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:
@@ -32,7 +32,7 @@ if ($_SESSION['DEFAULT_CHARSET']) {
|
||||
if ($_SESSION['DEFAULT_LANG']) {
|
||||
$lang = $_SESSION['DEFAULT_LANG'];
|
||||
} elseif (!$lang) {
|
||||
$lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;;
|
||||
$lang = defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;
|
||||
}
|
||||
// create the char lang encoding
|
||||
$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 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)) {
|
||||
$cms->debug('LANG', 'Orig: '.LAYOUT.DEFAULT_TEMPLATE.LANG.', New: '.$cms->lang_dir.' | Orig Lang: '.(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG;).', New 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->l->l10nReloadMOfile($lang, $cms->lang_dir);
|
||||
// if we have login class
|
||||
if ($login) {
|
||||
|
||||
@@ -379,35 +379,51 @@ function phfo(tree)
|
||||
// BLOCK: html wrappers for quickly creating html data blocks
|
||||
// METHOD: html_options
|
||||
// PARAMS: name/id, array for the options, selected item uid
|
||||
// options_only: if this is true, it will not print the select part
|
||||
// return_string, return as string and not as element
|
||||
// options_only [def false] if this is true, it will not print the select part
|
||||
// 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
|
||||
// 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
|
||||
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 element_select;
|
||||
let element_option;
|
||||
let data_list = []; // for sorted output
|
||||
// set outside select, gets stripped on return if options only is true
|
||||
element_select = cel('select', name);
|
||||
// console.log('Call for %s, options: %s', name, options_only);
|
||||
$H(data).each(function(t) {
|
||||
console.log('options: key: %s, value: %s', t.key, t.value);
|
||||
// basic options init
|
||||
let options = {
|
||||
'label': t.value,
|
||||
'value': t.key
|
||||
};
|
||||
// add selected if matching
|
||||
if (selected == t.key) {
|
||||
options.selected = '';
|
||||
if (isObject(data)) {
|
||||
// console.log('Call for %s, options: %s', name, options_only);
|
||||
// console.log('Call for %s, options: %s', name, options_only);
|
||||
if (sort == 'keys') {
|
||||
data_list = Object.keys(data).sort();
|
||||
} else if (sort == 'values') {
|
||||
data_list = Object.keys(data).sort((a, b) => ('' + data[a]).localeCompare(data[b]));
|
||||
} else {
|
||||
data_list = Object.keys(data);
|
||||
}
|
||||
// create the element option
|
||||
element_option = cel('option', '', t.value, '', options);
|
||||
// attach it to the select element
|
||||
ael(element_select, element_option);
|
||||
});
|
||||
// console.log('ORDER: %s', data_list);
|
||||
// use the previously sorted list
|
||||
// for (const [key, value] of Object.entries(data)) {
|
||||
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 (!options_only) {
|
||||
if (return_string) {
|
||||
|
||||
@@ -1427,7 +1427,7 @@ class Basic
|
||||
public static function compareDateTime($start_datetime, $end_datetime)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
$start_timestamp = strtotime($start_datetime);
|
||||
|
||||
Reference in New Issue
Block a user