Third progress with the dashboards (first version)
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
G::LoadClass('pmDashlet');
|
||||
|
||||
class DashletGaugeIndicator extends PMDashlet {
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
60
workflow/engine/classes/class.dashletOpenVSCompleted.php
Normal file
60
workflow/engine/classes/class.dashletOpenVSCompleted.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
require_once 'interfaces/dashletInterface.php';
|
||||
|
||||
class DashletOpenVSCompleted implements DashletInterface {
|
||||
|
||||
/**
|
||||
width
|
||||
*/
|
||||
var $w = 610;
|
||||
|
||||
/**
|
||||
height
|
||||
*/
|
||||
var $h = 300;
|
||||
|
||||
/**
|
||||
value of gauge
|
||||
*/
|
||||
var $value = 50;
|
||||
|
||||
/**
|
||||
maxValue
|
||||
*/
|
||||
var $maxValue = 100;
|
||||
|
||||
/**
|
||||
redFrom
|
||||
*/
|
||||
var $redFrom = 80;
|
||||
|
||||
/**
|
||||
redTo
|
||||
*/
|
||||
var $redTo = 100;
|
||||
|
||||
/**
|
||||
yellowFrom
|
||||
*/
|
||||
var $yellowFrom = 60;
|
||||
|
||||
/**
|
||||
yellowTo
|
||||
*/
|
||||
var $yellowTo = 80;
|
||||
|
||||
function setup($config) {
|
||||
//$this->w = $config['w'];
|
||||
//loadData
|
||||
}
|
||||
|
||||
function render () {
|
||||
/*G::LoadClass('gauge');
|
||||
$g = new Gauge();
|
||||
$g->w = $w;
|
||||
//others
|
||||
$g->render();*/
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,10 +6,79 @@ require_once 'model/DashletInstance.php';
|
||||
|
||||
class PMDashlet extends DashletInstance implements DashletInterface {
|
||||
|
||||
public function setup() {
|
||||
// Own properties
|
||||
|
||||
// Interface functions
|
||||
|
||||
public function setup($dasInsUid) {
|
||||
try {
|
||||
//
|
||||
}
|
||||
catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
//recupera el registro
|
||||
/*$array = loadDB()
|
||||
//merge
|
||||
$c = new $className();
|
||||
$c->setup($array);*/
|
||||
}
|
||||
|
||||
public function render() {
|
||||
try {
|
||||
//
|
||||
}
|
||||
catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
//$this->c->render();
|
||||
}
|
||||
|
||||
// Own functions
|
||||
|
||||
public function getDashletsInstances() {
|
||||
try {
|
||||
//
|
||||
}
|
||||
catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
|
||||
public function getDashletsInstancesQuantity() {
|
||||
try {
|
||||
//
|
||||
}
|
||||
catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
|
||||
public function saveDashletInstance($data) {
|
||||
try {
|
||||
//
|
||||
}
|
||||
catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteDashletInstance($dasInsUid) {
|
||||
try {
|
||||
//
|
||||
}
|
||||
catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
|
||||
public function getDashletsInstancesForUser($userUid) {
|
||||
try {
|
||||
//
|
||||
}
|
||||
catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,27 +7,55 @@
|
||||
|
||||
class Dashboard extends Controller {
|
||||
|
||||
// Class properties
|
||||
private pmDashlet;
|
||||
|
||||
// Class constructor
|
||||
public function __construct() {
|
||||
G::LoadClass('pmDashlet');
|
||||
$this->pmDashlet = new PMDashlet();
|
||||
}
|
||||
|
||||
// Functions for the dashboards users module - Start
|
||||
|
||||
public function index($httpData) {
|
||||
try {
|
||||
$this->setJSVar('dashletsInstances', $this->getDashletsInstancesForCurrentUser());
|
||||
$this->includeExtJS('dashboard/index');
|
||||
$this->includeExtJSLib('ux/portal');
|
||||
G::RenderPage('publish', 'extJs');
|
||||
}
|
||||
catch (Exception $error) {
|
||||
//ToDo: Display a error message
|
||||
}
|
||||
}
|
||||
|
||||
public function renderDashletInstance($dasInsUid) {
|
||||
require_once ( PATH_METHODS . 'dashboard/class.gauge.php' );
|
||||
$gauge = new pmGauge();
|
||||
/*
|
||||
$gauge->value = x;
|
||||
$gauge->maxValue = x;
|
||||
*/
|
||||
//falta el width de la imagen
|
||||
$w = isset($_REQUEST['w']) ? intval($_REQUEST['w']) : 610;
|
||||
if ( intval($_REQUEST['w']) < 50 ) $w = 50;
|
||||
$gauge->w = $w;
|
||||
public function renderDashletInstance($data) {
|
||||
try {
|
||||
if (!isset($data['DAS_INS_UID'])) {
|
||||
$data['DAS_INS_UID'] = '';
|
||||
}
|
||||
if ($data['DAS_INS_UID'] == '') {
|
||||
throw new Exception('Parameter "DAS_INS_UID" is empty.');
|
||||
}
|
||||
$this->pmDashlet->setup($data['DAS_INS_UID']);
|
||||
$this->pmDashlet->render();
|
||||
}
|
||||
catch (Exception $error) {
|
||||
//ToDo: Render a image with the error message
|
||||
}
|
||||
}
|
||||
|
||||
$gauge->render();
|
||||
private function getDashletsInstancesForCurrentUser() {
|
||||
try {
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
throw new Exception('The session has expired.');
|
||||
}
|
||||
return $this->pmDashlet->getDashletsInstancesForUser($_SESSION['USER_LOGGED']);
|
||||
}
|
||||
catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
|
||||
// Functions for the dashboards users module - End
|
||||
@@ -35,36 +63,88 @@ class Dashboard extends Controller {
|
||||
// Functions for the dasboards administration module - Start
|
||||
|
||||
public function dashletsList() {
|
||||
$headPublisher =& headPublisher::getSingleton();
|
||||
$headPublisher->addExtJsScript('dashboard/dashletsList', false);
|
||||
$headPublisher->addContent('dashboard/dashletsList');
|
||||
try {
|
||||
$this->includeExtJS('dashboard/dashletsList');
|
||||
$this->setView('dashboard/dashletsList');
|
||||
G::RenderPage('publish', 'extJs');
|
||||
}
|
||||
catch (Exception $error) {
|
||||
//ToDo: Display a error message
|
||||
}
|
||||
}
|
||||
|
||||
public function getDashletsInstances() {
|
||||
//
|
||||
$this->setResponseType('json');
|
||||
$result = new stdclass();
|
||||
$result->status = 'OK';
|
||||
try {
|
||||
$result->dashletsInstances = $this->pmDashlet->getDashletsInstances($start, $limit);
|
||||
$result->totalDashletsInstances = $this->pmDashlet->getDashletsInstancesQuantity();
|
||||
}
|
||||
catch (Exception $error) {
|
||||
$result->status = 'ERROR';
|
||||
$result->message = $error->getMessage();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function dashletInstanceForm($dasInsUid) {
|
||||
$headPublisher =& headPublisher::getSingleton();
|
||||
$headPublisher->addExtJsScript('dashboard/dashletInstanceForm', false);
|
||||
$headPublisher->addContent('dashboard/dashletInstanceForm');
|
||||
public function dashletInstanceForm($dasInsUid = '') {
|
||||
try {
|
||||
$this->includeExtJS('dashboard/dashletInstanceForm', false);
|
||||
$this->setView('dashboard/dashletInstanceForm');
|
||||
if ($dasInsUid != '') {
|
||||
// load data before render the form
|
||||
$this->setJSVar('dashletInstance', $this->pmDashlet->getDashletInstance($dasInsUid));
|
||||
}
|
||||
else {
|
||||
$this->setJSVar('dashletInstance', new stdclass());
|
||||
}
|
||||
G::RenderPage('publish', 'extJs');
|
||||
}
|
||||
catch (Exception $error) {
|
||||
//ToDo: Display a error message
|
||||
}
|
||||
}
|
||||
|
||||
public function saveDashletInstance($data) {
|
||||
//
|
||||
$this->setResponseType('json');
|
||||
$result = new stdclass();
|
||||
$result->status = 'OK';
|
||||
try {
|
||||
$this->pmDashlet->saveDashletInstance($data);
|
||||
}
|
||||
catch (Exception $error) {
|
||||
$result->status = 'ERROR';
|
||||
$result->message = $error->getMessage();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function deleteDashletInstance($dasInsUid) {
|
||||
//
|
||||
$this->setResponseType('json');
|
||||
$result = new stdclass();
|
||||
$result->status = 'OK';
|
||||
try {
|
||||
$this->pmDashlet->deleteDashletInstance($dasInsUid);
|
||||
}
|
||||
catch (Exception $error) {
|
||||
$result->status = 'ERROR';
|
||||
$result->message = $error->getMessage();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getOwnersByType($type) {
|
||||
//
|
||||
$this->setResponseType('json');
|
||||
$result = new stdclass();
|
||||
$result->status = 'OK';
|
||||
try {
|
||||
//ToDo: For the next release
|
||||
}
|
||||
catch (Exception $error) {
|
||||
$result->status = 'ERROR';
|
||||
$result->message = $error->getMessage();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Functions for the dasboards administration module - End
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
new Ext.KeyMap(document, [{
|
||||
key: Ext.EventObject.F5,
|
||||
fn: function(keycode, e) {
|
||||
fn: function(k, e) {
|
||||
if (!e.ctrlKey) {
|
||||
if (Ext.isIE) {
|
||||
e.browserEvent.keyCode = 8;
|
||||
}
|
||||
e.stopEvent();
|
||||
document.location = document.location;
|
||||
}else{
|
||||
}
|
||||
else {
|
||||
Ext.Msg.alert('Refresh', 'You clicked: CTRL-F5');
|
||||
}
|
||||
}
|
||||
@@ -42,15 +43,11 @@ var smodel;
|
||||
var newButton;
|
||||
var editButton;
|
||||
var deleteButton;
|
||||
var permissionsButton;
|
||||
var searchButton;
|
||||
var serachText;
|
||||
var newForm;
|
||||
var comboStatusStore;
|
||||
var editForm;
|
||||
var contextMenu;
|
||||
var w;
|
||||
//var searchButton;
|
||||
//var searchText;
|
||||
//var clearTextButton;
|
||||
var actionButtons;
|
||||
var contextMenu;
|
||||
|
||||
Ext.onReady(function(){
|
||||
Ext.QuickTips.init();
|
||||
@@ -77,21 +74,17 @@ Ext.onReady(function(){
|
||||
disabled: true
|
||||
});
|
||||
|
||||
searchButton = new Ext.Action({
|
||||
/*searchButton = new Ext.Action({
|
||||
text: _('ID_SEARCH'),
|
||||
handler: doSearch
|
||||
});
|
||||
|
||||
contextMenu = new Ext.menu.Menu({
|
||||
items: [editButton, deleteButton]
|
||||
});
|
||||
|
||||
searchText = new Ext.form.TextField ({
|
||||
id: 'searchText',
|
||||
ctCls:'pm_search_text_field',
|
||||
allowBlank: true,
|
||||
width: 150,
|
||||
emptyText: _('ID_ENTER_SEARCH_TERM'),//'enter search term',
|
||||
emptyText: _('ID_ENTER_SEARCH_TERM'),
|
||||
listeners: {
|
||||
specialkey: function(f, e){
|
||||
if (e.getKey() == e.ENTER) {
|
||||
@@ -109,9 +102,13 @@ Ext.onReady(function(){
|
||||
text: 'X',
|
||||
ctCls:'pm_search_x_button',
|
||||
handler: gridByDefault
|
||||
});*/
|
||||
|
||||
contextMenu = new Ext.menu.Menu({
|
||||
items: [editButton, deleteButton]
|
||||
});
|
||||
|
||||
actionButtons = [newButton, '-', editButton, deleteButton, {xtype: 'tbfill'}, searchText, clearTextButton, searchButton];
|
||||
actionButtons = [newButton, '-', editButton, deleteButton/*, {xtype: 'tbfill'}, searchText, clearTextButton, searchButton*/];
|
||||
|
||||
smodel = new Ext.grid.RowSelectionModel({
|
||||
singleSelect: true,
|
||||
@@ -150,8 +147,8 @@ Ext.onReady(function(){
|
||||
url: 'getDashletsInstances'
|
||||
}),
|
||||
reader : new Ext.data.JsonReader( {
|
||||
root: 'sources',
|
||||
totalProperty: 'total_sources',
|
||||
root: 'dashletsInstances',
|
||||
totalProperty: 'totalDashletsInstances',
|
||||
fields : [
|
||||
{name : 'AUTH_SOURCE_UID'},
|
||||
{name : 'AUTH_SOURCE_NAME'},
|
||||
@@ -293,14 +290,14 @@ onMessageContextMenu = function (grid, rowIndex, e) {
|
||||
|
||||
//Load Grid By Default
|
||||
gridByDefault = function(){
|
||||
searchText.reset();
|
||||
//searchText.reset();
|
||||
infoGrid.store.load();
|
||||
};
|
||||
|
||||
//Do Search Function
|
||||
doSearch = function(){
|
||||
/*doSearch = function(){
|
||||
infoGrid.store.load({params: {textFilter: searchText.getValue()}});
|
||||
};
|
||||
};*/
|
||||
|
||||
//New Dashlet Instance Action
|
||||
newDashletInstance = function() {
|
||||
@@ -341,7 +338,7 @@ deleteDashletInstance = function(){
|
||||
}else{
|
||||
PMExt.error(_('ID_DASHLET_INSTANCE'),resp.error);
|
||||
}
|
||||
doSearch();
|
||||
//doSearch();
|
||||
editButton.disable();
|
||||
deleteButton.disable();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user