[kune-commits] r1523 - in trunk: script src/main/java/cc/kune/chat/client/actions src/main/java/cc/kune/core/client/i18n src/main/java/cc/kune/core/client/rpcservices src/main/java/cc/kune/core/server src/main/java/cc/kune/core/server/content src/main/java/cc/kune/core/server/properties src/main/java/cc/kune/core/server/rpc src/main/java/cc/kune/core/shared/dto src/main/java/cc/kune/gspace/client src/main/java/cc/kune/gspace/client/actions src/main/java/cc/kune/gspace/client/viewers src/main/java/cc/kune/wave/client src/main/java/cc/kune/wave/server src/main/resources

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Tue Sep 20 03:33:01 CEST 2011


Author: vjrj_
Date: 2011-09-20 03:32:58 +0200 (Tue, 20 Sep 2011)
New Revision: 1523

Added:
   trunk/src/main/java/cc/kune/gspace/client/actions/GiveUsFeedbackAction.java
   trunk/src/main/java/cc/kune/gspace/client/actions/GiveUsFeedbackBtn.java
Modified:
   trunk/script/i18n-db2gwt.sh
   trunk/src/main/java/cc/kune/chat/client/actions/ChatAboutContentBtn.java
   trunk/src/main/java/cc/kune/core/client/i18n/I18nUITranslationService.java
   trunk/src/main/java/cc/kune/core/client/i18n/KuneConstants.java
   trunk/src/main/java/cc/kune/core/client/i18n/KuneConstants_es.properties
   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/InitData.java
   trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java
   trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java
   trunk/src/main/java/cc/kune/core/server/properties/KunePropertiesDefault.java
   trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
   trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java
   trunk/src/main/java/cc/kune/core/shared/dto/InitDataDTO.java
   trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java
   trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java
   trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
   trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java
   trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java
   trunk/src/main/java/cc/kune/wave/client/WaveGinModule.java
   trunk/src/main/java/cc/kune/wave/client/WebClient.java
   trunk/src/main/java/cc/kune/wave/server/KuneAgent.java
   trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java
   trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java
   trunk/src/main/resources/kune.properties
Log:
NEW - # 79: I18n refactorization 
http://kune.ourproject.org/issues/ticket/79
CLOSED - # 108: Send Feedback button 
http://kune.ourproject.org/issues/ticket/108

Modified: trunk/script/i18n-db2gwt.sh
===================================================================
--- trunk/script/i18n-db2gwt.sh	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/script/i18n-db2gwt.sh	2011-09-20 01:32:58 UTC (rev 1523)
@@ -41,10 +41,13 @@
 
 if [[ $J -eq 1 ]] 
 then
