Merge branch 'master' of bitbucket.org:colosa/processmaker into PM-2039

This commit is contained in:
Victor Saisa Lopez
2015-04-20 11:50:39 -04:00
48 changed files with 2888 additions and 2157 deletions

View File

@@ -109,6 +109,7 @@ BarChart.prototype.drawBars = function(data, canvas, param) {
var currObj = this;
if (data == null || data.length == 0) {
console.log(graphDim);
canvas.append("text")
.attr('class','pm-charts-no-draw')
.attr("y", graphDim.height/2)
@@ -1385,6 +1386,7 @@ PieChart.prototype.drawPie2D = function (dataset, canvas, param) {
.enter()
.append("text")
.attr("x", width + 30)
.attr("class", "legend")
.text(function (d, i) {
return (d.datalabel + "-" + getPercent(d.value))
})

View File

@@ -294,10 +294,10 @@ class Publisher
//This dynaform has show/hide field conditions
if (isset($_SESSION['CURRENT_DYN_UID']) && $_SESSION['CURRENT_DYN_UID'] != '') {
$ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CURRENT_DYN_UID"]); //lsl
$ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CURRENT_DYN_UID"]);
} else {
if (isset($_SESSION['CONDITION_DYN_UID']) && $_SESSION['CONDITION_DYN_UID'] != '') {
$ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CONDITION_DYN_UID"]); //lsl
$ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CONDITION_DYN_UID"]);
}
}
}
@@ -649,4 +649,3 @@ class Publisher
$G_TABLE = null;
}
}

View File

@@ -414,7 +414,7 @@ class calendar extends CalendarDefinition
$hoursDuration -= (float)($secondRes/3600);
//$dataLog[] = (float)($secondRes/3600);
} else {
$newDate = date('Y-m-d H:i:s', strtotime('+' . (((float)$hoursDuration)*3600) . ' seconds', strtotime($newDate)));
$newDate = date("Y-m-d H:i:s", strtotime("+" . round(((float)($hoursDuration)) * 3600) . " seconds", strtotime($newDate)));
//$dataLog[] = (float)($hoursDuration);
$hoursDuration = 0;
}

View File

@@ -337,6 +337,36 @@ class indicatorsCalculator
return $retval;
}
public function ueiCostHistoric($employeeId, $initDate, $endDate, $periodicity)
{
if (!is_a($initDate, 'DateTime')) throw new InvalidArgumentException ('initDate parameter must be a DateTime object.', 0);
if (!is_a($endDate, 'DateTime')) throw new InvalidArgumentException ('endDate parameter must be a DateTime object.', 0);
$periodicitySelectFields = $this->periodicityFieldsForSelect($periodicity);
$periodicityGroup = $this->periodicityFieldsForGrouping($periodicity);
$initYear = $initDate->format("Y");
$initMonth = $initDate->format("m");
$initDay = $endDay = 1;
$endYear = $endDate->format("Y");
$endMonth = $endDate->format("m");
//$params[":initYear"] = $initYear;
//$params[":initMonth"] = $initMonth;
$params[":endYear"] = $endYear;
$params[":endMonth"] = $endMonth;
$sqlString = "SELECT $periodicitySelectFields " . $this->ueiCostFormula . " as EEC
FROM USR_REPORTING
WHERE
IF(`YEAR` = :endYear, `MONTH`, `YEAR`) <= IF (`YEAR` = :endYear, :endMonth, :endYear)"
. $periodicityGroup;
$retval = $this->pdoExecutor($sqlString, $params);
//$retval = $this->propelExecutor($sqlString);
return $retval;
}
public function generalIndicatorData($indicatorId, $initDate, $endDate, $periodicity) {
if (!is_a($initDate, 'DateTime')) throw new InvalidArgumentException ('initDate parameter must be a DateTime object.', 0);
if (!is_a($endDate, 'DateTime')) throw new InvalidArgumentException ('endDate parameter must be a DateTime object.', 0);
@@ -443,14 +473,16 @@ class indicatorsCalculator
$sqlString = " select
i.TAS_UID as uid,
t.CON_VALUE as name,
i.efficienceIndex,
i.efficiencyIndex,
i.inefficiencyCost,
i.averageTime,
i.deviationTime,
i.configuredTime
FROM
( select
TAS_UID,
$this->peiFormula as efficienceIndex,
$this->peiFormula as efficiencyIndex,
$this->peiCostFormula as inefficiencyCost,
AVG(AVG_TIME) as averageTime,
AVG(SDV_TIME) as deviationTime,
CONFIGURED_TASK_TIME as configuredTime
@@ -468,6 +500,95 @@ class indicatorsCalculator
return $retval;
}
public function statusIndicatorGeneral ($usrUid)
{
$params[':usrUid'] = $usrUid;
$sqlString = "SELECT
COALESCE( SUM( DATEDIFF( DEL_DUE_DATE , NOW( ) ) < 0 ) , 0 ) AS OVERDUE,
COALESCE( SUM( DATEDIFF( DEL_DUE_DATE , NOW( ) ) > 0 ) , 0 ) AS ONTIME,
COALESCE( SUM( DATEDIFF( DEL_RISK_DATE , NOW( ) ) < 0 ) , 0 ) AS ATRISK
FROM LIST_INBOX
WHERE USR_UID = :usrUid
AND APP_STATUS = 'TO_DO'
AND DEL_DUE_DATE IS NOT NULL ";
return $this->pdoExecutor($sqlString, $params);
}
public function statusIndicatorDetail ($usrUid)
{
$params[':usrUid'] = $usrUid;
$sqlString = "SELECT
TAS_UID as tasUid,
PRO_UID as proUid,
APP_TAS_TITLE AS taskTitle,
APP_PRO_TITLE AS proTitle,
COALESCE( SUM( DATEDIFF( DEL_DUE_DATE , NOW( ) ) < 0 ) , 0 ) AS overdue,
COALESCE( SUM( DATEDIFF( DEL_DUE_DATE , NOW( ) ) > 0 ) , 0 ) AS onTime,
COALESCE( SUM( DATEDIFF( DEL_RISK_DATE , NOW( ) ) < 0 ) , 0 ) AS atRisk
FROM LIST_INBOX
WHERE USR_UID = :usrUid
AND APP_STATUS = 'TO_DO'
AND DEL_DUE_DATE IS NOT NULL
GROUP BY TAS_UID";
return $this->pdoExecutor($sqlString, $params);
}
public function statusIndicator($usrUid)
{
$response = array();
$result = $this->statusIndicatorGeneral($usrUid);
$response['overdue'] = 0;
$response['atRisk'] = 0;
$response['onTime'] = 0;
$response['percentageOverdue'] = 0;
$response['percentageAtRisk'] = 0;
$response['percentageOnTime'] = 0;
$response['dataList'] = array();
if (is_array($result) && isset($result[0])) {
$response['overdue'] = $result[0]['OVERDUE'];
$response['atRisk'] = $result[0]['ONTIME'];
$response['onTime'] = $result[0]['ATRISK'];
$total = $response['overdue'] + $response['atRisk'] + $response['onTime'];
if ($total != 0) {
$response['percentageOverdue'] = ($response['overdue']*100)/$total;
$response['percentageAtRisk'] = ($response['atRisk']*100)/$total;
$response['percentageOnTime'] = ($response['onTime']*100)/$total;
}
}
$result = $this->statusIndicatorDetail($usrUid);
foreach ($result as $key => $value) {
$result[$key]['overdue'] = $value['overdue'];
$result[$key]['atRisk'] = $value['atRisk'];
$result[$key]['onTime'] = $value['onTime'];
$result[$key]['percentageOverdue'] = 0;
$result[$key]['percentageAtRisk'] = 0;
$result[$key]['percentageOnTime'] = 0;
$result[$key]['percentageTotalOverdue'] = 0;
$result[$key]['percentageTotalAtRisk'] = 0;
$result[$key]['percentageTotalOnTime'] = 0;
$total = $value['overdue'] + $value['onTime'] + $value['atRisk'];
if ($total != 0) {
$result[$key]['percentageOverdue'] = ($value['overdue']*100)/$total;
$result[$key]['percentageAtRisk'] = ($value['atRisk']*100)/$total;
$result[$key]['percentageOnTime'] = ($value['onTime']*100)/$total;
$result[$key]['percentageTotalOverdue'] = $response['overdue'] != 0 ? ($value['overdue']*100)/$response['overdue']: 0;
$result[$key]['percentageTotalAtRisk'] = $response['atRisk'] != 0 ? ($value['atRisk']*100)/$response['atRisk'] : 0;
$result[$key]['percentageTotalOnTime'] = $response['onTime'] != 0 ? ($value['onTime']*100)/$response['onTime']: 0;
}
}
$response['dataList'] = $result;
return $response;
}
private function periodicityFieldsForSelect($periodicity) {
$periodicityFields = $this->periodicityFieldsString($periodicity);

View File

@@ -27,6 +27,127 @@ class PMLicensedFeatures
{
private $featuresDetails = array ();
private $features = array ();
private $newFeatures = array(
0 => array(
"description" => "Enables de Actions By Email feature.",
"enabled" => false,
"id" => "actionsByEmail",
"latest_version" => "",
"log" => null,
"name" => "actionsByEmail",
"nick" => "actionsByEmail",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010004",
"type" => "features",
"url" => "",
"version" => ""
),
1 => array(
"description" => "Enables de Batch Routing feature.",
"enabled" => false,
"id" => "pmConsolidatedCL",
"latest_version" => "",
"log" => null,
"name" => "pmConsolidatedCL",
"nick" => "pmConsolidatedCL",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010005",
"type" => "features",
"url" => "",
"version" => ""
),
2 => array(
"description" => "Dashboard with improved charting graphics and optimized to show strategic information like Process Efficiency and User Efficiency indicators.",
"enabled" => false,
"id" => "strategicDashboards",
"latest_version" => "",
"log" => null,
"name" => "strategicDashboards",
"nick" => "Strategic Dashboards",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010006",
"type" => "features",
"url" => "",
"version" => ""
),
3 => array(
"description" => "Enables the configuration of a second database connection in order to divide the database requests in read and write operations. This features is used with database clusters to improve the application performance.",
"enabled" => false,
"id" => "secondDatabaseConnection",
"latest_version" => "",
"log" => null,
"name" => "secondDatabaseConnection",
"nick" => "secondDatabaseConnection",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010000",
"type" => "features",
"url" => "",
"version" => ""
),
4 => array(
"description" => "Registers every admin action in a log. The actions in administration settings options are registered in the log.",
"enabled" => false,
"id" => "auditLog",
"latest_version" => "",
"log" => null,
"name" => "auditLog",
"nick" => "auditLog",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010001",
"type" => "features",
"url" => "",
"version" => ""
),
5 => array(
"description" => "A more secure option to store user passwords in ProcessMaker. The modern algorithm SHA-2 is used to store the passwords.",
"enabled" => false,
"id" => "secureUserPasswordHash",
"latest_version" => "",
"log" => null,
"name" => "secureUserPasswordHash",
"nick" => "secureUserPasswordHash",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010002",
"type" => "features",
"url" => "",
"version" => ""
),
6 => array(
"description" => "This functionality enables the flexibility to send mails from different email servers or configurations.",
"enabled" => false,
"id" => "sendEmailFromDifferentEmailServers",
"latest_version" => "",
"log" => null,
"name" => "sendEmailFromDifferentEmailServers",
"nick" => "sendEmailFromDifferentEmailServers",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010003",
"type" => "features",
"url" => "",
"version" => ""
)
);
private static $instancefeature = null;
@@ -87,6 +208,132 @@ class PMLicensedFeatures
$this->featuresDetails[$value[0]]->enabled = $enable;
return $enable;
}
public function addNewFeatures ($data)
{
$newFeaturesList = $this->newFeatures;
$newData = array();
$newFeaturesIds = array();
foreach($newFeaturesList as $val) {
$newFeaturesIds[] = $val['id'];
}
$criteria = new Criteria();
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_ID);
$criteria->add(AddonsManagerPeer::ADDON_ID, $newFeaturesIds, Criteria::IN);
$criteria->add(AddonsManagerPeer::ADDON_TYPE, 'features');
$rs = AddonsManagerPeer::doSelectRS($criteria);
$rs->next();
$row = $rs->getRow();
if(sizeof($row)) {
while (is_array($row)) {
$ids[] = $row[0];
$rs->next();
$row = $rs->getRow();
}
$toUpdate = array_diff($newFeaturesIds,$ids);
if(sizeof($toUpdate)){
$newFeaturesListAux = array();
foreach($toUpdate as $index => $v) {
$newFeaturesListAux[] = $newFeaturesList[$index];
}
unset($newFeaturesList);
$newFeaturesList = array_values($newFeaturesListAux);
} else {
return $data;
}
}
foreach($newFeaturesList as $k => $newFeature){
$newData[] = array (
'db' => 'wf',
'table' => 'ADDONS_MANAGER',
'keys' =>
array (
0 => 'ADDON_ID',
),
'data' =>
array (
0 =>
array (
'field' => 'ADDON_DESCRIPTION',
'type' => 'text',
'value' => $newFeature['description'],
),
1 =>
array (
'field' => 'ADDON_ID',
'type' => 'text',
'value' => $newFeature['id'],
),
2 =>
array (
'field' => 'ADDON_NAME',
'type' => 'text',
'value' => $newFeature['name'],
),
3 =>
array (
'field' => 'ADDON_NICK',
'type' => 'text',
'value' => $newFeature['nick'],
),
4 =>
array (
'field' => 'ADDON_PUBLISHER',
'type' => 'text',
'value' => $newFeature['publisher'],
),
5 =>
array (
'field' => 'ADDON_RELEASE_TYPE',
'type' => 'text',
'value' => $newFeature['release_type'],
),
6 =>
array (
'field' => 'ADDON_STATUS',
'type' => 'text',
'value' => $newFeature['status'],
),
7 =>
array (
'field' => 'STORE_ID',
'type' => 'text',
'value' => $newFeature['store'],
),
8 =>
array (
'field' => 'ADDON_TYPE',
'type' => 'text',
'value' => $newFeature['type'],
),
9 =>
array (
'field' => 'ADDON_DOWNLOAD_URL',
'type' => 'text',
'value' => $newFeature['url'],
),
10 =>
array (
'field' => 'ADDON_VERSION',
'type' => 'text',
'value' => $newFeature['version'],
),
11 =>
array (
'field' => 'ADDON_DOWNLOAD_PROGRESS',
'type' => 'text',
'value' => $newFeature['progress'],
)
),
'action' => 1,
);
$i++;
}
return array_merge($data, $newData);
}
/*----------------------------------********---------------------------------*/
}

View File

