[TEP-COMMIT] [CVS catalog] the new account edit page based on a CSS layout
hpdl-OfajU3CKLf1/[email protected] 29 Mar 2005 23:29:35 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>catalog/catalog/includes</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt>content/pages/<a href="#file1"><span id="added">account_edit.php</span></a></tt></td><td align="right" id="added">+101</td><td></td><td nowrap="nowrap" align="right">added <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/account_edit.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt>modules/account/<a href="#file2"><span id="added">edit.php</span></a></tt></td><td align="right" id="added">+121</td><td></td><td nowrap="nowrap" align="right">added <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/account/edit.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td></td><td align="right" id="added">+222</td><td></td><td></td></tr>
</table>
<small id="info">2 added files</small><br />
<pre class="comment">
the new account edit page based on a CSS layout
introduce a new account module to handle the account_edit logic
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname" id="added"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content">content</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages">pages</a><br /></span>
<div class="fileheader" id="added"><big><b>account_edit.php</b></big> <small id="info">added at <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/account_edit.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N account_edit.php
--- /dev/null Wed Mar 30 01:29:19 2005
+++ /tmp/cvsAAAi8aGWs Wed Mar 30 01:29:32 2005
@@ -0,0 +1,101 @@
</small></pre><pre class="diff" id="added">+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2005 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ require('includes/form_check.js.php');
+
+ $Qaccount = $osC_Database->query('select customers_gender, customers_firstname, customers_lastname, unix_timestamp(customers_dob) as customers_dob, customers_email_address from :table_customers where customers_id = :customers_id');
+ $Qaccount->bindTable(':table_customers', TABLE_CUSTOMERS);
+ $Qaccount->bindInt(':customers_id', $osC_Customer->id);
+ $Qaccount->execute();
+?>
+
+<div class="pageHeading">
+ <span class="pageHeadingImage"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_account.gif', HEADING_TITLE_ACCOUNT_EDIT, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></span>
+
+ <h1><?php echo HEADING_TITLE_ACCOUNT_EDIT; ?></h1>
+</div>
+
+<?php
+ if ($messageStack->size('account_edit') > 0) {
+ echo $messageStack->output('account_edit');
+ }
+?>
+
+<form name="account_edit" action="<?php echo tep_href_link(FILENAME_ACCOUNT, 'edit=save', 'SSL'); ?>" method="post" onSubmit="return check_form(account_edit);">
+
+<div class="moduleBox">
+ <div class="outsideHeading">
+ <span class="inputRequirement" style="float: right;"><?php echo FORM_REQUIRED_INFORMATION; ?></span>
+
+ <?php echo MY_ACCOUNT_TITLE; ?>
+ </div>
+
+ <div class="content">
+ <table border="0" cellspacing="2" cellpadding="2">
+
+<?php
+ if (ACCOUNT_GENDER > -1) {
+ $gender_array = array(array('id' => 'm', 'text' => MALE),
+ array('id' => 'f', 'text' => FEMALE));
+?>
+ <tr>
+ <td><?php echo ENTRY_GENDER; ?></td>
+ <td><?php echo osc_draw_radio_field('gender', $gender_array, $Qaccount->value('customers_gender'), '', (ACCOUNT_GENDER > 0)); ?></td>
+ </tr>
+ <tr>
+ <td colspan="2">&nbsp;</td>
+ </tr>
+<?php
+ }
+?>
+
+ <tr>
+ <td><?php echo ENTRY_FIRST_NAME; ?></td>
+ <td><?php echo osc_draw_input_field('firstname', $Qaccount->value('customers_firstname'), '', true); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo ENTRY_LAST_NAME; ?></td>
+ <td><?php echo osc_draw_input_field('lastname', $Qaccount->value('customers_lastname'), '', true); ?></td>
+ </tr>
+
+<?php
+ if (ACCOUNT_DATE_OF_BIRTH > -1) {
+?>
+ <tr>
+ <td colspan="2">&nbsp;</td>
+ </tr>
+ <tr>
+ <td><?php echo ENTRY_DATE_OF_BIRTH; ?></td>
+ <td><?php echo tep_draw_date_pull_down_menu('dob', $Qaccount->value('customers_dob'), false, true, true, date('Y')-1901, -5) . '&nbsp;<span class="inputRequirement">*</span>'; ?></td>
+ </tr>
+<?php
+ }
+?>
+
+ <tr>
+ <td colspan="2">&nbsp;</td>
+ </tr>
+ <tr>
+ <td><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
+ <td><?php echo osc_draw_input_field('email_address', $Qaccount->value('customers_email_address'), '', true); ?></td>
+ </tr>
+ </table>
+ </div>
+</div>
+
+<div class="submitFormButtons">
+ <span style="float: right;"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></span>
+
+ <?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?>
+</div>
+
+</form>
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname" id="added"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules">modules</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/account">account</a><br /></span>
<div class="fileheader" id="added"><big><b>edit.php</b></big> <small id="info">added at <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/account/edit.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N edit.php
--- /dev/null Wed Mar 30 01:29:33 2005
+++ /tmp/cvsAAATma4Xs Wed Mar 30 01:29:33 2005
@@ -0,0 +1,121 @@
</small></pre><pre class="diff" id="added">+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2005 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Account_Edit {
+
+/* Public variables */
+
+ var $page_contents = 'account_edit.php';
+
+/* Private variables */
+
+ var $_module = 'edit';
+
+/* Class constructor */
+
+ function osC_Account_Edit() {
+ global $osC_Services, $breadcrumb;
+
+ if ($osC_Services->isStarted('breadcrumb')) {
+ $breadcrumb->add(NAVBAR_TITLE_EDIT_ACCOUNT, tep_href_link(FILENAME_ACCOUNT, $this->_module, 'SSL'));
+ }
+
+ if ($_GET[$this->_module] == 'save') {
+ $this->_process();
+ }
+ }
+
+/* Public methods */
+
+ function getPageContentsFile() {
+ return $this->page_contents;
+ }
+
+/* Private methods */
+
+ function _process() {
+ global $messageStack, $osC_Database, $osC_Customer;
+
+ if (ACCOUNT_GENDER > 0) {
+ if (!isset($_POST['gender']) || (($_POST['gender'] != 'm') && ($_POST['gender'] != 'f'))) {
+ $messageStack->add('account_edit', ENTRY_GENDER_ERROR);
+ }
+ }
+
+ if (!isset($_POST['firstname']) || (strlen(trim($_POST['firstname'])) < ACCOUNT_FIRST_NAME)) {
+ $messageStack->add('account_edit', ENTRY_FIRST_NAME_ERROR);
+ }
+
+ if (!isset($_POST['lastname']) || (strlen(trim($_POST['lastname'])) < ACCOUNT_LAST_NAME)) {
+ $messageStack->add('account_edit', ENTRY_LAST_NAME_ERROR);
+ }
+
+ if (ACCOUNT_DATE_OF_BIRTH > -1) {
+ if (isset($_POST['dob_days']) && isset($_POST['dob_months']) && isset($_POST['dob_years']) && checkdate($_POST['dob_months'], $_POST['dob_days'], $_POST['dob_years'])) {
+ $dob = mktime(0, 0, 0, $_POST['dob_months'], $_POST['dob_days'], $_POST['dob_years']);
+ } else {
+ $messageStack->add('account_edit', ENTRY_DATE_OF_BIRTH_ERROR);
+ }
+ }
+
+ if (!isset($_POST['email_address']) || (strlen(trim($_POST['email_address'])) < ACCOUNT_EMAIL_ADDRESS)) {
+ $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR);
+ } else {
+ if (tep_validate_email($_POST['email_address']) == false) {
+ $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
+ } else {
+ $Qcheck = $osC_Database->query('select customers_id from :table_customers where customers_email_address = :customers_email_address and customers_id != :customers_id limit 1');
+ $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS);
+ $Qcheck->bindValue(':customers_email_address', $_POST['email_address']);
+ $Qcheck->bindInt(':customers_id', $osC_Customer->id);
+ $Qcheck->execute();
+
+ if ($Qcheck->numberOfRows() > 0) {
+ $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
+ }
+
+ $Qcheck->freeResult();
+ }
+ }
+
+ if ($messageStack->size('account_edit') === 0) {
+ $Qcustomer = $osC_Database->query('update :table_customers set customers_gender = :customers_gender, customers_firstname = :customers_firstname, customers_lastname = :customers_lastname, customers_email_address = :customers_email_address, customers_dob = :customers_dob where customers_id = :customers_id');
+ $Qcustomer->bindTable(':table_customers', TABLE_CUSTOMERS);
+ $Qcustomer->bindValue(':customers_gender', (((ACCOUNT_GENDER > -1) && isset($_POST['gender']) && (($_POST['gender'] == 'm') || ($_POST['gender'] == 'f'))) ? $_POST['gender'] : ''));
+ $Qcustomer->bindValue(':customers_firstname', $_POST['firstname']);
+ $Qcustomer->bindValue(':customers_lastname', $_POST['lastname']);
+ $Qcustomer->bindValue(':customers_email_address', $_POST['email_address']);
+ $Qcustomer->bindValue(':customers_dob', ((ACCOUNT_DATE_OF_BIRTH > -1) ? date('Ymd', $dob) : ''));
+ $Qcustomer->bindInt(':customers_id', $osC_Customer->id);
+ $Qcustomer->execute();
+
+ $Qupdate = $osC_Database->query('update :table_customers_info set customers_info_date_account_last_modified = now() where customers_info_id = :customers_info_id');
+ $Qupdate->bindTable(':table_customers_info', TABLE_CUSTOMERS_INFO);
+ $Qupdate->bindInt(':customers_info_id', $osC_Customer->id);
+ $Qupdate->execute();
+
+// reset the session variables
+ if (ACCOUNT_GENDER > -1) {
+ $osC_Customer->setGender($_POST['gender']);
+ }
+ $osC_Customer->setFirstName(trim($_POST['firstname']));
+ $osC_Customer->setLastName(trim($_POST['lastname']));
+ $osC_Customer->setFullName();
+ $osC_Customer->setEmailAddress(trim($_POST['email_address']));
+
+ $messageStack->add_session('account', SUCCESS_ACCOUNT_UPDATED, 'success');
+
+ tep_redirect(tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
+ }
+ }
+ }
+?>
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.9</small></center>
</body></html>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click