-mysql -B --skip-column-names --password="db4kune" -u kune kune_dev -e "$SEL" \
+mysql -B --skip-column-names --default-character-set=utf8 --password="db4kune" -u kune kune_dev -e "$SEL" \
 | sed 's/	/ł/g' \
 | awk -F "ł" '
 BEGIN {
+  print "/**"
+  print " * Autogenerated by trunk/bin/i18n-db2gwt.sh, please not edit directly"
+  print " */"
   print "public interface KuneConstants extends ConstantsWithLookup {"
 }
 {
@@ -69,6 +72,10 @@
 | sed 's/	/ł/g' \
 | awk -F "ł" '
 BEGIN {
+  print "#"
+  print "# Autogenerated by trunk/bin/i18n-db2gwt.sh, please not edit directly"
+  print "#"
+  print
 }
 {
   lang=$4

Modified: trunk/src/main/java/cc/kune/chat/client/actions/ChatAboutContentBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/ChatAboutContentBtn.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/chat/client/actions/ChatAboutContentBtn.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -22,6 +22,8 @@
 import cc.kune.chat.client.ChatClient;
 import cc.kune.common.client.actions.ActionEvent;
 import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.utils.SimpleResponseCallback;
 import cc.kune.core.client.actions.RolAction;
 import cc.kune.core.client.resources.CoreResources;
 import cc.kune.core.client.state.Session;
@@ -51,11 +53,23 @@
 
     @Override
     public void actionPerformed(final ActionEvent event) {
-      final String subject = i18n.t("Chat about: [%s]", session.getContentState().getTitle());
-      final StateToken token = session.getCurrentStateToken();
-      chatClient.get().joinRoom(token.toString().replaceAll("\\.", "-"), subject,
-          session.getCurrentUserInfo().getShortName());
-      chatClient.get().show();
+      NotifyUser.askConfirmation(
+          i18n.t("Confirm, please:"),
+          i18n.t("This will open a specific chatroom to chat about this page or document (it's useful to chat with others about something while reading/modifing it). Are you sure?"),
+          new SimpleResponseCallback() {
+            @Override
+            public void onCancel() {
+            }
+
+            @Override
+            public void onSuccess() {
+              final String subject = i18n.t("Chat about: [%s]", session.getContentState().getTitle());
+              final StateToken token = session.getCurrentStateToken();
+              chatClient.get().joinRoom(token.toString().replaceAll("\\.", "-"), subject,
+                  session.getCurrentUserInfo().getShortName());
+              chatClient.get().show();
+            }
+          });
     }
 
   }

Modified: trunk/src/main/java/cc/kune/core/client/i18n/I18nUITranslationService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/i18n/I18nUITranslationService.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/core/client/i18n/I18nUITranslationService.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -24,7 +24,6 @@
 import java.util.MissingResourceException;
 
 import cc.kune.common.client.log.Log;
-import cc.kune.common.client.notify.NotifyUser;
 import cc.kune.common.client.utils.Location;
 import cc.kune.common.client.utils.TextUtils;
 import cc.kune.common.client.utils.WindowUtils;
@@ -64,7 +63,6 @@
       @Override
       public void onSuccess(final I18nLanguageDTO result) {
         currentLang = result;
-        NotifyUser.info("lang: " + result.getCode());
         currentLanguageCode = currentLang.getCode();
         session.setCurrentLanguage(currentLang);
         i18nService.getLexicon(currentLang.getCode(), new AsyncCallback<HashMap<String, String>>() {

Modified: trunk/src/main/java/cc/kune/core/client/i18n/KuneConstants.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/i18n/KuneConstants.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/core/client/i18n/KuneConstants.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -1,5 +1,8 @@
 package cc.kune.core.client.i18n;
 
+/**
+ * Autogenerated by trunk/bin/i18n-db2gwt.sh, please not edit directly
+ */
 import com.google.gwt.i18n.client.ConstantsWithLookup;
 
 public interface KuneConstants extends ConstantsWithLookup {

Modified: trunk/src/main/java/cc/kune/core/client/i18n/KuneConstants_es.properties
===================================================================
--- trunk/src/main/java/cc/kune/core/client/i18n/KuneConstants_es.properties	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/core/client/i18n/KuneConstants_es.properties	2011-09-20 01:32:58 UTC (rev 1523)
@@ -1,3 +1,6 @@
+#
+# Autogenerated by trunk/bin/i18n-db2gwt.sh, please not edit directly
+#
 addAsABuddienull = Añadir como colega
 chatNull = Chat ;)
 search = Buscar

Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -74,6 +74,8 @@
 
   void save(String user, StateToken token, String content) throws DefaultException;
 
+  String sendFeedback(String userHash, String title, String body);
+
   ContentSimpleDTO setAsDefaultContent(String userHash, StateToken token);
 
   I18nLanguageDTO setLanguage(String userHash, StateToken token, String languageCode)

Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -77,6 +77,8 @@
 
   void save(String user, StateToken token, String content, AsyncCallback<Void> asyncCallback);
 
+  void sendFeedback(String userHash, String title, String body, AsyncCallback<String> callback);
+
   void setAsDefaultContent(String userHash, StateToken token,
       AsyncCallback<ContentSimpleDTO> asyncCallback);
 

Modified: trunk/src/main/java/cc/kune/core/server/InitData.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/InitData.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/core/server/InitData.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -42,6 +42,7 @@
   private License defaultLicense;
   private String defaultWsTheme;
   private List<ExtMediaDescrip> extMediaDescrips;
+  private boolean feedbackEnabled;
   private String flvEmbedObject;
   private String galleryPermittedExtensions;
   private List<ToolSimple> groupTools;
@@ -180,6 +181,10 @@
     return userTools;
   }
 
+  public boolean isFeedbackEnabled() {
+    return feedbackEnabled;
+  }
+
   public void setAviEmbedObject(final String aviEmbedObject) {
     this.aviEmbedObject = aviEmbedObject;
   }
@@ -216,6 +221,10 @@
     this.extMediaDescrips = extMediaDescrips;
   }
 
+  public void setFeedbackEnabled(final boolean feedbackEnabled) {
+    this.feedbackEnabled = feedbackEnabled;
+  }
+
   public void setFlvEmbedObject(final String flvEmbedObject) {
     this.flvEmbedObject = flvEmbedObject;
   }

Modified: trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -46,7 +46,6 @@
   private final ContainerManager containerManager;
   private final ContentManager contentManager;
   private final Log LOG = LogFactory.getLog(CreationServiceDefault.class);
-
   private final ServerToolRegistry tools;
 
   @Inject

Modified: trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -28,6 +28,8 @@
   String CHAT_ROOM_HOST = "kune.chat.roomHost";
   String CURRENT_CC_VERSION = "kune.currentccversion";
   String DEFAULT_SITE_SHORT_NAME = "kune.default.site.shortName";
+  String FEEDBACK_ENABLED = "kune.feedback.enabled";
+  String FEEDBACK_TO = "kune.feedback.to";
   String FLV_EMBEDED_OBJECT = "kune.media.flvembededobject";
   String IMAGES_CROPSIZE = "kune.images.cropsize";
   String IMAGES_ICONSIZE = "kune.images.iconsize";
@@ -63,6 +65,8 @@
 
   String get(String key, String defaultValue);
 
+  boolean getBoolean(String key);
+
   Integer getInteger(String key);
 
   List<String> getList(String key);

Modified: trunk/src/main/java/cc/kune/core/server/properties/KunePropertiesDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/properties/KunePropertiesDefault.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/core/server/properties/KunePropertiesDefault.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -70,6 +70,13 @@
   }
 
   @Override
+  public boolean getBoolean(final String key) {
+    final Boolean value = config.getBoolean(key);
+    checkNull(key, value);
+    return value;
+  }
+
+  @Override
   public Integer getInteger(final String key) {
     final Integer value = config.getInt(key);
     checkNull(key, value);

Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -19,10 +19,15 @@
  */
 package cc.kune.core.server.rpc;
 
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 import javax.persistence.NoResultException;
 
+import org.waveprotocol.wave.model.wave.ParticipantId;
+import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
+
 import cc.kune.chat.server.ChatManager;
 import cc.kune.core.client.errors.AccessViolationException;
 import cc.kune.core.client.errors.ContentNotFoundException;
@@ -45,6 +50,7 @@
 import cc.kune.core.server.manager.GroupManager;
 import cc.kune.core.server.manager.TagUserContentManager;
 import cc.kune.core.server.mapper.Mapper;
+import cc.kune.core.server.properties.KuneProperties;
 import cc.kune.core.server.state.StateContainer;
 import cc.kune.core.server.state.StateContent;
 import cc.kune.core.server.state.StateService;
@@ -65,6 +71,8 @@
 import cc.kune.domain.Content;
 import cc.kune.domain.Group;
 import cc.kune.domain.User;
+import cc.kune.wave.server.KuneWaveManager;
+import cc.kune.wave.server.ParticipantUtils;
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
@@ -78,7 +86,10 @@
   private final CreationService creationService;
   private final FinderService finderService;
   private final GroupManager groupManager;
+  private final KuneProperties kuneProperties;
+  private final KuneWaveManager kuneWaveManager;
   private final Mapper mapper;
+  private final ParticipantUtils participantUtils;
   private final AccessRightsService rightsService;
   private final StateService stateService;
   private final TagUserContentManager tagManager;
@@ -90,7 +101,8 @@
       final StateService stateService, final CreationService creationService,
       final GroupManager groupManager, final ContentManager contentManager,
       final ContainerManager containerManager, final TagUserContentManager tagManager,
-      final Mapper mapper, final ChatManager chatManager) {
+      final Mapper mapper, final ChatManager chatManager, final KuneWaveManager kuneWaveManager,
+      final KuneProperties kuneProperties, final ParticipantUtils participantUtils) {
     this.finderService = finderService;
     this.userSessionProvider = userSessionProvider;
     this.accessService = accessService;
@@ -103,6 +115,9 @@
     this.tagManager = tagManager;
     this.mapper = mapper;
     this.chatManager = chatManager;
+    this.kuneWaveManager = kuneWaveManager;
+    this.kuneProperties = kuneProperties;
+    this.participantUtils = participantUtils;
   }
 
   @Override
@@ -436,6 +451,22 @@
 
   @Override
   @Authenticated
+  @Transactional
+  public String sendFeedback(final String userHash, final String title, final String body)
+      throws DefaultException {
+    final User user = getCurrentUser();
+    final List<String> participants = kuneProperties.getList(KuneProperties.FEEDBACK_TO);
+    participants.add(0, user.getShortName());
+    final List<ParticipantId> partIds = new ArrayList<ParticipantId>();
+    for (final String part : participants) {
+      partIds.add(participantUtils.of(part));
+    }
+    return JavaWaverefEncoder.encodeToUriPathSegment(kuneWaveManager.createWave(title, body,
+        partIds.toArray(new ParticipantId[0])));
+  }
+
+  @Override
+  @Authenticated
   @Authorizated(accessRolRequired = AccessRol.Administrator)
   @Transactional
   public ContentSimpleDTO setAsDefaultContent(final String userHash, final StateToken token) {

Modified: trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -152,6 +152,7 @@
     data.setOggEmbedObject(kuneProperties.get(KuneProperties.OGG_EMBEDED_OBJECT));
     data.setAviEmbedObject(kuneProperties.get(KuneProperties.AVI_EMBEDED_OBJECT));
     data.setExtMediaDescrips(extMediaDescManager.getAll());
+    data.setFeedbackEnabled(kuneProperties.getBoolean(KuneProperties.FEEDBACK_ENABLED));
     return data;
   }
 }

