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

📄 cmsnewexplorerfilelist.java

📁 内容管理
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                        folderToIgnore = folder.getAbsolutePath();
                    }else {
                        if(folder.getProjectId() != onlineProjectId) {
                            grey = false;
                            parentId = folder.getParentId();
                            try {
                                // the next res is the same res in the online-project: ignore it!
                                if(folder.getAbsolutePath().equals(((CmsFolder)tree.elementAt(i + 1)).getAbsolutePath())) {
                                    i++;
                                    idMixer.put(new Integer(((CmsFolder)tree.elementAt(i)).getResourceId()),
                                            new Integer(folder.getResourceId()));
                                }
                            }catch(IndexOutOfBoundsException exc) {
                            // ignore the exception, this was the last resource
                            }
                        }else {
                            grey = true;
                            parentId = folder.getParentId();
                            if(idMixer.containsKey(new Integer(parentId))) {
                                parentId = ((Integer)idMixer.get(new Integer(parentId))).intValue();
                            }
                        }
                        content.append("top.aC(");
                        // id
                        content.append(folder.getResourceId());
                        content.append(", ");
                        // name
                        content.append("\"");
                        content.append(folder.getName());
                        content.append("\", ");
                        // parentId
                        content.append(parentId);
                        content.append(", ");
                        content.append(grey);
                        content.append(");\n");
                    }
                }
            }
        }
        if(listonly || projectView) {
            // only show the filelist
            content.append(" top.dUL(document); \n");
        } else {
            // update all frames
            content.append(" top.dU(document,");
            content.append(numberOfPages);
            content.append(",");
            content.append(selectedPage);
            content.append("); \n");
        }
        content.append("}\n");
        content.append("</script>\n</head> \n<BODY onLoad=\"initialize()\"></BODY> \n</html>\n");
        return (content.toString()).getBytes();
    }

    /**
     * Gets the content of a given template file.
     *
     * @param cms CmsObject Object for accessing system resources
     * @param templateFile Filename of the template file
     * @param elementName <em>not used here</em>.
     * @param parameters <em>not used here</em>.
     * @param templateSelector <em>not used here</em>.
     * @return Unprocessed content of the given template file.
     * @throws CmsException
     */

    public byte[] getContent(CmsObject cms, String templateFile, String elementName,
            Hashtable parameters, String templateSelector) throws CmsException {

        // ignore the templateSelector since we only dump the template
        return getContent(cms, templateFile, elementName, parameters);
    }

    /**
     * Sets the default preferences for the current user if those values are not available.
     * @return Hashtable with default preferences.
     */

    private int getDefaultPreferences(CmsObject cms) {
        int filelist;
        String explorerSettings = (String)cms.getRequestContext().currentUser().getAdditionalInfo(C_ADDITIONAL_INFO_EXPLORERSETTINGS);
        if(explorerSettings != null) {
            filelist = new Integer(explorerSettings).intValue();
        }else {
            filelist = C_FILELIST_NAME + C_FILELIST_TITLE + C_FILELIST_TYPE + C_FILELIST_CHANGED;
        }
        return filelist;
    }

    /**
     * Gets the key that should be used to cache the results of
     * this template class.
     * <P>
     * Since this class is quite simple it's okay to return
     * just the name of the template file here.
     *
     * @param cms CmsObject Object for accessing system resources
     * @param templateFile Filename of the template file
     * @param parameters Hashtable with all template class parameters.
     * @param templateSelector template section that should be processed.
     * @return key that can be used for caching
     */

    public Object getKey(CmsObject cms, String templateFile, Hashtable parameter,
            String templateSelector) {
        CmsRequestContext reqContext = cms.getRequestContext();
        StringBuffer buf = new StringBuffer();
        buf.append(reqContext.currentProject().getId());
        buf.append(":");
        buf.append(templateFile);
        return new String(buf);
    }

    /**
     * Template cache is not used here since we don't include
     * any subtemplates. So we can always return <code>true</code> here.
     * @return <code>true</code>
     */
    public boolean isCacheable(CmsObject cms, String templateFile, String elementName,
            Hashtable parameters, String templateSelector) {
        return false;
    }
    public boolean isProxyPrivateCacheable(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector) {
        return false;
    }
    public boolean isProxyPublicCacheable(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector) {
        return false;
    }
    public boolean isExportable(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector) {
        return false;
    }
    public boolean isStreamable(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector) {
        return false;
    }
    public CmsCacheDirectives collectCacheDirectives(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector) {
        CmsCacheDirectives myCd = new CmsCacheDirectives(false);
        return myCd;
    }

    /**
     * Any results of this class are cacheable since we don't include
     * any subtemplates. So we can always return <code>true</code> here.
     * @return <code>true</code>
     */
    public boolean isTemplateCacheSet() {
        return true;
    }

    /**
     * Template cache is not used here since we don't include
     * any subtemplates <em>(not implemented)</em>.
     */

    public void setTemplateCache(I_CmsTemplateCache c) {
        // do nothing.
    }

    /**
     * Template cache is not used here since we don't include
     * any subtemplates. So we can always return <code>false</code> here.
     * @return <code>false</code>
     */

    public boolean shouldReload(CmsObject cms, String templateFile, String elementName,
            Hashtable parameters, String templateSelector) {
        return false;
    }

    public A_CmsElement createElement(CmsObject cms, String templateFile, Hashtable parameters) {
        return new CmsElementDump(getClass().getName(), templateFile, null, getCacheDirectives(cms, templateFile, null, parameters, null),
                                    cms.getRequestContext().getElementCache().getVariantCachesize());
    }

    /**
     * Get the resources in the folder stored in parameter param
     * or in the project shown in the projectview
     *
     * @param cms The CmsObject
     * @param param The name of the folder
     * @param parameters The parameters of the request
     * @return The vector with all ressources
     */
    private Vector getRessources(CmsObject cms, String param, Hashtable parameters) throws CmsException {
        String mode = (String)parameters.get("mode")!=null?(String)parameters.get("mode"):"";
        String submode = (String)parameters.get("submode")!=null?(String)parameters.get("submode"):"";
        if("projectview".equals(mode)) {
            I_CmsSession session = cms.getRequestContext().getSession(true);
            if("search".equals(submode)){
                Vector resources = new Vector();
                String currentFilter = (String)session.getValue("ocms_search.currentfilter");
                CmsSearchFormObject searchForm = null;
                if(currentFilter != null){
                    searchForm = (CmsSearchFormObject)((Hashtable)session.getValue("ocms_search.allfilter")).get(currentFilter);
                    if((currentFilter != null) && (searchForm != null)){
                        // flag for using lucene for search
                        I_CmsRegistry registry = cms.getRegistry();
                        boolean luceneEnabled = "on".equals(registry.getSystemValue("searchbylucene"));
                        if("property".equals(currentFilter)){
                            String definition = searchForm.getValue02();
                            String value = searchForm.getValue03();
                            int type = Integer.parseInt(searchForm.getValue01());
                            resources = cms.getVisibleResourcesWithProperty(definition, value, type);
                        } else if ("filename".equals(currentFilter)){
                            String filename = searchForm.getValue01();
                            // if lucene is enabled the use lucene for searching by filename
                            // else use the method that reads from the database
                            if(luceneEnabled){
                                // put here the lucene search for filenames
                            } else {
                                resources = cms.readResourcesLikeName(filename);
                            }
                        } else if ("content".equals(currentFilter)){
                            // this search is only available if lucene is enabled
                            searchForm.getValue01();
                        }
                    }
                }
                // remove the channel resources
                for(int i=0; i<resources.size(); i++){
                    CmsResource curRes = (CmsResource)resources.elementAt(i);
                    if(curRes.getResourceName().startsWith(cms.getRequestContext().getSiteName()+CmsObject.C_ROOTNAME_COS)){
                        resources.remove(i);
                    }
                }
                return resources;
            } else {
                String filter = new String();
                filter = (String) session.getValue("filter");
                String projectId = (String) session.getValue("projectid");
                int currentProjectId;
                if(projectId == null || "".equals(projectId)){
                    currentProjectId = cms.getRequestContext().currentProject().getId();
                } else {
                    currentProjectId = Integer.parseInt(projectId);
                }
                session.removeValue("filter");
                return cms.readProjectView(currentProjectId, filter);
            }
        } else if ("vfslink".equals(mode)) {
            String file = (String)parameters.get("file");
            List list = cms.fetchVfsLinksForResource(file);          
            return new Vector(list);
        } else {
            return cms.getResourcesInFolder(param);
        }
    }

}

⌨️ 快捷键说明

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