diff --git a/4dev/database/bin/import_data.sh b/4dev/database/bin/import_data.sh index 932c6433..e1e10ab4 100755 --- a/4dev/database/bin/import_data.sh +++ b/4dev/database/bin/import_data.sh @@ -5,19 +5,63 @@ #echo "EXIT"; #exit; +# if flagged 'y' then it will ask after each import to continue +development='y'; +test='n'; +input=''; +# database connection info db=''; host=''; user=''; -#schema="publicv"; +schema="public"; +export PGPASSWORD=''; -for file in `cat ORDER`; -do - if [ -f $file ]; - then -# for path in $schema; -# do -# echo "WORK ON "$schema"."$file; - psql -U $user -h $host -f $file $db 1>> output 2>> error -# done; +# log files +error_file="log/error"; +output_file="log/output"; + +if [ ! -f ORDER ]; then + echo "Could not find ORDER file"; + exit; +fi; + +if [ "$test" != "n" ]; then + echo "TESTING MODE, NO DATA WILL BE IMPORTED"; +fi; +if [ "$development" = "y" ]; then + echo "STEP BY STEP IMPORT MODE ACTIVATED"; +fi; + +while read file <&3; do + if [ "$file" = "FINISHED" ]; then + echo "Database data is flagged as FINISHED in ORDER file"; + exit; fi; -done; + if [ -f "$file" ]; then + for path in "$schemas"; do + echo "[+] WORK ON '${file}' @ '${path}'"; + if [ "$test" = 'n' ]; then + echo "=== START [$file] ===>" >> ${error_file}; + psql -U ${user} -h ${host} -f "${file}" ${db} 1>> ${output_file} 2>> ${error_file} + echo "=== END [$file] ===>" >> ${error_file}; + fi; + if [ "$development" = "y" ]; then + echo "Press 'y' to move to next. Press 'r' to reload last file. ^c to abort"; + fi; + while [ "$development" = "y" ] && [ "$input" != "y" ]; do + read -ep "Continue (y|r|^c): " input; + if [ "$input" = "r" ]; then + echo "Reload File '${file}' ..."; + if [ "$test" = 'n' ]; then + echo "=== START RELOAD [$file] ===>" >> ${error_file}; + psql -U ${user} -h ${host} -f "${file}" ${db} 1>> ${output_file} 2>> ${error_file} + echo "=== END RELOAD [$file] ===>" >> ${error_file}; + fi; + fi; + done; + input=''; + done; + elif [[ ${file::1} != "#" ]]; then + echo "[!] COULD NOT FIND FILE: '${file}'"; + fi; +done 3getTemplateDir()[0].DS.$TEMPL if (false === strstr(BASE.INCLUDES.LANG.CONTENT_PATH, $cms->lang_dir) || strcasecmp(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG, $lang) ) { - $cms->debug('LANG', 'Orig Lang: '.(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG).', New Lang: '.$lang); + $cms->debug('LANG', 'Orig: '.BASE.INCLUDES.LANG.CONTENT_PATH.', New: '.$cms->lang_dir.' | Orig Lang: '.(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG).', New Lang: '.$lang); $cms->l->l10nReloadMOfile($lang, $cms->lang_dir); // if we have login class if ($login) { @@ -91,7 +91,7 @@ if (false === strstr(BASE.INCLUDES.LANG.CONTENT_PATH, $cms->lang_dir) || } } -// javascrip translate data as template for auto translate +// javascript translate data as template for auto translate if (!$TEMPLATE_TRANSLATE) { $TEMPLATE_TRANSLATE = 'jsTranslate_'.$lang.'.tpl'; $cms->debug('LANG', 'Load lang: '.$lang.', for page file '.$TEMPLATE_TRANSLATE); diff --git a/www/includes/admin_smarty.inc b/www/includes/admin_smarty.inc index 84051000..2f417b31 100644 --- a/www/includes/admin_smarty.inc +++ b/www/includes/admin_smarty.inc @@ -14,7 +14,7 @@ if ($cms->HEADER['USE_PROTOTYPE']) { $cms->HEADER['USE_SCRIPTACULOUS'] = isset($USE_SCRIPTACULOUS) ? $USE_SCRIPTACULOUS : USE_SCRIPTACULOUS; } // jquery and prototype should not be used together -$cms->HEADER['USE_JQUERY'] = isset($USE_JQUERY) ? $USE_JQUERY : USE_JQUERY; // don't use either of those two toger +$cms->HEADER['USE_JQUERY'] = isset($USE_JQUERY) ? $USE_JQUERY : USE_JQUERY; // don't use either of those two together // set basic template path (tmp) // paths are set in the 'set_paths.inc' file diff --git a/www/layout/admin/javascript/edit.jq.js b/www/layout/admin/javascript/edit.jq.js index 508f8551..ee8e0011 100644 --- a/www/layout/admin/javascript/edit.jq.js +++ b/www/layout/admin/javascript/edit.jq.js @@ -428,9 +428,12 @@ function aelx(base, ...attach) // METHOD: rel [reset element] // PARAMS: cel created element -// RETURN: "none", is self change, but returns base.sub +// RETURN: returns sub reset base element // DESC : resets the sub elements of the base element given -const rel = (base) => base.sub = []; +const rel = (base) => { + base.sub = []; + return base; +}; // METHOD: rcssel [remove a css from the element] // PARAMS: element, style sheet to remove diff --git a/www/layout/admin/javascript/edit.pt.js b/www/layout/admin/javascript/edit.pt.js index 923c618d..bb162f29 100644 --- a/www/layout/admin/javascript/edit.pt.js +++ b/www/layout/admin/javascript/edit.pt.js @@ -506,9 +506,12 @@ function aelx(base, ...attach) // METHOD: rel [reset element] // PARAMS: cel created element -// RETURN: "none", is self change, but returns base.sub +// RETURN: returns sub reset base element // DESC : resets the sub elements of the base element given -const rel = (base) => base.sub = []; +const rel = (base) => { + base.sub = []; + return base; +}; // METHOD: rcssel [remove a css from the element] // PARAMS: element, style sheet to remove