[kune-commits] r1485 - in trunk: img src/main/java/cc/kune src/main/java/cc/kune/barters/client src/main/java/cc/kune/barters/server src/main/java/cc/kune/blogs/client src/main/java/cc/kune/blogs/server src/main/java/cc/kune/blogs/shared src/main/java/cc/kune/chat/client src/main/java/cc/kune/chat/server src/main/java/cc/kune/chat/shared src/main/java/cc/kune/client src/main/java/cc/kune/core/client/resources/nav src/main/java/cc/kune/core/server src/main/java/cc/kune/docs/client src/main/java/cc/kune/docs/client/actions src/main/java/cc/kune/docs/server src/main/java/cc/kune/domain src/main/java/cc/kune/gspace/client/tool src/main/java/cc/kune/meets/client src/main/java/cc/kune/meets/server src/main/java/cc/kune/tasks src/main/java/cc/kune/tasks/client src/main/java/cc/kune/tasks/client/actions src/main/java/cc/kune/tasks/server src/main/java/cc/kune/tasks/shared src/main/java/cc/kune/wiki/client src/main/java/cc/kune/wiki/server src/test/java/cc/kune/blogs/server src/test/java/cc/kune/docs/server src/test/java/cc/kune/wiki/server

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Mon Aug 8 01:07:05 CEST 2011


Author: vjrj_
Date: 2011-08-08 01:07:04 +0200 (Mon, 08 Aug 2011)
New Revision: 1485

Added:
   trunk/src/main/java/cc/kune/core/client/resources/nav/task.png
   trunk/src/main/java/cc/kune/core/client/resources/nav/taskadd.png
   trunk/src/main/java/cc/kune/core/server/AbstractServerTool.java
   trunk/src/main/java/cc/kune/tasks/
   trunk/src/main/java/cc/kune/tasks/KuneTasks.gwt.xml
   trunk/src/main/java/cc/kune/tasks/client/
   trunk/src/main/java/cc/kune/tasks/client/TasksClientTool.java
   trunk/src/main/java/cc/kune/tasks/client/TasksGinModule.java
   trunk/src/main/java/cc/kune/tasks/client/TasksGinjector.java
   trunk/src/main/java/cc/kune/tasks/client/TasksParts.java
   trunk/src/main/java/cc/kune/tasks/client/actions/
   trunk/src/main/java/cc/kune/tasks/client/actions/AbstractOptionsMenu.java
   trunk/src/main/java/cc/kune/tasks/client/actions/DelFolderMenuItem.java
   trunk/src/main/java/cc/kune/tasks/client/actions/DelTaskMenuItem.java
   trunk/src/main/java/cc/kune/tasks/client/actions/GoParentFolderBtn.java
   trunk/src/main/java/cc/kune/tasks/client/actions/NewFolderBtn.java
   trunk/src/main/java/cc/kune/tasks/client/actions/NewTaskIconBtn.java
   trunk/src/main/java/cc/kune/tasks/client/actions/NewTaskMenuItem.java
   trunk/src/main/java/cc/kune/tasks/client/actions/OpenFolderMenuItem.java
   trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java
   trunk/src/main/java/cc/kune/tasks/client/actions/TasksNewMenu.java
   trunk/src/main/java/cc/kune/tasks/server/
   trunk/src/main/java/cc/kune/tasks/server/TaskServerModule.java
   trunk/src/main/java/cc/kune/tasks/server/TaskServerTool.java
   trunk/src/main/java/cc/kune/tasks/shared/
   trunk/src/main/java/cc/kune/tasks/shared/TasksConstants.java
   trunk/src/test/java/cc/kune/blogs/server/TaskServerToolTest.java
Removed:
   trunk/src/test/java/cc/kune/blogs/server/BlogServerToolTest.java
Modified:
   trunk/img/icons-base.svg
   trunk/src/main/java/cc/kune/Kune.gwt.xml
   trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java
   trunk/src/main/java/cc/kune/barters/server/BarterServerTool.java
   trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java
   trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java
   trunk/src/main/java/cc/kune/blogs/shared/BlogsConstants.java
   trunk/src/main/java/cc/kune/chat/client/ChatClientTool.java
   trunk/src/main/java/cc/kune/chat/server/ChatServerModule.java
   trunk/src/main/java/cc/kune/chat/server/ChatServerTool.java
   trunk/src/main/java/cc/kune/chat/shared/ChatConstants.java
   trunk/src/main/java/cc/kune/client/KuneEntryPoint.java
   trunk/src/main/java/cc/kune/client/KuneGinjector.java
   trunk/src/main/java/cc/kune/core/client/resources/nav/NavResources.java
   trunk/src/main/java/cc/kune/core/server/KuneRackModule.java
   trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java
   trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
   trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java
   trunk/src/main/java/cc/kune/domain/Content.java
   trunk/src/main/java/cc/kune/gspace/client/tool/FoldableAbstractClientTool.java
   trunk/src/main/java/cc/kune/meets/client/MeetingsClientTool.java
   trunk/src/main/java/cc/kune/meets/server/MeetingServerTool.java
   trunk/src/main/java/cc/kune/wiki/client/WikiClientTool.java
   trunk/src/main/java/cc/kune/wiki/server/WikiServerTool.java
   trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java
   trunk/src/test/java/cc/kune/wiki/server/WikiServerToolTest.java
Log:
NEW - # 79: I18n refactorization 
http://kune.ourproject.org/issues/ticket/79
NEW - # 88: Task tool 
http://kune.ourproject.org/issues/ticket/88

Modified: trunk/img/icons-base.svg
===================================================================
--- trunk/img/icons-base.svg	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/img/icons-base.svg	2011-08-07 23:07:04 UTC (rev 1485)
@@ -14,7 +14,7 @@
    height="297mm"
    id="svg21019"
    sodipodi:version="0.32"
-   inkscape:version="0.48.0 r9654"
+   inkscape:version="0.48.1 r9760"
    sodipodi:docname="icons-base.svg"
    inkscape:output_extension="org.inkscape.output.svg.inkscape"
    inkscape:export-filename="/tmp/buttons.png"
@@ -29,8 +29,8 @@
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="1"
-     inkscape:cx="71"
-     inkscape:cy="807.5"
+     inkscape:cx="268"
+     inkscape:cy="359"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      inkscape:window-width="1278"
@@ -56,7 +56,8 @@
        type="xygrid"
        id="GridFromPre046Settings"
        visible="true"
-       enabled="true" />
+       enabled="true"
+       snapvisiblegridlinesonly="true" />
   </sodipodi:namedview>
   <defs
      id="defs21021">
@@ -4692,11 +4693,11 @@
     <image
        sodipodi:absref="/home/vjrj/proyectos/dev/kune/trunk/img/icons/lock_break.png"
        xlink:href="icons/lock_break.png"
-       y="450.82797"
+       width="16"
+       height="16"
+       id="image2972"
        x="330.84604"
-       id="image2972"
-       height="16"
-       width="16" />
+       y="450.82797" />
     <use
        x="0"
        y="0"
@@ -4787,12 +4788,12 @@
     <image
        sodipodi:absref="/home/vjrj/proyectos/dev/kune/trunk/img/icons/lock_break.png"
        xlink:href="icons/lock_break.png"
-       y="432.36218"
+       transform="scale(-1,1)"
+       width="16"
+       height="16"
+       id="image3958"
        x="-371"
-       id="image3958"
-       height="16"
-       width="16"
-       transform="scale(-1,1)" />
+       y="432.36218" />
     <g
        id="g3962"
        transform="translate(-43.509019,-21.462476)">
@@ -5368,5 +5369,120 @@
        width="8.7500134"
        id="rect3579"
        style="fill:url(#radialGradient4374);fill-opacity:1;stroke:#c83737;stroke-width:1.24998641000000021;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+    <image
+       y="520.36218"
+       x="445"
+       id="image4719"
+       xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAdNJREFU
+OI2Vk7FrU1EUxn/3vbSCJDGN1JQMhSIGXFy0amIE0RJwdtAhOBRFbR3ExUGXgjgIjvoPNIO7m6hL
+1S66OCmRUqjRSEJeb2zQRu85DqGPvMRAPdO937nnx/k+uIaBKpfLxve9587JXL/u+94L56RUqVS0
+XzcAN+fMFQMPFSYUDzt1iXz+CJ5nABBRVlc/sK/+FIMAtFT11uOXLJuFs8R8zwQXzhyMf+lmeRfk
+aNkuMzPTGLMDENbXN0glxzma+syUv8Gz12tWVNMxIO55Zmw85vO+kWPp/iOCIKBarUaszc8fIp1O
+c+/ubS5mvyGqcWA81v+osw3JZBJVYXb22GA8JBIJtv+AUxNqIUA1kg0rb95G7sVCfggYAQzW6VOF
+8KwqiLjRAP1HY2cDVUVFyJ88/n8bFAt5RAQRQVWw1jI5mdkdoH9QpDfc/tHe/QYiLoTUvtZoNhtD
+IUcBAz3neoB229JsNCiVzo9yijdqA2s3qX+vIyKhfn3hKpenV0Zb2DumtIIWmUyWTCZLLncYazdR
+FW4sXguHfaMRwJaI/u78cntOpD7yYOkOP91wNMX9n1jrHAAgpTWMMVuq2jUAi+d6vxHDxEizfaXa
++41PXrH8F0/m4ZhJIciYAAAAAElFTkSuQmCC
+"
+       height="16"
+       width="16" />
+    <path
+       inkscape:connector-curvature="0"
+       style="color:#000000;fill:#d40000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.0625;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+       d="m 460.54725,523.36218 -5.61351,5.05002 -1.81751,-2.09221 -2.22424,2.28085 c 1.60629,1.4242 2.80319,2.43911 4.13653,3.80876 2.24198,-2.10143 4.53857,-3.76628 6.97148,-5.34924 -0.3707,-1.58182 -0.85095,-2.67256 -1.45275,-3.69818 z"
+       id="path3563-5"
+       sodipodi:nodetypes="ccccccc"
+       inkscape:export-filename="/home/vjrj/proyectos/dev/kune/trunk/img/icons/checked.png"
+       inkscape:export-xdpi="90"
+       inkscape:export-ydpi="90" />
+    <path
+       inkscape:export-ydpi="90"
+       inkscape:export-xdpi="90"
+       inkscape:export-filename="/home/vjrj/proyectos/dev/kune/trunk/img/icons/checked.png"
+       sodipodi:nodetypes="ccccccc"
+       id="path5217"
+       d="m 272.19758,498.71675 -5.61351,5.05002 -1.81751,-2.09221 -2.22424,2.28085 c 1.60629,1.4242 2.80319,2.43911 4.13653,3.80876 2.24198,-2.10143 4.53857,-3.76628 6.97148,-5.34924 -0.3707,-1.58182 -0.85095,-2.67256 -1.45275,-3.69818 z"
+       style="color:#000000;fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.06250000000000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+       inkscape:connector-curvature="0" />
+    <rect
+       style="fill:none;stroke:#c83737;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;opacity:0.71000002"
+       id="rect5219"
+       width="14"
+       height="13.999999"
+       x="261"
+       y="496.36218"
+       ry="2.5"
+       inkscape:export-filename="/home/vjrj/proyectos/dev/kune/trunk/img/icons/checked.png"
+       inkscape:export-xdpi="90"
+       inkscape:export-ydpi="90"
+       rx="2.5" />
+    <image
+       y="504.36218"
+       x="268"
+       id="image7247"
+       xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAQZJREFU
+OI1j/P//PwMlgIki3cPDABZsggVTo2r+M/wv+/HrO+/nbx8/f/jyrmtb+8UWbGoZ0WMhc0JQg6SM
+QL2xpgmDjJAqw/6rGxhOXDnM8ODOm94TU56VEPTC1x+fyw009Bn+Mv1l0Jd0ZfjL+JvBQteKgYGB
+IRubCzAMeP/lLQcrIw+Dn2YuAwMDA0Ox8ywGZTE9BgYGBg6iDHj78dWPq8+OMXTsTmRgYGBg6NiV
+yHD31SUGBgaGH0QZ8O//v94Tl44xsDGwMGy+PI2BjZGF4ciFgwwMDAxTsRmAEYgMDAwMFjlSHQwM
+DFkMDAy8DAwMnxkYGKadmPKsgmgDSAEDnxIpNgAAJ+ZYJkBPdSwAAAAASUVORK5CYII=
+"
+       height="16"
+       width="16" />
+    <path
+       inkscape:connector-curvature="0"
+       style="color:#000000;fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.0625;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+       d="m 272.19758,658.71675 -5.61351,5.05002 -1.81751,-2.09221 -2.22424,2.28085 c 1.60629,1.4242 2.80319,2.43911 4.13653,3.80876 2.24198,-2.10143 4.53857,-3.76628 6.97148,-5.34924 -0.3707,-1.58182 -0.85095,-2.67256 -1.45275,-3.69818 z"
+       id="path7250"
+       sodipodi:nodetypes="ccccccc"
+       inkscape:export-filename="/home/vjrj/proyectos/dev/kune/trunk/img/icons/checked.png"
+       inkscape:export-xdpi="90"
+       inkscape:export-ydpi="90" />
+    <rect
+       rx="2.5"
+       inkscape:export-ydpi="90"
+       inkscape:export-xdpi="90"
+       inkscape:export-filename="/home/vjrj/proyectos/dev/kune/trunk/src/main/java/cc/kune/core/client/resources/nav/taskadd.png"
+       ry="2.5"
+       y="656.36218"
+       x="261"
+       height="13.999999"
+       width="14"
+       id="rect7252"
+       style="opacity:1;fill:none;stroke:#aa4400;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+    <image
+       width="16"
+       height="16"
+       xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAQZJREFU
+OI1j/P//PwMlgIki3cPDABZsggVTo2r+M/wv+/HrO+/nbx8/f/jyrmtb+8UWbGoZ0WMhc0JQg6SM
+QL2xpgmDjJAqw/6rGxhOXDnM8ODOm94TU56VEPTC1x+fyw009Bn+Mv1l0Jd0ZfjL+JvBQteKgYGB
+IRubCzAMeP/lLQcrIw+Dn2YuAwMDA0Ox8ywGZTE9BgYGBg6iDHj78dWPq8+OMXTsTmRgYGBg6NiV
+yHD31SUGBgaGH0QZ8O//v94Tl44xsDGwMGy+PI2BjZGF4ciFgwwMDAxTsRmAEYgMDAwMFjlSHQwM
+DFkMDAy8DAwMnxkYGKadmPKsgmgDSAEDnxIpNgAAJ+ZYJkBPdSwAAAAASUVORK5CYII=
+"
+       id="image7254"
+       x="265"
+       y="659.36218" />
+    <path
+       inkscape:export-ydpi="90"
+       inkscape:export-xdpi="90"
+       inkscape:export-filename="/home/vjrj/proyectos/dev/kune/trunk/src/main/java/cc/kune/core/client/resources/nav/task.png"
+       sodipodi:nodetypes="ccccccc"
+       id="path7256"
+       d="m 272.19758,688.71675 -5.61351,5.05002 -1.81751,-2.09221 -2.22424,2.28085 c 1.60629,1.4242 2.80319,2.43911 4.13653,3.80876 2.24198,-2.10143 4.53857,-3.76628 6.97148,-5.34924 -0.3707,-1.58182 -0.85095,-2.67256 -1.45275,-3.69818 z"
+       style="color:#000000;fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.0625;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+       inkscape:connector-curvature="0" />
+    <rect
+       style="fill:none;stroke:#aa4400;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+       id="rect7258"
+       width="14"
+       height="13.999999"
+       x="261"
+       y="686.36218"
+       ry="2.5"
+       inkscape:export-filename="/home/vjrj/proyectos/dev/kune/trunk/src/main/java/cc/kune/core/client/resources/nav/task.png"
+       inkscape:export-xdpi="90"
+       inkscape:export-ydpi="90"
+       rx="2.5" />
   </g>
 </svg>

