diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl index d26b416ab1..f3a0979b5e 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl @@ -155,10 +155,10 @@ <#assign versionRow=versionRow+1> - Open ${record.versionLabel} + Open ${record.versionLabel} - ${record.versionLabel}
+ ${record.versionLabel}
Author: ${record.creator}
Date: ${record.createdDate?datetime}
<#if record.description?exists> diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.html.ftl index 133c13317b..2bcabd2d4d 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.html.ftl @@ -140,6 +140,7 @@ <#assign documentsFound = 0> <#list thisSpace.children?sort_by('name') as child> <#if child.isDocument> + <#assign isVersionable = (hasAspect(child, "cm:versionable") == 1)> <#assign documentsFound = documentsFound + 1> <#assign relativePath = (child.displayPath?substring(chLen+1) + '/' + child.name)?url?replace('%2F', '/')?replace('\'', '\\\'') />
@@ -152,7 +153,7 @@ <#if child.name?ends_with(extn) || child.name?ends_with(extnx)> - ${child.name} + ${child.name} <#else> ${child.name} diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebfiles.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebfiles.get.html.ftl index 27071e1af1..7011d4cd23 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebfiles.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebfiles.get.html.ftl @@ -28,6 +28,7 @@ <#assign storeId=wp.properties["wca:avmstore"]> <#assign username=person.properties.userName> <#assign sandbox=avm.userSandboxStore(storeId, username)> + <#if avm.lookupStore(sandbox)?exists>
${wp.name} @@ -72,6 +73,7 @@
+ diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms.get.html.ftl index 7b6bf0d67e..f5624471fd 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms.get.html.ftl @@ -28,6 +28,7 @@ <#assign storeId=wp.properties["wca:avmstore"]> <#assign username=person.properties.userName> <#assign sandbox=avm.userSandboxStore(storeId, username)> + <#if avm.lookupStore(sandbox)?exists>
${wp.name} @@ -56,6 +57,7 @@
+ diff --git a/source/java/org/alfresco/web/bean/search/SearchContext.java b/source/java/org/alfresco/web/bean/search/SearchContext.java index 7cf4d39048..22b7c9d889 100644 --- a/source/java/org/alfresco/web/bean/search/SearchContext.java +++ b/source/java/org/alfresco/web/bean/search/SearchContext.java @@ -502,21 +502,10 @@ public class SearchContext implements Serializable */ private static void processSearchAttribute(QName qname, String value, StringBuilder buf, boolean andOp, boolean notOp) { - if (value.indexOf(' ') == -1) - { - if (andOp) buf.append('+'); - else if (notOp) buf.append('-'); - buf.append('@').append(Repository.escapeQName(qname)).append(":") - .append(SearchContext.escape(value)).append(' '); - } - else - { - // phrase multi-word search - if (andOp) buf.append('+'); - else if (notOp) buf.append('-'); - buf.append('@').append(Repository.escapeQName(qname)).append(":\"") - .append(value).append('"').append(' '); - } + if (andOp) buf.append('+'); + else if (notOp) buf.append('-'); + buf.append('@').append(Repository.escapeQName(qname)).append(":\"") + .append(value).append("\" "); } /** @@ -530,9 +519,9 @@ public class SearchContext implements Serializable */ private static void processSearchTextAttribute(String qname, String value, StringBuilder attrBuf, StringBuilder textBuf) { - textBuf.append("TEXT:").append(SearchContext.escape(value)); - attrBuf.append("@").append(qname).append(":") - .append(SearchContext.escape(value)); + textBuf.append("TEXT:\"").append(value).append('"'); + attrBuf.append('@').append(qname).append(":\"") + .append(value).append('"'); } /** diff --git a/source/java/org/alfresco/web/bean/users/UsersDialog.java b/source/java/org/alfresco/web/bean/users/UsersDialog.java index 9974ebc9f0..ab6c31ad58 100644 --- a/source/java/org/alfresco/web/bean/users/UsersDialog.java +++ b/source/java/org/alfresco/web/bean/users/UsersDialog.java @@ -267,7 +267,7 @@ public class UsersDialog extends BaseDialogBean implements IContextListener, Cha UserTransaction tx = null; try { - tx = Repository.getUserTransaction(context, true); + tx = Repository.getUserTransaction(context); tx.begin(); Map props = properties.getNodeService().getProperties(properties.getPerson().getNodeRef()); diff --git a/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java b/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java index eb9eecb498..df9a7a4fbf 100644 --- a/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java +++ b/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java @@ -992,7 +992,7 @@ public abstract class BaseAssociationEditor extends UIInput if (contains != null && contains.length() > 0) { - String safeContains = QueryParser.escape(contains.trim()); + String safeContains = contains.trim(); // if the association's target is the person type search on the // firstName and lastName properties instead of the name property @@ -1002,9 +1002,9 @@ public abstract class BaseAssociationEditor extends UIInput query.append(safeContains); query.append("*\" @").append(NamespaceService.CONTENT_MODEL_PREFIX).append("\\:lastName:\"*"); query.append(safeContains); - query.append("*\" @").append(NamespaceService.CONTENT_MODEL_PREFIX).append("\\:userName:"); + query.append("*\" @").append(NamespaceService.CONTENT_MODEL_PREFIX).append("\\:userName:\""); query.append(safeContains); - query.append("*)"); + query.append("*\")"); } else { @@ -1012,7 +1012,7 @@ public abstract class BaseAssociationEditor extends UIInput String nameAttr = Repository.escapeQName(QName.createQName( NamespaceService.CONTENT_MODEL_1_0_URI, "name")); query.append(nameAttr); - query.append(":*" + safeContains + "*"); + query.append(":\"*" + safeContains + "*\""); } } diff --git a/source/web/scripts/office/navigation.js b/source/web/scripts/office/navigation.js index 16f0bfd7df..c2f62d4273 100644 --- a/source/web/scripts/office/navigation.js +++ b/source/web/scripts/office/navigation.js @@ -10,12 +10,14 @@ var OfficeNavigation = CREATE_SPACE_TEMPLATE: 16, OVERLAY_ANIM_LENGTH: 300, OVERLAY_OPACITY: 0.7, + documentNames: [], init: function() { $('overlayPanel').setStyle('opacity', 0); OfficeNavigation.setupToggles(); OfficeNavigation.setupCreateSpace(); + OfficeNavigation.getDocumentNames(); // Did we arrive here from the "Create collaboration space" shortcut? if (window.queryObject.cc) @@ -105,6 +107,16 @@ var OfficeNavigation = panel.setStyle('display', 'block'); panel.setStyle('height', panel.defaultHeight); }, + + getDocumentNames: function() + { + OfficeNavigation.documentNames = []; + + $$("#documentList .notVersionable").each(function(doc, i) + { + OfficeNavigation.documentNames.push(doc.getText()); + }); + }, showCreateSpace: function() { @@ -223,16 +235,20 @@ var OfficeNavigation = transition: Fx.Transitions.linear, onComplete: function() { - $('saveFilename').addEvent('keydown', function(event) + $('saveFilename').addEvent('keypress', function(event) { event = new Event(event); if (event.key == 'enter') { OfficeNavigation.saveOK(); + event.stop(); + $('saveFilename').removeEvent('keypress'); } else if (event.key == 'esc') { OfficeNavigation.saveCancel(); + event.stop(); + $('saveFilename').removeEvent('keypress'); } }); $('saveFilename').focus(); @@ -240,17 +256,43 @@ var OfficeNavigation = }).start({'opacity': 1}); this.fxOverlay.start(OfficeNavigation.OVERLAY_OPACITY); - this.popupPanel = panel; - this.popupPanel.currentPath = currentPath; + if (panel != null) + { + this.popupPanel = panel; + this.popupPanel.currentPath = currentPath; + } }, saveOK: function() { + // Shortcut for double-event firing issue + if (this.popupPanel == null) + { + return; + } + var filename = $('saveFilename').value; var currentPath = this.popupPanel.currentPath; + var cancelSave = false; + if (filename.length > 0) { - window.external.saveToAlfrescoAs(currentPath, filename); + // Trying to save over an existing non-versionable doc? + OfficeNavigation.documentNames.each(function(doc, i) + { + if ((doc == filename) || (doc == filename + ".doc")) + { + if (!confirm("The document exists and is not versionable. Overwrite this file?")) + { + cancelSave = true; + } + } + }); + + if (!cancelSave) + { + window.external.saveToAlfrescoAs(currentPath, filename); + } } OfficeNavigation.saveCancel(); },