';
echo '';
diff --git a/inc/formanswer.class.php b/inc/formanswer.class.php
index 1d987053f..2331466ff 100644
--- a/inc/formanswer.class.php
+++ b/inc/formanswer.class.php
@@ -460,7 +460,7 @@ public function showForm($ID, $options = []) {
$options = ['canedit' => false];
// Print css media
- echo Html::css(FORMCREATOR_ROOTDOC."/css/print_form_answer.css", ['media' => 'print']);
+ echo Html::css(FORMCREATOR_ROOTDOC . "/css/print_form_answer.css", ['media' => 'print']);
// start form
echo "";
diff --git a/inc/notificationtargetformanswer.class.php b/inc/notificationtargetformanswer.class.php
index 321ba53e0..9e00e9975 100644
--- a/inc/notificationtargetformanswer.class.php
+++ b/inc/notificationtargetformanswer.class.php
@@ -55,7 +55,7 @@ public function addDataForTemplate($event, $options = []) {
$form = new PluginFormcreatorForm();
$form->getFromDB($this->obj->fields['plugin_formcreator_forms_id']);
$link = $CFG_GLPI['url_base'];
- $link .= '/plugins/formcreator/front/formanswer.form.php?id=' . $this->obj->getID();
+ $link .= FORMCREATOR_ROOTDOC . '/front/formanswer.form.php?id=' . $this->obj->getID();
$requester = new User();
$requester->getFromDB($this->obj->fields['requester_id']);
diff --git a/js/scripts.js.php b/js/scripts.js.php
index 6f5c81018..ada86b598 100644
--- a/js/scripts.js.php
+++ b/js/scripts.js.php
@@ -41,6 +41,7 @@
var serviceCatalogEnabled = false;
var slinkyCategories;
var timers = [];
+var formcreatorRootDoc = '';
// === COMMON ===
@@ -67,7 +68,7 @@ function(event) {
// === MENU ===
var link = '';
link += '';
@@ -90,7 +91,7 @@ function(event) {
$('#formcreator-toggle-nav-desktop').change(function() {
$('.plugin_formcreator_container').toggleClass('toggle_menu');
$.ajax({
- url: rootDoc + '/plugins/formcreator/ajax/homepage_wizard.php',
+ url: formcreatorRootDoc + '/ajax/homepage_wizard.php',
data: {wizard: 'toggle_menu'},
type: "POST",
dataType: "json"
@@ -199,7 +200,7 @@ function showHomepageFormList() {
}
$.ajax({
- url: rootDoc + '/plugins/formcreator/ajax/homepage_forms.php',
+ url: formcreatorRootDoc + '/ajax/homepage_forms.php',
type: "GET"
}).done(function(response){
if (!$('#plugin_formcreatorHomepageForms').length) {
@@ -210,7 +211,7 @@ function showHomepageFormList() {
function updateCategoriesView() {
$.ajax({
- url: rootDoc + '/plugins/formcreator/ajax/homepage_wizard.php',
+ url: formcreatorRootDoc + '/ajax/homepage_wizard.php',
data: {wizard: 'categories'},
type: "GET",
dataType: "json"
@@ -254,7 +255,7 @@ function getFormAndFaqItems(categoryId) {
keywords = $('#plugin_formcreator_searchBar input:first').val();
deferred = jQuery.Deferred();
$.ajax({
- url: rootDoc + '/plugins/formcreator/ajax/homepage_wizard.php',
+ url: formcreatorRootDoc + '/ajax/homepage_wizard.php',
data: {wizard: 'forms', categoriesId: categoryId, keywords: keywords, helpdeskHome: 0},
type: "GET",
dataType: "json"
@@ -370,10 +371,10 @@ function buildTiles(list) {
$.each(list, function (key, item) {
// Build a HTML tile
if (item.type == 'form') {
- url = rootDoc + '/plugins/formcreator/front/formdisplay.php?id=' + item.id;
+ url = formcreatorRootDoc + '/front/formdisplay.php?id=' + item.id;
} else {
if (serviceCatalogEnabled) {
- url = rootDoc + '/plugins/formcreator/front/knowbaseitem.form.php?id=' + item.id;
+ url = formcreatorRootDoc + '/front/knowbaseitem.form.php?id=' + item.id;
} else {
url = rootDoc + '/front/knowbaseitem.form.php?id=' + item.id;
}
@@ -444,8 +445,8 @@ function buildTiles(list) {
// === SEARCH BAR ===
// === QUESTIONS ===
-var urlQuestion = rootDoc + "/plugins/formcreator/ajax/question.php";
-var urlFrontQuestion = rootDoc + "/plugins/formcreator/front/question.form.php";
+var urlQuestion = formcreatorRootDoc + "/ajax/question.php";
+var urlFrontQuestion = formcreatorRootDoc + "/front/question.form.php";
function plugin_formcreator_addQuestion(items_id, token, section) {
modalWindow.load(urlQuestion, {
@@ -526,8 +527,8 @@ function plugin_formcreator_duplicateQuestion(items_id, token, question_id) {
// === SECTIONS ===
-var urlSection = rootDoc + "/plugins/formcreator/ajax/section.php";
-var urlFrontSection = rootDoc + "/plugins/formcreator/front/section.form.php";
+var urlSection = formcreatorRootDoc + "/ajax/section.php";
+var urlFrontSection = formcreatorRootDoc + "/front/section.form.php";
function plugin_formcreator_addSection(items_id, token) {
modalWindow.load(urlSection, {
@@ -589,7 +590,7 @@ function plugin_formcreator_moveSection(token, section_id, action) {
// === TARGETS ===
function plugin_formcreator_addTarget(items_id, token) {
- modalWindow.load(rootDoc + '/plugins/formcreator/ajax/target.php', {
+ modalWindow.load(formcreatorRootDoc + '/ajax/target.php', {
form_id: items_id,
_glpi_csrf_token: token
}).dialog("open");
@@ -598,7 +599,7 @@ function plugin_formcreator_addTarget(items_id, token) {
function plugin_formcreator_deleteTarget(itemtype, target_id, token) {
if(confirm(" ")) {
jQuery.ajax({
- url: rootDoc + '/plugins/formcreator/front/form.form.php',
+ url: formcreatorRootDoc + '/front/form.form.php',
type: "POST",
data: {
delete_target: 1,
@@ -618,7 +619,7 @@ function plugin_formcreator_deleteTarget(itemtype, target_id, token) {
function formcreatorShowFields(form) {
$.ajax({
- url: rootDoc + '/plugins/formcreator/ajax/showfields.php',
+ url: formcreatorRootDoc + '/ajax/showfields.php',
type: "POST",
data: form.serializeArray()
}).done(function(response){
@@ -829,7 +830,7 @@ function plugin_formcreator_addEmptyCondition(target) {
});
$.ajax({
type: 'POST',
- url: rootDoc + '/plugins/formcreator/ajax/condition.php',
+ url: formcreatorRootDoc + '/ajax/condition.php',
data: data
}).done(function (data) {
$(target).parents('tr').after(data);
@@ -847,7 +848,7 @@ function plugin_formcreator_changeDropdownItemtype(rand) {
dropdown_id = $('[name="plugin_formcreator_questionform"] [name="id"]').val();
$.ajax({
- url: rootDoc + '/plugins/formcreator/ajax/dropdown_values.php',
+ url: formcreatorRootDoc + '/ajax/dropdown_values.php',
type: 'GET',
data: {
dropdown_itemtype: dropdown_type,
@@ -862,7 +863,7 @@ function plugin_formcreator_changeDropdownItemtype(rand) {
$('.plugin_formcreator_dropdown_ticket').toggle(showTicketCategorySpecific);
$.ajax({
- url: rootDoc + '/plugins/formcreator/ajax/commontree.php',
+ url: formcreatorRootDoc + '/ajax/commontree.php',
type: 'GET',
data: {
itemtype: dropdown_type,
@@ -884,7 +885,7 @@ function plugin_formcreator_changeGlpiObjectItemType() {
glpi_object_id = $('[name="plugin_formcreator_questionform"] [name="id"]').val();
$.ajax({
- url: rootDoc + '/plugins/formcreator/ajax/dropdown_values.php',
+ url: formcreatorRootDoc + '/ajax/dropdown_values.php',
type: 'GET',
data: {
dropdown_itemtype: glpi_object,
@@ -1119,7 +1120,7 @@ function plugin_formcreator_changeQuestionType(rand) {
var questionType = $ ('form[name="plugin_formcreator_questionform"] [name="fieldtype"]').val();
$.ajax({
- url: rootDoc + '/plugins/formcreator/ajax/question_design.php',
+ url: formcreatorRootDoc + '/ajax/question_design.php',
type: 'GET',
data: {
questionId: questionId,
@@ -1157,7 +1158,7 @@ function plugin_formcreator_changeLDAP(ldap) {
var ldap_directory = ldap.value;
jQuery.ajax({
- url: rootDoc + '/plugins/formcreator/ajax/ldap_filter.php',
+ url: formcreatorRootDoc + '/ajax/ldap_filter.php',
type: 'POST',
data: {
value: ldap_directory,
@@ -1336,12 +1337,12 @@ function plugin_formcreator_updateCompositePeerType(rand) {
function plugin_formcreator_cancelMyTicket(id) {
$.ajax({
- url: rootDoc + '/plugins/formcreator/ajax/cancelticket.php',
+ url: formcreatorRootDoc + '/ajax/cancelticket.php',
data: {id: id},
type: "POST",
dataType: "text"
}).done(function(response) {
- window.location.replace(rootDoc + '/plugins/formcreator/front/issue.php?reset=reset');
+ window.location.replace(formcreatorRootDoc + '/front/issue.php?reset=reset');
}).error(function(response) {
alert("");
});
diff --git a/setup.php b/setup.php
index bc3ac7db4..cd6da01d8 100644
--- a/setup.php
+++ b/setup.php
@@ -243,10 +243,10 @@ function plugin_init_formcreator() {
}
$pages = [
- "plugins/formcreator/front/targetticket.form.php",
- "plugins/formcreator/front/formdisplay.php",
- "plugins/formcreator/front/form.form.php",
- "plugins/formcreator/front/formanswer.form.php",
+ FORMCREATOR_ROOTDOC . '/front/targetticket.form.php',
+ FORMCREATOR_ROOTDOC . '/front/formdisplay.php',
+ FORMCREATOR_ROOTDOC . '/front/form.form.php',
+ FORMCREATOR_ROOTDOC . '/front/formanswer.form.php',
];
foreach ($pages as $page) {
if (strpos($_SERVER['REQUEST_URI'], $page) !== false) {
@@ -276,7 +276,7 @@ function plugin_init_formcreator() {
}
// Load JS and CSS files if we are on a page which need them
- if (strpos($_SERVER['REQUEST_URI'], 'plugins/formcreator') !== false
+ if (strpos($_SERVER['REQUEST_URI'], '/formcreator') !== false
|| strpos($_SERVER['REQUEST_URI'], 'central.php') !== false
|| isset($_SESSION['glpiactiveprofile']) &&
$_SESSION['glpiactiveprofile']['interface'] == 'helpdesk') {