mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Combined edit categories dialog for content and spaces into one dialog and separated it from Document/SpaceDetailsBean
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6866 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -365,13 +365,8 @@
|
|||||||
icon="/images/icons/save_search_large.gif" title-id="save_edit_search"
|
icon="/images/icons/save_search_large.gif" title-id="save_edit_search"
|
||||||
description-id="save_search_description" />
|
description-id="save_search_description" />
|
||||||
|
|
||||||
<dialog name="editContentCategories" page="/jsp/dialog/edit-category.jsp" managed-bean="DocumentDetailsBean"
|
<dialog name="editNodeCategories" page="/jsp/categories/edit-node-categories.jsp"
|
||||||
icon="/images/icons/edit_large.gif" title-id="modify_categories_of"
|
managed-bean="EditNodeCategoriesDialog" icon="/images/icons/edit_large.gif" />
|
||||||
description-id="editcategory_description" />
|
|
||||||
|
|
||||||
<dialog name="editSpaceCategories" page="/jsp/dialog/edit-space-category.jsp" managed-bean="SpaceDetailsBean"
|
|
||||||
icon="/images/icons/edit_large.gif" title-id="modify_categories_of"
|
|
||||||
description-id="editcategory_space_description" />
|
|
||||||
|
|
||||||
<dialog name="createCategory" page="/jsp/categories/new-category.jsp" managed-bean="CreateCategoryDialog"
|
<dialog name="createCategory" page="/jsp/categories/new-category.jsp" managed-bean="CreateCategoryDialog"
|
||||||
icon="/images/icons/create_category_large.gif" title-id="new_category"
|
icon="/images/icons/create_category_large.gif" title-id="new_category"
|
||||||
|
@@ -60,13 +60,10 @@ import org.alfresco.service.cmr.version.VersionService;
|
|||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.app.servlet.DownloadContentServlet;
|
import org.alfresco.web.app.servlet.DownloadContentServlet;
|
||||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
|
||||||
import org.alfresco.web.bean.dialog.IDialogBean;
|
|
||||||
import org.alfresco.web.bean.ml.MultilingualUtils;
|
import org.alfresco.web.bean.ml.MultilingualUtils;
|
||||||
import org.alfresco.web.bean.repository.MapNode;
|
import org.alfresco.web.bean.repository.MapNode;
|
||||||
import org.alfresco.web.bean.repository.Node;
|
import org.alfresco.web.bean.repository.Node;
|
||||||
import org.alfresco.web.bean.repository.Repository;
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig;
|
|
||||||
import org.alfresco.web.ui.common.Utils;
|
import org.alfresco.web.ui.common.Utils;
|
||||||
import org.alfresco.web.ui.common.Utils.URLMode;
|
import org.alfresco.web.ui.common.Utils.URLMode;
|
||||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||||
@@ -76,7 +73,7 @@ import org.alfresco.web.ui.common.component.UIActionLink;
|
|||||||
*
|
*
|
||||||
* @author gavinc
|
* @author gavinc
|
||||||
*/
|
*/
|
||||||
public class DocumentDetailsBean extends BaseDetailsBean implements IDialogBean
|
public class DocumentDetailsBean extends BaseDetailsBean
|
||||||
{
|
{
|
||||||
private static final String OUTCOME_RETURN = "showDocDetails";
|
private static final String OUTCOME_RETURN = "showDocDetails";
|
||||||
|
|
||||||
@@ -87,8 +84,7 @@ public class DocumentDetailsBean extends BaseDetailsBean implements IDialogBean
|
|||||||
private static final String MSG_ERROR_ASPECT_INLINEEDITABLE = "error_aspect_inlineeditable";
|
private static final String MSG_ERROR_ASPECT_INLINEEDITABLE = "error_aspect_inlineeditable";
|
||||||
private static final String MSG_ERROR_ASPECT_VERSIONING = "error_aspect_versioning";
|
private static final String MSG_ERROR_ASPECT_VERSIONING = "error_aspect_versioning";
|
||||||
private static final String MSG_ERROR_ASPECT_CLASSIFY = "error_aspect_classify";
|
private static final String MSG_ERROR_ASPECT_CLASSIFY = "error_aspect_classify";
|
||||||
private static final String MSG_ERROR_UPDATE_CATEGORY = "error_update_category";
|
|
||||||
private static final String MSG_MODIFY_CATEGORIES_OF = "modify_categories_of";
|
|
||||||
|
|
||||||
private static final String ML_VERSION_PANEL_ID = "ml-versions-panel";
|
private static final String ML_VERSION_PANEL_ID = "ml-versions-panel";
|
||||||
|
|
||||||
@@ -99,21 +95,7 @@ public class DocumentDetailsBean extends BaseDetailsBean implements IDialogBean
|
|||||||
protected ContentFilterLanguagesService contentFilterLanguagesService;
|
protected ContentFilterLanguagesService contentFilterLanguagesService;
|
||||||
protected EditionService editionService;
|
protected EditionService editionService;
|
||||||
|
|
||||||
private NodeRef addedCategory;
|
|
||||||
private List categories;
|
|
||||||
|
|
||||||
private Node translationDocument;
|
private Node translationDocument;
|
||||||
private BaseDialogBean baseDialogBean = new BaseDialogBeanImpl();
|
|
||||||
|
|
||||||
private class BaseDialogBeanImpl extends BaseDialogBean
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
|
||||||
{
|
|
||||||
return saveCategories(context, outcome);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Construction
|
// Construction
|
||||||
@@ -142,10 +124,6 @@ public class DocumentDetailsBean extends BaseDetailsBean implements IDialogBean
|
|||||||
{
|
{
|
||||||
// reset the workflow cache
|
// reset the workflow cache
|
||||||
this.workflowProperties = null;
|
this.workflowProperties = null;
|
||||||
|
|
||||||
// reset the category caches
|
|
||||||
this.categories = null;
|
|
||||||
this.addedCategory = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -576,99 +554,6 @@ public class DocumentDetailsBean extends BaseDetailsBean implements IDialogBean
|
|||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Event handler called to setup the categories for editing
|
|
||||||
*
|
|
||||||
* @param event The event
|
|
||||||
*/
|
|
||||||
public void setupCategoriesForEdit(ActionEvent event)
|
|
||||||
{
|
|
||||||
this.categories = (List)this.nodeService.getProperty(getDocument().getNodeRef(),
|
|
||||||
ContentModel.PROP_CATEGORIES);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a Map of the initial categories on the node keyed by the NodeRef
|
|
||||||
*
|
|
||||||
* @return Map of initial categories
|
|
||||||
*/
|
|
||||||
public List getCategories()
|
|
||||||
{
|
|
||||||
return this.categories;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the categories Map
|
|
||||||
*
|
|
||||||
* @param categories
|
|
||||||
*/
|
|
||||||
public void setCategories(List categories)
|
|
||||||
{
|
|
||||||
this.categories = categories;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the last category added from the multi value editor
|
|
||||||
*
|
|
||||||
* @return The last category added
|
|
||||||
*/
|
|
||||||
public NodeRef getAddedCategory()
|
|
||||||
{
|
|
||||||
return this.addedCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the category added from the multi value editor
|
|
||||||
*
|
|
||||||
* @param addedCategory The added category
|
|
||||||
*/
|
|
||||||
public void setAddedCategory(NodeRef addedCategory)
|
|
||||||
{
|
|
||||||
this.addedCategory = addedCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the categories for the current document
|
|
||||||
*
|
|
||||||
* @return The outcome
|
|
||||||
*/
|
|
||||||
public String saveCategories(FacesContext newContext, String newOutcome)
|
|
||||||
{
|
|
||||||
String outcome = newOutcome;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
RetryingTransactionHelper txnHelper = Repository.getRetryingTransactionHelper(FacesContext.getCurrentInstance());
|
|
||||||
RetryingTransactionCallback<Object> callback = new RetryingTransactionCallback<Object>()
|
|
||||||
{
|
|
||||||
public Object execute() throws Throwable
|
|
||||||
{
|
|
||||||
// firstly retrieve all the properties for the current node
|
|
||||||
Map<QName, Serializable> updateProps = nodeService.getProperties(getDocument().getNodeRef());
|
|
||||||
|
|
||||||
// create a node ref representation of the selected id and set the new properties
|
|
||||||
updateProps.put(ContentModel.PROP_CATEGORIES, (Serializable) categories);
|
|
||||||
|
|
||||||
// set the properties on the node
|
|
||||||
nodeService.setProperties(getDocument().getNodeRef(), updateProps);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
txnHelper.doInTransaction(callback);
|
|
||||||
|
|
||||||
// reset the state of the current document so it reflects the changes just made
|
|
||||||
getDocument().reset();
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Throwable e)
|
|
||||||
{
|
|
||||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
|
||||||
FacesContext.getCurrentInstance(), MSG_ERROR_UPDATE_CATEGORY), e.getMessage()), e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return outcome;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies the classifiable aspect to the current document
|
* Applies the classifiable aspect to the current document
|
||||||
*/
|
*/
|
||||||
@@ -1097,78 +982,4 @@ public class DocumentDetailsBean extends BaseDetailsBean implements IDialogBean
|
|||||||
{
|
{
|
||||||
this.editionService = editionService;
|
this.editionService = editionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
// IDialogBean implementation
|
|
||||||
|
|
||||||
public String cancel()
|
|
||||||
{
|
|
||||||
return baseDialogBean.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String finish()
|
|
||||||
{
|
|
||||||
return baseDialogBean.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DialogButtonConfig> getAdditionalButtons()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getAdditionalButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCancelButtonLabel()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getCancelButtonLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContainerDescription()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getContainerDescription();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContainerTitle()
|
|
||||||
{
|
|
||||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_MODIFY_CATEGORIES_OF) +
|
|
||||||
" '" + getDocument().getName() + "'";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContainerSubTitle()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getContainerSubTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getFinishButtonDisabled()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFinishButtonLabel()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getFinishButtonLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init(Map<String, String> parameters)
|
|
||||||
{
|
|
||||||
baseDialogBean.init(parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void restored()
|
|
||||||
{
|
|
||||||
baseDialogBean.restored();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getActionsContext()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getActionsContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getActionsConfigId()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getActionsConfigId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMoreActionsConfigId()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getMoreActionsConfigId();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.web.bean;
|
package org.alfresco.web.bean;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -39,15 +38,11 @@ import org.alfresco.model.ApplicationModel;
|
|||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.TemplateService;
|
import org.alfresco.service.cmr.repository.TemplateService;
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.app.servlet.GuestTemplateContentServlet;
|
import org.alfresco.web.app.servlet.GuestTemplateContentServlet;
|
||||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
|
||||||
import org.alfresco.web.bean.dialog.IDialogBean;
|
|
||||||
import org.alfresco.web.bean.repository.Node;
|
import org.alfresco.web.bean.repository.Node;
|
||||||
import org.alfresco.web.bean.repository.Repository;
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig;
|
|
||||||
import org.alfresco.web.ui.common.Utils;
|
import org.alfresco.web.ui.common.Utils;
|
||||||
import org.alfresco.web.ui.common.Utils.URLMode;
|
import org.alfresco.web.ui.common.Utils.URLMode;
|
||||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||||
@@ -57,31 +52,15 @@ import org.alfresco.web.ui.common.component.UIActionLink;
|
|||||||
*
|
*
|
||||||
* @author Kevin Roast
|
* @author Kevin Roast
|
||||||
*/
|
*/
|
||||||
public class SpaceDetailsBean extends BaseDetailsBean implements IDialogBean
|
public class SpaceDetailsBean extends BaseDetailsBean
|
||||||
{
|
{
|
||||||
private static final String MSG_HAS_FOLLOWING_CATEGORIES = "has_following_categories_space";
|
private static final String MSG_HAS_FOLLOWING_CATEGORIES = "has_following_categories_space";
|
||||||
private static final String MSG_NO_CATEGORIES_APPLIED = "no_categories_applied_space";
|
private static final String MSG_NO_CATEGORIES_APPLIED = "no_categories_applied_space";
|
||||||
private static final String MSG_ERROR_UPDATE_CATEGORY = "error_update_category";
|
|
||||||
private static final String MSG_ERROR_ASPECT_CLASSIFY = "error_aspect_classify_space";
|
private static final String MSG_ERROR_ASPECT_CLASSIFY = "error_aspect_classify_space";
|
||||||
private static final String MSG_MODIFY_CATEGORIES_OF = "modify_categories_of";
|
|
||||||
|
|
||||||
/** Category details */
|
|
||||||
private NodeRef addedCategory;
|
|
||||||
private List categories;
|
|
||||||
private BaseDialogBean baseDialogBean = new BaseDialogBeanImpl();
|
|
||||||
|
|
||||||
/** RSS Template ID */
|
/** RSS Template ID */
|
||||||
private String rssTemplate;
|
private String rssTemplate;
|
||||||
|
|
||||||
private class BaseDialogBeanImpl extends BaseDialogBean
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
|
||||||
{
|
|
||||||
return saveCategories(context, outcome);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Construction
|
// Construction
|
||||||
|
|
||||||
@@ -352,99 +331,6 @@ public class SpaceDetailsBean extends BaseDetailsBean implements IDialogBean
|
|||||||
|
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Event handler called to setup the categories for editing
|
|
||||||
*
|
|
||||||
* @param event The event
|
|
||||||
*/
|
|
||||||
public void setupCategoriesForEdit(ActionEvent event)
|
|
||||||
{
|
|
||||||
this.categories = (List)this.nodeService.getProperty(getSpace().getNodeRef(),
|
|
||||||
ContentModel.PROP_CATEGORIES);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a Map of the initial categories on the node keyed by the NodeRef
|
|
||||||
*
|
|
||||||
* @return Map of initial categories
|
|
||||||
*/
|
|
||||||
public List getCategories()
|
|
||||||
{
|
|
||||||
return this.categories;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the categories Map
|
|
||||||
*
|
|
||||||
* @param categories
|
|
||||||
*/
|
|
||||||
public void setCategories(List categories)
|
|
||||||
{
|
|
||||||
this.categories = categories;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the last category added from the multi value editor
|
|
||||||
*
|
|
||||||
* @return The last category added
|
|
||||||
*/
|
|
||||||
public NodeRef getAddedCategory()
|
|
||||||
{
|
|
||||||
return this.addedCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the category added from the multi value editor
|
|
||||||
*
|
|
||||||
* @param addedCategory The added category
|
|
||||||
*/
|
|
||||||
public void setAddedCategory(NodeRef addedCategory)
|
|
||||||
{
|
|
||||||
this.addedCategory = addedCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the categories for the current document
|
|
||||||
*
|
|
||||||
* @return The outcome
|
|
||||||
*/
|
|
||||||
public String saveCategories(FacesContext newContext, String newOutcome)
|
|
||||||
{
|
|
||||||
String outcome = newOutcome;
|
|
||||||
|
|
||||||
UserTransaction tx = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance());
|
|
||||||
tx.begin();
|
|
||||||
|
|
||||||
// firstly retrieve all the properties for the current node
|
|
||||||
Map<QName, Serializable> updateProps = this.nodeService.getProperties(
|
|
||||||
getSpace().getNodeRef());
|
|
||||||
|
|
||||||
// create a node ref representation of the selected id and set the new properties
|
|
||||||
updateProps.put(ContentModel.PROP_CATEGORIES, (Serializable)this.categories);
|
|
||||||
|
|
||||||
// set the properties on the node
|
|
||||||
this.nodeService.setProperties(getSpace().getNodeRef(), updateProps);
|
|
||||||
|
|
||||||
// commit the transaction
|
|
||||||
tx.commit();
|
|
||||||
|
|
||||||
// reset the state of the current document so it reflects the changes just made
|
|
||||||
getSpace().reset();
|
|
||||||
}
|
|
||||||
catch (Throwable e)
|
|
||||||
{
|
|
||||||
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
|
|
||||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
|
||||||
FacesContext.getCurrentInstance(), MSG_ERROR_UPDATE_CATEGORY), e.getMessage()), e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return outcome;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies the classifiable aspect to the current document
|
* Applies the classifiable aspect to the current document
|
||||||
@@ -598,78 +484,4 @@ public class SpaceDetailsBean extends BaseDetailsBean implements IDialogBean
|
|||||||
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), e.getMessage()), e);
|
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), e.getMessage()), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
// dialog implementation
|
|
||||||
|
|
||||||
public String cancel()
|
|
||||||
{
|
|
||||||
return baseDialogBean.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String finish()
|
|
||||||
{
|
|
||||||
return baseDialogBean.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DialogButtonConfig> getAdditionalButtons()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getAdditionalButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCancelButtonLabel()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getCancelButtonLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContainerDescription()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getContainerDescription();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContainerTitle()
|
|
||||||
{
|
|
||||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_MODIFY_CATEGORIES_OF) +
|
|
||||||
" '" + getSpace().getName() + "'";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContainerSubTitle()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getContainerSubTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getFinishButtonDisabled()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFinishButtonLabel()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getFinishButtonLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init(Map<String, String> parameters)
|
|
||||||
{
|
|
||||||
baseDialogBean.init(parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void restored()
|
|
||||||
{
|
|
||||||
baseDialogBean.restored();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getActionsContext()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getActionsContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getActionsConfigId()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getActionsConfigId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMoreActionsConfigId()
|
|
||||||
{
|
|
||||||
return baseDialogBean.getMoreActionsConfigId();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,179 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.web.bean.categories;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.util.ParameterCheck;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation for the edit node categories dialog.
|
||||||
|
*
|
||||||
|
* @author gavinc
|
||||||
|
*/
|
||||||
|
public class EditNodeCategoriesDialog extends BaseDialogBean
|
||||||
|
{
|
||||||
|
protected Node node;
|
||||||
|
protected NodeRef addedCategory;
|
||||||
|
protected List categories;
|
||||||
|
protected String description;
|
||||||
|
|
||||||
|
private static final String MSG_ERROR_UPDATE_CATEGORY = "error_update_category";
|
||||||
|
private static final String MSG_MODIFY_CATEGORIES_OF = "modify_categories_of";
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Dialog implementation
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Map<String, String> parameters)
|
||||||
|
{
|
||||||
|
super.init(parameters);
|
||||||
|
|
||||||
|
// reset variables
|
||||||
|
this.categories = null;
|
||||||
|
this.addedCategory = null;
|
||||||
|
|
||||||
|
// retrieve parameters
|
||||||
|
String id = parameters.get("id");
|
||||||
|
|
||||||
|
// make sure id was supplied
|
||||||
|
ParameterCheck.mandatoryString("id", id);
|
||||||
|
|
||||||
|
// create the node
|
||||||
|
this.node = new Node(new NodeRef(Repository.getStoreRef(), id));
|
||||||
|
|
||||||
|
// determine description for dialog
|
||||||
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
if (this.dictionaryService.isSubClass(this.node.getType(), ContentModel.TYPE_FOLDER))
|
||||||
|
{
|
||||||
|
this.description = Application.getMessage(context, "editcategory_space_description");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.description = Application.getMessage(context, "editcategory_description");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||||
|
{
|
||||||
|
// firstly retrieve all the properties for the current node
|
||||||
|
Map<QName, Serializable> updateProps = this.nodeService.getProperties(this.node.getNodeRef());
|
||||||
|
|
||||||
|
// create a node ref representation of the selected id and set the new properties
|
||||||
|
updateProps.put(ContentModel.PROP_CATEGORIES, (Serializable) categories);
|
||||||
|
|
||||||
|
// set the properties on the node
|
||||||
|
this.nodeService.setProperties(this.node.getNodeRef(), updateProps);
|
||||||
|
|
||||||
|
return outcome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getFinishButtonDisabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getContainerTitle()
|
||||||
|
{
|
||||||
|
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_MODIFY_CATEGORIES_OF) +
|
||||||
|
" '" + this.node.getName() + "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getContainerDescription()
|
||||||
|
{
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getErrorMessageId()
|
||||||
|
{
|
||||||
|
return MSG_ERROR_UPDATE_CATEGORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Bean property getters and setters
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a Map of the initial categories on the node keyed by the NodeRef
|
||||||
|
*
|
||||||
|
* @return Map of initial categories
|
||||||
|
*/
|
||||||
|
public List getCategories()
|
||||||
|
{
|
||||||
|
if (this.categories == null)
|
||||||
|
{
|
||||||
|
// get the list of categories
|
||||||
|
this.categories = (List)this.nodeService.getProperty(this.node.getNodeRef(),
|
||||||
|
ContentModel.PROP_CATEGORIES);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the categories Map
|
||||||
|
*
|
||||||
|
* @param categories
|
||||||
|
*/
|
||||||
|
public void setCategories(List categories)
|
||||||
|
{
|
||||||
|
this.categories = categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the last category added from the multi value editor
|
||||||
|
*
|
||||||
|
* @return The last category added
|
||||||
|
*/
|
||||||
|
public NodeRef getAddedCategory()
|
||||||
|
{
|
||||||
|
return this.addedCategory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the category added from the multi value editor
|
||||||
|
*
|
||||||
|
* @param addedCategory The added category
|
||||||
|
*/
|
||||||
|
public void setAddedCategory(NodeRef addedCategory)
|
||||||
|
{
|
||||||
|
this.addedCategory = addedCategory;
|
||||||
|
}
|
||||||
|
}
|
@@ -4430,6 +4430,25 @@
|
|||||||
<managed-bean-scope>session</managed-bean-scope>
|
<managed-bean-scope>session</managed-bean-scope>
|
||||||
</managed-bean>
|
</managed-bean>
|
||||||
|
|
||||||
|
<managed-bean>
|
||||||
|
<description>
|
||||||
|
The bean for the Edit Node Categories screen.
|
||||||
|
</description>
|
||||||
|
<managed-bean-name>EditNodeCategoriesDialog</managed-bean-name>
|
||||||
|
<managed-bean-class>
|
||||||
|
org.alfresco.web.bean.categories.EditNodeCategoriesDialog
|
||||||
|
</managed-bean-class>
|
||||||
|
<managed-bean-scope>session</managed-bean-scope>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>nodeService</property-name>
|
||||||
|
<value>#{NodeService}</value>
|
||||||
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>dictionaryService</property-name>
|
||||||
|
<value>#{DictionaryService}</value>
|
||||||
|
</managed-property>
|
||||||
|
</managed-bean>
|
||||||
|
|
||||||
<managed-bean>
|
<managed-bean>
|
||||||
<description>
|
<description>
|
||||||
The bean for the Edit Category screen.
|
The bean for the Edit Category screen.
|
||||||
|
@@ -37,15 +37,15 @@
|
|||||||
<td width="98%">
|
<td width="98%">
|
||||||
</f:verbatim>
|
</f:verbatim>
|
||||||
<r:multiValueSelector id="multi-category-selector"
|
<r:multiValueSelector id="multi-category-selector"
|
||||||
value="#{DocumentDetailsBean.categories}"
|
value="#{DialogManager.bean.categories}"
|
||||||
lastItemAdded="#{DocumentDetailsBean.addedCategory}"
|
lastItemAdded="#{DialogManager.bean.addedCategory}"
|
||||||
selectItemMsg="#{msg.select_category}"
|
selectItemMsg="#{msg.select_category}"
|
||||||
selectedItemsMsg="#{msg.selected_categories}"
|
selectedItemsMsg="#{msg.selected_categories}"
|
||||||
noSelectedItemsMsg="#{msg.no_selected_categories}"
|
noSelectedItemsMsg="#{msg.no_selected_categories}"
|
||||||
styleClass="selector">
|
styleClass="selector">
|
||||||
<f:subview id="categorySelector">
|
<f:subview id="categorySelector">
|
||||||
<r:categorySelector id="category-selector" label="#{msg.select_category_prompt}"
|
<r:categorySelector id="category-selector" label="#{msg.select_category_prompt}"
|
||||||
styleClass="selector" value="#{DocumentDetailsBean.addedCategory}" />
|
styleClass="selector" value="#{DialogManager.bean.addedCategory}" />
|
||||||
</f:subview>
|
</f:subview>
|
||||||
</r:multiValueSelector>
|
</r:multiValueSelector>
|
||||||
<f:verbatim>
|
<f:verbatim>
|
@@ -405,7 +405,9 @@
|
|||||||
<f:facet name="title">
|
<f:facet name="title">
|
||||||
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="Write">
|
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="Write">
|
||||||
<a:actionLink id="titleLink3" value="#{msg.change_category}" showLink="false" image="/images/icons/Change_details.gif"
|
<a:actionLink id="titleLink3" value="#{msg.change_category}" showLink="false" image="/images/icons/Change_details.gif"
|
||||||
action="dialog:editContentCategories" actionListener="#{DocumentDetailsBean.setupCategoriesForEdit}" />
|
action="dialog:editNodeCategories" actionListener="#{DialogManager.setupParameters}">
|
||||||
|
<f:param name="id" value="#{DocumentDetailsBean.document.id}" />
|
||||||
|
</a:actionLink>
|
||||||
</r:permissionEvaluator>
|
</r:permissionEvaluator>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
</h:panelGroup>
|
</h:panelGroup>
|
||||||
|
@@ -1,56 +0,0 @@
|
|||||||
<%--
|
|
||||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
|
||||||
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
* As a special exception to the terms and conditions of version 2.0 of
|
|
||||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
|
||||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
|
||||||
* FLOSS exception. You should have recieved a copy of the text describing
|
|
||||||
* the FLOSS exception, and it is also available here:
|
|
||||||
* http://www.alfresco.com/legal/licensing"
|
|
||||||
--%>
|
|
||||||
<%@ 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" %>
|
|
||||||
|
|
||||||
<f:verbatim>
|
|
||||||
<table cellpadding="2" cellspacing="2" border="0" width="100%">
|
|
||||||
<tr><td colspan="2" class="paddingRow"></td></tr>
|
|
||||||
<tr>
|
|
||||||
<td></f:verbatim><h:outputText value="#{msg.categories}" /><f:verbatim>:</td>
|
|
||||||
<td width="98%">
|
|
||||||
</f:verbatim><r:multiValueSelector id="multi-category-selector"
|
|
||||||
value="#{SpaceDetailsBean.categories}"
|
|
||||||
lastItemAdded="#{SpaceDetailsBean.addedCategory}"
|
|
||||||
selectItemMsg="#{msg.select_category}"
|
|
||||||
selectedItemsMsg="#{msg.selected_categories}"
|
|
||||||
noSelectedItemsMsg="#{msg.no_selected_categories}"
|
|
||||||
styleClass="selector">
|
|
||||||
<f:subview id="categorySelector">
|
|
||||||
<r:categorySelector id="category-selector" label="#{msg.select_category_prompt}"
|
|
||||||
styleClass="selector"
|
|
||||||
value="#{SpaceDetailsBean.addedCategory}"/>
|
|
||||||
</f:subview>
|
|
||||||
</r:multiValueSelector>
|
|
||||||
<f:verbatim>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr><td colspan="2" class="paddingRow"></td></tr>
|
|
||||||
</table>
|
|
||||||
</f:verbatim>
|
|
||||||
|
|
@@ -253,7 +253,9 @@
|
|||||||
<f:facet name="title">
|
<f:facet name="title">
|
||||||
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="Write">
|
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="Write">
|
||||||
<a:actionLink id="titleLink3" value="#{msg.change_category}" showLink="false" image="/images/icons/Change_details.gif"
|
<a:actionLink id="titleLink3" value="#{msg.change_category}" showLink="false" image="/images/icons/Change_details.gif"
|
||||||
action="dialog:editSpaceCategories" actionListener="#{SpaceDetailsBean.setupCategoriesForEdit}" />
|
action="dialog:editNodeCategories" actionListener="#{DialogManager.setupParameters}">
|
||||||
|
<f:param name="id" value="#{SpaceDetailsBean.space.id}" />
|
||||||
|
</a:actionLink>
|
||||||
</r:permissionEvaluator>
|
</r:permissionEvaluator>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
</h:panelGroup>
|
</h:panelGroup>
|
||||||
|
Reference in New Issue
Block a user