Modified: trunk/src/main/java/cc/kune/core/shared/dto/InitDataDTO.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/InitDataDTO.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/core/shared/dto/InitDataDTO.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -35,6 +35,7 @@
   private LicenseDTO defaultLicense;
   private String defaultWsTheme;
   private List<ExtMediaDescripDTO> extMediaDescrips;
+  private boolean feedbackEnabled;
   private String flvEmbedObject;
   private String galleryPermittedExtensions;
   private List<ToolSimpleDTO> groupTools;
@@ -180,6 +181,10 @@
     return getUserInfo() != null;
   }
 
+  public boolean isFeedbackEnabled() {
+    return feedbackEnabled;
+  }
+
   public void setAviEmbedObject(final String aviEmbedObject) {
     this.aviEmbedObject = aviEmbedObject;
   }
@@ -216,6 +221,10 @@
     this.extMediaDescrips = extMediaDescrips;
   }
 
+  public void setFeedbackEnabled(final boolean feedbackEnabled) {
+    this.feedbackEnabled = feedbackEnabled;
+  }
+
   public void setFlvEmbedObject(final String flvEmbedObject) {
     this.flvEmbedObject = flvEmbedObject;
   }

Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -61,6 +61,8 @@
 
   IsActionExtensible getSubheaderToolbar();
 
