From c0a2579654d7bfca7c4a74fcf337094d5b2f9286 Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Tue, 18 Jul 2006 14:50:00 +0000 Subject: [PATCH] Merge V1.3 to HEAD (2976:3004) svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@2976 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3004 . git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3335 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/messages/webclient.properties | 6 +- config/alfresco/web-client-config.xml | 4 +- .../web/app/servlet/CommandServlet.java | 2 +- .../org/alfresco/web/bean/LicenseBean.java | 128 ++++++++++++++++++ .../org/alfresco/web/bean/TrashcanBean.java | 2 + .../web/bean/actions/RunActionWizard.java | 15 +- .../web/bean/content/AddContentDialog.java | 45 +++++- .../alfresco/web/config/AspectEvaluator.java | 21 +-- .../org/alfresco/web/ui/repo/tag/PageTag.java | 21 +-- .../web/WEB-INF/faces-config-enterprise.xml | 24 ++++ source/web/WEB-INF/web.xml | 2 +- source/web/jsp/admin/admin-console.jsp | 3 + 12 files changed, 238 insertions(+), 35 deletions(-) create mode 100644 source/java/org/alfresco/web/bean/LicenseBean.java create mode 100644 source/web/WEB-INF/faces-config-enterprise.xml diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 0828398478..c7bed2b4c8 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -817,11 +817,11 @@ recover_listed_items=Recover Listed Items recover_listed_items_info=Recover the listed files and spaces from the deleted file store recover_listed_items_confirm=Are you sure you want to recover the following deleted files and spaces from the deleted file store? recovered_item_success=The item \"{0}\" has been successfully recovered. -recovered_item_parent=Failed to recover the item \"{0}\" as the original parent folder is missing, please select a new folder destination. +recovered_item_parent=Failed to recover the item \"{0}\" as the parent folder is missing, please select a new folder destination. recovered_item_parent_short=Parent folder missing -recovered_item_permission=Failed to recover the item \"{0}\" as you do not have the appropriate permissions to restore the item to the original parent folder, please select a new folder destination. +recovered_item_permission=Failed to recover the item \"{0}\" as you do not have the appropriate permissions to restore the item to the parent folder, please select a new folder destination. recovered_item_permission_short=No permissions to write -recovered_item_integrity=Failed to recover the item \"{0}\" as there is now an item in the original parent folder with the same name, please select a new folder destination. +recovered_item_integrity=Failed to recover the item \"{0}\" as there is now an item in the parent folder with the same name, please select a new folder destination. recovered_item_integrity_short=Item with same name exists recovered_item_failure=Failed to recover the item \"{0}\" due to error: {1} recovered_item_failure_short=Failed diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml index b771e92be1..58056f7637 100644 --- a/config/alfresco/web-client-config.xml +++ b/config/alfresco/web-client-config.xml @@ -129,9 +129,9 @@ - + - + diff --git a/source/java/org/alfresco/web/app/servlet/CommandServlet.java b/source/java/org/alfresco/web/app/servlet/CommandServlet.java index 2ccfb0ed40..0beb509ddc 100644 --- a/source/java/org/alfresco/web/app/servlet/CommandServlet.java +++ b/source/java/org/alfresco/web/app/servlet/CommandServlet.java @@ -47,7 +47,7 @@ import org.apache.commons.logging.LogFactory; * The 'processor-name' identifies the command processor to execute the command. For example the * 'workflow' processor will execute workflow commands upon a node (e.g. "approve" or "reject"). * For example: - *
/alfresco/command/workflow/approve/workspace/SpacesStore/0000-0000-0000-0000
+ * 
/alfresco/command/workflow/approve/workspace/SpacesStore/0000-0000-0000-0000
* The store protocol, followed by the store ID, followed by the content Node Id used to * identify the node to execute the workflow action upon. *

