. Edit Folder Properties dialog

. Edit file/folder properties now shows name+title+description as expected
. Addition of TITLED and UIFACETS aspects to files and folders during import/create

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3987 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-10-02 10:14:45 +00:00
parent b1e5b3dfac
commit 0dc8a68d44
13 changed files with 204 additions and 18 deletions

View File

@@ -854,6 +854,7 @@ edit_file_properties=Edit File Properties
edit_file_description=Edit the properties of the file then click OK.
edit_folder_properties=Edit Folder Properties
edit_folder_description=Edit the properties of the folder then click OK.
folder_props=Folder Properties
# New User Wizard messages
new_user_title=New User Wizard

View File

@@ -132,7 +132,11 @@
<dialog name="editAvmFileProperties" page="/jsp/content/edit-content-properties.jsp"
managed-bean="EditFilePropertiesDialog" icon="/images/icons/details_large.gif"
title-id="modify_content_properties" description-id="edit_content_description" />
title-id="edit_file_properties" description-id="edit_file_description" />
<dialog name="editAvmFolderProperties" page="/jsp/wcm/edit-folder-properties.jsp"
managed-bean="EditFolderPropertiesDialog" icon="/images/icons/details_large.gif"
title-id="edit_folder_properties" description-id="edit_folder_description" />
</dialogs>
</config>

View File

@@ -54,6 +54,9 @@ public class EditContentPropertiesDialog extends BaseDialogBean
}
}
/**
* Init the editable Node
*/
protected Node initEditableNode()
{
return new Node(this.browseBean.getDocument().getNodeRef());

View File

@@ -31,10 +31,18 @@ public class EditSpaceDialog extends CreateSpaceDialog
super.init(parameters);
// setup the space being edited
this.editableNode = new Node(this.browseBean.getActionSpace().getNodeRef());
this.editableNode = initEditableNode();
this.spaceType = this.editableNode.getType().toString();
}
/**
* Init the editable Node
*/
protected Node initEditableNode()
{
return new Node(this.browseBean.getActionSpace().getNodeRef());
}
@Override
public String getFinishButtonLabel()
{
@@ -61,7 +69,7 @@ public class EditSpaceDialog extends CreateSpaceDialog
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
// update the existing node in the repository
NodeRef nodeRef = this.browseBean.getActionSpace().getNodeRef();
NodeRef nodeRef = this.editableNode.getNodeRef();
Map<String, Object> editedProps = this.editableNode.getProperties();
// handle the name property separately, perform a rename in case it changed

View File

@@ -81,11 +81,6 @@ public class AddAvmContentDialog extends AddContentDialog
if (logger.isDebugEnabled())
logger.debug("Created AVM file: " + path);
// set the author aspect
Map<QName, Serializable> authorProps = new HashMap<QName, Serializable>(1, 1.0f);
authorProps.put(ContentModel.PROP_AUTHOR, this.author);
this.nodeService.addAspect(fileNodeRef, ContentModel.ASPECT_AUTHOR, authorProps);
// apply the titled aspect - title and description
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(2, 1.0f);
titledProps.put(ContentModel.PROP_TITLE, this.title);

View File

@@ -125,10 +125,12 @@ public class CreateFolderDialog extends BaseDialogBean
{
String parent = this.avmBrowseBean.getCurrentPath();
this.avmService.createDirectory(parent, this.name);
String path = parent + '/' + this.name;
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, path);
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_UIFACETS, null);
if (this.description != null && this.description.length() != 0)
{
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, path);
this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description);
}

View File

@@ -20,8 +20,10 @@ import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
@@ -33,9 +35,12 @@ import javax.faces.model.SelectItem;
import org.alfresco.config.Config;
import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigService;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.content.BaseContentWizard;
import org.alfresco.web.data.IDataContainer;
@@ -81,6 +86,7 @@ public class CreateWebContentWizard extends BaseContentWizard
this.avmBrowseBean = avmBrowseBean;
}
// ------------------------------------------------------------------------------
// Wizard implementation
@@ -140,6 +146,12 @@ public class CreateWebContentWizard extends BaseContentWizard
// remember the created path
this.createdPath = path + '/' + this.fileName;
// add titled aspect for the read/edit properties screens
NodeRef fileRef = AVMNodeConverter.ToNodeRef(-1, this.createdPath);
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(1, 1.0f);
titledProps.put(ContentModel.PROP_TITLE, this.fileName);
this.nodeService.addAspect(fileRef, ContentModel.ASPECT_TITLED, titledProps);
}
@Override

View File

@@ -28,6 +28,8 @@ import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
/**
* Backing bean for the Edit File Properties dialog.
*
* @author Kevin Roast
*/
public class EditFilePropertiesDialog extends EditContentPropertiesDialog

View File

@@ -0,0 +1,81 @@
/*
* 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.
*/
package org.alfresco.web.bean.wcm;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import javax.faces.context.FacesContext;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.spaces.EditSpaceDialog;
import org.alfresco.web.ui.common.component.UIListItem;
/**
* Backing bean for the Edit Folder Properties dialog.
*
* @author Kevin Roast
*/
public class EditFolderPropertiesDialog extends EditSpaceDialog
{
protected AVMBrowseBean avmBrowseBean;
// ------------------------------------------------------------------------------
// Bean property getters and setters
/**
* @param avmBrowseBean The AVMBrowseBean to set.
*/
public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
{
this.avmBrowseBean = avmBrowseBean;
}
// ------------------------------------------------------------------------------
// Dialog implementation
/**
* @see org.alfresco.web.bean.spaces.EditSpaceDialog#initEditableNode()
*/
@Override
protected Node initEditableNode()
{
return new Node(this.avmBrowseBean.getAvmNode().getNodeRef());
}
@Override
protected String doPostCommitProcessing(FacesContext context, String outcome)
{
return outcome;
}
public List<UIListItem> getIcons()
{
List<UIListItem> icons = new ArrayList<UIListItem>(1);
UIListItem item = new UIListItem();
item.setValue(DEFAULT_SPACE_ICON_NAME);
item.getAttributes().put("image", "/images/icons/" + DEFAULT_SPACE_ICON_NAME + ".gif");
icons.add(item);
return icons;
}
}

