mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- Fixed regression in rules wizards
- Added title to create/edit space dialogs - Changed space dialogs to use required field icon - Converted all forums and removed all old legacy beans and JSPs git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2903 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -14,6 +14,9 @@ import org.alfresco.web.app.Application;
|
||||
*/
|
||||
public class CreateSpaceDialog extends CreateSpaceWizard
|
||||
{
|
||||
// ------------------------------------------------------------------------------
|
||||
// Wizard implementation
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
|
@@ -53,6 +53,7 @@ public class CreateSpaceWizard extends BaseWizardBean
|
||||
protected String templateSpaceId;
|
||||
protected String copyPolicy;
|
||||
protected String name;
|
||||
protected String title;
|
||||
protected String description;
|
||||
protected String templateName;
|
||||
protected boolean saveAsTemplate;
|
||||
@@ -63,6 +64,9 @@ public class CreateSpaceWizard extends BaseWizardBean
|
||||
// the NodeRef of the node created during finish
|
||||
protected NodeRef createdNode;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Wizard implementation
|
||||
|
||||
/**
|
||||
* Initialises the wizard
|
||||
*/
|
||||
@@ -85,7 +89,8 @@ public class CreateSpaceWizard extends BaseWizardBean
|
||||
this.existingSpaceId = null;
|
||||
this.templateSpaceId = null;
|
||||
this.name = null;
|
||||
this.description = "";
|
||||
this.title = null;
|
||||
this.description = null;
|
||||
this.templateName = null;
|
||||
this.saveAsTemplate = false;
|
||||
}
|
||||
@@ -122,7 +127,7 @@ public class CreateSpaceWizard extends BaseWizardBean
|
||||
// apply the uifacets aspect - icon, title and description props
|
||||
Map<QName, Serializable> uiFacetsProps = new HashMap<QName, Serializable>(5);
|
||||
uiFacetsProps.put(ContentModel.PROP_ICON, this.icon);
|
||||
uiFacetsProps.put(ContentModel.PROP_TITLE, this.name);
|
||||
uiFacetsProps.put(ContentModel.PROP_TITLE, this.title);
|
||||
uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, this.description);
|
||||
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_UIFACETS, uiFacetsProps);
|
||||
|
||||
@@ -141,7 +146,8 @@ public class CreateSpaceWizard extends BaseWizardBean
|
||||
// copy from existing
|
||||
NodeRef copiedNode = this.fileFolderService.copy(sourceNode, parentSpace, this.name).getNodeRef();
|
||||
|
||||
// also need to set the new description and icon properties
|
||||
// also need to set the new title, description and icon properties
|
||||
this.nodeService.setProperty(copiedNode, ContentModel.PROP_TITLE, this.title);
|
||||
this.nodeService.setProperty(copiedNode, ContentModel.PROP_DESCRIPTION, this.description);
|
||||
this.nodeService.setProperty(copiedNode, ContentModel.PROP_ICON, this.icon);
|
||||
|
||||
@@ -160,7 +166,8 @@ public class CreateSpaceWizard extends BaseWizardBean
|
||||
NodeRef parentSpace = new NodeRef(Repository.getStoreRef(), this.navigator.getCurrentNodeId());
|
||||
// copy from the template
|
||||
NodeRef copiedNode = this.fileFolderService.copy(sourceNode, parentSpace, this.name).getNodeRef();
|
||||
// also need to set the new description and icon properties
|
||||
// also need to set the new title, description and icon properties
|
||||
this.nodeService.setProperty(copiedNode, ContentModel.PROP_TITLE, this.title);
|
||||
this.nodeService.setProperty(copiedNode, ContentModel.PROP_DESCRIPTION, this.description);
|
||||
this.nodeService.setProperty(copiedNode, ContentModel.PROP_ICON, this.icon);
|
||||
|
||||
@@ -202,6 +209,9 @@ public class CreateSpaceWizard extends BaseWizardBean
|
||||
return outcome;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean Getters and Setters
|
||||
|
||||
/**
|
||||
* @return Returns the copyPolicy.
|
||||
*/
|
||||
@@ -298,6 +308,22 @@ public class CreateSpaceWizard extends BaseWizardBean
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the title.
|
||||
*/
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title The title to set.
|
||||
*/
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the saveAsTemplate.
|
||||
*/
|
||||
@@ -642,6 +668,9 @@ public class CreateSpaceWizard extends BaseWizardBean
|
||||
return icons;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helper methods
|
||||
|
||||
/**
|
||||
* Formats the error message to display if an error occurs during finish processing
|
||||
*
|
||||
|
@@ -1,36 +1,27 @@
|
||||
package org.alfresco.web.bean.spaces;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.config.Config;
|
||||
import org.alfresco.config.ConfigElement;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.model.FileExistsException;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.ui.common.component.UIListItem;
|
||||
|
||||
/**
|
||||
* Dialog bean to edit an existing space.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class EditSpaceDialog extends BaseDialogBean
|
||||
public class EditSpaceDialog extends CreateSpaceDialog
|
||||
{
|
||||
protected Node editableNode;
|
||||
|
||||
@@ -41,6 +32,13 @@ public class EditSpaceDialog extends BaseDialogBean
|
||||
|
||||
// setup the space being edited
|
||||
this.editableNode = this.browseBean.getActionSpace();
|
||||
this.spaceType = this.editableNode.getType().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), "ok");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,64 +50,6 @@ public class EditSpaceDialog extends BaseDialogBean
|
||||
{
|
||||
return this.editableNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of icons to allow the user to select from.
|
||||
* The list can change according to the type of space being created.
|
||||
*
|
||||
* @return A list of icons
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<UIListItem> getIcons()
|
||||
{
|
||||
List<UIListItem> icons = null;
|
||||
|
||||
QName type = QName.createQName(this.editableNode.getType().toString());
|
||||
String typePrefixForm = type.toPrefixString(this.namespaceService);
|
||||
|
||||
Config config = Application.getConfigService(FacesContext.getCurrentInstance()).
|
||||
getConfig(typePrefixForm + " icons");
|
||||
if (config != null)
|
||||
{
|
||||
ConfigElement iconsCfg = config.getConfigElement("icons");
|
||||
if (iconsCfg != null)
|
||||
{
|
||||
boolean first = true;
|
||||
for (ConfigElement icon : iconsCfg.getChildren())
|
||||
{
|
||||
String iconName = icon.getAttribute("name");
|
||||
String iconPath = icon.getAttribute("path");
|
||||
|
||||
if (iconName != null && iconPath != null)
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
icons = new ArrayList<UIListItem>(iconsCfg.getChildCount());
|
||||
first = false;
|
||||
}
|
||||
|
||||
UIListItem item = new UIListItem();
|
||||
item.setValue(iconName);
|
||||
item.getAttributes().put("image", iconPath);
|
||||
icons.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we didn't find any icons display one default choice
|
||||
if (icons == null)
|
||||
{
|
||||
icons = new ArrayList<UIListItem>(1);
|
||||
|
||||
UIListItem item = new UIListItem();
|
||||
item.setValue("space-icon-default");
|
||||
item.getAttributes().put("image", "/images/icons/space-icon-default.gif");
|
||||
icons.add(item);
|
||||
}
|
||||
|
||||
return icons;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
@@ -213,27 +153,4 @@ public class EditSpaceDialog extends BaseDialogBean
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the error message to display if an error occurs during finish processing
|
||||
*
|
||||
* @param The exception
|
||||
* @return The formatted message
|
||||
*/
|
||||
@Override
|
||||
protected String formatErrorMessage(Throwable exception)
|
||||
{
|
||||
if (exception instanceof FileExistsException)
|
||||
{
|
||||
return MessageFormat.format(Application.getMessage(
|
||||
FacesContext.getCurrentInstance(), Repository.ERROR_EXISTS),
|
||||
((FileExistsException)exception).getExisting().getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
return MessageFormat.format(Application.getMessage(
|
||||
FacesContext.getCurrentInstance(), "error_space"),
|
||||
exception.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user