Modified: trunk/src/main/java/cc/kune/Kune.gwt.xml
===================================================================
--- trunk/src/main/java/cc/kune/Kune.gwt.xml	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/Kune.gwt.xml	2011-08-07 23:07:04 UTC (rev 1485)
@@ -11,6 +11,7 @@
   <inherits name="cc.kune.docs.KuneDocs"/>
   <inherits name="cc.kune.wiki.KuneWiki"/>
   <inherits name="cc.kune.meets.KuneMeets"/>
+  <inherits name="cc.kune.tasks.KuneTasks"/>
   <inherits name="cc.kune.pspace.PSpace"/>
   <inherits name="com.calclab.suco.Suco"/>
   <inherits name="org.adamtacy.GWTEffects"></inherits>

Modified: trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -23,9 +23,9 @@
 import static cc.kune.barters.shared.BartersConstants.TYPE_BARTER;
 import static cc.kune.barters.shared.BartersConstants.TYPE_FOLDER;
 import static cc.kune.barters.shared.BartersConstants.TYPE_ROOT;
-import cc.kune.core.client.i18n.I18nUITranslationService;
 import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
 import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.tool.FoldableAbstractClientTool;
 import cc.kune.gspace.client.tool.selector.ToolSelector;
 
@@ -33,13 +33,10 @@
 
 public class BartersClientTool extends FoldableAbstractClientTool {
 
-  private final NavResources navResources;
-
   @Inject
-  public BartersClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
+  public BartersClientTool(final I18nTranslationService i18n, final ToolSelector toolSelector,
       final ContentCapabilitiesRegistry cntCapRegistry, final NavResources navResources) {
-    super(NAME, i18n.t("barters"), toolSelector, cntCapRegistry);
-    this.navResources = navResources;
+    super(NAME, i18n.t("barters"), toolSelector, cntCapRegistry, i18n, navResources);
 
     // registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
     registerAuthorableTypes(TYPE_BARTER);
@@ -62,8 +59,8 @@
     registerContentTypeIcon(TYPE_FOLDER, navResources.folder());
     registerContentTypeIcon(TYPE_ROOT, navResources.folder());
     registerContentTypeIcon(TYPE_BARTER, navResources.barter());
-    registerEmptyMessages(TYPE_FOLDER, "There folder is empty");
-    registerEmptyMessages(TYPE_ROOT, "There isn't any barter");
+    registerEmptyMessages(TYPE_FOLDER, i18n.t("There folder is empty"));
+    registerEmptyMessages(TYPE_ROOT, i18n.t("There isn't any barter"));
   }
 
 }

Modified: trunk/src/main/java/cc/kune/barters/server/BarterServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/barters/server/BarterServerTool.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/barters/server/BarterServerTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -26,14 +26,13 @@
 import static cc.kune.barters.shared.BartersConstants.TYPE_ROOT;
 
 import java.net.URL;
+import java.util.Arrays;
 import java.util.Date;
 
-import cc.kune.core.client.errors.ContainerNotPermittedException;
-import cc.kune.core.client.errors.ContentNotPermittedException;
+import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
 import cc.kune.core.server.manager.ToolConfigurationManager;
-import cc.kune.core.server.tool.ServerToolRegistry;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.server.tool.ServerWaveTool;
 import cc.kune.core.server.utils.UrlUtils;
@@ -44,128 +43,54 @@
 import cc.kune.domain.Container;
 import cc.kune.domain.Content;
 import cc.kune.domain.Group;
-import cc.kune.domain.ToolConfiguration;
 import cc.kune.domain.User;
 
 import com.google.inject.Inject;
 
-public class BarterServerTool implements ServerWaveTool {
+public class BarterServerTool extends AbstractServerTool implements ServerWaveTool {
 
   private static final String BARTER_GADGET = "http://troco.ourproject.org/gadget/org.ourproject.troco.client.TrocoWaveGadget.gadget.xml";
-  private final ToolConfigurationManager configurationManager;
-  private final ContainerManager containerManager;
-  private final ContentManager contentManager;
   private final URL gadgetUrl;
-  private final I18nTranslationService i18n;
 
   @Inject
   public BarterServerTool(final ContentManager contentManager, final ContainerManager containerManager,
-      final ToolConfigurationManager configurationManager,
-      final I18nTranslationService translationService) {
-    this.contentManager = contentManager;
-    this.containerManager = containerManager;
-    this.configurationManager = configurationManager;
-    this.i18n = translationService;
+      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n) {
+    super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_BARTER), Arrays.asList(TYPE_ROOT, TYPE_FOLDER),
+        Arrays.asList(TYPE_FOLDER), Arrays.asList(TYPE_ROOT, TYPE_FOLDER), contentManager,
+        containerManager, configurationManager, i18n, ServerToolTarget.forUsers);
     gadgetUrl = UrlUtils.of(BARTER_GADGET);
   }
 
-  void checkContainerTypeId(final String parentTypeId, final String typeId) {
-    if (typeId.equals(TYPE_FOLDER)) {
-      // ok valid container
-      if ((typeId.equals(TYPE_FOLDER) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))) {
-        // ok
-      } else {
-        throw new ContainerNotPermittedException();
-      }
-    } else {
-      throw new ContainerNotPermittedException();
-    }
-  }
-
-  void checkContentTypeId(final String parentTypeId, final String typeId) {
-    if (typeId.equals(TYPE_BARTER)) {
-      // ok valid content
-      final boolean parentIsFolderOrRoot = parentTypeId.equals(TYPE_ROOT)
-          || parentTypeId.equals(TYPE_FOLDER);
-      if ((typeId.equals(TYPE_BARTER) && parentIsFolderOrRoot)) {
-        // ok
-      } else {
-        throw new ContentNotPermittedException();
-      }
-    } else {
-      throw new ContentNotPermittedException();
-    }
-  }
-
   @Override
-  public void checkTypesBeforeContainerCreation(final String parentTypeId, final String typeId) {
-    checkContainerTypeId(parentTypeId, typeId);
-  }
-
-  @Override
-  public void checkTypesBeforeContentCreation(final String parentTypeId, final String typeId) {
-    checkContentTypeId(parentTypeId, typeId);
-  }
-
-  @Override
   public URL getGadgetUrl() {
     return gadgetUrl;
   }
 
   @Override
-  public String getName() {
-    return NAME;
-  }
-
-  @Override
-  public String getRootName() {
-    return ROOT_NAME;
-  }
-
-  @Override
-  public ServerToolTarget getTarget() {
-    return ServerToolTarget.forUsers;
-  }
-
-  @Override
   public Group initGroup(final User user, final Group group, final Object... otherVars) {
-    final ToolConfiguration config = new ToolConfiguration();
-    final Container rootFolder = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
-    setContainerBartersAcl(rootFolder);
-    config.setRoot(rootFolder);
-    group.setToolConfig(NAME, config);
-    configurationManager.persist(config);
-    final Content content = contentManager.createContent(
-        i18n.t("Barter sample"),
-        i18n.t("This is only a barter sample. You can invite other participants to this barter, but also publish to the general public allowing you to share services, goods, etc."),
-        user, rootFolder, TYPE_BARTER, gadgetUrl);
-    content.addAuthor(user);
-    content.setLanguage(user.getLanguage());
-    content.setTypeId(TYPE_BARTER);
-    content.setStatus(ContentStatus.publishedOnline);
+    final Container rootFolder = createRoot(group);
+    setContainerAcl(rootFolder);
+    final Content content = createInitialContent(user, group, rootFolder, i18n.t("Barter sample"),
+        i18n.t("This is only a barter sample. You can invite other participants to this barter, "
+            + "but also publish to the general public allowing you to share services, goods, etc."),
+        TYPE_BARTER, gadgetUrl);
     contentManager.save(content);
     return group;
   }
 
   @Override
   public void onCreateContainer(final Container container, final Container parent) {
-    setContainerBartersAcl(container);
+    setContainerAcl(container);
   }
 
   @Override
   public void onCreateContent(final Content content, final Container parent) {
-    // addGadget(content);
     content.setStatus(ContentStatus.publishedOnline);
     content.setPublishedOn(new Date());
   }
 
   @Override
