mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
Issues konfiguration: added GUI for assigning konfiguration to fehler
This commit is contained in:
@@ -283,10 +283,18 @@ $config['navigation_menu']['system/issues/Issues/*'] = array(
|
||||
'fehlerzustaendigkeiten' => array(
|
||||
'link' => site_url('system/issues/IssuesZustaendigkeiten'),
|
||||
'description' => 'Fehler Zuständigkeiten',
|
||||
'icon' => 'cogs',
|
||||
'icon' => 'users',
|
||||
'sort' => 100,
|
||||
'target' => '_blank',
|
||||
'requiredPermissions' => array('admin:rw')
|
||||
)
|
||||
),
|
||||
'fehlerkonfiguration' => array(
|
||||
'link' => site_url('system/issues/IssuesKonfiguration'),
|
||||
'description' => 'Fehler Konfiguration',
|
||||
'icon' => 'cogs',
|
||||
'sort' => 200,
|
||||
'target' => '_blank',
|
||||
'requiredPermissions' => array('admin:rw')
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class IssuesKonfiguration extends Auth_Controller
|
||||
{
|
||||
private $_uid;
|
||||
|
||||
const STRING_DATA_TYPE = 'string';
|
||||
const INTEGER_DATA_TYPE = 'integer';
|
||||
const FLOAT_DATA_TYPE = 'float';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'admin:r',
|
||||
'getApps' => 'admin:r',
|
||||
'getFehlerKonfigurationByApp' => 'admin:r',
|
||||
'saveFehlerKonfiguration' => 'admin:rw',
|
||||
'deleteKonfiguration' => 'admin:rw'
|
||||
)
|
||||
);
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('IssuesLib');
|
||||
$this->load->library('WidgetLib');
|
||||
|
||||
// Load models
|
||||
$this->load->model('system/Fehlerkonfigurationstyp_model', 'FehlerkonfigurationstypModel');
|
||||
$this->load->model('system/Fehlerkonfiguration_model', 'FehlerkonfigurationModel');
|
||||
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
//~ 'global',
|
||||
'ui',
|
||||
'filter',
|
||||
//~ 'lehre',
|
||||
//~ 'person',
|
||||
'fehlermonitoring'
|
||||
)
|
||||
);
|
||||
|
||||
$this->_setAuthUID(); // sets property uid
|
||||
$this->setControllerId(); // sets the controller id
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Load initial view.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->load->view("system/issues/issuesKonfiguration.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all Apps to which Fehler exist.
|
||||
*/
|
||||
public function getApps()
|
||||
{
|
||||
$this->FehlerModel->addDistinct();
|
||||
$this->FehlerModel->addSelect('app');
|
||||
$this->FehlerModel->addJoin('system.tbl_fehler_konfigurationstyp', 'app');
|
||||
$this->FehlerModel->addOrder('app');
|
||||
|
||||
$appRes = $this->FehlerModel->load();
|
||||
|
||||
$this->outputJson($appRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all fehlercodes, optionally by app.
|
||||
*/
|
||||
public function getFehlerKonfigurationByApp()
|
||||
{
|
||||
$app = $this->input->get('app');
|
||||
|
||||
// get all Konfiguration types, optionally filtered by app
|
||||
$this->FehlerkonfigurationstypModel->addSelect('konfigurationstyp_kurzbz, konfigurationsdatentyp, beschreibung');
|
||||
$this->FehlerkonfigurationstypModel->addOrder('konfigurationstyp_kurzbz');
|
||||
$konfRes = isEmptyString($app)
|
||||
? $this->FehlerkonfigurationstypModel->load()
|
||||
: $this->FehlerkonfigurationstypModel->loadWhere(array('app' => $app));
|
||||
|
||||
if (isError($konfRes)) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'fehlerKonfigurationstypenLaden'));
|
||||
|
||||
// get all Fehler, optionally filtered by app
|
||||
$params = array('fehlercode_extern' => null);
|
||||
$this->FehlerModel->addSelect('fehlercode, fehler_kurzbz, fehlertyp_kurzbz, fehlertext');
|
||||
$this->FehlerModel->addOrder('fehlercode');
|
||||
if (isEmptyString($app)) $params['app'] = $app;
|
||||
$fehlerRes = $this->FehlerModel->loadWhere($params);
|
||||
|
||||
if (isError($fehlerRes)) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'fehlerFehlerLaden'));
|
||||
|
||||
// return object with retrieved data
|
||||
$konfObj = new StdClass();
|
||||
$konfObj->konfigurationstypen = array();
|
||||
$konfObj->fehler = array();
|
||||
|
||||
if (hasData($konfRes)) $konfObj->konfigurationstypen = getData($konfRes);
|
||||
if (hasData($fehlerRes)) $konfObj->fehler = getData($fehlerRes);
|
||||
|
||||
$this->outputJsonSuccess($konfObj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a Fehler configuration, inserts new configuration or updates existing.
|
||||
* Checks if datatype of passed configuration is correct.
|
||||
*/
|
||||
public function saveFehlerKonfiguration()
|
||||
{
|
||||
$result = null;
|
||||
$konfigurationstyp_kurzbz = $this->input->post('konfigurationstyp_kurzbz');
|
||||
$fehlercode = $this->input->post('fehlercode');
|
||||
$konfigurationsWert = $this->input->post('konfigurationsWert');
|
||||
|
||||
// check if all params passed
|
||||
if (isEmptyString($konfigurationstyp_kurzbz)) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'ungueltigerKonfigurationstyp'));
|
||||
|
||||
if (isEmptyString($fehlercode)) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'ungueltigerFehlercode'));
|
||||
|
||||
// separate by semicolon if multiple values passed
|
||||
$konfigurationsWert = explode(';', $konfigurationsWert);
|
||||
|
||||
// check konfigurationswert
|
||||
|
||||
// get the expected data type
|
||||
$dataType = self::STRING_DATA_TYPE;
|
||||
$this->FehlerkonfigurationstypModel->addSelect('konfigurationsdatentyp');
|
||||
$konfigtypRes = $this->FehlerkonfigurationstypModel->loadWhere(array('konfigurationstyp_kurzbz' => $konfigurationstyp_kurzbz));
|
||||
|
||||
if (hasData($konfigtypRes))
|
||||
{
|
||||
$konfigurationsdatentyp = getData($konfigtypRes)[0]->konfigurationsdatentyp;
|
||||
foreach ($konfigurationsWert as $idx => $konfWert)
|
||||
{
|
||||
// check if data type correct
|
||||
$valid = false;
|
||||
switch ($konfigurationsdatentyp)
|
||||
{
|
||||
case self::INTEGER_DATA_TYPE:
|
||||
$valid = (string)(int)$konfWert == $konfWert;
|
||||
$konfigurationsWert[$idx] = (int) $konfWert;
|
||||
break;
|
||||
case self::FLOAT_DATA_TYPE:
|
||||
$valid = (string)(float)$konfWert == $konfWert;
|
||||
$konfigurationsWert[$idx] = (float) $konfWert;
|
||||
break;
|
||||
default:
|
||||
$valid = is_string($konfWert) && preg_match('/^[A-Za-z0-9_]+$/', $konfWert);
|
||||
}
|
||||
if (!$valid) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'ungueltigerKonfigurationswert', $konfigurationsdatentyp));
|
||||
}
|
||||
}
|
||||
|
||||
// check if konfiguration already set for the fehlercode
|
||||
$this->FehlerkonfigurationModel->addSelect('konfiguration');
|
||||
$fehlerkonfigurationRes = $this->FehlerkonfigurationModel->loadWhere(
|
||||
array(
|
||||
'konfigurationstyp_kurzbz' => $konfigurationstyp_kurzbz,
|
||||
'fehlercode' => $fehlercode
|
||||
)
|
||||
);
|
||||
|
||||
if (isError($fehlerkonfigurationRes)) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'fehlerFehlerKonfigurationLaden'));
|
||||
|
||||
// if konfiguration exists, update by add konfiguration values to existing
|
||||
if (hasData($fehlerkonfigurationRes))
|
||||
{
|
||||
$fehlerkonfiguration = getData($fehlerkonfigurationRes);
|
||||
|
||||
$existingKonf = json_decode($fehlerkonfiguration[0]->konfiguration);
|
||||
|
||||
if (!$existingKonf) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'fehlerJsonDekodierung'));
|
||||
|
||||
if (!is_array($existingKonf)) $existingKonf = array($existingKonf);
|
||||
|
||||
$newKonf = json_encode(array_values(array_unique(array_merge($existingKonf, $konfigurationsWert))));
|
||||
if (!$newKonf) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'fehlerJsonKodierung'));
|
||||
|
||||
$result = $this->FehlerkonfigurationModel->update(
|
||||
array('konfigurationstyp_kurzbz' => $konfigurationstyp_kurzbz, 'fehlercode' => $fehlercode),
|
||||
array('konfiguration' => $newKonf, 'updateamum' => 'NOW()', 'updatevon' => $this->_uid)
|
||||
);
|
||||
}
|
||||
else // if no konfiguration exists, add new konfiguration entry
|
||||
{
|
||||
$newKonf = json_encode($konfigurationsWert);
|
||||
if (!$newKonf) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'fehlerJsonKodierung'));
|
||||
|
||||
$result = $this->FehlerkonfigurationModel->insert(
|
||||
array(
|
||||
'konfigurationstyp_kurzbz' => $konfigurationstyp_kurzbz,
|
||||
'fehlercode' => $fehlercode,
|
||||
'konfiguration' => $newKonf,
|
||||
'insertvon' => $this->_uid
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// output result (insert or update)
|
||||
$this->outputJson($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a Konfiguration.
|
||||
*/
|
||||
public function deleteKonfiguration()
|
||||
{
|
||||
$konfigurationstyp_kurzbz = $this->input->post('konfigurationstyp_kurzbz');
|
||||
$fehlercode = $this->input->post('fehlercode');
|
||||
|
||||
// check if Konfigurationstyp correctly passed
|
||||
if (isEmptyString($konfigurationstyp_kurzbz)) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'ungueltigerKonfigurationstyp'));
|
||||
|
||||
// check if fehlercode correctly passed
|
||||
if (isEmptyString($fehlercode)) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'ungueltigerFehlercode'));
|
||||
|
||||
$this->outputJson(
|
||||
$this->FehlerkonfigurationModel->delete(
|
||||
array('konfigurationstyp_kurzbz' => $konfigurationstyp_kurzbz, 'fehlercode' => $fehlercode)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the UID of the logged user and checks if it is valid
|
||||
*/
|
||||
private function _setAuthUID()
|
||||
{
|
||||
$this->_uid = getAuthUID();
|
||||
|
||||
if (!$this->_uid) show_error('User authentification failed');
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,6 @@ class IssuesZustaendigkeiten extends Auth_Controller
|
||||
// Load models
|
||||
$this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
|
||||
$this->load->model('system/Fehler_model', 'FehlerModel');
|
||||
$this->load->model('system/Fehler_model', 'FehlerModel');
|
||||
$this->load->model('system/Fehlerzustaendigkeiten_model', 'FehlerzustaendigkeitenModel');
|
||||
|
||||
$this->loadPhrases(
|
||||
@@ -70,7 +69,7 @@ class IssuesZustaendigkeiten extends Auth_Controller
|
||||
{
|
||||
$app = $this->input->get('app');
|
||||
|
||||
//$this->FehlerModel->addSelect('fehlercode, fehler_kurzbz, fehlertext, fehlertyp_kurzbz');
|
||||
$this->FehlerModel->addSelect('fehlercode, fehler_kurzbz, fehlertext, fehlertyp_kurzbz, app');
|
||||
$this->FehlerModel->addOrder('fehlercode');
|
||||
|
||||
$fehlerRes = isset($app) ? $this->FehlerModel->loadWhere(array('app' => $app)) : $this->FehlerModel->load();
|
||||
|
||||
@@ -14,7 +14,6 @@ abstract class PlausiIssueProducer_Controller extends JOB_Controller
|
||||
|
||||
// pass extension name if calling from extension
|
||||
$extensionName = isset($this->_extensionName) ? $this->_extensionName : null;
|
||||
//$app = isset($this->_app) ? $this->_app : null;
|
||||
|
||||
// load libraries
|
||||
$this->load->library('issues/PlausicheckProducerLib', array('extensionName' => $extensionName, 'app' => $this->_app));
|
||||
|
||||
@@ -26,7 +26,7 @@ class PlausicheckProducerLib
|
||||
$this->_ci =& get_instance(); // get ci instance
|
||||
|
||||
// load models
|
||||
$this->_ci->load->model('system/fehlerkonfiguration_model', 'FehlerkonfigurationModel');
|
||||
$this->_ci->load->model('system/Fehlerkonfiguration_model', 'FehlerkonfigurationModel');
|
||||
|
||||
// get all configuration parameters for the application
|
||||
$fehlerkonfigurationRes = $this->_ci->FehlerkonfigurationModel->getKonfiguration($app);
|
||||
|
||||
@@ -10,10 +10,11 @@ class Fehlerkonfiguration_model extends DB_Model
|
||||
parent::__construct();
|
||||
$this->dbTable = 'system.tbl_fehler_konfiguration';
|
||||
$this->pk = array('konfigurationstyp_kurzbz', 'fehlercode');
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all configuration parameters (e.g. excluding certain values), optionally filtered by app.
|
||||
* Retrieve all set configuration parameters, optionally filtered by app.
|
||||
* @param string $app
|
||||
* @return object success or error
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
class Fehlerkonfigurationstyp_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'system.tbl_fehler_konfigurationstyp';
|
||||
$this->pk = array('konfigurationstyp_kurzbz');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all set configuration parameters, optionally filtered by app.
|
||||
* @param string $app
|
||||
* @return object success or error
|
||||
*/
|
||||
public function getKonfiguration($app = null)
|
||||
{
|
||||
$fehlerkonfiguration = array();
|
||||
|
||||
$this->addSelect('fehlercode, konfigurationstyp_kurzbz, konfiguration, fehler_kurzbz');
|
||||
$this->addJoin('system.tbl_fehler_konfigurationstyp konftyp', 'konfigurationstyp_kurzbz');
|
||||
$this->addJoin('system.tbl_fehler fehler', 'fehlercode');
|
||||
$fehlerkonfigurationRes = isset($app) ? $this->loadWhere(array('fehler.app' => $app)) : $this->load();
|
||||
|
||||
if (isError($fehlerkonfigurationRes)) return $fehlerkonfigurationRes;
|
||||
|
||||
if (hasData($fehlerkonfigurationRes))
|
||||
{
|
||||
$fehlerkonfigurationData = getData($fehlerkonfigurationRes);
|
||||
foreach ($fehlerkonfigurationData as $fk)
|
||||
{
|
||||
$konf = json_decode($fk->konfiguration);
|
||||
if (is_array($konf))
|
||||
{
|
||||
$fk->konfiguration = $konf;
|
||||
$fehlerkonfiguration[] = $fk;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return success($fehlerkonfiguration);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'Fehler Konfiguration',
|
||||
'jquery3' => true,
|
||||
'jqueryui1' => true,
|
||||
'jquerycheckboxes1' => true,
|
||||
'bootstrap3' => true,
|
||||
'fontawesome4' => true,
|
||||
'sbadmintemplate3' => true,
|
||||
'tablesorter2' => true,
|
||||
'ajaxlib' => true,
|
||||
'filterwidget' => true,
|
||||
'navigationwidget' => true,
|
||||
'dialoglib' => true,
|
||||
'phrases' => array(
|
||||
'ui',
|
||||
'fehlermonitoring'
|
||||
),
|
||||
'customCSSs' => array('public/css/issues/issuesKonfiguration.css', 'public/css/sbadmin2/tablesort_bootstrap.css'),
|
||||
'customJSs' => array('public/js/issues/issuesKonfiguration.js', 'public/js/bootstrapper.js')
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
|
||||
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
|
||||
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h3 class="page-header">
|
||||
<?php echo $this->p->t('fehlermonitoring', 'fehlerKonfiguration') ?>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<div class="panel panel-default">
|
||||
<table class="table table-bordered" id="fehlercodeSelectTable">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="fehlerappSelect">App</label>
|
||||
<select class="form-control" name="fehlerappSelect" id="fehlerappSelect">
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-8">
|
||||
<div class="panel panel-default">
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<td class="tableCellNoRightBorder">
|
||||
<label for="konfigSelect"><?php echo $this->p->t('fehlermonitoring', 'konfigurationstyp') ?></label>
|
||||
<select class="form-control" name="konfigSelect" id="konfigSelect">
|
||||
</select>
|
||||
<i class="fa fa-info-circle" id="konfigurationstypInfoIcon"></i>
|
||||
</td>
|
||||
<td class="tableCellNoLeftBorder">
|
||||
<label for="fehlercodeSelect"><?php echo $this->p->t('fehlermonitoring', 'fehlercode') ?></label>
|
||||
<select class="form-control" name="fehlercodeSelect" id="fehlercodeSelect">
|
||||
</select>
|
||||
<i class="fa fa-info-circle" id="fehlercodeInfoIcon"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="konfigurationsWert" id="konfigurationsWert"
|
||||
placeholder="<?php echo $this->p->t('fehlermonitoring', 'konfigurationswertPlatzhalter') ?>">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" id="assignKonfiguration">
|
||||
<?php echo $this->p->t('fehlermonitoring', 'konfigurationswertZuweisen') ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div>
|
||||
<?php $this->load->view('system/issues/issuesKonfigurationData.php'); ?>
|
||||
</div>
|
||||
<div class="modal fade" id="fehlerInfo" tabindex="-1"
|
||||
role="dialog"
|
||||
aria-labelledby="fehlerInfoLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close"
|
||||
data-dismiss="modal"
|
||||
aria-hidden="true">×
|
||||
</button>
|
||||
<h4 class="modal-title" id="fehlerInfoLabel">
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body" id="fehlerInfoContent">
|
||||
<table class="table table-condensed table-bordered">
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo ucfirst($this->p->t('fehlermonitoring', 'fehlercode')) ?></b>
|
||||
</td>
|
||||
<td>
|
||||
<span id="fehlercodeInfo"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo ucfirst($this->p->t('fehlermonitoring', 'fehlerkurzbz')) ?></b>
|
||||
</td>
|
||||
<td>
|
||||
<span id="fehlerkurzbzInfo"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo ucfirst($this->p->t('fehlermonitoring', 'fehlertyp')) ?></b>
|
||||
</td>
|
||||
<td>
|
||||
<span id="fehlertypInfo"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo ucfirst($this->p->t('fehlermonitoring', 'fehlertext')) ?></b>
|
||||
</td>
|
||||
<td>
|
||||
<span id="fehlertextInfo"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal-fade -->
|
||||
<div class="modal fade" id="konfigurationsInfo" tabindex="-1"
|
||||
role="dialog"
|
||||
aria-labelledby="konfigurationstypInfoLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close"
|
||||
data-dismiss="modal"
|
||||
aria-hidden="true">×
|
||||
</button>
|
||||
<h4 class="modal-title" id="konfigurationstypInfoLabel">
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body" id="konfigurationstypInfoContent">
|
||||
<table class="table table-condensed table-bordered">
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo ucfirst($this->p->t('fehlermonitoring', 'konfigurationstyp')) ?></b>
|
||||
</td>
|
||||
<td>
|
||||
<span id="konfigurationstypInfo"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo ucfirst($this->p->t('fehlermonitoring', 'konfigurationsbeschreibung')) ?></b>
|
||||
</td>
|
||||
<td>
|
||||
<span id="konfigurationsbeschreibungInfo"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo ucfirst($this->p->t('fehlermonitoring', 'konfigurationsdatentyp')) ?></b>
|
||||
</td>
|
||||
<td>
|
||||
<span id="konfigurationsdatentypInfo"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal-fade -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
// get assigned Konfiguration
|
||||
$query = "SELECT
|
||||
konftyp.konfigurationstyp_kurzbz, fe.fehlercode, fe.fehler_kurzbz, konf.konfiguration, fe.app,
|
||||
konftyp.beschreibung AS konfigurationsbeschreibung, konftyp.konfigurationsdatentyp, fe.fehlertext
|
||||
FROM
|
||||
system.tbl_fehler_konfiguration konf
|
||||
JOIN system.tbl_fehler_konfigurationstyp konftyp USING (konfigurationstyp_kurzbz)
|
||||
JOIN system.tbl_fehler fe USING (fehlercode)
|
||||
ORDER BY
|
||||
konf.konfigurationstyp_kurzbz, fe.fehlercode";
|
||||
|
||||
$filterWidgetArray = array(
|
||||
'query' => $query,
|
||||
'app' => 'core',
|
||||
'datasetName' => 'fehlerKonfiguration',
|
||||
'filter_id' => $this->input->get('filter_id'),
|
||||
'tableUniqueId' => 'issuesKonfiguration',
|
||||
'requiredPermissions' => 'admin',
|
||||
'datasetRepresentation' => 'tablesorter',
|
||||
'additionalColumns' => array('Delete'),
|
||||
'columnsAliases' => array(
|
||||
ucfirst($this->p->t('fehlermonitoring', 'konfigurationstyp')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'fehlercode')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'fehlerkurzbz')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'konfigurationswert')),
|
||||
'application',
|
||||
ucfirst($this->p->t('fehlermonitoring', 'konfigurationsbeschreibung')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'konfigurationsdatentyp')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'fehlertext')),
|
||||
),
|
||||
'formatRow' => function($datasetRaw) {
|
||||
|
||||
$datasetRaw->{'Delete'} =
|
||||
"<button
|
||||
data-konfigurationstyp-kurzbz='".$datasetRaw->{'konfigurationstyp_kurzbz'}."'
|
||||
data-fehlercode='".$datasetRaw->{'fehlercode'}."'
|
||||
class='btn btn-default deleteBtn'>"
|
||||
.ucfirst($this->p->t('ui', 'loeschen'))."</button>";
|
||||
|
||||
if ($datasetRaw->{'konfigurationsbeschreibung'} == null)
|
||||
{
|
||||
$datasetRaw->{'konfigurationsbeschreibung'} = '-';
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'fehlertext'} == null)
|
||||
{
|
||||
$datasetRaw->{'fehlertext'} = '-';
|
||||
}
|
||||
|
||||
return $datasetRaw;
|
||||
}
|
||||
);
|
||||
|
||||
echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray);
|
||||
@@ -0,0 +1,7 @@
|
||||
#konfigSelect, #fehlercodeSelect {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#konfigurationstypInfoIcon,#fehlercodeInfoIcon {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
/**
|
||||
* Javascript file for Issues Zuständigkeiten assignment page
|
||||
*/
|
||||
|
||||
const FEHLERAPP_DROPDOWN_ID = "fehlerappSelect";
|
||||
const FEHLERCODE_DROPDOWN_ID = "fehlercodeSelect";
|
||||
const FEHLERKONFIGURATIONSTYP_DROPDOWN_ID = "konfigSelect";
|
||||
|
||||
var IssuesKonfiguration = {
|
||||
|
||||
fehlerkonfigArr: [], // for saving received fehlerkonfigs
|
||||
fehlercodesArr: [], // for saving received fehlercodes
|
||||
|
||||
getApps: function()
|
||||
{
|
||||
FHC_AjaxClient.ajaxCallGet(
|
||||
'system/issues/IssuesKonfiguration/getApps',
|
||||
null,
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
{
|
||||
// save loaded apps
|
||||
let apps = FHC_AjaxClient.getData(data);
|
||||
|
||||
// fill dropdown with apps
|
||||
IssuesKonfiguration._fillDropdown(
|
||||
FEHLERAPP_DROPDOWN_ID,
|
||||
"app",
|
||||
apps,
|
||||
null,
|
||||
false,
|
||||
"core"
|
||||
);
|
||||
|
||||
// Initiate getting of fehlercodes with apps
|
||||
IssuesKonfiguration.getFehlerKonfigurationByApp($("#"+FEHLERAPP_DROPDOWN_ID).val());
|
||||
}
|
||||
},
|
||||
errorCallback: function(jqXHR, textStatus, errorThrown) {
|
||||
FHC_DialogLib.alertError(textStatus);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
getFehlerKonfigurationByApp: function(app)
|
||||
{
|
||||
FHC_AjaxClient.ajaxCallGet(
|
||||
'system/issues/IssuesKonfiguration/getFehlerKonfigurationByApp',
|
||||
{
|
||||
app: app
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
{
|
||||
let fehlerKonfigurationData = FHC_AjaxClient.getData(data);
|
||||
|
||||
// save konfig and fehler data for displaying info later
|
||||
IssuesKonfiguration.fehlerkonfigArr = fehlerKonfigurationData.konfigurationstypen;
|
||||
IssuesKonfiguration.fehlercodesArr = fehlerKonfigurationData.fehler;
|
||||
|
||||
// display fehlercodes in dropdown
|
||||
let fehlerCodes = [];
|
||||
|
||||
for (let i = 0; i < fehlerKonfigurationData.fehler.length; i++)
|
||||
{
|
||||
let fe = fehlerKonfigurationData.fehler[i];
|
||||
|
||||
fehlerCodes.push(
|
||||
{
|
||||
fehlercode: fe.fehlercode,
|
||||
fullFehlerBezeichnung: fe.fehlercode + (!fe.fehler_kurzbz ? '' : ' - ' + fe.fehler_kurzbz)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
IssuesKonfiguration._fillDropdown(
|
||||
FEHLERCODE_DROPDOWN_ID,
|
||||
"fehlercode",
|
||||
fehlerCodes,
|
||||
"fullFehlerBezeichnung"
|
||||
);
|
||||
|
||||
// display fehlerkonfiguration in dropdown
|
||||
let konfigurationstypen = [];
|
||||
|
||||
for (let i = 0; i < fehlerKonfigurationData.konfigurationstypen.length; i++)
|
||||
{
|
||||
let konf = fehlerKonfigurationData.konfigurationstypen[i];
|
||||
|
||||
konfigurationstypen.push(
|
||||
{
|
||||
konfigurationstyp_kurzbz: konf.konfigurationstyp_kurzbz
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
IssuesKonfiguration._fillDropdown(
|
||||
FEHLERKONFIGURATIONSTYP_DROPDOWN_ID,
|
||||
"konfigurationstyp_kurzbz",
|
||||
konfigurationstypen
|
||||
);
|
||||
|
||||
// set delete event on buttons
|
||||
IssuesKonfiguration._setDeleteEvents();
|
||||
}
|
||||
},
|
||||
errorCallback: function(jqXHR, textStatus, errorThrown) {
|
||||
FHC_DialogLib.alertError(textStatus);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
saveFehlerKonfiguration: function(konfigurationstyp_kurzbz, fehlercode, konfigurationsWert)
|
||||
{
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
'system/issues/IssuesKonfiguration/saveFehlerKonfiguration',
|
||||
{
|
||||
konfigurationstyp_kurzbz: konfigurationstyp_kurzbz,
|
||||
fehlercode: fehlercode,
|
||||
konfigurationsWert: konfigurationsWert
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
{
|
||||
// show message, reset input fields and reload data after Zuständigkeit added
|
||||
FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t('fehlermonitoring', 'konfigurationGespeichert'))
|
||||
IssuesKonfiguration._reloadKonfigurationOverview();
|
||||
}
|
||||
else
|
||||
{
|
||||
// show error if no data
|
||||
let errorMsg = FHC_PhrasesLib.t('fehlermonitoring', 'konfigurationGespeichertFehler');
|
||||
if (FHC_AjaxClient.isError(data))
|
||||
errorMsg += ": "+FHC_AjaxClient.getError(data);
|
||||
FHC_DialogLib.alertError(errorMsg);
|
||||
}
|
||||
},
|
||||
errorCallback: function(jqXHR, textStatus, errorThrown) {
|
||||
FHC_DialogLib.alertError(textStatus);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
deleteKonfiguration: function(konfigurationstyp_kurzbz, fehlercode)
|
||||
{
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
'system/issues/IssuesKonfiguration/deleteKonfiguration',
|
||||
{
|
||||
konfigurationstyp_kurzbz: konfigurationstyp_kurzbz,
|
||||
fehlercode: fehlercode
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
{
|
||||
FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t('fehlermonitoring', 'konfigurationGeloescht'))
|
||||
// reload dataset to see change
|
||||
IssuesKonfiguration._reloadKonfigurationOverview();
|
||||
}
|
||||
else
|
||||
{
|
||||
FHC_DialogLib.alertError(FHC_PhrasesLib.t('fehlermonitoring', 'konfigurationGeloeschtFehler'));
|
||||
}
|
||||
},
|
||||
errorCallback: function(jqXHR, textStatus, errorThrown) {
|
||||
FHC_DialogLib.alertError(textStatus);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
_reloadKonfigurationOverview: function()
|
||||
{
|
||||
FHC_FilterWidget.reloadDataset();
|
||||
IssuesKonfiguration._setDeleteEvents();
|
||||
},
|
||||
_setDeleteEvents: function()
|
||||
{
|
||||
// set events on delete buttons
|
||||
$(".deleteBtn").click(
|
||||
function()
|
||||
{
|
||||
IssuesKonfiguration.deleteKonfiguration($(this).attr("data-konfigurationstyp-kurzbz"), $(this).attr("data-fehlercode"));
|
||||
}
|
||||
)
|
||||
},
|
||||
_fillDropdown: function(dropdownId, valueName, data, textName, includeNoSelectionOption, defaultValue)
|
||||
{
|
||||
// by default, displayed text in dropdown is the value
|
||||
if (!textName)
|
||||
textName = valueName;
|
||||
|
||||
// clear dropdown
|
||||
$("#"+dropdownId).empty();
|
||||
|
||||
// optionally include default "no selection" value
|
||||
if (includeNoSelectionOption === true)
|
||||
$("#"+dropdownId).append("<option value=''> -- "+FHC_PhrasesLib.t('fehlermonitoring', 'keineAuswahl')+" -- </option>");
|
||||
|
||||
// fill dropdown with values
|
||||
for (let i = 0; i < data.length; i++)
|
||||
{
|
||||
let val = data[i];
|
||||
|
||||
// the value selected by default
|
||||
let selected = val[valueName] === defaultValue ? " selected" : "";
|
||||
|
||||
// append option
|
||||
$("#"+dropdownId).append("<option value='"+val[valueName]+"'"+selected+">"+val[textName]+"</option>");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* When JQuery is up
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
|
||||
// initiate cascade of getting data, first apps
|
||||
IssuesKonfiguration.getApps();
|
||||
|
||||
// get new fehlercodes each time app is changed
|
||||
$("#"+FEHLERAPP_DROPDOWN_ID).change(
|
||||
function()
|
||||
{
|
||||
IssuesKonfiguration.getFehlerKonfigurationByApp($(this).val());
|
||||
}
|
||||
);
|
||||
|
||||
// get new fehlercodes each time app is changed
|
||||
$("#assignKonfiguration").click(
|
||||
function()
|
||||
{
|
||||
IssuesKonfiguration.saveFehlerKonfiguration(
|
||||
$("#"+FEHLERKONFIGURATIONSTYP_DROPDOWN_ID).val(),
|
||||
$("#"+FEHLERCODE_DROPDOWN_ID).val(),
|
||||
$("#konfigurationsWert").val()
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// set events for showing info modals
|
||||
$("#fehlercodeInfoIcon").click(
|
||||
function()
|
||||
{
|
||||
let fehlercode = $("#"+FEHLERCODE_DROPDOWN_ID).val();
|
||||
let fehlercodeData = {};
|
||||
|
||||
for (let i = 0; i < IssuesKonfiguration.fehlercodesArr.length; i++)
|
||||
{
|
||||
let fc = IssuesKonfiguration.fehlercodesArr[i];
|
||||
console.log(fc);
|
||||
|
||||
if (fc.fehlercode === fehlercode)
|
||||
{
|
||||
fehlercodeData = fc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fehlercodeData)
|
||||
return;
|
||||
|
||||
$("#fehlerInfoLabel").text(fehlercodeData.fehlercode + " - " + fehlercodeData.fehler_kurzbz);
|
||||
$("#fehlercodeInfo").text(fehlercodeData.fehlercode);
|
||||
$("#fehlerkurzbzInfo").text(fehlercodeData.fehler_kurzbz);
|
||||
$("#fehlertypInfo").text(fehlercodeData.fehlertyp_kurzbz);
|
||||
$("#fehlertextInfo").text(fehlercodeData.fehlertext);
|
||||
|
||||
$("#fehlerInfo").modal("show");
|
||||
}
|
||||
);
|
||||
|
||||
$("#konfigurationstypInfoIcon").click(
|
||||
function()
|
||||
{
|
||||
let konfigurationstyp_kurzbz = $("#"+FEHLERKONFIGURATIONSTYP_DROPDOWN_ID).val();
|
||||
let konfigurationstypData = {};
|
||||
|
||||
for (let i = 0; i < IssuesKonfiguration.fehlerkonfigArr.length; i++)
|
||||
{
|
||||
let konf = IssuesKonfiguration.fehlerkonfigArr[i];
|
||||
console.log(konf);
|
||||
|
||||
if (konf.konfigurationstyp_kurzbz === konfigurationstyp_kurzbz)
|
||||
{
|
||||
konfigurationstypData = konf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!konfigurationstypData)
|
||||
return;
|
||||
|
||||
$("#konfigurationstypInfo").text(konfigurationstypData.konfigurationstyp_kurzbz);
|
||||
$("#konfigurationsbeschreibungInfo").text(konfigurationstypData.beschreibung);
|
||||
$("#konfigurationsdatentypInfo").text(konfigurationstypData.konfigurationsdatentyp);
|
||||
|
||||
$("#konfigurationsInfo").modal("show");
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
@@ -289,7 +289,7 @@ var IssuesZustaendigkeiten = {
|
||||
let val = data[i];
|
||||
|
||||
// the value selected by default
|
||||
let selected = val === defaultValue ? " selected" : "";
|
||||
let selected = val[valueName] === defaultValue ? " selected" : "";
|
||||
|
||||
// append option
|
||||
$("#"+dropdownId).append("<option value='"+val[valueName]+"'"+selected+">"+val[textName]+"</option>");
|
||||
|
||||
@@ -1211,6 +1211,28 @@ $filters = array(
|
||||
',
|
||||
'oe_kurzbz' => null
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'dataset_name' => 'fehlerKonfiguration',
|
||||
'filter_kurzbz' => 'fehlerKonfiguration',
|
||||
'description' => '{Fehler Konfiguration}',
|
||||
'sort' => 1,
|
||||
'default_filter' => true,
|
||||
'filter' => '
|
||||
{
|
||||
"name": "Fehler Konfiguration",
|
||||
"columns": [
|
||||
{"name": "konfigurationstyp_kurzbz"},
|
||||
{"name": "fehlercode"},
|
||||
{"name": "fehler_kurzbz"},
|
||||
{"name": "konfiguration"},
|
||||
{"name": "app"}
|
||||
],
|
||||
"filters": []
|
||||
}
|
||||
',
|
||||
'oe_kurzbz' => null
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'dataset_name' => 'gruppenmanagement',
|
||||
|
||||
Reference in New Issue
Block a user