- Updated OpenSearch UI after Linton review
- Multiple OpenSearch clients can now be added to a single page - Configured OpenSearch as a dashlet - Made the lookup for beans in portal session more rigorous for AJAX invoke command - Updated paging graphics git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4942 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
@@ -1297,10 +1297,13 @@ workflow_duration=Duration:
|
||||
workflow_duration_ms=ms
|
||||
|
||||
# OpenSearch messages
|
||||
show=Show
|
||||
opensearch=OpenSearch
|
||||
opensearch_desc=Provides ability to search across multiple OpenSearch supported search engines.
|
||||
perform_search_in=Perform Search In
|
||||
search_in=Search In
|
||||
no_engines_registered=Failed to find any registered OpenSearch engines!
|
||||
current_repo=Current Alfresco Repository
|
||||
toggle_options=Toggle Options
|
||||
|
||||
# UI Page Titles
|
||||
title_about=About Alfresco
|
||||
|
@@ -22,7 +22,7 @@
|
||||
<config evaluator="string-compare" condition="OpenSearch">
|
||||
<opensearch>
|
||||
<engines>
|
||||
<engine label="Alfresco Text Search">
|
||||
<engine label-id="current_repo">
|
||||
<url type="application/opensearchdescription+xml">
|
||||
/service/search/textsearchdescription.xml
|
||||
</url>
|
||||
|
@@ -211,6 +211,8 @@
|
||||
<dashlet id="my-images" label-id="dashlet_myimages"
|
||||
description-id="dashlet_myimages_desc"
|
||||
jsp="/jsp/dashboards/dashlets/my-images.jsp" allow-narrow="false" />
|
||||
<dashlet id="opensearch" label-id="opensearch" description-id="opensearch_desc"
|
||||
jsp="/jsp/dashboards/dashlets/opensearch.jsp" />
|
||||
</dashlets>
|
||||
<!-- set true allow the Guest user to configure the dashboard view - false by default -->
|
||||
<allow-guest-config>false</allow-guest-config>
|
||||
|
@@ -93,20 +93,21 @@ public class InvokeCommand extends BaseAjaxCommand
|
||||
" on variable " + variableName +
|
||||
" with method " + methodName);
|
||||
|
||||
// retrieve the managed bean, this is really weak but if the
|
||||
// request comes from a portal server the bean we need to get
|
||||
// is in the session with a prefix chosen by the portal vendor,
|
||||
// to cover this scenario we have to go through the names of
|
||||
// all the objects in the session to find the bean we want.
|
||||
Object bean = null;
|
||||
|
||||
Object bean = null;
|
||||
if (Application.inPortalServer())
|
||||
{
|
||||
// retrieve the managed bean, this is really weak but if the
|
||||
// request comes from a portal server the bean we need to get
|
||||
// is in the session with a prefix chosen by the portal vendor,
|
||||
// to cover this scenario we have to go through the names of
|
||||
// all the objects in the session to find the bean we want.
|
||||
|
||||
String beanNameSuffix = "?" + variableName;
|
||||
Enumeration enumNames = request.getSession().getAttributeNames();
|
||||
while (enumNames.hasMoreElements())
|
||||
{
|
||||
String name = (String)enumNames.nextElement();
|
||||
if (name.endsWith(variableName))
|
||||
if (name.endsWith(beanNameSuffix))
|
||||
{
|
||||
bean = request.getSession().getAttribute(name);
|
||||
|
||||
@@ -118,8 +119,7 @@ public class InvokeCommand extends BaseAjaxCommand
|
||||
}
|
||||
}
|
||||
|
||||
// if we didn't find the bean it may be a request scope bean, in which
|
||||
// case go through the variable resolver to create it.
|
||||
// if we don't have the bean yet try and get it via the variable resolver
|
||||
if (bean == null)
|
||||
{
|
||||
VariableResolver vr = facesContext.getApplication().getVariableResolver();
|
||||
|
@@ -111,7 +111,7 @@ public class UIDataPager extends UICommand
|
||||
Integer.toString(pageCount)
|
||||
}));
|
||||
|
||||
buf.append(" ");
|
||||
buf.append(" ");
|
||||
|
||||
// output HTML links or labels to render the paging controls
|
||||
// first page
|
||||
@@ -128,6 +128,8 @@ public class UIDataPager extends UICommand
|
||||
buf.append(Utils.buildImageTag(context, WebResources.IMAGE_FIRSTPAGE_NONE, 16, 16, null));
|
||||
}
|
||||
|
||||
buf.append(" ");
|
||||
|
||||
// previous page
|
||||
if (currentPage != 0)
|
||||
{
|
||||
@@ -228,6 +230,8 @@ public class UIDataPager extends UICommand
|
||||
buf.append(Utils.buildImageTag(context, WebResources.IMAGE_NEXTPAGE_NONE, 16, 16, null));
|
||||
}
|
||||
|
||||
buf.append(" ");
|
||||
|
||||
// last page
|
||||
if ((dataContainer.getCurrentPage() < dataContainer.getPageCount() - 1) == true)
|
||||
{
|
||||
|
@@ -55,7 +55,7 @@ public class UIOpenSearch extends SelfRenderingComponent
|
||||
return;
|
||||
}
|
||||
|
||||
String clientId = this.getClientId(context);
|
||||
String clientId = this.getId();
|
||||
|
||||
// output the scripts required by the component (checks are
|
||||
// made to make sure the scripts are only written once)
|
||||
@@ -78,17 +78,17 @@ public class UIOpenSearch extends SelfRenderingComponent
|
||||
|
||||
// write out the javascript initialisation required
|
||||
out.write("<script type='text/javascript'>\n");
|
||||
out.write("setSearchTermFieldId('");
|
||||
out.write("var ");
|
||||
out.write(clientId);
|
||||
out.write("-search-term');\n");
|
||||
out.write("setPageSizeFieldId('");
|
||||
out.write(" = new Alfresco.OpenSearchClient('");
|
||||
out.write(clientId);
|
||||
out.write("-page-size');\n");
|
||||
out.write("');\n");
|
||||
|
||||
// register the engines on the client
|
||||
for (OpenSearchEngine engine : engines)
|
||||
{
|
||||
out.write("registerOpenSearchEngine('");
|
||||
out.write(clientId);
|
||||
out.write(".registerOpenSearchEngine('");
|
||||
out.write(engine.getId());
|
||||
out.write("', '");
|
||||
out.write(engine.getLabel());
|
||||
@@ -99,45 +99,67 @@ public class UIOpenSearch extends SelfRenderingComponent
|
||||
out.write("</script>\n");
|
||||
|
||||
// write out the HTML
|
||||
out.write("<div class='osPanel'>\n");
|
||||
out.write("<div class='osPanel'><div class='osControls'>");
|
||||
out.write("<table border='0' cellpadding='2' cellspacing='0'><tr>");
|
||||
out.write("<td><input id='");
|
||||
out.write(clientId);
|
||||
out.write("-search-term' name='");
|
||||
out.write(clientId);
|
||||
out.write("-search-term' type='text' size='25' onkeyup='return handleKeyPress(event);' />");
|
||||
out.write("-search-term' type='text' size='30' onkeyup='return ");
|
||||
out.write(clientId);
|
||||
out.write(".handleKeyPress(event);' />");
|
||||
out.write("</td><td><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/search_icon.gif' style='cursor:pointer' onclick='executeQuery()' title='");
|
||||
out.write("/images/icons/search_icon.gif' style='cursor:pointer' onclick='");
|
||||
out.write(clientId);
|
||||
out.write(".executeQuery()' title='");
|
||||
out.write(Application.getMessage(context, "search"));
|
||||
out.write("' /></td></tr></table>\n");
|
||||
out.write("<table border='0' cellpadding='2' cellspacing='0' style='margin-top: 2px;'><tr><td><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/expanded.gif' style='cursor:pointer' onclick='");
|
||||
out.write(clientId);
|
||||
out.write(".toggleOptions(this)' class='expanded' title='");
|
||||
out.write(Application.getMessage(context, "toggle_options"));
|
||||
out.write("' /></td><td><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/collapsed.gif' style='cursor:pointer' onclick='toggleOptions(this)' class='collapsed' title='");
|
||||
out.write("/images/icons/opensearch_controls.gif' /></td><td>");
|
||||
out.write(Application.getMessage(context, "options"));
|
||||
out.write("' /></td></tr></table>\n");
|
||||
out.write("<div id='os-options' class='osOptions'>");
|
||||
out.write("</td></tr></table>\n");
|
||||
|
||||
out.write("<div id='");
|
||||
out.write(clientId);
|
||||
out.write("-os-options' class='osOptions'>");
|
||||
out.write(Application.getMessage(context, "show"));
|
||||
out.write("<input id='");
|
||||
out.write(clientId);
|
||||
out.write("-page-size' name='");
|
||||
out.write(clientId);
|
||||
out.write("-page-size' type='text' value='5' style='width: 25px; margin-right: 5px;' />");
|
||||
out.write("-page-size' type='text' value='5' style='width: 25px; margin-left: 5px; margin-right: 5px;' />");
|
||||
out.write(Application.getMessage(context, "items_per_page"));
|
||||
out.write("<div style='margin-top: 6px; margin-bottom: 6px;'>");
|
||||
out.write(Application.getMessage(context, "perform_search_in"));
|
||||
out.write("<div style='margin-top: 6px; margin-bottom: 4px;'>");
|
||||
out.write(Application.getMessage(context, "search_in"));
|
||||
out.write(":</div><table border='0' cellpadding='2' cellspacing='0'>");
|
||||
for (OpenSearchEngine engine : engines)
|
||||
{
|
||||
out.write("<tr><td><input id='");
|
||||
out.write(clientId);
|
||||
out.write("-");
|
||||
out.write(engine.getId());
|
||||
out.write("-engine-enabled' name='");
|
||||
out.write(clientId);
|
||||
out.write("-");
|
||||
out.write(engine.getId());
|
||||
out.write("-engine-enabled' type='checkbox' checked='checked' />");
|
||||
out.write("</td><td>");
|
||||
out.write(engine.getLabel());
|
||||
out.write("</td></tr>");
|
||||
}
|
||||
out.write("</table></div>\n");
|
||||
out.write("<div id='os-results'></div>\n</div>\n");
|
||||
out.write("</table></div></div>\n");
|
||||
|
||||
out.write("<div id='");
|
||||
out.write(clientId);
|
||||
out.write("-os-results'></div>\n</div>\n");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -435,7 +435,7 @@ a.topToolbarLinkHighlight, a.topToolbarLinkHighlight:link, a.topToolbarLinkHighl
|
||||
|
||||
.pager
|
||||
{
|
||||
padding: 3px;
|
||||
padding: 6px 4px 3px 4px;
|
||||
border: 1px dotted #cccccc;
|
||||
}
|
||||
|
||||
|
@@ -1,59 +1,60 @@
|
||||
.osSidebarPanel
|
||||
{
|
||||
min-width: 190px;
|
||||
background-color: #f5f5f5;
|
||||
padding: 4px;
|
||||
min-width: 212px;
|
||||
*width: 100%;
|
||||
}
|
||||
|
||||
.osPanel
|
||||
{
|
||||
margin: 4px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.osControls
|
||||
{
|
||||
padding: 4px;
|
||||
background-color: white;
|
||||
border: 1px solid #babfc5;
|
||||
-moz-border-radius: 7px;
|
||||
}
|
||||
|
||||
.osOptions
|
||||
{
|
||||
margin: 6px;
|
||||
display: none;
|
||||
margin-top: 6px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.osResults
|
||||
{
|
||||
margin-top: 6px;
|
||||
padding: 3px;
|
||||
background: url(../images/parts/os-background.gif) 0 0 repeat-x;
|
||||
background-color: white;
|
||||
border: 1px solid #babfc5;
|
||||
-moz-border-radius: 7px;
|
||||
*width: 100%;
|
||||
}
|
||||
|
||||
.osEngineTitle
|
||||
{
|
||||
padding: 1px 2px 2px 2px;
|
||||
margin-bottom: 2px;
|
||||
border-bottom: 1px dashed #bbb;
|
||||
}
|
||||
|
||||
.osEngineTitleText
|
||||
{
|
||||
font-weight: bold;
|
||||
color: #003366;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
.osResultsPosition
|
||||
{
|
||||
font-size: 9px;
|
||||
text-align: right;
|
||||
padding-right: 2px;
|
||||
_padding-right: 6px;
|
||||
color: #004488;
|
||||
white-space: nowrap;
|
||||
border-bottom: 1px dotted #bbb;
|
||||
}
|
||||
|
||||
.osResultsPaging
|
||||
{
|
||||
padding: 6px 4px 4px 4px;
|
||||
font-size: 9px;
|
||||
text-align: right;
|
||||
padding: 4px;
|
||||
padding-top: 6px;
|
||||
}
|
||||
|
||||
.osResultsPaging a, .osResultsPaging a:hover, .osResultsPaging a:link, .osResultsPaging a:visited
|
||||
.osResultsPaging img
|
||||
{
|
||||
font-size: 9px;
|
||||
vertical-align: -4px;
|
||||
}
|
||||
|
||||
.osResultNoMatch
|
||||
|
Before Width: | Height: | Size: 330 B After Width: | Height: | Size: 582 B |
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 374 B |
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 583 B |
Before Width: | Height: | Size: 330 B After Width: | Height: | Size: 373 B |
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 361 B |
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 359 B |
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 355 B |
BIN
source/web/images/icons/opensearch_controls.gif
Normal file
After Width: | Height: | Size: 317 B |
Before Width: | Height: | Size: 1.6 KiB |
22
source/web/jsp/dashboards/dashlets/opensearch.jsp
Normal file
@@ -0,0 +1,22 @@
|
||||
<%--
|
||||
Copyright (C) 2005 Alfresco, Inc.
|
||||
|
||||
Licensed under the Mozilla Public License version 1.1
|
||||
with a permitted attribution clause. You may obtain a
|
||||
copy of the License at
|
||||
|
||||
http://www.alfresco.org/legal/license.txt
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
either express or implied. See the License for the specific
|
||||
language governing permissions and limitations under the
|
||||
License.
|
||||
--%>
|
||||
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
|
||||
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
|
||||
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
||||
|
||||
<r:openSearch id="dashletOsClient" />
|
@@ -21,6 +21,6 @@
|
||||
|
||||
<f:verbatim><div class="osSidebarPanel"></f:verbatim>
|
||||
|
||||
<r:openSearch id="os-client" />
|
||||
<r:openSearch id="sidebarOsClient" />
|
||||
|
||||
<f:verbatim></div></f:verbatim>
|
@@ -3,8 +3,33 @@
|
||||
// Gavin Cornwell 14-07-2006
|
||||
//
|
||||
|
||||
// Global Alfresco namespace object
|
||||
if (typeof Alfresco == "undefined")
|
||||
{
|
||||
var Alfresco = {};
|
||||
}
|
||||
|
||||
var _alfContextPath = null;
|
||||
|
||||
/**
|
||||
* Error handler for errors caught in a catch block
|
||||
*/
|
||||
function handleCaughtError(err)
|
||||
{
|
||||
var msg = null;
|
||||
|
||||
if (err.message)
|
||||
{
|
||||
msg = err.message;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = err;
|
||||
}
|
||||
|
||||
alert("An error occurred: " + msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default handler for errors when using the dojo toolkit
|
||||
*/
|
||||
|