[kune-commits] r1525 - in trunk/src/main/java/cc/kune: core/client core/client/auth core/client/groups/newgroup core/client/sn/actions gspace/client/options/general
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Wed Sep 21 01:21:28 CEST 2011
Author: vjrj_
Date: 2011-09-21 01:21:27 +0200 (Wed, 21 Sep 2011)
New Revision: 1525
Modified:
trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
trunk/src/main/java/cc/kune/core/client/CoreParts.java
trunk/src/main/java/cc/kune/core/client/auth/RegisterForm.java
trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java
trunk/src/main/java/cc/kune/core/client/auth/UserFieldFactory.java
trunk/src/main/java/cc/kune/core/client/groups/newgroup/GroupFieldFactory.java
trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java
trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
trunk/src/main/java/cc/kune/gspace/client/options/general/GroupOptGeneralPanel.java
trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPanel.java
Log:
NEW - # 102: Highlight Sign-In and/or show "New" button disabled to anonymous user
http://kune.ourproject.org/issues/ticket/102
Modified: trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-09-20 14:28:24 UTC (rev 1524)
+++ trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-09-20 23:21:27 UTC (rev 1525)
@@ -39,6 +39,7 @@
import cc.kune.core.client.auth.SignInPanel;
import cc.kune.core.client.auth.SignInPresenter;
import cc.kune.core.client.auth.SignInPresenter.SignInView;
+import cc.kune.core.client.auth.UserFieldFactory;
import cc.kune.core.client.auth.UserPassAutocompleteManager;
import cc.kune.core.client.auth.UserPassAutocompleteManagerImpl;
import cc.kune.core.client.cookies.CookiesManager;
@@ -46,6 +47,7 @@
import cc.kune.core.client.dnd.KuneDragController;
import cc.kune.core.client.dnd.NotImplementedDropManager;
import cc.kune.core.client.errors.ErrorHandler;
+import cc.kune.core.client.groups.newgroup.GroupFieldFactory;
import cc.kune.core.client.groups.newgroup.NewGroup;
import cc.kune.core.client.groups.newgroup.NewGroupPanel;
import cc.kune.core.client.groups.newgroup.NewGroupPresenter;
@@ -140,6 +142,9 @@
s(KuneDragController.class);
s(NotImplementedDropManager.class);
+ s(UserFieldFactory.class);
+ s(GroupFieldFactory.class);
+
// Presenters
bindPresenter(CorePresenter.class, CorePresenter.CoreView.class, CoreViewImpl.class,
CorePresenter.CoreProxy.class);
Modified: trunk/src/main/java/cc/kune/core/client/CoreParts.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreParts.java 2011-09-20 14:28:24 UTC (rev 1524)
+++ trunk/src/main/java/cc/kune/core/client/CoreParts.java 2011-09-20 23:21:27 UTC (rev 1525)
@@ -19,8 +19,6 @@
*/
package cc.kune.core.client;
-import cc.kune.core.client.auth.UserFieldFactory;
-import cc.kune.core.client.groups.newgroup.GroupFieldFactory;
import cc.kune.core.client.init.AppStartEvent;
import cc.kune.core.client.init.AppStartEvent.AppStartHandler;
import cc.kune.core.client.sitebar.SiteUserOptionsPresenter;
@@ -40,8 +38,6 @@
final Provider<UserSNPresenter> buddiesAndParticipationPresenter,
final Provider<GroupSNConfActions> groupMembersConfActions,
final Provider<UserSNConfActions> userSNConfActions,
- final Provider<UserFieldFactory> userFielFactory,
- final Provider<GroupFieldFactory> groupFielFactory,
final Provider<SiteUserOptionsPresenter> userOptions) {
session.onAppStart(true, new AppStartHandler() {
@Override
@@ -51,8 +47,6 @@
groupMembersPresenter.get();
buddiesAndParticipationPresenter.get();
userOptions.get();
- userFielFactory.get();
- groupFielFactory.get();
}
});
}
Modified: trunk/src/main/java/cc/kune/core/client/auth/RegisterForm.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/RegisterForm.java 2011-09-20 14:28:24 UTC (rev 1524)
+++ trunk/src/main/java/cc/kune/core/client/auth/RegisterForm.java 2011-09-20 23:21:27 UTC (rev 1525)
@@ -48,14 +48,15 @@
private final TextField<String> shortNameRegField;
- public RegisterForm(final I18nTranslationService i18n, final Session session) {
+ public RegisterForm(final I18nTranslationService i18n, final Session session,
+ final UserFieldFactory userFieldFactory) {
super.addStyleName("kune-Margin-Large-l");
- shortNameRegField = UserFieldFactory.createUserShortName(NICK_FIELD);
+ shortNameRegField = userFieldFactory.createUserShortName(NICK_FIELD);
shortNameRegField.setTabIndex(1);
add(shortNameRegField);
- longNameRegField = UserFieldFactory.createUserLongName(LONGNAME_FIELD);
+ longNameRegField = userFieldFactory.createUserLongName(LONGNAME_FIELD);
longNameRegField.setTabIndex(2);
add(longNameRegField);
Modified: trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java 2011-09-20 14:28:24 UTC (rev 1524)
+++ trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java 2011-09-20 23:21:27 UTC (rev 1525)
@@ -47,11 +47,11 @@
@Inject
public RegisterPanel(final I18nTranslationService i18n, final Session session,
- final MaskWidgetView mask, final NotifyLevelImages images) {
+ final MaskWidgetView mask, final NotifyLevelImages images, final UserFieldFactory userFieldFactory) {
super(REGISTER_DIALOG, mask, i18n, i18n.t(CoreMessages.REGISTER_TITLE), true, true, true, "",
i18n.t(CoreMessages.REGISTER_TITLE), REGISTER_BUTTON_ID,
i18n.tWithNT("Cancel", "used in button"), CANCEL_BUTTON_ID, images, ERRMSG, 5);
- registerForm = new RegisterForm(i18n, session);
+ registerForm = new RegisterForm(i18n, session, userFieldFactory);
registerForm.setWidth(330);
registerForm.getFormPanel().setId(REGISTER_FORM);
messageErrorBar = new MessageToolbar(images, errorLabelId);
Modified: trunk/src/main/java/cc/kune/core/client/auth/UserFieldFactory.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/UserFieldFactory.java 2011-09-20 14:28:24 UTC (rev 1524)
+++ trunk/src/main/java/cc/kune/core/client/auth/UserFieldFactory.java 2011-09-20 23:21:27 UTC (rev 1525)
@@ -11,9 +11,14 @@
@Singleton
public class UserFieldFactory {
- private static I18nTranslationService i18n;
+ private final I18nTranslationService i18n;
- public static TextField<String> createUserLongName(final String fieldId) {
+ @Inject
+ public UserFieldFactory(final I18nTranslationService i18n) {
+ this.i18n = i18n;
+ }
+
+ public TextField<String> createUserLongName(final String fieldId) {
final TextField<String> longNameRegField = new TextField<String>();
longNameRegField.setFieldLabel(i18n.t("Name"));
longNameRegField.setName(fieldId);
@@ -25,7 +30,7 @@
return longNameRegField;
}
- public static TextField<String> createUserShortName(final String fieldId) {
+ public TextField<String> createUserShortName(final String fieldId) {
final String minMaxText = i18n.t(CoreMessages.FIELD_MUST_BE_BETWEEN_3_AND_15);
final TextField<String> field = new TextField<String>();
field.setFieldLabel(i18n.t("Username"));
@@ -43,9 +48,4 @@
return field;
}
- @Inject
- public UserFieldFactory(final I18nTranslationService i18n) {
- UserFieldFactory.i18n = i18n;
- }
-
}
Modified: trunk/src/main/java/cc/kune/core/client/groups/newgroup/GroupFieldFactory.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/groups/newgroup/GroupFieldFactory.java 2011-09-20 14:28:24 UTC (rev 1524)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/GroupFieldFactory.java 2011-09-20 23:21:27 UTC (rev 1525)
@@ -11,9 +11,14 @@
@Singleton
public class GroupFieldFactory {
- private static I18nTranslationService i18n;
+ private final I18nTranslationService i18n;
- public static TextField<String> createUserLongName(final String fieldId) {
+ @Inject
+ public GroupFieldFactory(final I18nTranslationService i18n) {
+ this.i18n = i18n;
+ }
+
+ public TextField<String> createUserLongName(final String fieldId) {
final TextField<String> field = new TextField<String>();
field.setFieldLabel(i18n.t("Long name"));
field.setName(fieldId);
@@ -26,7 +31,7 @@
return field;
}
- public static TextField<String> createUserShortName(final String fieldId) {
+ public TextField<String> createUserShortName(final String fieldId) {
final String minMaxText = i18n.t(CoreMessages.FIELD_MUST_BE_BETWEEN_3_AND_15);
final TextField<String> field = new TextField<String>();
field.setFieldLabel(i18n.t("Short name"));
@@ -43,9 +48,4 @@
field.setValidationDelay(1000);
return field;
}
-
- @Inject
- public GroupFieldFactory(final I18nTranslationService i18n) {
- GroupFieldFactory.i18n = i18n;
- }
}
Modified: trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java 2011-09-20 14:28:24 UTC (rev 1524)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java 2011-09-20 23:21:27 UTC (rev 1525)
@@ -64,6 +64,7 @@
private final BasicTopDialog dialog;
private final FormPanel form;
+ private final GroupFieldFactory groupFieldFactory;
private final I18nTranslationService i18n;
private TextField<String> longNameField;
private final MaskWidgetView mask;
@@ -71,15 +72,16 @@
private Radio orgRadio;
private Radio projectRadio;
private TextArea publicDescField;
+
private TextField<String> shortNameField;
-
private TextField<String> tag1;
private TextField<String> tag2;
private TextField<String> tag3;
@Inject
public NewGroupPanel(final I18nTranslationService i18n, final NotifyLevelImages img,
- final MaskWidgetView mask) {
+ final MaskWidgetView mask, final GroupFieldFactory groupFieldFactory) {
+ this.groupFieldFactory = groupFieldFactory;
final Builder builder = new BasicTopDialog.Builder(NEWGROUP_WIZARD, false, true).autoscroll(true).title(
i18n.t("Register a new group"));
builder.icon("k-newgroup-icon");
@@ -124,11 +126,11 @@
// intro.setStyleName("k-form-intro");
// form.add(intro);
- shortNameField = GroupFieldFactory.createUserShortName(SHORTNAME_FIELD);
+ shortNameField = groupFieldFactory.createUserShortName(SHORTNAME_FIELD);
shortNameField.setTabIndex(1);
form.add(shortNameField);
- longNameField = GroupFieldFactory.createUserLongName(LONGNAME_FIELD);
+ longNameField = groupFieldFactory.createUserLongName(LONGNAME_FIELD);
longNameField.setTabIndex(2);
form.add(longNameField);
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java 2011-09-20 14:28:24 UTC (rev 1524)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java 2011-09-20 23:21:27 UTC (rev 1525)
@@ -21,13 +21,18 @@
import cc.kune.common.client.actions.Action;
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.resources.CoreResources;
import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
import cc.kune.core.client.rpcservices.SocialNetworkServiceAsync;
import cc.kune.core.client.state.AccessRightsClientManager;
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.dto.AccessRolDTO;
import cc.kune.core.shared.dto.SocialNetworkRequestResult;
import cc.kune.core.shared.i18n.I18nTranslationService;
@@ -37,42 +42,66 @@
public class JoinGroupAction extends SNRolAction {
- @Inject
- public JoinGroupAction(final StateManager stateManager, final Session session, final I18nTranslationService i18n,
- final CoreResources res, final Provider<SocialNetworkServiceAsync> snServiceProvider,
- final AccessRightsClientManager rightsClientManager) {
- super(stateManager, session, i18n, res, snServiceProvider, rightsClientManager, AccessRolDTO.Viewer, false,
- true, false);
- putValue(NAME, i18n.t("Participate"));
- putValue(SHORT_DESCRIPTION, i18n.t("Request to participate in this group"));
- putValue(Action.SMALL_ICON, res.addGreen());
- putValue(Action.STYLES, "k-sn-join");
- }
+ private final Provider<SignIn> signIn;
- @Override
- public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgressProcessing();
- snServiceProvider.get().requestJoinGroup(session.getUserHash(), session.getCurrentState().getStateToken(),
- new AsyncCallbackSimple<SocialNetworkRequestResult>() {
+ @Inject
+ public JoinGroupAction(final StateManager stateManager, final Session session,
+ final I18nTranslationService i18n, final CoreResources res,
+ final Provider<SocialNetworkServiceAsync> snServiceProvider, final Provider<SignIn> signIn,
+ final AccessRightsClientManager rightsClientManager) {
+ super(stateManager, session, i18n, res, snServiceProvider, rightsClientManager, AccessRolDTO.Viewer,
+ false, true, false);
+ this.signIn = signIn;
+ putValue(NAME, i18n.t("Participate"));
+ putValue(SHORT_DESCRIPTION, i18n.t("Request to participate in this group"));
+ putValue(Action.SMALL_ICON, res.addGreen());
+ putValue(Action.STYLES, "k-sn-join");
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ if (session.isLogged()) {
+ NotifyUser.askConfirmation(i18n.t("Confirm, please:"), i18n.t("Do you want to join this group?"),
+ new SimpleResponseCallback() {
+ @Override
+ public void onCancel() {
+ // Do nothing
+ }
+
+ @Override
+ public void onSuccess() {
+ NotifyUser.showProgressProcessing();
+ snServiceProvider.get().requestJoinGroup(session.getUserHash(),
+ session.getCurrentState().getStateToken(),
+ new AsyncCallbackSimple<SocialNetworkRequestResult>() {
@Override
public void onSuccess(final SocialNetworkRequestResult result) {
- NotifyUser.hideProgress();
- switch ((result)) {
- case accepted:
- NotifyUser.info(i18n.t("You are now member of this group"));
- stateManager.refreshCurrentStateWithoutCache();
- break;
- case denied:
- NotifyUser.important(i18n.t("Sorry this is a closed group"));
- break;
- case moderated:
- NotifyUser.info(i18n.t("Membership requested. Waiting for admins decision"));
- break;
- default:
- NotifyUser.info(i18n.t("Programatic error in ParticipateAction"));
- }
+ NotifyUser.hideProgress();
+ switch ((result)) {
+ case accepted:
+ NotifyUser.info(i18n.t("You are now member of this group"));
+ stateManager.refreshCurrentStateWithoutCache();
+ break;
+ case denied:
+ NotifyUser.important(i18n.t("Sorry this is a closed group"));
+ break;
+ case moderated:
+ NotifyUser.info(i18n.t("Membership requested. Waiting for admins decision"));
+ break;
+ default:
+ NotifyUser.info(i18n.t("Programatic error in ParticipateAction"));
+ }
}
- });
+ });
+ }
+ });
+ } else {
+ signIn.get().setErrorMessage(i18n.t("Sign in or create an account to participate in this group"),
+ NotifyLevel.info);
+ stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGNIN,
+ session.getCurrentStateToken().toString()));
}
+ }
+
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/gspace/client/options/general/GroupOptGeneralPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/general/GroupOptGeneralPanel.java 2011-09-20 14:28:24 UTC (rev 1524)
+++ trunk/src/main/java/cc/kune/gspace/client/options/general/GroupOptGeneralPanel.java 2011-09-20 23:21:27 UTC (rev 1525)
@@ -36,10 +36,10 @@
@Inject
public GroupOptGeneralPanel(final I18nTranslationService i18n, final CoreResources res,
- final MaskWidget maskWidget) {
+ final MaskWidget maskWidget, final GroupFieldFactory groupFieldFactory) {
super(i18n, res, maskWidget);
- shortName = GroupFieldFactory.createUserShortName(SHORT_NAME_FIELD);
- longName = GroupFieldFactory.createUserLongName(LONG_NAME_FIELD);
+ shortName = groupFieldFactory.createUserShortName(SHORT_NAME_FIELD);
+ longName = groupFieldFactory.createUserLongName(LONG_NAME_FIELD);
add(shortName);
add(longName);
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPanel.java 2011-09-20 14:28:24 UTC (rev 1524)
+++ trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPanel.java 2011-09-20 23:21:27 UTC (rev 1525)
@@ -38,10 +38,11 @@
@Inject
public UserOptGeneralPanel(final I18nTranslationService i18n, final CoreResources res,
- final MaskWidget maskWidget, final LanguageSelectorPanel langSelector) {
+ final MaskWidget maskWidget, final LanguageSelectorPanel langSelector,
+ final UserFieldFactory userFieldFactory) {
super(i18n, res, maskWidget);
this.langSelector = langSelector;
- longName = UserFieldFactory.createUserLongName(LONG_NAME_FIELD);
+ longName = userFieldFactory.createUserLongName(LONG_NAME_FIELD);
add(longName);
langSelector.setLangTitle(i18n.t("Your language"));
langSelector.setLabelAlign(LabelAlign.LEFT);
More information about the kune-commits
mailing list