mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- Create Folder action dialog added to website browsing screen
- Fix to bug in client AVMNode where it was not correctly dealing with additional avm node properties set using the nodeservice git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3951 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -843,6 +843,8 @@ delete_avm_folder_confirm=Are you sure you want to remove \"{0}\" and its conten
|
||||
error_delete_folder=Unable to delete Folder due to system error:
|
||||
create_web_content_title=Create Web Content Wizard
|
||||
create_web_content_desc=This wizard helps you to create a new content item for a website.
|
||||
create_folder=Create Folder
|
||||
create_avm_folder_info=Create a new folder in the website.
|
||||
|
||||
# New User Wizard messages
|
||||
new_user_title=New User Wizard
|
||||
|
@@ -125,6 +125,10 @@
|
||||
<dialog name="deleteAvmFolder" page="/jsp/dialog/delete.jsp" managed-bean="DeleteFolderDialog"
|
||||
icon="/images/icons/delete_large.gif" title-id="delete_folder"
|
||||
description-id="delete_avm_folder_info" />
|
||||
|
||||
<dialog name="createAvmFolder" page="/jsp/wcm/create-folder-dialog.jsp" managed-bean="CreateFolderDialog"
|
||||
icon="/images/icons/create_space_large.gif" title-id="create_folder"
|
||||
description-id="create_avm_folder_info" />
|
||||
</dialogs>
|
||||
</config>
|
||||
|
||||
|
@@ -61,6 +61,20 @@
|
||||
<target>new</target>
|
||||
</action>
|
||||
|
||||
<!-- Create AVM Content -->
|
||||
<action id="create_content">
|
||||
<label-id>sandbox_create</label-id>
|
||||
<image>/images/icons/new_content.gif</image>
|
||||
<action>wizard:createWebContent</action>
|
||||
</action>
|
||||
|
||||
<!-- Create AVM folder -->
|
||||
<action id="create_folder">
|
||||
<label-id>create_folder</label-id>
|
||||
<image>/images/icons/create_space.gif</image>
|
||||
<action>dialog:createAvmFolder</action>
|
||||
</action>
|
||||
|
||||
|
||||
<!-- Actions for a document in the AVM Browse screen -->
|
||||
<action-group id="avm_file_browse">
|
||||
@@ -100,6 +114,13 @@
|
||||
<action idref="submit" />
|
||||
</action-group>
|
||||
|
||||
<!-- Actions for the Create menu in the sandbox browse screen -->
|
||||
<action-group id="avm_create_menu">
|
||||
<show-link>false</show-link>
|
||||
<action idref="create_content" />
|
||||
<action idref="create_folder" />
|
||||
</action-group>
|
||||
|
||||
</actions>
|
||||
</config>
|
||||
|
||||
|
@@ -26,6 +26,7 @@ import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.QNameMap;
|
||||
@@ -95,7 +96,7 @@ public class AVMNode implements Map<String, Object>
|
||||
for (QName qname: props.keySet())
|
||||
{
|
||||
PropertyValue propValue = props.get(qname);
|
||||
this.properties.put(qname.toString(), propValue.getSerializableValue());
|
||||
this.properties.put(qname.toString(), propValue.getValue(DataTypeDefinition.ANY));
|
||||
}
|
||||
}
|
||||
|
||||
|
124
source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java
Normal file
124
source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* 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 javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Bean implementation for the AVM "Create Folder" dialog
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class CreateFolderDialog extends BaseDialogBean
|
||||
{
|
||||
private static final Log logger = LogFactory.getLog(CreateFolderDialog.class);
|
||||
|
||||
protected AVMService avmService;
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
protected NodeService nodeService;
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
|
||||
|
||||
/**
|
||||
* @param avmBrowseBean The avmBrowseBean to set.
|
||||
*/
|
||||
public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
|
||||
{
|
||||
this.avmBrowseBean = avmBrowseBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param avmService The avmService to set.
|
||||
*/
|
||||
public void setAvmService(AVMService avmService)
|
||||
{
|
||||
this.avmService = avmService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeService The NodeService to set.
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the description.
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description The description to set.
|
||||
*/
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the name.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name The name to set.
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Dialog implementation
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
String parent = this.avmBrowseBean.getCurrentPath();
|
||||
this.avmService.createDirectory(parent, this.name);
|
||||
String path = parent + '/' + this.name;
|
||||
if (this.description != null && this.description.length() != 0)
|
||||
{
|
||||
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, path);
|
||||
this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description);
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
}
|
@@ -272,6 +272,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
* Identifier for store-types: .sandbox.staging.main and .sandbox.staging.preview
|
||||
* Store-id: .sandbox-id.<guid> (unique across all stores in the sandbox)
|
||||
* DNS: .dns.<store> = <path-to-webapps-root>
|
||||
* Website Name: .website.name = website name
|
||||
*
|
||||
* @param name The store name to create the sandbox for
|
||||
*/
|
||||
@@ -328,6 +329,12 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.avmService.setStoreProperty(previewStore,
|
||||
QName.createQName(null, sandboxIdProp),
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
dumpStoreProperties(stagingStore);
|
||||
dumpStoreProperties(previewStore);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -412,6 +419,12 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
this.avmService.setStoreProperty(previewStore, QName.createQName(null, sandboxIdProp),
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
dumpStoreProperties(userStore);
|
||||
dumpStoreProperties(previewStore);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -428,4 +441,18 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.avmService.setStoreProperty(store, QName.createQName(null, dnsProp),
|
||||
new PropertyValue(DataTypeDefinition.TEXT, path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Debug helper method to dump the properties of a store
|
||||
*
|
||||
* @param store Store name to dump properties for
|
||||
*/
|
||||
private void dumpStoreProperties(String store)
|
||||
{
|
||||
Map<QName, PropertyValue> props = avmService.getStoreProperties(store);
|
||||
for (QName name : props.keySet())
|
||||
{
|
||||
logger.debug(" " + name + ": " + props.get(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -762,6 +762,27 @@
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>
|
||||
The bean that backs up the Create AVM Folder Dialog
|
||||
</description>
|
||||
<managed-bean-name>CreateFolderDialog</managed-bean-name>
|
||||
<managed-bean-class>org.alfresco.web.bean.wcm.CreateFolderDialog</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
<managed-property>
|
||||
<property-name>avmService</property-name>
|
||||
<value>#{AVMService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>avmBrowseBean</property-name>
|
||||
<value>#{AVMBrowseBean}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>nodeService</property-name>
|
||||
<value>#{NodeService}</value>
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>
|
||||
The bean that backs up the Set Content Properties Dialog
|
||||
|
@@ -76,8 +76,12 @@
|
||||
</td>
|
||||
<td align=right>
|
||||
<a:actionLink value="#{msg.sandbox_preview}" image="/images/icons/preview_website.gif" href="#{AVMBrowseBean.sandboxPreviewUrl}" target="new" />
|
||||
|
||||
<a:actionLink value="#{msg.sandbox_create}" image="/images/icons/new_content.gif" action="wizard:createWebContent" />
|
||||
</td>
|
||||
<td width=80 style="padding-left:4px">
|
||||
<%-- Create actions menu --%>
|
||||
<a:menu id="createMenu" itemSpacing="4" label="#{msg.create_options}" image="/images/icons/menu.gif" menuStyleClass="moreActionsMenu" style="white-space:nowrap">
|
||||
<r:actions id="acts_create" value="avm_create_menu" context="#{AVMBrowseBean.avmNode}" />
|
||||
</a:menu>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
106
source/web/jsp/wcm/create-folder-dialog.jsp
Normal file
106
source/web/jsp/wcm/create-folder-dialog.jsp
Normal file
@@ -0,0 +1,106 @@
|
||||
<%--
|
||||
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" %>
|
||||
|
||||
<f:verbatim>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/validation.js"> </script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var finishButtonPressed = false;
|
||||
window.onload = pageLoaded;
|
||||
|
||||
function pageLoaded()
|
||||
{
|
||||
document.getElementById("dialog:dialog-body:name").focus();
|
||||
document.getElementById("dialog").onsubmit = validate;
|
||||
document.getElementById("dialog:finish-button").onclick = function() {finishButtonPressed = true; clear_dialog();}
|
||||
checkButtonState();
|
||||
}
|
||||
|
||||
function checkButtonState()
|
||||
{
|
||||
if (document.getElementById("dialog:dialog-body:name").value.length == 0 )
|
||||
{
|
||||
document.getElementById("dialog:finish-button").disabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById("dialog:finish-button").disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
function validate()
|
||||
{
|
||||
if (finishButtonPressed)
|
||||
{
|
||||
finishButtonPressed = false;
|
||||
return validateName(document.getElementById("dialog:dialog-body:name"),
|
||||
'</f:verbatim><a:outputText value="#{msg.validation_invalid_character}" /><f:verbatim>',
|
||||
true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<table cellpadding="2" cellspacing="2" border="0" width="100%">
|
||||
<tr>
|
||||
<td colspan="3" class="wizardSectionHeading">
|
||||
</f:verbatim>
|
||||
<h:outputText value="#{msg.properties}" />
|
||||
<f:verbatim>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="middle">
|
||||
</f:verbatim>
|
||||
<h:graphicImage value="/images/icons/required_field.gif" alt="Required Field" />
|
||||
<f:verbatim>
|
||||
</td>
|
||||
<td>
|
||||
</f:verbatim>
|
||||
<h:outputText value="#{msg.name}:" />
|
||||
<f:verbatim>
|
||||
</td>
|
||||
<td width="85%">
|
||||
</f:verbatim>
|
||||
<h:inputText id="name" value="#{DialogManager.bean.name}" size="35" maxlength="1024"
|
||||
onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState();" />
|
||||
<f:verbatim>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
</f:verbatim>
|
||||
<h:outputText value="#{msg.description}:" />
|
||||
<f:verbatim>
|
||||
</td>
|
||||
<td>
|
||||
</f:verbatim>
|
||||
<h:inputText id="description" value="#{DialogManager.bean.description}" size="35" maxlength="1024" />
|
||||
<f:verbatim>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</f:verbatim>
|
Reference in New Issue
Block a user