[TEP-COMMIT] [CVS admin] update to the template structure
anonymous-OfajU3CKLf1/[email protected] 22 Jul 2004 23:27:57 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit in admin/admin on MAIN
currencies.php +92 -242 1.50 -> 1.51
templates/pages/currencies.php +237 added 1.1
+329 -242
1 added + 1 modified, total 2 files
update to the template structure
----------
admin /admin
currencies.php 1.50 -> 1.51
diff -u -r1.50 -r1.51
--- currencies.php 2004/04/16 05:37:21 1.50
+++ currencies.php 2004/07/22 23:27:55 1.51
@@ -5,274 +5,124 @@
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 = 'localization';
- $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
+ require('../includes/classes/currencies.php');
+ $osC_Currencies = new osC_Currencies();
- if (tep_not_null($action)) {
+ $action = (isset($_GET['action']) ? $_GET['action'] : '');
+
+ if (!isset($_GET['page']) || (isset($_GET['page']) && !is_numeric($_GET['page']))) {
+ $_GET['page'] = 1;
+ }
+
+ if (!empty($action)) {
switch ($action) {
- case 'insert':
case 'save':
- if (isset($HTTP_GET_VARS['cID'])) $currency_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);
- $title = tep_db_prepare_input($HTTP_POST_VARS['title']);
- $code = tep_db_prepare_input($HTTP_POST_VARS['code']);
- $symbol_left = tep_db_prepare_input($HTTP_POST_VARS['symbol_left']);
- $symbol_right = tep_db_prepare_input($HTTP_POST_VARS['symbol_right']);
- $decimal_places = tep_db_prepare_input($HTTP_POST_VARS['decimal_places']);
- $value = tep_db_prepare_input($HTTP_POST_VARS['value']);
-
- $sql_data_array = array('title' => $title,
- 'code' => $code,
- 'symbol_left' => $symbol_left,
- 'symbol_right' => $symbol_right,
- 'decimal_places' => $decimal_places,
- 'value' => $value);
-
- if ($action == 'insert') {
- tep_db_perform(TABLE_CURRENCIES, $sql_data_array);
- $currency_id = tep_db_insert_id();
- } elseif ($action == 'save') {
- tep_db_perform(TABLE_CURRENCIES, $sql_data_array, 'update', "currencies_id = '" . (int)$currency_id . "'");
- }
-
- if (isset($HTTP_POST_VARS['default']) && ($HTTP_POST_VARS['default'] == 'on')) {
- tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($code) . "' where configuration_key = 'DEFAULT_CURRENCY'");
+ if (isset($_GET['cID']) && is_numeric($_GET['cID'])) {
+ $Qcurrency = $osC_Database->query('update :table_currencies set title = :title, code = :code, symbol_left = :symbol_left, symbol_right = :symbol_right, decimal_places = :decimal_places, value = :value where currencies_id = :currencies_id');
+ $Qcurrency->bindInt(':currencies_id', $_GET['cID']);
+ } else {
+ $Qcurrency = $osC_Database->query('insert into :table_currencies (title, code, symbol_left, symbol_right, decimal_places, value) values (:title, :code, :symbol_left, :symbol_right, :decimal_places, :value)');
}
-
- tep_redirect(tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $currency_id));
- break;
- case 'deleteconfirm':
- $currencies_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);
+ $Qcurrency->bindTable(':table_currencies', TABLE_CURRENCIES);
+ $Qcurrency->bindValue(':title', $_POST['title']);
+ $Qcurrency->bindValue(':code', $_POST['code']);
+ $Qcurrency->bindValue(':symbol_left', $_POST['symbol_left']);
+ $Qcurrency->bindValue(':symbol_right', $_POST['symbol_right']);
+ $Qcurrency->bindInt(':decimal_places', $_POST['decimal_places']);
+ $Qcurrency->bindValue(':value', $_POST['value']);
+ $Qcurrency->execute();
+
+ if ($osC_Database->isError() === false) {
+ if (isset($_GET['cID']) && is_numeric($_GET['cID'])) {
+ $currency_id = $_GET['cID'];
+ } else {
+ $currency_id = $osC_Database->nextID();
+ }
- $currency_query = tep_db_query("select currencies_id from " . TABLE_CURRENCIES . " where code = '" . DEFAULT_CURRENCY . "'");
- $currency = tep_db_fetch_array($currency_query);
+ if ( (isset($_POST['default']) && ($_POST['default'] == 'on')) || (isset($_POST['is_default']) && ($_POST['is_default'] == 'true') && ($_POST['code'] != DEFAULT_CURRENCY)) ) {
+ $Qupdate = $osC_Database->query('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
+ $Qupdate->bindTable(':table_configuration', TABLE_CONFIGURATION);
+ $Qupdate->bindValue(':configuration_value', $_POST['code']);
+ $Qupdate->bindValue(':configuration_key', 'DEFAULT_CURRENCY');
+ $Qupdate->execute();
+
+ if ($Qupdate->affectedRows()) {
+ osC_Cache::clear('configuration');
+ }
+ }
- if ($currency['currencies_id'] == $currencies_id) {
- tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '' where configuration_key = 'DEFAULT_CURRENCY'");
+ $messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
+ } else {
+ $messageStack->add_session(ERROR_DB_ROWS_NOT_UPDATED, 'error');
}
-
- tep_db_query("delete from " . TABLE_CURRENCIES . " where currencies_id = '" . (int)$currencies_id . "'");
- tep_redirect(tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page']));
+ tep_redirect(tep_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page'] . '&cID=' . $currency_id));
break;
- case 'update':
- $server_used = CURRENCY_SERVER_PRIMARY;
-
- $currency_query = tep_db_query("select currencies_id, code, title from " . TABLE_CURRENCIES);
- while ($currency = tep_db_fetch_array($currency_query)) {
- $quote_function = 'quote_' . CURRENCY_SERVER_PRIMARY . '_currency';
- $rate = $quote_function($currency['code']);
-
- if (empty($rate) && (tep_not_null(CURRENCY_SERVER_BACKUP))) {
- $messageStack->add_session(sprintf(WARNING_PRIMARY_SERVER_FAILED, CURRENCY_SERVER_PRIMARY, $currency['title'], $currency['code']), 'warning');
-
- $quote_function = 'quote_' . CURRENCY_SERVER_BACKUP . '_currency';
- $rate = $quote_function($currency['code']);
-
- $server_used = CURRENCY_SERVER_BACKUP;
- }
-
- if (tep_not_null($rate)) {
- tep_db_query("update " . TABLE_CURRENCIES . " set value = '" . $rate . "', last_updated = now() where currencies_id = '" . (int)$currency['currencies_id'] . "'");
-
- $messageStack->add_session(sprintf(TEXT_INFO_CURRENCY_UPDATED, $currency['title'], $currency['code'], $server_used), 'success');
- } else {
- $messageStack->add_session(sprintf(ERROR_CURRENCY_INVALID, $currency['title'], $currency['code'], $server_used), 'error');
+ case 'deleteconfirm':
+ if (isset($_GET['cID']) && is_numeric($_GET['cID'])) {
+ $Qcheck = $osC_Database->query('select code from :table_currencies where currencies_id = :currencies_id');
+ $Qcheck->bindTable(':table_currencies', TABLE_CURRENCIES);
+ $Qcheck->bindInt(':currencies_id', $_GET['cID']);
+ $Qcheck->execute();
+
+ if ($Qcheck->value('code') != DEFAULT_CURRENCY) {
+ $Qdelete = $osC_Database->query('delete from :table_currencies where currencies_id = :currencies_id');
+ $Qdelete->bindTable(':table_currencies', TABLE_CURRENCIES);
+ $Qdelete->bindInt(':currencies_id', $_GET['cID']);
+ $Qdelete->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_redirect(tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $HTTP_GET_VARS['cID']));
+ tep_redirect(tep_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page']));
break;
- case 'delete':
- $currencies_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);
-
- $currency_query = tep_db_query("select code from " . TABLE_CURRENCIES . " where currencies_id = '" . (int)$currencies_id . "'");
- $currency = tep_db_fetch_array($currency_query);
+ case 'update_currencies':
+ if (isset($_POST['service']) && (($_POST['service'] == 'oanda') || ($_POST['service'] == 'xe'))) {
+ $quote_function = 'quote_' . $_POST['service'] . '_currency';
+
+ $Qcurrencies = $osC_Database->query('select currencies_id, code, title from :table_currencies');
+ $Qcurrencies->bindTable(':table_currencies', TABLE_CURRENCIES);
+ $Qcurrencies->execute();
+
+ while ($Qcurrencies->next()) {
+ $rate = $quote_function($Qcurrencies->value('code'));
+
+ if (!empty($rate)) {
+ $Qupdate = $osC_Database->query('update :table_currencies set value = :value, last_updated = now() where currencies_id = :currencies_id');
+ $Qupdate->bindTable(':table_currencies', TABLE_CURRENCIES);
+ $Qupdate->bindValue(':value', $rate);
+ $Qupdate->bindInt(':currencies_id', $Qcurrencies->valueInt('currencies_id'));
+ $Qupdate->execute();
+
+ $messageStack->add_session(sprintf(TEXT_INFO_CURRENCY_UPDATED, $Qcurrencies->value('title'), $Qcurrencies->value('code'), $_POST['service']), 'success');
+ } else {
+ $messageStack->add_session(sprintf(ERROR_CURRENCY_INVALID, $Qcurrencies->value('title'), $Qcurrencies->value('code'), $_POST['service']), 'error');
+ }
+ }
- $remove_currency = true;
- if ($currency['code'] == DEFAULT_CURRENCY) {
- $remove_currency = false;
- $messageStack->add(ERROR_REMOVE_DEFAULT_CURRENCY, 'error');
+ tep_redirect(tep_href_link(FILENAME_CURRENCIES));
}
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_CURRENCY_NAME; ?></td>
- <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CURRENCY_CODES; ?></td>
- <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_CURRENCY_VALUE; ?></td>
- <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
- </tr>
-<?php
- $currency_query_raw = "select currencies_id, title, code, symbol_left, symbol_right, decimal_places, last_updated, value from " . TABLE_CURRENCIES . " order by title";
- $currency_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $currency_query_raw, $currency_query_numrows);
- $currency_query = tep_db_query($currency_query_raw);
- while ($currency = tep_db_fetch_array($currency_query)) {
- if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $currency['currencies_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
- $cInfo = new objectInfo($currency);
- }
-
- if (isset($cInfo) && is_object($cInfo) && ($currency['currencies_id'] == $cInfo->currencies_id) ) {
- echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->currencies_id . '&action=edit') . '\'">' . "\n";
- } else {
- echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $currency['currencies_id']) . '\'">' . "\n";
- }
-
- if (DEFAULT_CURRENCY == $currency['code']) {
- echo ' <td class="dataTableContent"><b>' . $currency['title'] . ' (' . TEXT_DEFAULT . ')</b></td>' . "\n";
- } else {
- echo ' <td class="dataTableContent">' . $currency['title'] . '</td>' . "\n";
- }
-?>
- <td class="dataTableContent"><?php echo $currency['code']; ?></td>
- <td class="dataTableContent" align="right"><?php echo number_format($currency['value'], 8); ?></td>
- <td class="dataTableContent" align="right"><?php if (isset($cInfo) && is_object($cInfo) && ($currency['currencies_id'] == $cInfo->currencies_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $currency['currencies_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
- </tr>
-<?php
- }
-?>
- <tr>
- <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
- <tr>
- <td class="smallText" valign="top"><?php echo $currency_split->display_count($currency_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_CURRENCIES); ?></td>
- <td class="smallText" align="right"><?php echo $currency_split->display_links($currency_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>
- </tr>
-<?php
- if (empty($action)) {
-?>
- <tr>
- <td><?php if (CURRENCY_SERVER_PRIMARY) { echo '<a href="' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->currencies_id . '&action=update') . '">' . tep_image_button('button_update_currencies.gif', IMAGE_UPDATE_CURRENCIES) . '</a>'; } ?></td>
- <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->currencies_id . '&action=new') . '">' . tep_image_button('button_new_currency.gif', IMAGE_NEW_CURRENCY) . '</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_CURRENCY . '</b>');
-
- $contents = array('form' => tep_draw_form('currencies', FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . (isset($cInfo) ? '&cID=' . $cInfo->currencies_id : '') . '&action=insert'));
- $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_TITLE . '<br>' . tep_draw_input_field('title'));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_CODE . '<br>' . tep_draw_input_field('code'));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_SYMBOL_LEFT . '<br>' . tep_draw_input_field('symbol_left'));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_SYMBOL_RIGHT . '<br>' . tep_draw_input_field('symbol_right'));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_DECIMAL_PLACES . '<br>' . tep_draw_input_field('decimal_places'));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_VALUE . '<br>' . tep_draw_input_field('value'));
- $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('default') . ' ' . TEXT_INFO_SET_AS_DEFAULT);
- $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $HTTP_GET_VARS['cID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
- break;
- case 'edit':
- $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_CURRENCY . '</b>');
-
- $contents = array('form' => tep_draw_form('currencies', FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->currencies_id . '&action=save'));
- $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_TITLE . '<br>' . tep_draw_input_field('title', $cInfo->title));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_CODE . '<br>' . tep_draw_input_field('code', $cInfo->code));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_SYMBOL_LEFT . '<br>' . tep_draw_input_field('symbol_left', $cInfo->symbol_left));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_SYMBOL_RIGHT . '<br>' . tep_draw_input_field('symbol_right', $cInfo->symbol_right));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_DECIMAL_PLACES . '<br>' . tep_draw_input_field('decimal_places', $cInfo->decimal_places));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_VALUE . '<br>' . tep_draw_input_field('value', $cInfo->value));
- if (DEFAULT_CURRENCY != $cInfo->code) $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('default') . ' ' . TEXT_INFO_SET_AS_DEFAULT);
- $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->currencies_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
- break;
- case 'delete':
- $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_CURRENCY . '</b>');
-
- $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
- $contents[] = array('text' => '<br><b>' . $cInfo->title . '</b>');
- $contents[] = array('align' => 'center', 'text' => '<br>' . (($remove_currency) ? '<a href="' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->currencies_id . '&action=deleteconfirm') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>' : '') . ' <a href="' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->currencies_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
- break;
- default:
- if (is_object($cInfo)) {
- $heading[] = array('text' => '<b>' . $cInfo->title . '</b>');
-
- $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->currencies_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->currencies_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_TITLE . ' ' . $cInfo->title);
- $contents[] = array('text' => TEXT_INFO_CURRENCY_CODE . ' ' . $cInfo->code);
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_SYMBOL_LEFT . ' ' . $cInfo->symbol_left);
- $contents[] = array('text' => TEXT_INFO_CURRENCY_SYMBOL_RIGHT . ' ' . $cInfo->symbol_right);
- $contents[] = array('text' => TEXT_INFO_CURRENCY_DECIMAL_PLACES . ' ' . $cInfo->decimal_places);
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_LAST_UPDATED . ' ' . tep_date_short($cInfo->last_updated));
- $contents[] = array('text' => TEXT_INFO_CURRENCY_VALUE . ' ' . number_format($cInfo->value, 8));
- $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_EXAMPLE . '<br>' . $currencies->format('30', false, DEFAULT_CURRENCY) . ' = ' . $currencies->format('30', true, $cInfo->code));
- }
- break;
- }
- if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
- echo ' <td width="25%" valign="top">' . "\n";
+ $page_contents = 'currencies.php';
- $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
currencies.php added at 1.1
diff -N currencies.php
--- /dev/null Fri Jul 23 01:27:53 2004
+++ /tmp/cvsAAAgYaWid Fri Jul 23 01:27:56 2004
@@ -0,0 +1,237 @@
+<?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_cDefault" <?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_CURRENCY_NAME; ?></th>
+ <th><?php echo TABLE_HEADING_CURRENCY_CODES; ?></th>
+ <th><?php echo TABLE_HEADING_CURRENCY_VALUE; ?></th>
+ <th><?php echo TABLE_HEADING_CURRENCY_EXAMPLE; ?></th>
+ <th><?php echo TABLE_HEADING_ACTION; ?></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php
+ $Qcurrencies = $osC_Database->query('select currencies_id, title, code, symbol_left, symbol_right, decimal_places, last_updated, value from :table_currencies order by title');
+ $Qcurrencies->bindTable(':table_currencies', TABLE_CURRENCIES);
+ $Qcurrencies->setBatchLimit($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS);
+ $Qcurrencies->execute();
+
+ while ($Qcurrencies->next()) {
+ if (!isset($cInfo) && (!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $Qcurrencies->valueInt('currencies_id'))))) {
+ $cInfo = new objectInfo($Qcurrencies->toArray());
+ }
+
+ if (isset($cInfo) && ($Qcurrencies->valueInt('currencies_id') == $cInfo->currencies_id) ) {
+ echo ' <tr class="selected">' . "\n";
+ } else {
+ echo ' <tr onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);" onClick="document.location.href=\'' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page'] . '&cID=' . $Qcurrencies->valueInt('currencies_id')) . '\';">' . "\n";
+ }
+?>
+ <td>
+<?php
+ if (DEFAULT_CURRENCY == $Qcurrencies->value('code')) {
+ echo '<b>' . $Qcurrencies->value('title') . ' (' . TEXT_DEFAULT . ')</b>';
+ } else {
+ echo $Qcurrencies->value('title');
+ }
+?>
+ </td>
+ <td><?php echo $Qcurrencies->value('code'); ?></td>
+ <td><?php echo number_format($Qcurrencies->valueDecimal('value'), 8); ?></td>
+ <td><?php echo $osC_Currencies->format(1499.99, $Qcurrencies->value('code'), 1); ?></td>
+ <td align="right">
+<?php
+ if (isset($cInfo) && ($Qcurrencies->valueInt('currencies_id') == $cInfo->currencies_id)) {
+ echo '<a href="#" onClick="toggleInfoBox(\'cEdit\');">' . tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . '</a> ' .
+ '<a href="#" onClick="toggleInfoBox(\'cDelete\');">' . tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . '</a>';
+ } else {
+ echo '<a href="' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page'] . '&cID=' . $Qcurrencies->valueInt('currencies_id') . '&action=cEdit') . '">' . tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . '</a> ' .
+ '<a href="' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page'] . '&cID=' . $Qcurrencies->valueInt('currencies_id') . '&action=cDelete') . '">' . 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 $Qcurrencies->displayBatchLinksTotal(TEXT_DISPLAY_NUMBER_OF_CURRENCIES); ?></td>
+ <td class="smallText" align="right"><?php echo $Qcurrencies->displayBatchLinksPullDown(); ?></td>
+ </tr>
+ </table>
+
+ <p align="right">
+<?php
+ if (isset($cInfo)) {
+ echo '<input type="button" value="' . IMAGE_UPDATE_CURRENCIES . '" onClick="toggleInfoBox(\'cUpdate\');" class="infoBoxButton"> ';
+ }
+
+ echo '<input type="button" value="' . IMAGE_INSERT . '" onClick="toggleInfoBox(\'cNew\');" class="infoBoxButton">';
+?>
+ </p>
+</div>
+
+<div id="infoBox_cNew" <?php if ($action != 'cNew') { 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_CURRENCY; ?></div>
+ <div class="infoBoxContent">
+ <?php echo tep_draw_form('cNew', FILENAME_CURRENCIES, '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_CURRENCY_TITLE . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('title', '', 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CURRENCY_CODE . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('code', '', 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CURRENCY_SYMBOL_LEFT . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('symbol_left', '', 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CURRENCY_SYMBOL_RIGHT . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('symbol_right', '', 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CURRENCY_DECIMAL_PLACES . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('decimal_places', '', 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CURRENCY_VALUE . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('value', '', 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_SET_AS_DEFAULT . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_checkbox_field('default', '', 'style="width: 100%;"'); ?></td>
+ </tr>
+ </table>
+
+ <p align="center"><?php echo '<input type="submit" value="' . IMAGE_SAVE . '" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'cDefault\');" class="operationButton">'; ?></p>
+
+ </form>
+ </div>
+</div>
+
+<?php
+ if (isset($cInfo)) {
+?>
+
+<div id="infoBox_cUpdate" <?php if ($action != 'cUpdate') { echo 'style="display: none;"'; } ?>>
+ <div class="infoBoxHeading"><?php echo tep_image('templates/' . $template . '/images/icons/16x16/reload.png', IMAGE_UPDATE, '16', '16') . ' ' . IMAGE_UPDATE_CURRENCIES; ?></div>
+ <div class="infoBoxContent">
+ <?php echo tep_draw_form('cUpdate', FILENAME_CURRENCIES, 'action=update_currencies'); ?>
+
+ <p><?php echo TEXT_INFO_UPDATE_SERVICE_INTRO; ?></p>
+
+ <p>
+<?php
+ $services = array(array('id' => 'oanda', 'text' => 'Oanda (http://www.oanda.com)'),
+ array('id' => 'xe', 'text' => 'XE (http://www.xe.com)'));
+
+ echo osc_draw_radio_field('service', $services, '', '', false, '<br>');
+?>
+ </p>
+
+ <p><?php echo TEXT_INFO_SERVICE_TERMS; ?></p>
+
+ <p align="center"><?php echo '<input type="submit" value="' . IMAGE_UPDATE . '" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'cDefault\');" class="operationButton">'; ?></p>
+
+ </form>
+ </div>
+</div>
+
+<div id="infoBox_cEdit" <?php if ($action != 'cEdit') { echo 'style="display: none;"'; } ?>>
+ <div class="infoBoxHeading"><?php echo tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . ' ' . $cInfo->title; ?></div>
+ <div class="infoBoxContent">
+ <?php echo tep_draw_form('cEdit', FILENAME_CURRENCIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->currencies_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_CURRENCY_TITLE . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('title', $cInfo->title, 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CURRENCY_CODE . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('code', $cInfo->code, 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CURRENCY_SYMBOL_LEFT . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('symbol_left', $cInfo->symbol_left, 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CURRENCY_SYMBOL_RIGHT . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('symbol_right', $cInfo->symbol_right, 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CURRENCY_DECIMAL_PLACES . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('decimal_places', $cInfo->decimal_places, 'style="width: 100%;"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_CURRENCY_VALUE . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('value', $cInfo->value, 'style="width: 100%;"'); ?></td>
+ </tr>
+<?php
+ if (DEFAULT_CURRENCY != $cInfo->code) {
+?>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_SET_AS_DEFAULT . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_checkbox_field('default', '', 'style="width: 100%;"'); ?></td>
+ </tr>
+<?php
+ }
+?>
+ </table>
+
+ <p align="center"><?php echo ((DEFAULT_CURRENCY == $cInfo->code) ? osc_draw_hidden_field('is_default', 'true') : '') . '<input type="submit" value="' . IMAGE_SAVE . '" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'cDefault\');" class="operationButton">'; ?></p>
+
+ </form>
+ </div>
+</div>
+
+<div id="infoBox_cDelete" <?php if ($action != 'cDelete') { echo 'style="display: none;"'; } ?>>
+ <div class="infoBoxHeading"><?php echo tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . ' ' . $cInfo->title; ?></div>
+ <div class="infoBoxContent">
+<?php
+ if (DEFAULT_CURRENCY == $cInfo->code) {
+?>
+ <p><?php echo '<b>' . TEXT_INFO_DELETE_PROHIBITED . '</b>'; ?></p>
+ <p align="center"><?php echo '<input type="button" value="' . IMAGE_BACK . '" onClick="toggleInfoBox(\'cDefault\');" class="operationButton">'; ?></p>
+<?php
+ } else {
+?>
+ <p><?php echo TEXT_INFO_DELETE_INTRO; ?></p>
+ <p><?php echo '<b>' . $cInfo->title . '</b>'; ?></p>
+ <p align="center"><?php echo '<input type="button" value="' . IMAGE_DELETE . '" onClick="document.location.href=\'' . tep_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->currencies_id . '&action=deleteconfirm') . '\';" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'cDefault\');" 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