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

📄 explorer.js

📁 cms是开源的框架
💻 JS
📖 第 1 页 / 共 4 页
字号:

	+ "<style type='text/css'>\n"
	+ "input.location { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: normal; width: 99% }\n"
	+ "select.location { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: normal; width: 50px }\n"
	+ "</style>\n"

	+ "<script type=\"text/javascript\">\n"
	+ "<!--\n"
	+ "function doSet() {\n"
	+ "\tdocument.urlform.resource.value=\"" + getDisplayResource("true") + "\";\n"
	+ "}\n"
	+ "//-->\n"
	+ "</script>\n"

	+ "</head>\n"
	+ "<body class=\"buttons-head\" onload=\"window.setTimeout('doSet()',50);\">\n"
	+ "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n"
	+ "<form name=\"urlform\" onsubmit=\"top.submitResource();return false;\">\n"
	+ "<tr>\n"

	+ buttonSep(0, 0, 0)
	+ button("javascript:top.histGoBack();", null, "back.png", vr.langback, buttonType)
	+ btUpload
	+ btWizard
	+ btUp

	+ buttonSep(5, 5, 1)
	+ "<td>"+vr.langadress+"&nbsp;</td>\n"
	+ "<td width=\"100%\"><input value=\"\" maxlength=\"255\" name=\"resource\" class=\"location\"></td>\n"
	+ pageSelect

	+ "</tr>\n</form>\n</table>\n"
	+ "</body>\n</html>";

	doc.open();
	doc.write(html);
	doc.close();
}


// formats a button in one of 3 styles (type 0..2)
function button(href, target, image, label, type) {

	if (image != null && image.indexOf('.') == -1) {
        // append default suffix for images
        image += ".png";
    }

	var result = "<td>";
	switch (type) {
		case 1:
		// image and text
		if (href != null) {
			result += "<a href=\"";
			result += href;
			result += "\" class=\"button\"";
			if (target != null) {
				result += " target=\"";
				result += target;
				result += "\"";
			}
			result += ">";
		}
		result += "<span unselectable=\"on\"";
		if (href != null) {
			result += " class=\"norm\" onmouseover=\"className='over'\" onmouseout=\"className='norm'\" onmousedown=\"className='push'\" onmouseup=\"className='over'\"";
		} else {
			result += " class=\"disabled\"";
		}
		result += "><span unselectable=\"on\" class=\"combobutton\" ";
		result += "style=\"background-image: url('";
		result += vi.skinPath;
		result += "buttons/";
		result += image;
		result += "');\">";
		result += label;
		result += "</span></span>";
		if (href != null) {
			result += "</a>";
		}
		break;

		case 2:
		// text only
		if (href != null) {
			result += "<a href=\"";
			result += href;
			result += "\" class=\"button\"";
			if (target != null) {
				result += " target=\"";
				result += target;
				result += "\"";
			}
			result += ">";
		}
		result += "<span unselectable=\"on\"";
		if (href != null) {
			result += " class=\"norm\" onmouseover=\"className='over'\" onmouseout=\"className='norm'\" onmousedown=\"className='push'\" onmouseup=\"className='over'\"";
		} else {
			result += " class=\"disabled\"";
		}
		result += "><span unselectable=\"on\" class=\"txtbutton\">";
		result += label;
		result += "</span></span>";
		if (href != null) {
			result += "</a>";
		}
		break;

		default:
		// only image
		if (href != null) {
			result += "<a href=\"";
			result += href;
			result += "\" class=\"button\"";
			if (target != null) {
				result += " target=\"";
				result += target;
				result += "\"";
			}
			result += " title=\"";
			result += label;
			result += "\">";
		}
		result += "<span unselectable=\"on\"";
		if (href != null) {
			result += " class=\"norm\" onmouseover=\"className='over'\" onmouseout=\"className='norm'\" onmousedown=\"className='push'\" onmouseup=\"className='over'\"";
		} else {
			result += " class=\"disabled\"";
		}
		result += "><img class=\"button\" src=\"";
		result += vi.skinPath;
		result += "buttons/";
		result += image;
		result += "\">";
		result += "</span>";
		break;
	}
	result += "</td>\n";
	return result;
}


// formats a button separator line
function buttonSep(left, right, type) {
	var style = "starttab";
	if (type == 1) {
		style = "separator";
	}
	var result = "<td><span class=\"norm\"><span unselectable=\"on\" class=\"txtbutton\" style=\"padding-right: 0px; padding-left: " + left + "px;\"></span></span></td>\n"
	+ "<td><span class=\"" + style + "\"></span></td>\n"
	+ "<td><span class=\"norm\"><span unselectable=\"on\" class=\"txtbutton\" style=\"padding-right: 0px; padding-left: " + right + "px;\"></span></span></td>\n";
	return result;
}


function setOnlineProject(id){
	vr.onlineProject=id;
}


function setProject(id){
	vr.actProject=id;
}


function setDirectory(id, dir){
	displayResource = dir;
	if (mode == "explorerview") {
		addHist(dir);
	}
	vr.actDirId=id;
	dir = removeSiblingPrefix(dir);
	vr.actDirectory = dir;
	last_id = -1;
	selectedResources = new Array();
}


function enableNewButton(showit){
	vi.newButtonActive=showit;
}


