additional functions for fancytree and context menu
Dieser Commit ist enthalten in:
Ursprung
4752241bd2
Commit
6b373d96c7
|
@ -52,14 +52,22 @@ class cGuiFileList {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$sList .= '<li class="dir_empty" data-icon="unknown.gif">'. i18n("No files in directory.").'</li>' . "\n";
|
||||
$sList .= '<li class="dir_empty" data-icon="unknown.gif">' . i18n("No files in directory.") . '</li>' . "\n";
|
||||
}
|
||||
|
||||
$sList .= '</ul></li></ul>' . "\n";
|
||||
$this->_oTpl->set('s', 'item_list', $sList);
|
||||
|
||||
$this->_oTpl->set('s', 'multilinkf1', $sess->url("main.php?area=$area&frame=1"));
|
||||
$this->_oTpl->set('s', 'multilinkf2', $sess->url("main.php?area=$area&frame=2"));
|
||||
$this->_oTpl->set('s', 'multilinkf3', $sess->url("main.php?area=$area&frame=3"));
|
||||
$this->_oTpl->set('s', 'multilinkf4', $sess->url("main.php?area=$area&frame=4"));
|
||||
|
||||
$this->_oTpl->set('s', 'multilink1', $sess->url("main.php?area=$area&frame=3&file=\${file}"));
|
||||
$this->_oTpl->set('s', 'multilink2', $sess->url("main.php?area=$area&frame=4&action=js_edit&file=\${file}&tmp_file=\${file}"));
|
||||
$this->_oTpl->set('s', 'multilink3', $sess->url("main.php?area=$area&frame=1&file=\${file}"));
|
||||
|
||||
$this->_oTpl->set('s', 'multilink4', $sess->url("main.php?area=$area&frame=2&action=file_delete&delfile=\${file}"));
|
||||
|
||||
$this->_oTpl->generate(cRegistry::getConfigValue('path', 'contenido') . cRegistry::getConfigValue('path', 'templates') . "html5/file_list.html", $bReturn);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,8 @@ $sFileType = "js";
|
|||
$sActionCreate = 'js_create';
|
||||
$sActionEdit = 'js_edit';
|
||||
|
||||
$bNewFile = false;
|
||||
|
||||
$page = new cPage;
|
||||
|
||||
$tpl->reset();
|
||||
|
@ -60,25 +62,21 @@ if (!$perm->have_perm_area_action($area, $action)) {
|
|||
} else {
|
||||
$sFilename .= stripslashes($_REQUEST['file']);
|
||||
}
|
||||
|
||||
if(!empty($_REQUEST['dirname']) && trim($_REQUEST['dirname']) != '.') {
|
||||
$sFilename = stripslashes($_REQUEST['dirname']).DIRECTORY_SEPARATOR.$sFilename;
|
||||
}
|
||||
echo $sFilename;
|
||||
if (stripslashes($_REQUEST['file'])) {
|
||||
$sReloadScript = "<script type=\"text/javascript\">
|
||||
var left_bottom = parent.parent.frames['left'].frames['left_bottom'];
|
||||
if (left_bottom) {
|
||||
var href = left_bottom.location.href;
|
||||
href = href.replace(/&file[^&]*/, '');
|
||||
left_bottom.location.href = href+'&file='+'" . $sFilename . "';
|
||||
|
||||
}
|
||||
</script>";
|
||||
} else {
|
||||
$sReloadScript = "";
|
||||
if (!empty($_REQUEST['dirname']) && trim($_REQUEST['dirname']) != '.') {
|
||||
if (empty($sFilename)) {
|
||||
$sFilename = "newfile.js";
|
||||
$bNewFile = true;
|
||||
}
|
||||
$sFilename = stripslashes($_REQUEST['dirname']) . DIRECTORY_SEPARATOR . $sFilename;
|
||||
}
|
||||
$sReloadScript = "";
|
||||
$sReloadScript = "<script type=\"text/javascript\">"
|
||||
. "var left_bottom = parent.parent.frames['left'].frames['left_bottom'];
|
||||
if (left_bottom) {
|
||||
var href = '" . $sess->url("main.php?area=$area&frame=2") . "';
|
||||
left_bottom.location.href = href;
|
||||
}
|
||||
</script>";
|
||||
// Content Type is template
|
||||
$sTypeContent = "js";
|
||||
$aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db);
|
||||
|
@ -86,8 +84,8 @@ $sReloadScript = "";
|
|||
# create new file
|
||||
if ($_REQUEST['action'] == $sActionCreate AND $_REQUEST['status'] == 'send') {
|
||||
$sTempFilename = $sFilename;
|
||||
createFile($sFilename, $path);
|
||||
$bEdit = fileEdit($sFilename, $_REQUEST['code'], $path);
|
||||
createFile(pathinfo($sFilename, PATHINFO_BASENAME), $path.pathinfo($sFilename, PATHINFO_DIRNAME).DIRECTORY_SEPARATOR);
|
||||
$bEdit = fileEdit(pathinfo($sFilename, PATHINFO_BASENAME), $_REQUEST['code'], $path.pathinfo($sFilename, PATHINFO_DIRNAME).DIRECTORY_SEPARATOR);
|
||||
updateFileInformation($client, $sFilename, 'js', $auth->auth['uid'], $_REQUEST['description'], $db);
|
||||
$sReloadScript .= "<script type=\"text/javascript\">
|
||||
var right_top = top.content.right.right_top;
|
||||
|
@ -101,7 +99,7 @@ $sReloadScript = "";
|
|||
# edit selected file
|
||||
if ($_REQUEST['action'] == $sActionEdit AND $_REQUEST['status'] == 'send') {
|
||||
if ($sFilename != $sTempFilename) {
|
||||
$sTempFilename = renameFile($sTempFilename, $sFilename, $path);
|
||||
$sTempFilename = renameFile(pathinfo($sTempFilename, PATHINFO_BASENAME), pathinfo($sFilename, PATHINFO_BASENAME), $path.pathinfo($sFilename, PATHINFO_DIRNAME).DIRECTORY_SEPARATOR);
|
||||
$sReloadScript .= "<script type=\"text/javascript\">
|
||||
var right_top = top.content.right.right_top;
|
||||
if (right_top) {
|
||||
|
@ -155,8 +153,7 @@ $sReloadScript = "";
|
|||
$form->setVar("frame", $frame);
|
||||
$form->setVar("status", 'send');
|
||||
$form->setVar("tmp_file", $sTempFilename);
|
||||
print_r(pathinfo($sFilename));
|
||||
$tb_name = new cHTMLTextbox("file", pathinfo($sFilename, PATHINFO_BASENAME), 60);
|
||||
$tb_name = new cHTMLTextbox("file", ($bNewFile)?'':pathinfo($sFilename, PATHINFO_BASENAME), 60);
|
||||
$tb_path = new cHTMLHiddenField("dirname", pathinfo($sFilename, PATHINFO_DIRNAME));
|
||||
$ta_code = new cHTMLTextarea("code", clHtmlSpecialChars($sCode), 100, 35, "code");
|
||||
$descr = new cHTMLTextarea("description", clHtmlSpecialChars($aFileInfo["description"]), 100, 5);
|
||||
|
@ -165,7 +162,7 @@ $sReloadScript = "";
|
|||
$descr->setStyle("font-family: monospace;width: 100%;");
|
||||
$ta_code->updateAttributes(array("wrap" => getEffectiveSetting('script_editor', 'wrap', 'off')));
|
||||
|
||||
$form->add(i18n("Name"), $tb_name.$tb_path);
|
||||
$form->add(i18n("Name"), $tb_name . "  ".i18n("Directory").": ". pathinfo($sFilename, PATHINFO_DIRNAME).DIRECTORY_SEPARATOR . $tb_path);
|
||||
$form->add(i18n("Description"), $descr->render());
|
||||
$form->add(i18n("Code"), $ta_code);
|
||||
|
||||
|
|
|
@ -8,14 +8,30 @@ if (!defined('CON_FRAMEWORK')) {
|
|||
}
|
||||
|
||||
if (!(int) $client > 0) {
|
||||
#if there is no client selected, display empty page
|
||||
$oPage = new cPage;
|
||||
$oPage->render();
|
||||
return;
|
||||
#if there is no client selected, display empty page
|
||||
$oPage = new cPage();
|
||||
$oPage->render();
|
||||
return;
|
||||
}
|
||||
|
||||
cInclude("includes", "functions.file.php");
|
||||
|
||||
if ($action == "file_delete") {
|
||||
if ($perm->have_perm_area_action($area, $action)) {
|
||||
$path = $cfgClient[$client]["js"]["path"];
|
||||
$sDelFile = filter_input(INPUT_GET, 'delfile', FILTER_SANITIZE_URL);
|
||||
|
||||
if (file_exists($path . $sDelFile)) {
|
||||
unlink($path . $sDelFile);
|
||||
removeFileInformation($client, $sDelFile, 'js', $db);
|
||||
}
|
||||
} else {
|
||||
$notification->displayNotification("error", i18n("Permission denied"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$oDirList = new cGuiFileList($cfgClient[$client]["js"]["path"], 'js');
|
||||
$oDirList->scanDir();
|
||||
|
||||
$oDirList->renderList();
|
||||
$oDirList->renderList();
|
||||
|
|
|
@ -32,6 +32,9 @@ if(!defined('CON_FRAMEWORK')) {
|
|||
die('Illegal call');
|
||||
}
|
||||
|
||||
$sFilename = filter_input(INPUT_GET, 'file', FILTER_SANITIZE_URL);
|
||||
//echo $sFilename."\n";
|
||||
$sDirname = pathinfo($sFilename, PATHINFO_DIRNAME);
|
||||
$tpl->set('s', 'ID', 'oTplSel');
|
||||
$tpl->set('s', 'CLASS', 'text_medium');
|
||||
$tpl->set('s', 'OPTIONS', '');
|
||||
|
@ -46,7 +49,7 @@ $area = "style";
|
|||
$mstr = sprintf($tmp_mstr, 'right_top',
|
||||
$sess->url("main.php?area=js&frame=3"),
|
||||
'right_bottom',
|
||||
$sess->url("main.php?area=js&frame=4&action=js_create"),
|
||||
$sess->url("main.php?area=js&frame=4&action=js_create&dirname=".$sDirname),
|
||||
i18n("Create script"));
|
||||
if ((int) $client > 0) {
|
||||
$tpl->set('s', 'NEWSCRIPT', $mstr);
|
||||
|
|
|
@ -41,15 +41,7 @@
|
|||
store: "auto",
|
||||
fireActivate: true
|
||||
},
|
||||
click: function (event, data) {
|
||||
//console.log(data.node);
|
||||
|
||||
if (data.node.hasClass('file')) {
|
||||
var file = data.node.data.filepath;
|
||||
// console.log(`Open ${file}`);
|
||||
conMultiLink('right_top', `{multilink1}`, 'right_bottom', `{multilink2}`);
|
||||
}
|
||||
|
||||
activate: function (event, data, flag) {
|
||||
var tmpnode = data.node;
|
||||
var parentnodes = [];
|
||||
var counter = 0;
|
||||
|
@ -72,6 +64,22 @@
|
|||
basePath += '/';
|
||||
}
|
||||
console.log(basePath);
|
||||
if (data.node.hasClass('directory') || basePath == '') {
|
||||
var file = basePath + 'nofile';
|
||||
console.log(`Open ${file}`);
|
||||
conMultiLink('left_top', `{multilink3}`);
|
||||
}
|
||||
},
|
||||
click: function (event, data) {
|
||||
//console.log(data.node);
|
||||
var parentNode = data.node.getParent(),
|
||||
topNode = data.node.getParentList()[0];
|
||||
|
||||
if (data.node.hasClass('file')) {
|
||||
var file = data.node.data.filepath;
|
||||
// console.log(`Open ${file}`);
|
||||
conMultiLink('right_top', `{multilink1}`, 'right_bottom', `{multilink2}`, 'left_top', `{multilink3}`);
|
||||
}
|
||||
},
|
||||
active: function (event, data) {
|
||||
console.log('active');
|
||||
|
@ -91,8 +99,17 @@
|
|||
var node = $.ui.fancytree.getNode(this);
|
||||
if (node.hasClass('file')) {
|
||||
var file = node.data.filepath;
|
||||
conMultiLink('right_top', `{multilink1}`, 'right_bottom', `{multilink2}`);
|
||||
conMultiLink('right_top', `{multilink1}`, 'right_bottom', `{multilink2}`, 'left_top', `{multilink3}`);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
var node = $.ui.fancytree.getNode(this);
|
||||
var file = node.data.filepath;
|
||||
if (node.hasClass('file') && confirm("Do you really want to delete " + file + "?")) {
|
||||
console.log('delete', node);
|
||||
conMultiLink('left_bottom', `{multilink4}`, 'right_bottom', `{multilinkf4}`, 'right_top', `{multilinkf3}`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
items: {}
|
||||
|
@ -118,34 +135,6 @@
|
|||
};
|
||||
return options;
|
||||
}
|
||||
|
||||
/*
|
||||
items: {
|
||||
"edit": {
|
||||
name: "Edit <span>readonly</span>",
|
||||
icon: "edit",
|
||||
disabled: function (event, ui) {
|
||||
var node = $.ui.fancytree.getNode(this);
|
||||
console.log(node);
|
||||
console.log(ui);
|
||||
// return `true` to disable, `"hide"` to remove entry:
|
||||
return (node.hasClass('file')) ? false : true;
|
||||
},
|
||||
callback: function (itemKey, opt, e) {
|
||||
var node = $.ui.fancytree.getNode(this);
|
||||
var file = node.data.filepath;
|
||||
console.log(`Open ${file}`);
|
||||
conMultiLink('right_top', `{multilink1}`, 'right_bottom', `{multilink2}`);
|
||||
}
|
||||
},
|
||||
"delete": {name: "Delete", icon: "delete", disabled: function (event, ui) {
|
||||
var node = $.ui.fancytree.getNode(this);
|
||||
console.log(node);
|
||||
console.log(ui);
|
||||
// return `true` to disable, `"hide"` to remove entry:
|
||||
return (node.hasClass('notwritable')) ? true : (node.hasClass('file')) ? false : true;
|
||||
}}
|
||||
}*/
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,27 +1,28 @@
|
|||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="expires" content="0">
|
||||
<meta http-equiv="cache-control" content="no-cache">
|
||||
<meta http-equiv="pragma" content="no-cache">
|
||||
<link rel="stylesheet" type="text/css" href="styles/contenido.css">
|
||||
<script type="text/javascript" src="scripts/HTMLObj.js.php?contenido={SESSID}"></script>
|
||||
<script type="text/javascript" src="scripts/contenidoConfig.js"></script>
|
||||
<script type="text/javascript" src="scripts/infoBox.js"></script>
|
||||
<script type="text/javascript" src="scripts/general.js"></script>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="expires" content="0">
|
||||
<meta http-equiv="cache-control" content="no-cache">
|
||||
<meta http-equiv="pragma" content="no-cache">
|
||||
<link rel="stylesheet" type="text/css" href="styles/contenido.css">
|
||||
<script type="text/javascript" src="scripts/HTMLObj.js.php?contenido={SESSID}"></script>
|
||||
<script type="text/javascript" src="scripts/contenidoConfig.js"></script>
|
||||
<script type="text/javascript" src="scripts/infoBox.js"></script>
|
||||
<script type="text/javascript" src="scripts/general.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function resizeFrame()
|
||||
{
|
||||
parent.parent.frameResize.resizeTopLeftFrame(document.getElementById('top_left_container').offsetHeight+1);
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body bgcolor="#FFFFFF" onLoad="resizeFrame()">
|
||||
<div id="top_left_container" style="height: 2em; padding: 5px 0 0 15px; border: 1px solid #B3B3B3; margin-top: 1px">
|
||||
{CAPTION}
|
||||
{NEWSCRIPT}
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
var dirname = '';
|
||||
function resizeFrame()
|
||||
{
|
||||
parent.parent.frameResize.resizeTopLeftFrame(document.getElementById('top_left_container').offsetHeight + 1);
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body bgcolor="#FFFFFF" onLoad="resizeFrame()">
|
||||
<div id="top_left_container" style="height: 2em; padding: 5px 0 0 15px; border: 1px solid #B3B3B3; margin-top: 1px">
|
||||
{CAPTION}
|
||||
{NEWSCRIPT}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Laden…
In neuem Issue referenzieren