mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Point check-in. Office Addin - create new workflow not yet complete.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5852 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,9 +1,42 @@
|
||||
/*
|
||||
* Prerequisites: mootools.v1.1.js
|
||||
* autocompleter.js
|
||||
* office_addin.js
|
||||
*/
|
||||
var OfficeMyTasks =
|
||||
{
|
||||
init: function()
|
||||
{
|
||||
OfficeMyTasks.setupEventHandlers();
|
||||
|
||||
if (window.queryObject.t)
|
||||
{
|
||||
OfficeMyTasks.openTask(window.queryObject.t);
|
||||
}
|
||||
|
||||
if ($('wrkUser'))
|
||||
{
|
||||
var autoUser = new Autocompleter.Ajax.Json($('wrkUser'), window.contextPath + '/service/office/getUsers',
|
||||
{
|
||||
postVar: 's',
|
||||
ajaxOptions:
|
||||
{
|
||||
method: 'get',
|
||||
headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'}
|
||||
},
|
||||
onRequest: function(el)
|
||||
{
|
||||
$('ajxUser').setStyle('display', '');
|
||||
},
|
||||
onComplete: function(el)
|
||||
{
|
||||
$('ajxUser').setStyle('display', 'none');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
setupEventHandlers: function()
|
||||
{
|
||||
var tasks = $$('#taskList .taskItem');
|
||||
|
||||
@@ -50,10 +83,13 @@ var OfficeMyTasks =
|
||||
// flag this task as open
|
||||
task.isOpen = true;
|
||||
|
||||
// highlight the item title
|
||||
task.addClass('taskItemSelected');
|
||||
|
||||
OfficeAddin.showStatusText("Loading task...", "ajax_anim.gif", false);
|
||||
|
||||
// ajax call to load task details
|
||||
var actionURL = "/alfresco/service/office/myTasksDetail?t=" + task.id;
|
||||
var actionURL = window.contextPath + "/service/office/myTasksDetail?t=" + task.id;
|
||||
var myAjax = new Ajax(actionURL, {
|
||||
method: 'get',
|
||||
headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'},
|
||||
@@ -92,7 +128,45 @@ var OfficeMyTasks =
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
openTask: function(taskId)
|
||||
{
|
||||
$(taskId).fireEvent("click");
|
||||
},
|
||||
|
||||
transitionTask: function(taskId, commandURL, successMessage)
|
||||
{
|
||||
OfficeAddin.showStatusText("Running workflow...", "ajax_anim.gif", false);
|
||||
|
||||
// ajax call to run workflow
|
||||
var myAjax = new Ajax(commandURL, {
|
||||
method: 'get',
|
||||
headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'},
|
||||
onComplete: function(textResponse, xmlResponse)
|
||||
{
|
||||
// Remove any trailing hash
|
||||
var href = window.location.href.replace("#", "")
|
||||
// Remove any previous "&st=" string
|
||||
href = href.replace(/[?&]st=([^&$]+)/g, "");
|
||||
// Remove any previous "&t=" string
|
||||
href = href.replace(/[?&]t=([^&$]+)/g, "");
|
||||
// Optionally add a status string
|
||||
if (successMessage != "")
|
||||
{
|
||||
var json = "{\"statusString\":\"" + successMessage + "\",\"statusCode\":true}";
|
||||
href += "&st=" + encodeURI(json);
|
||||
href += "&t=" + taskId;
|
||||
}
|
||||
window.location.href = href;
|
||||
},
|
||||
onFailure: function()
|
||||
{
|
||||
OfficeAddin.showStatusText("Couldn't run workflow", "action_failed.gif", true);
|
||||
}
|
||||
});
|
||||
myAjax.request();
|
||||
}
|
||||
};
|
||||
|
||||
window.addEvent('domready', OfficeMyTasks.init);
|
||||
window.addEvent('domready', OfficeMyTasks.init);
|
||||
|
Reference in New Issue
Block a user