mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
first pass at locking related ui work.
- adding lock icons to the ui - using lock aware service for create and edit web content. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6027 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -125,7 +125,7 @@ kilobyte=KB
|
|||||||
megabyte=MB
|
megabyte=MB
|
||||||
gigabyte=GB
|
gigabyte=GB
|
||||||
locked_you=Item locked by you
|
locked_you=Item locked by you
|
||||||
locked_user=Item locked by user
|
locked_user=Item locked by {0,choice,0#SHOULD_NOT_HAPPEN|1#user|1<users}
|
||||||
wizard_errors=Please correct the errors below.
|
wizard_errors=Please correct the errors below.
|
||||||
last_page=Last Page
|
last_page=Last Page
|
||||||
next_page=Next Page
|
next_page=Next Page
|
||||||
@@ -746,16 +746,19 @@ regenerate_renditions_desc=This wizard helps you regenerate renditions.
|
|||||||
regenerate_renditions_select_renditions_title=Select Renditions
|
regenerate_renditions_select_renditions_title=Select Renditions
|
||||||
regenerate_renditions_select_renditions_step_title=Select Renditions
|
regenerate_renditions_select_renditions_step_title=Select Renditions
|
||||||
regenerate_renditions_select_renditions_desc=Select which renditions you want to regenerate.
|
regenerate_renditions_select_renditions_desc=Select which renditions you want to regenerate.
|
||||||
regenerate_renditions_select_renditions_select_item_desc={0} related renditions in {1}.
|
regenerate_renditions_select_renditions_select_item_desc={0} related {0,choice,0#renditions|1#rendition|1<renditions} in {1}.
|
||||||
regenerate_renditions_select_renditions_select_web_project=Select the web project in which you want to regenerate renditions.
|
regenerate_renditions_select_renditions_select_web_project=Select the web project in which you want to regenerate renditions.
|
||||||
regenerate_renditions_select_renditions_select_regenerate_scope=Select which renditions you want to regenerate within the selected web project.
|
regenerate_renditions_select_renditions_select_regenerate_scope=Select which renditions you want to regenerate within the selected web project.
|
||||||
regenerate_renditions_select_renditions_scope_all=Choose this option to regenerate all renditions of all form generated content within the selected web project.
|
regenerate_renditions_select_renditions_scope_all=Choose this option to regenerate all renditions of all form generated content within the selected web project.
|
||||||
regenerate_renditions_select_renditions_scope_form=Choose this option to regenerate all renditions of content generated by a particular set of forms configured for the selected web project.
|
regenerate_renditions_select_renditions_scope_form=Choose this option to regenerate all renditions of content generated by a particular set of forms configured for the selected web project.
|
||||||
regenerate_renditions_select_renditions_scope_rendering_engine_templates=Choose this option to regenerate particular renditions generated by a particular set of rendering engine templates.
|
regenerate_renditions_select_renditions_scope_rendering_engine_templates=Choose this option to regenerate particular renditions generated by a particular set of rendering engine templates.
|
||||||
regenerate_renditions_select_renditions_instruction=To regenerate renditions based on your selection, click next.
|
regenerate_renditions_select_renditions_instruction=To regenerate renditions based on your selection, click next.
|
||||||
regenerate_renditions_summary_desc={0} renditions have been regenerated in web project {1}.
|
regenerate_renditions_summary_desc={0} {0,choice,0#renditions|1#rendition|1<renditions} have been regenerated in web project {1}.
|
||||||
regenerate_renditions_summary_instruction=To commit these changes to the web project, click Finish.
|
regenerate_renditions_summary_instruction=To commit these changes to the web project, click Finish.
|
||||||
|
regenerate_renditions_snapshot_description_scope_form=Regenerated all rendition for content authored using forms {0}.
|
||||||
|
regenerate_renditions_snapshot_description_scope_rendering_engine_template=Regenerated all renditions generated by {0}.
|
||||||
|
regenerate_renditions_snapshot_description_scope_web_project=Regenerated all renditions in web project {0}.
|
||||||
|
regenerate_renditions_snapshot_short_description=Regenerated {0} {0,choice,0#renditions|1#rendition|1<renditions}.
|
||||||
create_form_title=Create Web Form Wizard
|
create_form_title=Create Web Form Wizard
|
||||||
edit_form_title=Edit Web Form Wizard
|
edit_form_title=Edit Web Form Wizard
|
||||||
create_form_desc=This wizard helps you create a new form.
|
create_form_desc=This wizard helps you create a new form.
|
||||||
|
@@ -39,7 +39,6 @@ import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
|||||||
import org.alfresco.service.cmr.repository.ContentReader;
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
import org.alfresco.service.cmr.repository.ContentService;
|
import org.alfresco.service.cmr.repository.ContentService;
|
||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
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.DownloadContentServlet;
|
import org.alfresco.web.app.servlet.DownloadContentServlet;
|
||||||
@@ -95,9 +94,6 @@ public class AVMEditBean
|
|||||||
/** The ContentService bean reference */
|
/** The ContentService bean reference */
|
||||||
protected ContentService contentService;
|
protected ContentService contentService;
|
||||||
|
|
||||||
/** The NodeService bean reference */
|
|
||||||
protected NodeService nodeService;
|
|
||||||
|
|
||||||
/** The FilePickerBean reference */
|
/** The FilePickerBean reference */
|
||||||
protected FilePickerBean filePickerBean;
|
protected FilePickerBean filePickerBean;
|
||||||
|
|
||||||
@@ -145,14 +141,6 @@ public class AVMEditBean
|
|||||||
this.contentService = contentService;
|
this.contentService = contentService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param nodeService The nodeService to set.
|
|
||||||
*/
|
|
||||||
public void setNodeService(final NodeService nodeService)
|
|
||||||
{
|
|
||||||
this.nodeService = nodeService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the current AVM node context.
|
* @return Returns the current AVM node context.
|
||||||
*/
|
*/
|
||||||
|
@@ -114,26 +114,26 @@ public class RegenerateRenditionsWizard
|
|||||||
}
|
}
|
||||||
LOGGER.debug("updating " + diffList.size() + " renditions in staging");
|
LOGGER.debug("updating " + diffList.size() + " renditions in staging");
|
||||||
this.avmSyncService.update(diffList, null, true, true, true, true, null, null);
|
this.avmSyncService.update(diffList, null, true, true, true, true, null, null);
|
||||||
final StringBuilder description = new StringBuilder();
|
String description = null;
|
||||||
|
final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
|
||||||
if (this.regenerateScope.equals(REGENERATE_SCOPE_FORM))
|
if (this.regenerateScope.equals(REGENERATE_SCOPE_FORM))
|
||||||
{
|
{
|
||||||
description.append("regenerated all renditions for content authored using forms ").
|
description = MessageFormat.format("regenerate_renditions_snapshot_description_scope_form",
|
||||||
append(StringUtils.arrayToDelimitedString(this.selectedForms, ", ")).
|
StringUtils.arrayToDelimitedString(this.selectedForms, ", "));
|
||||||
append(".");
|
|
||||||
}
|
}
|
||||||
else if (this.regenerateScope.equals(REGENERATE_SCOPE_RENDERING_ENGINE_TEMPLATE))
|
else if (this.regenerateScope.equals(REGENERATE_SCOPE_RENDERING_ENGINE_TEMPLATE))
|
||||||
{
|
{
|
||||||
description.append("regenerated all renditions generated by ").
|
description = MessageFormat.format("regenerate_renditions_snapshot_description_scope_rendering_engine_template",
|
||||||
append(StringUtils.arrayToDelimitedString(this.selectedRenderingEngineTemplates, ", ")).
|
StringUtils.arrayToDelimitedString(this.selectedRenderingEngineTemplates, ", "));
|
||||||
append(".");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
description.append("regenerated all renditions in web project " + this.selectedWebProject.getName());
|
description = MessageFormat.format("regenerate_renditions_snapshot_description_scope_web_project",
|
||||||
|
this.selectedWebProject.getName());
|
||||||
}
|
}
|
||||||
this.avmService.createSnapshot(this.selectedWebProject.getStoreId(),
|
this.avmService.createSnapshot(this.selectedWebProject.getStoreId(),
|
||||||
"regenerated renditions",
|
MessageFormat.format("regenerate_renditions_snapshot_short_description", diffList.size()),
|
||||||
description.toString());
|
description);
|
||||||
}
|
}
|
||||||
return outcome;
|
return outcome;
|
||||||
}
|
}
|
||||||
|
@@ -178,8 +178,7 @@ public class RenderingEngineTemplateImpl
|
|||||||
public String getOutputPathForRendition(final FormInstanceData formInstanceData, final String currentAVMPath)
|
public String getOutputPathForRendition(final FormInstanceData formInstanceData, final String currentAVMPath)
|
||||||
{
|
{
|
||||||
final ServiceRegistry sr = this.getServiceRegistry();
|
final ServiceRegistry sr = this.getServiceRegistry();
|
||||||
final NodeService nodeService = sr.getNodeService();
|
final AVMService avmService = this.getAVMService();
|
||||||
final AVMService avmService = sr.getAVMService();
|
|
||||||
|
|
||||||
final String formInstanceDataAVMPath = formInstanceData.getPath();
|
final String formInstanceDataAVMPath = formInstanceData.getPath();
|
||||||
|
|
||||||
@@ -253,7 +252,7 @@ public class RenderingEngineTemplateImpl
|
|||||||
SAXException,
|
SAXException,
|
||||||
RenderingEngine.RenderingException
|
RenderingEngine.RenderingException
|
||||||
{
|
{
|
||||||
final AVMService avmService = this.getServiceRegistry().getAVMService();
|
final AVMService avmService = this.getAVMService();
|
||||||
final boolean isRegenerate = avmService.lookup(-1, renditionAvmPath) != null;
|
final boolean isRegenerate = avmService.lookup(-1, renditionAvmPath) != null;
|
||||||
if (!isRegenerate)
|
if (!isRegenerate)
|
||||||
{
|
{
|
||||||
@@ -330,7 +329,7 @@ public class RenderingEngineTemplateImpl
|
|||||||
new PropertyValue(DataTypeDefinition.TEXT,
|
new PropertyValue(DataTypeDefinition.TEXT,
|
||||||
AVMUtil.getStoreRelativePath(formInstanceData.getPath())));
|
AVMUtil.getStoreRelativePath(formInstanceData.getPath())));
|
||||||
|
|
||||||
final AVMService avmService = this.getServiceRegistry().getAVMService();
|
final AVMService avmService = this.getAVMService();
|
||||||
avmService.setNodeProperties(rendition.getPath(), props);
|
avmService.setNodeProperties(rendition.getPath(), props);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,6 +554,11 @@ public class RenderingEngineTemplateImpl
|
|||||||
return new FormDataFunctions((AVMRemote)wac.getBean("avmRemote"));
|
return new FormDataFunctions((AVMRemote)wac.getBean("avmRemote"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AVMService getAVMService()
|
||||||
|
{
|
||||||
|
return this.getServiceRegistry().getAVMService();
|
||||||
|
}
|
||||||
|
|
||||||
private ServiceRegistry getServiceRegistry()
|
private ServiceRegistry getServiceRegistry()
|
||||||
{
|
{
|
||||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
@@ -570,5 +574,6 @@ public class RenderingEngineTemplateImpl
|
|||||||
{
|
{
|
||||||
return this.getClass().getName() + "{name : " + this.getName() + "}";
|
return this.getClass().getName() + "{name : " + this.getName() + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,8 +32,10 @@ import javax.faces.context.FacesContext;
|
|||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.model.WCMAppModel;
|
import org.alfresco.model.WCMAppModel;
|
||||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||||
|
import org.alfresco.repo.domain.PropertyValue;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
|
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
@@ -101,11 +103,11 @@ public class RenditionImpl
|
|||||||
public FormInstanceData getPrimaryFormInstanceData()
|
public FormInstanceData getPrimaryFormInstanceData()
|
||||||
throws FileNotFoundException
|
throws FileNotFoundException
|
||||||
{
|
{
|
||||||
final AVMService avmService = this.getServiceRegistry().getAVMService();
|
final AVMService avmService = this.getAVMService();
|
||||||
final NodeService nodeService = this.getServiceRegistry().getNodeService();
|
|
||||||
final String fidAVMStoreRelativePath = (String)
|
final String fidAVMStoreRelativePath = (String)
|
||||||
nodeService.getProperty(this.nodeRef,
|
avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
|
||||||
WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA);
|
AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
|
||||||
|
WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA).getValue(DataTypeDefinition.TEXT);
|
||||||
String avmStore = AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond();
|
String avmStore = AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond();
|
||||||
avmStore = avmStore.substring(0, avmStore.indexOf(':'));
|
avmStore = avmStore.substring(0, avmStore.indexOf(':'));
|
||||||
final String path = avmStore + ':' + fidAVMStoreRelativePath;
|
final String path = avmStore + ':' + fidAVMStoreRelativePath;
|
||||||
@@ -113,7 +115,7 @@ public class RenditionImpl
|
|||||||
{
|
{
|
||||||
throw new FileNotFoundException("unable to find primary form instance data " + path);
|
throw new FileNotFoundException("unable to find primary form instance data " + path);
|
||||||
}
|
}
|
||||||
return new FormInstanceDataImpl(AVMNodeConverter.ToNodeRef(-1, path));
|
return new FormInstanceDataImpl(-1, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the rendering engine template that generated this rendition */
|
/** the rendering engine template that generated this rendition */
|
||||||
@@ -121,20 +123,36 @@ public class RenditionImpl
|
|||||||
{
|
{
|
||||||
if (this.renderingEngineTemplate == null)
|
if (this.renderingEngineTemplate == null)
|
||||||
{
|
{
|
||||||
final NodeService nodeService = this.getServiceRegistry().getNodeService();
|
final AVMService avmService = this.getAVMService();
|
||||||
final NodeRef retNodeRef = (NodeRef)
|
PropertyValue pv =
|
||||||
nodeService.getProperty(this.nodeRef,
|
avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
|
||||||
WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE);
|
AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
|
||||||
|
WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE);
|
||||||
|
if (pv == null)
|
||||||
|
{
|
||||||
|
LOGGER.debug("property " + WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE +
|
||||||
|
" not set on " + this.getPath());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final NodeRef retNodeRef = (NodeRef)pv.getValue(DataTypeDefinition.NODE_REF);
|
||||||
if (retNodeRef == null)
|
if (retNodeRef == null)
|
||||||
{
|
{
|
||||||
LOGGER.debug("unable to locate parent rendering engine template of rendition " +
|
LOGGER.debug("unable to locate parent rendering engine template of rendition " +
|
||||||
this.getPath());
|
this.getPath());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
pv = avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
|
||||||
|
AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
|
||||||
|
WCMAppModel.PROP_PARENT_RENDITION_PROPERTIES);
|
||||||
|
if (pv == null)
|
||||||
|
{
|
||||||
|
LOGGER.debug("property " + WCMAppModel.PROP_PARENT_RENDITION_PROPERTIES +
|
||||||
|
" not set on " + this.getPath());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
final NodeRef rpNodeRef = (NodeRef)
|
final NodeRef rpNodeRef = (NodeRef)pv.getValue(DataTypeDefinition.NODE_REF);
|
||||||
nodeService.getProperty(this.nodeRef,
|
|
||||||
WCMAppModel.PROP_PARENT_RENDITION_PROPERTIES);
|
|
||||||
if (rpNodeRef == null)
|
if (rpNodeRef == null)
|
||||||
{
|
{
|
||||||
LOGGER.debug("unable to locate parent rendering engine template properties of rendition " +
|
LOGGER.debug("unable to locate parent rendering engine template properties of rendition " +
|
||||||
@@ -169,7 +187,7 @@ public class RenditionImpl
|
|||||||
|
|
||||||
public OutputStream getOutputStream()
|
public OutputStream getOutputStream()
|
||||||
{
|
{
|
||||||
final AVMService avmService = this.getServiceRegistry().getAVMService();
|
final AVMService avmService = this.getAVMService();
|
||||||
final Pair<Integer, String> p = AVMNodeConverter.ToAVMVersionPath(this.nodeRef);
|
final Pair<Integer, String> p = AVMNodeConverter.ToAVMVersionPath(this.nodeRef);
|
||||||
return (avmService.lookup(p.getFirst(), p.getSecond()) == null
|
return (avmService.lookup(p.getFirst(), p.getSecond()) == null
|
||||||
? avmService.createFile(AVMNodeConverter.SplitBase(p.getSecond())[0],
|
? avmService.createFile(AVMNodeConverter.SplitBase(p.getSecond())[0],
|
||||||
@@ -194,6 +212,11 @@ public class RenditionImpl
|
|||||||
this.getRenderingEngineTemplate().render(formInstanceData, this);
|
this.getRenderingEngineTemplate().render(formInstanceData, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AVMService getAVMService()
|
||||||
|
{
|
||||||
|
return this.getServiceRegistry().getAVMService();
|
||||||
|
}
|
||||||
|
|
||||||
private ServiceRegistry getServiceRegistry()
|
private ServiceRegistry getServiceRegistry()
|
||||||
{
|
{
|
||||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
package org.alfresco.web.ui.repo.component;
|
package org.alfresco.web.ui.repo.component;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
import javax.faces.context.ResponseWriter;
|
import javax.faces.context.ResponseWriter;
|
||||||
@@ -38,6 +39,7 @@ import org.alfresco.web.bean.repository.Repository;
|
|||||||
import org.alfresco.web.ui.common.Utils;
|
import org.alfresco.web.ui.common.Utils;
|
||||||
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
|
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
|
||||||
import org.alfresco.web.ui.repo.WebResources;
|
import org.alfresco.web.ui.repo.WebResources;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Kevin Roast
|
* @author Kevin Roast
|
||||||
@@ -79,16 +81,17 @@ public class UILockIcon extends SelfRenderingComponent
|
|||||||
*/
|
*/
|
||||||
public Object saveState(FacesContext context)
|
public Object saveState(FacesContext context)
|
||||||
{
|
{
|
||||||
Object values[] = new Object[7];
|
return new Object[]
|
||||||
// standard component attributes are saved by the super class
|
{
|
||||||
values[0] = super.saveState(context);
|
// standard component attributes are saved by the super class
|
||||||
values[1] = this.lockImage;
|
super.saveState(context),
|
||||||
values[2] = this.lockOwnerImage;
|
this.lockImage,
|
||||||
values[3] = this.align;
|
this.lockOwnerImage,
|
||||||
values[4] = this.width;
|
this.align,
|
||||||
values[5] = this.height;
|
this.width,
|
||||||
values[6] = this.value;
|
this.height,
|
||||||
return (values);
|
this.value
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,14 +103,10 @@ public class UILockIcon extends SelfRenderingComponent
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResponseWriter out = context.getResponseWriter();
|
|
||||||
|
|
||||||
// get the value and see if the image is locked
|
// get the value and see if the image is locked
|
||||||
NodeService nodeService = getNodeService(context);
|
NodeService nodeService = getNodeService(context);
|
||||||
boolean locked = false;
|
String lockUser = null;
|
||||||
boolean lockedOwner = false;
|
|
||||||
|
|
||||||
Object val = getValue();
|
Object val = getValue();
|
||||||
NodeRef ref = null;
|
NodeRef ref = null;
|
||||||
if (val instanceof NodeRef)
|
if (val instanceof NodeRef)
|
||||||
@@ -115,15 +114,26 @@ public class UILockIcon extends SelfRenderingComponent
|
|||||||
ref = (NodeRef)val;
|
ref = (NodeRef)val;
|
||||||
if (nodeService.exists(ref) && nodeService.hasAspect(ref, ContentModel.ASPECT_LOCKABLE) == true)
|
if (nodeService.exists(ref) && nodeService.hasAspect(ref, ContentModel.ASPECT_LOCKABLE) == true)
|
||||||
{
|
{
|
||||||
String lockerUser = (String)nodeService.getProperty(ref, ContentModel.PROP_LOCK_OWNER);
|
lockUser = (String)nodeService.getProperty(ref, ContentModel.PROP_LOCK_OWNER);
|
||||||
if (lockerUser != null)
|
|
||||||
{
|
|
||||||
locked = true;
|
|
||||||
lockedOwner = (lockerUser.equals(Application.getCurrentUser(context).getUserName()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final boolean locked = lockUser != null;
|
||||||
|
final boolean lockedOwner = locked && (lockUser.equals(Application.getCurrentUser(context).getUserName()));
|
||||||
|
|
||||||
|
this.encodeBegin(context, locked, lockedOwner, new String[] { lockUser });
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void encodeBegin(final FacesContext context,
|
||||||
|
final boolean locked,
|
||||||
|
final boolean lockedOwner,
|
||||||
|
final String[] lockUser)
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
if (isRendered() == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ResponseWriter out = context.getResponseWriter();
|
||||||
String msg = null;
|
String msg = null;
|
||||||
|
|
||||||
if (locked == true)
|
if (locked == true)
|
||||||
@@ -157,15 +167,14 @@ public class UILockIcon extends SelfRenderingComponent
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String lockingUser = (String)nodeService.getProperty(ref, ContentModel.PROP_LOCK_OWNER);
|
msg = MessageFormat.format(Application.getMessage(context, MSG_LOCKED_USER), lockUser.length);
|
||||||
msg = Application.getMessage(context, MSG_LOCKED_USER);
|
|
||||||
if (getLockedUserTooltip() != null)
|
if (getLockedUserTooltip() != null)
|
||||||
{
|
{
|
||||||
msg = getLockedUserTooltip();
|
msg = getLockedUserTooltip();
|
||||||
}
|
}
|
||||||
StringBuilder buf = new StringBuilder(32);
|
StringBuilder buf = new StringBuilder(32);
|
||||||
msg = buf.append(msg).append(" '")
|
msg = buf.append(msg).append(" '")
|
||||||
.append(lockingUser)
|
.append(StringUtils.arrayToDelimitedString(lockUser, ", "))
|
||||||
.append("'").toString();
|
.append("'").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
107
source/java/org/alfresco/web/ui/wcm/component/UIAVMLockIcon.java
Normal file
107
source/java/org/alfresco/web/ui/wcm/component/UIAVMLockIcon.java
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
/*
|
||||||
|
* 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.ui.wcm.component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.context.ResponseWriter;
|
||||||
|
import javax.faces.el.ValueBinding;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||||
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
|
import org.alfresco.service.cmr.avm.locking.AVMLock;
|
||||||
|
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.web.app.Application;
|
||||||
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
|
import org.alfresco.web.bean.repository.User;
|
||||||
|
import org.alfresco.web.bean.wcm.WebProject;
|
||||||
|
import org.alfresco.web.ui.repo.component.UILockIcon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ariel Backenroth
|
||||||
|
*/
|
||||||
|
public class UIAVMLockIcon extends UILockIcon
|
||||||
|
{
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Component implementation
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.component.UIComponent#getFamily()
|
||||||
|
*/
|
||||||
|
public String getFamily()
|
||||||
|
{
|
||||||
|
return "org.alfresco.faces.AVMLockIcon";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
|
||||||
|
*/
|
||||||
|
public void encodeBegin(FacesContext context) throws IOException
|
||||||
|
{
|
||||||
|
if (isRendered() == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the value and see if the image is locked
|
||||||
|
final AVMService avmService = Repository.getServiceRegistry(context).getAVMService();
|
||||||
|
final AVMLockingService avmLockingService = Repository.getServiceRegistry(context).getAVMLockingService();
|
||||||
|
|
||||||
|
boolean locked = false;
|
||||||
|
boolean lockedOwner = false;
|
||||||
|
Object val = getValue();
|
||||||
|
List<String> lockUser = null;
|
||||||
|
final String avmPath = (val instanceof NodeRef
|
||||||
|
? AVMNodeConverter.ToAVMVersionPath((NodeRef)val).getSecond()
|
||||||
|
: (val instanceof String
|
||||||
|
? (String)val
|
||||||
|
: null));
|
||||||
|
if (avmPath != null)
|
||||||
|
{
|
||||||
|
if (avmService.lookup(-1, avmPath) != null)
|
||||||
|
{
|
||||||
|
final WebProject webProject = new WebProject(avmPath);
|
||||||
|
final AVMLock lock = avmLockingService.getLock(webProject.getStoreId(), avmPath.substring(avmPath.indexOf("/")));
|
||||||
|
if (lock != null)
|
||||||
|
{
|
||||||
|
locked = true;
|
||||||
|
final User currentUser = Application.getCurrentUser(context);
|
||||||
|
lockUser = lock.getOwners();
|
||||||
|
lockedOwner = (webProject.isManager(currentUser) ||
|
||||||
|
lockUser.contains(currentUser.getUserName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.encodeBegin(context,
|
||||||
|
locked,
|
||||||
|
lockedOwner,
|
||||||
|
lockUser == null ? new String[0] : (String[])lockUser.toArray(new String[lockUser.size()]));
|
||||||
|
}
|
||||||
|
}
|
@@ -719,6 +719,10 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
|||||||
out.write("</a></td><td>");
|
out.write("</a></td><td>");
|
||||||
out.write(linkPrefix);
|
out.write(linkPrefix);
|
||||||
out.write(name);
|
out.write(name);
|
||||||
|
UIAVMLockIcon lockIcon = (UIAVMLockIcon)fc.getApplication().createComponent("org.alfresco.faces.AVMLockIcon");
|
||||||
|
lockIcon.setId("lock_" + FacesHelper.makeLegalId(name));
|
||||||
|
lockIcon.setValue(sourcePath);
|
||||||
|
Utils.encodeRecursive(fc, lockIcon);
|
||||||
out.write("</a>");
|
out.write("</a>");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
41
source/java/org/alfresco/web/ui/wcm/tag/AVMLockIconTag.java
Normal file
41
source/java/org/alfresco/web/ui/wcm/tag/AVMLockIconTag.java
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* 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.ui.wcm.tag;
|
||||||
|
|
||||||
|
import org.alfresco.web.ui.repo.tag.LockIconTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ariel Backenroth
|
||||||
|
*/
|
||||||
|
public class AVMLockIconTag extends LockIconTag
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see javax.faces.webapp.UIComponentTag#getComponentType()
|
||||||
|
*/
|
||||||
|
public String getComponentType()
|
||||||
|
{
|
||||||
|
return "org.alfresco.faces.AVMLockIcon";
|
||||||
|
}
|
||||||
|
}
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||||
elementFormDefault="qualified">
|
elementFormDefault="qualified">
|
||||||
<xs:element name="simple-test">
|
<xs:element name="simple">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="string" type="xs:normalizedString" default="default string value"/>
|
<xs:element name="string" type="xs:normalizedString" default="default string value"/>
|
||||||
|
@@ -2691,7 +2691,7 @@
|
|||||||
</managed-property>
|
</managed-property>
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>avmService</property-name>
|
<property-name>avmService</property-name>
|
||||||
<value>#{AVMService}</value>
|
<value>#{AVMLockingAwareService}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>avmSyncService</property-name>
|
<property-name>avmSyncService</property-name>
|
||||||
@@ -2913,7 +2913,7 @@
|
|||||||
<managed-bean-scope>session</managed-bean-scope>
|
<managed-bean-scope>session</managed-bean-scope>
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>avmService</property-name>
|
<property-name>avmService</property-name>
|
||||||
<value>#{AVMService}</value>
|
<value>#{AVMLockingAwareService}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>avmSyncService</property-name>
|
<property-name>avmSyncService</property-name>
|
||||||
@@ -2927,10 +2927,6 @@
|
|||||||
<property-name>avmBrowseBean</property-name>
|
<property-name>avmBrowseBean</property-name>
|
||||||
<value>#{AVMBrowseBean}</value>
|
<value>#{AVMBrowseBean}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
<managed-property>
|
|
||||||
<property-name>nodeService</property-name>
|
|
||||||
<value>#{NodeService}</value>
|
|
||||||
</managed-property>
|
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>filePickerBean</property-name>
|
<property-name>filePickerBean</property-name>
|
||||||
<value>#{FilePickerBean}</value>
|
<value>#{FilePickerBean}</value>
|
||||||
|
@@ -10,13 +10,13 @@
|
|||||||
</component>
|
</component>
|
||||||
|
|
||||||
<component>
|
<component>
|
||||||
<component-type>org.alfresco.faces.UserSandboxes</component-type>
|
<component-type>org.alfresco.faces.SandboxSnapshots</component-type>
|
||||||
<component-class>org.alfresco.web.ui.wcm.component.UIUserSandboxes</component-class>
|
<component-class>org.alfresco.web.ui.wcm.component.UISandboxSnapshots</component-class>
|
||||||
</component>
|
</component>
|
||||||
|
|
||||||
<component>
|
<component>
|
||||||
<component-type>org.alfresco.faces.SandboxSnapshots</component-type>
|
<component-type>org.alfresco.faces.AVMLockIcon</component-type>
|
||||||
<component-class>org.alfresco.web.ui.wcm.component.UISandboxSnapshots</component-class>
|
<component-class>org.alfresco.web.ui.wcm.component.UIAVMLockIcon</component-class>
|
||||||
</component>
|
</component>
|
||||||
|
|
||||||
<component>
|
<component>
|
||||||
|
@@ -411,4 +411,88 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
</tag>
|
</tag>
|
||||||
|
|
||||||
|
<tag>
|
||||||
|
<name>avmLockIcon</name>
|
||||||
|
<tag-class>org.alfresco.web.ui.wcm.tag.AVMLockIconTag</tag-class>
|
||||||
|
<body-content>JSP</body-content>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>id</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>binding</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>rendered</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>style</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>styleClass</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>lockImage</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>lockOwnerImage</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>align</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>width</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>height</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>lockedOwnerTooltip</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>lockedUserTooltip</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>value</name>
|
||||||
|
<required>true</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
</tag>
|
||||||
|
|
||||||
</taglib>
|
</taglib>
|
||||||
|
@@ -157,6 +157,7 @@
|
|||||||
<a:actionLink id="col1-act2" value="#{r.name}" actionListener="#{AVMBrowseBean.clickFolder}">
|
<a:actionLink id="col1-act2" value="#{r.name}" actionListener="#{AVMBrowseBean.clickFolder}">
|
||||||
<f:param name="id" value="#{r.id}" />
|
<f:param name="id" value="#{r.id}" />
|
||||||
</a:actionLink>
|
</a:actionLink>
|
||||||
|
<w:avmLockIcon id="col10-lock" value="#{r.nodeRef}" align="absmiddle" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Description column
|
<%-- Description column
|
||||||
@@ -243,6 +244,7 @@
|
|||||||
<a:actionLink id="col10-act1" value="#{r.name}" href="#{r.url}" target="new" image="#{r.fileType16}" showLink="false" styleClass="inlineAction" />
|
<a:actionLink id="col10-act1" value="#{r.name}" href="#{r.url}" target="new" image="#{r.fileType16}" showLink="false" styleClass="inlineAction" />
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<a:actionLink id="col10-act2" value="#{r.name}" href="#{r.url}" target="new" />
|
<a:actionLink id="col10-act2" value="#{r.name}" href="#{r.url}" target="new" />
|
||||||
|
<w:avmLockIcon id="col10-lock" value="#{r.nodeRef}" align="absmiddle" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Description column
|
<%-- Description column
|
||||||
|
Reference in New Issue
Block a user