[kune-commits] r946 - in trunk: . script
src/main/java/org/ourproject/kune/app/public/css
src/main/java/org/ourproject/kune/docs/client
src/main/java/org/ourproject/kune/docs/client/cnt
src/main/java/org/ourproject/kune/docs/client/cnt/folder
src/main/java/org/ourproject/kune/docs/client/ctx
src/main/java/org/ourproject/kune/docs/client/ctx/admin
src/main/java/org/ourproject/kune/platf/client/services
src/main/java/org/ourproject/kune/platf/client/ui
src/main/java/org/ourproject/kune/workspace/client/editor
src/main/java/org/ourproject/kune/workspace/client/i18n
vjrj
vjrj at ourproject.org
Tue Nov 11 14:12:44 CET 2008
Author: vjrj
Date: 2008-11-11 14:12:39 +0100 (Tue, 11 Nov 2008)
New Revision: 946
Added:
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocFolderContent.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocFolderContentPanel.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocFolderContentPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocFolderContentView.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewer.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewerPanel.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewerPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewerView.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextPropEditor.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextPropEditorPanel.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextPropEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextPropEditorView.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/ContextPropertyPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorPanel.java
Removed:
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditor.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPanel.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/
Modified:
trunk/TODO
trunk/pom.xml
trunk/script/copy_deploy.sh
trunk/script/css-update.sh
trunk/script/deploy_gwt.cmd
trunk/script/deploy_gwt.sh
trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
Log:
Incomplete - task Context properties editor
Incomplete - task UI tools & workspace refactorization
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/TODO 2008-11-11 13:12:39 UTC (rev 946)
@@ -6,10 +6,6 @@
SHORT-TERM (URGENT):
--------------------------------------------------------------------------------
<vjrj> IconHyperlink.java and IconLabel.java to gwt1.5
-<vjrj> chat add new room name validation (do a form with validation)
---> vjrj
-<vjrj> Double click issue:
-http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/147f09153c4752d2/4caf0ac41c4625d3?lnk=gst&q=timer+double+click&rnum=1#4caf0ac41c4625d3
<vjrj> Injection problem [2]
<vjrj> BUG: Duplicate Keys in group/user creation different exception [1]
---> vjrj
@@ -351,7 +347,7 @@
Selecciona una licencia para compartir los contenidos de este grupo con el resto de gente:
[X] Usar la licencia <href>copyleft recomendada
-[ ] Quiero elegir otra licencia (uso avanzado)
+[ ] Quiero elegir otra licencia (uso avanzado)
Notas:
* <href>¿Porqué necesito una licencia?
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/pom.xml 2008-11-11 13:12:39 UTC (rev 946)
@@ -5,7 +5,7 @@
<groupId>org.ourproject</groupId>
<artifactId>kune</artifactId>
<packaging>jar</packaging>
- <version>0.0.4</version>
+ <version>0.0.5</version>
<description>
kune free/open/libre collaboration platform
</description>
Modified: trunk/script/copy_deploy.sh
===================================================================
--- trunk/script/copy_deploy.sh 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/script/copy_deploy.sh 2008-11-11 13:12:39 UTC (rev 946)
@@ -5,4 +5,4 @@
rm src/main/webapp/gwt/org.ourproject.kune.app.Kune/ -R
mkdir src/main/webapp/gwt/org.ourproject.kune.app.Kune/
-cp target/kune-0.0.4/org.ourproject.kune.app.Kune/ src/main/webapp/gwt/ -R
+cp target/kune-0.0.5/org.ourproject.kune.app.Kune/ src/main/webapp/gwt/ -R
Modified: trunk/script/css-update.sh
===================================================================
--- trunk/script/css-update.sh 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/script/css-update.sh 2008-11-11 13:12:39 UTC (rev 946)
@@ -1,7 +1,7 @@
#!/bin/bash
APPPUB=src/main/java/org/ourproject/kune/app/public
WEBAPP=src/main/webapp/gwt/org.ourproject.kune.app.Kune
-TARGET=target/kune-0.0.4/org.ourproject.kune.app.Kune
+TARGET=target/kune-0.0.5/org.ourproject.kune.app.Kune
#$PWD/script/css-compact-and-tidy.css
Modified: trunk/script/deploy_gwt.cmd
===================================================================
--- trunk/script/deploy_gwt.cmd 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/script/deploy_gwt.cmd 2008-11-11 13:12:39 UTC (rev 946)
@@ -1 +1 @@
-copy target\kune-0.0.4\org.ourproject.kune.Main\* src\main\webapp\gwt\org.ourproject.kune
+copy target\kune-0.0.5\org.ourproject.kune.Main\* src\main\webapp\gwt\org.ourproject.kune
Modified: trunk/script/deploy_gwt.sh
===================================================================
--- trunk/script/deploy_gwt.sh 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/script/deploy_gwt.sh 2008-11-11 13:12:39 UTC (rev 946)
@@ -2,11 +2,11 @@
mkdir -p src/main/webapp/gwt/org.ourproject.kune.app.Kune
-find target/kune-0.0.4/org.ourproject.kune.app.Kune/ -name .DS_Store -exec rm {} \;
+find target/kune-0.0.5/org.ourproject.kune.app.Kune/ -name .DS_Store -exec rm {} \;
script/css-compact-and-tidy.css
script/css-update.sh
-cp target/kune-0.0.4/org.ourproject.kune.app.Kune/js/ext/ext-all-debug.js target/kune-0.0.4/org.ourproject.kune.app.Kune/js/ext/ext-all.js
-rsync --delete -C -r -p target/kune-0.0.4/org.ourproject.kune.app.Kune/ src/main/webapp/gwt/org.ourproject.kune.app.Kune/
+cp target/kune-0.0.5/org.ourproject.kune.app.Kune/js/ext/ext-all-debug.js target/kune-0.0.5/org.ourproject.kune.app.Kune/js/ext/ext-all.js
+rsync --delete -C -r -p target/kune-0.0.5/org.ourproject.kune.app.Kune/ src/main/webapp/gwt/org.ourproject.kune.app.Kune/
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-11-11 13:12:39 UTC (rev 946)
@@ -41,4 +41,4 @@
padding: 1px 0px 1px 1px;
text-decoration:none;
}
-*/.k-textlinethrough{text-decoration:line-through;color:red;}.k-textnormal{text-decoration:inherit;color:green;}.k-textunderline{text-decoration:underline;color:gray;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}
\ No newline at end of file
+*/.k-textlinethrough{text-decoration:line-through;color:red;}.k-textnormal{text-decoration:inherit;color:green;}.k-textunderline{text-decoration:underline;color:gray;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-11-11 13:12:39 UTC (rev 946)
@@ -750,11 +750,36 @@
}
.k-error-tb {
- background: #FFB380 none repeat scroll 0% 50%;
- color: #250;
+ background: #FFB380 none repeat scroll 0% 50%;
+ color: #250;
}
.k-infod-head {
- font-size: 108%;
- margin-bottom: 10px;
-}
\ No newline at end of file
+ font-size: 108%;
+ margin-bottom: 10px;
+}
+
+.gwt-DisclosurePanel {
+}
+
+.gwt-DisclosurePanel-open {
+}
+
+.gwt-DisclosurePanel-closed {
+}
+
+.gwt-DisclosurePanel .header,
+.gwt-DisclosurePanel .header a,
+.gwt-DisclosurePanel .header td {
+ text-decoration: none; /* Remove underline from header */
+ color: black;
+ cursor: pointer;
+ cursor: hand;
+}
+
+.gwt-DisclosurePanel .content {
+ border-left: 3px solid #e8eef7;
+ padding: 4px 0px 4px 8px;
+ margin-left: 6px;
+}
+
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -28,8 +28,8 @@
import static org.ourproject.kune.docs.client.DocumentClientTool.TYPE_WIKI;
import static org.ourproject.kune.docs.client.DocumentClientTool.TYPE_WIKIPAGE;
-import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewer;
-import org.ourproject.kune.docs.client.ctx.admin.DocContextEditor;
+import org.ourproject.kune.docs.client.cnt.DocumentViewer;
+import org.ourproject.kune.docs.client.ctx.admin.DocContextPropEditor;
import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
import org.ourproject.kune.platf.client.actions.ActionMenuItemDescriptor;
import org.ourproject.kune.platf.client.actions.ActionToolbarButtonAndItemDescriptor;
@@ -87,7 +87,7 @@
private final Provider<TextEditor> textEditorProvider;
private final KuneErrorHandler errorHandler;
private final DocumentViewer documentViewer;
- private final Provider<DocContextEditor> adminContextProvider;
+ private final Provider<DocContextPropEditor> contextPropEditorProvider;
public DocumentClientActions(final I18nUITranslationService i18n, final ContextNavigator contextNavigator,
final Session session, final StateManager stateManager,
@@ -96,7 +96,7 @@
final ContentActionRegistry contentActionRegistry, final ContextActionRegistry contextActionRegistry,
final Provider<FileDownloadUtils> fileDownloadProvider, final EntityLogo entityLogo,
final Provider<TextEditor> textEditorProvider, final KuneErrorHandler errorHandler,
- final DocumentViewer documentViewer, final Provider<DocContextEditor> adminContextProvider) {
+ final DocumentViewer documentViewer, final Provider<DocContextPropEditor> contextProvEditorProvider) {
this.i18n = i18n;
this.contextNavigator = contextNavigator;
this.session = session;
@@ -111,7 +111,7 @@
this.textEditorProvider = textEditorProvider;
this.errorHandler = errorHandler;
this.documentViewer = documentViewer;
- this.adminContextProvider = adminContextProvider;
+ this.contextPropEditorProvider = contextProvEditorProvider;
createActions();
}
@@ -339,7 +339,7 @@
final TextEditor editor = textEditorProvider.get();
documentViewer.detach();
contextNavigator.detach();
- adminContextProvider.get().attach();
+ contextPropEditorProvider.get().attach();
editor.editContent(session.getContentState().getContent(), new Listener<String>() {
public void onEvent(final String html) {
Site.showProgressSaving();
@@ -371,7 +371,7 @@
DeferredCommand.addCommand(new Command() {
public void execute() {
documentViewer.attach();
- adminContextProvider.get().detach();
+ contextPropEditorProvider.get().detach();
contextNavigator.attach();
if (session.getCurrentStateToken().equals(stateToken)) {
documentViewer.refreshState();
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -18,20 +18,20 @@
*
*/package org.ourproject.kune.docs.client;
-import org.ourproject.kune.docs.client.cnt.folder.viewer.DocFolderContent;
-import org.ourproject.kune.docs.client.cnt.folder.viewer.DocFolderContentPanel;
-import org.ourproject.kune.docs.client.cnt.folder.viewer.DocFolderContentPresenter;
-import org.ourproject.kune.docs.client.cnt.folder.viewer.DocFolderContentView;
-import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewer;
-import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewerPanel;
-import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewerPresenter;
-import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewerView;
+import org.ourproject.kune.docs.client.cnt.DocFolderContent;
+import org.ourproject.kune.docs.client.cnt.DocFolderContentPanel;
+import org.ourproject.kune.docs.client.cnt.DocFolderContentPresenter;
+import org.ourproject.kune.docs.client.cnt.DocFolderContentView;
+import org.ourproject.kune.docs.client.cnt.DocumentViewer;
+import org.ourproject.kune.docs.client.cnt.DocumentViewerPanel;
+import org.ourproject.kune.docs.client.cnt.DocumentViewerPresenter;
+import org.ourproject.kune.docs.client.cnt.DocumentViewerView;
import org.ourproject.kune.docs.client.ctx.DocumentContext;
import org.ourproject.kune.docs.client.ctx.DocumentContextPresenter;
-import org.ourproject.kune.docs.client.ctx.admin.DocContextEditor;
-import org.ourproject.kune.docs.client.ctx.admin.DocContextEditorPanel;
-import org.ourproject.kune.docs.client.ctx.admin.DocContextEditorPresenter;
-import org.ourproject.kune.docs.client.ctx.admin.DocContextEditorView;
+import org.ourproject.kune.docs.client.ctx.admin.DocContextPropEditor;
+import org.ourproject.kune.docs.client.ctx.admin.DocContextPropEditorPanel;
+import org.ourproject.kune.docs.client.ctx.admin.DocContextPropEditorPresenter;
+import org.ourproject.kune.docs.client.ctx.admin.DocContextPropEditorView;
import org.ourproject.kune.platf.client.actions.ContentActionRegistry;
import org.ourproject.kune.platf.client.actions.ContentIconsRegistry;
import org.ourproject.kune.platf.client.actions.ContextActionRegistry;
@@ -52,6 +52,7 @@
import org.ourproject.kune.workspace.client.editor.TextEditor;
import org.ourproject.kune.workspace.client.entitylogo.EntityLogo;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.i18n.LanguageSelector;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
import org.ourproject.kune.workspace.client.tags.TagsSummary;
import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
@@ -85,18 +86,18 @@
$$(GroupServiceAsync.class), $$(FileUploader.class), $(ContentActionRegistry.class),
$(ContextActionRegistry.class), $$(FileDownloadUtils.class), $(EntityLogo.class),
$$(TextEditor.class), $(KuneErrorHandler.class), $(DocumentViewer.class),
- $$(DocContextEditor.class));
+ $$(DocContextPropEditor.class));
}
});
- register(Singleton.class, new Factory<DocContextEditor>(DocContextEditor.class) {
+ register(Singleton.class, new Factory<DocContextPropEditor>(DocContextPropEditor.class) {
@Override
- public DocContextEditor create() {
- final DocContextEditorPresenter presenter = new DocContextEditorPresenter($(Session.class),
+ public DocContextPropEditor create() {
+ final DocContextPropEditorPresenter presenter = new DocContextPropEditorPresenter($(Session.class),
$(StateManager.class), $$(TagsSummary.class), $$(ContentServiceAsync.class),
$(EntityTitle.class), $(EntitySubTitle.class));
- final DocContextEditorView view = new DocContextEditorPanel(presenter,
- $(I18nUITranslationService.class), $(WorkspaceSkeleton.class));
+ final DocContextPropEditorView view = new DocContextPropEditorPanel(presenter,
+ $(I18nUITranslationService.class), $(WorkspaceSkeleton.class), $$(LanguageSelector.class));
presenter.init(view);
return presenter;
}
@@ -106,7 +107,7 @@
@Override
public DocumentContext create() {
final DocumentContextPresenter presenter = new DocumentContextPresenter($(StateManager.class),
- $$(ContextNavigator.class), $$(DocContextEditor.class));
+ $$(ContextNavigator.class), $$(DocContextPropEditor.class));
return presenter;
}
});
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocFolderContent.java (from rev 942, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContent.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContent.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocFolderContent.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,23 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.cnt;
+
+public interface DocFolderContent {
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocFolderContentPanel.java (from rev 943, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentPanel.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentPanel.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocFolderContentPanel.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,33 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.cnt;
+
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.workspace.client.cnt.FoldableContentPanel;
+import org.ourproject.kune.workspace.client.site.Site;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+public class DocFolderContentPanel extends FoldableContentPanel implements DocFolderContentView {
+
+ public DocFolderContentPanel(WorkspaceSkeleton ws, I18nTranslationService i18n) {
+ super(ws, i18n);
+ super.setLabel("Folder properties, translations ..." + Site.IN_DEVELOPMENT);
+ }
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocFolderContentPresenter.java (from rev 942, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentPresenter.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentPresenter.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocFolderContentPresenter.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,40 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.cnt;
+
+import org.ourproject.kune.docs.client.DocumentClientTool;
+import org.ourproject.kune.platf.client.actions.ActionRegistry;
+import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.cnt.FoldableContentPresenter;
+
+public class DocFolderContentPresenter extends FoldableContentPresenter implements DocFolderContent {
+
+ public DocFolderContentPresenter(StateManager stateManager, Session session, ActionContentToolbar toolbar,
+ final ActionRegistry<StateToken> actionRegistry) {
+ super(DocumentClientTool.NAME, stateManager, session, toolbar, actionRegistry);
+ }
+
+ public void init(final DocFolderContentView view) {
+ super.init(view);
+ }
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocFolderContentView.java (from rev 942, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentView.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentView.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocFolderContentView.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,25 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.cnt;
+
+import org.ourproject.kune.workspace.client.cnt.AbstractContentView;
+
+public interface DocFolderContentView extends AbstractContentView {
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewer.java (from rev 943, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewer.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewer.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewer.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,30 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.cnt;
+
+public interface DocumentViewer {
+
+ void attach();
+
+ void detach();
+
+ void refreshState();
+
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewerPanel.java (from rev 943, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPanel.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPanel.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewerPanel.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,30 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.cnt;
+
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.workspace.client.cnt.FoldableContentPanel;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+public class DocumentViewerPanel extends FoldableContentPanel implements DocumentViewerView {
+ public DocumentViewerPanel(final WorkspaceSkeleton ws, I18nTranslationService i18n) {
+ super(ws, i18n);
+ }
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewerPresenter.java (from rev 943, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPresenter.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPresenter.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewerPresenter.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,81 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.cnt;
+
+import org.ourproject.kune.docs.client.DocumentClientTool;
+import org.ourproject.kune.platf.client.actions.ContentActionRegistry;
+import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar;
+import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
+import org.ourproject.kune.platf.client.ui.download.ImageSize;
+import org.ourproject.kune.workspace.client.cnt.FoldableContentPresenter;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+
+import com.calclab.suco.client.ioc.Provider;
+
+public class DocumentViewerPresenter extends FoldableContentPresenter implements DocumentViewer {
+ private DocumentViewerView view;
+ private final Provider<FileDownloadUtils> downloadProvider;
+
+ public DocumentViewerPresenter(StateManager stateManager, Session session, I18nUITranslationService i18n,
+ ActionContentToolbar toolbar, ContentActionRegistry actionRegistry,
+ Provider<FileDownloadUtils> downloadProvider) {
+ super(DocumentClientTool.NAME, stateManager, session, toolbar, actionRegistry);
+ this.downloadProvider = downloadProvider;
+ }
+
+ public void init(DocumentViewerView view) {
+ super.init(view);
+ this.view = view;
+ }
+
+ public void refreshState() {
+ setState(session.getContentState());
+ }
+
+ @Override
+ protected void setState(StateContentDTO state) {
+ super.setState(state);
+ String typeId = state.getTypeId();
+ String text = state.getContent();
+ StateToken token = state.getStateToken();
+ BasicMimeTypeDTO mimeType = state.getMimeType();
+ if (typeId.equals(DocumentClientTool.TYPE_UPLOADEDFILE)) {
+ if (mimeType != null) {
+ FileDownloadUtils fileDownloadUtils = downloadProvider.get();
+ if (mimeType.getType().equals("image")) {
+ view.showImage(fileDownloadUtils.getImageUrl(token), fileDownloadUtils.getImageResizedUrl(token,
+ ImageSize.sized));
+ } else if (mimeType.toString().equals("text/plain") || mimeType.toString().equals("application/pdf")) {
+ view.setContent(text);
+ } else {
+ view.setContent("");
+ }
+ }
+ } else {
+ view.setContent(text);
+ }
+ view.attach();
+ }
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewerView.java (from rev 943, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerView.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerView.java 2008-11-10 19:00:10 UTC (rev 943)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentViewerView.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,30 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.cnt;
+
+import org.ourproject.kune.workspace.client.cnt.AbstractContentView;
+
+public interface DocumentViewerView extends AbstractContentView {
+
+ void setContent(String content);
+
+ void showImage(String imageUrl, String imageResizedUrl);
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -20,7 +20,7 @@
package org.ourproject.kune.docs.client.ctx;
import org.ourproject.kune.docs.client.DocumentClientTool;
-import org.ourproject.kune.docs.client.ctx.admin.DocContextEditor;
+import org.ourproject.kune.docs.client.ctx.admin.DocContextPropEditor;
import org.ourproject.kune.platf.client.dto.StateContainerDTO;
import org.ourproject.kune.platf.client.dto.StateContentDTO;
import org.ourproject.kune.platf.client.state.StateManager;
@@ -30,11 +30,11 @@
import com.calclab.suco.client.ioc.Provider;
public class DocumentContextPresenter extends FoldableContextPresenter implements DocumentContext {
- private final Provider<DocContextEditor> adminContextProvider;
+ private final Provider<DocContextPropEditor> adminContextProvider;
public DocumentContextPresenter(final StateManager stateManager,
final Provider<ContextNavigator> contextNavigatorProvider,
- final Provider<DocContextEditor> adminContextProvider) {
+ final Provider<DocContextPropEditor> adminContextProvider) {
super(DocumentClientTool.NAME, stateManager, contextNavigatorProvider);
this.adminContextProvider = adminContextProvider;
}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditor.java 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditor.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -1,32 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.ctx.admin;
-
-import org.ourproject.kune.platf.client.dto.StateContentDTO;
-
-public interface DocContextEditor {
- void attach();
-
- void clear();
-
- void detach();
-
- void setState(StateContentDTO content);
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPanel.java 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPanel.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -1,277 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.ctx.admin;
-
-import java.util.Date;
-import java.util.List;
-
-import org.ourproject.kune.platf.client.dto.AccessListsDTO;
-import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
-import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.VerticalPanel;
-
-public class DocContextEditorPanel extends VerticalPanel implements DocContextEditorView {
- // private static final Images IMG = Images.App.getInstance();
-
- // private static final int FORMS_WIDTH = 145;
-
- // private final IndexedStackPanelWithSubItems options;
- // private final AdminContextPresenter presenter;
- //
- // private AccessListsPanel accessListsPanel;
- // private DateField publishedOnField;
- // private TextArea tagsField;
- // private VerticalPanel tagsComponent;
- // private VerticalPanel publishedOnComponent;
- // private LanguageSelectorComponent langPresenter;
- // private VerticalPanel authorsComponent;
- // private VerticalPanel langComponent;
- // private IconLabel addAuthorLabel;
- // private final I18nTranslationService i18n;
- // private final String authors_item;
- // private final String publication_item;
- // private final String perms_item;
- // private final String language_item;
- // private final String tags_item;
-
- private final WorkspaceSkeleton ws;
- private final Label testLabel;
-
- public DocContextEditorPanel(final DocContextEditorPresenter presenter, final I18nTranslationService i18n,
- WorkspaceSkeleton ws) {
- this.ws = ws;
- testLabel = new Label("Admin ctx");
- // this.presenter = presenter;
- // this.i18n = i18n;
- // options = new IndexedStackPanelWithSubItems();
- // //options.addStyleName("kune-AdminContextPanel");
- //
- // //add(options);
- // //setCellWidth(options, "100%");
- // setWidth("100%");
- // authors_item = i18n.t("Authors");
- // publication_item = i18n.t("Publication");
- // perms_item = i18n.t("Permissions");
- // language_item = i18n.t("Language");
- // tags_item = i18n.t("Tags");
- }
-
- public void attach() {
- if (!testLabel.isAttached()) {
- ws.getEntityWorkspace().setContext(testLabel);
- }
- }
-
- public void detach() {
- if (testLabel.isAttached()) {
- testLabel.removeFromParent();
- }
- }
-
- public void removeAccessListComponent() {
- // if (options.containsItem(perms_item)) {
- // removeComponent(perms_item);
- // }
- }
-
- public void removeAuthorsComponent() {
- // if (options.containsItem(authors_item)) {
- // removeComponent(authors_item);
- // }
- }
-
- public void removeLangComponent() {
- // if (options.containsItem(language_item)) {
- // removeComponent(language_item);
- // }
- }
-
- public void removePublishedOnComponent() {
- // if (options.containsItem(publication_item)) {
- // removeComponent(publication_item);
- // }
- }
-
- public void removeTagsComponent() {
- // if (options.containsItem(tags_item)) {
- // removeComponent(tags_item);
- // }
- }
-
- public void reset() {
- // options.clear();
- }
-
- public void setAccessLists(final AccessListsDTO accessLists) {
- // if (accessListsPanel == null) {
- // accessListsPanel = new AccessListsPanel(i18n);
- // }
- // if (!options.containsItem(perms_item)) {
- // addComponent(perms_item, i18n.t("Who can admin/edit/view this work"),
- // accessListsPanel);
- // }
- // accessListsPanel.setAccessLists(accessLists);
- }
-
- public void setAuthors(final List<UserSimpleDTO> authors) {
- // if (authorsComponent == null) {
- // authorsComponent = new VerticalPanel();
- // addAuthorLabel = new IconLabel(IMG.addGreen(), i18n.t("Add author"));
- // addAuthorLabel.addClickListener(new ClickListener() {
- // public void onClick(final Widget sender) {
- // presenter.doAction(DocsEvents.ADD_AUTHOR, null);
- // }
- // });
- // } else {
- // if (options.containsItem(authors_item)) {
- // options.removeStackItem(authors_item);
- // }
- // authorsComponent.clear();
- // }
- // if (!options.containsItem(authors_item)) {
- // addComponent(authors_item, i18n.t("Authors of this work"),
- // authorsComponent);
- // }
- // for (final Iterator<UserSimpleDTO> iterator = authors.iterator();
- // iterator.hasNext();) {
- // final UserSimpleDTO author = iterator.next();
- // final StackSubItemAction[] authorActions = { new
- // StackSubItemAction(IMG.del(), i18n.t("Remove author"),
- // DocsEvents.REMOVE_AUTHOR) };
- // options.addStackSubItem(authors_item, IMG.personDef(),
- // author.getShortName(), author.getName(),
- // authorActions, presenter);
- // }
- // authorsComponent.add(addAuthorLabel);
- }
-
- public void setLanguage(final I18nLanguageDTO language) {
- // if (langComponent == null) {
- // langPresenter = WorkspaceFactory.createLanguageSelectorComponent();
- // langComponent = new VerticalPanel();
- // final LanguageSelectorPanel view = (LanguageSelectorPanel)
- // langPresenter.getView();
- // view.setWidth("" + FORMS_WIDTH);
- // langComponent.add(view);
- // view.addChangeListener(new ComboBoxListenerAdapter() {
- // public void onSelect(final ComboBox comboBox, final Record record,
- // final int index) {
- // presenter.doChangeLanguage(record.getAsString(LanguageSelectorPanel.LANG_ID));
- // }
- // });
- // }
- // if (!options.containsItem(language_item)) {
- // addComponent(language_item, i18n.t("The language of this work"),
- // langComponent);
- // }
- // langPresenter.setLanguage(language);
- }
-
- public void setPublishedOn(final Date publishedOn) {
- // if (publishedOnField == null) {
- // publishedOnComponent = createPublicationComponent();
- // }
- // if (!options.containsItem(publication_item)) {
- // addComponent(publication_item, i18n.t("Date of publication of this
- // work"), publishedOnComponent);
- // }
- // // publishedOnField.setValue(publishedOn);
- }
-
- public void setTags(final String tags) {
- // if (tagsComponent == null) {
- // tagsComponent = createTagsComponent();
- // }
- // if (!options.containsItem(tags_item)) {
- // addComponent(tags_item,
- // i18n.t("Keywords or terms associated with this work"),
- // tagsComponent);
- // }
- // tagsField.setValue(tags);
- // }
- //
- // private void addComponent(final String header, final String
- // headerTitle,
- // final VerticalPanel panel) {
- // panel.addStyleName("kune-AdminContextPanel-inner-wrap");
- // final VerticalPanel vp = options.addStackItem(header, headerTitle,
- // false);
- // vp.setStyleName("kune-AdminContextPanel-inner");
- // vp.add(panel);
- // vp.setCellWidth(panel, "100%");
- // vp.setWidth("100%");
- }
-
- // private FormPanel createDefaultForm() {
- // final FormPanel form = new FormPanel();
- // form.setHideLabels(true);
- // form.setWidth(FORMS_WIDTH);
- // form.setBorder(false);
- // return form;
- // }
-
- // private VerticalPanel createPublicationComponent() {
- // // final FormPanel form = createDefaultForm();
- // //
- // // publishedOnField = new DateField();
- // // publishedOnField.setWidth("140");
- // // publishedOnField.setFormat("Y-m-d");
- // //
- // // publishedOnField.addListener(new FieldListenerAdapter() {
- // // public void onChange(final Field field, final Object newVal, final
- // // Object oldVal) {
- // // presenter.setPublishedOn((Date) newVal);
- // // }
- // // });
- // //
- // // form.add(publishedOnField);
- // //
- // // final VerticalPanel vp = new VerticalPanel();
- // // vp.add(form);
- // // return vp;
- // //// }
- //
- // private VerticalPanel createTagsComponent() {
- // final FormPanel form = createDefaultForm();
- // tagsField = new TextArea();
- // tagsField.setWidth("" + FORMS_WIDTH);
- // tagsField.setHeight("3em");
- // tagsField.addListener(new FieldListenerAdapter() {
- // public void onChange(final Field field, final Object newVal, final
- // Object oldVal) {
- // presenter.setTags((String) newVal);
- // }
- // });
- //
- // form.add(tagsField);
- // final VerticalPanel vp = new VerticalPanel();
- // vp.add(form);
- // return vp;
- // }
-
- // private void removeComponent(final String header) {
- // options.removeStackItem(header);
- // }
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPresenter.java 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPresenter.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -1,176 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.ctx.admin;
-
-import java.util.Date;
-import java.util.List;
-
-import org.ourproject.kune.platf.client.dto.AccessListsDTO;
-import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.StateContainerDTO;
-import org.ourproject.kune.platf.client.dto.StateContentDTO;
-import org.ourproject.kune.platf.client.dto.TagResultDTO;
-import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
-import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.state.StateManager;
-import org.ourproject.kune.workspace.client.site.Site;
-import org.ourproject.kune.workspace.client.tags.TagsSummary;
-import org.ourproject.kune.workspace.client.title.EntitySubTitle;
-import org.ourproject.kune.workspace.client.title.EntityTitle;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class DocContextEditorPresenter implements DocContextEditor {
-
- private DocContextEditorView view;
- private final Session session;
- private final Provider<TagsSummary> tagsSummaryProvider;
- private final Provider<ContentServiceAsync> contentServiceProvider;
- private final EntitySubTitle entitySubTitle;
- private final EntityTitle entityTitle;
- private final StateManager stateManager;
-
- public DocContextEditorPresenter(final Session session, final StateManager stateManager,
- final Provider<TagsSummary> tagsSummaryProvider,
- final Provider<ContentServiceAsync> contentServiceProvider, final EntityTitle entityTitle,
- final EntitySubTitle entitySubTitle) {
- this.session = session;
- this.stateManager = stateManager;
- this.tagsSummaryProvider = tagsSummaryProvider;
- this.contentServiceProvider = contentServiceProvider;
- this.entityTitle = entityTitle;
- this.entitySubTitle = entitySubTitle;
- }
-
- public void addAuthor(final String authorShortName) {
- Site.showProgressProcessing();
- final StateContainerDTO currentState = session.getContentState();
- contentServiceProvider.get().addAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName,
- new AsyncCallbackSimple<Object>() {
- public void onSuccess(final Object result) {
- Site.hideProgress();
- stateManager.reload();
- }
- });
- }
-
- public void attach() {
- view.attach();
- }
-
- public void clear() {
- view.reset();
- }
-
- public void delAuthor(final String authorShortName) {
- Site.showProgressProcessing();
- final StateContainerDTO currentState = session.getContentState();
- contentServiceProvider.get().removeAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName,
- new AsyncCallbackSimple<Object>() {
- public void onSuccess(final Object result) {
- Site.hideProgress();
- stateManager.reload();
- }
- });
- }
-
- public void detach() {
- view.detach();
- }
-
- public void doChangeLanguage(final String langCode) {
- Site.showProgressProcessing();
- final StateContainerDTO currentState = session.getContentState();
- contentServiceProvider.get().setLanguage(session.getUserHash(), currentState.getStateToken(), langCode,
- new AsyncCallbackSimple<I18nLanguageDTO>() {
- public void onSuccess(final I18nLanguageDTO lang) {
- Site.hideProgress();
- entitySubTitle.setContentLanguage(lang.getEnglishName());
- }
- });
- }
-
- public void init(final DocContextEditorView view) {
- this.view = view;
- }
-
- public void setPublishedOn(final Date publishedOn) {
- Site.showProgressProcessing();
- final StateContainerDTO currentState = session.getContentState();
- contentServiceProvider.get().setPublishedOn(session.getUserHash(), currentState.getStateToken(), publishedOn,
- new AsyncCallbackSimple<Object>() {
- public void onSuccess(final Object result) {
- Site.hideProgress();
- entityTitle.setContentDate(publishedOn);
- }
- });
-
- }
-
- public void setState(final StateContentDTO content) {
- // In the future check the use of these components by each tool
- final I18nLanguageDTO language = content.getLanguage();
- final AccessListsDTO accessLists = content.getAccessLists();
- final Date publishedOn = content.getPublishedOn();
- final String tags = content.getTags();
- final List<UserSimpleDTO> authors = content.getAuthors();
-
- if (tags != null) {
- view.setTags(tags);
- } else {
- view.removeTagsComponent();
- }
- if (language != null) {
- view.setLanguage(language);
- } else {
- view.removeLangComponent();
- }
- if (authors != null) {
- view.setAuthors(authors);
- } else {
- view.removeAuthorsComponent();
- }
- if (publishedOn != null) {
- view.setPublishedOn(publishedOn);
- } else {
- view.removePublishedOnComponent();
- }
- if (accessLists != null) {
- view.setAccessLists(accessLists);
- } else {
- view.removeAccessListComponent();
- }
- }
-
- public void setTags(final String tagsString) {
- Site.showProgressProcessing();
- final StateContainerDTO currentState = session.getContentState();
- contentServiceProvider.get().setTags(session.getUserHash(), currentState.getStateToken(), tagsString,
- new AsyncCallbackSimple<List<TagResultDTO>>() {
- public void onSuccess(final List<TagResultDTO> result) {
- tagsSummaryProvider.get().setGroupTags(result);
- Site.hideProgress();
- }
- });
- }
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorView.java 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorView.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -1,58 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.ctx.admin;
-
-import java.util.Date;
-import java.util.List;
-
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.AccessListsDTO;
-import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
-
-public interface DocContextEditorView extends View {
-
- void attach();
-
- void detach();
-
- void removeAccessListComponent();
-
- void removeAuthorsComponent();
-
- void removeLangComponent();
-
- void removePublishedOnComponent();
-
- void removeTagsComponent();
-
- void reset();
-
- void setAccessLists(AccessListsDTO accessLists);
-
- void setAuthors(List<UserSimpleDTO> authors);
-
- void setLanguage(I18nLanguageDTO language);
-
- void setPublishedOn(Date publishedOn);
-
- void setTags(String tags);
-
-}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextPropEditor.java (from rev 941, trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditor.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditor.java 2008-11-06 00:35:01 UTC (rev 941)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextPropEditor.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,32 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.ctx.admin;
+
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
+
+public interface DocContextPropEditor {
+ void attach();
+
+ void clear();
+
+ void detach();
+
+ void setState(StateContentDTO content);
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextPropEditorPanel.java (from rev 941, trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPanel.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPanel.java 2008-11-06 00:35:01 UTC (rev 941)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextPropEditorPanel.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,255 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.ctx.admin;
+
+import java.util.Date;
+import java.util.List;
+
+import org.ourproject.kune.platf.client.dto.AccessListsDTO;
+import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
+import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.ui.ContextPropertyPanel;
+import org.ourproject.kune.workspace.client.i18n.LanguageSelector;
+import org.ourproject.kune.workspace.client.i18n.LanguageSelectorPanel;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+import com.calclab.suco.client.ioc.Provider;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.gwtext.client.data.Record;
+import com.gwtext.client.widgets.form.ComboBox;
+import com.gwtext.client.widgets.form.Field;
+import com.gwtext.client.widgets.form.FormPanel;
+import com.gwtext.client.widgets.form.TextArea;
+import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
+import com.gwtext.client.widgets.form.event.FieldListenerAdapter;
+
+public class DocContextPropEditorPanel extends ScrollPanel implements DocContextPropEditorView {
+
+ private static final int FORMS_WIDTH = 150;
+ public static final String TAGS_PROP = "k-dcpep-tagsp-dis";
+ public static final String LANG_PROP = "k-dcpep-tagsp-dis";
+
+ private final DocContextPropEditorPresenter presenter;
+ private final WorkspaceSkeleton ws;
+ private final I18nTranslationService i18n;
+ private TextArea tagsField;
+ private ContextPropertyPanel tagsComponent;
+ private final Provider<LanguageSelector> langSelectorProv;
+ private ContextPropertyPanel langComponent;
+ private final VerticalPanel vp;
+
+ public DocContextPropEditorPanel(final DocContextPropEditorPresenter presenter, final I18nTranslationService i18n,
+ WorkspaceSkeleton ws, Provider<LanguageSelector> langSelectorProv) {
+ this.i18n = i18n;
+ this.ws = ws;
+ this.presenter = presenter;
+ this.langSelectorProv = langSelectorProv;
+ super.addStyleName("kune-Margin-Medium-trbl");
+ vp = new VerticalPanel();
+ super.add(vp);
+ // authors_item = i18n.t("Authors");
+ // publication_item = i18n.t("Publication");
+ // perms_item = i18n.t("Permissions");
+ // language_item = i18n.t("Language");
+ // tags_item = i18n.t("Tags");
+ }
+
+ public void attach() {
+ if (!super.isAttached()) {
+ ws.getEntityWorkspace().setContext(this);
+ }
+ }
+
+ public void detach() {
+ if (super.isAttached()) {
+ super.removeFromParent();
+ }
+ }
+
+ public void removeAccessListComponent() {
+ // if (options.containsItem(perms_item)) {
+ // removeComponent(perms_item);
+ // }
+ }
+
+ public void removeAuthorsComponent() {
+ // if (options.containsItem(authors_item)) {
+ // removeComponent(authors_item);
+ // }
+ }
+
+ public void removeLangComponent() {
+ if (langComponent != null) {
+ langComponent.removeFromParent();
+ }
+ }
+
+ public void removePublishedOnComponent() {
+ // if (options.containsItem(publication_item)) {
+ // removeComponent(publication_item);
+ // }
+ }
+
+ public void removeTagsComponent() {
+ if (tagsComponent != null) {
+ tagsComponent.removeFromParent();
+ }
+ }
+
+ public void reset() {
+ tagsField.reset();
+ }
+
+ public void setAccessLists(final AccessListsDTO accessLists) {
+ // if (accessListsPanel == null) {
+ // accessListsPanel = new AccessListsPanel(i18n);
+ // }
+ // if (!options.containsItem(perms_item)) {
+ // addComponent(perms_item, i18n.t("Who can admin/edit/view this work"),
+ // accessListsPanel);
+ // }
+ // accessListsPanel.setAccessLists(accessLists);
+ }
+
+ public void setAuthors(final List<UserSimpleDTO> authors) {
+ // if (authorsComponent == null) {
+ // authorsComponent = new VerticalPanel();
+ // addAuthorLabel = new IconLabel(IMG.addGreen(), i18n.t("Add author"));
+ // addAuthorLabel.addClickListener(new ClickListener() {
+ // public void onClick(final Widget sender) {
+ // presenter.doAction(DocsEvents.ADD_AUTHOR, null);
+ // }
+ // });
+ // } else {
+ // if (options.containsItem(authors_item)) {
+ // options.removeStackItem(authors_item);
+ // }
+ // authorsComponent.clear();
+ // }
+ // if (!options.containsItem(authors_item)) {
+ // addComponent(authors_item, i18n.t("Authors of this work"),
+ // authorsComponent);
+ // }
+ // for (final Iterator<UserSimpleDTO> iterator = authors.iterator();
+ // iterator.hasNext();) {
+ // final UserSimpleDTO author = iterator.next();
+ // final StackSubItemAction[] authorActions = { new
+ // StackSubItemAction(IMG.del(), i18n.t("Remove author"),
+ // DocsEvents.REMOVE_AUTHOR) };
+ // options.addStackSubItem(authors_item, IMG.personDef(),
+ // author.getShortName(), author.getName(),
+ // authorActions, presenter);
+ // }
+ // authorsComponent.add(addAuthorLabel);
+ }
+
+ public void setLanguage(final I18nLanguageDTO language) {
+ if (langComponent == null) {
+ final LanguageSelectorPanel view = (LanguageSelectorPanel) langSelectorProv.get().getView();
+ view.setWidth(FORMS_WIDTH);
+ langComponent = new ContextPropertyPanel(i18n.t("What language is this in?"), null, true, LANG_PROP, view);
+ view.addChangeListener(new ComboBoxListenerAdapter() {
+ @Override
+ public void onSelect(final ComboBox comboBox, final Record record, final int index) {
+ presenter.doChangeLanguage(record.getAsString(LanguageSelectorPanel.LANG_ID));
+ }
+ });
+ // angComponent.addStyleName("kune-Margin-Medium-t");
+ addComponent(langComponent);
+ }
+ langSelectorProv.get().setLanguage(language);
+ }
+
+ public void setPublishedOn(final Date publishedOn) {
+ // if (publishedOnField == null) {
+ // publishedOnComponent = createPublicationComponent();
+ // }
+ // if (!options.containsItem(publication_item)) {
+ // addComponent(publication_item, i18n.t("Date of publication of this
+ // work"), publishedOnComponent);
+ // }
+ // // publishedOnField.setValue(publishedOn);
+ }
+
+ public void setTags(final String tags) {
+ if (tagsComponent == null) {
+ tagsComponent = createTagsComponent();
+ addComponent(tagsComponent);
+ }
+ tagsField.setValue(tags);
+ }
+
+ private void addComponent(ContextPropertyPanel prop) {
+ vp.add(prop);
+ }
+
+ private FormPanel createDefaultForm() {
+ final FormPanel form = new FormPanel();
+ form.setHideLabels(true);
+ form.setWidth(FORMS_WIDTH);
+ form.setBorder(false);
+ return form;
+ }
+
+ // private VerticalPanel createPublicationComponent() {
+ // // final FormPanel form = createDefaultForm();
+ // //
+ // // publishedOnField = new DateField();
+ // // publishedOnField.setWidth("140");
+ // // publishedOnField.setFormat("Y-m-d");
+ // //
+ // // publishedOnField.addListener(new FieldListenerAdapter() {
+ // // public void onChange(final Field field, final Object newVal, final
+ // // Object oldVal) {
+ // // presenter.setPublishedOn((Date) newVal);
+ // // }
+ // // });
+ // //
+ // // form.add(publishedOnField);
+ // //
+ // // final VerticalPanel vp = new VerticalPanel();
+ // // vp.add(form);
+ // // return vp;
+ // //// }
+ //
+ private ContextPropertyPanel createTagsComponent() {
+ final FormPanel form = createDefaultForm();
+ tagsField = new TextArea();
+ tagsField.setWidth(FORMS_WIDTH - 10);
+ tagsField.setHeight("3em");
+ tagsField.addListener(new FieldListenerAdapter() {
+ @Override
+ public void onChange(final Field field, final Object newVal, final Object oldVal) {
+ presenter.setTags((String) newVal);
+ }
+ });
+ form.add(tagsField);
+ ContextPropertyPanel propertyPanel = new ContextPropertyPanel(i18n.t("Tags"),
+ i18n.t("Keywords or terms associated with this work"), true, TAGS_PROP, form);
+ return propertyPanel;
+ }
+
+ // private void removeComponent(final String header) {
+ // options.removeStackItem(header);
+ // }
+
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextPropEditorPresenter.java (from rev 941, trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPresenter.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPresenter.java 2008-11-06 00:35:01 UTC (rev 941)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextPropEditorPresenter.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,176 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.ctx.admin;
+
+import java.util.Date;
+import java.util.List;
+
+import org.ourproject.kune.platf.client.dto.AccessListsDTO;
+import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
+import org.ourproject.kune.platf.client.dto.TagResultDTO;
+import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
+import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.site.Site;
+import org.ourproject.kune.workspace.client.tags.TagsSummary;
+import org.ourproject.kune.workspace.client.title.EntitySubTitle;
+import org.ourproject.kune.workspace.client.title.EntityTitle;
+
+import com.calclab.suco.client.ioc.Provider;
+
+public class DocContextPropEditorPresenter implements DocContextPropEditor {
+
+ private DocContextPropEditorView view;
+ private final Session session;
+ private final Provider<TagsSummary> tagsSummaryProvider;
+ private final Provider<ContentServiceAsync> contentServiceProvider;
+ private final EntitySubTitle entitySubTitle;
+ private final EntityTitle entityTitle;
+ private final StateManager stateManager;
+
+ public DocContextPropEditorPresenter(final Session session, final StateManager stateManager,
+ final Provider<TagsSummary> tagsSummaryProvider,
+ final Provider<ContentServiceAsync> contentServiceProvider, final EntityTitle entityTitle,
+ final EntitySubTitle entitySubTitle) {
+ this.session = session;
+ this.stateManager = stateManager;
+ this.tagsSummaryProvider = tagsSummaryProvider;
+ this.contentServiceProvider = contentServiceProvider;
+ this.entityTitle = entityTitle;
+ this.entitySubTitle = entitySubTitle;
+ }
+
+ public void addAuthor(final String authorShortName) {
+ Site.showProgressProcessing();
+ final StateContainerDTO currentState = session.getContentState();
+ contentServiceProvider.get().addAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName,
+ new AsyncCallbackSimple<Object>() {
+ public void onSuccess(final Object result) {
+ Site.hideProgress();
+ stateManager.reload();
+ }
+ });
+ }
+
+ public void attach() {
+ view.attach();
+ }
+
+ public void clear() {
+ view.reset();
+ }
+
+ public void delAuthor(final String authorShortName) {
+ Site.showProgressProcessing();
+ final StateContainerDTO currentState = session.getContentState();
+ contentServiceProvider.get().removeAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName,
+ new AsyncCallbackSimple<Object>() {
+ public void onSuccess(final Object result) {
+ Site.hideProgress();
+ stateManager.reload();
+ }
+ });
+ }
+
+ public void detach() {
+ view.detach();
+ }
+
+ public void doChangeLanguage(final String langCode) {
+ Site.showProgressProcessing();
+ final StateContainerDTO currentState = session.getContentState();
+ contentServiceProvider.get().setLanguage(session.getUserHash(), currentState.getStateToken(), langCode,
+ new AsyncCallbackSimple<I18nLanguageDTO>() {
+ public void onSuccess(final I18nLanguageDTO lang) {
+ Site.hideProgress();
+ entitySubTitle.setContentLanguage(lang.getEnglishName());
+ }
+ });
+ }
+
+ public void init(final DocContextPropEditorView view) {
+ this.view = view;
+ }
+
+ public void setPublishedOn(final Date publishedOn) {
+ Site.showProgressProcessing();
+ final StateContainerDTO currentState = session.getContentState();
+ contentServiceProvider.get().setPublishedOn(session.getUserHash(), currentState.getStateToken(), publishedOn,
+ new AsyncCallbackSimple<Object>() {
+ public void onSuccess(final Object result) {
+ Site.hideProgress();
+ entityTitle.setContentDate(publishedOn);
+ }
+ });
+
+ }
+
+ public void setState(final StateContentDTO content) {
+ // In the future check the use of these components by each tool
+ final I18nLanguageDTO language = content.getLanguage();
+ final AccessListsDTO accessLists = content.getAccessLists();
+ final Date publishedOn = content.getPublishedOn();
+ final String tags = content.getTags();
+ final List<UserSimpleDTO> authors = content.getAuthors();
+
+ if (tags != null) {
+ view.setTags(tags);
+ } else {
+ view.removeTagsComponent();
+ }
+ if (language != null) {
+ view.setLanguage(language);
+ } else {
+ view.removeLangComponent();
+ }
+ if (authors != null) {
+ view.setAuthors(authors);
+ } else {
+ view.removeAuthorsComponent();
+ }
+ if (publishedOn != null) {
+ view.setPublishedOn(publishedOn);
+ } else {
+ view.removePublishedOnComponent();
+ }
+ if (accessLists != null) {
+ view.setAccessLists(accessLists);
+ } else {
+ view.removeAccessListComponent();
+ }
+ }
+
+ public void setTags(final String tagsString) {
+ Site.showProgressProcessing();
+ final StateContainerDTO currentState = session.getContentState();
+ contentServiceProvider.get().setTags(session.getUserHash(), currentState.getStateToken(), tagsString,
+ new AsyncCallbackSimple<List<TagResultDTO>>() {
+ public void onSuccess(final List<TagResultDTO> result) {
+ tagsSummaryProvider.get().setGroupTags(result);
+ Site.hideProgress();
+ }
+ });
+ }
+
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextPropEditorView.java (from rev 941, trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorView.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorView.java 2008-11-06 00:35:01 UTC (rev 941)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextPropEditorView.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,58 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.docs.client.ctx.admin;
+
+import java.util.Date;
+import java.util.List;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.dto.AccessListsDTO;
+import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
+import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
+
+public interface DocContextPropEditorView extends View {
+
+ void attach();
+
+ void detach();
+
+ void removeAccessListComponent();
+
+ void removeAuthorsComponent();
+
+ void removeLangComponent();
+
+ void removePublishedOnComponent();
+
+ void removeTagsComponent();
+
+ void reset();
+
+ void setAccessLists(AccessListsDTO accessLists);
+
+ void setAuthors(List<UserSimpleDTO> authors);
+
+ void setLanguage(I18nLanguageDTO language);
+
+ void setPublishedOn(Date publishedOn);
+
+ void setTags(String tags);
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -57,6 +57,7 @@
import org.ourproject.kune.platf.client.state.StateManagerDefault;
import org.ourproject.kune.platf.client.tool.ToolSelector;
import org.ourproject.kune.platf.client.tool.ToolSelectorPresenter;
+import org.ourproject.kune.platf.client.ui.QuickTipsHelper;
import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalette;
import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
@@ -70,14 +71,14 @@
import org.ourproject.kune.workspace.client.entitylogo.EntityLogoSelectorPanel;
import org.ourproject.kune.workspace.client.entitylogo.EntityLogoSelectorPresenter;
import org.ourproject.kune.workspace.client.i18n.I18nTranslator;
+import org.ourproject.kune.workspace.client.i18n.I18nTranslatorPanel;
import org.ourproject.kune.workspace.client.i18n.I18nTranslatorPresenter;
import org.ourproject.kune.workspace.client.i18n.I18nTranslatorView;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.i18n.LanguageSelector;
+import org.ourproject.kune.workspace.client.i18n.LanguageSelectorPanel;
import org.ourproject.kune.workspace.client.i18n.LanguageSelectorPresenter;
import org.ourproject.kune.workspace.client.i18n.LanguageSelectorView;
-import org.ourproject.kune.workspace.client.i18n.ui.I18nTranslatorPanel;
-import org.ourproject.kune.workspace.client.i18n.ui.LanguageSelectorPanel;
import org.ourproject.kune.workspace.client.licensechoose.LicenseChoose;
import org.ourproject.kune.workspace.client.licensechoose.LicenseChoosePanel;
import org.ourproject.kune.workspace.client.licensechoose.LicenseChoosePresenter;
@@ -182,7 +183,15 @@
}
});
+ register(Singleton.class, new Factory<QuickTipsHelper>(QuickTipsHelper.class) {
+ @Override
+ public QuickTipsHelper create() {
+ return new QuickTipsHelper();
+ }
+ });
+
$(I18nUITranslationService.class);
+ $(QuickTipsHelper.class);
}
private void onI18nReady() {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -29,7 +29,6 @@
import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
-import org.ourproject.kune.platf.client.ui.QuickTipsHelper;
import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
import org.ourproject.kune.platf.client.ui.rate.RateIt;
import org.ourproject.kune.platf.client.ui.rate.RateItPanel;
@@ -125,13 +124,6 @@
}
});
- register(ApplicationComponentGroup.class, new Factory<QuickTipsHelper>(QuickTipsHelper.class) {
- @Override
- public QuickTipsHelper create() {
- return new QuickTipsHelper();
- }
- });
-
register(ApplicationComponentGroup.class, new Factory<SiteProgress>(SiteProgress.class) {
@Override
public SiteProgress create() {
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/ContextPropertyPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/ContextPropertyPanel.java 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/ContextPropertyPanel.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,44 @@
+package org.ourproject.kune.platf.client.ui;
+
+import org.ourproject.kune.platf.client.services.Images;
+
+import com.google.gwt.user.client.ui.AbstractImagePrototype;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DisclosurePanel;
+import com.google.gwt.user.client.ui.DisclosurePanelImages;
+import com.google.gwt.user.client.ui.Widget;
+
+public class ContextPropertyPanel extends Composite {
+
+ public ContextPropertyPanel(AbstractImagePrototype headerIcon, String tooltip, String headerText, boolean isOpen,
+ String debugId, Widget content) {
+ this(new IconLabel(headerIcon, headerText), tooltip, isOpen, debugId, content);
+ }
+
+ public ContextPropertyPanel(String headerText, String tooltip, boolean isOpen, String debugId, Widget content) {
+ DisclosurePanelImages images = new DisclosurePanelImages() {
+ public AbstractImagePrototype disclosurePanelClosed() {
+ return Images.App.getInstance().arrowRightWhite();
+ }
+
+ public AbstractImagePrototype disclosurePanelOpen() {
+ return Images.App.getInstance().arrowDownWhite();
+ }
+ };
+ DisclosurePanel disclosure = new DisclosurePanel(images, headerText, isOpen);
+ init(disclosure, tooltip, content, debugId);
+ }
+
+ public ContextPropertyPanel(Widget header, String tooltip, boolean isOpen, String debugId, Widget content) {
+ DisclosurePanel disclosure = new DisclosurePanel(header, isOpen);
+ init(disclosure, tooltip, content, debugId);
+ }
+
+ private void init(DisclosurePanel disclosure, String tooltip, Widget content, String debugId) {
+ disclosure.setAnimationEnabled(true);
+ disclosure.ensureDebugId(debugId);
+ disclosure.setContent(content);
+ KuneUiUtils.setQuickTip(disclosure, tooltip);
+ initWidget(disclosure);
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-11-10 21:32:52 UTC (rev 945)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -34,6 +34,8 @@
import com.calclab.suco.client.listener.Listener;
import com.calclab.suco.client.listener.Listener0;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DeferredCommand;
public class TextEditorPresenter implements TextEditor {
public static final int AUTOSAVE_AFTER_FAILS_IN_MILLISECONS = 20000;
@@ -46,7 +48,6 @@
private final boolean autoSave;
private boolean saveAndCloseConfirmed;
private Listener<String> onSave;
- private Listener0 onEditCancelled;
private final ActionToolbar<StateToken> toolbar;
private ActionToolbarButtonDescriptor<StateToken> save;
private ActionToolbarButtonDescriptor<StateToken> close;
@@ -76,7 +77,6 @@
public void editContent(final String content, final Listener<String> onSave, final Listener0 onEditCancelled) {
this.onSave = onSave;
- this.onEditCancelled = onEditCancelled;
toolbar.attach();
view.attach();
setContent(content);
@@ -151,7 +151,6 @@
reset();
view.detach();
toolbar.detach();
- onEditCancelled.onEvent();
}
protected void onEditHTML() {
@@ -179,7 +178,11 @@
onCancel();
return false;
} else {
- onCancelConfirmed();
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ onCancelConfirmed();
+ }
+ });
return true;
}
}
Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPanel.java (from rev 941, trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java 2008-11-06 00:35:01 UTC (rev 941)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPanel.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,329 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.workspace.client.i18n;
+
+import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.services.Images;
+import org.ourproject.kune.platf.client.ui.AbstractSearcherPanel;
+import org.ourproject.kune.platf.client.ui.TextUtils;
+import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog;
+import org.ourproject.kune.workspace.client.search.SiteBottomTrayButton;
+import org.ourproject.kune.workspace.client.site.Site;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+import com.google.gwt.user.client.ui.Frame;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.core.RegionPosition;
+import com.gwtext.client.data.FieldDef;
+import com.gwtext.client.data.Record;
+import com.gwtext.client.data.Store;
+import com.gwtext.client.data.StringFieldDef;
+import com.gwtext.client.util.Format;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.TabPanel;
+import com.gwtext.client.widgets.Window;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.widgets.form.ComboBox;
+import com.gwtext.client.widgets.form.TextField;
+import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
+import com.gwtext.client.widgets.grid.CellMetadata;
+import com.gwtext.client.widgets.grid.ColumnConfig;
+import com.gwtext.client.widgets.grid.ColumnModel;
+import com.gwtext.client.widgets.grid.EditorGridPanel;
+import com.gwtext.client.widgets.grid.GridEditor;
+import com.gwtext.client.widgets.grid.GridPanel;
+import com.gwtext.client.widgets.grid.Renderer;
+import com.gwtext.client.widgets.grid.event.EditorGridListenerAdapter;
+import com.gwtext.client.widgets.grid.event.GridCellListenerAdapter;
+import com.gwtext.client.widgets.layout.BorderLayoutData;
+import com.gwtext.client.widgets.layout.FitLayout;
+
+public class I18nTranslatorPanel extends AbstractSearcherPanel implements I18nTranslatorView {
+
+ private Window dialog;
+ private final I18nTranslatorPresenter presenter;
+ private LanguageSelectorPanel languageSelectorPanel;
+ private Store unTransStore;
+ private Store transStore;
+ private GridPanel transGrid;
+ private GridPanel unTransGrid;
+ private final LanguageSelector languageSelector;
+ private final WorkspaceSkeleton ws;
+ private SiteBottomTrayButton traybarButton;
+ private final Images img;
+
+ public I18nTranslatorPanel(final I18nTranslatorPresenter initPresenter, final I18nTranslationService i18n,
+ final LanguageSelector languageSelector, final WorkspaceSkeleton ws, Images img) {
+ super(i18n);
+ this.presenter = initPresenter;
+ this.languageSelector = languageSelector;
+ this.ws = ws;
+ this.img = img;
+ }
+
+ public void close() {
+ dialog.hide();
+ }
+
+ public void hide() {
+ dialog.hide();
+ }
+
+ public void hideTranslatorAndIcon() {
+ if (dialog.isRendered()) {
+ dialog.hide();
+ }
+ if (traybarButton != null) {
+ traybarButton.destroy();
+ traybarButton = null;
+ }
+ }
+
+ public void show() {
+ if (dialog == null) {
+ dialog = createDialog();
+ }
+ // By default we use the user lang to help in translation
+ final I18nLanguageDTO lang = presenter.getLanguage();
+ setLanguage(lang);
+ final String languageNativeNameIfAvailable = lang.getNativeName().length() > 0 ? lang.getNativeName()
+ : lang.getEnglishName();
+ dialog.setTitle(i18n.t("Help to translate kune to [%s]", languageNativeNameIfAvailable));
+ dialog.show();
+ dialog.expand();
+ dialog.center();
+ if (traybarButton == null) {
+ traybarButton = new SiteBottomTrayButton("images/language.gif", i18n.t("Show/hide translator"), dialog, ws);
+ }
+ }
+
+ private Window createDialog() {
+ final Panel north = new Panel();
+ north.setBorder(false);
+
+ final Panel center = new TabPanel();
+ center.setAutoScroll(false);
+ center.setClosable(false);
+ center.setBorder(false);
+
+ final Window dialog = new BasicDialog("", false, false, 720, 330);
+ // dialog.setResizable(false);
+ dialog.setIconCls("i18n-icon");
+
+ final Button close = new Button();
+ close.setText(i18n.tWithNT("Close", "used in button"));
+ close.addListener(new ButtonListenerAdapter() {
+ @Override
+ public void onClick(final Button button, final EventObject e) {
+ presenter.doClose();
+ }
+ });
+ dialog.addButton(close);
+
+ final Panel unTransCenterPanel = new Panel(i18n.t("Untranslated"));
+ unTransCenterPanel.setAutoScroll(false);
+ unTransCenterPanel.setLayout(new FitLayout());
+
+ final Panel transCenterPanel = new Panel(i18n.t("Translated"));
+ transCenterPanel.setAutoScroll(false);
+ transCenterPanel.setLayout(new FitLayout());
+
+ final Panel recommendationPanel = new Panel(i18n.t("Recommendations"));
+ recommendationPanel.setAutoScroll(true);
+ recommendationPanel.setLayout(new FitLayout());
+
+ transGrid = createGridPanel(true);
+ unTransGrid = createGridPanel(false);
+ final HorizontalPanel hp = new HorizontalPanel();
+ languageSelectorPanel = (LanguageSelectorPanel) languageSelector.getView();
+ languageSelectorPanel.addChangeListener(new ComboBoxListenerAdapter() {
+ @Override
+ public void onSelect(final ComboBox comboBox, final Record record, final int index) {
+ setLanguage(record.getAsString(LanguageSelectorPanel.LANG_ID));
+ dialog.setTitle(i18n.t("Help to translate kune to [%s]", record.getAsString("language")));
+ }
+ });
+ hp.add(languageSelectorPanel);
+ hp.addStyleName("kune-Margin-Large-trbl");
+ north.add(hp);
+
+ unTransCenterPanel.add(unTransGrid);
+ transCenterPanel.add(transGrid);
+ final Frame recommFrame = new Frame("html/i18n-recom.html");
+ recommFrame.setHeight("auto");
+ recommendationPanel.add(recommFrame);
+
+ center.add(unTransCenterPanel);
+ center.add(transCenterPanel);
+ center.add(recommendationPanel);
+ dialog.add(north, new BorderLayoutData(RegionPosition.NORTH));
+ dialog.add(center, new BorderLayoutData(RegionPosition.CENTER));
+
+ center.setActiveItemID(unTransCenterPanel.getId());
+
+ return dialog;
+ }
+
+ private GridPanel createGridPanel(final boolean translated) {
+
+ final Renderer renderNT = new Renderer() {
+ public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum,
+ Store store) {
+ String renderer;
+ String[] splitted = splitNT((String) value);
+ if (splitted.length > 1) {
+ renderer = "{0} " + img.nt().getHTML();
+ String tip = "<div style='min-width: 75px'>" + splitted[1] + "</div>";
+ cellMetadata.setHtmlAttribute("ext:qtip=\"" + tip + "\" ext:qtitle=\"Note for translators\"");
+ } else {
+ renderer = "{0}";
+ }
+ return Format.format(renderer, splitted);
+ }
+ };
+
+ Store store;
+ final String id = "id";
+ final FieldDef[] fieldDefs = new FieldDef[] { new StringFieldDef("trKey"), new StringFieldDef("text"),
+ new StringFieldDef(id) };
+
+ if (translated) {
+ final String url = "/kune/json/I18nTranslationJSONService/searchtranslated";
+ transStore = createStore(fieldDefs, url, id);
+ store = transStore;
+ } else {
+ final String url = "/kune/json/I18nTranslationJSONService/search";
+ unTransStore = createStore(fieldDefs, url, id);
+ store = unTransStore;
+ }
+
+ final ColumnConfig trKeyColumn = new ColumnConfig() {
+ {
+ setHeader(i18n.t("Text to translate"));
+ setDataIndex("trKey");
+ setWidth(335);
+ setTooltip(i18n.t("Click to sort"));
+ setRenderer(renderNT);
+ }
+ };
+
+ final GridEditor textColumnEditor = new GridEditor(new TextField());
+
+ final ColumnConfig textColumn = new ColumnConfig() {
+ {
+ setHeader(i18n.t("Translation (click to edit)"));
+ setDataIndex("text");
+ setWidth(335);
+ setEditor(textColumnEditor);
+ }
+ };
+
+ final ColumnModel columnModel = new ColumnModel(new ColumnConfig[] { trKeyColumn, textColumn });
+
+ columnModel.setDefaultSortable(true);
+
+ final EditorGridPanel grid = new EditorGridPanel((translated ? "grid-translated" : "grid-untranslated"), 695,
+ 180, store, columnModel);
+ createPagingToolbar(store, grid);
+
+ // final PagingToolbar pag = new PagingToolbar(store);
+ // pag.setPageSize(PAGINATION_SIZE);
+ // pag.setDisplayInfo(true);
+ // pag.setDisplayMsg(i18n.tWithNT("Displaying results {0} - {1} of
+ // {2}",
+ // "Respect {} values in translations, "
+ // + "these will produce: 'Displaying results 1 - 25 of 95465' for
+ // instance"));
+ // pag.setEmptyMsg(i18n.t("No results to display"));
+ // pag.setAfterPageText(i18n.tWithNT("of {0}", "Used to show
+ // multiple results: '1 of 30'"));
+ // pag.setBeforePageText(i18n.t("Page"));
+ // pag.setFirstText(i18n.t("First Page"));
+ // pag.setLastText(i18n.t("Last Page"));
+ // pag.setNextText(i18n.t("Next Page"));
+ // pag.setPrevText(i18n.t("Previous Page"));
+ // pag.setRefreshText(i18n.t("Refresh"));
+ // grid.setBottomToolbar(pag);
+ // grid.setLoadMask(true);
+ // grid.setLoadMask(i18n.t("Loading"));
+ grid.setClicksToEdit(1);
+ // grid.setStripeRows(true);
+ // grid.setFrame(true);
+ // grid.setSelectionModel(new RowSelectionModel());
+
+ grid.addEditorGridListener(new EditorGridListenerAdapter() {
+ @Override
+ public void onAfterEdit(final GridPanel grid, final Record record, final String field,
+ final Object newValue, final Object oldValue, final int rowIndex, final int colIndex) {
+ final String idValue = record.getAsString(id);
+ final String trKey = record.getAsString("trKey");
+ presenter.doTranslation(idValue, trKey, (String) newValue);
+ record.set(field, TextUtils.escapeHtmlLight((String) newValue));
+ }
+ });
+
+ grid.addGridCellListener(new GridCellListenerAdapter() {
+ @Override
+ public void onCellDblClick(final GridPanel grid, final int rowIndex, final int colIndex, final EventObject e) {
+ final Record record = unTransStore.getRecordAt(rowIndex);
+ final String idValue = record.getAsString(id);
+ final String trKey = record.getAsString("trKey");
+ final String text = record.getAsString("text");
+ if (text == null || text.length() == 0) {
+ final String trWithoutNT = removeNT(trKey);
+ record.set("text", trWithoutNT);
+ presenter.doTranslation(idValue, trKey, trWithoutNT);
+ }
+ }
+ });
+
+ return grid;
+ }
+
+ private String removeNT(final String string) {
+ return i18n.removeNT(string);
+ }
+
+ private void setLanguage(final I18nLanguageDTO language) {
+ languageSelectorPanel.setLanguage(language.getCode());
+ setLanguage(language.getCode());
+ }
+
+ private void setLanguage(final String language) {
+ Site.showProgressLoading();
+ query(unTransStore, unTransGrid, language);
+ query(transStore, transGrid, language);
+ Site.hideProgress();
+ }
+
+ private String[] splitNT(final String textWithNT) {
+ String[] nt;
+ final String[] splitted = textWithNT.split(" \\[%NT ");
+ if (splitted.length > 1) {
+ nt = splitted[1].split("\\]$");
+ splitted[1] = nt[0];
+ }
+ return splitted;
+ }
+
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPanel.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorPanel.java (from rev 941, trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/LanguageSelectorPanel.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/LanguageSelectorPanel.java 2008-11-06 00:35:01 UTC (rev 941)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorPanel.java 2008-11-11 13:12:39 UTC (rev 946)
@@ -0,0 +1,103 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.workspace.client.i18n;
+
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+
+import com.gwtext.client.data.SimpleStore;
+import com.gwtext.client.data.Store;
+import com.gwtext.client.widgets.form.ComboBox;
+import com.gwtext.client.widgets.form.Field;
+import com.gwtext.client.widgets.form.FormPanel;
+import com.gwtext.client.widgets.form.event.ComboBoxListener;
+
+public class LanguageSelectorPanel extends FormPanel implements LanguageSelectorView {
+
+ public static final String LANG_ID = "abbr";
+ public static final String LANG_FIELD = "k-langsp-lf";
+
+ private ComboBox langCombo;
+ private final LanguageSelectorPresenter presenter;
+ private final I18nTranslationService i18n;
+
+ public LanguageSelectorPanel(final LanguageSelectorPresenter presenter, final I18nTranslationService i18n) {
+ this(presenter, null, i18n);
+ }
+
+ public LanguageSelectorPanel(final LanguageSelectorPresenter presenter, final String langFieldTitle,
+ final I18nTranslationService i18n) {
+ super();
+ this.i18n = i18n;
+ super.setBorder(false);
+ if (langFieldTitle == null) {
+ setHideLabels(true);
+ }
+ this.presenter = presenter;
+ createLangCombo(langFieldTitle);
+ super.add(langCombo);
+ }
+
+ public void addChangeListener(final ComboBoxListener listener) {
+ langCombo.addListener(listener);
+ }
+
+ public String getLanguage() {
+ return langCombo.getValueAsString();
+ }
+
+ public void reset() {
+ langCombo.reset();
+ }
+
+ public void setLanguage(final String languageCode) {
+ langCombo.setValue(languageCode);
+ }
+
+ private void createLangCombo(final String langFieldTitle) {
+ final Store langStore = new SimpleStore(new String[] { LANG_ID, "language" }, getLanguages());
+ langStore.load();
+
+ Field.setMsgTarget("side");
+ langCombo = new ComboBox();
+ langCombo.setName(LANG_FIELD);
+ langCombo.setMinChars(1);
+ if (langFieldTitle != null) {
+ langCombo.setFieldLabel(langFieldTitle);
+ }
+ langCombo.setStore(langStore);
+ langCombo.setDisplayField("language");
+ langCombo.setMode(ComboBox.LOCAL);
+ langCombo.setTriggerAction(ComboBox.ALL);
+ langCombo.setEmptyText(i18n.t("Enter language"));
+ langCombo.setLoadingText(i18n.t("Searching..."));
+ langCombo.setTypeAhead(true);
+ langCombo.setTypeAheadDelay(1000);
+ langCombo.setSelectOnFocus(false);
+ langCombo.setWidth(140);
+ langCombo.setValueField(LANG_ID);
+ langCombo.setPageSize(7);
+ langCombo.setForceSelection(true);
+ langCombo.setAllowBlank(false);
+ }
+
+ private Object[][] getLanguages() {
+ return presenter.getLanguages();
+ }
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorPanel.java
___________________________________________________________________
Name: svn:mergeinfo
+
More information about the kune-commits
mailing list