diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 0ba26b7851..7ea9751f5e 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -820,6 +820,7 @@ store_created_on=Created On store_created_by=Created By store_working_users=There are {0} user(s) working on this website. avm_node_deleted=Deleted +submit=Submit # Website actions and dialog messages title_import_content=Import Content into Website diff --git a/config/alfresco/web-client-config-wcm-actions.xml b/config/alfresco/web-client-config-wcm-actions.xml index 45d8eca448..a4f468d723 100644 --- a/config/alfresco/web-client-config-wcm-actions.xml +++ b/config/alfresco/web-client-config-wcm-actions.xml @@ -35,6 +35,16 @@ + + + submit + /images/icons/submit.gif + #{AVMBrowseBean.submitNode} + + #{actionContext.path} + + + @@ -53,12 +63,14 @@ false + false + diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java index 243a98757d..079a23dbe4 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java @@ -24,12 +24,15 @@ import java.util.List; import java.util.Map; import java.util.ResourceBundle; +import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; import javax.transaction.UserTransaction; import org.alfresco.model.ContentModel; 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.AVMService; import org.alfresco.service.cmr.avm.AVMStoreDescriptor; @@ -112,6 +115,8 @@ public class AVMBrowseBean implements IContextListener /** AVM service bean reference */ protected AVMService avmService; + protected ActionService actionService; + /** * Default Constructor @@ -193,6 +198,14 @@ public class AVMBrowseBean implements IContextListener this.navigator = navigator; } + /** + * @param actionService The actionService to set. + */ + public void setActionService(ActionService actionService) + { + this.actionService = actionService; + } + /** * Summary text for the staging store: * Created On: xx/yy/zz @@ -214,7 +227,8 @@ public class AVMBrowseBean implements IContextListener if (store != null) { // 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(": ") .append(Utils.getDateFormat(fc).format(new Date(store.getCreateDate()))) .append("

"); @@ -567,6 +581,37 @@ public class AVMBrowseBean implements IContextListener 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 diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java index 28d0b76c90..d04dbde837 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java @@ -404,7 +404,7 @@ public class CreateWebsiteWizard extends BaseWizardBean private void tagStoreDNSPath(String store, String... components) { 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); this.avmService.setStoreProperty(store, QName.createQName(null, dnsProp), new PropertyValue(DataTypeDefinition.TEXT, path)); diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index 7323c2660a..e7a87534a3 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -697,6 +697,10 @@ nodeService #{NodeService} + + actionService + #{ActionService} + diff --git a/source/web/images/icons/submit.gif b/source/web/images/icons/submit.gif new file mode 100644 index 0000000000..862efc17fc Binary files /dev/null and b/source/web/images/icons/submit.gif differ