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

📄 cmsnewexplorerfilelist.java

📁 内容管理
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        // the flaturl
        if(flaturl != null) {
            content.append("top.flaturl='");
            content.append(flaturl);
            content.append("';\n");
        } else if (!listonly){
            content.append("top.flaturl='';\n");
        }

        // the help_url
        content.append("top.head.helpUrl='explorer/index.html';\n");
        // the project
        content.append("top.setProject(");
        content.append(cms.getRequestContext().currentProject().getId());
        content.append(");\n");
        // the onlineProject
        content.append("top.setOnlineProject(");
        content.append(cms.onlineProject().getId());
        content.append(");\n");
        // set the checksum for the tree
        content.append("top.setChecksum(");
        content.append(check);
        content.append(");\n");
        // set the writeAccess for the current Folder
        boolean writeAccess = true;
        if (! vfslinkView) {        
        CmsFolder test = cms.readFolder(currentFolder);
            writeAccess = test.getProjectId() == cms.getRequestContext().currentProject().getId();
        }
        content.append("top.enableNewButton(");
        content.append(writeAccess);
        content.append(");\n");
        // the folder
        content.append("top.setDirectory(");
        content.append(currentFolderId);
        content.append(",\"");
        content.append(currentFolder);
        content.append("\");\n");
        content.append("top.rD();\n\n");

        // now look which filelist colums we want to show
        int filelist = getDefaultPreferences(cms);
        boolean showTitle = (filelist & C_FILELIST_TITLE) > 0;
        boolean showDateChanged = (filelist & C_FILELIST_CHANGED) > 0;
        boolean showOwner = (filelist & C_FILELIST_OWNER) > 0;
        boolean showGroup = (filelist & C_FILELIST_GROUP) > 0;
        boolean showSize = (filelist & C_FILELIST_SIZE) > 0;

        // now get the entries for the filelist
        Vector resources = getRessources(cms, currentFolder, parameters);

        // if a folder contains to much entrys we split them to pages of C_ENTRYS_PER_PAGE
        // but only in the explorer view
        int startat = 0;
        int stopat = resources.size();
        int selectedPage = 1;
        int numberOfPages = 0;
        int maxEntrys = C_ENTRYS_PER_PAGE; // later this comes from the usersettings
        if(!(listonly || projectView || vfslinkView)){
            String selPage = (String)parameters.get("selPage");
            if(selPage == null || "".equals(selPage)){
                selPage = (String)session.getValue(C_SESSION_CURRENT_PAGE);
            }
            if(selPage != null && !"".equals(selPage)){
                try{
                    selectedPage = Integer.parseInt(selPage);
                    session.putValue(C_SESSION_CURRENT_PAGE, selPage);
                }catch(Exception e){
                }
            }
            if(stopat > maxEntrys){
                // we have to splitt
                numberOfPages = (stopat / maxEntrys) +1;
                if(selectedPage > numberOfPages){
                    // the user has changed the folder and then selected a page for the old folder
                    selectedPage =1;
                }
                startat = (selectedPage -1) * maxEntrys;
                if((startat + maxEntrys) < stopat){
                    stopat = startat + maxEntrys;
                }
            }
        }

        for(int i = startat;i < stopat;i++) {
            CmsResource res = (CmsResource)resources.elementAt(i);
            content.append("top.aF(");
            // the name
            content.append("\"");
            content.append(res.getName());
            content.append("\",");
            // the path
            if(projectView || vfslinkView){
                content.append("\"");
                content.append(res.getPath());
                content.append("\",");
            }else{
                //is taken from top.setDirectory
                content.append("\"\",");
            }
            // the title
            if(showTitle){
                String title = "";
                try {
                    title = cms.readProperty(res.getAbsolutePath(), C_PROPERTY_TITLE);
                }catch(CmsException e) {
                }
                if(title == null) {
                    title = "";
                }
                content.append("\"");
                if (title != null) content.append(Encoder.escapeHtml(title));
                content.append("\",");
                
            }else{
                content.append("\"\",");
            }
            // the type
            content.append(res.getType());
            content.append(",");
            // date of last change
            if(showDateChanged){
                content.append("\"");
                content.append(Utils.getNiceDate(res.getDateLastModified()));
                content.append("\",");
                
            }else{
                content.append("\"\",");
            }
            // unused field, was intended for the user who changed the resource last
            content.append("\"\",");
            // date
            // unused field, was intended for: content.append("\"" + Utils.getNiceDate(res.getDateCreated()) + "\",");
            content.append("\"\",");
            // size
            if(res.isFolder() || (!showSize)) {
                content.append("\"\",");
            }else {
                content.append( res.getLength());
                content.append(",");                
            }
            // state
            content.append(res.getState());
            content.append(",");            
            // project
            content.append(res.getProjectId());
            content.append(",");            
            // owner
            if(showOwner){
                content.append("\"");                
                content.append(cms.readUser(res.getOwnerId()).getName());
                content.append("\",");                
            }else{
                content.append("\"\",");
            }
            // group
            if(showGroup){
                content.append("\"");                
                content.append(cms.readGroup(res).getName());
                content.append("\",");                
            }else{
                content.append("\"\",");
            }
            // accessFlags
            content.append(res.getAccessFlags());
            content.append(",");            
            // locked by
            if(res.isLockedBy() == C_UNKNOWN_ID) {
                content.append("\"\",");
            }else {
                content.append("\"");                
                content.append(cms.lockedBy(res).getName());
                content.append("\",");                
            }
            // locked in project
            int lockedInProject = res.getLockedInProject();
            String lockedInProjectName = "";
            try {
                lockedInProjectName = cms.readProject(lockedInProject).getName();
            } catch(CmsException exc) {
                // ignore the exception - this is an old project so ignore it
            }
            content.append("\"");            
            content.append(lockedInProjectName);
            content.append("\",");
            content.append(lockedInProject);
            content.append(");\n");
        }

        //  now the tree, only if changed
        if(newTreePlease && (!(listonly || vfslinkView))) {
            content.append("\n top.rT();\n");
            Vector tree = cms.getFolderTree();
            int startAt = 1;
            int parentId;
            boolean grey = false;
            int onlineProjectId = cms.onlineProject().getId();
            if(cms.getRequestContext().currentProject().isOnlineProject()) {

                // all easy: we are in the onlineProject
                CmsFolder rootFolder = (CmsFolder)tree.elementAt(0);
                content.append("top.aC(");
                content.append(rootFolder.getResourceId());
                content.append(", ");
                content.append("\"");
                content.append(messages.key("title.rootfolder"));
                content.append("\", ");
                content.append(rootFolder.getParentId());
                content.append(", false);\n");
                for(int i = startAt;i < tree.size();i++) {
                    CmsFolder folder = (CmsFolder)tree.elementAt(i);
                    content.append("top.aC(");
                    // id
                    content.append(folder.getResourceId());
                    content.append(", ");
                    // name
                    content.append("\"");
                    content.append(folder.getName());
                    content.append("\", ");
                    // parentId
                    content.append(folder.getParentId());
                    content.append(", false);\n");
                }
            }else {
                // offline Project
                Hashtable idMixer = new Hashtable();
                CmsFolder rootFolder = (CmsFolder)tree.elementAt(0);
                String folderToIgnore = null;
                if(rootFolder.getProjectId() != onlineProjectId) {
                    startAt = 2;
                    grey = false;
                    idMixer.put(new Integer(((CmsFolder)tree.elementAt(1)).getResourceId()),
                            new Integer(rootFolder.getResourceId()));
                }else {
                    grey = true;
                }
                content.append("top.aC(");
                content.append(rootFolder.getResourceId());
                content.append(", ");
                content.append("\"");
                content.append(messages.key("title.rootfolder"));
                content.append("\", ");
                content.append(rootFolder.getParentId());
                content.append(", ");
                content.append(grey);
                content.append(");\n");
                for(int i = startAt;i < tree.size();i++) {
                    CmsFolder folder = (CmsFolder)tree.elementAt(i);
                    if((folder.getState() == C_STATE_DELETED) || (folder.getAbsolutePath().equals(folderToIgnore))) {

                        // if the folder is deleted - ignore it and the following online res

⌨️ 快捷键说明

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