42
42
var serviceCatalogEnabled = false;
43
43
var slinkyCategories;
44
44
var timers = [];
45
+ var formcreatorRootDoc = '<?php echo Plugin::getWebDir ('formcreator ' )?> ';
45
46
46
47
// === COMMON ===
47
48
@@ -68,7 +69,7 @@ function(event) {
68
69
// === MENU ===
69
70
var link = '';
70
71
link += '<li id="menu7">';
71
- link += '<a href="' + rootDoc + '/plugins/formcreator /front/formlist.php" class="itemP">';
72
+ link += '<a href="' + formcreatorRootDoc + '/front/formlist.php" class="itemP">';
72
73
link += "<?php echo Toolbox::addslashes_deep (_n ('Form ' , 'Forms ' , 2 , 'formcreator ' )); ?> ";
73
74
link += '</a>';
74
75
link += '</li>';
@@ -91,7 +92,7 @@ function(event) {
91
92
$('#formcreator-toggle-nav-desktop').change(function() {
92
93
$('.plugin_formcreator_container').toggleClass('toggle_menu');
93
94
$.ajax({
94
- url: rootDoc + '/plugins/formcreator /ajax/homepage_wizard.php',
95
+ url: formcreatorRootDoc + '/ajax/homepage_wizard.php',
95
96
data: {wizard: 'toggle_menu'},
96
97
type: "POST",
97
98
dataType: "json"
@@ -200,7 +201,7 @@ function showHomepageFormList() {
200
201
}
201
202
202
203
$.ajax({
203
- url: rootDoc + '/plugins/formcreator /ajax/homepage_forms.php',
204
+ url: formcreatorRootDoc + '/ajax/homepage_forms.php',
204
205
type: "GET"
205
206
}).done(function(response){
206
207
if (!$('#plugin_formcreatorHomepageForms').length) {
@@ -211,7 +212,7 @@ function showHomepageFormList() {
211
212
212
213
function updateCategoriesView() {
213
214
$.ajax({
214
- url: rootDoc + '/plugins/formcreator /ajax/homepage_wizard.php',
215
+ url: formcreatorRootDoc + '/ajax/homepage_wizard.php',
215
216
data: {wizard: 'categories'},
216
217
type: "GET",
217
218
dataType: "json"
@@ -255,7 +256,7 @@ function getFormAndFaqItems(categoryId) {
255
256
var keywords = $('#plugin_formcreator_searchBar input:first').val();
256
257
var deferred = jQuery.Deferred();
257
258
$.ajax({
258
- url: rootDoc + '/plugins/formcreator /ajax/homepage_wizard.php',
259
+ url: formcreatorRootDoc + '/ajax/homepage_wizard.php',
259
260
data: {wizard: 'forms', categoriesId: categoryId, keywords: keywords, helpdeskHome: 0},
260
261
type: "GET",
261
262
dataType: "json"
@@ -370,10 +371,10 @@ function buildTiles(list) {
370
371
var faqs = [];
371
372
$.each(list, function (key, item) {
372
373
// Build a HTML tile
373
- var url = rootDoc + '/plugins/formcreator /front/formdisplay.php?id=' + item.id;
374
+ var url = formcreatorRootDoc + '/front/formdisplay.php?id=' + item.id;
374
375
if (item.type != 'form') {
375
376
if (serviceCatalogEnabled) {
376
- url = rootDoc + '/plugins/formcreator /front/knowbaseitem.form.php?id=' + item.id;
377
+ url = formcreatorRootDoc + '/front/knowbaseitem.form.php?id=' + item.id;
377
378
} else {
378
379
url = rootDoc + '/front/knowbaseitem.form.php?id=' + item.id;
379
380
}
@@ -476,7 +477,7 @@ function buildTiles(list) {
476
477
y: newWidget.y
477
478
};
478
479
$.ajax({
479
- 'url': rootDoc + '/plugins/formcreator /ajax/question_move.php',
480
+ 'url': formcreatorRootDoc + '/ajax/question_move.php',
480
481
type: 'POST',
481
482
data: {
482
483
move: changes,
@@ -505,7 +506,7 @@ function buildTiles(list) {
505
506
}
506
507
});
507
508
$.get({
508
- url: rootDoc + '/plugins/formcreator /ajax/question_get.php',
509
+ url: formcreatorRootDoc + '//ajax/question_get.php',
509
510
dataType: 'json',
510
511
data: {
511
512
id: sectionId,
@@ -578,7 +579,7 @@ function buildTiles(list) {
578
579
return;
579
580
}
580
581
$.ajax({
581
- 'url': rootDoc + '/plugins/formcreator /ajax/question_move.php',
582
+ 'url': formcreatorRootDoc + '/ajax/question_move.php',
582
583
type: 'POST',
583
584
data: {
584
585
move: changes,
@@ -622,7 +623,7 @@ function buildTiles(list) {
622
623
}
623
624
if (confirm("<?php echo Toolbox::addslashes_deep (__ ('Are you sure you want to delete this question? ' , 'formcreator ' )); ?> ")) {
624
625
jQuery.ajax({
625
- url: rootDoc + '/plugins/formcreator /ajax/question_delete.php',
626
+ url: formcreatorRootDoc + '/ajax/question_delete.php',
626
627
type: "POST",
627
628
data: {
628
629
id: id,
@@ -666,7 +667,7 @@ function buildTiles(list) {
666
667
}
667
668
var required = $(target).hasClass('fa-check-circle');
668
669
jQuery.ajax({
669
- url: rootDoc + '/plugins/formcreator /ajax/question_toggle_required.php',
670
+ url: formcreatorRootDoc + '/ajax/question_toggle_required.php',
670
671
type: "POST",
671
672
data: {
672
673
id: id,
@@ -690,7 +691,7 @@ function buildTiles(list) {
690
691
this.addQuestion = function () {
691
692
var form = $('form[data-itemtype="PluginFormcreatorQuestion"]');
692
693
$.ajax({
693
- url: rootDoc + '/plugins/formcreator /ajax/question_add.php',
694
+ url: formcreatorRootDoc + '/ajax/question_add.php',
694
695
type: "POST",
695
696
data: form.serializeArray(),
696
697
dataType: 'json'
@@ -726,7 +727,7 @@ function buildTiles(list) {
726
727
var form = $('form[data-itemtype="PluginFormcreatorQuestion"]');
727
728
var questionId = form.find('[name="id"]').val();
728
729
$.ajax({
729
- url: rootDoc + '/plugins/formcreator /ajax/question_update.php',
730
+ url: formcreatorRootDoc + '/ajax/question_update.php',
730
731
type: "POST",
731
732
data: form.serializeArray(),
732
733
dataType: 'html'
@@ -748,7 +749,7 @@ function buildTiles(list) {
748
749
}
749
750
750
751
$.ajax({
751
- url: rootDoc + '/plugins/formcreator /ajax/question_duplicate.php',
752
+ url: formcreatorRootDoc + '/ajax/question_duplicate.php',
752
753
type: "POST",
753
754
dataType: 'json',
754
755
data: {
@@ -776,7 +777,7 @@ function buildTiles(list) {
776
777
777
778
this.showFields = function (form) {
778
779
$.ajax({
779
- url: rootDoc + '/plugins/formcreator /ajax/showfields.php',
780
+ url: formcreatorRootDoc + '/ajax/showfields.php',
780
781
type: "POST",
781
782
data: form.serializeArray()
782
783
}).done(function(response){
@@ -826,7 +827,7 @@ function buildTiles(list) {
826
827
var section = $(item).closest('#plugin_formcreator_form.plugin_formcreator_form_design [data-itemtype="PluginFormcreatorSection"]');
827
828
var sectionId = section.attr('data-id');
828
829
$.ajax({
829
- url: rootDoc + '/plugins/formcreator /ajax/section_delete.php',
830
+ url: formcreatorRootDoc + '/ajax/section_delete.php',
830
831
type: "POST",
831
832
data: {
832
833
id: sectionId
@@ -844,7 +845,7 @@ function buildTiles(list) {
844
845
var section = $(item).closest('#plugin_formcreator_form.plugin_formcreator_form_design [data-itemtype="PluginFormcreatorSection"]');
845
846
var sectionId = section.attr('data-id');
846
847
$.ajax({
847
- url: rootDoc + '/plugins/formcreator /ajax/section_move.php',
848
+ url: formcreatorRootDoc + '/ajax/section_move.php',
848
849
type: "POST",
849
850
data: {
850
851
id: sectionId,
@@ -875,7 +876,7 @@ function buildTiles(list) {
875
876
};
876
877
877
878
this.showQuestionForm = function (sectionId, questionId = 0) {
878
- modalWindow.load(rootDoc + '/plugins/formcreator /ajax/question.php', {
879
+ modalWindow.load(formcreatorRootDoc + '/ajax/question.php', {
879
880
question_id: questionId,
880
881
plugin_formcreator_sections_id: sectionId
881
882
}).dialog('open');
@@ -886,7 +887,7 @@ function buildTiles(list) {
886
887
var section = $(item).closest('#plugin_formcreator_form.plugin_formcreator_form_design [data-itemtype="PluginFormcreatorSection"]');
887
888
var sectionId = section.attr('data-id');
888
889
$.ajax({
889
- url: rootDoc + '/plugins/formcreator /ajax/section_duplicate.php',
890
+ url: formcreatorRootDoc + '/ajax/section_duplicate.php',
890
891
type: "POST",
891
892
data: {
892
893
id: sectionId
@@ -905,7 +906,7 @@ function buildTiles(list) {
905
906
906
907
this.showSectionForm = function (formId, sectionId = 0) {
907
908
modalWindow.load(
908
- rootDoc + '/plugins/formcreator /ajax/section.php', {
909
+ formcreatorRootDoc + '/ajax/section.php', {
909
910
section_id: sectionId,
910
911
plugin_formcreator_forms_id: formId
911
912
}
@@ -916,7 +917,7 @@ function buildTiles(list) {
916
917
this.addSection = function () {
917
918
var form = $('form[data-itemtype="PluginFormcreatorSection"]');
918
919
$.ajax({
919
- url: rootDoc + '/plugins/formcreator /ajax/section_add.php',
920
+ url: formcreatorRootDoc + '/ajax/section_add.php',
920
921
type: "POST",
921
922
data: form.serializeArray(),
922
923
dataType: 'html'
@@ -936,7 +937,7 @@ function buildTiles(list) {
936
937
var form = $('form[data-itemtype="PluginFormcreatorSection"]');
937
938
var sectionId = form.find('[name="id"]').val();
938
939
$.ajax({
939
- url: rootDoc + '/plugins/formcreator /ajax/section_update.php',
940
+ url: formcreatorRootDoc + '/ajax/section_update.php',
940
941
type: "POST",
941
942
data: form.serializeArray(),
942
943
dataType: 'html'
@@ -964,13 +965,13 @@ function buildTiles(list) {
964
965
// === TARGETS ===
965
966
966
967
function plugin_formcreator_addTarget(items_id, token) {
967
- modalWindow.load(rootDoc + '/plugins/formcreator /ajax/target.php', {
968
+ modalWindow.load(formcreatorRootDoc + '/ajax/target.php', {
968
969
plugin_formcreator_forms_id: items_id
969
970
}).dialog("open");
970
971
}
971
972
972
973
function plugin_formcreator_editTarget(itemtype, items_id) {
973
- modalWindow.load(rootDoc + '/plugins/formcreator /ajax/target_edit.php', {
974
+ modalWindow.load(formcreatorRootDoc + '/ajax/target_edit.php', {
974
975
itemtype: itemtype,
975
976
id: items_id
976
977
}).dialog("open");
@@ -979,7 +980,7 @@ function plugin_formcreator_editTarget(itemtype, items_id) {
979
980
function plugin_formcreator_deleteTarget(itemtype, target_id, token) {
980
981
if(confirm("<?php echo Toolbox::addslashes_deep (__ ('Are you sure you want to delete this destination: ' , 'formcreator ' )); ?> ")) {
981
982
jQuery.ajax({
982
- url: rootDoc + '/plugins/formcreator /front/form.form.php',
983
+ url: formcreatorRootDoc + '/front/form.form.php',
983
984
type: "POST",
984
985
data: {
985
986
delete_target: 1,
@@ -1130,7 +1131,7 @@ function plugin_formcreator_changeDropdownItemtype(rand) {
1130
1131
var dropdown_id = $('[data-itemtype="PluginFormcreatorQuestion"] [name="id"]').val();
1131
1132
1132
1133
$.ajax({
1133
- url: rootDoc + '/plugins/formcreator /ajax/dropdown_values.php',
1134
+ url: formcreatorRootDoc + '/ajax/dropdown_values.php',
1134
1135
type: 'GET',
1135
1136
data: {
1136
1137
dropdown_itemtype: dropdown_type,
@@ -1145,7 +1146,7 @@ function plugin_formcreator_changeDropdownItemtype(rand) {
1145
1146
$('.plugin_formcreator_dropdown_ticket').toggle(showTicketCategorySpecific);
1146
1147
1147
1148
$.ajax({
1148
- url: rootDoc + '/plugins/formcreator /ajax/commontree.php',
1149
+ url: formcreatorRootDoc + '/ajax/commontree.php',
1149
1150
type: 'GET',
1150
1151
data: {
1151
1152
itemtype: dropdown_type,
@@ -1167,7 +1168,7 @@ function plugin_formcreator_changeGlpiObjectItemType() {
1167
1168
var glpi_object_id = $('[data-itemtype="PluginFormcreatorQuestion"] [name="id"]').val();
1168
1169
1169
1170
$.ajax({
1170
- url: rootDoc + '/plugins/formcreator /ajax/dropdown_values.php',
1171
+ url: formcreatorRootDoc + '/ajax/dropdown_values.php',
1171
1172
type: 'GET',
1172
1173
data: {
1173
1174
dropdown_itemtype: glpi_object,
@@ -1212,7 +1213,7 @@ function plugin_formcreator_addEmptyCondition(target) {
1212
1213
});
1213
1214
$.ajax({
1214
1215
type: 'POST',
1215
- url: rootDoc + '/plugins/formcreator /ajax/condition.php',
1216
+ url: formcreatorRootDoc + '/ajax/condition.php',
1216
1217
data: data
1217
1218
}).done(function (data) {
1218
1219
$(target).parents('tr').after(data);
@@ -1437,7 +1438,7 @@ function plugin_formcreator_changeQuestionType(rand) {
1437
1438
var questionType = $('form[name="form"][data-itemtype="PluginFormcreatorQuestion"] [name="fieldtype"]').val();
1438
1439
1439
1440
$.ajax({
1440
- url: rootDoc + '/plugins/formcreator /ajax/question_design.php',
1441
+ url: formcreatorRootDoc + '/ajax/question_design.php',
1441
1442
type: 'GET',
1442
1443
data: {
1443
1444
questionId: questionId,
@@ -1475,7 +1476,7 @@ function plugin_formcreator_changeLDAP(ldap) {
1475
1476
var ldap_directory = ldap.value;
1476
1477
1477
1478
jQuery.ajax({
1478
- url: rootDoc + '/plugins/formcreator /ajax/ldap_filter.php',
1479
+ url: formcreatorRootDoc + '/ajax/ldap_filter.php',
1479
1480
type: 'POST',
1480
1481
data: {
1481
1482
value: ldap_directory,
@@ -1654,12 +1655,12 @@ function plugin_formcreator_updateCompositePeerType(rand) {
1654
1655
1655
1656
function plugin_formcreator_cancelMyTicket(id) {
1656
1657
$.ajax({
1657
- url: rootDoc + '/plugins/formcreator /ajax/cancelticket.php',
1658
+ url: formcreatorRootDoc + '/ajax/cancelticket.php',
1658
1659
data: {id: id},
1659
1660
type: "POST",
1660
1661
dataType: "text"
1661
1662
}).done(function(response) {
1662
- window.location.replace(rootDoc + '/plugins/formcreator /front/issue.php?reset=reset');
1663
+ window.location.replace(formcreatorRootDoc + '/front/issue.php?reset=reset');
1663
1664
}).error(function(response) {
1664
1665
alert("<?php echo __ ('Failed to cancel the ticket ' , 'formcreator ' ); ?> ");
1665
1666
});
0 commit comments