Files
tomolino-processmaker/js/cases.helpdesk.js
tomolimo ca197c9f43 Cherry pick from 3.5.10 to 3.6.16
Added feature GLPI_TASK_PREVENT_REASSIGN to prevent assignment of a list of users (can be PM UID, GLPI id, GLPI logon) to a specific task (can be task list)

Cherry pick from 3.4.24 to 3.6.15

Cherry pick from 3.4.23
Added a proxy and SSL mangement to external application calls Added an escape DB for ticket name and ticket solution description Updated translation
Added swingcall.php file (to test swing api)
Set version to 3.6.14

Cherry pick from version 3.4.22
Added a new case variable to be able to create information tasks GLPI_ITEM_INFORMATION_TASK

Cherry pick from 3.4.21
Revert back $_REQUEST into $_POST

cherry pick from version 3.4.20
Added Send reminder Added unclaim task
Rewrite some code for clearer maintenance

commented line HTTPROXY setup

Bugfixe : remove the default setting of a followup

bugfixes:
- list the processes according to the type of ticket (request or incident).
- set variable 'content' according to the variable sent by processmaker in the addItemFollowup function
- logged error information of curl

Set content to tinymce content field

Bugfixes : Update the taskId (value and letter case)

Bugfixes requests. bad syntax with the new ORM

Changed folder properties

Changed text Deleted unused param

Added a hook to manage the change of user login
Cleaning of unused code Set version to 3.6.8

add condition to set user = admin when script is run in crontask fixes
2020-10-07 15:40:05 +02:00

122 lines
4.0 KiB
JavaScript

var oldHandler;
var submitButton;
var caseIFrame;
function onClickContinue(obj) {
//debugger;
contentDocument = caseIFrame.contentDocument;
var txtAreaUserRequestSumUp = contentDocument.getElementById('form[UserRequestSumUp]');
if ($("textarea[name='content']").val() == '') {
if (txtAreaUserRequestSumUp) {
tinymce.activeEditor.setContent($(txtAreaUserRequestSumUp).val().replace(/(\r\n)|(\r)|(\n)/g, '<br>'));
} else {
tinymce.activeEditor.setContent('_');
}
}
// call old handler if any
//debugger;
if (obj != undefined && oldHandler) {
oldHandler(obj.target);
}
// hide the iFrame
caseIFrame.style.visibility = 'hidden';
// trigger a click on the 'add' button of the ticket
submitButton.click();
}
// used to find an element in a list and to hide it!
function bGLPIHideElement(eltList, attribute, value) {
var ret = false;
for (var i = 0; i < eltList.length; i++) {
var node = eltList[i];
if (node.getAttribute(attribute) == value) {
// hide the link
node.style.display = 'none';
ret = true;
}
}
return ret;
}
function onLoadFrame( evt, caseId, delIndex, caseNumber, processName ) {
var caseTimerCounter = 0;
var redimIFrame = false;
var bButtonContinue = false;
var caseTimer = window.setInterval(function () {
//debugger ;
// look for caseiframe iFrame
caseIFrame = document.getElementById('caseiframe');
var contentDocument;
try {
contentDocument = caseIFrame.contentDocument;
} catch (ex) {
contentDocument = false;
}
if (caseIFrame != undefined && contentDocument) {
var buttonContinue = contentDocument.getElementById('form[btnGLPISendRequest]');
var linkList = contentDocument.getElementsByTagName('a');
if (!bButtonContinue && buttonContinue != undefined && linkList != undefined && linkList.length > 0) {
bButtonContinue = true; //window.clearInterval(caseTimer); // to be sure that it will be done only one time
// change action for the attached form and add some parameters
//debugger;
bGLPIHideElement(linkList, 'href', 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN');
oldHandler = buttonContinue.onclick;
buttonContinue.onclick = onClickContinue;
submitButton = $("input[name='add'][type=submit]")[0];
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_action' value='routecase'/>");
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_caseguid' value='" + caseId + "'/>");
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_delindex' value='" + delIndex + "'/>");
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_casenum' value='" + caseNumber + "'/>");
$("input[name='name'][type=text]")[0].value = processName;
}
// try to redim caseIFrame
if (!redimIFrame) {
redimIFrame = true; // to prevent several timer creation
// redim one time
redimTaskFrame(caseIFrame);
// redim each second
var redimFrameTimer = window.setInterval(function () {
redimTaskFrame(caseIFrame);
}, 1000);
}
}
if ( caseTimerCounter > 3000 ) {
window.clearInterval(caseTimer);
} else {
caseTimerCounter = caseTimerCounter + 1;
}
}, 10);
}
function redimTaskFrame(taskFrame) {
var newHeight;
try {
//var locElt = locContentDocument.getElementsByTagName("table")[0];
var locElt = taskFrame.contentDocument.getElementsByTagName("html")[0];
newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
if (newHeight < 400) {
newHeight = 400;
}
taskFrame.height = newHeight;
} catch (e) {
}
}