Index: /trunk/prototype/modules/filters/filters.js
===================================================================
--- /trunk/prototype/modules/filters/filters.js	(revision 6392)
+++ /trunk/prototype/modules/filters/filters.js	(revision 6443)
@@ -346,4 +346,14 @@
 }
 
+
+DataLayer.codec( 'message', 'jqGrid', {
+ 
+      encoder: function( data ){
+
+	  return( data );
+
+      }
+});
+
 /* Gerencia o grid das mensagens da caixa de entrada */
 function showGridMessages(thiss) {
@@ -365,13 +375,11 @@
 	var options = ["from", "to", "subject", "body", "size"];
 	var criterias_ = new Array();
-	var j = 0;		
-	for (i in criteria_) {
-		if(criteria_[i] != "") {
-			(j == 0) ? criterias_[j] = {"0": options[i], "1": criteria_value_[i], "2": criteria_[i]} : criterias_[j] = {"0": "OR", "1": options[i], "2": criteria_value_[i], "3": criteria_[i]}; 
-			j++;
-		}	
-	}
+
+	for (i in criteria_)
+		if(criteria_[i] != "")
+		    criterias_.push( criterias_.length ?  {"0": "OR", "1": options[i], "2": criteria_value_[i], "3": criteria_[i]} : {"0": options[i], "1": criteria_value_[i], "2": criteria_[i]} ); 
+
 	showGridButton = thiss.parent();
-// 	.html('buscando mensagens...');
+
 	showGridButton.siblings("#filtergrid-container").block({  
 							message: '<div id="loading-content"><div class="image"></div></div>',  
@@ -389,86 +397,86 @@
 								opacity:         0.5 
 							}  
-						}); 
-
-	$.ajax({  
-		url: DataLayer.basePath + 'folder/INBOX/message&' +  $.param( {"filter": criterias_} ),
-		dataType: 'json',
-		success: function(data){
-			allMessages = data;
-
-			var parametro =  { "filter": ( data != false ? [ "msgNumber", "IN", data ] : criterias_ ) };
-			
-			if (typeof grid !== "undefined") { 
-				grid.jqGrid( 'setGridParam', { url: DataLayer.basePath + 'folder/INBOX/message&' +  $.param( parametro ) } ).trigger( 'reloadGrid' ); 
-				//return;
-			}
-			grid = showGridButton.siblings("#filtergrid-container").removeClass('empty-container')
-			.html('<table class="hidden fields-search-messages-grid" id="fields-search-messages-grid"><tr><td/></tr></table><div class="hidden fields-search-messages-grid-pager" id="fields-search-messages-grid-pager"></div>')
-			.children(".fields-search-messages-grid, .fields-search-messages-grid-pager").removeClass('hidden').filter(".fields-search-messages-grid").trigger( 'reloadGrid' ).jqGrid({
-				//url: DataLayer.basePath + 'folder/INBOX/message&' +  $.param( {"filter": [ "msgNumber", "IN", data ]} ),
-				url: DataLayer.basePath + 'folder/INBOX/message&' +  $.param( parametro ),
-				datatype: "json",
-				mtype: 'GET',
-				colNames:['#', 'De', 'Assunto', 'Data', 'Tamanho'],
-				colModel:[
-					{name:'msg_number',index:'msg_number', width:45, hidden:true, sortable:false},
-					{name:'from.email',index:'msg_number', width:130, sortable:false},
-					{name:'subject',index:'subject', width:250, sortable:false},
-					{name:'timestamp',index:'timestamp', width:65, align:"center", sortable:false, formatter:date2Time},
-					{name:'size',index:'size', width:50, align:"right", sortable:false, formatter:bytes2Size}
-				],
-				jsonReader : {
-					root:"rows",
-					page: "page",
-					total: "total",
-					records: "records",
-					repeatitems: false,
-					id: "0"
-				},
-				rowNum:10,
-				//rowList:[10,25,50],
-				rowList:[10],
-				pager: '#fields-search-messages-grid-pager',
-				sortname: 'id',
-				viewrecords: true,
-				sortorder: "desc",
-				multiselect: true,
-				autowidth: true,
-				reloadAfterEdit: true,
-				reloadAfterSubmit: true,
-				height:200,
-				loadComplete: function(data) {
-			  //				// aplica o contador
-			  //				jQuery('.timable').each(function (i) {
-			  //					jQuery(this).countdown({
-			  //						since: new Date(parseInt(this.title)), 
-			  //						significant: 1,
-			  //						layout: 'h&aacute; {d<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl}{s>}', 
-			  //						description: ' atr&aacute;s'
-			  //					});
-			  //				});
-				},
-				onSelectRow: function (id, selected) {
-					if( selected ) 
-					{
-						selectedMessages[ id ] = true;
-					}
-					else
-					{
-						delete selectedMessages[ id ];
-					}
-				},
-				onSelectAll: function (id, selected) {					
-					for (i in id) {
-						if(selected)
-							selectedMessages[id[i]] = true;
-						else
-							delete selectedMessages[id[i]];	
-					}
-				},
-				caption: 'Mensagens que atendem aos crit&eacute;rios'
-			}); // end jqGrid
-		} // end success
-	}); // end ajax
+						});
+
+	var data = DataLayer.get( 'message', { filter: criterias_, criteria: { properties: { context: { folder: 'INBOX' } } } }, true );
+	
+	DataLayer.register( 'criterias', 'message:jqGrid', function( crit ){
+
+		    crit.properties = { context: { folder: 'INBOX' } };
+		    
+		    return { filter: [ "msgNumber", "IN", data ], criteria: crit };
+	});
+
+	allMessages = data;
+	
+	if (typeof grid !== "undefined") { 
+		grid.jqGrid( 'setGridParam', { url: 'message:jqGrid', postData: data } ).trigger( 'reloadGrid' ); 
+		//return;
+	}
+	grid = showGridButton.siblings("#filtergrid-container").removeClass('empty-container')
+	.html('<table class="hidden fields-search-messages-grid" id="fields-search-messages-grid"><tr><td/></tr></table><div class="hidden fields-search-messages-grid-pager" id="fields-search-messages-grid-pager"></div>')
+	.children(".fields-search-messages-grid, .fields-search-messages-grid-pager").removeClass('hidden').filter(".fields-search-messages-grid").trigger( 'reloadGrid' ).jqGrid({
+		url: 'message:jqGrid',
+		datatype: "json",
+		mtype: 'GET',
+		colNames:['#', 'De', 'Assunto', 'Data', 'Tamanho'],
+		colModel:[
+			{name:'msg_number',index:'msg_number', width:45, hidden:true, sortable:false},
+			{name:'from.email',index:'msg_number', width:130, sortable:false},
+			{name:'subject',index:'subject', width:250, sortable:false},
+			{name:'timestamp',index:'timestamp', width:65, align:"center", sortable:false, formatter:date2Time},
+			{name:'size',index:'size', width:50, align:"right", sortable:false, formatter:bytes2Size}
+		],
+		jsonReader : {
+			root:"rows",
+			page: "page",
+			total: "total",
+			records: "records",
+			repeatitems: false,
+			id: "0"
+		},
+		rowNum:10,
+		//rowList:[10,25,50],
+		rowList:[10],
+		pager: '#fields-search-messages-grid-pager',
+		sortname: 'id',
+		viewrecords: true,
+		sortorder: "desc",
+		multiselect: true,
+		autowidth: true,
+		reloadAfterEdit: true,
+		reloadAfterSubmit: true,
+		height:200,
+		loadComplete: function(data) {
+	  //				// aplica o contador
+	  //				jQuery('.timable').each(function (i) {
+	  //					jQuery(this).countdown({
+	  //						since: new Date(parseInt(this.title)), 
+	  //						significant: 1,
+	  //						layout: 'h&aacute; {d<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl}{s>}', 
+	  //						description: ' atr&aacute;s'
+	  //					});
+	  //				});
+		},
+		onSelectRow: function (id, selected) {
+			if( selected ) 
+			{
+				selectedMessages[ id ] = true;
+			}
+			else
+			{
+				delete selectedMessages[ id ];
+			}
+		},
+		onSelectAll: function (id, selected) {					
+			for (i in id) {
+				if(selected)
+					selectedMessages[id[i]] = true;
+				else
+					delete selectedMessages[id[i]];	
+			}
+		},
+		caption: 'Mensagens que atendem aos crit&eacute;rios'
+	}); // end jqGrid
 }
 
