diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 00f745656..4c5246d92 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -178,36 +178,6 @@ class DisplayBlock public function Display(WebPage $oPage, $sId, $aExtraParams = array()) { $oPage->add($this->GetDisplay($oPage, $sId, $aExtraParams)); - /* - $aExtraParams = array_merge($aExtraParams, $this->m_aParams); - $aExtraParams['block_id'] = $sId; - if (!$this->m_bAsynchronous) - { - // render now - $oPage->add("
\n"); - $this->RenderContent($oPage, $aExtraParams); - $oPage->add("
\n"); - } - else - { - // render it as an Ajax (asynchronous) call - $sFilter = $this->m_oFilter->serialize(); - $oPage->add("
\n"); - $oPage->p(" Loading..."); - $oPage->add("
\n"); - $oPage->add(' - '); // TO DO: add support for $aExtraParams in asynchronous/Ajax mode - } - */ } public function GetDisplay(WebPage $oPage, $sId, $aExtraParams = array()) diff --git a/application/itopwebpage.class.inc.php b/application/itopwebpage.class.inc.php index 17cae8327..f0d8e5933 100644 --- a/application/itopwebpage.class.inc.php +++ b/application/itopwebpage.class.inc.php @@ -50,6 +50,7 @@ class iTopWebPage extends NiceWebPage $this->m_aTabs = array(); $this->m_sMenu = ""; $this->m_sMessage = ''; + $sAbsURLAppRoot = addslashes(utils::GetAbsoluteUrlAppRoot()); // Pass it to Javascript scripts $oAppContext = new ApplicationContext(); $sExtraParams = $oAppContext->GetForLink(); $this->add_header("Content-type: text/html; charset=utf-8"); @@ -382,6 +383,11 @@ EOF } } + function GetAbsoluteUrlAppRoot() + { + return '$sAbsURLAppRoot'; + } + var oUserPreferences = $sUserPrefs; // For disabling the CKEditor at init time when the corresponding textarea is disabled ! diff --git a/application/portalwebpage.class.inc.php b/application/portalwebpage.class.inc.php index ce53788bb..4041acd6e 100644 --- a/application/portalwebpage.class.inc.php +++ b/application/portalwebpage.class.inc.php @@ -55,6 +55,7 @@ class PortalWebPage extends NiceWebPage $this->add_header("Cache-control: no-cache"); $this->add_linked_stylesheet("../css/jquery.treeview.css"); $this->add_linked_stylesheet("../css/jquery.autocomplete.css"); + $sAbsURLAppRoot = addslashes(utils::GetAbsoluteUrlAppRoot()); // Pass it to Javascript scripts if ($sAlternateStyleSheet != '') { $this->add_linked_stylesheet("../portal/$sAlternateStyleSheet/portal.css"); @@ -150,6 +151,12 @@ EOF return bResult; } + + function GetAbsoluteUrlAppRoot() + { + return '$sAbsURLAppRoot'; + } + function GoBack(sFormId) { var form = $('#'+sFormId); diff --git a/application/uilinkswizard.class.inc.php b/application/uilinkswizard.class.inc.php index 8ccb37708..aaa61e705 100644 --- a/application/uilinkswizard.class.inc.php +++ b/application/uilinkswizard.class.inc.php @@ -132,7 +132,7 @@ class UILinksWizard function AddObjects() { // TO DO: compute the list of objects already linked with the current Object - $.post( '../pages/ajax.render.php', { 'operation': 'addObjects', + $.post( GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', { 'operation': 'addObjects', 'class': '{$this->m_sClass}', 'linkageAttr': '{$this->m_sLinkageAttr}', 'linkedClass': '{$this->m_sLinkedClass}', @@ -175,7 +175,7 @@ class UILinksWizard theMap['operation'] = 'searchObjectsToAdd'; // Run the query and display the results - $.post( '../pages/ajax.render.php', theMap, + $.post( GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', theMap, function(data) { $('#SearchResultsToAdd').html(data); @@ -223,7 +223,7 @@ class UILinksWizard theMap['operation'] = 'doAddObjects'; // Run the query and display the results - $.post( '../pages/ajax.render.php', theMap, + $.post( GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', theMap, function(data) { //console.log('Data: ' + data); diff --git a/core/bulkchange.class.inc.php b/core/bulkchange.class.inc.php index 91ae1ca9a..8a525f5a0 100644 --- a/core/bulkchange.class.inc.php +++ b/core/bulkchange.class.inc.php @@ -999,7 +999,7 @@ EOF <<'); - table.ajax_request = $.post("../pages/ajax.render.php", + table.ajax_request = $.post(GetAbsoluteUrlAppRoot()+"pages/ajax.render.php", { operation: 'pagination', filter: c.filter, extra_param: c.extra_params, diff --git a/js/linkswidget.js b/js/linkswidget.js index 443bd0e95..7d506c3a7 100644 --- a/js/linkswidget.js +++ b/js/linkswidget.js @@ -98,7 +98,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates) $(sSearchAreaId).block(); // Run the query and display the results - $.post( '../pages/ajax.render.php', theMap, + $.post( GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', theMap, function(data) { $(sSearchAreaId).html(data); @@ -198,7 +198,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates) theMap['operation'] = 'doAddObjects'; $('#busy_'+me.iInputId).html(' '); // Run the query and display the results - $.post( '../pages/ajax.render.php', theMap, + $.post( GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', theMap, function(data) { //console.log('Data: ' + data); diff --git a/js/utils.js b/js/utils.js index 8a7149255..5817e8abb 100644 --- a/js/utils.js +++ b/js/utils.js @@ -76,7 +76,7 @@ function ReloadBlock(divId, sStyle, sSerializedFilter, sExtraParams) { $('#'+divId).block(); //$('#'+divId).blockUI(); - $.post('../pages/ajax.render.php?style='+sStyle, + $.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php?style='+sStyle, { operation: 'ajax', filter: sSerializedFilter, extra_params: sExtraParams }, function(data){ $('#'+divId).empty(); @@ -119,7 +119,7 @@ function ReloadSearchForm(divId, sClassName, sBaseClass, sContext) } sAction = $('#ds_'+divId+' form').attr('action'); - $.post('../pages/ajax.render.php?'+sContext, + $.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php?'+sContext, { operation: 'search_form', className: sClassName, baseClass: sBaseClass, currentId: divId, action: sAction }, function(data) { oDiv.empty(); @@ -165,7 +165,7 @@ function SetUserPreference(sPreferenceCode, sPrefValue, bPersistent) oUserPreferences[sPreferenceCode] = sPrefValue; if (bPersistent && (sPrefValue != sPreviousValue)) { - ajax_request = $.post('../pages/ajax.render.php', + ajax_request = $.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', { operation: 'set_pref', code: sPreferenceCode, value: sPrefValue} ); // Make it persistent } } diff --git a/js/wizard.utils.js b/js/wizard.utils.js index 75cb2a103..d392c36dc 100644 --- a/js/wizard.utils.js +++ b/js/wizard.utils.js @@ -9,7 +9,7 @@ function UpdateObjectList(sClass, sId, sExtKeyToRemote) aRelatedObjectIds[0] = 0; } var oql = "SELECT "+sClass+" AS c WHERE c.id IN (" + aRelatedObjectIds.join(", ") + ")"; - $.post("ajax.render.php?style=list&encoding=oql", + $.post(GetAbsoluteUrlAppRoot()+"ajax.render.php?style=list&encoding=oql", { operation: "ajax", filter: oql }, function(data){ $("#related_objects_"+sId).empty(); @@ -42,7 +42,7 @@ function ManageObjects(sTitle, sClass, sId, sExtKeyToRemote) function Manage_LoadSelect(sSelectedId, sFilter) { $('#'+sSelectedId).addClass('loading'); - $.post('../pages/ajax.render.php', + $.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', { operation: 'combo_options', filter: sFilter }, function(data){ $('#'+sSelectedId).empty(); diff --git a/js/wizardhelper.js b/js/wizardhelper.js index 5bb0bddbd..ef37fc20f 100644 --- a/js/wizardhelper.js +++ b/js/wizardhelper.js @@ -140,7 +140,7 @@ function WizardHelper(sClass, sFormPrefix, sState) { //console.log('data sent:', this.ToJSON()); //console.log('oWizard:', this); - $.post('../pages/ajax.render.php', + $.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', { operation: 'wizard_helper', json_obj: this.ToJSON() }, function(html){ $('#ajax_content').html(html); diff --git a/pages/UI.php b/pages/UI.php index 6673adec3..f7679b53a 100644 --- a/pages/UI.php +++ b/pages/UI.php @@ -1899,7 +1899,7 @@ EOF ajax_request = null; } - ajax_request = $.get('xml.navigator.php', { 'class': sClass, id: iId, relation: sRelation, format: 'html' }, + ajax_request = $.get(GetAbsoluteUrlAppRoot()+'pages/xml.navigator.php', { 'class': sClass, id: iId, relation: sRelation, format: 'html' }, function(data) { $('#impacted_objects').empty(); diff --git a/pages/csvimport.php b/pages/csvimport.php index 133268866..d2e1be18a 100644 --- a/pages/csvimport.php +++ b/pages/csvimport.php @@ -927,7 +927,7 @@ EOF ajax_request = null; } - ajax_request = $.post('ajax.csvimport.php', + ajax_request = $.post(GetAbsoluteUrlAppRoot()+'pages/ajax.csvimport.php', { operation: 'display_mapping_form', enctype: 'multipart/form-data', csvdata: csv_data, separator: separator, qualifier: text_qualifier, nb_lines_skipped: nb_lines_skipped, header_line: header_line, class_name: class_name, advanced: advanced, encoding: encoding }, @@ -1225,7 +1225,7 @@ EOF ajax_request = null; } - ajax_request = $.post('ajax.csvimport.php', + ajax_request = $.post(GetAbsoluteUrlAppRoot()+'pages/ajax.csvimport.php', { operation: 'parser_preview', enctype: 'multipart/form-data', csvdata: $("#csvdata_truncated").val(), separator: separator, qualifier: text_qualifier, nb_lines_skipped: nb_lines_skipped, header_line: header_line, encoding: encoding }, function(data) { $('#preview').empty(); @@ -1385,7 +1385,7 @@ if (ajax_request != null) ajax_request = null; } -ajax_request = $.post('ajax.csvimport.php', +ajax_request = $.post(GetAbsoluteUrlAppRoot()+'pages/ajax.csvimport.php', { operation: 'get_csv_template', class_name: sClassName }, function(data) { $('#template').empty();