[TEP-COMMIT] [CVS admin] update to the template structure

anonymous-OfajU3CKLf1/[email protected] 22 Jul 2004 23:30:52 -0000
Newsgroups gmane.comp.web.oscommerce.cvs
Message-ID <[email protected]>
Commit in admin/admin on MAIN

specials.php +61 -259 1.41 -> 1.42

templates/pages/specials_edit.php +73 added 1.1

/specials.php +93 added 1.1

+227 -259

2 added + 1 modified, total 3 files

update to the template structure

----------

admin /admin

specials.php 1.41 -> 1.42

diff -u -r1.41 -r1.42
--- specials.php 2003/06/29 22:50:52 1.41
+++ specials.php 2004/07/22 23:30:50 1.42
@@ -5,285 +5,87 @@

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

- Copyright (c) 2003 osCommerce

+ Copyright (c) 2004 osCommerce

Released under the GNU General Public License
*/

require('includes/application_top.php');

- require(DIR_WS_CLASSES . 'currencies.php');
- $currencies = new currencies();

+ $selected_box = 'catalog';

- $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

+ $action = (isset($_GET['action']) ? $_GET['action'] : '');

- if (tep_not_null($action)) {
- switch ($action) {
- case 'setflag':
- tep_set_specials_status($HTTP_GET_VARS['id'], $HTTP_GET_VARS['flag']);
-
- tep_redirect(tep_href_link(FILENAME_SPECIALS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'sID=' . $HTTP_GET_VARS['id'], 'NONSSL'));
- break;
- case 'insert':
- $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
- $products_price = tep_db_prepare_input($HTTP_POST_VARS['products_price']);
- $specials_price = tep_db_prepare_input($HTTP_POST_VARS['specials_price']);
- $day = tep_db_prepare_input($HTTP_POST_VARS['day']);
- $month = tep_db_prepare_input($HTTP_POST_VARS['month']);
- $year = tep_db_prepare_input($HTTP_POST_VARS['year']);
-
- if (substr($specials_price, -1) == '%') {
- $new_special_insert_query = tep_db_query("select products_id, products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
- $new_special_insert = tep_db_fetch_array($new_special_insert_query);
-
- $products_price = $new_special_insert['products_price'];
- $specials_price = ($products_price - (($specials_price / 100) * $products_price));
- }
-
- $expires_date = '';
- if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year)) {
- $expires_date = $year;
- $expires_date .= (strlen($month) == 1) ? '0' . $month : $month;
- $expires_date .= (strlen($day) == 1) ? '0' . $day : $day;
- }
-
- tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), '" . tep_db_input($expires_date) . "', '1')");

+ if (!isset($_GET['page']) || (isset($_GET['page']) && !is_numeric($_GET['page']))) {
+ $_GET['page'] = 1;
+ }

- tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page']));
- break;
- case 'update':
- $specials_id = tep_db_prepare_input($HTTP_POST_VARS['specials_id']);
- $products_price = tep_db_prepare_input($HTTP_POST_VARS['products_price']);
- $specials_price = tep_db_prepare_input($HTTP_POST_VARS['specials_price']);
- $day = tep_db_prepare_input($HTTP_POST_VARS['day']);
- $month = tep_db_prepare_input($HTTP_POST_VARS['month']);
- $year = tep_db_prepare_input($HTTP_POST_VARS['year']);
-
- if (substr($specials_price, -1) == '%') $specials_price = ($products_price - (($specials_price / 100) * $products_price));
-
- $expires_date = '';
- if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year)) {
- $expires_date = $year;
- $expires_date .= (strlen($month) == 1) ? '0' . $month : $month;
- $expires_date .= (strlen($day) == 1) ? '0' . $day : $day;

+ if (!empty($action)) {
+ switch ($action) {
+ case 'save':
+ $Qproduct = $osC_Database->query('select products_price from :table_products where products_id = :products_id');
+ $Qproduct->bindTable(':table_products', TABLE_PRODUCTS);
+ $Qproduct->bindInt(':products_id', $_POST['products_id']);
+ $Qproduct->execute();
+
+ if ($Qproduct->numberOfRows() === 1) {
+ $specials_price = $_POST['specials_price'];
+
+ if (substr($specials_price, -1) == '%') {
+ $specials_price = $Qproduct->valueDecimal('products_price') - (((double)$specials_price / 100) * $Qproduct->valueDecimal('products_price'));
+ }
+
+ if (isset($_GET['sID']) && is_numeric($_GET['sID'])) {
+ $Qspecial = $osC_Database->query('update :table_specials set specials_new_products_price = :specials_new_products_price, specials_last_modified = now(), expires_date = :expires_date, status = :status where specials_id = :specials_id');
+ $Qspecial->bindInt(':specials_id', $_GET['sID']);
+ } else {
+ $Qspecial = $osC_Database->query('insert into :table_specials (products_id, specials_new_products_price, specials_date_added, expires_date, status) values (:products_id, :specials_new_products_price, now(), :expires_date, :status)');
+ $Qspecial->bindInt(':products_id', $_POST['products_id']);
+ }
+ $Qspecial->bindTable(':table_specials', TABLE_SPECIALS);
+ $Qspecial->bindValue(':specials_new_products_price', $specials_price);
+ $Qspecial->bindValue(':expires_date', $_POST['specials_expires_date']);
+ $Qspecial->bindInt(':status', (isset($_POST['specials_status']) && ($_POST['specials_status'] == '1') ? '1' : '0'));
+ $Qspecial->execute();
+
+ if ($osC_Database->isError() === false) {
+ $messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
+ } else {
+ $messageStack->add_session(ERROR_DB_ROWS_NOT_UPDATED, 'error');
+ }

}

-
- tep_db_query("update " . TABLE_SPECIALS . " set specials_new_products_price = '" . tep_db_input($specials_price) . "', specials_last_modified = now(), expires_date = '" . tep_db_input($expires_date) . "' where specials_id = '" . (int)$specials_id . "'");

- tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials_id));

+ tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . (isset($_GET['sID']) ? '&sID=' . $_GET['sID'] : '')));

break;
case 'deleteconfirm':

- $specials_id = tep_db_prepare_input($HTTP_GET_VARS['sID']);
-
- tep_db_query("delete from " . TABLE_SPECIALS . " where specials_id = '" . (int)$specials_id . "'");

+ if (isset($_GET['sID']) && is_numeric($_GET['sID'])) {
+ $Qspecial = $osC_Database->query('delete from :table_specials where specials_id = :specials_id');
+ $Qspecial->bindTable(':table_specials', TABLE_SPECIALS);
+ $Qspecial->bindInt(':specials_id', $_GET['sID']);
+ $Qspecial->execute();
+
+ if ($Qspecial->affectedRows()) {
+ $messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
+ } else {
+ $messageStack->add_session(WARNING_DB_ROWS_NOT_UPDATED, 'warning');
+ }
+ }

- tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page']));

+ tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page']));

break;
}
}