@@ -3,7 +3,7 @@
/**
* class.pmDynaform.php
* Implementing pmDynaform library in the running case.
*
*
* @author Roly Rudy Gutierrez Pinto
* @package engine.classes
*/
@@ -80,19 +80,37 @@ class pmDynaform
public function jsonr(&$json)
{
foreach ($json as $key => $value) {
foreach ($json as $key => &$value) {
$sw1 = is_array($value);
$sw2 = is_object($value);
if ($sw1 || $sw2) {
$this->jsonr($value);
}
if (!$sw1 && !$sw2) {
//property
//set properties from trigger
$prefixs = array("@@", "@#", "@%", "@?", "@$", "@=");
if (is_string($value) && in_array(substr($value, 0, 2), $prefixs)) {
$triggerValue = substr($value, 2);
if (isset($this->fields["APP_DATA"][$triggerValue])) {
$json->$key = $this->fields["APP_DATA"][$triggerValue];
$json->{$key} = $this->fields["APP_DATA"][$triggerValue];
}
}
//set properties from 'formInstance' variable
if (isset($this->fields["APP_DATA"]["formInstance"])) {
$formInstance = $this->fields["APP_DATA"]["formInstance"];
if (!is_array($formInstance)) {
$formInstance = array($formInstance);
}
$nfi = count($formInstance);
for ($ifi = 0; $ifi < $nfi; $ifi++) {
$fi = $formInstance[$ifi];
if (is_object($fi) && isset($fi->id) && $key === "id" && $json->{$key} === $fi->id) {
foreach ($fi as $keyfi => $valuefi) {
if (isset($json->{$keyfi})) {
$json->{$keyfi} = $valuefi;
}
}
}
}
}
//query & options
@@ -136,11 +154,17 @@ class pmDynaform
array_push($json->options, $option);
}
} catch (Exception $e) {
}
}
if (isset($json->options[0])) {
$json->data = $json->options[0];
$no = count($json->options);
for ($io = 0; $io < $no; $io++) {
if ($json->options[$io]["value"] === $json->defaultValue) {
$json->data = $json->options[$io];
}
}
}
}
//data
@@ -187,7 +211,7 @@ class pmDynaform
if ($column->type === "text" || $column->type === "textarea" || $column->type === "dropdown" || $column->type === "datetime" || $column->type === "checkbox" || $column->type === "file" || $column->type === "link") {
array_push($cells, array(
"value" => isset($row[$column->name]) ? $row[$column->name] : "",
"label" => isset($row[$column->name . "_label"]) ? $row[$column->name . "_label"] : ""
"label" => isset($row[$column->name . "_label"]) ? $row[$column->name . "_label"] : (isset($row[$column->name]) ? $row[$column->name] : "")
));
}
if ($column->type === "suggest") {
@@ -208,11 +232,15 @@ class pmDynaform
$this->lang = $json->language;
}
if ($this->langs !== null) {
if (($key === "label" || $key === "hint" || $key === "placeholder" || $key === "validateMessage" || $key === "alternateText" || $key === "comment" || $key === "alt") && isset($json->{$key}) && isset($this->langs->{$this->lang})) {
if (($key === "label" || $key === "title" || $key === "hint" || $key === "placeholder" || $key === "validateMessage" || $key === "alternateText" || $key === "comment" || $key === "alt") && isset($this->langs->{$this->lang})) {
$langs = $this->langs->{$this->lang}->Labels;
foreach ($langs as $langsValue) {
if ($json->{$key} === $langsValue->msgid)
if (is_object($json) && $json->{$key} === $langsValue->msgid) {
$json->{$key} = $langsValue->msgstr;
}
if (is_array($json) && $json[$key] === $langsValue->msgid) {
$json[$key] = $langsValue->msgstr;
}
}
}
}
@@ -225,6 +253,72 @@ class pmDynaform
return $this->record != null && $this->record["DYN_VERSION"] == 2 ? true : false;
}
public function printViewWithoutSubmit()
{
ob_clean();
$json = G::json_decode($this->record["DYN_CONTENT"]);
foreach ($json->items[0]->items as $key => $value) {
switch ($json->items[0]->items[$key][0]->type) {
case "submit":
unset($json->items[0]->items[$key]);
break;
}
}
$this->jsonr($json);
$javascript = "
<script type=\"text/javascript\">
var jsondata = " . G::json_encode($json) . ";
var pm_run_outside_main_app = \"\";
var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\";
var __DynaformName__ = \"" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "\";
var app_uid = \"" . $this->fields["APP_UID"] . "\";
var prj_uid = \"" . $this->fields["PRO_UID"] . "\";
var step_mode = \"\";
var workspace = \"" . SYS_SYS . "\";
var credentials = " . G::json_encode($this->credentials) . ";
var filePost = \"\";
var fieldsRequired = null;
var triggerDebug = false;
$(window).load(function ()
{
var data = jsondata;
data.items[0].mode = \"disabled\";
window.project = new PMDynaform.core.Project({
data: data,
keys: {
server: location.host,
projectId: prj_uid,
workspace: workspace
},
token: credentials,
submitRest: false
});
$(document).find(\"form\").submit(function (e) {
e.preventDefault();
return false;
});
});
</script>
<div style=\"margin: 10px 20px 10px 0;\">
<div style=\"float: right\"><a href=\"javascript: window.history.go(-1);\" style=\"text-decoration: none;\">&lt; " . G::LoadTranslation("ID_BACK") . "</a></div>
<div style=\"clear: both\"></div>
</div>
";
$file = file_get_contents(PATH_HOME . "public_html" . PATH_SEP . "lib" . PATH_SEP . "pmdynaform" . PATH_SEP . "build" . PATH_SEP . "pmdynaform.html");
$file = str_replace("{javascript}", $javascript, $file);
echo $file;
exit(0);
}
public function printView()
{
ob_clean();
@@ -409,6 +503,8 @@ class pmDynaform
$json->name = $newVariable["VAR_NAME"];
if (isset($json->dbConnection) && $json->dbConnection === $oldVariable["VAR_DBCONNECTION"])
$json->dbConnection = $newVariable["VAR_DBCONNECTION"];
if (isset($json->dbConnectionLabel) && $json->dbConnectionLabel === $oldVariable["VAR_DBCONNECTION_LABEL"])
$json->dbConnectionLabel = $newVariable["VAR_DBCONNECTION_LABEL"];
if (isset($json->sql) && $json->sql === $oldVariable["VAR_SQL"])
$json->sql = $newVariable["VAR_SQL"];
if (isset($json->options) && G::json_encode($json->options) === $oldVariable["VAR_ACCEPTED_VALUES"]) {

View File

@@ -1588,8 +1588,9 @@ class processMap
$numRows = DynaformPeer::doCount($oCriteria);
if ($numRows == 0) {
echo "<div style=\"margin:1em;\"><strong>".G::LoadTranslation('ID_ALERT')."</strong><br />".G::LoadTranslation('ID_CONSOLIDATED_DYNAFORM_REQUIRED')."</div>";
die;
$aFields['TITLE_ALERT'] = G::LoadTranslation('ID_ALERT');
$aFields['SUBTITLE_MESSAGE'] = G::LoadTranslation('ID_CONSOLIDATED_DYNAFORM_REQUIRED');
$sFilename = 'tasks/tasks_Consolidated_Error.xml';
}
}

View File

@@ -919,6 +919,10 @@ class workspaceTools
if (file_exists(PATH_CORE . 'data' . PATH_SEP . 'check.data')) {
$checkData = unserialize(file_get_contents(PATH_CORE . 'data' . PATH_SEP . 'check.data'));
if (is_array($checkData)) {
/*----------------------------------********---------------------------------*/
$licensedFeatures = & PMLicensedFeatures::getSingleton();
$checkData = $licensedFeatures->addNewFeatures($checkData);
/*----------------------------------********---------------------------------*/
foreach ($checkData as $checkThis) {
$this->updateThisRegistry($checkThis);
}

View File

@@ -356,17 +356,18 @@ class AppDelegation extends BaseAppDelegation
$aCalendarUID = '';
}
//use the dates class to calculate dates
//Calendar - Use the dates class to calculate dates
$calendar = new calendar();
$arrayCalendarData = array();
if ($calendar->pmCalendarUid == "") {
$calendar->getCalendar(null, $task->getProUid(), $this->getTasUid());
$calendar->getCalendar(null, $this->getProUid(), $this->getTasUid());
$arrayCalendarData = $calendar->getCalendarData();
}
//Due date
/*$iDueDate = $calendar->calculateDate( $this->getDelDelegateDate(), $aData['TAS_DURATION'], $aData['TAS_TIMEUNIT'] //hours or days, ( we only accept this two types or maybe weeks
);*/
$dueDate = $calendar->dashCalculateDate($this->getDelDelegateDate(), $aData["TAS_DURATION"], $aData["TAS_TIMEUNIT"], $arrayCalendarData);
@@ -378,10 +379,22 @@ class AppDelegation extends BaseAppDelegation
public function calculateRiskDate($dueDate, $risk)
{
try {
$numDueDate = strtotime($dueDate); //Seconds
$numDueDate = $numDueDate - ($numDueDate * $risk);
$riskTime = strtotime($dueDate) - strtotime($this->getDelDelegateDate()); //Seconds
$riskTime = $riskTime - ($riskTime * $risk);
$riskDate = date("Y-m-d H:i:s", round($numDueDate));
//Calendar - Use the dates class to calculate dates
$calendar = new calendar();
$arrayCalendarData = array();
if ($calendar->pmCalendarUid == "") {
$calendar->getCalendar(null, $this->getProUid(), $this->getTasUid());
$arrayCalendarData = $calendar->getCalendarData();
}
//Risk date
$riskDate = $calendar->dashCalculateDate($this->getDelDelegateDate(), round($riskTime / (60 * 60)), "HOURS", $arrayCalendarData);
//Return
return $riskDate;

View File

@@ -70,6 +70,28 @@ class DashboardIndicator extends BaseDashboardIndicator
$oldValue = current(reset($calculator->ueiHistoric($uid, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE)));
$row['DAS_IND_VARIATION'] = $value - $oldValue;
break;
case '1050':
$value = $calculator->statusIndicatorGeneral($userUid);
$row['OVERDUE'] = 0;
$row['ON_TIME'] = 0;
$row['AT_RISK'] = 0;
$row['PERCENTAGE_OVERDUE'] = 0;
$row['PERCENTAGE_AT_RISK'] = 0;
$row['PERCENTAGE_ON_TIME'] = 0;
if (is_array($value) && isset($value[0])) {
$row['OVERDUE'] = $value[0]['OVERDUE'];
$row['ON_TIME'] = $value[0]['ONTIME'];
$row['AT_RISK'] = $value[0]['ATRISK'];
$total = $row['OVERDUE'] + $row['AT_RISK'] + $row['ON_TIME'];
if ($total != 0) {
$row['PERCENTAGE_OVERDUE'] = ($row['OVERDUE']*100)/$total;
$row['PERCENTAGE_AT_RISK'] = ($row['AT_RISK']*100)/$total;
$row['PERCENTAGE_ON_TIME'] = ($row['ON_TIME']*100)/$total;
}
}
break;
default:
$arrResult = $calculator->generalIndicatorData($row['DAS_IND_UID'], $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE);
$value = $arrResult[0]['value'];

13
workflow/engine/data/mysql/insert.sql Executable file → Normal file
View File

@@ -59976,8 +59976,13 @@ INSERT INTO CATALOG (CAT_UID, CAT_LABEL_ID, CAT_TYPE, CAT_FLAG, CAT_OBSERVATION,
('400','ID_YEAR','PERIODICITY','','','2015-03-04','2015-03-04'),
('1010','ID_PROCESS_EFFICIENCE','INDICATOR','','','2015-03-04','2015-03-04'),
('1030','ID_EMPLYEE_EFFICIENCIE','INDICATOR','','','2015-03-04','2015-03-04'),
('1040','ID_USER_INEFFICIENCE','INDICATOR','','','2015-03-04','2015-03-04'),
('1050','ID_OVER_DUE','INDICATOR','%','Unit for displaying','2015-03-04','2015-03-04'),
('1060','ID_NEW_CASES','INDICATOR','','','2015-03-04','2015-03-04'),
('1070','ID_COMPLETED_CASES','INDICATOR','','','2015-03-04','2015-03-04'),
('1080','ID_WORKING_CASES','INDICATOR','','','2015-03-04','2015-03-04');
INSERT INTO ADDONS_MANAGER (ADDON_DESCRIPTION,ADDON_ID,ADDON_NAME,ADDON_NICK,ADDON_PUBLISHER,ADDON_RELEASE_TYPE,ADDON_STATUS,STORE_ID,ADDON_TYPE,ADDON_DOWNLOAD_URL,ADDON_VERSION,ADDON_DOWNLOAD_PROGRESS) VALUES
('Enables de Actions By Email feature.','actionsByEmail','actionsByEmail','actionsByEmail','Colosa','localRegistry','ready','00000000000000000000000000010004','features','','','0'),
('Enables de Batch Routing feature.','pmConsolidatedCL','pmConsolidatedCL','pmConsolidatedCL','Colosa','localRegistry','ready','00000000000000000000000000010005','features','','','0'),
('Dashboard with improved charting graphics and optimized to show strategic information like Process Efficiency and User Efficiency indicators.','strategicDashboards','strategicDashboards','Strategic Dashboards','Colosa','localRegistry','ready','00000000000000000000000000010006','features','','','0'),
('Enables the configuration of a second database connection in order to divide the database requests in read and write operations. This features is used with database clusters to improve the application performance.','secondDatabaseConnection','secondDatabaseConnection','secondDatabaseConnection','Colosa','localRegistry','ready','00000000000000000000000000010000','features','','','0'),
('A more secure option to store user passwords in ProcessMaker. The modern algorithm SHA-2 is used to store the passwords.','secureUserPasswordHash','secureUserPasswordHash','secureUserPasswordHash','Colosa','localRegistry','ready','00000000000000000000000000010002','features','','','0'),
('This functionality enables the flexibility to send mails from different email servers or configurations.','sendEmailFromDifferentEmailServers','sendEmailFromDifferentEmailServers','sendEmailFromDifferentEmailServers','Colosa','localRegistry','ready','00000000000000000000000000010003','features','','','0'),
('Registers every admin action in a log. The actions in administration settings options are registered in the log.','auditLog','auditLog','auditLog','Colosa','localRegistry','ready','00000000000000000000000000010001','features','','','0');

View File

@@ -2789,7 +2789,7 @@ CREATE TABLE `DASHBOARD_DAS_IND`
(
`DAS_UID` VARCHAR(32) default '' NOT NULL,
`OWNER_UID` VARCHAR(32) default '' NOT NULL,
`OWNER_TYPE` VARCHAR(15) default '' NOT NULL
`OWNER_TYPE` VARCHAR(15) default '' NOT NULL,
PRIMARY KEY (`DAS_UID`),
CONSTRAINT `fk_dashboard_indicator_dashboard_das_ind`
FOREIGN KEY (`DAS_UID`)

File diff suppressed because it is too large Load Diff

View File

@@ -1,500 +0,0 @@
var getKeyValue =
function getKeyValue(obj, key, undefined) {
var reg = /\./gi
, subKey
, keys
, context
, x
;
if (reg.test(key)) {
keys = key.split(reg);
context = obj;
for (x = 0; x < keys.length; x++) {
subKey = keys[x];
//the values of all keys except for
//the last one should be objects
if (x < keys.length -1) {
if (!context.hasOwnProperty(subKey)) {
return undefined;
}
context = context[subKey];
}
else {
return context[subKey];
}
}
}
else {
return obj[key];
}
};
var setKeyValue =
function setKeyValue(obj, key, value) {
var reg = /\./gi
, subKey
, keys
, context
, x
;
//check to see if we need to process
//multiple levels of objects
if (reg.test(key)) {
keys = key.split(reg);
context = obj;
for (x = 0; x < keys.length; x++) {
subKey = keys[x];
//the values of all keys except for
//the last one should be objects
if (x < keys.length -1) {
if (!context[subKey]) {
context[subKey] = {};
}
context = context[subKey];
}
else {
context[subKey] = value;
}
}
}
else {
obj[key] = value;
}
};
var merge =
function merge(objFrom, objTo, propMap) {
var toKey
, fromKey
, x
, value
, def
, transform
, key
, keyIsArray
;
if (!objTo) {
objTo = {};
}
for(fromKey in propMap) {
if (propMap.hasOwnProperty(fromKey)) {
toKey = propMap[fromKey];
//force toKey to an array of toKeys
if (!Array.isArray(toKey)) {
toKey = [toKey];
}
for(x = 0; x < toKey.length; x++) {
def = null;
transform = null;
key = toKey[x];
keyIsArray = Array.isArray(key);
if (typeof(key) === "object" && !keyIsArray) {
def = key.default || null;
transform = key.transform || null;
key = key.key;
//evaluate if the new key is an array
keyIsArray = Array.isArray(key);
}
if (keyIsArray) {
//key[toKeyName,transform,default]
def = key[2] || null;
transform = key[1] || null;
key = key[0];
}
if (def && typeof(def) === "function" ) {
def = def(objFrom, objTo);
}
value = getKeyValue(objFrom, fromKey);
if (transform) {
value = transform(value, objFrom, objTo);
}
if (typeof value !== 'undefined') {
setKeyValue(objTo, key, value);
}
else if (typeof def !== 'undefined') {
setKeyValue(objTo, key, def);
}
}
}
}
return objTo;
};
var DashboardProxy = function (oauthToken, server, workspace) {
this.server = server;
this.workspace = workspace;
this.baseUrl = "/api/1.0/" + workspace + "/";
this.oauthToken = oauthToken;
};
DashboardProxy.prototype.userDashboards = function(userId, callBack) {
this.getJson('dashboard/ownerData/' + userId,
function (r) {
var returnList = [];
$.each(r, function(index, originalObject) {
var map = {
"DAS_TITLE" : "dashName",
"DAS_UID" : "dashUid",
"DAS_FAVORITE" : "favorite",
};
var newObject = merge(originalObject, {}, map);
returnList.push(newObject);
});
callBack(returnList);
});
};
DashboardProxy.prototype.dashboardIndicators = function(dashboardId, initDate, endDate, callBack) {
this.getJson('dashboard/' + dashboardId + '/indicator?dateIni=' + initDate + '&dateFin=' + endDate,
function (r) {
var returnList = [];
$.each(r, function(index, originalObject) {
var map = {
"DAS_IND_UID" : "indUid",
"DAS_IND_TITLE" : "indName",
"DAS_IND_TYPE" : "id",
"DAS_IND_VARIATION" : "comparative",
"DAS_IND_DIRECTION" : "direction",
"DAS_IND_VALUE" : "index",
"DAS_IND_X" : "x",
"DAS_IND_Y" : "y",
"DAS_IND_WIDTH" : "width",
"DAS_IND_HEIGHT" : "height",
"DAS_UID_PROCESS" : "process"
};
var newObject = merge(originalObject, {}, map);
//TODO do not burn this value. Data must come from the endpoint
newObject.favorite = ((returnList.length == 1) ? 1 : 0);
returnList.push(newObject);
});
callBack(returnList);
});
};
DashboardProxy.prototype.peiData = function(indicatorId, measureDate, compareDate, callBack) {
var endPoint = "ReportingIndicators/process-efficiency-data?" +
"indicator_uid=" + indicatorId +
"&measure_date=" + measureDate +
"&compare_date=" + compareDate +
"&language=en";
this.getJson(endPoint,
function (r) {
var graphData = [];
$.each(r.data, function(index, originalObject) {
var map = {
"name" : "datalabel",
"inefficiencyCost" : "value"
};
var newObject = merge(originalObject, {}, map);
var shortLabel = (newObject.datalabel == null)
? ""
: newObject.datalabel.substring(0,15);
newObject.datalabel = shortLabel;
graphData.push(newObject);
});
r.dataToDraw = graphData.splice(0,7);
callBack(r);
});
}
DashboardProxy.prototype.processTasksData = function(process, initDate, endDate, callBack) {
var endPoint = "ReportingIndicators/process-tasks?" +
"process_list=" + process +
"&init_date=" + initDate +
"&end_date=" + endDate +
"&language=en";
this.getJson(endPoint,
function (r) {
var graphData = [];
$.each(r, function(index, originalObject) {
var map = {
"name" : "datalabel",
"averageTime" : "value",
"deviationTime" : "dispersion"
};
var newObject = merge(originalObject, {}, map);
newObject.datalabel = newObject.datalabel.substring(0, 7);
graphData.push(newObject);
});
var retval = {};
retval.dataToDraw = graphData.splice(0,7);
retval.tasksData = r;
callBack(retval);
});
}
DashboardProxy.prototype.ueiData = function(indicatorId, measureDate, compareDate, callBack) {
var endPoint = "ReportingIndicators/employee-efficiency-data?" +
"indicator_uid=" + indicatorId +
"&measure_date=" + measureDate +
"&compare_date=" + compareDate +
"&language=en";
this.getJson(endPoint,
function (r) {
var graphData = [];
$.each(r.data, function(index, originalObject) {
var map = {
"name" : "datalabel",
"averageTime" : "value",
"deviationTime" : "dispersion"
};
var newObject = merge(originalObject, {}, map);
var shortLabel = (newObject.datalabel == null)
? ""
: newObject.datalabel.substring(0,7);
newObject.datalabel = shortLabel;
graphData.push(newObject);
});
r.dataToDraw = graphData.splice(0,7);
callBack(r);
});
/*var retval = {
"efficiencyIndex":1.23,
"efficiencyVariation":0.23,
"inefficiencyCost":"$ 20112.23",
"employeeGroupsDataToDraw":
[
{"value":"96", "datalabel":"User 1"},
{"value":"84", "datalabel":"User 2"},
{"value":"72", "datalabel":"User 3"},
{"value":"18", "datalabel":"User 4"},
{"value":"85", "datalabel":"User 5"}
],
"employeeGroupsData": [
{"name": "User 1", "efficiencyIndex":"0.45", "innefficiencyCost":"$ 3404"},
{"name": "User 2", "efficiencyIndex":"1.45", "innefficiencyCost":"$ 1404"},
{"name": "User 3", "efficiencyIndex":"0.25", "innefficiencyCost":"$ 3304"},
{"name": "User 4", "efficiencyIndex":"1.95", "innefficiencyCost":"$ 404"},
{"name": "User 5", "efficiencyIndex":"1.25", "innefficiencyCost":"$ 13404"},
{"name": "User 6", "efficiencyIndex":"0.75", "innefficiencyCost":"$ 4"}
]
}
return retval;*/
}
DashboardProxy.prototype.userGroupData = function(groupId, initDate, endDate, callBack) {
var endPoint = "ReportingIndicators/group-employee-data?" +
"group_uid=" + groupId +
"&init_date=" + initDate +
"&end_date=" + endDate +
"&language=en";
this.getJson(endPoint,
function (r) {
var graphData = [];
$.each(r, function(index, originalObject) {
var map = {
"name" : "datalabel",
"averageTime" : "value",
"deviationTime" : "dispersion"
};
var newObject = merge(originalObject, {}, map);
newObject.datalabel = newObject.datalabel.substring(0, 7);
graphData.push(newObject);
});
var retval = {};
retval.dataToDraw = graphData.splice(0,7);
retval.tasksData = r;
callBack(retval);
});
}
DashboardProxy.prototype.generalIndicatorData = function(indicatorId, initDate, endDate, callBack) {
var method = "";
var endPoint = "ReportingIndicators/general-indicator-data?" +
"indicator_uid=" + indicatorId +
"&init_date=" + initDate +
"&end_date=" + endDate +
"&language=en";
this.getJson(endPoint,
function (r) {
$.each(r.graph1Data, function(index, originalObject) {
var label = (('YEAR' in originalObject) ? originalObject.YEAR : "") ;
label += (('MONTH' in originalObject) ? "/" + originalObject.MONTH : "") ;
label += (('QUARTER' in originalObject) ? "/" + originalObject.QUARTER : "");
label += (('SEMESTER' in originalObject) ? "/" + originalObject.SEMESTER : "");
originalObject.datalabel = label;
});
$.each(r.graph2Data, function(index, originalObject) {
var label = (('YEAR' in originalObject) ? originalObject.YEAR : "") ;
label += (('MONTH' in originalObject) ? "/" + originalObject.MONTH : "") ;
label += (('QUARTER' in originalObject) ? "/" + originalObject.QUARTER : "");
label += (('SEMESTER' in originalObject) ? "/" + originalObject.SEMESTER : "") ;
originalObject.datalabel = label;
});
callBack(r);
});
/*var retval = {
"index" : "23",
"graph1Data": [
{"value":"96", "datalabel":"User 1"},
{"value":"84", "datalabel":"User 2"},
{"value":"72", "datalabel":"User 3"},
{"value":"18", "datalabel":"User 4"},
{"value":"85", "datalabel":"User 5"}
],
"graph2Data": [
{"value":"196", "datalabel":"User 1"},
{"value":"184", "datalabel":"User 2"},
{"value":"172", "datalabel":"User 3"},
{"value":"118", "datalabel":"User 4"},
{"value":"185", "datalabel":"User 5"}
]
}
return retval;*/
}
DashboardProxy.prototype.userTasksData = function(processId, monthCompare, yearCompare) {
var retval = {
"tasksDataToDraw": [
{"value":"96", "datalabel":"Task 1"},
{"value":"84", "datalabel":"Task 2"},
{"value":"72", "datalabel":"Task 3"},
{"value":"18", "datalabel":"Task 4"},
{"value":"85", "datalabel":"Task 5"}
],
"tasksData": [
{"Name": "Task 1", "efficiencyIndex":"0.45", "deviationTime":"0.45", "averageTime":"34 days"},
{"Name": "Task 2", "efficiencyIndex":"1.45", "deviationTime":"1.45", "averageTime":"14 days"},
{"Name": "Task 3", "efficiencyIndex":"0.25", "deviationTime":"0.25", "averageTime":"3 days"},
{"Name": "Task 4", "efficiencyIndex":"1.95", "deviationTime":"1.95", "averageTime":"4 days"},
{"Name": "Task 5", "efficiencyIndex":"1.25", "deviationTime":"1.25", "averageTime":"14 days"},
{"Name": "Task 6", "efficiencyIndex":"0.75", "deviationTime":"0.75", "averageTime":"4 days"}
]
}
return retval;
}
DashboardProxy.prototype.getPositionIndicator = function(callBack) {
this.getJson('dashboard/config', function (r) {
var graphData = [];
$.each(r, function(index, originalObject) {
var map = {
"widgetId" : originalObject.widgetId,
"x" : originalObject.x,
"y" : originalObject.y,
"width" : originalObject.width,
"height" : originalObject.height
};
graphData.push(map);
});
callBack(graphData);
});
};
DashboardProxy.prototype.setPositionIndicator = function(data, callBack) {
var that = this;
this.getPositionIndicator(
function(response){
if (response.length != 0) {
that.putJson('dashboard/config', data, function (r) {
});
} else {
that.postJson('dashboard/config', data, function (r) {
});
}
}
);
};
DashboardProxy.prototype.getJson = function (endPoint, callBack) {
var that = this;
var callUrl = this.baseUrl + endPoint
//For Debug: console.log('Llamando:');
//For Debug: console.log(callUrl)
$.ajax({
url: callUrl,
type: 'GET',
datatype: 'json',
success: function(response) { callBack(response); },
error: function(jqXHR, textStatus, errorThrown) {
throw new Error(textStatus);
},
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'Bearer ' + that.oauthToken);
xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
}
});
}
DashboardProxy.prototype.postJson = function (endPoint, data, callBack) {
var that = this;
$.ajax({
url : this.baseUrl + endPoint,
type : 'POST',
datatype : 'json',
contentType: "application/json; charset=utf-8",
data: JSON.stringify(data),
success: function(response) {
callBack(response);
},
error: function(jqXHR, textStatus, errorThrown) {
throw new Error(textStatus);
},
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'Bearer ' + that.oauthToken);
xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
}
}).fail(function () {
throw new Error('Fail server');
});
};
DashboardProxy.prototype.putJson = function (endPoint, data, callBack) {
var that = this;
$.ajax({
url : this.baseUrl + endPoint,
type : 'PUT',
datatype : 'json',
contentType: "application/json; charset=utf-8",
data: JSON.stringify(data),
success: function(response) {
callBack(response);
},
error: function(jqXHR, textStatus, errorThrown) {
throw new Error(textStatus);
},
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'Bearer ' + that.oauthToken);
xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
}
}).fail(function () {
throw new Error('Fail server');
});
};

View File

@@ -0,0 +1,180 @@
var ViewDashboardHelper = function () {
};
ViewDashboardHelper.prototype.userDashboards = function(userId, callBack) {
};
ViewDashboardHelper.prototype.stringIfNull = function (val){
if(val === null || val == undefined || val == "?"){
val = "?";
} else {
val = (parseFloat(val)).toFixed(2);
}
return val;
};
ViewDashboardHelper.prototype.assert = function (condition, message) {
if (!condition) {
message = message || "Assertion failed";
if (typeof Error !== "undefined") {
throw new Error(message);
}
throw message; // Fallback
}
}
ViewDashboardHelper.prototype.truncateString = function (string, len) {
this.assert(len != null && len > 0, "Var len not valid. String must by truncated to a positive non zero length.");
this.assert(string != null, "var string can't be null.");
var retval = "";
if(string.length > len){
retval = string.substring(0, len ) + "...";
}
else{
retval = string;
}
return retval;
}
ViewDashboardHelper.prototype.getKeyValue = function (obj, key, undefined) {
var reg = /\./gi
, subKey
, keys
, context
, x
;
if (reg.test(key)) {
keys = key.split(reg);
context = obj;
for (x = 0; x < keys.length; x++) {
subKey = keys[x];
//the values of all keys except for
//the last one should be objects
if (x < keys.length -1) {
if (!context.hasOwnProperty(subKey)) {
return undefined;
}
context = context[subKey];
}
else {
return context[subKey];
}
}
}
else {
return obj[key];
}
};
ViewDashboardHelper.prototype.setKeyValue = function (obj, key, value) {
var reg = /\./gi
, subKey
, keys
, context
, x
;
//check to see if we need to process
//multiple levels of objects
if (reg.test(key)) {
keys = key.split(reg);
context = obj;
for (x = 0; x < keys.length; x++) {
subKey = keys[x];
//the values of all keys except for
//the last one should be objects
if (x < keys.length -1) {
if (!context[subKey]) {
context[subKey] = {};
}
context = context[subKey];
}
else {
context[subKey] = value;
}
}
}
else {
obj[key] = value;
}
};
ViewDashboardHelper.prototype.merge = function (objFrom, objTo, propMap) {
var toKey
, fromKey
, x
, value
, def
, transform
, key
, keyIsArray
;
if (!objTo) {
objTo = {};
}
for(fromKey in propMap) {
if (propMap.hasOwnProperty(fromKey)) {
toKey = propMap[fromKey];
//force toKey to an array of toKeys
if (!Array.isArray(toKey)) {
toKey = [toKey];
}
for(x = 0; x < toKey.length; x++) {
def = null;
transform = null;
key = toKey[x];
keyIsArray = Array.isArray(key);
if (typeof(key) === "object" && !keyIsArray) {
def = key.default || null;
transform = key.transform || null;
key = key.key;
//evaluate if the new key is an array
keyIsArray = Array.isArray(key);
}
if (keyIsArray) {
//key[toKeyName,transform,default]
def = key[2] || null;
transform = key[1] || null;
key = key[0];
}
if (def && typeof(def) === "function" ) {
def = def(objFrom, objTo);
}
value = this.getKeyValue(objFrom, fromKey);
if (transform) {
value = transform(value, objFrom, objTo);
}
if (typeof value !== 'undefined') {
this.setKeyValue(objTo, key, value);
}
else if (typeof def !== 'undefined') {
this.setKeyValue(objTo, key, def);
}
}
}
}
return objTo;
};

View File

@@ -0,0 +1,194 @@
var ViewDashboardModel = function (oauthToken, server, workspace) {
this.server = server;
this.workspace = workspace;
this.baseUrl = "/api/1.0/" + workspace + "/";
//this.baseUrl = "http://127.0.0.1:8080/api/1.0/workflow/";
this.oauthToken = oauthToken;
this.helper = new ViewDashboardHelper();
this.cache = [];
this.forceRemote=false; //if true, the next call will go to the remote server
};
ViewDashboardModel.prototype.userDashboards = function(userId) {
return this.getJson('dashboard/ownerData/' + userId);
};
ViewDashboardModel.prototype.dashboardIndicators = function(dashboardId, initDate, endDate) {
return this.getJson('dashboard/' + dashboardId + '/indicator?dateIni=' + initDate + '&dateFin=' + endDate);
};
ViewDashboardModel.prototype.peiData = function(indicatorId, compareDate, measureDate) {
var endPoint = "ReportingIndicators/process-efficiency-data?" +
"indicator_uid=" + indicatorId +
"&compare_date=" + compareDate +
"&measure_date=" + measureDate +
"&language=en";
return this.getJson(endPoint);
}
ViewDashboardModel.prototype.statusData = function() {
var endPoint = "ReportingIndicators/status-indicator";
return this.getJson(endPoint);
}
ViewDashboardModel.prototype.peiDetailData = function(process, initDate, endDate) {
var endPoint = "ReportingIndicators/process-tasks?" +
"process_list=" + process +
"&init_date=" + initDate +
"&end_date=" + endDate +
"&language=en";
return this.getJson(endPoint);
}
ViewDashboardModel.prototype.ueiData = function(indicatorId, compareDate, measureDate ) {
var endPoint = "ReportingIndicators/employee-efficiency-data?" +
"indicator_uid=" + indicatorId +
"&compare_date=" + compareDate +
"&measure_date=" + measureDate +
"&language=en";
return this.getJson(endPoint);
}
ViewDashboardModel.prototype.ueiDetailData = function(groupId, initDate, endDate) {
var endPoint = "ReportingIndicators/group-employee-data?" +
"group_uid=" + groupId +
"&init_date=" + initDate +
"&end_date=" + endDate +
"&language=en";
return this.getJson(endPoint);
}
ViewDashboardModel.prototype.generalIndicatorData = function(indicatorId, initDate, endDate) {
var method = "";
var endPoint = "ReportingIndicators/general-indicator-data?" +
"indicator_uid=" + indicatorId +
"&init_date=" + initDate +
"&end_date=" + endDate +
"&language=en";
return this.getJson(endPoint);
}
ViewDashboardModel.prototype.getPositionIndicator = function(callBack) {
this.getJson('dashboard/config').done(function (r) {
var graphData = [];
$.each(r, function(index, originalObject) {
var map = {
"widgetId" : originalObject.widgetId,
"x" : originalObject.x,
"y" : originalObject.y,
"width" : originalObject.width,
"height" : originalObject.height
};
graphData.push(map);
});
callBack(graphData);
});
};
ViewDashboardModel.prototype.setPositionIndicator = function(data) {
var that = this;
this.getPositionIndicator(
function(response){
if (response.length != 0) {
that.putJson('dashboard/config', data);
} else {
that.postJson('dashboard/config', data);
}
}
);
};
ViewDashboardModel.prototype.getJson = function (endPoint) {
var that = this;
var callUrl = this.baseUrl + endPoint
var requestFinished = $.Deferred();
var itemInCache = that.getCacheItem(endPoint);
if (itemInCache != null && !this.forceRemote) {
that.forceRemote = false;
requestFinished.resolve(itemInCache);
return requestFinished.promise();
}
else {
return $.ajax({
url: callUrl,
type: 'GET',
datatype: 'json',
success: function (data) {
that.forceRemote = false;
requestFinished.resolve(data);
that.putInCache(endPoint, data);
// return requestFinished.promise();
},
error: function(jqXHR, textStatus, errorThrown) {
throw new Error(callUrl + ' -- ' + errorThrown);
},
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'Bearer ' + that.oauthToken);
//xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
}
});
}
}
ViewDashboardModel.prototype.postJson = function (endPoint, data) {
var that = this;
return $.ajax({
url : this.baseUrl + endPoint,
type : 'POST',
datatype : 'json',
contentType: "application/json; charset=utf-8",
data: JSON.stringify(data),
error: function(jqXHR, textStatus, errorThrown) {
throw new Error(errorThrown);
},
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'Bearer ' + that.oauthToken);
xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
}
}).fail(function () {
throw new Error('Fail server');
});
};
ViewDashboardModel.prototype.putJson = function (endPoint, data) {
var that = this;
return $.ajax({
url : this.baseUrl + endPoint,
type : 'PUT',
datatype : 'json',
contentType: "application/json; charset=utf-8",
data: JSON.stringify(data),
error: function(jqXHR, textStatus, errorThrown) {
throw new Error(errorThrown);
},
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'Bearer ' + that.oauthToken);
//xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
}
}).fail(function () {
throw new Error('Fail server');
});
};
ViewDashboardModel.prototype.getCacheItem = function (endPoint) {
var retval = null;
$.each(this.cache, function(index, objectItem) {
if (objectItem.key == endPoint) {
retval = objectItem.value;
}
});
return retval;
}
ViewDashboardModel.prototype.putInCache = function (endPoint, data) {
var cacheItem = this.getCacheItem(endPoint);
if (cacheItem == null) {
this.cache.push ({ key: endPoint, value:data });
}
else {
cacheItem.value = data;
}
}

View File

@@ -0,0 +1,381 @@
var ViewDashboardPresenter = function (model) {
this.helper = new ViewDashboardHelper();
this.helper.assert(model != null, "A model must be passed for the presenter work.")
this.model = model;
};
ViewDashboardPresenter.prototype.getUserDashboards = function (userId) {
var that = this;
var requestFinished = $.Deferred();
that.model.userDashboards(userId)
.done(function(modelData){
var viewModel = that.userDashboardsViewModel(modelData)
requestFinished.resolve(viewModel);
});
return requestFinished.promise();
};
ViewDashboardPresenter.prototype.userDashboardsViewModel = function(data) {
var that = this;
//if null data is returned we default to an empty array
if (data == null) { data = []; }
var returnList = [];
$.each(data, function(index, originalObject) {
var map = {
"DAS_TITLE" : "title",
"DAS_UID" : "id",
"DAS_FAVORITE" : "isFavorite"
};
var newObject = that.helper.merge(originalObject, {}, map);
returnList.push(newObject);
});
return returnList;
};
ViewDashboardPresenter.prototype.getDashboardIndicators = function (dashboardId,initDate, endDate) {
if (dashboardId == null) {throw new Error ("getDashboardIndicators -> dashboardId can't be null");};
var that = this;
var requestFinished = $.Deferred();
this.model.dashboardIndicators (dashboardId, initDate, endDate)
.done(function (modelData) {
var viewModel = that.dashboardIndicatorsViewModel(modelData)
requestFinished.resolve(viewModel);
});
return requestFinished.promise();
};
ViewDashboardPresenter.prototype.dashboardIndicatorsViewModel = function(data) {
var that = this;
var returnList = [];
var i = 1;
$.each(data, function(index, originalObject) {
var map = {
"DAS_IND_UID" : "id",
"DAS_IND_TITLE" : "title",
"DAS_IND_TYPE" : "type",
"DAS_IND_VARIATION" : "comparative",
"DAS_IND_DIRECTION" : "direction",
"DAS_IND_VALUE" : "value",
"DAS_IND_X" : "x",
"DAS_IND_Y" : "y",
"DAS_IND_WIDTH" : "width",
"DAS_IND_HEIGHT" : "height",
"DAS_UID_PROCESS" : "process",
"PERCENTAGE_OVERDUE" : "percentageOverdue",
"PERCENTAGE_AT_RISK" : "percentageAtRisk",
"PERCENTAGE_ON_TIME" : "percentageOnTime"
};
var newObject = that.helper.merge(originalObject, {}, map);
newObject.toDrawX = newObject.x;
//newObject.toDrawX = (newObject.x == 0) ? 12 - 12/i : newObject.x;
newObject.toDrawY = (newObject.y == 0) ? 6 : newObject.y;
newObject.toDrawHeight = (newObject.y == 0) ? 2 : newObject.height;
newObject.toDrawWidth = (newObject.y == 0) ? 12 / data.length : newObject.width;
newObject.comparative = ((newObject.comparative > 0)? "+": "") + that.helper.stringIfNull(newObject.comparative);
newObject.directionSymbol = (newObject.direction == "1") ? "<" : ">";
newObject.isWellDone = (newObject.direction == "1")
? parseFloat(newObject.value) <= parseFloat(newObject.comparative)
: parseFloat(newObject.value) >= parseFloat(newObject.comparative);
newObject.category = (newObject.type == "1010" || newObject.type == "1030")
? "special"
: "normal";
//round goals for normal indicators
newObject.comparative = (newObject.category == "normal")
? Math.round(newObject.comparative) + ""
: newObject.comparative;
newObject.value = (newObject.category == "normal")
? Math.round(newObject.value) + ""
: Math.round(newObject.value*100)/100 + ""
newObject.favorite = 0;
newObject.percentageOverdue = Math.round(newObject.percentageOverdue);
newObject.percentageAtRisk = Math.round(newObject.percentageAtRisk);
//to be sure that percentages sum up to 100 (the rounding will lost decimals)%
newObject.percentageOnTime = 100 - newObject.percentageOverdue - newObject.percentageAtRisk;
newObject.overdueVisibility = (newObject.percentageOverdue > 0)? "visible" : "hidden";
newObject.atRiskVisiblity = (newObject.percentageAtRisk > 0)? "visible" : "hidden";
newObject.onTimeVisibility = (newObject.percentageOnTime > 0)? "visible" : "hidden";
returnList.push(newObject);
i++;
});
//sort the array for drawing in toDrawX order
returnList.sort(function (a, b) {
return ((a.toDrawX <= b.toDrawX) ? -1 : 1);
});
if (returnList.length > 0) {
returnList[0].favorite = 1;
}
return returnList;
};
/*++++++++ FIRST LEVEL INDICATOR DATA +++++++++++++*/
ViewDashboardPresenter.prototype.getIndicatorData = function (indicatorId, indicatorType, initDate, endDate) {
var that = this;
var requestFinished = $.Deferred();
switch (indicatorType) {
case "1010":
this.model.peiData(indicatorId, initDate, endDate)
.done(function(modelData) {
var viewModel = that.peiViewModel(modelData)
requestFinished.resolve(viewModel);
});
break;
case "1030":
this.model.ueiData(indicatorId, initDate, endDate)
.done(function(modelData) {
var viewModel = that.ueiViewModel(modelData)
requestFinished.resolve(viewModel);
});
break;
case "1050":
this.model.statusData(indicatorId)
.done(function(modelData) {
var viewModel = that.statusViewModel(indicatorId, modelData)
requestFinished.resolve(viewModel);
});
break;
default:
this.model.generalIndicatorData(indicatorId, initDate, endDate)
.done(function(modelData) {
var viewModel = that.indicatorViewModel(modelData)
requestFinished.resolve(viewModel);
});
break;
}
return requestFinished.promise();
};
ViewDashboardPresenter.prototype.peiViewModel = function(data) {
var that = this;
var graphData = [];
$.each(data.data, function(index, originalObject) {
var map = {
"name" : "datalabel",
"inefficiencyCost" : "value"
};
var newObject = that.helper.merge(originalObject, {}, map);
var shortLabel = (newObject.datalabel == null)
? ""
: newObject.datalabel.substring(0,15);
newObject.datalabel = shortLabel;
graphData.push(newObject);
originalObject.inefficiencyCostToShow = "$ " + Math.round(originalObject.inefficiencyCost);
originalObject.efficiencyIndexToShow = Math.round(originalObject.efficiencyIndex * 100) / 100;
originalObject.indicatorId = data.id;
originalObject.json = JSON.stringify(originalObject);
});
var retval = {};
retval = data;
graphData.sort(function(a,b) {
var retval = 0;
retval = ((a.value*1.0 <= b.value*1.0) ? 1 : -1);
return retval;
})
retval.dataToDraw = graphData.splice(0,7);
//TODO aumentar el símbolo de moneda $
retval.inefficiencyCostToShow = "$ " +Math.round(retval.inefficiencyCost);
retval.efficiencyIndexToShow = Math.round(retval.efficiencyIndex * 100) / 100;
return retval;
};
ViewDashboardPresenter.prototype.ueiViewModel = function(data) {
var that = this;
var graphData = [];
$.each(data.data, function(index, originalObject) {
var map = {
"name" : "datalabel",
"inefficiencyCost" : "value",
"deviationTime" : "dispersion"
};
var newObject = that.helper.merge(originalObject, {}, map);
var shortLabel = (newObject.datalabel == null)
? ""
: newObject.datalabel.substring(0,7);
newObject.datalabel = shortLabel;
graphData.push(newObject);
originalObject.inefficiencyCostToShow = "$ " + Math.round(originalObject.inefficiencyCost);
originalObject.efficiencyIndexToShow = Math.round(originalObject.efficiencyIndex * 100) / 100;
originalObject.indicatorId = data.id;
originalObject.json = JSON.stringify(originalObject);
});
var retval = {};
retval = data;
graphData.sort(function(a,b) {
var retval = 0;
retval = ((a.value*1.0 <= b.value*1.0) ? 1 : -1);
return retval;
})
retval.dataToDraw = graphData.splice(0,7);
//TODO aumentar el símbolo de moneda $
retval.inefficiencyCostToShow = "$ " + Math.round(retval.inefficiencyCost);
retval.efficiencyIndexToShow = Math.round(retval.efficiencyIndex * 100) / 100;
return retval;
};
ViewDashboardPresenter.prototype.statusViewModel = function(indicatorId, data) {
var that = this;
data.id = indicatorId;
var graph1Data = [];
var graph2Data = [];
var graph3Data = [];
$.each(data.dataList, function(index, originalObject) {
var title = (originalObject.taskTitle == null)
? ""
: originalObject.taskTitle.substring(0,15);
var newObject1 = {
datalabel : title,
value : originalObject.percentageTotalOverdue
};
var newObject2 = {
datalabel : title,
value : originalObject.percentageTotalAtRisk
};
var newObject3 = {
datalabel : title,
value : originalObject.percentageTotalOnTime
};
graph1Data.push(newObject1);
graph2Data.push(newObject2);
graph3Data.push(newObject3);
//we add the indicator id for reference
originalObject.indicatorId = indicatorId;
});
var retval = data;
//TODO selecte de 7 worst cases no the first 7
retval.graph1Data = graph1Data.splice(0,7)
retval.graph2Data = graph2Data.splice(0,7)
retval.graph3Data = graph3Data.splice(0,7)
return retval;
};
ViewDashboardPresenter.prototype.indicatorViewModel = function(data) {
var that = this;
$.each(data.graph1Data, function(index, originalObject) {
var label = (('YEAR' in originalObject) ? originalObject.YEAR : "") ;
label += (('MONTH' in originalObject) ? "/" + originalObject.MONTH : "") ;
label += (('QUARTER' in originalObject) ? "/" + originalObject.QUARTER : "");
label += (('SEMESTER' in originalObject) ? "/" + originalObject.SEMESTER : "");
originalObject.datalabel = label;
});
$.each(data.graph2Data, function(index, originalObject) {
var label = (('YEAR' in originalObject) ? originalObject.YEAR : "") ;
label += (('MONTH' in originalObject) ? "/" + originalObject.MONTH : "") ;
label += (('QUARTER' in originalObject) ? "/" + originalObject.QUARTER : "");
label += (('SEMESTER' in originalObject) ? "/" + originalObject.SEMESTER : "") ;
originalObject.datalabel = label;
});
return data;
};
/*-------FIRST LEVEL INDICATOR DATA */
/*++++++++ SECOND LEVEL INDICATOR DATA +++++++++++++*/
ViewDashboardPresenter.prototype.getSpecialIndicatorSecondLevel = function (entityId, indicatorType, initDate, endDate) {
var that = this;
var requestFinished = $.Deferred();
//if modelData is passed (because it was cached on the view) no call is made to the server.
//and just a order is applied to the list
switch (indicatorType) {
case "1010":
this.model.peiDetailData(entityId, initDate, endDate)
.done(function (modelData) {
var viewModel = that.returnIndicatorSecondLevelPei(modelData);
requestFinished.resolve(viewModel);
});
break;
case "1030":
this.model.ueiDetailData(entityId, initDate, endDate)
.done(function (modelData) {
var viewModel = that.returnIndicatorSecondLevelUei(modelData);
requestFinished.resolve(viewModel);
});
break;
default:
throw new Error("Indicator type " + indicatorType + " has not detail data implemented of special indicator kind.");
}
return requestFinished.promise();
};
ViewDashboardPresenter.prototype.returnIndicatorSecondLevelPei = function(modelData) {
//modelData arrives in format [{users/tasks}]
//returns object {dataToDraw[], entityData[] //user/tasks data}
var that = this;
var graphData = [];
$.each(modelData, function(index, originalObject) {
var map = {
"name" : "datalabel",
"averageTime" : "value",
"deviationTime" : "dispersion"
};
var newObject = that.helper.merge(originalObject, {}, map);
newObject.datalabel = ((newObject.datalabel == null) ? "" : newObject.datalabel.substring(0, 7));
originalObject.inefficiencyCostToShow = "$ " + Math.round(originalObject.inefficiencyCost);
originalObject.efficiencyIndexToShow = Math.round(originalObject.efficiencyIndex * 100) / 100;
graphData.push(newObject);
});
var retval = {};
retval.dataToDraw = graphData.splice(0,7);
retval.entityData = modelData;
return retval;
};
ViewDashboardPresenter.prototype.returnIndicatorSecondLevelUei = function(modelData) {
//modelData arrives in format [{users/tasks}]
//returns object {dataToDraw[], entityData[] //user/tasks data}
var that = this;
var graphData = [];
$.each(modelData, function(index, originalObject) {
var map = {
"name" : "datalabel",
"averageTime" : "value",
"deviationTime" : "dispersion"
};
var newObject = that.helper.merge(originalObject, {}, map);
newObject.datalabel = ((newObject.datalabel == null) ? "" : newObject.datalabel.substring(0, 7));
originalObject.inefficiencyCostToShow = "$ " +Math.round(originalObject.inefficiencyCost);
originalObject.efficiencyIndexToShow = Math.round(originalObject.efficiencyIndex * 100) / 100;
graphData.push(newObject);
});
var retval = {};
retval.dataToDraw = graphData.splice(0,7);
retval.entityData = modelData;
return retval;
};
/*-------SECOND LEVEL INDICATOR DATA*/
ViewDashboardPresenter.prototype.orderDataList = function(listData, orderDirection, orderFunction) {
//orderDirection is passed in case no order FUnction is passed (to use in the default ordering)
var orderToUse = orderFunction;
if (orderFunction == undefined) {
orderToUse = function (a ,b) {
var retval = 0;
if (orderDirection == "down") {
retval = ((a.inefficiencyCost*1.0 <= b.inefficiencyCost*1.0) ? 1 : -1);
}
else {
//the 1,-1 are flipped
retval = ((a.inefficiencyCost*1.0 <= b.inefficiencyCost*1.0) ? -1 : 1);
}
return retval;
}
}
return listData.sort(orderToUse);
}

