Merged in marcoAntonioNina/processmaker/dashboards2 (pull request #2008)
Add validation check group user
This commit is contained in:
@@ -108,10 +108,40 @@ class DashboardDasInd extends BaseDashboardDasInd
|
||||
}
|
||||
}
|
||||
|
||||
public function getOwnerByDashboard ($dasUid)
|
||||
public function loadOwnerByUserId ($usrId)
|
||||
{
|
||||
|
||||
}
|
||||
try {
|
||||
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(DashboardDasIndPeer::OWNER_UID, $usrId);
|
||||
$criteria->add(DashboardDasIndPeer::OWNER_TYPE, "USER");
|
||||
|
||||
$dataset = DashboardDasIndPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$fields = array();
|
||||
|
||||
while ($dataset->next()) {
|
||||
$auxField = $dataset->getRow();
|
||||
$fields[] = $auxField;
|
||||
}
|
||||
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(DashboardDasIndPeer::OWNER_TYPE, "GROUP");
|
||||
$criteria->add(GroupUserPeer::USR_UID, $usrId);
|
||||
$criteria->addJoin(GroupUserPeer::GRP_UID, DashboardDasIndPeer::OWNER_UID);
|
||||
|
||||
$dataset = DashboardDasIndPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$auxField = $dataset->getRow();
|
||||
$fields[] = $auxField;
|
||||
}
|
||||
|
||||
return $fields;
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class Dashboard {
|
||||
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "DashboardDasInd.php");
|
||||
$oDashboardDasInd = new \DashboardDasInd();
|
||||
|
||||
$response = $oDashboardDasInd->loadByOwner($usr_uid);
|
||||
$response = $oDashboardDasInd->loadOwnerByUserId($usr_uid);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -40,27 +40,32 @@ class Dashboard {
|
||||
{
|
||||
$resp = array();
|
||||
$dashboards = $this->getDashboardsUidByUser($usr_uid);
|
||||
$existFavorite = false;
|
||||
foreach($dashboards as $i=>$x) {
|
||||
$resp[$i] = $this->getDashboard($x['DAS_UID']);
|
||||
$Dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||
$dashConfig = $Dashboard->getConfig($usr_uid);
|
||||
$resp[$i]['DAS_FAVORITE'] = 0;
|
||||
foreach ($dashConfig as $dashId=>$dashData) {
|
||||
if($dashId == $x['DAS_UID'] ) {
|
||||
$resp[$i]['DAS_FAVORITE'] = $dashData['dashFavorite'];
|
||||
if ($dashData['dashFavorite']==1) {
|
||||
$existFavorite = true;
|
||||
}
|
||||
$existFavorite = false;
|
||||
foreach($dashboards as $i=>$x) {
|
||||
//$resp[$i] = $this->getDashboard($x['DAS_UID']);
|
||||
$dashboardUser = $this->getDashboard($x['DAS_UID']);
|
||||
if ($dashboardUser['DAS_STATUS'] == 0) {
|
||||
continue;
|
||||
}
|
||||
$resp[$i] = $dashboardUser;
|
||||
$Dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||
$dashConfig = $Dashboard->getConfig($usr_uid);
|
||||
$resp[$i]['DAS_FAVORITE'] = 0;
|
||||
foreach ($dashConfig as $dashId=>$dashData) {
|
||||
if($dashId == $x['DAS_UID'] ) {
|
||||
$resp[$i]['DAS_FAVORITE'] = $dashData['dashFavorite'];
|
||||
if ($dashData['dashFavorite']==1) {
|
||||
$existFavorite = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if no favorite is set, the default vavorite is the first one
|
||||
if ($existFavorite == false && $dashboards != null && sizeof($dashboards)>0) {
|
||||
$resp[0]['DAS_FAVORITE'] = 1;
|
||||
}
|
||||
}
|
||||
return $resp;
|
||||
|
||||
//if no favorite is set, the default favorite is the first one
|
||||
if ($existFavorite == false && $resp != null && sizeof($resp)>0) {
|
||||
$resp[0]['DAS_FAVORITE'] = 1;
|
||||
}
|
||||
return $resp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,6 +76,8 @@ Ext.onReady(function() {
|
||||
|
||||
statusButton = new Ext.Action({
|
||||
text: _('ID_STATUS'),
|
||||
icon : '',
|
||||
id : 'activator',
|
||||
iconCls: 'silk-add',
|
||||
handler: statusDashboard,
|
||||
disabled: true
|
||||
@@ -105,19 +107,19 @@ Ext.onReady(function() {
|
||||
}
|
||||
}
|
||||
|
||||
var activator = Ext.getCmp('activator');
|
||||
|
||||
if( record.data.DAS_STATUS == 1 ){
|
||||
statusButton.setIconClass('icon-activate');
|
||||
statusButton.setText( _('ID_DEACTIVATE') );
|
||||
activator.setIcon('/images/deactivate.png');
|
||||
activator.setText( _('ID_DEACTIVATE') );
|
||||
editButton.enable();
|
||||
deleteButton.enable();
|
||||
//statusButton.enable();
|
||||
} else {
|
||||
statusButton.setIconClass('icon-deactivate');
|
||||
statusButton.setText( _('ID_ACTIVATE') );
|
||||
activator.setIcon('/images/activate.png');
|
||||
activator.setText( _('ID_ACTIVATE') );
|
||||
editButton.disable();
|
||||
deleteButton.disable();
|
||||
//statusButton.disable();
|
||||
}
|
||||
}
|
||||
},
|
||||
rowdeselect: function(sm, index, record){
|
||||
editButton.disable();
|
||||
@@ -237,7 +239,7 @@ Ext.onReady(function() {
|
||||
viewConfig: {
|
||||
forceFit:true
|
||||
},
|
||||
title : _('ID_DASHBOARD'),
|
||||
title : _('ID_STRATEGIC_DASHBOARD'),
|
||||
store: store,
|
||||
cm: cmodel,
|
||||
sm: smodel,
|
||||
|
||||
@@ -41,7 +41,6 @@ var frmDashboard;
|
||||
var addTabButton;
|
||||
var tabPanel;
|
||||
var dashboardIndicatorFields;
|
||||
var dashboardIndicatorPanel;
|
||||
var store;
|
||||
|
||||
var indexTab = 0;
|
||||
@@ -49,7 +48,7 @@ var comboPageSize = 10;
|
||||
var resultTpl;
|
||||
var storeIndicatorType;
|
||||
var storeGraphic;
|
||||
var storeFrecuency;
|
||||
var storeFrequency;
|
||||
var storeProject;
|
||||
var storeGroup;
|
||||
var storeUsers;
|
||||
@@ -79,7 +78,7 @@ Ext.onReady( function() {
|
||||
items : [
|
||||
{
|
||||
id : 'DAS_TITLE',
|
||||
fieldLabel : _('ID_DASHBOARD_TITLE')+ ' *',
|
||||
fieldLabel : '<span style=\"color:red;\" ext:qtip="'+ _('ID_FIELD_REQUIRED', _('ID_DASHBOARD_TITLE')) +'"> * </span>' + _('ID_DASHBOARD_TITLE'),
|
||||
xtype : 'textfield',
|
||||
anchor : '85%',
|
||||
maxLength : 250,
|
||||
@@ -297,7 +296,7 @@ Ext.onReady( function() {
|
||||
}
|
||||
});
|
||||
|
||||
storeFrecuency = new Ext.data.GroupingStore( {
|
||||
storeFrequency = new Ext.data.GroupingStore( {
|
||||
proxy : new Ext.data.HttpProxy({
|
||||
api: {
|
||||
read : urlProxy + 'catalog/periodicity'
|
||||
@@ -754,7 +753,7 @@ var addTab = function (flag) {
|
||||
hidden : true
|
||||
},
|
||||
{
|
||||
fieldLabel : _('ID_INDICATOR_TITLE')+ ' *',
|
||||
fieldLabel : '<span style=\"color:red;\" ext:qtip="'+ _('ID_FIELD_REQUIRED', _('ID_INDICATOR_TITLE')) +'"> * </span>' + _('ID_INDICATOR_TITLE'),
|
||||
id : 'IND_TITLE_'+ indexTab,
|
||||
xtype : 'textfield',
|
||||
anchor : '85%',
|
||||
@@ -768,7 +767,7 @@ var addTab = function (flag) {
|
||||
anchor : '85%',
|
||||
editable : false,
|
||||
id : 'IND_TYPE_'+ indexTab,
|
||||
fieldLabel : _('ID_INDICATOR_TYPE')+ ' *',
|
||||
fieldLabel : '<span style=\"color:red;\" ext:qtip="'+ _('ID_FIELD_REQUIRED', _('ID_INDICATOR_TYPE')) +'"> * </span>' + _('ID_INDICATOR_TYPE'),
|
||||
displayField : 'CAT_LABEL_ID',
|
||||
valueField : 'CAT_UID',
|
||||
forceSelection : false,
|
||||
@@ -880,7 +879,7 @@ var addTab = function (flag) {
|
||||
new Ext.form.ComboBox({
|
||||
anchor : '85%',
|
||||
editable : false,
|
||||
fieldLabel : _('ID_PROCESS')+ ' *',
|
||||
fieldLabel : '<span style=\"color:red;\" ext:qtip="'+ _('ID_FIELD_REQUIRED', _('ID_PROCESS')) +'"> * </span>' + _('ID_PROCESS'),
|
||||
id : 'IND_PROCESS_'+ indexTab,
|
||||
displayField : 'prj_name',
|
||||
valueField : 'prj_uid',
|
||||
@@ -923,7 +922,7 @@ var addTab = function (flag) {
|
||||
typeAhead : true,
|
||||
autocomplete : true,
|
||||
triggerAction : 'all',
|
||||
store : storeFrecuency
|
||||
store : storeFrequency
|
||||
}),
|
||||
new Ext.form.ComboBox({
|
||||
anchor : '85%',
|
||||
@@ -955,7 +954,7 @@ var addTab = function (flag) {
|
||||
typeAhead : true,
|
||||
autocomplete : true,
|
||||
triggerAction : 'all',
|
||||
store : storeFrecuency
|
||||
store : storeFrequency
|
||||
})
|
||||
]
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user