-?>
-<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html <?php echo HTML_PARAMS; ?>>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
-<title><?php echo TITLE; ?></title>
-<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
-<script language="javascript" src="includes/general.js"></script>
-<?php
- if ( ($action == 'new') || ($action == 'edit') ) {
-?>
-<link rel="stylesheet" type="text/css" href="includes/javascript/calendar.css">
-<script language="JavaScript" src="includes/javascript/calendarcode.js"></script>
-<?php
- }
-?>
-</head>
-<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
-<div id="popupcalendar" class="text"></div>
-<!-- header //-->
-<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
-<!-- header_eof //-->
-
-<!-- body //-->
-<table border="0" width="100%" cellspacing="2" cellpadding="2">
- <tr>
- <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
-<!-- left_navigation //-->
-<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
-<!-- left_navigation_eof //-->
- </table></td>
-<!-- body_text //-->
- <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
- <tr>
- <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
- <tr>
- <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
- <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
- </tr>
- </table></td>
- </tr>
-<?php
- if ( ($action == 'new') || ($action == 'edit') ) {
- $form_action = 'insert';
- if ( ($action == 'edit') && isset($HTTP_GET_VARS['sID']) ) {
- $form_action = 'update';
-
- $product_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, s.specials_new_products_price, s.expires_date from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id and s.specials_id = '" . (int)$HTTP_GET_VARS['sID'] . "'");
- $product = tep_db_fetch_array($product_query);
-
- $sInfo = new objectInfo($product);
- } else {
- $sInfo = new objectInfo(array());
-
-// create an array of products on special, which will be excluded from the pull down menu of products
-// (when creating a new product on special)
- $specials_array = array();
- $specials_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s where s.products_id = p.products_id");
- while ($specials = tep_db_fetch_array($specials_query)) {
- $specials_array[] = $specials['products_id'];
- }
- }
-?>
- <tr><form name="new_special" <?php echo 'action="' . tep_href_link(FILENAME_SPECIALS, tep_get_all_get_params(array('action', 'info', 'sID')) . 'action=' . $form_action, 'NONSSL') . '"'; ?> method="post"><?php if ($form_action == 'update') echo tep_draw_hidden_field('specials_id', $HTTP_GET_VARS['sID']); ?>
- <td><br><table border="0" cellspacing="0" cellpadding="2">
- <tr>
- <td class="main"><?php echo TEXT_SPECIALS_PRODUCT; ?>&nbsp;</td>
- <td class="main"><?php echo (isset($sInfo->products_name)) ? $sInfo->products_name . ' <small>(' . $currencies->format($sInfo->products_price) . ')</small>' : tep_draw_products_pull_down('products_id', 'style="font-size:10px"', $specials_array); echo tep_draw_hidden_field('products_price', (isset($sInfo->products_price) ? $sInfo->products_price : '')); ?></td>
- </tr>
- <tr>
- <td class="main"><?php echo TEXT_SPECIALS_SPECIAL_PRICE; ?>&nbsp;</td>
- <td class="main"><?php echo tep_draw_input_field('specials_price', (isset($sInfo->specials_new_products_price) ? $sInfo->specials_new_products_price : '')); ?></td>
- </tr>
- <tr>
- <td class="main"><?php echo TEXT_SPECIALS_EXPIRES_DATE; ?>&nbsp;</td>
- <td class="main"><?php echo tep_draw_input_field('day', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('month', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('year', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="javascript:calClick();return false;" onmouseover="calSwapImg('BTN_date', 'img_Date_OVER',true);" onmouseout="calSwapImg('BTN_date', 'img_Date_UP',true);" onclick="calSwapImg('BTN_date', 'img_Date_DOWN');showCalendar('new_special','dteWhen','BTN_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22',
'17', 'align="absmiddle" name="BTN_date"'); ?></a></td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
- <tr>
- <td class="main"><br><?php echo TEXT_SPECIALS_PRICE_TIP; ?></td>
- <td class="main" align="right" valign="top"><br><?php echo (($form_action == 'insert') ? tep_image_submit('button_insert.gif', IMAGE_INSERT) : tep_image_submit('button_update.gif', IMAGE_UPDATE)). '&nbsp;&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . (isset($HTTP_GET_VARS['sID']) ? '&sID=' . $HTTP_GET_VARS['sID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
- </tr>
- </table></td>
- </form></tr>
-<?php
- } else {
-?>
- <tr>
- <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
- <tr>
- <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
- <tr class="dataTableHeadingRow">
- <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
- <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRODUCTS_PRICE; ?></td>
- <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>
- <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
- </tr>
-<?php
- $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id order by pd.products_name";
- $specials_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $specials_query_raw, $specials_query_numrows);
- $specials_query = tep_db_query($specials_query_raw);
- while ($specials = tep_db_fetch_array($specials_query)) {
- if ((!isset($HTTP_GET_VARS['sID']) || (isset($HTTP_GET_VARS['sID']) && ($HTTP_GET_VARS['sID'] == $specials['specials_id']))) && !isset($sInfo)) {
- $products_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$specials['products_id'] . "'");
- $products = tep_db_fetch_array($products_query);
- $sInfo_array = array_merge($specials, $products);
- $sInfo = new objectInfo($sInfo_array);
- }
-
- if (isset($sInfo) && is_object($sInfo) && ($specials['specials_id'] == $sInfo->specials_id)) {
- echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=edit') . '\'">' . "\n";
- } else {
- echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials['specials_id']) . '\'">' . "\n";
- }
-?>
- <td class="dataTableContent"><?php echo $specials['products_name']; ?></td>
- <td class="dataTableContent" align="right"><span class="oldPrice"><?php echo $currencies->format($specials['products_price']); ?></span> <span class="specialPrice"><?php echo $currencies->format($specials['specials_new_products_price']); ?></span></td>
- <td class="dataTableContent" align="right">
-<?php
- if ($specials['status'] == '1') {
- echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_SPECIALS, 'action=setflag&flag=0&id=' . $specials['specials_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';
- } else {
- echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'action=setflag&flag=1&id=' . $specials['specials_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>&nbsp;&nbsp;' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
- }
-?></td>
- <td class="dataTableContent" align="right"><?php if (isset($sInfo) && is_object($sInfo) && ($specials['specials_id'] == $sInfo->specials_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials['specials_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
- </tr>
-<?php
- }
-?>
- <tr>
- <td colspan="4"><table border="0" width="100%" cellpadding="0"cellspacing="2">
- <tr>
- <td class="smallText" valign="top"><?php echo $specials_split->display_count($specials_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
- <td class="smallText" align="right"><?php echo $specials_split->display_links($specials_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>
- </tr>
-<?php
- if (empty($action)) {
-?>
- <tr>
- <td colspan="2" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&action=new') . '">' . tep_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . '</a>'; ?></td>
- </tr>
-<?php
- }
-?>
- </table></td>
- </tr>
- </table></td>
-<?php
- $heading = array();
- $contents = array();

- switch ($action) {
- case 'delete':
- $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SPECIALS . '</b>');

+ require('../includes/classes/currencies.php');
+ $osC_Currencies = new osC_Currencies();

- $contents = array('form' => tep_draw_form('specials', FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=deleteconfirm'));
- $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
- $contents[] = array('text' => '<br><b>' . $sInfo->products_name . '</b>');
- $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
- break;
- default:
- if (is_object($sInfo)) {
- $heading[] = array('text' => '<b>' . $sInfo->products_name . '</b>');
-
- $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
- $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . tep_date_short($sInfo->specials_date_added));
- $contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . tep_date_short($sInfo->specials_last_modified));
- $contents[] = array('align' => 'center', 'text' => '<br>' . tep_info_image($sInfo->products_image, $sInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT));
- $contents[] = array('text' => '<br>' . TEXT_INFO_ORIGINAL_PRICE . ' ' . $currencies->format($sInfo->products_price));
- $contents[] = array('text' => '' . TEXT_INFO_NEW_PRICE . ' ' . $currencies->format($sInfo->specials_new_products_price));
- $contents[] = array('text' => '' . TEXT_INFO_PERCENTAGE . ' ' . number_format(100 - (($sInfo->specials_new_products_price / $sInfo->products_price) * 100)) . '%');
-
- $contents[] = array('text' => '<br>' . TEXT_INFO_EXPIRES_DATE . ' <b>' . tep_date_short($sInfo->expires_date) . '</b>');
- $contents[] = array('text' => '' . TEXT_INFO_STATUS_CHANGE . ' ' . tep_date_short($sInfo->date_status_change));
- }
- break;

+ switch ($action) {
+ case 'sNew':
+ case 'sEdit': $page_contents = 'specials_edit.php'; break;
+ default: $page_contents = 'specials.php';

}

- if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
- echo ' <td width="25%" valign="top">' . "\n";

- $box = new box;
- echo $box->infoBox($heading, $contents);

+ require('templates/default.php');

- echo ' </td>' . "\n";
- }
-}

+ require('includes/application_bottom.php');

?>

- </tr>
- </table></td>
- </tr>
- </table></td>
-<!-- body_text_eof //-->
- </tr>
-</table>
-<!-- body_eof //-->
-
-<!-- footer //-->
-<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
-<!-- footer_eof //-->
-</body>
-</html>
-<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

----------

admin /admin /templates /pages

specials_edit.php added at 1.1

diff -N specials_edit.php
--- /dev/null Fri Jul 23 01:30:50 2004
+++ /tmp/cvsAAAYDaaqf Fri Jul 23 01:30:50 2004
@@ -0,0 +1,73 @@

+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ if (($action == 'sEdit') && isset($_GET['sID'])) {
+ $Qspecial = $osC_Database->query('select p.products_id, pd.products_name, p.products_price, s.specials_new_products_price, s.expires_date, s.status from :table_specials s, :table_products p, :table_products_description pd where s.specials_id = :specials_id and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = :language_id');
+ $Qspecial->bindTable(':table_specials', TABLE_SPECIALS);
+ $Qspecial->bindTable(':table_products', TABLE_PRODUCTS);
+ $Qspecial->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
+ $Qspecial->bindInt(':specials_id', $_GET['sID']);
+ $Qspecial->bindInt(':language_id', $osC_Session->value('languages_id'));
+ $Qspecial->execute();
+
+ $sInfo = new objectInfo($Qspecial->toArray());
+ } else {
+ $specials_array = array();
+
+ $Qspecials = $osC_Database->query('select p.products_id, p.products_price, pd.products_name, s.specials_new_products_price from :table_products p left join :table_specials s on (p.products_id = s.products_id), :table_products_description pd where p.products_id = pd.products_id and pd.language_id = :language_id order by pd.products_name');
+ $Qspecials->bindTable(':table_products', TABLE_PRODUCTS);
+ $Qspecials->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
+ $Qspecials->bindTable(':table_specials', TABLE_SPECIALS);
+ $Qspecials->bindInt(':language_id', $osC_Session->value('languages_id'));
+ $Qspecials->execute();
+
+ while ($Qspecials->next()) {
+ if ($Qspecials->valueDecimal('specials_new_products_price') < 1) {
+ $specials_array[] = array('id' => $Qspecials->valueInt('products_id'), 'text' => $Qspecials->value('products_name') . ' (' . $osC_Currencies->format($Qspecials->value('products_price')) . ')');
+ }
+ }
+ }
+?>
+
+<style type="text/css">@import url('external/jscalendar/0.9.6/calendar-win2k-1.css');</style>
+<script type="text/javascript" src="external/jscalendar/0.9.6/calendar.js"></script>
+<script type="text/javascript" src="external/jscalendar/0.9.6/lang/calendar-en.js"></script>
+<script type="text/javascript" src="external/jscalendar/0.9.6/calendar-setup.js"></script>
+
+<h1><?php echo HEADING_TITLE; ?></p>
+
+<?php echo tep_draw_form('special', FILENAME_SPECIALS, 'page=' . $_GET['page'] . (isset($_GET['sID']) ? '&sID=' . $_GET['sID'] : '') . '&action=save'); ?>
+
+<table border="0" cellspacing="0" cellpadding="2">
+ <tr>
+ <td class="main"><?php echo TEXT_SPECIALS_PRODUCT; ?></td>
+ <td class="main"><?php echo (isset($sInfo) ? $sInfo->products_name . ' <small>(' . $osC_Currencies->format($sInfo->products_price) . ')</small>' . osc_draw_hidden_field('products_id', $sInfo->products_id) : osc_draw_pull_down_menu('products_id', $specials_array)); ?></td>
+ </tr>
+ <tr>
+ <td class="main"><?php echo TEXT_SPECIALS_SPECIAL_PRICE; ?></td>
+ <td class="main"><?php echo osc_draw_input_field('specials_price', (isset($sInfo) ? $sInfo->specials_new_products_price : '')); ?></td>
+ </tr>
+ <tr>
+ <td class="main"><?php echo TEXT_SPECIALS_STATUS; ?></td>
+ <td class="main"><?php echo osc_draw_checkbox_field('specials_status', '1', (isset($sInfo) ? $sInfo->status : '')); ?></td>
+ </tr>
+ <tr>
+ <td class="main"><?php echo TEXT_SPECIALS_EXPIRES_DATE; ?></td>
+ <td class="main"><?php echo osc_draw_input_field('specials_expires_date', (isset($sInfo) ? $sInfo->expires_date : ''), 'id="calendarValue"'); ?><input type="button" value="..." id="calendarTrigger" class="operationButton"><script type="text/javascript">Calendar.setup( { inputField: "calendarValue", ifFormat: "%Y-%m-%d", button: "calendarTrigger" } );</script></td>
+ </tr>
+</table>
+
+<p align="right"><?php echo '<input type="submit" value="' . IMAGE_SAVE . '" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" class="operationButton" onClick="document.location.href=\'' . tep_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . (isset($_GET['sID']) ? '&sID=' . $_GET['sID'] : '')) . '\';">'; ?></p>
+
+<p class="main"><?php echo TEXT_SPECIALS_PRICE_TIP; ?></p>
+
+</form>

----------

admin /admin /templates /pages

specials.php added at 1.1

diff -N specials.php
--- /dev/null Fri Jul 23 01:30:50 2004
+++ /tmp/cvsAAAzIaOqf Fri Jul 23 01:30:51 2004
@@ -0,0 +1,93 @@

+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+?>
+
+<h1><?php echo HEADING_TITLE; ?></p>
+
+<div id="infoBox_sDefault" <?php if (!empty($action)) { echo 'style="display: none;"'; } ?>>
+ <table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">
+ <thead>
+ <tr>
+ <th><?php echo TABLE_HEADING_PRODUCTS; ?></th>
+ <th><?php echo TABLE_HEADING_PRODUCTS_PRICE; ?></th>
+ <th><?php echo TABLE_HEADING_STATUS; ?></th>
+ <th><?php echo TABLE_HEADING_ACTION; ?></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php
+ $Qspecials = $osC_Database->query('select p.products_id, pd.products_name, p.products_price, p.products_image, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from :table_products p, :table_specials s, :table_products_description pd where p.products_id = pd.products_id and pd.language_id = :language_id and p.products_id = s.products_id order by pd.products_name');
+ $Qspecials->bindTable(':table_specials', TABLE_SPECIALS);
+ $Qspecials->bindTable(':table_products', TABLE_PRODUCTS);
+ $Qspecials->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
+ $Qspecials->bindInt(':language_id', $osC_Session->value('languages_id'));
+ $Qspecials->setBatchLimit($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS);
+ $Qspecials->execute();
+
+ while ($Qspecials->next()) {
+ if (!isset($sInfo) && (!isset($_GET['sID']) || (isset($_GET['sID']) && ($_GET['sID'] == $Qspecials->valueInt('specials_id'))))) {
+ $sInfo = new objectInfo($Qspecials->toArray());
+ }
+
+ if (isset($sInfo) && ($Qspecials->valueInt('specials_id') == $sInfo->specials_id)) {
+ echo ' <tr class="selected">' . "\n";
+ } else {
+ echo ' <tr onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);" onClick="document.location.href=\'' . tep_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $Qspecials->valueInt('specials_id')) . '\';">' . "\n";
+ }
+?>
+ <td><?php echo $Qspecials->value('products_name'); ?></td>
+ <td><span class="oldPrice"><?php echo $osC_Currencies->format($Qspecials->value('products_price')); ?></span> <span class="specialPrice"><?php echo $osC_Currencies->format($Qspecials->value('specials_new_products_price')); ?></span></td>
+ <td align="center"><?php echo tep_image('templates/' . $template . '/images/icons/' . (($Qspecials->valueInt('status') === 1) ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif')); ?></td>
+ <td align="right">
+<?php
+ echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $Qspecials->valueInt('specials_id') . '&action=sEdit') . '">' . tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . '</a>&nbsp;';
+
+ if (isset($sInfo) && ($Qspecials->valueInt('specials_id') == $sInfo->specials_id)) {
+ echo '<a href="#" onClick="toggleInfoBox(\'sDelete\');">' . tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . '</a>';
+ } else {
+ echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $Qspecials->valueInt('specials_id') . '&action=sDelete') . '">' . tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . '</a>';
+ }
+?>
+ </td>
+ </tr>
+<?php
+ }
+?>
+ </tbody>
+ </table>
+
+ <table border="0" width="100%" cellpadding="0"cellspacing="2">
+ <tr>
+ <td class="smallText"><?php echo $Qspecials->displayBatchLinksTotal(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
+ <td class="smallText" align="right"><?php echo $Qspecials->displayBatchLinksPullDown(); ?></td>
+ </tr>
+ </table>
+
+ <p align="right"><?php echo '<input type="button" value="' . IMAGE_INSERT . '" class="infoBoxButton" onClick="document.location.href=\'' . tep_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&action=sNew') . '\';">'; ?></p>
+</div>
+
+<?php
+ if (isset($sInfo)) {
+?>
+
+<div id="infoBox_sDelete" <?php if ($action != 'sDelete') { echo 'style="display: none;"'; } ?>>
+ <div class="infoBoxHeading"><?php echo tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . ' ' . $sInfo->products_name; ?></div>
+ <div class="infoBoxContent">
+ <p><?php echo TEXT_INFO_DELETE_INTRO; ?></p>
+ <p><?php echo '<b>' . $sInfo->products_name . '</b>'; ?></p>
+ <p align="center"><?php echo '<input type="button" value="' . IMAGE_DELETE . '" onClick="document.location.href=\'' . tep_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id . '&action=deleteconfirm') . '\';" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'sDefault\');" class="operationButton">'; ?></p>
+ </div>
+</div>
+
+<?php
+ }
+?>

CVSspam 0.2.8

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click