receive page done, tinkered with other stuff

This commit is contained in:
Ryan Walberg 2012-11-13 01:43:35 +00:00
parent b5de4289d1
commit 38396087aa
5 changed files with 101 additions and 78 deletions

View file

@ -74,66 +74,26 @@ else if ($action == "receive") {
header("Location: " . getFullPath("index.php?message=Item+marked+as+received."));
exit;
}
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
?>
<!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 - Receive an Item</title>
<link href="styles.css" type="text/css" rel="stylesheet" />
</head>
<body>
<form name="receiver" method="get" action="receive.php">
<input type="hidden" name="action" value="receive">
<input type="hidden" name="itemid" value="<?php echo $_GET["itemid"]; ?>">
<div align="center">
<TABLE class="partbox">
<TR valign="top">
<TD>
<b>Select the buyer</b>
</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.shopper " .
"WHERE s.mayshopfor = " . $userid . " " .
"AND pending = 0 " .
"ORDER BY u.fullname";
$buyers = mysql_query($query) or die("Could not query: " . mysql_error());
?>
<select name="buyer" size="<?php echo mysql_num_rows($buyers) ?>">
<?php
while ($row = mysql_fetch_array($buyers,MYSQL_ASSOC)) {
?>
<option value="<?php echo $row["userid"] ?>"><?php echo $row["fullname"] ?></option>
<?php
}
?>
</select>
</TD>
</TR>
<tr valign="top">
<td>
<b>Quantity received<br />(maximum of <?php echo $quantity; ?>)</b>
</td>
<td>
<input type="text" name="quantity" value="1" size="3" maxlength="3">
</td>
</tr>
<tr>
<td colspan="2">
<i>Once you have received all of an item, it will be deleted.</i>
</td>
</tr>
</TABLE>
</div>
<p>
<div align="center">
<input type="submit" value="Receive Item"/>
<input type="button" value="Cancel" onClick="document.location.href='index.php';">
</div>
</p>
</form>
</body>
</html>
$query = "SELECT u.userid, u.fullname " .
"FROM {$OPT["table_prefix"]}shoppers s " .
"INNER JOIN {$OPT["table_prefix"]}users u ON u.userid = s.shopper " .
"WHERE s.mayshopfor = " . $userid . " " .
"AND pending = 0 " .
"ORDER BY u.fullname";
$rs = mysql_query($query) or die("Could not query: " . mysql_error());
$buyers = array();
while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {
$buyers[] = $row;
}
mysql_free_result($buyers);
define('SMARTY_DIR',str_replace("\\","/",getcwd()).'/includes/Smarty-3.1.12/libs/');
require_once(SMARTY_DIR . 'Smarty.class.php');
$smarty = new Smarty();
$smarty->assign('buyers', $buyers);
$smarty->assign('quantity', $quantity);
$smarty->assign('itemid', $itemid);
$smarty->assign('userid', $userid);
$smarty->assign('opt', $OPT);
$smarty->display('receive.tpl');

View file

@ -47,6 +47,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
</ul>
<ul id="main-menu-right" class="nav pull-right">
<li><a href="profile.php">Update Profile</a></li>
<li><a href="event.php">Manage Events</a></li>
{if $isadmin}
<li class="dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown">
@ -69,13 +70,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
</div>
<div class="container" style="padding-top: 60px;">
{if isset($message)}
<section id="message">
<div class="row">
<div class="span12">
<div class="alert alert-block">{$message|escape:'htmlall'}</div>
</div>
</div>
</section>
{/if}
{if $opt.show_helptext}
<section id="help">

View file

