Make sure that the AJax calls use a full/absolute path to the page they call so that they can be embedded anywhere inside the application (i.e. in plug-ins supplied pages as well as 'regular' app pages).

SVN:trunk[1364]
This commit is contained in:
Denis Flaven
2011-07-26 12:21:53 +00:00
parent aee8a98d84
commit 3fde682653
14 changed files with 38 additions and 83 deletions

View File

@@ -70,7 +70,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
me.StopPendingRequest();
// Run the query and get the result back directly in HTML
me.ajax_request = $.post( '../pages/ajax.render.php', theMap,
me.ajax_request = $.post( GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', theMap,
function(data)
{
$('#ac_dlg_'+me.id).html(data);
@@ -163,7 +163,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
me.StopPendingRequest();
// Run the query and display the results
me.ajax_request = $.post( '../pages/ajax.render.php', theMap,
me.ajax_request = $.post( GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', theMap,
function(data)
{
$(sSearchAreaId).html(data);
@@ -208,7 +208,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
me.StopPendingRequest();
// Run the query and get the result back directly in JSON
me.ajax_request = $.post( '../pages/ajax.render.php', theMap,
me.ajax_request = $.post( GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', theMap,
function(data)
{
$('#label_'+me.id).val(data.name);
@@ -270,7 +270,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
me.StopPendingRequest();
// Run the query and get the result back directly in HTML
me.ajax_request = $.post( '../pages/ajax.render.php', theMap,
me.ajax_request = $.post( GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', theMap,
function(data)
{
$('#ajax_'+me.id).html(data);
@@ -347,7 +347,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
me.StopPendingRequest();
// Run the query and get the result back directly in JSON
me.ajax_request = $.post( '../pages/ajax.render.php', theMap,
me.ajax_request = $.post( GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', theMap,
function(data)
{
if (me.bSelectMode)
@@ -432,7 +432,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
me.StopPendingRequest();
// Run the query and display the results
me.ajax_request = $.post( '../pages/ajax.render.php', theMap,
me.ajax_request = $.post( GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', theMap,
function(data)
{
$('#ac_tree_'+me.id).html(data);
@@ -490,7 +490,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
me.StopPendingRequest();
// Run the query and get the result back directly in JSON
me.ajax_request = $.post( '../pages/ajax.render.php', theMap,
me.ajax_request = $.post( GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', theMap,
function(data)
{
$('#label_'+me.id).val(data.name);

View File

@@ -90,40 +90,12 @@ function ActivateStep(iTargetStep)
//$('#wizStep'+(iTargetStep)).block({ message: null });
}
//function AjaxGetValuesDef(oObj, sClass, sAttCode, iFieldId)
//{
// var oJSON = document.getElementById(sJsonFieldId);
// $.get('ajax.render.php?class=' + sClass + '&json_obj=' + oJSON.value + '&att_code=' + sAttCode,
// { operation: "allowed_values" },
// function(data){
// //$('#field_'+iFieldId).html(data);
// }
// );
//}
//
//function AjaxGetDefaultValue(oObj, sClass, sAttCode, iFieldId)
//{
// // Asynchronously call the server to provide a default value if the field is
// // empty
// if (oObj['m_aCurrValues'][sAttCode] == '')
// {
// var oJSON = document.getElementById(sJsonFieldId);
// $.get('../pages/ajax.render.php?class=' + sClass + '&json_obj=' + oJSON.value + '&att_code=' + sAttCode,
// { operation: "default_value" },
// function(json_data){
// var oObj = ReloadObjectFromServer(json_data);
// UpdateFieldFromObject(iFieldId, aFieldsMap, oObj)
// }
// );
// }
//}
function OnUnload(sTransactionId)
{
if (!window.bInSubmit)
{
// If it's not a submit, then it's a "cancel" (Pressing the Cancel button, closing the window, using the back button...)
$.post('../pages/ajax.render.php', {operation: 'on_form_cancel', transaction_id: sTransactionId }, function()
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', {operation: 'on_form_cancel', transaction_id: sTransactionId }, function()
{
// Do nothing for now...
});

View File

@@ -163,7 +163,7 @@ function sprintf(format, etc) {
s_order = (s[1] == 0) ? 'asc' : 'desc';
}
$('#loading', table.config.container).html('<img src="../images/indicator.gif" />');
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,

View File

@@ -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('&nbsp;<img src="../images/indicator.gif"/>');
// 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);

View File

@@ -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
}
}

View File

@@ -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();

View File

@@ -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);