+  IsActionExtensible getToolsSouthToolbar();
+
   ForIsWidget getUserSpace();
 
   void selectGroupSpace();

Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -95,6 +95,8 @@
   private final ActionFlowPanel subheaderToolbar;
   @UiField
   TabLayoutPanel tabs;
+  private final ActionFlowPanel toolsSouthToolbar;
+
   @UiField
   FlowPanel userSpace;
 
@@ -110,9 +112,11 @@
     footerToolbar = toolbarProv.get();
     headerToolbar = toolbarProv.get();
     subheaderToolbar = toolbarProv.get();
+    toolsSouthToolbar = toolbarProv.get();
     getDocHeader().add(headerToolbar);
     getDocSubheader().add(subheaderToolbar);
     getDocFooter().add(footerToolbar);
+    getEntityToolsSouth().add(toolsSouthToolbar);
     entityToolsNorth.getElement().getStyle().setPosition(Position.RELATIVE);
     // entityToolsSouth.setVisible(false);
     mainpanel.getWidgetContainerElement(tabs).addClassName("k-spaces");
@@ -215,6 +219,11 @@
   }
 
   @Override
+  public IsActionExtensible getToolsSouthToolbar() {
+    return toolsSouthToolbar;
+  }
+
+  @Override
   public ForIsWidget getUserSpace() {
     return userSpace;
   }

Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -23,13 +23,14 @@
 import cc.kune.core.client.sitebar.search.SitebarSearchPanel;
 import cc.kune.core.client.sitebar.search.SitebarSearchPresenter;
 import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