diff --git a/source/java/org/alfresco/web/bean/LicenseBean.java b/source/java/org/alfresco/web/bean/LicenseBean.java new file mode 100644 index 0000000000..8f599c804c --- /dev/null +++ b/source/java/org/alfresco/web/bean/LicenseBean.java @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Alfresco Network License. You may obtain a + * copy of the License at + * + * http://www.alfrescosoftware.com/legal/ + * + * Please view the license relevant to your network subscription. + * + * BY CLICKING THE "I UNDERSTAND AND ACCEPT" BOX, OR INSTALLING, + * READING OR USING ALFRESCO'S Network SOFTWARE (THE "SOFTWARE"), + * YOU ARE AGREEING ON BEHALF OF THE ENTITY LICENSING THE SOFTWARE + * ("COMPANY") THAT COMPANY WILL BE BOUND BY AND IS BECOMING A PARTY TO + * THIS ALFRESCO NETWORK AGREEMENT ("AGREEMENT") AND THAT YOU HAVE THE + * AUTHORITY TO BIND COMPANY. IF COMPANY DOES NOT AGREE TO ALL OF THE + * TERMS OF THIS AGREEMENT, DO NOT SELECT THE "I UNDERSTAND AND AGREE" + * BOX AND DO NOT INSTALL THE SOFTWARE OR VIEW THE SOURCE CODE. COMPANY + * HAS NOT BECOME A LICENSEE OF, AND IS NOT AUTHORIZED TO USE THE + * SOFTWARE UNLESS AND UNTIL IT HAS AGREED TO BE BOUND BY THESE LICENSE + * TERMS. THE "EFFECTIVE DATE" FOR THIS AGREEMENT SHALL BE THE DAY YOU + * CHECK THE "I UNDERSTAND AND ACCEPT" BOX. + */ +package org.alfresco.web.bean; + +import java.security.Principal; +import java.text.MessageFormat; +import java.util.Date; + +import javax.faces.context.FacesContext; + +import org.alfresco.service.descriptor.DescriptorService; +import org.alfresco.service.license.LicenseDescriptor; +import org.alfresco.web.app.Application; + +/** + * Backing Bean for the License Management pages. + * + * @author David Caruana + */ +public class LicenseBean +{ + + /** The DescriptorService to be used by the bean */ + private DescriptorService descriptorService; + + + + // ------------------------------------------------------------------------------ + // Bean property getters and setters + + /** + * @param descriptorService The DescriptorService to set. + */ + public void setDescriptorService(DescriptorService descriptorService) + { + this.descriptorService = descriptorService; + } + + + /** + * Gets the License Description + * + * @return license description + */ + public String getLicenseDescription() + { + String description = ""; + + LicenseDescriptor descriptor = descriptorService.getLicenseDescriptor(); + if (descriptor != null) + { + String subject = descriptor.getSubject(); + String holder = getHolderOrganisation(descriptor.getHolder()); + Date issued = descriptor.getIssued(); + Date validUntil = descriptor.getValidUntil(); + + if (validUntil == null) + { + description = Application.getMessage(FacesContext.getCurrentInstance(), "admin_unlimited_license"); + description = MessageFormat.format(description, new Object[] { subject, holder, issued }); + } + else + { + int days = descriptor.getDays(); + int remainingDays = descriptor.getRemainingDays(); + description = Application.getMessage(FacesContext.getCurrentInstance(), "admin_limited_license"); + description = MessageFormat.format(description, new Object[] { subject, holder, issued, days, validUntil, remainingDays }); + } + } + else + { + description = Application.getMessage(FacesContext.getCurrentInstance(), "admin_invalid_license"); + } + + return description; + } + + /** + * Get Organisation from Principal + * + * @param holderPrincipal + * @return organisation + */ + private String getHolderOrganisation(Principal holderPrincipal) + { + String holder = null; + if (holderPrincipal != null) + { + holder = holderPrincipal.getName(); + if (holder != null) + { + String[] properties = holder.split(","); + for (String property : properties) + { + String[] parts = property.split("="); + if (parts[0].equals("O")) + { + holder = parts[1]; + } + } + } + } + + return holder; + } + +} diff --git a/source/java/org/alfresco/web/bean/TrashcanBean.java b/source/java/org/alfresco/web/bean/TrashcanBean.java index 85e5d7c6cd..c3483ef394 100644 --- a/source/java/org/alfresco/web/bean/TrashcanBean.java +++ b/source/java/org/alfresco/web/bean/TrashcanBean.java @@ -61,6 +61,8 @@ import org.alfresco.web.ui.common.component.UIModeList; import org.alfresco.web.ui.common.component.data.UIRichList; /** + * Backing bean for the Manage Deleted Items (soft delete and archiving) pages. + * * @author Kevin Roast */ public class TrashcanBean implements IContextListener diff --git a/source/java/org/alfresco/web/bean/actions/RunActionWizard.java b/source/java/org/alfresco/web/bean/actions/RunActionWizard.java index d57d42955b..104f8b0322 100644 --- a/source/java/org/alfresco/web/bean/actions/RunActionWizard.java +++ b/source/java/org/alfresco/web/bean/actions/RunActionWizard.java @@ -14,6 +14,7 @@ import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.ActionDefinition; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.web.app.Application; +import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.QuickSort; @@ -89,7 +90,19 @@ public class RunActionWizard extends BaseActionWizard { // reset the current document properties/aspects in case we have changed them // during the execution of the custom action - this.browseBean.getDocument().reset(); + Node document = this.browseBean.getDocument(); + if (document != null) + { + document.reset(); + } + + // reset the current space properties/aspects as well in case we have + // changed them during the execution of the custom action + Node space = this.browseBean.getActionSpace(); + if (space != null) + { + space.reset(); + } return outcome; } diff --git a/source/java/org/alfresco/web/bean/content/AddContentDialog.java b/source/java/org/alfresco/web/bean/content/AddContentDialog.java index e3f6042431..dc18d4ce22 100644 --- a/source/java/org/alfresco/web/bean/content/AddContentDialog.java +++ b/source/java/org/alfresco/web/bean/content/AddContentDialog.java @@ -3,12 +3,17 @@ package org.alfresco.web.bean.content; import java.io.File; import java.io.Serializable; import java.text.MessageFormat; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; +import org.alfresco.config.Config; +import org.alfresco.config.ConfigElement; +import org.alfresco.config.ConfigService; import org.alfresco.model.ContentModel; import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.filestore.FileContentReader; @@ -26,6 +31,7 @@ import org.alfresco.web.bean.repository.Repository; */ public class AddContentDialog extends BaseContentWizard { + protected List inlineEditableMimeTypes; protected File file; // ------------------------------------------------------------------------------ @@ -53,7 +59,16 @@ public class AddContentDialog extends BaseContentWizard { this.title = this.fileName; } - + + // determine whether inline editing should be enabled by default. + // if the mime type of the added file is in the list of mime types + // configured in "Content Wizards" then enable inline editing + List mimeTypes = getInlineEditableMimeTypes(); + if (mimeTypes.contains(this.mimeType)) + { + this.inlineEdit = true; + } + saveContent(this.file, null); // return default outcome @@ -71,6 +86,8 @@ public class AddContentDialog extends BaseContentWizard @Override protected String doPostCommitProcessing(FacesContext context, String outcome) { + clearUpload(); + // as we were successful, go to the set properties dialog if asked // to otherwise just return if (this.showOtherProperties) @@ -214,4 +231,30 @@ public class AddContentDialog extends BaseContentWizard FacesContext ctx = FacesContext.getCurrentInstance(); ctx.getExternalContext().getSessionMap().remove(FileUploadBean.FILE_UPLOAD_BEAN_NAME); } + + protected List getInlineEditableMimeTypes() + { + if (this.inlineEditableMimeTypes == null) + { + this.inlineEditableMimeTypes = new ArrayList(8); + + // get the create mime types list from the config + ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance()); + Config wizardCfg = svc.getConfig("Content Wizards"); + if (wizardCfg != null) + { + ConfigElement typesCfg = wizardCfg.getConfigElement("create-mime-types"); + if (typesCfg != null) + { + for (ConfigElement child : typesCfg.getChildren()) + { + String currentMimeType = child.getAttribute("name"); + this.inlineEditableMimeTypes.add(currentMimeType); + } + } + } + } + + return this.inlineEditableMimeTypes; + } } diff --git a/source/java/org/alfresco/web/config/AspectEvaluator.java b/source/java/org/alfresco/web/config/AspectEvaluator.java index 2c52f24bf7..482af8af95 100644 --- a/source/java/org/alfresco/web/config/AspectEvaluator.java +++ b/source/java/org/alfresco/web/config/AspectEvaluator.java @@ -16,9 +16,10 @@ */ package org.alfresco.web.config; -import java.util.Set; +import javax.faces.context.FacesContext; import org.alfresco.config.evaluator.Evaluator; +import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.namespace.QName; import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; @@ -28,7 +29,7 @@ import org.alfresco.web.bean.repository.Repository; * * @author gavinc */ -public class AspectEvaluator implements Evaluator +public final class AspectEvaluator implements Evaluator { /** * Determines whether the given aspect is applied to the given object @@ -37,19 +38,19 @@ public class AspectEvaluator implements Evaluator */ public boolean applies(Object obj, String condition) { - boolean result = false; - if (obj instanceof Node) { - Set aspects = ((Node)obj).getAspects(); - if (aspects != null) + DictionaryService dd = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService(); + QName aspectQName = Repository.resolveToQName(condition); + for (QName aspect : ((Node)obj).getAspects()) { - QName spaceQName = Repository.resolveToQName(condition); - result = aspects.contains(spaceQName); + if (dd.isSubClass(aspect, aspectQName) == true) + { + return true; + } } } - return result; + return false; } - } diff --git a/source/java/org/alfresco/web/ui/repo/tag/PageTag.java b/source/java/org/alfresco/web/ui/repo/tag/PageTag.java index 633258fcff..a036e7a797 100644 --- a/source/java/org/alfresco/web/ui/repo/tag/PageTag.java +++ b/source/java/org/alfresco/web/ui/repo/tag/PageTag.java @@ -47,19 +47,9 @@ public class PageTag extends TagSupport */ private final static String ALF_URL = "http://www.alfresco.com"; - private final static String ALF_LOGO = "http://www.alfresco.com/images/alfresco_community_horizont.gif"; - private final static String SF_LOGO = "/images/logo/sflogo.php.png"; - private final static String ALF_TEXT = "Alfresco Community"; - private final static String ALF_COPY = "Supplied free of charge with " + - "no support, " + - "no certification, " + - "no maintenance, " + - "no warranty and " + - "no indemnity by " + - "Alfresco or its " + - "Certified Partners. " + - "Click here for support. " + - "Alfresco Software Inc. © 2005-2006 All rights reserved."; + private final static String ALF_LOGO = "/images/logo/alfresco_enterprise.gif"; + private final static String ALF_TEXT = "Alfresco Enterprise"; + private final static String ALF_COPY = "Certified and supported. Alfresco Software Inc. © 2005-2006 All rights reserved."; private static Log logger = LogFactory.getLog(PageTag.class); private static String alfresco = null; @@ -211,11 +201,10 @@ public class PageTag extends TagSupport String reqPath = ((HttpServletRequest)pageContext.getRequest()).getContextPath(); alfresco = "

