diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 202dc788b9..48e00c57e8 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -97,6 +97,7 @@ has_following_categories_space=This space has the following categories applied.. moved=moved copied=copied clipboard=Clipboard +node_added_clipboard=An item was added to the clipboard. There are now {0} item(s) in the clipboard. Click ''Paste All'' in the ''More Actions'' menu to add the items to your current location. recent_spaces=Recent Spaces shortcuts=Shortcuts company_home=Company Home diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml index 1153ef1020..7db5a2c7da 100644 --- a/config/alfresco/web-client-config.xml +++ b/config/alfresco/web-client-config.xml @@ -75,6 +75,11 @@ alfresco@alfresco.org + + + + true + true diff --git a/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java b/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java index 08b8e01adb..897b58d4cd 100644 --- a/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java +++ b/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java @@ -16,10 +16,12 @@ */ package org.alfresco.web.bean.clipboard; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; import java.util.Map; +import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; @@ -135,6 +137,8 @@ public class ClipboardBean */ private void performPasteItems(int index, int action) { + FacesContext context = FacesContext.getCurrentInstance(); + try { if (index == -1) @@ -152,7 +156,12 @@ public class ClipboardBean } } } - // TODO: after a paste all - remove items from the clipboard...? or not. ask linton + + // if configured to do so clear the clipboard after a paste all + if (Application.getClientConfig(context).isPasteAllAndClearEnabled()) + { + this.items.clear(); + } } else { @@ -169,12 +178,12 @@ public class ClipboardBean } // refresh UI on success - UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); + UIContextService.getInstance(context).notifyBeans(); } catch (Throwable err) { - Utils.addErrorMessage(Application.getMessage( - FacesContext.getCurrentInstance(), MSG_ERROR_PASTE) + err.getMessage(), err); + Utils.addErrorMessage(Application.getMessage(context, + MSG_ERROR_PASTE) + err.getMessage(), err); } } @@ -268,6 +277,16 @@ public class ClipboardBean { items.add(item); } + + // add a message to inform the user of the clipboard state now if configured + FacesContext context = FacesContext.getCurrentInstance(); + if (Application.getClientConfig(context).isClipboardStatusVisible()) + { + String pattern = Application.getMessage(context, "node_added_clipboard"); + String msg = MessageFormat.format(pattern, items.size()); + FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); + context.addMessage(null, facesMsg); + } } } } diff --git a/source/java/org/alfresco/web/config/ClientConfigElement.java b/source/java/org/alfresco/web/config/ClientConfigElement.java index c534861dc5..3f6d38634f 100644 --- a/source/java/org/alfresco/web/config/ClientConfigElement.java +++ b/source/java/org/alfresco/web/config/ClientConfigElement.java @@ -56,9 +56,11 @@ public class ClientConfigElement extends ConfigElementAdapter private String homeSpacePermission = null; private boolean ajaxEnabled = false; private String initialLocation = "myalfresco"; - private ExpiringValueCache wcmDomain = new ExpiringValueCache(1000*10L); - private ExpiringValueCache wcmPort = new ExpiringValueCache(1000*10L); + private ExpiringValueCache wcmDomain = new ExpiringValueCache(1000*10L); + private ExpiringValueCache wcmPort = new ExpiringValueCache(1000*10L); private String defaultHomeSpacePath = "/app:company_home"; + private boolean clipboardStatusVisible = true; + private boolean pasteAllAndClear = true; private boolean allowGuestConfig = false; /** @@ -164,6 +166,16 @@ public class ClientConfigElement extends ConfigElementAdapter combinedElement.setShelfVisible(newElement.isShelfVisible()); } + if (newElement.isClipboardStatusVisible() != combinedElement.isClipboardStatusVisible()) + { + combinedElement.setClipboardStatusVisible(newElement.isClipboardStatusVisible()); + } + + if (newElement.isPasteAllAndClearEnabled() != combinedElement.isPasteAllAndClearEnabled()) + { + combinedElement.setPasteAllAndClearEnabled(newElement.isPasteAllAndClearEnabled()); + } + if (newElement.getFromEmailAddress() != null && (newElement.getFromEmailAddress().equals(combinedElement.getFromEmailAddress()) == false)) { @@ -220,6 +232,39 @@ public class ClientConfigElement extends ConfigElementAdapter { this.shelfVisible = shelfVisible; } + + /** + * @return Returns if the clipboard status messages are visible by default. + */ + public boolean isClipboardStatusVisible() + { + return this.clipboardStatusVisible; + } + + /** + * @param clipboardStatusVisible True if the clipboard status messages should be visible. + */ + /*package*/ void setClipboardStatusVisible(boolean clipboardStatusVisible) + { + this.clipboardStatusVisible = clipboardStatusVisible; + } + + /** + * @return Returns if the clipboard paste all action should clear the clipboard. + */ + public boolean isPasteAllAndClearEnabled() + { + return this.pasteAllAndClear; + } + + /** + * @param pasteAllAndClear Sets whether the paste all action should clear all items + * from the clipboard. + */ + /*package*/ void setPasteAllAndClearEnabled(boolean pasteAllAndClear) + { + this.pasteAllAndClear = pasteAllAndClear; + } /** * @return The error page the application should use diff --git a/source/java/org/alfresco/web/config/ClientElementReader.java b/source/java/org/alfresco/web/config/ClientElementReader.java index 82c8a35d95..6c8a6b3846 100644 --- a/source/java/org/alfresco/web/config/ClientElementReader.java +++ b/source/java/org/alfresco/web/config/ClientElementReader.java @@ -43,6 +43,8 @@ public class ClientElementReader implements ConfigElementReader public static final String ELEMENT_AJAX_ENABLED = "ajax-enabled"; public static final String ELEMENT_INITIALLOCATION = "initial-location"; public static final String ELEMENT_DEFAULTHOMESPACEPATH = "default-home-space-path"; + public static final String ELEMENT_CLIPBOARDSTATUS = "clipboard-status-visible"; + public static final String ELEMENT_PASTEALLANDCLEAR = "paste-all-and-clear"; public static final String ELEMENT_GUESTCONFIG = "allow-guest-config"; /** @@ -171,6 +173,22 @@ public class ClientElementReader implements ConfigElementReader configElement.setDefaultHomeSpacePath(defaultHomeSpacePath.getTextTrim()); } + // get the default visibility of the clipboard status messages + Element clipboardStatusVisible = element.element(ELEMENT_CLIPBOARDSTATUS); + if (clipboardStatusVisible != null) + { + configElement.setClipboardStatusVisible(Boolean.parseBoolean( + clipboardStatusVisible.getTextTrim())); + } + + // get the default setting for the paste all action, should it clear the clipboard after? + Element pasteAllAndClear = element.element(ELEMENT_PASTEALLANDCLEAR); + if (pasteAllAndClear != null) + { + configElement.setPasteAllAndClearEnabled(Boolean.parseBoolean( + pasteAllAndClear.getTextTrim())); + } + // get allow Guest to configure start location preferences Element guestConfigElement = element.element(ELEMENT_GUESTCONFIG); if (guestConfigElement != null) diff --git a/source/java/org/alfresco/web/ui/common/renderer/ErrorsRenderer.java b/source/java/org/alfresco/web/ui/common/renderer/ErrorsRenderer.java index ee31e3e172..c8f8987fb7 100644 --- a/source/java/org/alfresco/web/ui/common/renderer/ErrorsRenderer.java +++ b/source/java/org/alfresco/web/ui/common/renderer/ErrorsRenderer.java @@ -55,6 +55,8 @@ public class ErrorsRenderer extends BaseRenderer ResponseWriter out = context.getResponseWriter(); String contextPath = context.getExternalContext().getRequestContextPath(); String styleClass = (String)component.getAttributes().get("styleClass"); + String errorClass = (String)component.getAttributes().get("errorClass"); + String infoClass = (String)component.getAttributes().get("infoClass"); String message = (String)component.getAttributes().get("message"); if (message == null) @@ -75,27 +77,57 @@ public class ErrorsRenderer extends BaseRenderer PanelGenerator.generatePanelStart(out, contextPath, "yellowInner", "#ffffcc"); - out.write("\n"); - out.write("Error  "); - out.write(Utils.encode(message)); - out.write("\n
    "); - while (messages.hasNext()) + // if we have a message to display show it next to the info icon + if (message.length() > 0) { - FacesMessage fm = (FacesMessage)messages.next(); - out.write("
  • "); - out.write(Utils.encode(fm.getSummary())); - out.write("
  • \n"); + out.write("Error  "); + out.write(Utils.encode(message)); + out.write("\n
      "); + + while (messages.hasNext()) + { + FacesMessage fm = (FacesMessage)messages.next(); + out.write(""); + out.write(Utils.encode(fm.getSummary())); + out.write("\n"); + } + + out.write("
    "); + } + else + { + // if there is no title message to display use a table to place + // the info icon on the left and the list of messages on the right + out.write("
    Error"); + out.write(""); + + while (messages.hasNext()) + { + FacesMessage fm = (FacesMessage)messages.next(); + out.write("
    "); + out.write(Utils.encode(fm.getSummary())); + out.write("
    \n"); + } + + out.write("
    "); } - out.write("
