[kune-commits] r1755 - in trunk: . src/main/java/cc/kune/barters/client/actions src/main/java/cc/kune/blogs/client/actions src/main/java/cc/kune/core/client/rpcservices src/main/java/cc/kune/core/server src/main/java/cc/kune/core/server/access src/main/java/cc/kune/core/server/content src/main/java/cc/kune/core/server/manager src/main/java/cc/kune/core/server/manager/impl src/main/java/cc/kune/core/server/rpc src/main/java/cc/kune/docs/client/actions src/main/java/cc/kune/events/client/actions src/main/java/cc/kune/gspace/client/actions src/main/java/cc/kune/lists/client/actions src/main/java/cc/kune/tasks/client/actions src/main/java/cc/kune/wave/server src/main/java/cc/kune/wave/server/kspecific src/main/java/cc/kune/wiki/client/actions src/main/java/com/google/wave/splash/text
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Sun Mar 11 09:06:01 CET 2012
Author: vjrj_
Date: 2012-03-11 09:06:00 +0100 (Sun, 11 Mar 2012)
New Revision: 1755
Added:
trunk/src/main/java/cc/kune/gspace/client/actions/CopyContentMenuItem.java
trunk/src/main/java/cc/kune/gspace/client/actions/MenuLoggedDescriptor.java
trunk/src/main/java/cc/kune/gspace/client/actions/WriteToParticipantsMenuItem.java
Modified:
trunk/TODO
trunk/TODO_done
trunk/src/main/java/cc/kune/barters/client/actions/BartersClientActions.java
trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java
trunk/src/main/java/cc/kune/core/server/UserSession.java
trunk/src/main/java/cc/kune/core/server/UserSessionManager.java
trunk/src/main/java/cc/kune/core/server/access/FinderService.java
trunk/src/main/java/cc/kune/core/server/access/FinderServiceDefault.java
trunk/src/main/java/cc/kune/core/server/content/ContentManager.java
trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java
trunk/src/main/java/cc/kune/core/server/manager/KuneWaveManager.java
trunk/src/main/java/cc/kune/core/server/manager/impl/KuneWaveManagerDefault.java
trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java
trunk/src/main/java/cc/kune/gspace/client/actions/AbstractEditorsMenu.java
trunk/src/main/java/cc/kune/gspace/client/actions/ContentViewerShareMenu.java
trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java
trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java
trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java
trunk/src/main/java/cc/kune/wave/server/kspecific/KuneAgent.java
trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveService.java
trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveServiceDefault.java
trunk/src/main/java/cc/kune/wiki/client/actions/WikiClientActions.java
trunk/src/main/java/com/google/wave/splash/text/ContentRenderer.java
Log:
Possibility to copy waves and participants
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/TODO 2012-03-11 08:06:00 UTC (rev 1755)
@@ -160,11 +160,6 @@
*** Add -startupUrl to your GWT Run launch with /ws/?locale=en&log_level=INFO (or similar)
*** When you compile/run gwt web-app from eclipse, select target/kune-CURRENT-VERSION as War directory selection
*** src/main/webapp in GWTDesigner???
-** new UI library (gwt-ext is dead)
-- mosaic,
-- gtx
-- smartclient
--
** Documentation
CLOSED: [2012-03-04 dom 22:51]
*** Windows users
@@ -219,49 +214,6 @@
action (act)
lista de (des) ---> lista de views
-
-** <s> Changes in UI
- - [ ] 2:21 (video) add member dialog with confirmation (other way to do confirmation)
- - [ ] Leave this group, with green icon
- - [ ] 2.23 "page 1 de 1"
- - [ ] "Those who can view..." too long
- - [ ] cute menus ala https://addons.mozilla.org/es-ES/firefox/addon/1330
- - [ ] 2:27 (?) icon ...
- - [ ] 2:35 "Start a chat with this member"-> chat! and other long items
- - [ ] 2.41 long submenus...
- - [ ] scroll of licenses
-** maven-gwt problem (using another plugin from codehaus) :ARCHIVE:
- mvn com.totsp.gwt:maven-googlewebtoolkit2-plugin:compile
- and so on.
- More info:
- http://code.google.com/p/gwt-maven/wiki/M2FAQ
-** vjrj use xwiki maven repo
- http://maven.xwiki.org/releases/com/xpn/xwiki/platform/xwiki-web-wysiwyg/1.8-rc-2/
-** vjrj <v> better RTE :ARCHIVE:
-*** Pending
-**** Insert/Edit link
-***** use cases
- ^<a href="http://example.com">sample</a>^ --- Parse and edit
- <a href="http://example.com">s^ample</a> --- Parse and edit
- <a href="http://example.com">s^amp^le</a> --- Parse and edit
- <a href="http://example.com">s^a<em>kk</em>mp^le</a> --- Parse, get contains and edit
- ^some text <a href="http://example.com">samp^le</a> --- new link with get inner content?
-**** bidi support
-**** images (local/remote) with preview
-**** youtube videos/podcasts
-**** File > Rename (F2)
-**** Insert > Page break (for printing)
-**** Shortcut to fonts (Ctrl + numbers)
-*** Links
- http://www.ongwt.com/post/2009/01/08/XWiki-:-Wysiwyg-editor-based-on-GWT
- http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/samples/internet/ie55/EditRegions/default.asp
- http://www.mozilla.org/editor/midas-spec.html
- http://mozilla.org/editor/midasdemo/
-** vjrj <v> GWT 1.6 :ARCHIVE:
- http://code.google.com/intl/es/webtoolkit/doc/1.6/ReleaseNotes_1_6.html#Upgrading
- http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/3e7e6cc3b35ad98a
- http://code.google.com/p/google-web-toolkit/wiki/WAR_Design_1_6
- http://www.gwt-ext.com/forum/viewtopic.php?f=5&p=12038
** TODO <v> User preferences storing
*** links:
**** http://download.oracle.com/javase/1.4.2/docs/guide/lang/preferences.html (Preferences API)
Modified: trunk/TODO_done
===================================================================
--- trunk/TODO_done 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/TODO_done 2012-03-11 08:06:00 UTC (rev 1755)
@@ -300,7 +300,93 @@
overflow: hidden;
width: 14px;
}
+* new UI library (gwt-ext is dead)
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2012-03-10 sáb 15:32
+ :ARCHIVE_FILE: ~/proyectos/dev/kune/trunk/TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)
+ :ARCHIVE_CATEGORY: TODO
+ :END:
+- mosaic,
+- gtx
+- smartclient
+-
+* <s> Changes in UI
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2012-03-10 sáb 15:32
+ :ARCHIVE_FILE: ~/proyectos/dev/kune/trunk/TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)
+ :ARCHIVE_CATEGORY: TODO
+ :END:
+ - [ ] 2:21 (video) add member dialog with confirmation (other way to do confirmation)
+ - [ ] Leave this group, with green icon
+ - [ ] 2.23 "page 1 de 1"
+ - [ ] "Those who can view..." too long
+ - [ ] cute menus ala https://addons.mozilla.org/es-ES/firefox/addon/1330
+ - [ ] 2:27 (?) icon ...
+ - [ ] 2:35 "Start a chat with this member"-> chat! and other long items
+ - [ ] 2.41 long submenus...
+ - [ ] scroll of licenses
+* maven-gwt problem (using another plugin from codehaus) :ARCHIVE:
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2012-03-10 sáb 15:32
+ :ARCHIVE_FILE: ~/proyectos/dev/kune/trunk/TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)
+ :ARCHIVE_CATEGORY: TODO
+ :END:
+ mvn com.totsp.gwt:maven-googlewebtoolkit2-plugin:compile
+ and so on.
+ More info:
+ http://code.google.com/p/gwt-maven/wiki/M2FAQ
+* vjrj use xwiki maven repo
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2012-03-10 sáb 15:32
+ :ARCHIVE_FILE: ~/proyectos/dev/kune/trunk/TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)
+ :ARCHIVE_CATEGORY: TODO
+ :ARCHIVE_TODO: vjrj
+ :END:
+ http://maven.xwiki.org/releases/com/xpn/xwiki/platform/xwiki-web-wysiwyg/1.8-rc-2/
+* vjrj <v> better RTE :ARCHIVE:
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2012-03-10 sáb 15:32
+ :ARCHIVE_FILE: ~/proyectos/dev/kune/trunk/TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)
+ :ARCHIVE_CATEGORY: TODO
+ :ARCHIVE_TODO: vjrj
+ :END:
+** Pending
+*** Insert/Edit link
+**** use cases
+ ^<a href="http://example.com">sample</a>^ --- Parse and edit
+ <a href="http://example.com">s^ample</a> --- Parse and edit
+ <a href="http://example.com">s^amp^le</a> --- Parse and edit
+ <a href="http://example.com">s^a<em>kk</em>mp^le</a> --- Parse, get contains and edit
+ ^some text <a href="http://example.com">samp^le</a> --- new link with get inner content?
+*** bidi support
+*** images (local/remote) with preview
+*** youtube videos/podcasts
+*** File > Rename (F2)
+*** Insert > Page break (for printing)
+*** Shortcut to fonts (Ctrl + numbers)
+** Links
+ http://www.ongwt.com/post/2009/01/08/XWiki-:-Wysiwyg-editor-based-on-GWT
+ http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/samples/internet/ie55/EditRegions/default.asp
+ http://www.mozilla.org/editor/midas-spec.html
+ http://mozilla.org/editor/midasdemo/
+* vjrj <v> GWT 1.6 :ARCHIVE:
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2012-03-10 sáb 15:32
+ :ARCHIVE_FILE: ~/proyectos/dev/kune/trunk/TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)
+ :ARCHIVE_CATEGORY: TODO
+ :ARCHIVE_TODO: vjrj
+ :END:
+ http://code.google.com/intl/es/webtoolkit/doc/1.6/ReleaseNotes_1_6.html#Upgrading
+ http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/3e7e6cc3b35ad98a
+ http://code.google.com/p/google-web-toolkit/wiki/WAR_Design_1_6
+ http://www.gwt-ext.com/forum/viewtopic.php?f=5&p=12038
@@ -317,3 +403,10 @@
+
+
+
+
+
+
+
Modified: trunk/src/main/java/cc/kune/barters/client/actions/BartersClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/barters/client/actions/BartersClientActions.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/barters/client/actions/BartersClientActions.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -35,9 +35,11 @@
import cc.kune.gspace.client.actions.AddPublicToContentMenuItem;
import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
import cc.kune.gspace.client.actions.ContentViewerShareMenu;
+import cc.kune.gspace.client.actions.CopyContentMenuItem;
import cc.kune.gspace.client.actions.ParticipateInContentBtn;
import cc.kune.gspace.client.actions.RefreshContentMenuItem;
import cc.kune.gspace.client.actions.TutorialContainerBtn;
+import cc.kune.gspace.client.actions.WriteToParticipantsMenuItem;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -63,7 +65,9 @@
final Provider<AddPublicToContentMenuItem> addPublicMenuItem,
final Provider<TutorialContainerBtn> tutorialBtn,
final Provider<ParticipateInContentBtn> participateBtn,
- final Provider<DelFolderMenuItem> delFolderMenuItem, final Provider<RefreshContentMenuItem> refresh) {
+ final Provider<DelFolderMenuItem> delFolderMenuItem,
+ final Provider<RefreshContentMenuItem> refresh, final Provider<CopyContentMenuItem> copyContent,
+ final Provider<WriteToParticipantsMenuItem> writeToParticipants) {
super(session, stateManager, i18n, registry);
actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all);
actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all);
@@ -78,6 +82,8 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, newBartersBtn, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderBtn, containers);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, copyContent, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, writeToParticipants, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, containersNoRoot);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem, contents);
@@ -86,6 +92,8 @@
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addAdminMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addCollabMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addPublicMenuItem, contents);
+ actionsRegistry.addAction(ActionGroups.ITEM_MENU, copyContent, contents);
+ actionsRegistry.addAction(ActionGroups.ITEM_MENU, writeToParticipants, contents);
}
@Override
Modified: trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -39,10 +39,12 @@
import cc.kune.gspace.client.actions.AddPublicToContentMenuItem;
import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
import cc.kune.gspace.client.actions.ContentViewerShareMenu;
+import cc.kune.gspace.client.actions.CopyContentMenuItem;
import cc.kune.gspace.client.actions.ParticipateInContentBtn;
import cc.kune.gspace.client.actions.RefreshContentMenuItem;
import cc.kune.gspace.client.actions.SetAsHomePageMenuItem;
import cc.kune.gspace.client.actions.TutorialContainerBtn;
+import cc.kune.gspace.client.actions.WriteToParticipantsMenuItem;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -73,6 +75,8 @@
final Provider<ParticipateInContentBtn> participateBtn, final BlogsNewMenu blogNewMenu,
final PostNewMenu postNewMenu, final NewMenusForTypeIdsRegistry newMenusRegistry,
final Provider<ChatAboutContentBtn> chatAbout, final Provider<DelBlogMenuItem> delFolderMenuItem,
+ final Provider<CopyContentMenuItem> copyContent,
+ final Provider<WriteToParticipantsMenuItem> writeToParticipants,
final Provider<SetAsHomePageMenuItem> setAsHomePage) {
super(session, stateManager, i18n, registry);
actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all);
@@ -92,6 +96,8 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, tutorialBtn, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
actionsRegistry.addAction(ActionGroups.TOOLBAR, chatAbout, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, copyContent, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, writeToParticipants, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, containersNoRoot);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem, contents);
@@ -100,6 +106,8 @@
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addAdminMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addCollabMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addPublicMenuItem, contents);
+ actionsRegistry.addAction(ActionGroups.ITEM_MENU, copyContent, contents);
+ actionsRegistry.addAction(ActionGroups.ITEM_MENU, writeToParticipants, contents);
newMenusRegistry.register(TYPE_BLOG, blogNewMenu.get());
newMenusRegistry.register(TYPE_POST,
(MenuDescriptor) postNewMenu.get().withText(i18n.t("Add Gadget")));
Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -65,6 +65,9 @@
StateContainerDTO addRoom(String user, StateToken parentToken, String name) throws DefaultException;
+ StateContentDTO copyContent(String userHash, StateToken parentToken, StateToken token)
+ throws DefaultException;
+
StateContentDTO delContent(String userHash, StateToken token) throws DefaultException;
StateAbstractDTO getContent(String userHash, StateToken token) throws DefaultException;
@@ -108,4 +111,6 @@
String writeTo(String userHash, StateToken token, boolean onlyToAdmins, String title, String message)
throws DefaultException;
+
+ String writeToParticipants(String userHash, StateToken token) throws DefaultException;
}
Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -65,6 +65,9 @@
void addRoom(String user, StateToken parentToken, String name,
AsyncCallback<StateContainerDTO> callback);
+ void copyContent(String userHash, StateToken parentToken, StateToken token,
+ AsyncCallback<StateContentDTO> callback);
+
void delContent(String userHash, StateToken token, AsyncCallback<StateContentDTO> asyncCallback);
void getContent(String user, StateToken newState, AsyncCallback<StateAbstractDTO> callback);
@@ -116,4 +119,6 @@
void writeTo(String userHash, StateToken token, boolean onlyToAdmins, String title, String message,
AsyncCallback<String> callback);
+ void writeToParticipants(String userHash, StateToken token, AsyncCallback<String> callback);
+
}
Modified: trunk/src/main/java/cc/kune/core/server/UserSession.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/UserSession.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/server/UserSession.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -30,6 +30,7 @@
private String userHash;
private Long userId;
+ private String userName;
public UserSession() {
}
@@ -42,6 +43,10 @@
return userId;
}
+ public String getUserName() {
+ return userName;
+ }
+
public void setHash(final String hash) {
this.userHash = hash;
}
@@ -50,4 +55,8 @@
this.userId = userId;
}
+ public void setUserName(final String userName) {
+ this.userName = userName;
+ }
+
}
Modified: trunk/src/main/java/cc/kune/core/server/UserSessionManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/UserSessionManager.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/server/UserSessionManager.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -56,14 +56,14 @@
return getUserSession().getHash();
}
+ public User getUser() {
+ return manager.find(getUserSession().getUserId());
+ }
+
private String getUserLoggedShortName() {
return getUser().getShortName();
}
- public User getUser() {
- return manager.find(getUserSession().getUserId());
- }
-
private UserSession getUserSession() {
return userSessionProv.get();
}
@@ -81,8 +81,9 @@
return !isUserLoggedIn();
}
- public void login(final Long userId, final String newUserHash) {
+ public void login(final Long userId, final String name, final String newUserHash) {
getUserSession().setUserId(userId);
+ getUserSession().setUserName(name);
getUserSession().setHash(newUserHash);
updateLoggedUser();
}
@@ -92,6 +93,7 @@
logins.remove(getUserLoggedShortName());
}
getUserSession().setUserId(null);
+ getUserSession().setUserName(null);
getUserSession().setHash(null);
}
Modified: trunk/src/main/java/cc/kune/core/server/access/FinderService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/access/FinderService.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/server/access/FinderService.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -29,6 +29,8 @@
public interface FinderService {
+ Container getContainer(Long folderId) throws DefaultException;
+
Content getContent(Long contentId) throws DefaultException;
Content getContent(StateToken token, Group defaultGroup) throws DefaultException;
Modified: trunk/src/main/java/cc/kune/core/server/access/FinderServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/access/FinderServiceDefault.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/server/access/FinderServiceDefault.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -186,4 +186,9 @@
return rateManager.getRateByUsers(content);
}
+ @Override
+ public Container getContainer(Long folderId) throws DefaultException {
+ return getFolder(folderId);
+ }
+
}
Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManager.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManager.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -55,6 +55,8 @@
boolean addParticipants(User user, Long contentId, Group group, SocialNetworkSubGroup whichOnes);
+ Content copyContent(User user, Container container, Content contentToCopy);
+
Content createGadget(User user, Container container, String gadgetname, String typeIdChild,
String title, String body, Map<String, String> gadgetProperties);
Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -36,9 +36,11 @@
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.search.Query;
+import org.waveprotocol.wave.model.waveref.InvalidWaveRefException;
import org.waveprotocol.wave.model.waveref.WaveRef;
import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
+import cc.kune.common.shared.i18n.I18nTranslationService;
import cc.kune.core.client.actions.xml.XMLKuneClientActions;
import cc.kune.core.client.actions.xml.XMLWaveExtension;
import cc.kune.core.client.errors.DefaultException;
@@ -86,6 +88,7 @@
private final ContainerFinder containerFinder;
private final ContentFinder contentFinder;
private final FinderService finder;
+ private final I18nTranslationService i18n;
private final KuneWaveService kuneWaveManager;
private final I18nLanguageFinder languageFinder;
private final Log LOG = LogFactory.getLog(ContentManagerDefault.class);
@@ -100,7 +103,7 @@
final FinderService finder, final UserFinder userFinder, final I18nLanguageFinder languageFinder,
final TagUserContentManager tagManager, final KuneWaveService kuneWaveManager,
final ParticipantUtils participantUtils, final ServerToolRegistry tools,
- final XMLActionReader xmlActionReader) {
+ final XMLActionReader xmlActionReader, final I18nTranslationService i18n) {
super(provider, Content.class);
this.contentFinder = contentFinder;
this.containerFinder = containerFinder;
@@ -111,6 +114,7 @@
this.kuneWaveManager = kuneWaveManager;
this.participantUtils = participantUtils;
this.tools = tools;
+ this.i18n = i18n;
this.actions = xmlActionReader.getActions();
}
@@ -174,14 +178,27 @@
return addParticipants(user, content, members.toArray(new String[members.size()]));
}
+ @Override
+ public Content copyContent(final User user, final Container destination, final Content contentToCopy) {
+ try {
+ return createContent(
+ findInexistentTitle(destination, i18n.t("Copy of [%s]", contentToCopy.getTitle())), "",
+ JavaWaverefEncoder.decodeWaveRefFromPath(contentToCopy.getWaveId()), user, destination,
+ contentToCopy.getTypeId(), KuneWaveService.WITHOUT_GADGET,
+ Collections.<String, String> emptyMap());
+ } catch (final InvalidWaveRefException e) {
+ throw new DefaultException("Error copying wave", e);
+ }
+ }
+
protected Content createContent(final String title, final String body, final User author,
final Container container, final String typeId) {
- return createContent(title, body, author, container, typeId, KuneWaveService.WITHOUT_GADGET,
- Collections.<String, String> emptyMap());
+ return createContent(title, body, KuneWaveService.NO_WAVE_TO_COPY, author, container, typeId,
+ KuneWaveService.WITHOUT_GADGET, Collections.<String, String> emptyMap());
}
- protected Content createContent(final String title, final String body, final User author,
- final Container container, final String typeId, final URL gadgetUrl,
+ protected Content createContent(final String title, final String body, final WaveRef waveIdToCopy,
+ final User author, final Container container, final String typeId, final URL gadgetUrl,
final Map<String, String> gadgetProperties) {
FilenameUtils.checkBasicFilename(title);
final String newtitle = findInexistentTitle(container, title);
@@ -196,7 +213,7 @@
// Duplicate in StateServiceDefault
if (newContent.isWave()) {
final String authorName = author.getShortName();
- final WaveRef waveRef = kuneWaveManager.createWave(newtitle, body,
+ final WaveRef waveRef = kuneWaveManager.createWave(newtitle, body, waveIdToCopy,
KuneWaveService.DO_NOTHING_CBACK, gadgetUrl, gadgetProperties, participantUtils.of(authorName));
newContent.setWaveId(JavaWaverefEncoder.encodeToUriPathSegment(waveRef));
newContent.setModifiedOn((new Date()).getTime());
@@ -213,8 +230,8 @@
final String toolName = container.getToolName();
final ServerTool tool = tools.get(toolName);
tool.checkTypesBeforeContentCreation(container.getTypeId(), typeIdChild);
- final Content content = createContent(title, body, user, container, typeIdChild,
- getGadgetUrl(gadgetname), gadgetProperties);
+ final Content content = createContent(title, body, KuneWaveService.NO_WAVE_TO_COPY, user, container,
+ typeIdChild, getGadgetUrl(gadgetname), gadgetProperties);
tool.onCreateContent(content, container);
return content;
}
Modified: trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -59,8 +59,8 @@
tool.checkTypesBeforeContentCreation(container.getTypeId(), typeId);
final URL gagdetUrl = tool instanceof ServerWaveTool ? ((ServerWaveTool) tool).getGadgetUrl()
: KuneWaveService.WITHOUT_GADGET;
- final Content content = contentManager.createContent(title, body, user, container, typeId,
- gagdetUrl, Collections.<String, String> emptyMap());
+ final Content content = contentManager.createContent(title, body, KuneWaveService.NO_WAVE_TO_COPY,
+ user, container, typeId, gagdetUrl, Collections.<String, String> emptyMap());
tool.onCreateContent(content, container);
return content;
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/KuneWaveManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/KuneWaveManager.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/server/manager/KuneWaveManager.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -29,4 +29,6 @@
String writeTo(User user, String groupName, boolean onlyToAdmins, String title, String content);
+ String writeToParticipants(String author, String from, String waveId);
+
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/KuneWaveManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/KuneWaveManagerDefault.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/KuneWaveManagerDefault.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -20,13 +20,17 @@
package cc.kune.core.server.manager.impl;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.waveprotocol.wave.model.wave.ParticipantId;
+import org.waveprotocol.wave.model.waveref.InvalidWaveRefException;
+import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
import cc.kune.core.client.errors.AccessViolationException;
+import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.server.access.AccessRightsUtils;
import cc.kune.core.server.manager.KuneWaveManager;
import cc.kune.core.server.manager.UserManager;
@@ -44,6 +48,7 @@
import com.google.inject.Inject;
import com.google.inject.Singleton;
+import com.google.wave.api.Participants;
@Singleton
public class KuneWaveManagerDefault implements KuneWaveManager {
@@ -107,4 +112,20 @@
return KuneWaveServerUtils.getUrl(waveService.createWave(title, message,
KuneWaveService.DO_NOTHING_CBACK, participantUtils.listFrom(toList)));
}
+
+ @Override
+ public String writeToParticipants(final String author, final String from, final String waveId) {
+ try {
+ final Participants parts = waveService.getParticipants(
+ JavaWaverefEncoder.decodeWaveRefFromPath(waveId), author);
+ final List<String> list = new ArrayList<String>();
+ // From the first in the list
+ list.add(from);
+ list.addAll(Arrays.asList(parts.toArray(new String[parts.size()])));
+ return KuneWaveServerUtils.getUrl(waveService.createWave("", KuneWaveService.DO_NOTHING_CBACK,
+ participantUtils.listFrom(list)));
+ } catch (final InvalidWaveRefException e) {
+ throw new DefaultException("Cannot access to the wave to copy");
+ }
+ }
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -31,6 +31,8 @@
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
@@ -42,6 +44,8 @@
import org.waveprotocol.box.server.persistence.AccountStore;
import org.waveprotocol.box.server.persistence.PersistenceException;
import org.waveprotocol.box.server.robots.agent.RobotAgentUtil;
+import org.waveprotocol.wave.model.id.InvalidIdException;
+import org.waveprotocol.wave.model.id.WaveId;
import org.waveprotocol.wave.model.wave.ParticipantId;
import org.waveprotocol.wave.model.waveref.WaveRef;
@@ -91,6 +95,7 @@
@Singleton
public class UserManagerDefault extends DefaultManager<User, Long> implements UserManager {
+ public static final Log LOG = LogFactory.getLog(UserManagerDefault.class);
private final ChatProperties chatProperties;
private final I18nCountryManager countryManager;
private final GroupManager groupManager;
@@ -259,25 +264,32 @@
throw e;
}
WaveRef welcome = null;
+ final User user = new User(shortName, longName, email, passwd, passwdDigest.getDigest(),
+ passwdDigest.getSalt(), language, country, tz);
+
+ final String defWave = properties.getWelcomewave();
+ groupManager.createUserGroup(user, wantPersonalHomepage);
try {
- final User user = new User(shortName, longName, email, passwd, passwdDigest.getDigest(),
- passwdDigest.getSalt(), language, country, tz);
-
- final String defWave = properties.getWelcomewave();
- groupManager.createUserGroup(user, wantPersonalHomepage);
- if (defWave != null) {
- welcome = kuneWaveManager.createWave(
- ContentConstants.WELCOME_WAVE_CONTENT_TITLE.replaceAll("\\[%s\\]",
- properties.getDefaultSiteName()), "", defWave, new SimpleArgCallback<WaveRef>() {
- @Override
- public void onCallback(final WaveRef arg) {
- // Is this necessary? try to remove (used when we were setting
- // the def
- // content
- // contentManager.save(userGroup.getDefaultContent());
- askForEmailConfirmation(user, EmailConfirmationType.emailVerification);
- }
- }, null, participantUtils.of(properties.getAdminShortName()), participantUtils.of(shortName));
+ try {
+ if (defWave != null) {
+ final WaveId copyWaveId = WaveId.ofChecked(participantUtils.getDomain(), defWave);
+ welcome = kuneWaveManager.createWave(
+ ContentConstants.WELCOME_WAVE_CONTENT_TITLE.replaceAll("\\[%s\\]",
+ properties.getDefaultSiteName()), "", WaveRef.of(copyWaveId),
+ new SimpleArgCallback<WaveRef>() {
+ @Override
+ public void onCallback(final WaveRef arg) {
+ // Is this necessary? try to remove (used when we were setting
+ // the def
+ // content
+ // contentManager.save(userGroup.getDefaultContent());
+ askForEmailConfirmation(user, EmailConfirmationType.emailVerification);
+ }
+ }, null, participantUtils.of(properties.getAdminShortName()),
+ participantUtils.of(shortName));
+ }
+ } catch (final InvalidIdException e) {
+ LOG.error("Cannot create a welcome wave", e);
}
return user;
} catch (final RuntimeException e) {
Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -215,6 +215,22 @@
return getState(user, chatManager.addRoom(userHash, user, parentToken, roomName, ""));
}
+ @Authenticated
+ @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor, mustCheckMembership = true)
+ @Transactional
+ public StateContentDTO copyContent(final String userHash, final StateToken parentToken,
+ final StateToken token) throws DefaultException {
+ final User user = getCurrentUser();
+ final Content contentToCopy = finderService.getContent(ContentUtils.parseId(token.getDocument()));
+ final Container container = finderService.getContainer(ContentUtils.parseId(parentToken.getFolder()));
+ if (rightsService.get(user, contentToCopy.getAccessLists()).isVisible()) {
+ return mapper.map(contentManager.copyContent(user, container, contentToCopy),
+ StateContentDTO.class);
+ } else {
+ throw new AccessViolationException();
+ }
+ }
+
private StateContentDTO createContent(final StateToken parentToken, final String title,
final String typeId) {
final User user = getCurrentUser();
@@ -586,4 +602,15 @@
return waveManager.writeTo(user, token.getGroup(), onlyToAdmins, title, message);
}
+ @Authenticated
+ @Authorizated(actionLevel = ActionLevel.content, accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
+ @Transactional
+ public String writeToParticipants(final String userHash, final StateToken token)
+ throws DefaultException {
+ final User user = getCurrentUser();
+ final Content content = finderService.getContent(ContentUtils.parseId(token.getDocument()));
+ return waveManager.writeToParticipants(content.getAuthors().get(0).getShortName(),
+ user.getShortName(), content.getWaveId());
+ }
+
}
Modified: trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -180,7 +180,7 @@
private UserInfoDTO loginUser(final User user, final String waveToken) throws DefaultException {
if (user != null) {
- userSessionManager.login(user.getId(), waveToken);
+ userSessionManager.login(user.getId(), user.getShortName(), waveToken);
return loadUserInfo(user);
} else {
throw new UserAuthException();
Modified: trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -39,10 +39,12 @@
import cc.kune.gspace.client.actions.AddPublicToContentMenuItem;
import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
import cc.kune.gspace.client.actions.ContentViewerShareMenu;
+import cc.kune.gspace.client.actions.CopyContentMenuItem;
import cc.kune.gspace.client.actions.ParticipateInContentBtn;
import cc.kune.gspace.client.actions.RefreshContentMenuItem;
import cc.kune.gspace.client.actions.SetAsHomePageMenuItem;
import cc.kune.gspace.client.actions.TutorialContainerBtn;
+import cc.kune.gspace.client.actions.WriteToParticipantsMenuItem;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -74,6 +76,8 @@
final Provider<TutorialContainerBtn> tutorialBtn, final Provider<ChatAboutContentBtn> chatAbout,
final Provider<RefreshContentMenuItem> refresh,
final Provider<SetAsHomePageMenuItem> setAsHomePage,
+ final Provider<CopyContentMenuItem> copyContent,
+ final Provider<WriteToParticipantsMenuItem> writeToParticipants,
final NewMenusForTypeIdsRegistry newMenusRegistry, final DocsFolderNewMenu foldersNewMenu,
final DocsNewMenu docsNewMenu) {
super(session, stateManager, i18n, registry);
@@ -95,6 +99,8 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderMenuItem, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, chatAbout, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, copyContent, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, writeToParticipants, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, containersNoRoot);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem, contents);
@@ -104,6 +110,8 @@
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addAdminMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addCollabMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addPublicMenuItem, contents);
+ actionsRegistry.addAction(ActionGroups.ITEM_MENU, copyContent, contents);
+ actionsRegistry.addAction(ActionGroups.ITEM_MENU, writeToParticipants, contents);
newMenusRegistry.register(TYPE_FOLDER, foldersNewMenu.get());
newMenusRegistry.register(TYPE_ROOT, foldersNewMenu.get());
newMenusRegistry.register(TYPE_DOCUMENT,
Modified: trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -34,8 +34,10 @@
import cc.kune.gspace.client.actions.AddPublicToContentMenuItem;
import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
import cc.kune.gspace.client.actions.ContentViewerShareMenu;
+import cc.kune.gspace.client.actions.CopyContentMenuItem;
import cc.kune.gspace.client.actions.ParticipateInContentBtn;
import cc.kune.gspace.client.actions.RefreshContentMenuItem;
+import cc.kune.gspace.client.actions.WriteToParticipantsMenuItem;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -66,6 +68,8 @@
final Provider<EventAddMenuItem> eventAddMenuItem,
final Provider<EventOpenMenuItem> eventOpenMenuItem, final Provider<CalendarGoPrevBtn> calPrevBtn,
final Provider<EventRemoveMenuItem> eventRemoveMenuItem,
+ final Provider<CopyContentMenuItem> copyContent,
+ final Provider<WriteToParticipantsMenuItem> writeToParticipants,
final Provider<ExportCalendarMenuItem> export, final Provider<CalendarGoNextBtn> calNextBtn,
final CalendarOnOverMenu onOverMenu, final Provider<CalendarGoTodayBtn> goToday,
final Provider<RefreshContentMenuItem> refresh) {
@@ -87,6 +91,8 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, addAdminMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.TOOLBAR, addCollabMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.TOOLBAR, addPublicMenuItem, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, copyContent, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, writeToParticipants, contents);
// On over calendar menu
actionsRegistry.addAction(ActionGroups.TOOLBAR, onOverMenu, containers);
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/AbstractEditorsMenu.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/AbstractEditorsMenu.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/AbstractEditorsMenu.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -19,15 +19,14 @@
*/
package cc.kune.gspace.client.actions;
-import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
import cc.kune.core.client.events.AccessRightsChangedEvent;
import cc.kune.core.client.events.AccessRightsChangedEvent.AccessRightsChangedHandler;
import cc.kune.core.client.state.AccessRightsClientManager;
-public class AbstractEditorsMenu extends MenuDescriptor {
+public class AbstractEditorsMenu extends MenuLoggedDescriptor {
public AbstractEditorsMenu(final AccessRightsClientManager rightsManager) {
- super();
+ super(rightsManager);
this.withStyles(ActionStyles.MENU_BTN_STYLE_LEFT);
rightsManager.onRightsChanged(true, new AccessRightsChangedHandler() {
@Override
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/ContentViewerShareMenu.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/ContentViewerShareMenu.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/ContentViewerShareMenu.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -19,19 +19,20 @@
*/
package cc.kune.gspace.client.actions;
-import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
import cc.kune.common.shared.i18n.I18nTranslationService;
import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.state.AccessRightsClientManager;
import com.google.inject.Inject;
-public class ContentViewerShareMenu extends MenuDescriptor {
+public class ContentViewerShareMenu extends MenuLoggedDescriptor {
private static final String ID = "k-cnt-viewer-share-menu";
@Inject
- public ContentViewerShareMenu(final CoreResources res, final I18nTranslationService i18n) {
- super();
+ public ContentViewerShareMenu(final CoreResources res, final I18nTranslationService i18n,
+ final AccessRightsClientManager rightsManager) {
+ super(rightsManager);
this.withText(i18n.t("Share")).withToolTip(i18n.t("Share this with group members, etc")).withIcon(
res.world16()).withStyles(ActionStyles.MENU_BTN_STYLE_RIGHT).withId(ID);
}
Added: trunk/src/main/java/cc/kune/gspace/client/actions/CopyContentMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/CopyContentMenuItem.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/CopyContentMenuItem.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -0,0 +1,85 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.gspace.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.shared.i18n.I18nTranslationService;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
+import cc.kune.core.client.rpcservices.ContentServiceAsync;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.dto.AbstractContentSimpleDTO;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.core.shared.dto.StateContentDTO;
+
+import com.google.inject.Inject;
+
+public class CopyContentMenuItem extends MenuItemDescriptor {
+
+ public static class CopyContentAction extends RolAction {
+
+ private final ContentServiceAsync contentService;
+ private final I18nTranslationService i18n;
+ private final Session session;
+ private final StateManager stateManager;
+
+ @Inject
+ public CopyContentAction(final Session session, final StateManager stateManager,
+ final ContentServiceAsync contentService, final I18nTranslationService i18n) {
+ super(AccessRolDTO.Editor, true);
+ this.session = session;
+ this.stateManager = stateManager;
+ this.contentService = contentService;
+ this.i18n = i18n;
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.showProgress(i18n.t("Copying"));
+ final boolean inContent = session.getCurrentStateToken().hasAll();
+ final StateToken token = inContent ? session.getCurrentStateToken()
+ : ((AbstractContentSimpleDTO) event.getTarget()).getStateToken();
+ final StateToken parentToken = inContent ? session.getContentState().getContainer().getStateToken()
+ : session.getCurrentStateToken();
+ contentService.copyContent(session.getUserHash(), parentToken, token,
+ new AsyncCallbackSimple<StateContentDTO>() {
+ @Override
+ public void onSuccess(final StateContentDTO result) {
+ NotifyUser.hideProgress();
+ stateManager.setRetrievedStateAndGo(result);
+ }
+ });
+ }
+
+ }
+
+ @Inject
+ public CopyContentMenuItem(final I18nTranslationService i18n, final CopyContentAction action,
+ final ContentViewerOptionsMenu optionsMenu, final NavResources res) {
+ super(action);
+ this.withParent(optionsMenu, false);
+ this.withText(i18n.t("Copy this to a new message"));
+ }
+}
Added: trunk/src/main/java/cc/kune/gspace/client/actions/MenuLoggedDescriptor.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/MenuLoggedDescriptor.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/MenuLoggedDescriptor.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -0,0 +1,18 @@
+package cc.kune.gspace.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
+import cc.kune.core.client.events.AccessRightsChangedEvent;
+import cc.kune.core.client.events.AccessRightsChangedEvent.AccessRightsChangedHandler;
+import cc.kune.core.client.state.AccessRightsClientManager;
+
+public class MenuLoggedDescriptor extends MenuDescriptor {
+ public MenuLoggedDescriptor(final AccessRightsClientManager rightsManager) {
+ rightsManager.onRightsChanged(true, new AccessRightsChangedHandler() {
+ @Override
+ public void onAccessRightsChanged(final AccessRightsChangedEvent event) {
+ MenuLoggedDescriptor.this.setVisible(event.getCurrentRights().isEditable());
+ }
+ });
+ }
+
+}
Added: trunk/src/main/java/cc/kune/gspace/client/actions/WriteToParticipantsMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/WriteToParticipantsMenuItem.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/WriteToParticipantsMenuItem.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -0,0 +1,85 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.gspace.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.shared.i18n.I18nTranslationService;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
+import cc.kune.core.client.rpcservices.ContentServiceAsync;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.dto.AbstractContentSimpleDTO;
+import cc.kune.core.shared.dto.AccessRolDTO;
+
+import com.google.inject.Inject;
+
+public class WriteToParticipantsMenuItem extends MenuItemDescriptor {
+
+ public static class WriteToParticipantsAction extends RolAction {
+
+ private final ContentServiceAsync contentService;
+ private final I18nTranslationService i18n;
+ private final Session session;
+ private final StateManager stateManager;
+
+ @Inject
+ public WriteToParticipantsAction(final Session session, final StateManager stateManager,
+ final ContentServiceAsync contentService, final I18nTranslationService i18n) {
+ super(AccessRolDTO.Editor, true);
+ this.session = session;
+ this.stateManager = stateManager;
+ this.contentService = contentService;
+ this.i18n = i18n;
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.showProgress(i18n.t("Writing"));
+ final boolean inContent = session.getCurrentStateToken().hasAll();
+ final StateToken token = inContent ? session.getCurrentStateToken()
+ : ((AbstractContentSimpleDTO) event.getTarget()).getStateToken();
+ contentService.writeToParticipants(session.getUserHash(), token,
+ new AsyncCallbackSimple<String>() {
+ @Override
+ public void onSuccess(final String result) {
+ NotifyUser.hideProgress();
+ NotifyUser.info(i18n.t("Message created. Just edit it"));
+ stateManager.gotoHistoryToken(result);
+ }
+ });
+ }
+
+ }
+
+ @Inject
+ public WriteToParticipantsMenuItem(final I18nTranslationService i18n,
+ final WriteToParticipantsAction action, final NavResources res,
+ final ContentViewerOptionsMenu optionsMenu) {
+ super(action);
+ this.withText(i18n.t("New message with everyone here")).withIcon(res.pageText()).withParent(
+ optionsMenu, false);
+ }
+
+}
Modified: trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -37,9 +37,11 @@
import cc.kune.gspace.client.actions.AddCollabMembersToContentMenuItem;
import cc.kune.gspace.client.actions.AddPublicToContentMenuItem;
import cc.kune.gspace.client.actions.ContentViewerShareMenu;
+import cc.kune.gspace.client.actions.CopyContentMenuItem;
import cc.kune.gspace.client.actions.ParticipateInContentBtn;
import cc.kune.gspace.client.actions.SetAsHomePageMenuItem;
import cc.kune.gspace.client.actions.TutorialContainerBtn;
+import cc.kune.gspace.client.actions.WriteToParticipantsMenuItem;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -69,7 +71,9 @@
final Provider<AddCollabMembersToContentMenuItem> addCollabMembersMenuItem,
final Provider<AddPublicToContentMenuItem> addPublicMenuItem,
final Provider<SetListOpenessMenuItem> listOpenessMenuItem,
- final Provider<ParticipateInContentBtn> participateBtn, final ListsNewMenu listNewMenu,
+ final Provider<ParticipateInContentBtn> participateBtn,
+ final Provider<CopyContentMenuItem> copyContent,
+ final Provider<WriteToParticipantsMenuItem> writeToParticipants, final ListsNewMenu listNewMenu,
final PostNewMenu postNewMenu, final NewMenusForTypeIdsRegistry newMenusRegistry,
final Provider<ChatAboutContentBtn> chatAbout, final Provider<DelListMenuItem> delFolderMenuItem,
final Provider<SetAsHomePageMenuItem> setAsHomePage) {
@@ -96,6 +100,8 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
actionsRegistry.addAction(ActionGroups.TOOLBAR, subscribersCount, containersNoRoot);
actionsRegistry.addAction(ActionGroups.TOOLBAR, chatAbout, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, copyContent, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, writeToParticipants, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, containersNoRoot);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, delFolderMenuItem, containersNoRoot);
@@ -103,6 +109,8 @@
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addAdminMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addCollabMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addPublicMenuItem, contents);
+ actionsRegistry.addAction(ActionGroups.ITEM_MENU, copyContent, contents);
+ actionsRegistry.addAction(ActionGroups.ITEM_MENU, writeToParticipants, contents);
newMenusRegistry.register(TYPE_LIST, listNewMenu.get());
newMenusRegistry.register(TYPE_ROOT, listNewMenu.get());
newMenusRegistry.register(TYPE_POST,
Modified: trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -39,10 +39,12 @@
import cc.kune.gspace.client.actions.AddPublicToContentMenuItem;
import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
import cc.kune.gspace.client.actions.ContentViewerShareMenu;
+import cc.kune.gspace.client.actions.CopyContentMenuItem;
import cc.kune.gspace.client.actions.ParticipateInContentBtn;
import cc.kune.gspace.client.actions.RefreshContentMenuItem;
import cc.kune.gspace.client.actions.SetAsHomePageMenuItem;
import cc.kune.gspace.client.actions.TutorialContainerBtn;
+import cc.kune.gspace.client.actions.WriteToParticipantsMenuItem;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -72,8 +74,10 @@
final Provider<AddAdminMembersToContentMenuItem> addAdminMembersMenuItem,
final Provider<AddCollabMembersToContentMenuItem> addCollabMembersMenuItem,
final Provider<AddPublicToContentMenuItem> addPublicMenuItem,
+ final Provider<ChatAboutContentBtn> chatAbout, final Provider<CopyContentMenuItem> copyContent,
+ final Provider<WriteToParticipantsMenuItem> writeToParticipants,
final TasksFolderNewMenu taskFolderNewMenu, final TasksNewMenu taskNewMenu,
- final NewMenusForTypeIdsRegistry newMenusRegistry, final Provider<ChatAboutContentBtn> chatAbout,
+ final NewMenusForTypeIdsRegistry newMenusRegistry,
final Provider<DelFolderMenuItem> delFolderMenuItem,
final Provider<SetAsHomePageMenuItem> setAsHomePage) {
super(session, stateManager, i18n, registry);
@@ -95,6 +99,8 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, addPublicMenuItem, contents);
actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
actionsRegistry.addAction(ActionGroups.TOOLBAR, chatAbout, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, copyContent, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, writeToParticipants, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, containersNoRoot);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, marksAsDoneMenuItem,
@@ -108,6 +114,8 @@
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addAdminMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addCollabMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addPublicMenuItem, contents);
+ actionsRegistry.addAction(ActionGroups.ITEM_MENU, copyContent, contents);
+ actionsRegistry.addAction(ActionGroups.ITEM_MENU, writeToParticipants, contents);
// Currently new menu in folders has no sense (because we have buttons for
// the same contents)
// newMenusRegistry.register(TYPE_FOLDER, taskFolderNewMenu.get());
Modified: trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -20,6 +20,7 @@
package cc.kune.wave.server;
import java.util.Iterator;
+import java.util.List;
import java.util.Set;
import org.waveprotocol.box.server.CoreSettings;
@@ -60,6 +61,10 @@
return atDomain;
}
+ public String getDomain() {
+ return domain;
+ }
+
public ParticipantId getPublicParticipantId() {
return of(getAtDomain());
}
@@ -72,6 +77,14 @@
return address.contains(getAtDomain());
}
+ public ParticipantId[] listFrom(final List<String> list) {
+ final ParticipantId[] array = new ParticipantId[list.size()];
+ for (int i = 0; i < list.size(); i++) {
+ array[i] = of(list.get(i));
+ }
+ return array;
+ }
+
public ParticipantId[] listFrom(final Set<User> list) {
final ParticipantId[] array = new ParticipantId[list.size()];
final Iterator<User> iterator = list.iterator();
Modified: trunk/src/main/java/cc/kune/wave/server/kspecific/KuneAgent.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/kspecific/KuneAgent.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/wave/server/kspecific/KuneAgent.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -115,7 +115,7 @@
}
@Override
- public WaveRef createWave(final String title, final String message, final String waveIdToCopy,
+ public WaveRef createWave(final String title, final String message, final WaveRef waveIdToCopy,
final SimpleArgCallback<WaveRef> onCreate, final URL gadgetUrl,
final Map<String, String> gadgetProperties, final ParticipantId... participantsArray) {
// TODO Auto-generated method stub
@@ -123,7 +123,7 @@
}
@Override
- public WaveRef createWave(final String title, final String message, final String waveIdToCopy,
+ public WaveRef createWave(final String title, final String message, final WaveRef waveIdToCopy,
final SimpleArgCallback<WaveRef> onCreate, final URL gadgetUrl,
final ParticipantId... participantsArray) {
return null;
Modified: trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveService.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveService.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveService.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -42,6 +42,7 @@
};
public static final String NO_MESSAGE = "";
public static final String NO_TITLE = "";
+ public static final WaveRef NO_WAVE_TO_COPY = null;
public static final URL WITHOUT_GADGET = null;
void addGadget(WaveRef waveName, String author, URL gadgetUrl);
@@ -62,11 +63,11 @@
WaveRef createWave(String title, String message, SimpleArgCallback<WaveRef> onCreate, URL gadgetUrl,
ParticipantId... participantsArray);
- WaveRef createWave(String title, String message, String waveIdToCopy,
+ WaveRef createWave(String title, String message, WaveRef waveIdToCopy,
SimpleArgCallback<WaveRef> onCreate, URL gadgetUrl, Map<String, String> gadgetProperties,
ParticipantId... participantsArray);
- WaveRef createWave(String title, String message, String waveIdToCopy,
+ WaveRef createWave(String title, String message, WaveRef waveIdToCopy,
SimpleArgCallback<WaveRef> onCreate, URL gadgetUrl, ParticipantId... participantsArray);
void delParticipants(WaveRef waveName, String whoDel, String... participants);
Modified: trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveServiceDefault.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveServiceDefault.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -68,10 +68,8 @@
import com.google.wave.api.ElementType;
import com.google.wave.api.FormElement;
import com.google.wave.api.Gadget;
-import com.google.wave.api.Image;
import com.google.wave.api.JsonRpcConstant.ParamsProperty;
import com.google.wave.api.JsonRpcResponse;
-import com.google.wave.api.Line;
import com.google.wave.api.OperationQueue;
import com.google.wave.api.OperationRequest;
import com.google.wave.api.OperationRequest.Parameter;
@@ -95,7 +93,6 @@
private static final String NO_ANNOTATION_KEY = null;
private static final List<BundledAnnotation> NO_BUNDLED_ANNOTATIONS = Collections.emptyList();
private static final List<String> NO_VALUES = Collections.<String> emptyList();
- private static final String NO_WAVE_TO_COPY = null;
/**
*
@@ -134,14 +131,16 @@
result = new FormElement(type, entry.getValue().getProperties());
} else if (type == ElementType.GADGET) {
result = new Gadget(entry.getValue().getProperties());
- } else if (type == ElementType.IMAGE) {
- result = new Image(entry.getValue().getProperties());
- } else if (type == ElementType.LINE) {
- result = new Line(entry.getValue().getProperties());
- } else {
- result = new Element(type, entry.getValue().getProperties());
+ // } else if (type == ElementType.IMAGE) {
+ // result = new Image(entry.getValue().getProperties());
+ // } else if (type == ElementType.LINE) {
+ // result = new Line(entry.getValue().getProperties());
+ // } else {
+ // result = new Element(type, entry.getValue().getProperties());
}
- toBlip.append(result);
+ if (result != null) {
+ toBlip.append(result);
+ }
}
}
@@ -249,7 +248,7 @@
@Override
public WaveRef createWave(@Nonnull final String title, final String message,
- final String waveIdToCopy, final SimpleArgCallback<WaveRef> onCreate, final URL gadgetUrl,
+ final WaveRef waveIdToCopy, final SimpleArgCallback<WaveRef> onCreate, final URL gadgetUrl,
final Map<String, String> gadgetProperties, @Nonnull final ParticipantId... participantsArray) {
String newWaveId = null;
String newWaveletId = null;
@@ -264,17 +263,16 @@
final Blip rootBlip = newWavelet.getRootBlip();
rootBlip.append(new com.google.wave.api.Markup(message).getText());
- if (waveIdToCopy != NO_WAVE_TO_COPY && TextUtils.notEmpty(waveIdToCopy)) {
+ if (waveIdToCopy != NO_WAVE_TO_COPY) {
try {
- WaveId copyWaveId;
- copyWaveId = WaveId.ofChecked(domain, waveIdToCopy);
- final Wavelet waveletToCopy = fetchWave(copyWaveId, WaveletId.of(domain, "conv+root"),
+ // WaveId copyWaveId;
+ // copyWaveId = WaveId.ofChecked(domain, waveIdToCopy);
+ final Wavelet waveletToCopy = fetchWave(waveIdToCopy.getWaveId(), waveIdToCopy.getWaveletId(),
participantsArray[0].toString());
if (waveletToCopy != null) {
copyWavelet(waveletToCopy.getRootBlip(), rootBlip);
+ copyWaveletElements(waveletToCopy.getRootBlip(), rootBlip);
}
- } catch (final InvalidIdException e) {
- LOG.error("Error copying wave content", e);
} catch (final DefaultException e2) {
LOG.error("Error copying wave content", e2);
}
@@ -327,7 +325,7 @@
@Override
public WaveRef createWave(@Nonnull final String title, final String message,
- final String waveIdToCopy, final SimpleArgCallback<WaveRef> onCreate, final URL gadgetUrl,
+ final WaveRef waveIdToCopy, final SimpleArgCallback<WaveRef> onCreate, final URL gadgetUrl,
@Nonnull final ParticipantId... participantsArray) {
return createWave(title, message, waveIdToCopy, onCreate, gadgetUrl,
Collections.<String, String> emptyMap(), participantsArray);
Modified: trunk/src/main/java/cc/kune/wiki/client/actions/WikiClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/wiki/client/actions/WikiClientActions.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/cc/kune/wiki/client/actions/WikiClientActions.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -39,10 +39,12 @@
import cc.kune.gspace.client.actions.AddPublicToContentMenuItem;
import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
import cc.kune.gspace.client.actions.ContentViewerShareMenu;
+import cc.kune.gspace.client.actions.CopyContentMenuItem;
import cc.kune.gspace.client.actions.ParticipateInContentBtn;
import cc.kune.gspace.client.actions.RefreshContentMenuItem;
import cc.kune.gspace.client.actions.SetAsHomePageMenuItem;
import cc.kune.gspace.client.actions.TutorialContainerBtn;
+import cc.kune.gspace.client.actions.WriteToParticipantsMenuItem;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -74,6 +76,8 @@
final Provider<ChatAboutContentBtn> chatAbout, final Provider<RefreshContentMenuItem> refresh,
final Provider<SetAsHomePageMenuItem> setAsHomePage,
final NewMenusForTypeIdsRegistry newMenusRegistry, final WikiFolderNewMenu folderNewMenu,
+ final Provider<CopyContentMenuItem> copyContent,
+ final Provider<WriteToParticipantsMenuItem> writeToParticipants,
final WikiPageNewMenu wikipageNewMenu) {
super(session, stateManager, i18n, registry);
actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all);
@@ -97,6 +101,8 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, tutorialBtn, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
actionsRegistry.addAction(ActionGroups.TOOLBAR, chatAbout, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, copyContent, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, writeToParticipants, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, containersNoRoot);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem, contents);
@@ -106,6 +112,8 @@
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addAdminMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addCollabMembersMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, addPublicMenuItem, contents);
+ actionsRegistry.addAction(ActionGroups.ITEM_MENU, copyContent, contents);
+ actionsRegistry.addAction(ActionGroups.ITEM_MENU, writeToParticipants, contents);
// Currently new menu in folders has no sense (because we have buttons for
// the same contents)
// newMenusRegistry.register(TYPE_FOLDER, folderNewMenu.get());
Modified: trunk/src/main/java/com/google/wave/splash/text/ContentRenderer.java
===================================================================
--- trunk/src/main/java/com/google/wave/splash/text/ContentRenderer.java 2012-03-10 07:36:46 UTC (rev 1754)
+++ trunk/src/main/java/com/google/wave/splash/text/ContentRenderer.java 2012-03-11 08:06:00 UTC (rev 1755)
@@ -24,6 +24,7 @@
import org.waveprotocol.wave.client.editor.content.paragraph.DefaultParagraphHtmlRenderer;
import org.waveprotocol.wave.client.editor.content.paragraph.Paragraph;
+import org.waveprotocol.wave.client.editor.content.paragraph.Paragraph.Alignment;
import com.google.gwt.dom.client.Style.FontWeight;
import com.google.inject.Inject;
@@ -99,6 +100,7 @@
private final GadgetRenderer gadgetRenderer;
private boolean identing;
+ private boolean inAlign = false;
private boolean inheader = false;
private final WaveRenderer waveRenderer;
@@ -117,7 +119,13 @@
}
private void emitAnnotation(final Marker marker, final StringBuilder builder) {
- if (marker.isEnd) {
+ if (marker.annotation.getName().startsWith("link")) {
+ if (marker.isEnd) {
+ builder.append("</a>");
+ } else {
+ builder.append("<a href=\"" + marker.annotation.getValue() + "\" target=\"_blank\">");
+ }
+ } else if (marker.isEnd) {
// if (marker.annotation.getName().)
builder.append("</span>");
} else {
@@ -147,12 +155,19 @@
final String i = element.getProperty(Line.INDENT);
final String a = element.getProperty(Line.ALIGNMENT);
final String d = element.getProperty(Line.DIRECTION);
+ // For direction stuff (RTL etc) see DefaultParagraphHtml
+ if (inAlign) {
+ // Close identations
+ inAlign = false;
+ builder.append("</div><!-- end of align -->");
+ }
final Integer ident = i != null ? Integer.valueOf(i) : 0;
if (inheader) {
// New line, we close previous header
builder.append("</div> <!-- end h1/h2... header -->");
inheader = false;
}
+
if (t != null && t.equals(Paragraph.LIST_TYPE)) {
// type-0 to 2, margin 22px * i <li class="bullet-type-0"
// style="margin-left: 88px;">
@@ -166,6 +181,10 @@
} else {
closeIndentIfNecessary(builder);
}
+ if (a != null) {
+ builder.append("<div style=\"text-align:" + Alignment.fromValue(a).cssValue() + ";\">");
+ inAlign = true;
+ }
if (t != null && t.startsWith("h")) {
// See DefaultParagraphHtml
final String fontWeight = FontWeight.BOLD.getCssName();
@@ -249,6 +268,9 @@
if (annotationName.startsWith("style")) {
markers.add(Marker.fromAnnotation(annotation, annotation.getRange().getStart(), false));
markers.add(Marker.fromAnnotation(annotation, annotation.getRange().getEnd(), true));
+ } else if (annotationName.startsWith("link")) {
+ markers.add(Marker.fromAnnotation(annotation, annotation.getRange().getStart(), false));
+ markers.add(Marker.fromAnnotation(annotation, annotation.getRange().getEnd(), true));
} else if ("conv/title".equals(annotationName)) {
// Find the first newline and make sure the annotation only gets to that
// point.
@@ -261,6 +283,8 @@
// "bold", start, end);
// markers.add(Marker.fromAnnotation(title, start, false));
// markers.add(Marker.fromAnnotation(title, end, true));
+ } else {
+ // LOG?
}
}
}
More information about the kune-commits
mailing list