Edit: Revamp using Ace editor (ace.c9.io).

This commit is contained in:
reliberate
2016-02-24 12:28:35 -07:00
parent 9b2d02a569
commit 5456e2d837
41 changed files with 611 additions and 936 deletions
+136 -175
View File
@@ -39,195 +39,156 @@ else {
$language = new text;
$text = $language->get();
echo "<html>";
echo "<head>";
//include
require_once "header.php";
echo "<style>\n";
echo "TD {\n";
echo " font-size: 11.5px;\n";
echo "<script type=\"text/javascript\" language=\"javascript\">\n";
echo " function makeRequest(url, strpost) {\n";
echo " var http_request = false;\n";
echo "\n";
echo " if (window.XMLHttpRequest) { // Mozilla, Safari, ...\n";
echo " http_request = new XMLHttpRequest();\n";
echo " if (http_request.overrideMimeType) {\n";
echo " http_request.overrideMimeType('text/xml');\n";
echo " // See note below about this line\n";
echo " }\n";
echo " } else if (window.ActiveXObject) { // IE\n";
echo " try {\n";
echo " http_request = new ActiveXObject(\"Msxml2.XMLHTTP\");\n";
echo " } catch (e) {\n";
echo " try {\n";
echo " http_request = new ActiveXObject(\"Microsoft.XMLHTTP\");\n";
echo " } catch (e) {}\n";
echo " }\n";
echo " }\n";
echo "\n";
echo " if (!http_request) {\n";
echo " alert('".$text['message-give-up']."');\n";
echo " return false;\n";
echo " }\n";
echo " http_request.onreadystatechange = function() { returnContent(http_request); };\n";
echo " http_request.overrideMimeType('text/html');\n";
echo " http_request.open('POST', url, true);\n";
echo "\n";
echo " if (strpost.length == 0) {\n";
echo " //http_request.send(null);\n";
echo " http_request.send('name=value&foo=bar');\n";
echo " }\n";
echo " else {\n";
echo " http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');\n";
echo " http_request.send(strpost);\n";
echo " }\n";
echo " }\n";
echo "\n";
echo " function returnContent(http_request) {\n";
echo "\n";
echo " if (http_request.readyState == 4) {\n";
echo " if (http_request.status == 200) {\n";
echo " parent.editAreaLoader.setValue('edit1', http_request.responseText); \n";
echo " }\n";
echo " else {\n";
echo " alert('".$text['message-problem']."');\n";
echo " }\n";
echo " }\n";
echo " }\n";
echo "</script>";
echo "<SCRIPT LANGUAGE=\"JavaScript\">\n";
//echo "// ---------------------------------------------\n";
//echo "// --- http://www.codeproject.com/jscript/dhtml_treeview.asp\n";
//echo "// --- Name: Easy DHTML Treeview --\n";
//echo "// --- Author: D.D. de Kerf --\n";
//echo "// --- Version: 0.2 Date: 13-6-2001 --\n";
//echo "// ---------------------------------------------\n";
echo "function Toggle(node) {\n";
echo " // Unfold the branch if it isn't visible\n";
echo " if (node.nextSibling.style.display == 'none') {\n";
echo " node.nextSibling.style.display = 'block';\n";
echo " }\n";
echo " // Collapse the branch if it IS visible\n";
echo " else {\n";
echo " node.nextSibling.style.display = 'none';\n";
echo " }\n";
echo "\n";
echo "}\n";
echo "A {\n";
echo " text-decoration:none\n";
echo "}\n";
echo "</style>";
echo "</SCRIPT>";
function isfile($filename) {
if (@filesize($filename) > 0) { return true; } else { return false; }
}
echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n";
function space($count) {
$r=''; $i=0;
while($i < $count) {
$r .= ' ';
$i++;
}
return $r;
}
echo "<tr class='border'>\n";
echo " <td align=\"left\" valign='top' nowrap>\n";
echo " <table border=0 cellpadding='0' cellspacing='0'><tr><td style='cursor: default;'><img src='resources/images/icon_folder.png' border='0' align='absmiddle' style='margin: 0px 2px 4px 0px;'> ".$text['label-clip-library']."</a><div>\n";
//show the content
echo "<script type=\"text/javascript\" language=\"javascript\">\n";
echo " function makeRequest(url, strpost) {\n";
echo " var http_request = false;\n";
echo "\n";
echo " if (window.XMLHttpRequest) { // Mozilla, Safari, ...\n";
echo " http_request = new XMLHttpRequest();\n";
echo " if (http_request.overrideMimeType) {\n";
echo " http_request.overrideMimeType('text/xml');\n";
echo " // See note below about this line\n";
echo " }\n";
echo " } else if (window.ActiveXObject) { // IE\n";
echo " try {\n";
echo " http_request = new ActiveXObject(\"Msxml2.XMLHTTP\");\n";
echo " } catch (e) {\n";
echo " try {\n";
echo " http_request = new ActiveXObject(\"Microsoft.XMLHTTP\");\n";
echo " } catch (e) {}\n";
echo " }\n";
echo " }\n";
echo "\n";
echo " if (!http_request) {\n";
echo " alert('".$text['message-give-up']."');\n";
echo " return false;\n";
echo " }\n";
echo " http_request.onreadystatechange = function() { returnContent(http_request); };\n";
echo " http_request.overrideMimeType('text/html');\n";
echo " http_request.open('POST', url, true);\n";
echo "\n";
echo " if (strpost.length == 0) {\n";
echo " //http_request.send(null);\n";
echo " http_request.send('name=value&foo=bar');\n";
echo " }\n";
echo " else {\n";
echo " http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');\n";
echo " http_request.send(strpost);\n";
echo " }\n";
echo " }\n";
echo "\n";
echo " function returnContent(http_request) {\n";
echo "\n";
echo " if (http_request.readyState == 4) {\n";
echo " if (http_request.status == 200) {\n";
echo " parent.editAreaLoader.setValue('edit1', http_request.responseText); \n";
echo " }\n";
echo " else {\n";
echo " alert('".$text['message-problem']."');\n";
echo " }\n";
echo " }\n";
echo " }\n";
echo "</script>";
echo "<SCRIPT LANGUAGE=\"JavaScript\">\n";
//echo "// ---------------------------------------------\n";
//echo "// --- http://www.codeproject.com/jscript/dhtml_treeview.asp\n";
//echo "// --- Name: Easy DHTML Treeview --\n";
//echo "// --- Author: D.D. de Kerf --\n";
//echo "// --- Version: 0.2 Date: 13-6-2001 --\n";
//echo "// ---------------------------------------------\n";
echo "function Toggle(node) {\n";
echo " // Unfold the branch if it isn't visible\n";
echo " if (node.nextSibling.style.display == 'none') {\n";
echo " // Change the image (if there is an image)\n";
echo " if (node.childNodes.length > 0) {\n";
echo " if (node.childNodes.item(0).nodeName == \"IMG\") {\n";
echo " node.childNodes.item(0).src = \"images/minus.gif\";\n";
echo " }\n";
echo " }\n";
echo " \n";
echo " node.nextSibling.style.display = 'block';\n";
echo " }\n";
echo " // Collapse the branch if it IS visible\n";
echo " else {\n";
echo " // Change the image (if there is an image)\n";
echo " if (node.childNodes.length > 0) {\n";
echo " if (node.childNodes.item(0).nodeName == \"IMG\") {\n";
echo " node.childNodes.item(0).src = \"images/plus.gif\";\n";
echo " }\n";
echo " }\n";
echo " node.nextSibling.style.display = 'none';\n";
echo " }\n";
echo "\n";
echo "}\n";
echo "</SCRIPT>";
echo "<head>";
echo "<body>";
echo "<div align='center' valign='1'>";
echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\" valign='top' nowrap>\n";
echo " <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD><a onclick=\"window.open('clipoptions.php','Clip Options','left=20,top=20,width=500,height=500,toolbar=0,resizable=0');\" style='text-decoration:none;' title=''><IMG SRC=\"images/folder.gif\" border='0'> ".$text['label-clip-library']."</a><DIV style=''>\n"; //display:none
$sql = "select * from v_clips ";
$sql .= "order by clip_folder ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
if ($result_count > 0) { //no results
$last_folder = '';
$tag_open = '';
$x = 0;
$current_depth = 0;
$previous_depth = 0;
foreach($result as $row) {
$current_depth = count(explode("/", $row[clip_folder]));
if ($current_depth < $previous_depth) {
$count = ($previous_depth - $current_depth);
$i=0;
while($i < $count){
echo "</DIV></TD></TR></TABLE>\n";
$i++;
}
echo "</DIV></TD></TR></TABLE>\n";
$sql = "select * from v_clips ";
$sql .= "order by clip_folder ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
if ($result_count > 0) { //no results
$last_folder = '';
$tag_open = '';
$x = 0;
$current_depth = 0;
$previous_depth = 0;
foreach($result as $row) {
$current_depth = count(explode("/", $row[clip_folder]));
if ($current_depth < $previous_depth) {
$count = ($previous_depth - $current_depth);
$i=0;
while($i < $count){
echo "</div></td></tr></table>\n";
$i++;
}
echo "</div></td></tr></table>\n";
if ($last_folder != $row['clip_folder']) {
$clip_folder_name = str_replace ($previous_folder_name, "", $row['clip_folder']);
$clip_folder_name = str_replace ("/", "", $clip_folder_name);
echo "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD WIDTH=10></TD><TD><A onClick=\"Toggle(this);\"><IMG SRC=\"images/plus.gif\"> <IMG SRC=\"images/folder.gif\"> &nbsp;".$clip_folder_name." &nbsp; </A><DIV style='display:none'>\n\n";
$tag_open = 1;
}
$previous_depth = $current_depth;
$previous_folder_name = $row['clip_folder'];
}
echo "<textarea style='display:none' id='clip_lib_start".$row['clip_uuid']."'>".$row['clip_text_start']."</textarea>\n";
echo "<textarea style='display:none' id='clip_lib_end".$row['clip_uuid']."'>".$row['clip_text_end']."</textarea>\n";
echo "\n";
echo "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD WIDTH=12></TD><TD align='bottom'><IMG SRC=\"images/file.png\" border='0'> \n";
echo "<a href='javascript:void(0);' onclick=\"parent.document.getElementById('clip_uuid').value='".$row['clip_uuid']."';parent.document.getElementById('clip_name').value='".$row['clip_name']."';\">".$row['clip_name']."</a>\n";
if ($last_folder != $row['clip_folder']) {
$clip_folder_name = str_replace ($previous_folder_name, "", $row['clip_folder']);
$clip_folder_name = str_replace ("/", "", $clip_folder_name);
echo "<table border=0 cellpadding='0' cellspacing='0'>";
echo " <tr>";
echo " <td nowrap style='padding-left: 16px;'>";
echo " <a onclick='Toggle(this);'><img src='resources/images/icon_folder.png' align='absmiddle' style='margin: 1px 2px 3px 0px;'>".$clip_folder_name."</a><div style='display:none'>";
$tag_open = 1;
}
echo "</TD></TR></TABLE>\n";
echo "\n\n";
$previous_depth = $current_depth;
$previous_folder_name = $row['clip_folder'];
$last_folder = $row['clip_folder'];
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<textarea style='display:none' id='clip_lib_start".$row['clip_uuid']."'>".$row['clip_text_start']."</textarea>\n";
echo "<textarea style='display:none' id='clip_lib_end".$row['clip_uuid']."'>".$row['clip_text_end']."</textarea>\n";
echo "\n";
echo "<table border=0 cellpadding='0' cellspacing='0'>";
echo " <tr>";
echo " <td nowrap align='bottom' style='padding-left: 16px;'>";
echo " <a href='javascript:void(0);' onclick=\"parent.document.getElementById('clip_uuid').value='".$row['clip_uuid']."'; parent.document.getElementById('clip_name').value='".$row['clip_name']."';\"><img src='resources/images/icon_file.png' border='0' align='absmiddle' style='margin: 1px 2px 3px -1px;'>".$row['clip_name']."</a>";
echo " </td>";
echo " </tr>";
echo "</table>\n";
echo "\n";
echo " </div></td></tr></table>\n";
$last_folder = $row['clip_folder'];
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>";
echo " </div>";
echo " </td>";
echo " </tr>";
echo "</table>\n";
echo "<br><br>";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
echo "</body>";
echo "</html>";
require_once "footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
?>