" + "" + - "" + + "" + "" + "" + ALF_COPY + - "" + + "" + "
"; } diff --git a/source/web/WEB-INF/faces-config-enterprise.xml b/source/web/WEB-INF/faces-config-enterprise.xml new file mode 100644 index 0000000000..1c89638123 --- /dev/null +++ b/source/web/WEB-INF/faces-config-enterprise.xml @@ -0,0 +1,24 @@ + + + + + + + + + The bean that holds state for the License Manager. + + LicenseBean + org.alfresco.web.bean.LicenseBean + session + + descriptorService + #{DescriptorService} + + + + + + + diff --git a/source/web/WEB-INF/web.xml b/source/web/WEB-INF/web.xml index 643f854213..45e03798a7 100644 --- a/source/web/WEB-INF/web.xml +++ b/source/web/WEB-INF/web.xml @@ -16,7 +16,7 @@ javax.faces.CONFIG_FILES - /WEB-INF/faces-config-app.xml,/WEB-INF/faces-config-beans.xml,/WEB-INF/faces-config-navigation.xml,/WEB-INF/faces-config-common.xml,/WEB-INF/faces-config-repo.xml,WEB-INF/faces-config-custom.xml + /WEB-INF/faces-config-app.xml,/WEB-INF/faces-config-beans.xml,/WEB-INF/faces-config-navigation.xml,/WEB-INF/faces-config-common.xml,/WEB-INF/faces-config-repo.xml,WEB-INF/faces-config-custom.xml,/WEB-INF/faces-config-enterprise.xml diff --git a/source/web/jsp/admin/admin-console.jsp b/source/web/jsp/admin/admin-console.jsp index 1afb36f029..4b48d8c131 100644 --- a/source/web/jsp/admin/admin-console.jsp +++ b/source/web/jsp/admin/admin-console.jsp @@ -126,6 +126,9 @@ + + + <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "ballongrey"); %>