@ -38,14 +38,17 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<li>The quantity field indicates the number of that item that you want. Once that many are bought or reserved, no more will be available. If you have no limit on how many you want, enter 999 (for example).</li>
{/if}
</ul>
</div>
</div>
</div>
{/if}
<div class="row">
<div class="class6 offset3">
<div class="span8 offset2">
<form name="item" method="POST" action="item.php" enctype="multipart/form-data" class="well form-horizontal">
<fieldset>
<legend>Add/Edit Item</legend>
<legend>{if $action == 'edit' || (isset($haserror) && $action == 'update')}Edit Item{else}Add Item{/if}</legend>
{if $action == 'edit' || (isset($haserror) && $action == 'update')}
<input type="hidden" name="itemid" value="<?php echo (int) $_REQUEST["itemid"]; ?>">
<input type="hidden" name="itemid" value="{$itemid}">
<input type="hidden" name="action" value="update">
{elseif $action == "add" || (isset($haserror) && $action == 'insert')}
<input type="hidden" name="action" value="insert">
@ -62,10 +65,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<div class="control-group {if isset($category_error)}warning{/if}">
<label class="control-label" for="category">Category</label>
<div class="controls">
<select name="category" class="input-xlarge">
<select id="category" name="category" class="input-xlarge">
<option value="" {if $category == NULL}SELECTED{/if}>Uncategorized</option>
{foreach from=$categories item=row}
<option value="$row.categoryid" {if $row.categoryid == $category}SELECTED{/if}>{$row.category|escape:'htmlall'}</option>
<option value="{$row.categoryid}" {if $row.categoryid == $category}SELECTED{/if}>{$row.category|escape:'htmlall'}</option>
{/foreach}
</select>
{if isset($category_error)}
@ -85,7 +88,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<div class="control-group {if isset($source_error)}warning{/if}">
<label class="control-label" for="source">Store/Retailer</label>
<div class="controls">
<input id="source" name="source" type="text" value="{$source|escape:'htmlall'}" class="input-xlarge" maxlength="255" size="50">
<input id="source" name="source" type="text" value="{$source|escape:'htmlall'}" class="input-xlarge" maxlength="255" size="50" placeholder="Source">
{if isset($source_error)}
<span class="help-inline">{$source_error}</span>
{/if}
@ -94,9 +97,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<div class="control-group {if isset($ranking_error)}warning{/if}">
<label class="control-label" for="ranking">Ranking</label>
<div class="controls">
<select id="ranking" name="ranking" size="{$ranks_count}" class="input-xlarge">
<select id="ranking" name="ranking" multiple="multiple" class="input-xlarge">
{foreach from=$ranks item=row}
<option value="$row.ranking" {if $row.ranking == $ranking}SELECTED{/if}>{$row.title}</option>
<option value="{$row.ranking}" {if $row.ranking == $ranking}SELECTED{/if}>{$row.title}</option>
{/foreach}
</select>
{if isset($ranking_error)}
@ -125,7 +128,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<span class="help-inline">{$url_error}</span>
{/if}
</div>
{/div>
</div>
{if $opt.allow_images}
<div class="control-group">
<label class="control-label" for="image">Image (optional)</label>
@ -151,7 +154,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<div class="control-group">
<label class="control-label" for="comment">Comment</label>
<div class="controls">
<textarea id="comment" name="comment" class="input-xlarge" rows="5" cols="40">{$comment|escape:'htmlall'}</textarea>
<textarea id="comment" name="comment" class="input-xlarge" rows="2" cols="40">{$comment|escape:'htmlall'}</textarea>
</div>
</div>
<div class="form-actions">

View file

@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<body>
<div class="container">
<div class="row">
<div class="span6 offset3">
<div class="span8 offset2">
<form name="login" method="post" action="login.php" class="well form-horizontal">
<fieldset>
<legend>Gift Registry</legend>
@ -52,12 +52,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
</div>
</div>
<div class="row">
<div class="span3 offset3">
<div class="span4 offset2">
<div class="well">
<a href="signup.php">Need an account?</a>
</div>
</div>
<div class="span3">
<div class="span4">
<div class="well">
<a href="forgot.php">Forgot your password?</a>
</div>

61
src/templates/receive.tpl Normal file
View file

@ -0,0 +1,61 @@
{*
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 - Receive an Item</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<div class="span8 offset2">
<form name="receiver" method="get" action="receive.php" class="well form-horizontal">
<input type="hidden" name="action" value="receive">
<input type="hidden" name="itemid" value="{$itemid}">
<fieldset>
<legend>Select the buyer and quantity</legend>
<div class="control-group">
<label class="control-label" for="buyer">Buyer</label>
<div class="controls">
<select id="buyer" name="buyer" class="input-xlarge">
{foreach from=$buyers item=row}
<option value="{$row.userid}">{$row.fullname|escape:'htmlall'}</option>
{/foreach}
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="quantity">Quantity received (maximum of {$quantity})</label>
<div class="controls">
<input type="text" id="quantity" name="quantity" value="1" size="3" maxlength="3">
<p class="help-block">Once you have received all of an item, it will be deleted.</p>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Receive Item</button>
<button type="button" onClick="document.location.href='index.php';">Cancel</button>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</body>
</html>