Versions Compared

Key

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

...

Completes an assignment with a specific process instance id & activity instance id with option to set workflow variables

Chinese

使用特定流程实例标识和活动实例标识完成分配,并带有用于设置工作流程变量的选项


Parameters

Chinese

参数


    • baseUrl - base URL of Joget Workflow, e.g., 'http://localhost/jw'

      Chinese

      baseUrl - Joget Workflow的基本URL,例如   'http://localhost/jw'

    • activityId - activity instance id of the assignment to be completed

      Chinese

      activityId - 要完成的分配的活动实例标识

    • variableData - variables to be set. All variable name must prefix with "var_"

      Chinese

      variableData - 要设置的变量。所有变量名都必须以“var_”作为前缀

    • redirect - a URL to redirect to after the assignment is completed (optional)

      Chinese

      redirect - 分配完成后重定向到的URL(可选)

Sample code  

Chinese

示例代码  

Code Block
languagejs
AssignmentManager.completeAssignmentWithVariable('http://localhost/jw', '1_1_activity', 'var_status=new&var_id=123', 'http://localhost/completed.jsp');

...

Gets the current logged in username in Joget Workflow

Chinese

获取Joget Workflow中当前登录的用户名


Parameters

Chinese

参数

    • baseUrl - base URL of Joget Workflow, e.g., 'http://localhost/jw'

      Chinese

      baseUrl - Joget Workflow的基本URL,例如 'http://localhost/jw'

    • callback - a callback function after a successful call

      Chinese

      callback -  成功调用后的回调函数

Sample code 

Chinese

示例代码  

Code Block
languagejs
var callback = {
    success : function(response){
        //response.username
        if(response.username != "roleAnonymous"){
            console.log("Username is " + response.username);
        }else{
            console.log("User is anonymous");
        }
    }
};
AssignmentManager.getCurrentUsername('http://localhost/jw', callback);

...

Login the user in Joget Workflow

Chinese

获取Joget Workflow中当前登录的用户名(正常登录)


Parameters

Chinese

参数

    • baseUrl - base URL of Joget Workflow, e.g., 'http://localhost/jw'

      Chinese

      baseUrl - Joget Workflow的基本URL,例如 'http://localhost/jw'

    • username - username for user to login

      Chinese

      username - 用户名

    • password - password for user to login

      Chinese

      password - 密码

    • callback - a callback function after a successful call (optional)

      Chinese

      callback - 成功调用后的回调函数

Sample code  

Chinese

示例代码  

Code Block
languagejs
var callback = {
    success : function(response){
        //response.username && response.isAdmin
        if(response.username != "roleAnonymous"){
            console.log("username (" + response.username + ") is " + ((response.isAdmin !== undefined && response.isAdmin === "true")?"admin":"not an admin"));
        }else{
            console.log("Fail to login user!");
        }
    }
};
AssignmentManager.login('http://localhost/jw', 'admin', 'admin', callback);

...

Login the user with hash in Joget Workflow

Chinese

获取Joget Workflow中当前登录的用户名 (使用Hash 密码)


Parameters

Chinese

参数

    • baseUrl - base URL of Joget Workflow, e.g., 'http://localhost/jw'

      Chinese

      baseUrl - Joget Workflow的基本URL,例如 'http://localhost/jw'

    • username - username for user to login

      Chinese

      username - 用户名

    • hash - hashed password for user to login.  (refer to Hashed Password)

      Chinese

      hash - 登录的Hash密码.  (refer to 散列密码(Hashed Password))

    • callback - a callback function after a successful call (optional)

      Chinese

      callback - 成功调用后的回调函数

Sample code  

Chinese

示例代码  

Code Block
languagejs
var callback = {
    success : function(response){
        //response.username && response.isAdmin
        if(response.username != "roleAnonymous"){
            console.log("username (" + response.username + ") is " + ((response.isAdmin !== undefined && response.isAdmin === "true")?"admin":"not an admin"));
        }else{
            console.log("Fail to login user!");
        }
    }
};
AssignmentManager.loginWithHash('http://localhost/jw', 'admin', '14ACD782DCFEB2BCDE2B271CCD559477', callback);

...

Logs out the current logged in username in Joget Workflow

Chinese

登出


Parameters

Chinese

参数

Sample code  

Chinese

示例代码  

Code Block
languagejs
AssignmentManager.logout('http://localhost/jw');

...

Withdraws an assignment with a specific activity instance id

Chinese

撤销具有特定活动实例ID的分配

Note

Deprecated since v3, the concept of accept & withdraw assignment is removed. 

Chinese

已弃用  自v3接受和撤销分配的概念被删除。 


Parameters

Chinese

参数

    • baseUrl - base URL of Joget Workflow, e.g., 'http://localhost/jw'

      Chinese

      baseUrl - Joget Workflow的基本URL,例如 'http://localhost/jw'

    • activityId - activity instance id of the assignment to be withdrawn

      Chinese

      activityId - 要撤销的分配的活动实例ID