Index: /trunk/prototype/api/datalayer.js
===================================================================
--- /trunk/prototype/api/datalayer.js	(revision 6412)
+++ /trunk/prototype/api/datalayer.js	(revision 6443)
@@ -1,2 +1,6 @@
+
+(function($){$.parseQuery=function(options){var config={query:window.location.search||""},params={};if(typeof options==='string'){options={query:options};}
+$.extend(config,$.parseQuery,options);config.query=config.query.replace(/^\?/,'');$.each(config.query.split(config.separator),function(i,param){var pair=param.split('='),key=config.decode(pair.shift(),null).toString(),value=config.decode(pair.length?pair.join('='):null,key);if(config.array_keys(key)){params[key]=params[key]||[];params[key].push(value);}else{params[key]=value;}});return params;};$.parseQuery.decode=$.parseQuery.default_decode=function(string){return decodeURIComponent((string||"").replace('+',' '));};$.parseQuery.array_keys=function(){return false;};$.parseQuery.separator="&";}(jQuery));
+
 internalUrl = /^([A-z0-9-_]+)(:[A-z0-9-_]+)?$/;
 internalUri = /^([a-zA-Z0-9-_]+)\(([a-zA-Z0-9-_]+)\):\/\/(.*)|([a-zA-Z0-9-_]+):\/\/(.*)$/;
