Members
-
Helper :HelperMain
-
Helper provides several auxiliary functions for intrexx
Type:
- See:
Methods
-
ajaxAppVTL(vtlFile, settingsAjax, appContext,) → {Deferred}
-
Sends a request to the provided application resource vtl-file underneath internal/application/resource/APPGUID/.
Parameters:
Name Type Description vtlFile
string path to the application resource vtl-file ("internal/application/resource/[APPGUID]/" will be added automatically)
settingsAjax
object ajax settings e.g. {dataType: 'json'}, http://api.jquery.com/jQuery.ajax/, additional intrexx properties: urlParameters
appContext,
object object {upFuncPart} or any html element of the application page. Parameter can also be null.
Returns:
jQuery deferred, http://api.jquery.com/category/deferred-object/
- Type
- Deferred
Example
ajaxAppVTL("test.vm", { dataType: "json", success: function(dataJSON){ //e.g. dataJSON response is: //{"myobject":{"property1":"propertyValue1"}} alert(dataJSON.myobject.property1); } }, getElement(GUID)); ajaxAppVTL("test.vm", { dataType: 'text', data: { fr_param1: Browser.getValue(getElement("GUID_FORM_FIELD")) }, success: function(data){ Browser.setValue(getElement("GUID_STATIC_TEXTFIELD"), data); } }, getElement("GUID_FORM_ANY_FIELD"));
-
ajaxVTL(vtlFile, settingsAjax, appContext,) → {Deferred}
-
Sends a request to the provided vtl-file.
Parameters:
Name Type Description vtlFile
string path to the vtl-file (e.g. internal/system/vm/html/include/sample.vm)
settingsAjax
object ajax settings e.g. {dataType: 'json'}, http://api.jquery.com/jQuery.ajax/, additional intrexx properties: urlParameters
appContext,
object object {upFuncPart} or any html element of the application page. Parameter can also be null.
Returns:
jQuery deferred, http://api.jquery.com/category/deferred-object/
- Type
- Deferred
Example
ajaxVTL("internal/system/vm/custom/test.vm", { dataType: "json", urlParameters: { "rq_Name1": "value1", "rq_Name2": "value2" }, success: function(dataJSON){ //e.g. dataJSON response is: //{"myobject":{"property1":"propertyValue1"}} alert(dataJSON.myobject.property1); } });
-
calculate(oHtml1, oHtml2, strOp, oHtmlResult) → {boolean}
-
Calculates a result of values from two html controls with an operator and writes it into a html control.
Parameters:
Name Type Description oHtml1
object Reference to a html control of type "integer", "double", "currency"
oHtml2
object Reference to a html control of type "integer", "double", "currency"
strOp
string Operator
oHtmlResult
object Result; Reference to a html control of type "integer", "double", "currency"
Returns:
- Type
- boolean
Example
calculate(getElement("F28BA7351E3C8F5123880548CFA72B64566A1421"), getElement("80467069EA61BD786CFFEB508786723D6451F2F5"), "+", getElement("B52A9E9FC555A820984E63DECF13BCAA33E308CD"));
-
checkRequired(oHtml, strMessage) → {boolean}
-
Checks a html control, as if "entry required" has been set OR checks all controls of a form, where "entry required" was set.
Parameters:
Name Type Description oHtml
object Reference to a html input control or to a form control ("FormGroup")
strMessage
string (OPTIONAL) Text to show, if checkRequired returns
false
. If not set, value of FORM_CONSTR_REQUIRED from "preset texts" will be displayed.Returns:
- Type
- boolean
Example
checkRequired(getElement("E94A9FBDADD46039BB62F76870E1EC57C226C6DC"), "An alternative text!");
-
dateAdd(interval, number, date) → {date}
-
Adds or subtracts a interval to/from a given JavaScript date object.
Parameters:
Name Type Description interval
string Possible values: "ms" - for milliseconds; "s" - for seconds; "mi" - for minutes; "h" - for hours; "d" - for days; "mo" - for months; "y" - for years;
number
integer value for given interval, that should be added to date. Negative values are also possible.
date
date JavaScript date object.
Returns:
JavaScript date object.
- Type
- date
Example
var dtNow = new Date(); var dtAdd1 = dateAdd("d", 1, dtNow); // adds 1 day to current date. var dtAdd2 = dateAdd("h", -2, dtNow); // subtracts 2 hours from current date.
-
dateComparedToNow(p_oDate) → {number}
-
Compares a value of a date control with the current date. Imperative for input and view controls (for view controls the expert attribute
jsobject = true (Boolean)
has to be set.)Parameters:
Name Type Description p_oDate
Reference to an html input control of type "date", "time" or "datetime"
Returns:
JavaScript number object.
- Type
- number
Example
dateComparedToNow(getElement("5F7S5E7F9EA9ED1A829DB98DBF5459F59961FA3B"));
-
debug(p_strText, p_strType, p_oObject)
-
write text into console if debug mode ist enabled (DEBUG = true)
Parameters:
Name Type Description p_strText
string Text
p_strType
string (optional) debug | info | warn | error
p_oObject
object (optional) inspect object
-
getCurrencyByLocalString(strValue) → {number}
-
Parses a local formatted string representing a currency value and returns a JavaScript number object.
Parameters:
Name Type Description strValue
string Local formatted currency string.
Returns:
JavaScript number object.
- Type
- number
Example
getCurrencyByLocalString("1.234");
-
getCurrencyStringByLocal(strValue) → {string}
-
Parses a local formatted string representing a currency value. (for example 3.215,20 -> 3215.20)
Parameters:
Name Type Description strValue
string Local formatted currency string.
Returns:
double as formatted string.
- Type
- string
Example
getCurrencyStringByLocal("1.234");
-
getDateObject(oHtml) → {date}
-
Creates an JavaScript date object from a html control.
Parameters:
Name Type Description oHtml
object Reference to a html input control of types "date", "time" or "date & time".
Returns:
JavaScript date object
- Type
- date
Example
getDateObject(getElement("A84E5E7F9EA9ED1A829DB98DBF5459F59961FA3B"));
-
getDoubleByLocalString(strValue) → {number}
-
Parses a local formatted string representing a double value and returns a JavaScript number object.
Parameters:
Name Type Description strValue
string Local formatted string.
Returns:
JavaScript number object.
- Type
- number
Example
getDoubleByLocalString("1.234");
-
getDoubleStringByLocal(strValue) → {string}
-
Parses a local formatted string representing a double value. (for example 3.215,20 -> 3215.20)
Parameters:
Name Type Description strValue
string Local formatted double string.
Returns:
double as formatted string.
- Type
- string
Example
getDoubleStringByLocal("1.234");
-
getIntegerByLocalString(strValue) → {number}
-
Parses a local formatted string representing an integer value and returns a JavaScript number object.
Parameters:
Name Type Description strValue
string Local formatted integer string.
Returns:
JavaScript number object.
- Type
- number
Example
getIntegerByLocalString("1.234");
-
getIntegerStringByLocal(strValue) → {string}
-
Parses a local formatted string representing an integer value.
Parameters:
Name Type Description strValue
string Local formatted integer string.
Returns:
Integer formatted string.
- Type
- string
Example
getIntegerStringByLocal("1.234");
-
getLocalDurationString(oHtmlDateFrom, oHtmlDateTo) → {string}
-
Calculates the difference of values from two html controls of type "date & time" and returns it as string formatted as "2 days 3 minutes"
Parameters:
Name Type Description oHtmlDateFrom
object Reference to a html control of type "date & time"
oHtmlDateTo
object Reference to a html control of type "date & time"
Returns:
string formatted as "2 days 3 minutes".
- Type
- string
Example
getLocalDurationString(getElement("4E48F310711C446B4B04752A6B3239900D49F3A0"),getElement("E13A41C114E8754574DEA9767F505DDE3491C89A"));
-
getNumberObject(oHtml) → {object}
-
Creates an JavaScript number object from a html control.
Parameters:
Name Type Description oHtml
object Reference to a html input control of types "integer", "double" or "currency".
Returns:
JavaScript number object.
- Type
- object
Example
getNumberObject(getElement("5F7S5E7F9EA9ED1A829DB98DBF5459F59961FA3B"));
-
getTableByRecordHtml(oHtml) → {upShapedTable}
-
Get the shaped table which the given element belongs to.
Parameters:
Name Type Description oHtml
Object Returns:
- Type
- upShapedTable
-
getTableRecordByRecordHtml(oHtml) → {upShapedTableRecord}
-
Get the shaped table record which the given element belongs to.
Parameters:
Name Type Description oHtml
Object Returns:
- Type
- upShapedTableRecord
Examples
alert(getTableRecordByRecordHtml(this).getRecId());
alert($(this).getTableRecord().getRecId());
-
getTextValue(oHtml) → {string}
-
Reads a value from a viewcontrol or static textcontrol.
Parameters:
Name Type Description oHtml
object Reference to a html input control.
Returns:
Value from viewcontrol or static textcontrol.
- Type
- string
Example
getTextValue(getElement("F28BA7351E3C8F5123880548CFA72B64566A1433"));
-
getTextValueById(id) → {string}
-
Reads a value from a viewcontrol or static textcontrol.
Parameters:
Name Type Description id
string DOM id of the element; equivalent to the id-attribute value of the html element.
Returns:
Value from viewcontrol or static textcontrol.
- Type
- string
Example
getTextValueById("ID_labelcontrol900CB1AB");
-
inking(control, op, comp, color, colored)
-
Colors rows and cells in a viewtablecontrol depending on a number value.
Parameters:
Name Type Description control
string Name of control, whose value should be checked (name from expert page of the column).
op
string Operator
comp
string Value to compare with.
color
string Value of color (hexadecimal or name)
colored
string Possible values: "row" = whole row (tr), "cell" = whole cell (td), "span" = text of cell (span).
Example
inking("viewcontrolD54BA2DD", ">", 10, "#008000", "row");
-
inkingDate(control, op, type, color, colored)
-
Colors date or datetime values in a viewtablecontrol depending on today.
Parameters:
Name Type Argument Default Description control
String Name of control, whose value should be checked (name from expert page of the column).
op
String Operator
type
String <optional>
"" Compare either against today as "date" or today as "datetime".
color
String Value of color (hexadecimal or name)
colored
String Possible values: "row" = whole row (tr), "cell" = whole cell (td), "span" = text of cell (span).
- See:
-
inkingString(control, op, comp, color, colored)
-
Colors strings in a viewtablecontrol depending on a number value.
Parameters:
Name Type Description control
string Name of control, whose value should be checked (name from expert page of the column).
op
string Operator
comp
string Value to compare with.
color
string Value of color (hexadecimal or name)
colored
string Possible values: "row" = whole row (tr), "cell" = whole cell (td), "span" = text of cell (span).
- See:
-
log(p_strText, p_strType, p_oObject)
-
write text into console
Parameters:
Name Type Description p_strText
string Text
p_strType
string (optional) debug | info | warn | error
p_oObject
object (optional) inspect object
-
makeAppRequest(p_strApp, p_strTarget, p_strRecId, p_bClosePopup, p_bChangeParent, p_bNewWindow)
-
Executes an application-request.
Parameters:
Name Type Description p_strApp
string Application GUID
p_strTarget
string Page GUID
p_strRecId
string Record Id
p_bClosePopup
boolean Close popup (if current page in popup).
p_bChangeParent
boolean Set request into main window (if current page in popup).
p_bNewWindow
boolean Set request into a new popup window.
Example
// opens page 3B8501CD6DFE930F85CC6305C4BDA16D95BC9F59 of application 77C4E95D8F1EEC234D308C2C8C15CB63A97F7ABA in an new window makeAppRequest("77C4E95D8F1EEC234D308C2C8C15CB63A97F7ABA", "3B8501CD6DFE930F85CC6305C4BDA16D95BC9F59", false, false, true);
-
setFullDays(oHtmlCheck, oHtmlFrom, oHtmlTo)
-
Sets two datafields on a duration of a whole day: dateFrom 00:00 a.m., dateTo 00:00 a.m. next day.
Parameters:
Name Type Description oHtmlCheck
object Reference to a checkbox input control
oHtmlFrom
object Reference to a html input control (date from)
oHtmlTo
object Reference to a html input control (date to)
Example
// Example usage (executable on an checkbox onclick() event): setFullDays(getElement("123401F1E55C9A193BE6EC4091B45C6A5A6C8154"), getElement("DD2E01F1E55C9A193BE6EC4091B45C6A5A6C8154"), getElement("4D0708BDECC7D088613F818CE1B09B8D812F5750") );
-
setTextValue(oHtml, strValue) → {boolean}
-
Writes a value in a viewcontrol or static textcontrol.
Parameters:
Name Type Description oHtml
object Reference to a html input control.
strValue
string Value to write.
Returns:
- Type
- boolean
Example
setTextValue(getElement("F28BA7351E3C8F5123880548CFA72B64566A1433"), "Some text");
-
setTextValueById(id, strValue) → {boolean}
-
Writes a value in a viewcontrol or static textcontrol.
Parameters:
Name Type Description id
string DOM id of the element; equivalent to the id-attribute value of the html element.
strValue
string Value to write.
Returns:
- Type
- boolean
Example
setTextValueById("ID_labelcontrol900CB1AB", "Some text");
-
toLocalString(oHtml, strValue) → {string}
-
Creates a local formatted string from an number string or a datetime string.
Parameters:
Name Type Description oHtml
object Reference to a html input control of types "integer", "double", "currency" (format settings can be appended here, too).
strValue
string Number string or date string.
Returns:
Local formatted number as string or local formatted datetime as string
- Type
- string
Example
toLocalString(getElement("DDB279D4974A17DB27A89F58DB36F7BF4E10DA13"),"123.45");
-
triggerUserWorkflowEvent(eventGuid, urlParameters, ajaxParameters)
-
Triggers an User Workflow Event.
Parameters:
Name Type Description eventGuid
string The paramter "eventGuid" of the generic event handler.
urlParameters
object Map containing name value pairs, which will be part of the querystring.
ajaxParameters
object Map containing synchronous mode and type mode
Example
// Example 1 // Trigger event with guid <GUID>. Define a generic event handler with the class "de.uplanet.lucy.server.workflow.eventhandler.UserWorkflowEventHandler" before. triggerUserWorkflowEvent("<GUID>", {"param1":"value1","param2":"value2"}, {"async": [true/false], "type":"value" }); // Example 2 $.when(triggerUserWorkflowEvent("<GUID>", {"param1":"value1","param2":"value2"}, {"async": [true/false], "type":"value"})) .done(function() { alert("done") }) .fail(function() { alert("failed :(") });
-
writeLocalString(oHtml, strValue) → {boolean}
-
Creates a local formatted string from an number string or a datetime string and writes it as value into a html control.
Parameters:
Name Type Description oHtml
object Reference to a html input control of types "date", "time", "date & time", "integer", "double", "currency" (format settings can be appended here, too).
strValue
string Value to localize.
Returns:
- Type
- boolean
Example
writeLocalString(getElement("DDB279D4974A17DB27A89F58DB36F7BF4E10DA13"),"123.45");