Edit Properties dialog for an AVM File

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3976 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-09-29 16:11:34 +00:00
parent 01b40b303a
commit 8f6dbe4920
7 changed files with 140 additions and 3 deletions

View File

@@ -850,6 +850,10 @@ update_avm_file_desc=Update a file in the website with content from your compute
file_details_desc=View details about the file. file_details_desc=View details about the file.
title_folder_details=Folder Details title_folder_details=Folder Details
folder_details_desc=View details about the folder. folder_details_desc=View details about the folder.
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.
# New User Wizard messages # New User Wizard messages
new_user_title=New User Wizard new_user_title=New User Wizard

View File

@@ -129,6 +129,10 @@
<dialog name="createAvmFolder" page="/jsp/wcm/create-folder-dialog.jsp" managed-bean="CreateFolderDialog" <dialog name="createAvmFolder" page="/jsp/wcm/create-folder-dialog.jsp" managed-bean="CreateFolderDialog"
icon="/images/icons/create_space_large.gif" title-id="create_folder" icon="/images/icons/create_space_large.gif" title-id="create_folder"
description-id="create_avm_folder_info" /> description-id="create_avm_folder_info" />
<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" />
</dialogs> </dialogs>
</config> </config>

View File

@@ -177,11 +177,15 @@
<!-- Actions for the File Details action menu --> <!-- Actions for the File Details action menu -->
<action-group id="avm_file_details"> <action-group id="avm_file_details">
<show-link>false</show-link> <show-link>false</show-link>
<action idref="edit_file" />
<action idref="update_file" />
<action idref="delete_file" />
</action-group> </action-group>
<!-- Actions for the Folder Details action menu --> <!-- Actions for the Folder Details action menu -->
<action-group id="avm_folder_details"> <action-group id="avm_folder_details">
<show-link>false</show-link> <show-link>false</show-link>
<action idref="delete_folder" />
</action-group> </action-group>
</actions> </actions>

View File

@@ -42,7 +42,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean
super.init(parameters); super.init(parameters);
// setup the editable node // setup the editable node
this.editableNode = new Node(this.browseBean.getDocument().getNodeRef()); this.editableNode = initEditableNode();
// special case for Mimetype - since this is a sub-property of the ContentData object // special case for Mimetype - since this is a sub-property of the ContentData object
// we must extract it so it can be edited in the client, then we check for it later // we must extract it so it can be edited in the client, then we check for it later
@@ -54,11 +54,16 @@ public class EditContentPropertiesDialog extends BaseDialogBean
} }
} }
protected Node initEditableNode()
{
return new Node(this.browseBean.getDocument().getNodeRef());
}
@Override @Override
protected String finishImpl(FacesContext context, String outcome) protected String finishImpl(FacesContext context, String outcome)
throws Exception throws Exception
{ {
NodeRef nodeRef = this.browseBean.getDocument().getNodeRef(); NodeRef nodeRef = this.editableNode.getNodeRef();
Map<String, Object> editedProps = this.editableNode.getProperties(); Map<String, Object> editedProps = this.editableNode.getProperties();
// get the name and move the node as necessary // get the name and move the node as necessary
@@ -233,6 +238,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean
return false; return false;
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Bean getters and setters // Bean getters and setters

View File

@@ -0,0 +1,94 @@
/*
* 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.text.MessageFormat;
import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.model.FileExistsException;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.content.EditContentPropertiesDialog;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
/**
* @author Kevin Roast
*/
public class EditFilePropertiesDialog extends EditContentPropertiesDialog
{
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.content.EditContentPropertiesDialog#initEditableNode()
*/
@Override
protected Node initEditableNode()
{
return new Node(this.avmBrowseBean.getAvmNode().getNodeRef());
}
@Override
protected String doPostCommitProcessing(FacesContext context, String outcome)
{
return outcome;
}
/**
* Formats the error message to display if an error occurs during finish processing
*
* @param The exception
* @return The formatted message
*/
@Override
protected String formatErrorMessage(Throwable exception)
{
if (exception instanceof FileExistsException)
{
return MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_EXISTS),
((FileExistsException)exception).getName());
}
else if (exception instanceof InvalidNodeRefException)
{
return MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF),
new Object[] {this.avmBrowseBean.getAvmNode().getPath()});
}
else
{
return super.formatErrorMessage(exception);
}
}
}

View File

@@ -854,6 +854,31 @@
</managed-property> </managed-property>
</managed-bean> </managed-bean>
<managed-bean>
<description>
The bean that backs up the Edit AVM File Properties Dialog
</description>
<managed-bean-name>EditFilePropertiesDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.wcm.EditFilePropertiesDialog</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> <managed-bean>
<description> <description>
The bean that backs up the Set Content Properties Dialog The bean that backs up the Set Content Properties Dialog

View File

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