Pārlūkot izejas kodu

Replace Ajax "get" calls by "posts" since long URLs may be truncated... and sometimes URLs get longer than expected when some characters are urlencoded... (Trac #195)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@628 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 15 gadi atpakaļ
vecāks
revīzija
46a346943e

+ 4 - 4
application/displayblock.class.inc.php

@@ -190,8 +190,8 @@ class DisplayBlock
 			$oPage->add("</div>\n");
 			$oPage->add("</div>\n");
 			$oPage->add('
 			$oPage->add('
 			<script language="javascript">
 			<script language="javascript">
-			$.get("ajax.render.php?filter='.$sFilter.'&style='.$this->m_sStyle.'",
-			   { operation: "ajax" },
+			$.post("ajax.render.php?style='.$this->m_sStyle.'",
+			   { operation: "ajax", filter: "$sFilter" },
 			   function(data){
 			   function(data){
 				 $("#'.$sId.'").empty();
 				 $("#'.$sId.'").empty();
 				 $("#'.$sId.'").append(data);
 				 $("#'.$sId.'").append(data);
@@ -257,8 +257,8 @@ class DisplayBlock
 			$sHtml .= "</div>\n";
 			$sHtml .= "</div>\n";
 			$sHtml .= '
 			$sHtml .= '
 			<script language="javascript">
 			<script language="javascript">
-			$.get("ajax.render.php?filter='.$sFilter.'&style='.$this->m_sStyle.'",
-			   { operation: "ajax", extra_params: "'.$sExtraParams.'" },
+			$.post("ajax.render.php?style='.$this->m_sStyle.'",
+			   { operation: "ajax", filter: "'.$sFilter.'", extra_params: "'.$sExtraParams.'" },
 			   function(data){
 			   function(data){
 				 $("#'.$sId.'").empty();
 				 $("#'.$sId.'").empty();
 				 $("#'.$sId.'").append(data);
 				 $("#'.$sId.'").append(data);

+ 3 - 3
application/uilinkswizard.class.inc.php

@@ -132,7 +132,7 @@ class UILinksWizard
 		function AddObjects()
 		function AddObjects()
 		{
 		{
 			// TO DO: compute the list of objects already linked with the current Object
 			// TO DO: compute the list of objects already linked with the current Object
-			$.get( 'ajax.render.php', { 'operation': 'addObjects',
+			$.post( 'ajax.render.php', { 'operation': 'addObjects',
 										'class': '{$this->m_sClass}',
 										'class': '{$this->m_sClass}',
 										'linkageAttr': '{$this->m_sLinkageAttr}',
 										'linkageAttr': '{$this->m_sLinkageAttr}',
 										'linkedClass': '{$this->m_sLinkedClass}',
 										'linkedClass': '{$this->m_sLinkedClass}',
@@ -175,7 +175,7 @@ class UILinksWizard
 			theMap['operation'] = 'searchObjectsToAdd';
 			theMap['operation'] = 'searchObjectsToAdd';
 			
 			
 			// Run the query and display the results
 			// Run the query and display the results
-			$.get( 'ajax.render.php', theMap, 
+			$.post( 'ajax.render.php', theMap, 
 				function(data)
 				function(data)
 				{
 				{
 					$('#SearchResultsToAdd').html(data);
 					$('#SearchResultsToAdd').html(data);
@@ -223,7 +223,7 @@ class UILinksWizard
 			theMap['operation'] = 'doAddObjects';
 			theMap['operation'] = 'doAddObjects';
 			
 			
 			// Run the query and display the results
 			// Run the query and display the results
-			$.get( 'ajax.render.php', theMap, 
+			$.post( 'ajax.render.php', theMap, 
 				function(data)
 				function(data)
 				{
 				{
 					//console.log('Data: ' + data);
 					//console.log('Data: ' + data);

+ 5 - 5
js/utils.js

@@ -6,8 +6,8 @@ function ReloadTruncatedList(divId, sSerializedFilter, sExtraParams)
 {
 {
 	$('#'+divId).addClass('loading');
 	$('#'+divId).addClass('loading');
 	//$('#'+divId).blockUI();
 	//$('#'+divId).blockUI();
-	$.get('ajax.render.php?filter='+sSerializedFilter+'&style=list',
-	   { operation: 'ajax', extra_params: sExtraParams },
+	$.post('ajax.render.php?style=list',
+	   { operation: 'ajax', filter: sSerializedFilter, extra_params: sExtraParams },
 	   function(data){
 	   function(data){
 		 $('#'+divId).empty();
 		 $('#'+divId).empty();
 		 $('#'+divId).append(data);
 		 $('#'+divId).append(data);
@@ -25,8 +25,8 @@ function ReloadBlock(divId, sStyle, sSerializedFilter, sExtraParams)
 {
 {
 	$('#'+divId).addClass('loading');
 	$('#'+divId).addClass('loading');
 	//$('#'+divId).blockUI();
 	//$('#'+divId).blockUI();
-	$.get('ajax.render.php?filter='+sSerializedFilter+'&style='+sStyle,
-	   { operation: 'ajax', extra_params: sExtraParams },
+	$.post('ajax.render.php?style='+sStyle,
+	   { operation: 'ajax', filter: sSerializedFilter, extra_params: sExtraParams },
 	   function(data){
 	   function(data){
 		 $('#'+divId).empty();
 		 $('#'+divId).empty();
 		 $('#'+divId).append(data);
 		 $('#'+divId).append(data);
@@ -65,7 +65,7 @@ function ReloadSearchForm(divId, sClassName, sBaseClass)
 		bSubmitHookIsUsed = true;
 		bSubmitHookIsUsed = true;
 	}
 	}
 	$('#'+divId+' form').unbind('submit');
 	$('#'+divId+' form').unbind('submit');
-	$.get('ajax.render.php',
+	$.post('ajax.render.php',
 	   { operation: 'search_form', className: sClassName, baseClass: sBaseClass, currentId: divId },
 	   { operation: 'search_form', className: sClassName, baseClass: sBaseClass, currentId: divId },
 	   function(data){
 	   function(data){
 		   $('#'+divId).empty();
 		   $('#'+divId).empty();

+ 4 - 4
js/wizard.utils.js

@@ -9,8 +9,8 @@ function UpdateObjectList(sClass, sId, sExtKeyToRemote)
 		aRelatedObjectIds[0] = 0;
 		aRelatedObjectIds[0] = 0;
 	}
 	}
 	var oql = "SELECT "+sClass+" AS c WHERE c.id IN (" + aRelatedObjectIds.join(", ") + ")";
 	var oql = "SELECT "+sClass+" AS c WHERE c.id IN (" + aRelatedObjectIds.join(", ") + ")";
-	$.get("ajax.render.php?filter=" + oql + "&style=list&encoding=oql",
-	   { operation: "ajax" },
+	$.post("ajax.render.php?style=list&encoding=oql",
+	   { operation: "ajax", filter: oql },
 	   function(data){
 	   function(data){
 		 $("#related_objects_"+sId).empty();
 		 $("#related_objects_"+sId).empty();
 		 $("#related_objects_"+sId).append(data);
 		 $("#related_objects_"+sId).append(data);
@@ -42,8 +42,8 @@ function ManageObjects(sTitle, sClass, sId, sExtKeyToRemote)
 function Manage_LoadSelect(sSelectedId, sFilter)
 function Manage_LoadSelect(sSelectedId, sFilter)
 {
 {
  	$('#'+sSelectedId).addClass('loading');
  	$('#'+sSelectedId).addClass('loading');
-	$.get('ajax.render.php?filter=' + sFilter,
-	   { operation: 'combo_options' },
+	$.post('ajax.render.php',
+	   { operation: 'combo_options', filter: sFilter },
 	   function(data){
 	   function(data){
 		 $('#'+sSelectedId).empty();
 		 $('#'+sSelectedId).empty();
 		 $('#'+sSelectedId).append(data);
 		 $('#'+sSelectedId).append(data);

+ 2 - 2
js/wizardhelper.js

@@ -102,8 +102,8 @@ function WizardHelper(sClass)
 	{
 	{
 		//console.log('data sent:', this.ToJSON());
 		//console.log('data sent:', this.ToJSON());
 		//console.log('oWizard:', this);
 		//console.log('oWizard:', this);
-		$.get('ajax.render.php?json_obj=' + this.ToJSON(),
-		   { operation: 'wizard_helper' },
+		$.post('ajax.render.php',
+		   { operation: 'wizard_helper', json_obj: this.ToJSON() },
 			function(html){
 			function(html){
 				$('body').append(html);
 				$('body').append(html);
 				//console.log('data received:', oWizardHelper);
 				//console.log('data received:', oWizardHelper);

+ 1 - 1
pages/csvimport.php

@@ -1026,7 +1026,7 @@ function Welcome(iTopWebPage $oPage)
 		ajax_request = null;
 		ajax_request = null;
 	}
 	}
 	
 	
-	ajax_request = $.get('ajax.csvimport.php',
+	ajax_request = $.post('ajax.csvimport.php',
 		   { operation: 'get_csv_template', class_name: sClassName },
 		   { operation: 'get_csv_template', class_name: sClassName },
 		   function(data) {
 		   function(data) {
 			 $('#template').empty();
 			 $('#template').empty();