From 1d0747827a27e95efdf26ae2ee617d3fc97792bb Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 7 Feb 2018 16:20:34 +0100 Subject: [PATCH] when sent to person, correct fields are shown in message preview, renamed message Date --- application/controllers/system/Messages.php | 25 +++++++++----- application/views/system/messageList.php | 2 +- application/views/system/messageWrite.php | 36 ++++++++++++--------- 3 files changed, 38 insertions(+), 25 deletions(-) diff --git a/application/controllers/system/Messages.php b/application/controllers/system/Messages.php index 4ad4c5e54..e0642ca02 100644 --- a/application/controllers/system/Messages.php +++ b/application/controllers/system/Messages.php @@ -31,6 +31,10 @@ class Messages extends VileSci_Controller { $prestudent_id = $this->input->post('prestudent_id'); $person_id = $this->input->post('person_id'); + $personOnly = false; + + if (isset($person_id) && !isset($prestudent_id)) + $personOnly = true; $msg = null; @@ -53,10 +57,10 @@ class Messages extends VileSci_Controller // Get variables $this->load->model('system/Message_model', 'MessageModel'); - if($prestudent_id !== null) - $this->getPrestudentMsgData($prestudent_id, $variablesArray, $msgVarsData); - elseif($person_id !== null) + if ($personOnly === true) $this->getPersonMsgData($person_id, $variablesArray, $msgVarsData); + else + $this->getPrestudentMsgData($prestudent_id, $variablesArray, $msgVarsData); // Organisation units used to get the templates $oe_kurzbz = array(); // A person can have more organisation units @@ -84,7 +88,8 @@ class Messages extends VileSci_Controller 'message' => $msg, 'variables' => $variablesArray, 'oe_kurzbz' => $oe_kurzbz, // used to get the templates - 'isAdmin' => $isAdmin->retval + 'isAdmin' => $isAdmin->retval, + 'personOnly' => $personOnly//indicates if sent only to persons ); $v = $this->load->view('system/messageWrite', $data); @@ -289,12 +294,18 @@ class Messages extends VileSci_Controller public function parseMessageText() { $prestudent_id = $this->input->get('prestudent_id'); + $person_id = $this->input->get('person_id'); $text = $this->input->get('text'); - if (isset($prestudent_id)) - { + $data = null; + + if (isset($person_id) && !isset($prestudent_id)) + $data = $this->MessageModel->getMsgVarsDataByPersonId($person_id); + elseif (isset($prestudent_id)) $data = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id); + if (isset($data)) + { $parsedText = ""; if (hasData($data)) { @@ -321,8 +332,6 @@ class Messages extends VileSci_Controller */ 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 diff --git a/application/views/system/messageList.php b/application/views/system/messageList.php index f6f251c48..c14da6217 100644 --- a/application/views/system/messageList.php +++ b/application/views/system/messageList.php @@ -2,7 +2,7 @@ - + diff --git a/application/views/system/messageWrite.php b/application/views/system/messageWrite.php index 2a4376720..12f7d5aa6 100644 --- a/application/views/system/messageWrite.php +++ b/application/views/system/messageWrite.php @@ -16,7 +16,7 @@ $this->load->view(
-
-   +  
+ name="subject" size="70">
@@ -122,7 +121,7 @@ $href = str_replace("/system/Messages/write", "/system/Messages/send", $_SERVER[ Preview: -
+
@@ -130,11 +129,11 @@ $href = str_replace("/system/Messages/write", "/system/Messages/send", $_SERVER[ '."\n"; } ?> @@ -206,7 +205,11 @@ $href = str_replace("/system/Messages/write", "/system/Messages/send", $_SERVER[ { if ($("#bodyTextArea")) { - tinyMCE.get("bodyTextArea").setContent(tinyMCE.get("bodyTextArea").getContent() + $(this).children(":selected").val()); + //if editor active add at cursor position, otherwise at end + if(tinymce.activeEditor.id === "bodyTextArea") + tinymce.activeEditor.execCommand('mceInsertContent', false, $(this).children(":selected").val()); + else + tinyMCE.get("bodyTextArea").setContent(tinyMCE.get("bodyTextArea").getContent() + $(this).children(":selected").val()); } }); } @@ -280,17 +283,18 @@ $href = str_replace("/system/Messages/write", "/system/Messages/send", $_SERVER[ } } - function parseMessageText(prestudent_id, text) + function parseMessageText(receiver_id, text) { $.ajax({ dataType: "json", url: "", - data: {"prestudent_id": prestudent_id, "text": text}, + data: {"": receiver_id, "text": text}, success: function (data, textStatus, jqXHR) { tinyMCE.get("tinymcePreview").setContent(data);
DatumGelesen am Sender Empfänger Betreff