additional functions for fancytree and context menu
Dieser Commit ist enthalten in:
Ursprung
4752241bd2
Commit
6b373d96c7
|
@ -58,8 +58,16 @@ class cGuiFileList {
|
||||||
$sList .= '</ul></li></ul>' . "\n";
|
$sList .= '</ul></li></ul>' . "\n";
|
||||||
$this->_oTpl->set('s', 'item_list', $sList);
|
$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', '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', '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);
|
$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';
|
$sActionCreate = 'js_create';
|
||||||
$sActionEdit = 'js_edit';
|
$sActionEdit = 'js_edit';
|
||||||
|
|
||||||
|
$bNewFile = false;
|
||||||
|
|
||||||
$page = new cPage;
|
$page = new cPage;
|
||||||
|
|
||||||
$tpl->reset();
|
$tpl->reset();
|
||||||
|
@ -62,23 +64,19 @@ if (!$perm->have_perm_area_action($area, $action)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_REQUEST['dirname']) && trim($_REQUEST['dirname']) != '.') {
|
if (!empty($_REQUEST['dirname']) && trim($_REQUEST['dirname']) != '.') {
|
||||||
|
if (empty($sFilename)) {
|
||||||
|
$sFilename = "newfile.js";
|
||||||
|
$bNewFile = true;
|
||||||
|
}
|
||||||
$sFilename = stripslashes($_REQUEST['dirname']) . DIRECTORY_SEPARATOR . $sFilename;
|
$sFilename = stripslashes($_REQUEST['dirname']) . DIRECTORY_SEPARATOR . $sFilename;
|
||||||
}
|
}
|
||||||
echo $sFilename;
|
$sReloadScript = "<script type=\"text/javascript\">"
|
||||||
if (stripslashes($_REQUEST['file'])) {
|
. "var left_bottom = parent.parent.frames['left'].frames['left_bottom'];
|
||||||
$sReloadScript = "<script type=\"text/javascript\">
|
|
||||||
var left_bottom = parent.parent.frames['left'].frames['left_bottom'];
|
|
||||||
if (left_bottom) {
|
if (left_bottom) {
|
||||||
var href = left_bottom.location.href;
|
var href = '" . $sess->url("main.php?area=$area&frame=2") . "';
|
||||||
href = href.replace(/&file[^&]*/, '');
|
left_bottom.location.href = href;
|
||||||
left_bottom.location.href = href+'&file='+'" . $sFilename . "';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>";
|
</script>";
|
||||||
} else {
|
|
||||||
$sReloadScript = "";
|
|
||||||
}
|
|
||||||
$sReloadScript = "";
|
|
||||||
// Content Type is template
|
// Content Type is template
|
||||||
$sTypeContent = "js";
|
$sTypeContent = "js";
|
||||||
$aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db);
|
$aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db);
|
||||||
|
@ -86,8 +84,8 @@ $sReloadScript = "";
|
||||||
# create new file
|
# create new file
|
||||||
if ($_REQUEST['action'] == $sActionCreate AND $_REQUEST['status'] == 'send') {
|
if ($_REQUEST['action'] == $sActionCreate AND $_REQUEST['status'] == 'send') {
|
||||||
$sTempFilename = $sFilename;
|
$sTempFilename = $sFilename;
|
||||||
createFile($sFilename, $path);
|
createFile(pathinfo($sFilename, PATHINFO_BASENAME), $path.pathinfo($sFilename, PATHINFO_DIRNAME).DIRECTORY_SEPARATOR);
|
||||||
$bEdit = fileEdit($sFilename, $_REQUEST['code'], $path);
|
$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);
|
updateFileInformation($client, $sFilename, 'js', $auth->auth['uid'], $_REQUEST['description'], $db);
|
||||||
$sReloadScript .= "<script type=\"text/javascript\">
|
$sReloadScript .= "<script type=\"text/javascript\">
|
||||||
var right_top = top.content.right.right_top;
|
var right_top = top.content.right.right_top;
|
||||||
|
@ -101,7 +99,7 @@ $sReloadScript = "";
|
||||||
# edit selected file
|
# edit selected file
|
||||||
if ($_REQUEST['action'] == $sActionEdit AND $_REQUEST['status'] == 'send') {
|
if ($_REQUEST['action'] == $sActionEdit AND $_REQUEST['status'] == 'send') {
|
||||||
if ($sFilename != $sTempFilename) {
|
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\">
|
$sReloadScript .= "<script type=\"text/javascript\">
|
||||||
var right_top = top.content.right.right_top;
|
var right_top = top.content.right.right_top;
|
||||||
if (right_top) {
|
if (right_top) {
|
||||||
|
@ -155,8 +153,7 @@ $sReloadScript = "";
|
||||||
$form->setVar("frame", $frame);
|
$form->setVar("frame", $frame);
|
||||||
$form->setVar("status", 'send');
|
$form->setVar("status", 'send');
|
||||||
$form->setVar("tmp_file", $sTempFilename);
|
$form->setVar("tmp_file", $sTempFilename);
|
||||||
print_r(pathinfo($sFilename));
|
$tb_name = new cHTMLTextbox("file", ($bNewFile)?'':pathinfo($sFilename, PATHINFO_BASENAME), 60);
|
||||||
$tb_name = new cHTMLTextbox("file", pathinfo($sFilename, PATHINFO_BASENAME), 60);
|
|
||||||
$tb_path = new cHTMLHiddenField("dirname", pathinfo($sFilename, PATHINFO_DIRNAME));
|
$tb_path = new cHTMLHiddenField("dirname", pathinfo($sFilename, PATHINFO_DIRNAME));
|
||||||
$ta_code = new cHTMLTextarea("code", clHtmlSpecialChars($sCode), 100, 35, "code");
|
$ta_code = new cHTMLTextarea("code", clHtmlSpecialChars($sCode), 100, 35, "code");
|
||||||
$descr = new cHTMLTextarea("description", clHtmlSpecialChars($aFileInfo["description"]), 100, 5);
|
$descr = new cHTMLTextarea("description", clHtmlSpecialChars($aFileInfo["description"]), 100, 5);
|
||||||
|
@ -165,7 +162,7 @@ $sReloadScript = "";
|
||||||
$descr->setStyle("font-family: monospace;width: 100%;");
|
$descr->setStyle("font-family: monospace;width: 100%;");
|
||||||
$ta_code->updateAttributes(array("wrap" => getEffectiveSetting('script_editor', 'wrap', 'off')));
|
$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("Description"), $descr->render());
|
||||||
$form->add(i18n("Code"), $ta_code);
|
$form->add(i18n("Code"), $ta_code);
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,27 @@ if (!defined('CON_FRAMEWORK')) {
|
||||||
|
|
||||||
if (!(int) $client > 0) {
|
if (!(int) $client > 0) {
|
||||||
#if there is no client selected, display empty page
|
#if there is no client selected, display empty page
|
||||||
$oPage = new cPage;
|
$oPage = new cPage();
|
||||||
$oPage->render();
|
$oPage->render();
|
||||||
return;
|
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 = new cGuiFileList($cfgClient[$client]["js"]["path"], 'js');
|
||||||
$oDirList->scanDir();
|
$oDirList->scanDir();
|
||||||
|
|
|
@ -32,6 +32,9 @@ if(!defined('CON_FRAMEWORK')) {
|
||||||
die('Illegal call');
|
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', 'ID', 'oTplSel');
|
||||||
$tpl->set('s', 'CLASS', 'text_medium');
|
$tpl->set('s', 'CLASS', 'text_medium');
|
||||||
$tpl->set('s', 'OPTIONS', '');
|
$tpl->set('s', 'OPTIONS', '');
|
||||||
|
@ -46,7 +49,7 @@ $area = "style";
|
||||||
$mstr = sprintf($tmp_mstr, 'right_top',
|
$mstr = sprintf($tmp_mstr, 'right_top',
|
||||||
$sess->url("main.php?area=js&frame=3"),
|
$sess->url("main.php?area=js&frame=3"),
|
||||||
'right_bottom',
|
'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"));
|
i18n("Create script"));
|
||||||
if ((int) $client > 0) {
|
if ((int) $client > 0) {
|
||||||
$tpl->set('s', 'NEWSCRIPT', $mstr);
|
$tpl->set('s', 'NEWSCRIPT', $mstr);
|
||||||
|
|
|
@ -41,15 +41,7 @@
|
||||||
store: "auto",
|
store: "auto",
|
||||||
fireActivate: true
|
fireActivate: true
|
||||||
},
|
},
|
||||||
click: function (event, data) {
|
activate: function (event, data, flag) {
|
||||||
//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}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
var tmpnode = data.node;
|
var tmpnode = data.node;
|
||||||
var parentnodes = [];
|
var parentnodes = [];
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
|
@ -72,6 +64,22 @@
|
||||||
basePath += '/';
|
basePath += '/';
|
||||||
}
|
}
|
||||||
console.log(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) {
|
active: function (event, data) {
|
||||||
console.log('active');
|
console.log('active');
|
||||||
|
@ -91,8 +99,17 @@
|
||||||
var node = $.ui.fancytree.getNode(this);
|
var node = $.ui.fancytree.getNode(this);
|
||||||
if (node.hasClass('file')) {
|
if (node.hasClass('file')) {
|
||||||
var file = node.data.filepath;
|
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: {}
|
items: {}
|
||||||
|
@ -118,34 +135,6 @@
|
||||||
};
|
};
|
||||||
return options;
|
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>
|
</script>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<script type="text/javascript" src="scripts/general.js"></script>
|
<script type="text/javascript" src="scripts/general.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var dirname = '';
|
||||||
function resizeFrame()
|
function resizeFrame()
|
||||||
{
|
{
|
||||||
parent.parent.frameResize.resizeTopLeftFrame(document.getElementById('top_left_container').offsetHeight + 1);
|
parent.parent.frameResize.resizeTopLeftFrame(document.getElementById('top_left_container').offsetHeight + 1);
|
||||||
|
|
Laden…
In neuem Issue referenzieren