Merged V2.0 to HEAD

5091:  AWC-1118
   5092:  pooledactor assignment
   5100:  AWC-1133
   5103:  CML copy and cm:name
   5106:  Bubble view discussion topics
   5107:  AWC-1030, AWC-1137, Console buttons


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5312 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-03-06 13:20:00 +00:00
parent 2b40e7dd3d
commit d3ea87e5e2
7 changed files with 187 additions and 30 deletions

View File

@@ -1310,6 +1310,10 @@ search_in=Search In
no_engines_registered=Failed to find any registered OpenSearch engines!
current_repo=Current Alfresco Repository
toggle_options=Toggle Options
no_results=No results
of=of
failed_gen_url=Failed to generate url for search engine '{0}'.\\n\\nThis is probably caused by missing required parameters, check the template url for the search engine.
failed_search=Failed to retrieve search results for '{0}'
# UI Page Titles
title_about=About Alfresco

View File

@@ -1184,7 +1184,7 @@ public class TrashcanBean implements IContextListener
}
else
{
img = Utils.getFileTypeImage(node.getName(), false);
img = Utils.getFileTypeImage(node.getName(), true);
}
buf.append("<img width=16 height=16 alt='' src='").append(contextPath).append(img).append("'>");
buf.append("</td><td>");

View File

@@ -1036,7 +1036,7 @@ public class ForumsBean implements IContextListener
{
ResponseWriter out = context.getResponseWriter();
out.write("<tr><td colspan='99' align='right'>");
out.write("<tr><td colspan='99' align='center'>");
for (Iterator i = richList.getChildren().iterator(); i.hasNext(); /**/)
{
// output all remaining child components that are not UIColumn

View File

@@ -30,12 +30,14 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.search.impl.lucene.QueryParser;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -45,7 +47,6 @@ import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.ISO9075;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.IContextListener;
import org.alfresco.web.app.context.UIContextService;
@@ -441,7 +442,7 @@ public class UsersBean implements IContextListener
{
this.usersRichList.setValue(null);
if (this.searchCriteria == null || this.searchCriteria.length() == 0)
if (this.searchCriteria == null || this.searchCriteria.trim().length() == 0)
{
this.users = Collections.<Node>emptyList();
}
@@ -456,21 +457,30 @@ public class UsersBean implements IContextListener
tx.begin();
// define the query to find people by their first or last name
String search = ISO9075.encode(this.searchCriteria);
String query = "( TYPE:\"{http://www.alfresco.org/model/content/1.0}person\") AND " +
"((@\\{http\\://www.alfresco.org/model/content/1.0\\}firstName:" + search +
"*) OR (@\\{http\\://www.alfresco.org/model/content/1.0\\}lastName:" + search +
"*) OR (@\\{http\\://www.alfresco.org/model/content/1.0\\}userName:" + search +
"*)))";
String search = this.searchCriteria.trim();
StringBuilder query = new StringBuilder(256);
query.append("TYPE:\"{http://www.alfresco.org/model/content/1.0}person\" AND (");
for (StringTokenizer t = new StringTokenizer(search, " "); t.hasMoreTokens(); /**/)
{
String term = QueryParser.escape(t.nextToken());
query.append("((@\\{http\\://www.alfresco.org/model/content/1.0\\}firstName:*");
query.append(term);
query.append("*) OR (@\\{http\\://www.alfresco.org/model/content/1.0\\}lastName:*");
query.append(term);
query.append("*) OR (@\\{http\\://www.alfresco.org/model/content/1.0\\}userName:");
query.append(term);
query.append("*)) "); // final space here is important as default OR separator
}
query.append(")");
if (logger.isDebugEnabled())
logger.debug("Query: " + query);
logger.debug("Query: " + query.toString());
// define the search parameters
SearchParameters params = new SearchParameters();
params.setLanguage(SearchService.LANGUAGE_LUCENE);
params.addStore(Repository.getStoreRef());
params.setQuery(query);
params.setQuery(query.toString());
List<NodeRef> people = this.searchService.query(params).getNodeRefs();

View File

@@ -115,6 +115,47 @@ public class UIOpenSearch extends SelfRenderingComponent
out.write("', '");
out.write(engine.getUrl());
out.write("');\n");
// pass in NLS strings
out.write(clientId);
out.write(".setMsgNoResults(\"");
out.write(Application.getMessage(context, "no_results"));
out.write("\");\n");
out.write(clientId);
out.write(".setMsgOf(\"");
out.write(Application.getMessage(context, "of"));
out.write("\");\n");
out.write(clientId);
out.write(".setMsgFailedGenerateUrl(\"");
out.write(Application.getMessage(context, "failed_gen_url"));
out.write("\");\n");
out.write(clientId);
out.write(".setMsgFailedSearch(\"");
out.write(Application.getMessage(context, "failed_search"));
out.write("\");\n");
out.write(clientId);
out.write(".setMsgFirstPage(\"");
out.write(Application.getMessage(context, "first_page"));
out.write("\");\n");
out.write(clientId);
out.write(".setMsgPreviousPage(\"");
out.write(Application.getMessage(context, "prev_page"));
out.write("\");\n");
out.write(clientId);
out.write(".setMsgNextPage(\"");
out.write(Application.getMessage(context, "next_page"));
out.write("\");\n");
out.write(clientId);
out.write(".setMsgLastPage(\"");
out.write(Application.getMessage(context, "last_page"));
out.write("\");\n");
}
out.write("</script>\n");

View File

@@ -106,33 +106,33 @@
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "ballongrey", "#EEEEEE"); %>
<table cellpadding="6" cellspacing="6" border="0" width="100%">
<tr>
<td><a:actionLink value="#{msg.manage_users}" image="/images/icons/users.gif" action="dialog:manageUsers" styleClass="title" actionListener="#{NewUserWizard.setupUsers}" /></td>
<td><a:actionLink value="#{msg.manage_users}" image="/images/icons/users.gif" padding="2" action="dialog:manageUsers" styleClass="title" actionListener="#{NewUserWizard.setupUsers}" /></td>
</tr>
<tr>
<td><a:actionLink value="#{msg.manage_groups}" image="/images/icons/group.gif" action="dialog:manageGroups" styleClass="title" /></td>
<td><a:actionLink value="#{msg.manage_groups}" image="/images/icons/group.gif" padding="2" action="dialog:manageGroups" styleClass="title" /></td>
</tr>
<tr>
<td><a:actionLink value="#{msg.category_management}" image="/images/icons/categories.gif" action="dialog:manageCategories" styleClass="title" /></td>
<td><a:actionLink value="#{msg.category_management}" image="/images/icons/categories.gif" padding="2" action="dialog:manageCategories" styleClass="title" /></td>
</tr>
<tr>
<td>
<a:actionLink value="#{msg.import}" image="/images/icons/import.gif" action="dialog:import" actionListener="#{BrowseBean.setupSpaceAction}" styleClass="title">
<a:actionLink value="#{msg.import}" image="/images/icons/import.gif" padding="2" action="dialog:import" actionListener="#{BrowseBean.setupSpaceAction}" styleClass="title">
<f:param name="id" value="#{NavigationBean.currentNodeId}" />
</a:actionLink>
</td>
</tr>
<tr>
<td>
<a:actionLink value="#{msg.export}" image="/images/icons/export.gif" action="dialog:export" actionListener="#{BrowseBean.setupSpaceAction}" styleClass="title">
<a:actionLink value="#{msg.export}" image="/images/icons/export.gif" padding="2" action="dialog:export" actionListener="#{BrowseBean.setupSpaceAction}" styleClass="title">
<f:param name="id" value="#{NavigationBean.currentNodeId}" />
</a:actionLink>
</td>
</tr>
<tr>
<td><a:actionLink value="#{msg.system_info}" image="/images/icons/info_icon.gif" action="dialog:showSystemInfo" styleClass="title" /></td>
<td><a:actionLink value="#{msg.system_info}" image="/images/icons/info_icon.gif" padding="2" action="dialog:showSystemInfo" styleClass="title" /></td>
</tr>
<tr>
<td><a:actionLink value="#{msg.node_browser}" image="/images/icons/node_browser.gif" action="dialog:showNodeBrowser" styleClass="title" /></td>
<td><a:actionLink value="#{msg.node_browser}" image="/images/icons/node_browser.gif" padding="2" action="dialog:showNodeBrowser" styleClass="title" /></td>
</tr>
</table>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "ballongrey"); %>

