mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge from HEAD to WCM-DEV2.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3659 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,23 +1,6 @@
|
||||
/*
|
||||
* 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.content;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
@@ -35,17 +18,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
|
||||
*
|
||||
@@ -53,14 +28,12 @@ import org.alfresco.web.app.servlet.FacesHelper;
|
||||
*/
|
||||
public class CreateContentWizard extends BaseContentWizard
|
||||
{
|
||||
protected String content = null;
|
||||
protected String templateTypeName;
|
||||
protected List<SelectItem> createMimeTypes;
|
||||
|
||||
private static final Log LOGGER =
|
||||
LogFactory.getLog(CreateContentWizard.class);
|
||||
|
||||
|
||||
protected String content = null;
|
||||
|
||||
protected List<SelectItem> createMimeTypes;
|
||||
|
||||
private static Log logger = LogFactory.getLog(CreateContentWizard.class);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Wizard implementation
|
||||
|
||||
@@ -68,28 +41,10 @@ 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;
|
||||
saveContent(null, this.content);
|
||||
|
||||
// return the default outcome
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,7 +54,6 @@ public class CreateContentWizard extends BaseContentWizard
|
||||
|
||||
this.content = null;
|
||||
this.inlineEdit = true;
|
||||
this.templateTypeName = null;
|
||||
this.mimeType = MimetypeMap.MIMETYPE_HTML;
|
||||
}
|
||||
|
||||
@@ -162,20 +116,6 @@ public class CreateContentWizard extends BaseContentWizard
|
||||
{
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public List<SelectItem> getCreateTemplateTypes()
|
||||
{
|
||||
Collection<TemplateType> ttl = TemplatingService.getInstance().getTemplateTypes();
|
||||
List<SelectItem> sil = new ArrayList<SelectItem>(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,37 +153,18 @@ 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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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.
|
||||
|
@@ -0,0 +1,75 @@
|
||||
package org.alfresco.web.bean.content;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* Bean implementation of the "View Content Properties" dialog.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class ViewContentPropertiesDialog extends BaseDialogBean
|
||||
{
|
||||
protected static final String TEMP_PROP_MIMETYPE = "mimetype";
|
||||
|
||||
protected Node viewingNode;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Dialog implementation
|
||||
|
||||
@Override
|
||||
public void init(Map<String, String> parameters)
|
||||
{
|
||||
super.init(parameters);
|
||||
|
||||
// setup the editable node
|
||||
this.viewingNode = new Node(this.browseBean.getDocument().getNodeRef());
|
||||
|
||||
// special case for Mimetype - since this is a sub-property of the ContentData object
|
||||
// we must extract it so it can be edited in the client, then we check for it later
|
||||
// and create a new ContentData object to wrap it and it's associated URL
|
||||
ContentData content = (ContentData)this.viewingNode.getProperties().get(ContentModel.PROP_CONTENT);
|
||||
if (content != null)
|
||||
{
|
||||
this.viewingNode.getProperties().put(TEMP_PROP_MIMETYPE, content.getMimetype());
|
||||
}
|
||||
|
||||
// add the specially handled 'size' property
|
||||
this.viewingNode.addPropertyResolver("size", this.browseBean.resolverSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome)
|
||||
throws Exception
|
||||
{
|
||||
// nothing to do as the finish button is not shown and the dialog is read only
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), "close");
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean getters and setters
|
||||
|
||||
/**
|
||||
* Returns the node being viewed
|
||||
*
|
||||
* @return The node being viewed
|
||||
*/
|
||||
public Node getViewingNode()
|
||||
{
|
||||
return this.viewingNode;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user