View File

@@ -0,0 +1,904 @@
/**************************************************************/
var WidgetBuilder = function () {
this.helper = new ViewDashboardHelper();
}
WidgetBuilder.prototype.getIndicatorWidget = function (indicator) {
var retval = null;
switch(indicator.type) {
case "1010": retval = this.buildSpecialIndicatorButton(indicator); break;
case "1030": retval = this.buildSpecialIndicatorButton(indicator); break;
case "1050": retval = this.buildStatusIndicatorButton(indicator); break;
case "1020":
case "1040":
case "1060":
case "1070":
case "1080":
retval = this.buildIndicatorButton(indicator); break;
}
if(retval == null) {throw new Error(indicator.type + " has not associated a widget.");}
return retval;
};
WidgetBuilder.prototype.buildSpecialIndicatorButton = function (indicator) {
_.templateSettings.variable = "indicator";
var template = _.template ($("script.specialIndicatorButtonTemplate").html());
var $retval = $(template(indicator));
if(indicator.comparative < 0){
$retval.find(".ind-container-selector").removeClass("panel-green").addClass("panel-red");
$retval.find(".ind-symbol-selector").removeClass("fa-chevron-up").addClass("fa-chevron-down");
}
if(indicator.comparative > 0){
$retval.find(".ind-container-selector").removeClass("panel-red").addClass("panel-green");
$retval.find(".ind-symbol-selector").removeClass("fa-chevron-down").addClass("fa-chevron-up");
}
if(indicator.comparative == 0){
$retval.find(".ind-symbol-selector").removeClass("fa-chevron-up");
$retval.find(".ind-symbol-selector").removeClass("fa-chevron-down");
$retval.find(".ind-symbol-selector").addClass("fa-circle-o");
$retval.find(".ind-container-selector").removeClass("panel-red").addClass("panel-green");
}
return $retval;
}
WidgetBuilder.prototype.buildStatusIndicatorButton = function (indicator) {
_.templateSettings.variable = "indicator";
var template = _.template ($("script.statusIndicatorButtonTemplate").html());
var $retval = $(template(indicator));
return $retval;
}
WidgetBuilder.prototype.buildIndicatorButton = function (indicator) {
_.templateSettings.variable = "indicator";
var template = _.template ($("script.statusIndicatorButtonTemplate").html());
var $retval = $(template(indicator));
var $comparative = $retval.find('.ind-comparative-selector');
var $title = $retval.find('.ind-title-selector');
if (indicator.isWellDone) {
$comparative.text("(" + indicator.directionSymbol + " " + indicator.comparative + "%)-"+ G_STRING.ID_WELL_DONE);
$retval.find(".ind-container-selector").removeClass("panel-low").addClass("panel-high");
}
else {
$comparative.text("Goal: " + indicator.directionSymbol + " " + indicator.comparative + "%");
$retval.find(".ind-container-selector").removeClass("panel-high").addClass("panel-low");
}
return $retval;
}
WidgetBuilder.prototype.buildSpecialIndicatorFirstView = function (indicatorData) {
if (indicatorData == null) { throw new Error ("indicatorData is null."); }
if (!indicatorData.hasOwnProperty("id")) { throw new Error ("indicatorData has no id."); }
_.templateSettings.variable = "indicator";
var template = _.template ($("script.specialIndicatorMainPanel").html());
var $retval = $(template(indicatorData));
var indicatorPrincipalData = this.getIndicatorLoadedById(indicatorData.id)
$retval.find('.breadcrumb').find('li').remove()
$retval.find('.breadcrumb').append ('<li><b>'+indicatorPrincipalData.title+'</b></li>')
$retval.find(".sind-index-selector").text(G_STRING.ID_EFFICIENCY_INDEX);
$retval.find(".sind-cost-selector").text(G_STRING.ID_INEFFICIENCY_COST);
this.setColorForInefficiency($retval.find(".sind-cost-number-selector"), indicatorData);
return $retval;
}
WidgetBuilder.prototype.buildSpecialIndicatorFirstViewDetail = function (oneItemDetail) {
//detailData = {indicatorId, uid, name, averateTime...}
if (oneItemDetail == null){throw new Error("oneItemDetail is null ");}
if (!typeof(oneItemDetail) === 'object'){throw new Error( "detailData is not and object ->" + oneItemDetail);}
if (!oneItemDetail.hasOwnProperty("name")){throw new Error("buildSpecialIndicatorFirstViewDetail -> detailData has not the name param. Has it the correct Type? ->" + oneItemDetail);}
_.templateSettings.variable = "detailData";
var template = _.template ($("script.specialIndicatorDetail").html());
var $retval = $(template(oneItemDetail));
$retval.find(".detail-efficiency-selector").text(G_STRING.ID_EFFICIENCY_INDEX);
$retval.find(".detail-cost-selector").text(G_STRING.ID_INEFFICIENCY_COST);
this.setColorForInefficiency($retval.find(".detail-cost-number-selector"), oneItemDetail);
return $retval;
}
WidgetBuilder.prototype.buildStatusIndicatorFirstView = function (indicatorData) {
if (indicatorData == null) { throw new Error ("indicatorData is null."); }
if (!indicatorData.hasOwnProperty("id")) { throw new Error ("indicatorData has no id."); }
_.templateSettings.variable = "indicator";
var template = _.template ($("script.statusIndicatorMainPanel").html());
var $retval = $(template(indicatorData));
var indicatorPrincipalData = this.getIndicatorLoadedById(indicatorData.id)
$retval.find('.breadcrumb').find('li').remove()
$retval.find('.breadcrumb').append ('<li><b>'+indicatorPrincipalData.title+'</b></li>')
return $retval;
}
WidgetBuilder.prototype.buildStatusIndicatorFirstViewDetail = function (oneItemDetail) {
//detailData = {indicatorId, uid, name, averateTime...}
if (oneItemDetail == null){throw new Error("oneItemDetail is null ");}
if (!typeof(oneItemDetail) === 'object'){throw new Error( "detailData is not and object ->" + oneItemDetail);}
if (!oneItemDetail.hasOwnProperty("taskTitle")){throw new Error("detailData has not the name param. Has it the correct Type? ->" + oneItemDetail);}
_.templateSettings.variable = "detailData";
var template = _.template ($("script.statusDetail").html());
var $retval = $(template(oneItemDetail));
return $retval;
}
WidgetBuilder.prototype.buildSpecialIndicatorSecondView = function (secondViewData) {
//presenterData= object {dataToDraw[], entityData[] //user/tasks data}
_.templateSettings.variable = "indicator";
var template = _.template ($("script.specialIndicatorMainPanel").html());
var $retval = $(template(window.currentEntityData));
//var indicatorPrincipalData = this.getIndicatorLoadedById(indicatorId);
//$retval.find(".sind-title-selector").text(indicatorPrincipalData.title);
$retval.find(".sind-index-selector").text(G_STRING.ID_EFFICIENCY_INDEX);
$retval.find(".sind-cost-selector").text(G_STRING.ID_INEFFICIENCY_COST);
$retval.find('.breadcrumb').find('li').remove();
$retval.find('.breadcrumb').append ('<li><a class="bread-back-selector" href="#"><i class="fa fa-chevron-left fa-fw"></i>' + window.currentIndicator.title + '</a></li>');
$retval.find('.breadcrumb').append ('<li><b>' + window.currentEntityData.name + '</b></li>');
this.setColorForInefficiency($retval.find(".sind-cost-number-selector"), window.currentEntityData);
return $retval;
};
WidgetBuilder.prototype.buildSpecialIndicatorSecondViewDetail = function (oneItemDetail) {
if (oneItemDetail == null){throw new Error("oneItemDetail is null ");}
if (!typeof(oneItemDetail) === 'object'){throw new Error( "detailData is not and object ->" + oneItemDetail);}
if (!oneItemDetail.hasOwnProperty("name")){throw new Error("buildSpecialIndicatorFirstViewDetail -> detailData has not the name param. Has it the correct Type? ->" + oneItemDetail);}
_.templateSettings.variable = "detailData";
var template = _.template ($("script.specialIndicatorSencondViewDetail").html());
var $retval = $(template(oneItemDetail));
$retval.find(".detail-efficiency-selector").text(G_STRING.ID_EFFICIENCY_INDEX);
$retval.find(".detail-cost-selector").text(G_STRING.ID_INEFFICIENCY_COST);
this.setColorForInefficiency($retval.find(".detail-cost-number-selector"), oneItemDetail);
return $retval;
}
WidgetBuilder.prototype.getIndicatorLoadedById = function (searchedIndicatorId) {
var retval = null;
for (key in window.loadedIndicators) {
var indicator = window.loadedIndicators[key];
if (indicator.id == searchedIndicatorId) {
retval = indicator;
}
}
if (retval == null) { throw new Error(searchedIndicatorId + " was not found in the loaded indicators.");}
return retval;
}
WidgetBuilder.prototype.buildGeneralIndicatorFirstView = function (indicatorData) {
_.templateSettings.variable = "indicator";
var template = _.template ($("script.generalIndicatorMainPanel").html());
var $retval = $(template(indicatorData));
$retval.find(".ind-title-selector").text(window.currentIndicator.title);
return $retval;
}
WidgetBuilder.prototype.setColorForInefficiency = function ($widget, indicatorData) {
//turn red/gree the font according if is positive or negative: var $widget = $retval.find(".sind-cost-number-selector");
$widget.removeClass("red");
$widget.removeClass("green");
if (indicatorData.inefficiencyCost >= 0) {
$widget.addClass("green");
}
else {
$widget.addClass("red");
}
}
/**********************************************************************/
helper = new ViewDashboardHelper();
var ws = urlProxy.split('/');
model = new ViewDashboardModel(token, urlProxy, ws[3]);
presenter = new ViewDashboardPresenter(model);
window.loadedIndicators = []; //updated in das-title-selector.click->fillIndicatorWidgets, ready->fillIndicatorWidgets
window.currentEntityData = null;
window.currentIndicator = null;//updated in ind-button-selector.click ->loadIndicator, ready->loadIndicator
window.currentDashboardId = null;
window.currentDetailFunction = null;
window.currentDetailList = null;
$(document).ready(function() {
$('#indicatorsGridStack').gridstack();
$('#indicatorsDataGridStack').gridstack();
$('#relatedDetailGridStack').gridstack();
$('#sortListButton').click(function() {
var btn = $(this);
if (btn.hasClass('fa-chevron-up')) {
btn.removeClass('fa-chevron-up');
btn.addClass('fa-chevron-down');
}
else {
btn.removeClass('fa-chevron-down');
btn.addClass('fa-chevron-up');
}
window.currentDetailFunction (presenter.orderDataList (
window.currentDetailList,
selectedOrderOfDetailList()));
//send scroll +1 and -1 to activate the show/hide event.
//both scrolls are sent cause if the scroll at the end
//scroll +1 has no effect but -1 yes
$(window).scrollTop($(window).scrollTop() + 1);
$(window).scrollTop($(window).scrollTop() - 1);
return false;
});
/* Show on scroll functionality */
$(window).scroll( function() {
/* Check the location of each desired element */
$('.hideme').each( function(i){
var bottom_of_object = $(this).offset().top + $(this).outerHeight();
var bottom_of_window = $(window).scrollTop() + $(window).height();
/* If the object is completely visible in the window, fade it in */
if (bottom_of_window + 100 > bottom_of_object) {
$(this).animate({'opacity':'1'}, 500);
$(this).removeClass('hideme');
}
});
hideScrollIfAllDivsAreVisible();
});
var isHover = false;
$('#scrollImg').mouseover(function() {
isHover = true;
var interval = window.setInterval(function () {
var newPos = $(window).scrollTop() + 100;
$(window).scrollTop(newPos);
if (isHover == false) {
window.clearInterval(interval);
}
}, 200);
});
$('#scrollImg').mouseleave(function() {
isHover = false;
});
//When some item is moved
$('.grid-stack').on('change', function (e, items) {
var widgets = [];
_.map($('.grid-stack .grid-stack-item:visible'), function (el) {
el = $(el);
var item = el.data('_gridstack_node');
var idWidGet = el.data("indicator-id");
/*if(favorite == actualDashId){
favoriteData = 1;
} else {
favoriteData = 0;
}*/
if (typeof idWidGet != "undefined") {
var widgetsObj = {
'indicatorId': idWidGet,
'x': item.x,
'y': item.y,
'width': item.width,
'height': item.height <= 1 ? 2 : item.height
}
widgets.push(widgetsObj);
}
});
var favoriteDasbhoardId = $('.das-icon-selector.selected').parent().data('dashboard-id');
if (favoriteDasbhoardId == null || favoriteDasbhoardId == 'undefined') {throw new Error ('No favorite dashboard detected');}
if (widgets.length != 0) {
var dashboard = {
'dashId': window.currentDashboardId,
'dashFavorite': ((window.currentDashboardId == favoriteDasbhoardId) ? 1 : 0),
'dashData': widgets
}
model.setPositionIndicator(dashboard);
}
});
$('body').on('click', '.das-icon-selector', function() {
var dashboardId = $(this).parent().data('dashboard-id');
$('.das-icon-selector').removeClass("selected");
$(this).addClass('selected');
var dashboard = {
'dashId': dashboardId,
'dashFavorite': 1,
'dashData': ''
}
model.setPositionIndicator(dashboard);
});
/*-------------------------------clicks----------------------------*/
$('body').on('click','.btn-compare', function() {
presenter.getDashboardIndicators(window.currentDashboardId, defaultInitDate(), defaultEndDate())
.done(function(indicatorsVM) {
fillIndicatorWidgets(indicatorsVM);
loadIndicator(getFavoriteIndicator().id, defaultInitDate(), defaultEndDate());
});
});
$('#dashboardsList').on('click','.das-title-selector', function() {
var dashboardId = $(this).parent().data('dashboard-id');
window.currentDashboardId = dashboardId;
presenter.getDashboardIndicators(dashboardId, defaultInitDate(), defaultEndDate())
.done(function(indicatorsVM) {
fillIndicatorWidgets(indicatorsVM);
//TODO use real data
loadIndicator(getFavoriteIndicator().id, defaultInitDate(), defaultEndDate());
});
});
$('#indicatorsGridStack').on('click','.ind-button-selector', function() {
var indicatorId = $(this).data('indicator-id');
//TODO use real data
loadIndicator(indicatorId, defaultInitDate(), defaultEndDate());
});
$('body').on('click','.bread-back-selector', function() {
var indicatorId = window.currentIndicator.id;
//TODO use real data
loadIndicator(indicatorId, defaultInitDate(), defaultEndDate());
return false;
});
$('#relatedDetailGridStack').on('click','.detail-button-selector', function() {
var detailId = $(this).data('detail-id');
window.currentEntityData = {"entityId":$(this).data('detail-id'),
"indicatorId":$(this).data('indicator-id'),
"efficiencyIndexToShow":$(this).data('detail-index'),
"inefficiencyCostToShow":$(this).data('detail-cost-to-show'),
"inefficiencyCost":$(this).data('detail-cost'),
"name":$(this).data('detail-name')
};
//TODO PASS REAL VALUES
presenter.getSpecialIndicatorSecondLevel(detailId, window.currentIndicator.type, defaultInitDate(), defaultEndDate())
.done(function (viewModel) {
fillSpecialIndicatorSecondView(viewModel);
});
});
initialDraw();
});
var hideScrollIfAllDivsAreVisible = function(){
if ($('.hideme').length <= 0) {
$('#scrollImg').hide();
}
else {
$('#scrollImg').show();
}
}
var selectedOrderOfDetailList = function () {
return ($('#sortListButton').hasClass('fa-chevron-up') ? "up" : "down");
}
var initialDraw = function () {
presenter.getUserDashboards(pageUserId)
.then(function(dashboardsVM) {
fillDashboardsList(dashboardsVM);
/**** window initialization with favorite dashboard*****/
presenter.getDashboardIndicators(window.currentDashboardId, defaultInitDate(), defaultEndDate())
.done(function(indicatorsVM) {
fillIndicatorWidgets(indicatorsVM);
loadIndicator(getFavoriteIndicator().id, defaultInitDate(), defaultEndDate());
});
});
}
var loadIndicator = function (indicatorId, initDate, endDate) {
var builder = new WidgetBuilder();
window.currentIndicator = builder.getIndicatorLoadedById(indicatorId);
presenter.getIndicatorData(indicatorId, window.currentIndicator.type, initDate, endDate)
.done(function (viewModel) {
switch (window.currentIndicator.type) {
case "1010":
case "1030":
fillSpecialIndicatorFirstView(viewModel);
break;
case "1050":
fillStatusIndicatorFirstView(viewModel);
break;
default:
fillGeneralIndicatorFirstView(viewModel);
break;
}
});
}
var setIndicatorActiveMarker = function () {
$('.panel-footer').each (function () {
$(this).removeClass('panel-active');
var indicatorId = $(this).parents('.ind-button-selector').data('indicator-id');
if (window.currentIndicator.id == indicatorId) {
$(this).addClass('panel-active');
}
});
}
var getFavoriteIndicator = function() {
var retval = (window.loadedIndicators.length > 0)
? window.loadedIndicators[0]
: null;
for (key in window.loadedIndicators) {
var indicator = window.loadedIndicators[key];
if (indicator.favorite == 1) {
retval = indicator;
}
}
if (retval==null) {throw new Error ('No favorites found.');}
return retval;
}
var defaultInitDate = function() {
var date = new Date();
var dateMonth = date.getMonth();
var dateYear = date.getFullYear();
var initDate = $('#year').val() + '-' + $('#month').val() + '-' + '01';
return initDate;
}
var defaultEndDate = function () {
var date = new Date();
var dateMonth = date.getMonth();
var dateYear = date.getFullYear();
return dateYear + "-" + (dateMonth + 1) + "-30";
}
var fillDashboardsList = function (presenterData) {
if (presenterData == null || presenterData.length == 0) {
$('#dashboardsList').append(G_STRING['ID_NO_DATA_TO_DISPLAY']);
}
_.templateSettings.variable = "dashboard";
var template = _.template ($("script.dashboardButtonTemplate").html())
for (key in presenterData) {
var dashboard = presenterData[key];
$('#dashboardsList').append(template(dashboard));
if (dashboard.isFavorite == 1) {
window.currentDashboardId = dashboard.id;
$('#dashboardButton-' + dashboard.id)
.find('.das-icon-selector')
.addClass('selected');
}
}
};
var fillIndicatorWidgets = function (presenterData) {
var widgetBuilder = new WidgetBuilder();
var grid = $('#indicatorsGridStack').data('gridstack');
grid.remove_all();
window.loadedIndicators = presenterData;
$.each(presenterData, function(key, indicator) {
var $widget = widgetBuilder.getIndicatorWidget(indicator);
grid.add_widget($widget, indicator.toDrawX, indicator.toDrawY, indicator.toDrawWidth, indicator.toDrawHeight, true);
//TODO will exist animation?
/*if (indicator.category == "normal") {
animateProgress(indicator, $widget);
}*/
var $title = $widget.find('.ind-title-selector');
if (indicator.favorite == "1") {
$title.addClass("panel-active");
}
});
}
var fillStatusIndicatorFirstView = function (presenterData) {
var widgetBuilder = new WidgetBuilder();
var panel = $('#indicatorsDataGridStack').data('gridstack');
panel.remove_all();
$('#relatedDetailGridStack').data('gridstack').remove_all();
var $widget = widgetBuilder.buildStatusIndicatorFirstView(presenterData);
panel.add_widget($widget, 0, 15, 20, 4.7, true);
var graphParams1 = {
canvas : {
containerId:'graph1',
width:300,
height:300,
stretch:true
},
graph: {
allowDrillDown:false,
allowTransition:true,
showTip: true,
allowZoom: false,
gapWidth:0.2,
useShadows: true,
thickness: 30,
showLabels: true,
colorPalette: ['#5486bf','#bf8d54','#acb30c','#7a0c0c','#bc0000','#906090','#007efb','#62284a','#0c7a7a']
}
};
var graph1 = new PieChart(presenterData.graph1Data, graphParams1, null, null);
graph1.drawChart();
var graphParams2 = graphParams1;
graphParams2.canvas.containerId = "graph2";
var graph2 = new PieChart(presenterData.graph2Data, graphParams2, null, null);
graph2.drawChart();
var graphParams3 = graphParams1;
graphParams3.canvas.containerId = "graph3";
var graph3 = new PieChart(presenterData.graph3Data, graphParams3, null, null);
graph3.drawChart();
var indicatorPrincipalData = widgetBuilder.getIndicatorLoadedById(presenterData.id)
setIndicatorActiveMarker();
}
var fillStatusIndicatorFirstViewDetail = function(presenterData) {
var widgetBuilder = new WidgetBuilder();
var gridDetail = $('#relatedDetailGridStack').data('gridstack');
//gridDetail.remove_all();
$.each(presenterData.dataList, function(index, dataItem) {
var $widget = widgetBuilder.buildStatusIndicatorFirstViewDetail(dataItem);
var x = (index % 2 == 0) ? 6 : 0;
gridDetail.add_widget($widget, x, 15, 6, 2, true);
});
if (window.currentIndicator.type == "1010") {
$('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_PROCESS']);
}
if (window.currentIndicator.type == "1030") {
$('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_GROUPS']);
}
if (window.currentIndicator.type == "1050") {
$('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_PROCESS']);
}
}
var fillSpecialIndicatorFirstView = function(presenterData) {
var widgetBuilder = new WidgetBuilder();
var panel = $('#indicatorsDataGridStack').data('gridstack');
panel.remove_all();
$('#relatedDetailGridStack').data('gridstack').remove_all();
var $widget = widgetBuilder.buildSpecialIndicatorFirstView(presenterData);
panel.add_widget($widget, 0, 15, 20, 4.7, true);
var peiParams = {
canvas : {
containerId:'specialIndicatorGraph',
width:300,
height:300,
stretch:true
},
graph: {
allowDrillDown:false,
allowTransition:true,
showTip: true,
allowZoom: false,
gapWidth:0.3,
useShadows: true,
thickness: 30,
showLabels: true,
colorPalette: ['#5486bf','#bf8d54','#acb30c','#7a0c0c','#bc0000','#906090','#007efb','#62284a','#0c7a7a']
}
};
var ueiParams = {
canvas : {
containerId:'specialIndicatorGraph',
width:500,
height:300,
stretch:true
},
graph: {
allowDrillDown:false,
allowTransition:true,
axisX:{ showAxis: true, label: G_STRING.ID_YEAR },
axisY:{ showAxis: true, label: "Q" },
gridLinesX:false,
gridLinesY:true,
showTip: true,
allowZoom: false,
useShadows: true,
paddingTop: 50,
colorPalette: ['#5486bf','#bf8d54','#acb30c','#7a0c0c','#bc0000','#906090','#007efb','#62284a','#0c7a7a','#74a9a9']
}
};
var indicatorPrincipalData = widgetBuilder.getIndicatorLoadedById(presenterData.id)
if (indicatorPrincipalData.type == "1010") {
var graph = new Pie3DChart(presenterData.dataToDraw, peiParams, null, null);
graph.drawChart();
//the pie chart goes to much upwards,so a margin is added:
$('#specialIndicatorGraph').css('margin-top','60px');
}
if (indicatorPrincipalData.type == "1030") {
var graph = new BarChart(presenterData.dataToDraw, ueiParams, null, null);
graph.drawChart();
}
this.fillSpecialIndicatorFirstViewDetail(presenter.orderDataList(presenterData.data, selectedOrderOfDetailList()));
setIndicatorActiveMarker();
}
var fillSpecialIndicatorFirstViewDetail = function (list) {
//presenterData = { id: "indId", efficiencyIndex: "0.11764706", efficiencyVariation: -0.08235294,
// inefficiencyCost: "-127.5000", inefficiencyCostToShow: -127, efficiencyIndexToShow: 0.12
// data: {indicatorId, uid, name, averateTime...}, dataToDraw: [{datalabe, value}] }
var widgetBuilder = new WidgetBuilder();
var gridDetail = $('#relatedDetailGridStack').data('gridstack');
gridDetail.remove_all();
window.currentDetailList = list;
window.currentDetailFunction = fillSpecialIndicatorFirstViewDetail;
$.each(list, function(index, dataItem) {
var $widget = widgetBuilder.buildSpecialIndicatorFirstViewDetail(dataItem);
var x = (index % 2 == 0) ? 6 : 0;
//the first 2 elements are not hidden
if (index < 2) {
$widget.removeClass("hideme");
}
gridDetail.add_widget($widget, x, 15, 6, 2, true);
});
if (window.currentIndicator.type == "1010") {
$('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_PROCESS']);
}
if (window.currentIndicator.type == "1030") {
$('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_GROUPS']);
}
hideScrollIfAllDivsAreVisible();
}
var fillSpecialIndicatorSecondView = function(presenterData) {
//presenterData= object {dataToDraw[], entityData[] //user/tasks data}
var widgetBuilder = new WidgetBuilder();
var panel = $('#indicatorsDataGridStack').data('gridstack');
panel.remove_all();
var $widget = widgetBuilder.buildSpecialIndicatorSecondView(presenterData);
panel.add_widget($widget, 0, 15, 20, 4.7, true);
var detailParams = {
canvas : {
containerId:'specialIndicatorGraph',
width:300,
height:300,
stretch:true
},
graph: {
allowTransition: false,
allowDrillDown: true,
showTip: true,
allowZoom: false,
useShadows: false,
gridLinesX: true,
gridLinesY: true,
area: {visible: false, css:"area"},
axisX:{ showAxis: true, label: G_STRING.ID_USERS },
axisY:{ showAxis: true, label: G_STRING.ID_TIME_HOURS },
showErrorBars: true
}
};
var indicatorPrincipalData = widgetBuilder.getIndicatorLoadedById(window.currentEntityData.indicatorId);
if (window.currentIndicator.type == "1010") {
var graph = new BarChart(presenterData.dataToDraw, detailParams, null, null);
graph.drawChart();
}
if (window.currentIndicator.type == "1030") {
var graph = new BarChart(presenterData.dataToDraw, detailParams, null, null);
graph.drawChart();
}
this.fillSpecialIndicatorSecondViewDetail(presenter.orderDataList(presenterData.entityData, selectedOrderOfDetailList()));
}
var fillSpecialIndicatorSecondViewDetail = function (list) {
//presenterData = { entityData: Array[{name,uid,inefficiencyCost,
// inefficiencyIndex, deviationTime,
// averageTime}],
// dataToDraw: Array[{datalabel, value}] }
var widgetBuilder = new WidgetBuilder();
var gridDetail = $('#relatedDetailGridStack').data('gridstack');
gridDetail.remove_all();
window.currentDetailList = list;
window.currentDetailFunction = fillSpecialIndicatorSecondViewDetail;
$.each(list, function(index, dataItem) {
var $widget = widgetBuilder.buildSpecialIndicatorSecondViewDetail(dataItem);
var x = (index % 2 == 0) ? 6 : 0;
//the first 2 elements are not hidden
if (index < 2) {
$widget.removeClass("hideme");
}
gridDetail.add_widget($widget, x, 15, 6, 2, true);
});
if (window.currentIndicator.type == "1010") {
$('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_TASKS']);
}
if (window.currentIndicator.type == "1030") {
$('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_USERS']);
}
hideScrollIfAllDivsAreVisible();
}
var fillGeneralIndicatorFirstView = function (presenterData) {
var widgetBuilder = new WidgetBuilder();
var panel = $('#indicatorsDataGridStack').data('gridstack');
panel.remove_all();
$('#relatedDetailGridStack').data('gridstack').remove_all();
var $widget = widgetBuilder.buildGeneralIndicatorFirstView(presenterData);
panel.add_widget($widget, 0, 15, 20, 4.7, true);
$('#relatedLabel').find('h3').text('');
var generalLineParams1 = {
canvas : {
containerId:'generalGraph1',
width:300,
height:300,
stretch:true
},
graph: {
allowTransition: false,
allowDrillDown: true,
showTip: true,
allowZoom: false,
useShadows: false,
gridLinesX: true,
gridLinesY: true,
area: {visible: false, css:"area"},
axisX:{ showAxis: true, label: G_STRING.ID_PROCESS_TASKS },
axisY:{ showAxis: true, label: G_STRING.ID_TIME_HOURS },
showErrorBars: false
}
};
var generalLineParams2 = {
canvas : {
containerId:'generalGraph2',
width:300,
height:300,
stretch:true
},
graph: {
allowTransition: false,
allowDrillDown: true,
showTip: true,
allowZoom: false,
useShadows: false,
gridLinesX: true,
gridLinesY: true,
area: {visible: false, css:"area"},
axisX:{ showAxis: true, label: G_STRING.ID_PROCESS_TASKS },
axisY:{ showAxis: true, label: G_STRING.ID_TIME_HOURS },
showErrorBars: false
}
};
var generalBarParams1 = {
canvas : {
containerId:'generalGraph1',
width:300,
height:300,
stretch:true
},
graph: {
allowDrillDown:false,
allowTransition:true,
axisX:{ showAxis: true, label: G_STRING.ID_YEAR },
axisY:{ showAxis: true, label: "Q" },
gridLinesX:false,
gridLinesY:true,
showTip: true,
allowZoom: false,
useShadows: true,
paddingTop: 50,
colorPalette: ['#5486bf','#bf8d54','#acb30c','#7a0c0c','#bc0000','#906090','#007efb','#62284a','#0c7a7a','#74a9a9']
}
};
var generalBarParams2 = {
canvas : {
containerId:'generalGraph2',
width:300,
height:300,
stretch:true
},
graph: {
allowDrillDown:false,
allowTransition:true,
axisX:{ showAxis: true, label: G_STRING.ID_YEAR },
axisY:{ showAxis: true, label: "Q" },
gridLinesX:false,
gridLinesY:true,
showTip: true,
allowZoom: false,
useShadows: true,
paddingTop: 50,
colorPalette: ['#5486bf','#bf8d54','#acb30c','#7a0c0c','#bc0000','#906090','#007efb','#62284a','#0c7a7a','#74a9a9']
}
};
var graph1 = null;
if (presenterData.graph1Type == '10') {
generalBarParams1.graph.axisX.label = presenterData.graph1XLabel;
generalBarParams1.graph.axisY.label = presenterData.graph1YLabel;
graph1 = new BarChart(presenterData.graph1Data, generalBarParams1, null, null);
} else {
generalLineParams1.graph.axisX.label = presenterData.graph1XLabel;
generalLineParams1.graph.axisY.label = presenterData.graph1YLabel;
graph1 = new LineChart(presenterData.graph1Data, generalLineParams1, null, null);
}
graph1.drawChart();
var graph2 = null;
if (presenterData.graph2Type == '10') {
generalBarParams2.graph.axisX.label = presenterData.graph2XLabel;
generalBarParams2.graph.axisY.label = presenterData.graph2YLabel;
graph2 = new BarChart(presenterData.graph2Data, generalBarParams2, null, null);
} else {
generalLineParams2.graph.axisX.label = presenterData.graph2XLabel;
generalLineParams2.graph.axisY.label = presenterData.graph2YLabel;
graph2 = new LineChart(presenterData.graph2Data, generalLineParams2, null, null);
}
graph2.drawChart();
setIndicatorActiveMarker();
}
var animateProgress = function (indicatorItem, widget){
var getRequestAnimationFrame = function () {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function ( callback ){
window.setTimeout(enroute, 1 / 60 * 1000);
};
};
var fpAnimationFrame = getRequestAnimationFrame();
var i = 0;
var j = 0;
var indicator = indicatorItem;
var animacion = function () {
var intComparative = parseInt(indicator.comparative);
var divId = "#indicatorButton" + indicator.id;
var $valueLabel = widget
.find('.ind-value-selector');
var $progressBar = widget
.find('.ind-progress-selector');
if (!($valueLabel.length > 0)) {throw new Error ('"No ind-value-selector found for " + divId');}
this.helper.assert($progressBar.length > 0, "No ind-progress-selector found for " + divId);
$progressBar.attr('aria-valuemax', intComparative);
var indexToPaint = Math.min(indicator.value * 100 / intComparative, 100);
if (i <= indexToPaint) {
$progressBar.css('width', i+'%').attr('aria-valuenow', i);
i++;
fpAnimationFrame(animacion);
}
if(j <= indicator.value){
$valueLabel.text(j + "%");
j++;
fpAnimationFrame(animacion);
}
}
fpAnimationFrame(animacion);
};
/*var dashboardButtonTemplate = ' <div class="btn-group pull-left"> \
<button id="favorite" type="button" class="btn btn-success"><i class="fa fa-star fa-1x"></i></button> \
<button id="dasB" type="button" class="btn btn-success">'+ G_STRING.ID_MANAGERS_DASHBOARDS +'</button> \
</div>';*/