View File

@@ -34,6 +34,7 @@ Alfresco.OpenSearchClient = function(id)
this.id = id;
this.engines = [];
this.enginesById = [];
this.searchInProgress = false;
}
Alfresco.OpenSearchClient.prototype =
@@ -43,6 +44,24 @@ Alfresco.OpenSearchClient.prototype =
engines: null,
enginesById: null,
searchInProgress: false,
msgNoResults: null,
msgOf: null,
msgFailedGenerateUrl: null,
msgFailedSearch: null,
msgFirstPage: null,
msgPreviousPage: null,
msgNextPage: null,
msgLastPage: null,
/**
* Registers an OpenSearch engine to be called when performing queries
@@ -54,6 +73,70 @@ Alfresco.OpenSearchClient.prototype =
this.enginesById[id] = se;
},
/**
* Sets the 'No Results' message
*/
setMsgNoResults: function(msg)
{
this.msgNoResults = msg;
},
/**
* Sets the 'of' message
*/
setMsgOf: function(msg)
{
this.msgOf = msg;
},
/**
* Sets the 'Failed to generate url' message
*/
setMsgFailedGenerateUrl: function(msg)
{
this.msgFailedGenerateUrl = msg;
},
/**
* Sets the 'Failed to retrieve search results' message
*/
setMsgFailedSearch: function(msg)
{
this.msgFailedSearch = msg;
},
/**
* Sets the 'First Page' message
*/
setMsgFirstPage: function(msg)
{
this.msgFirstPage = msg;
},
/**
* Sets the 'Previous Page' message
*/
setMsgPreviousPage: function(msg)
{
this.msgPreviousPage = msg;
},
/**
* Sets the 'Next Page' message
*/
setMsgNextPage: function(msg)
{
this.msgNextPage = msg;
},
/**
* Sets the 'Last Page' message
*/
setMsgLastPage: function(msg)
{
this.msgLastPage = msg;
},
/**
* Handles the key press event, if ENTER is pressed execute the query
*/
@@ -129,8 +212,11 @@ Alfresco.OpenSearchClient.prototype =
}
// issue the queries if there is enough search criteria
if (term != null && term.length > 1)
if (this.searchInProgress == false && term != null && term.length > 1)
{
// show that we are executing a search
this.searchInProgress = true;
// remove previous results (if necessary)
var resultsPanel = document.getElementById(this.id + _RESULTS_DIV_ID_SUFFIX);
if (resultsPanel != null)
@@ -177,8 +263,9 @@ Alfresco.OpenSearchClient.prototype =
}
else
{
handleErrorYahoo("Failed to generate url for search engine '" + ose.label +
"'.\n\nThis is probably caused by missing required parameters, check the template url for the search engine.");
// replace the token with the engine label
var errorMsg = this.msgFailedGenerateUrl.replace("{0}", ose.label);
handleErrorYahoo(errorMsg);
}
},
@@ -327,7 +414,7 @@ Alfresco.OpenSearchClient.prototype =
if (results == null || results.length == 0)
{
return "<div class='osResultNoMatch'>No results</div>";
return "<div class='osResultNoMatch'>" + this.msgNoResults + "</div>";
}
else
{
@@ -498,7 +585,9 @@ Alfresco.OpenSearchClient.prototype =
sb[sb.length] = firstUrl;
sb[sb.length] = "&quot;);'><img src='";
sb[sb.length] = getContextPath();
sb[sb.length] = "/images/icons/FirstPage.gif' title='First Page' border='0' /></a>";
sb[sb.length] = "/images/icons/FirstPage.gif' title='";
sb[sb.length] = this.msgFirstPage;
sb[sb.length] = "' border='0' /></a>";
}
else
{
@@ -519,7 +608,9 @@ Alfresco.OpenSearchClient.prototype =
sb[sb.length] = previousUrl;
sb[sb.length] = "&quot;);'><img src='";
sb[sb.length] = getContextPath();
sb[sb.length] = "/images/icons/PreviousPage.gif' title='Previous Page' border='0' /></a>";
sb[sb.length] = "/images/icons/PreviousPage.gif' title='";
sb[sb.length] = this.msgPreviousPage;
sb[sb.length] = "' border='0' /></a>";
}
else
{
@@ -532,7 +623,9 @@ Alfresco.OpenSearchClient.prototype =
sb[sb.length] = startIndex;
sb[sb.length] = "&nbsp;-&nbsp;";
sb[sb.length] = endIndex;
sb[sb.length] = "&nbsp;of&nbsp;";
sb[sb.length] = "&nbsp;";
sb[sb.length] = this.msgOf;
sb[sb.length] = "&nbsp;";
sb[sb.length] = totalResults;
sb[sb.length] = "&nbsp;&nbsp;";
@@ -546,7 +639,9 @@ Alfresco.OpenSearchClient.prototype =
sb[sb.length] = nextUrl;
sb[sb.length] = "&quot;);'><img src='";
sb[sb.length] = getContextPath();
sb[sb.length] = "/images/icons/NextPage.gif' title='Next Page' border='0' /></a>";
sb[sb.length] = "/images/icons/NextPage.gif' title='";
sb[sb.length] = this.msgNextPage;
sb[sb.length] = "' border='0' /></a>";
}
else
{
@@ -567,7 +662,9 @@ Alfresco.OpenSearchClient.prototype =
sb[sb.length] = lastUrl;
sb[sb.length] = "&quot;);'><img src='";
sb[sb.length] = getContextPath();
sb[sb.length] = "/images/icons/LastPage.gif' title='Last Page' border='0' /></a>";
sb[sb.length] = "/images/icons/LastPage.gif' title='";
sb[sb.length] = this.msgLastPage;
sb[sb.length] = "' border='0' /></a>";
}
else
{
@@ -595,6 +692,11 @@ Alfresco.OpenSearchEngine.processSearchResults = function(ajaxResponse)
var engineId = ajaxResponse.argument[0];
var clientInstance = ajaxResponse.argument[1];
var feed = ajaxResponse.responseXML.documentElement;
// reset the search in progress flag, we do this on the
// first set of results as this is enough time to stop
// the double press of the enter key
clientInstance.searchInProgress = false;
// if the name of the feed element is "rss", get the channel child element
if (feed.tagName == "rss")
@@ -674,6 +776,6 @@ Alfresco.OpenSearchEngine.handleSearchError = function(ajaxResponse)
var clientInstance = ajaxResponse.argument[1];
var engineLabel = clientInstance.enginesById[engineId].label;
handleErrorYahoo("Failed to retrieve search results for '" + engineLabel +
"': " + ajaxResponse.status + " " + ajaxResponse.statusText);
var errorMsg = clientInstance.msgFailedSearch.replace("{0}", engineLabel);
handleErrorYahoo(errorMsg + ": " + ajaxResponse.status + " " + ajaxResponse.statusText);
}