. /***********************************************************************\ * Display and Manage BOINC Application Versions * * This page presents a form with information about application versions. * Some of the fields can be changed. * * Eric Myers - 4 June 2006 * @(#) $Id$ \***********************************************************************/ // TODO: rewrite this using the new DB interface require_once('../inc/util_ops.inc'); db_init(); // Platform and application labels (are better than numbers) $result = mysql_query("SELECT * FROM platform"); $Nplatform = mysql_num_rows($result); for($i=0;$i<$Nplatform;$i++){ $item=mysql_fetch_object($result); $id=$item->id; $plat_off[$id]=$item->deprecated; $platform[$id]=$item->user_friendly_name; } mysql_free_result($result); $result = mysql_query("SELECT * FROM app"); $Napp = mysql_num_rows($result); for($i=0;$i<$Napp;$i++){ $item=mysql_fetch_object($result); $id=$item->id; $app_off[$id]=$item->deprecated; $app[$id]=$item->name; } mysql_free_result($result); $commands=""; /***************************************************\ * Action: process form input for changes \***************************************************/ if( !empty($_POST) ) { $result = mysql_query("SELECT * FROM app_version"); $Nrow=mysql_num_rows($result); for($j=1;$j<=$Nrow;$j++){ // test/update each row in DB $item=mysql_fetch_object($result); $id=$item->id; /* Change deprecated status? */ $field="deprecated_".$id; $new_v= array_key_exists($field, $_POST) ? 1 : 0; $old_v=$item->deprecated; if ($new_v != $old_v ) { $cmd = "UPDATE app_version SET deprecated=$new_v WHERE id=$id"; $commands .= "

$cmd
\n"; mysql_query($cmd); } /* Minimum core version limit */ $field="min_core_version_".$id; $new_v= $_POST[$field]; $old_v=$item->min_core_version; if ($new_v != $old_v ) { $cmd = "UPDATE app_version SET min_core_version=$new_v WHERE id=$id"; $commands .= "

$cmd
\n"; mysql_query($cmd); } /* Maximum core version limit */ $field="max_core_version_".$id; $new_v= $_POST[$field]; $old_v=$item->max_core_version; if($new_v != $old_v ) { $cmd = "UPDATE app_version SET max_core_version=$new_v WHERE id=$id"; $commands .= "

$cmd
\n"; mysql_query($cmd); } } mysql_free_result($result); } /***************************************************\ * Display the DB contents in a form \***************************************************/ admin_page_head("Manage Application Versions"); if($commands) echo $commands; // show the last DB commands given $self=$_SERVER['PHP_SELF']; echo "
\n"; // Application Version table: start_table("align='center'"); echo "ID # Application Version Platform Plan Class minimum
core version maximum
core version deprecated? \n"; $q="SELECT * FROM app_version ORDER BY appid, version_num, platformid"; $result = mysql_query($q); $Nrow=mysql_num_rows($result); for($j=1;$j<=$Nrow;$j++){ $item=mysql_fetch_object($result); $id=$item->id; // grey-out deprecated versions $f1=$f2=''; if($item->deprecated==1) { $f1=""; $f2=""; } echo " "; echo " $f1 $id $f2\n"; $i=$item->appid; echo " $f1 $app[$i] $f2\n"; echo " $f1 $item->version_num $f2\n"; $i=$item->platformid; echo " $f1 $platform[$i] $f2\n"; echo " $f1 $item->plan_class $f2\n"; $field="min_core_version_".$id; $v=$item->min_core_version; echo " \n"; $field="max_core_version_".$id; $v=$item->max_core_version; echo " \n"; $field="deprecated_".$id; $v=''; if($item->deprecated) $v=' CHECKED '; echo " \n"; echo " "; } mysql_free_result($result); echo " "; end_table(); echo "

\n"; admin_page_tail(); //Generated automatically - do not edit $cvs_version_tracker[]="\$Id$"; ?>