Kevin Roast
2007-01-30 15:52:35 +00:00
parent 7e13957e36
commit a6d4684034
9 changed files with 58 additions and 24 deletions

View File

@@ -40,6 +40,7 @@ import org.alfresco.web.app.servlet.TemplateContentServlet;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.Utils.URLMode;
import org.alfresco.web.ui.common.component.UIActionLink;
/**
@@ -112,6 +113,16 @@ public class SpaceDetailsBean extends BaseDetailsBean
return getNode();
}
/**
* Returns the URL to access the browse page for the current node
*
* @return The bookmark URL
*/
public String getBrowseUrl()
{
return Utils.generateURL(FacesContext.getCurrentInstance(), getNode(), URLMode.BROWSE);
}
/**
* Resolve the actual document Node from any Link object that may be proxying it
*

View File

@@ -180,17 +180,18 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
if (logger.isDebugEnabled())
logger.debug("Attempting to copy node: " + getNodeRef() + " into node ID: " + destRef.toString());
// first check that we are not attempting to copy a duplicate into the same parent
if (destRef.equals(assocRef.getParentRef()) && name.equals(getName()))
{
// manually change the name if this occurs
String copyOf = Application.getMessage(fc, MSG_COPY_OF);
name = copyOf + ' ' + name;
}
if (dd.isSubClass(getType(), ContentModel.TYPE_CONTENT) ||
dd.isSubClass(getType(), ContentModel.TYPE_FOLDER))
{
// copy the file/folder
// first check that we are not attempting to copy a duplicate into the same parent
if (destRef.equals(assocRef.getParentRef()) && name.equals(getName()))
{
// manually change the name if this occurs
String copyOf = Application.getMessage(fc, MSG_COPY_OF);
name = copyOf + ' ' + name;
}
fileFolderService.copy(
getNodeRef(),
destRef,
@@ -201,7 +202,7 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
// copy the node
if (checkExists(name, destRef) == false)
{
copyService.copy(
copyService.copyAndRename(
getNodeRef(),
destRef,
ContentModel.ASSOC_CONTAINS,

View File

@@ -535,7 +535,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
}
/**
* @return List of UI items to represent the available Workflows for all websites
* @return List of UI items to represent the available Web Forms for all websites
*/
public List<UIListItem> getFormsList()
{

View File

@@ -43,6 +43,8 @@ import org.alfresco.web.app.servlet.DownloadContentServlet;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.alfresco.web.forms.*;
import org.alfresco.web.forms.xforms.XFormsProcessor;
import org.apache.commons.logging.Log;
@@ -220,7 +222,10 @@ public class WebProject
*/
public List<Form> getForms()
{
return Collections.unmodifiableList(new ArrayList(this.getFormsImpl().values()));
List forms = new ArrayList(this.getFormsImpl().values());
QuickSort sorter = new QuickSort(forms, "name", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
return Collections.unmodifiableList(forms);
}
/**

View File

@@ -17,6 +17,7 @@
package org.alfresco.web.forms;
import java.io.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
@@ -50,6 +51,8 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
@@ -64,7 +67,6 @@ import org.xml.sax.SAXException;
public final class FormsService
implements Serializable
{
private static final Log LOGGER = LogFactory.getLog(FormsService.class);
/** the single instance initialized using spring */
@@ -155,7 +157,8 @@ public final class FormsService
final String xpath = (Application.getRootPath(fc) + "/" +
Application.getGlossaryFolderName(fc) + "/" +
Application.getContentFormsFolderName(fc));
LOGGER.debug("locating content forms at " + xpath);
if (LOGGER.isDebugEnabled())
LOGGER.debug("locating content forms at " + xpath);
final List<NodeRef> results =
searchService.selectNodes(this.nodeService.getRootNode(Repository.getStoreRef()),
xpath,
@@ -183,12 +186,14 @@ public final class FormsService
final ResultSet rs = this.searchService.query(sp);
if (LOGGER.isDebugEnabled())
LOGGER.debug("received " + rs.length() + " results");
final Collection<Form> result = new LinkedList<Form>();
final Collection<Form> result = new ArrayList<Form>(rs.length());
for (ResultSetRow row : rs)
{
final NodeRef nodeRef = row.getNodeRef();
result.add(this.getForm(nodeRef));
result.add(this.getForm(row.getNodeRef()));
}
QuickSort sorter = new QuickSort((List)result, "name", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
return result;
}

View File

@@ -554,7 +554,7 @@ public final class Utils
/**
* Enum representing the client URL type to generate
*/
public enum URLMode {HTTP_DOWNLOAD, HTTP_INLINE, WEBDAV, CIFS, SHOW_DETAILS, FTP}
public enum URLMode {HTTP_DOWNLOAD, HTTP_INLINE, WEBDAV, CIFS, SHOW_DETAILS, BROWSE, FTP}
/**
* Generates a URL for the given usage for the given node.
@@ -665,12 +665,12 @@ public final class Utils
DictionaryService dd = Repository.getServiceRegistry(context).getDictionaryService();
// default to showing details of content
String outcome = "showDocDetails";
String outcome = ExternalAccessServlet.OUTCOME_DOCDETAILS;
// if the node is a type of folder then make the outcome to show space details
if (dd.isSubClass(node.getType(), ContentModel.TYPE_FOLDER))
{
outcome = "showSpaceDetails";
outcome = ExternalAccessServlet.OUTCOME_SPACEDETAILS;
}
// build the url
@@ -680,6 +680,13 @@ public final class Utils
break;
}
case BROWSE:
{
url = ExternalAccessServlet.generateExternalURL(ExternalAccessServlet.OUTCOME_BROWSE,
Repository.getStoreRef().getProtocol() + "/" +
Repository.getStoreRef().getIdentifier() + "/" + node.getId());
}
case FTP:
{
// not implemented yet!