\n"); + out.write("\n"); PanelGenerator.generatePanelEnd(out, contextPath, "yellowInner"); @@ -111,4 +143,31 @@ public class ErrorsRenderer extends BaseRenderer { return false; } + + /** + * Renders the attributes for the given FacesMessage. + */ + private void renderMessageAttrs(FacesMessage fm, ResponseWriter out, + String errorClass, String infoClass) throws IOException + { + // use the error class if the message is error level + if (errorClass != null && + fm.getSeverity() == FacesMessage.SEVERITY_ERROR || + fm.getSeverity() == FacesMessage.SEVERITY_FATAL) + { + out.write(" class='"); + out.write(errorClass); + out.write("'"); + } + + // use the info class if the message is info level + if (infoClass != null && + fm.getSeverity() == FacesMessage.SEVERITY_INFO || + fm.getSeverity() == FacesMessage.SEVERITY_WARN) + { + out.write(" class='"); + out.write(infoClass); + out.write("'"); + } + } } diff --git a/source/java/org/alfresco/web/ui/common/tag/ErrorsTag.java b/source/java/org/alfresco/web/ui/common/tag/ErrorsTag.java index f279cfc9d8..0abbcfddee 100644 --- a/source/java/org/alfresco/web/ui/common/tag/ErrorsTag.java +++ b/source/java/org/alfresco/web/ui/common/tag/ErrorsTag.java @@ -21,6 +21,8 @@ import javax.faces.component.UIComponent; public class ErrorsTag extends HtmlComponentTag { private String message; + private String errorClass; + private String infoClass; /** * @see javax.faces.webapp.UIComponentTag#getComponentType() @@ -46,6 +48,8 @@ public class ErrorsTag extends HtmlComponentTag super.setProperties(component); setStringProperty(component, "message", this.message); + setStringProperty(component, "errorClass", this.errorClass); + setStringProperty(component, "infoClass", this.infoClass); } /** @@ -55,4 +59,20 @@ public class ErrorsTag extends HtmlComponentTag { this.message = message; } + + /** + * @param errorClass The CSS class to use for error messages + */ + public void setErrorClass(String errorClass) + { + this.errorClass = errorClass; + } + + /** + * @param infoClass The CSS class to use for info messages + */ + public void setInfoClass(String infoClass) + { + this.infoClass = infoClass; + } } diff --git a/source/web/WEB-INF/alfresco.tld b/source/web/WEB-INF/alfresco.tld index 0908936416..5f705c3c03 100644 --- a/source/web/WEB-INF/alfresco.tld +++ b/source/web/WEB-INF/alfresco.tld @@ -1470,6 +1470,18 @@ true + + infoClass + false + true + + + + errorClass + false + true + + style false diff --git a/source/web/jsp/browse/browse.jsp b/source/web/jsp/browse/browse.jsp index 15bbfe1b75..4ce063ea67 100644 --- a/source/web/jsp/browse/browse.jsp +++ b/source/web/jsp/browse/browse.jsp @@ -202,6 +202,16 @@ + <%-- Error Messages --%> + + + + <%-- messages tag to show messages not handled by other specific message tags --%> + + + + + <%-- Custom Template View --%> @@ -487,16 +497,6 @@ - <%-- Error Messages --%> - - - - <%-- messages tag to show messages not handled by other specific message tags --%> - - - - - <%-- separator row with bottom panel graphics --%> diff --git a/source/web/jsp/dialog/document-details.jsp b/source/web/jsp/dialog/document-details.jsp index 48abacb3ec..da42c31550 100644 --- a/source/web/jsp/dialog/document-details.jsp +++ b/source/web/jsp/dialog/document-details.jsp @@ -117,6 +117,16 @@ + <%-- Error Messages --%> + + + + <%-- messages tag to show messages not handled by other specific message tags --%> + + + + + <%-- Details --%> @@ -227,7 +237,6 @@ action="#{DocumentDetailsBean.applyInlineEditable}" rendered="#{DocumentDetailsBean.inlineEditable == false}" /> - @@ -259,7 +268,6 @@ columns="1" mode="view" labelStyleClass="propertiesLabel" externalConfig="true" /> - diff --git a/source/web/jsp/dialog/space-details.jsp b/source/web/jsp/dialog/space-details.jsp index e6a988817d..33a9da3cdc 100644 --- a/source/web/jsp/dialog/space-details.jsp +++ b/source/web/jsp/dialog/space-details.jsp @@ -105,6 +105,16 @@ + <%-- Error Messages --%> + + + + <%-- messages tag to show messages not handled by other specific message tags --%> + + + + + <%-- Details --%> @@ -205,7 +215,6 @@ - diff --git a/source/web/jsp/forums/forum.jsp b/source/web/jsp/forums/forum.jsp index 05492473f3..d8b25c9c89 100644 --- a/source/web/jsp/forums/forum.jsp +++ b/source/web/jsp/forums/forum.jsp @@ -113,6 +113,16 @@ + <%-- Error Messages --%> + + + + <%-- messages tag to show messages not handled by other specific message tags --%> + + + + + <%-- Details - Topics --%> @@ -175,16 +185,6 @@ - <%-- Error Messages --%> - - - - <%-- messages tag to show messages not handled by other specific message tags --%> - - - - - <%-- separator row with bottom panel graphics --%> diff --git a/source/web/jsp/forums/forums.jsp b/source/web/jsp/forums/forums.jsp index ca1418f9a2..679396bb50 100644 --- a/source/web/jsp/forums/forums.jsp +++ b/source/web/jsp/forums/forums.jsp @@ -116,6 +116,16 @@ + <%-- Error Messages --%> + + + + <%-- messages tag to show messages not handled by other specific message tags --%> + + + + + <%-- Details - Forums --%> @@ -231,16 +241,6 @@ - <%-- Error Messages --%> - - - - <%-- messages tag to show messages not handled by other specific message tags --%> - - - - - <%-- separator row with bottom panel graphics --%> diff --git a/source/web/jsp/forums/topic.jsp b/source/web/jsp/forums/topic.jsp index b3754dfb00..8c4bbe832b 100644 --- a/source/web/jsp/forums/topic.jsp +++ b/source/web/jsp/forums/topic.jsp @@ -114,6 +114,16 @@ + <%-- Error Messages --%> + + + + <%-- messages tag to show messages not handled by other specific message tags --%> + + + + + <%-- Details - Posts --%> @@ -209,16 +219,6 @@ - <%-- Error Messages --%> - - - - <%-- messages tag to show messages not handled by other specific message tags --%> - - - - - <%-- separator row with bottom panel graphics --%>