From: Chris S. <san...@us...> - 2007-05-31 10:43:22
|
Update of /cvsroot/stack/stack-dev/lib/ui In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv14288/lib/ui Added Files: authorTest.php questionTest.php Log Message: CJS install in Windows machine, 30-5-7 --- NEW FILE: questionTest.php --- <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Question test</title> <style type="text/css" media="all"> @import "../../styles.css"; </style> </head> <body> <h2>Question:</h2> <form action="questionTest.php" method="POST"> <?php session_start(); require_once('../../config.php'); $config = new stackConfig(); global $config; require_once('DisplayItem.php'); if($_POST == NULL) { unset($_SESSION['S_item']); $question = new DisplayItem(1,$_GET['id'], false); echo $question->displayQuestion(); $_SESSION['S_item'] = serialize($question); } else { $question = unserialize($_SESSION['S_item']); echo $question->displayQuestion($_POST); $_SESSION['S_item'] = serialize($question); } ?> <br /><br /> <input type="hidden" name="answered" value="true" /> <input type="submit" value="Submit" /> </form> <br/><br/> <h3>Marking</h3> <?php echo $question->displayPRTMarks(); //echo 'worked ans<br />'; //echo $question->getWorkedSolution(); ?> <p><a href="../../index.php">Main menu</a></p> </body> </html> --- NEW FILE: authorTest.php --- <?php session_start(); require_once('../../config.php'); $config = new stackConfig(); global $config; require_once('AuthorDisplay.php'); if(empty($_SESSION['authorItem']) || ($_POST == NULL)) { if(empty($_GET['id'])) { $author = new AuthorDisplay('1'); } else { $author = new AuthorDisplay('1', $_GET['id']); } } else { $author = unserialize($_SESSION['authorItem']); } if(!empty($_POST)) { $author->updateQuestion($_POST); } //unset($_SESSION['authorItem']); $_SESSION['authorItem'] = serialize($author); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <style type="text/css" media="all"> @import "../../styles.css"; </style> <script type="text/javascript" src="../../other/moo.fx/prototype.lite.js"></script> <script type="text/javascript" src="../../other/moo.fx/moo.fx.js"></script> <script type="text/javascript"> // Initialise the effects var metaContainer; var optionsContainer; var prtContainer; window.onload = function() { metaContainer = new fx.Height('meta', {duration: 400}); metaContainer.hide(); optionsContainer = new fx.Height('options', {duration: 400}); optionsContainer.hide(); prtContainer = new fx.Height('prtContainer', {duration: 400}); qpContainer = new fx.Height('qpContainer', {duration: 400}); } </script> <title>Question test</title> </head> <body> <h2>Author Question</h2> <form action="authorTest.php" method="POST"> <?php echo $author->displayAuthor(); ?> <!-- <pre> <?php switch ($_POST['submit']) { case "+": echo "Add PRT"; break; //add in buttons for save to disk, save as new etc //remove PR & PRT buttons? //should still save the item to session, otherwise changes will be lost! //first & therefore default should always be a simple save to memory/validate button for accidentaly presses of enter default: echo "Save form to session"; } ?> --> <br /><br /> <input type="submit" name="submit" value="Update" /> <input type="submit" name="submit" value="Save" /> <input type="submit" name="submit" value="Save as New" /> <input type="submit" name="submit" value="Export as XML" /> </form> <p><a href="../../index.php">Main menu</a></p> <pre> <?php //var_dump($_POST); ?> </pre> </body> </html> |