+import cc.kune.gspace.client.actions.GiveUsFeedbackBtn;
 import cc.kune.gspace.client.actions.RenameAction;
 import cc.kune.gspace.client.i18n.I18nTranslator;
 import cc.kune.gspace.client.i18n.I18nTranslatorPanel;
 import cc.kune.gspace.client.i18n.I18nTranslatorPresenter;
 import cc.kune.gspace.client.i18n.I18nTranslatorPresenter.I18nTranslatorView;
+import cc.kune.gspace.client.i18n.I18nTranslatorTabsCollection;
 import cc.kune.gspace.client.i18n.SiteOptionsI18nTranslatorAction;
-import cc.kune.gspace.client.i18n.I18nTranslatorTabsCollection;
 import cc.kune.gspace.client.licensewizard.LicenseChangeAction;
 import cc.kune.gspace.client.licensewizard.LicenseWizard;
 import cc.kune.gspace.client.licensewizard.LicenseWizardPanel;
@@ -184,6 +185,7 @@
     // Actions
     s(ContentViewerOptionsMenu.class);
     s(RenameAction.class);
+    s(GiveUsFeedbackBtn.class);
 
     // LicenseWizard
     bindPresenter(LicenseWizardPresenter.class, LicenseWizardView.class, LicenseWizardPanel.class,

Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -23,9 +23,10 @@
 import cc.kune.core.client.init.AppStartEvent.AppStartHandler;
 import cc.kune.core.client.sitebar.search.SitebarSearchPresenter;
 import cc.kune.core.client.state.Session;
+import cc.kune.gspace.client.actions.GiveUsFeedbackBtn;
 import cc.kune.gspace.client.i18n.I18nToTranslateGridPanel;
+import cc.kune.gspace.client.i18n.I18nTranslatorTabsCollection;
 import cc.kune.gspace.client.i18n.SiteOptionsI18nTranslatorAction;
-import cc.kune.gspace.client.i18n.I18nTranslatorTabsCollection;
 import cc.kune.gspace.client.options.GroupOptions;
 import cc.kune.gspace.client.options.GroupOptionsCollection;
 import cc.kune.gspace.client.options.UserOptions;
@@ -67,6 +68,7 @@
       final Provider<UserOptStyle> ups, final Provider<UserOptLogo> ul,
       final Provider<UserOptTools> utc, final Provider<SitebarSearchPresenter> siteSearch,
       final Provider<SiteOptionsI18nTranslatorAction> transAction,
+      final Provider<GiveUsFeedbackBtn> giveUsFeedback,
       final Provider<I18nToTranslateGridPanel> toTrans,
       final Provider<I18nTranslatorTabsCollection> gtranslator) {
 
@@ -102,6 +104,11 @@
         // i18n
         transAction.get();
         gtranslator.get().add(toTrans);
+
+        // Feedback
+        if (event.getInitData().isFeedbackEnabled()) {
+          giveUsFeedback.get();
+        }
       }
     });
   }

