message page converted

This commit is contained in:
Ryan Walberg 2012-11-16 02:34:02 +00:00
parent 026ea189d0
commit 299f91e596
2 changed files with 86 additions and 55 deletions

View file

@ -47,59 +47,27 @@ if (!empty($_GET["action"])) {
}
}
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
$query = "SELECT u.userid, u.fullname " .
"FROM {$OPT["table_prefix"]}shoppers s " .
"INNER JOIN {$OPT["table_prefix"]}users u ON u.userid = s.mayshopfor " .
"WHERE s.shopper = " . $userid . " " .
"AND pending = 0 " .
"ORDER BY u.fullname";
$rs = mysql_query($query) or die("Could not query: " . mysql_error());
$recipients = array();
while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {
$recipients[] = $row;
}
$rcount = mysql_num_rows($rs);
mysql_free_result($rs);
define('SMARTY_DIR',str_replace("\\","/",getcwd()).'/includes/Smarty-3.1.12/libs/');
require_once(SMARTY_DIR . 'Smarty.class.php');
$smarty = new Smarty();
$smarty->assign('recipients', $recipients);
$smarty->assign('rcount', $rcount);
$smarty->assign('userid', $userid);
$smarty->assign('isadmin', $_SESSION["admin"]);
$smarty->assign('opt', $OPT);
$smarty->display('message.tpl');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Gift Registry - Compose a Message</title>
<link href="styles.css" type="text/css" rel="stylesheet" />
</head>
<body>
<form name="message" method="get" action="message.php">
<input type="hidden" name="action" value="send">
<div align="center">
<TABLE class="partbox">
<TR valign="top">
<TD>
<b>Recipients</b><br />
<i>(Hold CTRL while clicking to<br />select multiple names.)</i>
</TD>
<TD>
<?php
$query = "SELECT u.userid, u.fullname " .
"FROM {$OPT["table_prefix"]}shoppers s " .
"INNER JOIN {$OPT["table_prefix"]}users u ON u.userid = s.mayshopfor " .
"WHERE s.shopper = " . $userid . " " .
"AND pending = 0 " .
"ORDER BY u.fullname";
$recipients = mysql_query($query) or die("Could not query: " . mysql_error());
?>
<select name="recipients[]" size="<?php echo mysql_num_rows($recipients) ?>" MULTIPLE>
<?php
while ($row = mysql_fetch_array($recipients,MYSQL_ASSOC)) {
?>
<option value="<?php echo $row["userid"] ?>"><?php echo $row["fullname"] ?></option>
<?php
}
?>
</select>
</TD>
</TR>
<TR valign="top">
<TD colspan="2">
<b>Message</b><br />
<textarea name="msg" rows="5" cols="40"></textarea>
</TD>
</TR>
</TABLE>
</div>
<p>
<div align="center">
<input type="submit" value="Send Message"/>
<input type="button" value="Cancel" onClick="document.location.href='index.php';">
</div>
</p>
</form>
</body>
</html>

63
src/templates/message.tpl Normal file
View file

@ -0,0 +1,63 @@
{*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Gift Registry - Compose a Message</title>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
{include file='navbar.tpl' isadmin=$isadmin}
<div class="container" style="padding-top: 60px;">
<div class="row">
<div class="span12">
<form name="message" method="get" action="message.php" class="well form-horizontal">
<input type="hidden" name="action" value="send">
<fieldset>
<legend>Send a message</legend>
<div class="control-group">
<label class="control-label" for="recipients[]">Recipients</label>
<div class="controls">
<select name="recipients[]" size="{$rcount}" MULTIPLE class="input-xlarge">
{foreach from=$recipients item=row}
<option value="{$row.userid}">{$row.fullname|escape:'htmlall'}</option>
{/foreach}
</select>
<p class="help-block">(Hold CTRL while clicking to select multiple names.)</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="msg">Message</label>
<div class="controls">
<textarea id="msg" name="msg" rows="5" cols="40" class="input-xlarge"></textarea>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Send Message</button>
<button type="button" onClick="document.location.href='index.php';">Cancel</button>
</div>
</fieldset>
</form>
</div>
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>