@@ -57,4 +61,7 @@
 
 	  jqXHR.abort();
+	  
+	  if( typeof options.data === "string" )
+	      options.data = $.parseQuery( options.data );
 
 	  switch( options.type.toUpperCase() )
@@ -1392,5 +1399,5 @@
 	  properties: criteria.properties || ''
 
-      } );
+      }, false, true );
     },
 
Index: /trunk/prototype/request.php
===================================================================
--- /trunk/prototype/request.php	(revision 6111)
+++ /trunk/prototype/request.php	(revision 6443)
@@ -1,16 +1,16 @@
 <?php
 
-// $properties = $_GET['properties'];
-// $limit = $_GET['limit'];
-// $offset = $_GET['offset'];
-// $group = $_GET['group'];
-// $order = $_GET['join'];
-// $filter = $_GET['filter'];
-// $URI = $_GET['URI'];
+// $properties = $_REQUEST['properties'];
+// $limit = $_REQUEST['limit'];
+// $offset = $_REQUEST['offset'];
+// $group = $_REQUEST['group'];
+// $order = $_REQUEST['join'];
+// $filter = $_REQUEST['filter'];
+// $URI = $_REQUEST['URI'];
 
-$concept = isset( $_GET['concept'] ) ? $_GET['concept'] : false;
-$id = isset( $_GET['id'] ) ? $_GET['id'] : false;
-$filter = isset( $_GET['filter'] ) ? $_GET['filter'] : false;
-$criteria =  isset( $_GET['criteria'] ) ? $_GET['criteria'] : false;
+$concept = isset( $_REQUEST['concept'] ) ? $_REQUEST['concept'] : false;
+$id = isset( $_REQUEST['id'] ) ? $_REQUEST['id'] : false;
+$filter = isset( $_REQUEST['filter'] ) ? $_REQUEST['filter'] : false;
+$criteria =  isset( $_REQUEST['criteria'] ) ? $_REQUEST['criteria'] : false;
 
 $criteria = $filter ? $criteria ?