View File

@@ -908,7 +908,7 @@ try {
$daysSelected = "selected = 'selected'";
}
$sAux = '<select name=' . $hiddenName . '[NEXT_TASK][TAS_TIMEUNIT] id= ' . $hiddenName . '[NEXT_TASK][TAS_TIMEUNIT] ';
$sAux = '<select name=' . $hiddenName . '[NEXT_TASK][TAS_TIMEUNIT] id= ' . $hiddenName . '[NEXT_TASK][TAS_TIMEUNIT] >';
$sAux .= "<option " . $hoursSelected . " value='HOURS'>Hours</option> ";
$sAux .= "<option " . $daysSelected . " value='DAYS'>Days</option> ";
$sAux .= '</select>';
@@ -921,7 +921,7 @@ try {
$calendarSelected = "selected = 'selected'";
}
$sAux = '<select name=' . $hiddenName . '[NEXT_TASK][TAS_TYPE_DAY] id= ' . $hiddenName . '[NEXT_TASK][TAS_TYPE_DAY] ';
$sAux = '<select name=' . $hiddenName . '[NEXT_TASK][TAS_TYPE_DAY] id= ' . $hiddenName . '[NEXT_TASK][TAS_TYPE_DAY] >';
$sAux .= "<option " . $workSelected . " value='1'>Work Days</option> ";
$sAux .= "<option " . $calendarSelected . " value='2'>Calendar Days</option> ";
$sAux .= '</select>';

