mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 07:52:16 +00:00
- Bug fix in MessageLib
- Now is possible to send a message to more recipients from FAS - Can be used the variables substitution from FAS
This commit is contained in:
@@ -3,14 +3,47 @@
|
||||
<body>
|
||||
<?php
|
||||
$href = str_replace("/system/Messages/write", "/system/Messages/send", $_SERVER["REQUEST_URI"]);
|
||||
$href = substr($href, 0, strrpos($href, '?'));
|
||||
?>
|
||||
<form id="sendForm" method="post" action="<?php echo $href; ?>">
|
||||
|
||||
<div class="row">
|
||||
<div class="span4">
|
||||
To: <?php echo $receiver->vorname . " " . $receiver->nachname; ?><br/>
|
||||
Subject: <input type="text" value="" name="subject"><br/>
|
||||
To:
|
||||
<?php
|
||||
for($i = 0; $i < count($receivers); $i++)
|
||||
{
|
||||
$receiver = $receivers[$i];
|
||||
// Every 10 recipients a new line
|
||||
if ($i > 1 && $i % 10 == 0)
|
||||
{
|
||||
echo '<br>';
|
||||
}
|
||||
echo $receiver->Vorname . " " . $receiver->Nachname . "; ";
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
Subject: <input type="text" value="" name="subject" size="70"><br/>
|
||||
<textarea id="bodyTextArea" name="body"></textarea>
|
||||
<?php
|
||||
if (isset($variables))
|
||||
{
|
||||
?>
|
||||
Variables:<br>
|
||||
<select id="variables" size="12" style="min-width:200px;">
|
||||
<?php
|
||||
foreach($variables as $key => $val)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $key; ?>"><?php echo $val; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -22,29 +55,114 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (isset($receivers) && count($receivers) > 0)
|
||||
{
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="span4">
|
||||
Recipients:<br>
|
||||
<select id="recipients">
|
||||
<option value="-1">Select...</option>
|
||||
<?php
|
||||
foreach($receivers as $receiver)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $receiver->prestudent_id; ?>"><?php echo $receiver->Nachname . " " . $receiver->Vorname; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<a href="#" id="refresh">Refresh</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="span4">
|
||||
<textarea id="tinymcePreview"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
for($i = 0; $i < count($receivers); $i++)
|
||||
{
|
||||
$receiver = $receivers[$i];
|
||||
echo '<input type="hidden" name="prestudents[]" value="' . $receiver->prestudent_id . '">' . "\n";
|
||||
}
|
||||
?>
|
||||
|
||||
</form>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
tinymce.init({
|
||||
selector: "#bodyTextArea"
|
||||
selector: "#bodyTextArea"
|
||||
});
|
||||
|
||||
<?php
|
||||
$url = str_replace("/system/Messages/write", "/system/Messages/getVorlage", $_SERVER["REQUEST_URI"]);
|
||||
?>
|
||||
tinymce.init({
|
||||
menubar: false,
|
||||
toolbar: false,
|
||||
readonly: 1,
|
||||
selector: "#tinymcePreview",
|
||||
statusbar: true
|
||||
});
|
||||
|
||||
function getVorlageText(vorlage_kurzbz)
|
||||
$(document).ready(function() {
|
||||
if ($("#variables"))
|
||||
{
|
||||
$("#variables").dblclick(function() {
|
||||
if ($("#bodyTextArea"))
|
||||
{
|
||||
tinyMCE.get("bodyTextArea").setContent(tinyMCE.get("bodyTextArea").getContent() + $(this).children(":selected").val());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ($("#recipients"))
|
||||
{
|
||||
$("#recipients").change(tinymcePreviewSetContent);
|
||||
}
|
||||
|
||||
if ($("#refresh"))
|
||||
{
|
||||
$("#refresh").click(tinymcePreviewSetContent);
|
||||
}
|
||||
});
|
||||
|
||||
function tinymcePreviewSetContent()
|
||||
{
|
||||
if ($("#tinymcePreview"))
|
||||
{
|
||||
if ($("#recipients").children(":selected").val() > -1)
|
||||
{
|
||||
parseMessageText($("#recipients").children(":selected").val(), tinyMCE.get("bodyTextArea").getContent());
|
||||
}
|
||||
else
|
||||
{
|
||||
tinyMCE.get("tinymcePreview").setContent("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parseMessageText(prestudent_id, text)
|
||||
{
|
||||
<?php
|
||||
$url = str_replace("/system/Messages/write", "/system/Messages/parseMessageText", $_SERVER["REQUEST_URI"]);
|
||||
$url = substr($url, 0, strrpos($url, '/'));
|
||||
?>
|
||||
|
||||
$.ajax({
|
||||
dataType: "json",
|
||||
url: "<?php echo $url; ?>",
|
||||
data: {"vorlage_kurzbz": vorlage_kurzbz},
|
||||
data: {"prestudent_id": prestudent_id, "text" : text},
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
tinyMCE.activeEditor.setContent(data.retval[0].text);
|
||||
tinyMCE.get("tinymcePreview").setContent(data);
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
alert(textStatus + " - " + errorThrown);
|
||||
alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user