Merging some changes to the variable picker feature inside the processmaker core

This commit is contained in:
user
2012-11-27 08:55:29 -04:00
parent 421c6b235f
commit 2f1ded16f5
3 changed files with 37 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
var getValue = function (list) { var getValue = function (list) {
insertFormVar(document.getElementById('selectedField').value,list.value) insertFormVar(document.getElementById('selectedField').value,list.value);
} }
var getVariableList = function (queryText, proUid, varType){ var getVariableList = function (queryText, proUid, varType){
@@ -19,22 +19,33 @@ var getVariableList = function (queryText, proUid, varType){
return responseData; return responseData;
} }
leimnud.event.add(document.getElementById('type_variables'), 'change', function(e) { var getPrefixInfo = function (prefix){
//console.log('Dropdown Type of Variables'); var oRPC = new leimnud.module.rpc.xmlhttp({
generateListValues(); url : "../processes/processes_Ajax",
async : false,
method: "POST",
args : "action=getVariablePrefix&prefix="+prefix
});
oRPC.make();
return oRPC.xmlhttp.responseText;
}
leimnud.event.add(document.getElementById('type_variables'), 'change', function(event) {
generateListValues();
}); });
leimnud.event.add(document.getElementById('prefix'), 'change', function(event) { leimnud.event.add(document.getElementById('prefix'), 'change', function(event) {
console.log('Dropdown Prefix'); document.getElementById('desc_prefix').textContent = getPrefixInfo(document.getElementById('prefix').value);
}); });
leimnud.event.add(document.getElementById('_Var_Form_'), 'change', function(event) {
document.getElementById('selectedVariableLabel').textContent = document.getElementById('_Var_Form_').value
});
leimnud.event.add(document.getElementById('search'), 'keypress', function(e) { leimnud.event.add(document.getElementById('search'), 'keypress', function(e) {
var key = e.keyCode; var key = e.keyCode;
if(key == '13') if(key == '13'){
{ // elements that will be part of a function
//var ref = document.getElementById("PRO_UID").value;
var list = getVariableList(document.getElementById('search').value, document.getElementById("process").value, document.getElementById('type_variables').value); var list = getVariableList(document.getElementById('search').value, document.getElementById("process").value, document.getElementById('type_variables').value);
for (var i=0; i< list.length; i++){ for (var i=0; i< list.length; i++){
console.log(list[i].sName); console.log(list[i].sName);

View File

@@ -27,9 +27,10 @@ $html .= '<div id="d_variables">';
$html .= '<table width="90%" align="center">'; $html .= '<table width="90%" align="center">';
$html .= '<tr>'; $html .= '<tr style="display:none; visibility:hidden;">';
$html .= '<td colspan="3">'; $html .= '<td colspan="3">';
$html .= '<input type="hidden" id="process" value="'.$_POST['sProcess'].'">'; $html .= '<input type="hidden" id="process" value="'.$_POST['sProcess'].'">';
$html .= '<input type="hidden" id="selectedField" name="selectedField" value="'.$_POST['sFieldName'].'"/> ';
$html .= '</td>'; $html .= '</td>';
$html .= '</tr>'; $html .= '</tr>';
@@ -56,7 +57,6 @@ $html .= '<option value="all">All Variables</option>';
$html .= '<option value="system">System Variables</option>'; $html .= '<option value="system">System Variables</option>';
$html .= '<option value="process">Process Variables</option>'; $html .= '<option value="process">Process Variables</option>';
$html .= '</select> &nbsp;&nbsp;&nbsp;&nbsp;'; $html .= '</select> &nbsp;&nbsp;&nbsp;&nbsp;';
$html .= '<input type="hidden" id="selectedField" name="selectedField" value="'.$_POST['sFieldName'].'"/> ';
$html .= '</td>'; $html .= '</td>';
$html .= '<td width="25%">'; $html .= '<td width="25%">';
@@ -75,12 +75,7 @@ $html .= '<td width="25%" valign="top">';
$html .= '<input type="text" id="search" size="15">'; $html .= '<input type="text" id="search" size="15">';
$html .= '</td>'; $html .= '</td>';
$html .= '</tr>'; $html .= '</tr>';
$html .= '<br>';
$html .= '<tr><td>&nbsp;</td></tr>';
$html .= '<tr>'; $html .= '<tr>';
$html .= '<br>';
$html .= '<tr><td><label for="prefix_label">Variables</label></td></tr>'; $html .= '<tr><td><label for="prefix_label">Variables</label></td></tr>';
$html .= '<tr>'; $html .= '<tr>';
//onChange="Seleccionar(this); //onChange="Seleccionar(this);
@@ -91,7 +86,7 @@ $aFields = getDynaformsVars( $_POST['sProcess'], true, isset( $_POST['bIncMulSel
//$html .= '<select name="_Var_Form_" id="_Var_Form_" size="' . count( $aFields ) . '" style="width:100%;' . (! isset( $_POST['sNoShowLeyend'] ) ? 'height:50%;' : '') . '" ondblclick="insertFormVar(\'' . $_POST['sFieldName'] . '\', this.value);">'; //$html .= '<select name="_Var_Form_" id="_Var_Form_" size="' . count( $aFields ) . '" style="width:100%;' . (! isset( $_POST['sNoShowLeyend'] ) ? 'height:50%;' : '') . '" ondblclick="insertFormVar(\'' . $_POST['sFieldName'] . '\', this.value);">';
$html .= '<select name="_Var_Form_" id="_Var_Form_" size="8" style="width:100%;' . (! isset( $_POST['sNoShowLeyend'] ) ? 'height:50%;' : '') . '" ondblclick="getValue(this);">'; $html .= '<select name="_Var_Form_" id="_Var_Form_" size="8" style="width:100%;' . (! isset( $_POST['sNoShowLeyend'] ) ? 'height:170;' : '') . '" ondblclick="getValue(this);">';
foreach ($aFields as $aField) { foreach ($aFields as $aField) {
$html .= '<option value="' . $_POST['sSymbol'] . $aField['sName'] . '">' . $_POST['sSymbol'] . $aField['sName'] . ' (' . $aField['sType'] . ')</option>'; $html .= '<option value="' . $_POST['sSymbol'] . $aField['sName'] . '">' . $_POST['sSymbol'] . $aField['sName'] . ' (' . $aField['sType'] . ')</option>';
@@ -110,23 +105,21 @@ $html .= '</table>';
$html .= '</div>'; $html .= '</div>';
$html .= '<br>'; $html .= '<br>';
$html .= '<div id="desc_variables">';
$html .= '<table border="1" width="90%" align="center">'; $html .= '<table border="1" width="90%" align="center">';
$html .= '<tr width="40%">'; $html .= '<tr width="40%">';
$html .= '<td>Result</td>'; $html .= '<td>Result</td>';
$html .= '<td>@#SYS_LANG</td>'; $html .= '<td><span id="selectedVariableLabel">@@SYS_LANG</span></td>';
$html .= '</tr>'; $html .= '</tr>';
$html .= '<tr width="60%">'; $html .= '<tr width="60%">';
$html .= '<td>Description</td>'; $html .= '<td>Description</td>';
$html .= '<td>Description @#SYS_LANG</td>'; $html .= '<td><span id="desc_variables">'.G::LoadTranslation('ID_SYSTEM').'</span></td>';
$html .= '</tr>'; $html .= '</tr>';
$html .= '</table>'; $html .= '</table>';
$html .= '</div>'; $html .= '</div>';
$html .= '<br>'; $html .= '<br>';
$html .= '<div id="desc_variables">';
$html .= '<table width="90%" align="center">'; $html .= '<table width="90%" align="center">';
$html .= '<tr><td>'; $html .= '<tr><td>';
$html .= '<label for="desc_prefix">' . G::LoadTranslation( 'ID_TO_FLOAT' ) . '</label>'; $html .= '<label for="desc_prefix">*<span id="desc_prefix">' . G::LoadTranslation( 'ID_TO_STRING' ) . '</span></label>';
$html .= '</td></tr>'; $html .= '</td></tr>';
$html .= '</div>'; $html .= '</div>';

View File

@@ -528,7 +528,6 @@ try {
} else { } else {
$isSystem = false; $isSystem = false;
} }
var_dump($isSystem);
if ($_REQUEST['type']=='all'){ if ($_REQUEST['type']=='all'){
$aFields = getDynaformsVars( $proUid ); $aFields = getDynaformsVars( $proUid );
} else { } else {
@@ -543,6 +542,10 @@ try {
$oJSON = new Services_JSON(); $oJSON = new Services_JSON();
echo $oJSON->encode( $aVariables ); echo $oJSON->encode( $aVariables );
break; break;
case 'getVariablePrefix':
$_REQUEST['prefix'] = $_REQUEST['prefix']!=null?$_REQUEST['prefix']:'ID_TO_STRING';
echo G::LoadTranslation($_REQUEST['prefix']);
break;
/* /*
case 'saveFile': case 'saveFile':
global $G_PUBLISH; global $G_PUBLISH;