diff --git a/ajax/autocomplete.php b/ajax/autocomplete.php
deleted file mode 100755
index bd0fca5a..00000000
--- a/ajax/autocomplete.php
+++ /dev/null
@@ -1,113 +0,0 @@
-.
- --------------------------------------------------------------------------
- */
-
-include ('../../../inc/includes.php');
-
-$DB = new DB;
-//header("Content-Type: text/html; charset=UTF-8");
-if (isset($_GET['table'])) {
- $table = $DB->escape(utf8_decode($_GET['table']));
-} else {
- die("No 'table' parameter");
-}
-if (isset($_GET['columns'])) {
- $columns = $DB->escape(utf8_decode($_GET['columns']));
- $columns = str_replace(' ', '', $columns); // suppress whitespaces
- $columns_arr = explode(',', $columns);
-} else {
- die("No 'columns' parameter");
-}
-if (isset($_GET['jointtables']) && $_GET['jointtables'] != '') {
- $firstword = strtok($_GET['jointtables'], ' ');
- $jointreservedword = array("LEFT", "INNER", "RIGHT", "JOIN", "NATURAL", "STRAIGHT_JOIN");
- if ( in_array(strtoupper($firstword), $jointreservedword) ) {
- $jointtables = $DB->escape(utf8_decode($_GET['jointtables']));
- } else {
- $jointtables = ", ".$DB->escape(utf8_decode($_GET['jointtables']));
- }
-} else {
- $jointtables = "";
-}
-if (isset($_GET['jointcolumns']) && $_GET['jointcolumns'] != '') {
- $jointcolumns = ", ".$DB->escape(utf8_decode($_GET['jointcolumns']));
-} else {
- $jointcolumns = "";
-}
-if (isset($_GET['jointcriteria'])) {
- $jointcriteria = $DB->escape(urldecode($_GET['jointcriteria']));
-} else {
- $jointcriteria = "";
-}
-if (isset($_GET['term'])) {
- $term = $DB->escape(utf8_decode($_GET['term']));
-} else {
- $term = "";
-}
-if (isset($_GET['othercriteria'])) {
- $othercriteria = stripslashes(htmlspecialchars_decode(urldecode($_GET['othercriteria'])));
-} else {
- $othercriteria = "";
-}
-if (isset($_GET['ordercriteria'])) {
- $ordercriteria = stripslashes(htmlspecialchars_decode(urldecode($_GET['ordercriteria'])));
- $ordercriteria = (strtoupper(substr($ordercriteria, 0, 9)) == 'ORDER BY ') ? $ordercriteria : 'ORDER BY '.$ordercriteria ;
-} else {
- $ordercriteria = "";
-}
-$query = "SELECT $table.id $jointcolumns from $table $jointtables where (";
-$or = "";
-foreach ($columns_arr as $column) {
- if (strpos($column,".") !== false) {
- // table is present in column name
- $query .= $or.$column." like '%".$term."%' ";
- } else {
- // no table in column name -> add it
- $query .= $or.$table.".".$column." like '%".$term."%' ";
- }
- $or = " OR ";
-}
-$query .= ") ".$jointcriteria." ".$othercriteria." ".$ordercriteria;
-//Toolbox::logInFile("autocomplete", $query."\n");
-//var_dump($query);
-if ($result=$DB->query($query)) {
- while ($data=$DB->fetchAssoc($result)) {
-//var_dump($data);
- $datas[] = $data;
-/* $datas[] =
- array(
- 'id' => $data['id'],
- 'label' => $data['description'],
- 'value' => $data['id']
- )
- ;
-*/ }
-}
-//var_dump($datas);
-if (isset($datas))
- echo json_encode($datas);
-else
- echo json_encode('');
-?>
diff --git a/ajax/getconfig.php b/ajax/getconfig.php
deleted file mode 100755
index ec78b663..00000000
--- a/ajax/getconfig.php
+++ /dev/null
@@ -1,59 +0,0 @@
-.
- --------------------------------------------------------------------------
- */
-
-define('GLPI_ROOT', '../../..');
-include (GLPI_ROOT . "/inc/includes.php");
-
-$forbidden_tables = ['glpi_users', 'glpi_authldaps', 'glpi_authmails', 'glpi_certificates'];
-$DB = new DB;
-$tables = file_get_contents('php://input');
-if (isset($tables)) {
- $tables = json_decode($tables);
-} else {
- die("No 'tables' contained in body of POST request 'getconfig'");
-}
-$datas = [];
-foreach($tables as $key => $tablecolumn) {
- $table = $tablecolumn->table;
- $columns = explode(",", str_replace(' ', '', $tablecolumn->column)); // suppress spaces and split on comma
- $where = ($tablecolumn->where ? " WHERE ".$tablecolumn->where : "");
- if (!in_array(strtolower($table), $forbidden_tables)) {
- $query = "SELECT `".implode("`, `", $columns)."` FROM glpi_plugin_archimap_configs $where ORDER BY `".implode("`, `", $columns)."`";
-//Toolbox::logInFile("gettables", $query."\n");
-//var_dump($query);
- if ($result=$DB->query($query)) {
- while ($data=$DB->fetchAssoc($result)) {
-// $datas[$key][]=$data[$key];
-//Toolbox::logInFile("gettables", print_r($datas,TRUE)."\n");
- $datas[$key][$data[$columns[0]]]=$data;
- }
- }
- }
-}
-//var_dump($datas);
-//Toolbox::logInFile("gettables", print_r($datas,TRUE)."\n");
-echo json_encode($datas);
-?>
diff --git a/ajax/getcustomproperties.php b/ajax/getcustomproperties.php
deleted file mode 100755
index 576d623a..00000000
--- a/ajax/getcustomproperties.php
+++ /dev/null
@@ -1,69 +0,0 @@
-.
- --------------------------------------------------------------------------
- */
-
-include ('../../../inc/includes.php');
-
-
-$forbidden_tables = ['glpi_users', 'glpi_authldaps', 'glpi_authmails', 'glpi_certificates'];
-$DB = new DB;
-
-$cells = file_get_contents('php://input');
-//Toolbox::logInFile("getcustomproperties", $cells."\n");
-if (isset($cells)) {
- $cells = json_decode($cells);
-} else {
- die("No 'cells' contained in body of POST request 'getcustomproperties'");
-}
-$data = [];
-foreach($cells as $id => $cell) {
- $key = $DB->escape($cell->key);
- $table = $DB->escape($cell->tablename);
- if (isset($cell->jointtables)) {
- $firstword = strtok($cell->jointtables, ' ');
- $jointreservedword = array("LEFT", "INNER", "RIGHT", "JOIN", "NATURAL", "STRAIGHT_JOIN");
- if ( in_array(strtoupper($firstword), $jointreservedword)
- || trim($cell->jointtables) == "") {
- $jointtables = $DB->escape($cell->jointtables);
- } else {
- $jointtables = ", ".$DB->escape($cell->jointtables);
- }
- } else {
- $jointtables = "";
- }
- $jointcolumns = (isset($cell->jointcolumns))? ", ".$DB->escape($cell->jointcolumns) : "";
- $jointcriteria = (isset($cell->jointcriteria))? $DB->escape($cell->jointcriteria) : "";
- if (!in_array(strtolower($table), $forbidden_tables)) {
- $query = "SELECT $table.id as glpi_id $jointcolumns from $table $jointtables \nwhere $table.id = $id $jointcriteria";
-//Toolbox::logInFile("getcustomproperties", $query."\n");
-//var_dump($query);
- if ($result=$DB->query($query)) {
- $data[$key]=$DB->fetchAssoc($result);
- }
- }
-}
-//var_dump($data);
-echo json_encode($data);
-?>
diff --git a/ajax/gettables.php b/ajax/gettables.php
deleted file mode 100755
index 27cc7958..00000000
--- a/ajax/gettables.php
+++ /dev/null
@@ -1,55 +0,0 @@
-.
- --------------------------------------------------------------------------
- */
-
-define('GLPI_ROOT', '../../..');
-include (GLPI_ROOT . "/inc/includes.php");
-
-$forbidden_tables = ['glpi_users', 'glpi_authldaps', 'glpi_authmails', 'glpi_certificates'];
-$DB = new DB;
-$tables = file_get_contents('php://input');
-if (isset($tables)) {
- $tables = json_decode($tables);
-} else {
- die("No 'tables' contained in body of POST request 'gettables'");
-}
-$datas = [];
-foreach($tables as $key => $tablecolumn) {
- $table = $tablecolumn->table;
- $column = $tablecolumn->column;
- if (!in_array(strtolower($table), $forbidden_tables)) {
- $query = "SELECT DISTINCT $column FROM $table";
-//Toolbox::logInFile("gettables", $query."\n");
-//var_dump($query);
- if ($result=$DB->query($query)) {
- while ($data=$DB->fetchAssoc($result)) {
- $datas[$key][]=$data[$column];
- }
- }
- }
-}
-//var_dump($datas);
-echo json_encode($datas);
-?>
diff --git a/ajax/postconfig.php b/ajax/postconfig.php
deleted file mode 100755
index 96c0a321..00000000
--- a/ajax/postconfig.php
+++ /dev/null
@@ -1,51 +0,0 @@
-.
- --------------------------------------------------------------------------
- */
-
-define('GLPI_ROOT', '../../..');
-include (GLPI_ROOT . "/inc/includes.php");
-
-$DB = new DB;
-$keys = file_get_contents('php://input');
-Toolbox::logInFile("gettables", "setconfig ".$keys."\n");
-if (isset($keys)) {
- $keys = json_decode($keys);
-} else {
- die("No 'keys' contained in body of POST request 'getconfig'");
-}
-$datas = [];
-foreach($keys as $key => $typevalue) {
- $type = $typevalue->type;
- $value = $typevalue->value;
- $query = "UPDATE glpi_plugin_archimap_configs SET value = '$value' WHERE type = '$type' and `key` = '$key';";
-Toolbox::logInFile("gettables", "postconfig ".$query."\n");
-//var_dump($query);
- $result=$DB->query($query);
- $datas[$key] = $DB->affectedRows();
-}
-//var_dump($datas);
-Toolbox::logInFile("gettables", "postconfig ".print_r($datas,TRUE)."\n");
-echo json_encode($result);
-?>
diff --git a/ajax/putconfig.php b/ajax/putconfig.php
deleted file mode 100755
index 47825575..00000000
--- a/ajax/putconfig.php
+++ /dev/null
@@ -1,49 +0,0 @@
-.
- --------------------------------------------------------------------------
- */
-
-define('GLPI_ROOT', '../../..');
-include (GLPI_ROOT . "/inc/includes.php");
-
-$DB = new DB;
-$keys = file_get_contents('php://input');
-if (isset($keys)) {
- $keys = json_decode($keys);
-} else {
- die("No 'keys' contained in body of POST request 'getconfig'");
-}
-$datas = [];
-foreach($keys as $key => $typevalue) {
- $type = $typevalue->type;
- $value = $typevalue->value;
- $query = "INSERT INTO glpi_plugin_archimap_configs (type, `key`, value ) VALUES ('$type', '$key', '$value');";
-//Toolbox::logInFile("gettables", "puttconfig ".$query."\n");
-//var_dump($query);
- $result=$DB->query($query);
- $datas[$key] = $DB->insertId();
-}
-//var_dump($result);
-echo json_encode($datas);
-?>
diff --git a/ajax/updategraph.php b/ajax/updategraph.php
deleted file mode 100755
index b8252dae..00000000
--- a/ajax/updategraph.php
+++ /dev/null
@@ -1,114 +0,0 @@
-.
- --------------------------------------------------------------------------
- */
-
-include ('../../../inc/includes.php');
-Toolbox::logInFile("updategraph", "GET".print_r($_GET,TRUE)."\n");
-Toolbox::logInFile("updategraph", "POST".print_r($_POST,TRUE)."\n");
-
-if (!isset($_GET["id"])) $_GET["id"] = "";
-if (!isset($_GET["withtemplate"])) $_GET["withtemplate"] = "";
-$graph=new PluginArchimapGraph();
-$graph_item=new PluginArchimapGraph_Item();
-
-if (isset($_POST["add"])) {
-
- $graph->check(-1, CREATE,$_POST);
- $newID=$graph->add($_POST);
- if ($_SESSION['glpibackcreated']) {
- Html::redirect($graph->getFormURL()."?id=".$newID);
- }
- Html::back();
-
-} else if (isset($_POST["delete"])) {
-
- $graph->check($_POST['id'], DELETE);
- $graph->delete($_POST);
- $graph->redirectToList();
-
-} else if (isset($_POST["restore"])) {
-
- $graph->check($_POST['id'], PURGE);
- $graph->restore($_POST);
- $graph->redirectToList();
-
-} else if (isset($_POST["purge"])) {
-
- $graph->check($_POST['id'], PURGE);
- $graph->delete($_POST,1);
- $graph->redirectToList();
-
-} else if (isset($_POST["update"])) {
-
-Toolbox::logInFile("updategraph", "update ".$_POST['id']."\n");
- $graph->check($_POST['id'], UPDATE);
- $graph->link($_POST['id'], $_POST['graph']);
- $graph->update($_POST);
- Html::back();
-
-} else if (isset($_POST["additem"])) {
-
- if (!empty($_POST['itemtype'])&&$_POST['items_id']>0) {
- $graph_item->check(-1, UPDATE, $_POST);
- $graph_item->addItem($_POST);
- }
- Html::back();
-
-} else if (isset($_POST["deleteitem"])) {
-
- foreach ($_POST["item"] as $key => $val) {
- $input = array('id' => $key);
- if ($val==1) {
- $graph_item->check($key, UPDATE);
- $graph_item->delete($input);
- }
- }
- Html::back();
-
-} else if (isset($_POST["deletegraphs"])) {
-
- $input = array('id' => $_POST["id"]);
- $graph_item->check($_POST["id"], UPDATE);
- $graph_item->delete($input);
- Html::back();
-
-} else {
-
- $graph->checkGlobal(READ);
-
- $plugin = new Plugin();
- if ($plugin->isActivated("environment")) {
- Html::header(PluginArchimapGraph::getTypeName(2),
- '',"assets","pluginenvironmentdisplay","archimap");
- } else {
- Html::header(PluginArchimapGraph::getTypeName(2), '', "assets",
- "pluginarchimapmenu");
- }
- $graph->display($_GET);
-
- Html::footer();
-}
-
-?>
diff --git a/archimap.xml b/archimap.xml
index 410df3dc..474719fc 100755
--- a/archimap.xml
+++ b/archimap.xml
@@ -24,6 +24,11 @@
Eric Feron
+
+ 3.2.13
+ ~10.0.0
+ https://github.com/ericferon/glpi-archimap/releases/download/v3.2.13/archimap-v3.2.13.zip
+
3.2.12
~10.0.0
diff --git a/drawio-integration/ajax/getconfig.php b/drawio-integration/ajax/getconfig.php
index 48a614b9..e7e7152e 100755
--- a/drawio-integration/ajax/getconfig.php
+++ b/drawio-integration/ajax/getconfig.php
@@ -33,25 +33,34 @@
if (isset($tables)) {
$tables = json_decode($tables);
} else {
- die("No 'tables' contained in body of POST request 'getconfig'");
+ die("No query parameters contained in body of POST request 'getconfig'");
}
$datas = [];
foreach($tables as $key => $tablecolumn) {
- $table = $tablecolumn->table;
+ $table = "glpi_plugin_archimap_configs";
$columns = explode(",", str_replace(' ', '', $tablecolumn->column)); // suppress spaces and split on comma
- $where = ($tablecolumn->where ? " WHERE ".$tablecolumn->where : "");
- if (!in_array(strtolower($table), $forbidden_tables)) {
- $query = "SELECT `".implode("`, `", $columns)."` FROM glpi_plugin_archimap_configs $where ORDER BY `".implode("`, `", $columns)."`";
+ if (isset($tablecolumn->type))
+ $where = "`type` = '".strtok($tablecolumn->type, " (\t")."'"; // take only first word
+ else
+ $where = "";
+ if (isset($tablecolumn->type) && isset($tablecolumn->key)) $where .= " AND ";
+ if (isset($tablecolumn->key)) $where .= "`key` = '".strtok($tablecolumn->key, " (\t")."'";
+ $query = "SELECT `".implode("`, `", $columns)."` FROM glpi_plugin_archimap_configs".($where?" WHERE ".$where:"")." ORDER BY `".implode("`, `", $columns)."`";
//Toolbox::logInFile("gettables", $query."\n");
//var_dump($query);
if ($result=$DB->query($query)) {
- while ($data=$DB->fetchAssoc($result)) {
-// $datas[$key][]=$data[$key];
+ if ($DB->numrows($result)>0)
+ { while ($data=$DB->fetchAssoc($result)) {
//Toolbox::logInFile("gettables", print_r($datas,TRUE)."\n");
- $datas[$key][$data[$columns[0]]]=$data;
+ $datas[$key][$data[$columns[0]]]=$data;
+ }
}
+ else
+ $datas[$key]["error"]["msg"]="No data found";
+ }
+ else {
+ $datas[$key]["error"]["msg"]="SQL error";
}
- }
}
//var_dump($datas);
//Toolbox::logInFile("gettables", print_r($datas,TRUE)."\n");
diff --git a/drawio-integration/diagram-editor.js b/drawio-integration/diagram-editor.js
index b6394cb0..cf7c28e8 100755
--- a/drawio-integration/diagram-editor.js
+++ b/drawio-integration/diagram-editor.js
@@ -27,6 +27,36 @@ function hideGlpi()
var header10 = document.getElementsByTagName('header')[0];
if (header10) header10.style.display = 'none';
};
+function showGlpi()
+{
+ // come back on the first tab of GLPI
+ // remove iframes
+ var iframe = document.getElementsByTagName('iframe');
+ while (iframe && iframe.length>0)
+ {
+ iframe[0].remove();
+ }
+ // display back the header, footer and page HTML elements
+ var header = document.getElementById('header');
+ if (header) header.style.display = 'inline';
+ var footer = document.getElementById('footer');
+ if (footer && footer.style) footer.style.display = 'inline';
+ var page = document.getElementById('page');
+ if (page) page.style.display = 'inline';
+ var aside = document.getElementsByTagName('aside')[0];
+ if (aside) aside.style.display = 'flex';
+ var header10 = document.getElementsByTagName('header')[0];
+ if (header10) header10.style.display = 'flex';
+ var diagramtab = $('a[title="Diagram"]');
+ if (diagramtab.length > 0) diagramtab[0].click();
+ // add event on 2nd tab to show full screen drawing pane
+ document.querySelector('a[title="Drawing Pane"]').addEventListener("click",(function() {hideGlpi();showDrawio()}));
+};
+function hideDrawio()
+{
+ var geeditor = document.getElementsByTagName('geEditor')[0];
+ if (geeditor) geeditor.style.display = 'none';
+};
// display drawio editor
function showDrawio()
{
@@ -120,21 +150,21 @@ DiagramEditor.prototype.editElement = function(elem)
var getSessionToken = function()
{
let tables = {};
- tables['app_token'] = {'table' : 'glpi_plugin_archimap_configs',
- 'column' : 'key, value',
- 'where' : 'type = "APP_TOKEN"'};
+ tables['app_token'] = {'column' : 'key, value',
+ 'type' : 'APP_TOKEN'};
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0)) {
app_token = JSON && JSON.parse(xhr.responseText) || $.parseJSON(xhr.responseText);
- user.app_token = app_token['app_token'][''].value;
- var xhr2 = new XMLHttpRequest();
- xhr2.onreadystatechange = function() {
- if (xhr2.readyState == 4 && (xhr2.status == 200 || xhr2.status == 0)) {
- session_token = JSON && JSON.parse(xhr2.responseText) || $.parseJSON(xhr2.responseText);
- user.session_token = session_token.session_token;
- // create the "libraries" object in this.config (see https://desk.draw.io/support/solutions/articles/16000058316)
- diaedit.config = {'libraries' : [ {
+ if (app_token['app_token']['']) {
+ user.app_token = app_token['app_token'][''].value;
+ var xhr2 = new XMLHttpRequest();
+ xhr2.onreadystatechange = function() {
+ if (xhr2.readyState == 4 && (xhr2.status == 200 || xhr2.status == 0)) {
+ session_token = JSON && JSON.parse(xhr2.responseText) || $.parseJSON(xhr2.responseText);
+ user.session_token = session_token.session_token;
+ // create the "libraries" object in this.config (see https://desk.draw.io/support/solutions/articles/16000058316)
+ diaedit.config = {'libraries' : [ {
"title": { "main": "Custom"},
"entries": [ { "id": "glpi",
"title": { "main": "GLPI"},
@@ -143,71 +173,72 @@ DiagramEditor.prototype.editElement = function(elem)
} ]
} ]
};
- // fill in config with libraries from "getlibraries" on central repository
- var getLibraries = function(type, key, libconfig, success, error)
- {
- let tables = {};
- tables['param'] = {'table' : 'glpi_plugin_archimap_configs',
- 'column' : 'key, value',
- 'where' : 'type = "LIBXML"' + (key ? ' and `key` = "'+key+'"' : '')};
- var xhr3 = new XMLHttpRequest();
- xhr3.onreadystatechange = function() {
- if (xhr3.readyState == 4 && (xhr3.status == 200 || xhr3.status == 0)) {
- datas = JSON && JSON.parse(xhr3.responseText) || $.parseJSON(xhr3.responseText);
- success(datas, libconfig);
- }
- };
- xhr3.open("POST", window.DRAWIOINTEGRATION_PATH + "/ajax/getconfig.php", true);
- xhr3.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
- xhr3.send(JSON.stringify(tables));
- }
- var success = function(repolibs, libconfig)
- {
- var decodeHTML = function (html) {
- var txt = document.createElement('textarea');
- txt.innerHTML = html;
- return txt.value;
- };
- var ExtractTagFromXml = function (xml, tag) {
- var parser = new DOMParser();
- var xmlDoc = parser.parseFromString(xml,"text/xml");
- if (tag)
- {
- return JSON.parse(xmlDoc.getElementsByTagName(tag)[0].childNodes[0].nodeValue);
- }
- else
- {
- return xmlDoc;
- }
+ // fill in config with libraries from "getlibraries" on central repository
+ var getLibraries = function(type, key, libconfig, success, error)
+ {
+ let tables = {};
+ tables['param'] = {'column' : 'key, value',
+ 'type' : type};
+ if (key)
+ tables['param'].key;
+ var xhr3 = new XMLHttpRequest();
+ xhr3.onreadystatechange = function() {
+ if (xhr3.readyState == 4 && (xhr3.status == 200 || xhr3.status == 0)) {
+ datas = JSON && JSON.parse(xhr3.responseText) || $.parseJSON(xhr3.responseText);
+ success(datas, libconfig);
+ }
+ };
+ xhr3.open("POST", window.DRAWIOINTEGRATION_PATH + "/ajax/getconfig.php", true);
+ xhr3.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
+ xhr3.send(JSON.stringify(tables));
+ }
+ var success = function(repolibs, libconfig)
+ {
+ var decodeHTML = function (html) {
+ var txt = document.createElement('textarea');
+ txt.innerHTML = html;
+ return txt.value;
+ };
+ var ExtractTagFromXml = function (xml, tag) {
+ var parser = new DOMParser();
+ var xmlDoc = parser.parseFromString(xml,"text/xml");
+ if (tag)
+ {
+ return JSON.parse(xmlDoc.getElementsByTagName(tag)[0].childNodes[0].nodeValue);
+ }
+ else
+ {
+ return xmlDoc;
+ }
- };
- if (repolibs && repolibs['param'])
- {
- var arrayLength = repolibs['param'].length;
- var istart = libconfig.length;
- for (var i = 0 in repolibs['param'])
- {
-// var data = new XMLSerializer().serializeToString(ExtractTagFromXml(decodeHTML(repolibs['param'][i].value)));
- var data = ExtractTagFromXml(decodeHTML(repolibs['param'][i].value), 'mxlibrary');
- libconfig[istart] =
- {"title" : {"main" : repolibs['param'][i].key.replace(/_/g, " ")}, // replace underscore by space in file name
- "data" : data};
- istart++;
- }
- }
- // fill in config with libraries from "drawio-extension/libraries" directory on server
- var customlibsurl = document.location.protocol + '//' + document.location.hostname + window.location.pathname.split('/').slice(0,4).join('/') + '/drawio-integration/libraries/';
- var istart = diaedit.config.libraries[0].entries[0].libs.length;
- for (var i=0; iHTTP initSession error "+xhr2.status+" - "+xhr2.statusText
+ +"
App-Token is "+(user.app_token?"present, but invalid ("+session_token[0]+").":"missing.")
+ +"
user_token is "+(user.user_token?"present.":"missing.")
+ );
+ hideDrawio();
+ showGlpi();
+ }
+ };
+ xhr2.open("GET", DiagramEditor.prototype.rootUrl + "/apirest.php/initSession/", true);
+ xhr2.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
+ xhr2.setRequestHeader("App-Token", user.app_token);
+ xhr2.setRequestHeader("Authorization", 'user_token '+user.user_token);
+ xhr2.send();
+ }
+ else {
+ alert("Error when getting the APP_TOKEN : "+app_token['app_token']['error'].msg);
+ hideDrawio();
+ showGlpi();
+ }
+ }
+ else if (xhr.readyState == 4) {
+ alert("Error when getting the APP_TOKEN : HTTP error "+xhr.status+" - "+xhr.statusText);
+ hideDrawio();
+ showGlpi();
}
};
xhr.open("POST", window.DRAWIOINTEGRATION_PATH + "/ajax/getconfig.php", true);
@@ -597,28 +648,7 @@ DiagramEditor.prototype.handleMessage = function(msg)
this.stopEditing(msg);
}
// Added EFE 20200512
- // come back on the first tab of GLPI
- // remove iframes
- var iframe = document.getElementsByTagName('iframe');
- while (iframe && iframe.length>0)
- {
- iframe[0].remove();
- }
- // display back the header, footer and page HTML elements
- var header = document.getElementById('header');
- if (header) header.style.display = 'inline';
- var footer = document.getElementById('footer');
- if (footer && footer.style) footer.style.display = 'inline';
- var page = document.getElementById('page');
- if (page) page.style.display = 'inline';
- var aside = document.getElementsByTagName('aside')[0];
- if (aside) aside.style.display = 'flex';
- var header10 = document.getElementsByTagName('header')[0];
- if (header10) header10.style.display = 'flex';
- var diagramtab = $('a[title="Diagram"]');
- if (diagramtab.length > 0) diagramtab[0].click();
- // add event on 2nd tab to show full screen drawing pane
- document.querySelector('a[title="Drawing Pane"]').addEventListener("click",(function() {hideGlpi();showDrawio()}));
+ showGlpi();
// End of Added EFE 20200512
}
};