📄 explorer.js
字号:
/*
* File : $Source: /usr/local/cvs/opencms/modules/org.opencms.workplace.explorer/resources/system/workplace/resources/commons/explorer.js,v $
* Date : $Date: 2007-09-06 09:40:20 $
* Version: $Revision: 1.21 $
*
* This library is part of OpenCms -
* the Open Source Content Management System
*
* Copyright (c) 2002 - 2007 Alkacon Software GmbH (http://www.alkacon.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* For further information about Alkacon Software GmbH, please see the
* company website: http://www.alkacon.com
*
* For further information about OpenCms, please see the
* project website: http://www.opencms.org
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
var help_url="ExplorerAnsicht/index.html";
var flaturl="";
var mode="explorerview";
var showlinks=false;
var openfolderMethod="openFolder";
var showKon=true;
var autolock=false;
var plainresid=-1;
var win;
var buttonType=1;
var link_newresource="/system/workplace/commons/newresource.jsp";
var link_uploadresource="/system/workplace/commons/newresource_upload.jsp";
var link_showresource="/system/workplace/commons/displayresource.jsp";
var link_searchresource="/system/workplace/views/admin/admin-main.jsp?root=explorer&path=%2Fsearch";
var last_id=-1;
var active_mouse_id=-1;
var lockId=false;
var active_from_text=false;
var cancelNextOpen=false;
var selectedResources=new Array();
var selectedStyles=new Array();
var contextOpen=false;
var displayResource="/";
var g_histLoc=0;
var g_history=null;
var m_rootFolder="/";
function show_help(){
return help_url;
}
function windowStore(body, head, tree, files) {
this.body = body;
this.head = head;
this.tree = tree;
this.files = files.document;
this.fileswin = files;
}
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
function file(name, path, title, navtext, type, linkType, size, state, layoutstyle, dateLastModified, userWhoLastModified, dateCreated, userWhoCreated, dateReleased, dateExpired, permissions, lockedBy, lockedInProjectName, lockState, isInsideCurrentProject, sysLockInfo, projectState){
this.name = name;
this.path = path;
this.title = decodeURIComponent(title);
this.navtext = decodeURIComponent(navtext);
this.type = type;
this.linkType = linkType;
this.size = size;
this.state = state;
this.layoutstyle = layoutstyle;
this.dateLastModified = dateLastModified;
this.userWhoLastModified = userWhoLastModified
this.dateCreated = dateCreated;
this.userWhoCreated = userWhoCreated;
this.dateReleased = dateReleased;
this.dateExpired = dateExpired;
this.permissions = permissions;
this.lockedBy = lockedBy;
this.lockedInProjectName = lockedInProjectName;
this.lockState = lockState;
this.isInsideCurrentProject = (isInsideCurrentProject=='I');
this.sysLockInfo = sysLockInfo;
this.projectState = projectState;
this.isFolder = (size < 0);
}
function aF(name, path, title, navtext, type, linkType, size, state, layoutstyle, dateLastModified, userWhoLastModified, dateCreated, userWhoCreated, dateReleased, dateExpired, permissions, lockedBy, lockedInProjectName, lockState, isInsideCurrentProject, sysLockInfo, projectState) {
if(path == "") {
path=vr.actDirectory;
}
vi.liste[vi.liste.length] = new file(name, path, title, navtext, type, linkType, size, state, layoutstyle, dateLastModified, userWhoLastModified, dateCreated, userWhoCreated, dateReleased, dateExpired, permissions, lockedBy, lockedInProjectName, lockState, isInsideCurrentProject, sysLockInfo, projectState);
}
function vars_index() {
this.icons = new Array();
this.liste = new Array();
this.lockIcons = new Array();
this.lockStatus = new Array();
this.iconPath;
this.skinPath;
this.newButtonActive;
this.check_name;
this.check_title;
this.check_navtext;
this.check_type;
this.check_size;
this.check_permissions;
this.check_dateLastModified;
this.check_userWhoLastModified;
this.check_dateCreated;
this.check_userWhoCreated;
this.check_dateReleased;
this.check_dateExpired;
this.check_state;
this.check_lockedBy;
this.userName;
this.resource = new Array();
}
function res(text, nicename, icon, createLink) {
this.text = text;
this.nicename = nicename;
this.icon = icon;
this.createLink = createLink;
}
function setDisplayResource(resource) {
displayResource = resource;
if (win.head) {
win.head.forms.urlform.resource.value = displayResource.substring(getRootFolder().length - 1);
}
}
function getDisplayResource(param) {
if (param == "true") {
return displayResource.substring(getRootFolder().length - 1);
}
return displayResource;
}
function getRootFolder() {
if (m_rootFolder == null) {
return "/";
} else {
return m_rootFolder;
}
}
function setRootFolder(value) {
m_rootFolder = value;
}
function initHist() {
g_histLoc = 0;
g_history = new Array();
}
function addHist(entry) {
if (g_history[g_histLoc] != entry && entry.indexOf("siblings:") == -1) {
g_histLoc++;
g_history[g_histLoc] = entry;
}
}
function histGoBack() {
if (g_histLoc > 1) {
g_histLoc--;
setDisplayResource(g_history[g_histLoc]);
} else {
setDisplayResource(removeSiblingPrefix(getDisplayResource()));
}
openurl();
}
function dU(doc, pages, actpage) {
vi.locklength = 0;
vi.doc = doc;
updateWindowStore();
openfolderMethod="openFolder";
showCols(vr.viewcfg);
printList(doc);
if (win.head) {
displayHead(win.head, pages, actpage);
}
}
function updateWindowStore() {
var theTree = null;
if (window.body.explorer_body && window.body.explorer_body.explorer_tree) {
theTree = window.body.explorer_body.explorer_tree;
}
if ((mode == "listview") || (mode == "galleryview")) {
var theDoc = null;
if (window.body.admin_content) {
if (window.body.admin_content.tool_content) {
theDoc = window.body.admin_content.tool_content;
} else {
theDoc = window.body.admin_content;
}
} else {
if (window.body.explorer_body.explorer_files.tool_content) {
theDoc = window.body.explorer_body.explorer_files.tool_content;
} else {
theDoc = window.body.explorer_body.explorer_files;
}
}
if (window.body.admin_head) {
win = new windowStore(window.body.document, window.body.admin_head.document, theTree, theDoc);
} else if (window.body.explorer_head) {
win = new windowStore(window.body.document, window.body.explorer_head.document, theTree, theDoc);
} else {
win = new windowStore(window.body.document, null, theTree, theDoc);
}
} else {
try {
win = new windowStore(window.body.document, window.body.explorer_head.document, theTree, window.body.explorer_body.explorer_files);
} catch (e) {}
}
}
function rD() {
vi.liste = new Array();
vi.icons = new Array();
}
function showCols(cols) {
var check = new Array();
check[9] = 'vi.check_name';
check[0] = 'vi.check_title';
check[6] = 'vi.check_navtext';
check[1] = 'vi.check_type';
check[3] = 'vi.check_size';
check[7] = 'vi.check_permissions';
check[2] = 'vi.check_dateLastModified';
check[10] = 'vi.check_dateCreated';
check[11] = 'vi.check_userWhoLastModified';
check[5] = 'vi.check_userWhoCreated';
check[12] = 'vi.check_dateReleased';
check[13] = 'vi.check_dateExpired';
check[4] = 'vi.check_state';
check[8] = 'vi.check_lockedBy';
for (i = 0; i <= 13; i++) {
if ((cols & Math.pow(2, i)) > 0) {
eval(check[i] + "=true;");
} else {
eval(check[i] + "=false;");
}
}
}
// set the last selected menu id (from icon)
function setId(id) {
if (!lockId) {
active_mouse_id = id;
active_from_text = false;
}
}
// set the last selected menu id (from link text)
function setId2(id) {
if (!lockId) {
active_mouse_id = id;
active_from_text = true;
}
}
// handle the context menu to show
function handleContext(e) {
if (selectedResources.length > 1) {
// multi context menu
lockId = true;
getContextMenu();
} else {
// single context menu
if (active_mouse_id >= 0) {
lockId = true;
getContextMenu();
}
}
// stop event bubbling
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
return false;
}
// makes an ajax request to get the context menu for the selected resource(s)
function getContextMenu() {
// the list of resources
var resourceList = "";
if (selectedResources.length == 1) {
resourceList = getResourceAbsolutePath(active_mouse_id);
// set resource in hidden form field value
win.files.forms["formmulti"].elements["resource"].value = resourceList;
} else if (selectedResources.length > 1) {
// concatenate all selected resources
var isFirst = true;
for (var i=0; i<selectedResources.length; i++) {
if (!isFirst) {
resourceList += "|";
}
resourceList += getResourceAbsolutePath(selectedResources[i]);
isFirst = false;
}
// set resource list in hidden form field value
win.files.forms["formmulti"].elements["resourcelist"].value = resourceList;
}
// ajax call
makeRequest(vr.servpath + '/system/workplace/views/explorer/contextmenu.jsp', 'resourcelist=' + resourceList + "&acttarget=" + top.active_target, 'showContextMenu');
}
// builds the HTML for a context menu (single or multi context menu)
function showContextMenu(msg, state) {
if (state == 'ok') {
var menu = msg;
if (menu.length > 0) {
var cmouter = win.files.getElementById("contextmenuouter");
var cminner = win.files.getElementById("contextmenu");
cminner.innerHTML = menu;
// set menu x position
var x = 12;
cmouter.style.left = x + "px";
cmouter.style.display = "block";
// calculate menu y position before setting visibility to avoid display errors
var y = getMenuPosY(win.files, active_mouse_id);
cmouter.style.top = y + "px";
cmouter.style.visibility = "visible";
} // end if (access)
last_id = active_mouse_id;
contextOpen = true;
lockId = false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -