AUI.add( 'liferay-workflow-tasks', function(A) { var WorkflowTasks = { onTaskClick: function(event, randomId) { var instance = this; var icon = event.currentTarget; var li = icon.get('parentNode'); event.preventDefault(); var content = null; if (li.hasClass('task-due-date-link')) { content = '#' + randomId + 'updateDueDate'; } else if (li.hasClass('task-assign-to-me-link')) { content = '#' + randomId + 'updateAsigneeToMe'; } else if (li.hasClass('task-assign-link')) { content = '#' + randomId + 'updateAsignee'; } title = icon.text(); uri = icon.getAttribute('data-dialogUri'); WorkflowTasks.showPopup(icon.getAttribute('data-href'), A.one(content), title, randomId); }, showPopup: function(url, content, title, randomId) { var form = A.Node.create('
'); form.setAttribute('action', url); form.setAttribute('method', 'POST'); var comments = A.one('#' + randomId + 'updateComments'); var dirName = A.one('#' + randomId + 'dirName'); if (dirName) { form.append(dirName); } if (content) { form.append(content); content.show(); } if (comments) { form.append(comments); var yKienXuLy = A.one('#yKienXuLy'); if(yKienXuLy) { comments.one('textarea').set('value', yKienXuLy.one('textarea').get('value')); } comments.show(); } var dialog = Liferay.Util.Window.getWindow( { dialog: { bodyContent: form, height: 420, modal: true, resizable: false, cache: false, centered: true, toolbars: { footer: [ { label: '\u0110\u1ed3\u006e\u0067\u0020\u00fd', on: { click: function() { if (uri) { dialog.hide(); Liferay.Util.Window.getWindow({ dialog: { cache: false, centered: true, draggable: true, destroyOnHide: true, destroyOnClose: true, height: 800, modal: true, resizable: false, width: 800 }, id: 'dialog', title: title + '\u0054\u0068\u00f4\u006e\u0067\u0020\u0062\u00e1\u006f\u0020\u0074\u0069\u006e\u0020\u006e\u0068\u1eaf\u006e', uri: uri, iframeCssClass: 'dialog-iframe', }).after('destroy', function(event) { submitForm(form); }) } else { submitForm(form); } } } }, { label: '\u0048\u1ee7\u0079\u0020\u0062\u1ecf', on: { click: function() { dialog.hide(); } } } ] }, width: 600 }, title: title } ); } }; Liferay.WorkflowTasks = WorkflowTasks; }, '', { requires: ['liferay-util-window'] } ); Liferay.provide(window, 'refreshPortlet', function() { }, ['aui-dialog','aui-dialog-iframe'] ); Liferay.provide(window, 'closePopup', function() { });