[kune-commits] r933 - in trunk/src:
main/java/org/ourproject/kune/platf/client/services
main/java/org/ourproject/kune/platf/client/ui
main/java/org/ourproject/kune/platf/client/ui/dialogs
main/java/org/ourproject/kune/platf/client/ui/rate
main/java/org/ourproject/kune/platf/client/ui/upload
main/java/org/ourproject/kune/platf/server/content
main/java/org/ourproject/kune/platf/server/i18n
main/java/org/ourproject/kune/platf/server/manager/impl
main/java/org/ourproject/kune/workspace/client/ctxadmin
main/java/org/ourproject/kune/workspace/client/i18n
main/java/org/ourproject/kune/workspace/client/i18n/ui
main/java/org/ourproject/kune/workspace/client/licensechoose
main/java/org/ourproject/kune/workspace/client/newgroup
main/java/org/ourproject/kune/workspace/client/signin
main/java/org/ourproject/kune/workspace/client/site/msg
main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch
main/java/org/ourproject/kune/workspace/client/summary
test/java/org/ourproject/kune/platf/client/ui
test/java/org/ourproject/kune/platf/integration/selenium
vjrj
vjrj at ourproject.org
Mon Oct 27 22:53:24 CET 2008
Author: vjrj
Date: 2008-10-27 22:53:19 +0100 (Mon, 27 Oct 2008)
New Revision: 933
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/ui/TextUtils.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/MessageToolbar.java
trunk/src/test/java/org/ourproject/kune/platf/client/ui/TextUtilsTest.java
trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/NewGroupSeleniumTest.java
Removed:
trunk/src/main/java/org/ourproject/kune/platf/client/ui/SplitterListener.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/SplitterListenerCollection.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInOld.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPanelOld.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenterOld.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInViewOld.java
Modified:
trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationServiceMocked.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneStringUtils.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderDialog.java
trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/i18n/I18nTranslationServiceDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ctxadmin/AccessListsPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nUITranslationService.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/licensechoose/LicenseChoosePanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInAbstractPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SimpleMessagePanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessagePanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/summary/GroupSummaryPanel.java
trunk/src/test/java/org/ourproject/kune/platf/client/ui/KuneStringUtilsTest.java
trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java
trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java
trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SignInSeleniumTest.java
Log:
Incomplete - task New Group dialog refactorization (with more selenium test)
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationServiceMocked.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationServiceMocked.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationServiceMocked.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -19,11 +19,11 @@
*/
package org.ourproject.kune.platf.client.services;
-import org.ourproject.kune.platf.client.ui.KuneStringUtils;
+import org.ourproject.kune.platf.client.ui.TextUtils;
public class I18nTranslationServiceMocked extends I18nTranslationService {
public String t(final String text) {
- String encodeText = KuneStringUtils.escapeHtmlLight(text);
+ String encodeText = TextUtils.escapeHtmlLight(text);
String translation = removeNT(encodeText);
return decodeHtml(translation);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -22,8 +22,13 @@
public class ImageUtils {
+ private final Images img;
+
+ public ImageUtils(Images img) {
+ this.img = img;
+ }
+
public AbstractImagePrototype getImage(final ImageDescriptor imageDescriptor) {
- final Images img = Images.App.getInstance();
switch (imageDescriptor) {
case accept: {
return img.accept();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -28,7 +28,6 @@
public static class App {
private static Images ourInstance = null;
- @Deprecated
public static synchronized Images getInstance() {
if (ourInstance == null) {
ourInstance = (Images) GWT.create(Images.class);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -228,7 +228,7 @@
}, new Factory<ImageUtils>(ImageUtils.class) {
@Override
public ImageUtils create() {
- return new ImageUtils();
+ return new ImageUtils($(Images.class));
}
});
@@ -261,7 +261,7 @@
final I18nTranslatorPresenter presenter = new I18nTranslatorPresenter($(Session.class),
$(I18nServiceAsync.class), i18n);
final I18nTranslatorView view = new I18nTranslatorPanel(presenter, i18n, $(LanguageSelector.class),
- $(WorkspaceSkeleton.class));
+ $(WorkspaceSkeleton.class), $(Images.class));
presenter.init(view);
return presenter;
}
@@ -294,7 +294,7 @@
@Override
public LicenseChoose create() {
final LicenseChoosePresenter presenter = new LicenseChoosePresenter($(Session.class));
- final LicenseChoosePanel view = new LicenseChoosePanel(presenter, i18n);
+ final LicenseChoosePanel view = new LicenseChoosePanel(presenter, i18n, $(Images.class));
presenter.init(view);
return presenter;
}
@@ -305,7 +305,7 @@
public NewGroup create() {
final NewGroupPresenter presenter = new NewGroupPresenter(i18n, $(Session.class),
$(StateManager.class), $$(GroupServiceAsync.class));
- final NewGroupPanel view = new NewGroupPanel(presenter, i18n, $$(LicenseChoose.class));
+ final NewGroupPanel view = new NewGroupPanel(presenter, i18n, $$(LicenseChoose.class), $(Images.class));
presenter.init(view);
return presenter;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -230,7 +230,7 @@
public SiteSearch create() {
final SiteSearchPresenter presenter = new SiteSearchPresenter($$(SiteSearcher.class));
final SiteSearchPanel panel = new SiteSearchPanel(presenter, $(WorkspaceSkeleton.class),
- $(I18nUITranslationService.class));
+ $(I18nUITranslationService.class), $(Images.class));
presenter.init(panel);
return presenter;
}
@@ -310,7 +310,7 @@
final RateItPresenter presenter = new RateItPresenter($(I18nUITranslationService.class),
$(Session.class), $$(ContentServiceAsync.class), $(StateManager.class));
final RateItPanel panel = new RateItPanel(presenter, $(I18nUITranslationService.class),
- $(WorkspaceSkeleton.class));
+ $(WorkspaceSkeleton.class), $(Images.class));
presenter.init(panel);
return presenter;
}
@@ -346,8 +346,8 @@
public GroupSummary create() {
final GroupSummaryPresenter presenter = new GroupSummaryPresenter($(StateManager.class),
$(WsThemePresenter.class));
- final GroupSummaryView view = new GroupSummaryPanel(presenter, $(I18nUITranslationService.class),
- $(WorkspaceSkeleton.class));
+ final GroupSummaryView view = new GroupSummaryPanel($(Images.class), presenter,
+ $(I18nUITranslationService.class), $(WorkspaceSkeleton.class));
presenter.init(view);
return presenter;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -47,7 +47,8 @@
private final RoundedPanel outerBorder;
private String stylePrimaryName;
- public DropDownPanel() {
+ public DropDownPanel(Images img) {
+ this.img = img;
vp = new VerticalPanel();
outerBorder = new RoundedPanel(vp, RoundedPanel.ALL);
titleHP = new HorizontalPanel();
@@ -68,7 +69,6 @@
vp.setCellWidth(contentPanel, "100%");
vp.setCellWidth(titleHP, "100%");
titleHP.setStylePrimaryName("k-dropdownlabel");
- img = Images.App.getInstance();
img.arrowDownWhite().applyTo(arrowImage);
titleLabel.setText("");
contentPanel.setStylePrimaryName("k-dropdowninner");
@@ -78,13 +78,13 @@
titleLabel.addClickListener(this);
}
- public DropDownPanel(final boolean visible) {
- this();
+ public DropDownPanel(Images img, final boolean visible) {
+ this(img);
setContentVisible(visible);
}
- public DropDownPanel(final String headerText, final boolean visible) {
- this();
+ public DropDownPanel(Images img, final String headerText, final boolean visible) {
+ this(img);
setContentVisible(visible);
setHeaderText(headerText);
}
@@ -136,6 +136,7 @@
KuneUiUtils.setQuickTip(titleLabel, title);
}
+ @Override
public void setHeight(final String height) {
super.setHeight(height);
outerBorder.setHeight(height);
@@ -157,6 +158,7 @@
contentPanel.addStyleDependentName(newThemeS);
}
+ @Override
public void setWidth(final String width) {
super.setWidth(width);
outerBorder.setWidth(width);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneStringUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneStringUtils.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneStringUtils.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -1,80 +1,10 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
package org.ourproject.kune.platf.client.ui;
-import java.util.ArrayList;
+/**
+ * Use TextUtils
+ *
+ */
+ at Deprecated
+public class KuneStringUtils extends TextUtils {
-public class KuneStringUtils {
- /*
- * This method escape only some dangerous html chars
- */
- public static String escapeHtmlLight(final String textOrig) {
- String text = textOrig;
- text = text.replaceAll("&", "&");
- text = text.replaceAll("\"", """);
- // text = text.replaceAll("\'", "'");
- text = text.replaceAll("<", "<");
- text = text.replaceAll(">", ">");
- return text;
- }
-
- public static String generateHtmlLink(final String href, final String text) {
- return "<a href=\"" + href + "\" target=\"_blank\">" + text + "</a>";
- }
-
- public static ArrayList<String> splitTags(final String tagsString) {
- final ArrayList<String> tagsList = new ArrayList<String>();
- String tagsCopy = tagsString;
- // remove commas and quotes
- if (tagsString == null) {
- return tagsList;
- }
- tagsCopy = tagsCopy.replaceAll(",", " ");
- tagsCopy = tagsCopy.replaceAll("\"", "");
- tagsCopy = tagsCopy.replaceAll("\'", "");
- final String[] splitted = tagsCopy.split("\\s+");
- for (int i = 0; i < splitted.length; i++) {
- String tag = splitted[i];
- tag = tag.replaceAll("\\s$", "");
- if (tag.length() > 0) {
- tagsList.add(tag);
- }
- }
- return tagsList;
- }
-
- /*
- * This method unescape only some dangerous html chars for use in GWT Html
- * widget for instance
- */
- public static String unescapeHtmlLight(final String textOrig) {
- String text = textOrig;
- text = text.replaceAll("&", "&");
- text = text.replaceAll(""", "\"");
- text = text.replaceAll("'", "\'");
- text = text.replaceAll("<", "<");
- text = text.replaceAll(">", ">");
- return text;
- }
-
- public KuneStringUtils() {
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -28,20 +28,51 @@
public class KuneUiUtils {
+ public enum IconPosition {
+ left, right
+ }
+
+ public static String genQuickTipLabel(final String labelText, final String tipTitle, final String tipText) {
+ String tipHtml = "<span style=\"vertical-align: middle;\" ext:qtip=\"" + tipText + "\"";
+ if (tipTitle != null && tipTitle.length() > 0) {
+ tipHtml += " ext:qtitle=\"" + tipTitle + "\"";
+ }
+ tipHtml += ">";
+ tipHtml += labelText;
+ tipHtml += "</span>";
+ return tipHtml;
+ }
+
public static String genQuickTipLabel(final String labelText, final String tipTitle, final String tipText,
- final AbstractImagePrototype icon) {
- // FIXME: get this from emite
+ final AbstractImagePrototype icon, IconPosition iconPosition) {
String tipHtml = "<span style=\"vertical-align: middle;\" ext:qtip=\"" + tipText + "\"";
if (tipTitle != null && tipTitle.length() > 0) {
tipHtml += " ext:qtitle=\"" + tipTitle + "\"";
}
tipHtml += ">";
- tipHtml += labelText;
- tipHtml += " ";
- Image iconImg = new Image();
+ final Image iconImg = new Image();
icon.applyTo(iconImg);
- setQuickTip(iconImg, tipText, tipTitle);
- tipHtml += iconImg.toString();
+ iconImg.setStyleName("vamiddle");
+ // setQuickTip(iconImg, tipText, tipTitle);
+
+ ToolTip tooltip = new ToolTip();
+ tooltip.setHtml(tipText);
+ tooltip.setWidth(250);
+ tooltip.applyTo(iconImg.getElement());
+
+ switch (iconPosition) {
+ case left:
+ tipHtml += iconImg.toString();
+ tipHtml += " ";
+ tipHtml += labelText;
+ break;
+ case right:
+ tipHtml += labelText;
+ tipHtml += " ";
+ tipHtml += iconImg.toString();
+ break;
+ }
+
tipHtml += "</span>";
return tipHtml;
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/SplitterListener.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/SplitterListener.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/SplitterListener.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -1,30 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.client.ui;
-
-import com.google.gwt.user.client.ui.Widget;
-
-public interface SplitterListener {
-
- void onStartResizing(Widget sender);
-
- void onStopResizing(Widget sender);
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/SplitterListenerCollection.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/SplitterListenerCollection.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/SplitterListenerCollection.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -1,57 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.client.ui;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import com.google.gwt.user.client.ui.Widget;
-
-public class SplitterListenerCollection extends ArrayList<SplitterListener> {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Fires a event to all listeners.
- *
- * @param sender
- * the widget sending the event.
- */
- public void fireStartResizing(final Widget sender) {
- for (Iterator<SplitterListener> it = iterator(); it.hasNext();) {
- SplitterListener listener = it.next();
- listener.onStartResizing(sender);
- }
- }
-
- /**
- * Fires a event to all listeners.
- *
- * @param sender
- * the widget sending the event.
- */
- public void fireStopResizing(final Widget sender) {
- for (Iterator<SplitterListener> it = iterator(); it.hasNext();) {
- SplitterListener listener = it.next();
- listener.onStopResizing(sender);
- }
- }
-
-}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/ui/TextUtils.java (from rev 925, trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneStringUtils.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneStringUtils.java 2008-10-24 17:46:08 UTC (rev 925)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/TextUtils.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -0,0 +1,91 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.platf.client.ui;
+
+import java.util.ArrayList;
+
+public class TextUtils {
+ // Original regexp from http://snippets.dzone.com/posts/show/452
+ public static final String URL_REGEXP = "((ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?)";
+
+ // Original regexp from http://www.regular-expressions.info/email.html
+ public static final String EMAIL_REGEXP = "[-!#$%&\'*+/=?_`{|}~a-z0-9^]+(\\.[-!#$%&\'*+/=?_`{|}~a-z0-9^]+)*@(localhost|([a-z0-9]([-a-z0-9]*[a-z0-9])?\\.)+[a-z0-9]([-a-z0-9]*[a-z0-9]))?";
+
+ /*
+ * This method escape only some dangerous html chars
+ */
+ public static String escapeHtmlLight(final String source) {
+ if (source == null) {
+ return null;
+ }
+ String result = source;
+ result = result.replaceAll("&", "&");
+ result = result.replaceAll("\"", """);
+ // text = text.replaceAll("\'", "'");
+ result = result.replaceAll("<", "<");
+ result = result.replaceAll(">", ">");
+ return result;
+ }
+
+ public static String generateHtmlLink(final String href, final String text) {
+ return "<a href=\"" + href + "\" target=\"_blank\">" + text + "</a>";
+ }
+
+ public static ArrayList<String> splitTags(final String tagsString) {
+ final ArrayList<String> tagsList = new ArrayList<String>();
+ String tagsCopy = tagsString;
+ // remove commas and quotes
+ if (tagsString == null) {
+ return tagsList;
+ }
+ tagsCopy = tagsCopy.replaceAll(",", " ");
+ tagsCopy = tagsCopy.replaceAll("\"", "");
+ tagsCopy = tagsCopy.replaceAll("\'", "");
+ final String[] splitted = tagsCopy.split("\\s+");
+ for (String tag : splitted) {
+ tag = tag.replaceAll("\\s$", "");
+ if (tag.length() > 0) {
+ tagsList.add(tag);
+ }
+ }
+ return tagsList;
+ }
+
+ /*
+ * This method unescape only some dangerous html chars for use in GWT Html
+ * widget for instance
+ */
+ public static String unescape(final String source) {
+ if (source == null) {
+ return null;
+ }
+ String result = source;
+ result = result.replaceAll("&", "&");
+ result = result.replaceAll(""", "\"");
+ result = result.replaceAll("'", "\'");
+ result = result.replaceAll("<", "<");
+ result = result.replaceAll(">", ">");
+ return result;
+ }
+
+ public TextUtils() {
+ }
+
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/client/ui/TextUtils.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/MessageToolbar.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/MessageToolbar.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/MessageToolbar.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -0,0 +1,46 @@
+package org.ourproject.kune.platf.client.ui.dialogs;
+
+import org.ourproject.kune.platf.client.services.Images;
+import org.ourproject.kune.workspace.client.newgroup.SiteErrorType;
+
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Label;
+import com.gwtext.client.widgets.Toolbar;
+
+public class MessageToolbar {
+ private final Toolbar toolbar;
+ private final Image errorIcon;
+ private final Label errorLabel;
+
+ public MessageToolbar(Images images, String errorLabelId) {
+ toolbar = new Toolbar();
+ errorLabel = new Label("");
+ errorLabel.ensureDebugId(errorLabelId);
+ errorIcon = new Image();
+ images.error().applyTo(errorIcon);
+ toolbar.addSpacer();
+ toolbar.addElement(errorIcon.getElement());
+ toolbar.setCls("k-error-tb");
+ toolbar.addSpacer();
+ toolbar.addSpacer();
+ toolbar.addElement(errorLabel.getElement());
+ errorIcon.setVisible(false);
+ toolbar.setVisible(false);
+ }
+
+ public Toolbar getToolbar() {
+ return toolbar;
+ }
+
+ public void hideErrorMessage() {
+ errorIcon.setVisible(false);
+ errorLabel.setText("");
+ toolbar.setVisible(false);
+ }
+
+ public void setErrorMessage(final String message, final SiteErrorType type) {
+ errorLabel.setText(message);
+ errorIcon.setVisible(true);
+ toolbar.setVisible(true);
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -26,20 +26,22 @@
import com.google.gwt.user.client.ui.Widget;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.Toolbar;
import com.gwtext.client.widgets.event.WindowListenerAdapter;
public class WizardDialog {
- private final BasicDialog dialog;
private final Button backButton;
- private final Button nextButton;
private final Button cancelButton;
+ private final BasicDialog dialog;
private final Button finishButton;
private final I18nTranslationService i18n;
+ private final Button nextButton;
public WizardDialog(final String caption, final boolean modal, final boolean minimizable, final int width,
final int height, final int minWidth, final int minHeight, final WizardListener listener,
- final I18nTranslationService i18n) {
+ final I18nTranslationService i18n, String dialogId, final String backId, final String nextId,
+ final String finishId, final String cancelId, final String closeId) {
dialog = new BasicDialog(caption, modal, false, width, height, minWidth, minHeight);
this.i18n = i18n;
dialog.setCollapsible(minimizable);
@@ -47,12 +49,14 @@
dialog.setPlain(true);
dialog.setCollapsible(false);
dialog.setResizable(false);
+ dialog.setId(dialogId);
backButton = new CustomButton(i18n.tWithNT("« Back", "used in button"), new ClickListener() {
public void onClick(final Widget sender) {
listener.onBack();
}
}).getButton();
+ backButton.setId(backId);
dialog.addButton(backButton);
nextButton = new CustomButton(i18n.tWithNT("Next »", "used in button"), new ClickListener() {
@@ -60,6 +64,7 @@
listener.onNext();
}
}).getButton();
+ nextButton.setId(nextId);
dialog.addButton(nextButton);
cancelButton = new CustomButton(i18n.tWithNT("Cancel", "used in button"), new ClickListener() {
@@ -67,6 +72,7 @@
listener.onCancel();
}
}).getButton();
+ cancelButton.setId(cancelId);
dialog.addButton(cancelButton);
finishButton = new CustomButton(i18n.tWithNT("Finish", "used in button"), new ClickListener() {
@@ -74,9 +80,11 @@
listener.onFinish();
}
}).getButton();
+ finishButton.setId(finishId);
dialog.addButton(finishButton);
dialog.addListener(new WindowListenerAdapter() {
+ @Override
public void onClose(final Panel panel) {
listener.onClose();
}
@@ -84,8 +92,10 @@
}
public WizardDialog(final String caption, final boolean modal, final boolean minimizable, final int width,
- final int height, final WizardListener listener, final I18nTranslationService i18n) {
- this(caption, modal, minimizable, width, height, width, height, listener, i18n);
+ final int height, final WizardListener listener, final I18nTranslationService i18n, String dialogId,
+ final String backId, final String nextId, final String finishId, final String cancelId, final String closeId) {
+ this(caption, modal, minimizable, width, height, width, height, listener, i18n, dialogId, backId, nextId,
+ finishId, cancelId, closeId);
}
public void add(final Widget widget) {
@@ -108,6 +118,10 @@
mask(i18n.t("Processing"));
}
+ public void setBottomToolbar(Toolbar toolbar) {
+ dialog.setBottomToolbar(toolbar);
+ }
+
public void setEnabledBackButton(final boolean enabled) {
if (enabled) {
backButton.enable();
@@ -167,5 +181,4 @@
public void unMask() {
dialog.getEl().unmask();
}
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -35,14 +35,16 @@
private Grid rateGrid;
private Image[] starImg;
private Label rateDesc;
- private final Images img = Images.App.getInstance();
+ private final Images img;
private final RateItPresenter presenter;
private Label rateItLabel;
private final I18nTranslationService i18n;
- public RateItPanel(final RateItPresenter presenter, final I18nTranslationService i18n, final WorkspaceSkeleton ws) {
+ public RateItPanel(final RateItPresenter presenter, final I18nTranslationService i18n, final WorkspaceSkeleton ws,
+ Images img) {
this.presenter = presenter;
this.i18n = i18n;
+ this.img = img;
initialize();
layout();
setProperties();
@@ -90,6 +92,7 @@
starImg[i].setTitle(i18n.t("Click to rate this"));
starImg[i].addClickListener(this);
starImg[i].addMouseListener(new MouseListenerAdapter() {
+ @Override
public void onMouseEnter(final Widget sender) {
for (int j = 0; j < 5; j++) {
if (sender == starImg[j]) {
@@ -99,6 +102,7 @@
}
+ @Override
public void onMouseLeave(final Widget sender) {
presenter.revertCurrentRate();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderDialog.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderDialog.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderDialog.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -18,7 +18,7 @@
*
*/package org.ourproject.kune.platf.client.ui.upload;
-import org.ourproject.kune.platf.client.ui.KuneStringUtils;
+import org.ourproject.kune.platf.client.ui.TextUtils;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.site.Site;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
@@ -84,7 +84,7 @@
}
public void setPermittedExtensions(final String extensions) {
- final Object[] objs = KuneStringUtils.splitTags(extensions).toArray();
+ final Object[] objs = TextUtils.splitTags(extensions).toArray();
final String[] exts = new String[objs.length];
for (int i = 0; i < objs.length; i++) {
exts[i] = (String) objs[i];
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -34,7 +34,7 @@
import org.ourproject.kune.platf.client.errors.DefaultException;
import org.ourproject.kune.platf.client.errors.I18nNotFoundException;
import org.ourproject.kune.platf.client.errors.UserNotFoundException;
-import org.ourproject.kune.platf.client.ui.KuneStringUtils;
+import org.ourproject.kune.platf.client.ui.TextUtils;
import org.ourproject.kune.platf.server.access.FinderService;
import org.ourproject.kune.platf.server.domain.Container;
import org.ourproject.kune.platf.server.domain.Content;
@@ -205,7 +205,7 @@
public void setTags(final User user, final Long contentId, final String tags) throws DefaultException {
final Content content = finder.getContent(contentId);
- final ArrayList<String> tagsStripped = KuneStringUtils.splitTags(tags);
+ final ArrayList<String> tagsStripped = TextUtils.splitTags(tags);
final ArrayList<Tag> tagList = new ArrayList<Tag>();
for (String tagString : tagsStripped) {
Tag tag;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/i18n/I18nTranslationServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/i18n/I18nTranslationServiceDefault.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/i18n/I18nTranslationServiceDefault.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -20,7 +20,7 @@
package org.ourproject.kune.platf.server.i18n;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.platf.client.ui.KuneStringUtils;
+import org.ourproject.kune.platf.client.ui.TextUtils;
import org.ourproject.kune.platf.server.UserSession;
import org.ourproject.kune.platf.server.domain.I18nTranslation;
import org.ourproject.kune.platf.server.manager.I18nTranslationManager;
@@ -62,7 +62,7 @@
// } else {
language = I18nTranslation.DEFAULT_LANG;
// }
- String encodeText = KuneStringUtils.escapeHtmlLight(text);
+ String encodeText = TextUtils.escapeHtmlLight(text);
String translation = translationManager.getTranslation(language, text);
if (translation == UNTRANSLATED_VALUE) {
// Not translated but in db, return text
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -27,7 +27,7 @@
import javax.persistence.EntityManager;
import org.ourproject.kune.platf.client.errors.DefaultException;
-import org.ourproject.kune.platf.client.ui.KuneStringUtils;
+import org.ourproject.kune.platf.client.ui.TextUtils;
import org.ourproject.kune.platf.server.domain.I18nLanguage;
import org.ourproject.kune.platf.server.domain.I18nTranslation;
import org.ourproject.kune.platf.server.manager.I18nLanguageManager;
@@ -77,7 +77,7 @@
public String getTranslation(final String language, final String text) {
final HashMap<String, String> lexicon = getLexicon(language);
- final String escapedText = KuneStringUtils.escapeHtmlLight(text);
+ final String escapedText = TextUtils.escapeHtmlLight(text);
if (lexicon.containsKey(escapedText)) {
final String translation = lexicon.get(escapedText);
return translation;
@@ -123,7 +123,7 @@
public String setTranslation(final String id, final String translation) throws DefaultException {
final I18nTranslation trans = super.find(new Long(id));
if (trans != null) {
- final String escapedTranslation = KuneStringUtils.escapeHtmlLight(translation);
+ final String escapedTranslation = TextUtils.escapeHtmlLight(translation);
trans.setText(escapedTranslation);
persist(trans);
return escapedTranslation;
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxadmin/AccessListsPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxadmin/AccessListsPanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxadmin/AccessListsPanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -34,14 +34,15 @@
public class AccessListsPanel extends VerticalPanel implements View {
- private static final Images img = Images.App.getInstance();
private final VerticalPanel adminsVP;
private final VerticalPanel editorsVP;
private final VerticalPanel viewersVP;
private final I18nTranslationService i18n;
+ private final Images img;
- public AccessListsPanel(final I18nTranslationService i18n) {
+ public AccessListsPanel(final I18nTranslationService i18n, Images img) {
this.i18n = i18n;
+ this.img = img;
final Label adminsLabel = new Label(i18n.t("Who can admin this:"));
adminsVP = new VerticalPanel();
final Label editorsLabel = new Label(i18n.t("Who more can edit:"));
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nUITranslationService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nUITranslationService.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nUITranslationService.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -25,7 +25,7 @@
import org.ourproject.kune.platf.client.rpc.I18nServiceAsync;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.ui.KuneStringUtils;
+import org.ourproject.kune.platf.client.ui.TextUtils;
import org.ourproject.kune.platf.client.ui.Location;
import org.ourproject.kune.platf.client.ui.WindowUtils;
@@ -133,7 +133,7 @@
*/
@Override
public String t(final String text) {
- final String encodeText = KuneStringUtils.escapeHtmlLight(text);
+ final String encodeText = TextUtils.escapeHtmlLight(text);
String translation = lexicon.get(encodeText);
if (lexicon.containsKey(encodeText)) {
if (translation == UNTRANSLATED_VALUE) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -23,7 +23,7 @@
import org.ourproject.kune.platf.client.services.I18nTranslationService;
import org.ourproject.kune.platf.client.services.Images;
import org.ourproject.kune.platf.client.ui.AbstractSearcherPanel;
-import org.ourproject.kune.platf.client.ui.KuneStringUtils;
+import org.ourproject.kune.platf.client.ui.TextUtils;
import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog;
import org.ourproject.kune.workspace.client.i18n.I18nTranslatorPresenter;
import org.ourproject.kune.workspace.client.i18n.I18nTranslatorView;
@@ -63,8 +63,6 @@
public class I18nTranslatorPanel extends AbstractSearcherPanel implements I18nTranslatorView {
- private static final String NOTE_FOR_TRANSLATORS_IMAGE_HTML = Images.App.getInstance().nt().getHTML();
-
private Window dialog;
private final I18nTranslatorPresenter presenter;
private LanguageSelectorPanel languageSelectorPanel;
@@ -75,13 +73,15 @@
private final LanguageSelector languageSelector;
private final WorkspaceSkeleton ws;
private SiteBottomTrayButton traybarButton;
+ private final Images img;
public I18nTranslatorPanel(final I18nTranslatorPresenter initPresenter, final I18nTranslationService i18n,
- final LanguageSelector languageSelector, final WorkspaceSkeleton ws) {
+ final LanguageSelector languageSelector, final WorkspaceSkeleton ws, Images img) {
super(i18n);
this.presenter = initPresenter;
this.languageSelector = languageSelector;
this.ws = ws;
+ this.img = img;
}
public void close() {
@@ -136,6 +136,7 @@
final Button close = new Button();
close.setText(i18n.tWithNT("Close", "used in button"));
close.addListener(new ButtonListenerAdapter() {
+ @Override
public void onClick(final Button button, final EventObject e) {
presenter.doClose();
}
@@ -159,6 +160,7 @@
final HorizontalPanel hp = new HorizontalPanel();
languageSelectorPanel = (LanguageSelectorPanel) languageSelector.getView();
languageSelectorPanel.addChangeListener(new ComboBoxListenerAdapter() {
+ @Override
public void onSelect(final ComboBox comboBox, final Record record, final int index) {
setLanguage(record.getAsString(LanguageSelectorPanel.LANG_ID));
dialog.setTitle(i18n.t("Help to translate kune to [%s]", record.getAsString("language")));
@@ -193,7 +195,7 @@
String renderer;
String[] splitted = splitNT((String) value);
if (splitted.length > 1) {
- renderer = "{0} " + NOTE_FOR_TRANSLATORS_IMAGE_HTML;
+ renderer = "{0} " + img.nt().getHTML();
String tip = "<div style='min-width: 75px'>" + splitted[1] + "</div>";
cellMetadata.setHtmlAttribute("ext:qtip=\"" + tip + "\" ext:qtitle=\"Note for translators\"");
} else {
@@ -273,16 +275,18 @@
// grid.setSelectionModel(new RowSelectionModel());
grid.addEditorGridListener(new EditorGridListenerAdapter() {
+ @Override
public void onAfterEdit(final GridPanel grid, final Record record, final String field,
final Object newValue, final Object oldValue, final int rowIndex, final int colIndex) {
final String idValue = record.getAsString(id);
final String trKey = record.getAsString("trKey");
presenter.doTranslation(idValue, trKey, (String) newValue);
- record.set(field, KuneStringUtils.escapeHtmlLight((String) newValue));
+ record.set(field, TextUtils.escapeHtmlLight((String) newValue));
}
});
grid.addGridCellListener(new GridCellListenerAdapter() {
+ @Override
public void onCellDblClick(final GridPanel grid, final int rowIndex, final int colIndex, final EventObject e) {
final Record record = unTransStore.getRecordAt(rowIndex);
final String idValue = record.getAsString(id);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensechoose/LicenseChoosePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensechoose/LicenseChoosePanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensechoose/LicenseChoosePanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -57,9 +57,8 @@
private final RadioButton nonCommercialRB;
private final I18nTranslationService i18n;
- public LicenseChoosePanel(final LicenseChoosePresenter presenter, final I18nTranslationService i18n) {
+ public LicenseChoosePanel(final LicenseChoosePresenter presenter, final I18nTranslationService i18n, Images img) {
this.i18n = i18n;
- final Images img = Images.App.getInstance();
final VerticalPanel generalVP = new VerticalPanel();
initWidget(generalVP);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -21,17 +21,16 @@
import org.ourproject.kune.platf.client.dto.LicenseDTO;
import org.ourproject.kune.platf.client.services.Images;
-import org.ourproject.kune.platf.client.ui.KuneStringUtils;
import org.ourproject.kune.platf.client.ui.KuneUiUtils;
+import org.ourproject.kune.platf.client.ui.TextUtils;
+import org.ourproject.kune.platf.client.ui.dialogs.MessageToolbar;
import org.ourproject.kune.platf.client.ui.dialogs.WizardDialog;
import org.ourproject.kune.platf.client.ui.dialogs.WizardListener;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.licensechoose.LicenseChoose;
import org.ourproject.kune.workspace.client.licensechoose.LicenseChoosePanel;
-import org.ourproject.kune.workspace.client.site.msg.SiteMessagePanel;
import com.calclab.suco.client.ioc.Provider;
-import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.DeckPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
@@ -50,13 +49,23 @@
import com.gwtext.client.widgets.layout.FitLayout;
public class NewGroupPanel extends WizardDialog implements NewGroupView {
- private static final AbstractImagePrototype INFO_IMAGE = Images.App.getInstance().info();
- private static final String MUST_BE_BETWEEN_3_AND_15 = "Must be between 3 and 15 lowercase characters. Can only contain characters, numbers, and dashes";
- private static final String SHORTNAME_FIELD = "short_name";
- private static final String LONGNAME_FIELD = "long_name";
- private static final String PUBLICDESC_FIELD = "public_desc";
- private static final String TYPEOFGROUP_FIELD = "type_of_group";
- private static final String TAGS_FIELD = "tags";
+ public static final String REGISTER_A_NEW_GROUP_TITLE = "Register a new Group";
+ public static final String MUST_BE_BETWEEN_3_AND_15 = "Must be between 3 and 15 lowercase characters. Can only contain characters, numbers, and dashes";
+ public static final String SHORTNAME_FIELD = "k-ngp-short_name";
+ public static final String LONGNAME_FIELD = "k-ngp-long_name";
+ public static final String PUBLICDESC_FIELD = "k-ngp-public_desc";
+ public static final String TYPEOFGROUP_FIELD = "k-ngp-type_of_group";
+ public static final String PROJ_GROUP_TYPE_ID = "k-ngp-type_of_group_proj";
+ public static final String ORG_GROUP_TYPE_ID = "k-ngp-type_of_group_org";
+ public static final String COMM_GROUP_TYPE_ID = "k-ngp-type_of_group_comm";
+ public static final String TAGS_FIELD = "tags";
+ public static final String NEWGROUP_WIZARD = "k-ngp-wiz";
+ public static final String CANCEL_BUTTON = "k-ngp-cancel-bt";
+ public static final String CLOSE_BUTTON = "k-ngp-close-bt";
+ public static final String FINISH_BUTTON = "k-ngp-finish-bt";
+ public static final String NEXT_BUTTON = "k-ngp-next-bt";
+ public static final String BACK_BUTTON = "k-ngp-back-bt";
+ public static final String ERROR_MSG_BAR = "k-ngp-error-mb";
private final FormPanel newGroupInitialDataForm;
private Radio projectRadio;
@@ -68,13 +77,13 @@
private TextArea publicDescField;
private final DeckPanel deck;
private final LicenseChoose licenseChoosePanel;
- private final SiteMessagePanel messagesPanel;
private final I18nUITranslationService i18n;
private TextField tags;
+ private final MessageToolbar messageErrorBar;
public NewGroupPanel(final NewGroupPresenter presenter, final I18nUITranslationService i18n,
- final Provider<LicenseChoose> licenseChooseProvider) {
- super(i18n.t("Register a new Group"), true, false, 460, 480, new WizardListener() {
+ final Provider<LicenseChoose> licenseChooseProvider, Images img) {
+ super(i18n.t(REGISTER_A_NEW_GROUP_TITLE), true, false, 460, 480, new WizardListener() {
public void onBack() {
presenter.onBack();
}
@@ -94,10 +103,11 @@
public void onNext() {
presenter.onNext();
}
- }, i18n);
+ }, i18n, NEWGROUP_WIZARD, BACK_BUTTON, NEXT_BUTTON, FINISH_BUTTON, CANCEL_BUTTON, CLOSE_BUTTON);
this.i18n = i18n;
Field.setMsgTarget("side");
final Panel centerPanel = new Panel();
+ centerPanel.setPaddings(10);
centerPanel.setLayout(new FitLayout());
deck = new DeckPanel();
newGroupInitialDataForm = createNewGroupInitialDataForm(presenter);
@@ -106,7 +116,6 @@
final HorizontalPanel newGroupInitialDataHP = new HorizontalPanel();
final VerticalPanel chooseLicenseVP = new VerticalPanel();
final HorizontalPanel chooseLicenseHP = new HorizontalPanel();
- final Images img = Images.App.getInstance();
newGroupInitialDataHP.add(img.step1().createImage());
final Label step1Label = new Label(
i18n.t("Please fill this form and follow the next steps to register a new group:"));
@@ -115,7 +124,7 @@
newGroupInitialDataVP.add(newGroupInitialDataForm);
chooseLicenseHP.add(img.step2().createImage());
final HTML step2Label = new HTML(i18n.t("Select a license to share your group contents with other people. "
- + "We recomend [%s] licenses for practical works.", KuneStringUtils.generateHtmlLink(
+ + "We recomend [%s] licenses for practical works.", TextUtils.generateHtmlLink(
"http://en.wikipedia.org/wiki/Copyleft", "copyleft")));
chooseLicenseHP.add(step2Label);
final Label licenseTypeLabel = new Label(i18n.t("Choose a license type:"));
@@ -128,10 +137,8 @@
step1Label.addStyleName("kune-Margin-Medium-b");
step2Label.addStyleName("kune-Margin-Medium-b");
- messagesPanel = new SiteMessagePanel(null, false, i18n);
- messagesPanel.setWidth("425");
- messagesPanel.setMessage("", SiteErrorType.info, SiteErrorType.error);
- newGroupInitialDataVP.add(messagesPanel);
+ messageErrorBar = new MessageToolbar(img, ERROR_MSG_BAR);
+ super.setBottomToolbar(messageErrorBar.getToolbar());
chooseLicenseVP.add((Widget) licenseChoosePanel.getView());
deck.add(newGroupInitialDataVP);
@@ -178,7 +185,7 @@
}
public void hideMessage() {
- messagesPanel.hide();
+ messageErrorBar.hideErrorMessage();
}
public boolean isCommunity() {
@@ -198,8 +205,7 @@
}
public void setMessage(final String message, final SiteErrorType type) {
- messagesPanel.setMessage(message, type, type);
- messagesPanel.show();
+ messageErrorBar.setErrorMessage(message, type);
}
public void showLicenseForm() {
@@ -266,6 +272,7 @@
final FieldSet groupTypeFieldSet = new FieldSet(i18n.t("Type of group"));
groupTypeFieldSet.setStyle("margin-left: 105px");
+ groupTypeFieldSet.setWidth(300);
form.add(groupTypeFieldSet);
@@ -274,55 +281,37 @@
"A project is a kind of group in which new members inclusion "
+ "is moderated by the project administrators. "
+ "An administrator is the person who creates the project "
- + "and other people she/he choose in the future as administrator too.");
+ + "and other people she/he choose in the future as administrator too.", PROJ_GROUP_TYPE_ID);
projectRadio.setChecked(true);
orgRadio = new Radio();
createRadio(groupTypeFieldSet, orgRadio, "Organization", "An organization is like a project, "
- + "but organizations must be a legal entity.");
+ + "but organizations must be a legal entity.", ORG_GROUP_TYPE_ID);
communityRadio = new Radio();
createRadio(groupTypeFieldSet, communityRadio, "Community", "Communities are social group of persons "
+ "with shared interests and they are open to new members "
+ "(for instance the environmental community or the LGBT community). "
- + "Normally they aren't a legal entity.");
+ + "Normally they aren't a legal entity.", COMM_GROUP_TYPE_ID);
groupTypeFieldSet.setCollapsible(false);
return form;
}
- private void createRadio(final FieldSet fieldSet, final Radio radio, final String radioLabel, final String radioTip) {
+ private void createRadio(final FieldSet fieldSet, final Radio radio, final String radioLabel,
+ final String radioTip, final String id) {
radio.setName(TYPEOFGROUP_FIELD);
- radio.setBoxLabel(KuneUiUtils.genQuickTipLabel(i18n.t(radioLabel), null, i18n.t(radioTip), INFO_IMAGE));
+ radio.setBoxLabel(KuneUiUtils.genQuickTipLabel(i18n.t(radioLabel), null, i18n.t(radioTip)));
radio.setAutoCreate(true);
radio.setHideLabel(true);
+ radio.setId(id);
fieldSet.add(radio);
- // ToolTip fieldToolTip = new ToolTip("Tooltip on a Field.");
- // fieldToolTip.applyTo(captchaField);
- // Image info = new Image("images/silk/information.gif");
- //
- // ToolTip tooltip = new ToolTip();
- // tooltip.setHtml("A <b>CAPTCHA</b> is a challenge-response test to
- // determine whether " +
- // "the user is human.");
- // tooltip.setWidth(150);
- // tooltip.applyTo(info.getElement());
- // Tested:
- // Set tooltip
- // Image info = new Image();
- // ChatIcons.App.getInstance().info().applyTo(info);
- // ToolTip tooltip = new ToolTip();
- // tooltip.setHtml(i18n.t("Note that the 'Jabber Id' sometimes is the
- // same as the email "
- // + "(in gmail accounts for instance)."));
- // tooltip.setWidth(250);
- // tooltip.applyTo(info.getElement());
- // jidPanel.addToRow(info, new ColumnLayoutData(1));
- //
- // formPanel.add(jidPanel);
-
+ ToolTip tooltip = new ToolTip();
+ tooltip.setHtml(radioTip);
+ tooltip.setWidth(250);
+ tooltip.applyTo(radio);
}
private void initBottomButtons() {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -39,6 +39,7 @@
import com.google.gwt.user.client.rpc.AsyncCallback;
public class NewGroupPresenter implements NewGroup {
+ public static final String REGISTER_TO_CREATE_A_GROUP = "Sign in or register to create a group";
private NewGroupView view;
private final I18nTranslationService i18n;
private StateToken previousToken;
@@ -70,7 +71,7 @@
Site.hideProgress();
} else {
stateManager.gotoToken(previousToken);
- Site.info(i18n.t("Sign in or register to create a group"));
+ Site.info(i18n.t(REGISTER_TO_CREATE_A_GROUP));
}
}
});
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -13,6 +13,7 @@
public class RegisterPanel extends SignInAbstractPanel implements RegisterView {
+ public static final String REGISTER_TITLE = "Register";
public static final String ERRMSG = "k-regp-errmsg";
static RegisterForm registerForm;
@@ -22,22 +23,23 @@
public static final String REGISTER_FORM = "k-regp-p";
public static final String WELCOME_OK_BUTTON = "k-regp-okbt";
+ public static final String WELCOME_DIALOG = "k-regp-wdiag";
public RegisterPanel(final RegisterPresenter presenter, I18nUITranslationService i18n, final WorkspaceSkeleton ws,
Session session, Images images) {
- super(i18n, i18n.t("Register"), true, true, 390, 450, "", i18n.t("Register"), REGISTER_BUTTON_ID, i18n.tWithNT(
- "Cancel", "used in button"), CANCEL_BUTTON_ID, new Listener0() {
- public void onEvent() {
- registerForm.validate();
- if (registerForm.isValid()) {
- presenter.onFormRegister();
- }
- }
- }, new Listener0() {
- public void onEvent() {
- presenter.onCancel();
- }
- }, images, ERRMSG);
+ super(i18n, i18n.t(REGISTER_TITLE), true, true, 390, 450, "", i18n.t(REGISTER_TITLE), REGISTER_BUTTON_ID,
+ i18n.tWithNT("Cancel", "used in button"), CANCEL_BUTTON_ID, new Listener0() {
+ public void onEvent() {
+ registerForm.validate();
+ if (registerForm.isValid()) {
+ presenter.onFormRegister();
+ }
+ }
+ }, new Listener0() {
+ public void onEvent() {
+ presenter.onCancel();
+ }
+ }, images, ERRMSG);
Panel panel = new Panel();
panel.setBorder(false);
@@ -106,6 +108,7 @@
i18n.t("Now you can participate more actively in this site with other people and groups. "
+ "Your email is not verified, please follow the instructions you will receive by email."),
i18n.t("Ok"), WELCOME_OK_BUTTON, true, true, 400, 210);
+ welcomeDialog.setId(WELCOME_DIALOG);
welcomeDialog.show();
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInAbstractPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInAbstractPanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInAbstractPanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -5,6 +5,7 @@
import org.ourproject.kune.platf.client.services.Images;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.ui.dialogs.BasicDialogExtended;
+import org.ourproject.kune.platf.client.ui.dialogs.MessageToolbar;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.newgroup.SiteErrorType;
import org.ourproject.kune.workspace.client.site.Site;
@@ -12,17 +13,12 @@
import com.calclab.suco.client.listener.Listener0;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Cookies;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Label;
import com.gwtext.client.core.Ext;
-import com.gwtext.client.widgets.Toolbar;
public abstract class SignInAbstractPanel extends BasicDialogExtended {
protected final I18nUITranslationService i18n;
- protected Label errorLabel;
- private final Image errorIcon;
- private final Toolbar messageToolbar;
+ private final MessageToolbar messageErrorBar;
public SignInAbstractPanel(I18nUITranslationService i18n, String title, boolean modal, boolean autoscroll,
int width, int heigth, String icon, String firstButtonTitle, String cancelButtonTitle,
@@ -39,21 +35,9 @@
super(title, modal, autoscroll, width, heigth, icon, firstButtonTitle, firstButtonId, cancelButtonTitle,
cancelButtonId, onFirstButtonClick, onCancelButtonClick);
this.i18n = i18n;
- errorLabel = new Label("");
- errorLabel.ensureDebugId(errorLabelId);
- messageToolbar = new Toolbar();
- errorIcon = new Image();
- Images.App.getInstance().error().applyTo(errorIcon);
- messageToolbar.addSpacer();
- messageToolbar.addElement(errorIcon.getElement());
- messageToolbar.setCls("k-error-tb");
- messageToolbar.addSpacer();
- messageToolbar.addSpacer();
- messageToolbar.addElement(errorLabel.getElement());
- errorIcon.setVisible(false);
- messageToolbar.setVisible(false);
- super.setBottomToolbar(messageToolbar);
+ messageErrorBar = new MessageToolbar(images, errorLabelId);
+ super.setBottomToolbar(messageErrorBar.getToolbar());
}
@Override
@@ -64,9 +48,7 @@
}
public void hideMessages() {
- errorIcon.setVisible(false);
- errorLabel.setText("");
- messageToolbar.setVisible(false);
+ messageErrorBar.hideErrorMessage();
}
public void mask(final String message) {
@@ -86,9 +68,7 @@
}
public void setErrorMessage(final String message, final SiteErrorType type) {
- errorLabel.setText(message);
- errorIcon.setVisible(true);
- messageToolbar.setVisible(true);
+ messageErrorBar.setErrorMessage(message, type);
}
public void unMask() {
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInOld.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInOld.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInOld.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -1,28 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.workspace.client.signin;
-
-import org.ourproject.kune.platf.client.dto.StateToken;
-
-public interface SignInOld {
-
- void doSignIn(StateToken previousStateToken);
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -15,6 +15,7 @@
public class SignInPanel extends SignInAbstractPanel implements SignInView {
+ public static final String SIGN_IN_TITLE = "Sign in";
public static final String ERROR_MSG = "k-sigp-errmsg";
public static final String CANCEL_BUTTON_ID = "k-signinp-cb";
public static final String SIGN_IN_BUTTON_ID = "k-signinp-sib";
@@ -24,19 +25,19 @@
public SignInPanel(final SignInPresenter presenter, I18nUITranslationService i18n, final WorkspaceSkeleton ws,
Images images) {
- super(i18n, i18n.t("Sign in"), true, true, 340, 240, "", i18n.t("Sign in"), SIGN_IN_BUTTON_ID, i18n.tWithNT(
- "Cancel", "used in button"), CANCEL_BUTTON_ID, new Listener0() {
- public void onEvent() {
- signInForm.validate();
- if (signInForm.isValid()) {
- presenter.onFormSignIn();
- }
- }
- }, new Listener0() {
- public void onEvent() {
- presenter.onCancel();
- }
- }, images, ERROR_MSG);
+ super(i18n, i18n.t(SIGN_IN_TITLE), true, true, 340, 240, "", i18n.t(SIGN_IN_TITLE), SIGN_IN_BUTTON_ID,
+ i18n.tWithNT("Cancel", "used in button"), CANCEL_BUTTON_ID, new Listener0() {
+ public void onEvent() {
+ signInForm.validate();
+ if (signInForm.isValid()) {
+ presenter.onFormSignIn();
+ }
+ }
+ }, new Listener0() {
+ public void onEvent() {
+ presenter.onCancel();
+ }
+ }, images, ERROR_MSG);
this.presenter = presenter;
super.addListener(new WindowListenerAdapter() {
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPanelOld.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPanelOld.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPanelOld.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -1,397 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.workspace.client.signin;
-
-import java.util.Date;
-
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog;
-import org.ourproject.kune.platf.client.ui.dialogs.InfoDialog;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-import org.ourproject.kune.workspace.client.newgroup.SiteErrorType;
-import org.ourproject.kune.workspace.client.site.Site;
-import org.ourproject.kune.workspace.client.site.msg.SimpleMessagePanel;
-import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.Cookies;
-import com.google.gwt.user.client.DeferredCommand;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.Widget;
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.widgets.Button;
-import com.gwtext.client.widgets.Component;
-import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.TabPanel;
-import com.gwtext.client.widgets.Toolbar;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-import com.gwtext.client.widgets.event.PanelListenerAdapter;
-import com.gwtext.client.widgets.event.WindowListenerAdapter;
-import com.gwtext.client.widgets.form.Field;
-import com.gwtext.client.widgets.layout.FitLayout;
-
-public class SignInPanelOld implements SignInViewOld {
- private class MessagePanel extends Panel {
- private static final String SIGNIN_MESSAGE_PANEL = "kune-sip-mp";
- private final SimpleMessagePanel messagesPanel;
-
- public MessagePanel() {
- setPaddings(10);
- setBorder(false);
- setHeight(60);
- messagesPanel = new SimpleMessagePanel();
- messagesPanel.ensureDebugId(SIGNIN_MESSAGE_PANEL);
- messagesPanel.setMessage("", SiteErrorType.info, SiteErrorType.error);
- add(messagesPanel);
- }
-
- @Override
- public void hide() {
- messagesPanel.hide();
- super.hide();
- }
-
- public void setMessage(final String message, final SiteErrorType lastMessageType, final SiteErrorType type) {
- messagesPanel.setMessage(message, lastMessageType, type);
- }
-
- @Override
- public void show() {
- messagesPanel.show();
- super.show();
- }
- }
-
- private static final String USER_SIGN_IN_PANEL = "kune-sip-usp";
- private static final String USER_REGISTER_PANEL = "kune-sip-rp";
- private static final String CANCEL_BUTTON_ID = "kune-sip-cb";
- private static final String REGISTER_BUTTON_ID = "kune-sip-rb";
- private static final String SIGN_IN_BUTTON_ID = "kune-sip-sib";
-
- private BasicDialog dialog;
- private final SignInPresenterOld presenter;
- private SignInForm signInForm;
- private RegisterForm registerForm;
- private MessagePanel messagesSignInPanel;
- private InfoDialog welcomeDialog;
- private TabPanel centerPanel;
- private MessagePanel messagesRegisterPanel;
- private final I18nUITranslationService i18n;
- private Label errorLabel;
-
- public SignInPanelOld(final SignInPresenterOld presenter, final I18nUITranslationService i18n,
- final WorkspaceSkeleton ws) {
- this.i18n = i18n;
- Field.setMsgTarget("side");
- this.presenter = presenter;
- createPanel();
- }
-
- public void center() {
- dialog.center();
- }
-
- public String getCountry() {
- return registerForm.getCountry();
- }
-
- public String getEmail() {
- return registerForm.getEmail();
- }
-
- public String getLanguage() {
- return registerForm.getLanguage();
- }
-
- public String getLoginPassword() {
- return signInForm.getLoginPassword();
- }
-
- public String getLongName() {
- return registerForm.getLongName();
- }
-
- public String getNickOrEmail() {
- return signInForm.getNickOrEmail();
- }
-
- public String getRegisterPassword() {
- return registerForm.getRegisterPassword();
- }
-
- public String getRegisterPasswordDup() {
- return registerForm.getRegisterPasswordDup();
- }
-
- public String getShortName() {
- return registerForm.getShortName();
- }
-
- public String getTimezone() {
- return registerForm.getTimezone();
- }
-
- public void hide() {
- dialog.hide();
- }
-
- public void hideMessages() {
- errorLabel.setText("");
- messagesSignInPanel.hide();
- if (messagesRegisterPanel != null) {
- messagesRegisterPanel.hide();
- }
- renderDialogIfNeeded();
- }
-
- public boolean isRegisterFormValid() {
- return registerForm.isValid();
- }
-
- public boolean isSignInFormValid() {
- return signInForm.isValid();
- }
-
- public void mask(final String message) {
- dialog.getEl().mask(message, "x-mask-loading");
- }
-
- public void maskProcessing() {
- mask(i18n.t("Processing"));
- }
-
- public void reset() {
- DeferredCommand.addCommand(new Command() {
- public void execute() {
- signInForm.reset();
- if (registerForm != null) {
- registerForm.reset();
- }
- }
- });
- }
-
- public void setCookie(final String userHash) {
- // http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ
- final long duration = Session.SESSION_DURATION;
- final Date expires = new Date(System.currentTimeMillis() + duration);
- Cookies.setCookie(Site.USERHASH, userHash, expires, null, "/", false);
- GWT.log("Received hash: " + userHash, null);
- }
-
- public void setRegisterMessage(final String message, final SiteErrorType type) {
- messagesRegisterPanel.setMessage(message, type, type);
- messagesRegisterPanel.show();
- renderDialogIfNeeded();
- }
-
- public void setSignInMessage(final String message, final SiteErrorType type) {
- errorLabel.setText(message);
- messagesSignInPanel.setMessage(message, type, type);
- messagesSignInPanel.show();
- renderDialogIfNeeded();
- }
-
- public void show() {
- centerPanel.activate(0);
- dialog.setVisible(true);
- dialog.show();
- Site.hideProgress();
- dialog.focus();
- signInForm.focusLogin();
- }
-
- public void showWelcolmeDialog() {
- if (welcomeDialog == null) {
- welcomeDialog = new InfoDialog(i18n.t("Welcome"), i18n.t("Thanks for registering"),
- i18n.t("Now you can participate more actively in this site with other people and groups. "
- + "You can also use your personal space to publish contents. "
- + "Your email is not verified, please follow the instructions you will receive by email."),
- i18n.t("Ok"), "asdfasdfa", true, true, 400, 270);
- }
- welcomeDialog.show();
- }
-
- public void unMask() {
- dialog.getEl().unmask();
- }
-
- public boolean wantPersonalHomepage() {
- return registerForm.wantPersonalHomepage();
- }
-
- private void confPanel(final Panel panel) {
- // panel.setLayout(new FormLayout());
- // panel.setAutoWidth(true);
- // anel.setAutoHeight(true);
- panel.setAutoScroll(true);
- }
-
- private Panel createNoAccountRegister() {
- final Panel noAccRegisterPanel = new Panel();
- noAccRegisterPanel.setBorder(false);
- noAccRegisterPanel.setMargins(0, 20, 0, 0);
- HorizontalPanel hp = new HorizontalPanel();
- final Label dontHaveAccountLabel = new Label(i18n.t("Don't have an account?"));
- final Label registerLabel = new Label(i18n.t("Create one."));
- registerLabel.addClickListener(new ClickListener() {
- public void onClick(final Widget arg0) {
- centerPanel.activate(1);
- }
- });
- registerLabel.addStyleName("kune-Margin-Medium-l");
- registerLabel.addStyleName("kune-link");
- hp.add(dontHaveAccountLabel);
- hp.add(registerLabel);
- noAccRegisterPanel.add(hp);
- return noAccRegisterPanel;
- }
-
- private void createPanel() {
- dialog = new BasicDialog(i18n.t("Sign in"), true, false, 370, 400);
- dialog.setLayout(new FitLayout());
- final Panel dialogPanel = new Panel();
- dialogPanel.setLayout(new FitLayout());
- dialogPanel.setBorder(false);
- // dialog.setAutoHeight(false);
- // dialog.setAutoWidth(false);
- // dialog.setAutoHeight(true);
- // dialog.setAutoWidth(true);
- dialogPanel.setHeight("100%");
- dialogPanel.setWidth("auto");
- // dialog.setCollapsible(false);
-
- centerPanel = new TabPanel();
- centerPanel.setBorder(false);
- centerPanel.setActiveTab(0);
- // centerPanel.setAutoWidth(true);
- // centerPanel.setAutoHeight(true);
- centerPanel.setClosable(false);
-
- final Panel signInPanel = new Panel(i18n.t("Sign in"));
- signInPanel.setBorder(false);
- signInPanel.setMargins(20);
- confPanel(signInPanel);
- signInForm = new SignInForm(i18n);
- signInPanel.add(signInForm.getForm());
- signInPanel.setCls(USER_SIGN_IN_PANEL);
- signInPanel.add(createNoAccountRegister());
- messagesSignInPanel = new MessagePanel();
- signInPanel.add(messagesSignInPanel);
-
- final Panel registerPanel = new Panel(i18n.t("Register"));
- signInPanel.setBorder(false);
- registerPanel.setCls(USER_REGISTER_PANEL);
- confPanel(registerPanel);
-
- centerPanel.add(signInPanel);
- centerPanel.add(registerPanel);
- dialogPanel.add(centerPanel);
- errorLabel = new Label("");
- Toolbar messageToolbar = new Toolbar();
- messageToolbar.addElement(errorLabel.getElement());
- dialog.setBottomToolbar(messageToolbar);
- dialog.add(dialogPanel);
-
- final Button signInBtn = new Button(i18n.t("Sign in"));
- signInBtn.addListener(new ButtonListenerAdapter() {
- @Override
- public void onClick(final Button button, final EventObject e) {
- signInForm.validate();
- if (signInForm.isValid()) {
- presenter.onFormSignIn();
- }
- }
- });
- signInBtn.setId(SIGN_IN_BUTTON_ID);
- dialog.addButton(signInBtn);
-
- final Button registerBtn = new Button(i18n.t("Register"));
- registerBtn.addListener(new ButtonListenerAdapter() {
- @Override
- public void onClick(final Button button, final EventObject e) {
- registerForm.validate();
- if (registerForm.isValid()) {
- presenter.onFormRegister();
- }
- }
- });
- dialog.addButton(registerBtn);
- registerBtn.setId(REGISTER_BUTTON_ID);
- registerBtn.hide();
-
- final Button cancel = new Button();
- cancel.setId(CANCEL_BUTTON_ID);
- dialog.addButton(cancel);
- cancel.setText(i18n.tWithNT("Cancel", "used in button"));
- cancel.addListener(new ButtonListenerAdapter() {
- @Override
- public void onClick(final Button button, final EventObject e) {
- presenter.onCancel();
- }
- });
-
- signInPanel.addListener(new PanelListenerAdapter() {
- @Override
- public void onActivate(final Panel panel) {
- dialog.setTitle(i18n.t("Sign in"));
- registerBtn.hide();
- signInBtn.show();
- }
- });
-
- registerPanel.addListener(new PanelListenerAdapter() {
- @Override
- public void onActivate(final Panel panel) {
- if (registerForm == null) {
- maskProcessing();
- // registerForm = new RegisterForm(presenter, i18n);
- registerPanel.add(registerForm.getForm());
- messagesRegisterPanel = new MessagePanel();
- registerPanel.add(messagesRegisterPanel);
- messagesRegisterPanel.hide();
- renderDialogIfNeeded();
- unMask();
- }
- dialog.setTitle(i18n.t("Register"));
- signInBtn.hide();
- registerBtn.show();
- }
- });
-
- dialog.addListener(new WindowListenerAdapter() {
- @Override
- public void onHide(final Component component) {
- presenter.onClose();
- }
- });
- hideMessages();
- renderDialogIfNeeded();
- }
-
- private void renderDialogIfNeeded() {
- if (dialog.isRendered()) {
- dialog.doLayout();
- }
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenterOld.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenterOld.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenterOld.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -1,210 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.workspace.client.signin;
-
-import org.ourproject.kune.platf.client.dto.I18nCountryDTO;
-import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.dto.TimeZoneDTO;
-import org.ourproject.kune.platf.client.dto.UserDTO;
-import org.ourproject.kune.platf.client.dto.UserInfoDTO;
-import org.ourproject.kune.platf.client.errors.EmailAddressInUseException;
-import org.ourproject.kune.platf.client.errors.GroupNameInUseException;
-import org.ourproject.kune.platf.client.errors.UserAuthException;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.state.StateManager;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-import org.ourproject.kune.workspace.client.newgroup.SiteErrorType;
-import org.ourproject.kune.workspace.client.site.Site;
-import org.ourproject.kune.workspace.client.site.rpc.UserServiceAsync;
-
-import com.allen_sauer.gwt.log.client.Log;
-import com.calclab.emiteuimodule.client.SubscriptionMode;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-public class SignInPresenterOld implements SignInOld {
-
- SignInViewOld view;
- private final Session session;
- private final I18nUITranslationService i18n;
- private final UserServiceAsync userService;
- private final StateManager stateManager;
- private StateToken previousStateToken;
-
- public SignInPresenterOld(final Session session, final StateManager stateManager, final I18nUITranslationService i18n,
- final UserServiceAsync userService) {
- this.session = session;
- this.stateManager = stateManager;
- this.userService = userService;
- this.i18n = i18n;
- }
-
- public void doSignIn(final StateToken previousStateToken) {
- this.previousStateToken = previousStateToken;
- if (!session.isLogged()) {
- Site.showProgressProcessing();
- view.show();
- view.center();
- Site.hideProgress();
- } else {
- stateManager.gotoToken(previousStateToken);
- }
- }
-
- public Object[][] getCountries() {
- return session.getCountriesArray();
- }
-
- public I18nLanguageDTO getCurrentLanguage() {
- return session.getCurrentLanguage();
- }
-
- public Object[][] getLanguages() {
- return session.getLanguagesArray();
- }
-
- public Object[][] getTimezones() {
- return session.getTimezones();
- }
-
- public void init(final SignInViewOld loginview) {
- this.view = loginview;
- }
-
- public void onCancel() {
- resetMessages();
- reset();
- view.hide();
- stateManager.gotoToken(previousStateToken);
- }
-
- public void onClose() {
- reset();
- view.hideMessages();
- if (!session.isLogged()) {
- stateManager.gotoToken(previousStateToken);
- }
- }
-
- public void onFormRegister() {
- if (view.isRegisterFormValid()) {
- view.maskProcessing();
-
- final I18nLanguageDTO language = new I18nLanguageDTO();
- language.setCode(view.getLanguage());
-
- final I18nCountryDTO country = new I18nCountryDTO();
- country.setCode(view.getCountry());
-
- final TimeZoneDTO timezone = new TimeZoneDTO();
- timezone.setId(view.getTimezone());
-
- boolean wantPersonalHomepage = view.wantPersonalHomepage();
-
- final UserDTO user = new UserDTO(view.getLongName(), view.getShortName(), view.getRegisterPassword(),
- view.getEmail(), language, country, timezone, null, true, SubscriptionMode.manual, "blue");
- final AsyncCallback<UserInfoDTO> callback = new AsyncCallback<UserInfoDTO>() {
- public void onFailure(final Throwable caught) {
- view.unMask();
- try {
- throw caught;
- } catch (final EmailAddressInUseException e) {
- view.setRegisterMessage(i18n.t("This email in in use by other person, try with another."),
- SiteErrorType.error);
- } catch (final GroupNameInUseException e) {
- view.setRegisterMessage(i18n.t("This name in already in use, try with a different name."),
- SiteErrorType.error);
- } catch (final Throwable e) {
- view.setRegisterMessage(i18n.t("Error during registration."), SiteErrorType.error);
- GWT.log("Other kind of exception in user registration" + e.getMessage() + ", "
- + e.getLocalizedMessage(), null);
- e.printStackTrace();
- throw new RuntimeException();
- }
- }
-
- public void onSuccess(final UserInfoDTO userInfoDTO) {
- stateManager.gotoToken(userInfoDTO.getHomePage());
- onSignIn(userInfoDTO);
- view.hide();
- view.unMask();
- view.showWelcolmeDialog();
- }
- };
- userService.createUser(user, wantPersonalHomepage, callback);
- }
- }
-
- protected void onFormSignIn() {
- if (view.isSignInFormValid()) {
- view.maskProcessing();
-
- final String nickOrEmail = view.getNickOrEmail();
- final String passwd = view.getLoginPassword();
-
- final UserDTO user = new UserDTO();
- user.setShortName(nickOrEmail);
- user.setPassword(passwd);
-
- final AsyncCallback<UserInfoDTO> callback = new AsyncCallback<UserInfoDTO>() {
- public void onFailure(final Throwable caught) {
- view.unMask();
- Site.hideProgress();
- try {
- throw caught;
- } catch (final UserAuthException e) {
- view.setSignInMessage(i18n.t("Incorrect nickname/email or password"), SiteErrorType.error);
- } catch (final Throwable e) {
- view.setSignInMessage("Error in login", SiteErrorType.error);
- Log.error("Other kind of exception in LoginFormPresenter/doLogin");
- }
- }
-
- public void onSuccess(final UserInfoDTO userInfoDTO) {
- onSignIn(userInfoDTO);
- stateManager.gotoToken(previousStateToken);
- view.hide();
- view.unMask();
- }
- };
- userService.login(user.getShortName(), user.getPassword(), callback);
- }
- }
-
- private void onSignIn(final UserInfoDTO userInfoDTO) {
- final String userHash = userInfoDTO.getUserHash();
- view.setCookie(userHash);
- session.setUserHash(userHash);
- session.setCurrentUserInfo(userInfoDTO);
- final I18nLanguageDTO language = userInfoDTO.getLanguage();
- i18n.changeCurrentLanguage(language.getCode());
- session.setCurrentLanguage(language);
- }
-
- private void reset() {
- view.reset();
- }
-
- private void resetMessages() {
- view.hideMessages();
- }
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInViewOld.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInViewOld.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInViewOld.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -1,75 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.workspace.client.signin;
-
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.workspace.client.newgroup.SiteErrorType;
-
-public interface SignInViewOld extends View {
-
- void center();
-
- String getCountry();
-
- String getEmail();
-
- String getLanguage();
-
- String getLoginPassword();
-
- String getLongName();
-
- String getNickOrEmail();
-
- String getRegisterPassword();
-
- String getRegisterPasswordDup();
-
- String getShortName();
-
- String getTimezone();
-
- void hide();
-
- void hideMessages();
-
- boolean isRegisterFormValid();
-
- boolean isSignInFormValid();
-
- void maskProcessing();
-
- void reset();
-
- void setCookie(String userHash);
-
- void setRegisterMessage(String message, SiteErrorType type);
-
- void setSignInMessage(String message, SiteErrorType type);
-
- void show();
-
- void showWelcolmeDialog();
-
- void unMask();
-
- boolean wantPersonalHomepage();
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SimpleMessagePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SimpleMessagePanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SimpleMessagePanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -30,11 +30,12 @@
public class SimpleMessagePanel extends HorizontalPanel implements SiteMessageView {
HTML message = null;
Image messageIcon = null;
+ private final Images images;
- public SimpleMessagePanel() {
+ public SimpleMessagePanel(Images images) {
+ this.images = images;
message = new HTML();
messageIcon = new Image();
- final Images images = Images.App.getInstance();
add(messageIcon);
add(message);
setCellVerticalAlignment(messageIcon, VerticalPanel.ALIGN_MIDDLE);
@@ -66,7 +67,6 @@
}
public void setMessage(final String text, final SiteErrorType lastMessageType, final SiteErrorType type) {
- final Images images = Images.App.getInstance();
AbstractImagePrototype imagePrototype = null;
switch (type) {
case error:
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessagePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessagePanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessagePanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -41,9 +41,10 @@
private final ExtElement extElem;
public SiteMessagePanel(final MessagePresenter presenter, final boolean closable,
- final I18nUITranslationService i18n) {
- final Images images = Images.App.getInstance();
+ final I18nUITranslationService i18n, Images images) {
+ super(images);
timer = new Timer() {
+ @Override
public void run() {
hide();
if (presenter != null) {
@@ -90,12 +91,14 @@
super.adjustWidth(windowWidth);
}
+ @Override
public void hide() {
extElem.hide(true);
super.reset();
timer.cancel();
}
+ @Override
public void show() {
extElem.show(false);
// super.show();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -6,11 +6,14 @@
public class SiteToastMessagePanel implements SiteToastMessageView {
+ public static final String MESSAGE = "k-stmess-m";
+
public SiteToastMessagePanel() {
}
public void showMessage(String title, String message, SiteErrorType type) {
ToastWindow toastWindow = new ToastWindow(title, message);
+ toastWindow.setId(MESSAGE);
String iconCls = "";
switch (type) {
case info:
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -42,9 +42,8 @@
private final I18nUITranslationService i18n;
public SiteSearchPanel(final SiteSearchPresenter presenter, final WorkspaceSkeleton ws,
- final I18nUITranslationService i18n) {
+ final I18nUITranslationService i18n, Images img) {
this.i18n = i18n;
- final Images img = Images.App.getInstance();
final SimpleToolbar siteBar = ws.getSiteBar();
siteBar.addSpacer();
siteBar.addSpacer();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/summary/GroupSummaryPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/summary/GroupSummaryPanel.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/summary/GroupSummaryPanel.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -20,6 +20,7 @@
package org.ourproject.kune.workspace.client.summary;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.services.Images;
import org.ourproject.kune.platf.client.ui.DropDownPanel;
import org.ourproject.kune.workspace.client.site.Site;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
@@ -31,9 +32,9 @@
private final VerticalPanel vp;
- public GroupSummaryPanel(final GroupSummaryPresenter presenter, final I18nTranslationService i18n,
+ public GroupSummaryPanel(Images img, final GroupSummaryPresenter presenter, final I18nTranslationService i18n,
final WorkspaceSkeleton ws) {
- super(i18n.t("Group Summary"), true);
+ super(img, i18n.t("Group Summary"), true);
setHeaderTitle(i18n.t("Some summarized information about current project" + Site.IN_DEVELOPMENT));
vp = new VerticalPanel();
vp.setWidth("100%");
Modified: trunk/src/test/java/org/ourproject/kune/platf/client/ui/KuneStringUtilsTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/ui/KuneStringUtilsTest.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/ui/KuneStringUtilsTest.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -11,14 +11,14 @@
@Test
public void testTagNull() {
final String tagsString = null;
- final ArrayList<String> tags = KuneStringUtils.splitTags(tagsString);
+ final ArrayList<String> tags = TextUtils.splitTags(tagsString);
assertEquals(0, tags.size());
}
@Test
public void testTagStripsSimple() {
final String tagsString = "ab cd";
- final ArrayList<String> tags = KuneStringUtils.splitTags(tagsString);
+ final ArrayList<String> tags = TextUtils.splitTags(tagsString);
assertEquals("ab", tags.get(0));
assertEquals("cd", tags.get(1));
}
@@ -26,7 +26,7 @@
@Test
public void testTagStripsWithCommas() {
final String tagsString = "ab,cd";
- final ArrayList<String> tags = KuneStringUtils.splitTags(tagsString);
+ final ArrayList<String> tags = TextUtils.splitTags(tagsString);
assertEquals("ab", tags.get(0));
assertEquals("cd", tags.get(1));
}
@@ -34,7 +34,7 @@
@Test
public void testTagStripsWithCommasAndSpaces() {
final String tagsString = "ab, cd";
- final ArrayList<String> tags = KuneStringUtils.splitTags(tagsString);
+ final ArrayList<String> tags = TextUtils.splitTags(tagsString);
assertEquals("ab", tags.get(0));
assertEquals("cd", tags.get(1));
}
@@ -42,7 +42,7 @@
@Test
public void testTagStripsWithQuotes() {
final String tagsString = "ab \"cd\"";
- final ArrayList<String> tags = KuneStringUtils.splitTags(tagsString);
+ final ArrayList<String> tags = TextUtils.splitTags(tagsString);
assertEquals("ab", tags.get(0));
assertEquals("cd", tags.get(1));
}
@@ -50,7 +50,7 @@
@Test
public void testTagStripsWithSpaces() {
final String tagsString = " ab cd ";
- final ArrayList<String> tags = KuneStringUtils.splitTags(tagsString);
+ final ArrayList<String> tags = TextUtils.splitTags(tagsString);
assertEquals("ab", tags.get(0));
assertEquals("cd", tags.get(1));
}
Added: trunk/src/test/java/org/ourproject/kune/platf/client/ui/TextUtilsTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/ui/TextUtilsTest.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/ui/TextUtilsTest.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -0,0 +1,26 @@
+package org.ourproject.kune.platf.client.ui;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TextUtilsTest {
+ @Test
+ public void matchDemoEmail() {
+ String email = "test100 at emitedemo.ourproject.org";
+ assertTrue(email.matches(TextUtils.EMAIL_REGEXP));
+ }
+
+ @Test
+ public void matchLocalhostEmail() {
+ String email = "me at localhost";
+ assertTrue(email.matches(TextUtils.EMAIL_REGEXP));
+ }
+
+ @Test
+ public void matchSimpleEmail() {
+ String email = "me at example.com";
+ assertTrue(email.matches(TextUtils.EMAIL_REGEXP));
+ }
+
+}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -1,10 +1,13 @@
package org.ourproject.kune.platf.integration.selenium;
+import java.util.Date;
+
import org.junit.Before;
import org.ourproject.kune.workspace.client.signin.RegisterForm;
import org.ourproject.kune.workspace.client.signin.RegisterPanel;
import org.ourproject.kune.workspace.client.signin.SignInForm;
import org.ourproject.kune.workspace.client.signin.SignInPanel;
+import org.ourproject.kune.workspace.client.site.SiteToken;
import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignInLinkPanel;
import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignOutLinkPanel;
import org.ourproject.kune.workspace.client.sitebar.siteusermenu.SiteUserMenuPanel;
@@ -12,6 +15,8 @@
public class KuneSeleniumTestHelper extends SeleniumTestHelper {
+ protected static final String KUNE_BASE_URL = "/kune/?locale=en#";
+
@Before
public void before() {
selenium.deleteAllVisibleCookies();
@@ -79,4 +84,20 @@
protected void verifyLoggedUserShorName(String userShortName) throws Exception {
waitForTextInside(gid(SiteUserMenuPanel.LOGGED_USER_MENU), userShortName);
}
+
+ protected long genPrefix() {
+ long prefix = new Date().getTime();
+ return prefix;
+ }
+
+ protected void open(SiteToken token) {
+ open(KUNE_BASE_URL + token.toString());
+ }
+
+ protected String registerValidUser(boolean wantHomepage) {
+ String shortName = "u" + genPrefix();
+ register(shortName, "some name " + genPrefix(), "somepasswd", "somepasswd", genPrefix() + "@example.com",
+ "Andorra", "English", "MET", wantHomepage);
+ return shortName;
+ }
}
Added: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/NewGroupSeleniumTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/NewGroupSeleniumTest.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/NewGroupSeleniumTest.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -0,0 +1,39 @@
+package org.ourproject.kune.platf.integration.selenium;
+
+import static org.junit.Assert.assertFalse;
+
+import org.junit.Test;
+import org.ourproject.kune.workspace.client.newgroup.NewGroupPanel;
+import org.ourproject.kune.workspace.client.newgroup.NewGroupPresenter;
+import org.ourproject.kune.workspace.client.site.SiteToken;
+import org.ourproject.kune.workspace.client.site.msg.SiteToastMessagePanel;
+
+public class NewGroupSeleniumTest extends KuneSeleniumTestHelper {
+
+ @Test
+ public void newGroupBasic() throws Exception {
+ setMustStopFinally(false);
+ assertFalse(selenium.isTextPresent(NewGroupPanel.NEWGROUP_WIZARD));
+ openDefPage();
+ signIn();
+ selenium.refresh();
+ open(SiteToken.newgroup);
+ verifyLoggedUserShorName("admin");
+ waitForTextInside(NewGroupPanel.NEWGROUP_WIZARD, NewGroupPanel.REGISTER_A_NEW_GROUP_TITLE);
+ }
+
+ @Test
+ public void newGroupNotLogged() throws Exception {
+ setMustStopFinally(false);
+ assertFalse(selenium.isTextPresent(NewGroupPanel.NEWGROUP_WIZARD));
+ open(SiteToken.newgroup);
+ waitForTextInside(SiteToastMessagePanel.MESSAGE, NewGroupPresenter.REGISTER_TO_CREATE_A_GROUP);
+ }
+
+ @Test
+ public void newGroupWithExistingNicknameFails() {
+ open(SiteToken.newgroup);
+
+ }
+
+}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -9,10 +9,13 @@
public class SeleniumTestHelper {
protected static DefaultSelenium selenium;
+ private static boolean mustStopFinally = true;
@AfterClass
public static void afterClass() throws Exception {
- selenium.stop();
+ if (mustStopFinally) {
+ selenium.stop();
+ }
}
/**
@@ -46,10 +49,20 @@
selenium.start();
}
+ public static void setMustStopFinally(boolean mustStopFinally) {
+ SeleniumTestHelper.mustStopFinally = mustStopFinally;
+ }
+
protected void click(String id) {
selenium.click(id);
}
+ protected void clickOnPushButton(String id) {
+ selenium.mouseOver(id);
+ selenium.mouseDown(id);
+ selenium.mouseUp(id);
+ }
+
protected void fail(String message) throws Exception {
throw new Exception(message);
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SignInSeleniumTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SignInSeleniumTest.java 2008-10-27 13:32:42 UTC (rev 932)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SignInSeleniumTest.java 2008-10-27 21:53:19 UTC (rev 933)
@@ -1,10 +1,9 @@
package org.ourproject.kune.platf.integration.selenium;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
-import java.util.Date;
-
-import org.junit.Ignore;
import org.junit.Test;
import org.ourproject.kune.workspace.client.nohomepage.NoHomePagePanel;
import org.ourproject.kune.workspace.client.signin.RegisterPanel;
@@ -12,7 +11,9 @@
import org.ourproject.kune.workspace.client.signin.SignInPanel;
import org.ourproject.kune.workspace.client.signin.SignInPresenter;
import org.ourproject.kune.workspace.client.site.Site;
+import org.ourproject.kune.workspace.client.site.SiteToken;
import org.ourproject.kune.workspace.client.sitebar.siteusermenu.SiteUserMenuPanel;
+import org.ourproject.kune.workspace.client.title.EntityTitlePanel;
public class SignInSeleniumTest extends KuneSeleniumTestHelper {
@@ -40,18 +41,26 @@
registerValidUser(true);
}
- @Ignore
+ @Test
public void registerSomeUserWithouHomepage() throws Exception {
openDefPage();
registerValidUser(false);
+ selenium.isTextPresent("Welcome");
click(RegisterPanel.WELCOME_OK_BUTTON);
- click("//div[@id='" + gid(SiteUserMenuPanel.LOGGED_USER_MENU) + "']/div");
+ clickOnPushButton(gid(SiteUserMenuPanel.LOGGED_USER_MENU));
click(linkId(SiteUserMenuPanel.YOUR_HOMEPAGE));
waitForTextInside(gid(NoHomePagePanel.NO_HOME_PAGE_LABEL), NoHomePagePanel.USER_DON_T_HAVE_A_HOMEPAGE);
- wait(20000);
}
@Test
+ public void testRegisterToken() throws Exception {
+ open(SiteToken.register);
+ assertFalse(selenium.isTextPresent(RegisterPanel.REGISTER_TITLE));
+ waitForTextInside(gid(EntityTitlePanel.ENTITY_TITLE_RIGHT_TITLE), "Welcome to kune");
+ assertTrue(selenium.isTextPresent(RegisterPanel.REGISTER_TITLE));
+ }
+
+ @Test
public void testSignInAndOut() throws Exception {
openDefPage();
signIn();
@@ -97,15 +106,11 @@
signOut();
}
- private long genPrefix() {
- long prefix = new Date().getTime();
- return prefix;
+ @Test
+ public void testSignInToken() throws Exception {
+ open(SiteToken.signin);
+ assertFalse(selenium.isTextPresent(SignInPanel.SIGN_IN_TITLE));
+ waitForTextInside(gid(EntityTitlePanel.ENTITY_TITLE_RIGHT_TITLE), "Welcome to kune");
+ assertTrue(selenium.isTextPresent(SignInPanel.SIGN_IN_TITLE));
}
-
- private String registerValidUser(boolean wantHomepage) {
- String shortName = "u" + genPrefix();
- register(shortName, "some name " + genPrefix(), "somepasswd", "somepasswd", genPrefix() + "@example.com",
- "Andorra", "English", "MET", wantHomepage);
- return shortName;
- }
}
More information about the kune-commits
mailing list