Added: trunk/src/main/java/cc/kune/gspace/client/actions/GiveUsFeedbackAction.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/GiveUsFeedbackAction.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/GiveUsFeedbackAction.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -0,0 +1,69 @@
+package cc.kune.gspace.client.actions;
+
+import cc.kune.common.client.actions.AbstractExtendedAction;
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.notify.NotifyLevel;
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.utils.SimpleResponseCallback;
+import cc.kune.core.client.auth.SignIn;
+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.SiteTokens;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.client.state.TokenUtils;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class GiveUsFeedbackAction extends AbstractExtendedAction {
+
+  private final Provider<ContentServiceAsync> contentService;
+  private final I18nTranslationService i18n;
+  private final Session session;
+  private final Provider<SignIn> signIn;
+  private final StateManager stateManager;
+
+  @Inject
+  public GiveUsFeedbackAction(final Session session, final Provider<SignIn> signIn,
+      final StateManager stateManager, final I18nTranslationService i18n,
+      final Provider<ContentServiceAsync> contentService) {
+    this.session = session;
+    this.signIn = signIn;
+    this.stateManager = stateManager;
+    this.i18n = i18n;
+    this.contentService = contentService;
+  }
+
+  @Override
+  public void actionPerformed(final ActionEvent event) {
+    if (session.isLogged()) {
+      NotifyUser.askConfirmation(
+          i18n.t("Confirm, please:"),
+          i18n.t("Do you want to write us with some positive or negative feedback? This can help us to improve these services"),
+          new SimpleResponseCallback() {
+            @Override
+            public void onCancel() {
+            }
+
+            @Override
+            public void onSuccess() {
+              contentService.get().sendFeedback(session.getUserHash(),
+                  i18n.t("Feedback of [%s]", session.getCurrentUser().getShortName()),
+                  i18n.t("Edit and write here your feedback."), new AsyncCallbackSimple<String>() {
+                    @Override
+                    public void onSuccess(final String url) {
+                      stateManager.gotoHistoryToken(url);
+                    }
+                  });
+            }
+          });
+    } else {
+      signIn.get().setErrorMessage(i18n.t("Sign in or create an account to give us feedback"),
+          NotifyLevel.info);
+      stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGNIN,
+          session.getCurrentStateToken().toString()));
+    }
+  }
+}

Added: trunk/src/main/java/cc/kune/gspace/client/actions/GiveUsFeedbackBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/GiveUsFeedbackBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/GiveUsFeedbackBtn.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -0,0 +1,23 @@
+package cc.kune.gspace.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.GSpaceArmor;
+
+import com.google.inject.Inject;
+
+public class GiveUsFeedbackBtn extends ButtonDescriptor {
+
+  @Inject
+  public GiveUsFeedbackBtn(final GiveUsFeedbackAction action, final I18nTranslationService i18n,
+      final NavResources res, final GSpaceArmor armor) {
+    super(action);
+    withIcon(res.refresh());
+    withText(i18n.t("Give us feedback!"));
+    withToolTip(i18n.t("Write us with some feedback for help us to improve these services"));
+    withStyles("k-noborder, k-nobackcolor, k-no-backimage");
+    armor.getToolsSouthToolbar().add(this);
+  }
+
+}

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -42,6 +42,7 @@
 import cc.kune.gspace.client.actions.RenameAction;
 import cc.kune.gspace.client.actions.RenameListener;
 import cc.kune.gspace.client.tool.ContentViewer;
+import cc.kune.wave.client.WaveClientManager;
 
 import com.google.gwt.event.shared.EventBus;
 import com.google.gwt.event.shared.HandlerRegistration;