View File

@@ -1,6 +1,7 @@
<?php
$DYN_UID = $_GET["dyn_uid"];
$_SESSION['PROCESS'] = $_GET["prj_uid"];
G::LoadClass('pmDynaform');
$a = new pmDynaform(array("CURRENT_DYNAFORM" => $DYN_UID));
$a->printPmDynaform();

View File

@@ -42,7 +42,7 @@ GROUP BY APPLICATION.PRO_UID;
UPDATE PRO_REPORTING
SET PRO_REPORTING.CONFIGURED_PROCESS_TIME = (
SELECT SUM(if (TASK.TAS_TIMEUNIT = "DAYS", (TASK.TAS_DURATION*8), TASK.TAS_DURATION))
SELECT SUM(if (TASK.TAS_TIMEUNIT = "DAYS", (TASK.TAS_DURATION*24), TASK.TAS_DURATION))
FROM TASK
WHERE PRO_REPORTING.PRO_UID = TASK.PRO_UID
);

View File

@@ -55,7 +55,7 @@ UPDATE USR_REPORTING
INNER JOIN
TASK
ON USR_REPORTING.TAS_UID = TASK.TAS_UID
SET USR_REPORTING.CONFIGURED_TASK_TIME = if (TASK.TAS_TIMEUNIT = "DAYS", (TASK.TAS_DURATION*8), TASK.TAS_DURATION)
SET USR_REPORTING.CONFIGURED_TASK_TIME = if (TASK.TAS_TIMEUNIT = "DAYS", (TASK.TAS_DURATION*24), TASK.TAS_DURATION)

View File

@@ -54,11 +54,27 @@ switch ($_GET['CTO_TYPE_OBJ']) {
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PRINT_PREVIEW'] = '#';
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PRINT_PREVIEW_ACTION'] = 'tracker_PrintView?CTO_UID_OBJ=' . $_GET['CTO_UID_OBJ'] . '&CTO_TYPE_OBJ=PRINT_PREVIEW';
$_SESSION['CTO_UID_OBJ'] = $_GET['CTO_UID_OBJ'];
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['CTO_UID_OBJ'], '', $Fields['APP_DATA'], '', '', 'view' );
G::RenderPage( 'publish' );
break;
$dynaForm = new Dynaform();
$arrayDynaFormData = $dynaForm->Load($_GET["CTO_UID_OBJ"]);
if (isset($arrayDynaFormData["DYN_VERSION"]) && $arrayDynaFormData["DYN_VERSION"] == 2) {
G::LoadClass("pmDynaform");
$Fields["PRO_UID"] = $_SESSION["PROCESS"];
$Fields["CURRENT_DYNAFORM"] = $_GET["CTO_UID_OBJ"];
$pmDynaForm = new pmDynaform($Fields);
if ($pmDynaForm->isResponsive()) {
$pmDynaForm->printViewWithoutSubmit();
}
} else {
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent("dynaform", "xmlform", $_SESSION["PROCESS"] . "/" . $_GET["CTO_UID_OBJ"], "", $Fields["APP_DATA"], "", "", "view");
G::RenderPage("publish");
}
break;
case 'INPUT_DOCUMENT':
G::LoadClass( 'case' );
$oCase = new Cases();

View File

