From: Chris S. <san...@us...> - 2005-07-08 16:36:50
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13324 Modified Files: analysis.php index.php Added Files: user.php Log Message: Index: analysis.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/analysis.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** analysis.php 27 Jun 2005 08:29:40 -0000 1.13 --- analysis.php 8 Jul 2005 16:36:08 -0000 1.14 *************** *** 58,67 **** $user = stack_user_guest(); } ! // Do we need analysis of one question? if (array_key_exists('questionID',$_POST)) { $questionID = $_POST['questionID']; } ! include('html/pagehead.php'); //////////////////////////////////////////////// // Carry out the analysis requested in $_POST --- 58,84 ---- $user = stack_user_guest(); } ! ! $questionID = ''; // Do we need analysis of one question? if (array_key_exists('questionID',$_POST)) { $questionID = $_POST['questionID']; } ! ! // Do we need analysis of one user? ! $userID = ''; ! if (array_key_exists('userID',$_POST)) { ! $userID = $_POST['userID']; ! } ! ! $etimestr = ''; ! if (array_key_exists('EndTime',$_POST)) { ! $etimestr = $_POST['EndTime']; ! } ! $stimestr = ''; ! if (array_key_exists('StartTime',$_POST)) { ! $stimestr = $_POST['StartTime']; ! } ! ! include('html/pagehead.php'); //////////////////////////////////////////////// // Carry out the analysis requested in $_POST *************** *** 269,273 **** echo "<hr /><p>Enter the information for the student answers that you would like to see:</p>\n ! <form name='stackanalysisform' action='{$_PHP_SELF}' method='POST'>\n"; echo "<table>\n"; --- 286,290 ---- echo "<hr /><p>Enter the information for the student answers that you would like to see:</p>\n ! <form name='stackanalysisform' action='' method='POST'>\n"; echo "<table>\n"; *************** *** 275,313 **** // Add a list of users // HACK - $query = 'SELECT id, username, firstname, lastname FROM stackUser'; - - $stack_users = stack_db_query($query); - - if(0 != mysql_num_rows($stack_users)) { - - echo "<tr><td><span id=SectionText>User ID</span></td>\n"; - echo "<td><select name=\"userID\">\n"; - - $spec_users=array('(any)','>0'); - - echo "userID"; - foreach ($spec_users as $su) { - $sup = htmlspecialchars($su); - if ($su == $userID ) { - echo " <option value=\"$sup\" selected>$sup</option>\n"; - } else { - echo " <option value=\"$sup\" >$sup</option>\n"; - } - } - - - for ($i = 0; $i < mysql_num_rows($stack_users); $i++) - { - $row = mysql_fetch_row($stack_users); - if ($row[0] == $userID) { - echo " <option value=\"{$row[0]}\" selected>{$row[0]} {$row[1]} ({$row[2]} {$row[3]})</option>\n"; - } else { - echo " <option value=\"{$row[0]}\">{$row[0]} {$row[1]} ({$row[2]} {$row[3]})</option>\n"; - } - } - echo "</select> </td></tr>"; - - } // Add a list of questions --- 292,298 ---- // Add a list of users // HACK + // Produce a form fragment to get a dropdown list of users. + stack_user_select_formfrag($userID); // Add a list of questions *************** *** 341,354 **** // Add action requested - unset($s); if (array_key_exists('actionreq',$_POST)) { $s[$_POST['actionreq']]='selected'; ! } echo "<tr><td><span id=SectionText>Action requested</span></td>\n"; echo "<td><select name=\"actionreq\">\n ! <option value='any' {nsf($s,'any')}>Any</option>\n ! <option value='validate' {nsf($s,'validate')}>Validate</option>\n ! <option value='mark' {nsf($s,'mark')}>Mark</option></select></td></tr>"; --- 326,340 ---- // Add action requested if (array_key_exists('actionreq',$_POST)) { $s[$_POST['actionreq']]='selected'; ! } else { ! $s['any'] = 'selected'; ! } echo "<tr><td><span id=SectionText>Action requested</span></td>\n"; echo "<td><select name=\"actionreq\">\n ! <option value='any' ".nsf($s,'any').">Any</option>\n ! <option value='validate' ".nsf($s,'validate').">Validate</option>\n ! <option value='mark' ".nsf($s,'mark').">Mark</option></select></td></tr>"; *************** *** 357,366 **** if (array_key_exists('Valid',$_POST)) { $s[$_POST['Valid']]='selected'; ! } echo "<tr><td><span id=SectionText>Valid</span></td>\n"; echo "<td><select name=\"Valid\">\n ! <option value='any' {nsf($s,'any')}>Any</option>\n ! <option value='true' {nsf($s,'true')}>Valid only</option>\n ! <option value='false' {nsf($s,'false')}>Invalid only</option></select></td></tr>"; // Add mark --- 343,355 ---- if (array_key_exists('Valid',$_POST)) { $s[$_POST['Valid']]='selected'; ! } else { ! $s['any'] = 'selected'; ! } ! echo "<tr><td><span id=SectionText>Valid</span></td>\n"; echo "<td><select name=\"Valid\">\n ! <option value='any' ".nsf($s,'any').">Any</option>\n ! <option value='true' ".nsf($s,'true').">Valid only</option>\n ! <option value='false' ".nsf($s,'false').">Invalid only</option></select></td></tr>"; // Add mark *************** *** 368,378 **** if (array_key_exists('RawMark',$_POST)) { $s[$_POST['RawMark']]='selected'; ! } echo "<tr><td><span id=SectionText>Marks obtained</span></td>\n"; echo "<td><select name=\"RawMark\">\n ! <option value='any' {nsf($s,'any')}>Any</option>\n ! <option value='full' {nsf($s,'full')}>Full marks</option>\n ! <option value='nonzero' {nsf($s,'nonzero')}>Non zero</option> ! <option value='zero' {nsf($s,'zero')}>Zero</option> </select></td></tr> <tr><td>Start time</td> --- 357,370 ---- if (array_key_exists('RawMark',$_POST)) { $s[$_POST['RawMark']]='selected'; ! } else { ! $s = ''; ! } ! echo "<tr><td><span id=SectionText>Marks obtained</span></td>\n"; echo "<td><select name=\"RawMark\">\n ! <option value='any' ".nsf($s,'any').">Any</option>\n ! <option value='full' ".nsf($s,'full').">Full marks</option>\n ! <option value='nonzero' ".nsf($s,'nonzero').">Non zero</option> ! <option value='zero' ".nsf($s,'zero').">Zero</option> </select></td></tr> <tr><td>Start time</td> Index: index.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/index.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** index.php 20 Jun 2005 15:42:52 -0000 1.18 --- index.php 8 Jul 2005 16:36:08 -0000 1.19 *************** *** 52,56 **** $errps = stack_get_errps($err); - ////////////////////////////////////////////////////////////// // (2) Print the page. --- 52,55 ---- *************** *** 69,72 **** --- 68,77 ---- } + if ('loginerr' == $action) { + echo "<h1>Problems with your login.</h1> <p>You could not be logged into STACK as <tt>{$user['username']}</tt> for the following reason.</p>"; + echo $errors['user']; + $action = 'loginscreen'; + } + switch ($action) { case 'loginscreen': *************** *** 79,84 **** case 'update_info': if (stack_is_logged_in($user) and !stack_user_is_guest($user)) { ! $err = stack_get_err2($errors); ! stack_display_main_update_userinfo($user, $err, $errors); } else { echo '<h1>Update user information</h1>'; --- 84,88 ---- case 'update_info': if (stack_is_logged_in($user) and !stack_user_is_guest($user)) { ! stack_user_update_info($user, $errors); } else { echo '<h1>Update user information</h1>'; --- NEW FILE: user.php --- <?php /** * * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * <br> * This file is licensed under the GPL License. * <br> * A copy of the license is in your STACK distribution called * license.txt. If you are missing this file you can obtain * it from: * http://www.stack.bham.ac.uk/license.txt * <br> * Copyright (c) 2005, Christopher James Sangwin * * @author Chris Sangwin C.J...@bh... * * @package Stack */ /////////////////////////////////////////////////////////////// // (1) Process Input - this sets $action, $user and $username /////////////////////////////////////////////////////////////// session_start(); include('stackstd.php'); $default_action = 'none'; include_once($stack_root.'/frontend_general/front_end_display.php'); include($stack_root.'/frontend_general/process_input.php'); /////////////////////////////////////////////////////////////// // (2) Take any actions required /////////////////////////////////////////////////////////////// // Note that we need to unset the user before printing the header. if ('admin' != $user['username'] and $user['loggedin']) { echo "Only the admin user may access this page."; die(); } if ('userupdate' == $action) { $user_stu = stack_user_updateinfo($errors); } // Do we need analysis of one user? $userID = ''; if ('userupdate_choose' == $action) { $userID = $_POST['userID']; $user_stu = stack_db_user_get_ID($userID); $action = 'userupdate'; } ////////////////////////////////////////////////////////////// // (2) Print the page. ////////////////////////////////////////////////////////////// include('html/pagehead.php'); switch ($action) { case 'none': echo "<h1>User management</h1>\n"; echo "<form name='stackuserform' action='' method='POST'>\n"; echo "<table>"; stack_user_select_formfrag($userID,FALSE); $s[$action] = 'selected'; echo "<td>Action</td>"; echo "<td><select name=\"action\">\n <option value='userupdate_choose' {nsf($s,'update')}>Update</option>\n <option value='delete' {nsf($s,'delete')}>Delete</option></select></td></tr>"; echo "</table>"; echo "<input type=\"submit\" name=\"submit\" value=\"Submit\">"; echo "</form>"; break; case 'userupdate': stack_user_update_info($user_stu,$errors,TRUE); break; case 'delete': echo 'Not yet implemented.'; break;} include('html/pagefoot.php'); ?> |