Skip to content

Commit

Permalink
fix: bad path for marketplace
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Jul 9, 2020
1 parent 1da588e commit 9e49a02
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 32 deletions.
4 changes: 2 additions & 2 deletions inc/form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ public function displayUserForm() {
}

// Print css media
echo Html::css("plugins/formcreator/css/print_form.css", ['media' => 'print']);
echo Html::css(FORMCREATOR_ROOTDOC . "/css/print_form.css", ['media' => 'print']);

// Display form
$formName = 'plugin_formcreator_form';
Expand Down Expand Up @@ -2008,7 +2008,7 @@ public function showForCentral() {

echo '<table class="tab_cadrehov" id="plugin_formcreatorHomepageForms">';
echo '<tr class="noHover">';
echo '<th><a href="../plugins/formcreator/front/formlist.php">' . _n('Form', 'Forms', 2, 'formcreator') . '</a></th>';
echo '<th><a href="' . Plugin::getWebDir('formcreator', true, true) . '/front/formlist.php">' . _n('Form', 'Forms', 2, 'formcreator') . '</a></th>';
echo '</tr>';

$currentCategoryId = -1;
Expand Down
2 changes: 1 addition & 1 deletion inc/form_profile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static function showForForm(CommonDBTM $item, $withtemplate = '') {
echo '</td>';
echo '<td>'.__('Link to the form', 'formcreator').': ';
if ($item->fields['is_active']) {
$form_url = FORMCREATOR_ROOTDOC.'/front/formdisplay.php?id='.$item->getID();
$form_url = Plugin::getWebDir('formcreator', true, true) . '/front/formdisplay.php?id='.$item->getID();
echo '<a href="'.$form_url.'">'.$form_url.'</a>&nbsp;';
echo '<a href="mailto:?subject='.$item->getName().'&body='.$form_url.'" target="_blank">';
echo '<img src="'.FORMCREATOR_ROOTDOC.'/pics/email.png" />';
Expand Down
2 changes: 1 addition & 1 deletion inc/formanswer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<div class='form_answer'>";
Expand Down
2 changes: 1 addition & 1 deletion inc/notificationtargetformanswer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
45 changes: 23 additions & 22 deletions js/scripts.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
var serviceCatalogEnabled = false;
var slinkyCategories;
var timers = [];
var formcreatorRootDoc = '<?php echo Plugin::getWebDir('formcreator')?>';

// === COMMON ===

Expand All @@ -67,7 +68,7 @@ function(event) {
// === MENU ===
var link = '';
link += '<li id="menu7">';
link += '<a href="' + rootDoc + '/plugins/formcreator/front/formlist.php" class="itemP">';
link += '<a href="' + formcreatorRootDoc + '/front/formlist.php" class="itemP">';
link += "<?php echo Toolbox::addslashes_deep(_n('Form', 'Forms', 2, 'formcreator')); ?>";
link += '</a>';
link += '</li>';
Expand All @@ -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"
Expand Down Expand Up @@ -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) {
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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, {
Expand Down Expand Up @@ -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, {
Expand Down Expand Up @@ -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");
Expand All @@ -598,7 +599,7 @@ function plugin_formcreator_addTarget(items_id, token) {
function plugin_formcreator_deleteTarget(itemtype, target_id, token) {
if(confirm("<?php echo Toolbox::addslashes_deep(__('Are you sure you want to delete this destination:', 'formcreator')); ?> ")) {
jQuery.ajax({
url: rootDoc + '/plugins/formcreator/front/form.form.php',
url: formcreatorRootDoc + '/front/form.form.php',
type: "POST",
data: {
delete_target: 1,
Expand All @@ -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){
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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("<?php echo __('Failed to cancel the ticket', 'formcreator'); ?>");
});
Expand Down
10 changes: 5 additions & 5 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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') {
Expand Down

0 comments on commit 9e49a02

Please sign in to comment.