@@ -1,9 +1,18 @@
/*
* LOGIN PM3 STYLES
*/
@font-face {
font-family: "Chivo";
font-style: normal;
font-weight: normal;
src: local("?"), url("/fonts/Chivo-Regular.ttf") format("truetype");
}
body.login {
background: url("/images/backgroundpm3.jpg") repeat scroll 0 0 / cover rgba(0, 0, 0, 0);
//background-position-y: -30px;
//background-position-y: -30px;
font-family: "Chivo",sans-serif;
height: 100%;
}
.vertical-offset-100 {
@@ -48,7 +57,8 @@ img.img-responsive {
.module_app_input___gray {
background-color: #fff;
font-family: "Chivo",sans-serif;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
@@ -71,9 +81,11 @@ img.img-responsive {
color: #555;
display: block;
font-size: 14px;
height: 45px;
//height: 45px;
box-sizing: border-box;
//padding-top: 12px;
line-height: 1.42857;
padding: 9px 12px;
//padding: 9px 12px;
transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
width: 100%;
}
@@ -82,6 +94,7 @@ img.img-responsive {
box-sizing: border-box;
color: #444;
font-family: "Open Sans",Arial,Helvetica,sans-serif;
//font-family: "Chivo",sans-serif;
font-size: 16px;
height: 45px;
padding: 10px;
@@ -89,6 +102,12 @@ img.img-responsive {
margin-bottom: 6px;
}
.form-signin .module_app_input___gray:-ms-input-placeholder {
font-family: "Open Sans",Arial,Helvetica,sans-serif;
color:#999;
}
.module_app_input___gray::-moz-placeholder {
color: #999;
opacity: 1;
@@ -159,7 +178,7 @@ p {
font-weight: 700;
//transition: all 0.3s ease-in-out 0s;
max-width: 400px;
filter:none;
filter:none;
}
.button-login-success:hover{
@@ -211,13 +230,10 @@ p {
font-size: 11px;
}
.footer-login .content{
.footer-login span{
color: white;
font-weight: 900;
}
.footer-login{
text-align: center;
font-size: 12px;
}
.login_result span{
@@ -227,6 +243,7 @@ p {
.login .module_app_inputFailed___gray{
font-family: "Chivo",sans-serif;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
@@ -241,4 +258,29 @@ p {
transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
width: 100%;
border:1px solid #e14333;
}
}
.page-wrap{
height: auto;
margin: 0 auto -60px;
min-height: 95%;
padding: 0 0 60px;
}
.page-wrap:after{
width: 100%;
display:block;
clear:both;
}
.footer-login{
text-align: center;
height: auto;
margin: -0px auto 0;
}
#form[FORGOT_PASWORD_LINK]{
font-family: Chivo;
font-size: 14px;
padding-top: 10px;
}

View File

@@ -78,10 +78,8 @@
</table>
</body>
{else}
<body id="page-top" class="login" data-spy="scroll" data-target=".navbar-custom">
<div style="display: none;" id="preloader">
<div style="display: none;" id="load"></div>
</div>
<body id="page-top" class="login" data-spy="scroll" data-target=".navbar-custom">
<div class="page-wrap">
<div class="container">
<div class="row vertical-offset-100">
<div class="col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
@@ -102,8 +100,13 @@
</div>
</div>
</div>
<div class ="footer-login">
<div class="content">{$footer}</div>
</div>
<div class="footer-login">
<div class="container">
<span>
{$footer}
</span>
</div>
</div>
</body>
{/if}

View File

@@ -377,8 +377,8 @@ class SkinEngine
if (strpos($_SERVER['REQUEST_URI'], '/login/login') !== false) {
$freeOfChargeText = "";
if (! defined('SKIP_FREE_OF_CHARGE_TEXT'))
$freeOfChargeText = "Supplied free of charge with no support, certification, warranty, <br>maintenance nor indemnity by Colosa and its Certified Partners.";
if(class_exists('pmLicenseManager')) $freeOfChargeText="";
$freeOfChargeText = "Supplied free of charge with no support, certification, warranty, <br>maintenance nor indemnity by Processmaker and its Certified Partners.";
if(file_exists(PATH_CLASSES."class.pmLicenseManager.php")) $freeOfChargeText="";
$fileFooter = PATH_SKINS . SYS_SKIN . PATH_SEP . 'footer.html';
if (file_exists($fileFooter)) {
@@ -392,7 +392,7 @@ class SkinEngine
if (file_exists($fileFooter)) {
$footer .= file_get_contents($fileFooter);
} else {
$footer .= "<br />Copyright &copy; 2000-" . date('Y') . " <a href=\"http://www.processmaker.com\" alt=\"ProcessMaker Inc.\" target=\"_blank\">ProcessMaker Inc.</a> All rights reserved.<br /> $freeOfChargeText " . "<br><br/><a href=\"http://www.processmaker.com\" alt=\"Powered by ProcessMaker - Open Source Workflow & Business Process Management (BPM) Management Software\" title=\"Powered by ProcessMaker\" target=\"_blank\"></a>";
$footer .= "$freeOfChargeText <br />Copyright &copy; 2000-" . date('Y') . " <a href=\"http://www.processmaker.com\" alt=\"ProcessMaker Inc.\" target=\"_blank\">ProcessMaker </a>Inc. All rights reserved.<br />" . "<br><br/><a href=\"http://www.processmaker.com\" alt=\"Powered by ProcessMaker - Open Source Workflow & Business Process Management (BPM) Management Software\" title=\"Powered by ProcessMaker\" target=\"_blank\"></a>";
}
}
}
@@ -505,7 +505,7 @@ class SkinEngine
if (file_exists($fileFooter)) {
$footer .= file_get_contents($fileFooter);
} else {
$footer .= "<br />Copyright &copy; 2000-" . date('Y') . " <a href=\"http://www.processmaker.com\" alt=\"ProcessMaker Inc.\" target=\"_blank\">ProcessMaker Inc.</a> All rights reserved.<br /> $freeOfChargeText " . "<br><br/><a href=\"http://www.processmaker.com\" alt=\"Powered by ProcessMaker - Open Source Workflow & Business Process Management (BPM) Management Software\" title=\"Powered by ProcessMaker\" target=\"_blank\"></a>";
$footer .= "$freeOfChargeText <br />Copyright &copy; 2000-" . date('Y') . " <a href=\"http://www.processmaker.com\" alt=\"ProcessMaker Inc.\" target=\"_blank\">ProcessMaker </a>Inc. All rights reserved.<br /> " . "<br><br/><a href=\"http://www.processmaker.com\" alt=\"Powered by ProcessMaker - Open Source Workflow & Business Process Management (BPM) Management Software\" title=\"Powered by ProcessMaker\" target=\"_blank\"></a>";
}
}
}
@@ -698,8 +698,8 @@ class SkinEngine
if (strpos($_SERVER['REQUEST_URI'], '/login/login') !== false) {
$freeOfChargeText = "";
if (! defined('SKIP_FREE_OF_CHARGE_TEXT'))
$freeOfChargeText = "Supplied free of charge with no support, certification, warranty, maintenance nor indemnity by Colosa and its Certified Partners.";
if(class_exists('pmLicenseManager')) $freeOfChargeText="";
$freeOfChargeText = "Supplied free of charge with no support, certification, warranty, maintenance nor indemnity by ProcessMaker and its Certified Partners.";
if(file_exists(PATH_CLASSES."class.pmLicenseManager.php")) $freeOfChargeText="";
$fileFooter = PATH_SKINS . SYS_SKIN . PATH_SEP . 'footer.html';
if (file_exists($fileFooter)) {
@@ -713,7 +713,7 @@ class SkinEngine
if (file_exists($fileFooter)) {
$footer .= file_get_contents($fileFooter);
} else {
$footer .= " $freeOfChargeText <br />Copyright &copy; 2000-" . date('Y') . " <a href=\"http://www.processmaker.com\" alt=\"ProcessMaker Inc.\" target=\"_blank\">ProcessMaker Inc.</a> All rights reserved.<br />" . "<br><br/><a href=\"http://www.processmaker.com\" alt=\"Powered by ProcessMaker - Open Source Workflow & Business Process Management (BPM) Management Software\" title=\"Powered by ProcessMaker\" target=\"_blank\"></a>";
$footer .= "$freeOfChargeText <br />Copyright &copy; 2000-" . date('Y') . " <a href=\"http://www.processmaker.com\" alt=\"ProcessMaker Inc.\" target=\"_blank\">ProcessMaker </a>Inc. All rights reserved.<br />" . "<br><br/><a href=\"http://www.processmaker.com\" alt=\"Powered by ProcessMaker - Open Source Workflow & Business Process Management (BPM) Management Software\" title=\"Powered by ProcessMaker\" target=\"_blank\"></a>";
}
}
}

View File

@@ -18,7 +18,7 @@ class ReportingIndicators
*
* return decimal value
*/
public function getPeiCompleteData($indicatorUid, $measureDate, $compareDate, $language)
public function getPeiCompleteData($indicatorUid, $compareDate, $measureDate, $language)
{
G::loadClass('indicatorsCalculator');
$calculator = new \IndicatorsCalculator();
@@ -30,7 +30,10 @@ class ReportingIndicators
$peiCost = current(reset($calculator->peiCostHistoric($processesId, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
$peiCompare = current(reset($calculator->peiHistoric($processesId, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE)));
$retval = array("efficiencyIndex" => $peiValue,
$retval = array(
"id" => $indicatorUid,
"efficiencyIndex" => $peiValue,
"efficiencyIndexCompare" => $peiCompare,
"efficiencyVariation" => ($peiValue-$peiCompare),
"inefficiencyCost" => $peiCost,
"data"=>$processes);
@@ -47,32 +50,22 @@ class ReportingIndicators
*
* return decimal value
*/
public function getUeiCompleteData($indicatorUid, $measureDate, $compareDate, $language)
public function getUeiCompleteData($indicatorUid, $compareDate, $measureDate,$language)
{
G::loadClass('indicatorsCalculator');
$calculator = new \IndicatorsCalculator();
$groups = $calculator->ueiUserGroups($indicatorUid, $measureDate, $measureDate, $language);
$groupIds = array();
foreach($groups as $p) {
array_push($groupIds, $p['uid']);
}
if (sizeof($groupIds) == 0) {
$groupIds = null;
}
//TODO think what if each indicators has a group or user subset assigned. Now are all
$ueiValue = current(reset($calculator->ueiHistoric(null, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
$arrCost = $calculator->ueiUserGroups($indicatorUid, $measureDate, $measureDate, $language);
$ueiCost = (sizeof($arrCost) > 0)
? $arrCost[0]['inefficiencyCost']
: null;
$ueiCost = current(reset($calculator->ueiCostHistoric(null, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
$ueiCompare = current(reset($calculator->ueiHistoric(null, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE)));
$retval = array("efficiencyIndex" => $ueiValue,
$retval = array(
"id" => $indicatorUid,
"efficiencyIndex" => $ueiValue,
"efficiencyVariation" => ($ueiValue-$ueiCompare),
"inefficiencyCost" => $ueiCost,
"data"=>$groups);
@@ -296,5 +289,27 @@ class ReportingIndicators
);
return $returnValue;
}
/**
* Get list status indicator
*
* @access public
* @param array $options, Data for list
* @return array
*
* @author Marco Antonio Nina <marco.antonio.nina@colosa.com>
* @copyright Colosa - Bolivia
*/
public function getStatusIndicator($options = array())
{
Validator::isArray($options, '$options');
$usrUid = isset( $options["usrUid"] ) ? $options["usrUid"] : "";
G::loadClass('indicatorsCalculator');
$calculator = new \IndicatorsCalculator();
$result = $calculator->statusIndicator($usrUid);
return $result;
}
}

View File

@@ -321,7 +321,7 @@ class Task
}
//Validating TAS_TRANSFER_FLY value
if ($arrayProperty["TAS_TRANSFER_FLY"] == "TRUE") {
if ($arrayProperty["TAS_TRANSFER_FLY"] == "FALSE") {
if (!isset($arrayProperty["TAS_DURATION"])) {
throw (new \Exception("Invalid value specified for 'tas_duration'"));
}

View File

@@ -129,10 +129,13 @@ class Variable
$cnn = \Propel::getConnection("workflow");
try {
$variable = \ProcessVariablesPeer::retrieveByPK($variableUid);
$dbConnection = \DbSourcePeer::retrieveByPK($variable->getVarDbconnection(), $variable->getPrjUid());
$oldVariable = array(
"VAR_NAME" => $variable->getVarName(),
"VAR_FIELD_TYPE" => $variable->getVarFieldType(),
"VAR_DBCONNECTION" => $variable->getVarDbconnection(),
"VAR_DBCONNECTION_LABEL" => $dbConnection !== null ? '[' . $dbConnection->getDbsServer() . ':' . $dbConnection->getDbsPort() . '] ' . $dbConnection->getDbsType() . ': ' . $dbConnection->getDbsDatabaseName() : 'PM Database',
"VAR_SQL" => $variable->getVarSql(),
"VAR_ACCEPTED_VALUES" => $variable->getVarAcceptedValues()
);
@@ -170,10 +173,12 @@ class Variable
$variable->save();
$cnn->commit();
//update dynaforms
$dbConnection = \DbSourcePeer::retrieveByPK($variable->getVarDbconnection(), $variable->getPrjUid());
$newVariable = array(
"VAR_NAME" => $variable->getVarName(),
"VAR_FIELD_TYPE" => $variable->getVarFieldType(),
"VAR_DBCONNECTION" => $variable->getVarDbconnection(),
"VAR_DBCONNECTION_LABEL" => $dbConnection !== null ? '[' . $dbConnection->getDbsServer() . ':' . $dbConnection->getDbsPort() . '] ' . $dbConnection->getDbsType() . ': ' . $dbConnection->getDbsDatabaseName() : 'PM Database',
"VAR_SQL" => $variable->getVarSql(),
"VAR_ACCEPTED_VALUES" => $variable->getVarAcceptedValues()
);
@@ -265,9 +270,14 @@ class Variable
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NULL);
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_DEFAULT);
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_ACCEPTED_VALUES);
$criteria->addSelectColumn(\DbSourcePeer::DBS_SERVER);
$criteria->addSelectColumn(\DbSourcePeer::DBS_PORT);
$criteria->addSelectColumn(\DbSourcePeer::DBS_DATABASE_NAME);
$criteria->addSelectColumn(\DbSourcePeer::DBS_TYPE);
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
$criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUid, \Criteria::EQUAL);
$criteria->addJoin(\ProcessVariablesPeer::VAR_DBCONNECTION, \DbSourcePeer::DBS_UID, \Criteria::LEFT_JOIN);
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
@@ -283,7 +293,8 @@ class Variable
'var_field_type' => $aRow['VAR_FIELD_TYPE'],
'var_field_size' => (int)$aRow['VAR_FIELD_SIZE'],
'var_label' => $aRow['VAR_LABEL'],
'var_dbconnection' => $aRow['VAR_DBCONNECTION'],
'var_dbconnection' => $aRow['VAR_DBCONNECTION'] === 'none' ? 'workflow' : $aRow['VAR_DBCONNECTION'],
'var_dbconnection_label' => $aRow['DBS_SERVER'] !== null ? '[' . $aRow['DBS_SERVER'] . ':' . $aRow['DBS_PORT'] . '] ' . $aRow['DBS_TYPE'] . ': ' . $aRow['DBS_DATABASE_NAME'] : 'PM Database',
'var_sql' => $aRow['VAR_SQL'],
'var_null' => (int)$aRow['VAR_NULL'],
'var_default' => $aRow['VAR_DEFAULT'],
@@ -326,8 +337,13 @@ class Variable
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NULL);
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_DEFAULT);
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_ACCEPTED_VALUES);
$criteria->addSelectColumn(\DbSourcePeer::DBS_SERVER);
$criteria->addSelectColumn(\DbSourcePeer::DBS_PORT);
$criteria->addSelectColumn(\DbSourcePeer::DBS_DATABASE_NAME);
$criteria->addSelectColumn(\DbSourcePeer::DBS_TYPE);
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
$criteria->addJoin(\ProcessVariablesPeer::VAR_DBCONNECTION, \DbSourcePeer::DBS_UID, \Criteria::LEFT_JOIN);
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
@@ -343,7 +359,8 @@ class Variable
'var_field_type' => $aRow['VAR_FIELD_TYPE'],
'var_field_size' => (int)$aRow['VAR_FIELD_SIZE'],
'var_label' => $aRow['VAR_LABEL'],
'var_dbconnection' => $aRow['VAR_DBCONNECTION'],
'var_dbconnection' => $aRow['VAR_DBCONNECTION'] === 'none' ? 'workflow' : $aRow['VAR_DBCONNECTION'],
'var_dbconnection_label' => $aRow['DBS_SERVER'] !== null ? '[' . $aRow['DBS_SERVER'] . ':' . $aRow['DBS_PORT'] . '] ' . $aRow['DBS_TYPE'] . ': ' . $aRow['DBS_DATABASE_NAME'] : 'PM Database',
'var_sql' => $aRow['VAR_SQL'],
'var_null' => (int)$aRow['VAR_NULL'],
'var_default' => $aRow['VAR_DEFAULT'],
@@ -690,4 +707,3 @@ class Variable
}
}
}

View File

@@ -1384,10 +1384,6 @@ class BpmnWorkflow extends Project\Bpmn
$activity = $bwp->getActivity($activityData["ACT_UID"]);
if ($activity["BOU_CONTAINER"] != $activityData["BOU_CONTAINER"]) {
$activity = null;
}
if ($forceInsert || is_null($activity)) {
if ($generateUid) {
//Generate and update UID

View File

@@ -71,223 +71,6 @@ class ReportingIndicators extends Api
}
}
// /**
// * Returns the aggregate Efficiency of a employee or set of employees
// *
// * @param string $employee_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @return array
// *
// * @url GET /employee-efficiency-index
// */
// public function doGetEmployeeEfficiencyIndex($employee_list, $init_date, $end_date)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($employee_list) > 1)
// ? $listArray = explode(',', $employee_list)
// : null;
// $response = $indicatorsObj->getEmployeeEfficiencyIndex($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date));
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Lists tasks of a employee and it's statistics (efficiency, average times, etc.)
// *
// * @param string $employee_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @param string $language {@from path}
// * @return array
// *
// * @url GET /employee-tasks
// */
// public function doGetEmployeeTasksInfo($employee_list, $init_date, $end_date, $language)
// {
// if ($employee_list == null || strlen($employee_list) <= 1)
// throw new InvalidArgumentException ('employee_list must have at least a value', 0);
//
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = $listArray = explode(',', $employee_list);
// $response = $indicatorsObj->getEmployeeTasksInfoList($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date),
// $language);
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Returns the percent of Cases with Overdue time
// *
// * @param string $$process_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @return array
// *
// * @url GET /percent-overdue-cases
// */
// public function doGetPercentOverdueByProcess($process_list, $init_date, $end_date)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($process_list) > 1)
// ? $listArray = explode(',', $process_list)
// : null;
// $response = $indicatorsObj->getPercentOverdueCasesByProcess($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date));
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Returns the percent of Cases with Overdue time with the selected periodicity
// *
// * @param string $$process_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @param string $periodicity {@from path}
// * @return array
// *
// * @url GET /percent-overdue-cases-history
// */
// public function doGetPercentOverdueByProcessHistory($process_list, $init_date, $end_date, $periodicity)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($process_list) > 1)
// ? $listArray = explode(',', $process_list)
// : null;
// $response = $indicatorsObj->getPercentOverdueCasesByProcessHistory($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date),
// $periodicity);
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Returns the total of Cases with New time
// *
// * @param string $$process_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @return array
// *
// * @url GET /total-new-cases
// */
// public function doGetTotalNewByProcess($process_list, $init_date, $end_date)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($process_list) > 1)
// ? $listArray = explode(',', $process_list)
// : null;
// $response = $indicatorsObj->getPercentNewCasesByProcess($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date));
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Returns the total of Cases with New time with the selected periodicity
// *
// * @param string $$process_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @param string $periodicity {@from path}
// * @return array
// *
// * @url GET /total-new-cases-history
// */
// public function doGetTotalNewByProcessHistory($process_list, $init_date, $end_date, $periodicity)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($process_list) > 1)
// ? $listArray = explode(',', $process_list)
// : null;
// $response = $indicatorsObj->getPercentNewCasesByProcessHistory($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date),
// $periodicity);
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Returns the total of Cases with Completed time
// *
// * @param string $$process_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @return array
// *
// * @url GET /total-completed-cases
// */
// public function doGetTotalCompletedByProcess($process_list, $init_date, $end_date)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($process_list) > 1)
// ? $listArray = explode(',', $process_list)
// : null;
// $response = $indicatorsObj->getPercentCompletedCasesByProcess($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date));
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Returns the total of Cases with Completed time with the selected periodicity
// *
// * @param string $$process_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @param string $periodicity {@from path}
// * @return array
// *
// * @url GET /total-completed-cases-history
// */
// public function doGetTotalCompletedByProcessHistory($process_list, $init_date, $end_date, $periodicity)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($process_list) > 1)
// ? $listArray = explode(',', $process_list)
// : null;
// $response = $indicatorsObj->getPercentCompletedCasesByProcessHistory($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date),
// $periodicity);
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
/**
* Returns the total of Cases with Completed time with the selected periodicity
*
@@ -299,7 +82,7 @@ class ReportingIndicators extends Api
*
* @url GET /process-efficiency-data
*/
public function doGetProcessEficciencyData($indicator_uid, $measure_date, $compare_date, $language)
public function doGetProcessEficciencyData($indicator_uid, $compare_date, $measure_date, $language)
{
try {
$indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
@@ -324,7 +107,7 @@ class ReportingIndicators extends Api
*
* @url GET /employee-efficiency-data
*/
public function doGetEmployeeEficciencyData($indicator_uid, $measure_date, $compare_date, $language)
public function doGetEmployeeEficciencyData($indicator_uid, $compare_date, $measure_date, $language)
{
try {
$indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
@@ -390,6 +173,29 @@ class ReportingIndicators extends Api
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get list Status indicator
*
* @return array
*
* @author Marco Antonio Nina <marco.antonio.nina@colosa.com>
* @copyright Colosa - Bolivia
*
* @url GET /status-indicator
*/
public function doGetStatusIndicator() {
try {
$options['usrUid'] = $this->getUserId();
$indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
$response = $indicatorsObj->getStatusIndicator($options);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}

View File

@@ -175,9 +175,11 @@ class PmPdo implements \OAuth2\Storage\AuthorizationCodeInterface,
{
$access_token = new \OauthAccessTokens();
$access_token->load($token);
$stmt = $this->db->prepare(sprintf('DELETE FROM %s WHERE ACCESS_TOKEN = :token', $this->config['access_token_table']));
$stmt->execute(compact('token'));
$stmt = $this->db->prepare(sprintf('DELETE FROM %s WHERE EXPIRES>%s', $this->config['refresh_token_table'], "'".Date('Y-m-d H:i:s')."'"));
$stmt = $this->db->prepare(sprintf("DELETE FROM %s WHERE EXPIRES < %s", $this->config["refresh_token_table"], "'" . date("Y-m-d H:i:s") . "'"));
return $stmt->execute(compact('token'));
}

View File

@@ -68,7 +68,10 @@ class Server implements iAuthenticate
$this->server->addGrantType(new \ProcessMaker\Services\OAuth2\PmClientCredentials($this->storage));
// Add the "Refresh token" grant type
$this->server->addGrantType(new \OAuth2\GrantType\RefreshToken($this->storage));
$this->server->addGrantType(new \OAuth2\GrantType\RefreshToken(
$this->storage,
array("always_issue_new_refresh_token" => true)
));
// create some users in memory
//$users = array('bshaffer' => array('password' => 'brent123', 'first_name' => 'Brent', 'last_name' => 'Shaffer'));
@@ -261,7 +264,9 @@ class Server implements iAuthenticate
if ($returnResponse) {
return $response;
} else {
die($response->send());
$response->send();
exit(0);
}
}
@@ -279,9 +284,11 @@ class Server implements iAuthenticate
if ($request == null) {
$request = \OAuth2\Request::createFromGlobals();
}
$response = $this->server->handleTokenRequest($request);
$response = $this->server->handleTokenRequest($request); //Set/Get token //PmPdo->setAccessToken()
$token = $response->getParameters();
if (array_key_exists('access_token', $token)
&& array_key_exists('refresh_token', $token)
) {
@@ -309,17 +316,9 @@ class Server implements iAuthenticate
if ($returnResponse) {
return $response;
} else {
if ($response->getStatusCode() == 400) {
$msg = $response->getParameter("error_description", "");
$msg = ($msg != "")? $msg : $response->getParameter("error", "");
$response->send();
$rest = new \Maveriks\Extension\Restler();
$rest->setMessage(new \Luracast\Restler\RestException(\ProcessMaker\Services\Api::STAT_APP_EXCEPTION, $msg));
exit(0);
} else {
$response->send();
}
exit(0);
}
}

View File

@@ -1443,54 +1443,6 @@ Ext.onReady(function() {
}
return '';
}
},
{
id : "status-feature",
header : _('ID_STATUS'),
width : 60,
sortable : false,
hideable : false,
dataIndex: "status",
renderer: function (val) {
var str = "";
var text = "";
switch (val) {
case "available": text = _('ID_BUY_NOW'); break;
case "installed": text = _('ID_INSTALLED'); break;
case "ready": text = _('ID_INSTALL_NOW'); break;
case "upgrade": text = _('ID_UPGRADE_NOW'); break;
case "download": text = _('ID_CANCEL'); break;
case "install": text = _('ID_INSTALLING'); break;
case "cancel": text = _('ID_CANCELLING'); break;
case "disabled": text = _('ID_DISABLED'); break;
case "download-start": text = "<img src=\"/images/enterprise/loader.gif\" />"; break;
default: text = val; break;
}
switch (val) {
case "available":
case "ready":
case "upgrade":
case "download":
case "install":
case "cancel":
case "download-start":
str = "<div class=\"" + val + " roundedCorners\">" + text + "</div>";
break;
case "installed":
case "disabled":
str = "<div style=\"margin-right: 0.85em; font-weight: bold; text-align: center;\">" + text + "</div>";
break;
default:
str = "<div class=\"" + val + " roundedCorners\">" + text + "</div>";
break;
}
return (str);
}
}
]
});

View File

@@ -198,20 +198,23 @@ Ext.onReady(function(){
function createNW(nwTitle, aoDbWf, aoDbRb, aoDbRp, nwUsername, nwPassword, nwPassword2){
PMExt.confirm(_('ID_CONFIRM'), _('NEW_SITE_CONFIRM_TO_CREATE'), function(){
var loadMask = new Ext.LoadMask(document.body, {msg : _('ID_SITE_CREATING')});
var oParams = {
action : 'create',
NW_TITLE : nwTitle,
AO_DB_WF : aoDbWf,
AO_DB_RB : aoDbRb,
AO_DB_RP : aoDbRp,
NW_USERNAME : nwUsername,
NW_PASSWORD : nwPassword,
NW_PASSWORD2 : nwPassword2
};
if(aoDbDrop){
oParams.AO_DB_DROP = 'On';
}
loadMask.show();
Ext.Ajax.request({
url: '../newSiteProxy/testingNW',
params: {
action : 'create',
NW_TITLE : nwTitle,
AO_DB_WF : aoDbWf,
AO_DB_RB : aoDbRb,
AO_DB_RP : aoDbRp,
NW_USERNAME : nwUsername,
NW_PASSWORD : nwPassword,
NW_PASSWORD2 : nwPassword2,
AO_DB_DROP : aoDbDrop
},
params: oParams,
method: 'POST',
success: function ( result, request ) {
loadMask.hide();

View File

@@ -504,7 +504,7 @@ Ext.onReady( function() {
enableTabScroll : true,
//anchor : '98%',
width : '100%',
height : 315,
height : 260,
defaults : {
autoScroll :true
},
@@ -574,7 +574,13 @@ Ext.onReady( function() {
if (typeof dataIndicator[id-1]['DAS_IND_DIRECTION'] != 'undefined') {
Ext.getCmp('DAS_IND_DIRECTION_'+id).setValue(idDirection);
}
if (dataIndicator[id-1]['DAS_IND_TYPE'] != '1010' && dataIndicator[id-1]['DAS_IND_TYPE'] != '1030') {
var field = '';
if (dataIndicator[id-1]['DAS_IND_TYPE'] != '1050') {
field = Ext.getCmp('IND_PROCESS_'+id);
field.enable();
field.show();
}
if (dataIndicator[id-1]['DAS_IND_TYPE'] != '1010' && dataIndicator[id-1]['DAS_IND_TYPE'] != '1030' && dataIndicator[id-1]['DAS_IND_TYPE'] != '1050') {
var fields = ['DAS_IND_FIRST_FIGURE_'+id,'DAS_IND_FIRST_FREQUENCY_'+ id,'DAS_IND_SECOND_FIGURE_'+id, 'DAS_IND_SECOND_FREQUENCY_'+ id];
for (var k=0; k<fields.length; k++) {
field = Ext.getCmp(fields[k]);
@@ -730,7 +736,7 @@ var addTab = function (flag) {
width : "100%",
items : [
new Ext.Panel({
height : 275,
height : 230,
width : "100%",
border : true,
bodyStyle : 'padding:10px',
@@ -771,9 +777,19 @@ var addTab = function (flag) {
scope: this,
select: function(combo, record, index) {
var value = combo.getValue();
var field = '';
var index = tabPanel.getActiveTab().id;
var fields = ['DAS_IND_FIRST_FIGURE_'+index,'DAS_IND_FIRST_FREQUENCY_'+index,'DAS_IND_SECOND_FIGURE_'+index, 'DAS_IND_SECOND_FREQUENCY_'+index];
if (value == '1010' || value == '1030') {
if (value == '1050') {
field = Ext.getCmp('IND_PROCESS_'+index);
field.disable();
field.hide();
} else {
field = Ext.getCmp('IND_PROCESS_'+index);
field.enable();
field.show();
}
if (value == '1010' || value == '1030' || value == '1050') {
for (var i=0; i<fields.length; i++) {
field = Ext.getCmp(fields[i]);
field.disable();
@@ -797,6 +813,7 @@ var addTab = function (flag) {
paddingLeft: "30px",
marginLeft : "60px",
layout : 'hbox',
hidden : true,
items : [
new Ext.form.ComboBox({
editable : false,
@@ -828,6 +845,7 @@ var addTab = function (flag) {
anchor : '40%',
maskRe : /([0-9\.]+)$/,
maxLength : 9,
value : 1,
width : 80,
allowBlank : false,
listeners : {
@@ -863,9 +881,11 @@ var addTab = function (flag) {
forceSelection : false,
emptyText : _('ID_EMPTY_PROCESSES'),
selectOnFocus : true,
hidden : true,
typeAhead : true,
autocomplete : true,
triggerAction : 'all',
value : '0',
store : storeProject
}),
new Ext.form.ComboBox({

View File

@@ -27,18 +27,287 @@
<script type="text/javascript" src="/js/pmchart/pmCharts.js"></script>
<script type="text/javascript" >
var urlProxy = '{$urlProxy}';
var usrId = '{$usrId}';
var pageUserId = '{$usrId}';
var token = '{$credentials.access_token}';
var G_STRING = [];
{foreach from=$translation key=index item=option}
G_STRING['{$index}'] = "{$option}";
{/foreach}
</script>
<script type="text/javascript" src="/jscore/strategicDashboard/dashboard.js"></script>
<script type="text/javascript" src="/jscore/strategicDashboard/dashboardProxy.js"></script>
<script type="text/javascript" src="/jscore/strategicDashboard/viewDashboardHelper.js"></script>
<script type="text/javascript" src="/jscore/strategicDashboard/viewDashboardModel.js"></script>
<script type="text/javascript" src="/jscore/strategicDashboard/viewDashboardPresenter.js"></script>
<script type="text/javascript" src="/jscore/strategicDashboard/viewDashboardView.js"></script>
<script type="text/template" class="specialIndicatorButtonTemplate">
<div class="col-lg-3 col-md-6 dashPro ind-button-selector"
id="indicatorButton-<%- indicator.id %>"
data-indicator-id="<%- indicator.id %>"
data-indicator-type="<%- indicator.type %>"
data-gs-min-width="3" data-gs-min-height="2" data-gs-max-height="2">
<div class="ind-container-selector panel panel-green grid-stack-item-content" style="min-width:200px;">
<a data-toggle="collapse" href="#efficiencyindex" aria-expanded="false" aria-controls="efficiencyindex">
<div class="panel-heading" >
<div class="row">
<div class="col-xs-3">
<div class="huge ind-value-selector"><%- indicator.value %></div>
</div>
<div class="col-xs-9 text-right"><i class="ind-symbol-selector fa fa-chevron-up fa-3x"></i>
<div class="small ind-comparative-selector"><%- indicator.comparative %></div>
</div>
</div>
</div>
<div class="panel-footer text-center ind-title-selector">
<%- indicator.title %>
</div>
</a>
</div>
</div>
</script>
<script type="text/template" class="statusIndicatorButtonTemplate">
<div class="col-lg-3 col-md-6 dashPro ind-button-selector"
id="indicatorButton-<%- indicator.id %>"
data-indicator-id="<%- indicator.id %>"
data-indicator-type="<%- indicator.type %>"
data-gs-min-width="3" data-gs-min-height="2" data-gs-max-height="2">
<div class="ind-container-selector panel grid-stack-item-content" style="min-width:200px;">
<a data-toggle="collapse" href="#efficiencyindex" aria-expanded="false" aria-controls="efficiencyindex">
<div class="panel-heading status-indicator-low"
style=" width:<%- indicator.percentageOverdue %>%;
visibility: <%- indicator.overdueVisibility %>" >
<div class="row">
<div class="col-xs-12">
<div class="small ind-comparative-selector"><%- indicator.percentageOverdue %>%</div>
</div>
</div>
</div>
<div class="panel-heading status-indicator-medium"
style=" width:<%- indicator.percentageAtRisk %>%;
visibility: <%- indicator.atRiskVisibility %>;" >
<div class="row">
<div class="col-xs-12">
<div class="small ind-comparative-selector"><%- indicator.percentageAtRisk %>%</div>
</div>
</div>
</div>
<div class="panel-heading status-indicator-high"
style=" width:<%- indicator.percentageOnTime %>%;
visibility: <%- indicator.onTimeVisibility %>;">
<div class="row">
<div class="col-xs-12">
<div class="small ind-comparative-selector"><%- indicator.percentageOnTime %>%</div>
</div>
</div>
</div>
<div class="panel-footer text-center ind-title-selector" style="clear:both;">
<%- indicator.title %>
</div>
</a>
</div>
</div>
</script>
<script type="text/template" class="indicatorButtonTemplate">
<div class="col-lg-3 col-md-6 ind-button-selector" id="generalLowItem"
id="indicatorButton-<%- indicator.id %>"
data-indicator-id="<%- indicator.id %>"
data-indicator-type="<%- indicator.type %>"
data-gs-min-width="3" data-gs-min-height="2" data-gs-max-height="2" >
<div class="panel ie-panel panel-low grid-stack-item-content ind-container-selector" style="min-width: 200px;">
<a data-toggle="collapse" href="#completedcases" aria-expanded="false" aria-controls="completedcases">
<div class="panel-heading"> <div class="row"> <div class="col-xs-3">
<div class="huge ind-value-selector">X</div>
</div>
<div class="col-xs-9 text-right"><i class="fa fa-file-text-o fa-3x"></i>
<div class="small ind-comparative-selector ellipsis"><%- indicator.comparative %></div>
</div>
</div>
</div>
<div class="progress progress-xs progress-dark-base ie-progress-dark-base mar-no">
<div role="progressbar"
aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"
class="progress-bar progress-bar-light ind-progress-selector"
style="width: 0%">
</div>
</div>
<div class="panel-footer text-center ind-title-selector">
<span>
<%- indicator.title %>
</span>
</div>
</a>
</div>
</div>
</script>
<script type="text/template" class="specialIndicatorMainPanel">
<div class="process-div well" id="specialIndicatorMainPanel"
data-gs-no-resize="true"
style="clear:both;position:relative;height:auto;">
<div class="panel-heading bluebg sind-title-selector"">
<ol class="breadcrumb">
</ol>
</div>
<div class="text-center huge">
<div class="col-xs-3 vcenter">
<div class="green"><%- indicator.efficiencyIndexToShow %></div>
<div class="small grey sind-index-selector ellipsis"></div>
</div>
<div class="col-xs-3 vcenter" style="margin-right:40px">
<div class="red sind-cost-number-selector"><%- indicator.inefficiencyCostToShow %></div>
<div class="small grey sind-cost-selector ellipsis"></div>
</div>
<div class="col-xs-6" id="specialIndicatorGraph" style="width:540px;height:300px;"></div>
</div>
<div class="clearfix"></div>
</div>
</script>
<script type="text/template" class="specialIndicatorDetail">
<div class="process-div well hideme detail-button-selector" data-gs-no-resize="true"
id="detailData-<%- detailData.uid %>"
data-indicator-id="<%- detailData.indicatorId %>"
data-detail-id="<%- detailData.uid %>"
data-detail-index="<%- detailData.efficiencyIndexToShow %>"
data-detail-cost-to-show="<%- detailData.inefficiencyCostToShow %>"
data-detail-cost="<%- detailData.inefficiencyCost%>"
data-detail-name="<%- detailData.name %>"
>
<div class="col-lg-12 vcenter-task">
<a href="#" class="process-button">
<div class="col-xs-5 text-left title-process">
<div class="small grey detail-title-selector"> <%- detailData.name %></div>
</div>
<div class="col-xs-3 text-center ">
<div class="blue"><%- detailData.efficiencyIndexToShow%></div>
<div class="small grey detail-efficiency-selector ellipsis"></div>
</div>
<div class="col-xs-3 text-center ">
<div class="red detail-cost-number-selector"><%- detailData.inefficiencyCostToShow %></div>
<div class="small grey detail-cost-selector ellipsis"></div>
</div>
<div class="col-xs-1 text-right arrow"><i class="fa fa-chevron-right fa-fw"></i></div>
</a>
</div>
<div class="clearfix"></div>
</div>
</script>
<script type="text/template" class="specialIndicatorSencondViewDetail">
<div class="process-div well hideme detail-button-selector" data-gs-no-resize="true"
id="detailData-<%- detailData.uid %>"
data-indicator-id="<%- detailData.indicatorId %>"
data-detail-id="<%- detailData.uid %>">
<div class="panel-heading greenbg">
<div class="col-xs-12 text-center detail-title-selector"><i class="fa fa-tasks fa-fw"></i> <span id="usrName"><%- detailData.name %></span> </div>
<div class="clearfix"></div>
</div>
<div class="text-center huge">
<div class="col-xs-12 vcenter-task">
<div class="col-xs-5 ">
<div class="blue small"><%- detailData.efficiencyIndexToShow%></div>
<div class="smallB grey fontMedium detail-efficiency-selector ellipsis"></div>
</div>
<div class="col-xs-5 ">
<div class="small detail-cost-number-selector"><%- detailData.inefficiencyCostToShow%></div>
<div class="smallB grey detail-cost-selector ellipsis"></div>
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
</script>
<script type="text/template" class="statusDetail">
<div class="process-div well hideme detail-button-selector" data-gs-no-resize="true"
id="detailData-<%- detailData.uid %>"
data-indicator-id="<%- detailData.indicatorId %>"
data-detail-id="<%- detailData.uid %>">
<div class="panel-heading greenbg">
<div class="col-xs-12 text-center detail-title-selector"><i class="fa fa-tasks fa-fw"></i> <span id="usrName"><%- detailData.taskTitle %></span> </div>
<div class="clearfix"></div>
</div>
<div class="text-center huge">
<div class="col-xs-12 vcenter-task">
<div class="col-xs-4 ">
<div class="blue small"><%- detailData.percentageOverdue%> %</div>
<div class="smallB grey fontMedium detail-efficiency-selector">Overdue</div>
</div>
<div class="col-xs-4">
<div class="blue small"><%- detailData.percentageAtRisk%> %</div>
<div class="smallB grey fontMedium detail-efficiency-selector">At Risk</div>
</div>
<div class="col-xs-4 ">
<div class="blue small"><%- detailData.percentageOnTime%> %</div>
<div class="smallB grey fontMedium detail-efficiency-selector">On Time</div>
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
</script>
<script type="text/template" class="dashboardButtonTemplate">
<div id="dashboardButton-<%- dashboard.id %>" class="btn-group pull-left"
data-dashboard-id="<%- dashboard.id %>" >
<button type="button" class="btn btn-success das-icon-selector">
<i class="fa fa-star fa-1x"></i>
</button>
<button type="button" class="btn btn-success das-title-selector" >
<%- dashboard.title %>
</button>
</div>
</script>
<script type="text/template" class="generalIndicatorMainPanel">
<div class="process-div well" data-gs-no-resize="true" style="clear:both;position:relative;height:auto;">
<div class="panel-heading bluebg">
<ol class="breadcrumb">
<li class="ind-title-selector"></li>
</ol>
</div>
<div class="text-center huge">
<div class="col-xs-6" id="generalGraph1" style="width:600px; height:300px;"><img src="../dist/img/graph.png" /></div>
<div class="col-xs-6" id="generalGraph2" style="width:600px; height:300px;margin-left:60px;"><img src="../dist/img/graph.png" /></div>
</div>
<div class="clearfix"></div>
</div>
</script>
<script type="text/template" class="statusIndicatorMainPanel">
<div class="process-div well" data-gs-no-resize="true" style="clear:both;position:relative;height:auto;">
<div class="panel-heading bluebg">
<ol class="breadcrumb">
<li class="ind-title-selector"></li>
</ol>
</div>
<div class="text-center huge" style="margin:0 auto; width:90%;">
<div class="col-xs-4" style="width:auto;">
<div class="status-graph-title-low">Overdue:</div>
<div id="graph1" style="width:450px; height:300px;"></div>
</div>
<div class="col-xs-4" style="width:auto;">
<div class="status-graph-title-medium">At Risk:</div>
<div id="graph2" style="width:450px; height:300px;"></div>
</div>
<div class="col-xs-4" style="width:auto;">
<div class="status-graph-title-high">On Time:</div>
<div id="graph3" style="width:450px; height:300px;"></div>
</div>
</div>
<div class="clearfix"></div>
</div>
</script>
</head>
<body id="page-top" class="index">
<img id="theImg" class="floating" src="/images/scrolldown.gif" width="80" height="80"/>
<img id="scrollImg" class="floating" src="/images/scrolldown.gif" width="80" height="80" style="border-radius:85px;"/>
<div id="wrapper">
<div id="page-wrapper">
<!--Cabezera-->
@@ -65,17 +334,17 @@
<div class="span4 pull-left">
<select id="year" class="form-control pull-right ">
{literal}
<script>
now = new Date();
<script>
now = new Date();
anio = now.getFullYear();
for(a=anio;a>=anio-7;a--){
document.write('<option value="'+a+'">'+a+'</option>');
}
for(a=anio;a>=anio-7;a--){
document.write('<option value="'+a+'">'+a+'</option>');
}
</script>
{/literal}
</select>
<select id="mounth" class="form-control pull-right ">
<select id="month" class="form-control pull-right ">
<option value="1">{translate label="ID_MONTH_ABB_1"}</option>
<option value="2">{translate label="ID_MONTH_ABB_2"}</option>
<option value="3">{translate label="ID_MONTH_ABB_3"}</option>
@@ -99,7 +368,7 @@
<p class="text-center">{translate label="ID_DASH_CLICK_TO_VIEW"}</p>
<p>
<!-- Split button -->
<div id="dasbuttons">
<div id="dashboardsList">
</div>
</p>
<div class="clearfix"></div>
@@ -123,9 +392,19 @@
<!--Here are added dynamically the Dat by indicator-->
</div>
</div>
<div id="relatedLabel"></div>
<div id="relatedLabel" style="clear:both;">
<div>
<center><h3></h3></center>
</div>
<div>
Sort: &nbsp; &nbsp;<a id="sortListButton" class="fa fa-chevron-down fa-1x" style="color:#000;" href="#"></a>
</div>
</div>
<div class="col-lg-12 col-md-12">
<div id="relatedDataGridStack" class="grid-stack" data-gs-width="12" data-gs-animate="no" >
<div id="relatedDetailGridStack" class="grid-stack" data-gs-width="12"
data-gs-animate="no" style="clear:both;">
</div>
</div>
</div>
@@ -136,4 +415,3 @@
</body>
</html>

View File

@@ -6,7 +6,7 @@
<USR_USERNAME type="text" size="30" maxlength="50" required="true" validate="Any" autocomplete="0">
<en><![CDATA[User]]></en>
</USR_USERNAME>
<USR_EMAIL type="text" size="30" required="true" maxlength="32" autocomplete="0">
<USR_EMAIL type="text" size="30" required="true" maxlength="254" autocomplete="0">
<en><![CDATA[Email]]></en>
</USR_EMAIL>
<URL type="hidden"/>

View File

@@ -86,6 +86,20 @@ var dynaformOnload = function() {
}
};
leimnud.event.add(document.getElementById('form[USR_PASSWORD_MASK]'), 'keypress', function(event) {
var key;
if(window.event)
key = window.event.keyCode; //IE
else
key = event.which; //firefox
if(key == 13) {
document.getElementById('form[BSUBMIT]').click();
return true;
} else {
return true;
}
});
leimnud.event.add(document.getElementById('form[BSUBMIT]'), 'click', function() {
document.getElementById('form[USR_PASSWORD]').value = document.getElementById('form[USR_PASSWORD_MASK]').value;
document.getElementById('form[USR_PASSWORD_MASK]').value = '';

View File

@@ -25,7 +25,6 @@ SELECT LANG_ID, LANG_NAME FROM langOptions
<en><![CDATA[Forgot Password]]></en>
</FORGOT_PASWORD_LINK>
<JS type="javascript"><![CDATA[
window.onload= function(){
document.getElementById('form[USR_USERNAME]').placeholder = _('ID_USER');
document.getElementById('form[USR_PASSWORD_MASK]').placeholder = _('ID_PASSWORD');
@@ -94,6 +93,20 @@ var dynaformOnload = function() {
}
};
leimnud.event.add(document.getElementById('form[USR_PASSWORD_MASK]'), 'keypress', function(event) {
var key;
if(window.event)
key = window.event.keyCode; //IE
else
key = event.which; //firefox
if(key == 13) {
document.getElementById('form[BSUBMIT]').click();
return true;
} else {
return true;
}
});
leimnud.event.add(document.getElementById('form[BSUBMIT]'), 'click', function() {
setNestedProperty(this, Array('disabled'), 'true');
setNestedProperty(this, Array('value'), @@LOGIN_VERIFY_MSG);

View File

@@ -27,6 +27,20 @@ SELECT LANG_ID, LANG_NAME FROM langOptions
setFocus (getField ('USR_USERNAME'));
leimnud.event.add(document.getElementById('form[USR_PASSWORD_MASK]'), 'keypress', function(event) {
var key;
if(window.event)
key = window.event.keyCode; //IE
else
key = event.which; //firefox
if(key == 13) {
document.getElementById('form[BSUBMIT]').click();
return true;
} else {
return true;
}
});
leimnud.event.add(document.getElementById('form[BSUBMIT]'), 'click', function() {
createCookie("pm_sys_sys", "{\"sys_sys\": \"" + getField("USER_ENV").value + "\"}", 365);

View File

@@ -29,11 +29,25 @@ window.onload= function(){
document.getElementById('form[USR_PASSWORD_MASK]').placeholder = _('ID_PASSWORD');
document.getElementById('form[USER_ENV]').placeholder = _('ID_WORKSPACE');
document.getElementById('form[BSUBMIT]').classList.remove('module_app_button___gray');
document.getElementById('form[BSUBMIT]').classList.add('button-login-success');
document.getElementById('form[BSUBMIT]').classList.add('button-login-success');
};
setFocus (getField ('USR_USERNAME'));
leimnud.event.add(document.getElementById('form[USR_PASSWORD_MASK]'), 'keypress', function(event) {
var key;
if(window.event)
key = window.event.keyCode; //IE
else
key = event.which; //firefox
if(key == 13) {
document.getElementById('form[BSUBMIT]').click();
return true;
} else {
return true;
}
});
leimnud.event.add(document.getElementById('form[BSUBMIT]'), 'click', function() {
ws = getField('USER_ENV').value;
createCookie('pmos_generik2', '{"ws":"'+ws+'"}', 365);

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm type="xmlform" name="" width="585" height="305" enabletemplate="0" mode="">
<PRO_UID type="hidden" />
<TAS_UID type="hidden" />
<SYS_LANG type="hidden" />
<REP_TAB_UID type="hidden" />
<INDEX type="hidden" />
<TABLE_NAME_DEFAULT type="hidden" />
<IFORM type="hidden" />
<TITLE_ALERT type="title">
<en><![CDATA[Alert]]></en>
<es><![CDATA[Alert]]></es>
</TITLE_ALERT>
<SUBTITLE_MESSAGE type="text" mode="view">
<en><![CDATA[Message]]></en>
<en><![CDATA[Mensaje]]></en>
</SUBTITLE_MESSAGE>
</dynaForm>

View File

@@ -4,7 +4,7 @@
<INDEX type="hidden"/>
<IFORM type="hidden"/>
<TAS_TRANSFER_FLY type="checkbox" value="TRUE" falsevalue="FALSE" defaultvalue="TRUE" group="1">
<en><![CDATA[Allow user defined timing control]]></en>
<en><![CDATA[Allow users to change the task duration in runtime]]></en>
</TAS_TRANSFER_FLY>
<TAS_DURATION type="text" size="3" maxlength="3" defaultvalue="1" required="1" validate="Any" mask="###" group="1" dependentfields="" linkfield="" strto="UPPER" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection="">
<en><![CDATA[Task duration]]></en>
@@ -23,7 +23,7 @@ SELECT CALENDAR_UID, CALENDAR_NAME FROM availableCalendars
var toggleFields = function()
{
if(getField('TAS_TRANSFER_FLY').checked == true)
if(getField('TAS_TRANSFER_FLY').checked == false)
{
showRowById('TAS_DURATION');
showRowById('TAS_TIMEUNIT');

View File

@@ -1,4 +1,6 @@
.pm-charts-no-draw {
font-size:16px;
font-family:"Arial";
@@ -11,10 +13,56 @@
color:#e14333;
}
.status-graph-title-low,
.status-graph-title-medium,
.status-graph-title-high {
text-align:center;
font-size:17px;
font-family: 'Chivo', sans-serif;
width:90%;
margin:0 auto;
border:1px solid #eaeaea;
margin-top:10px;
border-radius: 5px;
}
.status-graph-title-low {
background-color: #e14333;
}
.status-graph-title-medium {
background-color:#fada5e;
}
.status-graph-title-high {
background-color:#1fbc99;
}
.status-indicator-low,
.status-indicator-medium,
.status-indicator-high {
padding:0px;
padding-top:30px;
color:#444;
float:left;
}
.section-title {
}
.status-indicator-low {
background-color: #e14333;
}
.status-indicator-medium {
background-color: #fada5e;
}
.status-indicator-high {
background-color: #1fbc99;
}
.hideme {opacity:0;}
.pie-label {font-size:10px;}
.axis-label {font-size:10px;}
.errorBar, .errorBarLowerMark, .errorBarUpperMark{
@@ -29,15 +77,34 @@
font-size:9px;
}
.das-title-selector {
width:160px;
text-overflow: ellipsis;
white-space: nowrap;
overflow:hidden;
}
.ind-title-selector {
text-overflow: ellipsis;
white-space: nowrap;
overflow:hidden;
}
.ellipsis {
text-overflow: ellipsis;
white-space: nowrap;
overflow:hidden;
}
img.floating {
position:fixed;
right:0;
bottom:0;
margin:0;
padding:0;
z-index:1000;
opacity: 0.9;
filter: alpha(opacity=90);
position:fixed;
right:0;
bottom:0;
margin:0;
padding:0;
z-index:1000;
opacity: 0.9;
filter: alpha(opacity=90);
}

View File

@@ -103,7 +103,7 @@
width: auto !important;
left: 0 !important;
top: auto !important;
margin-bottom: 20px;
margin-bottom:20px;
}
.grid-stack {
@@ -127,3 +127,4 @@
-o-transition: left .0s, top .0s, height .0s, width .0s;
transition: left .0s, top .0s, height .0s, width .0s;
}

View File

@@ -348,21 +348,21 @@ table.dataTable thead .sorting:after {
text-decoration: none;
}
.panel-yellow {
.panel-high {
border-color: #ddd;
}
.panel-yellow .panel-heading {
.panel-high .panel-heading {
border-color: #fcb322;
color: #fff;
background-color: #fcb322;
}
.panel-yellow a {
.panel-high a {
color: #606368;
}
.panel-yellow a:hover {
.panel-high a:hover {
color: #fcb322;
text-decoration: none;
}
@@ -520,15 +520,15 @@ table.dataTable thead .sorting:after {
/*title panel ends*/
.panel-primary{
.panel-low{
border-color: #ddd;
}
.panel-primary a{
.panel-low a{
color: #606368;
}
.panel-primary a:hover{
.panel-low a:hover{
color: #3397e1;
text-decoration: none;
}
@@ -549,7 +549,7 @@ table.dataTable thead .sorting:after {
margin-bottom: 20px;
}
.panel-green:hover, .panel-red:hover, .panel-yellow:hover, .panel-primary:hover{
.panel-green:hover, .panel-red:hover, .panel-high:hover, .panel-low:hover{
box-shadow:0px 3px 2px #dfdfdf;
}
@@ -566,7 +566,7 @@ table.dataTable thead .sorting:after {
}
.panel-active{
background-color: #fff;
background-color: #D99058;
position: relative;
}
@@ -583,6 +583,7 @@ table.dataTable thead .sorting:after {
.panel-active:after {
border-color: rgba(136, 183, 213, 0);
background-color: #000;
border-top-color: #fff;
border-width: 20px;
margin-left: -20px;
@@ -614,11 +615,11 @@ table.dataTable thead .sorting:after {
margin-top:10px;
}
.panel-red .panel-heading, .panel-primary .panel-heading{
.panel-red .panel-heading, .panel-low .panel-heading{
color:rgba(0,0,0,0.4) !important;
}
.panel-yellow .progress-bar{
.panel-high .progress-bar{
background: #fcb322;
}
@@ -728,11 +729,18 @@ table.dataTable thead .sorting:after {
font-size: 14px;
}
.process-button .blue{
.process-button .blue,
.process-button .red,
.process-button .green{
font-size: 24px;
}
.process-button:hover .blue, .process-button:hover, .process-button:hover .grey{
.process-button:hover .blue,
.process-button:hover,
.process-button:hover .grey,
.process-button:hover .red,
.process-button:hover .green
{
background: #337AB8;
color:#fff !important;
}

Binary file not shown.