-  @Inject
-  public void register(final ServerToolRegistry registry) {
-    registry.register(this);
-  }
-
-  private void setContainerBartersAcl(final Container container) {
+  protected void setContainerAcl(final Container container) {
     final AccessLists bartersAcl = new AccessLists();
     bartersAcl.getAdmins().setMode(GroupListMode.NORMAL);
     bartersAcl.getAdmins().add(container.getOwner());

Modified: trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -24,9 +24,10 @@
 import static cc.kune.blogs.shared.BlogsConstants.TYPE_POST;
 import static cc.kune.blogs.shared.BlogsConstants.TYPE_ROOT;
 import static cc.kune.blogs.shared.BlogsConstants.TYPE_UPLOADEDFILE;
-import cc.kune.core.client.i18n.I18nUITranslationService;
+import cc.kune.blogs.shared.BlogsConstants;
 import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
 import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.tool.FoldableAbstractClientTool;
 import cc.kune.gspace.client.tool.selector.ToolSelector;
 
@@ -34,13 +35,10 @@
 
 public class BlogsClientTool extends FoldableAbstractClientTool {
 
-  private final NavResources navResources;
-
   @Inject
-  public BlogsClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
+  public BlogsClientTool(final I18nTranslationService i18n, final ToolSelector toolSelector,
       final ContentCapabilitiesRegistry cntCapRegistry, final NavResources navResources) {
-    super(NAME, i18n.t("blogs"), toolSelector, cntCapRegistry);
-    this.navResources = navResources;
+    super(NAME, i18n.t(BlogsConstants.ROOT_NAME), toolSelector, cntCapRegistry, i18n, navResources);
 
     // registerAclEditableTypes();
     registerAuthorableTypes(TYPE_POST, TYPE_UPLOADEDFILE);
@@ -64,8 +62,8 @@
     registerContentTypeIcon(TYPE_BLOG, navResources.blog());
     registerContentTypeIcon(TYPE_POST, navResources.post());
     registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
-    registerEmptyMessages(TYPE_ROOT, "There isn't any blog, create one");
-    registerEmptyMessages(TYPE_BLOG, "This blog hasn't any post, create one");
+    registerEmptyMessages(TYPE_ROOT, i18n.t("There isn't any blog, create one"));
+    registerEmptyMessages(TYPE_BLOG, i18n.t("This blog hasn't any post, create one"));
   }
 
 }

Modified: trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -20,136 +20,49 @@
 package cc.kune.blogs.server;
 
 import static cc.kune.blogs.shared.BlogsConstants.NAME;
+import static cc.kune.blogs.shared.BlogsConstants.ROOT_NAME;
 import static cc.kune.blogs.shared.BlogsConstants.TYPE_BLOG;
 import static cc.kune.blogs.shared.BlogsConstants.TYPE_POST;
 import static cc.kune.blogs.shared.BlogsConstants.TYPE_ROOT;
 import static cc.kune.blogs.shared.BlogsConstants.TYPE_UPLOADEDFILE;
-import cc.kune.core.client.errors.ContainerNotPermittedException;
-import cc.kune.core.client.errors.ContentNotPermittedException;
+
+import java.util.Arrays;
+
+import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
 import cc.kune.core.server.manager.ToolConfigurationManager;
-import cc.kune.core.server.tool.ServerTool;
-import cc.kune.core.server.tool.ServerToolRegistry;
 import cc.kune.core.server.tool.ServerToolTarget;
-import cc.kune.core.shared.domain.ContentStatus;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.domain.Container;
 import cc.kune.domain.Content;
 import cc.kune.domain.Group;
 import cc.kune.domain.I18nLanguage;
-import cc.kune.domain.ToolConfiguration;
 import cc.kune.domain.User;
 
 import com.google.inject.Inject;
 
-public class BlogServerTool implements ServerTool {
+public class BlogServerTool extends AbstractServerTool {
 
-  public static final String ROOT_NAME = "blogs";
-
-  private final ToolConfigurationManager configurationManager;
-  private final ContainerManager containerManager;
-  private final ContentManager contentManager;
-  private final I18nTranslationService i18n;
-
   @Inject
   public BlogServerTool(final ContentManager contentManager, final ContainerManager containerManager,
-      final ToolConfigurationManager configurationManager,
-      final I18nTranslationService translationService) {
-    this.contentManager = contentManager;
-    this.containerManager = containerManager;
-    this.configurationManager = configurationManager;
-    this.i18n = translationService;
+      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n) {
+    super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_POST, TYPE_UPLOADEDFILE),
+        Arrays.asList(TYPE_BLOG), Arrays.asList(TYPE_BLOG), Arrays.asList(TYPE_ROOT), contentManager,
+        containerManager, configurationManager, i18n, ServerToolTarget.forBoth);
   }
 
-  void checkContainerTypeId(final String parentTypeId, final String typeId) {
-    if (typeId.equals(TYPE_BLOG)) {
-      // ok valid container
-      if ((typeId.equals(TYPE_BLOG) && parentTypeId.equals(TYPE_ROOT))) {
-        // ok
-      } else {
-        throw new ContainerNotPermittedException();
-      }
-    } else {
-      throw new ContainerNotPermittedException();
-    }
-  }
-
-  void checkContentTypeId(final String parentTypeId, final String typeId) {
-    if (typeId.equals(TYPE_UPLOADEDFILE) || typeId.equals(TYPE_POST)) {
-      // ok valid content
-      if ((typeId.equals(TYPE_UPLOADEDFILE) && parentTypeId.equals(TYPE_BLOG))
-          || (typeId.equals(TYPE_POST) && parentTypeId.equals(TYPE_BLOG))) {
-        // ok
-      } else {
-        throw new ContentNotPermittedException();
-      }
-
-    } else {
-      throw new ContentNotPermittedException();
-    }
-  }
-
   @Override
-  public void checkTypesBeforeContainerCreation(final String parentTypeId, final String typeId) {
-    checkContainerTypeId(parentTypeId, typeId);
-  }
-
-  @Override
-  public void checkTypesBeforeContentCreation(final String parentTypeId, final String typeId) {
-    checkContentTypeId(parentTypeId, typeId);
-  }
-
-  @Override
-  public String getName() {
-    return NAME;
-  }
-
-  @Override
-  public String getRootName() {
-    return ROOT_NAME;
-  }
-
-  @Override
-  public ServerToolTarget getTarget() {
-    return ServerToolTarget.forBoth;
-  }
-
-  @Override
   public Group initGroup(final User user, final Group group, final Object... otherVars) {
-    final ToolConfiguration config = new ToolConfiguration();
-    final Container rootFolder = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
-    config.setRoot(rootFolder);
-    group.setToolConfig(NAME, config);
-    configurationManager.persist(config);
+    final Container rootFolder = createRoot(group);
 
     final I18nLanguage language = user.getLanguage();
     final Container blog = containerManager.createFolder(group, rootFolder, i18n.t("Blog sample"),
         language, TYPE_BLOG);
 
-    final Content content = contentManager.createContent(i18n.t("A post sample"),
-        i18n.t("This is only a post sample. You can edit it, rename the post and this blog"), user,
-        blog, TYPE_POST);
-    content.addAuthor(user);
-    content.setLanguage(language);
-    content.setTypeId(TYPE_POST);
-    content.setStatus(ContentStatus.publishedOnline);
-
+    final Content content = createInitialContent(user, group, blog, i18n.t("A post sample"),
+        i18n.t("This is only a post sample. You can edit it, rename the post and this blog"), TYPE_POST);
     contentManager.save(content);
     return group;
   }
-
-  @Override
-  public void onCreateContainer(final Container container, final Container parent) {
-  }
-
-  @Override
-  public void onCreateContent(final Content content, final Container parent) {
-  }
-
-  @Override
-  @Inject
-  public void register(final ServerToolRegistry registry) {
-    registry.register(this);
-  }
 }

Modified: trunk/src/main/java/cc/kune/blogs/shared/BlogsConstants.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/shared/BlogsConstants.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/blogs/shared/BlogsConstants.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -23,12 +23,13 @@
 
 public final class BlogsConstants {
 
-    public static final String NAME = "blogs";
-    public static final String TYPE_BLOG = NAME + "." + "blog";
-    public static final String TYPE_POST = NAME + "." + "post";
-    public static final String TYPE_ROOT = NAME + "." + "root";
-    public static final String TYPE_UPLOADEDFILE = NAME + "." + ToolConstants.UPLOADEDFILE_SUFFIX;
+  public static final String NAME = "blogs";
+  public static final String ROOT_NAME = "blogs";
+  public static final String TYPE_BLOG = NAME + "." + "blog";
+  public static final String TYPE_POST = NAME + "." + "post";
+  public static final String TYPE_ROOT = NAME + "." + "root";
+  public static final String TYPE_UPLOADEDFILE = NAME + "." + ToolConstants.UPLOADEDFILE_SUFFIX;
 
-    private BlogsConstants() {
-    }
+  private BlogsConstants() {
+  }
 }

Modified: trunk/src/main/java/cc/kune/chat/client/ChatClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/ChatClientTool.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/chat/client/ChatClientTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -23,9 +23,9 @@
 import static cc.kune.chat.shared.ChatConstants.TYPE_ROOM;
 import cc.kune.chat.client.resources.ChatResources;
 import cc.kune.common.client.utils.TextUtils;
-import cc.kune.core.client.i18n.I18nUITranslationService;
 import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
 import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.tool.FoldableAbstractClientTool;
 import cc.kune.gspace.client.tool.selector.ToolSelector;
 
@@ -33,15 +33,13 @@
 
 public class ChatClientTool extends FoldableAbstractClientTool {
 
-  private final NavResources navResources;
   private final ChatResources res;
 
   @Inject
-  public ChatClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
+  public ChatClientTool(final I18nTranslationService i18n, final ToolSelector toolSelector,
       final ContentCapabilitiesRegistry cntCapRegistry, final NavResources navResources,
       final ChatResources res) {
-    super(NAME, i18n.t("chatrooms"), toolSelector, cntCapRegistry);
-    this.navResources = navResources;
+    super(NAME, i18n.t("chatrooms"), toolSelector, cntCapRegistry, i18n, navResources);
     this.res = res;
     registerIcons();
   }
@@ -53,8 +51,8 @@
 
   private void registerIcons() {
     registerContentTypeIcon(TYPE_ROOM, res.groupChat());
-    registerEmptyMessages(TYPE_ROOM, "Here you will see the archive of old conversations"
-        + TextUtils.IN_DEVELOPMENT_P);
+    registerEmptyMessages(TYPE_ROOM,
+        i18n.t("Here you will see the archive of old conversations" + TextUtils.IN_DEVELOPMENT_P));
   }
 
 }

Modified: trunk/src/main/java/cc/kune/chat/server/ChatServerModule.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/server/ChatServerModule.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/chat/server/ChatServerModule.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -23,13 +23,11 @@
 
 public class ChatServerModule extends AbstractModule {
 
-    @Override
-    public void configure() {
-        // To debug Smack, descomment this
-        // XMPPConnection.DEBUG_ENABLED = true;
+  @Override
+  public void configure() {
+    // To debug Smack, descomment this
+    // XMPPConnection.DEBUG_ENABLED = true;
+    bind(ChatServerTool.class).asEagerSingleton();
+  }
 
-        bind(ChatServerTool.class).asEagerSingleton();
-
-    }
-
 }

Modified: trunk/src/main/java/cc/kune/chat/server/ChatServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/server/ChatServerTool.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/chat/server/ChatServerTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -19,104 +19,47 @@
  */
 package cc.kune.chat.server;
 
-import cc.kune.chat.shared.ChatConstants;
-import cc.kune.core.client.errors.ContainerNotPermittedException;
+import static cc.kune.chat.shared.ChatConstants.NAME;
+import static cc.kune.chat.shared.ChatConstants.ROOT_NAME;
+import static cc.kune.chat.shared.ChatConstants.TYPE_ROOM;
+import static cc.kune.chat.shared.ChatConstants.TYPE_ROOT;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
+import cc.kune.core.server.content.ContentManager;
 import cc.kune.core.server.manager.ToolConfigurationManager;
-import cc.kune.core.server.tool.ServerTool;
-import cc.kune.core.server.tool.ServerToolRegistry;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.domain.Container;
-import cc.kune.domain.Content;
 import cc.kune.domain.Group;
-import cc.kune.domain.ToolConfiguration;
 import cc.kune.domain.User;
 
 import com.google.inject.Inject;
 
-public class ChatServerTool implements ServerTool {
+public class ChatServerTool extends AbstractServerTool {
 
   private final ChatManagerDefault chatManager;
-  private final ToolConfigurationManager configurationManager;
-  private final ContainerManager containerManager;
-  private final I18nTranslationService i18n;
 
   @Inject
   public ChatServerTool(final ToolConfigurationManager configurationManager,
-      final ContainerManager containerManager, final ChatManagerDefault chatManager,
-      final I18nTranslationService i18n) {
-    this.configurationManager = configurationManager;
-    this.containerManager = containerManager;
+      final ContentManager contentManager, final ContainerManager containerManager,
+      final ChatManagerDefault chatManager, final I18nTranslationService i18n) {
+    super(NAME, ROOT_NAME, TYPE_ROOT, Collections.<String> emptyList(),
+        Collections.<String> emptyList(), Arrays.asList(TYPE_ROOM), Arrays.asList(TYPE_ROOT),
+        contentManager, containerManager, configurationManager, i18n, ServerToolTarget.forGroups);
     this.chatManager = chatManager;
-    this.i18n = i18n;
   }
 
-  private void checkContainerTypeId(final String parentTypeId, final String typeId) {
-    if (typeId.equals(ChatConstants.TYPE_ROOM)) {
-      if (!parentTypeId.equals(ChatConstants.TYPE_ROOT)) {
-        throw new ContainerNotPermittedException();
-      }
-      // ok valid container
-    } else {
-      throw new ContainerNotPermittedException();
-    }
-  }
-
   @Override
-  public void checkTypesBeforeContainerCreation(final String parentTypeId, final String typeId) {
-    checkContainerTypeId(parentTypeId, typeId);
-  }
-
-  @Override
-  public void checkTypesBeforeContentCreation(final String parentTypeId, final String typeId) {
-    if (!parentTypeId.equals(ChatConstants.TYPE_ROOM)) {
-      throw new ContainerNotPermittedException();
-    }
-    // in the future chat history checks
-  }
-
-  @Override
-  public String getName() {
-    return ChatConstants.NAME;
-  }
-
-  @Override
-  public String getRootName() {
-    return ChatConstants.NAME;
-  }
-
-  @Override
-  public ServerToolTarget getTarget() {
-    return ServerToolTarget.forGroups;
-  }
-
-  @Override
   public Group initGroup(final User user, final Group group, final Object... otherVars) {
-    final ToolConfiguration config = new ToolConfiguration();
-    final Container container = containerManager.createRootFolder(group, ChatConstants.NAME,
-        ChatConstants.NAME, ChatConstants.TYPE_ROOT);
-    config.setRoot(container);
+    final Container rootFolder = createRoot(group);
     final String groupShortName = group.getShortName();
-    chatManager.addRoom("none", user, container.getStateToken(), groupShortName,
+    chatManager.addRoom("none", user, rootFolder.getStateToken(), groupShortName,
         i18n.t("Welcome to the [%s] public chat room", groupShortName));
-    group.setToolConfig(ChatConstants.NAME, config);
-    configurationManager.persist(config);
     return group;
   }
 
-  @Override
-  public void onCreateContainer(final Container container, final Container parent) {
-  }
-
-  @Override
-  public void onCreateContent(final Content content, final Container parent) {
-  }
-
-  @Override
-  @Inject
-  public void register(final ServerToolRegistry registry) {
-    registry.register(this);
-  }
-
 }

Modified: trunk/src/main/java/cc/kune/chat/shared/ChatConstants.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/shared/ChatConstants.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/chat/shared/ChatConstants.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -22,6 +22,7 @@
 public final class ChatConstants {
 
   public static final String NAME = "chats";
+  public static final String ROOT_NAME = "chats";
   public static final String TYPE_CHAT = NAME + "." + "chat";
   public static final String TYPE_ROOM = NAME + "." + "room";
   public static final String TYPE_ROOT = NAME + "." + "root";

Modified: trunk/src/main/java/cc/kune/client/KuneEntryPoint.java
===================================================================
--- trunk/src/main/java/cc/kune/client/KuneEntryPoint.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/client/KuneEntryPoint.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -84,6 +84,7 @@
     ginjector.getChatParts();
     ginjector.getBartersParts();
     ginjector.getMeetingsParts();
+    ginjector.getTasksParts();
 
     ginjector.getSiteLogoPresenter();
     ginjector.getSpacesTabPresenter();

Modified: trunk/src/main/java/cc/kune/client/KuneGinjector.java
===================================================================
--- trunk/src/main/java/cc/kune/client/KuneGinjector.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/client/KuneGinjector.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -61,6 +61,8 @@
 import cc.kune.pspace.client.PSpaceGinModule;
 import cc.kune.pspace.client.PSpaceParts;
 import cc.kune.pspace.client.PSpacePresenter;
+import cc.kune.tasks.client.TasksGinModule;
+import cc.kune.tasks.client.TasksGinjector;
 import cc.kune.wave.client.WaveGinModule;
 import cc.kune.wave.client.WaveParts;
 import cc.kune.wiki.client.WikiGinModule;
@@ -75,9 +77,9 @@
 
 @GinModules({ KuneGinModule.class, CoreGinModule.class, WaveGinModule.class, PSpaceGinModule.class,
     GSpaceGinModule.class, DocsGinModule.class, BlogsGinModule.class, ChatGinModule.class,
-    WikiGinModule.class, BartersGinModule.class, MeetingsGinModule.class })
+    WikiGinModule.class, BartersGinModule.class, MeetingsGinModule.class, TasksGinModule.class })
 public interface KuneGinjector extends Ginjector, GSpaceGinjector, DocsGinjector, BlogsGinjector,
-    WikiGinjector, BartersGinjector, MeetingsGinjector, ChatGinjector {
+    WikiGinjector, BartersGinjector, MeetingsGinjector, ChatGinjector, TasksGinjector {
 
   /*
    * You have to add here all the GWTPresenters (as Provider or AsyncProvider)

Modified: trunk/src/main/java/cc/kune/core/client/resources/nav/NavResources.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/resources/nav/NavResources.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/core/client/resources/nav/NavResources.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -108,6 +108,12 @@
   @Source("room_add.png")
   ImageResource roomAdd();
 
+  @Source("task.png")
+  ImageResource task();
+
+  @Source("taskadd.png")
+  ImageResource taskadd();
+
   @Source("upload.png")
   ImageResource upload();
 

Added: trunk/src/main/java/cc/kune/core/client/resources/nav/task.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/cc/kune/core/client/resources/nav/task.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/main/java/cc/kune/core/client/resources/nav/taskadd.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/cc/kune/core/client/resources/nav/taskadd.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/main/java/cc/kune/core/server/AbstractServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/AbstractServerTool.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/server/AbstractServerTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,142 @@
+package cc.kune.core.server;
+
+import java.net.URL;
+import java.util.Date;
+import java.util.List;
+
+import cc.kune.core.client.errors.ContainerNotPermittedException;
+import cc.kune.core.client.errors.ContentNotPermittedException;
+import cc.kune.core.server.content.ContainerManager;
+import cc.kune.core.server.content.ContentManager;
+import cc.kune.core.server.manager.ToolConfigurationManager;
+import cc.kune.core.server.tool.ServerTool;
+import cc.kune.core.server.tool.ServerToolRegistry;
+import cc.kune.core.server.tool.ServerToolTarget;
+import cc.kune.core.shared.domain.ContentStatus;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.domain.Container;
+import cc.kune.domain.Content;
+import cc.kune.domain.Group;
+import cc.kune.domain.ToolConfiguration;
+import cc.kune.domain.User;
+
+import com.google.inject.Inject;
+
+public abstract class AbstractServerTool implements ServerTool {
+
+  protected final ToolConfigurationManager configurationManager;
+  protected final ContainerManager containerManager;
+  protected final ContentManager contentManager;
+  protected final I18nTranslationService i18n;
+  private final String name;
+  private final String rootName;
+  private final ServerToolTarget target;
+  private final String typeRoot;
+  private final List<String> validContainerParents;
+  private final List<String> validContainers;
+  private final List<String> validContentParents;
+  private final List<String> validContents;
+
+  public AbstractServerTool(final String name, final String rootName, final String typeRoot,
+      final List<String> validContents, final List<String> validContentParents,
+      final List<String> validContainers, final List<String> validContainerParents,
+      final ContentManager contentManager, final ContainerManager containerManager,
+      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n,
+      final ServerToolTarget target) {
+    this.name = name;
+    this.rootName = rootName;
+    this.typeRoot = typeRoot;
+    this.validContents = validContents;
+    this.validContainers = validContainers;
+    this.validContentParents = validContentParents;
+    this.validContainerParents = validContainerParents;
+    this.contentManager = contentManager;
+    this.containerManager = containerManager;
+    this.configurationManager = configurationManager;
+    this.i18n = i18n;
+    this.target = target;
+  }
+
+  @Override
+  public void checkTypesBeforeContainerCreation(final String parentTypeId, final String typeId) {
+    if (validContainers.contains(typeId) && validContainerParents.contains(parentTypeId)) {
+      // ok
+    } else {
+      throw new ContainerNotPermittedException();
+    }
+  }
+
+  @Override
+  public void checkTypesBeforeContentCreation(final String parentTypeId, final String typeId) {
+    if (validContents.contains(typeId) && validContentParents.contains(parentTypeId)) {
+      // ok
+    } else {
+      throw new ContentNotPermittedException();
+    }
+  }
+
+  protected Content createInitialContent(final User user, final Group group, final Container rootFolder,
+      final String title, final String body, final String contentType) {
+    final Content content = contentManager.createContent(title, body, user, rootFolder, contentType);
+    setContentValues(content, contentType, user);
+    return content;
+  }
+
+  protected Content createInitialContent(final User user, final Group group, final Container rootFolder,
+      final String title, final String body, final String contentType, final URL gadgetUrl) {
+    final Content content = contentManager.createContent(title, body, user, rootFolder, contentType,
+        gadgetUrl);
+    setContentValues(content, contentType, user);
+    return content;
+  }
+
+  protected Container createRoot(final Group group) {
+    final ToolConfiguration config = new ToolConfiguration();
+    final Container rootFolder = containerManager.createRootFolder(group, name, rootName, typeRoot);
+    setContainerAcl(rootFolder);
+    config.setRoot(rootFolder);
+    group.setToolConfig(name, config);
+    configurationManager.persist(config);
+    return rootFolder;
+  }
+
+  @Override
+  public String getName() {
+    return name;
+  }
+
+  @Override
+  public String getRootName() {
+    return rootName;
+  }
+
+  @Override
+  public ServerToolTarget getTarget() {
+    return target;
+  }
+
+  @Override
+  public void onCreateContainer(final Container container, final Container parent) {
+  }
+
+  @Override
+  public void onCreateContent(final Content content, final Container parent) {
+  }
+
+  @Override
+  @Inject
+  public void register(final ServerToolRegistry registry) {
+    registry.register(this);
+  }
+
+  protected void setContainerAcl(final Container container) {
+  }
+
+  private void setContentValues(final Content content, final String contentType, final User author) {
+    content.addAuthor(author);
+    content.setLanguage(author.getLanguage());
+    content.setTypeId(contentType);
+    content.setStatus(ContentStatus.publishedOnline);
+    content.setPublishedOn(new Date());
+  }
+}

Modified: trunk/src/main/java/cc/kune/core/server/KuneRackModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/KuneRackModule.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/core/server/KuneRackModule.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -56,6 +56,7 @@
 import cc.kune.core.server.rest.UserJSONService;
 import cc.kune.docs.server.DocumentServerModule;
 import cc.kune.meets.server.MeetingServerModule;
+import cc.kune.tasks.server.TaskServerModule;
 import cc.kune.wiki.server.WikiServerModule;
 
 import com.google.inject.AbstractModule;
@@ -165,6 +166,7 @@
     builder.use(new ChatServerModule());
     builder.use(new BarterServerModule());
     builder.use(new MeetingServerModule());
+    builder.use(new TaskServerModule());
     // builder.use(new GalleryServerModule());
     builder.use(new RESTServicesModule());
     builder.use(configModule);

Modified: trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -24,9 +24,10 @@
 import static cc.kune.docs.shared.DocsConstants.TYPE_FOLDER;
 import static cc.kune.docs.shared.DocsConstants.TYPE_ROOT;
 import static cc.kune.docs.shared.DocsConstants.TYPE_UPLOADEDFILE;
-import cc.kune.core.client.i18n.I18nUITranslationService;
 import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
 import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.docs.shared.DocsConstants;
 import cc.kune.gspace.client.tool.FoldableAbstractClientTool;
 import cc.kune.gspace.client.tool.selector.ToolSelector;
 
@@ -34,13 +35,10 @@
 
 public class DocsClientTool extends FoldableAbstractClientTool {
 
-  private final NavResources navResources;
-
   @Inject
-  public DocsClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
+  public DocsClientTool(final I18nTranslationService i18n, final ToolSelector toolSelector,
       final ContentCapabilitiesRegistry cntCapRegistry, final NavResources navResources) {
-    super(NAME, i18n.t("documents"), toolSelector, cntCapRegistry);
-    this.navResources = navResources;
+    super(NAME, i18n.t(DocsConstants.ROOT_NAME), toolSelector, cntCapRegistry, i18n, navResources);
 
     // registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
     registerAuthorableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
@@ -64,8 +62,8 @@
     registerContentTypeIcon(TYPE_ROOT, navResources.folder());
     registerContentTypeIcon(TYPE_DOCUMENT, navResources.page());
     registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
-    registerEmptyMessages(TYPE_FOLDER, "This folder is empty");
-    registerEmptyMessages(TYPE_ROOT, "This folder is empty");
+    registerEmptyMessages(TYPE_FOLDER, i18n.t("This folder is empty"));
+    registerEmptyMessages(TYPE_ROOT, i18n.t("This folder is empty"));
   }
 
 }

Modified: trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -61,10 +61,10 @@
       final Provider<DelFolderMenuItem> delFolderMenuItem,
       final Provider<ChatAboutContentBtn> chatAbout, final Provider<RefreshContentMenuItem> refresh,
       final Provider<SetAsHomePageMenuItem> setAsHomePage,
-      final NewMenusForTypeIdsRegistry newMenusRegistry, final DocsFolderNewMenu folderNewMenu) {
+      final NewMenusForTypeIdsRegistry newMenusRegistry, final DocsFolderNewMenu docsNewMenu) {
     super(session, stateManager, i18n, registry);
     actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all);
-    actionsRegistry.addAction(ActionGroups.TOOLBAR, folderNewMenu, containers);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, docsNewMenu, containers);
     actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all);
     actionsRegistry.addAction(ActionGroups.TOOLBAR, newDocMenuItem, containers);
     actionsRegistry.addAction(ActionGroups.TOOLBAR, newDocIconBtn, all);
@@ -78,8 +78,8 @@
     actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem, contents);
     actionsRegistry.addAction(ActionGroups.ITEM_MENU, delFolderMenuItem, containersNoRoot);
     actionsRegistry.addAction(ActionGroups.ITEM_MENU, setAsHomePage, contents);
-    newMenusRegistry.register(TYPE_FOLDER, folderNewMenu.get());
-    newMenusRegistry.register(TYPE_ROOT, folderNewMenu.get());
+    newMenusRegistry.register(TYPE_FOLDER, docsNewMenu.get());
+    newMenusRegistry.register(TYPE_ROOT, docsNewMenu.get());
   }
 
   @Override

Modified: trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -26,130 +26,45 @@
 import static cc.kune.docs.shared.DocsConstants.TYPE_ROOT;
 import static cc.kune.docs.shared.DocsConstants.TYPE_UPLOADEDFILE;
 
-import java.util.Date;
+import java.util.Arrays;
 
-import cc.kune.core.client.errors.ContainerNotPermittedException;
-import cc.kune.core.client.errors.ContentNotPermittedException;
+import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
 import cc.kune.core.server.manager.ToolConfigurationManager;
-import cc.kune.core.server.tool.ServerTool;
-import cc.kune.core.server.tool.ServerToolRegistry;
 import cc.kune.core.server.tool.ServerToolTarget;
-import cc.kune.core.shared.domain.ContentStatus;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.docs.shared.DocsConstants;
 import cc.kune.domain.Container;
 import cc.kune.domain.Content;
 import cc.kune.domain.Group;
-import cc.kune.domain.ToolConfiguration;
 import cc.kune.domain.User;
 
 import com.google.inject.Inject;
 
-public class DocumentServerTool implements ServerTool {
-  private final ToolConfigurationManager configurationManager;
-  private final ContainerManager containerManager;
-  private final ContentManager contentManager;
-  private final I18nTranslationService i18n;
+public class DocumentServerTool extends AbstractServerTool {
 
   @Inject
   public DocumentServerTool(final ContentManager contentManager,
       final ContainerManager containerManager, final ToolConfigurationManager configurationManager,
-      final I18nTranslationService translationService) {
-    this.contentManager = contentManager;
-    this.containerManager = containerManager;
-    this.configurationManager = configurationManager;
-    this.i18n = translationService;
+      final I18nTranslationService i18n) {
+    super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_DOCUMENT, TYPE_UPLOADEDFILE), Arrays.asList(
+        TYPE_ROOT, TYPE_FOLDER), Arrays.asList(TYPE_FOLDER), Arrays.asList(TYPE_ROOT, TYPE_FOLDER),
+        contentManager, containerManager, configurationManager, i18n, ServerToolTarget.forBoth);
   }
 
-  void checkContainerTypeId(final String parentTypeId, final String typeId) {
-    if (typeId.equals(TYPE_FOLDER)) {
-      // ok valid container
-      if ((typeId.equals(TYPE_FOLDER) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))) {
-        // ok
-      } else {
-        throw new ContainerNotPermittedException();
-      }
-    } else {
-      throw new ContainerNotPermittedException();
-    }
-  }
-
-  void checkContentTypeId(final String parentTypeId, final String typeId) {
-    if (typeId.equals(TYPE_DOCUMENT) || typeId.equals(TYPE_UPLOADEDFILE)) {
-      // ok valid content
-      if ((typeId.equals(TYPE_DOCUMENT) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))
-          || (typeId.equals(TYPE_UPLOADEDFILE) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))) {
-        // ok
-      } else {
-        throw new ContentNotPermittedException();
-      }
-
-    } else {
-      throw new ContentNotPermittedException();
-    }
-  }
-
   @Override
-  public void checkTypesBeforeContainerCreation(final String parentTypeId, final String typeId) {
-    checkContainerTypeId(parentTypeId, typeId);
-  }
-
-  @Override
-  public void checkTypesBeforeContentCreation(final String parentTypeId, final String typeId) {
-    checkContentTypeId(parentTypeId, typeId);
-  }
-
-  @Override
-  public String getName() {
-    return NAME;
-  }
-
-  @Override
-  public String getRootName() {
-    return ROOT_NAME;
-  }
-
-  @Override
-  public ServerToolTarget getTarget() {
-    return ServerToolTarget.forBoth;
-  }
-
-  @Override
   public Group initGroup(final User user, final Group group, final Object... otherVars) {
-    final ToolConfiguration config = new ToolConfiguration();
-    final Container rootFolder = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
-    config.setRoot(rootFolder);
-    group.setToolConfig(NAME, config);
-    configurationManager.persist(config);
+    final Container rootFolder = createRoot(group);
 
     final boolean hasVars = otherVars.length >= 2;
     final String title = hasVars ? (String) otherVars[0] : i18n.t("Document sample");
     final String body = hasVars ? (String) otherVars[1] : i18n.t("This is only a sample of document");
+    final String contentType = DocsConstants.TYPE_DOCUMENT;
 
-    final Content content = contentManager.createContent(title, body, user, rootFolder,
-        DocsConstants.TYPE_DOCUMENT);
-    content.addAuthor(user);
-    content.setLanguage(user.getLanguage());
-    content.setTypeId(TYPE_DOCUMENT);
-    content.setStatus(ContentStatus.publishedOnline);
-    content.setPublishedOn(new Date());
+    final Content content = createInitialContent(user, group, rootFolder, title, body, contentType);
     group.setDefaultContent(content);
     return group;
   }
 
-  @Override
-  public void onCreateContainer(final Container container, final Container parent) {
-  }
-
-  @Override
-  public void onCreateContent(final Content content, final Container parent) {
-  }
-
-  @Override
-  @Inject
-  public void register(final ServerToolRegistry registry) {
-    registry.register(this);
-  }
 }

Modified: trunk/src/main/java/cc/kune/domain/Content.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/Content.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/domain/Content.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -59,6 +59,7 @@
 import cc.kune.docs.shared.DocsConstants;
 import cc.kune.domain.utils.HasStateToken;
 import cc.kune.meets.shared.MeetingsConstants;
+import cc.kune.tasks.shared.TasksConstants;
 import cc.kune.wiki.shared.WikiConstants;
 
 @Entity
@@ -264,6 +265,7 @@
   @Transient
   public boolean isWave() {
     return (typeId.equals(DocsConstants.TYPE_DOCUMENT))
+        || typeId.equals(TasksConstants.TYPE_TASK)
         || typeId.equals(WikiConstants.TYPE_WIKIPAGE)
         || (typeId.equals(BlogsConstants.TYPE_POST) || typeId.equals(BartersConstants.TYPE_BARTER) || typeId.equals(MeetingsConstants.TYPE_MEETING));
   }

Modified: trunk/src/main/java/cc/kune/gspace/client/tool/FoldableAbstractClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/tool/FoldableAbstractClientTool.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/gspace/client/tool/FoldableAbstractClientTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -21,17 +21,24 @@
 
 import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
 import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
+import cc.kune.core.client.resources.nav.NavResources;
 import cc.kune.core.shared.dto.BasicMimeTypeDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.tool.selector.ToolSelector;
 
 public abstract class FoldableAbstractClientTool extends AbstractClientTool {
 
   protected final ContentCapabilitiesRegistry contentCapabilitiesRegistry;
+  protected final I18nTranslationService i18n;
+  protected final NavResources navResources;
 
   public FoldableAbstractClientTool(final String shortName, final String longName,
-      final ToolSelector toolSelector, final ContentCapabilitiesRegistry contentCapabilitiesRegistry) {
+      final ToolSelector toolSelector, final ContentCapabilitiesRegistry contentCapabilitiesRegistry,
+      final I18nTranslationService i18n, final NavResources navResources) {
     super(shortName, longName, toolSelector);
     this.contentCapabilitiesRegistry = contentCapabilitiesRegistry;
+    this.i18n = i18n;
+    this.navResources = navResources;
   }
 
   protected void registerAclEditableTypes(final String... typeIds) {

Modified: trunk/src/main/java/cc/kune/meets/client/MeetingsClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/meets/client/MeetingsClientTool.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/meets/client/MeetingsClientTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -22,9 +22,9 @@
 import static cc.kune.meets.shared.MeetingsConstants.NAME;
 import static cc.kune.meets.shared.MeetingsConstants.TYPE_MEETING;
 import static cc.kune.meets.shared.MeetingsConstants.TYPE_ROOT;
-import cc.kune.core.client.i18n.I18nUITranslationService;
 import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
 import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.tool.FoldableAbstractClientTool;
 import cc.kune.gspace.client.tool.selector.ToolSelector;
 
@@ -32,13 +32,10 @@
 
 public class MeetingsClientTool extends FoldableAbstractClientTool {
 
-  private final NavResources navResources;
-
   @Inject
-  public MeetingsClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
+  public MeetingsClientTool(final I18nTranslationService i18n, final ToolSelector toolSelector,
       final ContentCapabilitiesRegistry cntCapRegistry, final NavResources navResources) {
-    super(NAME, i18n.t("meets"), toolSelector, cntCapRegistry);
-    this.navResources = navResources;
+    super(NAME, i18n.t("meets"), toolSelector, cntCapRegistry, i18n, navResources);
 
     // registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
     registerAuthorableTypes(TYPE_MEETING);
@@ -61,7 +58,7 @@
   private void registerIcons() {
     registerContentTypeIcon(TYPE_ROOT, navResources.folder());
     registerContentTypeIcon(TYPE_MEETING, navResources.calendar());
-    registerEmptyMessages(TYPE_ROOT, "There isn't any meeting");
+    registerEmptyMessages(TYPE_ROOT, i18n.t("There isn't any meeting"));
   }
 
 }

Modified: trunk/src/main/java/cc/kune/meets/server/MeetingServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/meets/server/MeetingServerTool.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/meets/server/MeetingServerTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -25,14 +25,14 @@
 import static cc.kune.meets.shared.MeetingsConstants.TYPE_ROOT;
 
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.Date;
 
-import cc.kune.core.client.errors.ContainerNotPermittedException;
-import cc.kune.core.client.errors.ContentNotPermittedException;
+import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
 import cc.kune.core.server.manager.ToolConfigurationManager;
-import cc.kune.core.server.tool.ServerToolRegistry;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.server.tool.ServerWaveTool;
 import cc.kune.core.server.utils.UrlUtils;
@@ -43,102 +43,44 @@
 import cc.kune.domain.Container;
 import cc.kune.domain.Content;
 import cc.kune.domain.Group;
-import cc.kune.domain.ToolConfiguration;
 import cc.kune.domain.User;
 
 import com.google.inject.Inject;
 
-public class MeetingServerTool implements ServerWaveTool {
+public class MeetingServerTool extends AbstractServerTool implements ServerWaveTool {
 
   private static final String MEETING_GADGET = "http://mass-mob.appspot.com/massmob/org.ourproject.massmob.client.MassmobGadget.gadget.xml";
-  private final ToolConfigurationManager configurationManager;
-  private final ContainerManager containerManager;
-  private final ContentManager contentManager;
   private final URL gadgetUrl;
-  private final I18nTranslationService i18n;
 
   @Inject
   public MeetingServerTool(final ContentManager contentManager, final ContainerManager containerManager,
-      final ToolConfigurationManager configurationManager,
-      final I18nTranslationService translationService) {
-    this.contentManager = contentManager;
-    this.containerManager = containerManager;
-    this.configurationManager = configurationManager;
-    this.i18n = translationService;
+      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n) {
+    super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_MEETING), Arrays.asList(TYPE_ROOT),
+        Collections.<String> emptyList(), Arrays.asList(TYPE_ROOT), contentManager, containerManager,
+        configurationManager, i18n, ServerToolTarget.forGroups);
     gadgetUrl = UrlUtils.of(MEETING_GADGET);
   }
 
-  void checkContainerTypeId(final String parentTypeId, final String typeId) {
-    throw new ContainerNotPermittedException();
-  }
-
-  void checkContentTypeId(final String parentTypeId, final String typeId) {
-    if (typeId.equals(TYPE_MEETING)) {
-      // ok valid content
-      final boolean parentIsFolderOrRoot = parentTypeId.equals(TYPE_ROOT);
-      if ((typeId.equals(TYPE_MEETING) && parentIsFolderOrRoot)) {
-        // ok
-      } else {
-        throw new ContentNotPermittedException();
-      }
-    } else {
-      throw new ContentNotPermittedException();
-    }
-  }
-
   @Override
-  public void checkTypesBeforeContainerCreation(final String parentTypeId, final String typeId) {
-    checkContainerTypeId(parentTypeId, typeId);
-  }
-
-  @Override
-  public void checkTypesBeforeContentCreation(final String parentTypeId, final String typeId) {
-    checkContentTypeId(parentTypeId, typeId);
-  }
-
-  @Override
   public URL getGadgetUrl() {
     return gadgetUrl;
   }
 
   @Override
-  public String getName() {
-    return NAME;
-  }
-
-  @Override
-  public String getRootName() {
-    return ROOT_NAME;
-  }
-
-  @Override
-  public ServerToolTarget getTarget() {
-    return ServerToolTarget.forGroups;
-  }
-
-  @Override
   public Group initGroup(final User user, final Group group, final Object... otherVars) {
-    final ToolConfiguration config = new ToolConfiguration();
-    final Container rootFolder = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
-    setContainerMeetingsAcl(rootFolder);
-    config.setRoot(rootFolder);
-    group.setToolConfig(NAME, config);
-    configurationManager.persist(config);
-    final Content content = contentManager.createContent(
-        i18n.t("Meeting sample"),
-        i18n.t("This is only a meet sample. You can invite other participants to this meeting, but also publish to the general public allowing you to to help in the organization, call and speed-up of events."),
-        user, rootFolder, TYPE_MEETING, gadgetUrl);
-    content.addAuthor(user);
-    content.setLanguage(user.getLanguage());
-    content.setTypeId(TYPE_MEETING);
-    content.setStatus(ContentStatus.publishedOnline);
+    final Container rootFolder = createRoot(group);
+
+    final Content content = createInitialContent(user, group, rootFolder, i18n.t("Meeting sample"),
+        i18n.t("This is only a meet sample. You can invite other participants to this meeting, "
+            + "but also publish to the general public allowing you to to help in the organization, "
+            + "call and speed-up of events."), TYPE_MEETING, gadgetUrl);
     contentManager.save(content);
     return group;
   }
 
   @Override
   public void onCreateContainer(final Container container, final Container parent) {
-    setContainerMeetingsAcl(container);
+    setContainerAcl(container);
   }
 
   @Override
@@ -148,12 +90,7 @@
   }
 
   @Override
-  @Inject
-  public void register(final ServerToolRegistry registry) {
-    registry.register(this);
-  }
-
-  private void setContainerMeetingsAcl(final Container container) {
+  protected void setContainerAcl(final Container container) {
     final AccessLists meetsAcl = new AccessLists();
     meetsAcl.getAdmins().setMode(GroupListMode.NORMAL);
     meetsAcl.getAdmins().add(container.getOwner());

Added: trunk/src/main/java/cc/kune/tasks/KuneTasks.gwt.xml
===================================================================
--- trunk/src/main/java/cc/kune/tasks/KuneTasks.gwt.xml	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/KuneTasks.gwt.xml	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,6 @@
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.1.0/distro-source/core/src/gwt-module.dtd">
+<module>
+  <inherits name="cc.kune.core.KuneCore" />
+  <source path="client" />
+  <source path="shared" />
+</module>
\ No newline at end of file

Added: trunk/src/main/java/cc/kune/tasks/client/TasksClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/TasksClientTool.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/TasksClientTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,68 @@
+/*
+ *
+ * Copyright (C) 2007-2009 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.client;
+
+import static cc.kune.tasks.shared.TasksConstants.NAME;
+import static cc.kune.tasks.shared.TasksConstants.ROOT_NAME;
+import static cc.kune.tasks.shared.TasksConstants.TYPE_FOLDER;
+import static cc.kune.tasks.shared.TasksConstants.TYPE_ROOT;
+import static cc.kune.tasks.shared.TasksConstants.TYPE_TASK;
+import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.tool.FoldableAbstractClientTool;
+import cc.kune.gspace.client.tool.selector.ToolSelector;
+
+import com.google.inject.Inject;
+
+public class TasksClientTool extends FoldableAbstractClientTool {
+
+  @Inject
+  public TasksClientTool(final I18nTranslationService i18n, final ToolSelector toolSelector,
+      final ContentCapabilitiesRegistry cntCapRegistry, final NavResources navResources) {
+    super(NAME, i18n.t(ROOT_NAME), toolSelector, cntCapRegistry, i18n, navResources);
+
+    // registerAclEditableTypes();
+    registerAuthorableTypes(TYPE_TASK);
+    registerDragableTypes(TYPE_TASK, TYPE_FOLDER);
+    registerDropableTypes(TYPE_ROOT, TYPE_FOLDER);
+    registerPublishModerableTypes(TYPE_TASK);
+    registerRateableTypes(TYPE_TASK);
+    registerRenamableTypes(TYPE_FOLDER, TYPE_TASK);
+    registerTageableTypes(TYPE_FOLDER, TYPE_TASK);
+    // registerTranslatableTypes();
+    registerIcons();
+  }
+
+  @Override
+  public String getName() {
+    return NAME;
+  }
+
+  private void registerIcons() {
+    registerContentTypeIcon(TYPE_ROOT, navResources.folder());
+    registerContentTypeIcon(TYPE_FOLDER, navResources.folder());
+    registerContentTypeIcon(TYPE_TASK, navResources.task());
+    final String noTask = i18n.t("There isn't any task, create one");
+    registerEmptyMessages(TYPE_ROOT, noTask);
+    registerEmptyMessages(TYPE_FOLDER, noTask);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/tasks/client/TasksGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/TasksGinModule.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/TasksGinModule.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,35 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.client;
+
+import cc.kune.common.client.ExtendedGinModule;
+import cc.kune.tasks.client.actions.TasksClientActions;
+import cc.kune.tasks.client.actions.TasksNewMenu;
+
+public class TasksGinModule extends ExtendedGinModule {
+
+  @Override
+  protected void configure() {
+    s(TasksNewMenu.class);
+    s(TasksClientTool.class);
+    s(TasksClientActions.class);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/tasks/client/TasksGinjector.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/TasksGinjector.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/TasksGinjector.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,28 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.client;
+
+import com.google.gwt.inject.client.Ginjector;
+
+public interface TasksGinjector extends Ginjector {
+
+  TasksParts getTasksParts();
+
+}

Added: trunk/src/main/java/cc/kune/tasks/client/TasksParts.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/TasksParts.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/TasksParts.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,42 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.client;
+
+import cc.kune.core.client.state.Session;
+import cc.kune.gspace.client.tool.ContentViewerSelector;
+import cc.kune.gspace.client.viewers.ContentViewerPresenter;
+import cc.kune.gspace.client.viewers.FolderViewerPresenter;
+import cc.kune.tasks.client.actions.TasksClientActions;
+import cc.kune.tasks.shared.TasksConstants;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class TasksParts {
+
+  @Inject
+  public TasksParts(final Session session, final Provider<TasksClientTool> clientTool,
+      final ContentViewerSelector viewerSelector, final TasksClientActions tasksActions,
+      final ContentViewerPresenter contentViewer, final FolderViewerPresenter folderViewer) {
+    clientTool.get();
+    viewerSelector.register(contentViewer, true, TasksConstants.TYPE_TASK);
+    viewerSelector.register(folderViewer, true, TasksConstants.TYPE_ROOT, TasksConstants.TYPE_FOLDER);
+  }
+}
\ No newline at end of file

Added: trunk/src/main/java/cc/kune/tasks/client/actions/AbstractOptionsMenu.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/actions/AbstractOptionsMenu.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/actions/AbstractOptionsMenu.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,32 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
+import cc.kune.core.client.resources.CoreResources;
+
+public abstract class AbstractOptionsMenu extends MenuDescriptor {
+
+    public AbstractOptionsMenu(final CoreResources res) {
+        super();
+        this.withIcon(res.arrowDownBlack()).withStyles("k-fr");
+    }
+
+}

Added: trunk/src/main/java/cc/kune/tasks/client/actions/DelFolderMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/actions/DelFolderMenuItem.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/actions/DelFolderMenuItem.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,35 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.client.actions;
+
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.DelContainerMenuItem;
+
+import com.google.inject.Inject;
+
+public class DelFolderMenuItem extends DelContainerMenuItem {
+
+    @Inject
+    public DelFolderMenuItem(final I18nTranslationService i18n, final DelContainerAction action, final CoreResources res) {
+        super(i18n, action, res);
+    }
+
+}

Added: trunk/src/main/java/cc/kune/tasks/client/actions/DelTaskMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/actions/DelTaskMenuItem.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/actions/DelTaskMenuItem.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,36 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.client.actions;
+
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.DelContentMenuItem;
+
+import com.google.inject.Inject;
+
+public class DelTaskMenuItem extends DelContentMenuItem {
+
+  @Inject
+  public DelTaskMenuItem(final I18nTranslationService i18n, final DelContentAction action,
+      final CoreResources res) {
+    super(i18n, action, res);
+    this.withText(i18n.t("Mark as done"));
+  }
+}

Added: trunk/src/main/java/cc/kune/tasks/client/actions/GoParentFolderBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/actions/GoParentFolderBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/actions/GoParentFolderBtn.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,38 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.client.actions;
+
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.GoParentContainerBtn;
+import cc.kune.tasks.shared.TasksConstants;
+
+import com.google.inject.Inject;
+
+public class GoParentFolderBtn extends GoParentContainerBtn {
+
+  @Inject
+  public GoParentFolderBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
+      final CoreResources res, final Session session) {
+    super(i18n, action, res, session, TasksConstants.TYPE_ROOT);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/tasks/client/actions/NewFolderBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/actions/NewFolderBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/actions/NewFolderBtn.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,38 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.client.actions;
+
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.NewContainerBtn;
+import cc.kune.tasks.shared.TasksConstants;
+
+import com.google.inject.Inject;
+
+public class NewFolderBtn extends NewContainerBtn {
+
+  @Inject
+  public NewFolderBtn(final I18nTranslationService i18n, final NewContainerAction action,
+      final NavResources res) {
+    super(i18n, action, res.taskadd(), i18n.t("New folder"), i18n.t("Create a new folder"),
+        i18n.t("New folder"), TasksConstants.TYPE_FOLDER);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/tasks/client/actions/NewTaskIconBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/actions/NewTaskIconBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/actions/NewTaskIconBtn.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,41 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.client.actions;
+
+import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.NewContentAction;
+import cc.kune.gspace.client.actions.NewContentBtn;
+import cc.kune.tasks.shared.TasksConstants;
+
+import com.google.inject.Inject;
+
+public class NewTaskIconBtn extends NewContentBtn {
+
+  @Inject
+  public NewTaskIconBtn(final I18nTranslationService i18n, final NewContentAction action,
+      final NavResources res, final GlobalShortcutRegister shorcutReg) {
+    super(i18n, action, res.taskadd(), shorcutReg, "", i18n.t("Create a new task"), i18n.t("New task"),
+        TasksConstants.TYPE_TASK);
+    withStyles("k-btn-min, k-fl");
+  }
+
+}

Added: trunk/src/main/java/cc/kune/tasks/client/actions/NewTaskMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/actions/NewTaskMenuItem.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/actions/NewTaskMenuItem.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,40 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.client.actions;
+
+import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.NewContentAction;
+import cc.kune.gspace.client.actions.NewContentMenuItem;
+import cc.kune.tasks.shared.TasksConstants;
+
+import com.google.inject.Inject;
+
+public class NewTaskMenuItem extends NewContentMenuItem {
+
+  @Inject
+  public NewTaskMenuItem(final I18nTranslationService i18n, final NewContentAction action,
+      final NavResources res, final GlobalShortcutRegister shorcutReg, final TasksNewMenu tasksNewMenu) {
+    super(i18n, action, res.taskadd(), shorcutReg, i18n.t("New task"), i18n.t("Create a new task"),
+        i18n.t("New task"), TasksConstants.TYPE_TASK, tasksNewMenu.get());
+  }
+
+}

Added: trunk/src/main/java/cc/kune/tasks/client/actions/OpenFolderMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/actions/OpenFolderMenuItem.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/actions/OpenFolderMenuItem.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,35 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.client.actions;
+
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.OpenContentMenuItem;
+
+import com.google.inject.Inject;
+
+public class OpenFolderMenuItem extends OpenContentMenuItem {
+
+    @Inject
+    public OpenFolderMenuItem(final I18nTranslationService i18n, final OpenContentAction action, final NavResources res) {
+        super(i18n, action, res);
+    }
+
+}

Added: trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,86 @@
+/*
+ *
+ * Copyright (C) 2007-2009 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ \*/
+package cc.kune.tasks.client.actions;
+
+import static cc.kune.tasks.shared.TasksConstants.TYPE_FOLDER;
+import static cc.kune.tasks.shared.TasksConstants.TYPE_ROOT;
+import static cc.kune.tasks.shared.TasksConstants.TYPE_TASK;
+import cc.kune.chat.client.actions.ChatAboutContentBtn;
+import cc.kune.core.client.actions.ActionRegistryByType;
+import cc.kune.core.client.i18n.I18nUITranslationService;
+import cc.kune.core.client.registry.NewMenusForTypeIdsRegistry;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.gspace.client.actions.AbstractFoldableToolActions;
+import cc.kune.gspace.client.actions.ActionGroups;
+import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
+import cc.kune.gspace.client.actions.ParticipateInContentBtn;
+import cc.kune.gspace.client.actions.RefreshContentMenuItem;
+import cc.kune.gspace.client.actions.SetAsHomePageMenuItem;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class TasksClientActions extends AbstractFoldableToolActions {
+
+  final String[] all = { TYPE_ROOT, TYPE_FOLDER, TYPE_TASK };
+  final String[] containers = { TYPE_ROOT, TYPE_FOLDER };
+  final String[] containersNoRoot = { TYPE_FOLDER };
+  final String[] contents = { TYPE_TASK };
+  final String[] noRoot = { TYPE_FOLDER, TYPE_TASK };
+
+  @Inject
+  public TasksClientActions(final I18nUITranslationService i18n, final Session session,
+      final StateManager stateManager, final ActionRegistryByType registry, final CoreResources res,
+      final Provider<GoParentFolderBtn> folderGoUp, final Provider<NewTaskMenuItem> newTaskItem,
+      final Provider<NewTaskIconBtn> newTaskIconBtn, final Provider<NewFolderBtn> newFolderBtn,
+      final Provider<OpenFolderMenuItem> openContentMenuItem,
+      final Provider<DelTaskMenuItem> delContentMenuItem,
+      final Provider<RefreshContentMenuItem> refresh,
+      final Provider<ContentViewerOptionsMenu> optionsMenuContent,
+      final Provider<ParticipateInContentBtn> participateBtn, final TasksNewMenu taskNewMenu,
+      final NewMenusForTypeIdsRegistry newMenusRegistry, final Provider<ChatAboutContentBtn> chatAbout,
+      final Provider<DelFolderMenuItem> delFolderMenuItem,
+      final Provider<SetAsHomePageMenuItem> setAsHomePage) {
+    super(session, stateManager, i18n, registry);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, taskNewMenu, containers);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, newTaskItem, containers);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, newTaskIconBtn, all);
+    // actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderBtn,
+    // containers);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, contents);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containers);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, chatAbout, contents);
+    actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, contents);
+    actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, containersNoRoot);
+    actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem, contents);
+    actionsRegistry.addAction(ActionGroups.ITEM_MENU, delFolderMenuItem, containersNoRoot);
+    newMenusRegistry.register(TYPE_FOLDER, taskNewMenu.get());
+    newMenusRegistry.register(TYPE_ROOT, taskNewMenu.get());
+  }
+
+  @Override
+  protected void createPostSessionInitActions() {
+  }
+}

