Merge remote branch 'upstream/3.0.1-GA' into 3.0.1-GA

This commit is contained in:
Luis Fernando Saisa Lopez
2015-08-26 14:16:14 -04:00
7 changed files with 455 additions and 366 deletions

View File

@@ -596,7 +596,7 @@ abstract class PreparedStatementCommon {
if ( is_object ( $value ) ) { if ( is_object ( $value ) ) {
$this->boundInVars[$paramIndex] = "'" . $this->escape($value->__toString()) . "'"; $this->boundInVars[$paramIndex] = "'" . $this->escape($value->__toString()) . "'";
} else { } else {
$this->boundInVars[$paramIndex] = "'" . $this->escape((string)$value) . "'"; @$this->boundInVars[$paramIndex] = "'" . $this->escape((string)$value) . "'";
} }
} }
} }

View File

@@ -87,10 +87,16 @@ class ConsolidatedCases
$dataDyna = $pmDyna->getDynaform(); $dataDyna = $pmDyna->getDynaform();
$json = G::json_decode($dataDyna["DYN_CONTENT"]); $json = G::json_decode($dataDyna["DYN_CONTENT"]);
$fieldsDyna = $json->items[0]->items; $fieldsDyna = $json->items[0]->items;
foreach ($fieldsDyna as $value) { foreach ($fieldsDyna as $value) {
$_POST['form']['FIELDS'][] = $value[0]->name . '-' . $value[0]->type; foreach ($value as $val) {
if(isset($val->type)){
if ($val->type == 'text' || $val->type == 'textarea' || $val->type == 'dropdown' || $val->type == 'checkbox' || $val->type == 'datetime' || $val->type == 'yesno' || $val->type == 'date' || $val->type == 'hidden' || $val->type == 'currency' || $val->type == 'percentage' || $val->type == 'link'){
$_POST['form']['FIELDS'][] = $val->name . '-' . $val->type;
}
}
}
} }
$aFieldsClases = array(); $aFieldsClases = array();
$i = 1; $i = 1;
$aFieldsClases[$i]['FLD_NAME'] = 'APP_UID'; $aFieldsClases[$i]['FLD_NAME'] = 'APP_UID';
@@ -176,16 +182,21 @@ class ConsolidatedCases
$oCaseConsolidated->setTasUid($sTasUid); $oCaseConsolidated->setTasUid($sTasUid);
} }
$criteria = new Criteria(); $criteria = new Criteria();
$criteria->addSelectColumn(CaseConsolidatedCorePeer::TAS_UID); $criteria->addSelectColumn(CaseConsolidatedCorePeer::TAS_UID);
$criteria->add(CaseConsolidatedCorePeer::TAS_UID, $sTasUid); $criteria->add(CaseConsolidatedCorePeer::TAS_UID, $sTasUid);
$rsCriteria = CaseConsolidatedCorePeer::doSelectRS($criteria); $rsCriteria = CaseConsolidatedCorePeer::doSelectRS($criteria);
if ($rsCriteria->next()) { if ($rsCriteria->next()) {
$row = $rsCriteria->getRow(); $row = $rsCriteria->getRow();
$oCaseConsolidated->delete(); $oCaseConsolidated->delete();
$oCaseConsolidated = CaseConsolidatedCorePeer::retrieveByPK($sTasUid); $oCaseConsolidated = CaseConsolidatedCorePeer::retrieveByPK($sTasUid);
} }
if (!(is_object($oCaseConsolidated)) || get_class($oCaseConsolidated) != 'CaseConsolidatedCore') {
$oCaseConsolidated = new CaseConsolidatedCore();
$oCaseConsolidated->setTasUid($sTasUid);
}
$oCaseConsolidated->setConStatus('ACTIVE'); $oCaseConsolidated->setConStatus('ACTIVE');
$oCaseConsolidated->setDynUid($sDynUid); $oCaseConsolidated->setDynUid($sDynUid);
$oCaseConsolidated->setRepTabUid($sRepTabUid); $oCaseConsolidated->setRepTabUid($sRepTabUid);

View File

