Compare commits
11
Commits
v9.27.0
...
32decdd037
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32decdd037 | ||
|
|
46cda40d37 | ||
|
|
e71df90144 | ||
|
|
bbcc642fde | ||
|
|
558694aa6c | ||
|
|
f3bd09529a | ||
|
|
816bb7c9ee | ||
|
|
fc7b705355 | ||
|
|
7b96c1f9ca | ||
|
|
26c6ebcea7 | ||
|
|
545279b9fe |
No files matched your search
@@ -5,3 +5,5 @@ vendor/
|
|||||||
tools/
|
tools/
|
||||||
www/composer.lock
|
www/composer.lock
|
||||||
www/vendor
|
www/vendor
|
||||||
|
**/.env
|
||||||
|
**/.target
|
||||||
@@ -152,7 +152,6 @@ final class CoreLibsACLLoginTest extends TestCase
|
|||||||
// TARGET
|
// TARGET
|
||||||
define('TARGET', 'test');
|
define('TARGET', 'test');
|
||||||
// LOGIN DB SCHEMA
|
// LOGIN DB SCHEMA
|
||||||
// define('LOGIN_DB_SCHEMA', '');
|
|
||||||
|
|
||||||
// SHOULD SET
|
// SHOULD SET
|
||||||
// DEFAULT_ACL_LEVEL (d80)
|
// DEFAULT_ACL_LEVEL (d80)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ final class CoreLibsConvertByteTest extends TestCase
|
|||||||
4 => '1.00 KB',
|
4 => '1.00 KB',
|
||||||
5 => '1.02KiB',
|
5 => '1.02KiB',
|
||||||
],
|
],
|
||||||
'invalud string number' => [
|
'invalid string number' => [
|
||||||
0 => '1024 MB',
|
0 => '1024 MB',
|
||||||
1 => '1024 MB',
|
1 => '1024 MB',
|
||||||
2 => '1024 MB',
|
2 => '1024 MB',
|
||||||
|
|||||||
@@ -114,3 +114,11 @@ Add `.libs` to the master .gitingore
|
|||||||
### Update phpunit
|
### Update phpunit
|
||||||
|
|
||||||
On a version update the old phpunit folder in .libs has to be removed and the new version extracted again
|
On a version update the old phpunit folder in .libs has to be removed and the new version extracted again
|
||||||
|
|
||||||
|
## Javascript
|
||||||
|
|
||||||
|
The original edit.js javascript functions are now in utils.js or utils.min.js.
|
||||||
|
|
||||||
|
The development for thos files is located in a different repository
|
||||||
|
|
||||||
|
https://[service]/CodeBlocks/javascript-utils
|
||||||
@@ -10,5 +10,6 @@ $_SERVER['HTTP_HOST'] = 'soba.tokyo.tequila.jp';
|
|||||||
define('BASE_NAME', '');
|
define('BASE_NAME', '');
|
||||||
define('SITE_DOMAIN', '');
|
define('SITE_DOMAIN', '');
|
||||||
define('HOST_NAME', 'soba.tokyo.tequila.jp');
|
define('HOST_NAME', 'soba.tokyo.tequila.jp');
|
||||||
|
define('DEFAULT_ENCODING', 'en_US.UTF-8');
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
/* general edit javascript */
|
/*
|
||||||
/* jquery version */
|
general edit javascript
|
||||||
|
jquery version
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @deprecated Do not use this anymore, use utils.js or utils.min.js */
|
||||||
|
|
||||||
/* global i18n */
|
/* global i18n */
|
||||||
|
|
||||||
@@ -21,6 +25,7 @@ var GL_OB_BASE = 100;
|
|||||||
* @param {string} el_id Element ID to get
|
* @param {string} el_id Element ID to get
|
||||||
* @returns {HTMLElement}
|
* @returns {HTMLElement}
|
||||||
* @throws Error
|
* @throws Error
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function loadEl(el_id)
|
function loadEl(el_id)
|
||||||
{
|
{
|
||||||
@@ -36,6 +41,7 @@ function loadEl(el_id)
|
|||||||
* @param {String} theURL the url
|
* @param {String} theURL the url
|
||||||
* @param {String} winName window name
|
* @param {String} winName window name
|
||||||
* @param {Object} features popup features
|
* @param {Object} features popup features
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function pop(theURL, winName, features) // eslint-disable-line no-unused-vars
|
function pop(theURL, winName, features) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -46,6 +52,7 @@ function pop(theURL, winName, features) // eslint-disable-line no-unused-vars
|
|||||||
/**
|
/**
|
||||||
* automatically resize a text area based on the amount of lines in it
|
* automatically resize a text area based on the amount of lines in it
|
||||||
* @param {string} ta_id element id
|
* @param {string} ta_id element id
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function expandTA(ta_id) // eslint-disable-line no-unused-vars
|
function expandTA(ta_id) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -71,6 +78,7 @@ function expandTA(ta_id) // eslint-disable-line no-unused-vars
|
|||||||
/**
|
/**
|
||||||
* wrapper to get the real window size for the current browser window
|
* wrapper to get the real window size for the current browser window
|
||||||
* @return {Object} object with width/height
|
* @return {Object} object with width/height
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function getWindowSize()
|
function getWindowSize()
|
||||||
{
|
{
|
||||||
@@ -86,6 +94,7 @@ function getWindowSize()
|
|||||||
/**
|
/**
|
||||||
* wrapper to get the correct scroll offset
|
* wrapper to get the correct scroll offset
|
||||||
* @return {Object} object with x/y px
|
* @return {Object} object with x/y px
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function getScrollOffset()
|
function getScrollOffset()
|
||||||
{
|
{
|
||||||
@@ -101,6 +110,7 @@ function getScrollOffset()
|
|||||||
/**
|
/**
|
||||||
* wrapper to get the correct scroll offset for opener page (from popup)
|
* wrapper to get the correct scroll offset for opener page (from popup)
|
||||||
* @return {Object} object with x/y px
|
* @return {Object} object with x/y px
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function getScrollOffsetOpener() // eslint-disable-line no-unused-vars
|
function getScrollOffsetOpener() // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -118,6 +128,7 @@ function getScrollOffsetOpener() // eslint-disable-line no-unused-vars
|
|||||||
* @param {String} id element to center
|
* @param {String} id element to center
|
||||||
* @param {Boolean} left if true centers to the middle from the left
|
* @param {Boolean} left if true centers to the middle from the left
|
||||||
* @param {Boolean} top if true centers to the middle from the top
|
* @param {Boolean} top if true centers to the middle from the top
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function setCenter(id, left, top)
|
function setCenter(id, left, top)
|
||||||
{
|
{
|
||||||
@@ -155,6 +166,7 @@ function setCenter(id, left, top)
|
|||||||
* @param {Number} [offset=0] offset from top, default is 0 (px)
|
* @param {Number} [offset=0] offset from top, default is 0 (px)
|
||||||
* @param {Number} [duration=500] animation time, default 500ms
|
* @param {Number} [duration=500] animation time, default 500ms
|
||||||
* @param {String} [base='body,html'] base element for offset scroll
|
* @param {String} [base='body,html'] base element for offset scroll
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function goToPos(element, offset = 0, duration = 500, base = 'body,html') // eslint-disable-line no-unused-vars
|
function goToPos(element, offset = 0, duration = 500, base = 'body,html') // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -173,6 +185,7 @@ function goToPos(element, offset = 0, duration = 500, base = 'body,html') // esl
|
|||||||
* go to element, scroll
|
* go to element, scroll
|
||||||
* non jquery
|
* non jquery
|
||||||
* @param {string} target
|
* @param {string} target
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function goTo(target) // eslint-disable-line no-unused-vars
|
function goTo(target) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -186,6 +199,7 @@ function goTo(target) // eslint-disable-line no-unused-vars
|
|||||||
* that is filled from gettext in PHP
|
* that is filled from gettext in PHP
|
||||||
* @param {String} string text to translate
|
* @param {String} string text to translate
|
||||||
* @return {String} translated text (based on PHP selected language)
|
* @return {String} translated text (based on PHP selected language)
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function __(string)
|
function __(string)
|
||||||
{
|
{
|
||||||
@@ -202,37 +216,70 @@ function __(string)
|
|||||||
* First, checks if it isn't implemented yet.
|
* First, checks if it isn't implemented yet.
|
||||||
* @param {String} String.prototype.format string with elements to be replaced
|
* @param {String} String.prototype.format string with elements to be replaced
|
||||||
* @return {String} Formated string
|
* @return {String} Formated string
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
if (!String.prototype.format) {
|
if (!String.prototype.format) {
|
||||||
String.prototype.format = function()
|
String.prototype.format = function()
|
||||||
{
|
{
|
||||||
var args = arguments;
|
console.error('[DEPRECATED] use formatString');
|
||||||
return this.replace(/{(\d+)}/g, function(match, number)
|
return formatString(this, arguments);
|
||||||
{
|
};
|
||||||
return typeof args[number] != 'undefined' ?
|
}
|
||||||
args[number] :
|
|
||||||
match
|
/**
|
||||||
;
|
* simple sprintf formater for replace
|
||||||
});
|
* usage: "{0} is cool, {1} is not".format("Alpha", "Beta");
|
||||||
|
* First, checks if it isn't implemented yet.
|
||||||
|
* @param {String} string String with {..} entries
|
||||||
|
* @param {...any} args List of replacement
|
||||||
|
* @returns {String} Escaped string
|
||||||
|
* @deprecated use utils.js
|
||||||
|
*/
|
||||||
|
function formatString(string, ...args)
|
||||||
|
{
|
||||||
|
return string.replace(/{(\d+)}/g, function(match, number)
|
||||||
|
{
|
||||||
|
return typeof args[number] != 'undefined' ?
|
||||||
|
args[number] :
|
||||||
|
match
|
||||||
|
;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* round to digits (float)
|
||||||
|
* @param {Number} Number.prototype.round Float type number to round
|
||||||
|
* @param {Number} prec Precision to round to
|
||||||
|
* @return {Float} Rounded number
|
||||||
|
* @deprecated use utils.js
|
||||||
|
*/
|
||||||
|
if (Number.prototype.round) {
|
||||||
|
Number.prototype.round = function (prec) {
|
||||||
|
console.error('[DEPRECATED] use roundPrecision');
|
||||||
|
return roundPrecision(this, prec);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* round to digits (float)
|
* round to digits (float)
|
||||||
* @param {Float} Number.prototype.round Float type number to round
|
* @param {Number} number Float type number to round
|
||||||
* @param {Number} prec Precision to round to
|
* @param {Number} precision Precision to round to
|
||||||
* @return {Float} Rounded number
|
* @return {Number} Rounded number
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
if (Number.prototype.round) {
|
function roundPrecision(number, precision)
|
||||||
Number.prototype.round = function (prec) {
|
{
|
||||||
return Math.round(this * Math.pow(10, prec)) / Math.pow(10, prec);
|
if (!isNaN(number) || !isNaN(precision)) {
|
||||||
};
|
return number;
|
||||||
|
}
|
||||||
|
return Math.round(number * Math.pow(10, precision)) / Math.pow(10, precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* formats flat number 123456 to 123,456
|
* formats flat number 123456 to 123,456
|
||||||
* @param {Number} x number to be formated
|
* @param {Number} x number to be formated
|
||||||
* @return {String} formatted with , in thousands
|
* @return {String} formatted with , in thousands
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function numberWithCommas(x) // eslint-disable-line no-unused-vars
|
function numberWithCommas(x) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -245,6 +292,7 @@ function numberWithCommas(x) // eslint-disable-line no-unused-vars
|
|||||||
* converts line breaks to br
|
* converts line breaks to br
|
||||||
* @param {String} string any string
|
* @param {String} string any string
|
||||||
* @return {String} string with <br>
|
* @return {String} string with <br>
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function convertLBtoBR(string) // eslint-disable-line no-unused-vars
|
function convertLBtoBR(string) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -253,51 +301,78 @@ function convertLBtoBR(string) // eslint-disable-line no-unused-vars
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* escape HTML string
|
* escape HTML string
|
||||||
* @param {String} !String.prototype.escapeHTML HTML data string to be escaped
|
* @param {String} String.prototype.escapeHTML HTML data string to be escaped
|
||||||
* @return {String} escaped string
|
* @return {String} escaped string
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
if (!String.prototype.escapeHTML) {
|
if (!String.prototype.escapeHTML) {
|
||||||
String.prototype.escapeHTML = function() {
|
String.prototype.escapeHTML = function() {
|
||||||
return this.replace(/[&<>"'/]/g, function (s) {
|
console.error('[DEPRECATED] use escapeHtml');
|
||||||
var entityMap = {
|
return escapeHtml(this);
|
||||||
'&': '&',
|
|
||||||
'<': '<',
|
|
||||||
'>': '>',
|
|
||||||
'"': '"',
|
|
||||||
'\'': ''',
|
|
||||||
'/': '/'
|
|
||||||
};
|
|
||||||
|
|
||||||
return entityMap[s];
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* unescape a HTML encoded string
|
* unescape a HTML encoded string
|
||||||
* @param {String} !String.prototype.unescapeHTML data with escaped entries
|
* @param {String} String.prototype.unescapeHTML data with escaped entries
|
||||||
* @return {String} HTML formated string
|
* @return {String} HTML formated string
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
if (!String.prototype.unescapeHTML) {
|
if (!String.prototype.unescapeHTML) {
|
||||||
String.prototype.unescapeHTML = function() {
|
String.prototype.unescapeHTML = function() {
|
||||||
return this.replace(/&[#\w]+;/g, function (s) {
|
console.error('[DEPRECATED] use unescapeHtml');
|
||||||
var entityMap = {
|
return unescapeHtml(this);
|
||||||
'&': '&',
|
|
||||||
'<': '<',
|
|
||||||
'>': '>',
|
|
||||||
'"': '"',
|
|
||||||
''': '\'',
|
|
||||||
'/': '/'
|
|
||||||
};
|
|
||||||
|
|
||||||
return entityMap[s];
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Escapes HTML in string
|
||||||
|
* @param {String} string Text to escape HTML in
|
||||||
|
* @returns {String}
|
||||||
|
* @deprecated use utils.js
|
||||||
|
*/
|
||||||
|
function escapeHtml(string)
|
||||||
|
{
|
||||||
|
return string.replace(/[&<>"'/]/g, function (s) {
|
||||||
|
var entityMap = {
|
||||||
|
'&': '&',
|
||||||
|
'<': '<',
|
||||||
|
'>': '>',
|
||||||
|
'"': '"',
|
||||||
|
'\'': ''',
|
||||||
|
'/': '/'
|
||||||
|
};
|
||||||
|
|
||||||
|
return entityMap[s];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unescape a HTML encoded string
|
||||||
|
* @param {String} string Text to unescape HTML in
|
||||||
|
* @returns {String}
|
||||||
|
* @deprecated use utils.js
|
||||||
|
*/
|
||||||
|
function unescapeHtml(string)
|
||||||
|
{
|
||||||
|
return string.replace(/&[#\w]+;/g, function (s) {
|
||||||
|
var entityMap = {
|
||||||
|
'&': '&',
|
||||||
|
'<': '<',
|
||||||
|
'>': '>',
|
||||||
|
'"': '"',
|
||||||
|
''': '\'',
|
||||||
|
'/': '/'
|
||||||
|
};
|
||||||
|
|
||||||
|
return entityMap[s];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns current timestamp (unix timestamp)
|
* returns current timestamp (unix timestamp)
|
||||||
* @return {Number} timestamp (in milliseconds)
|
* @return {Number} timestamp (in milliseconds)
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function getTimestamp() // eslint-disable-line no-unused-vars
|
function getTimestamp() // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -310,6 +385,7 @@ function getTimestamp() // eslint-disable-line no-unused-vars
|
|||||||
* i.e. 0-255 -> '00'-'ff'
|
* i.e. 0-255 -> '00'-'ff'
|
||||||
* @param {Number} dec decimal string
|
* @param {Number} dec decimal string
|
||||||
* @return {String} hex encdoded number
|
* @return {String} hex encdoded number
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function dec2hex(dec)
|
function dec2hex(dec)
|
||||||
{
|
{
|
||||||
@@ -321,6 +397,7 @@ function dec2hex(dec)
|
|||||||
* only works on mondern browsers
|
* only works on mondern browsers
|
||||||
* @param {Number} len length of unique id string
|
* @param {Number} len length of unique id string
|
||||||
* @return {String} random string in length of len
|
* @return {String} random string in length of len
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function generateId(len) // eslint-disable-line no-unused-vars
|
function generateId(len) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -334,6 +411,7 @@ function generateId(len) // eslint-disable-line no-unused-vars
|
|||||||
* works on all browsers
|
* works on all browsers
|
||||||
* after many runs it will create duplicates
|
* after many runs it will create duplicates
|
||||||
* @return {String} not true random string
|
* @return {String} not true random string
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function randomIdF() // eslint-disable-line no-unused-vars
|
function randomIdF() // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -347,6 +425,7 @@ function randomIdF() // eslint-disable-line no-unused-vars
|
|||||||
* @param {Number} min minimum int number inclusive
|
* @param {Number} min minimum int number inclusive
|
||||||
* @param {Number} max maximumg int number inclusive
|
* @param {Number} max maximumg int number inclusive
|
||||||
* @return {Number} Random number
|
* @return {Number} Random number
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function getRandomIntInclusive(min, max) // eslint-disable-line no-unused-vars
|
function getRandomIntInclusive(min, max) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -360,6 +439,7 @@ function getRandomIntInclusive(min, max) // eslint-disable-line no-unused-vars
|
|||||||
* check if name is a function
|
* check if name is a function
|
||||||
* @param {string} name Name of function to check if exists
|
* @param {string} name Name of function to check if exists
|
||||||
* @return {Boolean} true/false
|
* @return {Boolean} true/false
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function isFunction(name) // eslint-disable-line no-unused-vars
|
function isFunction(name) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -379,6 +459,7 @@ function isFunction(name) // eslint-disable-line no-unused-vars
|
|||||||
* @param {mixed} context context (window or first namespace)
|
* @param {mixed} context context (window or first namespace)
|
||||||
* hidden next are all the arguments
|
* hidden next are all the arguments
|
||||||
* @return {mixed} Return values from functon
|
* @return {mixed} Return values from functon
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function executeFunctionByName(functionName, context /*, args */) // eslint-disable-line no-unused-vars
|
function executeFunctionByName(functionName, context /*, args */) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -395,6 +476,7 @@ function executeFunctionByName(functionName, context /*, args */) // eslint-disa
|
|||||||
* checks if a variable is an object
|
* checks if a variable is an object
|
||||||
* @param {Mixed} val possible object
|
* @param {Mixed} val possible object
|
||||||
* @return {Boolean} true/false if it is an object or not
|
* @return {Boolean} true/false if it is an object or not
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function isObject(val)
|
function isObject(val)
|
||||||
{
|
{
|
||||||
@@ -408,6 +490,7 @@ function isObject(val)
|
|||||||
* get the length of an object (entries)
|
* get the length of an object (entries)
|
||||||
* @param {Object} object object to check
|
* @param {Object} object object to check
|
||||||
* @return {Number} number of entry
|
* @return {Number} number of entry
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function getObjectCount(object)
|
function getObjectCount(object)
|
||||||
{
|
{
|
||||||
@@ -419,6 +502,7 @@ function getObjectCount(object)
|
|||||||
* @param {String} key key name
|
* @param {String} key key name
|
||||||
* @param {Object} object object to search key in
|
* @param {Object} object object to search key in
|
||||||
* @return {Boolean} true/false if key exists in object
|
* @return {Boolean} true/false if key exists in object
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function keyInObject(key, object)
|
function keyInObject(key, object)
|
||||||
{
|
{
|
||||||
@@ -430,6 +514,7 @@ function keyInObject(key, object)
|
|||||||
* @param {Object} object object to search value in
|
* @param {Object} object object to search value in
|
||||||
* @param {Mixed} value any value (String, Number, etc)
|
* @param {Mixed} value any value (String, Number, etc)
|
||||||
* @return {String} the key found for the first matching value
|
* @return {String} the key found for the first matching value
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function getKeyByValue(object, value) // eslint-disable-line no-unused-vars
|
function getKeyByValue(object, value) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -444,6 +529,7 @@ function getKeyByValue(object, value) // eslint-disable-line no-unused-vars
|
|||||||
* @param {Object} object object to search value in
|
* @param {Object} object object to search value in
|
||||||
* @param {Mixed} value any value (String, Number, etc)
|
* @param {Mixed} value any value (String, Number, etc)
|
||||||
* @return {Boolean} true on value found, false on not found
|
* @return {Boolean} true on value found, false on not found
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function valueInObject(object, value) // eslint-disable-line no-unused-vars
|
function valueInObject(object, value) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -459,6 +545,7 @@ function valueInObject(object, value) // eslint-disable-line no-unused-vars
|
|||||||
* or if JSON.parse(JSON.stringify(obj)) is failing
|
* or if JSON.parse(JSON.stringify(obj)) is failing
|
||||||
* @param {Object} inObject Object to copy
|
* @param {Object} inObject Object to copy
|
||||||
* @return {Object} Copied Object
|
* @return {Object} Copied Object
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function deepCopyFunction(inObject)
|
function deepCopyFunction(inObject)
|
||||||
{
|
{
|
||||||
@@ -482,6 +569,7 @@ function deepCopyFunction(inObject)
|
|||||||
* checks if a DOM element actually exists
|
* checks if a DOM element actually exists
|
||||||
* @param {String} id Element id to check for
|
* @param {String} id Element id to check for
|
||||||
* @return {Boolean} true if element exists, false on failure
|
* @return {Boolean} true if element exists, false on failure
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function exists(id)
|
function exists(id)
|
||||||
{
|
{
|
||||||
@@ -493,6 +581,7 @@ function exists(id)
|
|||||||
* currently precision is fixed, if dynamic needs check for max/min precision
|
* currently precision is fixed, if dynamic needs check for max/min precision
|
||||||
* @param {Number} bytes bytes in int
|
* @param {Number} bytes bytes in int
|
||||||
* @return {String} string in GB/MB/KB
|
* @return {String} string in GB/MB/KB
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function formatBytes(bytes) // eslint-disable-line no-unused-vars
|
function formatBytes(bytes) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -509,6 +598,7 @@ function formatBytes(bytes) // eslint-disable-line no-unused-vars
|
|||||||
* like formatBytes, but returns bytes for <1KB and not 0.n KB
|
* like formatBytes, but returns bytes for <1KB and not 0.n KB
|
||||||
* @param {Number} bytes bytes in int
|
* @param {Number} bytes bytes in int
|
||||||
* @return {String} string in GB/MB/KB
|
* @return {String} string in GB/MB/KB
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function formatBytesLong(bytes) // eslint-disable-line no-unused-vars
|
function formatBytesLong(bytes) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -521,6 +611,7 @@ function formatBytesLong(bytes) // eslint-disable-line no-unused-vars
|
|||||||
* Convert a string with B/K/M/etc into a byte number
|
* Convert a string with B/K/M/etc into a byte number
|
||||||
* @param {String|Number} bytes Any string with B/K/M/etc
|
* @param {String|Number} bytes Any string with B/K/M/etc
|
||||||
* @return {String|Number} A byte number, or original string as is
|
* @return {String|Number} A byte number, or original string as is
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function stringByteFormat(bytes) // eslint-disable-line no-unused-vars
|
function stringByteFormat(bytes) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -551,6 +642,7 @@ function stringByteFormat(bytes) // eslint-disable-line no-unused-vars
|
|||||||
/**
|
/**
|
||||||
* prints out error messages based on data available from the browser
|
* prints out error messages based on data available from the browser
|
||||||
* @param {Object} err error from try/catch block
|
* @param {Object} err error from try/catch block
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function errorCatch(err)
|
function errorCatch(err)
|
||||||
{
|
{
|
||||||
@@ -594,6 +686,7 @@ function errorCatch(err)
|
|||||||
* @param {String} loc location name for action indicator
|
* @param {String} loc location name for action indicator
|
||||||
* default empty. for console.log
|
* default empty. for console.log
|
||||||
* @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block
|
* @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function actionIndicator(loc, overlay = true) // eslint-disable-line no-unused-vars
|
function actionIndicator(loc, overlay = true) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -610,6 +703,7 @@ function actionIndicator(loc, overlay = true) // eslint-disable-line no-unused-v
|
|||||||
* @param {String} loc location name for action indicator
|
* @param {String} loc location name for action indicator
|
||||||
* default empty. for console.log
|
* default empty. for console.log
|
||||||
* @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block
|
* @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function actionIndicatorShow(loc, overlay = true)
|
function actionIndicatorShow(loc, overlay = true)
|
||||||
{
|
{
|
||||||
@@ -632,6 +726,7 @@ function actionIndicatorShow(loc, overlay = true)
|
|||||||
* @param {String} loc location name for action indicator
|
* @param {String} loc location name for action indicator
|
||||||
* default empty. for console.log
|
* default empty. for console.log
|
||||||
* @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block
|
* @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function actionIndicatorHide(loc, overlay = true)
|
function actionIndicatorHide(loc, overlay = true)
|
||||||
{
|
{
|
||||||
@@ -644,6 +739,7 @@ function actionIndicatorHide(loc, overlay = true)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* shows the overlay box or if already visible, bumps the zIndex to 100
|
* shows the overlay box or if already visible, bumps the zIndex to 100
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function overlayBoxShow()
|
function overlayBoxShow()
|
||||||
{
|
{
|
||||||
@@ -658,6 +754,7 @@ function overlayBoxShow()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* hides the overlay box or if zIndex is 100 bumps it down to previous level
|
* hides the overlay box or if zIndex is 100 bumps it down to previous level
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function overlayBoxHide()
|
function overlayBoxHide()
|
||||||
{
|
{
|
||||||
@@ -671,6 +768,7 @@ function overlayBoxHide()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* position the overlay block box and shows it
|
* position the overlay block box and shows it
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function setOverlayBox() // eslint-disable-line no-unused-vars
|
function setOverlayBox() // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -681,6 +779,7 @@ function setOverlayBox() // eslint-disable-line no-unused-vars
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* opposite of set, always hides overlay box
|
* opposite of set, always hides overlay box
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function hideOverlayBox() // eslint-disable-line no-unused-vars
|
function hideOverlayBox() // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -691,6 +790,7 @@ function hideOverlayBox() // eslint-disable-line no-unused-vars
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* the abort call, clears the action box and hides it and the overlay box
|
* the abort call, clears the action box and hides it and the overlay box
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function ClearCall() // eslint-disable-line no-unused-vars
|
function ClearCall() // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -712,6 +812,7 @@ function ClearCall() // eslint-disable-line no-unused-vars
|
|||||||
* zIndex of 1000
|
* zIndex of 1000
|
||||||
* - indicator is page centered
|
* - indicator is page centered
|
||||||
* @param {String} loc ID string, only used for console log
|
* @param {String} loc ID string, only used for console log
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function showActionIndicator(loc) // eslint-disable-line no-unused-vars
|
function showActionIndicator(loc) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -750,6 +851,7 @@ function showActionIndicator(loc) // eslint-disable-line no-unused-vars
|
|||||||
* the overlayBox is not hidden but the zIndex
|
* the overlayBox is not hidden but the zIndex
|
||||||
* is set to this value
|
* is set to this value
|
||||||
* @param {String} loc ID string, only used for console log
|
* @param {String} loc ID string, only used for console log
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function hideActionIndicator(loc) // eslint-disable-line no-unused-vars
|
function hideActionIndicator(loc) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -773,6 +875,7 @@ function hideActionIndicator(loc) // eslint-disable-line no-unused-vars
|
|||||||
/**
|
/**
|
||||||
* checks if overlayBox exists, if not it is
|
* checks if overlayBox exists, if not it is
|
||||||
* added as hidden item at the body end
|
* added as hidden item at the body end
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function checkOverlayExists()
|
function checkOverlayExists()
|
||||||
{
|
{
|
||||||
@@ -790,6 +893,7 @@ function checkOverlayExists()
|
|||||||
* if not visible show and set zIndex to 10 (GL_OB_BASE)
|
* if not visible show and set zIndex to 10 (GL_OB_BASE)
|
||||||
* if visible, add +1 to the GL_OB_S variable and
|
* if visible, add +1 to the GL_OB_S variable and
|
||||||
* up zIndex by this value
|
* up zIndex by this value
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function showOverlayBoxLayers(el_id) // eslint-disable-line no-unused-vars
|
function showOverlayBoxLayers(el_id) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -822,6 +926,7 @@ function showOverlayBoxLayers(el_id) // eslint-disable-line no-unused-vars
|
|||||||
* and set zIndex and GL_OB_S to 0
|
* and set zIndex and GL_OB_S to 0
|
||||||
* else just set zIndex to the new GL_OB_S value
|
* else just set zIndex to the new GL_OB_S value
|
||||||
* @param {String} el_id Target to hide layer
|
* @param {String} el_id Target to hide layer
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function hideOverlayBoxLayers(el_id='')
|
function hideOverlayBoxLayers(el_id='')
|
||||||
{
|
{
|
||||||
@@ -847,6 +952,7 @@ function hideOverlayBoxLayers(el_id='')
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* only for single action box
|
* only for single action box
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function clearCallActionBox() // eslint-disable-line no-unused-vars
|
function clearCallActionBox() // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -864,6 +970,7 @@ function clearCallActionBox() // eslint-disable-line no-unused-vars
|
|||||||
* @param {Array} [css=[]] array for css tags
|
* @param {Array} [css=[]] array for css tags
|
||||||
* @param {Object} [options={}] anything else (value, placeholder, OnClick, style)
|
* @param {Object} [options={}] anything else (value, placeholder, OnClick, style)
|
||||||
* @return {Object} created element as an object
|
* @return {Object} created element as an object
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function cel(tag, id = '', content = '', css = [], options = {})
|
function cel(tag, id = '', content = '', css = [], options = {})
|
||||||
{
|
{
|
||||||
@@ -884,6 +991,7 @@ function cel(tag, id = '', content = '', css = [], options = {})
|
|||||||
* @param {Object} attach the object to be attached
|
* @param {Object} attach the object to be attached
|
||||||
* @param {String} [id=''] optional id, if given search in base for this id and attach there
|
* @param {String} [id=''] optional id, if given search in base for this id and attach there
|
||||||
* @return {Object} "none", technically there is no return needed as it is global attach
|
* @return {Object} "none", technically there is no return needed as it is global attach
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function ael(base, attach, id = '')
|
function ael(base, attach, id = '')
|
||||||
{
|
{
|
||||||
@@ -914,6 +1022,7 @@ function ael(base, attach, id = '')
|
|||||||
* @param {Object} base object to where we attach the elements
|
* @param {Object} base object to where we attach the elements
|
||||||
* @param {...Object} attach attach 1..n: attach directly to the base element those attachments
|
* @param {...Object} attach attach 1..n: attach directly to the base element those attachments
|
||||||
* @return {Object} "none", technically there is no return needed, global attach
|
* @return {Object} "none", technically there is no return needed, global attach
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function aelx(base, ...attach)
|
function aelx(base, ...attach)
|
||||||
{
|
{
|
||||||
@@ -930,6 +1039,7 @@ function aelx(base, ...attach)
|
|||||||
* @param {Object} base object to where we attach the elements
|
* @param {Object} base object to where we attach the elements
|
||||||
* @param {Array} attach array of objects to attach
|
* @param {Array} attach array of objects to attach
|
||||||
* @return {Object} "none", technically there is no return needed, global attach
|
* @return {Object} "none", technically there is no return needed, global attach
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function aelxar(base, attach) // eslint-disable-line no-unused-vars
|
function aelxar(base, attach) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -944,6 +1054,7 @@ function aelxar(base, attach) // eslint-disable-line no-unused-vars
|
|||||||
* resets the sub elements of the base element given
|
* resets the sub elements of the base element given
|
||||||
* @param {Object} base cel created element
|
* @param {Object} base cel created element
|
||||||
* @return {Object} returns reset base element
|
* @return {Object} returns reset base element
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function rel(base) // eslint-disable-line no-unused-vars
|
function rel(base) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -956,6 +1067,7 @@ function rel(base) // eslint-disable-line no-unused-vars
|
|||||||
* @param {Object} _element element to work one
|
* @param {Object} _element element to work one
|
||||||
* @param {String} css style sheet to remove (name)
|
* @param {String} css style sheet to remove (name)
|
||||||
* @return {Object} returns full element
|
* @return {Object} returns full element
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function rcssel(_element, css)
|
function rcssel(_element, css)
|
||||||
{
|
{
|
||||||
@@ -971,6 +1083,7 @@ function rcssel(_element, css)
|
|||||||
* @param {Object} _element element to work on
|
* @param {Object} _element element to work on
|
||||||
* @param {String} css style sheet to add (name)
|
* @param {String} css style sheet to add (name)
|
||||||
* @return {Object} returns full element
|
* @return {Object} returns full element
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function acssel(_element, css)
|
function acssel(_element, css)
|
||||||
{
|
{
|
||||||
@@ -988,6 +1101,7 @@ function acssel(_element, css)
|
|||||||
* @param {String} rcss style to remove (name)
|
* @param {String} rcss style to remove (name)
|
||||||
* @param {String} acss style to add (name)
|
* @param {String} acss style to add (name)
|
||||||
* @return {Object} returns full element
|
* @return {Object} returns full element
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function scssel(_element, rcss, acss) // eslint-disable-line no-unused-vars
|
function scssel(_element, rcss, acss) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -1000,6 +1114,7 @@ function scssel(_element, rcss, acss) // eslint-disable-line no-unused-vars
|
|||||||
* that can be inserted into the page
|
* that can be inserted into the page
|
||||||
* @param {Object} tree object tree with dom element declarations
|
* @param {Object} tree object tree with dom element declarations
|
||||||
* @return {String} HTML string that can be used as innerHTML
|
* @return {String} HTML string that can be used as innerHTML
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function phfo(tree)
|
function phfo(tree)
|
||||||
{
|
{
|
||||||
@@ -1106,6 +1221,7 @@ function phfo(tree)
|
|||||||
* Is like tree.sub call
|
* Is like tree.sub call
|
||||||
* @param {Array} list Array of cel created objects
|
* @param {Array} list Array of cel created objects
|
||||||
* @return {String} HTML String
|
* @return {String} HTML String
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function phfa(list) // eslint-disable-line no-unused-vars
|
function phfa(list) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -1132,6 +1248,7 @@ function phfa(list) // eslint-disable-line no-unused-vars
|
|||||||
* @param {String} [sort=''] if empty as is, else allowed 'keys',
|
* @param {String} [sort=''] if empty as is, else allowed 'keys',
|
||||||
* 'values' all others are ignored
|
* 'values' all others are ignored
|
||||||
* @return {String} html with build options block
|
* @return {String} html with build options block
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function html_options(name, data, selected = '', options_only = false, return_string = false, sort = '') // eslint-disable-line no-unused-vars
|
function html_options(name, data, selected = '', options_only = false, return_string = false, sort = '') // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -1159,6 +1276,7 @@ function html_options(name, data, selected = '', options_only = false, return_st
|
|||||||
* 'values' all others are ignored
|
* 'values' all others are ignored
|
||||||
* @param {String} [onchange=''] onchange trigger call, default unset
|
* @param {String} [onchange=''] onchange trigger call, default unset
|
||||||
* @return {String} html with build options block
|
* @return {String} html with build options block
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function html_options_block(
|
function html_options_block(
|
||||||
name, data, selected = '', multiple = 0, options_only = false, return_string = false, sort = '', onchange = ''
|
name, data, selected = '', multiple = 0, options_only = false, return_string = false, sort = '', onchange = ''
|
||||||
@@ -1241,6 +1359,7 @@ function html_options_block(
|
|||||||
* @param {String} name name/id
|
* @param {String} name name/id
|
||||||
* @param {Object} data array of options
|
* @param {Object} data array of options
|
||||||
* @param {String} [sort=''] if empty as is, else allowed 'keys', 'values'
|
* @param {String} [sort=''] if empty as is, else allowed 'keys', 'values'
|
||||||
|
* @deprecated use utils.js
|
||||||
* all others are ignored
|
* all others are ignored
|
||||||
*/
|
*/
|
||||||
function html_options_refill(name, data, sort = '') // eslint-disable-line no-unused-vars
|
function html_options_refill(name, data, sort = '') // eslint-disable-line no-unused-vars
|
||||||
@@ -1289,6 +1408,7 @@ function html_options_refill(name, data, sort = '') // eslint-disable-line no-un
|
|||||||
* @param {String} [return_key=''] if set only returns this key entry
|
* @param {String} [return_key=''] if set only returns this key entry
|
||||||
* or empty for none
|
* or empty for none
|
||||||
* @return {Object|String} parameter entry list
|
* @return {Object|String} parameter entry list
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function parseQueryString(query = '', return_key = '') // eslint-disable-line no-unused-vars
|
function parseQueryString(query = '', return_key = '') // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -1343,6 +1463,7 @@ function parseQueryString(query = '', return_key = '') // eslint-disable-line no
|
|||||||
* @return {Object|Array|String} if search is empty, object, if search is set
|
* @return {Object|Array|String} if search is empty, object, if search is set
|
||||||
* and only one entry, then string, else array
|
* and only one entry, then string, else array
|
||||||
* unless single is true
|
* unless single is true
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function getQueryStringParam(search = '', query = '', single = false) // eslint-disable-line no-unused-vars
|
function getQueryStringParam(search = '', query = '', single = false) // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -1380,6 +1501,7 @@ function getQueryStringParam(search = '', query = '', single = false) // eslint-
|
|||||||
// *** MASTER logout call
|
// *** MASTER logout call
|
||||||
/**
|
/**
|
||||||
* submits basic data for form logout
|
* submits basic data for form logout
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function loginLogout() // eslint-disable-line no-unused-vars
|
function loginLogout() // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -1400,6 +1522,7 @@ function loginLogout() // eslint-disable-line no-unused-vars
|
|||||||
* @param {String} [header_id='mainHeader'] the target for the main element block
|
* @param {String} [header_id='mainHeader'] the target for the main element block
|
||||||
* if not set mainHeader is assumed
|
* if not set mainHeader is assumed
|
||||||
* this is the target div for the "loginRow"
|
* this is the target div for the "loginRow"
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function createLoginRow(login_string, header_id = 'mainHeader') // eslint-disable-line no-unused-vars
|
function createLoginRow(login_string, header_id = 'mainHeader') // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
@@ -1435,6 +1558,7 @@ function createLoginRow(login_string, header_id = 'mainHeader') // eslint-disabl
|
|||||||
* @param {String} [header_id='mainHeader'] the target for the main element block
|
* @param {String} [header_id='mainHeader'] the target for the main element block
|
||||||
* if not set mainHeader is assumed
|
* if not set mainHeader is assumed
|
||||||
* this is the target div for the "menuRow"
|
* this is the target div for the "menuRow"
|
||||||
|
* @deprecated use utils.js
|
||||||
*/
|
*/
|
||||||
function createNavMenu(nav_menu, header_id = 'mainHeader') // eslint-disable-line no-unused-vars
|
function createNavMenu(nav_menu, header_id = 'mainHeader') // eslint-disable-line no-unused-vars
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
/* general edit javascript */
|
/*
|
||||||
/* prototype version */
|
general edit javascript
|
||||||
|
prototype version
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @deprecated Do not use this anymore, use utils.js */
|
||||||
|
|
||||||
|
throw new Error("Prototype Support is deprected, please switch to jquery and utils.js/utils.min.js");
|
||||||
|
|
||||||
/* jshint esversion: 6 */
|
/* jshint esversion: 6 */
|
||||||
|
|
||||||
@@ -25,7 +31,7 @@ function pop(theURL, winName, features) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* automatically resize a text area based on the amount of lines in it
|
* automatically resize a text area based on the amount of lines in it
|
||||||
* @param {[string} ta_id element id
|
* @param {string} ta_id element id
|
||||||
*/
|
*/
|
||||||
function expandTA(ta_id) {
|
function expandTA(ta_id) {
|
||||||
var ta;
|
var ta;
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
var i18n = {
|
||||||
|
"Original": "Translated"
|
||||||
|
};
|
||||||
|
|
||||||
|
// __END__
|
||||||
File diff suppressed because it is too large.
Load diff
+3
@@ -0,0 +1,3 @@
|
|||||||
|
function errorCatch(err){err.stack?err.lineNumber?console.error("ERROR[%s:%s] ",err.name,err.lineNumber,err):err.line?console.error("ERROR[%s:%s] ",err.name,err.line,err):console.error("ERROR[%s] ",err.name,err):err.number?(console.error("ERROR[%s:%s] %s",err.name,err.number,err.message),console.error("ERROR[description] %s",err.description)):console.error("ERROR[%s] %s",err.name,err.message)}function isFunction(name){return typeof window[name]<"u"&&typeof window[name]=="function"}function executeFunctionByName(functionName,context){var args=Array.prototype.slice.call(arguments,2),namespaces=functionName.split("."),func=namespaces.pop();if(func==null)throw new Error("Cannot get function from namespaces: "+functionName);for(var i=0;i<namespaces.length;i++)context=context[namespaces[i]];return context[func].apply(context,args)}function isObject(val){return val===null?!1:typeof val=="function"||typeof val=="object"}function getObjectCount(object){return isObject(object)?Object.keys(object).length:-1}function keyInObject(key,object){return objectKeyExists(object,key)}function objectKeyExists(object,key){return!!Object.prototype.hasOwnProperty.call(object,key)}function getKeyByValue(object,value){return Object.keys(object).find(key=>object[key]===value)??""}function valueInObject(object,value){return objectValueExists(object,value)}function objectValueExists(object,value){return!!Object.keys(object).find(key=>object[key]===value)}function deepCopyFunction(inObject){var outObject,value,key;if(typeof inObject!="object"||inObject===null)return inObject;outObject=Array.isArray(inObject)?[]:{};for(key in inObject)value=inObject[key],outObject[key]=deepCopyFunction(value);return outObject}function loadEl(el_id){let el=document.getElementById(el_id);if(el===null)throw new Error("Cannot find: "+el_id);return el}function pop(theURL,winName,features){let __winName=window.open(theURL,winName,features);__winName?.focus()}function expandTA(ta_id){let ta=this.loadEl(ta_id);if(ta instanceof HTMLElement&&ta.getAttribute("type")!=="textarea")throw new Error("Element is not a textarea: "+ta_id);let maxChars=parseInt(ta.getAttribute("cols")??"0"),ta_value=ta.getAttribute("value"),theRows=[];ta_value!=null&&(theRows=ta_value.split(`
|
||||||
|
`));for(var numNewRows=0,i=0;i<theRows.length;i++)theRows[i].length+2>maxChars&&(numNewRows+=Math.ceil((theRows[i].length+2)/maxChars));ta.setAttribute("row",(numNewRows+theRows.length).toString())}function exists(id){return $("#"+id).length>0}var HtmlElementCreator=class{cel(tag,id="",content="",css=[],options={}){return{tag,id,name:options.name,content,css,options,sub:[]}}ael(base,attach,id=""){if(id){if(base.id==id)base.sub.push(deepCopyFunction(attach));else if(isObject(base.sub)&&base.sub.length>0)for(var i=0;i<base.sub.length;i++)this.ael(base.sub[i],attach,id)}else base.sub.push(deepCopyFunction(attach));return base}aelx(base,...attach){for(var i=0;i<attach.length;i++)base.sub.push(deepCopyFunction(attach[i]));return base}aelxar(base,attach){for(var i=0;i<attach.length;i++)base.sub.push(deepCopyFunction(attach[i]));return base}rel(base){return base.sub=[],base}rcssel(_element,css){var css_index=_element.css.indexOf(css);return css_index>-1&&_element.css.splice(css_index,1),_element}acssel(_element,css){var css_index=_element.css.indexOf(css);return css_index==-1&&_element.css.push(css),_element}scssel(_element,rcss,acss){return this.rcssel(_element,rcss),this.acssel(_element,acss),_element}phfo(tree){let name_elements=["button","fieldset","form","iframe","input","map","meta","object","output","param","select","textarea"],skip_options=["id","name","class"],no_close=["input","br","img","hr","area","col","keygen","wbr","track","source","param","command","base","meta","link","embed"];var content=[],line="<"+tree.tag,i;if(tree.id&&(line+=' id="'+tree.id+'"',name_elements.includes(tree.tag)&&(line+=' name="'+(tree.name?tree.name:tree.id)+'"')),isObject(tree.css)&&tree.css.length>0){for(line+=' class="',i=0;i<tree.css.length;i++)line+=tree.css[i]+" ";line=line.slice(0,-1),line+='"'}if(isObject(tree.options))for(let[key,item]of Object.entries(tree.options))skip_options.includes(key)||(line+=" "+key+'="'+item+'"');if(line+=">",content.push(line),isObject(tree.sub)&&tree.sub.length>0)for(tree.content&&content.push(tree.content),i=0;i<tree.sub.length;i++)content.push(this.phfo(tree.sub[i]));else tree.content&&content.push(tree.content);return no_close.includes(tree.tag)||content.push("</"+tree.tag+">"),content.join("")}phfa(list){for(var content=[],i=0;i<list.length;i++)content.push(this.phfo(list[i]));return content.join("")}};var dom=new HtmlElementCreator;function escapeHtml(string){return string.replace(/[&<>"'/]/g,function(s){var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return entityMap[s]})}function unescapeHtml(string){return string.replace(/&[#\w]+;/g,function(s){var entityMap={"&":"&","<":"<",">":">",""":'"',"'":"'","/":"/"};return entityMap[s]})}function html_options(name,data,selected="",options_only=!1,return_string=!1,sort=""){return this.html_options_block(name,data,selected,0,options_only,return_string,sort)}function html_options_block(name,data,selected="",multiple=0,options_only=!1,return_string=!1,sort="",onchange=""){var content=[],element_select,select_options={},element_option,data_list=[],value,options={};multiple>0&&(select_options.multiple="",multiple>1&&(select_options.size=multiple)),onchange&&(select_options.OnChange=onchange),element_select=dom.cel("select",name,"",[],select_options),sort=="keys"?data_list=Object.keys(data).sort():sort=="values"?data_list=Object.keys(data).sort((a,b)=>(""+data[a]).localeCompare(data[b])):data_list=Object.keys(data);for(let key of data_list)value=data[key],options={label:value,value:key,selected:""},multiple==0&&!Array.isArray(selected)&&selected==key&&(options.selected=""),multiple==1&&Array.isArray(selected)&&selected.indexOf(key)!=-1&&(options.selected=""),element_option=dom.cel("option","",value,[],options),dom.ael(element_select,element_option);if(options_only)if(return_string){for(var i=0;i<element_select.sub.length;i++)content.push(dom.phfo(element_select.sub[i]));return content.join("")}else return element_select.sub;else return return_string?(content.push(dom.phfo(element_select)),content.join("")):element_select}function html_options_refill(name,data,sort=""){var element_option,option_selected,data_list=[],value;if(document.getElementById(name)){sort=="keys"?data_list=Object.keys(data).sort():sort=="values"?data_list=Object.keys(data).sort((a,b)=>(""+data[a]).localeCompare(data[b])):data_list=Object.keys(data),[].forEach.call(document.querySelectorAll("#"+name+" :checked"),function(elm){option_selected=elm.value}),loadEl(name).innerHTML="";for(let key of data_list)value=data[key],element_option=document.createElement("option"),element_option.label=value,element_option.value=key,element_option.innerHTML=value,key==option_selected&&(element_option.selected=!0),loadEl(name).appendChild(element_option)}}function dec2hex(dec){return("0x"+dec.toString(16)).substring(-2)}function getRandomIntInclusive(min,max){return min=Math.ceil(min),max=Math.floor(max),Math.floor(Math.random()*(
Line truncated
|
||||||
|
//# sourceMappingURL=utils.min.js.map
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"sources": ["../../../src/utils/JavaScriptHelpers.mjs", "../../../src/utils/DomHelpers.mjs", "../../../src/utils/HtmlElementCreator.mjs", "../../../src/utils/HtmlHelpers.mjs", "../../../src/utils/MathHelpers.mjs", "../../../src/utils/StringHelpers.mjs", "../../../src/utils/DateTimeHelpers.mjs", "../../../src/utils/UniqIdGenerators.mjs", "../../../src/utils/ResizingAndMove.mjs", "../../../src/utils/FormatBytes.mjs", "../../../src/utils/UrlParser.mjs", "../../../src/utils/LoginLogout.mjs", "../../../src/utils/ActionIndicatorOverlayBox.mjs", "../../../src/utils/l10nTranslation.mjs", "../../../src/utils/ActionBox.mjs", "../../../src/utils/LoginNavMenu.mjs", "../../../src/utils.mjs"],
|
||||||
|
"sourcesContent": ["/*\nDescription: JavaScript Helpers\nDate: 2025//3/6\nCreator: Clemens Schwaighofer\n*/\n\nexport {\n\terrorCatch, isFunction, executeFunctionByName,\n\tisObject, getObjectCount,\n\tkeyInObject, objectKeyExists,\n\tgetKeyByValue, valueInObject, objectValueExists,\n\tdeepCopyFunction\n};\n\n/**\n * prints out error messages based on data available from the browser\n * @param {Object} err error from try/catch block\n */\nfunction errorCatch(err)\n{\n\t// for FF & Chrome\n\tif (err.stack) {\n\t\t// only FF\n\t\tif (err.lineNumber) {\n\t\t\tconsole.error('ERROR[%s:%s] ', err.name, err.lineNumber, err);\n\t\t} else if (err.line) {\n\t\t\t// only Safari\n\t\t\tconsole.error('ERROR[%s:%s] ', err.name, err.line, err);\n\t\t} else {\n\t\t\tconsole.error('ERROR[%s] ', err.name, err);\n\t\t}\n\t} else if (err.number) {\n\t\t// IE\n\t\tconsole.error('ERROR[%s:%s] %s', err.name, err.number, err.message);\n\t\tconsole.error('ERROR[description] %s', err.description);\n\t} else {\n\t\t// the rest\n\t\tconsole.error('ERROR[%s] %s', err.name, err.message);\n\t}\n}\n\n/**\n * check if name is a function\n * @param {string} name Name of function to check if exists\n * @return {Boolean} true/false\n */\nfunction isFunction(name)\n{\n\tif (typeof window[name] !== 'undefined' &&\n\t\ttypeof window[name] === 'function') {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}\n\n/**\n * call a function by its string name\n * https://stackoverflow.com/a/359910\n * example: executeFunctionByName(\"My.Namespace.functionName\", window, arguments);\n * @param {string} functionName The function name or namespace + function\n * @param {any} context context (window or first namespace)\n * hidden next are all the arguments\n * @return {any} Return values from functon\n */\nfunction executeFunctionByName(functionName, context /*, args */)\n{\n\tvar args = Array.prototype.slice.call(arguments, 2);\n\tvar namespaces = functionName.split('.');\n\tvar func = namespaces.pop();\n\tif (func == undefined) {\n\t\tthrow new Error(\"Cannot get function from namespaces: \" + functionName);\n\t}\n\tfor (var i = 0; i < namespaces.length; i++) {\n\t\tcontext = context[namespaces[i]];\n\t}\n\treturn context[func].apply(context, args);\n}\n\n/**\n * checks if a variable is an object\n * @param {any} val possible object\n * @return {Boolean} true/false if it is an object or not\n */\nfunction isObject(val)\n{\n\tif (val === null) {\n\t\treturn false;\n\t}\n\treturn ((typeof val === 'function') || (typeof val === 'object'));\n}\n\n/**\n * get the length of an object (entries)\n * @param {Object} object object to check\n * @return {Number} number of entry, or -1 if not object\n */\nfunction getObjectCount(object)\n{\n\tif (!isObject(object)) {\n\t\treturn -1;\n\t}\n\treturn Object.keys(object).length;\n}\n\n/**\n * checks if a key exists in a given object\n * @param {String} key key name\n * @param {Object} object object to search key in\n * @return {Boolean} true/false if key exists in object\n * @deprecated Use objectKeyExists\n */\nfunction keyInObject(key, object)\n{\n\treturn objectKeyExists(object, key);\n}\n\n/**\n * This is the correct order and will superseed keyInObject\n * @param {Object} object object to search key in\n * @param {String} key key name\n * @returns {Boolean} true/false if key exists in object\n */\nfunction objectKeyExists(object, key)\n{\n\treturn Object.prototype.hasOwnProperty.call(object, key) ? true : false;\n}\n\n/**\n * returns matching key of value\n * @param {Object} object object to search value in\n * @param {any} value any value (String, Number, etc)\n * @return {String} the key found for the first matching value\n */\nfunction getKeyByValue(object, value)\n{\n\treturn Object.keys(object).find(key => object[key] === value) ?? '';\n}\n\n/**\n * returns true if value is found in object with a key\n * @param {Object} object object to search value in\n * @param {any} value any value (String, Number, etc)\n * @return {Boolean} true on value found, false on not found\n * @deprecated use objectValueExists\n */\nfunction valueInObject(object, value)\n{\n\treturn objectValueExists(object, value);\n}\n\n/**\n * returns true if value is found in object with a key\n * @param {Object} object object to search value in\n * @param {any} value any value (String, Number, etc)\n * @return {Boolean} true on value found, false on not found\n */\nfunction objectValueExists(object, value)\n{\n\treturn Object.keys(object).find(key => object[key] === value) ? true : false;\n}\n\n/**\n * true deep copy for Javascript objects\n * if Object.assign({}, obj) is not working (shallow)\n * or if JSON.parse(JSON.stringify(obj)) is failing\n * @param {Object} inObject Object to copy\n * @return {Object} Copied Object\n */\nfunction deepCopyFunction(inObject)\n{\n\tvar outObject, Line truncated
|
||||||
|
"mappings": "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 truncated
|
||||||
|
"names": ["i18n", "hec", "l10n", "hec", "l10n", "escapeHtml", "roundPrecision", "formatString", "unescapeHtml", "loadEl", "pop", "expandTA", "getWindowSize", "getScrollOffset", "getScrollOffsetOpener", "setCenter", "goToPos", "goTo", "numberWithCommas", "convertLBtoBR", "getTimestamp", "dec2hex", "generateId", "randomIdF", "getRandomIntInclusive", "isFunction", "executeFunctionByName", "isObject", "getObjectCount", "keyInObject", "getKeyByValue", "valueInObject", "deepCopyFunction", "exists", "formatBytes", "formatBytesLong", "stringByteFormat", "errorCatch", "actionIndicator", "actionIndicatorShow", "actionIndicatorHide", "overlayBoxShow", "overlayBoxHide", "setOverlayBox", "hideOverlayBox", "ClearCall", "html_options", "html_options_block", "html_options_refill", "parseQueryString", "getQueryStringParam", "loginLogout"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<head>
|
||||||
|
<title>JavaScript Test</title>
|
||||||
|
<script type="text/javascript" src="layout/javascript/jquery.min.js"></script>
|
||||||
|
<script type="text/javascript" src="layout/javascript/translateTest-ja_JP.UTF-8.js"></script>
|
||||||
|
<script type="text/javascript" src="layout/javascript/utils.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<h1>JavaScript tests</h1>
|
||||||
|
<div id="test-div">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<script languagae="JavaScript">
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
console.log('MAIN PAGE LOADED');
|
||||||
|
// console.log('Random: %o', mh.randomIdF());
|
||||||
|
console.log('Random: %o', randomIdF());
|
||||||
|
console.log("GW: %o", getWindowSize());
|
||||||
|
let bytes = 1021152;
|
||||||
|
console.log('FB: %o', formatBytes(bytes));
|
||||||
|
console.log('FBL: %o', formatBytesLong(bytes));
|
||||||
|
console.log('TR: %s', l10n.__('Original'));
|
||||||
|
console.log('TR: %s', l10n.__('Not exists'));
|
||||||
|
|
||||||
|
setCenter('test-div', true, true);
|
||||||
|
ClearCall();
|
||||||
|
overlayBoxShow();
|
||||||
|
actionIndicatorShow('testSmarty');
|
||||||
|
setTimeout(function() {
|
||||||
|
console.log('Waiting dummy ...');
|
||||||
|
actionIndicatorHide('testSmarty');
|
||||||
|
ClearCall();
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# target can be live, stage, test, dev
|
||||||
|
# this overrides the SITE set "location" entry
|
||||||
|
TARGET=
|
||||||
@@ -78,42 +78,11 @@ define('TEMPLATES_C', 'templates_c' . DIRECTORY_SEPARATOR);
|
|||||||
// template base
|
// template base
|
||||||
define('TEMPLATES', 'templates' . DIRECTORY_SEPARATOR);
|
define('TEMPLATES', 'templates' . DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
/************* HASH / ACL DEFAULT / ERROR SETTINGS / SMARTY *************/
|
/************* HASH / ACL DEFAULT *************/
|
||||||
// default hash type
|
// default hash type
|
||||||
define('DEFAULT_HASH', 'sha256');
|
define('DEFAULT_HASH', 'sha256');
|
||||||
// default acl level
|
// default acl level
|
||||||
define('DEFAULT_ACL_LEVEL', 80);
|
define('DEFAULT_ACL_LEVEL', $ENV['DEFAULT_ACL_LEVEL'] ?? 80);
|
||||||
// SSL host name
|
|
||||||
// define('SSL_HOST', $_ENV['SSL_HOST'] ?? '');
|
|
||||||
// error page strictness, Default is 3
|
|
||||||
// 1: only show error page as the last mesure if really no mid & aid can be loaded and found at all
|
|
||||||
// 2: if template not found, do not search, show error template
|
|
||||||
// 3: if default template is not found, show error template, do not fall back to default tree
|
|
||||||
// 4: very strict, even on normal fixable errors through error
|
|
||||||
// define('ERROR_STRICT', 3);
|
|
||||||
// allow page caching in general, set to 'false' if you do debugging or development!
|
|
||||||
// define('ALLOW_SMARTY_CACHE', false);
|
|
||||||
// cache life time, in second', default here is 2 days (172800s)
|
|
||||||
// -1 is never expire cache
|
|
||||||
// define('SMARTY_CACHE_LIFETIME', -1);
|
|
||||||
|
|
||||||
/************* LOGOUT ********************/
|
|
||||||
// logout target
|
|
||||||
define('LOGOUT_TARGET', '');
|
|
||||||
|
|
||||||
/************* AJAX / ACCESS *************/
|
|
||||||
// ajax request type
|
|
||||||
define('AJAX_REQUEST_TYPE', 'POST');
|
|
||||||
// what AJAX type to use
|
|
||||||
define('USE_PROTOTYPE', false);
|
|
||||||
define('USE_SCRIPTACULOUS', false);
|
|
||||||
define('USE_JQUERY', true);
|
|
||||||
|
|
||||||
/************* LAYOUT WIDTHS *************/
|
|
||||||
define('PAGE_WIDTH', '100%');
|
|
||||||
define('CONTENT_WIDTH', '100%');
|
|
||||||
// the default template name
|
|
||||||
define('MASTER_TEMPLATE_NAME', 'main_body.tpl');
|
|
||||||
|
|
||||||
/************* OVERALL CONTROL NAMES *************/
|
/************* OVERALL CONTROL NAMES *************/
|
||||||
// BELOW has HAS to be changed
|
// BELOW has HAS to be changed
|
||||||
@@ -136,24 +105,15 @@ define('COMPILE_ID', 'COMPILE_' . BASE_NAME . '_' . SERVER_NAME_HASH);
|
|||||||
|
|
||||||
/************* LANGUAGE / ENCODING *******/
|
/************* LANGUAGE / ENCODING *******/
|
||||||
// default lang + encoding
|
// default lang + encoding
|
||||||
define('DEFAULT_LOCALE', 'en_US.UTF-8');
|
define('DEFAULT_LOCALE', $_ENV['LOCALE'] ?? 'en_US.UTF-8');
|
||||||
// default web page encoding setting
|
// default web page encoding setting
|
||||||
define('DEFAULT_ENCODING', 'UTF-8');
|
define('DEFAULT_ENCODING', (string)array_pad(explode('.', DEFAULT_LOCALE, 2), 2, 'UTF-8')[1]);
|
||||||
|
|
||||||
/************* QUEUE TABLE *************/
|
/************* HOST NAME *****************/
|
||||||
// if we have a dev/live system
|
// get the name without the port
|
||||||
// set_live is a per page/per item
|
list($HOST_NAME) = array_pad(explode(':', $_SERVER['HTTP_HOST'], 2), 2, null);
|
||||||
// live_queue is a global queue system
|
// set HOST name
|
||||||
// define('QUEUE', 'live_queue');
|
define('HOST_NAME', $HOST_NAME);
|
||||||
|
|
||||||
/************* DB PATHS (PostgreSQL) *****************/
|
|
||||||
// schema names, can also be defined per <DB INFO>
|
|
||||||
define('PUBLIC_SCHEMA', 'public');
|
|
||||||
define('DEV_SCHEMA', 'public');
|
|
||||||
define('TEST_SCHEMA', 'public');
|
|
||||||
define('LIVE_SCHEMA', 'public');
|
|
||||||
define('GLOBAL_DB_SCHEMA', '');
|
|
||||||
define('LOGIN_DB_SCHEMA', '');
|
|
||||||
|
|
||||||
/************* CORE HOST SETTINGS *****************/
|
/************* CORE HOST SETTINGS *****************/
|
||||||
if (file_exists(BASE . CONFIGS . 'config.host.php')) {
|
if (file_exists(BASE . CONFIGS . 'config.host.php')) {
|
||||||
@@ -162,6 +122,14 @@ if (file_exists(BASE . CONFIGS . 'config.host.php')) {
|
|||||||
if (!isset($SITE_CONFIG)) {
|
if (!isset($SITE_CONFIG)) {
|
||||||
$SITE_CONFIG = [];
|
$SITE_CONFIG = [];
|
||||||
}
|
}
|
||||||
|
// BAIL ON MISSING MASTER SITE CONFIG
|
||||||
|
if (!isset($SITE_CONFIG[HOST_NAME]['location'])) {
|
||||||
|
throw new \InvalidArgumentException(
|
||||||
|
'Missing SITE_CONFIG entry for: "' . HOST_NAME . '". Contact Administrator'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// set target first
|
||||||
|
define('TARGET', $_ENV['TARGET'] ?? $SITE_CONFIG[HOST_NAME]['location'] ?? 'test');
|
||||||
/************* DB ACCESS *****************/
|
/************* DB ACCESS *****************/
|
||||||
if (file_exists(BASE . CONFIGS . 'config.db.php')) {
|
if (file_exists(BASE . CONFIGS . 'config.db.php')) {
|
||||||
require BASE . CONFIGS . 'config.db.php';
|
require BASE . CONFIGS . 'config.db.php';
|
||||||
@@ -175,18 +143,6 @@ if (file_exists(BASE . CONFIGS . 'config.path.php')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************* MASTER INIT *****************/
|
/************* MASTER INIT *****************/
|
||||||
// live frontend pages
|
|
||||||
// ** missing live domains **
|
|
||||||
// get the name without the port
|
|
||||||
[$HOST_NAME] = array_pad(explode(':', $_SERVER['HTTP_HOST'], 2), 2, null);
|
|
||||||
// set HOST name
|
|
||||||
define('HOST_NAME', $HOST_NAME);
|
|
||||||
// BAIL ON MISSING MASTER SITE CONFIG
|
|
||||||
if (!isset($SITE_CONFIG[HOST_NAME]['location'])) {
|
|
||||||
throw new \InvalidArgumentException(
|
|
||||||
'Missing SITE_CONFIG entry for: "' . HOST_NAME . '". Contact Administrator'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// BAIL ON MISSING DB CONFIG:
|
// BAIL ON MISSING DB CONFIG:
|
||||||
// we have either no db selction for this host but have db config entries
|
// we have either no db selction for this host but have db config entries
|
||||||
// or we have a db selection but no db config as array or empty
|
// or we have a db selection but no db config as array or empty
|
||||||
@@ -237,35 +193,31 @@ define('DB_CONFIG', $DB_CONFIG[DB_CONFIG_NAME] ?? [
|
|||||||
]);
|
]);
|
||||||
// because we can't change constant, but we want to for db debug flag
|
// because we can't change constant, but we want to for db debug flag
|
||||||
$GLOBALS['DB_CONFIG_SET'] = DB_CONFIG;
|
$GLOBALS['DB_CONFIG_SET'] = DB_CONFIG;
|
||||||
// define('DB_CONFIG_TARGET', SITE_CONFIG[$HOST_NAME]['db_host_target']);
|
|
||||||
// define('DB_CONFIG_OTHER', SITE_CONFIG[$HOST_NAME]['db_host_other']);
|
|
||||||
// override for login and global schemas
|
|
||||||
// where the edit* tables are
|
|
||||||
// define('LOGIN_DB_SCHEMA', PUBLIC_SCHEMA);
|
|
||||||
// where global tables are that are used by all schemas (eg queue tables for online, etc)
|
|
||||||
// define('GLOBAL_DB_SCHEMA', PUBLIC_SCHEMA);
|
|
||||||
// debug settings, site lang, etc
|
// debug settings, site lang, etc
|
||||||
define('TARGET', $SITE_CONFIG[HOST_NAME]['location'] ?? 'test');
|
|
||||||
define('DEBUG_LEVEL', $SITE_CONFIG[HOST_NAME]['debug_level'] ?? 'debug');
|
define('DEBUG_LEVEL', $SITE_CONFIG[HOST_NAME]['debug_level'] ?? 'debug');
|
||||||
define('SITE_LOCALE', $SITE_CONFIG[HOST_NAME]['site_locale'] ?? DEFAULT_LOCALE);
|
define('SITE_LOCALE', $SITE_CONFIG[HOST_NAME]['site_locale'] ?? DEFAULT_LOCALE);
|
||||||
define('SITE_DOMAIN', str_replace(DIRECTORY_SEPARATOR, '', CONTENT_PATH));
|
define('SITE_DOMAIN', str_replace(DIRECTORY_SEPARATOR, '', CONTENT_PATH));
|
||||||
define('SITE_ENCODING', $SITE_CONFIG[HOST_NAME]['site_encoding'] ?? DEFAULT_ENCODING);
|
define('SITE_ENCODING', $SITE_CONFIG[HOST_NAME]['site_encoding'] ?? DEFAULT_ENCODING);
|
||||||
define('LOGIN_ENABLED', $SITE_CONFIG[HOST_NAME]['login_enabled'] ?? false);
|
define('LOGIN_ENABLED', $SITE_CONFIG[HOST_NAME]['login_enabled'] ?? false);
|
||||||
define('AUTH', $SITE_CONFIG[HOST_NAME]['auth'] ?? false);
|
define('AUTH', $SITE_CONFIG[HOST_NAME]['auth'] ?? false);
|
||||||
// paths
|
|
||||||
// define('CSV_PATH', $PATHS[TARGET]['csv_path'] ?? '');
|
|
||||||
// define('EXPORT_SCRIPT', $PATHS[TARGET]['perl_bin'] ?? '');
|
|
||||||
// define('REDIRECT_URL', $PATHS[TARGET]['redirect_url'] ?? '');
|
|
||||||
|
|
||||||
|
// NOTE: everything below is smarty related and should be removed from here
|
||||||
/************* GENERAL PAGE TITLE ********/
|
/************* GENERAL PAGE TITLE ********/
|
||||||
define('G_TITLE', $_ENV['G_TITLE'] ?? '');
|
define('G_TITLE', $_ENV['G_TITLE'] ?? '');
|
||||||
|
/************* LAYOUT WIDTHS *************/
|
||||||
|
define('PAGE_WIDTH', $_ENV['SMARTY.PAGE_WIDTH'] ?? '100%');
|
||||||
|
define('CONTENT_WIDTH', $_ENV['SMARTY.CONTENT_WIDTH'] ?? '100%');
|
||||||
|
// the default template name
|
||||||
|
define('MASTER_TEMPLATE_NAME', $_ENV['MASTER_TEMPLATE_NAME'] ?? 'main_body.tpl');
|
||||||
|
/************* JS LIBRARIES *************/
|
||||||
|
define('USE_PROTOTYPE', false);
|
||||||
|
define('USE_SCRIPTACULOUS', false);
|
||||||
|
define('USE_JQUERY', true);
|
||||||
/************ STYLE SHEETS / JS **********/
|
/************ STYLE SHEETS / JS **********/
|
||||||
define('ADMIN_STYLESHEET', 'edit.css');
|
define('ADMIN_STYLESHEET', $_ENV['ADMIN.STYLESHEET'] ?? 'edit.css');
|
||||||
define('ADMIN_JAVASCRIPT', 'edit.js');
|
define('ADMIN_JAVASCRIPT', $_ENV['ADMIN.JAVASCRIPT'] ?? 'edit.js');
|
||||||
define('STYLESHEET', $_ENV['STYLESHEET'] ?? 'frontend.css');
|
define('STYLESHEET', $_ENV['STYLESHEET'] ?? 'frontend.css');
|
||||||
define('JAVASCRIPT', $_ENV['JAVASCRIPT'] ?? 'frontend.js');
|
define('JAVASCRIPT', $_ENV['JAVASCRIPT'] ?? 'frontend.js');
|
||||||
|
|
||||||
// anything optional
|
// anything optional
|
||||||
/************* INTERNAL ******************/
|
/************* INTERNAL ******************/
|
||||||
// any other global definitons in the config.other.php
|
// any other global definitons in the config.other.php
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ define('EDIT_BASE_STYLESHEET', 'edit.css');
|
|||||||
|
|
||||||
// define('SOME_ID', <SOME VALUE>);
|
// define('SOME_ID', <SOME VALUE>);
|
||||||
|
|
||||||
|
/************* QUEUE TABLE *************/
|
||||||
|
// if we have a dev/live system
|
||||||
|
// set_live is a per page/per item
|
||||||
|
// live_queue is a global queue system
|
||||||
|
// define('QUEUE', 'live_queue');
|
||||||
|
|
||||||
/************* CONVERT *******************/
|
/************* CONVERT *******************/
|
||||||
// this only needed if the external thumbnail create is used
|
// this only needed if the external thumbnail create is used
|
||||||
$paths = [
|
$paths = [
|
||||||
|
|||||||
@@ -35,4 +35,9 @@ define('CONTENT_PATH', $folder . DIRECTORY_SEPARATOR);
|
|||||||
],
|
],
|
||||||
];*/
|
];*/
|
||||||
|
|
||||||
|
// paths
|
||||||
|
// define('CSV_PATH', $PATHS[TARGET]['csv_path'] ?? '');
|
||||||
|
// define('EXPORT_SCRIPT', $PATHS[TARGET]['perl_bin'] ?? '');
|
||||||
|
// define('REDIRECT_URL', $PATHS[TARGET]['redirect_url'] ?? '');
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
@@ -53,6 +53,11 @@ for (
|
|||||||
\gullevek\dotEnv\DotEnv::readEnvFile(
|
\gullevek\dotEnv\DotEnv::readEnvFile(
|
||||||
$__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH
|
$__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH
|
||||||
);
|
);
|
||||||
|
// load target file if it exists
|
||||||
|
\gullevek\dotEnv\DotEnv::readEnvFile(
|
||||||
|
$__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH,
|
||||||
|
'.target'
|
||||||
|
);
|
||||||
// load master config file that loads all other config files
|
// load master config file that loads all other config files
|
||||||
require $__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php';
|
require $__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php';
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -423,14 +423,9 @@ class Login
|
|||||||
|
|
||||||
// LOGOUT TARGET
|
// LOGOUT TARGET
|
||||||
if (!isset($options['logout_target'])) {
|
if (!isset($options['logout_target'])) {
|
||||||
if (defined('LOGOUT_TARGET')) {
|
// defaults to ''
|
||||||
trigger_error(
|
$options['logout_target'] = '';
|
||||||
'loginMainCall: LOGOUT_TARGET should not be used',
|
$this->logout_target = $options['logout_target'];
|
||||||
E_USER_DEPRECATED
|
|
||||||
);
|
|
||||||
$options['logout_target'] = LOGOUT_TARGET;
|
|
||||||
$this->logout_target = $options['logout_target'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// *** PASSWORD SETTINGS
|
// *** PASSWORD SETTINGS
|
||||||
|
|||||||
@@ -103,11 +103,7 @@ class Basic
|
|||||||
'VIDEOS', 'DOCUMENTS', 'PDFS', 'BINARIES', 'ICONS', 'UPLOADS', 'CSV', 'JS',
|
'VIDEOS', 'DOCUMENTS', 'PDFS', 'BINARIES', 'ICONS', 'UPLOADS', 'CSV', 'JS',
|
||||||
'CSS', 'TABLE_ARRAYS', 'SMARTY', 'LANG', 'CACHE', 'TMP', 'LOG', 'TEMPLATES',
|
'CSS', 'TABLE_ARRAYS', 'SMARTY', 'LANG', 'CACHE', 'TMP', 'LOG', 'TEMPLATES',
|
||||||
'TEMPLATES_C', 'DEFAULT_LANG', 'DEFAULT_ENCODING', 'DEFAULT_HASH',
|
'TEMPLATES_C', 'DEFAULT_LANG', 'DEFAULT_ENCODING', 'DEFAULT_HASH',
|
||||||
'DEFAULT_ACL_LEVEL', 'LOGOUT_TARGET', 'PASSWORD_CHANGE', 'AJAX_REQUEST_TYPE',
|
'DB_CONFIG_NAME', 'DB_CONFIG', 'TARGET'
|
||||||
'USE_PROTOTYPE', 'USE_SCRIPTACULOUS', 'USE_JQUERY', 'PAGE_WIDTH',
|
|
||||||
'MASTER_TEMPLATE_NAME', 'PUBLIC_SCHEMA', 'TEST_SCHEMA', 'DEV_SCHEMA',
|
|
||||||
'LIVE_SCHEMA', 'DB_CONFIG_NAME', 'DB_CONFIG', 'TARGET', 'DEBUG',
|
|
||||||
'SHOW_ALL_ERRORS'
|
|
||||||
] as $constant
|
] as $constant
|
||||||
) {
|
) {
|
||||||
if (!defined($constant)) {
|
if (!defined($constant)) {
|
||||||
|
|||||||
@@ -10,9 +10,16 @@ namespace CoreLibs\Convert;
|
|||||||
|
|
||||||
class Html
|
class Html
|
||||||
{
|
{
|
||||||
|
/** @var int */
|
||||||
public const SELECTED = 0;
|
public const SELECTED = 0;
|
||||||
|
/** @var int */
|
||||||
public const CHECKED = 1;
|
public const CHECKED = 1;
|
||||||
|
|
||||||
|
// TODO: check for not valid htmlentites encoding
|
||||||
|
// as of PHP 8.4: https://www.php.net/manual/en/function.htmlentities.php
|
||||||
|
/** @#var array<string> */
|
||||||
|
// public const VALID_HTMLENT_ENCODINGS = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* full wrapper for html entities
|
* full wrapper for html entities
|
||||||
*
|
*
|
||||||
@@ -22,14 +29,19 @@ class Html
|
|||||||
* encodes in UTF-8
|
* encodes in UTF-8
|
||||||
* does not double encode
|
* does not double encode
|
||||||
*
|
*
|
||||||
* @param mixed $string string to html encode
|
* @param mixed $string string to html encode
|
||||||
* @param int $flags [default: ENT_QUOTES | ENT_HTML5]
|
* @param int $flags [default=ENT_QUOTES | ENT_HTML5]
|
||||||
|
* @param string $encoding [default=UTF-8]
|
||||||
* @return mixed if string, encoded, else as is (eg null)
|
* @return mixed if string, encoded, else as is (eg null)
|
||||||
*/
|
*/
|
||||||
public static function htmlent(mixed $string, int $flags = ENT_QUOTES | ENT_HTML5): mixed
|
public static function htmlent(
|
||||||
{
|
mixed $string,
|
||||||
|
int $flags = ENT_QUOTES | ENT_HTML5,
|
||||||
|
string $encoding = 'UTF-8'
|
||||||
|
): mixed {
|
||||||
if (is_string($string)) {
|
if (is_string($string)) {
|
||||||
return htmlentities($string, $flags, 'UTF-8', false);
|
// if not a valid encoding this will throw a warning and use UTF-8
|
||||||
|
return htmlentities($string, $flags, $encoding, false);
|
||||||
}
|
}
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
@@ -37,7 +49,7 @@ class Html
|
|||||||
/**
|
/**
|
||||||
* strips out all line breaks or replaced with given string
|
* strips out all line breaks or replaced with given string
|
||||||
* @param string $string string
|
* @param string $string string
|
||||||
* @param string $replace replace character, default ' '
|
* @param string $replace [default=' '] replace character
|
||||||
* @return string cleaned string without any line breaks
|
* @return string cleaned string without any line breaks
|
||||||
*/
|
*/
|
||||||
public static function removeLB(string $string, string $replace = ' '): string
|
public static function removeLB(string $string, string $replace = ' '): string
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ class GetLocale
|
|||||||
$locale = defined('SITE_LOCALE') && !empty(SITE_LOCALE) ?
|
$locale = defined('SITE_LOCALE') && !empty(SITE_LOCALE) ?
|
||||||
SITE_LOCALE :
|
SITE_LOCALE :
|
||||||
// else parse from default, if not 'en'
|
// else parse from default, if not 'en'
|
||||||
/** @phpstan-ignore-next-line DEFAULT_LOCALE could be empty */
|
|
||||||
(defined('DEFAULT_LOCALE') && !empty(DEFAULT_LOCALE) ?
|
(defined('DEFAULT_LOCALE') && !empty(DEFAULT_LOCALE) ?
|
||||||
DEFAULT_LOCALE : 'en');
|
DEFAULT_LOCALE : 'en');
|
||||||
}
|
}
|
||||||
@@ -97,8 +96,7 @@ class GetLocale
|
|||||||
$encoding = defined('SITE_ENCODING') && !empty(SITE_ENCODING) ?
|
$encoding = defined('SITE_ENCODING') && !empty(SITE_ENCODING) ?
|
||||||
SITE_ENCODING :
|
SITE_ENCODING :
|
||||||
// or default encoding, if not 'UTF-8'
|
// or default encoding, if not 'UTF-8'
|
||||||
/** @phpstan-ignore-next-line DEFAULT_LOCALE could be empty */
|
(defined('DEFAULT_ENCODING') ?
|
||||||
(defined('DEFAULT_ENCODING') && !empty(DEFAULT_ENCODING) ?
|
|
||||||
DEFAULT_ENCODING : 'UTF-8');
|
DEFAULT_ENCODING : 'UTF-8');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user