Added: trunk/src/main/java/cc/kune/tasks/client/actions/TasksNewMenu.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/actions/TasksNewMenu.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/client/actions/TasksNewMenu.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,34 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.client.actions;
+
+import cc.kune.gspace.client.actions.AbstractNewMenu;
+import cc.kune.gspace.client.actions.NewMenuProvider;
+
+import com.google.inject.Inject;
+
+public class TasksNewMenu extends NewMenuProvider {
+
+  @Inject
+  public TasksNewMenu(final AbstractNewMenu menu) {
+    super(menu);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/tasks/server/TaskServerModule.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/server/TaskServerModule.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/server/TaskServerModule.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,29 @@
+/*
+ *
+ * Copyright (C) 2007-2009 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.server;
+
+import com.google.inject.Binder;
+import com.google.inject.Module;
+
+public class TaskServerModule implements Module {
+    public void configure(final Binder binder) {
+        binder.bind(TaskServerTool.class).asEagerSingleton();
+    }
+}

Added: trunk/src/main/java/cc/kune/tasks/server/TaskServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/server/TaskServerTool.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/server/TaskServerTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,83 @@
+/*
+ *
+ * Copyright (C) 2007-2009 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.server;
+
+import static cc.kune.tasks.shared.TasksConstants.NAME;
+import static cc.kune.tasks.shared.TasksConstants.ROOT_NAME;
+import static cc.kune.tasks.shared.TasksConstants.TYPE_FOLDER;
+import static cc.kune.tasks.shared.TasksConstants.TYPE_ROOT;
+import static cc.kune.tasks.shared.TasksConstants.TYPE_TASK;
+
+import java.util.Arrays;
+
+import cc.kune.core.server.AbstractServerTool;
+import cc.kune.core.server.content.ContainerManager;
+import cc.kune.core.server.content.ContentManager;
+import cc.kune.core.server.manager.ToolConfigurationManager;
+import cc.kune.core.server.tool.ServerToolTarget;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.domain.Container;
+import cc.kune.domain.Content;
+import cc.kune.domain.Group;
+import cc.kune.domain.I18nLanguage;
+import cc.kune.domain.User;
+
+import com.google.inject.Inject;
+
+public class TaskServerTool extends AbstractServerTool {
+
+  @Inject
+  public TaskServerTool(final ContentManager contentManager, final ContainerManager containerManager,
+      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n) {
+    super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_TASK), Arrays.asList(TYPE_FOLDER, TYPE_ROOT),
+        Arrays.asList(TYPE_FOLDER), Arrays.asList(TYPE_ROOT, TYPE_FOLDER), contentManager,
+        containerManager, configurationManager, i18n, ServerToolTarget.forBoth);
+  }
+
+  private Container createFolder(final Group group, final Container rootFolder,
+      final I18nLanguage language, final String title) {
+    final Container shortTerm = containerManager.createFolder(group, rootFolder, i18n.t(title),
+        language, TYPE_FOLDER);
+    return shortTerm;
+  }
+
+  private void createTask(final User user, final Group group, final Container shortTerm,
+      final String text) {
+    final Content content = createInitialContent(user, group, shortTerm, i18n.t(text),
+        i18n.t("This is only a task sample. You can edit it, rename it"), TYPE_TASK);
+    contentManager.save(content);
+  }
+
+  @Override
+  public Group initGroup(final User user, final Group group, final Object... otherVars) {
+    final Container rootFolder = createRoot(group);
+
+    final I18nLanguage language = user.getLanguage();
+
+    final Container longTerm = createFolder(group, rootFolder, language, "Long-term tasks");
+    final Container midTerm = createFolder(group, rootFolder, language, "Mid-term tasks");
+    final Container shortTerm = createFolder(group, rootFolder, language, "Short-term (urgent) tasks");
+
+    createTask(user, group, longTerm, "A long-term task sample");
+    createTask(user, group, midTerm, "A mid-term task sample");
+    createTask(user, group, shortTerm, "A short-term task sample");
+    return group;
+  }
+}

Added: trunk/src/main/java/cc/kune/tasks/shared/TasksConstants.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/shared/TasksConstants.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/tasks/shared/TasksConstants.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,32 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.tasks.shared;
+
+public final class TasksConstants {
+
+  public static final String NAME = "tasks";
+  public static final String ROOT_NAME = "tasks";
+  public static final String TYPE_FOLDER = NAME + "." + "folder";
+  public static final String TYPE_ROOT = NAME + "." + "root";
+  public static final String TYPE_TASK = NAME + "." + "task";
+
+  private TasksConstants() {
+  }
+}

Modified: trunk/src/main/java/cc/kune/wiki/client/WikiClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/wiki/client/WikiClientTool.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/wiki/client/WikiClientTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -24,9 +24,9 @@
 import static cc.kune.wiki.shared.WikiConstants.TYPE_ROOT;
 import static cc.kune.wiki.shared.WikiConstants.TYPE_UPLOADEDFILE;
 import static cc.kune.wiki.shared.WikiConstants.TYPE_WIKIPAGE;
-import cc.kune.core.client.i18n.I18nUITranslationService;
 import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
 import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.tool.FoldableAbstractClientTool;
 import cc.kune.gspace.client.tool.selector.ToolSelector;
 
@@ -34,19 +34,14 @@
 
 public class WikiClientTool extends FoldableAbstractClientTool {
 
-  private final NavResources navResources;
-
   @Inject
-  public WikiClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
+  public WikiClientTool(final I18nTranslationService i18n, final ToolSelector toolSelector,
       final ContentCapabilitiesRegistry cntCapRegistry, final NavResources navResources) {
-    super(NAME, i18n.t("wiki"), toolSelector, cntCapRegistry);
-    this.navResources = navResources;
+    super(NAME, i18n.t("wiki"), toolSelector, cntCapRegistry, i18n, navResources);
 
-    // registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
     registerAuthorableTypes(TYPE_WIKIPAGE, TYPE_UPLOADEDFILE);
     registerDragableTypes(TYPE_WIKIPAGE, TYPE_FOLDER, TYPE_UPLOADEDFILE);
     registerDropableTypes(TYPE_ROOT, TYPE_FOLDER);
-    // registerPublishModerableTypes();
     registerRateableTypes(TYPE_UPLOADEDFILE, TYPE_WIKIPAGE);
     registerRenamableTypes(TYPE_FOLDER, TYPE_UPLOADEDFILE, TYPE_WIKIPAGE);
     registerTageableTypes(TYPE_UPLOADEDFILE, TYPE_WIKIPAGE);
@@ -65,8 +60,8 @@
     registerContentTypeIcon(TYPE_ROOT, navResources.folder());
     registerContentTypeIcon(TYPE_WIKIPAGE, navResources.wikipage());
     registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
-    registerEmptyMessages(TYPE_FOLDER, "There folder is empty");
-    registerEmptyMessages(TYPE_ROOT, "This wiki is empty");
+    registerEmptyMessages(TYPE_FOLDER, i18n.t("There folder is empty"));
+    registerEmptyMessages(TYPE_ROOT, i18n.t("This wiki is empty"));
   }
 
 }

Modified: trunk/src/main/java/cc/kune/wiki/server/WikiServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/wiki/server/WikiServerTool.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/main/java/cc/kune/wiki/server/WikiServerTool.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -26,15 +26,13 @@
 import static cc.kune.wiki.shared.WikiConstants.TYPE_UPLOADEDFILE;
 import static cc.kune.wiki.shared.WikiConstants.TYPE_WIKIPAGE;
 
+import java.util.Arrays;
 import java.util.Date;
 
-import cc.kune.core.client.errors.ContainerNotPermittedException;
-import cc.kune.core.client.errors.ContentNotPermittedException;
+import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
 import cc.kune.core.server.manager.ToolConfigurationManager;
-import cc.kune.core.server.tool.ServerTool;
-import cc.kune.core.server.tool.ServerToolRegistry;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.shared.domain.ContentStatus;
 import cc.kune.core.shared.domain.GroupListMode;
@@ -43,105 +41,32 @@
 import cc.kune.domain.Container;
 import cc.kune.domain.Content;
 import cc.kune.domain.Group;
-import cc.kune.domain.ToolConfiguration;
 import cc.kune.domain.User;
 
 import com.google.inject.Inject;
 
-public class WikiServerTool implements ServerTool {
+public class WikiServerTool extends AbstractServerTool {
 
-  private final ToolConfigurationManager configurationManager;
-  private final ContainerManager containerManager;
-  private final ContentManager contentManager;
-  private final I18nTranslationService i18n;
-
   @Inject
   public WikiServerTool(final ContentManager contentManager, final ContainerManager containerManager,
-      final ToolConfigurationManager configurationManager,
-      final I18nTranslationService translationService) {
-    this.contentManager = contentManager;
-    this.containerManager = containerManager;
-    this.configurationManager = configurationManager;
-    this.i18n = translationService;
+      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n) {
+    super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_WIKIPAGE, TYPE_UPLOADEDFILE), Arrays.asList(
+        TYPE_ROOT, TYPE_FOLDER), Arrays.asList(TYPE_FOLDER), Arrays.asList(TYPE_ROOT, TYPE_FOLDER),
+        contentManager, containerManager, configurationManager, i18n, ServerToolTarget.forBoth);
   }
 
-  void checkContainerTypeId(final String parentTypeId, final String typeId) {
-    if (typeId.equals(TYPE_FOLDER)) {
-      // ok valid container
-      if ((typeId.equals(TYPE_FOLDER) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))) {
-        // ok
-      } else {
-        throw new ContainerNotPermittedException();
-      }
-    } else {
-      throw new ContainerNotPermittedException();
-    }
-  }
-
-  void checkContentTypeId(final String parentTypeId, final String typeId) {
-    if (typeId.equals(TYPE_WIKIPAGE) || typeId.equals(TYPE_UPLOADEDFILE)) {
-      // ok valid content
-      final boolean parentIsFolderOrRoot = parentTypeId.equals(TYPE_ROOT)
-          || parentTypeId.equals(TYPE_FOLDER);
-      if ((typeId.equals(TYPE_UPLOADEDFILE) && parentIsFolderOrRoot)
-          || (typeId.equals(TYPE_WIKIPAGE) && parentIsFolderOrRoot)) {
-        // ok
-      } else {
-        throw new ContentNotPermittedException();
-      }
-    } else {
-      throw new ContentNotPermittedException();
-    }
-  }
-
   @Override
-  public void checkTypesBeforeContainerCreation(final String parentTypeId, final String typeId) {
-    checkContainerTypeId(parentTypeId, typeId);
-  }
-
-  @Override
-  public void checkTypesBeforeContentCreation(final String parentTypeId, final String typeId) {
-    checkContentTypeId(parentTypeId, typeId);
-  }
-
-  @Override
-  public String getName() {
-    return NAME;
-  }
-
-  @Override
-  public String getRootName() {
-    return ROOT_NAME;
-  }
-
-  @Override
-  public ServerToolTarget getTarget() {
-    return ServerToolTarget.forBoth;
-  }
-
-  @Override
   public Group initGroup(final User user, final Group group, final Object... otherVars) {
-    final ToolConfiguration config = new ToolConfiguration();
-    final Container rootFolder = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
-    setContainerWikiAcl(rootFolder);
-    config.setRoot(rootFolder);
-    group.setToolConfig(NAME, config);
-    configurationManager.persist(config);
-    final Content content = contentManager.createContent(i18n.t("Wiki page sample"),
-        i18n.t("This is only a wiki page sample. You can edit or rename it, but also any other user."),
-        user, rootFolder, TYPE_WIKIPAGE);
-    content.addAuthor(user);
-    content.setLanguage(user.getLanguage());
-    content.setTypeId(TYPE_WIKIPAGE);
-    content.setStatus(ContentStatus.publishedOnline);
+    final Container rootFolder = createRoot(group);
 
+    final Content content = super.createInitialContent(user, group, rootFolder, i18n.t("Wiki page sample"), i18n.t("This is only a wiki page sample. You can edit or rename it, but also any other user."), TYPE_WIKIPAGE);
     contentManager.save(content);
     return group;
   }
 
   @Override
   public void onCreateContainer(final Container container, final Container parent) {
-    setContainerWikiAcl(container);
+    setContainerAcl(container);
   }
 
   @Override
@@ -151,12 +76,7 @@
   }
 
   @Override
-  @Inject
-  public void register(final ServerToolRegistry registry) {
-    registry.register(this);
-  }
-
-  private void setContainerWikiAcl(final Container container) {
+  protected void setContainerAcl(final Container container) {
     final AccessLists wikiAcl = new AccessLists();
     wikiAcl.getAdmins().setMode(GroupListMode.NORMAL);
     wikiAcl.getAdmins().add(container.getOwner());

Deleted: trunk/src/test/java/cc/kune/blogs/server/BlogServerToolTest.java
===================================================================
--- trunk/src/test/java/cc/kune/blogs/server/BlogServerToolTest.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/test/java/cc/kune/blogs/server/BlogServerToolTest.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -1,67 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package cc.kune.blogs.server;
-
-import static cc.kune.blogs.shared.BlogsConstants.TYPE_BLOG;
-import static cc.kune.blogs.shared.BlogsConstants.TYPE_POST;
-import static cc.kune.blogs.shared.BlogsConstants.TYPE_ROOT;
-import static cc.kune.blogs.shared.BlogsConstants.TYPE_UPLOADEDFILE;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import cc.kune.core.client.errors.ContainerNotPermittedException;
-import cc.kune.core.client.errors.ContentNotPermittedException;
-
-public class BlogServerToolTest { // extends PersistenceTest {
-
-    private BlogServerTool serverTool;
-
-    @Before
-    public void before() {
-        serverTool = new BlogServerTool(null, null, null, null);
-    }
-
-    @Test
-    public void testCreateContainerInCorrectContainer() {
-        serverTool.checkContainerTypeId(TYPE_ROOT, TYPE_BLOG);
-    }
-
-    @Test(expected = ContainerNotPermittedException.class)
-    public void testCreateContainerInIncorrectContainer7() {
-        serverTool.checkContainerTypeId(TYPE_BLOG, TYPE_BLOG);
-    }
-
-    @Test
-    public void testCreateContentInCorrectContainer() {
-        serverTool.checkContentTypeId(TYPE_BLOG, TYPE_POST);
-        serverTool.checkContentTypeId(TYPE_BLOG, TYPE_UPLOADEDFILE);
-    }
-
-    @Test(expected = ContentNotPermittedException.class)
-    public void testCreateContentInIncorrectContainer1() {
-        serverTool.checkContentTypeId(TYPE_ROOT, TYPE_POST);
-    }
-
-    @Test(expected = ContentNotPermittedException.class)
-    public void testCreateContentInIncorrectContainer8() {
-        serverTool.checkContentTypeId(TYPE_ROOT, TYPE_UPLOADEDFILE);
-    }
-}
\ No newline at end of file

Copied: trunk/src/test/java/cc/kune/blogs/server/TaskServerToolTest.java (from rev 1481, trunk/src/test/java/cc/kune/blogs/server/BlogServerToolTest.java)
===================================================================
--- trunk/src/test/java/cc/kune/blogs/server/TaskServerToolTest.java	                        (rev 0)
+++ trunk/src/test/java/cc/kune/blogs/server/TaskServerToolTest.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -0,0 +1,67 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.blogs.server;
+
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_BLOG;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_POST;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_ROOT;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_UPLOADEDFILE;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import cc.kune.core.client.errors.ContainerNotPermittedException;
+import cc.kune.core.client.errors.ContentNotPermittedException;
+
+public class TaskServerToolTest { // extends PersistenceTest {
+
+  private BlogServerTool serverTool;
+
+  @Before
+  public void before() {
+    serverTool = new BlogServerTool(null, null, null, null);
+  }
+
+  @Test
+  public void testCreateContainerInCorrectContainer() {
+    serverTool.checkTypesBeforeContainerCreation(TYPE_ROOT, TYPE_BLOG);
+  }
+
+  @Test(expected = ContainerNotPermittedException.class)
+  public void testCreateContainerInIncorrectContainer7() {
+    serverTool.checkTypesBeforeContainerCreation(TYPE_BLOG, TYPE_BLOG);
+  }
+
+  @Test
+  public void testCreateContentInCorrectContainer() {
+    serverTool.checkTypesBeforeContentCreation(TYPE_BLOG, TYPE_POST);
+    serverTool.checkTypesBeforeContentCreation(TYPE_BLOG, TYPE_UPLOADEDFILE);
+  }
+
+  @Test(expected = ContentNotPermittedException.class)
+  public void testCreateContentInIncorrectContainer1() {
+    serverTool.checkTypesBeforeContentCreation(TYPE_ROOT, TYPE_POST);
+  }
+
+  @Test(expected = ContentNotPermittedException.class)
+  public void testCreateContentInIncorrectContainer8() {
+    serverTool.checkTypesBeforeContentCreation(TYPE_ROOT, TYPE_UPLOADEDFILE);
+  }
+}
\ No newline at end of file

Modified: trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java
===================================================================
--- trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -29,25 +29,25 @@
 
 public class DocumentServerToolTest { // extends PersistenceTest {
 
-    private DocumentServerTool serverTool;
+  private DocumentServerTool serverTool;
 
-    @Before
-    public void before() {
-        serverTool = new DocumentServerTool(null, null, null, null);
-    }
+  @Before
+  public void before() {
+    serverTool = new DocumentServerTool(null, null, null, null);
+  }
 
-    @Test
-    public void testCreateContainerInCorrectContainer() {
-        serverTool.checkContainerTypeId(TYPE_ROOT, TYPE_FOLDER);
-        serverTool.checkContainerTypeId(TYPE_FOLDER, TYPE_FOLDER);
-    }
+  @Test
+  public void testCreateContainerInCorrectContainer() {
+    serverTool.checkTypesBeforeContainerCreation(TYPE_ROOT, TYPE_FOLDER);
+    serverTool.checkTypesBeforeContainerCreation(TYPE_FOLDER, TYPE_FOLDER);
+  }
 
-    @Test
-    public void testCreateContentInCorrectContainer() {
-        serverTool.checkContentTypeId(TYPE_ROOT, TYPE_DOCUMENT);
-        serverTool.checkContentTypeId(TYPE_ROOT, TYPE_UPLOADEDFILE);
-        serverTool.checkContentTypeId(TYPE_FOLDER, TYPE_DOCUMENT);
-        serverTool.checkContentTypeId(TYPE_FOLDER, TYPE_UPLOADEDFILE);
-    }
+  @Test
+  public void testCreateContentInCorrectContainer() {
+    serverTool.checkTypesBeforeContentCreation(TYPE_ROOT, TYPE_DOCUMENT);
+    serverTool.checkTypesBeforeContentCreation(TYPE_ROOT, TYPE_UPLOADEDFILE);
+    serverTool.checkTypesBeforeContentCreation(TYPE_FOLDER, TYPE_DOCUMENT);
+    serverTool.checkTypesBeforeContentCreation(TYPE_FOLDER, TYPE_UPLOADEDFILE);
+  }
 
 }
\ No newline at end of file

Modified: trunk/src/test/java/cc/kune/wiki/server/WikiServerToolTest.java
===================================================================
--- trunk/src/test/java/cc/kune/wiki/server/WikiServerToolTest.java	2011-08-06 18:27:37 UTC (rev 1484)
+++ trunk/src/test/java/cc/kune/wiki/server/WikiServerToolTest.java	2011-08-07 23:07:04 UTC (rev 1485)
@@ -27,8 +27,6 @@
 import org.junit.Before;
 import org.junit.Test;
 
-import cc.kune.wiki.server.WikiServerTool;
-
 public class WikiServerToolTest { // extends PersistenceTest {
 
   private WikiServerTool serverTool;
@@ -40,16 +38,16 @@
 
   @Test
   public void testCreateContainerInCorrectContainer() {
-    serverTool.checkContainerTypeId(TYPE_ROOT, TYPE_FOLDER);
-    serverTool.checkContainerTypeId(TYPE_FOLDER, TYPE_FOLDER);
+    serverTool.checkTypesBeforeContainerCreation(TYPE_ROOT, TYPE_FOLDER);
+    serverTool.checkTypesBeforeContainerCreation(TYPE_FOLDER, TYPE_FOLDER);
   }
 
   @Test
   public void testCreateContentInCorrectContainer() {
-    serverTool.checkContentTypeId(TYPE_ROOT, TYPE_WIKIPAGE);
-    serverTool.checkContentTypeId(TYPE_ROOT, TYPE_UPLOADEDFILE);
-    serverTool.checkContentTypeId(TYPE_FOLDER, TYPE_WIKIPAGE);
-    serverTool.checkContentTypeId(TYPE_FOLDER, TYPE_UPLOADEDFILE);
+    serverTool.checkTypesBeforeContentCreation(TYPE_ROOT, TYPE_WIKIPAGE);
+    serverTool.checkTypesBeforeContentCreation(TYPE_ROOT, TYPE_UPLOADEDFILE);
+    serverTool.checkTypesBeforeContentCreation(TYPE_FOLDER, TYPE_WIKIPAGE);
+    serverTool.checkTypesBeforeContentCreation(TYPE_FOLDER, TYPE_UPLOADEDFILE);
   }
 
 }
\ No newline at end of file




More information about the kune-commits mailing list