@@ -1656,7 +1656,7 @@ class pmTablesProxy extends HttpProxyController
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
$excludeFieldsList = array ('title','subtitle','link','file','button','reset','submit','listbox','checkgroup','grid','javascript', '' $excludeFieldsList = array ('title','subtitle','link','file','button','reset','submit','listbox','checkgroup','grid','javascript','location','scannerCode','array'
); );
$labelFieldsTypeList = array ('dropdown','radiogroup'); $labelFieldsTypeList = array ('dropdown','radiogroup');
@@ -1709,32 +1709,27 @@ class pmTablesProxy extends HttpProxyController
$oDataset->next(); $oDataset->next();
$row = $oDataset->getRow(); $row = $oDataset->getRow();
if (isset($row["PRJ_UID"])) { if (isset($row["PRJ_UID"])) {
$sProcessUID = $row["PRJ_UID"];
$dynaformNotAllowedVariables = $this->getDynaformVariables($sProcessUID,$excludeFieldsList,false);
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_UID); $oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_UID);
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_NAME); $oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_NAME);
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_FIELD_TYPE); $oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_FIELD_TYPE);
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_SQL);
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_ACCEPTED_VALUES);
$oCriteria->add(ProcessVariablesPeer::PRJ_UID, $row["PRJ_UID"]); $oCriteria->add(ProcessVariablesPeer::PRJ_UID, $row["PRJ_UID"]);
$oDataset = ProcessVariablesPeer::doSelectRS($oCriteria); $oDataset = ProcessVariablesPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$index = 0; $index = 0;
while ($oDataset->next()) { while ($oDataset->next()) {
$row = $oDataset->getRow(); $row = $oDataset->getRow();
$fieldType = isset($row["VAR_FIELD_TYPE"]) ? $row["VAR_FIELD_TYPE"]: ''; if(!in_array($row["VAR_NAME"], $dynaformNotAllowedVariables) && !in_array($row["VAR_FIELD_TYPE"], $excludeFieldsList)) {
$varSql = isset($row["VAR_SQL"]) ? $row["VAR_SQL"] : ''; array_push($fields, array(
$varProcessVariable = isset($row["VAR_ACCEPTED_VALUES"]) ? $row["VAR_ACCEPTED_VALUES"] : '[]'; "FIELD_UID" => $row["VAR_NAME"] . "-" . $row["VAR_FIELD_TYPE"],
if(! in_array( $fieldType, $excludeFieldsList )){ "FIELD_NAME" => $row["VAR_NAME"],
if(strlen($varSql) == 0 && $varProcessVariable == '[]'){ "FIELD_VALIDATE" => "any",
array_push($fields, array( "_index" => $index ++,
"FIELD_UID" => $row["VAR_NAME"] . "-" . $row["VAR_FIELD_TYPE"], "_isset" => true
"FIELD_NAME" => $row["VAR_NAME"], ));
"FIELD_VALIDATE" => "any", }
"_index" => $index ++,
"_isset" => true
));
}
}
} }
} }
@@ -1873,5 +1868,50 @@ class pmTablesProxy extends HttpProxyController
} }
return $aFields; return $aFields;
} }
/**
* Get all dynaform variables
*
* @param $sProcessUID
*/
public function getDynaformVariables($sProcessUID,$excludeFieldsList,$allowed = true)
{
$dynaformVariables = array();
$oC = new Criteria( 'workflow' );
$oC->addSelectColumn( DynaformPeer::DYN_CONTENT );
$oC->add( DynaformPeer::PRO_UID, $sProcessUID );
$oData = DynaformPeer::doSelectRS( $oC );
$oData->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oData->next();
while ($aRowd = $oData->getRow()) {
$dynaform = G::json_decode($aRowd['DYN_CONTENT'],true);
if(is_array($dynaform) && sizeof($dynaform)) {
$items = $dynaform['items'][0]['items'];
foreach($items as $key => $val){
foreach($val as $column) {
if($allowed) {
if(!in_array( $column['type'], $excludeFieldsList )){
if(array_key_exists('variable',$column)) {
if($column['variable'] != "") {
$dynaformVariables[] = $column['variable'];
}
}
}
} else {
if(in_array( $column['type'], $excludeFieldsList )){
if(array_key_exists('variable',$column)) {
if($column['variable'] != "") {
$dynaformVariables[] = $column['variable'];
}
}
}
}
}
}
}
$oData->next();
}
return array_unique($dynaformVariables);
}
} }

View File

