don't force the user to select a family if there's only one family... so we can basically ignore families
This commit is contained in:
parent
092e0c65b9
commit
221b4c2df8
3 changed files with 24 additions and 12 deletions
|
@ -40,6 +40,9 @@ if (isset($_POST["action"])) {
|
||||||
$pwd = $_POST["pwd"];
|
$pwd = $_POST["pwd"];
|
||||||
$email = $_POST["email"];
|
$email = $_POST["email"];
|
||||||
$familyname = $_POST["familyname"];
|
$familyname = $_POST["familyname"];
|
||||||
|
if (trim($familyname) == "") {
|
||||||
|
$familyname = "Default family";
|
||||||
|
}
|
||||||
|
|
||||||
// 1. create the family.
|
// 1. create the family.
|
||||||
$stmt = dbh($opt)->prepare("INSERT INTO {$opt["table_prefix"]}families(familyname) VALUES(?)");
|
$stmt = dbh($opt)->prepare("INSERT INTO {$opt["table_prefix"]}families(familyname) VALUES(?)");
|
||||||
|
@ -188,7 +191,7 @@ else {
|
||||||
<form name="setupform" id="setupform" method="post" action="setup.php">
|
<form name="setupform" id="setupform" method="post" action="setup.php">
|
||||||
<input type="hidden" name="action" value="setup">
|
<input type="hidden" name="action" value="setup">
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<table cellpadding="3" class="partbox" width="50%">
|
<table cellpadding="3" class="partbox">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" class="partboxtitle" align="center">Set Up the Gift Registry</td>
|
<td colspan="2" class="partboxtitle" align="center">Set Up the Gift Registry</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -229,7 +232,7 @@ else {
|
||||||
<input id="email" name="email" size="30" maxlength="255" type="text" value="<?php if (isset($_POST["email"])) echo htmlspecialchars($_POST["email"]); ?>" />
|
<input id="email" name="email" size="30" maxlength="255" type="text" value="<?php if (isset($_POST["email"])) echo htmlspecialchars($_POST["email"]); ?>" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr valign="top">
|
||||||
<td>Default/initial family name</td>
|
<td>Default/initial family name</td>
|
||||||
<td>
|
<td>
|
||||||
<input id="familyname" name="familyname" size="50" maxlength="255" type="text" value="<?php if (isset($_POST["familyname"])) echo htmlspecialchars($_POST["familyname"]); ?>" />
|
<input id="familyname" name="familyname" size="50" maxlength="255" type="text" value="<?php if (isset($_POST["familyname"])) echo htmlspecialchars($_POST["familyname"]); ?>" />
|
||||||
|
|
|
@ -95,11 +95,16 @@ while ($row = $stmt->fetch()) {
|
||||||
$families[] = $row;
|
$families[] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count($families) == 1) {
|
||||||
|
// default the family to the single family we have.
|
||||||
|
$familyid = $families[0]["familyid"];
|
||||||
|
}
|
||||||
$smarty->assign('families', $families);
|
$smarty->assign('families', $families);
|
||||||
$smarty->assign('username', $username);
|
$smarty->assign('username', $username);
|
||||||
$smarty->assign('fullname', $fullname);
|
$smarty->assign('fullname', $fullname);
|
||||||
$smarty->assign('email', $email);
|
$smarty->assign('email', $email);
|
||||||
$smarty->assign('familyid', $familyid);
|
$smarty->assign('familyid', $familyid);
|
||||||
|
$smarty->assign('familycount', count($families));
|
||||||
$smarty->assign('action', $_POST["action"]);
|
$smarty->assign('action', $_POST["action"]);
|
||||||
if (isset($error)) {
|
if (isset($error)) {
|
||||||
$smarty->assign('error', $error);
|
$smarty->assign('error', $error);
|
||||||
|
|
|
@ -128,17 +128,21 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
<input id="email" name="email" type="text" class="input-xlarge" value="{$email|escape:'htmlall'}" placeholder="you@somewhere.com">
|
<input id="email" name="email" type="text" class="input-xlarge" value="{$email|escape:'htmlall'}" placeholder="you@somewhere.com">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
{if $familycount > 1}
|
||||||
<label class="control-label" for="familyid">Family</label>
|
<div class="control-group">
|
||||||
<div class="controls">
|
<label class="control-label" for="familyid">Family</label>
|
||||||
<select name="familyid">
|
<div class="controls">
|
||||||
<option value="">(select one)</option>
|
<select name="familyid">
|
||||||
{foreach from=$families item=row}
|
<option value="">(select one)</option>
|
||||||
<option value="{$row.familyid}">{$row.familyname|escape:'htmlall'}</option>
|
{foreach from=$families item=row}
|
||||||
{/foreach}
|
<option value="{$row.familyid}">{$row.familyname|escape:'htmlall'}</option>
|
||||||
</select>
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{else}
|
||||||
|
<input type="hidden" name="familyid" value="{$familyid}">
|
||||||
|
{/if}
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button type="submit" class="btn btn-primary">Submit</button>
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
<button type="button" class="btn" onClick="document.location.href='login.php';">Cancel</button>
|
<button type="button" class="btn" onClick="document.location.href='login.php';">Cancel</button>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue