Refactor output document / 0016759: Output Document pmGrids 0016760: Output Document Variables

Se agrego "Grid variables" a las opciones de Type Variable en el pmVariablePicker, que despliega los campos de las grillas que tiene en el proceso
This commit is contained in:
marcelo.cuiza
2015-05-22 16:21:55 -04:00
parent eabfe30c0c
commit 5b46d3e65a
3 changed files with 58 additions and 13 deletions

View File

@@ -414,7 +414,7 @@ function getDynaformsVars ($sProcessUID, $typeVars = 'all', $bIncMulSelFields =
array_push($aFields, array( array_push($aFields, array(
"sName" => $row["VAR_NAME"], "sName" => $row["VAR_NAME"],
"sType" => $row["VAR_FIELD_TYPE"], "sType" => $row["VAR_FIELD_TYPE"],
"sLabel" => $row["VAR_NAME"] . " [" . $row["VAR_FIELD_TYPE"] . "]" "sLabel" => $row["VAR_FIELD_TYPE"]
)); ));
} }
} }
@@ -437,8 +437,8 @@ function getDynaformsVars ($sProcessUID, $typeVars = 'all', $bIncMulSelFields =
foreach($columns as $column) { foreach($columns as $column) {
array_push($aFields, array( array_push($aFields, array(
"sName" => $column['name'], "sName" => $column['name'],
"sType" => $column['dataType'], "sType" => $column['type'],
"sLabel" => $column['name'] . " [" . $column['dataType']. "]" "sLabel" => $column['type']
)); ));
} }
} }

View File

@@ -1,19 +1,35 @@
var setVariablePickerJS = function(){ var setVariablePickerJS = function(){
if (document.getElementById('_Var_Form_').addEventListener) // W3C DOM if (document.getElementById('_Var_Form_').addEventListener) // W3C DOM
document.getElementById('_Var_Form_').addEventListener('dblclick', function(){ document.getElementById('_Var_Form_').addEventListener('dblclick', function(){
if (this.getAttribute('displayOption')=='event'){ if(this.value.substring(0,5) == 'gridt') {
e.insertFormVar(this.value.substring(2), this.value.substring(2), 'dyn' ); try {
updateEditorContent(this.value.substring(5));
} catch(err) {
closePluginPopup();
}
} else { } else {
insertFormVar(document.getElementById('selectedField').value, this.value); if (this.getAttribute('displayOption')=='event'){
e.insertFormVar(this.value.substring(2), this.value.substring(2), 'dyn' );
} else {
insertFormVar(document.getElementById('selectedField').value, this.value);
}
} }
}); });
else if (document.getElementById('selectedField').attachEvent) { // IE DOM else if (document.getElementById('selectedField').attachEvent) { // IE DOM
var element = document.getElementById('_Var_Form_'); var element = document.getElementById('_Var_Form_');
element.attachEvent("ondblclick", function(){ element.attachEvent("ondblclick", function(){
if (element.displayOption=='event'){ if(element.value.substring(0,5) == 'gridt') {
e.insertFormVar(element.value.substring(2), element.value.substring(2), 'dyn' ); try {
} else { updateEditorContent(element.value.substring(5));
insertFormVar(document.getElementById('selectedField').value, element.value); } catch(err) {
closePluginPopup();
}
} else {
if (element.displayOption=='event'){
e.insertFormVar(element.value.substring(2), element.value.substring(2), 'dyn' );
} else {
insertFormVar(document.getElementById('selectedField').value, element.value);
}
} }
}); });
} }
@@ -99,7 +115,12 @@ var setVariablePickerJS = function(){
}); });
leimnud.event.add(document.getElementById('_Var_Form_'), 'change', function(event) { leimnud.event.add(document.getElementById('_Var_Form_'), 'change', function(event) {
document.getElementById('selectedVariableLabel').textContent = document.getElementById('_Var_Form_').value var selectElement = document.getElementById('_Var_Form_');
if(selectElement.value.substring(0,5) == 'gridt') {
document.getElementById('selectedVariableLabel').textContent = selectElement.options[selectElement.selectedIndex].text;
} else {
document.getElementById('selectedVariableLabel').textContent = selectElement.value
}
}); });
leimnud.event.add(document.getElementById('search'), 'keypress', function(e) { leimnud.event.add(document.getElementById('search'), 'keypress', function(e) {
@@ -130,6 +151,7 @@ var setVariablePickerJS = function(){
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);
var combo = document.getElementById("_Var_Form_"); var combo = document.getElementById("_Var_Form_");
var option = document.createElement('option'); var option = document.createElement('option');
var isBpmn = document.getElementById('isBpmn').value;
for(i=(combo.length-1); i>=0; i--) for(i=(combo.length-1); i>=0; i--)
{ {
@@ -140,8 +162,15 @@ var setVariablePickerJS = function(){
if(list.length>0){ if(list.length>0){
for(i=0; i<list.length; i++) for(i=0; i<list.length; i++)
{ {
var optionValue = prefix+list[i].sName;
if(isBpmn) {
if(list[i].sLabel.toLowerCase() == 'grid') {
var gridValue = 'gridt<table border=1 cellspacing=0><tr><th>Header_1</th></tr><tbody><!--@>'+list[i].sName+'--><tr><td>column_name1</td></tr><!--@<'+list[i].sName+'--></tbody></table>';
optionValue = gridValue;
}
}
option = document.createElement("OPTION"); option = document.createElement("OPTION");
option.value = prefix+list[i].sName; option.value = optionValue;
option.text = prefix+list[i].sName+' ('+list[i].sLabel+')'; option.text = prefix+list[i].sName+' ('+list[i].sLabel+')';
combo.add(option); combo.add(option);
} }

View File

@@ -74,7 +74,9 @@ $oDataset = ProcessPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflo
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next(); $oDataset->next();
$row = $oDataset->getRow(); $row = $oDataset->getRow();
$isBpmn = false;
if (isset($row["PRJ_UID"])) { if (isset($row["PRJ_UID"])) {
$isBpmn = true;
$html .= '<option value="grid">'.$filter->xssFilterHard(G::LoadTranslation( 'ID_TINY_GRID_VARIABLES' )).'</option>'; $html .= '<option value="grid">'.$filter->xssFilterHard(G::LoadTranslation( 'ID_TINY_GRID_VARIABLES' )).'</option>';
} }
@@ -116,7 +118,14 @@ if (isset($_REQUEST['displayOption'])){
$html .= '<select name="_Var_Form_" id="_Var_Form_" size="8" style="width:100%;' . (! isset( $_POST['sNoShowLeyend'] ) ? 'height:170;' : '') . '" '.$displayOption.'>'; $html .= '<select name="_Var_Form_" id="_Var_Form_" size="8" style="width:100%;' . (! isset( $_POST['sNoShowLeyend'] ) ? 'height:170;' : '') . '" '.$displayOption.'>';
foreach ($aFields as $aField) { foreach ($aFields as $aField) {
$html .= '<option value="' . $_REQUEST['sSymbol'] . $aField['sName'] . '">' . $_REQUEST['sSymbol'] . $aField['sName'] . ' (' . $aField['sType'] . ')</option>'; $value = $_REQUEST['sSymbol'] . $aField['sName'];
if ($isBpmn) {
if(strtolower($aField['sType']) == 'grid') {
$gridValue = 'gridt<table border=1 cellspacing=0> <tr> <th>Header_1</th> </tr> <!--@>'.$aField['sName'].'--> <tr> <td>column_name1</td> </tr><!--@<'.$aField['sName'].'--> </table>';
$value = htmlentities($gridValue);
}
}
$html .= '<option value="' . $value . '">' . $_REQUEST['sSymbol'] . $aField['sName'] . ' (' . $aField['sType'] . ')</option>';
} }
$aRows[0] = Array ('fieldname' => 'char','variable' => 'char','type' => 'type','label' => 'char'); $aRows[0] = Array ('fieldname' => 'char','variable' => 'char','type' => 'type','label' => 'char');
@@ -126,6 +135,13 @@ foreach ($aFields as $aField) {
} }
$html .= '</select>'; $html .= '</select>';
if ($isBpmn) {
$valueBpmn = 1;
} else {
$valueBpmn = 0;
}
$html .= '<input type="hidden" id="isBpmn" value="'.$valueBpmn.'">';
$html .= '</td>'; $html .= '</td>';
$html .= '</tr>'; $html .= '</tr>';
$html .= '</table>'; $html .= '</table>';