Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Used to creates a popup dialog element.

 Parameters

    • id - an unique identifier of the popup dialog
    • url - an URL of a page to show in popup dialog
    • params - a JSON object to pass parameter and its value (Optional) 
    • title - a title to display for on the top of popup dialog (Optional)
    • width - width of the popup dialog box (Optional)
    • height - height of the popup dialog box (Optional) 
    • action - Get/Post. Default to Post (Optional) 

...

Code Block
languagejs
var params = {
    id : "1",
    name : "test"
};
 
JPopup.show(frameId"testPopup", url"http://www.joget.org", params);

UI

  • URL : /jw/js/json/ui.js
  • Auto included in all userview pages.
  • Convenient method to retrieve value for UI usages.

adjustPopUpDialog(dialogbox)

escapeHTML(content)

getPopUpHeight(height)

getPopUpWidth(width)

userviewThemeParams()

UrlUtil

  • URL : /jw/js/json/util.js
  • Auto included in all userview pages.
  • Convenient method to deal with URL.

constructUrlQueryString(params)

encodeUrlParam(url)

getUrlParams(url)

...

Description

Used by system to align the popup dialog to the center of the screen.

Parameters

    • dialogbox - the popup dialog object

Sample code 

Code Block
languagejs
UI.adjustPopUpDialog(JPopup.dialogboxes["testPopup"]);

escapeHTML(content)

Description

Used to escapes HTML syntax in a value

Parameters

    • content - content to be escapes

Sample code 

Code Block
languagejs
var content = "<p>test content</p>";
var escapedContent = UI.escapeHTML(content);
console.log(escapedContent); // &lt;p&gt;test content&lt;/p&gt;

getPopUpHeight(height)

Description

Used by the system to calculate the height of a popup dialog for current screen size to support mobile device.

Parameters

    • height - Max height of the popup dialog. Default to "90%".

Sample code 

Code Block
languagejs
var height = UI.getPopUpHeight("500px");

getPopUpWidth(width)

Description

Used by the system to calculate the width of a popup dialog for current screen size to support mobile device.

Parameters

    • width - Max width of the popup dialog. Default to "90%".

Sample code 

Code Block
languagejs
var width = UI.getPopUpWidth("800px");

userviewThemeParams()

Description

Used by system to gets the query parameters string that contains the meta of current userview theme in used.

Sample code 

Code Block
languagejs
var url = "http://localhost/jw/form/embed?" + UI.userviewThemeParams();

UrlUtil

  • URL : /jw/js/json/util.js
  • Auto included in all userview pages.
  • Convenient method to deal with URL.

constructUrlQueryString(params)

Description

Used to generate a query string based on a parameters object

Parameters

    • params - an object contains all parameter as attribute name and its values in array

Sample code 

Code Block
languagejs
var params = {
    "name" : ["joget"],
    "email" : ["info@joget.org", "test@joget.org"]
};
var queryString = UrlUtil.constructUrlQueryString(params);
console.log(queryString); // name=joget&email=info%40joget%2Eorg&email=test%40joget%2Eorg

encodeUrlParam(url)

Description

Used to encodes the URL parameters in a URL.

Parameters

    • url - URL with parameters to be encode. Note: it use "&" and "=" as separator.

Sample code 

Code Block
languagejs
var url = "http://localhost/jw/test?name=joget&email=info@jogte.org&email=test@joget.org";
 
var encodedUrl = UrlUtil.encodeUrlParam(url);
console.log(encodedUrl); // http://localhost/jw/test?name=joget&email=info%40joget%2Eorg&email=test%40joget%2Eorg

getUrlParams(url)

Description

Used to gets an object contains all parameter as attribute name and its value in an URL. 

Parameters

    • url - URL to be parses to retrieve all parameters and its value in array.

Sample code 

Code Block
languagejs
var url = "http://localhost/jw/test?name=joget&email=info@jogte.org&email=test@joget.org";
 
var params = UrlUtil.getUrlParams(url);
console.log(params); // {"name" : ["joget"], "email" : ["info@joget.org", "test@joget.org"]}

mergeRequestQueryString(queryString1, queryString2)

Description

Used to merge 2 URL query parameters strings into one query string.

Parameters

    • queryString1 - first query parameters string
    • queryString2 - second query parameters string. If a parameter is exist in both query strings, the value in second query string will override the first one.

Sample code 

Code Block
languagejs
var q1 = "name=joget&email=info@jogte.org&email=test@joget.org";
var q2 = "name=joget team&phone=012345678";
 
var queryString = UrlUtil.mergeRequestQueryString(q1, q2);
console.log(queryString); // name=joget%20team&email=info%40joget%2Eorg&email=test%40joget%2Eorg&phone=012345678