[TEP-COMMIT] [CVS admin] update to the template structure
anonymous-OfajU3CKLf1/[email protected] 22 Jul 2004 23:27:19 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit in admin/admin on MAIN
configuration.php +27 -148 1.44 -> 1.45
templates/pages/configuration.php +121 added 1.1
+148 -148
1 added + 1 modified, total 2 files
update to the template structure
----------
admin /admin
configuration.php 1.44 -> 1.45
diff -u -r1.44 -r1.45
--- configuration.php 2004/04/09 01:55:02 1.44
+++ configuration.php 2004/07/22 23:27:17 1.45
@@ -5,169 +5,48 @@
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 = 'configuration';
- if (tep_not_null($action)) {
- switch ($action) {
- case 'save':
- $configuration_value = tep_db_prepare_input($HTTP_POST_VARS['configuration_value']);
- $cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);
-
- tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($configuration_value) . "', last_modified = now() where configuration_id = '" . (int)$cID . "'");
+ $action = (isset($_GET['action']) ? $_GET['action'] : '');
- osC_Cache::clear('configuration');
-
- tep_redirect(tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cID));
- break;
- }
+ if (!isset($_GET['gID']) || (isset($_GET['gID']) && !is_numeric($_GET['gID']))) {
+ $_GET['gID'] = 1;
}
-
- $gID = (isset($HTTP_GET_VARS['gID'])) ? $HTTP_GET_VARS['gID'] : 1;
- $cfg_group_query = tep_db_query("select configuration_group_title from " . TABLE_CONFIGURATION_GROUP . " where configuration_group_id = '" . (int)$gID . "'");
- $cfg_group = tep_db_fetch_array($cfg_group_query);
-?>
-<!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 $cfg_group['configuration_group_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_CONFIGURATION_TITLE; ?></td>
- <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONFIGURATION_VALUE; ?></td>
- <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
- </tr>
-<?php
- $configuration_query = tep_db_query("select configuration_id, configuration_title, configuration_value, use_function from " . TABLE_CONFIGURATION . " where configuration_group_id = '" . (int)$gID . "' order by sort_order");
- while ($configuration = tep_db_fetch_array($configuration_query)) {
- if (tep_not_null($configuration['use_function'])) {
- $use_function = $configuration['use_function'];
- if (ereg('->', $use_function)) {
- $class_method = explode('->', $use_function);
- if (!is_object(${$class_method[0]})) {
- include(DIR_WS_CLASSES . $class_method[0] . '.php');
- ${$class_method[0]} = new $class_method[0]();
+ if (!empty($action)) {
+ switch ($action) {
+ case 'save':
+ if (isset($_GET['cID']) && is_numeric($_GET['cID'])) {
+ $Qupdate = $osC_Database->query('update :table_configuration set configuration_value = :configuration_value, last_modified = now() where configuration_id = :configuration_id');
+ $Qupdate->bindTable(':table_configuration', TABLE_CONFIGURATION);
+ $Qupdate->bindValue(':configuration_value', $_POST['configuration_value']);
+ $Qupdate->bindInt(':configuration_id', $_GET['cID']);
+ $Qupdate->execute();
+
+ if ($Qupdate->affectedRows()) {
+ osC_Cache::clear('configuration');
+
+ $messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
+ } else {
+ $messageStack->add_session(WARNING_DB_ROWS_NOT_UPDATED, 'warning');
+ }
}
- $cfgValue = tep_call_function($class_method[1], $configuration['configuration_value'], ${$class_method[0]});
- } else {
- $cfgValue = tep_call_function($use_function, $configuration['configuration_value']);
- }
- } else {
- $cfgValue = $configuration['configuration_value'];
- }
-
- if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $configuration['configuration_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
- $cfg_extra_query = tep_db_query("select configuration_key, configuration_description, date_added, last_modified, use_function, set_function from " . TABLE_CONFIGURATION . " where configuration_id = '" . (int)$configuration['configuration_id'] . "'");
- $cfg_extra = tep_db_fetch_array($cfg_extra_query);
- $cInfo_array = array_merge($configuration, $cfg_extra);
- $cInfo = new objectInfo($cInfo_array);
- }
-
- if ( (isset($cInfo) && is_object($cInfo)) && ($configuration['configuration_id'] == $cInfo->configuration_id) ) {
- echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id . '&action=edit') . '\'">' . "\n";
- } else {
- echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $configuration['configuration_id']) . '\'">' . "\n";
+ tep_redirect(tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $_GET['cID']));
+ break;
}
-?>
- <td class="dataTableContent"><?php echo $configuration['configuration_title']; ?></td>
- <td class="dataTableContent"><?php echo htmlspecialchars($cfgValue); ?></td>
- <td class="dataTableContent" align="right"><?php if ( (isset($cInfo) && is_object($cInfo)) && ($configuration['configuration_id'] == $cInfo->configuration_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $configuration['configuration_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
- </tr>
-<?php
- }
-?>
- </table></td>
-<?php
- $heading = array();
- $contents = array();
-
- switch ($action) {
- case 'edit':
- $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
-
- if ($cInfo->set_function) {
- eval('$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '");');
- } else {
- $value_field = tep_draw_input_field('configuration_value', $cInfo->configuration_value);
- }
-
- $contents = array('form' => tep_draw_form('configuration', FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id . '&action=save'));
- $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
- $contents[] = array('text' => '<br><b>' . $cInfo->configuration_title . '</b><br>' . $cInfo->configuration_description . '<br>' . $value_field);
- $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
- break;
- default:
- if (isset($cInfo) && is_object($cInfo)) {
- $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
-
- $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
- $contents[] = array('text' => '<br>' . $cInfo->configuration_description);
- $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . tep_date_short($cInfo->date_added));
- if (tep_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . tep_date_short($cInfo->last_modified));
- }
- break;
}
- if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
- echo ' <td width="25%" valign="top">' . "\n";
+ $page_contents = 'configuration.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
configuration.php added at 1.1
diff -N configuration.php
--- /dev/null Fri Jul 23 01:27:13 2004
+++ /tmp/cvsAAAHMaq9c Fri Jul 23 01:27:18 2004
@@ -0,0 +1,121 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ $Qcg = $osC_Database->query('select configuration_group_title from :table_configuration_group where configuration_group_id = :configuration_group_id');
+ $Qcg->bindTable(':table_configuration_group', TABLE_CONFIGURATION_GROUP);
+ $Qcg->bindInt(':configuration_group_id', $_GET['gID']);
+ $Qcg->execute();
+?>
+
+<h1><?php echo $Qcg->value('configuration_group_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_CONFIGURATION_TITLE; ?></th>
+ <th><?php echo TABLE_HEADING_CONFIGURATION_VALUE; ?></th>
+ <th><?php echo TABLE_HEADING_ACTION; ?></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php
+ $Qcfg = $osC_Database->query('select configuration_id, configuration_title, configuration_description, configuration_value, use_function from :table_configuration where configuration_group_id = :configuration_group_id order by sort_order');
+ $Qcfg->bindTable(':table_configuration', TABLE_CONFIGURATION);
+ $Qcfg->bindInt(':configuration_group_id', $_GET['gID']);
+ $Qcfg->execute();
+
+ while ($Qcfg->next()) {
+ if (tep_not_null($Qcfg->value('use_function'))) {
+ $use_function = $Qcfg->value('use_function');
+ if (ereg('->', $use_function)) {
+ $class_method = explode('->', $use_function);
+ if (!is_object(${$class_method[0]})) {
+ include('includes/classes/' . $class_method[0] . '.php');
+ ${$class_method[0]} = new $class_method[0]();
+ }
+ $cfgValue = tep_call_function($class_method[1], $Qcfg->value('configuration_value'), ${$class_method[0]});
+ } else {
+ $cfgValue = tep_call_function($use_function, $Qcfg->value('configuration_value'));
+ }
+ } else {
+ $cfgValue = $Qcfg->value('configuration_value');
+ }
+
+ if (!isset($cInfo) && (!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $Qcfg->value('configuration_id'))))) {
+ $Qcv = $osC_Database->query('select configuration_key, date_added, last_modified, set_function from :table_configuration where configuration_id = :configuration_id');
+ $Qcv->bindTable(':table_configuration', TABLE_CONFIGURATION);
+ $Qcv->bindInt(':configuration_id', $Qcfg->valueInt('configuration_id'));
+ $Qcv->execute();
+
+ $cInfo = new objectInfo(array_merge($Qcfg->toArray(), $Qcv->toArray()));
+ }
+
+ if (isset($cInfo) && ($Qcfg->valueInt('configuration_id') == $cInfo->configuration_id)) {
+ echo ' <tr class="selected" title="' . $Qcfg->valueProtected('configuration_description') . '">' . "\n";
+ } else {
+ echo ' <tr onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);" onClick="document.location.href=\'' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $Qcfg->valueInt('configuration_id')) . '\';" title="' . $Qcfg->valueProtected('configuration_description') . '">' . "\n";
+ }
+?>
+ <td><?php echo $Qcfg->value('configuration_title'); ?></td>
+ <td><?php echo htmlspecialchars($cfgValue); ?></td>
+ <td align="right">
+<?php
+ if (isset($cInfo) && ($Qcfg->valueInt('configuration_id') == $cInfo->configuration_id)) {
+ echo '<a href="#" onClick="toggleInfoBox(\'cEdit\');">' . tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . '</a>';
+ } else {
+ echo '<a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $Qcfg->valueInt('configuration_id') . '&action=cEdit') . '">' . tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . '</a>';
+ }
+?>
+ </td>
+ </tr>
+<?php
+ }
+?>
+ </tbody>
+ </table>
+</div>
+
+<?php
+ if (isset($cInfo)) {
+ if (!empty($cInfo->set_function)) {
+ eval('$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '");');
+ } else {
+ $value_field = osc_draw_input_field('configuration_value', $cInfo->configuration_value, 'style="width: 100%;"');
+ }
+?>
+
+<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->configuration_title; ?></div>
+ <div class="infoBoxContent">
+ <?php echo tep_draw_form('cEdit', FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $cInfo->configuration_id . '&action=save'); ?>
+
+ <p><?php echo $cInfo->configuration_description; ?></p>
+
+ <table border="0" width="100%" cellspacing="0" cellpadding="2">
+ <tr>
+ <td class="smallText" width="40%"><?php echo '<b>' . $cInfo->configuration_title . '</b>'; ?></td>
+ <td class="smallText" width="60%"><?php echo $value_field; ?></td>
+ </tr>
+ </table>
+
+ <p><?php echo TEXT_INFO_LAST_MODIFIED . ' ' . (!empty($cInfo->last_modified) ? tep_date_short($cInfo->last_modified) : tep_date_short($cInfo->date_added)); ?></p>
+
+ <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
+ }
+?>
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