diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 02d2130864..004ab62ee5 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -813,11 +813,18 @@ modified_items=Modified Items 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 # Website actions and dialog messages title_import_content=Import Content into Website import_website_content_title=Import Content into Website import_website_content_desc=Use this dialog to import an archive of content into the root of the website. +delete_avm_file_info=To remove this file from the sandbox, click OK. +delete_avm_file_confirm=Are you sure you want to remove \"{0}\" from the sandbox? +delete_folder=Delete Folder +delete_avm_folder_info=To remove this folder and its contents from the sandbox, click OK. +delete_avm_folder_confirm=Are you sure you want to remove \"{0}\" and its contents from the sandbox? +error_delete_folder=Unable to delete Folder due to system error: # New User Wizard messages new_user_title=New User Wizard diff --git a/config/alfresco/web-client-config-actions.xml b/config/alfresco/web-client-config-actions.xml index b13d45c252..30a5f274e4 100644 --- a/config/alfresco/web-client-config-actions.xml +++ b/config/alfresco/web-client-config-actions.xml @@ -323,8 +323,8 @@ /images/icons/new_content.gif wizard:createContent - - + + CreateChildren diff --git a/config/alfresco/web-client-config-dialogs.xml b/config/alfresco/web-client-config-dialogs.xml index b159613f6f..fb171144ae 100644 --- a/config/alfresco/web-client-config-dialogs.xml +++ b/config/alfresco/web-client-config-dialogs.xml @@ -90,7 +90,7 @@ - + @@ -114,6 +114,17 @@ + + + + + + + diff --git a/config/alfresco/web-client-config-wcm-actions.xml b/config/alfresco/web-client-config-wcm-actions.xml index 613a134400..45d8eca448 100644 --- a/config/alfresco/web-client-config-wcm-actions.xml +++ b/config/alfresco/web-client-config-wcm-actions.xml @@ -4,7 +4,7 @@ - + edit /images/icons/edit_icon.gif #{AVMEditBean.setupEditAction} @@ -13,17 +13,53 @@ + + + delete + /images/icons/delete.gif + #{AVMBrowseBean.setupContentAction} + dialog:deleteAvmFile + + #{actionContext.path} + + + + + + delete + /images/icons/delete.gif + #{AVMBrowseBean.setupContentAction} + dialog:deleteAvmFolder + + #{actionContext.path} + + + false - + + + + + + + false + false - + + + + + + + false + diff --git a/config/alfresco/web-client-config-wizards.xml b/config/alfresco/web-client-config-wizards.xml index e41292d177..04e000eea2 100644 --- a/config/alfresco/web-client-config-wizards.xml +++ b/config/alfresco/web-client-config-wizards.xml @@ -145,7 +145,7 @@ - + @@ -162,12 +162,6 @@ description-id="create_content_step2_desc" instruction-id="default_instruction" /> - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/project-build.xml b/project-build.xml index abc0d8654d..78c4da7d3c 100644 --- a/project-build.xml +++ b/project-build.xml @@ -53,8 +53,8 @@ - + diff --git a/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java b/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java index 422b9a8a23..5c42fe71a3 100644 --- a/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java +++ b/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java @@ -944,10 +944,10 @@ public class CheckinCheckoutBean private static Log logger = LogFactory.getLog(CheckinCheckoutBean.class); /** I18N messages */ - private static final String MSG_ERROR_CHECKIN = "error_checkin"; - private static final String MSG_ERROR_CANCELCHECKOUT = "error_cancel_checkout"; - private static final String MSG_ERROR_UPDATE = "error_update"; - private static final String MSG_ERROR_CHECKOUT = "error_checkout"; + public static final String MSG_ERROR_CHECKIN = "error_checkin"; + public static final String MSG_ERROR_CANCELCHECKOUT = "error_cancel_checkout"; + public static final String MSG_ERROR_UPDATE = "error_update"; + public static final String MSG_ERROR_CHECKOUT = "error_checkout"; /** constants for copy location selection */ private static final String COPYLOCATION_CURRENT = "current"; diff --git a/source/java/org/alfresco/web/bean/content/BaseContentWizard.java b/source/java/org/alfresco/web/bean/content/BaseContentWizard.java index 94c8b33970..040392a7fe 100644 --- a/source/java/org/alfresco/web/bean/content/BaseContentWizard.java +++ b/source/java/org/alfresco/web/bean/content/BaseContentWizard.java @@ -381,7 +381,7 @@ public abstract class BaseContentWizard extends BaseWizardBean } else { - writer.putContent(strContent == null ? "" : strContent); + writer.putContent(strContent == null ? "" : strContent); } // remember the created node now diff --git a/source/java/org/alfresco/web/bean/content/CreateContentWizard.java b/source/java/org/alfresco/web/bean/content/CreateContentWizard.java index ca61c9a54b..2a3892ee83 100644 --- a/source/java/org/alfresco/web/bean/content/CreateContentWizard.java +++ b/source/java/org/alfresco/web/bean/content/CreateContentWizard.java @@ -17,7 +17,6 @@ package org.alfresco.web.bean.content; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Map; import java.util.ResourceBundle; @@ -35,17 +34,9 @@ import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.Node; import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.QuickSort; -import org.alfresco.web.templating.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.alfresco.model.ContentModel; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.ContentWriter; -import java.io.OutputStreamWriter; -import org.alfresco.web.app.servlet.FacesHelper; - /** * Bean implementation for the "Create Content Wizard" dialog * @@ -54,11 +45,9 @@ import org.alfresco.web.app.servlet.FacesHelper; public class CreateContentWizard extends BaseContentWizard { protected String content = null; - protected String templateTypeName; protected List createMimeTypes; - private static final Log LOGGER = - LogFactory.getLog(CreateContentWizard.class); + private static Log logger = LogFactory.getLog(CreateContentWizard.class); // ------------------------------------------------------------------------------ @@ -68,25 +57,7 @@ public class CreateContentWizard extends BaseContentWizard protected String finishImpl(FacesContext context, String outcome) throws Exception { - LOGGER.debug("saving file content to " + this.fileName); saveContent(null, this.content); - if (this.templateTypeName != null) - { - LOGGER.debug("generating template output for " + this.templateTypeName); - this.nodeService.setProperty(this.createdNode, - TemplatingService.TT_QNAME, - this.templateTypeName); - TemplatingService ts = TemplatingService.getInstance(); - TemplateType tt = this.getTemplateType(); - OutputUtil.generate(this.createdNode, - ts.parseXML(this.content), - tt, - this.fileName, - this.getContainerNodeRef(), - this.fileFolderService, - this.contentService, - this.nodeService); - } // return the default outcome return outcome; @@ -99,7 +70,6 @@ public class CreateContentWizard extends BaseContentWizard this.content = null; this.inlineEdit = true; - this.templateTypeName = null; this.mimeType = MimetypeMap.MIMETYPE_HTML; } @@ -163,20 +133,6 @@ public class CreateContentWizard extends BaseContentWizard this.content = content; } - public List getCreateTemplateTypes() - { - Collection ttl = TemplatingService.getInstance().getTemplateTypes(); - List sil = new ArrayList(ttl.size()); - for (TemplateType tt : ttl) - { - sil.add(new SelectItem(tt.getName(), tt.getName())); - } - - QuickSort sorter = new QuickSort(sil, "label", true, IDataContainer.SORT_CASEINSENSITIVE); - sorter.sort(); - return sil; - } - /** * @return Returns a list of mime types to allow the user to select from */ @@ -213,12 +169,12 @@ public class CreateContentWizard extends BaseContentWizard } else { - LOGGER.warn("Could not find 'create-mime-types' configuration element"); + logger.warn("Could not find 'create-mime-types' configuration element"); } } else { - LOGGER.warn("Could not find 'Content Wizards' configuration section"); + logger.warn("Could not find 'Content Wizards' configuration section"); } } @@ -226,25 +182,6 @@ public class CreateContentWizard extends BaseContentWizard return this.createMimeTypes; } - public String getTemplateTypeName() - { - return this.templateTypeName; - } - - public TemplateType getTemplateType() - { - final TemplatingService ts = TemplatingService.getInstance(); - return ts.getTemplateType(this.getTemplateTypeName()); - } - - /** - * @param templateType Sets the currently selected template type - */ - public void setTemplateTypeName(final String templateTypeName) - { - this.templateTypeName = templateTypeName; - } - /** * @return Returns the summary data for the wizard. */ @@ -261,6 +198,7 @@ public class CreateContentWizard extends BaseContentWizard getSummaryMimeType(this.mimeType)}); } + // ------------------------------------------------------------------------------ // Action event handlers @@ -272,12 +210,4 @@ public class CreateContentWizard extends BaseContentWizard // clear the content as HTML is not compatible with the plain text box etc. this.content = null; } - - // ------------------------------------------------------------------------------ - // Service Injection - - - // ------------------------------------------------------------------------------ - // Helper methods - } diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java index 794c50e206..bf27b87550 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java @@ -51,6 +51,7 @@ import org.alfresco.web.ui.common.component.UIActionLink; import org.alfresco.web.ui.common.component.UIBreadcrumb; import org.alfresco.web.ui.common.component.data.UIRichList; import org.alfresco.web.ui.wcm.WebResources; +import org.alfresco.web.ui.wcm.component.UIUserSandboxes; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -74,12 +75,19 @@ public class AVMBrowseBean implements IContextListener private String sandboxTitle = null; private String currentPath = null; + /* component references */ private UIRichList foldersRichList; private UIRichList filesRichList; + private UIUserSandboxes userSandboxes; + /* transient lists of files/folders for a directory */ private List files = null; private List folders = null; + /** Current AVM Node context*/ + private AVMNode avmNode = null; + + /** breadcrumb location */ private List location = null; /** The NodeService to be used by the bean */ @@ -131,6 +139,11 @@ public class AVMBrowseBean implements IContextListener { this.nodeService = nodeService; } + + public NodeService getNodeService() + { + return this.nodeService; + } /** * @param dictionaryService The DictionaryService to set. @@ -239,7 +252,23 @@ public class AVMBrowseBean implements IContextListener { this.filesRichList = filesRichList; } - + + /** + * @return Returns the userSandboxes. + */ + public UIUserSandboxes getUserSandboxes() + { + return this.userSandboxes; + } + + /** + * @param userSandboxes The userSandboxes to set. + */ + public void setUserSandboxes(UIUserSandboxes userSandboxes) + { + this.userSandboxes = userSandboxes; + } + /** * @return Returns the sandbox. */ @@ -316,6 +345,53 @@ public class AVMBrowseBean implements IContextListener return this.navigator.getCurrentNode(); } + /** + * @return Returns the current AVM node context. + */ + public AVMNode getAvmNode() + { + return this.avmNode; + } + + /** + * @param avmNode The AVM node context to set. + */ + public void setAvmNode(AVMNode avmNode) + { + this.avmNode = avmNode; + } + + /** + * @param avmRef The AVMNodeDescriptor context to set. + */ + public void setAVMNodeDescriptor(AVMNodeDescriptor avmRef) + { + this.avmNode = new AVMNode(avmRef); + } + + /** + * @return Breadcrumb location list + */ + public List getLocation() + { + if (this.location == null) + { + List loc = new ArrayList(8); + loc.add(new AVMBreadcrumbHandler(getCurrentPath())); + + this.location = loc; + } + return this.location; + } + + /** + * @param location Breadcrumb location list + */ + public void setLocation(List location) + { + this.location = location; + } + /** * @return Map of avm node objects representing the folders with the current website space */ @@ -390,6 +466,10 @@ public class AVMBrowseBean implements IContextListener } } + + // ------------------------------------------------------------------------------ + // Action event handlers + /** * Update the UI after a folder click action in the website browsing screens */ @@ -434,27 +514,33 @@ public class AVMBrowseBean implements IContextListener } /** - * @return Breadcrumb location list + * Action event called by all actions that need to setup a Content node context on the + * before an action page/wizard is called. The context will be an AVMNodeDescriptor in + * setAVMNode() which can be retrieved on action pages via getAVMNode(). + * + * @param event ActionEvent */ - public List getLocation() + public void setupContentAction(ActionEvent event) { - if (this.location == null) + UIActionLink link = (UIActionLink)event.getComponent(); + Map params = link.getParameterMap(); + String path = params.get("id"); + if (path != null && path.length() != 0) { - List loc = new ArrayList(8); - loc.add(new AVMBreadcrumbHandler(getCurrentPath())); - - this.location = loc; + setAVMNodeDescriptor(avmService.lookup(-1, path)); } - return this.location; + else + { + setAVMNodeDescriptor(null); + } + + // update UI state ready for return after dialog close + UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); } - /** - * @param location Breadcrumb location list - */ - public void setLocation(List location) - { - this.location = location; - } + + // ------------------------------------------------------------------------------ + // Private helpers /** * @return the internal AVM path to the current folder for browsing diff --git a/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java b/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java index fc9b4e6f7e..c5188f42a7 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java @@ -16,21 +16,24 @@ */ package org.alfresco.web.bean.wcm; -import java.util.Map; - 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.repo.content.MimetypeMap; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.ui.common.component.UIActionLink; +import org.alfresco.web.app.AlfrescoNavigationHandler; +import org.alfresco.web.app.Application; +import org.alfresco.web.app.servlet.DownloadContentServlet; +import org.alfresco.web.bean.CheckinCheckoutBean; +import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.ui.common.Utils; /** * Bean backing the edit pages for a AVM node content. @@ -38,10 +41,7 @@ import org.alfresco.web.ui.common.component.UIActionLink; * @author Kevin Roast */ public class AVMEditBean -{ - /** Current AVM Node context*/ - private AVMNodeDescriptor avmNode = null; - +{ private String documentContent = null; private String editorOutput = null; @@ -49,6 +49,9 @@ public class AVMEditBean /** AVM service bean reference */ protected AVMService avmService; + /** AVM Browse Bean reference */ + protected AVMBrowseBean avmBrowseBean; + /** The ContentService bean reference */ protected ContentService contentService; @@ -57,13 +60,21 @@ public class AVMEditBean // Bean property getters and setters /** - * @param avmService The AVMService to set. + * @param avmService The AVMService to set. */ public void setAvmService(AVMService avmService) { this.avmService = avmService; } + /** + * @param avmBrowseBean The AVMBrowseBean to set. + */ + public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) + { + this.avmBrowseBean = avmBrowseBean; + } + /** * @param contentService The ContentService to set. */ @@ -75,17 +86,33 @@ public class AVMEditBean /** * @return Returns the current AVM node context. */ - public AVMNodeDescriptor getAVMNode() + public AVMNode getAvmNode() { - return this.avmNode; + return this.avmBrowseBean.getAvmNode(); } - + /** - * @param avmNode The AVM node context to set. + * @return Large file icon for current AVM node */ - public void setAVMNode(AVMNodeDescriptor avmNode) + public String getFileType32() { - this.avmNode = avmNode; + return Utils.getFileTypeImage(getAvmNode().getName(), false); + } + + /** + * @return Small file icon for current AVM node + */ + public String getFileType16() + { + return Utils.getFileTypeImage(getAvmNode().getName(), true); + } + + /** + * @return Content URL for current AVM node + */ + public String getUrl() + { + return DownloadContentServlet.generateDownloadURL(AVMNodeConverter.ToNodeRef(-1, getAvmNode().getPath()), getAvmNode().getName()); } /** @@ -124,38 +151,16 @@ public class AVMEditBean // ------------------------------------------------------------------------------ // Action event handlers - /** - * Action event called by all actions that need to setup a Content node context on the - * before an action page/wizard is called. The context will be an AVMNodeDescriptor in - * setAVMNode() which can be retrieved on action pages via getAVMNode(). - * - * @param event ActionEvent - */ - public void setupContentAction(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - String path = params.get("id"); - if (path != null && path.length() != 0) - { - setAVMNode(avmService.lookup(-1, path)); - } - else - { - setAVMNode(null); - } - } - /** * Action handler called to calculate which editing screen to display based on the mimetype * of a document. If appropriate, the in-line editing screen will be shown. */ public void setupEditAction(ActionEvent event) { - setupContentAction(event); + this.avmBrowseBean.setupContentAction(event); // retrieve the content reader for this node - NodeRef avmRef = AVMNodeConverter.ToNodeRef(-1, getAVMNode().getPath()); + NodeRef avmRef = AVMNodeConverter.ToNodeRef(-1, getAvmNode().getPath()); ContentReader reader = contentService.getReader(avmRef, ContentModel.PROP_CONTENT); if (reader != null) { @@ -201,4 +206,81 @@ public class AVMEditBean } } } + + /** + * Action called upon completion of the Edit File download page + */ + public String editFileOK() + { + String outcome = null; + + AVMNode node = getAvmNode(); + if (node != null) + { + resetState(); + + outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; + } + + return outcome; + } + + /** + * Action handler called to set the content of a node from an inline editing page. + */ + public String editInlineOK() + { + String outcome = null; + + UserTransaction tx = null; + + AVMNode avmNode = getAvmNode(); + if (avmNode != null) + { + NodeRef avmRef = AVMNodeConverter.ToNodeRef(-1, getAvmNode().getPath()); + try + { + tx = Repository.getUserTransaction(FacesContext.getCurrentInstance()); + tx.begin(); + + // get an updating writer that we can use to modify the content on the current node + ContentWriter writer = this.contentService.getWriter(avmRef, ContentModel.PROP_CONTENT, true); + writer.putContent(this.editorOutput); + + // commit the transaction + tx.commit(); + + // TODO: generate template content + /*if (nodeService.getProperty(node.getNodeRef(), + TemplatingService.TT_QNAME) != null) + { + OutputUtil.regenerate(node.getNodeRef(), + this.contentService, + this.nodeService); + }*/ + + resetState(); + + outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; + } + catch (Throwable err) + { + // rollback the transaction + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + Utils.addErrorMessage(Application.getMessage( + FacesContext.getCurrentInstance(), CheckinCheckoutBean.MSG_ERROR_UPDATE) + err.getMessage()); + } + } + + return outcome; + } + + private void resetState() + { + // clean up and clear action context + //clearUpload(); + this.avmBrowseBean.setAvmNode(null); + setDocumentContent(null); + setEditorOutput(null); + } } diff --git a/source/java/org/alfresco/web/bean/wcm/AVMNode.java b/source/java/org/alfresco/web/bean/wcm/AVMNode.java index 95357c7485..c2bd838166 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMNode.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMNode.java @@ -16,21 +16,19 @@ */ package org.alfresco.web.bean.wcm; -import java.io.Serializable; import java.util.Collection; import java.util.Map; import java.util.Set; -import java.util.Map.Entry; import javax.faces.context.FacesContext; +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.repository.NodeRef; import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QNameMap; -import org.alfresco.web.bean.repository.NodePropertyResolver; -import org.alfresco.web.bean.repository.QNameNodeMap; import org.alfresco.web.bean.repository.Repository; /** @@ -66,6 +64,16 @@ public class AVMNode implements Map { return this.version; } + + public String getName() + { + return this.avmRef.getName(); + } + + public NodeRef getNodeRef() + { + return AVMNodeConverter.ToNodeRef(this.version, this.path); + } /** * @return All the properties known about this node. @@ -156,22 +164,7 @@ public class AVMNode implements Map */ public Object get(Object key) { - Object obj = null; - - // there are some things that aren't available as properties - // but from method calls, so for these handle them individually - Map props = getProperties(); - /*if (propsInitialised == false) - { - // well known properties required as publically accessable map attributes - props.put("id", this.getId()); - props.put("name", this.getName()); // TODO: perf test pulling back single prop here instead of all! - props.put("nodeRef", this.getNodeRef()); - - propsInitialised = true; - }*/ - - return props.get(key); + return getProperties().get(key); } /** diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java new file mode 100644 index 0000000000..f0d2706b55 --- /dev/null +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java @@ -0,0 +1,269 @@ +/* + * 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.List; +import java.util.Map; +import java.util.ResourceBundle; + +import javax.faces.context.FacesContext; +import javax.faces.event.ValueChangeEvent; +import javax.faces.model.SelectItem; + +import org.alfresco.config.Config; +import org.alfresco.config.ConfigElement; +import org.alfresco.config.ConfigService; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.web.app.AlfrescoNavigationHandler; +import org.alfresco.web.app.Application; +import org.alfresco.web.bean.content.BaseContentWizard; +import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.data.IDataContainer; +import org.alfresco.web.data.QuickSort; +import org.alfresco.web.templating.OutputUtil; +import org.alfresco.web.templating.TemplateType; +import org.alfresco.web.templating.TemplatingService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Bean implementation for the "Create Web Content Wizard" dialog + */ +public class CreateWebContentWizard extends BaseContentWizard +{ + protected String content = null; + protected String templateTypeName; + protected List createMimeTypes; + + private static final Log logger = LogFactory.getLog(CreateWebContentWizard.class); + + + // ------------------------------------------------------------------------------ + // Wizard implementation + + @Override + protected String finishImpl(FacesContext context, String outcome) + throws Exception + { + logger.debug("saving file content to " + this.fileName); + saveContent(null, this.content); + if (this.templateTypeName != null) + { + logger.debug("generating template output for " + this.templateTypeName); + this.nodeService.setProperty(this.createdNode, + TemplatingService.TT_QNAME, + this.templateTypeName); + TemplatingService ts = TemplatingService.getInstance(); + TemplateType tt = this.getTemplateType(); + OutputUtil.generate(this.createdNode, + ts.parseXML(this.content), + tt, + this.fileName, + this.getContainerNodeRef(), + this.fileFolderService, + this.contentService, + this.nodeService); + } + + // return the default outcome + return outcome; + } + + @Override + public void init(Map parameters) + { + super.init(parameters); + + this.content = null; + this.inlineEdit = true; + this.templateTypeName = null; + this.mimeType = MimetypeMap.MIMETYPE_XML; + } + + @Override + public boolean getNextButtonDisabled() + { + // TODO: Allow the next button state to be configured so that + // wizard implementations don't have to worry about + // checking step numbers + + boolean disabled = false; + int step = Application.getWizardManager().getCurrentStep(); + switch(step) + { + case 1: + { + disabled = (this.fileName == null || this.fileName.length() == 0); + break; + } + } + + return disabled; + } + + @Override + protected String doPostCommitProcessing(FacesContext context, String outcome) + { + // as we were successful, go to the set properties dialog if asked + // to otherwise just return + if (this.showOtherProperties) + { + // we are going to immediately edit the properties so we need + // to setup the BrowseBean context appropriately + this.browseBean.setDocument(new Node(this.createdNode)); + + return getDefaultFinishOutcome() + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + + "dialog:setContentProperties"; + } + else + { + return outcome; + } + } + + // ------------------------------------------------------------------------------ + // Bean Getters and Setters + + /** + * @return Returns the content from the edited form. + */ + public String getContent() + { + return this.content; + } + + /** + * @param content The content to edit (should be clear initially) + */ + public void setContent(String content) + { + this.content = content; + } + + public List getCreateTemplateTypes() + { + Collection ttl = TemplatingService.getInstance().getTemplateTypes(); + List sil = new ArrayList(ttl.size()); + for (TemplateType tt : ttl) + { + sil.add(new SelectItem(tt.getName(), tt.getName())); + } + + QuickSort sorter = new QuickSort(sil, "label", true, IDataContainer.SORT_CASEINSENSITIVE); + sorter.sort(); + return sil; + } + + /** + * @return Returns a list of mime types to allow the user to select from + */ + public List getCreateMimeTypes() + { + if (this.createMimeTypes == null) + { + FacesContext context = FacesContext.getCurrentInstance(); + + // add the well known object type to start with + this.createMimeTypes = new ArrayList(5); + + // add the configured create mime types to the list + ConfigService svc = Application.getConfigService(context); + Config wizardCfg = svc.getConfig("Content Wizards"); + if (wizardCfg != null) + { + ConfigElement typesCfg = wizardCfg.getConfigElement("create-mime-types"); + if (typesCfg != null) + { + for (ConfigElement child : typesCfg.getChildren()) + { + String currentMimeType = child.getAttribute("name"); + if (currentMimeType != null) + { + String label = getSummaryMimeType(currentMimeType); + this.createMimeTypes.add(new SelectItem(currentMimeType, label)); + } + } + + // make sure the list is sorted by the label + QuickSort sorter = new QuickSort(this.objectTypes, "label", true, IDataContainer.SORT_CASEINSENSITIVE); + sorter.sort(); + } + else + { + logger.warn("Could not find 'create-mime-types' configuration element"); + } + } + else + { + logger.warn("Could not find 'Content Wizards' configuration section"); + } + + } + + return this.createMimeTypes; + } + + public String getTemplateTypeName() + { + return this.templateTypeName; + } + + public TemplateType getTemplateType() + { + final TemplatingService ts = TemplatingService.getInstance(); + return ts.getTemplateType(this.getTemplateTypeName()); + } + + /** + * @param templateType Sets the currently selected template type + */ + public void setTemplateTypeName(final String templateTypeName) + { + this.templateTypeName = templateTypeName; + } + + /** + * @return Returns the summary data for the wizard. + */ + public String getSummary() + { + ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); + + // TODO: show first few lines of content here? + return buildSummary( + new String[] {bundle.getString("file_name"), + bundle.getString("type"), + bundle.getString("content_type")}, + new String[] {this.fileName, getSummaryObjectType(), + getSummaryMimeType(this.mimeType)}); + } + + + // ------------------------------------------------------------------------------ + // Action event handlers + + /** + * Create content type value changed by the user + */ + public void createContentChanged(ValueChangeEvent event) + { + // clear the content as HTML is not compatible with the plain text box etc. + this.content = null; + } +} diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java index 731ac133f5..7061e2a7c0 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java @@ -102,7 +102,7 @@ public class CreateWebsiteWizard extends BaseWizardBean // create the AVM stores (layers) to represent the newly created location website createStagingSandbox(this.name); - // create a sandbox for each user (TODO: based on role?) + // create a sandbox for each user - TODO: based on role? List invitedUsers = getInvitedUsernames(); invitedUsers.add(Application.getCurrentUser(context).getUserName()); for (String username : invitedUsers) @@ -113,8 +113,6 @@ public class CreateWebsiteWizard extends BaseWizardBean // save the list of invited users against the store this.nodeService.setProperty(nodeRef, ContentModel.PROP_USERSANDBOXES, (Serializable)invitedUsers); - // TODO: import the ZIP structure into the AVM staging store - // set the property on the node to reference the AVM store this.nodeService.setProperty(nodeRef, ContentModel.PROP_AVMSTORE, this.name); diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java new file mode 100644 index 0000000000..9ec5f486cc --- /dev/null +++ b/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java @@ -0,0 +1,110 @@ +package org.alfresco.web.bean.wcm; + +import java.text.MessageFormat; + +import javax.faces.context.FacesContext; + +import org.alfresco.service.cmr.avm.AVMService; +import org.alfresco.web.app.AlfrescoNavigationHandler; +import org.alfresco.web.app.Application; +import org.alfresco.web.bean.dialog.BaseDialogBean; +import org.alfresco.web.bean.repository.Node; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Bean implementation for the AVM "Delete File" dialog + * + * @author kevinr + */ +public class DeleteFileDialog extends BaseDialogBean +{ + private static final Log logger = LogFactory.getLog(DeleteFileDialog.class); + + protected AVMService avmService; + protected AVMBrowseBean avmBrowseBean; + + + /** + * @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; + } + + + // ------------------------------------------------------------------------------ + // Dialog implementation + + @Override + protected String finishImpl(FacesContext context, String outcome) + throws Exception + { + // get the content to delete + AVMNode node = this.avmBrowseBean.getAvmNode(); + if (node != null) + { + if (logger.isDebugEnabled()) + logger.debug("Trying to delete AVM node: " + node.getPath()); + + // delete the node + this.avmService.removeNode( + node.getPath().substring(0, node.getPath().lastIndexOf('/')), + node.getPath().substring(node.getPath().lastIndexOf('/') + 1)); + } + else + { + logger.warn("WARNING: delete called without a current AVM Node!"); + } + + return outcome; + } + + @Override + protected String doPostCommitProcessing(FacesContext context, String outcome) + { + // clear action context + this.avmBrowseBean.setAvmNode(null); + + return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; + } + + @Override + protected String getErrorMessageId() + { + return "error_delete_file"; + } + + @Override + public boolean getFinishButtonDisabled() + { + return false; + } + + + // ------------------------------------------------------------------------------ + // Bean Getters and Setters + + /** + * Returns the confirmation to display to the user before deleting the content. + * + * @return The formatted message to display + */ + public String getConfirmMessage() + { + String fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(), + "delete_avm_file_confirm"); + + return MessageFormat.format(fileConfirmMsg, + new Object[] {this.avmBrowseBean.getAvmNode().getName()}); + } +} diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java new file mode 100644 index 0000000000..b9aa6f2339 --- /dev/null +++ b/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java @@ -0,0 +1,110 @@ +package org.alfresco.web.bean.wcm; + +import java.text.MessageFormat; + +import javax.faces.context.FacesContext; + +import org.alfresco.service.cmr.avm.AVMService; +import org.alfresco.web.app.AlfrescoNavigationHandler; +import org.alfresco.web.app.Application; +import org.alfresco.web.bean.dialog.BaseDialogBean; +import org.alfresco.web.bean.repository.Node; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Bean implementation for the AVM "Delete Folder" dialog + * + * @author kevinr + */ +public class DeleteFolderDialog extends BaseDialogBean +{ + private static final Log logger = LogFactory.getLog(DeleteFolderDialog.class); + + protected AVMService avmService; + protected AVMBrowseBean avmBrowseBean; + + + /** + * @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; + } + + + // ------------------------------------------------------------------------------ + // Dialog implementation + + @Override + protected String finishImpl(FacesContext context, String outcome) + throws Exception + { + // get the content to delete + AVMNode node = this.avmBrowseBean.getAvmNode(); + if (node != null) + { + if (logger.isDebugEnabled()) + logger.debug("Trying to delete AVM node: " + node.getPath()); + + // delete the node + this.avmService.removeNode( + node.getPath().substring(0, node.getPath().lastIndexOf('/')), + node.getPath().substring(node.getPath().lastIndexOf('/') + 1)); + } + else + { + logger.warn("WARNING: delete called without a current AVM Node!"); + } + + return outcome; + } + + @Override + protected String doPostCommitProcessing(FacesContext context, String outcome) + { + // clear action context + this.avmBrowseBean.setAvmNode(null); + + return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; + } + + @Override + protected String getErrorMessageId() + { + return "error_delete_folder"; + } + + @Override + public boolean getFinishButtonDisabled() + { + return false; + } + + + // ------------------------------------------------------------------------------ + // Bean Getters and Setters + + /** + * Returns the confirmation to display to the user before deleting the content. + * + * @return The formatted message to display + */ + public String getConfirmMessage() + { + String fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(), + "delete_avm_folder_confirm"); + + return MessageFormat.format(fileConfirmMsg, + new Object[] {this.avmBrowseBean.getAvmNode().getName()}); + } +} diff --git a/source/java/org/alfresco/web/templating/OutputUtil.java b/source/java/org/alfresco/web/templating/OutputUtil.java index 2516358064..7efe39d174 100644 --- a/source/java/org/alfresco/web/templating/OutputUtil.java +++ b/source/java/org/alfresco/web/templating/OutputUtil.java @@ -42,205 +42,205 @@ import org.w3c.dom.Document; */ public class OutputUtil { - private static final Log LOGGER = LogFactory.getLog(OutputUtil.class); - private static final String PARENT_AVM_PATH = - "repo-1:/repo-1/alice/appBase/avm_webapps/ROOT"; - - private static String stripExtension(String s) - { - return s.replaceAll("(.+)\\..*", "$1"); - } - - private static String getAVMParentPath(NodeRef nodeRef, - NodeService nodeService) - throws Exception - { - ChildAssociationRef caf = nodeService.getPrimaryParent(nodeRef); - final String parentName = (String) - nodeService.getProperty(caf.getParentRef(), ContentModel.PROP_NAME); - LOGGER.debug("computed avm path " + PARENT_AVM_PATH + "/" + parentName); - final String result = PARENT_AVM_PATH + "/" + parentName; - AVMService avmService = (AVMService)AVMContext.fgInstance.fAppContext.getBean("avmService"); - if (avmService.lookup(-1, result) != null) - { - return result; - } - else - { - // avmService.createDirectory(PARENT_AVM_PATH, parentName); - return PARENT_AVM_PATH; - } - } - - public static void generate(NodeRef createdNode, - Document xml, - TemplateType tt, - String fileName, - NodeRef containerNodeRef, - FileFolderService fileFolderService, - ContentService contentService, - NodeService nodeService) - throws Exception - { - try - { - // get the node ref of the node that will contain the content - String generatedFileName = stripExtension(fileName) + ".shtml"; - FileInfo fileInfo = - fileFolderService.create(containerNodeRef, - generatedFileName, - ContentModel.TYPE_CONTENT); - NodeRef fileNodeRef = fileInfo.getNodeRef(); - - if (LOGGER.isDebugEnabled()) - LOGGER.debug("Created file node for file: " + - generatedFileName); - - // get a writer for the content and put the file - ContentWriter writer = contentService.getWriter(fileNodeRef, - ContentModel.PROP_CONTENT, true); - // set the mimetype and encoding - writer.setMimetype("text/html"); - writer.setEncoding("UTF-8"); - TemplateOutputMethod tom = tt.getOutputMethods().get(0); - OutputStreamWriter out = - new OutputStreamWriter(writer.getContentOutputStream()); - tom.generate(xml, tt, out); - out.close(); - nodeService.setProperty(fileNodeRef, - TemplatingService.TT_QNAME, - tt.getName()); - - LOGGER.debug("generated " + generatedFileName + " using " + tom); - - if (createdNode != null) - { - nodeService.setProperty(createdNode, - TemplatingService.TT_GENERATED_OUTPUT_QNAME, - fileNodeRef.toString()); - } - - AVMService avmService = (AVMService)AVMContext.fgInstance.fAppContext.getBean("avmService"); - final String parentAVMPath = getAVMParentPath(createdNode, nodeService); - try - { - out = new OutputStreamWriter(avmService.createFile(parentAVMPath, generatedFileName)); - } - catch (AVMExistsException e) - { - out = new OutputStreamWriter(avmService.getFileOutputStream(parentAVMPath + "/" + generatedFileName)); - } - LOGGER.debug("generating " + generatedFileName + " to avm"); - tom.generate(xml, tt, out); - out.close(); - try - { - out = new OutputStreamWriter(avmService.createFile(parentAVMPath, generatedFileName)); - } - catch (AVMExistsException e) - { - out = new OutputStreamWriter(avmService.getFileOutputStream(parentAVMPath + "/" + generatedFileName)); - } - LOGGER.debug("generating " + generatedFileName + " to avm"); - tom.generate(xml, tt, out); - out.close(); - - try - { - out = new OutputStreamWriter(avmService.createFile(parentAVMPath, fileName)); - } - catch (AVMExistsException e) - { - out = new OutputStreamWriter(avmService.getFileOutputStream(parentAVMPath + "/" + fileName)); - } - LOGGER.debug("writing xml " + fileName + " to avm"); - final TemplatingService ts = TemplatingService.getInstance(); - ts.writeXML(xml, out); - out.close(); - } - catch (Exception e) - { - LOGGER.error(e); - e.printStackTrace(); - throw e; - } - } - - public static void regenerate(final NodeRef nodeRef, - final ContentService contentService, - final NodeService nodeService) - throws Exception - { - try - { - final TemplatingService ts = TemplatingService.getInstance(); - final String templateTypeName = (String) - nodeService.getProperty(nodeRef, TemplatingService.TT_QNAME); - final TemplateType tt = ts.getTemplateType(templateTypeName); - - final ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); - final Document xml = ts.parseXML(reader.getContentInputStream()); - String fileName = (String) - nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - NodeRef generatedNodeRef = - new NodeRef((String) - nodeService.getProperty(nodeRef, - TemplatingService.TT_GENERATED_OUTPUT_QNAME)); - String generatedFileName = (String) - nodeService.getProperty(generatedNodeRef, - ContentModel.PROP_NAME); - - if (LOGGER.isDebugEnabled()) - LOGGER.debug("regenerating file node for : " + fileName + " (" + - nodeRef.toString() + ") to " + generatedNodeRef.toString()); - - // get a writer for the content and put the file - ContentWriter writer = contentService.getWriter(generatedNodeRef, - ContentModel.PROP_CONTENT, - true); - // set the mimetype and encoding - writer.setMimetype("text/html"); - writer.setEncoding("UTF-8"); - // put a loop to generate all output methods - TemplateOutputMethod tom = tt.getOutputMethods().get(0); - OutputStreamWriter out = - new OutputStreamWriter(writer.getContentOutputStream()); - tom.generate(xml, tt, out); - out.close(); - - LOGGER.debug("generated " + fileName + " using " + tom); - - AVMService avmService = (AVMService)AVMContext.fgInstance.fAppContext.getBean("avmService"); - final String parentAVMPath = getAVMParentPath(nodeRef, nodeService); - try - { - out = new OutputStreamWriter(avmService.createFile(parentAVMPath, generatedFileName)); - } - catch (AVMExistsException e) - { - out = new OutputStreamWriter(avmService.getFileOutputStream(parentAVMPath + "/" + generatedFileName)); - } - LOGGER.debug("generating " + generatedFileName + " to avm"); - tom.generate(xml, tt, out); - out.close(); - - try - { - out = new OutputStreamWriter(avmService.createFile(parentAVMPath, fileName)); - } - catch (AVMExistsException e) - { - out = new OutputStreamWriter(avmService.getFileOutputStream(parentAVMPath + "/" + fileName)); - } - LOGGER.debug("writing xml " + fileName + " to avm"); - ts.writeXML(xml, out); - out.close(); - } - catch (Exception e) - { - LOGGER.error(e); - e.printStackTrace(); - throw e; - } - } + private static final Log LOGGER = LogFactory.getLog(OutputUtil.class); + private static final String PARENT_AVM_PATH = + "repo-1:/repo-1/alice/appBase/avm_webapps/ROOT"; + + private static String stripExtension(String s) + { + return s.replaceAll("(.+)\\..*", "$1"); + } + + private static String getAVMParentPath(NodeRef nodeRef, + NodeService nodeService) + throws Exception + { + ChildAssociationRef caf = nodeService.getPrimaryParent(nodeRef); + final String parentName = (String) + nodeService.getProperty(caf.getParentRef(), ContentModel.PROP_NAME); + LOGGER.debug("computed avm path " + PARENT_AVM_PATH + "/" + parentName); + final String result = PARENT_AVM_PATH + "/" + parentName; + AVMService avmService = (AVMService)AVMContext.fgInstance.fAppContext.getBean("avmService"); + if (avmService.lookup(-1, result) != null) + { + return result; + } + else + { + // avmService.createDirectory(PARENT_AVM_PATH, parentName); + return PARENT_AVM_PATH; + } + } + + public static void generate(NodeRef createdNode, + Document xml, + TemplateType tt, + String fileName, + NodeRef containerNodeRef, + FileFolderService fileFolderService, + ContentService contentService, + NodeService nodeService) + throws Exception + { + try + { + // get the node ref of the node that will contain the content + String generatedFileName = stripExtension(fileName) + ".shtml"; + FileInfo fileInfo = + fileFolderService.create(containerNodeRef, + generatedFileName, + ContentModel.TYPE_CONTENT); + NodeRef fileNodeRef = fileInfo.getNodeRef(); + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Created file node for file: " + + generatedFileName); + + // get a writer for the content and put the file + ContentWriter writer = contentService.getWriter(fileNodeRef, + ContentModel.PROP_CONTENT, true); + // set the mimetype and encoding + writer.setMimetype("text/html"); + writer.setEncoding("UTF-8"); + TemplateOutputMethod tom = tt.getOutputMethods().get(0); + OutputStreamWriter out = + new OutputStreamWriter(writer.getContentOutputStream()); + tom.generate(xml, tt, out); + out.close(); + nodeService.setProperty(fileNodeRef, + TemplatingService.TT_QNAME, + tt.getName()); + + LOGGER.debug("generated " + generatedFileName + " using " + tom); + + if (createdNode != null) + { + nodeService.setProperty(createdNode, + TemplatingService.TT_GENERATED_OUTPUT_QNAME, + fileNodeRef.toString()); + } + + AVMService avmService = (AVMService)AVMContext.fgInstance.fAppContext.getBean("avmService"); + final String parentAVMPath = getAVMParentPath(createdNode, nodeService); + try + { + out = new OutputStreamWriter(avmService.createFile(parentAVMPath, generatedFileName)); + } + catch (AVMExistsException e) + { + out = new OutputStreamWriter(avmService.getFileOutputStream(parentAVMPath + "/" + generatedFileName)); + } + LOGGER.debug("generating " + generatedFileName + " to avm"); + tom.generate(xml, tt, out); + out.close(); + try + { + out = new OutputStreamWriter(avmService.createFile(parentAVMPath, generatedFileName)); + } + catch (AVMExistsException e) + { + out = new OutputStreamWriter(avmService.getFileOutputStream(parentAVMPath + "/" + generatedFileName)); + } + LOGGER.debug("generating " + generatedFileName + " to avm"); + tom.generate(xml, tt, out); + out.close(); + + try + { + out = new OutputStreamWriter(avmService.createFile(parentAVMPath, fileName)); + } + catch (AVMExistsException e) + { + out = new OutputStreamWriter(avmService.getFileOutputStream(parentAVMPath + "/" + fileName)); + } + LOGGER.debug("writing xml " + fileName + " to avm"); + final TemplatingService ts = TemplatingService.getInstance(); + ts.writeXML(xml, out); + out.close(); + } + catch (Exception e) + { + LOGGER.error(e); + e.printStackTrace(); + throw e; + } + } + + public static void regenerate(final NodeRef nodeRef, + final ContentService contentService, + final NodeService nodeService) + throws Exception + { + try + { + final TemplatingService ts = TemplatingService.getInstance(); + final String templateTypeName = (String) + nodeService.getProperty(nodeRef, TemplatingService.TT_QNAME); + final TemplateType tt = ts.getTemplateType(templateTypeName); + + final ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); + final Document xml = ts.parseXML(reader.getContentInputStream()); + String fileName = (String) + nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); + NodeRef generatedNodeRef = + new NodeRef((String) + nodeService.getProperty(nodeRef, + TemplatingService.TT_GENERATED_OUTPUT_QNAME)); + String generatedFileName = (String) + nodeService.getProperty(generatedNodeRef, + ContentModel.PROP_NAME); + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("regenerating file node for : " + fileName + " (" + + nodeRef.toString() + ") to " + generatedNodeRef.toString()); + + // get a writer for the content and put the file + ContentWriter writer = contentService.getWriter(generatedNodeRef, + ContentModel.PROP_CONTENT, + true); + // set the mimetype and encoding + writer.setMimetype("text/html"); + writer.setEncoding("UTF-8"); + // put a loop to generate all output methods + TemplateOutputMethod tom = tt.getOutputMethods().get(0); + OutputStreamWriter out = + new OutputStreamWriter(writer.getContentOutputStream()); + tom.generate(xml, tt, out); + out.close(); + + LOGGER.debug("generated " + fileName + " using " + tom); + + AVMService avmService = (AVMService)AVMContext.fgInstance.fAppContext.getBean("avmService"); + final String parentAVMPath = getAVMParentPath(nodeRef, nodeService); + try + { + out = new OutputStreamWriter(avmService.createFile(parentAVMPath, generatedFileName)); + } + catch (AVMExistsException e) + { + out = new OutputStreamWriter(avmService.getFileOutputStream(parentAVMPath + "/" + generatedFileName)); + } + LOGGER.debug("generating " + generatedFileName + " to avm"); + tom.generate(xml, tt, out); + out.close(); + + try + { + out = new OutputStreamWriter(avmService.createFile(parentAVMPath, fileName)); + } + catch (AVMExistsException e) + { + out = new OutputStreamWriter(avmService.getFileOutputStream(parentAVMPath + "/" + fileName)); + } + LOGGER.debug("writing xml " + fileName + " to avm"); + ts.writeXML(xml, out); + out.close(); + } + catch (Exception e) + { + LOGGER.error(e); + e.printStackTrace(); + throw e; + } + } } diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java index cd5ea648fe..302944f17a 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java @@ -63,6 +63,7 @@ import org.springframework.web.jsf.FacesContextUtils; public class UIUserSandboxes extends SelfRenderingComponent { private static final String ACTIONS_FILE = "avm_file_modified"; + private static final String ACTIONS_FOLDER = "avm_folder_modified"; private static final String COMPONENT_ACTIONS = "org.alfresco.faces.Actions"; @@ -74,6 +75,7 @@ public class UIUserSandboxes extends SelfRenderingComponent private static final String MSG_DESCRIPTION = "description"; private static final String MSG_MODIFIED = "modified_date"; private static final String MSG_ACTIONS = "actions"; + private static final String MSG_DELETED_ITEM = "avm_node_deleted"; private static final String SPACE_ICON = "/images/icons/" + BrowseBean.SPACE_SMALL_DEFAULT + ".gif"; @@ -207,10 +209,10 @@ public class UIUserSandboxes extends SelfRenderingComponent // components for the current username, preview, browse and modified items inner list out.write("
"); // show the icon for the sandbox as a clickable browse link image + // this is currently identical to the sandbox_browse action as below Utils.encodeRecursive(context, aquireAction( context, mainStore, username, "sandbox_icon", WebResources.IMAGE_USERSANDBOX_32, "#{AVMBrowseBean.setupSandboxAction}", "browseSandbox")); - //out.write(Utils.buildImageTag(context, WebResources.IMAGE_USERSANDBOX_32, 32, 32, "")); out.write(""); out.write(""); out.write(bundle.getString(MSG_USERNAME)); @@ -222,12 +224,12 @@ public class UIUserSandboxes extends SelfRenderingComponent Utils.encodeRecursive(context, aquireAction( context, mainStore, username, "sandbox_preview", "/images/icons/preview_website.gif", null, null)); - out.write("  "); + out.write(" "); Utils.encodeRecursive(context, aquireAction( context, mainStore, username, "sandbox_create", "/images/icons/new_content.gif", - null, null)); - out.write("  "); + "#{AVMBrowseBean.setupSandboxAction}", "wizard:createWebContent")); + out.write(" "); Utils.encodeRecursive(context, aquireAction( context, mainStore, username, "sandbox_browse", "/images/icons/space_small.gif", @@ -249,26 +251,9 @@ public class UIUserSandboxes extends SelfRenderingComponent if (this.expandedPanels.contains(username)) { out.write("
"); - out.write(""); - - // header row - out.write(""); - - // row per modified doc item for this sandbox user + + // list the modified docs for this sandbox user renderUserFiles(context, out, username, storeRoot); - - // end table - out.write("
"); - out.write(bundle.getString(MSG_NAME)); - out.write(""); - out.write(bundle.getString(MSG_CREATED)); - out.write(""); - out.write(bundle.getString(MSG_MODIFIED)); - out.write(""); - out.write(bundle.getString(MSG_SIZE)); - out.write(""); - out.write(bundle.getString(MSG_ACTIONS)); - out.write("
"); } out.write("
"); @@ -309,7 +294,9 @@ public class UIUserSandboxes extends SelfRenderingComponent { AVMSyncService avmSyncService = getAVMSyncService(fc); AVMService avmService = getAVMService(fc); + DateFormat df = Utils.getDateTimeFormat(fc); + ResourceBundle bundle = Application.getBundle(fc); // build the paths to the stores to compare String userStore = AVMConstants.buildAVMUserMainStoreName(storeRoot, username) + ":/"; @@ -317,13 +304,32 @@ public class UIUserSandboxes extends SelfRenderingComponent // get the UIActions component responsible for rendering context related user actions UIActions uiFileActions = aquireUIActions(ACTIONS_FILE); + UIActions uiFolderActions = aquireUIActions(ACTIONS_FOLDER); // use the sync service to get the list of diffs between the stores List diffs = avmSyncService.compare(-1, userStore, -1, stagingStore); - for (AVMDifference diff : diffs) + if (diffs.size() != 0) { - //if (diff.getDifferenceCode() == AVMDifference.NEWER) - //{ + // output the table of modified items + out.write(""); + + // header row + out.write(""); + + // output each of the modified files as a row in the table + for (AVMDifference diff : diffs) + { + // TODO: display cases for diff.getDifferenceCode()? String sourcePath = diff.getSourcePath(); AVMNodeDescriptor node = avmService.lookup(-1, sourcePath); if (node != null) @@ -352,24 +358,87 @@ public class UIUserSandboxes extends SelfRenderingComponent out.write(name); } out.write(""); } - //} + else + { + // must have been deleted from this sandbox - show ghosted + AVMNodeDescriptor ghost = avmService.lookup(-1, diff.getDestinationPath()); + if (ghost != null) + { + // icon and name of the file/folder - files are clickable to see the content + String name = ghost.getName(); + out.write(""); + } + } + } + + // end table + out.write("
"); + out.write(bundle.getString(MSG_NAME)); + out.write(""); + out.write(bundle.getString(MSG_CREATED)); + out.write(""); + out.write(bundle.getString(MSG_MODIFIED)); + out.write(""); + out.write(bundle.getString(MSG_SIZE)); + out.write(""); + out.write(bundle.getString(MSG_ACTIONS)); + out.write("
"); + // created date out.write(df.format(new Date(node.getCreateDate()))); out.write(""); + // modified date out.write(df.format(new Date(node.getModDate()))); out.write(""); + + // size of files if (node.isFile()) { - // size of files out.write(getSizeConverter().getAsString(fc, this, node.getLength())); + out.write(""); + + // add UI actions for this item + uiFileActions.setContext(new AVMNode(node)); + Utils.encodeRecursive(fc, uiFileActions); + } + else + { + out.write(""); + + // add UI actions for this item + uiFolderActions.setContext(new AVMNode(node)); + Utils.encodeRecursive(fc, uiFolderActions); } - out.write(""); - // add UI actions for this item - uiFileActions.setContext(new AVMNode(node)); - Utils.encodeRecursive(fc, uiFileActions); out.write("
"); + if (ghost.isFile()) + { + out.write(Utils.buildImageTag(fc, Utils.getFileTypeImage(fc, name, true), "")); + out.write(""); + out.write(name); + out.write(""); + } + else + { + out.write(Utils.buildImageTag(fc, SPACE_ICON, 16, 16, "")); + out.write(""); + out.write(name); + } + out.write(""); + + // created date + out.write(df.format(new Date(ghost.getCreateDate()))); + out.write(""); + + // modified date + out.write(df.format(new Date(ghost.getModDate()))); + out.write(""); + + // size of files + if (ghost.isFile()) + { + out.write(getSizeConverter().getAsString(fc, this, ghost.getLength())); + } + out.write(""); + + // no UI actions for this item + out.write('[' + bundle.getString(MSG_DELETED_ITEM) + ']'); + out.write("
"); + } + else + { + // TODO: output "no modified files found" message } } @@ -385,6 +454,14 @@ public class UIUserSandboxes extends SelfRenderingComponent return this.sizeConverter; } + /** + * Aquire the UIActions component for the specified action group ID. + * Search for the component in the child list or create as needed. + * + * @param id ActionGroup id of the UIActions component + * + * @return UIActions component + */ private UIActions aquireUIActions(String id) { UIActions uiActions = null; @@ -401,6 +478,7 @@ public class UIUserSandboxes extends SelfRenderingComponent javax.faces.application.Application facesApp = FacesContext.getCurrentInstance().getApplication(); uiActions = (UIActions)facesApp.createComponent(COMPONENT_ACTIONS); uiActions.setShowLink(false); + uiActions.getAttributes().put("styleClass", "inlineAction"); uiActions.setId(id); uiActions.setParent(this); uiActions.setValue(id); diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index fa318fd9ed..c87720037f 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -534,6 +534,43 @@ + + + The bean that backs up the Create Web Content Wizard + + CreateWebContentWizard + org.alfresco.web.bean.wcm.CreateWebContentWizard + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + contentService + #{ContentService} + + + dictionaryService + #{DictionaryService} + + + The bean that backs up the Create Website Wizard @@ -620,6 +657,44 @@ contentService #{ContentService} + + avmBrowseBean + #{AVMBrowseBean} + + + + + + The bean that backs up the Delete AVM File Dialog + + DeleteFileDialog + org.alfresco.web.bean.wcm.DeleteFileDialog + session + + avmService + #{AVMService} + + + avmBrowseBean + #{AVMBrowseBean} + + + + + + The bean that backs up the Delete AVM Folder Dialog + + DeleteFolderDialog + org.alfresco.web.bean.wcm.DeleteFolderDialog + session + + avmService + #{AVMService} + + + avmBrowseBean + #{AVMBrowseBean} + diff --git a/source/web/jsp/content/create-content-wizard/create-xml.jsp b/source/web/jsp/content/create-content-wizard/create-xml.jsp deleted file mode 100644 index 9ea46974f9..0000000000 --- a/source/web/jsp/content/create-content-wizard/create-xml.jsp +++ /dev/null @@ -1,83 +0,0 @@ -<%-- - 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" %> -<%@ page import="org.alfresco.web.app.Application" %> -<%@ page import="org.alfresco.web.templating.*" %> -<%@ page import="org.alfresco.web.bean.content.CreateContentWizard" %> -<%@ page import="org.w3c.dom.Document" %> - -<% -final CreateContentWizard wiz = (CreateContentWizard) - Application.getWizardManager().getBean(); -TemplateType tt = wiz.getTemplateType(); -TemplateInputMethod tim = tt.getInputMethods().get(0); -final TemplatingService ts = TemplatingService.getInstance(); -final InstanceData instanceData = new InstanceData() { - - public Document getContent() - { - try - { - return (wiz.getContent() != null - ? ts.parseXML(wiz.getContent()) - : null); - } - catch (Exception e) - { - e.printStackTrace(); - return null; - } - } - - public void setContent(final Document d) - { - wiz.setContent(ts.writeXMLToString(d)); - } -}; -tim.generate(instanceData, tt, out); -%> - diff --git a/source/web/jsp/content/create-content-wizard/details.jsp b/source/web/jsp/content/create-content-wizard/details.jsp index 1ee4a2a749..fdb516d9c1 100644 --- a/source/web/jsp/content/create-content-wizard/details.jsp +++ b/source/web/jsp/content/create-content-wizard/details.jsp @@ -91,12 +91,6 @@ valueChangeListener="#{WizardManager.bean.createContentChanged}"> - - - - - - - <%-- actions are configured in web-client-config-actions.xml --%> - <%----%> + <%-- actions are configured in web-client-config-wcm-actions.xml --%> + @@ -255,7 +255,7 @@ - <%-- actions are configured in web-client-config-actions.xml --%> + <%-- actions are configured in web-client-config-wcm-actions.xml --%> diff --git a/source/web/jsp/wcm/browse-website.jsp b/source/web/jsp/wcm/browse-website.jsp index 981074b9b0..d616e9211f 100644 --- a/source/web/jsp/wcm/browse-website.jsp +++ b/source/web/jsp/wcm/browse-website.jsp @@ -105,7 +105,8 @@ - (P) (E) (T) (D)  + + @@ -132,7 +133,7 @@ <%-- User Sandboxes List --%> - + diff --git a/source/web/jsp/wcm/edit-file.jsp b/source/web/jsp/wcm/edit-file.jsp new file mode 100644 index 0000000000..257b63888e --- /dev/null +++ b/source/web/jsp/wcm/edit-file.jsp @@ -0,0 +1,164 @@ +<%-- + 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="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + +<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> +<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> + + + + + + <%-- load a bundle of properties with I18N strings --%> + + + <%-- set the form name here --%> + + + <%-- Main outer table --%> + + + <%-- Title bar --%> + + + + + <%-- Main area --%> + + <%-- Shelf --%> + + + <%-- Work Area --%> + + +
+ <%@ include file="../parts/titlebar.jsp" %> +
+ <%@ include file="../parts/shelf.jsp" %> + + + <%-- Breadcrumb --%> + <%@ include file="../parts/breadcrumb.jsp" %> + + <%-- Status and Actions --%> + + + + + + + <%-- separator row with gradient shadow --%> + + + + + + + <%-- Details --%> + + + + + + + <%-- Error Messages --%> + + + + + + + <%-- separator row with bottom panel graphics --%> + + + + + + +
+ + <%-- Status and Actions inner contents table --%> + <%-- Generally this consists of an icon, textual summary and actions for the current object --%> + + + + + +
+ +
''
+
+
+ +
+ + + + + + +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> + + + + + + + + + + +
+ + + +
+ <%-- downloadable file link --%> + +
+ +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> + + + + +
+ +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> +
+
+ <%-- messages tag to show messages not handled by other specific message tags --%> + +
+
+ +
+ +
+ +
\ No newline at end of file diff --git a/source/web/jsp/wcm/edit-html-inline.jsp b/source/web/jsp/wcm/edit-html-inline.jsp new file mode 100644 index 0000000000..2b051d2598 --- /dev/null +++ b/source/web/jsp/wcm/edit-html-inline.jsp @@ -0,0 +1,179 @@ +<%-- + 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="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + +<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> +<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> + + + + + + + + + + <%-- load a bundle of properties with I18N strings --%> + + + + + <%-- Main outer table --%> + + + <%-- Title bar --%> + + + + + <%-- Main area --%> + + <%-- Shelf --%> + + + <%-- Work Area --%> + + +
+ <%@ include file="../parts/titlebar.jsp" %> +
+ <%@ include file="../parts/shelf.jsp" %> + + + <%-- Breadcrumb --%> + <%@ include file="../parts/breadcrumb.jsp" %> + + <%-- Status and Actions --%> + + + + + + + <%-- separator row with gradient shadow --%> + + + + + + + <%-- Details --%> + + + + + + + <%-- Error Messages --%> + + + + + + + <%-- separator row with bottom panel graphics --%> + + + + + + +
+ + <%-- Status and Actions inner contents table --%> + <%-- Generally this consists of an icon, textual summary and actions for the current object --%> + + + + + +
+ +
''
+
+
+ +
+ + + <%-- Inline editor --%> + + + + +
+
+ +
+ +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> + + + + + + + + +
+ +
+ +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> +
+
+ <%-- messages tag to show messages not handled by other specific message tags --%> + +
+
+ +
+ +
+ +
\ No newline at end of file diff --git a/source/web/jsp/wcm/edit-text-inline.jsp b/source/web/jsp/wcm/edit-text-inline.jsp new file mode 100644 index 0000000000..38d45b560c --- /dev/null +++ b/source/web/jsp/wcm/edit-text-inline.jsp @@ -0,0 +1,150 @@ +<%-- + 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="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + +<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> +<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> + + + + + + <%-- load a bundle of properties with I18N strings --%> + + + + + <%-- Main outer table --%> + + + <%-- Title bar --%> + + + + + <%-- Main area --%> + + <%-- Shelf --%> + + + <%-- Work Area --%> + + +
+ <%@ include file="../parts/titlebar.jsp" %> +
+ <%@ include file="../parts/shelf.jsp" %> + + + <%-- Breadcrumb --%> + <%@ include file="../parts/breadcrumb.jsp" %> + + <%-- Status and Actions --%> + + + + + + + <%-- separator row with gradient shadow --%> + + + + + + + <%-- Details --%> + + + + + + + <%-- Error Messages --%> + + + + + + + <%-- separator row with bottom panel graphics --%> + + + + + + +
+ + <%-- Status and Actions inner contents table --%> + <%-- Generally this consists of an icon, textual summary and actions for the current object --%> + + + + + +
+ +
''
+
+
+ +
+ + + <%-- Inline editor --%> + + + +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> + + <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> + + <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> + + + + + + + + +
+ +
+ +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> +
+
+ <%-- messages tag to show messages not handled by other specific message tags --%> + +
+
+ +
+ +
+ +
\ No newline at end of file diff --git a/source/web/jsp/wcm/edit-xml-inline.jsp b/source/web/jsp/wcm/edit-xml-inline.jsp new file mode 100644 index 0000000000..7e3b645589 --- /dev/null +++ b/source/web/jsp/wcm/edit-xml-inline.jsp @@ -0,0 +1,200 @@ +<%-- + 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="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + +<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> +<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> +<%@ page import="org.alfresco.web.bean.wcm.*, + org.alfresco.service.cmr.repository.*, + org.alfresco.web.bean.content.*, + org.alfresco.web.templating.*" %> +<%@ page import="java.io.*" %> +<%@ page import="org.alfresco.web.app.Application" %> +<%@ page import="org.alfresco.web.bean.content.CreateXmlContentTypeWizard" %> +<%@ page import="org.alfresco.web.templating.*" %> +<%@ page import="org.w3c.dom.Document" %> +<% +final AVMBrowseBean ccb = (AVMBrowseBean)session.getAttribute("AVMBrowseBean"); +NodeRef nr = ccb.getAvmNode().getNodeRef(); +final AVMEditBean aeb = (AVMEditBean)session.getAttribute("AVMEditBean"); +String ttName = (String)ccb.getNodeService().getProperty(nr, TemplatingService.TT_QNAME); +final TemplatingService ts = TemplatingService.getInstance(); +final TemplateType tt = ts.getTemplateType(ttName); +TemplateInputMethod tim = tt.getInputMethods().get(0); +final InstanceData instanceData = new InstanceData() +{ + public Document getContent() + { + try + { + return aeb.getEditorOutput() != null ? ts.parseXML(aeb.getEditorOutput()) : null; + } + catch (Exception e) + { + e.printStackTrace(); + return null; + } + } + + public void setContent(final Document d) + { + aeb.setEditorOutput(ts.writeXMLToString(d)); + } +}; +%> + + + + + + <%-- load a bundle of properties with I18N strings --%> + + + + + <%-- Main outer table --%> + + + <%-- Title bar --%> + + + + + <%-- Main area --%> + + <%-- Shelf --%> + + + <%-- Work Area --%> + + +
+ <%@ include file="../parts/titlebar.jsp" %> +
+ <%@ include file="../parts/shelf.jsp" %> + + + <%-- Breadcrumb --%> + <%@ include file="../parts/breadcrumb.jsp" %> + + <%-- Status and Actions --%> + + + + + + + <%-- separator row with gradient shadow --%> + + + + + + + <%-- Details --%> + + + + + + + <%-- Error Messages --%> + + + + + + + <%-- separator row with bottom panel graphics --%> + + + + + + +
+ + <%-- Status and Actions inner contents table --%> + <%-- Generally this consists of an icon, textual summary and actions for the current object --%> + + + + + +
+ +
''
+
+
+ +
+ + + + + + <%-- Inline editor --%> + + + +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> + + + + + + + + +
+ +
+ +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> + + <% tim.generate(instanceData, tt, out); %> + + <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> +
+
+ <%-- messages tag to show messages not handled by other specific message tags --%> + +
+
+ +
+ +
+ + +
\ No newline at end of file