eric_jbdotcom Posted January 12, 2004 Share Posted January 12, 2004 so far i can get the site rep information to show correctly. but when i try to add/delete/edit a site rep i get this error 1146 - Table 'jbadmin_osc1.TABLE_SITEREPS_STATE' doesn't exist select sitereps_state_id from TABLE_SITEREPS_STATE order by sitereps_state_id [TEP STOP] heres my sitereps.php page in the admin. <?php/* $Id: sitereps.php,v 1.28 2003/06/29 22:50:51 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); if (tep_not_null($action)) { switch ($action) { case 'insert': $sitereps_id = tep_db_prepare_input($HTTP_POST_VARS['sitereps_id']); $sitereps_name = tep_db_prepare_input($HTTP_POST_VARS['sitereps_name']); $sitereps_state = tep_db_prepare_input($HTTP_POST_VARS['sitereps_state']); $sitereps_rank = tep_db_prepare_input($HTTP_POST_VARS['sitereps_rank']); tep_db_query("insert into " . TABLE_SITEREPS . " (sitereps_id, sitereps_name, sitereps_state, sitereps_rank) values ('" . tep_db_input($sitereps_id) . "', '" . tep_db_input($sitereps_name) . "', '" . tep_db_input($sitereps_state) . "', '" . (int)$sitereps_rank . "')"); tep_redirect(tep_href_link(FILENAME_SITEREPS)); break; case 'save': $sitereps_id = tep_db_prepare_input($HTTP_GET_VARS['cID']); $sitereps_id = tep_db_prepare_input($HTTP_POST_VARS['sitereps_id']); $sitereps_name = tep_db_prepare_input($HTTP_POST_VARS['sitereps_name']); $sitereps_state = tep_db_prepare_input($HTTP_POST_VARS['sitereps_state']); $sitereps_rank = tep_db_prepare_input($HTTP_POST_VARS['sitereps_rank']); tep_db_query("update " . TABLE_SITEREPS . " set sitereps_id = '" . tep_db_input($sitereps_id) . "', sitereps_name = '" . tep_db_input($sitereps_name) . "', sitereps_state = '" . tep_db_input($sitereps_state) . "', sitereps_rank = '" . (int)$sitereps_rank . "' where sitereps_id = '" . (int)$sitereps_id . "'"); tep_redirect(tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $sitereps_id)); break; case 'deleteconfirm': $sitereps_id = tep_db_prepare_input($HTTP_GET_VARS['cID']); tep_db_query("delete from " . TABLE_SITEREPS . " where sitereps_id = '" . (int)$sitereps_id . "'"); tep_redirect(tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['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" width="1%"> <?php echo TABLE_HEADING_SITEREPS_ID; ?> </td> <td class="dataTableHeadingContent" align="center" width="35%"> <?php echo TABLE_HEADING_SITEREPS_NAME; ?> </td> <td class="dataTableHeadingContent" align="center" width="20%"> <?php echo TABLE_HEADING_SITEREPS_STATE; ?> </td> <td class="dataTableHeadingContent" align="center" width="20%"> <?php echo TABLE_HEADING_SITEREPS_RANK; ?> </td> <td class="dataTableHeadingContent" align="right" width="24%"> <?php echo TABLE_HEADING_SITEREPS_ACTION; ?> </td> </tr> <?php $sitereps_query_raw = "select sitereps_id, sitereps_name, sitereps_name, sitereps_state, sitereps_rank from " . TABLE_SITEREPS . " order by sitereps_name"; $sitereps_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $sitereps_query_raw, $sitereps_query_numrows); $sitereps_query = tep_db_query($sitereps_query_raw); while ($sitereps = tep_db_fetch_array($sitereps_query)) { if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $sitereps['sitereps_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) { $cInfo = new objectInfo($sitereps); } if (isset($cInfo) && is_object($cInfo) && ($sitereps['sitereps_id'] == $cInfo->sitereps_id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id . '&action=edit') . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $sitereps['sitereps_id']) . '\'">' . "\n"; } ?> <tr> <td class="dataTableContent" width="1%"> <?php echo $sitereps['sitereps_id']; ?> </td> <td class="dataTableContent" align="center" width="30%"> <?php echo $sitereps['sitereps_name']; ?> </td> <td class="dataTableContent" align="center" width="20%"> <?php echo $sitereps['sitereps_state']; ?> </td> <td class="dataTableContent" align="center" width="20%"> <?php echo $sitereps['sitereps_rank']; ?> </td> <td class="dataTableContent" align="right" width="24%"> <?php if (isset($cInfo) && is_object($cInfo) && ($sitereps['sitereps_id'] == $cInfo->sitereps_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $sitereps['sitereps_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> </tr> <?php } ?> <tr> <td colspan="5"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText" valign="top"> <?php echo $sitereps_split->display_count($sitereps_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_SITEREPS); ?> </td> <td class="smallText" align="right"> <?php echo $sitereps_split->display_links($sitereps_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_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&action=new') . '">' . tep_image_button('button_new_siterep.gif', IMAGE_NEW_SITEREP) . '</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_COUNTRY . '</b>'); $contents = array('form' => tep_draw_form('sitereps', FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&action=insert')); $contents[] = array('text' => TEXT_INFO_INSERT_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_ID . '<br>' . tep_draw_input_field('sitereps_id')); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_NAME . '<br>' . tep_draw_input_field('sitereps_name')); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_STATE . '<br>' . tep_draw_pull_down_menu('sitereps_state', tep_get_sitereps_states())); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_RANK . '<br>' . tep_draw_radio_field('sitereps_rank', tep_get_sitereps_ranks())); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . tep_href_link(FILENAME_SITEREPS, '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_COUNTRY . '</b>'); $contents = array('form' => tep_draw_form('sitereps', FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id . '&action=save')); $contents[] = array('text' => TEXT_INFO_EDIT_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_ID . '<br>' . tep_draw_input_field('sitereps_name', $cInfo->sitereps_name)); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_NAME . '<br>' . tep_draw_input_field('sitereps_name', $cInfo->sitereps_name)); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_STATE . '<br>' . tep_draw_pull_down_menu('sitereps_state', tep_get_sitereps_states(), $cInfo->sitereps_state)); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_RANK . '<br>' . tep_draw_radio_field('sitereps_rank', tep_get_sitereps_ranks(), $cInfo->sitereps_rank)); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'delete': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_COUNTRY . '</b>'); $contents = array('form' => tep_draw_form('sitereps', FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); $contents[] = array('text' => '<br><b>' . $cInfo->sitereps_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; default: if (is_object($cInfo)) { $heading[] = array('text' => '<b>' . $cInfo->sitereps_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_ID . '<br>' . $cInfo->sitereps_id); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_NAME . ' ' . $cInfo->sitereps_name); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_STATE . ' ' . $cInfo->sitereps_state); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_RANK . ' ' . $cInfo->sitereps_rank); } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo ' <td width="25%" valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo ' </td>' . "\n"; } ?> </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'); ?> I am trying to add database tables that will show up in the admin section and be editable from there. in my OSC database i have added these tables with these configurations: TABLE NAME: sitereps sitereps_id (int) 11 autoincrement sitereps_name (vars) 64 sitereps_state (char) 2 sitereps_rank (char) 5 SET: sitereps_id to PRIMARY sitereps_name to IDX_REFERRERS_NAME TABLE NAME: referrers_state sitereps_state (varchar) 64 no sitereps_state_id (int) 11 no autoincrement SET: sitereps_state to PRIMARY i want to be able to link the states (im listing the 48 mainland ones) so that when i add a new site rep to my site reps list (going to be like the countries section) i can use a dropdown to get the states. ----------------------------------------------------------------- TABLE NAME: sitereps_rank sitereps_rank (varchar) 5 No sitereps_rank_id (int) 1 No auto_increment SET: sitereps_rank to PRIMARY I want to be able to make the rank have two choices, State or City, and be selectable via radio button when editing a Site Rep. ------------------------------------------------------------------------------------ heres the table data i entered in for the configuration TABLE: configuration_id: 956 configuration_title: Site Rep State configuration_key: SITEREPS_STATE configuration_value: configuration_description: Select the Site Rep's State configuration_group_id: 0 sort_order: 0 last_modified: 2004-01-11 16:38:48 date_added: 0000-00-00 00:00:00 use_function: tep_get_sitereps_state set_function: tep_cfg_pull_down_siterep_states( configuration_id: 957 configuration_title: Site Rep Rank configuration_key: SITEREPS_RANK configuration_value: configuration_description: Select the Site Rep's Rank configuration_group_id: 0 sort_order: 0 last_modified: 2004-01-11 16:38:48 date_added: 0000-00-00 00:00:00 use_function: NULL set_function: tep_cfg_select_option(array('City', 'State'), Link to comment Share on other sites More sharing options...
Guest Posted January 12, 2004 Share Posted January 12, 2004 In catalog/includes/database_tables.php add: define('TABLE_SITEREPS_STATE', 'sitereps_state'); The sitereps state pulldown function expects a table by that name ..... so you will need this also, or change the script. Matti Link to comment Share on other sites More sharing options...
eric_jbdotcom Posted January 12, 2004 Author Share Posted January 12, 2004 alright i just added the define('TABLE_SITEREPS_RANK', 'sitereps_rank'); define('TABLE_SITEREPS_STATE', 'sitereps_state'); to the database_tables.php and i've also added a sitereps_city field in the database and added the appropiate code for it to show in the admin. now when i edit a site rep, i see the name in the ID input section, and the City input section is blank. also i see #'s in the state dropdown instead of the state Initials and the rank radio selection for city/state only shows a checked radio button Link to comment Share on other sites More sharing options...
eric_jbdotcom Posted January 12, 2004 Author Share Posted January 12, 2004 disregard the last post, i fixed some of that. now for this ------------------------- now when i edit a site rep, also i see #'s in the state dropdown instead of the state Initials the rank radio selection for city/state only shows a checked radio button and when i press update, brings the rank to 0. PLUS: I cannot select and highlight the table rows like in other admin files to edit a site rep, i have to click the action arrow to select them. here is the new modified sitereps.php page <?php/* $Id: sitereps.php,v 1.28 2003/06/29 22:50:51 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); if (tep_not_null($action)) { switch ($action) { case 'insert': $sitereps_id = tep_db_prepare_input($HTTP_POST_VARS['sitereps_id']); $sitereps_name = tep_db_prepare_input($HTTP_POST_VARS['sitereps_name']); $sitereps_city = tep_db_prepare_input($HTTP_POST_VARS['sitereps_city']); $sitereps_state = tep_db_prepare_input($HTTP_POST_VARS['sitereps_state']); $sitereps_rank = tep_db_prepare_input($HTTP_POST_VARS['sitereps_rank']); tep_db_query("insert into " . TABLE_SITEREPS . " (sitereps_id, sitereps_name, sitereps_city, sitereps_state, sitereps_rank) values ('" . tep_db_input($sitereps_id) . "', '" . tep_db_input($sitereps_name) . "', '" . tep_db_input($sitereps_state) . "', '" . (int)$sitereps_rank . "')"); tep_redirect(tep_href_link(FILENAME_SITEREPS)); break; case 'save': $sitereps_id = tep_db_prepare_input($HTTP_GET_VARS['cID']); $sitereps_id = tep_db_prepare_input($HTTP_POST_VARS['sitereps_id']); $sitereps_name = tep_db_prepare_input($HTTP_POST_VARS['sitereps_name']); $sitereps_city = tep_db_prepare_input($HTTP_POST_VARS['sitereps_city']); $sitereps_state = tep_db_prepare_input($HTTP_POST_VARS['sitereps_state']); $sitereps_rank = tep_db_prepare_input($HTTP_POST_VARS['sitereps_rank']); tep_db_query("update " . TABLE_SITEREPS . " set sitereps_id = '" . tep_db_input($sitereps_id) . "', sitereps_name = '" . tep_db_input($sitereps_name) . "', sitereps_city = '" . tep_db_input($sitereps_city) . "', sitereps_state = '" . tep_db_input($sitereps_state) . "', sitereps_rank = '" . (int)$sitereps_rank . "' where sitereps_id = '" . (int)$sitereps_id . "'"); tep_redirect(tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $sitereps_id)); break; case 'deleteconfirm': $sitereps_id = tep_db_prepare_input($HTTP_GET_VARS['cID']); tep_db_query("delete from " . TABLE_SITEREPS . " where sitereps_id = '" . (int)$sitereps_id . "'"); tep_redirect(tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['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" width="2%" align="center"> <?php echo TABLE_HEADING_SITEREPS_ID; ?> </td> <td class="dataTableHeadingContent" align="left" width="31%"> <?php echo TABLE_HEADING_SITEREPS_NAME; ?> </td> <td class="dataTableHeadingContent" align="center" width="15%"> <?php echo TABLE_HEADING_SITEREPS_CITY; ?> </td> <td class="dataTableHeadingContent" align="center" width="15%"> <?php echo TABLE_HEADING_SITEREPS_STATE; ?> </td> <td class="dataTableHeadingContent" align="right" width="16%"> <?php echo TABLE_HEADING_SITEREPS_RANK; ?> </td> <td class="dataTableHeadingContent" align="right" width="23%"> <?php echo TABLE_HEADING_SITEREPS_ACTION; ?> </td> </tr> <?php $sitereps_query_raw = "select sitereps_id, sitereps_name, sitereps_name, sitereps_city, sitereps_state, sitereps_rank from " . TABLE_SITEREPS . " order by sitereps_name"; $sitereps_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $sitereps_query_raw, $sitereps_query_numrows); $sitereps_query = tep_db_query($sitereps_query_raw); while ($sitereps = tep_db_fetch_array($sitereps_query)) { if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $sitereps['sitereps_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) { $cInfo = new objectInfo($sitereps); } if (isset($cInfo) && is_object($cInfo) && ($sitereps['sitereps_id'] == $cInfo->sitereps_id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id . '&action=edit') . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $sitereps['sitereps_id']) . '\'">' . "\n"; } ?> <tr> <td class="dataTableContent" width="2%" align="center"> <?php echo $sitereps['sitereps_id']; ?> </td> <td class="dataTableContent" align="left" width="31%"> <?php echo $sitereps['sitereps_name']; ?> </td> <td class="dataTableContent" align="center" width="15%"> <?php echo $sitereps['sitereps_city']; ?> </td> <td class="dataTableContent" align="center" width="15%"> <?php echo $sitereps['sitereps_state']; ?> </td> <td class="dataTableContent" align="right" width="16%"> <?php echo $sitereps['sitereps_rank']; ?> </td> <td class="dataTableContent" align="right" width="23%"> <?php if (isset($cInfo) && is_object($cInfo) && ($sitereps['sitereps_id'] == $cInfo->sitereps_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $sitereps['sitereps_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> </tr> <?php } ?> <tr> <td colspan="6"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText" valign="top"> <?php echo $sitereps_split->display_count($sitereps_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_SITEREPS); ?> </td> <td class="smallText" align="right"> <?php echo $sitereps_split->display_links($sitereps_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_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&action=new') . '">' . tep_image_button('button_new_siterep.gif', IMAGE_NEW_SITEREP) . '</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_SITEREPS . '</b>'); $contents = array('form' => tep_draw_form('sitereps', FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&action=insert')); $contents[] = array('text' => TEXT_INFO_INSERT_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_ID . '<br>' . tep_draw_input_field('sitereps_id')); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_NAME . '<br>' . tep_draw_input_field('sitereps_name')); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_CITY . '<br>' . tep_draw_input_field('sitereps_city')); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_STATE . '<br>' . tep_draw_pull_down_menu('sitereps_state', tep_get_sitereps_states())); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_RANK . '<br>' . tep_draw_radio_field('sitereps_rank', tep_get_sitereps_ranks())); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . tep_href_link(FILENAME_SITEREPS, '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_SITEREPS . '</b>'); $contents = array('form' => tep_draw_form('sitereps', FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id . '&action=save')); $contents[] = array('text' => TEXT_INFO_EDIT_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_ID . '<br>' . tep_draw_input_field('sitereps_id', $cInfo->sitereps_id)); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_NAME . '<br>' . tep_draw_input_field('sitereps_name', $cInfo->sitereps_name)); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_CITY . '<br>' . tep_draw_input_field('sitereps_city', $cInfo->sitereps_city)); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_STATE . '<br>' . tep_draw_pull_down_menu('sitereps_state', tep_get_sitereps_states(), $cInfo->sitereps_state)); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_RANK . '<br>' . tep_draw_radio_field('sitereps_rank', tep_get_sitereps_ranks(), $cInfo->sitereps_rank)); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'delete': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SITEREPS . '</b>'); $contents = array('form' => tep_draw_form('sitereps', FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); $contents[] = array('text' => '<br><b>' . $cInfo->sitereps_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; default: if (is_object($cInfo)) { $heading[] = array('text' => '<b>' . $cInfo->sitereps_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_SITEREPS, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->sitereps_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_ID . ' ' . $cInfo->sitereps_id); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_NAME . ' ' . $cInfo->sitereps_name); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_CITY . ' ' . $cInfo->sitereps_city); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_STATE . ' ' . $cInfo->sitereps_state); $contents[] = array('text' => '<br>' . TEXT_INFO_SITEREPS_RANK . ' ' . $cInfo->sitereps_rank); } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo ' <td width="25%" valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo ' </td>' . "\n"; } ?> </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'); ?> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.