function openFolder(folderName) {
	if (cancelNextOpen) {
		return;
	}
	if (folderName.charAt(0) != '/') {
		folderName = getDisplayResource() + folderName + "/";
	}
	setDisplayResource(folderName);
	openurl();
}


function openthisfolderflat(thisdir){
	if (cancelNextOpen) {
		return;
	}	
	eval(flaturl + "?resource=" + vr.actDirectory+thisdir+"/\"");
}


function updateTreeFolder(folderName) {
	if (window.body.explorer_body && window.body.explorer_body.explorer_tree) {
		window.body.explorer_body.explorer_tree.updateCurrentFolder(window.body.explorer_body.explorer_tree.tree_display.document, folderName, false);
	}
}


function addNodeToLoad(nodeName) {
	if (window.body.explorer_body && window.body.explorer_body.explorer_tree) {
		window.body.explorer_body.explorer_tree.addNodeToLoad(null, nodeName);
	}
}


function reloadNodeList() {
	if (window.body.explorer_body && window.body.explorer_body.explorer_tree) {
		window.body.explorer_body.explorer_tree.loadNodeList(window.body.explorer_body.explorer_tree.tree_display.document, "&rootloaded=true");
	}
}


// returns the X position of an object in the body
function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	} else if (obj.x) {
		curleft += obj.x;
	}
	return curleft;
}


// returns the Y position of an object in the body
function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} else if (obj.y) {
		curtop += obj.y;
	}
	return curtop;
}


function getMenuPosY(doc, id) {

	var y = findPosY(doc.getElementById("ic" + id)) + 16;
	var scrollTop = 0;
	var clientHeight = 0;

	if (doc.documentElement && (doc.documentElement.scrollTop || doc.documentElement.clientHeight)) {
		scrollTop = doc.documentElement.scrollTop;
		clientHeight = doc.documentElement.clientHeight;
	} else if (doc.body) {
		scrollTop = doc.body.scrollTop;
		clientHeight = doc.body.clientHeight;
	}

	var el = doc.getElementById("contextmenu");
	var elementHeight = el.scrollHeight;
	var oy = y;
	var scrollSize = 20;

	if ((y + elementHeight + scrollSize) > (clientHeight + scrollTop)) {
		y = y - 16 - elementHeight;
	}
	if (y < scrollTop) {
		y = (clientHeight + scrollTop) - (elementHeight + scrollSize);
	}
	if (y < scrollTop) {
		y = scrollTop;
	}
	return y;
}


function menu(nr) {
	this.nr = nr;
	this.items = new Array();
}


function addMenuEntry(nr,text,link,target,rules){
	if(!vi.menus[nr])vi.menus[nr] = new menu(vi.menus.length);
	vi.menus[nr].items[vi.menus[nr].items.length] = new menuItem(text,link,target,rules);
}


var treewin = null;
var treeForm = null;
var treeField = null;
var treeDoc = null;

function openTreeWin(treeType, includeFiles, formName, fieldName, curDoc) {
	var paramString = "";
	if (treeType) {
		paramString += "?type=" + treeType;
	}
	if (includeFiles) {
		paramString += ((paramString == "")?"?":"&");
		paramString += "includefiles=true";
	}
	var target = vr.servpath + "/system/workplace/views/explorer/tree_fs.jsp" + paramString;
	treewin = openWin(target, "opencms", 300, 450);
	if (treewin.opener == null){
		treewin.opener = self;
	}
	treeForm = formName;
	treeField = fieldName;
	treeDoc = curDoc;
}


function openWin(url, name, w, h) {
	var newwin = window.open(url, name, 'toolbar=no,location=no,directories=no,status=yes,menubar=0,scrollbars=yes,resizable=yes,top=150,left=660,width='+w+',height='+h);
	if(newwin != null) {
		if (newwin.opener == null) {
			newwin.opener = self;
		}
	}
	newwin.focus();
	return newwin;
}


function closeTreeWin() {
	if (treewin != null) {
		window.treewin.close();
		treewin = null;
		treeForm = null;
		treeField = null;
		treeDoc = null;
	}
}


function setFormValue(filename) {
	// target form where the link is to be pasted to
	var curForm;
	// the document of the target form
	var curDoc;
	// update the window store
	updateWindowStore();

	if (treeDoc != null) {
		curDoc = treeDoc;
	} else {
		curDoc = win.files;
	}

	if (treeForm != null) {
		curForm = curDoc.forms[treeForm];
	} else {
		curForm = curDoc.forms[0];
	}

	if (curForm.elements[treeField]) {
		curForm.elements[treeField].value = filename;
	} else if (curForm.folder) {
		curForm.folder.value = filename;
	} else if (curForm.target) {
		curForm.target.value = filename;
	}

	// this calls the fillValues() function in the explorer window, if present
	if (window.body.explorer_body && window.body.explorer_body.explorer_files) {
		var filesDoc = window.body.explorer_body.explorer_files;
		if (filesDoc.fillValues) {
			filesDoc.fillValues(filename);
		}
	}

	// this fills the parameter from the hidden field to the select box
	if (window.body.admin_content) {
		if (treeField == "tempChannel") {
			window.body.admin_content.copyChannelSelection();
		} else {
			try {
				window.body.admin_content.copySelection();
			} catch (e) {

			}
		}
	}
}

⌨️ 快捷键说明

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