From bacc8f55518bafad1417a28cfcc23af59d2d6580 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sat, 25 May 2013 16:19:40 +0000 Subject: [PATCH] Add capability to the editor to work with grammar, script, php, xml, and provsion directories. --- app/edit/app_config.php | 157 +++++++++++++++++++++++++++++++---- app/edit/filelist.php | 16 +++- app/edit/filenew.php | 7 +- app/edit/fileoptionslist.php | 16 +++- app/edit/header.php | 3 +- app/edit/index.php | 3 + app/edit/list.php | 4 +- 7 files changed, 183 insertions(+), 23 deletions(-) diff --git a/app/edit/app_config.php b/app/edit/app_config.php index 7958be7a94..19a6887749 100644 --- a/app/edit/app_config.php +++ b/app/edit/app_config.php @@ -19,21 +19,86 @@ $apps[$x]['description']['pt-br'] = ''; //menu details - $apps[$x]['menu'][0]['title']['en-us'] = 'Script Editor'; - $apps[$x]['menu'][0]['title']['es-mx'] = ''; - $apps[$x]['menu'][0]['title']['de'] = ''; - $apps[$x]['menu'][0]['title']['de-ch'] = ''; - $apps[$x]['menu'][0]['title']['de-at'] = ''; - $apps[$x]['menu'][0]['title']['fr'] = ''; - $apps[$x]['menu'][0]['title']['fr-ca'] = ''; - $apps[$x]['menu'][0]['title']['fr-ch'] = ''; - $apps[$x]['menu'][0]['title']['pt-pt'] = 'Editor de Scripts'; - $apps[$x]['menu'][0]['title']['pt-br'] = ''; - $apps[$x]['menu'][0]['uuid'] = 'f1905fec-0577-daef-6045-59d09b7d3f94'; - $apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f'; - $apps[$x]['menu'][0]['category'] = 'external'; - $apps[$x]['menu'][0]['path'] = '/app/script_edit/index.php'; - $apps[$x]['menu'][0]['groups'][] = 'superadmin'; + $y = 0; + $apps[$x]['menu'][$y]['title']['en-us'] = 'Script Editor'; + $apps[$x]['menu'][$y]['title']['es-mx'] = ''; + $apps[$x]['menu'][$y]['title']['de'] = ''; + $apps[$x]['menu'][$y]['title']['de-ch'] = ''; + $apps[$x]['menu'][$y]['title']['de-at'] = ''; + $apps[$x]['menu'][$y]['title']['fr'] = ''; + $apps[$x]['menu'][$y]['title']['fr-ca'] = ''; + $apps[$x]['menu'][$y]['title']['fr-ch'] = ''; + $apps[$x]['menu'][$y]['title']['pt-pt'] = 'Editor de Scripts'; + $apps[$x]['menu'][$y]['title']['pt-br'] = ''; + $apps[$x]['menu'][$y]['uuid'] = 'f1905fec-0577-daef-6045-59d09b7d3f94'; + $apps[$x]['menu'][$y]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f'; + $apps[$x]['menu'][$y]['category'] = 'external'; + $apps[$x]['menu'][$y]['path'] = '/app/edit/index.php?dir=scripts'; + $apps[$x]['menu'][$y]['groups'][] = 'superadmin'; + $y++; + $apps[$x]['menu'][$y]['title']['en-us'] = 'XML Editor'; + $apps[$x]['menu'][$y]['title']['es-mx'] = ''; + $apps[$x]['menu'][$y]['title']['de'] = ''; + $apps[$x]['menu'][$y]['title']['de-ch'] = ''; + $apps[$x]['menu'][$y]['title']['de-at'] = ''; + $apps[$x]['menu'][$y]['title']['fr'] = ''; + $apps[$x]['menu'][$y]['title']['fr-ca'] = ''; + $apps[$x]['menu'][$y]['title']['fr-ch'] = ''; + $apps[$x]['menu'][$y]['title']['pt-pt'] = 'Editor XML'; + $apps[$x]['menu'][$y]['title']['pt-br'] = ''; + $apps[$x]['menu'][$y]['uuid'] = '16013877-606a-2a05-7d6a-c1b215839131'; + $apps[$x]['menu'][$y]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f'; + $apps[$x]['menu'][$y]['category'] = 'external'; + $apps[$x]['menu'][$y]['path'] = '/app/edit/index.php?dir=xml'; + $apps[$x]['menu'][$y]['groups'][] = 'superadmin'; + $y++; + $apps[$x]['menu'][$y]['title']['en-us'] = 'Provision Editor'; + $apps[$x]['menu'][$y]['title']['es-mx'] = ''; + $apps[$x]['menu'][$y]['title']['de'] = ''; + $apps[$x]['menu'][$y]['title']['de-ch'] = ''; + $apps[$x]['menu'][$y]['title']['de-at'] = ''; + $apps[$x]['menu'][$y]['title']['fr'] = ''; + $apps[$x]['menu'][$y]['title']['fr-ca'] = ''; + $apps[$x]['menu'][$y]['title']['fr-ch'] = ''; + $apps[$x]['menu'][$y]['title']['pt-pt'] = 'Editor de Provisionamento'; + $apps[$x]['menu'][$y]['title']['pt-br'] = ''; + $apps[$x]['menu'][$y]['uuid'] = '57773542-a565-1a29-605d-6535da1a0870'; + $apps[$x]['menu'][$y]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f'; + $apps[$x]['menu'][$y]['category'] = 'external'; + $apps[$x]['menu'][$y]['path'] = '/app/edit/index.php?dir=provision'; + $apps[$x]['menu'][$y]['groups'][] = 'superadmin'; + $y++; + $apps[$x]['menu'][$y]['title']['en-us'] = 'PHP Editor'; + $apps[$x]['menu'][$y]['title']['es-mx'] = ''; + $apps[$x]['menu'][$y]['title']['de'] = ''; + $apps[$x]['menu'][$y]['title']['de-ch'] = ''; + $apps[$x]['menu'][$y]['title']['de-at'] = ''; + $apps[$x]['menu'][$y]['title']['fr'] = ''; + $apps[$x]['menu'][$y]['title']['fr-ca'] = ''; + $apps[$x]['menu'][$y]['title']['fr-ch'] = ''; + $apps[$x]['menu'][$y]['title']['pt-pt'] = 'Editor de PHP'; + $apps[$x]['menu'][$y]['title']['pt-br'] = ''; + $apps[$x]['menu'][$y]['uuid'] = 'eae1f2d6-789b-807c-cc26-44501e848693'; + $apps[$x]['menu'][$y]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f'; + $apps[$x]['menu'][$y]['category'] = 'external'; + $apps[$x]['menu'][$y]['path'] = '/app/edit/index.php?dir=php'; + $apps[$x]['menu'][$y]['groups'][] = 'superadmin'; + $y++; + $apps[$x]['menu'][$y]['title']['en-us'] = 'Grammar Editor'; + $apps[$x]['menu'][$y]['title']['es-mx'] = 'Editor Gramático'; + $apps[$x]['menu'][$y]['title']['de'] = ''; + $apps[$x]['menu'][$y]['title']['de-ch'] = ''; + $apps[$x]['menu'][$y]['title']['de-at'] = ''; + $apps[$x]['menu'][$y]['title']['fr'] = "L'éditeur grammairien"; + $apps[$x]['menu'][$y]['title']['fr-ca'] = ''; + $apps[$x]['menu'][$y]['title']['fr-ch'] = ''; + $apps[$x]['menu'][$y]['title']['pt-pt'] = 'Editor Gramático'; + $apps[$x]['menu'][$y]['title']['pt-br'] = ''; + $apps[$x]['menu'][$y]['uuid'] = 'c3db739e-89f9-0fa2-44ce-0f4c2ff43b1a'; + $apps[$x]['menu'][$y]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f'; + $apps[$x]['menu'][$y]['category'] = 'external'; + $apps[$x]['menu'][$y]['path'] = '/app/edit/index.php?dir=grammar'; + $apps[$x]['menu'][$y]['groups'][] = 'superadmin'; //permission details $apps[$x]['permissions'][0]['name'] = 'script_editor_view'; @@ -41,4 +106,66 @@ $apps[$x]['permissions'][1]['name'] = 'script_editor_save'; $apps[$x]['permissions'][1]['groups'][] = 'superadmin'; + + $apps[$x]['permissions'][0]['name'] = 'provision_editor_view'; + $apps[$x]['permissions'][0]['groups'][] = 'superadmin'; + + $apps[$x]['permissions'][1]['name'] = 'provision_editor_save'; + $apps[$x]['permissions'][1]['groups'][] = 'superadmin'; + + $apps[$x]['permissions'][0]['name'] = 'xml_editor_view'; + $apps[$x]['permissions'][0]['groups'][] = 'superadmin'; + + $apps[$x]['permissions'][1]['name'] = 'xml_editor_save'; + $apps[$x]['permissions'][1]['groups'][] = 'superadmin'; + + $apps[$x]['permissions'][0]['name'] = 'php_editor_view'; + $apps[$x]['permissions'][0]['groups'][] = 'superadmin'; + + $apps[$x]['permissions'][1]['name'] = 'php_editor_save'; + $apps[$x]['permissions'][1]['groups'][] = 'superadmin'; + + $apps[$x]['permissions'][0]['name'] = 'grammar_view'; + $apps[$x]['permissions'][0]['groups'][] = 'admin'; + $apps[$x]['permissions'][0]['groups'][] = 'superadmin'; + + $apps[$x]['permissions'][1]['name'] = 'grammar_save'; + $apps[$x]['permissions'][1]['groups'][] = 'admin'; + $apps[$x]['permissions'][1]['groups'][] = 'superadmin'; + + //schema details + $y = 0; //table array index + $z = 0; //field array index + $apps[$x]['db'][$y]['table'] = 'v_clips'; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'clip_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'clip_name'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'clip_folder'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'clip_text_start'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'clip_text_end'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'clip_order'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'clip_desc'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + ?> \ No newline at end of file diff --git a/app/edit/filelist.php b/app/edit/filelist.php index bdf718ec84..ed78a8f210 100644 --- a/app/edit/filelist.php +++ b/app/edit/filelist.php @@ -232,7 +232,21 @@ echo "\n"; echo " "; echo " "; + echo " "; + echo " "; + echo " "; echo " "; echo "
".$text['label-files']."
\n"; //display:none //echo "
Files
\n"; //display:none -echo recur_dir($_SESSION['switch']['scripts']['dir']); +if ($_SESSION["app"]["edit"]["dir"] == "scripts") { + echo recur_dir($_SESSION['switch']['scripts']['dir']); +} +if ($_SESSION["app"]["edit"]["dir"] == "php") { + echo recur_dir($_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH); +} +if ($_SESSION["app"]["edit"]["dir"] == "grammar") { + echo recur_dir($_SESSION['switch']['grammar']['dir']); +} +if ($_SESSION["app"]["edit"]["dir"] == "provision") { + echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/includes/templates/provision/"); +} +if ($_SESSION["app"]["edit"]["dir"] == "xml") { + echo recur_dir($_SESSION['switch']['conf']['dir']); +} echo "
\n"; diff --git a/app/edit/filenew.php b/app/edit/filenew.php index 29272ab2d1..0120656333 100644 --- a/app/edit/filenew.php +++ b/app/edit/filenew.php @@ -56,6 +56,7 @@ if (strlen($folder) > 0 && strlen($file) > 0) { } else { require_once "header.php"; + echo "
"; echo "
"; echo "
"; @@ -81,9 +82,9 @@ else { echo "
"; - echo " "; - echo " "; - echo "
"; echo ""; diff --git a/app/edit/fileoptionslist.php b/app/edit/fileoptionslist.php index 5c1b343507..035fa1e0ea 100644 --- a/app/edit/fileoptionslist.php +++ b/app/edit/fileoptionslist.php @@ -229,7 +229,21 @@ echo "
\n"; //echo "\n"; -echo recur_dir($_SESSION['switch']['scripts']['dir']); +if ($_SESSION["app"]["edit"]["dir"] == "scripts") { + echo recur_dir($_SESSION['switch']['scripts']['dir']); +} +if ($_SESSION["app"]["edit"]["dir"] == "php") { + echo recur_dir($_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH); +} +if ($_SESSION["app"]["edit"]["dir"] == "grammar") { + echo recur_dir($_SESSION['switch']['grammar']['dir']); +} +if ($_SESSION["app"]["edit"]["dir"] == "provision") { + echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/includes/templates/provision/"); +} +if ($_SESSION["app"]["edit"]["dir"] == "xml") { + echo recur_dir($_SESSION['switch']['conf']['dir']); +} echo "\n"; diff --git a/app/edit/header.php b/app/edit/header.php index 88a419dc3f..f084a19ad8 100644 --- a/app/edit/header.php +++ b/app/edit/header.php @@ -26,7 +26,8 @@ */ //add multi-lingual support - require_once "app_languages.php"; + unset($text); + require "app_languages.php"; foreach($text as $key => $value) { $text[$key] = $value[$_SESSION['domain']['language']['code']]; } diff --git a/app/edit/index.php b/app/edit/index.php index 541aac97f7..7997e66947 100644 --- a/app/edit/index.php +++ b/app/edit/index.php @@ -41,6 +41,9 @@ else { $text[$key] = $value[$_SESSION['domain']['language']['code']]; } +//set the directory + $_SESSION["app"]["edit"]["dir"] = $_GET["dir"]; + echo "\n"; echo "\n"; echo " \n"; diff --git a/app/edit/list.php b/app/edit/list.php index c54993f2c1..021bbbe9d5 100644 --- a/app/edit/list.php +++ b/app/edit/list.php @@ -85,10 +85,10 @@ else { //received results //echo "".$row[clip_desc].""; //echo "".$row[clip_order].""; echo ""; - echo "\n"; if ($c==0) { $c=1; } else { $c=0; } - } //end foreach unset($sql, $result, $row_count); + } //end foreach + unset($sql, $result, $row_count); echo "\n"; echo "\n";