[TEP-COMMIT] [CVS admin] update to the template structure
anonymous-OfajU3CKLf1/[email protected] 22 Jul 2004 23:31:51 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit in admin/admin on MAIN
tax_classes.php +133 -156 1.21 -> 1.22
templates/pages/tax_classes_listing.php +163 added 1.1
/tax_classes.php +164 added 1.1
+460 -156
2 added + 1 modified, total 3 files
update to the template structure
----------
admin /admin
tax_classes.php 1.21 -> 1.22
diff -u -r1.21 -r1.22
--- tax_classes.php 2003/06/29 22:50:52 1.21
+++ tax_classes.php 2004/07/22 23:31:48 1.22
@@ -5,186 +5,163 @@
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');
- $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
+ $selected_box = 'taxes';
- if (tep_not_null($action)) {
- switch ($action) {
- case 'insert':
- $tax_class_title = tep_db_prepare_input($HTTP_POST_VARS['tax_class_title']);
- $tax_class_description = tep_db_prepare_input($HTTP_POST_VARS['tax_class_description']);
+ $action = (isset($_GET['action']) ? $_GET['action'] : '');
- tep_db_query("insert into " . TABLE_TAX_CLASS . " (tax_class_title, tax_class_description, date_added) values ('" . tep_db_input($tax_class_title) . "', '" . tep_db_input($tax_class_description) . "', now())");
+ if (!isset($_GET['page']) || (isset($_GET['page']) && !is_numeric($_GET['page']))) {
+ $_GET['page'] = 1;
+ }
- tep_redirect(tep_href_link(FILENAME_TAX_CLASSES));
- break;
- case 'save':
- $tax_class_id = tep_db_prepare_input($HTTP_GET_VARS['tID']);
- $tax_class_title = tep_db_prepare_input($HTTP_POST_VARS['tax_class_title']);
- $tax_class_description = tep_db_prepare_input($HTTP_POST_VARS['tax_class_description']);
+ $entriesAction = (isset($_GET['entriesAction']) ? $_GET['entriesAction'] : '');
- tep_db_query("update " . TABLE_TAX_CLASS . " set tax_class_id = '" . (int)$tax_class_id . "', tax_class_title = '" . tep_db_input($tax_class_title) . "', tax_class_description = '" . tep_db_input($tax_class_description) . "', last_modified = now() where tax_class_id = '" . (int)$tax_class_id . "'");
+ if (!isset($_GET['entriesPage']) || (isset($_GET['entriesPage']) && !is_numeric($_GET['entriesPage']))) {
+ $_GET['entriesPage'] = 1;
+ }
- tep_redirect(tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tax_class_id));
+ if (!empty($action)) {
+ switch ($action) {
+ case 'save':
+ if (isset($_GET['tcID']) && is_numeric($_GET['tcID'])) {
+ $Qclass = $osC_Database->query('update :table_tax_class set tax_class_title = :tax_class_title, tax_class_description = :tax_class_description, last_modified = now() where tax_class_id = :tax_class_id');
+ $Qclass->bindInt(':tax_class_id', $_GET['tcID']);
+ } else {
+ $Qclass = $osC_Database->query('insert into :table_tax_class (tax_class_title, tax_class_description, date_added) values (:tax_class_title, :tax_class_description, now())');
+ }
+ $Qclass->bindTable(':table_tax_class', TABLE_TAX_CLASS);
+ $Qclass->bindValue(':tax_class_title', $_POST['tax_class_title']);
+ $Qclass->bindValue(':tax_class_description', $_POST['tax_class_description']);
+ $Qclass->execute();
+
+ if ($osC_Database->isError() === false) {
+ if (isset($_GET['tcID']) && is_numeric($_GET['tcID'])) {
+ $tax_class_id = $_GET['tcID'];
+ } else {
+ $tax_class_id = $osC_Database->nextID();
+ }
+
+ if ($Qclass->affectedRows()) {
+ $messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
+ } else {
+ $messageStack->add_session(WARNING_DB_ROWS_NOT_UPDATED, 'warning');
+ }
+ } else {
+ $messageStack->add_session(ERROR_DB_ROWS_NOT_UPDATED, 'error');
+ }
+
+ tep_redirect(tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $tax_class_id));
break;
case 'deleteconfirm':
- $tax_class_id = tep_db_prepare_input($HTTP_GET_VARS['tID']);
+ if (isset($_GET['tcID']) && is_numeric($_GET['tcID'])) {
+ $error = false;
+
+ $osC_Database->startTransaction();
+
+ $Qrates = $osC_Database->query('delete from :table_tax_rates where tax_class_id = :tax_class_id');
+ $Qrates->bindTable(':table_tax_rates', TABLE_TAX_RATES);
+ $Qrates->bindInt(':tax_class_id', $_GET['tcID']);
+ $Qrates->execute();
+
+ if ($osC_Database->isError() === false) {
+ $Qclass = $osC_Database->query('delete from :table_tax_class where tax_class_id = :tax_class_id');
+ $Qclass->bindTable(':table_tax_class', TABLE_TAX_CLASS);
+ $Qclass->bindInt(':tax_class_id', $_GET['tcID']);
+ $Qclass->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ }
+ } else {
+ $error = true;
+ }
+
+ if ($error === false) {
+ $osC_Database->commitTransaction();
+
+ $messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
+ } else {
+ $osC_Database->rollbackTransaction();
- tep_db_query("delete from " . TABLE_TAX_CLASS . " where tax_class_id = '" . (int)$tax_class_id . "'");
+ $messageStack->add_session(ERROR_DB_ROWS_NOT_UPDATED, 'error');
+ }
- tep_redirect(tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page']));
+ tep_redirect(tep_href_link(FILENAME_TAX_CLASSES, '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>
-</head>
-<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
-<!-- 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><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>
- <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_TAX_CLASSES; ?></td>
- <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
- </tr>
-<?php
- $classes_query_raw = "select tax_class_id, tax_class_title, tax_class_description, last_modified, date_added from " . TABLE_TAX_CLASS . " order by tax_class_title";
- $classes_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $classes_query_raw, $classes_query_numrows);
- $classes_query = tep_db_query($classes_query_raw);
- while ($classes = tep_db_fetch_array($classes_query)) {
- if ((!isset($HTTP_GET_VARS['tID']) || (isset($HTTP_GET_VARS['tID']) && ($HTTP_GET_VARS['tID'] == $classes['tax_class_id']))) && !isset($tcInfo) && (substr($action, 0, 3) != 'new')) {
- $tcInfo = new objectInfo($classes);
- }
- if (isset($tcInfo) && is_object($tcInfo) && ($classes['tax_class_id'] == $tcInfo->tax_class_id)) {
- echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=edit') . '\'">' . "\n";
- } else {
- echo' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $classes['tax_class_id']) . '\'">' . "\n";
+ if (!empty($entriesAction)) {
+ switch ($entriesAction) {
+ case 'save':
+ if (isset($_GET['trID']) && is_numeric($_GET['trID'])) {
+ $Qrate = $osC_Database->query('update :table_tax_rates set tax_zone_id = :tax_zone_id, tax_priority = :tax_priority, tax_rate = :tax_rate, tax_description = :tax_description, last_modified = now() where tax_rates_id = :tax_rates_id');
+ $Qrate->bindInt(':tax_rates_id', $_GET['trID']);
+ } else {
+ $Qrate = $osC_Database->query('insert into :table_tax_rates (tax_zone_id, tax_class_id, tax_priority, tax_rate, tax_description, date_added) values (:tax_zone_id, :tax_class_id, :tax_priority, :tax_rate, :tax_description, now())');
+ $Qrate->bindInt(':tax_class_id', $_GET['tcID']);
+ }
+ $Qrate->bindTable(':table_tax_rates', TABLE_TAX_RATES);
+ $Qrate->bindInt(':tax_zone_id', $_POST['tax_zone_id']);
+ $Qrate->bindInt(':tax_priority', $_POST['tax_priority']);
+ $Qrate->bindValue(':tax_rate', $_POST['tax_rate']);
+ $Qrate->bindValue(':tax_description', $_POST['tax_description']);
+ $Qrate->execute();
+
+ if ($osC_Database->isError() === false) {
+ if (isset($_GET['trID']) && is_numeric($_GET['trID'])) {
+ $tax_rate_id = $_GET['trID'];
+ } else {
+ $tax_rate_id = $osC_Database->nextID();
+ }
+
+ if ($Qrate->affectedRows()) {
+ $messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
+ } else {
+ $messageStack->add_session(WARNING_DB_ROWS_NOT_UPDATED, 'warning');
+ }
+ } else {
+ $messageStack->add_session(ERROR_DB_ROWS_NOT_UPDATED, 'error');
+ }
+
+ tep_redirect(tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $_GET['tcID'] . '&action=list&entriesPage=' . $_GET['entriesPage'] . '&trID=' . $tax_rate_id));
+ break;
+ case 'deleteconfirm':
+ if (isset($_GET['trID']) && is_numeric($_GET['trID'])) {
+ $Qrate = $osC_Database->query('delete from :table_tax_rates where tax_rates_id = :tax_rates_id');
+ $Qrate->bindTable(':table_tax_rates', TABLE_TAX_RATES);
+ $Qrate->bindInt(':tax_rates_id', $_GET['trID']);
+ $Qrate->execute();
+
+ if ($osC_Database->isError() === false) {
+ if ($Qrate->affectedRows()) {
+ $messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
+ } else {
+ $messageStack->add_session(WARNING_DB_ROWS_NOT_UPDATED, 'warning');
+ }
+ } else {
+ $messageStack->add_session(ERROR_DB_ROWS_NOT_UPDATED, 'error');
+ }
+
+ tep_redirect(tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $_GET['tcID'] . '&action=list&entriesPage=' . $_GET['entriesPage']));
+ }
+ break;
}
-?>
- <td class="dataTableContent"><?php echo $classes['tax_class_title']; ?></td>
- <td class="dataTableContent" align="right"><?php if (isset($tcInfo) && is_object($tcInfo) && ($classes['tax_class_id'] == $tcInfo->tax_class_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $classes['tax_class_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
- </tr>
-<?php
}
-?>
- <tr>
- <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
- <tr>
- <td class="smallText" valign="top"><?php echo $classes_split->display_count($classes_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_TAX_CLASSES); ?></td>
- <td class="smallText" align="right"><?php echo $classes_split->display_links($classes_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_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&action=new') . '">' . tep_image_button('button_new_tax_class.gif', IMAGE_NEW_TAX_CLASS) . '</a>'; ?></td>
- </tr>
-<?php
- }
-?>
- </table></td>
- </tr>
- </table></td>
-<?php
- $heading = array();
- $contents = array();
switch ($action) {
- case 'new':
- $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_TAX_CLASS . '</b>');
-
- $contents = array('form' => tep_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&action=insert'));
- $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
- $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_TITLE . '<br>' . tep_draw_input_field('tax_class_title'));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . tep_draw_input_field('tax_class_description'));
- $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
- break;
- case 'edit':
- $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_TAX_CLASS . '</b>');
-
- $contents = array('form' => tep_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=save'));
- $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
- $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_TITLE . '<br>' . tep_draw_input_field('tax_class_title', $tcInfo->tax_class_title));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . tep_draw_input_field('tax_class_description', $tcInfo->tax_class_description));
- $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
- break;
- case 'delete':
- $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_TAX_CLASS . '</b>');
-
- $contents = array('form' => tep_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=deleteconfirm'));
- $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
- $contents[] = array('text' => '<br><b>' . $tcInfo->tax_class_title . '</b>');
- $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
- break;
- default:
- if (isset($tcInfo) && is_object($tcInfo)) {
- $heading[] = array('text' => '<b>' . $tcInfo->tax_class_title . '</b>');
-
- $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
- $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . tep_date_short($tcInfo->date_added));
- $contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . tep_date_short($tcInfo->last_modified));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . $tcInfo->tax_class_description);
- }
- break;
+ case 'list': $page_contents = 'tax_classes_listing.php'; break;
+ default: $page_contents = 'tax_classes.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 //-->
-<br>
-</body>
-</html>
-<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
----------
admin /admin /templates /pages
tax_classes_listing.php added at 1.1
diff -N tax_classes_listing.php
--- /dev/null Fri Jul 23 01:31:49 2004
+++ /tmp/cvsAAAiXaqzg Fri Jul 23 01:31:49 2004
@@ -0,0 +1,163 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ $Qclass = $osC_Database->query('select tax_class_id, tax_class_title from :table_tax_class where tax_class_id = :tax_class_id');
+ $Qclass->bindTable(':table_tax_class', TABLE_TAX_CLASS);
+ $Qclass->bindInt(':tax_class_id', $_GET['tcID']);
+ $Qclass->execute();
+?>
+
+<h1><?php echo HEADING_TITLE . ': ' . $Qclass->value('tax_class_title'); ?></h1>
+
+<div id="infoBox_trDefault" <?php if (!empty($entriesAction)) { echo 'style="display: none;"'; } ?>>
+ <table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">
+ <thead>
+ <tr>
+ <th><?php echo TABLE_HEADING_TAX_RATE_PRIORITY; ?></th>
+ <th><?php echo TABLE_HEADING_ZONE; ?></th>
+ <th><?php echo TABLE_HEADING_TAX_RATE; ?></th>
+ <th><?php echo TABLE_HEADING_ACTION; ?></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php
+ $Qrates = $osC_Database->query('select r.tax_rates_id, r.tax_priority, r.tax_rate, r.tax_description, r.date_added, r.last_modified, z.geo_zone_id, z.geo_zone_name from :table_tax_rates r, :table_geo_zones z where r.tax_class_id = :tax_class_id and r.tax_zone_id = z.geo_zone_id order by r.tax_priority, z.geo_zone_name');
+ $Qrates->bindTable(':table_tax_rates', TABLE_TAX_RATES);
+ $Qrates->bindTable(':table_geo_zones', TABLE_GEO_ZONES);
+ $Qrates->bindInt(':tax_class_id', $_GET['tcID']);
+ $Qrates->setBatchLimit($_GET['entriesPage'], MAX_DISPLAY_SEARCH_RESULTS);
+ $Qrates->execute();
+
+ while ($Qrates->next()) {
+ if (!isset($trInfo) && (!isset($_GET['trID']) || (isset($_GET['trID']) && ($_GET['trID'] == $Qrates->valueInt('tax_rates_id'))))) {
+ $trInfo = new objectInfo(array_merge($Qclass->toArray(), $Qrates->toArray()));
+ }
+
+ if (isset($trInfo) && ($Qrates->valueInt('tax_rates_id') == $trInfo->tax_rates_id)) {
+ echo ' <tr class="selected" title="' . $Qrates->valueProtected('tax_description') . '">' . "\n";
+ } else {
+ echo ' <tr onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);" onClick="document.location.href=\'' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $_GET['tcID'] . '&action=list&entriesPage=' . $_GET['entriesPage'] . '&trID=' . $Qrates->valueInt('tax_rates_id')) . '\';" title="' . $Qrates->valueProtected('tax_description') . '">' . "\n";
+ }
+?>
+ <td><?php echo $Qrates->valueInt('tax_priority'); ?></td>
+ <td><?php echo $Qrates->value('geo_zone_name'); ?></td>
+ <td><?php echo tep_display_tax_value($Qrates->valueDecimal('tax_rate')); ?>%</td>
+ <td align="right">
+<?php
+ if (isset($trInfo) && ($Qrates->valueInt('tax_rates_id') == $trInfo->tax_rates_id)) {
+ echo '<a href="#" onClick="toggleInfoBox(\'trEdit\');">' . tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . '</a> ' .
+ '<a href="#" onClick="toggleInfoBox(\'trDelete\');">' . tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . '</a>';
+ } else {
+ echo '<a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $_GET['tcID'] . '&action=list&entriesPage=' . $_GET['entriesPage'] . '&trID=' . $Qrates->valueInt('tax_rates_id') . '&entriesAction=trEdit') . '">' . tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . '</a> ' .
+ '<a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $_GET['tcID'] . '&action=list&entriesPage=' . $_GET['entriesPage'] . '&trID=' . $Qrates->valueInt('tax_rates_id') . '&entriesAction=trDelete') . '">' . tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . '</a>';
+ }
+?>
+ </td>
+ </tr>
+<?php
+ }
+?>
+ </tbody>
+ </table>
+
+ <table border="0" width="100%" cellspacing="0" cellpadding="2">
+ <tr>
+ <td class="smallText"><?php echo $Qrates->displayBatchLinksTotal(TEXT_DISPLAY_NUMBER_OF_TAX_RATES); ?></td>
+ <td class="smallText" align="right"><?php echo $Qrates->displayBatchLinksPullDown('entriesPage'); ?></td>
+ </tr>
+ </table>
+
+ <p align="right"><?php echo '<input type="button" value="' . IMAGE_BACK . '" onClick="document.location.href=\'' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $_GET['tcID']) . '\';" class="infoBoxButton"> <input type="button" value="' . IMAGE_INSERT . '" onClick="toggleInfoBox(\'trNew\');" class="infoBoxButton">'; ?></p>
+</div>
+
+<div id="infoBox_trNew" <?php if ($entriesAction != 'trNew') { echo 'style="display: none;"'; } ?>>
+ <div class="infoBoxHeading"><?php echo tep_image('templates/' . $template . '/images/icons/16x16/new.png', IMAGE_INSERT, '16', '16') . ' ' . TEXT_INFO_HEADING_NEW_TAX_RATE; ?></div>
+ <div class="infoBoxContent">
+ <?php echo tep_draw_form('trNew', FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $_GET['tcID'] . '&action=list&entriesPage=' . $_GET['entriesPage'] . '&entriesAction=save'); ?>
+
+ <p><?php echo TEXT_INFO_INSERT_INTRO; ?></p>
+
+ <table border="0" width="100%" cellspacing="0" cellpadding="2">
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_ZONE_NAME . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo tep_geo_zones_pull_down('name="tax_zone_id"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_TAX_RATE . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('tax_rate', '', 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_TAX_RATE_DESCRIPTION . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('tax_description', '', 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_TAX_RATE_PRIORITY . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('tax_priority', '', 'style="width: 100%;"'); ?></td>
+ </tr>
+ </table>
+
+ <p align="center"><?php echo '<input type="submit" value="' . IMAGE_INSERT . '" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'trDefault\');" class="operationButton">'; ?></p>
+
+ </form>
+ </div>
+</div>
+
+<?php
+ if (isset($trInfo)) {
+?>
+
+<div id="infoBox_trEdit" <?php if ($entriesAction != 'trEdit') { echo 'style="display: none;"'; } ?>>
+ <div class="infoBoxHeading"><?php echo tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . ' ' . $trInfo->tax_class_title . ': ' . $trInfo->geo_zone_name; ?></div>
+ <div class="infoBoxContent">
+ <?php echo tep_draw_form('trEdit', FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $_GET['tcID'] . '&action=list&entriesPage=' . $_GET['entriesPage'] . '&trID=' . $trInfo->tax_rates_id .'&entriesAction=save'); ?>
+
+ <p><?php echo TEXT_INFO_EDIT_INTRO; ?></p>
+
+ <table border="0" width="100%" cellspacing="0" cellpadding="2">
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_ZONE_NAME . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo tep_geo_zones_pull_down('name="tax_zone_id"', $trInfo->geo_zone_id); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_TAX_RATE . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('tax_rate', $trInfo->tax_rate, 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_TAX_RATE_DESCRIPTION . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('tax_description', $trInfo->tax_description, 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_TAX_RATE_PRIORITY . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('tax_priority', $trInfo->tax_priority, 'style="width: 100%;"'); ?></td>
+ </tr>
+ </table>
+
+ <p><?php echo TEXT_INFO_LAST_MODIFIED . ' ' . (($trInfo->last_modified > $trInfo->date_added) ? tep_date_short($trInfo->last_modified) : tep_date_short($trInfo->date_added)); ?></p>
+
+ <p align="center"><?php echo '<input type="submit" value="' . IMAGE_SAVE . '" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'trDefault\');" class="operationButton">'; ?></p>
+
+ </form>
+ </div>
+</div>
+
+<div id="infoBox_trDelete" <?php if ($entriesAction != 'trDelete') { echo 'style="display: none;"'; } ?>>
+ <div class="infoBoxHeading"><?php echo tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . ' ' . $trInfo->tax_class_title . ': ' . $trInfo->geo_zone_name; ?></div>
+ <div class="infoBoxContent">
+ <p><?php echo TEXT_INFO_DELETE_INTRO; ?></p>
+ <p><?php echo '<b>' . $trInfo->tax_class_title . ': ' . $trInfo->geo_zone_name; ?></p>
+ <p align="center"><?php echo '<input type="button" value="' . IMAGE_DELETE . '" onClick="document.location.href=\'' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $_GET['tcID'] . '&action=list&entriesPage=' . $_GET['entriesPage'] . '&trID=' . $trInfo->tax_rates_id .'&entriesAction=deleteconfirm') . '\';" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'trDefault\');" class="operationButton">'; ?></p>
+ </div>
+</div>
+
+<?php
+ }
+?>
----------
admin /admin /templates /pages
tax_classes.php added at 1.1
diff -N tax_classes.php
--- /dev/null Fri Jul 23 01:31:49 2004
+++ /tmp/cvsAAAg0ayAg Fri Jul 23 01:31:49 2004
@@ -0,0 +1,164 @@
+<?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; ?></h1>
+
+<div id="infoBox_tcDefault" <?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_TAX_CLASSES; ?></th>
+ <th><?php echo TABLE_HEADING_TAX_RATES_TOTAL; ?></th>
+ <th><?php echo TABLE_HEADING_ACTION; ?></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php
+ $Qclasses = $osC_Database->query('select tax_class_id, tax_class_title, tax_class_description, last_modified, date_added from :table_tax_class order by tax_class_title');
+ $Qclasses->bindTable(':table_tax_class', TABLE_TAX_CLASS);
+ $Qclasses->setBatchLimit($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS);
+ $Qclasses->execute();
+
+ while ($Qclasses->next()) {
+ $Qrates = $osC_Database->query('select count(*) as total_tax_rates from :table_tax_rates where tax_class_id = :tax_class_id');
+ $Qrates->bindTable(':table_tax_rates', TABLE_TAX_RATES);
+ $Qrates->bindInt(':tax_class_id', $Qclasses->valueInt('tax_class_id'));
+ $Qrates->execute();
+
+ if (!isset($tcInfo) && (!isset($_GET['tcID']) || (isset($_GET['tcID']) && ($_GET['tcID'] == $Qclasses->valueInt('tax_class_id'))))) {
+ $tcInfo = new objectInfo(array_merge($Qclasses->toArray(), $Qrates->toArray()));
+ }
+
+ if (isset($tcInfo) && ($Qclasses->valueInt('tax_class_id') == $tcInfo->tax_class_id)) {
+ echo ' <tr class="selected" title="' . $Qclasses->valueProtected('tax_class_description') . '">' . "\n";
+ } else {
+ echo ' <tr onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);" onClick="document.location.href=\'' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $Qclasses->valueInt('tax_class_id')) . '\'" title="' . $Qclasses->valueProtected('tax_class_description') . '">' . "\n";
+ }
+?>
+ <td><?php echo '<a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $Qclasses->valueInt('tax_class_id') . '&action=list') . '">' . tep_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . ' ' . $Qclasses->value('tax_class_title') . '</a>'; ?></td>
+ <td><?php echo $Qrates->valueInt('total_tax_rates'); ?></td>
+ <td align="right">
+<?php
+ if (isset($tcInfo) && ($Qclasses->valueInt('tax_class_id') == $tcInfo->tax_class_id)) {
+ echo '<a href="#" onClick="toggleInfoBox(\'tcEdit\');">' . tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . '</a> ' .
+ '<a href="#" onClick="toggleInfoBox(\'tcDelete\');">' . tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . '</a>';
+ } else {
+ echo '<a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $Qclasses->valueInt('tax_class_id') . '&action=tcEdit') . '">' . tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . '</a> ' .
+ '<a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $Qclasses->valueInt('tax_class_id') . '&action=tcDelete') . '">' . tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . '</a>';
+ }
+?>
+ </td>
+ </tr>
+<?php
+ }
+?>
+ </tbody>
+ </table>
+
+ <table border="0" width="100%" cellspacing="0" cellpadding="2">
+ <tr>
+ <td class="smallText"><?php echo $Qclasses->displayBatchLinksTotal(TEXT_DISPLAY_NUMBER_OF_TAX_CLASSES); ?></td>
+ <td class="smallText" align="right"><?php echo $Qclasses->displayBatchLinksPullDown(); ?></td>
+ </tr>
+ </table>
+
+ <p align="right"><?php echo '<input type="button" value="' . IMAGE_INSERT . '" onClick="toggleInfoBox(\'tcNew\');" class="infoBoxButton">'; ?></p>
+</div>
+
+<div id="infoBox_tcNew" <?php if ($action != 'tcNew') { echo 'style="display: none;"'; } ?>>
+ <div class="infoBoxHeading"><?php echo tep_image('templates/' . $template . '/images/icons/16x16/new.png', IMAGE_INSERT, '16', '16') . ' ' . TEXT_INFO_HEADING_NEW_TAX_CLASS; ?></div>
+ <div class="infoBoxContent">
+ <?php echo tep_draw_form('tcNew', FILENAME_TAX_CLASSES, 'action=save'); ?>
+
+ <p><?php echo TEXT_INFO_INSERT_INTRO; ?></p>
+
+ <table border="0" width="100%" cellspacing="0" cellpadding="2">
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CLASS_TITLE . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('tax_class_title', '', 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CLASS_DESCRIPTION . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('tax_class_description', '', 'style="width: 100%;"'); ?></td>
+ </tr>
+ </table>
+
+ <p align="center"><?php echo '<input type="submit" value="' . IMAGE_INSERT . '" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'tcDefault\');" class="operationButton">'; ?></p>
+
+ </form>
+ </div>
+</div>
+
+<?php
+ if (isset($tcInfo)) {
+?>
+
+<div id="infoBox_tcEdit" <?php if ($action != 'tcEdit') { echo 'style="display: none;"'; } ?>>
+ <div class="infoBoxHeading"><?php echo tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . ' ' . $tcInfo->tax_class_title; ?></div>
+ <div class="infoBoxContent">
+ <?php echo tep_draw_form('tcEdit', FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $tcInfo->tax_class_id . '&action=save'); ?>
+
+ <p><?php echo TEXT_INFO_EDIT_INTRO; ?></p>
+
+ <table border="0" width="100%" cellspacing="0" cellpadding="2">
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CLASS_TITLE . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('tax_class_title', $tcInfo->tax_class_title, 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CLASS_DESCRIPTION . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('tax_class_description', $tcInfo->tax_class_description, 'style="width: 100%;"'); ?></td>
+ </tr>
+ </table>
+
+ <p><?php echo TEXT_INFO_LAST_MODIFIED . ' ' . (($tcInfo->last_modified > $tcInfo->date_added) ? tep_date_short($tcInfo->last_modified) : tep_date_short($tcInfo->date_added)); ?></p>
+
+ <p align="center"><?php echo '<input type="submit" value="' . IMAGE_SAVE . '" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'tcDefault\');" class="operationButton">'; ?></p>
+
+ </form>
+ </div>
+</div>
+
+<div id="infoBox_tcDelete" <?php if ($action != 'tcDelete') { echo 'style="display: none;"'; } ?>>
+ <div class="infoBoxHeading"><?php echo tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . ' ' . $tcInfo->tax_class_title; ?></div>
+ <div class="infoBoxContent">
+<?php
+ $Qcheck = $osC_Database->query('select products_id from :table_products where products_tax_class_id = :products_tax_class_id limit 1');
+ $Qcheck->bindTable(':table_products', TABLE_PRODUCTS);
+ $Qcheck->bindInt(':products_tax_class_id', $tcInfo->tax_class_id);
+ $Qcheck->execute();
+
+ if ($Qcheck->numberOfRows() > 0) {
+?>
+ <p><?php echo '<b>' . TEXT_INFO_DELETE_PROHIBITED . '</b>'; ?></p>
+ <p align="center"><?php echo '<input type="button" value="' . IMAGE_BACK . '" onClick="toggleInfoBox(\'tcDefault\');" class="operationButton">'; ?></p>
+<?php
+ } else {
+?>
+ <p><?php echo TEXT_INFO_DELETE_INTRO; ?></p>
+ <p><?php echo '<b>' . $tcInfo->tax_class_title; ?></p>
+<?php
+ if ($tcInfo->total_tax_rates > 0) {
+ echo ' <p><b>' . sprintf(TEXT_INFO_DELETE_TAX_RATES_WARNING, $tcInfo->total_tax_rates) . '</b></p>' . "\n";
+ }
+?>
+ <p align="center"><?php echo '<input type="button" value="' . IMAGE_DELETE . '" onClick="document.location.href=\'' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tcID=' . $tcInfo->tax_class_id . '&action=deleteconfirm') . '\';" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'tcDefault\');" class="operationButton">'; ?></p>
+<?php
+ }
+?>
+ </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