[kune-commits] r990 - in trunk: . src/main/java/org/ourproject/kune/app/public/css src/main/java/org/ourproject/kune/platf/client/ui src/main/java/org/ourproject/kune/platf/server/content src/main/java/org/ourproject/kune/platf/server/domain src/test/java/org/ourproject/kune/platf/integration

vjrj vjrj at ourproject.org
Wed Dec 10 15:58:14 CET 2008


Author: vjrj
Date: 2008-12-10 15:58:11 +0100 (Wed, 10 Dec 2008)
New Revision: 990

Modified:
   trunk/INSTALL
   trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
   trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java
   trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManager.java
   trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManager.java
   trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/server/domain/Container.java
   trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java
Log:
Complete - task Case sensitive in title search 

Complete - task When empty doc show "Edit this doc" message

Complete - task Textbox instead of dialog in EditableIconLabel

Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL	2008-12-10 01:36:03 UTC (rev 989)
+++ trunk/INSTALL	2008-12-10 14:58:11 UTC (rev 990)
@@ -31,6 +31,7 @@
 You have to configure mysql to support UTF8 by editing your c:\Windows\my.ini or /etc/my.cnf (on Unix) file:
 [mysqld]
 default-character-set=utf8
+default-collation=utf8_general_ci
 
 Or do it per table:
 

Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css	2008-12-10 01:36:03 UTC (rev 989)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css	2008-12-10 14:58:11 UTC (rev 990)
@@ -41,4 +41,4 @@
     padding: 1px 0px 1px 1px;
     text-decoration:none;
 }
