From d111cb3f1cd039cf24a006a2c793dee23a0984f5 Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Wed, 20 Jan 2010 10:22:18 +0000 Subject: [PATCH] Merged V3.2E to HEAD 17571: ETHREEOH-1863 - alfresco-webscript-framework.jar is not available in the alfresco-enterprise-sdk-3.1 - although the framework jar was already part of the SDK when I looked I have done some re-organising of - names and paths and added missing source files. By no means finished but its another step forward. 17581: Fix for ETHREEOH-3380 - upload servlet in Explorer does not handle well upload errors as no error message is displayed on the client browser. 17582: ETHREEOH-2760 - Sealing of standard library root scope objects to prevent script potentially interfering with another scripts processing. - Example provided to fix ACT ticket issue against fixed codeline. 17583: Fixed ETHREEOH-3458 "If the rss feed to display returns bad formatted data or is unavailable an ugly free marker error is displayed" - Rss urls pointing to a "missing resource"/"bad formated rss data" is now displayed as "Rss feed is unavailable"/"Can't read rss feed" (before they displayed freemarker error making it impossible to re-configure) - Title is now updated after config (therefore the change to return json instead of html) (before a page refresh was needed) - The new url is now updated in the "2nd" config dialog after it has been changed in the first (before page refresh was needed) - Removed un-internationalised string from config respons template 17584: ALFCOM-3675 - WebDAV script does not allow inline editing for documents with name in upper case. - Now allows any case, as per supplied patch. - Also added support for Office 2007 file types so they can now be opened in write mode via webdav in IE6/7 from the Explorer client. - Tested in IE6/7. 17585: Yet another fix for ETHREEOH-1733 - agenda view all days events fixed 17586: ETHREEOH-1843: /api/sites/*/memberships search is slow on specific query 17587: Add cluster lock for JPBM job/timer executor (for WCM submits in a clustered env - ETHREEOH-2230 / ETHREEOH-3319) 17590: New icons for View Original & View Working Copy actions 17591: ETHREEOH-2879 - Alfresco + OpenLDAP: Unable to retrieve user from repository. - Fixed SURF to handle users without (utterly bizarely) First or Last names or even, usefully, neither. 17592: Merged V3.2 to V3.1 17415: Fix for ETHREEOH-3293 - Editing user details on large user repository causes Hibernate exception. Fix for ETHREEOH-3294 - Extreemly slow repository performance adding a new user to large user repository via the Explorer Client admin console. 17593: Icon for doclib View In Browser action 17594: ETHREEOH-2864 - Share - Documents cannot be deleted (in "All Documents" view) 17595: ETHREEOH-3203: Impossibility to add comment to any object by SiteContributor user 17596: ETHREEOH-1469 - SMTP errors not reported when sending an invitation - now errors are reported. - may upset unit tests, i've fixed those I know about 17598: Fixed ETHREEOH-3445 "Admin Console - Group Search sometimes never displays results list" 17601: ETHREEOH-3382 - Share Sites menu is broken in "debug" mode. Reworked menu css. Removed unused footer component. 17602: Share global debug flags removed from web-framework-config-application.xml. Use share-config-custom.xml instead. 17603: Changed wording on Create/Edit Site dialogs from "Access" to "Visibility". "Access" was no longer accurate now that Moderated Sites' content is private to non-members. 17604: ETHREEOH-1469 - SMTP error when sending an invitation does not return a failure. - SiteServiceTest also needed "fixing" 17606: ETHREEOH-3475 - IE: Second search on add groups to site gets yui error but works. Related to YUI bug 2286608. YUI patched instead of all DataTable client code. (Patch removed from DocLib) 17607: ETHREEOH-3470 - "Add" button is unavailable if the group with the name of more than 60 characters is found 17608: Fixed invalid use of Forms validator. Validators updated to handle specific case anyway. 17610: Fixed ETHREEOH-3445 "Admin Console - Group Search sometimes never displays results list" - missed commit of non-default theme files 17612: Fixed ETHREEOH-3480 "Browse" button no longer works after Groups Admin console page is refreshed 17613: ETHREEOH-3450 Fixed illegal nested comment in web-client-config-custom.xml.sample 17616: Fix for ETHREEOH-2863 - Code cache memory leak observed in JVM 1.6 when script action calls another script which in turn calls other functions. - Fixed use of Rhino optimization level when executing string based scripts. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18160 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../web-client-config-custom.xml.sample | 3 +- .../web/app/servlet/UploadFileServlet.java | 56 ++++++++++++++++--- .../web/bean/users/CreateUserWizard.java | 21 +++---- source/web/scripts/webdav.js | 26 ++++++--- 4 files changed, 73 insertions(+), 33 deletions(-) diff --git a/config/alfresco/extension/web-client-config-custom.xml.sample b/config/alfresco/extension/web-client-config-custom.xml.sample index 1087bed54f..d7ac00b077 100644 --- a/config/alfresco/extension/web-client-config-custom.xml.sample +++ b/config/alfresco/extension/web-client-config-custom.xml.sample @@ -104,7 +104,6 @@ - @@ -135,4 +134,4 @@ --> - + \ No newline at end of file diff --git a/source/java/org/alfresco/web/app/servlet/UploadFileServlet.java b/source/java/org/alfresco/web/app/servlet/UploadFileServlet.java index 8b3781046f..cd1f54a477 100644 --- a/source/java/org/alfresco/web/app/servlet/UploadFileServlet.java +++ b/source/java/org/alfresco/web/app/servlet/UploadFileServlet.java @@ -39,6 +39,7 @@ import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.repo.content.MimetypeMap; import org.alfresco.util.TempFileProvider; import org.alfresco.web.app.Application; +import org.alfresco.web.bean.ErrorBean; import org.alfresco.web.bean.FileUploadBean; import org.alfresco.web.config.ClientConfigElement; import org.apache.commons.fileupload.FileItem; @@ -220,24 +221,61 @@ public class UploadFileServlet extends BaseServlet { // finally redirect if (logger.isDebugEnabled()) - { logger.debug("redirecting to: " + returnPage); - } response.sendRedirect(returnPage); } + + if (logger.isDebugEnabled()) + logger.debug("upload complete"); } catch (Throwable error) { - Application.handleServletError(getServletContext(), (HttpServletRequest)request, - (HttpServletResponse)response, error, logger, returnPage); - } - - if (logger.isDebugEnabled()) - { - logger.debug("upload complete"); + handleUploadException(request, response, error, returnPage); } } + + private void handleUploadException(HttpServletRequest request, HttpServletResponse response, Throwable error, String returnPage) + { + try + { + HttpSession session = request.getSession(true); + ErrorBean errorBean = (ErrorBean) session.getAttribute(ErrorBean.ERROR_BEAN_NAME); + if (errorBean == null) + { + errorBean = new ErrorBean(); + session.setAttribute(ErrorBean.ERROR_BEAN_NAME, errorBean); + } + errorBean.setLastError(error); + errorBean.setReturnPage(returnPage); + } + catch (Throwable e) + { + logger.error("Error while handling upload Exception", e); + } + try + { + String errorPage = Application.getErrorPage(getServletContext()); + + if (logger.isDebugEnabled()) + { + logger.debug("An error has occurred. Sending back response for redirecting to error page: " + errorPage); + } + + response.setContentType(MimetypeMap.MIMETYPE_HTML); + response.setCharacterEncoding("utf-8"); + final PrintWriter out = response.getWriter(); + out.println(" "); + out.close(); + } + catch (Exception e) + { + logger.error("Error while handling upload Exception", e); + } + } + private boolean allowZeroByteFiles() { diff --git a/source/java/org/alfresco/web/bean/users/CreateUserWizard.java b/source/java/org/alfresco/web/bean/users/CreateUserWizard.java index 43123d27ed..d597fa1ec7 100644 --- a/source/java/org/alfresco/web/bean/users/CreateUserWizard.java +++ b/source/java/org/alfresco/web/bean/users/CreateUserWizard.java @@ -698,21 +698,16 @@ public class CreateUserWizard extends BaseWizardBean // check for existance of home space with same name - return immediately // if it exists or throw an exception an give user chance to enter another name - // TODO: this might be better replaced with an XPath query! - List children = this.getNodeService().getChildAssocs(parentRef); - for (ChildAssociationRef ref : children) + NodeRef childRef = this.getNodeService().getChildByName(parentRef, ContentModel.ASSOC_CONTAINS, spaceName); + if (childRef != null) { - String childNodeName = (String) this.getNodeService().getProperty(ref.getChildRef(), ContentModel.PROP_NAME); - if (spaceName.equals(childNodeName)) + if (error) { - if (error) - { - throw new AlfrescoRuntimeException("A Home Space with the same name already exists."); - } - else - { - return ref.getChildRef(); - } + throw new AlfrescoRuntimeException("A Home Space with the same name already exists."); + } + else + { + return childRef; } } diff --git a/source/web/scripts/webdav.js b/source/web/scripts/webdav.js index b6823ea4c3..9d624ff9d0 100644 --- a/source/web/scripts/webdav.js +++ b/source/web/scripts/webdav.js @@ -12,25 +12,33 @@ function openDoc(url) // have to rely on the context path being passed in an anyway) var contextPath = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 1)); var fullUrl = window.location.protocol + "//" + window.location.host + contextPath + url; + var lowerUrl = url.toLowerCase(); // if the link represents an Office document and we are in IE try and // open the file directly to get WebDAV editing capabilities if (agent.indexOf("msie") != -1) { - if (fullUrl.indexOf(".doc") != -1 || - fullUrl.indexOf(".dot") != -1 || - fullUrl.indexOf(".xls") != -1 || - fullUrl.indexOf(".ppt") != -1) + if (lowerUrl.indexOf(".doc") != -1 || lowerUrl.indexOf(".docx") != -1 || + lowerUrl.indexOf(".xls") != -1 || lowerUrl.indexOf(".xlsx") != -1 || + lowerUrl.indexOf(".ppt") != -1 || lowerUrl.indexOf(".pptx") != -1 || + lowerUrl.indexOf(".dot") != -1 || lowerUrl.indexOf(".dotx") != -1) { - var wordDoc = new ActiveXObject("SharePoint.OpenDocuments.1"); - if (wordDoc) + try { - showDoc = false; - wordDoc.EditDocument(fullUrl); + var wordDoc = new ActiveXObject("SharePoint.OpenDocuments.1"); + if (wordDoc) + { + showDoc = false; + wordDoc.EditDocument(fullUrl); + } + } + catch(e) + { + showDoc = true; } } } - + if (showDoc == true) { window.open(fullUrl, "_blank");