Class AmetysFrontEditionHelper

    • Method Detail

      • prepareJSFiles

        public static String prepareJSFiles​(String locale,
                                            boolean rtlMode,
                                            String theme)
        Prepare a hashcode for js files
        Parameters:
        locale - The language code to use
        rtlMode - Is for right-to-left language?
        theme - The url for the theme
        Returns:
        The new hashcode to read the minimified concatened file
      • prepareCSSFiles

        public static String prepareCSSFiles​(String locale,
                                             boolean rtlMode,
                                             String theme)
        Prepare a hashcode for css files
        Parameters:
        locale - The language code to use
        rtlMode - Is for right-to-left language?
        theme - The url for the theme
        Returns:
        The new hashcode to read the minimified concatened file
      • hasFrontEditionRight

        @Deprecated
        public static boolean hasFrontEditionRight​(String rightId,
                                                   String inputPageId)
        Deprecated.
        Use the version with three arguments
        Check if we can display the front edition button for a specific right Checks : * Rendering context == front * Edition mode * Front_Edition_Access_Right * RightId available
        Parameters:
        rightId - right to check (can be null)
        inputPageId - page to check
        Returns:
        true if all is OK, false if at least one is false
      • hasFrontEditionRight

        public static boolean hasFrontEditionRight​(String rightId,
                                                   String objectId,
                                                   boolean editionModeOnly)
        Check if we can display the front edition button for a specific right Checks : * Rendering context == front * Edition mode * Front_Edition_Access_Right * RightId available
        Parameters:
        rightId - right to check (can be null)
        objectId - page/content to check
        editionModeOnly - Check if the user is in edition mode
        Returns:
        true if all is OK, false if at least one is false
      • hasFrontEditionRight

        public static boolean hasFrontEditionRight()
        Check if the current user has the Front_Edition_Access_Right right
        Returns:
        true if right granted
      • hasWorkflowRight

        public static boolean hasWorkflowRight​(int actionId,
                                               String contentId,
                                               boolean checkEditionMode)
        Check if the current workflow action is available on this content
        Parameters:
        actionId - action to check
        contentId - content to check
        checkEditionMode - check also if we are in edition mode
        Returns:
        true if right is granted
      • hasWorkflowRight

        public static boolean hasWorkflowRight​(List<Integer> actionIds,
                                               String contentId,
                                               boolean checkEditionMode)
        Check if a list of workflow actions are available on this content
        Parameters:
        actionIds - list of action ids
        contentId - id of the content to check
        checkEditionMode - check also if we are in edition mode
        Returns:
        true if all actions are available
      • hasWorkflowRight

        public static boolean hasWorkflowRight​(List<Integer> actionIds,
                                               Content content,
                                               boolean checkEditionMode)
        Check if a list of workflow actions are available on this content
        Parameters:
        actionIds - list of action ids
        content - content to check
        checkEditionMode - check also if we are in edition mode
        Returns:
        true if all actions are available
      • getContentModifiables

        public static String getContentModifiables​(int actionId,
                                                   String inputPageId,
                                                   boolean checkEditionMode)
        Get a string representing a json map of the contentIds with true/false if they can/can't be modified
        Parameters:
        actionId - action to check
        inputPageId - page (can be null)
        checkEditionMode - check also if we are in edition mode
        Returns:
        {contentId : true/false, ....}
      • getWorkflowName

        public static String getWorkflowName​(String workflowName,
                                             int actionId)
        Get the name of a workflow action
        Parameters:
        workflowName - workflow name
        actionId - action id in the workflow
        Returns:
        name of the workflow action
      • getPageStatus

        public String getPageStatus​(String pageId)
        Get the status (validated/draft) of all contents in a page
        Parameters:
        pageId - id of the page to check
        Returns:
        "" if not a page, "draft" if all contents are drafts, "validated" if all contents are validated, and "mixed" if there are both
      • getContentWorkflowId

        public long getContentWorkflowId​(String contentId)
        Get the workflow step id of a content
        Parameters:
        contentId - id of the content
        Returns:
        the step Id
      • getContentWorkflowId

        public long getContentWorkflowId​(Content content)
        Get the workflow step id of a content
        Parameters:
        content - content
        Returns:
        the step Id
      • getContentStatus

        public String getContentStatus​(String contentId)
        check if a content is published ot not
        Parameters:
        contentId - id of the content
        Returns:
        "validated" or "draft", "" if not found
      • getContentStatus

        public String getContentStatus​(Content content)
        check if a content is published ot not
        Parameters:
        content - content
        Returns:
        "validated" or "draft"
      • isContentLive

        public boolean isContentLive​(String contentId)
        check if a content is published ot not
        Parameters:
        contentId - id of the content
        Returns:
        true if validated
      • isContentLive

        public boolean isContentLive​(Content content)
        check if a content is published ot not
        Parameters:
        content - content
        Returns:
        true if validated
      • getZoneSize

        public long getZoneSize​(String zoneName,
                                String pageId)
        Return the size of a zone
        Parameters:
        zoneName - zone name
        pageId - page Id
        Returns:
        size of the zone (-1 if not found)