Clean up edit_* pages, some config changes, bug fixes
- Class Basic convert string to bytes fix - admin edit_* pages do not need JS except pop call, moved that into the template and do not load any other JS anymore - changed the EDIT_STYLESHEET/JAVACSRIPT names to ADMIN_ to give them the proper name that they are admin based functions - paths are in an extra config file - plan on moving edit_* css rules into a special CSS file just for this
This commit is contained in:
@@ -26,6 +26,8 @@ DEFINE('LIBS', 'lib'.DS);
|
||||
DEFINE('CONFIGS', 'configs'.DS);
|
||||
// includes (strings, arrays for static, etc)
|
||||
DEFINE('INCLUDES', 'includes'.DS);
|
||||
// data folder (mostly in includes)
|
||||
DEFINE('DATA', 'data'.DS);
|
||||
// layout base path
|
||||
DEFINE('LAYOUT', 'layout'.DS);
|
||||
// pic-root (compatible to CMS)
|
||||
@@ -153,13 +155,6 @@ DEFINE('DEV_SCHEMA', 'public');
|
||||
DEFINE('TEST_SCHEMA', 'public');
|
||||
DEFINE('LIVE_SCHEMA', 'public');
|
||||
|
||||
/************* OTHER PATHS *****************/
|
||||
// File and Folder paths
|
||||
// ID is TARGET (first array element)
|
||||
// $PATHS['test']['csv_path'] = '';
|
||||
// $PATHS['test']['perl_bin'] = '';
|
||||
// $PATHS['test']['redirect_url'] = '';
|
||||
|
||||
/************* DB ACCESS *****************/
|
||||
if (file_exists(BASE.CONFIGS.'config.db.inc')) {
|
||||
require BASE.CONFIGS.'config.db.inc';
|
||||
@@ -168,6 +163,10 @@ if (file_exists(BASE.CONFIGS.'config.db.inc')) {
|
||||
if (file_exists(BASE.CONFIGS.'config.host.inc')) {
|
||||
require BASE.CONFIGS.'config.host.inc';
|
||||
}
|
||||
/************* OTHER PATHS *****************/
|
||||
if (file_exists(BASE.CONFIGS.'config.path.inc')) {
|
||||
require BASE.CONFIGS.'config.path.inc';
|
||||
}
|
||||
|
||||
// set the USE_DATABASE var, if there is nothing set, we assume TRUE
|
||||
$USE_DATABASE = defined('USE_DATABASE') ? USE_DATABASE : true;
|
||||
@@ -213,14 +212,13 @@ DEFINE('SITE_LANG', $SITE_LANG[$HOST_NAME]);
|
||||
DEFINE('SHOW_ALL_ERRORS', true); // show all errors if debug_all & show_error_handling are enabled
|
||||
|
||||
/************* GENERAL PAGE TITLE ********/
|
||||
$G_TITLE = '<OVERALL PAGE TITLE>';
|
||||
DEFINE('G_TITLE', '<OVERALL FALLBACK PAGE TITLE>');
|
||||
|
||||
/************ STYLE SHEETS / JS **********/
|
||||
$EDIT_STYLESHEET = 'edit.css';
|
||||
$EDIT_JAVASCRIPT = 'edit.js';
|
||||
|
||||
$STYLESHEET = 'frontend.css';
|
||||
$JAVASCRIPT = 'frontend.js';
|
||||
DEFINE('ADMIN_STYLESHEET', 'edit.css');
|
||||
DEFINE('ADMIN_JAVASCRIPT', 'edit.js');
|
||||
DEFINE('STYLESHEET', 'frontend.css');
|
||||
DEFINE('JAVASCRIPT', 'frontend.js');
|
||||
|
||||
// anything optional
|
||||
/************* INTERNAL ******************/
|
||||
|
||||
17
www/configs/config.path.inc
Executable file
17
www/configs/config.path.inc
Executable file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/********************************************************************
|
||||
* AUTHOR: Clemens Schwaighofer
|
||||
* CREATED: 2018/10/11
|
||||
* SHORT DESCRIPTION:
|
||||
* configuration file for core path settings
|
||||
* CSV target paths, and other download access URLS or paths needed
|
||||
* HISTORY:
|
||||
*********************************************************************/
|
||||
|
||||
// File and Folder paths
|
||||
// ID is TARGET (first array element)
|
||||
// $PATHS['test']['csv_path'] = '';
|
||||
// $PATHS['test']['perl_bin'] = '';
|
||||
// $PATHS['test']['redirect_url'] = '';
|
||||
|
||||
// __END__
|
||||
@@ -33,12 +33,14 @@ if (!isset($encoding)) {
|
||||
if (session_id() && $_SESSION['DEFAULT_LANG']) {
|
||||
$lang = $_SESSION['DEFAULT_LANG'];
|
||||
} elseif (!$lang) {
|
||||
$lang = DEFAULT_LANG;
|
||||
$lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;
|
||||
}
|
||||
// end the stop of the output flow, but only if we didn't request a csv file download
|
||||
if (array_key_exists('action', $_POST) && $_POST['action'] != 'download_csv') {
|
||||
header("Content-type: text/html; charset=".$encoding);
|
||||
ob_end_flush();
|
||||
}
|
||||
if ($AJAX_PAGE && !$ZIP_STREAM) {
|
||||
header("Content-Type: application/json; charset=UTF-8");
|
||||
}
|
||||
//------------------------------ basic variable settings start
|
||||
|
||||
@@ -59,6 +61,8 @@ $cms->menu_show_flag = 'main';
|
||||
$cms->dbInfo();
|
||||
// set acl
|
||||
$cms->acl = $login->acl;
|
||||
// flush
|
||||
ob_end_flush();
|
||||
//------------------------------ class init end
|
||||
|
||||
//------------------------------ logging start
|
||||
|
||||
@@ -118,13 +118,15 @@ if (!$AJAX_PAGE) {
|
||||
}
|
||||
}
|
||||
// if we can't find it, dump it
|
||||
if (!file_exists($smarty->getTemplateDir()[0].DS.$TEMPLATE_TRANSLATE)) {
|
||||
if ($smarty && !file_exists($smarty->getTemplateDir()[0].DS.$TEMPLATE_TRANSLATE)) {
|
||||
unset($TEMPLATE_TRANSLATE);
|
||||
}
|
||||
}
|
||||
|
||||
// $cms->debug("LANGUAGE", "L: $lang | ".$cms->lang_dir." | MO File: ".$cms->l->mofile);
|
||||
$cms->debug("LANGUAGE", "SL: ".$_SESSION['DEFAULT_CHARSET']." | ".$_SESSION['LANG']." | ".$_SESSION['DEFAULT_LANG']);
|
||||
if ($smarty) {
|
||||
$cms->debug("TEMPLATE", "P: ".$smarty->getTemplateDir()[0]);
|
||||
}
|
||||
|
||||
// __END__
|
||||
|
||||
@@ -61,11 +61,11 @@ $cms->HEADER['CSS'] = CSS;
|
||||
$cms->HEADER['JS'] = JS;
|
||||
$cms->HEADER['ENCODING'] = $encoding;
|
||||
$cms->HEADER['DEFAULT_ENCODING'] = DEFAULT_ENCODING;
|
||||
$cms->HEADER['STYLESHEET'] = $EDIT_STYLESHEET;
|
||||
$cms->HEADER['JAVASCRIPT'] = $EDIT_JAVASCRIPT;
|
||||
$cms->HEADER['STYLESHEET'] = isset($ADMIN_STYLESHEET) ? $ADMIN_STYLESHEET : ADMIN_STYLESHEET;
|
||||
$cms->HEADER['JAVASCRIPT'] = isset($ADMIN_JAVASCRIPT) ? $ADMIN_JAVASCRIPT : ADMIN_JAVASCRIPT;
|
||||
// html title
|
||||
$cms->HEADER['HTML_TITLE'] = (!isset($L_TITLE) || !$L_TITLE) ? $cms->l->__($G_TITLE) : $cms->l->__($L_TITLE);
|
||||
$cms->DATA['table_width'] = $PAGE_WIDTH ? $PAGE_WIDTH : PAGE_WIDTH;
|
||||
$cms->HEADER['HTML_TITLE'] = isset($L_TITLE) ? $cms->l->__($L_TITLE) : $cms->l->__(G_TITLE);
|
||||
$cms->DATA['table_width'] = isset($PAGE_WIDTH) ? $PAGE_WIDTH : PAGE_WIDTH;
|
||||
|
||||
// messages = array('msg' =>, 'class' => 'error/warning/...')
|
||||
$cms->DATA['messages'] = $cms->messages;
|
||||
|
||||
@@ -106,6 +106,11 @@ $data = array (
|
||||
// log action
|
||||
EditLog('Edit Submit', serialize($data));
|
||||
|
||||
// define all needed smarty stuff for the general HTML/page building
|
||||
$HEADER['CSS'] = CSS;
|
||||
$HEADER['DEFAULT_ENCODING'] = DEFAULT_ENCODING;
|
||||
$HEADER['STYLESHEET'] = isset($ADMIN_STYLESHEET) ? $ADMIN_STYLESHEET : ADMIN_STYLESHEET;
|
||||
|
||||
if ($form->my_page_name == 'edit_order') {
|
||||
// get is for "table_name" and "where" only
|
||||
$table_name = isset($_GET['table_name']) ? $_GET['table_name'] : '';
|
||||
@@ -176,14 +181,8 @@ if ($form->my_page_name == 'edit_order') {
|
||||
);
|
||||
} // while read data ...
|
||||
|
||||
// define all needed smarty stuff for the general HTML/page building
|
||||
$HEADER['CSS'] = CSS;
|
||||
$HEADER['DEFAULT_ENCODING'] = DEFAULT_ENCODING;
|
||||
$HEADER['JS'] = JS;
|
||||
$HEADER['STYLESHEET'] = $EDIT_STYLESHEET;
|
||||
$HEADER['JAVASCRIPT'] = $EDIT_JAVASCRIPT;
|
||||
// html title
|
||||
$HEADER['HTML_TITLE'] = (!$L_TITLE) ? $smarty->l10n->__($G_TITLE) : $smarty->l10n->__($L_TITLE);
|
||||
$HEADER['HTML_TITLE'] = $form->l->__('Edit Order');
|
||||
|
||||
// error msg
|
||||
if ($error) {
|
||||
@@ -235,13 +234,6 @@ if ($form->my_page_name == 'edit_order') {
|
||||
$form->formProcedureDelete();
|
||||
$form->formProcedureDeleteFromElementList($element_list, $remove_name);
|
||||
|
||||
// define all needed smarty stuff for the general HTML/page building
|
||||
$HEADER['CSS'] = CSS;
|
||||
$HEADER['DEFAULT_ENCODING'] = DEFAULT_ENCODING;
|
||||
$HEADER['JS'] = JS;
|
||||
$HEADER['STYLESHEET'] = $EDIT_STYLESHEET;
|
||||
$HEADER['JAVASCRIPT'] = $EDIT_JAVASCRIPT;
|
||||
|
||||
$DATA['table_width'] = $table_width;
|
||||
|
||||
// write out error / status messages
|
||||
@@ -314,7 +306,7 @@ if ($form->my_page_name == 'edit_order') {
|
||||
$DATA['page_name'] = $menuarray[$position]["page_name"];
|
||||
$L_TITLE = $DATA['page_name'];
|
||||
// html title
|
||||
$HEADER['HTML_TITLE'] = ((!$L_TITLE) ? $form->l->__($G_TITLE) : $form->l->__($L_TITLE));
|
||||
$HEADER['HTML_TITLE'] = $form->l->__($L_TITLE);
|
||||
// END MENU
|
||||
// LOAD AND NEW
|
||||
$DATA['load'] = $form->formCreateLoad();
|
||||
@@ -445,7 +437,7 @@ if (is_dir(BASE.TEMPLATES_C)) {
|
||||
if (is_dir(BASE.CACHE)) {
|
||||
$smarty->setCacheDir(BASE.CACHE);
|
||||
}
|
||||
$smarty->display($EDIT_TEMPLATE, $lang, $lang);
|
||||
$smarty->display($EDIT_TEMPLATE, 'editAdmin_'.$lang, 'editAdmin_'.$lang);
|
||||
|
||||
// debug output
|
||||
echo $login->printErrorMsg();
|
||||
|
||||
@@ -15,12 +15,14 @@
|
||||
{if $STYLESHEET}
|
||||
<link rel=stylesheet type="text/css" href="{$css}{$STYLESHEET}">
|
||||
{/if}
|
||||
{if $JAVASCRIPT}
|
||||
<script language="JavaScript" src="{$js}{$JAVASCRIPT}"></script>
|
||||
{/if}
|
||||
{if $DATE_JAVASCRIPT}
|
||||
<script language="JavaScript" src="{$JS}{$DATE_JAVASCRIPT}"></script>
|
||||
{/if}
|
||||
<script language="JavaScript">
|
||||
<!--
|
||||
function pop(theURL, winName, features) {
|
||||
winName = window.open(theURL, winName, features);
|
||||
winName.focus();
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<table width="{$table_width}" border="0" cellpadding="0" cellspacing="1">
|
||||
|
||||
@@ -14,7 +14,7 @@ if (!DEBUG) {
|
||||
// METHOD: pop
|
||||
// PARAMS: url, window name, features
|
||||
// RETURN: none
|
||||
// DESC : opens a popup window with winNAme and given features (string)
|
||||
// DESC : opens a popup window with winName and given features (string)
|
||||
function pop(theURL, winName, features) {
|
||||
winName = window.open(theURL, winName, features);
|
||||
winName.focus();
|
||||
|
||||
@@ -1241,8 +1241,8 @@ class Basic
|
||||
// DESC : calculates the bytes based on a string with nnG, nnM, etc
|
||||
public static function stringByteFormat($number)
|
||||
{
|
||||
$number = (int)trim($number);
|
||||
$last = strtolower($number[strlen($number) - 1]);
|
||||
$number = (int)trim($number);
|
||||
switch ($last) {
|
||||
case 't':
|
||||
$number *= 1024;
|
||||
|
||||
Reference in New Issue
Block a user