[TEP-COMMIT] [CVS catalog] the new account product notifications page based on a CSS layout, and the

hpdl-OfajU3CKLf1/[email protected] 29 Mar 2005 23:39:55 -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_notifications.php</span></a></tt></td><td align="right" id="added">+114</td><td></td><td nowrap="nowrap" align="right">added <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/account_notifications.php?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt>modules/account/<a href="#file2"><span id="added">notifications.php</span></a></tt></td><td align="right" id="added">+127</td><td></td><td nowrap="nowrap" align="right">added <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/account/notifications.php?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td></td><td align="right" id="added">+241</td><td></td><td></td></tr>
</table>
<small id="info">2 added files</small><br />
<pre class="comment">
the new account product notifications page based on a CSS layout, and the
new account notifications module to handle the processing 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_notifications.php</b></big> <small id="info">added at <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/account_notifications.php?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N account_notifications.php
--- /dev/null	Wed Mar 30 01:39:48 2005
+++ /tmp/cvsAAABIa4jF	Wed Mar 30 01:39:53 2005
@@ -0,0 +1,114 @@
</small></pre><pre class="diff" id="added">+&lt;?php
+/*
+  $Id$
+
+  osCommerce, Open Source E-Commerce Solutions
+  http://www.oscommerce.com
+
+  Copyright (c) 2005 osCommerce
+
+  Released under the GNU General Public License
+*/
+?&gt;
+
+&lt;div class="pageHeading"&gt;
+  &lt;span class="pageHeadingImage"&gt;&lt;?php echo tep_image(DIR_WS_IMAGES . 'table_background_account.gif', HEADING_TITLE_NOTIFICATIONS, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?&gt;&lt;/span&gt;
+
+  &lt;h1&gt;&lt;?php echo HEADING_TITLE_NOTIFICATIONS; ?&gt;&lt;/h1&gt;
+&lt;/div&gt;
+
+&lt;form name="account_notifications" action="&lt;?php echo tep_href_link(FILENAME_ACCOUNT, 'notifications=save', 'SSL'); ?&gt;" method="post"&gt;
+
+&lt;div class="moduleBox"&gt;
+  &lt;div class="outsideHeading"&gt;&lt;?php echo MY_NOTIFICATIONS_TITLE; ?&gt;&lt;/div&gt;
+
+  &lt;div class="content"&gt;
+    &lt;?php echo MY_NOTIFICATIONS_DESCRIPTION; ?&gt;
+  &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div class="moduleBox"&gt;
+  &lt;div class="outsideHeading"&gt;&lt;?php echo GLOBAL_NOTIFICATIONS_TITLE; ?&gt;&lt;/div&gt;
+
+  &lt;div class="content"&gt;
+    &lt;table border="0" width="100%" cellspacing="0" cellpadding="2"&gt;
+      &lt;tr class="moduleRow" onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);" onClick="checkBox('product_global');"&gt;
+        &lt;td width="30"&gt;&lt;?php echo osc_draw_checkbox_field('product_global', '1', $Qglobal-&gt;value('global_product_notifications'), 'onClick="checkBox(\'product_global\');"'); ?&gt;&lt;/td&gt;
+        &lt;td&gt;&lt;b&gt;&lt;?php echo GLOBAL_NOTIFICATIONS_TITLE; ?&gt;&lt;/b&gt;&lt;/td&gt;
+      &lt;/tr&gt;
+      &lt;tr&gt;
+        &lt;td width="30"&gt;&amp;nbsp;&lt;/td&gt;
+        &lt;td&gt;&lt;?php echo GLOBAL_NOTIFICATIONS_DESCRIPTION; ?&gt;&lt;/td&gt;
+      &lt;/tr&gt;
+    &lt;/table&gt;
+  &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;?php
+  if ($Qglobal-&gt;valueInt('global_product_notifications') != '1') {
+    $Qcheck = $osC_Database-&gt;query('select count(*) as total from :table_products_notifications where customers_id = :customers_id');
+    $Qcheck-&gt;bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
+    $Qcheck-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+    $Qcheck-&gt;execute();
+
+?&gt;
+
+&lt;div class="moduleBox"&gt;
+  &lt;div class="outsideHeading"&gt;&lt;?php echo NOTIFICATIONS_TITLE; ?&gt;&lt;/div&gt;
+
+  &lt;div class="content"&gt;
+
+&lt;?php
+    if ($Qcheck-&gt;valueInt('total') &gt; 0) {
+?&gt;
+
+    &lt;table border="0" width="100%" cellspacing="0" cellpadding="2"&gt;
+      &lt;tr&gt;
+        &lt;td class="main" colspan="2"&gt;&lt;?php echo NOTIFICATIONS_DESCRIPTION; ?&gt;&lt;/td&gt;
+      &lt;/tr&gt;
+
+&lt;?php
+      $counter = 0;
+
+      $Qproducts = $osC_Database-&gt;query('select pd.products_id, pd.products_name from :table_products_description pd, :table_products_notifications pn where pn.customers_id = :customers_id and pn.products_id = pd.products_id and pd.language_id = :language_id order by pd.products_name');
+      $Qproducts-&gt;bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
+      $Qproducts-&gt;bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
+      $Qproducts-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+      $Qproducts-&gt;bindInt(':language_id', $osC_Session-&gt;value('languages_id'));
+      $Qproducts-&gt;execute();
+
+      while ($Qproducts-&gt;next()) {
+?&gt;
+
+      &lt;tr class="moduleRow" onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);" onClick="checkBox('products[&lt;?php echo $counter; ?&gt;]');"&gt;
+        &lt;td width="30"&gt;&lt;?php echo osc_draw_checkbox_field('products[' . $counter . ']', $Qproducts-&gt;valueInt('products_id'), true, 'onclick="checkBox(\'products[' . $counter . ']\');"'); ?&gt;&lt;/td&gt;
+        &lt;td&gt;&lt;b&gt;&lt;?php echo $Qproducts-&gt;value('products_name'); ?&gt;&lt;/b&gt;&lt;/td&gt;
+      &lt;/tr&gt;
+
+&lt;?php
+        $counter++;
+      }
+?&gt;
+
+    &lt;/table&gt;
+
+&lt;?php
+    } else {
+      echo NOTIFICATIONS_NON_EXISTING;
+    }
+?&gt;
+
+  &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;?php
+  }
+?&gt;
+
+&lt;div class="submitFormButtons"&gt;
+  &lt;span style="float: right;"&gt;&lt;?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?&gt;&lt;/span&gt;
+
+  &lt;?php echo '&lt;a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '"&gt;' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '&lt;/a&gt;'; ?&gt;
+&lt;/div&gt;
+
+&lt;/form&gt;
</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>notifications.php</b></big> <small id="info">added at <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/account/notifications.php?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N notifications.php
--- /dev/null	Wed Mar 30 01:39:48 2005
+++ /tmp/cvsAAAfOaykF	Wed Mar 30 01:39:54 2005
@@ -0,0 +1,127 @@
</small></pre><pre class="diff" id="added">+&lt;?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_Notifications {
+
+/* Public variables */
+
+    var $page_contents = 'account_notifications.php';
+
+/* Private variables */
+
+    var $_module = 'notifications';
+
+/* Class constructor */
+
+    function osC_Account_Notifications() {
+      global $osC_Services, $breadcrumb, $osC_Database, $osC_Customer, $Qglobal;
+
+      if ($osC_Services-&gt;isStarted('breadcrumb')) {
+        $breadcrumb-&gt;add(NAVBAR_TITLE_NOTIFICATIONS, tep_href_link(FILENAME_ACCOUNT, $this-&gt;_module, 'SSL'));
+      }
+
+/////////////////////// HPDL /////// Should be moved to the customers class!
+      $Qglobal = $osC_Database-&gt;query('select global_product_notifications from :table_customers_info where customers_info_id = :customers_info_id');
+      $Qglobal-&gt;bindTable(':table_customers_info', TABLE_CUSTOMERS_INFO);
+      $Qglobal-&gt;bindInt(':customers_info_id', $osC_Customer-&gt;id);
+      $Qglobal-&gt;execute();
+
+      if ($_GET[$this-&gt;_module] == 'save') {
+        $this-&gt;_process();
+      }
+    }
+
+/* Public methods */
+
+    function getPageContentsFile() {
+      return $this-&gt;page_contents;
+    }
+
+/* Private methods */
+
+    function _process() {
+      global $messageStack, $osC_Database, $osC_Customer, $Qglobal;
+
+      $updated = false;
+
+      if (isset($_POST['product_global']) &amp;&amp; is_numeric($_POST['product_global'])) {
+        $product_global = $_POST['product_global'];
+      } else {
+        $product_global = '0';
+      }
+
+      if (isset($_POST['products'])) {
+        (array)$products = $_POST['products'];
+      } else {
+        $products = array();
+      }
+
+      if ($product_global != $Qglobal-&gt;valueInt('global_product_notifications')) {
+        $product_global = (($Qglobal-&gt;valueInt('global_product_notifications') == '1') ? '0' : '1');
+
+        $Qupdate = $osC_Database-&gt;query('update :table_customers_info set global_product_notifications = :global_product_notifications where customers_info_id = :customers_info_id');
+        $Qupdate-&gt;bindTable(':table_customers_info', TABLE_CUSTOMERS_INFO);
+        $Qupdate-&gt;bindInt(':global_product_notifications', $product_global);
+        $Qupdate-&gt;bindInt(':customers_info_id', $osC_Customer-&gt;id);
+        $Qupdate-&gt;execute();
+
+        if ($Qupdate-&gt;affectedRows() == 1) {
+          $updated = true;
+        }
+      } elseif (sizeof($products) &gt; 0) {
+        $products_parsed = tep_array_filter($products, 'is_numeric');
+
+        if (sizeof($products_parsed) &gt; 0) {
+          $Qcheck = $osC_Database-&gt;query('select count(*) as total from :table_products_notifications where customers_id = :customers_id and products_id not in :products_id');
+          $Qcheck-&gt;bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
+          $Qcheck-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+          $Qcheck-&gt;bindRaw(':products_id', '(' . implode(',', $products_parsed) . ')');
+          $Qcheck-&gt;execute();
+
+          if ($Qcheck-&gt;valueInt('total') &gt; 0) {
+            $Qdelete = $osC_Database-&gt;query('delete from :table_products_notifications where customers_id = :customers_id and products_id not in :products_id');
+            $Qdelete-&gt;bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
+            $Qdelete-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+            $Qdelete-&gt;bindRaw(':products_id', '(' . implode(',', $products_parsed) . ')');
+            $Qdelete-&gt;execute();
+
+            if ($Qdelete-&gt;affectedRows() &gt; 0) {
+              $updated = true;
+            }
+          }
+        }
+      } else {
+        $Qcheck = $osC_Database-&gt;query('select count(*) as total from :table_products_notifications where customers_id = :customers_id');
+        $Qcheck-&gt;bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
+        $Qcheck-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+        $Qcheck-&gt;execute();
+
+        if ($Qcheck-&gt;valueInt('total') &gt; 0) {
+          $Qdelete = $osC_Database-&gt;query('delete from :table_products_notifications where customers_id = :customers_id');
+          $Qdelete-&gt;bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
+          $Qdelete-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+          $Qdelete-&gt;execute();
+
+          if ($Qdelete-&gt;affectedRows() &gt; 0) {
+            $updated = true;
+          }
+        }
+      }
+
+      if ($updated === true) {
+        $messageStack-&gt;add_session('account', SUCCESS_NOTIFICATIONS_UPDATED, 'success');
+      }
+
+      tep_redirect(tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
+    }
+  }
+?&gt;
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; 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