⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmsavailability.java

📁 找了很久才找到到源代码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
            CmsObject cms = getCms();
            String resourceSitePath = cms.getRequestContext().removeSiteRoot(getParamResource());
            try {
                // get all parent folders of the current file
                parentResources = cms.readPath(getParamResource(), CmsResourceFilter.IGNORE_EXPIRATION);
            } catch (CmsException e) {
                // can usually be ignored
                if (LOG.isInfoEnabled()) {
                    LOG.info(e.getLocalizedMessage());
                }
            }
            Iterator i = parentResources.iterator();
            while (i.hasNext()) {
                CmsResource resource = (CmsResource)i.next();
                try {
                    String sitePath = cms.getRequestContext().removeSiteRoot(resource.getRootPath());
                    Iterator entries = cms.getAccessControlEntries(sitePath, false).iterator();
                    while (entries.hasNext()) {
                        CmsAccessControlEntry ace = (CmsAccessControlEntry)entries.next();
                        if (ace.isResponsible()) {
                            I_CmsPrincipal principal = cms.lookupPrincipal(ace.getPrincipal());
                            if (principal != null) {
                                responsibles.put(principal, resourceSitePath.equals(sitePath) ? null : sitePath);
                            }
                        }
                    }
                } catch (CmsException e) {
                    // can usually be ignored
                    if (LOG.isInfoEnabled()) {
                        LOG.info(e.getLocalizedMessage());
                    }
                }
            }

            if (responsibles.size() == 0) {
                // no responsibles found
                result.append(key(Messages.GUI_AVAILABILITY_NO_RESPONSIBLES_0));
            } else {
                // found responsibles, create list
                result.append(dialogToggleStart(key(Messages.GUI_AVAILABILITY_RESPONSIBLES_0), "responsibles", false));
                Collection parentFolders = new ArrayList(responsibles.values());
                parentFolders.remove(null);
                if (parentFolders.size() > 0) {
                    result.append("<table border=\"0\">\n<tr>\n\t<td>");
                    result.append(key(Messages.GUI_PERMISSION_SELECT_VIEW_0));
                    result.append("</td>\n<td><input type=\"button\" onclick=\"toggleInheritInfo();\" value=\"");
                    result.append(key(Messages.GUI_LABEL_DETAILS_0));
                    result.append("\" id=\"button\"/></td></tr></table>");
                }
                result.append(dialogWhiteBoxStart());
                Iterator it = responsibles.entrySet().iterator();
                for (int j = 0; it.hasNext(); j++) {
                    Map.Entry entry = (Map.Entry)it.next();
                    I_CmsPrincipal principal = (I_CmsPrincipal)entry.getKey();
                    String image = "user.png";
                    String localizedType = getLocalizedType(CmsAccessControlEntry.ACCESS_FLAGS_USER);
                    if (principal instanceof CmsGroup) {
                        image = "group.png";
                        localizedType = getLocalizedType(CmsAccessControlEntry.ACCESS_FLAGS_GROUP);
                    }
                    result.append("<div class=\"dialogrow\"><img src=\"");
                    result.append(getSkinUri());
                    result.append("commons/");
                    result.append(image);
                    result.append("\" class=\"noborder\" width=\"16\" height=\"16\" alt=\"");
                    result.append(localizedType);
                    result.append("\" title=\"");
                    result.append(localizedType);
                    result.append("\">&nbsp;<span class=\"textbold\">");
                    result.append(principal.getName());
                    result.append("</span><div class=\"hide\" id=\"inheritinfo");
                    result.append(j);
                    result.append("\"><div class=\"dialogpermissioninherit\">");
                    String resourceName = (String)entry.getValue();
                    if (CmsStringUtil.isNotEmpty(resourceName)) {
                        result.append(key(Messages.GUI_PERMISSION_INHERITED_FROM_1, new Object[] {resourceName}));
                    }
                    result.append("</div></div></div>\n");
                }
                result.append(dialogWhiteBoxEnd());
                result.append("</div>\n");
                result.append("</td></tr>");
            }
            return result.toString();
        }
    }

    /**
     * Creates the HTML JavaScript and stylesheet includes required by the calendar for the head of the page.<p>
     * 
     * @return the necessary HTML code for the js and stylesheet includes
     * 
     * @deprecated use {@link CmsCalendarWidget#calendarIncludes(java.util.Locale)}, this is just here so that old JSP still work
     */
    public String calendarIncludes() {

        return CmsCalendarWidget.calendarIncludes(getLocale());
    }

    /**
     * Generates the HTML to initialize the JavaScript calendar element on the end of a page.<p>
     * 
     * @param inputFieldId the ID of the input field where the date is pasted to
     * @param triggerButtonId the ID of the button which triggers the calendar
     * @param align initial position of the calendar popup element
     * @param singleClick if true, a single click selects a date and closes the calendar, otherwise calendar is closed by doubleclick
     * @param weekNumbers show the week numbers in the calendar or not
     * @param mondayFirst show monday as first day of week
     * @param dateStatusFunc name of the function which determines if/how a date should be disabled
     * @param showTime true if the time selector should be shown, otherwise false
     * @return the HTML code to initialize a calendar poup element
     * 
     * @deprecated use {@link CmsCalendarWidget#calendarInit(org.opencms.i18n.CmsMessages, String, String, String, boolean, boolean, boolean, String, boolean)}, this is just here so that old JSP still work
     */
    public String calendarInit(
        String inputFieldId,
        String triggerButtonId,
        String align,
        boolean singleClick,
        boolean weekNumbers,
        boolean mondayFirst,
        String dateStatusFunc,
        boolean showTime) {

        return CmsCalendarWidget.calendarInit(
            getMessages(),
            inputFieldId,
            triggerButtonId,
            align,
            singleClick,
            weekNumbers,
            mondayFirst,
            dateStatusFunc,
            showTime);
    }

    /**
     * Returns the current date and time as String formatted in localized pattern.<p>
     * 
     * @return the current date and time as String formatted in localized pattern
     */
    public String getCurrentDateTime() {

        // get the current date & time 
        return CmsCalendarWidget.getCalendarLocalizedTime(getLocale(), getMessages(), System.currentTimeMillis());
    }

    /**
     * Returns the current expiredate as String formatted in localized pattern.<p>
     * 
     * @return the current expiredate as String formatted in localized pattern
     */
    public String getCurrentExpireDate() {

        // get the expiration date
        if (isMultiOperation()) {
            return CmsTouch.DEFAULT_DATE_STRING;
        } else {
            try {
                CmsResource res = getCms().readResource(getParamResource(), CmsResourceFilter.IGNORE_EXPIRATION);
                if (res.getDateExpired() == CmsResource.DATE_EXPIRED_DEFAULT) {
                    return CmsTouch.DEFAULT_DATE_STRING;
                } else {
                    return CmsCalendarWidget.getCalendarLocalizedTime(getLocale(), getMessages(), res.getDateExpired());
                }
            } catch (CmsException e) {
                return CmsCalendarWidget.getCalendarLocalizedTime(
                    getLocale(),
                    getMessages(),
                    System.currentTimeMillis());
            }
        }
    }

    /**
     * Returns the current releasedate as String formatted in localized pattern.<p>
     * 
     * @return the current releasedate as String formatted in localized pattern
     */
    public String getCurrentReleaseDate() {

        // get the release date
        if (isMultiOperation()) {
            return CmsTouch.DEFAULT_DATE_STRING;
        } else {
            try {
                CmsResource res = getCms().readResource(getParamResource(), CmsResourceFilter.IGNORE_EXPIRATION);
                if (res.getDateReleased() == CmsResource.DATE_RELEASED_DEFAULT) {
                    return CmsTouch.DEFAULT_DATE_STRING;
                } else {
                    return CmsCalendarWidget.getCalendarLocalizedTime(getLocale(), getMessages(), res.getDateReleased());
                }
            } catch (CmsException e) {
                return CmsCalendarWidget.getCalendarLocalizedTime(
                    getLocale(),
                    getMessages(),
                    System.currentTimeMillis());
            }
        }
    }

    /**
     * Returns the value of the enable_notification parameter.<p>
     * 
     * The enable_notification parameter if content notification is enabled for this resource.<p>
     * 
     * @return the value of the enable_notification parameter
     */
    public String getParamEnablenotification() {

        return m_paramEnablenotification;
    }

    /**
     * Returns the value of the new expiredate parameter, 
     * or null if this parameter was not provided.<p>
     * 
     * @return the value of the new expiredate parameter
     */
    public String getParamExpiredate() {

        return m_paramExpiredate;
    }

    /**
     * Returns the value of the leaveexpire parameter.<p>
     * 
     * @return the value of the leaveexpire parameter
     */
    public String getParamLeaveexpire() {

        return m_paramLeaveexpire;
    }

    /**
     * Returns the value of the modify siblings parameter, 
     * or null if this parameter was not provided.<p>
     * 
     * @return the value of the modify siblings
     */
    public String getParamModifysiblings() {

        return m_paramModifysiblings;
    }

    /**
     * Returns the value of the notification interval parameter, 
     * or null if this parameter was not provided.<p>
     * 
     * @return the value of the notification interval parameter
     */
    public String getParamNotificationinterval() {

        return m_paramNotificationinterval;
    }

    /**
     * Returns the value of the recursive parameter, 
     * or null if this parameter was not provided.<p>
     * 
     * The recursive parameter on folders decides if all subresources
     * of the folder should be touched, too.<p>
     * 
     * @return the value of the recursive parameter
     */
    public String getParamRecursive() {

        return m_paramRecursive;
    }

    /**
     * Returns the value of the new releasedate parameter, 
     * or null if this parameter was not provided.<p>
     * 
     * The releasedate parameter stores the new releasedate as String.<p>
     * 
     * @return the value of the new releasedate parameter
     */
    public String getParamReleasedate() {

        return m_paramReleasedate;
    }

    /**
     * Returns the value of the resetexpire parameter.<p>
     * 
     * @return the value of the resetexpire parameter
     */
    public String getParamResetexpire() {

        return m_paramResetexpire;
    }

    /**
     * Returns the value of the resetrelease parameter.<p>
     * 
     * @return the value of the resetrelease parameter
     */
    public String getParamResetrelease() {

        return m_paramResetrelease;
    }

    /**
     * Sets the value of the enable notification parameter.<p>
     * 
     * @param value the value to set
     */
    public void setParamEnablenotification(String value) {

        m_paramEnablenotification = value;
    }

    /**
     * Sets the value of the expire date.<p>
     * 
     * @param value the value to set
     */
    public void setParamExpiredate(String value) {

        m_paramExpiredate = value;
    }

    /**

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -