- Submit action added for documents/folders for a user sandbox
   - To push a modifed item into the main staging area

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3894 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-09-22 16:31:46 +00:00
parent 1fe792cb65
commit 4591467318
6 changed files with 64 additions and 2 deletions

View File

@@ -820,6 +820,7 @@ store_created_on=Created On
store_created_by=Created By store_created_by=Created By
store_working_users=There are {0} user(s) working on this website. store_working_users=There are {0} user(s) working on this website.
avm_node_deleted=Deleted avm_node_deleted=Deleted
submit=Submit
# Website actions and dialog messages # Website actions and dialog messages
title_import_content=Import Content into Website title_import_content=Import Content into Website

View File

@@ -35,6 +35,16 @@
</params> </params>
</action> </action>
<!-- Submit AVM node -->
<action id="submit">
<label-id>submit</label-id>
<image>/images/icons/submit.gif</image>
<action-listener>#{AVMBrowseBean.submitNode}</action-listener>
<params>
<param name="id">#{actionContext.path}</param>
</params>
</action>
<!-- Actions for a document in the AVM Browse screen --> <!-- Actions for a document in the AVM Browse screen -->
<action-group id="avm_file_browse"> <action-group id="avm_file_browse">
@@ -53,12 +63,14 @@
<action-group id="avm_file_modified"> <action-group id="avm_file_modified">
<show-link>false</show-link> <show-link>false</show-link>
<action idref="edit_file" /> <action idref="edit_file" />
<action idref="submit" />
<action idref="delete_file" /> <action idref="delete_file" />
</action-group> </action-group>
<!-- Actions for a folder in Modified Files list --> <!-- Actions for a folder in Modified Files list -->
<action-group id="avm_folder_modified"> <action-group id="avm_folder_modified">
<show-link>false</show-link> <show-link>false</show-link>
<action idref="submit" />
<action idref="delete_folder" /> <action idref="delete_folder" />
</action-group> </action-group>

View File

@@ -24,12 +24,15 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent; import javax.faces.event.ActionEvent;
import javax.transaction.UserTransaction; import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor; import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avm.AVMStoreDescriptor; import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
@@ -112,6 +115,8 @@ public class AVMBrowseBean implements IContextListener
/** AVM service bean reference */ /** AVM service bean reference */
protected AVMService avmService; protected AVMService avmService;
protected ActionService actionService;
/** /**
* Default Constructor * Default Constructor
@@ -193,6 +198,14 @@ public class AVMBrowseBean implements IContextListener
this.navigator = navigator; this.navigator = navigator;
} }
/**
* @param actionService The actionService to set.
*/
public void setActionService(ActionService actionService)
{
this.actionService = actionService;
}
/** /**
* Summary text for the staging store: * Summary text for the staging store:
* Created On: xx/yy/zz * Created On: xx/yy/zz
@@ -214,7 +227,8 @@ public class AVMBrowseBean implements IContextListener
if (store != null) if (store != null)
{ {
// count user stores // count user stores
int users = avmService.queryStoresPropertyKeys(QName.createQName(null, AVMConstants.PROP_SANDBOX_STORE_PREFIX + storeRoot + "-%" + AVMConstants.STORE_MAIN)).size(); int users = avmService.queryStoresPropertyKeys(QName.createQName(null,
AVMConstants.PROP_SANDBOX_STORE_PREFIX + storeRoot + "-%" + AVMConstants.STORE_MAIN)).size();
summary.append(msg.getString(MSG_CREATED_ON)).append(": ") summary.append(msg.getString(MSG_CREATED_ON)).append(": ")
.append(Utils.getDateFormat(fc).format(new Date(store.getCreateDate()))) .append(Utils.getDateFormat(fc).format(new Date(store.getCreateDate())))
.append("<p>"); .append("<p>");
@@ -567,6 +581,37 @@ public class AVMBrowseBean implements IContextListener
UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans();
} }
public void submitNode(ActionEvent event)
{
setupContentAction(event);
UserTransaction tx = null;
try
{
FacesContext context = FacesContext.getCurrentInstance();
tx = Repository.getUserTransaction(context, true);
tx.begin();
Action action = this.actionService.createAction("simple-avm-submit");
this.actionService.executeAction(action, getAvmNode().getNodeRef());
// commit the transaction
tx.commit();
// if we get here, all was well - output friendly status message to the user
String msg = "Successfully submitted: " + getAvmNode().getName();
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
String formId = Utils.getParentForm(context, event.getComponent()).getClientId(context);
context.addMessage(formId + ':' + "sandboxes-panel", facesMsg);
}
catch (Throwable err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
}
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Private helpers // Private helpers

View File

@@ -404,7 +404,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
private void tagStoreDNSPath(String store, String... components) private void tagStoreDNSPath(String store, String... components)
{ {
String path = store + ":/" + AVMConstants.DIR_APPBASE + '/' + AVMConstants.DIR_WEBAPPS; String path = store + ":/" + AVMConstants.DIR_APPBASE + '/' + AVMConstants.DIR_WEBAPPS;
// TODO: DNS name mangle the property name - can only contain value DNS characters! // DNS name mangle the property name - can only contain value DNS characters!
String dnsProp = AVMConstants.PROP_DNS + DNSNameMangler.MakeDNSName(components); String dnsProp = AVMConstants.PROP_DNS + DNSNameMangler.MakeDNSName(components);
this.avmService.setStoreProperty(store, QName.createQName(null, dnsProp), this.avmService.setStoreProperty(store, QName.createQName(null, dnsProp),
new PropertyValue(DataTypeDefinition.TEXT, path)); new PropertyValue(DataTypeDefinition.TEXT, path));

View File

@@ -697,6 +697,10 @@
<property-name>nodeService</property-name> <property-name>nodeService</property-name>
<value>#{NodeService}</value> <value>#{NodeService}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>actionService</property-name>
<value>#{ActionService}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B