Sample code  

Chinese

示例代码  

Code Block
languagejs
AssignmentManager.withdrawAssignment('http://localhost/jw', '1_1_activity');

...

Initiates Ajax call with JSONP

Chinese

用JSONP启动Ajax调用


Parameters

Chinese

参数

    • url - URL to initiate Ajax call

      Chinese

      url - 启动Ajax调用的URL

    • callback - a callback function after a successful call (optional)

      Chinese

      callback - 成功调用后的回调函数(可选)

    • params - parameters for the call (optional)

      Chinese

      params - 调用参数(可选)

Sample code 

Chinese

示例代码  

Code Block
languagejs
var callback = {
    success : function(response){
        //do something
    }
};
ConnectionManager.ajaxJsonp('http://localhost/test', callback, 'id=4&name=test');

...

Initiates Ajax GET to a specific URL

Chinese

启动Ajax GET 到特定的URL


Parameters

Chinese

参数

    • url - URL for GET action

    • callback - a callback function after a successful call (optional)

      Chinese

      callback - 成功调用后的回调函数(可选)

    • params - parameters for the call (optional)

      Chinese

      params - 调用参数(可选)

    • xss - use when the URL is cross-domain (optional)

      Chinese

      xss - 当URL是跨域时使用(可选)

Sample code 

Chinese

示例代码  

Code Block
languagejs
var callback = {
    success : function(response){
        //do something
    }
};
ConnectionManager.get('http://localhost/test', callback, 'id=6&name=test', false);

...

Initiates Ajax POST to a specific URL

Chinese

启动Ajax POST到特定的URL


Parameters

Chinese

参数

    • url - URL for GET action

    • callback - a callback function after a successful call (optional)

      Chinese

      callback - 成功调用后的回调函数(可选)

    • params - parameters for the call (optional)

      Chinese

      params - 调用参数(可选)

Sample code 

Chinese

示例代码  

Code Block
languagejs
var callback = {
    success : function(response){
        //do something
    }
};
ConnectionManager.post('http://localhost/test', callback, 'id=6&name=test');

...

Used to gets the field object of a form field

Chinese

用于获取表单字段的字段对象


Parameters

Chinese

参数

    • fieldId - id of a form field

Sample code 

Chinese

示例代码  

Code Block
var field = FormUtil.getField("field1");
$(field).val("test"); //set value

...

Used to generates the fields value as url query parameter string

Chinese

用于生成字段值作为url查询参数字符串


Parameters

Chinese

参数

    • fields - an array contains objects with "field", "param" and "defaultValue" attributes.

      Chinese

      fields - 一个数组包含带有“field”,“param”和“defaultValue”属性的对象。


      - field : id of a form field

      Chinese

      - field : 表单字段的ID 


      - param : paremeter name to be used

      Chinese

      - param : 要使用的参数名称


      - defaultValue : value to be used when the field return empty value (Optional)

      Chinese

      - defaultValue : 当字段返回空值时使用的值(可选)

Sample code 

Chinese

示例代码  

Code Block
languagejs
var fields = [
    {"field":"field1", "param":"p_field1"},
    {"field":"field2", "param":"p_field2"},
    {"field":"field3", "param":"p_field3", "defaultValue":"default value"},
];
 
var queryString = FormUtil.getFieldsAsUrlQueryString(fields);
console.log(queryString); //p_field1=Field1%20value&p_field2=Field2%20value;Field2%20second%20value&p_field3=default%20value

...

Used to gets the cell objects of every rows of a grid field

Chinese

用于获取grid字段每一行的单元格对象


Parameters

Chinese

参数

    • cellFieldId - Grid Field Id and the cell id separated by a dot ".". Eg. gridId.cellId

      Chinese

      cellFieldId - 网格字段ID和由点“.”分隔的单元格ID。例如: gridId.cellId.

Sample code 

Chinese

示例代码  

Code Block
languagejs
var cells = FormUtil.getGridCells("gridId.field1");
$(cells).each(function(){
    //do something
});

...

Used to gets the cell values of every rows of a grid field and return it in an array.

Chinese

用于获取Grid字段每一行的单元格值并将其返回到数组中。


Parameters

Chinese

参数

    • cellFieldId - Grid Field Id and the cell id separated by a dot ".". Eg. gridId.cellId

      Chinese

      cellFieldId - 网格字段ID和由点“.”分隔的单元格ID。例如: gridId.cellId.

Sample code 

Chinese

示例代码  

Code Block
languagejs
var values = FormUtil.getGridCellValues("gridId.field1");
for (var i = 0; i < values.length; i++) {
    console.log(values[i]); //i equals to row number start from 0
}

...

Used to gets the value of a form field. 

Chinese

用于获取表单字段的值。 


Parameters

Chinese

参数

    • fieldId - id of a form field

      Chinese

      fieldId - 表单字段id

Sample code 

Chinese

示例代码  

Code Block
languagejs
var value = FormUtil.getValue("field1");

...