@@ -96,7 +97,7 @@
   public ContentViewerPresenter(final EventBus eventBus, final ContentViewerView view,
       final StateManager stateManager, final ContentViewerProxy proxy, final Session session,
       final ActionRegistryByType actionsRegistry, final Provider<RenameAction> renameAction,
-      final PathToolbarUtils pathToolbarUtils) {
+      final PathToolbarUtils pathToolbarUtils, final WaveClientManager wavClientManager) {
     super(eventBus, view, proxy);
     this.session = session;
     this.actionsRegistry = actionsRegistry;
@@ -109,7 +110,6 @@
       }
     });
     session.onUserSignIn(true, new UserSignInHandler() {
-
       @Override
       public void onUserSignIn(final UserSignInEvent event) {
         getView().signIn();
@@ -174,7 +174,8 @@
     if (session.isLogged() && rights.isEditable()) {
       if (stateContent.isParticipant()) {
         // is already participant, show wave editor
-        if (org.waveprotocol.box.webclient.client.Session.get().isLoggedIn()) {
+        final org.waveprotocol.box.webclient.client.Session waveSession = org.waveprotocol.box.webclient.client.Session.get();
+        if (waveSession != null && waveSession.isLoggedIn()) {
           // final String typeId = stateContent.getTypeId();
           // if (typeId.equals(BartersConstants.TYPE_BARTER)
           // || typeId.equals(MeetingsConstants.TYPE_MEETING)) {

Modified: trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -19,6 +19,7 @@
  */
 package cc.kune.wave.client;
 
+import cc.kune.common.client.log.Log;
 import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
 import cc.kune.core.client.rpcservices.UserServiceAsync;
 import cc.kune.core.client.state.Session;
@@ -34,6 +35,8 @@
 
 import com.google.gwt.core.client.JavaScriptObject;
 import com.google.gwt.core.client.JsonUtils;
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.core.client.Scheduler.ScheduledCommand;
 import com.google.gwt.event.shared.EventBus;
 import com.google.gwt.user.client.ui.InsertPanel.ForIsWidget;
 import com.google.inject.Inject;
@@ -56,18 +59,24 @@
                 setUseSocketIO(result.useSocketIO());
                 setSessionJSON(JsonUtils.safeEval(result.getSessionJSON()));
                 setClientFlags(JsonUtils.safeEval(result.getClientFlags()));
-                final ForIsWidget userSpace = wsArmor.getUserSpace();
-                if (webClient == null) {
-                  if (userSpace.getWidgetCount() > 0) {
-                    userSpace.remove(0);
+                Log.info("Wave client session: " + result.getSessionJSON());
+                Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+                  @Override
+                  public void execute() {
+                    final ForIsWidget userSpace = wsArmor.getUserSpace();
+                    if (webClient == null) {
+                      if (userSpace.getWidgetCount() > 0) {
+                        userSpace.remove(0);
+                      }
+                      webClient = webclientView.get();
+                      userSpace.add(webClient);
+                    } else {
+                      // this is done with the first webclient creation above
+                      webClient.login();
+                      webClient.asWidget().setVisible(true);
+                    }
                   }
-                  webClient = webclientView.get();
-                  userSpace.add(webClient);
-                } else {
-                  // this is done with the first webclient creation above
-                  webClient.login();
-                  webClient.asWidget().setVisible(true);
-                }
+                });
               }
             });
       }
@@ -91,14 +100,14 @@
   }
 
   private native void setClientFlags(JavaScriptObject object) /*-{
-		$wnd.__client_flags = object;
-  }-*/;
+                                                              $wnd.__client_flags = object;
+                                                              }-*/;
 
   private native void setSessionJSON(JavaScriptObject object) /*-{
-		$wnd.__session = object;
-  }-*/;
+                                                              $wnd.__session = object;
+                                                              }-*/;
 
   private native void setUseSocketIO(boolean use) /*-{
-		$wnd.__useSocketIO = use;
-  }-*/;
+                                                  $wnd.__useSocketIO = use;
+                                                  }-*/;
 }

Modified: trunk/src/main/java/cc/kune/wave/client/WaveGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WaveGinModule.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/wave/client/WaveGinModule.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -32,14 +32,14 @@
    */
   @Override
   protected void configure() {
+    s(WebClientMock.class);
+    s(WebClient.class);
+    s(WaveClientProvider.class);
     s(WaveClientManager.class);
     s(WaveStatusIndicator.class);
     eagle(WaveParts.class);
     s(KuneWaveProfileManager.class);
     s(InboxCountView.class, InboxCountPanel.class);
     s(InboxCountPresenter.class);
-    s(WaveClientProvider.class);
-    s(WebClientMock.class);
-    s(WebClient.class);
   }
 }

Modified: trunk/src/main/java/cc/kune/wave/client/WebClient.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WebClient.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/wave/client/WebClient.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -25,6 +25,7 @@
 import java.util.Date;
 import java.util.logging.Logger;
 
+import org.apache.commons.lang.NotImplementedException;
 import org.waveprotocol.box.webclient.client.ClientEvents;
 import org.waveprotocol.box.webclient.client.ClientIdGenerator;
 import org.waveprotocol.box.webclient.client.DebugMessagePanel;
@@ -32,7 +33,6 @@
 import org.waveprotocol.box.webclient.client.RemoteViewServiceMultiplexer;
 import org.waveprotocol.box.webclient.client.Session;
 import org.waveprotocol.box.webclient.client.SimpleWaveStore;
-import org.waveprotocol.box.webclient.client.StagesProvider;
 import org.waveprotocol.box.webclient.client.WaveWebSocketClient;
 import org.waveprotocol.box.webclient.client.events.NetworkStatusEvent;
 import org.waveprotocol.box.webclient.client.events.NetworkStatusEventHandler;
