[kune-commits] r1109 - in trunk/src:
main/java/org/ourproject/kune/chat/client
main/java/org/ourproject/kune/chat/server/managers
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/rte/basic
main/java/org/ourproject/kune/platf/client/ui/rte/saving
main/java/org/ourproject/kune/platf/server/domain
main/java/org/ourproject/kune/platf/server/manager/impl
main/java/org/ourproject/kune/platf/server/properties
main/java/org/ourproject/kune/platf/server/rpc
test/java/org/ourproject/kune/chat/server/managers
vjrj
vjrj at ourproject.org
Mon May 11 22:23:49 CEST 2009
Author: vjrj
Date: 2009-05-11 22:23:46 +0200 (Mon, 11 May 2009)
New Revision: 1109
Modified:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java
trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManager.java
trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTELinkPopup.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/properties/ChatProperties.java
trunk/src/main/java/org/ourproject/kune/platf/server/properties/DatabaseProperties.java
trunk/src/main/java/org/ourproject/kune/platf/server/properties/KuneProperties.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java
trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerTest.java
Log:
Complete - task link editing/remove not working
Complete - task link editing close option
Complete - task Elements unselectable utility
Incomplete - task 192: Make a chat notification library to users
http://ourproject.org/tracker/?group_id=407&func=detail&atid=139&aid=192
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -286,7 +286,7 @@
final String resource = "emiteui-" + new Date().getTime() + "-kune"; // +
// getGwtMetaProperty(GWT_PROPERTY_RELEASE);
// FIXME, get this from user profile
- return new UserChatOptions(jid + "@" + chatOptions.domain, passwd, resource, "blue",
- SubscriptionMode.autoAcceptAll, true);
+ return new UserChatOptions(jid + "@" + chatOptions.domain, passwd, resource, "blue", SubscriptionMode.manual,
+ true);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManager.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManager.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -39,4 +39,6 @@
void sendMessage(Room room, String message);
+ void sendMessage(String userName, String message);
+
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -24,7 +24,11 @@
import java.util.Iterator;
import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.ConnectionConfiguration;
+import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.XMPPConnection;
@@ -40,6 +44,7 @@
@Singleton
public class XmppManagerDefault implements XmppManager {
+ public static final Log log = LogFactory.getLog(XmppManagerDefault.class);
private final ChatProperties chatProperties;
@@ -78,7 +83,7 @@
}
- public Collection<RosterEntry> getRoster(ChatConnection conn) {
+ public Collection<RosterEntry> getRoster(final ChatConnection conn) {
XmppConnection xConn = (XmppConnection) conn;
Roster roster = xConn.getConn().getRoster();
return roster.getEntries();
@@ -123,6 +128,29 @@
}
}
+ public void sendMessage(final String userName, final String text) {
+ ChatConnection connection = login(chatProperties.getAdminJID(), chatProperties.getAdminPasswd(),
+ "kuneserveradmin" + System.currentTimeMillis());
+ XMPPConnection xmppConn = ((XmppConnection) connection).getConn();
+
+ String userJid = userName + "@" + chatProperties.getDomain();
+ Chat newChat = xmppConn.getChatManager().createChat(userJid, new MessageListener() {
+ public void processMessage(final Chat arg0, final Message arg1) {
+ log.info("Sended message: " + text);
+ }
+ });
+ try {
+ final Message message = new Message();
+ message.setFrom(chatProperties.getDomain());
+ message.setTo(userJid);
+ message.setBody(text);
+ newChat.sendMessage(message);
+ } catch (Exception e) {
+ log.error("Error Delivering xmpp message to " + userName);
+ }
+ xmppConn.disconnect();
+ }
+
private void configure(final MultiUserChat muc) throws XMPPException {
Form form = muc.getConfigurationForm();
Form answer = form.createAnswerForm();
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 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -25,6 +25,7 @@
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
+import com.gwtext.client.core.Ext;
import com.gwtext.client.widgets.ToolTip;
import com.gwtext.client.widgets.form.Field;
@@ -55,7 +56,7 @@
}
public static String genQuickTipLabel(final String labelText, final String tipTitle, final String tipText,
- final AbstractImagePrototype icon, IconPosition iconPosition) {
+ final AbstractImagePrototype icon, final IconPosition iconPosition) {
String tipHtml = "<span style=\"vertical-align: middle;\" ext:qtip=\"" + tipText + "\"";
if (tipTitle != null && tipTitle.length() > 0) {
tipHtml += " ext:qtitle=\"" + tipTitle + "\"";
@@ -88,7 +89,7 @@
return tipHtml;
}
- public static String genQuickTipWithImage(String imageResizedUrl, int size) {
+ public static String genQuickTipWithImage(final String imageResizedUrl, final int size) {
return new Image(imageResizedUrl).toString();
}
@@ -131,4 +132,13 @@
public static void setQuickTip(final Widget widget, final String tip, final String tipTitle) {
setQuickTip(widget.getElement(), tip, tipTitle);
}
+
+ /**
+ * Disables text selection on element
+ *
+ * @param element
+ */
+ public static void setUnselectable(final Element element) {
+ Ext.get(element).unselectable();
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -27,7 +27,7 @@
public class InfoDialog extends BasicDialog {
public InfoDialog(final String dialogId, final String title, final String header, final String text,
- final String okButtonText, String okButtonId, final boolean modal, final boolean autoScroll,
+ final String okButtonText, final String okButtonId, final boolean modal, final boolean autoScroll,
final int width, final int height) {
super(dialogId, title, modal, autoScroll, width, height);
final Button okButton = new Button(okButtonText);
@@ -35,7 +35,7 @@
okButton.addListener(new ButtonListenerAdapter() {
@Override
public void onClick(final Button button, final EventObject e) {
- hide();
+ destroy();
}
});
final Panel panel = new Panel();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTELinkPopup.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTELinkPopup.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTELinkPopup.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -1,10 +1,13 @@
package org.ourproject.kune.platf.client.ui.rte.basic;
import org.ourproject.kune.platf.client.actions.ActionItem;
+import org.ourproject.kune.platf.client.services.Images;
+import org.ourproject.kune.platf.client.ui.KuneUiUtils;
import com.calclab.suco.client.events.Listener0;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.Widget;
@@ -16,22 +19,32 @@
public RTELinkPopup() {
hp = new HorizontalPanel();
hp.setSpacing(5);
+ KuneUiUtils.setUnselectable(hp.getElement());
+ Image close = new Image();
+ Images.App.getInstance().kuneClose().applyTo(close);
+ close.addClickListener(new ClickListener() {
+ public void onClick(final Widget sender) {
+ hide();
+ }
+ });
+ hp.add(close);
}
public void addAction(final ActionItem<Object> item, final Listener0 onClick) {
Label actionLabel = new Label();
actionLabel.setText(item.getAction().getText());
actionLabel.addStyleName("k-rte-changelink");
+ KuneUiUtils.setUnselectable(actionLabel.getElement());
actionLabel.addClickListener(new ClickListener() {
public void onClick(final Widget arg0) {
onClick.onEvent();
}
});
- hp.add(actionLabel);
+ hp.insert(actionLabel, 0);
}
public void hide() {
- if (popupPalette != null) {
+ if (isVisible()) {
popupPalette.hide();
}
}
@@ -47,10 +60,9 @@
public void show(final int left, final int top) {
popupPalette = new PopupPanel(false, false);
popupPalette.addStyleName("k-rte-changelink-popup");
- popupPalette.setVisible(false);
+ popupPalette.setWidget(hp);
popupPalette.show();
popupPalette.setPopupPosition(left, top);
- popupPalette.setWidget(hp);
popupPalette.setVisible(true);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -39,6 +39,8 @@
ActionToolbar<Object> getTopBar();
+ void reset();
+
void setExtended(boolean extended);
void setFocus(boolean focus);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -28,6 +28,7 @@
import org.xwiki.gwt.dom.client.Range;
import org.xwiki.gwt.dom.client.Selection;
+import com.allen_sauer.gwt.log.client.Log;
import com.calclab.suco.client.events.Listener0;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.Command;
@@ -87,7 +88,11 @@
public void addCtxAction(final ActionItem<Object> actionItem) {
linkCtxMenu.addAction(actionItem, new Listener0() {
public void onEvent() {
- actionManager.doAction(actionItem);
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ actionManager.doAction(actionItem);
+ }
+ });
}
});
}
@@ -126,15 +131,13 @@
public LinkInfo getLinkInfoIfHref() {
LinkInfo linkinfo = null;
- org.xwiki.gwt.dom.client.Element selectedAnchor = LinkExecutableUtils.getSelectedAnchor(this);
+ org.xwiki.gwt.dom.client.Element selectedAnchor = selectAndGetLink();
if (selectedAnchor != null) {
- Range range = getDocument().createRange();
- range.selectNode(selectedAnchor);
- getSelection().addRange(range);
linkinfo = LinkInfo.parse(selectedAnchor);
} else {
linkinfo = new LinkInfo(getSelectionText());
}
+ Log.debug("Link info: " + linkinfo);
return linkinfo;
}
@@ -156,7 +159,6 @@
public void hideLinkCtxMenu() {
linkCtxMenu.hide();
-
}
public void insertBlockquote() {
@@ -320,6 +322,10 @@
basic.selectAll();
}
+ public void selectLink() {
+ selectAndGetLink();
+ }
+
public void setBackColor(final String color) {
basic.setBackColor(color);
}
@@ -422,6 +428,16 @@
}
}
+ private org.xwiki.gwt.dom.client.Element selectAndGetLink() {
+ org.xwiki.gwt.dom.client.Element selectedAnchor = LinkExecutableUtils.getSelectedAnchor(this);
+ if (selectedAnchor != null) {
+ Range range = getDocument().createRange();
+ range.selectNode(selectedAnchor);
+ getSelection().addRange(range);
+ }
+ return selectedAnchor;
+ }
+
private void updateLinkInfo() {
presenter.updateLinkInfo();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -67,7 +67,7 @@
private final DeferredCommandWrapper deferred;
private final ActionAddCondition<Object> canBeBasic;
private final ActionAddCondition<Object> canBeExtended;
- private final Provider<ColorWebSafePalette> palette;
+ private final Provider<ColorWebSafePalette> paletteProvider;
private final Provider<InsertLinkDialog> insertLinkDialog;
private final Provider<EditHtmlDialog> editHtmlDialog;
private final Provider<InsertImageDialog> insertImageDialog;
@@ -81,6 +81,7 @@
private final Provider<InsertSpecialCharDialog> insertSpecialCharDialog;
protected Listener<String> insertSpecialCharListener;
private final Provider<InsertMediaDialog> insertMediaDialog;
+ protected ColorWebSafePalette palette;
public RTEditorPresenter(final I18nTranslationService i18n, final Session session,
final RTEActionTopToolbar topBar, final RTEActionSndToolbar sndBar, final RTEImgResources imgResources,
@@ -93,7 +94,7 @@
this.topBar = topBar;
this.sndBar = sndBar;
this.insertLinkDialog = textEditorInsertElement;
- this.palette = palette;
+ this.paletteProvider = palette;
this.editHtmlDialog = editHtmlDialog;
this.insertImageDialog = insertImageDialog;
this.insertMediaDialog = insertMediaDialog;
@@ -186,12 +187,14 @@
}
public void onEditorFocus() {
- topBar.hideAllMenus();
- sndBar.hideAllMenus();
- palette.get().hide();
+ hideMenus();
}
public void onLostFocus() {
+ }
+
+ public void reset() {
+ hideMenus();
hideLinkCtxMenu();
}
@@ -452,6 +455,7 @@
EditHtmlDialog dialog = editHtmlDialog.get();
dialog.setUpdateListener(updateHtmlListener);
dialog.show();
+ hideLinkCtxMenu();
dialog.setHtml(view.getHTML());
}
});
@@ -619,6 +623,7 @@
dialog.reset();
dialog.setOnCreateImage(insertImageListener);
dialog.show();
+ hideLinkCtxMenu();
}
});
}
@@ -651,6 +656,7 @@
InsertMediaDialog dialog = insertMediaDialog.get();
dialog.setOnCreate(insertMediaListener);
dialog.show();
+ hideLinkCtxMenu();
}
});
}
@@ -659,7 +665,6 @@
insertMedia.setTextDescription(i18n.t("Audio/Video..."));
insertMedia.setAddCondition(canBeExtended);
insertMedia.setParentMenuTitle(i18n.t(INSERT_MENU));
-
ActionToolbarButtonDescriptor<Object> createOrEditLinkBtn = new ActionToolbarButtonDescriptor<Object>(
accessRol, sndbarPosition, new Listener0() {
public void onEvent() {
@@ -681,6 +686,7 @@
dialog.setLinkInfo(linkInfo);
dialog.setOnCreateLink(insertLinkListener);
dialog.show();
+ hideLinkCtxMenu();
String href = linkInfo.getHref();
if (href.length() > 0) {
if (href.startsWith("mailto")) {
@@ -711,13 +717,23 @@
editLinkCtx.setToolTip(null);
editLinkCtx.setShortcut(null);
editLinkCtx.setActionPosition(linkCtxPosition);
- editLinkCtx.setParentMenuTitle(i18n.t(INSERT_MENU));
ActionToolbarButtonDescriptor<Object> removeLink = new ActionToolbarButtonDescriptor<Object>(accessRol,
sndbarPosition, new Listener0() {
public void onEvent() {
- view.unlink();
- fireOnEdit();
+ if (view.isAnythingSelected()) {
+ // we try to unlink the selection
+ } else {
+ // we try to select the complete link
+ view.selectLink();
+ }
+ deferred.addCommand(new Listener0() {
+ public void onEvent() {
+ view.unlink();
+ hideLinkCtxMenu();
+ fireOnEdit();
+ }
+ });
}
});
removeLink.setIconCls(getCssName(imgResources.linkbreak()));
@@ -730,7 +746,6 @@
removeLinkCtx.setToolTip(null);
removeLinkCtx.setShortcut(null);
removeLinkCtx.setActionPosition(linkCtxPosition);
- removeLinkCtx.setParentMenuTitle(i18n.t(INSERT_MENU));
final ActionToolbarMenuDescriptor<Object> removeFormat = new ActionToolbarMenuDescriptor<Object>(accessRol,
topbarPosition, new Listener0() {
@@ -772,6 +787,7 @@
}
insertSpecialCharDialog.get().setOnInsertSpecialChar(insertSpecialCharListener);
insertSpecialCharDialog.get().show();
+ hideLinkCtxMenu();
NotifyUser.hideProgress();
}
});
@@ -805,14 +821,16 @@
final ActionToolbarButtonDescriptor<Object> fontColor = new ActionToolbarButtonDescriptor<Object>(accessRol,
sndbarPosition, new Listener0() {
public void onEvent() {
- palette.get().show(getActionLeftPosition(sndBar, insertTableBtn),
- getActionTopPosition(sndBar, removeFormatBtn), new Listener<String>() {
- public void onEvent(final String color) {
- palette.get().hide();
- view.setForeColor(color);
- fireOnEdit();
- }
- });
+ getPalette();
+ palette.show(getActionLeftPosition(sndBar, insertTableBtn), getActionTopPosition(sndBar,
+ removeFormatBtn), new Listener<String>() {
+ public void onEvent(final String color) {
+ palette.hide();
+ view.setForeColor(color);
+ fireOnEdit();
+ }
+ });
+ hideLinkCtxMenu();
}
});
fontColor.setIconCls(getCssName(imgResources.fontcolor()));
@@ -822,14 +840,16 @@
ActionToolbarButtonDescriptor<Object> backgroundColor = new ActionToolbarButtonDescriptor<Object>(accessRol,
sndbarPosition, new Listener0() {
public void onEvent() {
- palette.get().show(getActionLeftPosition(sndBar, fontColor),
- getActionTopPosition(sndBar, fontColor), new Listener<String>() {
+ getPalette();
+ palette.show(getActionLeftPosition(sndBar, fontColor), getActionTopPosition(sndBar, fontColor),
+ new Listener<String>() {
public void onEvent(final String color) {
- palette.get().hide();
+ palette.hide();
view.setBackColor(color);
fireOnEdit();
}
});
+ hideLinkCtxMenu();
}
});
backgroundColor.setIconCls(getCssName(imgResources.backcolor()));
@@ -904,8 +924,8 @@
actions.add(withNoItem(fontColor));
actions.add(withNoItem(backgroundColor));
+ view.addCtxAction(withNoItem(removeLinkCtx));
view.addCtxAction(withNoItem(editLinkCtx));
- view.addCtxAction(withNoItem(removeLinkCtx));
}
private ActionToolbarMenuDescriptor<Object> createFontNameAction(final ActionAddCondition<Object> canBeBasic,
@@ -954,12 +974,26 @@
return RTEImgResources.SUFFIX + imageResource.getName();
}
+ private void getPalette() {
+ if (palette == null) {
+ palette = paletteProvider.get();
+ }
+ }
+
private void hideLinkCtxMenu() {
if (view.isCtxMenuVisible()) {
view.hideLinkCtxMenu();
}
}
+ private void hideMenus() {
+ topBar.hideAllMenus();
+ sndBar.hideAllMenus();
+ if (palette != null) {
+ palette.hide();
+ }
+ }
+
private boolean isExtended() {
return extended && view.canBeExtended();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -96,6 +96,8 @@
void selectAll();
+ void selectLink();
+
void setBackColor(String color);
void setFocus(boolean focus);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -39,9 +39,9 @@
ActionToolbarButtonDescriptor<Object> saveBtn;
private RTESavingEditorView view;
- public RTESavingEditorPresenter(RTEditor editor, final boolean autoSave, final I18nTranslationService i18n,
- StateManager stateManager, DeferredCommandWrapper deferredCommandWrapper,
- RTEImgResources imgResources, TimerWrapper timer) {
+ public RTESavingEditorPresenter(final RTEditor editor, final boolean autoSave, final I18nTranslationService i18n,
+ final StateManager stateManager, final DeferredCommandWrapper deferredCommandWrapper,
+ final RTEImgResources imgResources, final TimerWrapper timer) {
this.editor = editor;
this.autoSave = autoSave;
this.i18n = i18n;
@@ -70,7 +70,7 @@
};
}
- public void edit(String html, Listener<String> onSave, Listener0 onEditCancelled) {
+ public void edit(final String html, final Listener<String> onSave, final Listener0 onEditCancelled) {
this.onSave = onSave;
this.onEditCancelled = onEditCancelled;
editor.setHtml(html);
@@ -87,7 +87,7 @@
return beforeStateChangeListener;
}
- public void init(RTESavingEditorView view) {
+ public void init(final RTESavingEditorView view) {
this.view = view;
}
@@ -214,7 +214,7 @@
ActionToolbarMenuDescriptor<Object> close = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
RTEditor.topbarPosition, new Listener<Object>() {
- public void onEvent(Object parameter) {
+ public void onEvent(final Object parameter) {
onCancel();
}
});
@@ -252,7 +252,7 @@
editor.addAction(saveCloseBtn);
}
- private void enableSaveBtn(boolean enable) {
+ private void enableSaveBtn(final boolean enable) {
editor.getSndBar().setButtonEnable(saveBtn, enable);
}
@@ -265,5 +265,6 @@
savePending = false;
saveAndCloseConfirmed = false;
enableSaveBtn(false);
+ editor.reset();
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -108,6 +108,9 @@
@Basic(optional = false)
private final Long createdOn;
+ @Basic
+ private Long lastLogin;
+
public User() {
this(null, null, null, null, null, null, null);
}
@@ -125,6 +128,7 @@
customProperties = new CustomProperties();
buddiesVisibility = UserBuddiesVisibility.anyone;
this.createdOn = System.currentTimeMillis();
+ this.setLastLogin(null);
}
@Finder(query = "from User")
@@ -174,6 +178,10 @@
return language;
}
+ public Long getLastLogin() {
+ return lastLogin;
+ }
+
public String getName() {
return name;
}
@@ -224,6 +232,10 @@
this.language = language;
}
+ public void setLastLogin(final Long lastLogin) {
+ this.lastLogin = lastLogin;
+ }
+
public void setName(final String name) {
this.name = name;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -34,6 +34,7 @@
import org.ourproject.kune.chat.server.managers.ChatConnection;
import org.ourproject.kune.chat.server.managers.XmppManager;
import org.ourproject.kune.platf.client.errors.I18nNotFoundException;
+import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
import org.ourproject.kune.platf.server.domain.I18nCountry;
import org.ourproject.kune.platf.server.domain.I18nLanguage;
import org.ourproject.kune.platf.server.domain.User;
@@ -54,17 +55,19 @@
private final I18nLanguageManager languageManager;
private final XmppManager xmppManager;
private final ChatProperties properties;
+ private final I18nTranslationService i18n;
@Inject
public UserManagerDefault(final Provider<EntityManager> provider, final User finder,
final I18nLanguageManager languageManager, final I18nCountryManager countryManager,
- final XmppManager xmppManager, ChatProperties properties) {
+ final XmppManager xmppManager, final ChatProperties properties, final I18nTranslationService i18n) {
super(provider, User.class);
this.finder = finder;
this.languageManager = languageManager;
this.countryManager = countryManager;
this.xmppManager = xmppManager;
this.properties = properties;
+ this.i18n = i18n;
}
public User createUser(final String shortName, final String longName, final String email, final String passwd,
@@ -85,7 +88,7 @@
return userId != null ? super.find(userId) : User.UNKNOWN_USER;
}
- public User findByShortname(String shortName) {
+ public User findByShortname(final String shortName) {
return finder.getByShortName(shortName);
}
@@ -143,6 +146,15 @@
}
}
if (user.getPassword().equals(passwd)) {
+ if (user.getLastLogin() == null) {
+ xmppManager.sendMessage(
+ user.getShortName(),
+ i18n.t("This is the chat window. \n"
+ + "\n"
+ + "Here you can communicate with other users of this site but also with other users with compatible accounts (like gmail accounts). \n"
+ + "\n" + "Just add some buddie and start to chat."));
+ }
+ user.setLastLogin(System.currentTimeMillis());
return user;
} else {
return null;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/properties/ChatProperties.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/properties/ChatProperties.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/properties/ChatProperties.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -34,16 +34,23 @@
this.properties = properties;
}
- public String getHttpBase() {
- return properties.get(KuneProperties.CHAT_HTTP_BASE);
+ public String getAdminJID() {
+ return properties.get(KuneProperties.SITE_ADMIN_SHORTNAME);
}
+ public String getAdminPasswd() {
+ return properties.get(KuneProperties.SITE_ADMIN_PASSWD);
+ }
+
public String getDomain() {
return properties.get(KuneProperties.CHAT_DOMAIN);
}
+ public String getHttpBase() {
+ return properties.get(KuneProperties.CHAT_HTTP_BASE);
+ }
+
public String getRoomHost() {
return properties.get(KuneProperties.CHAT_ROOM_HOST);
}
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/properties/DatabaseProperties.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/properties/DatabaseProperties.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/properties/DatabaseProperties.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -34,31 +34,31 @@
this.properties = properties;
}
- public String getDefaultSiteShortName() {
- return properties.get("kune.default.site.shortName");
+ public String getAdminEmail() {
+ return properties.get(KuneProperties.SITE_ADMIN_EMAIL);
}
- public String getDefaultSiteName() {
- return properties.get("kune.default.site.name");
+ public String getAdminPassword() {
+ return properties.get(KuneProperties.SITE_ADMIN_PASSWD);
}
- public String getAdminUserName() {
- return properties.get("kune.admin.name");
+ public String getAdminShortName() {
+ return properties.get(KuneProperties.SITE_ADMIN_SHORTNAME);
}
- public String getAdminShortName() {
- return properties.get("kune.admin.shortName");
+ public String getAdminUserName() {
+ return properties.get(KuneProperties.SITE_ADMIN_NAME);
}
- public String getAdminEmail() {
- return properties.get("kune.admin.email");
+ public String getDefaultLicense() {
+ return properties.get(KuneProperties.SITE_DEF_LICENSE);
}
- public String getAdminPassword() {
- return properties.get("kune.admin.password");
+ public String getDefaultSiteName() {
+ return properties.get(KuneProperties.SITE_NAME);
}
- public String getDefaultLicense() {
- return properties.get("kune.default.license");
+ public String getDefaultSiteShortName() {
+ return properties.get(KuneProperties.SITE_SHORTNAME);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/properties/KuneProperties.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/properties/KuneProperties.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/properties/KuneProperties.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -22,6 +22,14 @@
public interface KuneProperties {
String SITE_URL = "kune.siteurl";
String SITE_DOMAIN = "kune.site.domain";
+ String SITE_NAME = "kune.default.site.name";
+ String SITE_SHORTNAME = "kune.default.site.shortName";
+ String SITE_DEF_LICENSE = "kune.default.license";
+
+ String SITE_ADMIN_NAME = "kune.admin.name";
+ String SITE_ADMIN_SHORTNAME = "kune.admin.shortName";
+ String SITE_ADMIN_EMAIL = "kune.admin.email";
+ String SITE_ADMIN_PASSWD = "kune.admin.password";
String DEFAULT_SITE_SHORT_NAME = "kune.default.site.shortName";
String CURRENT_CC_VERSION = "kune.currentccversion";
String CHAT_HTTP_BASE = "kune.chat.httpbase";
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -75,18 +75,18 @@
}
@Transactional(type = TransactionType.READ_WRITE, rollbackOn = DefaultException.class)
- public UserInfoDTO createUser(final UserDTO userDTO, boolean wantPersonalHomepage) throws DefaultException {
+ public UserInfoDTO createUser(final UserDTO userDTO, final boolean wantPersonalHomepage) throws DefaultException {
final User user = userManager.createUser(userDTO.getShortName(), userDTO.getName(), userDTO.getEmail(),
userDTO.getPassword(), userDTO.getLanguage().getCode(), userDTO.getCountry().getCode(),
userDTO.getTimezone().getId());
groupManager.createUserGroup(user, wantPersonalHomepage);
- return loginUser(user);
+ return login(userDTO.getShortName(), userDTO.getPassword());
}
@Authenticated
@Transactional(type = TransactionType.READ_ONLY)
@Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
- public String getUserAvatarBaser64(final String userHash, StateToken userToken) throws DefaultException {
+ public String getUserAvatarBaser64(final String userHash, final StateToken userToken) throws DefaultException {
final UserSession userSession = getUserSession();
final User user = userSession.getUser();
Group userGroup = user.getUserGroup();
@@ -133,7 +133,8 @@
@Authenticated(mandatory = true)
@Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
@Transactional(type = TransactionType.READ_WRITE)
- public void setBuddiesVisibility(final String userHash, StateToken groupToken, UserBuddiesVisibilityDTO visibility) {
+ public void setBuddiesVisibility(final String userHash, final StateToken groupToken,
+ final UserBuddiesVisibilityDTO visibility) {
final UserSession userSession = getUserSession();
final User user = userSession.getUser();
if (groupToken.getGroup() != user.getShortName()) {
Modified: trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerTest.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerTest.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -13,9 +13,7 @@
import com.google.inject.Inject;
public class XmppManagerTest {
-
public static class OutputListener implements RoomListener {
- Log log = LogFactory.getLog(OutputListener.class);
private final String name;
private int hits;
@@ -36,6 +34,8 @@
}
+ static Log log = LogFactory.getLog(XmppManagerTest.class);
+
@Inject
XmppManager manager;
@@ -81,6 +81,11 @@
assertNotNull(manager.getRoster(handler));
}
+ @Test
+ public void testSendMessage() {
+ manager.sendMessage("admin", "test message");
+ }
+
@Test(expected = ChatException.class)
public void testUserDontExist() {
manager.login("user", "passowrd", "test");
More information about the kune-commits
mailing list