got et2 mostly working: timesheet.edit renders

This commit is contained in:
Ralf Becker
2021-06-07 17:33:53 +02:00
parent 592b7fb97d
commit f91bca83e1
183 changed files with 11759 additions and 12588 deletions

View File

@@ -4,11 +4,13 @@
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package etemplate
* @subpackage api
* @link http://www.egroupware.org
* @link https://www.egroupware.org
* @author Andreas Stöckel
* @copyright Stylite 2011
* @copyright EGroupware GmbH 2011-2021
*/
import {app, egw} from "../jsapi/egw_global";
/**
* IE Fix for array.indexOf
*/
@@ -27,14 +29,14 @@ if (typeof Array.prototype.indexOf == "undefined")
/**
* Array with all types supported by the et2_checkType function.
*/
var et2_validTypes = ["boolean", "string", "rawstring", "html", "float", "integer", "any", "js", "dimension"];
export var et2_validTypes = ["boolean", "string", "rawstring", "html", "float", "integer", "any", "js", "dimension"];
/**
* Object whith default values for the above types. Do not specify array or
* objects inside the et2_typeDefaults object, as this instance will be shared
* between all users of it.
*/
var et2_typeDefaults : object = {
export var et2_typeDefaults : object = {
"boolean": false,
"string": "",
"rawstring": "", // no html-entity decoding
@@ -46,7 +48,7 @@ var et2_typeDefaults : object = {
"dimension": "auto"
};
function et2_evalBool(_val)
export function et2_evalBool(_val)
{
if (typeof _val == "string")
{
@@ -64,7 +66,7 @@ function et2_evalBool(_val)
* @param variable number of arguments to contact
* @returns string
*/
function et2_form_name(_cname,_name)
export function et2_form_name(_cname,_name)
{
var parts = [];
for(var i=0; i < arguments.length; ++i)
@@ -89,7 +91,7 @@ function et2_form_name(_cname,_name)
* @param string _attr attribute name
* @param object _widget
*/
function et2_checkType(_val, _type, _attr, _widget)
export function et2_checkType(_val, _type, _attr, _widget)
{
if (typeof _attr == "undefined")
{
@@ -273,7 +275,7 @@ function et2_checkType(_val, _type, _attr, _widget)
* If et2_no_init is set as default value, the initAttributes function will not
* try to initialize the attribute with the default value.
*/
const et2_no_init = new Object();
export const et2_no_init = new Object();
/**
* Validates the given attribute with the given id. The validation checks for
@@ -282,7 +284,7 @@ const et2_no_init = new Object();
* empty string, the type defaults to any and the default to the corresponding
* type default.
*/
function et2_validateAttrib(_id, _attrib)
export function et2_validateAttrib(_id, _attrib)
{
// Default ignore to false.
if (typeof _attrib["ignore"] == "undefined")
@@ -333,7 +335,7 @@ function et2_validateAttrib(_id, _attrib)
/**
* Equivalent to the PHP array_values function
*/
function et2_arrayValues(_arr)
export function et2_arrayValues(_arr)
{
var result = [];
for (var key in _arr)
@@ -351,7 +353,7 @@ function et2_arrayValues(_arr)
/**
* Equivalent to the PHP array_keys function
*/
function et2_arrayKeys(_arr)
export function et2_arrayKeys(_arr)
{
var result = [];
for (var key in _arr)
@@ -362,7 +364,7 @@ function et2_arrayKeys(_arr)
return result;
}
function et2_arrayIntKeys(_arr)
export function et2_arrayIntKeys(_arr)
{
var result = [];
for (var key in _arr)
@@ -378,7 +380,7 @@ function et2_arrayIntKeys(_arr)
* Equivalent to the PHP substr function, partly take from phpjs, licensed under
* the GPL.
*/
function et2_substr (str, start, len) {
export function et2_substr (str, start, len) {
var end = str.length;
if (start < 0)
@@ -407,7 +409,7 @@ function et2_substr (str, start, len) {
* @param string _enclosure='"'
* @return array
*/
function et2_csvSplit(_str : string, _num? : number, _delimiter? : string, _enclosure? : string)
export function et2_csvSplit(_str : string, _num? : number, _delimiter? : string, _enclosure? : string)
{
// Default the parameters
if (typeof _str == "undefined" || _str == null)
@@ -474,7 +476,7 @@ function et2_csvSplit(_str : string, _num? : number, _delimiter? : string, _encl
/**
* Parses the given string and returns an array marking parts which are URLs
*/
function et2_activateLinks(_content)
export function et2_activateLinks(_content)
{
var _match = false;
var arr = [];
@@ -572,7 +574,7 @@ function et2_activateLinks(_content)
/**
* Inserts the structure generated by et2_activateLinks into the given DOM-Node
*/
function et2_insertLinkText(_text, _node, _target)
export function et2_insertLinkText(_text, _node, _target)
{
if(!_node)
{
@@ -640,7 +642,7 @@ function et2_insertLinkText(_text, _node, _target)
/**
* Creates a copy of the given object (non recursive)
*/
function et2_cloneObject(_obj)
export function et2_cloneObject(_obj)
{
var result = {};
@@ -656,7 +658,7 @@ function et2_cloneObject(_obj)
* Returns true if the given array of nodes or their children contains the given
* child node.
*/
function et2_hasChild(_nodes, _child)
export function et2_hasChild(_nodes, _child)
{
for (var i = 0; i < _nodes.length; i++)
{
@@ -689,7 +691,7 @@ function et2_hasChild(_nodes, _child)
/**
* Returns an "range" object with the given top position and height
*/
function et2_range(_top, _height)
export function et2_range(_top, _height)
{
return {
"top": _top,
@@ -700,7 +702,7 @@ function et2_range(_top, _height)
/**
* Returns an "area" object with the given top- and bottom position
*/
function et2_bounds(_top, _bottom)
export function et2_bounds(_top, _bottom)
{
return {
"top": _top,
@@ -711,7 +713,7 @@ function et2_bounds(_top, _bottom)
/**
* Returns whether two range objects intersect each other
*/
function et2_rangeIntersect(_ar1, _ar2)
export function et2_rangeIntersect(_ar1, _ar2)
{
return ! (_ar1.bottom < _ar2.top || _ar1.top > _ar2.bottom);
}
@@ -720,7 +722,7 @@ function et2_rangeIntersect(_ar1, _ar2)
* Returns whether two ranges intersect (result = 0) or their relative position
* to each other (used to do a binary search inside a list of sorted range objects).
*/
function et2_rangeIntersectDir(_ar1, _ar2)
export function et2_rangeIntersectDir(_ar1, _ar2)
{
if (_ar1.bottom < _ar2.top)
{
@@ -736,7 +738,7 @@ function et2_rangeIntersectDir(_ar1, _ar2)
/**
* Returns whether two ranges are equal.
*/
function et2_rangeEqual(_ar1, _ar2)
export function et2_rangeEqual(_ar1, _ar2)
{
return _ar1.top === _ar2.top && _ar1.bottom === _ar2.bottom;
}
@@ -744,7 +746,7 @@ function et2_rangeEqual(_ar1, _ar2)
/**
* Substracts _ar2 from _ar1, returns an array of new ranges.
*/
function et2_rangeSubstract(_ar1, _ar2)
export function et2_rangeSubstract(_ar1, _ar2)
{
// Per default return the complete _ar1 range
var res = [_ar1];
@@ -774,7 +776,7 @@ function et2_rangeSubstract(_ar1, _ar2)
* @param {string} _str
* @returns {string}
*/
function html_entity_decode(_str)
export function html_entity_decode(_str)
{
return _str && _str.indexOf('&') != -1 ? jQuery('<span>'+_str+'</span>').text() : _str;
}