Used to gets the values of a form field. Values will return in an array. 

Chinese

用于获取表单域的值。值将返回一个数组。


Parameters

Chinese

参数

    • fieldId - id of a form field

      Chinese
      • fieldId -表单字段id

Sample code 

Chinese

示例代码  

Code Block
languagejs
var values = FormUtil.getValues("field1");
for (var i = 0; i < values.length; i++) {
    console.log(values[i]); 
}

...

Used to creates a popup dialog element.

Chinese

用于创建一个弹出对话框元素。


Parameters

Chinese

参数

    • id - an unique identifier of the popup dialog

      Chinese

      id - 弹出对话框的唯一标识符

    • title - a title to display for on the top of popup dialog (Optional)

      Chinese

      title - 在弹出对话框顶部显示的标题(可选)

    • width - width of the popup dialog box (Optional)

      Chinese

      width - 弹出对话框的宽度(可选)

    • height - height of the popup dialog box (Optional) 

      Chinese

      height - 弹出对话框的高度(可选) 

Sample code 

Chinese

示例代码  

Code Block
languagejs
JPopup.create("testPopup", "Test Popup Dialog");

...

Used to hides a created and shown popup dialog element.

Chinese

用于隐藏创建并显示的弹出对话框元素。


Parameters

Chinese

参数

    • id - an unique identifier of the popup dialog

      Chinese

      id - 弹出对话框的唯一标识符

Sample code 

Chinese

示例代码  

Code Block
languagejs
JPopup.hide("testPopup");

...

Used to creates a popup dialog element.

Chinese

用于创建一个弹出对话框元素。


Parameters

Chinese

参数

    • id - an unique identifier of the popup dialog

      Chinese

      id - 弹出对话框的唯一标识符

    • url - an URL of a page to show in popup dialog

      Chinese

      url - 在弹出对话框中显示的页面的URL

    • params - a JSON object to pass parameter and its value (Optional)

      Chinese

      params - 要传递参数及其值的JSON对象(可选) 

    • title - a title to display for on the top of popup dialog (Optional)

      Chinese

      title - 在弹出对话框顶部显示的标题(可选)

    • width - width of the popup dialog box (Optional)

      Chinese

      width - 弹出对话框的宽度(可选)

    • height - height of the popup dialog box (Optional)

      Chinese

      height - 弹出对话框的高度(可选) 

    • action - Get/Post. Default to Post (Optional) 

      Chinese

      action - 获取/发布。默认为发布(可选) 

Sample code 

Chinese

示例代码  

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

...

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

Chinese

系统用来将弹出对话框对准屏幕中心。


Parameters

Chinese

参数

    • dialogbox - the popup dialog object

      Chinese

      dialogbox - 弹出的对话框对象

Sample code 

Chinese

示例代码  

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

...

Used to escapes HTML syntax in a value

Chinese

用于在值中转义HTML语法


Parameters

Chinese

参数

    • content - content to be escapes

      Chinese

      content - 内容是 escapes

Sample code 

Chinese

示例代码  

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;

...

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

Chinese

系统用于计算当前屏幕大小的弹出对话框的高度以支持移动设备


Parameters

Chinese

参数

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

      Chinese

      height - 弹出对话框的最大高度。默认为“90%”。

Sample code 

Chinese

示例代码  

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

...

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

Chinese

系统用于计算当前屏幕大小的弹出对话框的宽度以支持移动设备。


Parameters

Chinese

参数

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

      Chinese

      width - 弹出对话框的最大宽度。默认为“90%”。

Sample code 

Chinese

示例代码  

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

...

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

Chinese

系统使用它来获取包含当前userview主题的meta元素的查询参数字符串。

Sample code 

Chinese

示例代码  

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

...

Used to generate a query string based on a parameters object

Chinese

用于基于参数对象生成查询字符串


Parameters

Chinese

参数

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

      Chinese

      params - 一个对象包含所有参数作为属性名称及其在数组中的值

Sample code 

Chinese

示例代码  

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

...

Used to encodes the URL parameters in a URL.

Chinese

用于在URL中 编码URL参数


Parameters

Chinese

参数

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

      Chinese

      url - 要编码参数的URL。注意:它使用“&”和“=”作为分隔符。

Sample code 

Chinese

示例代码  

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

...

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

Chinese

用于获取包含所有参数的对象作为属性名称及其在URL中的值 


Parameters

Chinese

参数

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

      Chinese

      url - 要解析的URL以检索数组中的所有参数及其值。

Sample code 

Chinese

示例代码  

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"]}

...

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

Chinese

用于将2个URL查询参数字符串合并到一个查询字符串中。


Parameters

Chinese

参数

    • queryString1 - first query parameters string

      Chinese

      queryString1 - 首先查询参数字符串

    • 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.

      Chinese

      queryString2 - 第二个查询参数字符串。如果两个查询字符串中都存在参数,则第二个查询字符串中的值将覆盖第一个查询字符串中的值。

Sample code 

Chinese

示例代码  

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

...