View File

@@ -82,6 +82,7 @@ public class ImportWebsiteDialog
protected ContentService contentService;
protected NavigationBean navigationBean;
protected AVMService avmService;
protected NodeService nodeService;
/**
@@ -116,6 +117,14 @@ public class ImportWebsiteDialog
this.avmService = avmService;
}
/**
* @param nodeService The NodeService to set.
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* @return Returns the name of the file
*/
@@ -396,17 +405,22 @@ public class ImportWebsiteDialog
if (file.isFile())
{
String avmPath = AVMNodeConverter.ToAVMVersionPath(root).getSecond();
avmService.createFile(avmPath, file.getName(), new BufferedInputStream(new FileInputStream(file), BUFFER_SIZE));
String fileName = file.getName();
this.avmService.createFile(
avmPath, fileName,new BufferedInputStream(new FileInputStream(file), BUFFER_SIZE));
String filePath = avmPath + '/' + fileName;
NodeRef fileRef = AVMNodeConverter.ToNodeRef(-1, filePath);
// add titled aspect for the read/edit properties screens
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(1, 1.0f);
titledProps.put(ContentModel.PROP_TITLE, fileName);
this.nodeService.addAspect(fileRef, ContentModel.ASPECT_TITLED, titledProps);
// create content node based on the filename
/*FileInfo contentFile = fileFolderService.create(root, fileName, ContentModel.TYPE_AVM_PLAIN_CONTENT);
NodeRef content = contentFile.getNodeRef();
// add titled aspect (for Web Client display)
//Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>();
//titledProps.put(ContentModel.PROP_TITLE, fileName);
//titledProps.put(ContentModel.PROP_DESCRIPTION, fileName);
//nodeService.addAspect(content, ContentModel.ASPECT_TITLED, titledProps);
InputStream contentStream = new BufferedInputStream(new FileInputStream(file), BUFFER_SIZE);
ContentWriter writer = contentService.getWriter(content, ContentModel.PROP_CONTENT, true);
@@ -418,10 +432,16 @@ public class ImportWebsiteDialog
else
{
//FileInfo fileInfo = fileFolderService.create(root, file.getName(), ContentModel.TYPE_AVM_PLAIN_FOLDER);
String avmPath = AVMNodeConverter.ToAVMVersionPath(root).getSecond();
avmService.createDirectory(avmPath, file.getName());
importDirectory(file.getPath(), AVMNodeConverter.ToNodeRef(-1, avmPath + '/' + file.getName()));//fileInfo.getNodeRef()
String folderPath = avmPath + '/' + file.getName();
NodeRef folderRef = AVMNodeConverter.ToNodeRef(-1, folderPath);
importDirectory(file.getPath(), folderRef);
// add the uifacets aspect for the read/edit properties screens
this.nodeService.addAspect(folderRef, ContentModel.ASPECT_UIFACETS, null);
}
}
catch (FileNotFoundException e)

View File

@@ -615,6 +615,10 @@
<managed-bean-name>ImportWebsiteDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.wcm.ImportWebsiteDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>fileFolderService</property-name>
<value>#{FileFolderService}</value>
@@ -879,6 +883,31 @@
</managed-property>
</managed-bean>
<managed-bean>
<description>
The bean that backs up the Edit AVM Folder Properties Dialog
</description>
<managed-bean-name>EditFolderPropertiesDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.wcm.EditFolderPropertiesDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>fileFolderService</property-name>
<value>#{FileFolderService}</value>
</managed-property>
<managed-property>
<property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value>
</managed-property>
<managed-property>
<property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value>
</managed-property>
</managed-bean>
<managed-bean>
<description>
The bean that backs up the Set Content Properties Dialog

View File

@@ -0,0 +1,29 @@
<%--
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" %>
<h:panelGrid columns="1" rowClasses="wizardSectionHeading, paddingRow"
cellpadding="2" cellspacing="2" width="100%">
<h:outputText value="#{msg.folder_props}" />
<r:propertySheetGrid id="folder-props" value="#{DialogManager.bean.editableNode}"
var="folderProps" columns="1" labelStyleClass="propertiesLabel"
externalConfig="true" cellpadding="2" cellspacing="2" />
</h:panelGrid>

View File

@@ -126,7 +126,7 @@
<h:panelGroup id="props-panel-facets">
<f:facet name="title">
<%--<r:permissionEvaluator value="#{FolderDetailsBean.folder}" allow="Write">--%>
<a:actionLink id="titleLink1" value="#{msg.modify}" showLink="false" image="/images/icons/Change_details.gif" action="dialog:editAvmFolder" />
<a:actionLink id="titleLink1" value="#{msg.modify}" showLink="false" image="/images/icons/Change_details.gif" action="dialog:editAvmFolderProperties" />
<%--</r:permissionEvaluator>--%>
</f:facet>
</h:panelGroup>