First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// Ensure that only admin users have access to this module
|
||||
$AllowedUserTypes = array('SuperUser');
|
||||
if (checkPermission($AllowedUserTypes) != 1) {
|
||||
echo("<br>\n");
|
||||
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
||||
include "form.messages.php";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$ReplyTo = "sales@hotlunches.net";
|
||||
$ReplyDescription = "Hot Lunches On-Line";
|
||||
|
||||
?>
|
||||
<form action="/" method="post">
|
||||
<table width="90%" cellpadding="2" cellspacing="1" border="0">
|
||||
<tr>
|
||||
<td align='left' colspan='2'>
|
||||
<h3>Send Email Broadcast to Sales Contacts</h3>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Reply-To Address:</td>
|
||||
<td align='left'><input type="text" name="ReplyTo" value="<?php echo($ReplyTo); ?>" size="40"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Reply-To Description:</td>
|
||||
<td align='left'><input type="text" name="ReplyDescription" value="<?php echo($ReplyDescription); ?>" size="40"></td>
|
||||
</tr>
|
||||
<tr id="messageRow">
|
||||
<td align="right">Email Message:</td>
|
||||
<td align='left'>
|
||||
<select name="MessageID" id="MessageID" onChange="DoMessageChange();">
|
||||
<?php
|
||||
$customFields = array();
|
||||
$query = "select * from formatted_content " .
|
||||
"where content_type in ('E','S','Reminder') " .
|
||||
"and school_num = $school_num " .
|
||||
"order by date_modified desc,date_added desc";
|
||||
$results = db_query($query);
|
||||
if (db_num_rows($results)) {
|
||||
while ($row = db_fetch_array($results)) {
|
||||
$subject = $row["content_id"];
|
||||
$record_num = $row["record_num"];
|
||||
echo(" <option value='$record_num'>$subject</option>\n");
|
||||
$numFields = preg_match_all('/\{custom\.(text|textarea)\.([a-z0-9_]+)\}/', $row['content'], $matches, PREG_SET_ORDER);
|
||||
for ($i=0; $i<$numFields; $i++) {
|
||||
$customFields[] = array($record_num, $i+1, $matches[$i][1], $matches[$i][2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Email Template:</td>
|
||||
<td align="left">
|
||||
<select name="EmailTemplate">
|
||||
<?php BuildDirList("email_templates",array("html$","htm$","php$"),"EmailSalesContacts.php") ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Email Address:</td>
|
||||
<td align="left"><input type='text' name='selected_email' size='50'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'> </td>
|
||||
</tr>
|
||||
<?php
|
||||
// Get set of attachment files
|
||||
$files = array();
|
||||
$dir = opendir($attachdir);
|
||||
echo("\n\n<!-- $attachdir -->\n\n");
|
||||
$i = 0;
|
||||
|
||||
while (($file = readdir($dir)) != false) {
|
||||
if ($file == ".") continue;
|
||||
if ($file == "..") continue;
|
||||
$files[] = $file;
|
||||
$i+=1;
|
||||
}
|
||||
|
||||
if ($i > 0) {
|
||||
sort($files);
|
||||
?>
|
||||
<tr>
|
||||
<td align="right" valign="top">Attachments:</td>
|
||||
<td align='left'>
|
||||
<?php
|
||||
$count = 0;
|
||||
$jscript = "<script type='text/javascript'>\n";
|
||||
$jscript .= "var attachListArr = new Array();\n";
|
||||
|
||||
foreach ($files as $f) { ?>
|
||||
<input type="checkbox" class=checkbox name="attachments[]" id="<?php echo($f) ?>" value="<?php echo("$attachpath/$f") ?>"><?php echo($f); ?><br>
|
||||
<?php
|
||||
$jscript .= "attachListArr[$count] = '$f';\n";
|
||||
$count++;
|
||||
}
|
||||
$jscript .= "</script>\n";
|
||||
echo $jscript;
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<input type='submit' class='btn btn--primary' value="Send Broadcast Email">
|
||||
<!-- <input type="reset" class="submit" value="Clear Form"> -->
|
||||
<input type="hidden" name="action" value="email-sales-contacts">
|
||||
<input type="hidden" name="naction" value="confirm">
|
||||
</center>
|
||||
</form>
|
||||
|
||||
<script language="JavaScript">
|
||||
var currMessage=0;
|
||||
var goodRowDisplay = document.getElementById('messageRow').style.display;
|
||||
function DoMessageChange() {
|
||||
|
||||
// deactivate all attachment check boxes
|
||||
var arrLen=attachListArr.length;
|
||||
for (var j=0, len=arrLen; j<len; ++j) {
|
||||
var attachSel = attachListArr[j];
|
||||
document.getElementById(attachSel).checked = false;
|
||||
}
|
||||
|
||||
// activate the corrects ones
|
||||
var msgVar = document.getElementById('MessageID').value;
|
||||
var arrLen = (attachArr[msgVar] ? attachArr[msgVar].length : 0);
|
||||
for (var j=0, len=arrLen; j<len; ++j) {
|
||||
var attachSel = attachArr[msgVar][j];
|
||||
document.getElementById(attachSel).checked = true;
|
||||
}
|
||||
|
||||
if (currMessage) {
|
||||
i = 1;
|
||||
while (x = document.getElementById('custom_' + currMessage + '_' + i)) {
|
||||
x.disabled = true;
|
||||
document.getElementById('custom_row_'+ currMessage + '_' + i).style.display = 'none';
|
||||
i++;
|
||||
}
|
||||
}
|
||||
currMessage = msgVar;
|
||||
i = 1;
|
||||
while (x = document.getElementById('custom_' + currMessage + '_' + i)) {
|
||||
x.disabled = false;
|
||||
document.getElementById('custom_row_'+ currMessage + '_' + i).style.display = goodRowDisplay;
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<script language="JavaScript">
|
||||
DoMessageChange();
|
||||
</script>
|
||||
Reference in new issue
Block a user