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

📄 cmsavailability.java

📁 OpenCms 是一个J2EE的产品
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                    false).getValue();
            } catch (CmsException e) {
                if (LOG.isInfoEnabled()) {
                    LOG.info(e.getLocalizedMessage());
                }
            }
        }
        if (CmsStringUtil.isEmpty(propVal)) {
            propVal = "";
        }
        StringBuffer result = new StringBuffer();

        result.append("<input class=\"maxwidth\" type=\"text\" name=\"");
        result.append(CmsAvailability.PARAM_NOTIFICATION_INTERVAL);
        result.append("\" value=\"");
        result.append(propVal);
        result.append("\">");
        return result.toString();
    }

    /**
     * Builds a String with HTML code to display the responsibles of a resource.<p>
     * 
     * @return HTML code for the responsibles of the current resource
     */
    public String buildResponsibleList() {

        if (isMultiOperation()) {
            // show no responsibles list for multi operation
            return "";
        } else {
            // single resource operation, create list of responsibles
            StringBuffer result = new StringBuffer(512);
            result.append("<tr><td colspan=\"3\">");
            List parentResources = new ArrayList();
            Map responsibles = new HashMap();
            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());
                            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());
                i = responsibles.keySet().iterator();
                for (int j = 0; i.hasNext(); j++) {
                    I_CmsPrincipal principal = (I_CmsPrincipal)i.next();
                    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)responsibles.get(principal));
                    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();
        }
    }

    /**
     * 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 getCalendarLocalizedTime(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 getCalendarLocalizedTime(res.getDateExpired());
                }
            } catch (CmsException e) {
                return getCalendarLocalizedTime(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 getCalendarLocalizedTime(res.getDateReleased());
                }
            } catch (CmsException e) {
                return getCalendarLocalizedTime(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;
    }

    /**
     * Sets the value of the leaveexpire parameter.<p>

⌨️ 快捷键说明

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