10-03-2008 04:50 PM
> WEB-INF
> lib
> custom-dialog.jar
> alfresco
> extension
> web-client-config-custom.xml
> META-INF
> faces-config.xml
> MANIFEST.MF
> edu
> fccc
> sample
> SearchClinicalDocumentsDialog.class
> SearchClinicalDocumentsDialog$Node.class
> jsp
> extension
> search-clinical-documents.jsp
Q: Does anyone know how to work with Multiple web-client-config-custom.xml files
<alfresco-config>
<!– Add custom dialog –>
<config>
<actions>
<!– Launch Clinical Documents Search Dialog –>
<action id="search_clinical_documents">
<label>Search Clinical Documents</label>
<image>/images/icons/view_web_project.gif</image>
<action>dialog:searchClinicalDocuments</action>
</action>
<action-group id="navigator_actions">
<action idref="search_clinical_documents"/>
</action-group>
</actions>
</config>
<config>
<dialogs>
<dialog name="searchClinicalDocuments"
page = "/jsp/extension/search-clinical-documents.jsp"
managed-bean="SearchClinicalDocumentsDialog"
icon="/images/icons/submit_large.gif"
title="Search for Clinical Documents"
description="Returns list of clinical documents">
<buttons>
<button id="searchClinicalDocuments_new"
label="New search"
action="#{DialogManager.bean.newSearch}"
disabled="#{DialogManager.bean.newSearchDisabled}"
/>
</buttons>
</dialog>
</dialogs>
</config>
</alfresco-config>
Q: I used action-group "navigator_actions" to add link to the dialog, but i actually would like to add it to search drop down list under Advanced Search option. Is there an action-group for that?
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<managed-bean>
<managed-bean-name>SearchClinicalDocumentsDialog</managed-bean-name>
<managed-bean-class>edu.fccc.sample.ClinicalDocumentsDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>searchService</property-name>
<value>#{SearchService}</value>
</managed-property>
</managed-bean>
</faces-config>
package edu.fccc.sample;
import javax.faces.context.FacesContext;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.cmr.search.ResultSetRow;
import org.alfresco.web.app.servlet.DownloadContentServlet;
public class SearchClinicalDocumentsDialog extends BaseDialogBean{
private String searchTerms;
private boolean searchFinished;
private java.util.List<Node> sortedNodes;
public void init (java.util.Map parameters){
super.init(parameters);
searchFinished = false;
}
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
startSearch();
searchFinished = true;
return "do nothing";
}
public boolean getFinishButtonDisabled()
{
return searchFinished;
}
public boolean getNewSearchDisabled(){
return !searchFinished;
}
public String getFinishButtonLabel()
{
return "Search";
}
public String getCancelButtonLabel()
{
return "Finish";
}
//main method: performs search and stores result to sortedNodes
public void startSearch(){
sortedNodes = new java.util.ArrayList<Node>();
SearchParameters searchParameters = new SearchParameters();
searchParameters.addStore(new StoreRef("workspace", "SpacesStore"));
searchParameters.setLanguage(this.getSearchService().LANGUAGE_LUCENE);
//I only searched for documents with certain custom aspect; modify query to fit your model
String aspect= " +ASPECT:\"{custom.model}ClinicalReport\"";
String text = " +TEXT:\""+ searchTerms.trim() +"\"";
searchParameters.setQuery(aspect + text);
ResultSet reports = this.getSearchService().query(searchParameters);
for (ResultSetRow row: reports){
sortedNodes.add(new Node(row));
}
}
// called when New Search button clicked – resets dialog
public void newSearch(){
init(new java.util.HashMap());
}
public String getSearchTerms() {
return searchTerms;
}
public void setSearchTerms(String searchTerms) {
this.searchTerms = searchTerms;
}
public java.util.List<Node> getSortedNodes() {
return sortedNodes;
}
public void setSortedNodes(java.util.List<Node> sortedNodes) {
this.sortedNodes = sortedNodes;
}
public boolean isSearchFinished() {
return searchFinished;
}
public void setSearchFinished(boolean searchFinished) {
this.searchFinished = searchFinished;
}
public class Node{
String name;
String url;
public Node (ResultSetRow row){
try {
name = row.getValue(QName.createQName("{http://www.alfresco.org/model/content/1.0}name")).toString();
}catch (Exception e){}
try {
url = DownloadContentServlet.generateBrowserURL(row.getNodeRef(), name);
}catch (Exception e){}
//add more code
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
}Q: I perform search in finishImpl method because it already wrapped in transaction. When I tried to search from method triggered by additional dialog button, Alfresco threw an exception. SO I used finish method instead, but this way the flow becomes quirky (finish is not a finish and additional button resets dialog by calling init). It’d be nice to know how to do it more elegantly
<%@ 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" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<h:panelGroup rendered="#{DialogManager.bean.searchFinished == false }">
<h:outputText value="Enter serach terms then click \"Search\": "/>
<h:inputText size="100" value="#{DialogManager.bean.searchTerms}" />
</h:panelGroup>
<h:panelGroup rendered="#{DialogManager.bean.searchFinished == true }">
<h:outputText value="Serach terms: "/>
<h:outputText value="#{DialogManager.bean.searchTerms}" style="font-weight:bold"/>
<f:verbatim><BR><BR></f:verbatim>
<h:dataTable var="node" value="#{DialogManager.bean.sortedNodes}" border="1" cellpadding="10" style="vertical-align:top; ">
<h:column>
<h:outputLink value="/alfresco/#{node.url}" target="_blank">
<h:outputText value="#{node.name}" />
</h:outputLink>
</h:column>
</h:dataTable>
</h:panelGroup> That’s it.10-30-2008 04:24 PM
10-30-2008 05:17 PM
10-31-2008 05:18 PM
02-06-2009 05:33 PM
02-25-2009 08:06 PM
06-18-2009 05:09 AM
10-06-2009 01:29 PM
Did you package your Web Client customization in a .AMP file? Can you post the .AMP file so I can see the actual source code and modify it for my needs?
Another question: do you believe that it would be possible to call the standard Web Client search result list navigation pages from a custom search page?
10-06-2009 02:03 PM
can you send the source code and deployment process of your contribution.
> custom-dialog.jar
> alfresco
> extension
> web-client-config-custom.xml
> META-INF
> faces-config.xml
> MANIFEST.MF
> edu
> fccc
> sample
> SearchClinicalDocumentsDialog.java
> SearchClinicalDocumentsDialog.class
> SearchClinicalDocumentsDialog$Node.class
Manifest-Version: 1.0
Built-By: oltchuva
Class-Path: web-client-config-custom.xml04-12-2010 08:35 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.