use of org.alfresco.service.cmr.dictionary.DictionaryService in project acs-community-packaging by Alfresco.
the class UICategorySelector method getParentNodeId.
public String getParentNodeId(FacesContext context) {
String id = null;
if (this.navigationId != null) {
ChildAssociationRef parentRef = getFastNodeService(context).getPrimaryParent(new NodeRef(Repository.getStoreRef(), this.navigationId));
Node parentNode = new Node(parentRef.getParentRef());
DictionaryService dd = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService();
if (dd.isSubClass(parentNode.getType(), ContentModel.TYPE_CATEGORYROOT) == false) {
id = parentRef.getParentRef().getId();
}
}
return id;
}
use of org.alfresco.service.cmr.dictionary.DictionaryService in project acs-community-packaging by Alfresco.
the class UIShortcutsShelfItem method encodeBegin.
/**
* @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
*/
public void encodeBegin(FacesContext context) throws IOException {
if (isRendered() == false) {
return;
}
ResponseWriter out = context.getResponseWriter();
List<Node> items = (List<Node>) getValue();
out.write(SHELF_START);
if (items != null) {
DictionaryService dd = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService();
for (int i = 0; i < items.size(); i++) {
Node item = items.get(i);
out.write("<tr><td width=16>");
if (dd.isSubClass(item.getType(), ContentModel.TYPE_FOLDER)) {
// start row with correct node icon
String icon = (String) item.getProperties().get("app:icon");
if (icon != null) {
icon = "/images/icons/" + icon + "-16.gif";
} else {
icon = WebResources.IMAGE_SPACE;
}
out.write(Utils.buildImageTag(context, icon, 16, 16, null, null, "absmiddle"));
} else if (dd.isSubClass(item.getType(), ContentModel.TYPE_CONTENT)) {
String image = FileTypeImageUtils.getFileTypeImage(item.getName(), true);
out.write(Utils.buildImageTag(context, image, null, "absmiddle"));
}
// output cropped item label - we also output with no breaks, this is ok
// as the copped label will ensure a sensible maximum width
out.write("</td><td width=100%><nobr> ");
out.write(buildActionLink(ACTION_CLICK_ITEM, i, item.getName()));
// output actions
out.write("</nobr></td><td align=right><nobr>");
out.write(buildActionLink(ACTION_REMOVE_ITEM, i, Application.getMessage(context, MSG_REMOVE_ITEM), WebResources.IMAGE_REMOVE));
// TODO: add view details action here?
// end actions cell and end row
out.write("</nobr></td></tr>");
}
}
out.write(SHELF_END);
}
use of org.alfresco.service.cmr.dictionary.DictionaryService in project acs-community-packaging by Alfresco.
the class UIClipboardShelfItem method encodeBegin.
/**
* @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
*/
public void encodeBegin(FacesContext context) throws IOException {
if (isRendered() == false) {
return;
}
ResponseWriter out = context.getResponseWriter();
List<ClipboardItem> items = getCollections();
out.write(SHELF_START);
if (items.size() != 0) {
DictionaryService dd = Repository.getServiceRegistry(context).getDictionaryService();
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
ResourceBundle bundle = Application.getBundle(context);
for (int i = 0; i < items.size(); i++) {
ClipboardItem item = items.get(i);
// check that the item has not been deleted since added to the clipboard
if (nodeService.exists(item.getNodeRef()) == false) {
// remove from clipboard
items.remove(i--);
continue;
}
// start row with cut/copy state icon
out.write("<tr><td width=16>");
if (item.getMode() == ClipboardStatus.COPY) {
out.write(Utils.buildImageTag(context, WebResources.IMAGE_COPY, 14, 16, bundle.getString(MSG_COPY), null, "absmiddle"));
} else {
out.write(Utils.buildImageTag(context, WebResources.IMAGE_CUT, 13, 16, bundle.getString(MSG_CUT), null, "absmiddle"));
}
out.write("</td><td width=16>");
boolean isFolder = (dd.isSubClass(item.getType(), ContentModel.TYPE_FOLDER));
if (isFolder) {
// start row with correct node icon
String icon = (String) item.getIcon();
if (icon != null) {
icon = "/images/icons/" + icon + "-16.gif";
} else {
icon = WebResources.IMAGE_SPACE;
}
out.write(Utils.buildImageTag(context, icon, 16, 16, null, null, "absmiddle"));
} else {
String image = FileTypeImageUtils.getFileTypeImage(item.getName(), true);
out.write(Utils.buildImageTag(context, image, null, "absmiddle"));
}
// output cropped item label - we also output with no breaks, this is ok
// as the copped label will ensure a sensible maximum width
out.write("</td><td width=100%><nobr> ");
if (isFolder) {
out.write(Utils.cropEncode(item.getName()));
} else {
// output as a content download link
out.write("<a href='");
out.write(context.getExternalContext().getRequestContextPath());
out.write(generateBrowserURL(dd, nodeService, item));
out.write("' target='new'>");
out.write(Utils.cropEncode(item.getName()));
out.write("</a>");
}
// output actions
out.write("</nobr></td><td align=right><nobr>");
out.write(buildActionLink(ACTION_REMOVE_ITEM, i, bundle.getString(MSG_REMOVE_ITEM), WebResources.IMAGE_REMOVE));
out.write(" ");
out.write(buildActionLink(ACTION_PASTE_ITEM, i, bundle.getString(MSG_PASTE_ITEM), WebResources.IMAGE_PASTE));
if (item.supportsLink() && item.getMode() == ClipboardStatus.COPY && dd.isSubClass(item.getType(), ContentModel.TYPE_LINK) == false) {
out.write(" ");
out.write(buildActionLink(ACTION_PASTE_LINK, i, bundle.getString(MSG_PASTE_LINK), WebResources.IMAGE_PASTE_LINK));
}
// end actions cell and end row
out.write("</nobr></td></tr>");
}
// output general actions if any clipboard items are present
out.write("<tr><td colspan=4 style='padding-top:3px' align='center'><nobr>");
out.write(buildActionLink(ACTION_PASTE_ALL, -1, bundle.getString(MSG_PASTE_ALL), null));
out.write(" | ");
out.write(buildActionLink(ACTION_REMOVE_ALL, -1, bundle.getString(MSG_REMOVE_ALL), null));
out.write("</nobr></td><td></td></tr>");
}
out.write(SHELF_END);
}
use of org.alfresco.service.cmr.dictionary.DictionaryService in project acs-community-packaging by Alfresco.
the class EditDocCIFSEvaluator method evaluate.
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node) {
FacesContext fc = FacesContext.getCurrentInstance();
DictionaryService dd = Repository.getServiceRegistry(fc).getDictionaryService();
boolean result = false;
// if the node is inline editable, the default http behaviour should always be used
if (dd.isSubClass(node.getType(), ContentModel.TYPE_CONTENT)) {
if (node.hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE) == false && "cifs".equals(Application.getClientConfig(fc).getEditLinkType())) {
if ((node.isWorkingCopyOwner() == true && node.getProperties().get(ContentModel.PROP_WORKING_COPY_MODE) != null && node.getProperties().get(ContentModel.PROP_WORKING_COPY_MODE).equals(EditOnlineDialog.ONLINE_EDITING)) || (node.hasAspect(ContentModel.ASPECT_WORKING_COPY) && node.hasPermission(PermissionService.WRITE)) || (node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false)) {
result = true;
}
}
}
return result;
}
use of org.alfresco.service.cmr.dictionary.DictionaryService in project acs-community-packaging by Alfresco.
the class EditDocHttpEvaluator method evaluate.
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node) {
FacesContext fc = FacesContext.getCurrentInstance();
DictionaryService dd = Repository.getServiceRegistry(fc).getDictionaryService();
boolean result = false;
// no sens to edit it on-line.
if (node.getAspects().contains(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION)) {
// result = false
} else // always be used otherwise the configured approach is used
if (dd.isSubClass(node.getType(), ContentModel.TYPE_CONTENT)) {
if (node.hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE) == true && node.getProperties().get(ApplicationModel.PROP_EDITINLINE) != null && ((Boolean) node.getProperties().get(ApplicationModel.PROP_EDITINLINE)).booleanValue() == true) {
if ((node.isWorkingCopyOwner() == true && node.getProperties().get(ContentModel.PROP_WORKING_COPY_MODE) != null && node.getProperties().get(ContentModel.PROP_WORKING_COPY_MODE).equals(EditOnlineDialog.ONLINE_EDITING)) || (node.hasAspect(ContentModel.ASPECT_WORKING_COPY) && node.hasPermission(PermissionService.WRITE)) || (node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false)) {
result = true;
}
}
}
return result;
}
Aggregations