Changes to the ajax function in order to obtain the list of variables

This commit is contained in:
user
2012-11-23 16:54:38 -04:00
parent 209cdfbed7
commit adb1ae1c34
3 changed files with 22 additions and 21 deletions

View File

@@ -4,20 +4,17 @@ var getValue = function (list) {
var getVariableList = function (queryText, proUid, varType){ var getVariableList = function (queryText, proUid, varType){
varType = varType.toLowerCase(); varType = varType.toLowerCase();
var response var responseData
var oRPC = new leimnud.module.rpc.xmlhttp({ var oRPC = new leimnud.module.rpc.xmlhttp({
url : "../processes/processes_Ajax", url : "../processes/processes_Ajax",
async : false, async : false,
method: "POST", method: "POST",
args : "action=getVariableList&process="+proUid+"&queryText="+queryText+"&type="+varType args : "action=getVariableList&process="+proUid+"&queryText="+queryText+"&type="+varType
}); });
oRPC.callback = function(rpc){
console.log(rpc.xmlhttp.responseText);
response = eval(rpc.xmlhttp.responseText);
}.extend(this);
oRPC.make(); oRPC.make();
console.log(response); responseData = eval ("(" +oRPC.xmlhttp.responseText+ ")");
return responseData;
} }
leimnud.event.add(document.getElementById('type_variables'), 'change', function(event) { leimnud.event.add(document.getElementById('type_variables'), 'change', function(event) {
@@ -29,21 +26,25 @@ leimnud.event.add(document.getElementById('prefix'), 'change', function(event) {
}); });
leimnud.event.add(document.getElementById('search'), 'keypress', function(event) { leimnud.event.add(document.getElementById('search'), 'keypress', function(e) {
var tecla = event.keyCode; var key = e.keyCode;
if(tecla == '13') if(key == '13')
{ {
var list = getVariableList('nuev','2527075735085b447a58523099748463','system'); var list = getVariableList('nuev','2527075735085b447a58523099748463','system');
console.log(list); for (var i=0; i< list.length; i++){
for (var i in list){ console.log(list[i].sName);
console.log(list[i]); }
e.cancelBubble = true;
e.returnValue = false;
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
} }
console.log('Has pulsado enter');
return false; return false;
} }
}); });
leimnud.event.add(document.getElementById('type_variables'), 'change', function(event) { leimnud.event.add(document.getElementById('type_variables'), 'change', function(event) {
console.log('Dropdown Type of Variables'); console.log('Dropdown Type of Variables');
}); });

View File

@@ -71,8 +71,7 @@ $html .= '<option value="ID_REPLACE_WITHOUT_CHANGES">@=</option>';
$html .= '</select> &nbsp;&nbsp;&nbsp;&nbsp;'; $html .= '</select> &nbsp;&nbsp;&nbsp;&nbsp;';
$html .= '</td>'; $html .= '</td>';
$html .= '<td width="20%">'; $html .= '<td width="20%" valign="top">';
//$html .= '<input type="text" id="search" size="15" onkeydown="validartexto(event);">';
$html .= '<input type="text" id="search" size="15">'; $html .= '<input type="text" id="search" size="15">';
$html .= '</td>'; $html .= '</td>';
$html .= '</tr>'; $html .= '</tr>';

View File

@@ -522,16 +522,17 @@ try {
case 'getVariableList': case 'getVariableList':
G::LoadClass( 'xmlfield_InputPM' ); G::LoadClass( 'xmlfield_InputPM' );
$proUid= isset($_REQUEST['process'])?$_REQUEST['process']:''; $proUid= isset($_REQUEST['process'])?$_REQUEST['process']:'';
$queryText= isset($_REQUEST['queryText'])?$_REQUEST['queryText']:'';
$aFields = getDynaformsVars( $proUid, true, isset( $_REQUEST['bIncMulSelFields'] ) ? $_REQUEST['bIncMulSelFields'] : 0 ); $aFields = getDynaformsVars( $proUid, true, isset( $_REQUEST['bIncMulSelFields'] ) ? $_REQUEST['bIncMulSelFields'] : 0 );
$_REQUEST['queryString'] = 'SYS'; //$_REQUEST['queryString'] = 'SYS';
$aVariables = array(); $aVariables = array();
foreach ($aFields as $key => $value) { foreach ($aFields as $key => $value) {
if(stristr($aFields[$key]['sName'], $_REQUEST['queryString'])){ if(stristr($aFields[$key]['sName'], $queryText)){
$aVariables[] = $aFields[$key]; $aVariables[] = $aFields[$key];
} }
} }
$oJSON = new Services_JSON(); $oJSON = new Services_JSON();
echo $oJSON->encode($aFields); echo $oJSON->encode($aVariables);
break; break;
/* /*
case 'saveFile': case 'saveFile':