mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
added message table, added tinymce editor to header and messageList
This commit is contained in:
@@ -19,9 +19,6 @@ class Messages extends VileSci_Controller
|
||||
// Loads the widget library
|
||||
$this->load->library('WidgetLib');
|
||||
|
||||
// Loads the person log library
|
||||
$this->load->library('PersonLogLib');
|
||||
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
$this->_setAuthUID(); // sets property uid
|
||||
@@ -208,6 +205,9 @@ class Messages extends VileSci_Controller
|
||||
break;
|
||||
}
|
||||
|
||||
// Loads the person log library
|
||||
$this->load->library('PersonLogLib');
|
||||
|
||||
//write log entry
|
||||
$this->personloglib->log(
|
||||
$dataArray['person_id'],
|
||||
@@ -313,4 +313,21 @@ class Messages extends VileSci_Controller
|
||||
->set_output(json_encode($parsedText));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs message data for a message (identified my msg id and receiver id) in JSON format
|
||||
* @param $msg_id
|
||||
* @param $receiver_id
|
||||
*/
|
||||
public function getMessageFromIds($msg_id, $receiver_id)
|
||||
{
|
||||
/* $this->MessageModel->addSelect('subject, body, oe_kurzbz');
|
||||
$msg = $this->MessageModel->load($msg_id);*/
|
||||
$msg = $this->messagelib->getMessage($msg_id, $receiver_id);
|
||||
|
||||
$this->output
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode(array($msg->retval[0])));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,7 +61,8 @@ class InfoCenter extends VileSci_Controller
|
||||
$this->load->model('crm/statusgrund_model', 'StatusgrundModel');
|
||||
$this->load->model('person/notiz_model', 'NotizModel');
|
||||
$this->load->model('person/person_model', 'PersonModel');
|
||||
$this->load->model('system/Filters_model', 'FiltersModel');
|
||||
$this->load->model('system/message_model', 'MessageModel');
|
||||
$this->load->model('system/filters_model', 'FiltersModel');
|
||||
|
||||
// Loads libraries
|
||||
$this->load->library('DmsLib');
|
||||
@@ -484,6 +485,13 @@ class InfoCenter extends VileSci_Controller
|
||||
show_error($dokumente_nachgereicht->retval);
|
||||
}
|
||||
|
||||
$messages = $this->MessageModel->getMessagesOfPerson($person_id, 1);
|
||||
|
||||
if (isError($messages))
|
||||
{
|
||||
show_error($messages->retval);
|
||||
}
|
||||
|
||||
$logs = $this->personloglib->getLogs($person_id);
|
||||
|
||||
$notizen = $this->NotizModel->getNotiz($person_id);
|
||||
@@ -506,6 +514,7 @@ class InfoCenter extends VileSci_Controller
|
||||
'stammdaten' => $stammdaten->retval,
|
||||
'dokumente' => $dokumente->retval,
|
||||
'dokumente_nachgereicht' => $dokumente_nachgereicht->retval,
|
||||
'messages' => $messages->retval,
|
||||
'logs' => $logs,
|
||||
'notizen' => $notizen->retval,
|
||||
'messagelink' => $messagelink
|
||||
|
||||
@@ -85,6 +85,77 @@ class Message_model extends DB_Model
|
||||
return $this->execQuery($sql, $parametersArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets massages with a person being sender OR receiver.
|
||||
* @param $person_id
|
||||
* @param null $status message status. by default, latest status is returned
|
||||
* @return array|null
|
||||
*/
|
||||
public function getMessagesOfPerson($person_id, $status = null)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||
return $ent;
|
||||
|
||||
$sql = 'SELECT m.message_id,
|
||||
m.person_id,
|
||||
m.subject,
|
||||
m.body,
|
||||
m.priority,
|
||||
m.insertamum,
|
||||
m.relationmessage_id,
|
||||
m.oe_kurzbz,
|
||||
se.person_id AS sepersonid,
|
||||
se.anrede AS seanrede,
|
||||
se.titelpost AS setitelpost,
|
||||
se.titelpre AS setitelpre,
|
||||
se.nachname AS senachname,
|
||||
se.vorname AS sevorname,
|
||||
se.vornamen AS sevornamen,
|
||||
re.person_id AS repersonid,
|
||||
re.anrede AS reanrede,
|
||||
re.titelpost AS retitelpost,
|
||||
re.titelpre AS retitelpre,
|
||||
re.nachname AS renachname,
|
||||
re.vorname AS revorname,
|
||||
re.vornamen AS revornamen,
|
||||
s.status,
|
||||
s.statusinfo,
|
||||
s.insertamum AS statusamum
|
||||
FROM public.tbl_msg_message m
|
||||
JOIN public.tbl_msg_recipient r ON m.message_id = r.message_id
|
||||
JOIN public.tbl_person se ON (m.person_id = se.person_id)
|
||||
JOIN public.tbl_person re ON (r.person_id = re.person_id)
|
||||
LEFT JOIN (
|
||||
SELECT message_id, person_id, status, statusinfo, insertamum
|
||||
FROM public.tbl_msg_status
|
||||
%s
|
||||
ORDER BY insertamum DESC
|
||||
) s ON (m.message_id = s.message_id AND re.person_id = s.person_id)
|
||||
WHERE se.person_id = ?
|
||||
OR re.person_id = ?
|
||||
';
|
||||
|
||||
if (is_numeric($status))
|
||||
{
|
||||
$sql = sprintf($sql, 'WHERE status = '.$status);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = sprintf($sql, '');
|
||||
}
|
||||
|
||||
$parametersArray = array($person_id, $person_id);
|
||||
|
||||
return $this->execQuery($sql, $parametersArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* getMessageVars
|
||||
*/
|
||||
|
||||
@@ -8,6 +8,7 @@ $this->load->view(
|
||||
'fontawesome' => true,
|
||||
'jqueryui' => true,
|
||||
'tablesorter' => true,
|
||||
'tinymce' => true,
|
||||
'sbadmintemplate' => true,
|
||||
'customCSSs' => array('skin/admintemplate.css', 'skin/tablesort_bootstrap.css')
|
||||
)
|
||||
@@ -165,11 +166,13 @@ $this->load->view(
|
||||
<div class="table-responsive">
|
||||
<table id="doctable" class="table table-bordered">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Typ</th>
|
||||
<th>Uploaddatum</th>
|
||||
<th>Ausstellungsnation</th>
|
||||
<th>Formal geprüft</th>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Typ</th>
|
||||
<th>Uploaddatum</th>
|
||||
<th>Ausstellungsnation</th>
|
||||
<th>Formal geprüft</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
@@ -198,10 +201,12 @@ $this->load->view(
|
||||
<p>Nachzureichende Dokumente:</p>
|
||||
<table id="nachgdoctable" class="table table-bordered">
|
||||
<thead>
|
||||
<th>Typ</th>
|
||||
<th>Nachzureichen am</th>
|
||||
<th>Ausstellungsnation</th>
|
||||
<th>Anmerkung</th>
|
||||
<tr>
|
||||
<th>Typ</th>
|
||||
<th>Nachzureichen am</th>
|
||||
<th>Ausstellungsnation</th>
|
||||
<th>Anmerkung</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
@@ -589,6 +594,25 @@ $this->load->view(
|
||||
</div> <!-- /.column freigabe-->
|
||||
</div> <!-- /.row freigabe-->
|
||||
</section>
|
||||
<section>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading text-center">
|
||||
<a name="Nachrichten"></a>
|
||||
<h4 class="text-center">Nachrichten</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<?php
|
||||
$this->load->view('system/messageList.php', $messages);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
@@ -621,15 +645,16 @@ $this->load->view(
|
||||
</form>
|
||||
<table id="notiztable" class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<th>Datum</th>
|
||||
<th>Notiz</th>
|
||||
<th>User</th>
|
||||
<tr>
|
||||
<th>Datum</th>
|
||||
<th>Notiz</th>
|
||||
<th>User</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($notizen as $notiz): ?>
|
||||
<tr data-toggle="tooltip"
|
||||
title="<?php echo isset($notiz->text) ? $notiz->text : '' ?>">
|
||||
title="<?php echo isset($notiz->text) ? strip_tags($notiz->text) : '' ?>">
|
||||
<td><?php echo date_format(date_create($notiz->insertamum), 'd.m.Y H:i:s') ?></td>
|
||||
<td><?php echo html_escape($notiz->titel) ?></td>
|
||||
<td><?php echo $notiz->verfasser_uid ?></td>
|
||||
@@ -641,9 +666,11 @@ $this->load->view(
|
||||
<div class="col-lg-6">
|
||||
<table id="logtable" class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<th>Datum</th>
|
||||
<th>Aktivität</th>
|
||||
<th>User</th>
|
||||
<tr>
|
||||
<th>Datum</th>
|
||||
<th>Aktivität</th>
|
||||
<th>User</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($logs as $log): ?>
|
||||
@@ -669,11 +696,18 @@ $this->load->view(
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function ()
|
||||
$(document).ready(
|
||||
function ()
|
||||
{
|
||||
//javascript bootstrap hack - not nice!
|
||||
$("select").addClass('form-control');
|
||||
$("table").addClass('table-condensed');
|
||||
$("#logtable, #notiztable").addClass('table-hover');
|
||||
|
||||
//initialise table sorter
|
||||
addTablesorter("doctable", [[2, 1], [1, 0]], ["zebra"]);
|
||||
addTablesorter("nachgdoctable", [[2, 0], [1, 1]], ["zebra"]);
|
||||
addTablesorter("msgtable", [[0, 1], [2, 0]], ["zebra", "filter"]);
|
||||
addTablesorter("logtable", [[0, 1]], ["filter"]);
|
||||
addTablesorter("notiztable", [[0, 1]], ["filter"]);
|
||||
|
||||
@@ -681,68 +715,12 @@ $this->load->view(
|
||||
togglePager(23, "logtable", "logpager");
|
||||
togglePager(10, "notiztable", "notizpager");
|
||||
|
||||
function addTablesorter(tableid, sortList, widgets)
|
||||
{
|
||||
$("#" + tableid).tablesorter(
|
||||
{
|
||||
theme: "default",
|
||||
dateFormat: "ddmmyyyy",
|
||||
sortList: sortList,
|
||||
widgets: widgets
|
||||
}
|
||||
);
|
||||
|
||||
//hide filters if less than 2 datarows (+ 2 for headings and filter row itself)
|
||||
if ($("#" + tableid + " tr").length < 4)
|
||||
{
|
||||
$("#" + tableid + " tr.tablesorter-filter-row").hide();
|
||||
}
|
||||
}
|
||||
|
||||
function togglePager(size, tableid, pagerid)
|
||||
{
|
||||
var html =
|
||||
'<div id="' + pagerid + '" class="pager"> ' +
|
||||
'<form class="form-inline">' +
|
||||
'<i class="fa fa-step-backward first"></i> ' +
|
||||
'<i class="fa fa-backward prev"></i>' +
|
||||
'<span class="pagedisplay"></span>' +
|
||||
'<i class="fa fa-forward next"></i> ' +
|
||||
'<i class="fa fa-step-forward last"></i>' +
|
||||
'</form>' +
|
||||
'</div>';
|
||||
|
||||
var rowcount = $("#" + tableid + " tr").length;
|
||||
|
||||
//not show pager if on first table page
|
||||
if (rowcount > size)
|
||||
{
|
||||
var table = $("#" + tableid);
|
||||
table.after(html);
|
||||
|
||||
table.tablesorterPager(
|
||||
{
|
||||
container: $("#" + pagerid),
|
||||
size: size,
|
||||
cssDisabled: 'disabled',
|
||||
savePages: false,
|
||||
output: '{startRow} – {endRow} / {totalRows} Zeilen'
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//initialise datepicker
|
||||
$.datepicker.setDefaults($.datepicker.regional['de']);
|
||||
$(".dateinput").datepicker({
|
||||
"dateFormat": "dd.mm.yy"
|
||||
});
|
||||
|
||||
//javascript bootstrap hack - not nice!
|
||||
$("select").addClass('form-control');
|
||||
$("table").addClass('table-condensed');
|
||||
$("#logtable, #notiztable").addClass('table-hover');
|
||||
|
||||
//add submit event to message send link
|
||||
$("#sendmsglink").click(
|
||||
function()
|
||||
@@ -781,6 +759,57 @@ $this->load->view(
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
function addTablesorter(tableid, sortList, widgets)
|
||||
{
|
||||
$("#" + tableid).tablesorter(
|
||||
{
|
||||
theme: "default",
|
||||
dateFormat: "ddmmyyyy",
|
||||
sortList: sortList,
|
||||
widgets: widgets
|
||||
}
|
||||
);
|
||||
|
||||
//hide filters if less than 2 datarows (+ 2 for headings and filter row itself)
|
||||
if ($("#" + tableid + " tr").length < 4)
|
||||
{
|
||||
$("#" + tableid + " tr.tablesorter-filter-row").hide();
|
||||
}
|
||||
}
|
||||
|
||||
function togglePager(size, tableid, pagerid)
|
||||
{
|
||||
var html =
|
||||
'<div id="' + pagerid + '" class="pager"> ' +
|
||||
'<form class="form-inline">' +
|
||||
'<i class="fa fa-step-backward first"></i> ' +
|
||||
'<i class="fa fa-backward prev"></i>' +
|
||||
'<span class="pagedisplay"></span>' +
|
||||
'<i class="fa fa-forward next"></i> ' +
|
||||
'<i class="fa fa-step-forward last"></i>' +
|
||||
'</form>' +
|
||||
'</div>';
|
||||
|
||||
var rowcount = $("#" + tableid + " tr").length;
|
||||
|
||||
//not show pager if on first table page
|
||||
if (rowcount > size)
|
||||
{
|
||||
var table = $("#" + tableid);
|
||||
table.after(html);
|
||||
|
||||
table.tablesorterPager(
|
||||
{
|
||||
container: $("#" + pagerid),
|
||||
size: size,
|
||||
cssDisabled: 'disabled',
|
||||
savePages: false,
|
||||
output: '{startRow} – {endRow} / {totalRows} Zeilen'
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<div class="col-lg-8">
|
||||
<table id="msgtable" class="table table-bordered table-condensed tablesort-hover tablesort-active">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Datum</th>
|
||||
<th>Sender</th>
|
||||
<th>Empfänger</th>
|
||||
<th>Betreff</th>
|
||||
<th>Gelesen am</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($messages as $message): ?>
|
||||
<tr id="<?php echo $message->message_id.'_'.$message->repersonid ?>" style="cursor: pointer">
|
||||
<td><?php echo isset($message->insertamum) ? date_format(date_create($message->insertamum), 'd.m.Y H:i:s') : '' ?></td>
|
||||
<td><?php echo $message->sevorname.' '.$message->senachname ?></td>
|
||||
<td><?php echo $message->revorname.' '.$message->renachname ?></td>
|
||||
<td><?php echo $message->subject ?></td>
|
||||
<td><?php echo isset($message->statusamum) ? date_format(date_create($message->statusamum), 'd.m.Y H:i:s') : '' ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<br>
|
||||
<div class="text-center"><label for="msgbody" id="msgsubject"></label></div>
|
||||
<div>
|
||||
<textarea id="msgbody"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(
|
||||
function ()
|
||||
{
|
||||
var lastelement = $("#msgtable tbody tr").last();
|
||||
var id = lastelement.attr('id');
|
||||
|
||||
getMsgBody(id);
|
||||
lastelement.find("td").addClass("tablesort-active");
|
||||
|
||||
//add click event on message table for message preview
|
||||
$("#msgtable tbody tr").click(
|
||||
function ()
|
||||
{
|
||||
$("#msgtable").find("td").removeClass("tablesort-active");
|
||||
$(this).find("td").addClass("tablesort-active");
|
||||
getMsgBody(this.id);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//retrieve message data from message and reiver id via AJAX
|
||||
function getMsgBody(id)
|
||||
{
|
||||
var msgid = id.substr(0, id.indexOf('_'));
|
||||
var recid = id.substr(id.indexOf('_') + 1);
|
||||
|
||||
$.ajax(
|
||||
{
|
||||
dataType: "json",
|
||||
url: "<?php echo base_url("/index.ci.php/system/Messages/getMessageFromIds/") ?>" + msgid + "/" + recid,
|
||||
success: function (data, textStatus, jqXHR)
|
||||
{
|
||||
$("#msgsubject").text(data[0].subject);
|
||||
tinyMCE.get("msgbody").setContent(data[0].body);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown)
|
||||
{
|
||||
alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
tinymce.init({
|
||||
menubar: false,
|
||||
toolbar: false,
|
||||
readonly: 1,
|
||||
selector: "#msgbody",
|
||||
statusbar: false,
|
||||
height: 300/*,
|
||||
plugins: "autoresize"*/
|
||||
});
|
||||
</script>
|
||||
@@ -13,6 +13,7 @@ $jqueryui = isset($jqueryui) ? $jqueryui : false;
|
||||
$bootstrap = isset($bootstrap) ? $bootstrap : false;
|
||||
$fontawesome = isset($fontawesome) ? $fontawesome : false;
|
||||
$tablesorter = isset($tablesorter) ? $tablesorter : false;
|
||||
$tinymce = isset($tinymce) ? $tinymce : false;
|
||||
$sbadmintemplate = isset($sbadmintemplate) ? $sbadmintemplate : false;
|
||||
|
||||
/**
|
||||
@@ -131,6 +132,9 @@ function _generateJSsInclude($JSs)
|
||||
_generateJSsInclude('vendor/mottie/tablesorter/dist/js/jquery.tablesorter.widgets.min.js');
|
||||
_generateJSsInclude('vendor/mottie/tablesorter/dist/js/extras/jquery.tablesorter.pager.min.js');
|
||||
}
|
||||
//tinymce JS
|
||||
if($tinymce === true) _generateJSsInclude('vendor/tinymce/tinymce/tinymce.min.js') ;
|
||||
|
||||
// sb admin template JS
|
||||
if ($sbadmintemplate === true)
|
||||
{
|
||||
|
||||
@@ -20,16 +20,17 @@
|
||||
}
|
||||
|
||||
/* set colors of zebra widget */
|
||||
table.tablesorter tbody tr.even td{
|
||||
background-color: #ffff !important;
|
||||
table.tablesorter tbody tr.even td, table.tablesorter tbody tr.even:hover, table.tablesorter tbody tr.even td:hover{
|
||||
background-color: #ffff;
|
||||
}
|
||||
|
||||
table.tablesorter tbody tr.odd td{
|
||||
background-color: #f5f5f5 !important;
|
||||
table.tablesorter tbody tr.odd td, table.tablesorter tbody tr.odd:hover, table.tablesorter tbody tr.odd td:hover{
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
table.tablesorter tbody tr.odd:hover{
|
||||
background-color: #f5f5f5 !important;
|
||||
/* colors for hover over table rows and clicked rows*/
|
||||
table.tablesort-hover tr:hover, .tablesort-active{
|
||||
background-color: #dfdfdf !important;
|
||||
}
|
||||
|
||||
/* Remove background color from filter row */
|
||||
|
||||
Reference in New Issue
Block a user