- Vorlage widget now add an empty element to the beginning of the drop

down box
- Bugfix message write controller:
	- JS function getVorlageText was missing
	- Wrong URL in form action
This commit is contained in:
bison-paolo
2017-03-13 16:39:38 +01:00
parent 39d63d287a
commit 14aab3dd56
3 changed files with 35 additions and 2 deletions
+19 -1
View File
@@ -3,7 +3,6 @@
<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; ?>">
@@ -166,5 +165,24 @@
}
});
}
function getVorlageText(vorlage_kurzbz)
{
<?php
$url = str_replace("/system/Messages/write", "/system/Messages/getVorlage", $_SERVER["REQUEST_URI"]);
?>
$.ajax({
dataType: "json",
url: "<?php echo $url; ?>",
data: {"vorlage_kurzbz": vorlage_kurzbz},
success: function(data, textStatus, jqXHR) {
tinyMCE.get("bodyTextArea").setContent(data.retval[0].text);
},
error: function(jqXHR, textStatus, errorThrown) {
alert(textStatus + " - " + errorThrown);
}
});
}
</script>
</html>
+10 -1
View File
@@ -1,7 +1,16 @@
<select name="vorlage">
<?php foreach($vorlage as $v): ?>
<option value="<?php echo $v->vorlage_kurzbz; ?>" onClick="getVorlageText(this.value)">
<?php echo $v->vorlage_kurzbz . (isset($v->bezeichnung) ? " - " . $v->bezeichnung : ""); ?>
<?php
if ($v->vorlage_kurzbz == '-1')
{
echo $v->bezeichnung;
}
else
{
echo $v->vorlage_kurzbz . (isset($v->bezeichnung) ? " - " . $v->bezeichnung : "");
}
?>
</option>
<?php endforeach; ?>
</select>
+6
View File
@@ -10,6 +10,12 @@ class Vorlage_widget extends Widget
if (is_object($result) && $result->error == EXIT_SUCCESS)
{
// Adding an empty element
$emptyVorlage = new stdClass();
$emptyVorlage->vorlage_kurzbz = '-1';
$emptyVorlage->bezeichnung = 'Select a template...';
array_unshift($result->retval, $emptyVorlage);
$data = array("vorlage" => $result->retval);
$this->view("widgets/vorlage", $data);
}