update fetchKnowledge and html.formticket
This commit is contained in:
parent
b26e9be36f
commit
04a024570c
@ -22,9 +22,6 @@
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', '1'); // Disables token renewal
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', '1');
|
||||
}
|
||||
@ -34,13 +31,30 @@ if (!defined('NOREQUIREAJAX')) {
|
||||
if (!defined('NOREQUIRESOC')) {
|
||||
define('NOREQUIRESOC', '1');
|
||||
}
|
||||
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1');
|
||||
}
|
||||
// Do not check anti CSRF attack test
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1');
|
||||
}
|
||||
// If there is no need to load and show top and left menu
|
||||
if (!defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1');
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
include '../../main.inc.php';
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$idticketgroup = GETPOST('idticketgroup', 'aZ09');
|
||||
$idticketgroup = GETPOST('idticketgroup', 'aZ09');
|
||||
$lang = GETPOST('lang', 'aZ09');
|
||||
$popupurl = GETPOST('popupurl', 'bool');
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -69,7 +83,33 @@ if ($action == "getKnowledgeRecord") {
|
||||
$response = array();
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$response[] = array('title'=>$obj->question,'ref'=>$obj->url,'answer'=>$obj->answer,'url'=>$obj->url);
|
||||
if ($popupurl == "false") {
|
||||
$url = "<a href=\"".$obj->url. "\" target=\"_blank\">".$obj->url."</a></li>";
|
||||
$response[] = array('title'=>$obj->question,'ref'=>$obj->url,'answer'=>$obj->answer,'url'=>$url);
|
||||
} else {
|
||||
$name = $obj->ref;
|
||||
$buttonstring = $obj->url;
|
||||
$url = $obj->url;
|
||||
$urltoprint = '<a class="button_'.$name.'" style="cursor:pointer">'.$buttonstring.'</a>';
|
||||
$urltoprint .= '<!-- Add js code to open dialog popup on dialog -->';
|
||||
$urltoprint .= '<script language="javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(".button_'.$name.'").click(function () {
|
||||
console.log("Open popup with jQuery(...).dialog() on URL '.dol_escape_js($url).'")
|
||||
var $dialog = $(\'<div></div>\').html(\'<iframe class="iframedialog" style="border: 0px;" src="'.$url.'" width="100%" height="98%"></iframe>\')
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
height: (window.innerHeight - 150),
|
||||
width: \'80%\',
|
||||
title: "'.dol_escape_js($label).'"
|
||||
});
|
||||
$dialog.dialog(\'open\');
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$response[] = array('title'=>$obj->question,'ref'=>$obj->url,'answer'=>$obj->answer,'url'=>$urltoprint);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -258,7 +258,7 @@ class FormTicket
|
||||
|
||||
if (idgroupticket != "") {
|
||||
$.ajax({ url: \''.DOL_URL_ROOT.'/core/ajax/fetchKnowledgeRecord.php\',
|
||||
data: { action: \'getKnowledgeRecord\', idticketgroup: idgroupticket, token: \''.newToken().'\', lang:\''.$langs->defaultlang.'\'},
|
||||
data: { action: \'getKnowledgeRecord\', idticketgroup: idgroupticket, token: \''.newToken().'\', lang:\''.$langs->defaultlang.'\', popupurl:false},
|
||||
type: \'GET\',
|
||||
success: function(response) {
|
||||
var urllist = \'\';
|
||||
@ -266,7 +266,7 @@ class FormTicket
|
||||
response = JSON.parse(response)
|
||||
for (key in response) {
|
||||
console.log(response[key])
|
||||
urllist += "<li>" + response[key].title + ": " + \'<a href="\'+response[key].ref + "\">"+response[key].url+"</a></li>";
|
||||
urllist += "<li>" + response[key].title + ": " +response[key].url+"</li>";
|
||||
}
|
||||
if (urllist != "") {
|
||||
console.log(urllist)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user