@@ -51,7 +51,6 @@
 import org.waveprotocol.box.webclient.widget.frame.FramedPanel;
 import org.waveprotocol.box.webclient.widget.loading.LoadingIndicator;
 import org.waveprotocol.wave.client.account.ProfileManager;
-import org.waveprotocol.wave.client.account.impl.ProfileManagerImpl;
 import org.waveprotocol.wave.client.common.safehtml.SafeHtml;
 import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder;
 import org.waveprotocol.wave.client.common.util.AsyncHolder.Accessor;
@@ -62,6 +61,7 @@
 import org.waveprotocol.wave.model.wave.ParticipantId;
 import org.waveprotocol.wave.model.waveref.WaveRef;
 
+import cc.kune.common.client.errors.UIException;
 import cc.kune.common.client.notify.NotifyUser;
 import cc.kune.core.client.errors.DefaultException;
 import cc.kune.core.client.sitebar.spaces.Space;
@@ -81,15 +81,18 @@
 import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.History;
 import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.DockLayoutPanel;
 import com.google.gwt.user.client.ui.SplitLayoutPanel;
 import com.google.gwt.user.client.ui.UIObject;
 import com.google.inject.Inject;
+import com.google.inject.Singleton;
 
 /**
  * Entry point classes define <code>onModuleLoad()</code>.
  */
+ at Singleton
 public class WebClient extends  Composite implements WaveClientView {
   interface Binder extends UiBinder<DockLayoutPanel, WebClient> {
   }
@@ -245,7 +248,7 @@
    */
   @Inject
   public WebClient(final EventBus eventBus, KuneWaveProfileManager profiles, InboxCountPresenter inboxCount, TokenMatcher tokenMatcher) {
-
+    // Window.alert("webclient! " + new Date());
     this.eventBus = eventBus;
     this.profiles = profiles;
     this.inboxCount = inboxCount;
@@ -338,11 +341,11 @@
    */
   // XXX check formatting wrt GPE
   private native String getWebSocketBaseUrl(String moduleBase) /*-{
-		return "ws" + /:\/\/[^\/]+/.exec(moduleBase)[0] + "/";
+    return "ws" + /:\/\/[^\/]+/.exec(moduleBase)[0] + "/";
   }-*/;
 
   private native boolean useSocketIO() /*-{
-		return !!$wnd.__useSocketIO
+    return !!$wnd.__useSocketIO
   }-*/;
 
   /**

Modified: trunk/src/main/java/cc/kune/wave/server/KuneAgent.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneAgent.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/wave/server/KuneAgent.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -70,8 +70,8 @@
   }
 
   @Override
-  public WaveRef createWave(final String message, final ParticipantId participant) {
-    return createWave(NO_TITLE, message, participant);
+  public WaveRef createWave(final String message, final ParticipantId... participants) {
+    return createWave(NO_TITLE, message, participants);
   }
 
   @Override

Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -35,7 +35,7 @@
 
   void addParticipants(WaveRef waveName, String author, String userWhoAdd, String... newParticipants);
 
-  WaveRef createWave(String message, ParticipantId participants);
+  WaveRef createWave(String message, ParticipantId... participants);
 
   WaveRef createWave(String title, String message, ParticipantId... participantsArray);
 

Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java	2011-09-20 01:32:58 UTC (rev 1523)
@@ -211,8 +211,8 @@
   }
 
   @Override
-  public WaveRef createWave(final String message, final ParticipantId participant) {
-    return createWave(NO_TITLE, message, participant);
+  public WaveRef createWave(final String message, final ParticipantId... participants) {
+    return createWave(NO_TITLE, message, participants);
   }
 
   @Override

Modified: trunk/src/main/resources/kune.properties
===================================================================
--- trunk/src/main/resources/kune.properties	2011-09-19 20:25:07 UTC (rev 1522)
+++ trunk/src/main/resources/kune.properties	2011-09-20 01:32:58 UTC (rev 1523)
@@ -29,6 +29,11 @@
 kune.chat.domain = localhost
 kune.chat.roomHost = rooms.localhost
 
+### Feedback syste
+kune.feedback.enabled = true
+# List of participants to give feedback, comma-separated
+kune.feedback.to = admin
+
 ### Other params
 
 # Reserved words to avoid it's use in the client side for user and group names




More information about the kune-commits mailing list