Merged V2.1 to HEAD

6910: Fix for WCM-858, actions for files with an apostrophe in the name emit JavaScript errors
   6916: Fix to layout when My Spaces portlet follows on same page
   6919: Fix for AWC-1367 and AWC-1627
   6923: Added suport for datetime tokens in the lucene inedx
   6925: Fix for WCM-810
   6930: Fix for WCM-854
   Moved schema version to 110 and adjusted patch accordingly.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7343 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-11-12 14:08:11 +00:00
parent 1439ded6e0
commit 3cf0420a73
5 changed files with 92 additions and 37 deletions

View File

@@ -51,7 +51,7 @@
<th><a id="docFilter3" class="docfilterLink <#if filter=3>docfilterLinkSelected</#if>" href="#" onclick="MyDocs.filter(3); return false;"><span>PDF Documents</span></a></th> <th><a id="docFilter3" class="docfilterLink <#if filter=3>docfilterLinkSelected</#if>" href="#" onclick="MyDocs.filter(3); return false;"><span>PDF Documents</span></a></th>
<th><a id="docFilter4" class="docfilterLink <#if filter=4>docfilterLinkSelected</#if>" href="#" onclick="MyDocs.filter(4); return false;"><span>Recently Modified</span></a></th> <th><a id="docFilter4" class="docfilterLink <#if filter=4>docfilterLinkSelected</#if>" href="#" onclick="MyDocs.filter(4); return false;"><span>Recently Modified</span></a></th>
<th align=right> <th align=right>
<a href="#" onclick="MyDocs.refreshList(); return false;" class="refreshViewLink"><img src="${url.context}/images/icons/reset.gif" border="0" width="16" height="16" style="vertical-align:-25%;padding-right:4px">Refresh</a> <a href="#" onclick="MyDocs.refreshList(); return false;" class="docRefreshViewLink"><img src="${url.context}/images/icons/reset.gif" border="0" width="16" height="16" style="vertical-align:-25%;padding-right:4px">Refresh</a>
</th> </th>
</tr> </tr>
</table> </table>
@@ -93,11 +93,11 @@
<style type="text/css"> <style type="text/css">
a.docfilterLink, a.docfilterLink:hover a.docfilterLink, a.docfilterLink:hover
{ {
color: #8EA1B3; color: #8EA1B3 !important;
font-family: Trebuchet MS, Arial, Helvetica, sans-serif; font-family: Trebuchet MS, Arial, Helvetica, sans-serif !important;
font-size: 12px; font-size: 12px !important;
font-weight: bold; font-weight: bold !important;
text-decoration: none; text-decoration: none !important;
padding: 8px 4px 16px; padding: 8px 4px 16px;
outline: none; outline: none;
display: block; display: block;
@@ -209,11 +209,11 @@ a.docfilterLinkSelected:link, a.docfilterLinkSelected:visited
a.docItem, a.docItem:hover a.docItem, a.docItem:hover
{ {
font-family: Trebuchet MS, Arial, Helvetica, sans-serif; font-family: Trebuchet MS, Arial, Helvetica, sans-serif !important;
font-size: 14px; font-size: 14px !important;
color: #515D6B; color: #515D6B !important;
padding: 0px 8px 6px 8px; padding: 0px 8px 6px 8px;
text-decoration: none; text-decoration: none !important;
} }
.docIcon .docIcon
@@ -366,14 +366,14 @@ a.docItem, a.docItem:hover
overflow: hidden; overflow: hidden;
} }
a.refreshViewLink a.docRefreshViewLink
{ {
padding: 8px 4px 0px 0px; padding: 8px 4px 0px 0px;
display: block; display: block;
outline: none; outline: none;
} }
a.refreshViewLink:link, a.refreshViewLink:visited, a.refreshViewLink:hover a.docRefreshViewLink:link, a.docRefreshViewLink:visited, a.docRefreshViewLink:hover
{ {
font-family: Trebuchet MS, Arial, Helvetica, sans-serif; font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
font-size: 12px; font-size: 12px;

View File

@@ -38,6 +38,47 @@
ignore-if-missing="false" /> ignore-if-missing="false" />
</property-sheet> </property-sheet>
</config> </config>
<!-- WCM file and folder types, specified here so they appear first in the property sheet -->
<config evaluator="node-type" condition="wcm:avmplaincontent">
<property-sheet>
<show-property name="name" />
<show-property name="title" display-label-id="title"
ignore-if-missing="false" />
<show-property name="description" display-label-id="description"
ignore-if-missing="false" />
</property-sheet>
</config>
<config evaluator="node-type" condition="wcm:avmlayeredcontent">
<property-sheet>
<show-property name="name" />
<show-property name="title" display-label-id="title"
ignore-if-missing="false" />
<show-property name="description" display-label-id="description"
ignore-if-missing="false" />
</property-sheet>
</config>
<config evaluator="node-type" condition="wcm:avmplainfolder">
<property-sheet>
<show-property name="name" />
<show-property name="title" display-label-id="title"
ignore-if-missing="false" />
<show-property name="description" display-label-id="description"
ignore-if-missing="false" />
</property-sheet>
</config>
<config evaluator="node-type" condition="wcm:avmlayeredfolder">
<property-sheet>
<show-property name="name" />
<show-property name="title" display-label-id="title"
ignore-if-missing="false" />
<show-property name="description" display-label-id="description"
ignore-if-missing="false" />
</property-sheet>
</config>
<config evaluator="node-type" condition="dictionaryModel"> <config evaluator="node-type" condition="dictionaryModel">
<property-sheet> <property-sheet>
@@ -591,7 +632,7 @@
</property-sheet> </property-sheet>
</config> </config>
<!-- Configuration for wcm types and aspects --> <!-- Configuration for wcm types and aspects -->
<config evaluator="node-type" condition="wca:webfolder"> <config evaluator="node-type" condition="wca:webfolder">
<property-sheet> <property-sheet>
<show-property name="wca:avmstore" read-only="true" /> <show-property name="wca:avmstore" read-only="true" />

View File

@@ -185,13 +185,12 @@ public final class SearchContext implements Serializable
{ {
fullTextBuf.append(OP_NOT); fullTextBuf.append(OP_NOT);
nameAttrBuf.append(OP_NOT); nameAttrBuf.append(OP_NOT);
additionalAttrsBuf.append(OP_NOT);
} }
processSearchTextAttribute(nameAttr, text, nameAttrBuf, fullTextBuf); processSearchTextAttribute(nameAttr, text, nameAttrBuf, fullTextBuf);
for (QName qname : this.simpleSearchAdditionalAttrs) for (QName qname : this.simpleSearchAdditionalAttrs)
{ {
processSearchAttribute(qname, text, additionalAttrsBuf, false); processSearchAttribute(qname, text, additionalAttrsBuf, false, operatorNOT);
} }
} }
} }
@@ -243,20 +242,11 @@ public final class SearchContext implements Serializable
if (term.length() != 0) if (term.length() != 0)
{ {
// operators such as AND and OR are only make sense for full text searching
if (termCount != 0 && !operatorAND)
{
fullTextBuf.append("OR ");
nameAttrBuf.append("OR ");
additionalAttrsBuf.append("OR ");
}
// prepend NOT operator if supplied // prepend NOT operator if supplied
if (operatorNOT) if (operatorNOT)
{ {
fullTextBuf.append(OP_NOT); fullTextBuf.append(OP_NOT);
nameAttrBuf.append(OP_NOT); nameAttrBuf.append(OP_NOT);
additionalAttrsBuf.append(OP_NOT);
} }
// prepend AND operator if supplied // prepend AND operator if supplied
@@ -264,13 +254,12 @@ public final class SearchContext implements Serializable
{ {
fullTextBuf.append(OP_AND); fullTextBuf.append(OP_AND);
nameAttrBuf.append(OP_AND); nameAttrBuf.append(OP_AND);
additionalAttrsBuf.append(OP_AND);
} }
processSearchTextAttribute(nameAttr, term, nameAttrBuf, fullTextBuf); processSearchTextAttribute(nameAttr, term, nameAttrBuf, fullTextBuf);
for (QName qname : this.simpleSearchAdditionalAttrs) for (QName qname : this.simpleSearchAdditionalAttrs)
{ {
processSearchAttribute(qname, term, additionalAttrsBuf, false); processSearchAttribute(qname, term, additionalAttrsBuf, operatorAND, operatorNOT);
} }
fullTextBuf.append(' '); fullTextBuf.append(' ');
@@ -306,10 +295,6 @@ public final class SearchContext implements Serializable
{ {
for (int i=0; i<categories.length; i++) for (int i=0; i<categories.length; i++)
{ {
if (i > 0)
{
pathQuery.append("OR");
}
pathQuery.append(" PATH:\"").append(categories[i]).append("\" "); pathQuery.append(" PATH:\"").append(categories[i]).append("\" ");
} }
if (location != null) if (location != null)
@@ -423,7 +408,7 @@ public final class SearchContext implements Serializable
{ {
case SearchContext.SEARCH_ALL: case SearchContext.SEARCH_ALL:
query = '(' + fileTypeQuery + " AND " + '(' + nameAttrQuery + ' ' + additionalAttrsQuery + ' ' + fullTextQuery + ')' + ')' + query = '(' + fileTypeQuery + " AND " + '(' + nameAttrQuery + ' ' + additionalAttrsQuery + ' ' + fullTextQuery + ')' + ')' +
" OR " + ' ' +
'(' + folderTypeQuery + " AND " + '(' + nameAttrQuery + ' ' + additionalAttrsQuery + "))"; '(' + folderTypeQuery + " AND " + '(' + nameAttrQuery + ' ' + additionalAttrsQuery + "))";
break; break;
@@ -449,7 +434,7 @@ public final class SearchContext implements Serializable
switch (mode) switch (mode)
{ {
case SearchContext.SEARCH_ALL: case SearchContext.SEARCH_ALL:
query = '(' + fileTypeQuery + " OR " + folderTypeQuery + ')'; query = '(' + fileTypeQuery + ' ' + folderTypeQuery + ')';
break; break;
case SearchContext.SEARCH_FILE_NAMES: case SearchContext.SEARCH_FILE_NAMES:
@@ -487,7 +472,7 @@ public final class SearchContext implements Serializable
} }
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Query: " + query); logger.debug("Query:\r\n" + query);
return query; return query;
} }
@@ -502,7 +487,7 @@ public final class SearchContext implements Serializable
*/ */
private static void processSearchAttribute(QName qname, String value, StringBuilder buf) private static void processSearchAttribute(QName qname, String value, StringBuilder buf)
{ {
processSearchAttribute(qname, value, buf, true); processSearchAttribute(qname, value, buf, true, false);
} }
/** /**
@@ -513,12 +498,14 @@ public final class SearchContext implements Serializable
* @param value Non-null value of the attribute * @param value Non-null value of the attribute
* @param buf Buffer to append lucene terms to * @param buf Buffer to append lucene terms to
* @param andOp If true apply the '+' AND operator as the prefix to the attribute term * @param andOp If true apply the '+' AND operator as the prefix to the attribute term
* @param notOp If true apply the '-' NOT operator as the prefix to the attribute term
*/ */
private static void processSearchAttribute(QName qname, String value, StringBuilder buf, boolean andOp) private static void processSearchAttribute(QName qname, String value, StringBuilder buf, boolean andOp, boolean notOp)
{ {
if (value.indexOf(' ') == -1) if (value.indexOf(' ') == -1)
{ {
if (andOp) buf.append('+'); if (andOp) buf.append('+');
else if (notOp) buf.append('-');
buf.append('@').append(Repository.escapeQName(qname)).append(":") buf.append('@').append(Repository.escapeQName(qname)).append(":")
.append(SearchContext.escape(value)).append(' '); .append(SearchContext.escape(value)).append(' ');
} }
@@ -527,7 +514,9 @@ public final class SearchContext implements Serializable
// phrase multi-word search // phrase multi-word search
String safeValue = QueryParser.escape(value); String safeValue = QueryParser.escape(value);
if (andOp) buf.append('+'); if (andOp) buf.append('+');
buf.append('@').append(Repository.escapeQName(qname)).append(":\"").append(safeValue).append('"').append(' '); else if (notOp) buf.append('-');
buf.append('@').append(Repository.escapeQName(qname)).append(":\"")
.append(safeValue).append('"').append(' ');
} }
} }

View File

@@ -36,6 +36,8 @@ import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigService; import org.alfresco.config.ConfigService;
import org.alfresco.config.JNDIConstants; import org.alfresco.config.JNDIConstants;
import org.alfresco.mbeans.VirtServerRegistry; import org.alfresco.mbeans.VirtServerRegistry;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.domain.PropertyValue; import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.sandbox.SandboxConstants; import org.alfresco.sandbox.SandboxConstants;
@@ -43,6 +45,7 @@ import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.avm.AVMNotFoundException; import org.alfresco.service.cmr.avm.AVMNotFoundException;
import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.search.ResultSet; import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
@@ -926,6 +929,7 @@ public final class AVMUtil
// get services // get services
FacesContext fc = FacesContext.getCurrentInstance(); FacesContext fc = FacesContext.getCurrentInstance();
SearchService searchService = Repository.getServiceRegistry(fc).getSearchService(); SearchService searchService = Repository.getServiceRegistry(fc).getSearchService();
NodeService nodeService = Repository.getServiceRegistry(fc).getNodeService();
// construct the query // construct the query
String path = Application.getRootPath(fc) + "/" + Application.getWebsitesFolderName(fc) + "/*"; String path = Application.getRootPath(fc) + "/" + Application.getWebsitesFolderName(fc) + "/*";
@@ -939,10 +943,30 @@ public final class AVMUtil
results = searchService.query(Repository.getStoreRef(), results = searchService.query(Repository.getStoreRef(),
SearchService.LANGUAGE_LUCENE, query); SearchService.LANGUAGE_LUCENE, query);
// WCM-810:
// the 'avmstore' property was not defined as an identifier in the model (before 2.2)
// which means it may get tokenised which in turn means that 'test' and 'test-site'
// would get returned by the query above even though it's an exact match query,
// we therefore need to go through the results and check names if there is more
// than one result although this shouldn't happen anymore as the
// AVMStorePropertyTokenisationPatch will have reindexed the wca:avmstore property
if (results.length() == 1) if (results.length() == 1)
{ {
webProjectNode = results.getNodeRef(0); webProjectNode = results.getNodeRef(0);
} }
else if (results.length() > 1)
{
for (NodeRef node : results.getNodeRefs())
{
String nodeStoreName = (String)nodeService.getProperty(node,
WCMAppModel.PROP_AVMSTORE);
if (nodeStoreName.equals(storeName))
{
webProjectNode = node;
break;
}
}
}
} }
finally finally
{ {

View File

@@ -80,6 +80,7 @@ import org.alfresco.web.ui.common.component.UIStatusMessage;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.shared_impl.renderkit.html.HtmlFormRendererBase; import org.apache.myfaces.shared_impl.renderkit.html.HtmlFormRendererBase;
import org.springframework.util.StringUtils;
import org.springframework.web.jsf.FacesContextUtils; import org.springframework.web.jsf.FacesContextUtils;
/** /**
@@ -650,7 +651,7 @@ public final class Utils
buf.append("']['"); buf.append("']['");
buf.append(name); buf.append(name);
buf.append("'].value='"); buf.append("'].value='");
buf.append(params.get(name)); buf.append(StringUtils.replace(params.get(name), "'", "\\'"));
buf.append("';"); buf.append("';");
// weak, but this seems to be the way Sun RI do it... // weak, but this seems to be the way Sun RI do it...