Update set paths bug, Update core JS, fix basic class bug

SITE LANG settings had double ;;

Updated the edit.js core JS parts

Fixed bug in date compare with wrong variable name
This commit is contained in:
Clemens Schwaighofer
2018-10-11 09:51:17 +09:00
parent c6a15506c5
commit 2e8712d935
3 changed files with 39 additions and 23 deletions

View File

@@ -32,7 +32,7 @@ if ($_SESSION['DEFAULT_CHARSET']) {
if ($_SESSION['DEFAULT_LANG']) { if ($_SESSION['DEFAULT_LANG']) {
$lang = $_SESSION['DEFAULT_LANG']; $lang = $_SESSION['DEFAULT_LANG'];
} elseif (!$lang) { } elseif (!$lang) {
$lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;; $lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;
} }
// create the char lang encoding // create the char lang encoding
$lang_short = substr($lang, 0, 2); $lang_short = substr($lang, 0, 2);
@@ -108,8 +108,8 @@ if (!is_dir($cms->cache_pictures)) {
// if the template_dir is != DEFAULT_TEMPLATE, then try to make a lang switch // if the template_dir is != DEFAULT_TEMPLATE, then try to make a lang switch
// if the default lang is not like the lang given, switch lang // if the default lang is not like the lang given, switch lang
if (false === strstr(LAYOUT.DEFAULT_TEMPLATE.LANG, $cms->lang_dir) || strcasecmp(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;, $lang)) { if (false === strstr(LAYOUT.DEFAULT_TEMPLATE.LANG, $cms->lang_dir) || strcasecmp(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG, $lang)) {
$cms->debug('LANG', 'Orig: '.LAYOUT.DEFAULT_TEMPLATE.LANG.', New: '.$cms->lang_dir.' | Orig Lang: '.(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;).', New Lang: '.$lang); $cms->debug('LANG', 'Orig: '.LAYOUT.DEFAULT_TEMPLATE.LANG.', New: '.$cms->lang_dir.' | Orig Lang: '.(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG).', New Lang: '.$lang);
$cms->l->l10nReloadMOfile($lang, $cms->lang_dir); $cms->l->l10nReloadMOfile($lang, $cms->lang_dir);
// if we have login class // if we have login class
if ($login) { if ($login) {

View File

@@ -379,35 +379,51 @@ function phfo(tree)
// BLOCK: html wrappers for quickly creating html data blocks // BLOCK: html wrappers for quickly creating html data blocks
// METHOD: html_options // METHOD: html_options
// PARAMS: name/id, array for the options, selected item uid // PARAMS: name/id, array for the options, selected item uid
// options_only: if this is true, it will not print the select part // options_only [def false] if this is true, it will not print the select part
// return_string, return as string and not as element // return_string [def false]: return as string and not as element
// sort [def '']: if empty as is, else allowed 'keys', 'values' all others are ignored
// RETURN: html with build options block // RETURN: html with build options block
// DESC : creates an select/options drop down block. // DESC : creates an select/options drop down block.
// the array needs to be key -> value format. key is for the option id and value is for the data output // the array needs to be key -> value format. key is for the option id and value is for the data output
function html_options(name, data, selected = '', options_only = false, return_string = false) function html_options(name, data, selected = '', options_only = false, return_string = false, sort = '')
{ {
let content = []; let content = [];
let element_select; let element_select;
let element_option; let element_option;
let data_list = []; // for sorted output
// set outside select, gets stripped on return if options only is true // set outside select, gets stripped on return if options only is true
element_select = cel('select', name); element_select = cel('select', name);
// console.log('Call for %s, options: %s', name, options_only); if (isObject(data)) {
$H(data).each(function(t) { // console.log('Call for %s, options: %s', name, options_only);
console.log('options: key: %s, value: %s', t.key, t.value); // console.log('Call for %s, options: %s', name, options_only);
// basic options init if (sort == 'keys') {
let options = { data_list = Object.keys(data).sort();
'label': t.value, } else if (sort == 'values') {
'value': t.key data_list = Object.keys(data).sort((a, b) => ('' + data[a]).localeCompare(data[b]));
}; } else {
// add selected if matching data_list = Object.keys(data);
if (selected == t.key) {
options.selected = '';
} }
// create the element option // console.log('ORDER: %s', data_list);
element_option = cel('option', '', t.value, '', options); // use the previously sorted list
// attach it to the select element // for (const [key, value] of Object.entries(data)) {
ael(element_select, element_option); for (const key of data_list) {
}); let value = data[key];
console.log('options: key: %s, value: %s', key, value);
// basic options init
let options = {
'label': value,
'value': key
};
// add selected if matching
if (selected == key) {
options.selected = '';
}
// create the element option
element_option = cel('option', '', value, '', options);
// attach it to the select element
ael(element_select, element_option);
}
}
// if with select part, convert to text // if with select part, convert to text
if (!options_only) { if (!options_only) {
if (return_string) { if (return_string) {

View File

@@ -1427,7 +1427,7 @@ class Basic
public static function compareDateTime($start_datetime, $end_datetime) public static function compareDateTime($start_datetime, $end_datetime)
{ {
// pre check for empty or wrong // pre check for empty or wrong
if ($start_date == '--' || $end_date == '--' || !$start_date || !$end_date) { if ($start_datetime == '--' || $end_datetime == '--' || !$start_datetime || !$end_datetime) {
return false; return false;
} }
$start_timestamp = strtotime($start_datetime); $start_timestamp = strtotime($start_datetime);