[TEP-COMMIT] [CVS admin] update to the template structure
anonymous-OfajU3CKLf1/[email protected] 22 Jul 2004 23:29:15 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit in admin/admin on MAIN
languages.php +281 -236 1.35 -> 1.36
templates/pages/languages.php +190 added 1.1
+471 -236
1 added + 1 modified, total 2 files
update to the template structure
----------
admin /admin
languages.php 1.35 -> 1.36
diff -u -r1.35 -r1.36
--- languages.php 2003/06/29 22:50:52 1.35
+++ languages.php 2004/07/22 23:29:09 1.36
@@ -5,279 +5,324 @@
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 = 'localization';
- 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':
- $name = tep_db_prepare_input($HTTP_POST_VARS['name']);
- $code = tep_db_prepare_input($HTTP_POST_VARS['code']);
- $image = tep_db_prepare_input($HTTP_POST_VARS['image']);
- $directory = tep_db_prepare_input($HTTP_POST_VARS['directory']);
- $sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']);
+ case 'save':
+ $error = false;
- tep_db_query("insert into " . TABLE_LANGUAGES . " (name, code, image, directory, sort_order) values ('" . tep_db_input($name) . "', '" . tep_db_input($code) . "', '" . tep_db_input($image) . "', '" . tep_db_input($directory) . "', '" . tep_db_input($sort_order) . "')");
- $insert_id = tep_db_insert_id();
+ $osC_Database->startTransaction();
-// create additional categories_description records
- $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c left join " . TABLE_CATEGORIES_DESCRIPTION . " cd on c.categories_id = cd.categories_id where cd.language_id = '" . (int)$languages_id . "'");
- while ($categories = tep_db_fetch_array($categories_query)) {
- tep_db_query("insert into " . TABLE_CATEGORIES_DESCRIPTION . " (categories_id, language_id, categories_name) values ('" . (int)$categories['categories_id'] . "', '" . (int)$insert_id . "', '" . tep_db_input($categories['categories_name']) . "')");
+ if (isset($_GET['lID']) && is_numeric($_GET['lID'])) {
+ $Qlanguage = $osC_Database->query('update :table_languages set name = :name, code = :code, image = :image, directory = :directory, sort_order = :sort_order where languages_id = :languages_id');
+ $Qlanguage->bindInt(':languages_id', $_GET['lID']);
+ } else {
+ $Qlanguage = $osC_Database->query('insert into :table_languages (name, code, image, directory, sort_order) values (:name, :code, :image, :directory, :sort_order)');
}
+ $Qlanguage->bindTable(':table_languages', TABLE_LANGUAGES);
+ $Qlanguage->bindValue(':name', $_POST['name']);
+ $Qlanguage->bindValue(':code', $_POST['code']);
+ $Qlanguage->bindValue(':image', $_POST['image']);
+ $Qlanguage->bindValue(':directory', $_POST['directory']);
+ $Qlanguage->bindInt(':sort_order', $_POST['sort_order']);
+ $Qlanguage->execute();
+
+ if ($osC_Database->isError() === false) {
+ if (isset($_GET['lID']) && is_numeric($_GET['lID'])) {
+ $language_id = $_GET['lID'];
+ } else {
+ $language_id = $osC_Database->nextID();
+ include('../includes/classes/language.php');
+ $osC_Language = new language();
+
+// create additional categories_description records
+ $Qcategories = $osC_Database->query('select categories_id, categories_name from :table_categories_description where language_id = :language_id');
+ $Qcategories->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
+ $Qcategories->bindInt(':language_id', $osC_Language->catalog_languages[DEFAULT_LANGUAGE]['id']);
+ $Qcategories->execute();
+
+ while ($Qcategories->next()) {
+ $Qinsert = $osC_Database->query('insert into :table_categories_description (categories_id, language_id, categories_name) values (:categories_id, :language_id, :categories_name)');
+ $Qinsert->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
+ $Qinsert->bindInt(':categories_id', $Qcategories->valueInt('categories_id'));
+ $Qinsert->bindInt(':language_id', $language_id);
+ $Qinsert->bindValue(':categories_name', $Qcategories->value('categories_name'));
+ $Qinsert->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ break;
+ }
+ }
+
+ if ($error === false) {
// create additional products_description records
- $products_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, pd.products_url from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where pd.language_id = '" . (int)$languages_id . "'");
- while ($products = tep_db_fetch_array($products_query)) {
- tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url) values ('" . (int)$products['products_id'] . "', '" . (int)$insert_id . "', '" . tep_db_input($products['products_name']) . "', '" . tep_db_input($products['products_description']) . "', '" . tep_db_input($products['products_url']) . "')");
- }
+ $Qproducts = $osC_Database->query('select products_id, products_name, products_description, products_url from :table_products_description where language_id = :language_id');
+ $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
+ $Qproducts->bindInt(':language_id', $osC_Language->catalog_languages[DEFAULT_LANGUAGE]['id']);
+ $Qproducts->execute();
+
+ while ($Qproducts->next()) {
+ $Qinsert = $osC_Database->query('insert into :table_products_description (products_id, language_id, products_name, products_description, products_url) values (:products_id, :language_id, :products_name, :products_description, :products_url)');
+ $Qinsert->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
+ $Qinsert->bindInt(':products_id', $Qproducts->valueInt('products_id'));
+ $Qinsert->bindInt(':language_id', $language_id);
+ $Qinsert->bindInt(':products_name', $Qproducts->value('products_name'));
+ $Qinsert->bindInt(':products_description', $Qproducts->value('products_description'));
+ $Qinsert->bindInt(':products_url', $Qproducts->value('products_url'));
+ $Qinsert->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ break;
+ }
+ }
+ }
+ if ($error === false) {
// create additional products_options records
- $products_options_query = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "'");
- while ($products_options = tep_db_fetch_array($products_options_query)) {
- tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, language_id, products_options_name) values ('" . (int)$products_options['products_options_id'] . "', '" . (int)$insert_id . "', '" . tep_db_input($products_options['products_options_name']) . "')");
- }
+ $Qoptions = $osC_Database->query('select products_options_id, products_options_name from :table_products_options where language_id = :language_id');
+ $Qoptions->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
+ $Qoptions->bindInt(':language_id', $osC_Language->catalog_languages[DEFAULT_LANGUAGE]['id']);
+ $Qoptions->execute();
+
+ while ($Qoptions->next()) {
+ $Qinsert = $osC_Database->query('insert into :table_products_options (products_options_id, language_id, products_options_name) values (:products_options_id, :language_id, :products_options_name)');
+ $Qinsert->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
+ $Qinsert->bindInt(':products_options_id', $Qoptions->valueInt('products_options_id'));
+ $Qinsert->bindInt(':language_id', $language_id);
+ $Qinsert->bindValue(':products_options_name', $Qoptions->value('products_options_name'));
+ $Qinsert->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ break;
+ }
+ }
+ }
+ if ($error === false) {
// create additional products_options_values records
- $products_options_values_query = tep_db_query("select products_options_values_id, products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where language_id = '" . (int)$languages_id . "'");
- while ($products_options_values = tep_db_fetch_array($products_options_values_query)) {
- tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int)$products_options_values['products_options_values_id'] . "', '" . (int)$insert_id . "', '" . tep_db_input($products_options_values['products_options_values_name']) . "')");
- }
+ $Qvalues = $osC_Database->query('select products_options_values_id, products_options_values_name from :table_products_options_values where language_id = :language_id');
+ $Qvalues->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
+ $Qvalues->bindInt(':language_id', $osC_Language->catalog_languages[DEFAULT_LANGUAGE]['id']);
+ $Qvalues->execute();
+
+ while ($Qvalues->next()) {
+ $Qinsert = $osC_Database->query('insert into :table_products_options_values (products_options_values_id, language_id, products_options_values_name) values (:products_options_values_id, :language_id, :products_options_values_name)');
+ $Qinsert->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
+ $Qinsert->bindInt(':products_options_values_id', $Qvalues->valueInt('products_options_values_id'));
+ $Qinsert->bindInt(':language_id', $language_id);
+ $Qinsert->bindValue(':products_options_values_name', $Qvalues->value('products_options_values_name'));
+ $Qinsert->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ break;
+ }
+ }
+ }
+ if ($error === false) {
// create additional manufacturers_info records
- $manufacturers_query = tep_db_query("select m.manufacturers_id, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on m.manufacturers_id = mi.manufacturers_id where mi.languages_id = '" . (int)$languages_id . "'");
- while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
- tep_db_query("insert into " . TABLE_MANUFACTURERS_INFO . " (manufacturers_id, languages_id, manufacturers_url) values ('" . $manufacturers['manufacturers_id'] . "', '" . (int)$insert_id . "', '" . tep_db_input($manufacturers['manufacturers_url']) . "')");
- }
+ $Qmanufacturers = $osC_Database->query('select manufacturers_id, manufacturers_url from :table_manufacturers_info where languages_id = :languages_id');
+ $Qmanufacturers->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
+ $Qmanufacturers->bindInt(':languages_id', $osC_Language->catalog_languages[DEFAULT_LANGUAGE]['id']);
+ $Qmanufacturers->execute();
+
+ while ($Qmanufacturers->next()) {
+ $Qinsert = $osC_Database->query('insert into :table_manufacturers_info (manufacturers_id, languages_id, manufacturers_url) values (:manufacturers_id, :languages_id, :manufacturers_url)');
+ $Qinsert->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
+ $Qinsert->bindInt(':manufacturers_id', $Qmanufacturers->valueInt('manufacturers_id'));
+ $Qinsert->bindInt(':languages_id', $language_id);
+ $Qinsert->bindValue(':manufacturers_url', $Qmanufacturers->value('manufacturers_url'));
+ $Qinsert->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ break;
+ }
+ }
+ }
+ if ($error === false) {
// create additional orders_status records
- $orders_status_query = tep_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . (int)$languages_id . "'");
- while ($orders_status = tep_db_fetch_array($orders_status_query)) {
- tep_db_query("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . (int)$orders_status['orders_status_id'] . "', '" . (int)$insert_id . "', '" . tep_db_input($orders_status['orders_status_name']) . "')");
+ $Qstatus = $osC_Database->query('select orders_status_id, orders_status_name from :table_orders_status where language_id = :language_id');
+ $Qstatus->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
+ $Qstatus->bindInt(':language_id', $osC_Language->catalog_languages[DEFAULT_LANGUAGE]['id']);
+ $Qstatus->execute();
+
+ while ($Qstatus->next()) {
+ $Qinsert = $osC_Database->query('insert into :table_orders_status (orders_status_id, language_id, orders_status_name) values (:orders_status_id, :language_id, :orders_status_name)');
+ $Qinsert->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
+ $Qinsert->bindInt(':orders_status_id', $Qstatus->valueInt('orders_status_id'));
+ $Qinsert->bindInt(':language_id', $language_id);
+ $Qinsert->bindValue(':orders_status_name', $Qstatus->value('orders_status_name'));
+ $Qinsert->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ break;
+ }
+ }
+ }
+ }
+ } else {
+ $error = true;
}
- 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_LANGUAGE'");
+ if ($error === false) {
+ if ( (isset($_POST['default']) && ($_POST['default'] == 'on')) || (isset($_POST['is_default']) && ($_POST['is_default'] == 'true') && ($_POST['code'] != DEFAULT_LANGUAGE)) ) {
+ $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_LANGUAGE');
+ $Qupdate->execute();
+
+ if ($osC_Database->isError() === false) {
+ if ($Qupdate->affectedRows()) {
+ osC_Cache::clear('configuration');
+ }
+ } else {
+ $error = true;
+ }
+ }
}
- tep_redirect(tep_href_link(FILENAME_LANGUAGES, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'lID=' . $insert_id));
- break;
- case 'save':
- $lID = tep_db_prepare_input($HTTP_GET_VARS['lID']);
- $name = tep_db_prepare_input($HTTP_POST_VARS['name']);
- $code = tep_db_prepare_input($HTTP_POST_VARS['code']);
- $image = tep_db_prepare_input($HTTP_POST_VARS['image']);
- $directory = tep_db_prepare_input($HTTP_POST_VARS['directory']);
- $sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']);
+ if ($error === false) {
+ $osC_Database->commitTransaction();
- tep_db_query("update " . TABLE_LANGUAGES . " set name = '" . tep_db_input($name) . "', code = '" . tep_db_input($code) . "', image = '" . tep_db_input($image) . "', directory = '" . tep_db_input($directory) . "', sort_order = '" . tep_db_input($sort_order) . "' where languages_id = '" . (int)$lID . "'");
+ $messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
+ } else {
+ $osC_Database->rollbackTransaction();
- if ($HTTP_POST_VARS['default'] == 'on') {
- tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($code) . "' where configuration_key = 'DEFAULT_LANGUAGE'");
+ $messageStack->add_session(ERROR_DB_ROWS_NOT_UPDATED, 'error');
}
- tep_redirect(tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'] . '&lID=' . $HTTP_GET_VARS['lID']));
+ tep_redirect(tep_href_link(FILENAME_LANGUAGES, 'page=' . $_GET['page'] . '&lID=' . $language_id));
break;
case 'deleteconfirm':
- $lID = tep_db_prepare_input($HTTP_GET_VARS['lID']);
-
- $lng_query = tep_db_query("select languages_id from " . TABLE_LANGUAGES . " where code = '" . DEFAULT_CURRENCY . "'");
- $lng = tep_db_fetch_array($lng_query);
- if ($lng['languages_id'] == $lID) {
- tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '' where configuration_key = 'DEFAULT_CURRENCY'");
+ if (isset($_GET['lID']) && is_numeric($_GET['lID'])) {
+ $Qcheck = $osC_Database->query('select code from :table_languages where languages_id = :languages_id');
+ $Qcheck->bindTable(':table_languages', TABLE_LANGUAGES);
+ $Qcheck->bindInt(':languages_id', $_GET['lID']);
+ $Qcheck->execute();
+
+ if ($Qcheck->value('code') != DEFAULT_LANGUAGE) {
+ $error = false;
+
+ $osC_Database->startTransaction();
+
+ $Qcategories = $osC_Database->query('delete from :table_categories_description where language_id = :language_id');
+ $Qcategories->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
+ $Qcategories->bindInt(':language_id', $_GET['lID']);
+ $Qcategories->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ }
+
+ if ($error === false) {
+ $Qproducts = $osC_Database->query('delete from :table_products_description where language_id = :language_id');
+ $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
+ $Qproducts->bindInt(':language_id', $_GET['lID']);
+ $Qproducts->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ }
+ }
+
+ if ($error === false) {
+ $Qproducts = $osC_Database->query('delete from :table_products_options where language_id = :language_id');
+ $Qproducts->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
+ $Qproducts->bindInt(':language_id', $_GET['lID']);
+ $Qproducts->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ }
+ }
+
+ if ($error === false) {
+ $Qproducts = $osC_Database->query('delete from :table_products_options_values where language_id = :language_id');
+ $Qproducts->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
+ $Qproducts->bindInt(':language_id', $_GET['lID']);
+ $Qproducts->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ }
+ }
+
+ if ($error === false) {
+ $Qmanufacturers = $osC_Database->query('delete from :table_manufacturers_info where languages_id = :languages_id');
+ $Qmanufacturers->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
+ $Qmanufacturers->bindInt(':languages_id', $_GET['lID']);
+ $Qmanufacturers->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ }
+ }
+
+ if ($error === false) {
+ $Qstatus = $osC_Database->query('delete from :table_orders_status where language_id = :language_id');
+ $Qstatus->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
+ $Qstatus->bindInt(':language_id', $_GET['lID']);
+ $Qstatus->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ }
+ }
+
+ if ($error === false) {
+ $Qlanguages = $osC_Database->query('delete from :table_languages where languages_id = :languages_id');
+ $Qlanguages->bindTable(':table_languages', TABLE_LANGUAGES);
+ $Qlanguages->bindInt(':languages_id', $_GET['lID']);
+ $Qlanguages->execute();
+
+ if ($osC_Database->isError()) {
+ $error = true;
+ }
+ }
+
+ if ($error === false) {
+ $osC_Database->commitTransaction();
+
+ $messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
+ } else {
+ $osC_Database->rollbackTransaction();
+
+ $messageStack->add_session(ERROR_DB_ROWS_NOT_UPDATED, 'error');
+ }
+ }
}
-
- tep_db_query("delete from " . TABLE_CATEGORIES_DESCRIPTION . " where language_id = '" . (int)$lID . "'");
- tep_db_query("delete from " . TABLE_PRODUCTS_DESCRIPTION . " where language_id = '" . (int)$lID . "'");
- tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$lID . "'");
- tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where language_id = '" . (int)$lID . "'");
- tep_db_query("delete from " . TABLE_MANUFACTURERS_INFO . " where languages_id = '" . (int)$lID . "'");
- tep_db_query("delete from " . TABLE_ORDERS_STATUS . " where language_id = '" . (int)$lID . "'");
- tep_db_query("delete from " . TABLE_LANGUAGES . " where languages_id = '" . (int)$lID . "'");
-
- tep_redirect(tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page']));
- break;
- case 'delete':
- $lID = tep_db_prepare_input($HTTP_GET_VARS['lID']);
-
- $lng_query = tep_db_query("select code from " . TABLE_LANGUAGES . " where languages_id = '" . (int)$lID . "'");
- $lng = tep_db_fetch_array($lng_query);
- $remove_language = true;
- if ($lng['code'] == DEFAULT_LANGUAGE) {
- $remove_language = false;
- $messageStack->add(ERROR_REMOVE_DEFAULT_LANGUAGE, 'error');
- }
+ tep_redirect(tep_href_link(FILENAME_LANGUAGES, '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 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>
- <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_LANGUAGE_NAME; ?></td>
- <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LANGUAGE_CODE; ?></td>
- <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
- </tr>
-<?php
- $languages_query_raw = "select languages_id, name, code, image, directory, sort_order from " . TABLE_LANGUAGES . " order by sort_order";
- $languages_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $languages_query_raw, $languages_query_numrows);
- $languages_query = tep_db_query($languages_query_raw);
-
- while ($languages = tep_db_fetch_array($languages_query)) {
- if ((!isset($HTTP_GET_VARS['lID']) || (isset($HTTP_GET_VARS['lID']) && ($HTTP_GET_VARS['lID'] == $languages['languages_id']))) && !isset($lInfo) && (substr($action, 0, 3) != 'new')) {
- $lInfo = new objectInfo($languages);
- }
- if (isset($lInfo) && is_object($lInfo) && ($languages['languages_id'] == $lInfo->languages_id) ) {
- echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'] . '&lID=' . $lInfo->languages_id . '&action=edit') . '\'">' . "\n";
- } else {
- echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'] . '&lID=' . $languages['languages_id']) . '\'">' . "\n";
- }
+ $page_contents = 'languages.php';
- if (DEFAULT_LANGUAGE == $languages['code']) {
- echo ' <td class="dataTableContent"><b>' . $languages['name'] . ' (' . TEXT_DEFAULT . ')</b></td>' . "\n";
- } else {
- echo ' <td class="dataTableContent">' . $languages['name'] . '</td>' . "\n";
- }
-?>
- <td class="dataTableContent"><?php echo $languages['code']; ?></td>
- <td class="dataTableContent" align="right"><?php if (isset($lInfo) && is_object($lInfo) && ($languages['languages_id'] == $lInfo->languages_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'] . '&lID=' . $languages['languages_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
- </tr>
-<?php
- }
-?>
- <tr>
- <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
- <tr>
- <td class="smallText" valign="top"><?php echo $languages_split->display_count($languages_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_LANGUAGES); ?></td>
- <td class="smallText" align="right"><?php echo $languages_split->display_links($languages_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>
- </tr>
-<?php
- if (empty($action)) {
-?>
- <tr>
- <td align="right" colspan="2"><?php echo '<a href="' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'] . '&lID=' . $lInfo->languages_id . '&action=new') . '">' . tep_image_button('button_new_language.gif', IMAGE_NEW_LANGUAGE) . '</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_LANGUAGE . '</b>');
-
- $contents = array('form' => tep_draw_form('languages', FILENAME_LANGUAGES, 'action=insert'));
- $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
- $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_NAME . '<br>' . tep_draw_input_field('name'));
- $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_CODE . '<br>' . tep_draw_input_field('code'));
- $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_IMAGE . '<br>' . tep_draw_input_field('image', 'icon.gif'));
- $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_DIRECTORY . '<br>' . tep_draw_input_field('directory'));
- $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order'));
- $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('default') . ' ' . TEXT_SET_DEFAULT);
- $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'] . '&lID=' . $HTTP_GET_VARS['lID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
- break;
- case 'edit':
- $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_LANGUAGE . '</b>');
-
- $contents = array('form' => tep_draw_form('languages', FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'] . '&lID=' . $lInfo->languages_id . '&action=save'));
- $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
- $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_NAME . '<br>' . tep_draw_input_field('name', $lInfo->name));
- $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_CODE . '<br>' . tep_draw_input_field('code', $lInfo->code));
- $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_IMAGE . '<br>' . tep_draw_input_field('image', $lInfo->image));
- $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_DIRECTORY . '<br>' . tep_draw_input_field('directory', $lInfo->directory));
- $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', $lInfo->sort_order));
- if (DEFAULT_LANGUAGE != $lInfo->code) $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('default') . ' ' . TEXT_SET_DEFAULT);
- $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'] . '&lID=' . $lInfo->languages_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
- break;
- case 'delete':
- $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_LANGUAGE . '</b>');
-
- $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
- $contents[] = array('text' => '<br><b>' . $lInfo->name . '</b>');
- $contents[] = array('align' => 'center', 'text' => '<br>' . (($remove_language) ? '<a href="' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'] . '&lID=' . $lInfo->languages_id . '&action=deleteconfirm') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>' : '') . ' <a href="' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'] . '&lID=' . $lInfo->languages_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
- break;
- default:
- if (is_object($lInfo)) {
- $heading[] = array('text' => '<b>' . $lInfo->name . '</b>');
-
- $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'] . '&lID=' . $lInfo->languages_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'] . '&lID=' . $lInfo->languages_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_DEFINE_LANGUAGE, 'lngdir=' . $lInfo->directory) . '">' . tep_image_button('button_details.gif', IMAGE_DETAILS) . '</a>');
- $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_NAME . ' ' . $lInfo->name);
- $contents[] = array('text' => TEXT_INFO_LANGUAGE_CODE . ' ' . $lInfo->code);
- $contents[] = array('text' => '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $lInfo->directory . '/images/' . $lInfo->image, $lInfo->name));
- $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_DIRECTORY . '<br>' . DIR_WS_CATALOG_LANGUAGES . '<b>' . $lInfo->directory . '</b>');
- $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_SORT_ORDER . ' ' . $lInfo->sort_order);
- }
- break;
- }
-
- if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
- echo ' <td width="25%" valign="top">' . "\n";
+ require('templates/default.php');
- $box = new box;
- echo $box->infoBox($heading, $contents);
-
- 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
languages.php added at 1.1
diff -N languages.php
--- /dev/null Fri Jul 23 01:29:09 2004
+++ /tmp/cvsAAAAaaOEd Fri Jul 23 01:29:10 2004
@@ -0,0 +1,190 @@
+<?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_lDefault" <?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_LANGUAGE_NAME; ?></th>
+ <th><?php echo TABLE_HEADING_LANGUAGE_CODE; ?></th>
+ <th><?php echo TABLE_HEADING_ACTION; ?></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php
+ $Qlanguages = $osC_Database->query('select languages_id, name, code, image, directory, sort_order from :table_languages order by sort_order, name');
+ $Qlanguages->bindTable(':table_languages', TABLE_LANGUAGES);
+ $Qlanguages->setBatchLimit($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS);
+ $Qlanguages->execute();
+
+ while ($Qlanguages->next()) {
+ if (!isset($lInfo) && (!isset($_GET['lID']) || (isset($_GET['lID']) && ($_GET['lID'] == $Qlanguages->valueInt('languages_id'))))) {
+ $lInfo = new objectInfo($Qlanguages->toArray());
+ }
+
+ if (isset($lInfo) && ($Qlanguages->valueInt('languages_id') == $lInfo->languages_id)) {
+ echo ' <tr class="selected">' . "\n";
+ } else {
+ echo ' <tr onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);" onClick="document.location.href=\'' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $_GET['page'] . '&lID=' . $Qlanguages->valueInt('languages_id')) . '\';">' . "\n";
+ }
+
+ if (DEFAULT_LANGUAGE == $Qlanguages->value('code')) {
+ echo ' <td><b>' . $Qlanguages->value('name') . ' (' . TEXT_DEFAULT . ')</b></td>' . "\n";
+ } else {
+ echo ' <td>' . $Qlanguages->value('name') . '</td>' . "\n";
+ }
+?>
+ <td><?php echo $Qlanguages->value('code'); ?></td>
+ <td align="right">
+<?php
+ if (isset($lInfo) && ($Qlanguages->valueInt('languages_id') == $lInfo->languages_id)) {
+ echo '<a href="#" onClick="toggleInfoBox(\'lEdit\');">' . tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . '</a> ' .
+ '<a href="#" onClick="toggleInfoBox(\'lDelete\');">' . tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . '</a>';
+ } else {
+ echo '<a href="' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $_GET['page'] . '&lID=' . $Qlanguages->valueInt('languages_id') . '&action=lEdit') . '">' . tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . '</a> ' .
+ '<a href="' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $_GET['page'] . '&lID=' . $Qlanguages->valueInt('languages_id') . '&action=lDelete') . '">' . 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 $Qlanguages->displayBatchLinksTotal(TEXT_DISPLAY_NUMBER_OF_LANGUAGES); ?></td>
+ <td class="smallText" align="right"><?php echo $Qlanguages->displayBatchLinksPullDown(); ?></td>
+ </tr>
+ </table>
+
+ <p align="right"><?php echo '<input type="button" value="' . IMAGE_INSERT . '" onClick="toggleInfoBox(\'lNew\');" class="infoBoxButton">'; ?></p>
+</div>
+
+<div id="infoBox_lNew" <?php if ($action != 'lNew') { 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_LANGUAGE; ?></div>
+ <div class="infoBoxContent">
+ <?php echo tep_draw_form('lNew', FILENAME_LANGUAGES, '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_LANGUAGE_NAME . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('name', '', 'style="width: 100%"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_LANGUAGE_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_LANGUAGE_IMAGE . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('image', '', 'style="width: 100%"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_LANGUAGE_DIRECTORY . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('directory', '', 'style="width: 100%"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_LANGUAGE_SORT_ORDER . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('sort_order', '', 'style="width: 100%"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_SET_DEFAULT . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_checkbox_field('default'); ?></td>
+ </tr>
+ </table>
+
+ <p align="center"><?php echo '<input type="submit" value="' . IMAGE_SAVE . '" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'lDefault\');" class="operationButton">'; ?></p>
+
+ </form>
+ </div>
+</div>
+
+<?php
+ if (isset($lInfo)) {
+?>
+
+<div id="infoBox_lEdit" <?php if ($action != 'lEdit') { echo 'style="display: none;"'; } ?>>
+ <div class="infoBoxHeading"><?php echo tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . ' ' . $lInfo->name; ?></div>
+ <div class="infoBoxContent">
+ <?php echo tep_draw_form('lNew', FILENAME_LANGUAGES, 'page=' . $_GET['page'] . '&lID=' . $lInfo->languages_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_LANGUAGE_NAME . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('name', $lInfo->name, 'style="width: 100%"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_LANGUAGE_CODE . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('code', $lInfo->code, 'style="width: 100%"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_LANGUAGE_IMAGE . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('image', $lInfo->image, 'style="width: 100%"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_LANGUAGE_DIRECTORY . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('directory', $lInfo->directory, 'style="width: 100%"'); ?></td>
+ </tr>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_LANGUAGE_SORT_ORDER . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_input_field('sort_order', $lInfo->sort_order, 'style="width: 100%"'); ?></td>
+ </tr>
+<?php
+ if (DEFAULT_LANGUAGE != $lInfo->code) {
+?>
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . TEXT_SET_DEFAULT . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo osc_draw_checkbox_field('default'); ?></td>
+ </tr>
+<?php
+ }
+?>
+ </table>
+
+ <p align="center"><?php echo ((DEFAULT_LANGUAGE == $lInfo->code) ? osc_draw_hidden_field('is_default', 'true') : '') . '<input type="submit" value="' . IMAGE_SAVE . '" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'lDefault\');" class="operationButton">'; ?></p>
+
+ </form>
+ </div>
+</div>
+
+<div id="infoBox_lDelete" <?php if ($action != 'lDelete') { echo 'style="display: none;"'; } ?>>
+ <div class="infoBoxHeading"><?php echo tep_image('templates/' . $template . '/images/icons/16x16/trash.png', IMAGE_DELETE, '16', '16') . ' ' . $lInfo->name; ?></div>
+ <div class="infoBoxContent">
+<?php
+ if (DEFAULT_LANGUAGE == $lInfo->code) {
+?>
+ <p><?php echo '<b>' . TEXT_INFO_DELETE_PROHIBITED . '</b>'; ?></p>
+ <p align="center"><?php echo '<input type="button" value="' . IMAGE_BACK . '" onClick="toggleInfoBox(\'lDefault\');" class="operationButton">'; ?></p>
+<?php
+ } else {
+?>
+ <p><?php echo TEXT_INFO_DELETE_INTRO; ?></p>
+ <p><?php echo '<b>' . $lInfo->name . '</b>'; ?></p>
+ <p align="center"><?php echo '<input type="button" value="' . IMAGE_DELETE . '" onClick="document.location.href=\'' . tep_href_link(FILENAME_LANGUAGES, 'page=' . $_GET['page'] . '&lID=' . $lInfo->languages_id . '&action=deleteconfirm') . '\';" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'lDefault\');" 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