[kune-commits] r1006 - in trunk/src/main: java/org/ourproject/kune/platf/server/domain rails/publicspace/app/controllers rails/publicspace/app/helpers rails/publicspace/app/models rails/publicspace/app/views rails/publicspace/app/views/contents rails/publicspace/app/views/kunedbg rails/publicspace/app/views/layouts rails/publicspace/config rails/publicspace/db/migrate rails/publicspace/test/fixtures rails/publicspace/test/functional rails/publicspace/test/unit

dani matas danigb at ourproject.org
Sat Dec 20 23:31:04 CET 2008


Author: danigb
Date: 2008-12-20 23:31:01 +0100 (Sat, 20 Dec 2008)
New Revision: 1006

Added:
   trunk/src/main/rails/publicspace/app/controllers/contents_controller.rb
   trunk/src/main/rails/publicspace/app/controllers/kunedbg_controller.rb
   trunk/src/main/rails/publicspace/app/helpers/contents_helper.rb
   trunk/src/main/rails/publicspace/app/helpers/kunedbg_helper.rb
   trunk/src/main/rails/publicspace/app/models/group.rb
   trunk/src/main/rails/publicspace/app/views/contents/
   trunk/src/main/rails/publicspace/app/views/contents/show.html.erb
   trunk/src/main/rails/publicspace/app/views/kunedbg/
   trunk/src/main/rails/publicspace/app/views/kunedbg/list.html.erb
   trunk/src/main/rails/publicspace/app/views/layouts/kunedbg.html.erb
   trunk/src/main/rails/publicspace/db/migrate/20081220215911_create_groups.rb
   trunk/src/main/rails/publicspace/test/fixtures/groups.yml
   trunk/src/main/rails/publicspace/test/functional/contents_controller_test.rb
   trunk/src/main/rails/publicspace/test/functional/kunedbg_controller_test.rb
   trunk/src/main/rails/publicspace/test/unit/group_test.rb
Removed:
   trunk/src/main/rails/publicspace/app/controllers/documents_controller.rb
   trunk/src/main/rails/publicspace/app/helpers/documents_helper.rb
   trunk/src/main/rails/publicspace/test/functional/documents_controller_test.rb
Modified:
   trunk/src/main/java/org/ourproject/kune/platf/server/domain/BasicMimeType.java
   trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nTranslation.java
   trunk/src/main/rails/publicspace/config/routes.rb
Log:
all "type" fields in database renamed. a new rails debug controller created.

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/BasicMimeType.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/BasicMimeType.java	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/BasicMimeType.java	2008-12-20 22:31:01 UTC (rev 1006)
@@ -20,37 +20,41 @@
 
 import javax.persistence.Embeddable;
 
