mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 08:52:21 +00:00
- Changes in view vw_msg_vars: added orgform, typ and switched anrede
- Before sending a message it checks if the subject and the body are present
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
Subject: <input type="text" value="" name="subject" size="70"><br/>
|
||||
Subject: <input id="subject" type="text" value="" name="subject" size="70"><br/>
|
||||
<textarea id="bodyTextArea" name="body"></textarea>
|
||||
<?php
|
||||
if (isset($variables))
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="span4">
|
||||
<button type="submit">Send</button>
|
||||
<button id="sendButton" type="button">Send</button>
|
||||
|
||||
<?php echo $this->templatelib->widget("Vorlage_widget", array("title" => "Vorlage")); ?>
|
||||
</div>
|
||||
@@ -129,6 +129,20 @@
|
||||
{
|
||||
$("#refresh").click(tinymcePreviewSetContent);
|
||||
}
|
||||
|
||||
if ($("#sendButton") && $("#sendForm"))
|
||||
{
|
||||
$("#sendButton").click(function() {
|
||||
if ($("#subject") && $("#subject").val() != '' && tinyMCE.get("bodyTextArea").getContent() != '')
|
||||
{
|
||||
$("#sendForm").submit();
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("Subject and text are required fields!");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function tinymcePreviewSetContent()
|
||||
|
||||
+34
-27
@@ -50,16 +50,14 @@ if($result = @$db->db_query("SELECT * FROM information_schema.role_table_grants
|
||||
}
|
||||
}
|
||||
|
||||
// CREATE VIEW public.vw_msg_vars and grants privileges
|
||||
if (!@$db->db_query("SELECT * FROM public.vw_msg_vars WHERE 0 = 1"))
|
||||
{
|
||||
$qry = '
|
||||
CREATE VIEW public.vw_msg_vars AS (
|
||||
// CREATE OR REPLACE VIEW public.vw_msg_vars and grants privileges
|
||||
$qry = '
|
||||
CREATE OR REPLACE VIEW public.vw_msg_vars AS (
|
||||
SELECT DISTINCT ON(p.person_id, pr.prestudent_id) p.person_id,
|
||||
pr.prestudent_id AS prestudent_id,
|
||||
p.nachname AS "Nachname",
|
||||
p.vorname AS "Vorname",
|
||||
p.geschlecht AS "Anrede",
|
||||
p.anrede AS "Anrede",
|
||||
a.strasse AS "Strasse",
|
||||
a.ort AS "Ort",
|
||||
a.plz AS "PLZ",
|
||||
@@ -68,9 +66,11 @@ if (!@$db->db_query("SELECT * FROM public.vw_msg_vars WHERE 0 = 1"))
|
||||
ke.kontakt AS "Email",
|
||||
kt.kontakt AS "Telefon",
|
||||
s.bezeichnung AS "Studiengang DE",
|
||||
s.english AS "Studiengang EN"
|
||||
FROM public.tbl_person p
|
||||
LEFT JOIN (
|
||||
s.english AS "Studiengang EN",
|
||||
st.bezeichnung AS "Typ",
|
||||
orgform_kurzbz AS "Orgform"
|
||||
FROM public.tbl_person p
|
||||
LEFT JOIN (
|
||||
SELECT person_id,
|
||||
kontakt
|
||||
FROM public.tbl_kontakt
|
||||
@@ -78,7 +78,7 @@ if (!@$db->db_query("SELECT * FROM public.vw_msg_vars WHERE 0 = 1"))
|
||||
AND kontakttyp = \'email\'
|
||||
ORDER BY kontakt_id DESC
|
||||
) ke USING(person_id)
|
||||
LEFT JOIN (
|
||||
LEFT JOIN (
|
||||
SELECT person_id,
|
||||
kontakt
|
||||
FROM public.tbl_kontakt
|
||||
@@ -86,7 +86,7 @@ if (!@$db->db_query("SELECT * FROM public.vw_msg_vars WHERE 0 = 1"))
|
||||
AND kontakttyp IN (\'telefon\', \'mobil\')
|
||||
ORDER BY kontakt_id DESC
|
||||
) kt USING(person_id)
|
||||
LEFT JOIN (
|
||||
LEFT JOIN (
|
||||
SELECT person_id,
|
||||
strasse,
|
||||
ort,
|
||||
@@ -98,24 +98,31 @@ if (!@$db->db_query("SELECT * FROM public.vw_msg_vars WHERE 0 = 1"))
|
||||
WHERE public.tbl_adresse.heimatadresse = TRUE
|
||||
ORDER BY adresse_id DESC
|
||||
) a USING(person_id)
|
||||
LEFT JOIN public.tbl_prestudent pr USING(person_id)
|
||||
INNER JOIN public.tbl_studiengang s USING(studiengang_kz)
|
||||
WHERE p.aktiv = TRUE
|
||||
ORDER BY p.person_id ASC, pr.prestudent_id ASC
|
||||
);';
|
||||
LEFT JOIN public.tbl_prestudent pr USING(person_id)
|
||||
INNER JOIN public.tbl_studiengang s USING(studiengang_kz)
|
||||
INNER JOIN public.tbl_studiengangstyp st USING(typ)
|
||||
WHERE p.aktiv = TRUE
|
||||
ORDER BY p.person_id ASC, pr.prestudent_id ASC
|
||||
);';
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong>public.vw_msg_vars: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo 'public.vw_msg_vars view created';
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong>public.vw_msg_vars: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo 'public.vw_msg_vars view created';
|
||||
|
||||
$qry = 'GRANT SELECT ON TABLE public.vw_msg_vars TO web;';
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong>public.vw_msg_vars: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo 'Granted privileges to <strong>web</strong> on public.vw_msg_vars';
|
||||
|
||||
$qry = 'GRANT SELECT ON TABLE public.vw_msg_vars TO web;';
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong>public.vw_msg_vars: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo 'granted privileges to web on public.vw_msg_vars';
|
||||
}
|
||||
$qry = 'GRANT SELECT ON TABLE public.vw_msg_vars TO vilesci;';
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong>public.vw_msg_vars: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo 'Granted privileges to <strong>vilesci</strong> on public.vw_msg_vars';
|
||||
|
||||
//Spalte anmerkung und rechnungsadresse in tbl_adresse
|
||||
if(!$result = @$db->db_query("SELECT rechnungsadresse FROM public.tbl_adresse LIMIT 1"))
|
||||
|
||||
Reference in New Issue
Block a user