mmir.compat.v1.CommonUtils
Set to "backwards compatibility mode v1" (for pre version 2.0) for CommonUtils.
NOTE: needs
mmir.compat.v1.setToCompatibilityMode
to be set first!
This function re-adds deprecated and removed functions and
properties to the CommonUtils instance.
NOTE that once set to compatibility mode, it cannot be reset to
non-compatibility mode.
In addition, the following functions of CommonUtils are made accessible
on the mmir.CommonUtils
instance with these additional names
-
mmir.CommonUtils#regexHTMLComment
as html_comment_regex : RegExpr -
mmir.CommonUtils#resizeFitToSourroundingBox
as html_resize_font_to_fit_surrounding_box() -
mmir.CommonUtils#toJSONStringValue
as to_json_string_value(String: theObjectValue) : String -
mmir.CommonUtils#convertJSONStringValueToHTML
as convert_to_json_value_HTML_string(String: str) : String -
mmir.CommonUtils#convertJSONStringToHTML
as convert_json_to_HTML_string(String: str) : String -
mmir.CommonUtils#parseParamsToDictionary
as get_params_as_dict(String: str) : Object
mmir.extensions.JsonUtils
will be made available.
Name | Type | Description |
---|---|---|
compatibilitySelf |
mmir.CommonUtils | the instance of mmir.CommonUtils to which the compatibility functions etc. will be attached |
Example
mmir.require(['mmirf/core3Compatibility', 'mmirf/commonUtilsCompatibility', 'mmirf/core', 'mmirf/commonUtils'], function(setCoreCompatibility, setUtilsCompatibility, core, utils){
setCoreCompatibility(core);
setUtilsCompatibility(utils);
});
Requires
- module:document
- module:document
Members
-
privatecontentForRegExpString RegExp
-
Regular Expression to identify content for a view-element:
either _header_, _footer_, _dialogs_ or _content_- Deprecated
- old template syntax format
-
privatedebugNodeElement
-
HTML-Dom-Element for logging directly on the main HTML-Page as of now there is no element with the id "log" in the index.html
- Deprecated
- unused
-
privatejavaScriptRegExpString RegExp
-
Regular Expression to identify a javascript for the transformation of ehtml to html
- Deprecated
- unused
-
privatemonthsObject
-
Array of strings for the conversion of month represented by integers to strings Default Language for months is english, 'en'
-
partial_name_regexString RegExp
-
See Property:
mmir.compat.v1.CommonUtils#render_partial_regex
This regular expression is an extension for the parsing of the parameters of the partial (for customization) to get the name of the corresponding controller of the partial.
Regular Expression to identify if a partial is to be inserted in a view.
Partials are in principle customizable views, which can be used independently from a controller and furthermore accept parameters to customize the partial.
A partial is first processed and then integrated into the view.- Deprecated
- old template syntax format
Example
<% render googlemap/poi_details {:curr_poi_data_jpath => new JPath(mmir.ControllerManager.getInstance().getController("googlemap").impl['current_poi_meta_data'])} %>
-
partial_parameter_regexString RegExp
-
See Property:
mmir.compat.v1.CommonUtils#render_partial_regex
This regular expression is an extension for the parsing of the parameters of the partial (for customization).
Regular Expression to identify if a partial is to be inserted in a view.
Partials are in principle customizable views, which can be used independently from a controller and furthermore accept parameters to customize the partial.
A partial is first processed and then integrated into the view.- Deprecated
- old template syntax format
Example
<% render googlemap/poi_details {:curr_poi_data_jpath => new JPath(mmir.ControllerManager.getInstance().getController("googlemap").impl['current_poi_meta_data'])} %>
-
partial_var_pattern_assignment_regexString RegExp
-
Regular expression for detecting an assignment expression in templates, e.g.
{::theVariable=... }
.- Deprecated
- old template syntax format
Example
{::address = address + "<br/>"} or
{::address = {:anotherVariable} + "<br/>"}
-
partial_var_pattern_dataobject_regexString RegExp
-
Regular expression for the parsing of partial-files.
This expression detects all data objects for the customization of the partial in the form of {::curr_poi_data={:curr_poi_data_jpath}}.
Form of data object: {::DATA_OBJECT}
Partials are principally customizable views, which can be used independently from a controller and furthermore accept parameters to customize the partial.
A partial is first processed and then integrated into the view.- Deprecated
- old template syntax format
Example
{::address = address + "<br/>"}
-
partial_var_pattern_regexString RegExp
-
Regular expression for the parsing of partial-files.
This expression detects all variables and data-instructions for the customization of the partial. There are 3 types of variables or instructions: + if-else-statement, controls which part of the partial will be displayed - depending on the condition + data-instruction, which is evaluated, but not displayed + variable or javascript-code, which are evaluated and displayed in the view Partials are principally customizable views, which can be used independently from a controller and furthermore accept parameters to customize the partial.
A partial is first processed and then integrated into the view.- Deprecated
- old template syntax format
Example
{::address = address + " " + {:curr_poi_data}.query('addressBean/housenumber')}
-
partial_var_pattern_simpleobject_regexString RegExp
-
Regular expression for the parsing of partial-files.
This expression detects all simple variables for the customization of the partial in the form of {:curr_poi_data}.
Form of simple object: {:SIMPLE_OBJECT}
Partials are principally customizable views, which can be used independently from a controller and furthermore accept parameters to customize the partial.
A partial is first processed and then integrated into the view.- Deprecated
- old template syntax format
Example
{:curr_poi_data}
-
render_partial_regexString RegExp
-
Regular Expression to identify if a partial is to be inserted in a view.
Partials are in principle customizable views, which can be used independently from a controller and furthermore accept parameters to customize the partial.
A partial is first processed and then integrated into the view.- Deprecated
- old template syntax format
Example
<% render googlemap/poi_details {:curr_poi_data_jpath => new JPath(mmir.ControllerManager.getInstance().getController("googlemap").impl['current_poi_meta_data'])} %>
-
privaterenderPartialRegExpString RegExp
-
Regular Expression to identify if a partial should be rendered inside a view (ehtml-String)
- Deprecated
- old template syntax format
-
privatestyleSheetRegExpString RegExp
-
Regular Expression to identify a styleSheet-tag for the transformation of ehtml to html
- Deprecated
- unused
-
privatetranslationRegExpStringString RegExp
-
Regular Expression for matching a translation-tag for the localization of view content (ehtml-String)
- Deprecated
- old template syntax format
-
value_of_path_regexString RegExp
-
See Property:
mmir.compat.v1.CommonUtils#value_of_regex
This regular expression is an extension to parse the parameters of the value_of-function.
Regular Expression to identify content in a view that will be inserted.
The content is generated by a helper function of the controller and usually saved as a JSON-Object with a _helper_ and _content_ part.
If the string is escaped and must be unescaped a second parameter can be given to ensure that the string will be unescaped before the insertion in the view.- Deprecated
- old template syntax format
Example
<%= value_of(languageMenu::header, true) %>
-
value_of_regexString RegExp
-
Regular Expression to identify content in a view that will be inserted.
The content is generated by a helper function of the controller and usually saved as a JSON-Object with a _helper_ and _content_ part.
If the string is escaped and must be unescaped a second parameter can be given to ensure that the string will be unescaped before the insertion in the view.- Deprecated
- old template syntax format
Example
<%= value_of(languageMenu::header, true) %>
Methods
-
appendJsSrcToHeader(scriptSrc)
-
Similar to the jQuery.getScript() function - appending a url of a javascript-source to the header of the main document.
Name Type Description scriptSrc
String source of javascript-file - Deprecated
- superseded by getLocalScript
-
ehtml2Html(eHtmlTag){String}
-
Function which transforms a ehtml string (while parsing views) into html by replacing stylesheet-, javascript- and content_for-tags with corresponding contents.
Name Type Description eHtmlTag
String A string that should be transformed from ehtml to html - Deprecated
- used for parsing/rendering old template syntax format
Returns:
Type Description String From ehtml into html transformed string -
get_date_as_string(the, [Optional]){String}
-
Reformat the String representation of a date.
Name Type Description the
String date String in format yyyy-mm-dd HH:mm:ss.S
[Optional]
String the language code (currently used to format the name of the month). Currently supported languages: en, de
. If unkown or omitted, defaulten
is used.Returns:
Type Description String a new String representation for the date Example
converts
2012-07-23 16:37:33.0
into →23. July 2012
-
get_duration_as_string(the){String}
-
Convert a duration (in seconds) into a String representation.
Name Type Description the
Integer duration in seconds Returns:
Type Description String a String representation for the duration Example
2:09:19 h 12:05 min
-
getTranslationRegExp(){String}
-
Gets the Regular Expression for translation tags.
Returns:
Type Description String The regular expression for matching a translation-tag - used inside a ehtml-String -
log(clazz, logMessage)
-
Appends a log-message to the main document (index.html) and prints it in the console
Name Type Description clazz
String A prefix for the output of the log message in the console logMessage
String The log message which should be printed - Deprecated
- Yes