Fixed several bugs:
- Changed setup to be able to have the setting of the plugin even when cron is running. - Changed body to html to get the height of the iframe content to be able to adjust the height of the iframe - Added some filter to be sure that only text will receive the click event - Inverted place of comment and txtTaskContent
This commit is contained in:
@@ -1629,21 +1629,17 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
|
|
||||||
// manage task description
|
// manage task description
|
||||||
$input['content'] = ""; // by default empty :)
|
$input['content'] = ""; // by default empty :)
|
||||||
if ($options['txtTaskContent'] != '') {
|
|
||||||
$input['content'] = $options['txtTaskContent'];
|
|
||||||
} else if (!$pmProcess->fields["hide_case_num_title"]) {
|
|
||||||
$input['content'] = $LANG['processmaker']['item']['task']['case'].$caseInfo->caseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($pmProcess->fields["insert_task_comment"]) {
|
if ($pmProcess->fields["insert_task_comment"]) {
|
||||||
if ($input['content'] != '') {
|
$input['content'] .= $LANG['processmaker']['item']['task']['comment']."\n";
|
||||||
$input['content'] .= "\n";
|
|
||||||
}
|
}
|
||||||
$input['content'] .= $LANG['processmaker']['item']['task']['comment'];
|
|
||||||
}
|
if ($options['txtTaskContent'] != '') {
|
||||||
if ($input['content'] != '') {
|
$input['content'] .= $options['txtTaskContent']."\n";
|
||||||
$input['content'] .= "\n";
|
} else if (!$pmProcess->fields["hide_case_num_title"]) {
|
||||||
|
$input['content'] .= $LANG['processmaker']['item']['task']['case'].$caseInfo->caseName."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$input['content'] .= $LANG['processmaker']['item']['task']['manage'];
|
$input['content'] .= $LANG['processmaker']['item']['task']['manage'];
|
||||||
|
|
||||||
$input['is_private'] = 0;
|
$input['is_private'] = 0;
|
||||||
@@ -1956,20 +1952,14 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Summary of pre_show_item_processmakerticket
|
* Summary of pre_show_item_processmakerticket
|
||||||
* @param $parm
|
* @param $params
|
||||||
*/
|
*/
|
||||||
//private $pmCurrentCaseID = null ;
|
|
||||||
|
|
||||||
public static function pre_show_item_processmakerticket($params) {
|
public static function pre_show_item_processmakerticket($params) {
|
||||||
//global $LANG;
|
|
||||||
|
|
||||||
//$plug = new Plugin;
|
|
||||||
|
|
||||||
if (!is_array($params['item']) && is_subclass_of( $params['item'], 'CommonITILTask')) {
|
if (!is_array($params['item']) && is_subclass_of( $params['item'], 'CommonITILTask')) {
|
||||||
// must check if Task is bound to a PM task
|
// must check if Task is bound to a PM task
|
||||||
$pmTask = new PluginProcessmakerTask($params['item']->getType());
|
$pmTask = new PluginProcessmakerTask($params['item']->getType());
|
||||||
if ($pmTask->getFromDBByQuery("WHERE itemtype='".$params['item']->getType()."' and items_id=".$params['item']->getId())) {
|
if ($pmTask->getFromDBByQuery("WHERE itemtype='".$params['item']->getType()."' and items_id=".$params['item']->getId())) {
|
||||||
//echo 'Test' ;
|
|
||||||
$params['item']->fields['can_edit'] = false; // to prevent task edition
|
$params['item']->fields['can_edit'] = false; // to prevent task edition
|
||||||
|
|
||||||
// replace ##ticket.url##_PluginProcessmakerCase$processmakercases by a setActiveTab to the Case panel
|
// replace ##ticket.url##_PluginProcessmakerCase$processmakercases by a setActiveTab to the Case panel
|
||||||
@@ -1983,51 +1973,28 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
$params['item']->fields['content'] = str_replace( '##processmaker.taskcomment##', $taskComment, $params['item']->fields['content'] );
|
$params['item']->fields['content'] = str_replace( '##processmaker.taskcomment##', $taskComment, $params['item']->fields['content'] );
|
||||||
}
|
}
|
||||||
$taskJSId = "viewitem".$params['item']->getType().$params['item']->getId().$params['options']['rand'];
|
$taskJSId = "viewitem".$params['item']->getType().$params['item']->getId().$params['options']['rand'];
|
||||||
|
|
||||||
|
// special case for <hr> which will provoke the rendering to be split into several <p>
|
||||||
|
// add <p></p> which othervise will be missing
|
||||||
|
if (stripos($params['item']->fields['content'], '<hr>') !== false) {
|
||||||
|
$params['item']->fields['content'] = str_ireplace('<hr>', '<hr><p>', $params['item']->fields['content']).'</p>';
|
||||||
|
}
|
||||||
|
|
||||||
echo Html::scriptBlock( "
|
echo Html::scriptBlock( "
|
||||||
$('#$taskJSId').on('click', function ( ) {
|
$('#$taskJSId').find('.item_content').children().not('.read_more').on('click', function ( ) {
|
||||||
//debugger;
|
//debugger;
|
||||||
var tabindex = $('#tabspanel').next('div').find('a[href*=\"_glpi_tab=PluginProcessmaker\"]').parent().index();
|
var tabindex = $('#tabspanel').next('div').find('a[href*=\"_glpi_tab=PluginProcessmaker\"]').parent().index();
|
||||||
$('#tabspanel').next('div').tabs( 'option', 'active', tabindex );
|
$('#tabspanel').next('div').tabs( 'option', 'active', tabindex );
|
||||||
} ).css('cursor', 'pointer') ;
|
} ).css('cursor', 'pointer') ;
|
||||||
");
|
");
|
||||||
$params['item']->fields['content'] = str_replace( '##ticket.url##_PluginProcessmakerCase$processmakercases', "", $params['item']->fields['content'] ); //"<a href=\"javascript:pmActiveTab( );\">".$LANG['processmaker']['item']['task']['manage_text']."</a>"
|
|
||||||
|
$params['item']->fields['content'] = str_replace( "\n##ticket.url##_PluginProcessmakerCase\$processmakercases", "", $params['item']->fields['content'] );
|
||||||
|
|
||||||
if (isset( $params['item']->fields['tr_id'] )) {
|
if (isset( $params['item']->fields['tr_id'] )) {
|
||||||
$trID = $params['item']->fields['tr_id'];
|
$trID = $params['item']->fields['tr_id'];
|
||||||
//$params['item']->fields['content'] .= "<script>var loc$trID = document.getElementById('$trID'); loc$trID.style.cursor = 'pointer'; if (loc$trID.addEventListener) { loc$trID.addEventListener('click', function(){tabpanel.setActiveTab('PluginProcessmakerCase\$processmakercases');}, false);} else {loc$trID.attachEvent('onclick', function(){tabpanel.setActiveTab('PluginProcessmakerCase\$processmakercases');}); } </script>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if( ($plug = new Plugin) && !$plug->isActivated('arbehaviours') ) {
|
|
||||||
// if ($params['item']->getID() && is_subclass_of( $params['item'], 'CommonITILObject')) {
|
|
||||||
// // then we are in a ticket
|
|
||||||
// if (isset($_REQUEST['glpi_tab']) && $_SESSION['glpiactiveprofile']['interface'] != "helpdesk" ) {
|
|
||||||
// $data = self::multiexplode(array('$','_'), $_REQUEST['glpi_tab']);
|
|
||||||
// $itemtype = $data[0];
|
|
||||||
// // Default set
|
|
||||||
// $tabnum = 1;
|
|
||||||
// if (isset($data[1])) {
|
|
||||||
// $tabnum = $data[1];
|
|
||||||
// }
|
|
||||||
// elseif( $itemtype == -1 )
|
|
||||||
// $tabnum = -1 ;
|
|
||||||
|
|
||||||
// if( $data[0] == "processmaker" && $tabnum == 1 ) {
|
|
||||||
|
|
||||||
// }
|
|
||||||
// if( ($data[0] == "Ticket" && $tabnum == 2) || $tabnum == -1) {
|
|
||||||
// // then we are showing the Solution tab
|
|
||||||
// // then we must prevent solving of ticket if a case is running
|
|
||||||
// if( !PluginProcessmakerCase::canSolve( $params['item'] ) ) {
|
|
||||||
// // then output a new div to hide solution
|
|
||||||
// $pmHideSolution = true ;
|
|
||||||
// echo "<div id='toHideSolution' style='display: none;'>" ;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ function redimTaskFrame(taskFrame) {
|
|||||||
var newHeight;
|
var newHeight;
|
||||||
try {
|
try {
|
||||||
//var locElt = locContentDocument.getElementsByTagName("table")[0];
|
//var locElt = locContentDocument.getElementsByTagName("table")[0];
|
||||||
var locElt = taskFrame.contentDocument.getElementsByTagName("body")[0];
|
var locElt = taskFrame.contentDocument.getElementsByTagName("html")[0];
|
||||||
newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
||||||
if (newHeight < 400) {
|
if (newHeight < 400) {
|
||||||
newHeight = 400;
|
newHeight = 400;
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ function redimTaskFrame(taskFrame, delIndex) {
|
|||||||
var newHeight;
|
var newHeight;
|
||||||
try {
|
try {
|
||||||
//var locElt = locContentDocument.getElementsByTagName("table")[0];
|
//var locElt = locContentDocument.getElementsByTagName("table")[0];
|
||||||
var locElt = taskFrame.contentDocument.getElementsByTagName("body")[0];
|
var locElt = taskFrame.contentDocument.getElementsByTagName("html")[0];
|
||||||
newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
||||||
if (newHeight < 500) {
|
if (newHeight < 500) {
|
||||||
newHeight = 500;
|
newHeight = 500;
|
||||||
@@ -199,7 +199,7 @@ function onTaskFrameActivation(delIndex) {
|
|||||||
// try to redim caseIFrame
|
// try to redim caseIFrame
|
||||||
if (!redimIFrame) {
|
if (!redimIFrame) {
|
||||||
var newHeight;
|
var newHeight;
|
||||||
var locElt = locContentDocument.getElementsByTagName("body")[0];
|
var locElt = locContentDocument.getElementsByTagName("html")[0];
|
||||||
newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
||||||
|
|
||||||
tabs.getItem('task-' + delIndex).setHeight(newHeight);
|
tabs.getItem('task-' + delIndex).setHeight(newHeight);
|
||||||
|
|||||||
11
setup.php
11
setup.php
@@ -10,11 +10,6 @@ function plugin_init_processmaker() {
|
|||||||
// $objects = ['Ticket', 'Change', 'Problem'];
|
// $objects = ['Ticket', 'Change', 'Problem'];
|
||||||
$objects = ['Ticket'];
|
$objects = ['Ticket'];
|
||||||
|
|
||||||
$plugin = new Plugin();
|
|
||||||
if ($plugin->isInstalled('processmaker')
|
|
||||||
&& $plugin->isActivated('processmaker')
|
|
||||||
&& Session::getLoginUserID() ) {
|
|
||||||
|
|
||||||
Plugin::registerClass('PluginProcessmakerProcessmaker');
|
Plugin::registerClass('PluginProcessmakerProcessmaker');
|
||||||
|
|
||||||
Plugin::registerClass('PluginProcessmakerCase', array('addtabon' => array('Ticket')));
|
Plugin::registerClass('PluginProcessmakerCase', array('addtabon' => array('Ticket')));
|
||||||
@@ -97,6 +92,9 @@ function plugin_init_processmaker() {
|
|||||||
}
|
}
|
||||||
$PLUGIN_HOOKS['item_purge']['processmaker'] = $hooks;
|
$PLUGIN_HOOKS['item_purge']['processmaker'] = $hooks;
|
||||||
|
|
||||||
|
$plugin = new Plugin();
|
||||||
|
if ($plugin->isActivated('processmaker')
|
||||||
|
&& Session::getLoginUserID() ) {
|
||||||
$PLUGIN_HOOKS['add_javascript']['processmaker'] = array("js/domain.js.php");
|
$PLUGIN_HOOKS['add_javascript']['processmaker'] = array("js/domain.js.php");
|
||||||
$url = explode("/", $_SERVER['PHP_SELF']);
|
$url = explode("/", $_SERVER['PHP_SELF']);
|
||||||
$pageName = explode("?", array_pop($url));
|
$pageName = explode("?", array_pop($url));
|
||||||
@@ -106,12 +104,13 @@ function plugin_init_processmaker() {
|
|||||||
$PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/helpdesk.public.js.php";
|
$PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/helpdesk.public.js.php";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$PLUGIN_HOOKS['use_massive_action']['processmaker'] = 1;
|
$PLUGIN_HOOKS['use_massive_action']['processmaker'] = 1;
|
||||||
|
|
||||||
$CFG_GLPI['planning_types'][] = 'PluginProcessmakerTask';
|
$CFG_GLPI['planning_types'][] = 'PluginProcessmakerTask';
|
||||||
$PLUGIN_HOOKS['post_init']['processmaker'] = 'plugin_processmaker_post_init';
|
$PLUGIN_HOOKS['post_init']['processmaker'] = 'plugin_processmaker_post_init';
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the name and the version of the plugin - Needed
|
// Get the name and the version of the plugin - Needed
|
||||||
|
|||||||
Reference in New Issue
Block a user