<?php include '../../../inc/includes.php'; header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); Session::checkLoginUser(); if (!isset($_POST['type'])) { exit; } if (!isset($_POST['parenttype'])) { exit; } if (($item = getItemForItemtype($_POST['type'])) && ($parent = getItemForItemtype($_POST['parenttype']))) { if (isset($_POST[$parent->getForeignKeyField()]) && isset($_POST["id"]) && $parent->getFromDB($_POST[$parent->getForeignKeyField()])) { PluginTalkTicket::showSubForm($item, $_POST["id"], array('parent' => $parent, 'tickets_id' => $_POST["tickets_id"])); } else { _e('Access denied'); } } else { if ($_POST['type'] == "Solution") { PluginTalkTicket::showSubFormSolution($_POST["tickets_id"]); } } Html::ajaxFooter();
<?php include '../../../inc/includes.php'; //change mimetype header("Content-type: application/javascript"); if (!$plugin->isInstalled("talk") || !$plugin->isActivated("talk") || !isset($_SESSION['plugin_talk_lasttickets_id'])) { exit; } $ticket = new Ticket(); $ticket->getFromDB(intval($_SESSION['plugin_talk_lasttickets_id'])); $talkticket = new PluginTalkTicket(); $tab_title = $talkticket->getTabNameForItem($ticket); $tab_url = $CFG_GLPI['root_doc'] . "/ajax/common.tabs.php?" . "_target=/glpi/0.85-git/front/ticket.form.php&_itemtype=Ticket" . "&_glpi_tab=PluginTalkTicket\$1&id=" . $ticket->getID(); $JS = <<<JAVASCRIPT \$(document).ready(function() { //need a timeout for execute code after tabpanel initialization window.setTimeout(function() { function getUrlVar(key) { var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search); return result && unescape(result[1]) || ""; } //function for insert tab this.inserTab = function() { var tabpanel = \$('#tabspanel + div.ui-tabs'), newtab_html_title = "<li title='{$tab_title}'><a href='{$tab_url}'>{$tab_title}</a></li>"; //insert in second position tabpanel.find('ul li').first().after(newtab_html_title);