-*/.k-textlinethrough{text-decoration:line-through;color:red;}.k-textnormal{text-decoration:inherit;color:green;}.k-textunderline{text-decoration:underline;color:gray;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-basic-thumb{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-basic-thumb td{padding:2px 3px;border:none;}.k-text-gray{color:gray;}.k-elp-limg{margin-top:4px;margin-left:5px;cursor:pointer;}.k-tsp-tag{float:right;margin-right:5px;cursor:pointer;color:#00F;}.k-tsp-cloud{vertical-align:bottom;}.k-options-icon{background-image:url(img/emblem-system.gif)!important;}.x-toolbar-body table{/* width: 100%; */}.k-preview-msg{background:#FCA;}.k-preview-msg-lab{background:#FCA;padding:0 5px;}
\ No newline at end of file
+*/.k-textlinethrough{text-decoration:line-through;color:red;}.k-textnormal{text-decoration:inherit;color:green;}.k-textunderline{text-decoration:underline;color:gray;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-basic-thumb{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-basic-thumb td{padding:2px 3px;border:none;}.k-text-gray{color:gray;}.k-elp-limg{margin-top:4px;margin-left:5px;cursor:pointer;}.k-tsp-tag{float:right;margin-right:5px;cursor:pointer;color:#00F;}.k-tsp-cloud{vertical-align:bottom;}.k-options-icon{background-image:url(img/emblem-system.gif)!important;}.x-toolbar-body table{/* width: 100%; */}.k-preview-msg{background:#FCA;}.k-preview-msg-lab{background:#FCA;padding:0 5px;}.k-eil-edit{border:thin solid #000;}
\ No newline at end of file

Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css	2008-12-10 01:36:03 UTC (rev 989)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css	2008-12-10 14:58:11 UTC (rev 990)
@@ -828,3 +828,7 @@
     background: #FFCCAA;
     padding: 0 5px;
 }
+
+.k-eil-edit {
+    border: thin solid black;
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java	2008-12-10 01:36:03 UTC (rev 989)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java	2008-12-10 14:58:11 UTC (rev 990)
@@ -151,6 +151,7 @@
         String text = editor.getText();
         onEdit.fire(currentText, text);
         editor.setVisible(false);
+        editor.setReadOnly(true);
         label.setVisible(true);
         label.removeStyleDependentName("high");
     }
@@ -203,6 +204,7 @@
         label.setVisible(false);
         if (editor == null) {
             editor = new TextBox();
+            editor.setStyleName("k-eil-edit");
             hp.add(editor);
             editor.addFocusListener(new FocusListener() {
                 public void onFocus(Widget sender) {
@@ -218,7 +220,8 @@
                 }
             });
         }
-        editor.setPixelSize(hpWidth, 22);
+        editor.setReadOnly(false);
+        editor.setPixelSize(hpWidth < 40 ? 40 : hpWidth, 21);
         editor.setText(currentText);
         editor.setVisible(true);
         editor.setFocus(true);

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManager.java	2008-12-10 01:36:03 UTC (rev 989)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManager.java	2008-12-10 14:58:11 UTC (rev 990)
@@ -34,6 +34,8 @@
 
     Container find(Long id);
 
+    boolean findIfExistsTitle(Container container, String title);
+
     String renameFolder(Group group, Container container, String newName) throws DefaultException;
 
     SearchResult<Container> search(String search);

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java	2008-12-10 01:36:03 UTC (rev 989)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java	2008-12-10 14:58:11 UTC (rev 990)
@@ -86,6 +86,12 @@
         return persist(container);
     }
 
+    /** Duplicate code in ContentMD **/
+    public boolean findIfExistsTitle(Container container, String title) {
+        return (contentFinder.findIfExistsTitle(container, title) > 0)
+                || (containerFinder.findIfExistsTitle(container, title) > 0);
+    }
+
     public String renameFolder(final Group group, final Container container, final String newName)
             throws DefaultException {
         FilenameUtils.checkBasicFilename(newName);
@@ -122,12 +128,6 @@
     }
 
     /** Duplicate code in ContentMD **/
-    private boolean findIfExistsTitle(Container container, String title) {
-        return (contentFinder.findIfExistsTitle(container, title) > 0)
-                || (containerFinder.findIfExistsTitle(container, title) > 0);
-    }
-
-    /** Duplicate code in ContentMD **/
     private String findInexistentName(Container container, String title) {
         String initialTitle = new String(title);
         while (findIfExistsTitle(container, initialTitle)) {

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManager.java	2008-12-10 01:36:03 UTC (rev 989)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManager.java	2008-12-10 14:58:11 UTC (rev 990)
@@ -39,6 +39,8 @@
 
     void delContent(User user, Long contentId) throws DefaultException;
 
+    boolean findIfExistsTitle(Container container, String title);
+
     Double getRateAvg(Content content);
 
     Long getRateByUsers(Content content);

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java	2008-12-10 01:36:03 UTC (rev 989)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java	2008-12-10 14:58:11 UTC (rev 990)
@@ -109,6 +109,11 @@
         content.setDeletedOn(new Date());
     }
 
+    public boolean findIfExistsTitle(Container container, String title) {
+        return (contentFinder.findIfExistsTitle(container, title) > 0)
+                || (containerFinder.findIfExistsTitle(container, title) > 0);
+    }
+
     public Double getRateAvg(final Content content) {
         return finder.getRateAvg(content);
     }
@@ -235,11 +240,6 @@
         content.setTags(tagList);
     }
 
-    private boolean findIfExistsTitle(Container container, String title) {
-        return (contentFinder.findIfExistsTitle(container, title) > 0)
-                || (containerFinder.findIfExistsTitle(container, title) > 0);
-    }
-
     private String findInexistentTitle(Container container, String title) {
         String initialTitle = new String(title);
         while (findIfExistsTitle(container, initialTitle)) {

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Container.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Container.java	2008-12-10 01:36:03 UTC (rev 989)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Container.java	2008-12-10 14:58:11 UTC (rev 990)
@@ -25,6 +25,7 @@
 import java.util.Set;
 
 import javax.persistence.CascadeType;
+import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
@@ -58,6 +59,7 @@
     @DocumentId
     Long id;
 
+    @Column
     @Field(index = Index.TOKENIZED, store = Store.NO)
     private String name;
 
@@ -120,7 +122,7 @@
         contents.add(descriptor);
     }
 
-    @Finder(query = "SELECT COUNT(*) FROM Container c WHERE c.parent = :container AND c.name = :title")
+    @Finder(query = "SELECT COUNT(*) FROM Container c WHERE c.parent = :container AND c.name LIKE :title")
     public Long findIfExistsTitle(@Named("container") Container container, @Named("title") String title) {
         return null;
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java	2008-12-10 01:36:03 UTC (rev 989)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java	2008-12-10 14:58:11 UTC (rev 990)
@@ -164,7 +164,7 @@
         }
     }
 
-    @Finder(query = "select count(*) from Container ctx, Content ctn where ctn.container.id = ctx.id and ctx = :container and ctn.lastRevision.title = :title")
+    @Finder(query = "select count(*) from Container ctx, Content ctn where ctn.container.id = ctx.id and ctx = :container and ctn.lastRevision.title LIKE :title")
     public Long findIfExistsTitle(@Named("container") Container container, @Named("title") String title) {
         return null;
     }

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java	2008-12-10 01:36:03 UTC (rev 989)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java	2008-12-10 14:58:11 UTC (rev 990)
@@ -10,6 +10,8 @@
 import org.junit.Test;
 import org.ourproject.kune.chat.server.ChatServerTool;
 import org.ourproject.kune.docs.server.DocumentServerTool;
+import org.ourproject.kune.platf.server.content.ContainerManager;
+import org.ourproject.kune.platf.server.content.ContentManager;
 import org.ourproject.kune.platf.server.domain.Container;
 import org.ourproject.kune.platf.server.domain.Content;
 import org.ourproject.kune.platf.server.domain.Group;
@@ -33,9 +35,29 @@
     I18nLanguageManager languageManager;
     @Inject
     I18nCountryManager countryManager;
+    @Inject
+    ContentManager contentManager;
+    @Inject
+    ContainerManager containerManager;
 
     private Group defaultGroup;
 
+    /**
+     * If this test fails, see database configuration in INSTALL (the collation
+     * part) and http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html
+     * 
+     * Title must be created as something like `title` varchar(255) collate
+     * utf8_bin default NULL
+     * 
+     */
+    @Test
+    public void caseSensitive() {
+        Content defaultContent = defaultGroup.getDefaultContent();
+        assertTrue(contentManager.findIfExistsTitle(defaultContent.getContainer(), "Welcome to kune demo"));
+        assertTrue(!contentManager.findIfExistsTitle(defaultContent.getContainer(), "welcome to kune Demo"));
+        assertTrue(!contentManager.findIfExistsTitle(defaultContent.getContainer(), "Welcome to kune demo "));
+    }
+
     @Before
     public void init() {
         new IntegrationTestHelper(this);




More information about the kune-commits mailing list