Search in sources :

Example 21 with DictionaryService

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;
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) DictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService) Node(org.alfresco.web.bean.repository.Node) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef)

Example 22 with DictionaryService

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>&nbsp;");
            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);
}
Also used : DictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService) ResponseWriter(javax.faces.context.ResponseWriter) Node(org.alfresco.web.bean.repository.Node) List(java.util.List)

Example 23 with DictionaryService

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>&nbsp;");
            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("&nbsp;");
            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("&nbsp;");
                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("&nbsp;|&nbsp;");
        out.write(buildActionLink(ACTION_REMOVE_ALL, -1, bundle.getString(MSG_REMOVE_ALL), null));
        out.write("</nobr></td><td></td></tr>");
    }
    out.write(SHELF_END);
}
Also used : ClipboardItem(org.alfresco.web.bean.clipboard.ClipboardItem) DictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService) ResponseWriter(javax.faces.context.ResponseWriter) NodeService(org.alfresco.service.cmr.repository.NodeService) ResourceBundle(java.util.ResourceBundle)

Example 24 with DictionaryService

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;
}
Also used : FacesContext(javax.faces.context.FacesContext) DictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService)

Example 25 with DictionaryService

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;
}
Also used : FacesContext(javax.faces.context.FacesContext) DictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService)

Aggregations

DictionaryService (org.alfresco.service.cmr.dictionary.DictionaryService)29 FacesContext (javax.faces.context.FacesContext)12 NodeRef (org.alfresco.service.cmr.repository.NodeRef)11 QName (org.alfresco.service.namespace.QName)11 NodeService (org.alfresco.service.cmr.repository.NodeService)8 Node (org.alfresco.web.bean.repository.Node)8 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)7 TypeDefinition (org.alfresco.service.cmr.dictionary.TypeDefinition)6 SelectItem (javax.faces.model.SelectItem)5 PropertyDefinition (org.alfresco.service.cmr.dictionary.PropertyDefinition)5 Serializable (java.io.Serializable)4 ArrayList (java.util.ArrayList)4 DataTypeDefinition (org.alfresco.service.cmr.dictionary.DataTypeDefinition)4 QuickSort (org.alfresco.web.data.QuickSort)4 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)3 ResponseWriter (javax.faces.context.ResponseWriter)3 UserTransaction (javax.transaction.UserTransaction)3 AccessDeniedException (org.alfresco.repo.security.permissions.AccessDeniedException)3