@@ -597,6 +597,21 @@ class ajax_con extends WebResource
$oCaseConsolidated->setTasUid($sTasUid); $oCaseConsolidated->setTasUid($sTasUid);
} }
$criteria = new Criteria();
$criteria->addSelectColumn(CaseConsolidatedCorePeer::TAS_UID);
$criteria->add(CaseConsolidatedCorePeer::TAS_UID, $sTasUid);
$rsCriteria = CaseConsolidatedCorePeer::doSelectRS($criteria);
if ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$oCaseConsolidated->delete();
$oCaseConsolidated = CaseConsolidatedCorePeer::retrieveByPK($sTasUid);
}
if (!(is_object($oCaseConsolidated)) || get_class($oCaseConsolidated) != 'CaseConsolidatedCore') {
$oCaseConsolidated = new CaseConsolidatedCore();
$oCaseConsolidated->setTasUid($sTasUid);
}
if ($sStatus == '1') { if ($sStatus == '1') {
$oCaseConsolidated->setConStatus('ACTIVE'); $oCaseConsolidated->setConStatus('ACTIVE');
} else { } else {

View File

@@ -83,18 +83,18 @@ class Consolidated
if (!isset($Fields["DEL_INIT_DATE"])) { if (!isset($Fields["DEL_INIT_DATE"])) {
$oCase->setDelInitDate($app_uid, $del_index); $oCase->setDelInitDate($app_uid, $del_index);
$aFields = $oCase->loadCase($app_uid, $del_index); $aFields = $oCase->loadCase($app_uid, $del_index);
//Update data grid //Update data grid
$aData = $aFields['APP_DATA']; $aData = $aFields['APP_DATA'];
foreach ($aData as $k => $dataField) { foreach ($aData as $k => $dataField) {
if(is_array($dataField)){ if(is_array($dataField)){
$pos = count($dataField); $pos = count($dataField);
if(isset($aData[$k][$pos][$fieldName])){ if(isset($aData[$k][$pos][$fieldName])){
$aData[$k][$pos][$fieldName] = $fieldValue; $aData[$k][$pos][$fieldName] = $fieldValue;
} }
} }
} }
$aFields['APP_DATA'] = $aData; $aFields['APP_DATA'] = $aData;
$oCase->updateCase($app_uid, $aFields); $oCase->updateCase($app_uid, $aFields);
//End update //End update
} }
@@ -394,7 +394,9 @@ class Consolidated
foreach ($aTaskConsolidated as $key => $val) { foreach ($aTaskConsolidated as $key => $val) {
foreach ($val as $iKey => $iVal) { foreach ($val as $iKey => $iVal) {
if (self::checkValidDate($iVal)) { if (self::checkValidDate($iVal)) {
$val[$iKey] = str_replace("-", "/", $val[$iKey]); $iKeyView = str_replace("-", "/", $val[$iKey]);
$iKeyView = str_replace("T", " ", $iKeyView);
$val[$iKey] = $iKeyView;
} }
} }
$response["data"][] = $val; $response["data"][] = $val;
@@ -465,28 +467,34 @@ class Consolidated
$xmlfrm = new \stdclass(); $xmlfrm = new \stdclass();
$xmlfrm->fields = array(); $xmlfrm->fields = array();
foreach ($fieldsDyna as $key => $value) { foreach ($fieldsDyna as $key => $value) {
if ($value[0]->type == 'title' || $value[0]->type == 'submit') { foreach ($value as $val) {
continue; if ($val->type == 'title' || $val->type == 'submit' || $val->type == 'panel' || $val->type == 'image' || $val->type == 'button' || $val->type == 'grid' || $val->type == 'checkgroup' || $val->type == 'radiogroup' || $val->type == 'radio' || $val->type == 'hidden' || $val->type == 'link' || $val->type == 'file' || $val->type == 'subform' || $val->type == 'label') {
} continue;
$temp = new \stdclass();
$temp->type = $value[0]->type;
$temp->label = $value[0]->label;
$temp->name = $value[0]->name;
$temp->required = (isset($value[0]->required)) ? $value[0]->required : 0;
$temp->mode = (isset($value[0]->mode)) ? $value[0]->mode : 'edit';
if (!empty($value[0]->options)) {
$temp->storeData = '[';
foreach ($value[0]->options as $valueOption) {
$temp->storeData .= '["' . $valueOption['value'] . '", "' . $valueOption['label'] . '"],';
} }
$temp->storeData = substr($temp->storeData,0,-1); $temp = new \stdclass();
$temp->storeData .= ']'; $temp->type = $val->type;
} $temp->label = $val->label;
$temp->name = $val->name;
$temp->required = (isset($val->required)) ? $val->required : 0;
$temp->mode = (isset($val->mode)) ? $val->mode : 'edit';
$temp->readOnly = ($temp->mode == 'view') ? "1" : "0"; if (!empty($val->options)) {
$temp->colWidth = 200; $temp->storeData = '[';
$xmlfrm->fields[] = $temp; foreach ($val->options as $valueOption) {
if(isset($valueOption->value)){
$temp->storeData .= '["' . $valueOption->value . '", "' . $valueOption->label . '"],';
}else{
$temp->storeData .= '["' . $valueOption['value'] . '", "' . $valueOption['label'] . '"],';
}
}
$temp->storeData = substr($temp->storeData,0,-1);
$temp->storeData .= ']';
}
$temp->readOnly = ($temp->mode == 'view') ? "1" : "0";
$temp->colWidth = 200;
$xmlfrm->fields[] = $temp;
}
} }
} else { } else {
$filename = $pro_uid . PATH_SEP . $dyn_uid . ".xml"; $filename = $pro_uid . PATH_SEP . $dyn_uid . ".xml";
@@ -528,12 +536,12 @@ class Consolidated
$required = (isset($field->required))? $field->required : null; $required = (isset($field->required))? $field->required : null;
$validate = (isset($field->validate))? strtolower($field->validate) : null; $validate = (isset($field->validate))? strtolower($field->validate) : null;
$fieldReadOnly = ($readOnly . "" == "1")? "readOnly: true," : null; $fieldReadOnly = ($readOnly . "" == "1" || $field->readOnly == 'view')? "readOnly: true," : null;
$fieldRequired = ($required . "" == "1")? "allowBlank: false," : null; $fieldRequired = ($required . "" == "1")? "allowBlank: false," : null;
$fieldValidate = ($validate == "alpha" || $validate == "alphanum" || $validate == "email" || $validate == "int" || $validate == "real")? "vtype: \"$validate\"," : null; $fieldValidate = ($validate == "alpha" || $validate == "alphanum" || $validate == "email" || $validate == "int" || $validate == "real")? "vtype: \"$validate\"," : null;
$fieldLabel = (($fieldRequired != null)? "<span style='color: red;'>&#42;</span> ": null) . $field->label; $fieldLabel = (($fieldRequired != null)? "<span style='color: red;'>&#42;</span> ": null) . $field->label;
$fieldDisabled = ($field->mode != "edit")? "true" : "false"; $fieldDisabled = ($field->mode == "view")? "true" : "false";
switch ($field->type) { switch ($field->type) {
case "dropdown": case "dropdown":
@@ -633,7 +641,7 @@ class Consolidated
return Ext.isDate(value)? value.dateFormat('{$dateFormat}') : value; return Ext.isDate(value)? value.dateFormat('{$dateFormat}') : value;
} *"; } *";
if ($field->mode != "edit") { if ($field->mode == "view") {
$editor = null; $editor = null;
} }
@@ -735,6 +743,33 @@ class Consolidated
$hasTextArea = true; $hasTextArea = true;
break; break;
case "datetime":
$align = "center";
$size = 100;
if (isset($field->size)) {
$size = $field->size * 10;
}
$width = $size;
$editor = "* new Ext.form.DateField({
format: \"$dateFormat\",
$fieldReadOnly
$fieldRequired
$fieldValidate
cls: \"\"
}) *";
//$renderer = "* formatDate *";
$renderer = "* function (value){
return Ext.isDate(value)? value.dateFormat('{$dateFormat}') : value;
} *";
$caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "editor" => $editor, "renderer" => $renderer, "frame" => true, "clicksToEdit" => 1, "sortable" => true);
$caseReaderFields[] = array("name" => $field->name, "type" => "date");
break;
case "link": case "link":
$align = 'center'; $align = 'center';
$size = 100; $size = 100;

View File

@@ -468,7 +468,13 @@ class FilesManager
if (file_exists($path) && !is_dir($path)) { if (file_exists($path) && !is_dir($path)) {
unlink($path); unlink($path);
} } else {
$path = PATH_DATA_PUBLIC.$sProcessUID.DIRECTORY_SEPARATOR.$sFile;
if (file_exists($path) && !is_dir($path)) {
unlink($path);
}
}
$rs = \ProcessFilesPeer::doDelete($criteria); $rs = \ProcessFilesPeer::doDelete($criteria);
} catch (Exception $e) { } catch (Exception $e) {

View File

@@ -1,6 +1,6 @@
var grdNumRows = 0; // var grdNumRows = 0; //
var grdRowLabel = []; // var grdRowLabel = []; //
var fieldGridGral = ''; var fieldGridGral = '';
var fieldGridGralVal = ''; var fieldGridGralVal = '';
@@ -406,22 +406,27 @@ Ext.onReady(function () {
text: "Derivate", text: "Derivate",
//iconCls: 'ICON_CASES_PAUSED', //iconCls: 'ICON_CASES_PAUSED',
handler : function (){ handler : function (){
htmlMessage = ""; Ext.Msg.confirm('Confirm Routing', 'Route cases per batch?',
var selectedRow = Ext.getCmp(gridId).getSelectionModel().getSelections(); function(btn, text){
var maxLenght = selectedRow.length; if (btn=='yes'){
for (var i in selectedRow) { htmlMessage = "";
rowGrid = selectedRow[i].data var selectedRow = Ext.getCmp(gridId).getSelectionModel().getSelections();
for (fieldGrid in rowGrid){ var maxLenght = selectedRow.length;
if(fieldGrid != 'APP_UID' && fieldGrid != 'APP_NUMBER' && fieldGrid != 'APP_TITLE' && fieldGrid != 'DEL_INDEX' ){ for (var i in selectedRow) {
fieldGridGral = fieldGrid; rowGrid = selectedRow[i].data
fieldGridGralVal = rowGrid[fieldGrid]; for (fieldGrid in rowGrid){
} if(fieldGrid != 'APP_UID' && fieldGrid != 'APP_NUMBER' && fieldGrid != 'APP_TITLE' && fieldGrid != 'DEL_INDEX' ){
} fieldGridGral = fieldGrid;
if (selectedRow[i].data) { fieldGridGralVal = rowGrid[fieldGrid];
//alert (derivateRequestAjax(selectedRow[i].data["company"])); }
ajaxDerivationRequest(selectedRow[i].data["APP_UID"], selectedRow[i].data["DEL_INDEX"], maxLenght, selectedRow[i].data["APP_NUMBER"],fieldGridGral, fieldGridGralVal); }
} if (selectedRow[i].data) {
} ajaxDerivationRequest(selectedRow[i].data["APP_UID"], selectedRow[i].data["DEL_INDEX"], maxLenght, selectedRow[i].data["APP_NUMBER"],fieldGridGral, fieldGridGralVal);
}
}
}
}
);
} }
}); });
switch(action){ switch(action){
@@ -716,276 +721,267 @@ function renderSummary (val, p, r) {
function generateGridClassic(proUid, tasUid, dynUid){ function generateGridClassic(proUid, tasUid, dynUid){
var pager = 20; //pageSize var pager = 20; //pageSize
var pagei = 0; //start var pagei = 0; //start
Ext.Ajax.request({ Ext.Ajax.request({
url: '../pmConsolidatedCL/proxyGenerateGrid', url: '../pmConsolidatedCL/proxyGenerateGrid',
success: function(response) { success: function(response) {
//Obtenemos el column model y los reader fields de proxyGenerateGrid var dataResponse = Ext.util.JSON.decode(response.responseText);
var dataResponse = Ext.util.JSON.decode(response.responseText); var viewConfigObject;
var viewConfigObject; var textArea = dataResponse.hasTextArea;
var textArea = dataResponse.hasTextArea;
if (textArea == false) {
if (textArea == false) { viewConfigObject = { //forceFit: true
viewConfigObject = { //forceFit: true };
}; } else {
} else { viewConfigObject = {
viewConfigObject = { //forceFit:true,
//forceFit:true, enableRowBody:true,
enableRowBody:true, showPreview:true,
showPreview:true, getRowClass : function(record, rowIndex, p, store){
getRowClass : function(record, rowIndex, p, store){ if (this.showPreview) {
if (this.showPreview) { p.body = '<p><br /></p>';
p.body = '<p><br /></p>'; return 'x-grid3-row-expanded';
return 'x-grid3-row-expanded'; }
} return 'x-grid3-row-collapsed';
return 'x-grid3-row-collapsed'; }
} };
}; }
}
storeConsolidated = new Ext.data.Store({
storeConsolidated = new Ext.data.Store({ id: "storeConsolidatedGrid",
id: "storeConsolidatedGrid", remoteSort: true,
remoteSort: true, proxy: new Ext.data.HttpProxy({
//definimos un proxy como un objeto de la clase HttpProxy url: "../pmConsolidatedCL/proxyConsolidated",
proxy: new Ext.data.HttpProxy({ api: {
url: "../pmConsolidatedCL/proxyConsolidated", read: "../pmConsolidatedCL/proxyConsolidated",
api: { //update: "../pmConsolidatedCL/proxySaveConsolidated"
read: "../pmConsolidatedCL/proxyConsolidated", update: "../pmConsolidatedCL/consolidatedUpdateAjax"
//update: "../pmConsolidatedCL/proxySaveConsolidated" }
update: "../pmConsolidatedCL/consolidatedUpdateAjax" }),
}
}), reader: new Ext.data.JsonReader({
fields: dataResponse.readerFields,
//el data reader obtiene los reader fields de la consulta en ajax totalProperty: "totalCount",
reader: new Ext.data.JsonReader({ //successProperty: "success",
fields: dataResponse.readerFields, idProperty: "APP_UID",
totalProperty: "totalCount", root: "data",
//successProperty: "success", messageProperty: "message"
idProperty: "APP_UID", }),
root: "data",
messageProperty: "message" writer: new Ext.data.JsonWriter({
}), encode: true,
writeAllFields: false
//el data writer es un objeto generico pero q permitira a futuro el escribir los datos al servidor mediante el proxy }), //<-- plug a DataWriter into the store just as you would a Reader
writer: new Ext.data.JsonWriter({ autoSave: true, //<-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton.
encode: true,
writeAllFields: false //sortInfo:{
}), //<-- plug a DataWriter into the store just as you would a Reader // field: 'APP_CACHE_VIEW.APP_NUMBER',
autoSave: true, //<-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton. // direction: "DESC"
//}
//el ordenamiento para los campos posiblemente este tenga q ser el tercer dato obtenido del proxy dado q los listados son muy cambiantes de tarea en tarea
//sortInfo:{ //,
// field: 'APP_CACHE_VIEW.APP_NUMBER', listeners: { //
// direction: "DESC" beforeload:function (store, options) { //
//} grdNumRows = 0; //
}, //
//,
listeners: { // load:function (store, records, options) { //
beforeload:function (store, options) { // grdNumRows = store.getCount(); //
grdNumRows = 0; //
}, // consolidatedGrid.setDisabled(false);
} //
load:function (store, records, options) { // } //
grdNumRows = store.getCount(); // });
consolidatedGrid.setDisabled(false); var xColumns = dataResponse.columnModel;
} // xColumns.unshift(smodel);
} //
});
var cm = new Ext.grid.ColumnModel(xColumns);
var xColumns = dataResponse.columnModel; cm.config[2].renderer = renderTitle; //Case Number
xColumns.unshift(smodel); cm.config[3].renderer = renderTitle; //Case Title
cm.config[4].renderer = renderSummary;//Case Summary
var cm = new Ext.grid.ColumnModel(xColumns); storeConsolidated.setBaseParam("limit", pager);
cm.config[2].renderer = renderTitle; //Case Number storeConsolidated.setBaseParam("start", pagei);
cm.config[3].renderer = renderTitle; //Case Title storeConsolidated.setBaseParam('tasUid', tasUid);
cm.config[4].renderer = renderSummary;//Case Summary storeConsolidated.setBaseParam('dynUid', dynUid);
storeConsolidated.setBaseParam('proUid', proUid);
//generacion del grid basados en los atributos definidos con anterioridad storeConsolidated.setBaseParam('dropList', Ext.util.JSON.encode(dataResponse.dropList));
storeConsolidated.setBaseParam("limit", pager); storeConsolidated.load();
storeConsolidated.setBaseParam("start", pagei);
storeConsolidated.setBaseParam('tasUid', tasUid); consolidatedGrid = new Ext.grid.EditorGridPanel({
storeConsolidated.setBaseParam('dynUid', dynUid); id: gridId,
storeConsolidated.setBaseParam('proUid', proUid); region: "center",
storeConsolidated.setBaseParam('dropList', Ext.util.JSON.encode(dataResponse.dropList));
storeConsolidated.load(); store: storeConsolidated,
cm: cm,
consolidatedGrid = new Ext.grid.EditorGridPanel({ sm: smodel,
id: gridId, //autoHeight: true,
region: "center",
//height: pnlMain.getSize().height - pnlMain.getFrameHeight(), //
store: storeConsolidated, width: pnlMain.getSize().width, //
cm: cm, height: browserHeight - 35, //
sm: smodel,
//autoHeight: true, layout: 'fit',
//plugins: filters,
//height: pnlMain.getSize().height - pnlMain.getFrameHeight(), // viewConfig: viewConfigObject,
width: pnlMain.getSize().width, //
height: browserHeight - 35, // listeners: {
beforeedit: function (e) {
layout: 'fit', var selRow = Ext.getCmp(gridId).getSelectionModel().getSelected();
//plugins: filters,
viewConfig: viewConfigObject, var swDropdown = 0;
for (var i = 0; i <= dataResponse.dropList.length - 1 && swDropdown == 0; i++) {
listeners: { if (dataResponse.dropList[i] == e.field) {
beforeedit: function (e) { swDropdown = 1;
var selRow = Ext.getCmp(gridId).getSelectionModel().getSelected(); }
}
var swDropdown = 0;
for (var i = 0; i <= dataResponse.dropList.length - 1 && swDropdown == 0; i++) { var swYesNo = 0;
if (dataResponse.dropList[i] == e.field) { for (var i = 0; i <= dataResponse.comboBoxYesNoList.length - 1 && swYesNo == 0; i++) {
swDropdown = 1; if (dataResponse.comboBoxYesNoList[i] == e.field) {
} swYesNo = 1;
} }
}
var swYesNo = 0;
for (var i = 0; i <= dataResponse.comboBoxYesNoList.length - 1 && swYesNo == 0; i++) { if (swDropdown == 1 && swYesNo == 0) {
if (dataResponse.comboBoxYesNoList[i] == e.field) { storeAux = Ext.StoreMgr.get("store" + e.field + "_" + proUid);
swYesNo = 1; storeAux.setBaseParam("appUid", selRow.data["APP_UID"]);
} storeAux.setBaseParam("dynUid", dynUid);
} storeAux.setBaseParam("proUid", proUid);
storeAux.setBaseParam("fieldName", e.field);
if (swDropdown == 1 && swYesNo == 0) { //currentFieldEdited = e.field;
storeAux = Ext.StoreMgr.get("store" + e.field + "_" + proUid); storeAux.load();
storeAux.setBaseParam("appUid", selRow.data["APP_UID"]); }
storeAux.setBaseParam("dynUid", dynUid); },
storeAux.setBaseParam("proUid", proUid);
storeAux.setBaseParam("fieldName", e.field); afteredit: function (e) {
//currentFieldEdited = e.field; //var store = consolidatedGrid.getStore();
storeAux.load();
} if (Ext.getCmp("chk_allColumn").checked) {
}, Ext.Msg.show({
title: "",
afteredit: function (e) { msg: "The modification will be applied to all rows in your selection.",
//var store = consolidatedGrid.getStore(); buttons: Ext.Msg.YESNO,
fn: function (btn) {
if (Ext.getCmp("chk_allColumn").checked) { if (btn == "yes") {
Ext.Msg.show({ //storeConsolidated.each(function (record) {
title: "", // record.set(e.field, e.value);
msg: "The modification will be applied to all rows in your selection.", //});
buttons: Ext.Msg.YESNO,
fn: function (btn) { consolidatedGrid.setDisabled(true);
if (btn == "yes") {
//storeConsolidated.each(function (record) { var dataUpdate = "";
// record.set(e.field, e.value); var strValue = "";
//}); var sw = 0;
consolidatedGrid.setDisabled(true); if (e.value instanceof Date) {
var mAux = e.value.getMonth() + 1;
var dataUpdate = ""; var dAux = e.value.getDate();
var strValue = ""; var hAux = e.value.getHours();
var sw = 0; var iAux = e.value.getMinutes();
var sAux = e.value.getSeconds();
if (e.value instanceof Date) {
var mAux = e.value.getMonth() + 1; strValue = e.value.getFullYear() + "-" + ((mAux <= 9)? "0" : "") + mAux + "-" + ((dAux <= 9)? "0" : "") + dAux;
var dAux = e.value.getDate(); strValue = strValue + " " + ((hAux <= 9)? "0" + ((hAux == 0)? "0" : hAux) : hAux) + ":" + ((iAux <= 9)? "0" + ((iAux == 0)? "0" : iAux) : iAux) + ":" + ((sAux <= 9)? "0" + ((sAux == 0)? "0" : sAux) : sAux);
var hAux = e.value.getHours(); } else {
var iAux = e.value.getMinutes(); strValue = strReplace("\"", "\\\"", e.value + "");
var sAux = e.value.getSeconds(); }
strValue = e.value.getFullYear() + "-" + ((mAux <= 9)? "0" : "") + mAux + "-" + ((dAux <= 9)? "0" : "") + dAux; storeConsolidated.each(function (record) {
strValue = strValue + " " + ((hAux <= 9)? "0" + ((hAux == 0)? "0" : hAux) : hAux) + ":" + ((iAux <= 9)? "0" + ((iAux == 0)? "0" : iAux) : iAux) + ":" + ((sAux <= 9)? "0" + ((sAux == 0)? "0" : sAux) : sAux); dataUpdate = dataUpdate + ((sw == 1)? "(sep1 /)": "") + record.data["APP_UID"] + "(sep2 /)" + e.field + "(sep2 /)" + strValue;
} else { sw = 1;
strValue = strReplace("\"", "\\\"", e.value + ""); });
}
///////
storeConsolidated.each(function (record) { Ext.Ajax.request({
dataUpdate = dataUpdate + ((sw == 1)? "(sep1 /)": "") + record.data["APP_UID"] + "(sep2 /)" + e.field + "(sep2 /)" + strValue; url: "consolidatedUpdateAjax",
sw = 1; method: "POST",
}); params: {
"option": "ALL",
/////// "dynaformUid": dynUid,
Ext.Ajax.request({ "dataUpdate": dataUpdate
url: "consolidatedUpdateAjax", },
method: "POST",
params: { success: function (response, opts) {
"option": "ALL", var dataResponse = eval("(" + response.responseText + ")"); //json
"dynaformUid": dynUid,
"dataUpdate": dataUpdate if (dataResponse.status && dataResponse.status == "OK") {
}, if (typeof(storeConsolidated.lastOptions.params) != "undefined") {
pagei = storeConsolidated.lastOptions.params.start;
success: function (response, opts) { }
var dataResponse = eval("(" + response.responseText + ")"); //json
storeConsolidated.setBaseParam("start", pagei);
if (dataResponse.status && dataResponse.status == "OK") { storeConsolidated.load();
if (typeof(storeConsolidated.lastOptions.params) != "undefined") { } else {
pagei = storeConsolidated.lastOptions.params.start; //
} }
}
storeConsolidated.setBaseParam("start", pagei); });
storeConsolidated.load(); }
} else { },
// //animEl: "elId",
} icon: Ext.MessageBox.QUESTION
} });
}); }
} },
},
//animEl: "elId", mouseover: function (e, cell) {
icon: Ext.MessageBox.QUESTION var rowIndex = consolidatedGrid.getView().findRowIndex(cell);
}); if (!(rowIndex === false)) {
} var record = consolidatedGrid.store.getAt(rowIndex);
}, var msg = record.get('APP_TITLE');
Ext.QuickTips.register({
mouseover: function (e, cell) { text: msg,
var rowIndex = consolidatedGrid.getView().findRowIndex(cell); target: e.target
if (!(rowIndex === false)) { });
var record = consolidatedGrid.store.getAt(rowIndex); } else {
var msg = record.get('APP_TITLE'); Ext.QuickTips.unregister(e.target);
Ext.QuickTips.register({ }
text: msg, },
target: e.target
}); mouseout: function (e, cell) {
} else { Ext.QuickTips.unregister(e.target);
Ext.QuickTips.unregister(e.target); }
} },
},
//tbar: tb,
mouseout: function (e, cell) {
Ext.QuickTips.unregister(e.target); tbar: new Ext.Toolbar({
} height: 33,
}, items: toolbarconsolidated
}),
//tbar: tb,
bbar: new Ext.PagingToolbar({
tbar: new Ext.Toolbar({ pageSize: pager,
height: 33, store: storeConsolidated,
items: toolbarconsolidated displayInfo: true,
}), displayMsg: _("ID_DISPLAY_ITEMS"),
emptyMsg: _("ID_DISPLAY_EMPTY")
bbar: new Ext.PagingToolbar({ })
pageSize: pager, });
store: storeConsolidated,
displayInfo: true, //Ext.ComponentMgr.get("myId").body.update("");
displayMsg: _("ID_DISPLAY_ITEMS"), //pnlMain.removeAll(false);
emptyMsg: _("ID_DISPLAY_EMPTY") pnlMain.removeAll();
}) //adicion del grid definido con anterioridad
}); pnlMain.add(consolidatedGrid);
pnlMain.doLayout();
//remocion de todos los elementos del panel principal donde se carga el grid },
//Ext.ComponentMgr.get("myId").body.update("");
//pnlMain.removeAll(false); failure: function(){
pnlMain.removeAll(); alert("Failure...");
//adicion del grid definido con anterioridad },
pnlMain.add(consolidatedGrid);
//recarga de los elementos del grid, para su visualizacion. params: {
pnlMain.doLayout(); xaction: 'read',
}, tasUid: tasUid,
dynUid: dynUid,
//en caso de fallo ejecutar la siguiente funcion. proUid: proUid
failure: function(){ }
alert("Failure..."); });
},
// parametros que son enviados en la peticion al servidor.
params: {
xaction: 'read',
tasUid: tasUid,
dynUid: dynUid,
proUid: proUid
}
});
} }
function generateGrid(proUid, tasUid, dynUid) function generateGrid(proUid, tasUid, dynUid)
@@ -1001,8 +997,6 @@ function generateGrid(proUid, tasUid, dynUid)
'Authorization': 'Bearer ' + credentials.access_token 'Authorization': 'Bearer ' + credentials.access_token
}, },
success: function(response) { success: function(response) {
//Obtenemos el column model y los reader fields de proxyGenerateGrid
//console.log(response.responseText);
var dataResponse = Ext.util.JSON.decode(response.responseText); var dataResponse = Ext.util.JSON.decode(response.responseText);
var viewConfigObject; var viewConfigObject;
var textArea = dataResponse.hasTextArea; var textArea = dataResponse.hasTextArea;
@@ -1027,7 +1021,6 @@ function generateGrid(proUid, tasUid, dynUid)
storeConsolidated = new Ext.data.Store({ storeConsolidated = new Ext.data.Store({
id: "storeConsolidatedGrid", id: "storeConsolidatedGrid",
remoteSort: true, remoteSort: true,
//definimos un proxy como un objeto de la clase HttpProxy
proxy: new Ext.data.HttpProxy({ proxy: new Ext.data.HttpProxy({
method: 'GET', method: 'GET',
url: urlProxy + 'cases/' + proUid + '/' + tasUid + '/' + dynUid, url: urlProxy + 'cases/' + proUid + '/' + tasUid + '/' + dynUid,
@@ -1046,7 +1039,6 @@ function generateGrid(proUid, tasUid, dynUid)
'Authorization': 'Bearer ' + credentials.access_token 'Authorization': 'Bearer ' + credentials.access_token
} }
}), }),
//el data reader obtiene los reader fields de la consulta en ajax
reader: new Ext.data.JsonReader({ reader: new Ext.data.JsonReader({
fields: dataResponse.readerFields, fields: dataResponse.readerFields,
totalProperty: "totalCount", totalProperty: "totalCount",
@@ -1056,20 +1048,12 @@ function generateGrid(proUid, tasUid, dynUid)
messageProperty: "message" messageProperty: "message"
}), }),
//el data writer es un objeto generico pero q permitira a futuro el escribir los datos al servidor mediante el proxy
writer: new Ext.data.JsonWriter({ writer: new Ext.data.JsonWriter({
encode: false, encode: false,
writeAllFields: false writeAllFields: false
}), //<-- plug a DataWriter into the store just as you would a Reader }), //<-- plug a DataWriter into the store just as you would a Reader
autoSave: true, //<-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton. autoSave: true, //<-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton.
//el ordenamiento para los campos posiblemente este tenga q ser el tercer dato obtenido del proxy dado q los listados son muy cambiantes de tarea en tarea
//sortInfo:{
// field: 'APP_CACHE_VIEW.APP_NUMBER',
// direction: "DESC"
//}
//,
listeners: { // listeners: { //
beforeload:function (store, options) { // beforeload:function (store, options) { //
grdNumRows = 0; // grdNumRows = 0; //
@@ -1306,14 +1290,14 @@ function generateGrid(proUid, tasUid, dynUid)
}); });
} }
function ajaxDerivationRequest(appUid, delIndex, maxLenght, appNumber,fieldGridGral, fieldGridGralVal){ function ajaxDerivationRequest(appUid, delIndex, maxLenght, appNumber, fieldGridGral, fieldGridGralVal){
Ext.Ajax.request({ Ext.Ajax.request({
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': 'Bearer ' + credentials.access_token 'Authorization': 'Bearer ' + credentials.access_token
}, },
url: urlProxy + 'derivate/' + appUid + '/' + appNumber + '/' + delIndex + '/' + fieldGridGral + '/' + fieldGridGralVal, url: urlProxy + 'derivate/' + appUid + '/' + appNumber + '/' + delIndex + '/' + fieldGridGral + '/' + fieldGridGralVal + '/',
success: function(response) { success: function(response) {
var dataResponse; var dataResponse;
var fullResponseText = response.responseText; var fullResponseText = response.responseText;
@@ -1333,10 +1317,8 @@ function ajaxDerivationRequest(appUid, delIndex, maxLenght, appNumber,fieldGridG
Ext.MessageBox.show({ Ext.MessageBox.show({
title: "Derivation Result", title: "Derivation Result",
msg: htmlMessage, msg: htmlMessage,
buttons: Ext.MessageBox.OK,
fn: function (btn, text, opt) { fn: function (btn, text, opt) {
//if (btn == "ok") {}
if (maxLenght == storeConsolidated.getCount()) { if (maxLenght == storeConsolidated.getCount()) {
window.location.reload(); window.location.reload();
} }