[Fixing lock bug in SATYR and adding SATYR settings table tony@tonywhitmore.co.uk**20041118223323] { addfile ./SATYR/settings.php hunk ./CHANGELOG 1 +Development - 18/11/2004 +======================== +* Fixed a bug in SATYR/update.php where support requests that were not properly evaluated were left in a "locked" state after navigation away using the toolbar. +* Created a settings table for SATYR and updated the module to use it instead of the system-wide settings table +* Added structure for enabling/disabling mail integration with SATYR + hunk ./SATYR/settings.php 1 - +\n"; + +// Update the settings using POSTed data +if ( isset($_POST['not_new']) ) + { + // Pull all the current settings from the database + $query = "SELECT * FROM SATYR_settings WHERE function != 'allow_mail_integration'"; + $result = $db->query($query); + if (DB::isError($db)) {die($db->getMessage());} + while ( $row = $result->fetchRow() ) + { // for each row in the settings table + $query1 = "UPDATE SATYR_settings SET value='" . $_POST[$row['function']] . "' WHERE function='" . $row['function'] . "'"; + $result1 = $db->query($query1); + if (DB::isError($db)) {die($db->getMessage());} + } + // Process the mail integration setting + $query = "SELECT * FROM SATYR_settings WHERE function = 'allow_mail_integration'"; + $result = $db->query($query); + if (DB::isError($db)) {die($db->getMessage());} + while ( $row = $result->fetchRow() ) + { // for each row in the settings table + if ( !isset($_POST[$row['function']]) ) + { + $_POST[$row['function']] = "0"; + } + $query1 = "UPDATE SATYR_settings SET value='" . $_POST[$row['function']] . "' WHERE function='" . $row['function'] . "'"; + $result1 = $db->query($query1); + if (DB::isError($db)) {die($db->getMessage());} + } + // Closing comment and navbutton + echo "

Settings updated!

\n"; + navbutton("intro.php","OK"); + } +else + { + // Start the form that holds the data. + echo "
\n"; + // Start the table that holds the data table for formatting purposes. + echo "\n + \n"; + echo "\n"; + echo "
\n"; + // Start the table that holds the data. + echo "\n"; + // Table title bar + echo "\n"; + echo "\n"; + echo "\n"; + + // Fetch the information from the table + $query = "SELECT * FROM SATYR_settings WHERE function != 'allow_mail_integration'"; + $result = $db->query($query); + if (DB::isError($db)) {die($db->getMessage());} + while ( $row = $result->fetchRow() ) + { + extract ($row); + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + // Produce the special row for allowing mail integration tick box + $query = "SELECT * FROM SATYR_settings WHERE function = 'allow_mail_integration'"; + $result = $db->query($query); + if (DB::isError($db)) {die($db->getMessage());} + while ( $row = $result->fetchRow() ) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + // Close the table + echo "\n"; + echo "
\n"; + echo "System settings for the SATYR module\n"; + echo "
\n"; + echo ""; + // Small if loop that presents a nice version of the variable name + if ( $function == "page_refresh" ) + { + echo "Automatic refresh period for SATYR pages (in seconds):"; + } + else + { + echo $function; + } + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "Allow SATYR module to send mail to users:\n"; + echo "\n"; + echo ""; + echo "
\n"; + + // Close the table used for formatting purposes. + echo "
\n"; + + // Submittal button + echo "
\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + } + +?> hunk ./SATYR/update.php 240 +// hunk ./SATYR/update.php 242 +// hunk ./SATYR/update.php 281 + // Set the variables for the navigation bar + $job_id = $_POST['job_id']; + $dest = $_POST['dest']; hunk ./SATYR/update.php 290 + echo "
If you navigate away from this page now, no changes will be saved.
\n"; hunk ./SATYR/update.php 355 -// Work out which job_id to use. GET comes from evaluate.php, POST from detail.php +// +// If the page has not been sent updated data, then display the form for editing. +// Work out which job_id to use. GET comes from evaluate.php or recent.php, POST from detail.php +// hunk ./TODO 6 + System wide settings for mail server / application etc + Mail server integration with SATYR user option for updates? hunk ./TODO 16 +* Set up user options for mail alerts etc. (system wide?) hunk ./TODO 51 -* Add beginning of year database entry (and default values) to upgrade and install scripts hunk ./TODO 55 -* Move module settings to inside the module - probably keep table though - DONE with chknet +* Move module settings to inside the module - probably keep table though - DONE with chknet. +* Remember to DELETE SATYRrefresh line from settings table in upgrade script hunk ./chknet/settings.php 43 +// Update the settings using POSTed data hunk ./chknet/settings.php 52 - if ( $row['function'] != "chunksperday" ) - { // Don't update the chunksperday setting, but all others - $query1 = "UPDATE chknet_settings SET value='" . $_POST[$row['function']] . "' WHERE function='" . $row['function'] . "'"; - $result1 = $db->query($query1); - if (DB::isError($db)) {die($db->getMessage());} - } + $query1 = "UPDATE chknet_settings SET value='" . $_POST[$row['function']] . "' WHERE function='" . $row['function'] . "'"; + $result1 = $db->query($query1); + if (DB::isError($db)) {die($db->getMessage());} hunk ./includes/STORM/SATYR/html/admin_nav.inc 32 -// Start the cell for the first navigation element. +// Navigation element hunk ./includes/STORM/SATYR/html/admin_nav.inc 35 - echo "SATYR
Start Page\n"; + echo "SATYR Start Page\n"; hunk ./includes/STORM/SATYR/html/admin_nav.inc 39 -// Start and end the spacer cell between navigation elements. +// Spacer cell hunk ./includes/STORM/SATYR/html/admin_nav.inc 42 -// Start the cell for the second navigation element. +// Navigation element hunk ./includes/STORM/SATYR/html/admin_nav.inc 45 - echo "Unlock/lock\n"; - echo "a Support Request\n"; + echo "Unlock/lock a Support Request\n"; hunk ./includes/STORM/SATYR/html/admin_nav.inc 49 -// Start and end the spacer cell between navigation elements. +// Spacer cell hunk ./includes/STORM/SATYR/html/admin_nav.inc 52 -// Start the cell for the third navigation element. +// Navigation element hunk ./includes/STORM/SATYR/html/admin_nav.inc 55 - echo "Delete a\n"; - echo "Support Request\n"; + echo "Delete a Support Request\n"; hunk ./includes/STORM/SATYR/html/admin_nav.inc 59 -// Start and end the spacer cell between navigation elements. +// Spacer cell hunk ./includes/STORM/SATYR/html/admin_nav.inc 62 -// Start the cell for the fourth navigation element. +// Navigation element hunk ./includes/STORM/SATYR/html/admin_nav.inc 69 -// Start and end the spacer cell between navigation elements. echo "\n"; +// Spacer cell + echo "\n"; + +// Navigation element + echo "\n"; + echo "\n"; + echo "SATYR Settings\n"; + echo "\n"; + echo "\n"; + +// Spacer cell + echo "\n"; hunk ./includes/STORM/SATYR/html/admin_nav.inc 82 -// Start the cell for the seventh navigation element. +// Navigation element hunk ./includes/STORM/SATYR/html/admin_nav.inc 89 -// Start and end the spacer cell between navigation elements. +// Spacer cell hunk ./includes/STORM/SATYR/html/admin_nav.inc 92 -// Start the cell for the seventh navigation element. +// Navigation element hunk ./includes/STORM/SATYR/misc/functions.inc 12 - $query = "SELECT value FROM settings WHERE function='SATYRrefresh'"; + $query = "SELECT value FROM SATYR_settings WHERE function='page_refresh'"; hunk ./includes/STORM/SATYR/misc/functions.inc 16 + // If there is no value set for the refresh interval, use a safe value of 60 + // The prevents endlessly reloading pages + if ( $row['value'] == "" ) + { + $row['value'] = "60"; + } hunk ./login/settings.php 321 - elseif ( $function == "SATYRrefresh" ) - { - echo "Automatic refresh period for SATYR pages (in seconds)"; - } }