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 ) ) {
$this->boundInVars[$paramIndex] = "'" . $this->escape($value->__toString()) . "'";
} 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();
$json = G::json_decode($dataDyna["DYN_CONTENT"]);
$fieldsDyna = $json->items[0]->items;
foreach ($fieldsDyna as $value) {
$_POST['form']['FIELDS'][] = $value[0]->name . '-' . $value[0]->type;
foreach ($fieldsDyna as $value) {
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();
$i = 1;
$aFieldsClases[$i]['FLD_NAME'] = 'APP_UID';
@@ -176,16 +182,21 @@ class ConsolidatedCases
$oCaseConsolidated->setTasUid($sTasUid);
}
$criteria = new Criteria();
$criteria->addSelectColumn(CaseConsolidatedCorePeer::TAS_UID);
$criteria->add(CaseConsolidatedCorePeer::TAS_UID, $sTasUid);
$rsCriteria = CaseConsolidatedCorePeer::doSelectRS($criteria);
if ($rsCriteria->next()) {
$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);
$oCaseConsolidated = CaseConsolidatedCorePeer::retrieveByPK($sTasUid);
}
if (!(is_object($oCaseConsolidated)) || get_class($oCaseConsolidated) != 'CaseConsolidatedCore') {
$oCaseConsolidated = new CaseConsolidatedCore();
$oCaseConsolidated->setTasUid($sTasUid);
}
$oCaseConsolidated->setConStatus('ACTIVE');
$oCaseConsolidated->setDynUid($sDynUid);
$oCaseConsolidated->setRepTabUid($sRepTabUid);

View File

@@ -1656,7 +1656,7 @@ class pmTablesProxy extends HttpProxyController
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$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');
@@ -1709,32 +1709,27 @@ class pmTablesProxy extends HttpProxyController
$oDataset->next();
$row = $oDataset->getRow();
if (isset($row["PRJ_UID"])) {
$sProcessUID = $row["PRJ_UID"];
$dynaformNotAllowedVariables = $this->getDynaformVariables($sProcessUID,$excludeFieldsList,false);
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_UID);
$oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_NAME);
$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"]);
$oDataset = ProcessVariablesPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$index = 0;
while ($oDataset->next()) {
$row = $oDataset->getRow();
$fieldType = isset($row["VAR_FIELD_TYPE"]) ? $row["VAR_FIELD_TYPE"]: '';
$varSql = isset($row["VAR_SQL"]) ? $row["VAR_SQL"] : '';
$varProcessVariable = isset($row["VAR_ACCEPTED_VALUES"]) ? $row["VAR_ACCEPTED_VALUES"] : '[]';
if(! in_array( $fieldType, $excludeFieldsList )){
if(strlen($varSql) == 0 && $varProcessVariable == '[]'){
array_push($fields, array(
"FIELD_UID" => $row["VAR_NAME"] . "-" . $row["VAR_FIELD_TYPE"],
"FIELD_NAME" => $row["VAR_NAME"],
"FIELD_VALIDATE" => "any",
"_index" => $index ++,
"_isset" => true
));
}
}
if(!in_array($row["VAR_NAME"], $dynaformNotAllowedVariables) && !in_array($row["VAR_FIELD_TYPE"], $excludeFieldsList)) {
array_push($fields, array(
"FIELD_UID" => $row["VAR_NAME"] . "-" . $row["VAR_FIELD_TYPE"],
"FIELD_NAME" => $row["VAR_NAME"],
"FIELD_VALIDATE" => "any",
"_index" => $index ++,
"_isset" => true
));
}
}
}
@@ -1873,5 +1868,50 @@ class pmTablesProxy extends HttpProxyController
}
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);
}
$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') {
$oCaseConsolidated->setConStatus('ACTIVE');
} else {

View File

@@ -83,18 +83,18 @@ class Consolidated
if (!isset($Fields["DEL_INIT_DATE"])) {
$oCase->setDelInitDate($app_uid, $del_index);
$aFields = $oCase->loadCase($app_uid, $del_index);
//Update data grid
$aData = $aFields['APP_DATA'];
foreach ($aData as $k => $dataField) {
if(is_array($dataField)){
$pos = count($dataField);
if(isset($aData[$k][$pos][$fieldName])){
$aData[$k][$pos][$fieldName] = $fieldValue;
}
}
}
$aFields['APP_DATA'] = $aData;
$oCase->updateCase($app_uid, $aFields);
//Update data grid
$aData = $aFields['APP_DATA'];
foreach ($aData as $k => $dataField) {
if(is_array($dataField)){
$pos = count($dataField);
if(isset($aData[$k][$pos][$fieldName])){
$aData[$k][$pos][$fieldName] = $fieldValue;
}
}
}
$aFields['APP_DATA'] = $aData;
$oCase->updateCase($app_uid, $aFields);
//End update
}
@@ -394,7 +394,9 @@ class Consolidated
foreach ($aTaskConsolidated as $key => $val) {
foreach ($val as $iKey => $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;
@@ -465,28 +467,34 @@ class Consolidated
$xmlfrm = new \stdclass();
$xmlfrm->fields = array();
foreach ($fieldsDyna as $key => $value) {
if ($value[0]->type == 'title' || $value[0]->type == 'submit') {
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'] . '"],';
foreach ($value as $val) {
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->storeData = substr($temp->storeData,0,-1);
$temp->storeData .= ']';
}
$temp = new \stdclass();
$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";
$temp->colWidth = 200;
$xmlfrm->fields[] = $temp;
if (!empty($val->options)) {
$temp->storeData = '[';
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 {
$filename = $pro_uid . PATH_SEP . $dyn_uid . ".xml";
@@ -528,12 +536,12 @@ class Consolidated
$required = (isset($field->required))? $field->required : 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;
$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;
$fieldDisabled = ($field->mode != "edit")? "true" : "false";
$fieldDisabled = ($field->mode == "view")? "true" : "false";
switch ($field->type) {
case "dropdown":
@@ -633,7 +641,7 @@ class Consolidated
return Ext.isDate(value)? value.dateFormat('{$dateFormat}') : value;
} *";
if ($field->mode != "edit") {
if ($field->mode == "view") {
$editor = null;
}
@@ -735,6 +743,33 @@ class Consolidated
$hasTextArea = true;
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":
$align = 'center';
$size = 100;

View File

@@ -468,7 +468,13 @@ class FilesManager
if (file_exists($path) && !is_dir($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);
} catch (Exception $e) {

View File

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