+import org.hibernate.search.annotations.Field;
+
 @Embeddable
 public class BasicMimeType {
 
+    @Field(name = "mimetype")
     private String type;
+    @Field(name = "mimesubtype")
     private String subtype;
 
     public BasicMimeType() {
-        this(null, null);
+	this(null, null);
     }
 
     public BasicMimeType(final String mimetype) {
-        if (mimetype != null) {
-            final String[] split = mimetype.split("/", 2);
-            type = split[0];
-            if (split.length > 1 && split[1].length() > 0) {
-                subtype = split[1];
-            }
-        }
+	if (mimetype != null) {
+	    final String[] split = mimetype.split("/", 2);
+	    type = split[0];
+	    if (split.length > 1 && split[1].length() > 0) {
+		subtype = split[1];
+	    }
+	}
     }
 
     public BasicMimeType(final String type, final String subtype) {
-        this.type = type;
-        this.subtype = subtype;
+	this.type = type;
+	this.subtype = subtype;
     }
 
     public String getSubtype() {
-        return subtype;
+	return subtype;
     }
 
     public String getType() {
-        return type;
+	return type;
     }
 
     /**
@@ -59,7 +63,7 @@
      * @return
      */
     public boolean isImage() {
-        return type != null && type.equals("image");
+	return type != null && type.equals("image");
     }
 
     /**
@@ -68,7 +72,7 @@
      * @return
      */
     public boolean isPdf() {
-        return type != null && subtype != null && type.equals("application") && subtype.equals("pdf");
+	return type != null && subtype != null && type.equals("application") && subtype.equals("pdf");
     }
 
     /**
@@ -77,20 +81,20 @@
      * @return
      */
     public boolean isText() {
-        return type != null && subtype != null && type.equals("text") && subtype.equals("plain");
+	return type != null && subtype != null && type.equals("text") && subtype.equals("plain");
     }
 
     public void setSubtype(final String subtype) {
-        this.subtype = subtype;
+	this.subtype = subtype;
     }
 
     public void setType(final String type) {
-        this.type = type;
+	this.type = type;
     }
 
     @Override
     public String toString() {
-        return subtype == null ? type : type + "/" + subtype;
+	return subtype == null ? type : type + "/" + subtype;
     }
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nTranslation.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nTranslation.java	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nTranslation.java	2008-12-20 22:31:01 UTC (rev 1006)
@@ -48,10 +48,10 @@
 @Indexed
 @Table(name = "globalize_translations")
 @NamedQueries( {
-        @NamedQuery(name = "untranslated", query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :language and text=null"),
-        @NamedQuery(name = "translated", query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :language and text!=null"),
-        @NamedQuery(name = "untranslatedcount", query = "SELECT COUNT(gt.id) FROM I18nTranslation gt WHERE gt.language = :language and text=null"),
-        @NamedQuery(name = "translatedcount", query = "SELECT COUNT(gt.id) FROM I18nTranslation gt WHERE gt.language = :language and text!=null") })
+	@NamedQuery(name = "untranslated", query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :language and text=null"),
+	@NamedQuery(name = "translated", query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :language and text!=null"),
+	@NamedQuery(name = "untranslatedcount", query = "SELECT COUNT(gt.id) FROM I18nTranslation gt WHERE gt.language = :language and text=null"),
+	@NamedQuery(name = "translatedcount", query = "SELECT COUNT(gt.id) FROM I18nTranslation gt WHERE gt.language = :language and text!=null") })
 public class I18nTranslation implements HasId {
 
     public static final String DEF_NAMESPACE = "kune_core";
@@ -69,7 +69,7 @@
     @Column(name = "id", unique = true, nullable = false)
     private Long id;
 
-    @Column(name = "type")
+    @Column(name = "gtype")
     private String type;
 
     @Column(name = "tr_key")
@@ -95,157 +95,157 @@
     private String text;
 
     public I18nTranslation() {
-        this(null, null, null, null, null, null, null, null);
+	this(null, null, null, null, null, null, null, null);
     }
 
     public I18nTranslation(final String trKey, final I18nLanguage language, final String text) {
-        this("", null, DEF_PLUR_INDEX, "", text, trKey, DEF_NAMESPACE, language);
+	this("", null, DEF_PLUR_INDEX, "", text, trKey, DEF_NAMESPACE, language);
     }
 
     public I18nTranslation(final String facet, final Integer itemId, final Integer pluralizationIndex,
-            final String tableName, final String text, final String trKey, final String type,
-            final I18nLanguage language) {
-        this.type = type;
-        this.trKey = trKey;
-        this.tableName = tableName;
-        this.itemId = itemId;
-        this.facet = facet;
-        this.language = language;
-        this.pluralizationIndex = pluralizationIndex;
-        this.text = text;
+	    final String tableName, final String text, final String trKey, final String type,
+	    final I18nLanguage language) {
+	this.type = type;
+	this.trKey = trKey;
+	this.tableName = tableName;
+	this.itemId = itemId;
+	this.facet = facet;
+	this.language = language;
+	this.pluralizationIndex = pluralizationIndex;
+	this.text = text;
     }
 
     public I18nTranslation cloneForNewLanguage() {
-        final I18nTranslation clone = new I18nTranslation();
-        clone.type = type;
-        clone.trKey = trKey;
-        clone.tableName = tableName;
-        clone.itemId = itemId;
-        clone.facet = facet;
-        clone.language = null;
-        clone.pluralizationIndex = pluralizationIndex;
-        clone.text = null;
-        return clone;
+	final I18nTranslation clone = new I18nTranslation();
+	clone.type = type;
+	clone.trKey = trKey;
+	clone.tableName = tableName;
+	clone.itemId = itemId;
+	clone.facet = facet;
+	clone.language = null;
+	clone.pluralizationIndex = pluralizationIndex;
+	clone.text = null;
+	return clone;
     }
 
     @Finder(query = "SELECT gt FROM I18nTranslation gt JOIN gt.language gl WHERE gl.code = :language")
     public List<I18nTranslation> findByLanguage(@Named("language") final String language) {
-        return null;
+	return null;
     }
 
     public String getFacet() {
-        return this.facet;
+	return this.facet;
     }
 
     public Long getId() {
-        return this.id;
+	return this.id;
     }
 
     public Integer getItemId() {
-        return this.itemId;
+	return this.itemId;
     }
 
     public I18nLanguage getLanguage() {
-        return language;
+	return language;
     }
 
     @Finder(query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :deflanguage AND gt.trKey NOT IN (SELECT gt.trKey FROM I18nTranslation gt WHERE gt.language = :language)")
     public List<I18nTranslation> getNonExistentFromDefault(@Named("deflanguage") final I18nLanguage deflanguage,
-            @Named("language") final I18nLanguage language) {
-        return null;
+	    @Named("language") final I18nLanguage language) {
+	return null;
     }
 
     public Integer getPluralizationIndex() {
-        return this.pluralizationIndex;
+	return this.pluralizationIndex;
     }
 
     public String getTableName() {
-        return this.tableName;
+	return this.tableName;
     }
 
     public String getText() {
-        return this.text;
+	return this.text;
     }
 
     @Finder(namedQuery = TRANSLATED_QUERY)
     public List<I18nTranslation> getTranslatedLexicon(@Named("language") final I18nLanguage language) {
-        return null;
+	return null;
     }
 
     @Finder(namedQuery = TRANSLATED_QUERY)
     public List<I18nTranslation> getTranslatedLexicon(@Named("language") final I18nLanguage language,
-            @FirstResult final int first, @MaxResults final int max) {
-        return null;
+	    @FirstResult final int first, @MaxResults final int max) {
+	return null;
     }
 
     @Finder(namedQuery = TRANSLATED_COUNT_QUERY)
     public Long getTranslatedLexiconCount(@Named("language") final I18nLanguage language) {
-        return null;
+	return null;
     }
 
     public String getTrKey() {
-        return this.trKey;
+	return this.trKey;
     }
 
     public String getType() {
-        return this.type;
+	return this.type;
     }
 
     @Finder(namedQuery = UNTRANSLATED_QUERY)
     public List<I18nTranslation> getUnstranslatedLexicon(@Named("language") final I18nLanguage language) {
-        return null;
+	return null;
     }
 
     @Finder(namedQuery = UNTRANSLATED_QUERY)
     public List<I18nTranslation> getUnstranslatedLexicon(@Named("language") final I18nLanguage language,
-            @FirstResult final int first, @MaxResults final int max) {
-        return null;
+	    @FirstResult final int first, @MaxResults final int max) {
+	return null;
     }
 
     @Finder(namedQuery = UNTRANSLATED_COUNT_QUERY)
     public Long getUnstranslatedLexiconCount(@Named("language") final I18nLanguage language) {
-        return null;
+	return null;
     }
 
     public void setFacet(final String facet) {
-        this.facet = facet;
+	this.facet = facet;
     }
 
     public void setId(final Long id) {
-        this.id = id;
+	this.id = id;
     }
 
     public void setItemId(final Integer itemId) {
-        this.itemId = itemId;
+	this.itemId = itemId;
     }
 
     public void setLanguage(final I18nLanguage language) {
-        this.language = language;
+	this.language = language;
     }
 
     public void setPluralizationIndex(final Integer pluralizationIndex) {
-        this.pluralizationIndex = pluralizationIndex;
+	this.pluralizationIndex = pluralizationIndex;
     }
 
     public void setTableName(final String tableName) {
-        this.tableName = tableName;
+	this.tableName = tableName;
     }
 
     public void setText(final String text) {
-        this.text = text;
+	this.text = text;
     }
 
     public void setTrKey(final String trKey) {
-        this.trKey = trKey;
+	this.trKey = trKey;
     }
 
     public void setType(final String type) {
-        this.type = type;
+	this.type = type;
     }
 
     @Override
     public String toString() {
-        return "I18nTranslation[" + trKey + " (" + language + ") " + text + "]";
+	return "I18nTranslation[" + trKey + " (" + language + ") " + text + "]";
     }
 
 }

Added: trunk/src/main/rails/publicspace/app/controllers/contents_controller.rb
===================================================================
--- trunk/src/main/rails/publicspace/app/controllers/contents_controller.rb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/app/controllers/contents_controller.rb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -0,0 +1,10 @@
+class ContentsController < ApplicationController
+
+  def show
+    @group = Group.find_by_shortName!(params[:group])
+    @tool = params[:tool]
+    @folder = params[:folder]
+    @content = params[:content]
+  end
+
+end

Deleted: trunk/src/main/rails/publicspace/app/controllers/documents_controller.rb
===================================================================
--- trunk/src/main/rails/publicspace/app/controllers/documents_controller.rb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/app/controllers/documents_controller.rb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -1,5 +0,0 @@
-class DocumentsController < ApplicationController
-  def index
-    @contents = Content.find :all
-  end
-end

Added: trunk/src/main/rails/publicspace/app/controllers/kunedbg_controller.rb
===================================================================
--- trunk/src/main/rails/publicspace/app/controllers/kunedbg_controller.rb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/app/controllers/kunedbg_controller.rb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -0,0 +1,11 @@
+class KunedbgController < ApplicationController
+  layout 'kunedbg'
+  
+  def index
+    render :text => 'hola', :layout => true
+  end
+
+  def list
+    @models = Group.find :all
+  end
+end

Added: trunk/src/main/rails/publicspace/app/helpers/contents_helper.rb
===================================================================
--- trunk/src/main/rails/publicspace/app/helpers/contents_helper.rb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/app/helpers/contents_helper.rb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -0,0 +1,2 @@
+module ContentsHelper
+end

Deleted: trunk/src/main/rails/publicspace/app/helpers/documents_helper.rb
===================================================================
--- trunk/src/main/rails/publicspace/app/helpers/documents_helper.rb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/app/helpers/documents_helper.rb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -1,2 +0,0 @@
-module DocumentsHelper
-end

Added: trunk/src/main/rails/publicspace/app/helpers/kunedbg_helper.rb
===================================================================
--- trunk/src/main/rails/publicspace/app/helpers/kunedbg_helper.rb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/app/helpers/kunedbg_helper.rb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -0,0 +1,2 @@
+module KunedbgHelper
+end

Added: trunk/src/main/rails/publicspace/app/models/group.rb
===================================================================
--- trunk/src/main/rails/publicspace/app/models/group.rb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/app/models/group.rb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -0,0 +1,2 @@
+class Group < ActiveRecord::Base
+end

Added: trunk/src/main/rails/publicspace/app/views/contents/show.html.erb
===================================================================
--- trunk/src/main/rails/publicspace/app/views/contents/show.html.erb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/app/views/contents/show.html.erb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -0,0 +1,7 @@
+<h1>Contenido</h1>
+
+<%= @tool %><br/>
+<%= @group %><br/>
+<%= @folder %><br/>
+<%= @content %><br/>
+

Added: trunk/src/main/rails/publicspace/app/views/kunedbg/list.html.erb
===================================================================
--- trunk/src/main/rails/publicspace/app/views/kunedbg/list.html.erb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/app/views/kunedbg/list.html.erb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -0,0 +1,10 @@
+
+<table>
+  <thead>
+
+  </thead>
+  <tbody>
+    <% for model in @models %>
+    <% end %>
+  </tbody>
+</table>
\ No newline at end of file

Added: trunk/src/main/rails/publicspace/app/views/layouts/kunedbg.html.erb
===================================================================
--- trunk/src/main/rails/publicspace/app/views/layouts/kunedbg.html.erb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/app/views/layouts/kunedbg.html.erb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <link rel="icon" href="images/xy/favicon.ico" type="image/x-icon">
+    <title>kune debug page</title>
+    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
+    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/reset/reset-min.css"> 
+    <style type="text/css">
+      body {background-color: #efefef;}
+      h1 {font-size: 150%;}
+      .page {width: 60em; margin: 1em auto; background-color: white; border: 1px solid gray;}
+
+    </style>
+  </head>
+  <body>
+    <div class="page">
+      <ul class="menu"><li><%= link_to 'grupos', :action => 'list', :model => 'Group' %></li></ul>
+      <div class="content">
+    <%= yield %>
+      </div>
+    </div>
+  </body>
+</html>

Modified: trunk/src/main/rails/publicspace/config/routes.rb
===================================================================
--- trunk/src/main/rails/publicspace/config/routes.rb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/config/routes.rb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -1,5 +1,6 @@
 ActionController::Routing::Routes.draw do |map|
-  map.root :controller => 'documents'
-  map.connect '/public/:controller/:action/:id'
-  map.connect '/public/:controller/:action/:id.:format'
+  map.root :controller => 'kunedbg'
+  map.connect 'public/:group/:tool/:folder/:content', :controller => 'contents', :action => 'show'
+  map.connect '/public/debug/:action/:id', :controller => 'kunedbg'
+  #map.connect '/public/:controller/:action/:id.:format'
 end

Added: trunk/src/main/rails/publicspace/db/migrate/20081220215911_create_groups.rb
===================================================================
--- trunk/src/main/rails/publicspace/db/migrate/20081220215911_create_groups.rb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/db/migrate/20081220215911_create_groups.rb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -0,0 +1,12 @@
+class CreateGroups < ActiveRecord::Migration
+  def self.up
+    create_table :groups do |t|
+
+      t.timestamps
+    end
+  end
+
+  def self.down
+    drop_table :groups
+  end
+end

Added: trunk/src/main/rails/publicspace/test/fixtures/groups.yml
===================================================================
--- trunk/src/main/rails/publicspace/test/fixtures/groups.yml	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/test/fixtures/groups.yml	2008-12-20 22:31:01 UTC (rev 1006)
@@ -0,0 +1,7 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+# one:
+#   column: value
+#
+# two:
+#   column: value

Added: trunk/src/main/rails/publicspace/test/functional/contents_controller_test.rb
===================================================================
--- trunk/src/main/rails/publicspace/test/functional/contents_controller_test.rb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/test/functional/contents_controller_test.rb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class ContentsControllerTest < ActionController::TestCase
+  # Replace this with your real tests.
+  test "the truth" do
+    assert true
+  end
+end

Deleted: trunk/src/main/rails/publicspace/test/functional/documents_controller_test.rb
===================================================================
--- trunk/src/main/rails/publicspace/test/functional/documents_controller_test.rb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/test/functional/documents_controller_test.rb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class DocumentsControllerTest < ActionController::TestCase
-  # Replace this with your real tests.
-  test "the truth" do
-    assert true
-  end
-end

Added: trunk/src/main/rails/publicspace/test/functional/kunedbg_controller_test.rb
===================================================================
--- trunk/src/main/rails/publicspace/test/functional/kunedbg_controller_test.rb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/test/functional/kunedbg_controller_test.rb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class KunedbgControllerTest < ActionController::TestCase
+  # Replace this with your real tests.
+  test "the truth" do
+    assert true
+  end
+end

Added: trunk/src/main/rails/publicspace/test/unit/group_test.rb
===================================================================
--- trunk/src/main/rails/publicspace/test/unit/group_test.rb	2008-12-20 22:06:41 UTC (rev 1005)
+++ trunk/src/main/rails/publicspace/test/unit/group_test.rb	2008-12-20 22:31:01 UTC (rev 1006)
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class GroupTest < ActiveSupport::TestCase
+  # Replace this with your real tests.
+  test "the truth" do
+    assert true
+  end
+end




More information about the kune-commits mailing list