[LON-CAPA-cvs] cvs: loncom /homework lonsimpleproblemedit.pm

bisitz bisitz@source.lon-capa.org
Mon, 19 Oct 2009 15:15:03 -0000


bisitz		Mon Oct 19 15:15:03 2009 EDT

  Modified files:              
    /loncom/homework	lonsimpleproblemedit.pm 
  Log:
  Optimized simple problems screen design in edit mode:
  - Same width for all boxes
  - First display available functions (header), then display problem title
  - Wrap problem rendering preview in simple box instead of table
  - Wrap question type selection in fieldset
  
  
Index: loncom/homework/lonsimpleproblemedit.pm
diff -u loncom/homework/lonsimpleproblemedit.pm:1.28 loncom/homework/lonsimpleproblemedit.pm:1.29
--- loncom/homework/lonsimpleproblemedit.pm:1.28	Fri Oct 16 17:23:51 2009
+++ loncom/homework/lonsimpleproblemedit.pm	Mon Oct 19 15:15:03 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Problem Parameter Setting "Editor"
 #
-# $Id: lonsimpleproblemedit.pm,v 1.28 2009/10/16 17:23:51 bisitz Exp $
+# $Id: lonsimpleproblemedit.pm,v 1.29 2009/10/19 15:15:03 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -71,7 +71,7 @@
     return (<<ENDQUESTION);
 <table bgcolor="#dddd22" cellspacing="4" cellpadding="2" style="width:100%">
 <tr><td><b>$qt</b><br />
-<textarea style="width:100%" name="questiontext" cols="80" rows="8">$text</textarea>
+<textarea style="width:99%" name="questiontext" cols="80" rows="8">$text</textarea>
 <br />$spell_link
 </td></tr>
 </table>
@@ -85,9 +85,9 @@
     my $spell_link=
 	&Apache::lonhtmlcommon::spelllink('simpleedit','hinttext');
     return (<<ENDHINT);
-<table bgcolor="#accacc" cellspacing="4" cellpadding="2">
+<table bgcolor="#accacc" cellspacing="4" cellpadding="2" style="width:100%">
 <tr><td><b>$ht</b><br />
-<textarea style="width:100%" name="hinttext" cols="80" rows="4">$text</textarea>
+<textarea style="width:99%" name="hinttext" cols="80" rows="4">$text</textarea>
 <br />$spell_link
 </td></tr>
 </table>
@@ -99,9 +99,9 @@
     my $text=$qparms{$prefix.'numericalscript'};
     my $ht=&mt('Scripting (optional)');
     return (<<ENDSCRIPT);
-<table bgcolor="#ccccaa" cellspacing="4" cellpadding="2">
+<table bgcolor="#ccccaa" cellspacing="4" cellpadding="2" style="width:100%">
 <tr><td><b>$ht</b><br />
-<textarea style="width:100%" name="numericalscript" cols="80" rows="4">$text</textarea>
+<textarea style="width:99%" name="numericalscript" cols="80" rows="4">$text</textarea>
 </td></tr>
 </table>
 <br />
@@ -141,7 +141,7 @@
     my $spell_link=
 	&Apache::lonhtmlcommon::spelllink('simpleedit',"text$number");
     return (<<ENDFOIL);
-<table bgcolor="#E8D8EE" cellspacing="2" cellpadding="1">
+<table bgcolor="#E8D8EE" cellspacing="2" cellpadding="1" style="width:100%">
 <tr><td colspan="2"><b>$lt{'foil'}</b></td></tr>
 <tr><td>$lt{'value'}: $selectvalue</td><td>$lt{'pos'}: $selectposition</td></tr>
 <tr><td colspan="2">$lt{'text'}:<br />
@@ -251,7 +251,7 @@
     $r->print(&Apache::loncommon::start_page('Simple Problem Editor',
 					     $spell_header));
     if ($symb) {
-	$r->print('<h1>'.&Apache::lonnet::gettitle($symb).'</h1>');
+	    my $title='<h1>'.&Apache::lonnet::gettitle($symb).'</h1>';
         my $displaylink = &get_parent_uri($symb);
         if ($displaylink ne '') {
             my $functions=&Apache::lonhtmlcommon::start_funclist()
@@ -259,9 +259,11 @@
                               '<a href="'.$displaylink.'">'
                              .&mt('Student View').'</a>')
                              .&Apache::lonhtmlcommon::end_funclist();
-            $r->print(&Apache::loncommon::head_subbox($functions));
+            $r->print(&Apache::loncommon::head_subbox($functions)
+                     .$title);
         } else {
-            $r->print('<p class="LC_error">'
+            $r->print($title
+                     .'<p class="LC_error">'
                      .&mt('An error occurred retrieving the link to this problem.')
                      .'<br />'
                      .&mt('You may need to [_1]re-select the course[_2] and then return to this resource to view it.'
@@ -275,9 +277,11 @@
                  .'</p>'
         );
 
-	$r->print('<table border="2" bgcolor="#FFFFFF" width="100%"><tr><td>'.
-                  &rawrendering($symb).
-                  '</td></tr></table><br />');
+        $r->print(
+            '<div class="LC_Box">'
+           .&rawrendering($symb)
+           .'</div>'
+        );
         $r->print('<form name="simpleedit" method="post">');
 # Question Type        
 	my %questiontypes=('radio'  => 
@@ -289,11 +293,18 @@
         $qtype=$qparms{$prefix.'questiontype'};
         unless (defined($qtype)) { $qtype='radio'; }
         unless ($questiontypes{$qtype}) { $qtype='radio'; }
-        $r->print('<b>'.&mt('Question Type').
-		  ': '.&Apache::loncommon::select_form
-	                               ($qtype,'questiontype',%questiontypes).
-  '</b><br /><input type="submit" value="'.&mt('Save and Edit').
-  '" /><p>&nbsp;</p>');
+        $r->print(
+            '<fieldset style="width:400px;">'
+           .'<legend>'.&mt('Question Type').'</legend>'
+           .&Apache::loncommon::select_form
+	            ($qtype,'questiontype',%questiontypes)
+           .'</fieldset>'
+        );
+        $r->print(
+            '<p>'
+           .'<input type="submit" value="'.&mt('Save and Edit').'" />'
+           .'</p>'
+        );
 # Script
         if ($qtype eq 'numerical') {
            $r->print(&script());
@@ -313,7 +324,7 @@
             unless (defined($randomize)) { $randomize='yes'; }
             unless ($randomizes{$randomize}) { $randomize='yes'; }
 	    $r->print(
-		  '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2">'.
+		  '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2" style="width:100%">'.
 	          '<tr><td>'.&mt('Max number of foils displayed').
 ': <input type="text" size="3" name="maxfoils" value="'.$maxfoils.'" />&nbsp;&nbsp;'.
 		      &Apache::loncommon::select_form
@@ -325,7 +336,7 @@
                 unless (defined($options)) { $options="('true','false')"; }
                 my %optionshash=&evaloptionhash($options);
 		$r->print(
-		  '<table bgcolor="#ffcc22" cellspacing="4" cellpadding="2">'.
+		  '<table bgcolor="#ffcc22" cellspacing="4" cellpadding="2" style="width:100%">'.
 		  '<tr><td><input type="hidden" name="options" value="'.
                   $options.'" />'.&mt('Add new option').': '.
           '<input type="text" name="newopt" size="15" />'.
@@ -358,7 +369,7 @@
             unless (defined($stringtype)) { $stringtype='cs'; }
             unless ($stringtypes{$stringtype}) { $stringtype='cs'; }
 	    $r->print(
-		  '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2">'.
+		  '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2" style="width:100%">'.
 	          '<tr><td><label>'.&mt('Correct answer').': <input type="text" size="20" name="stringanswer" value="'.$stringanswer.'" /></label>&nbsp;&nbsp;'.
 		      &Apache::loncommon::select_form
 		      ($stringtype,'stringtype',%stringtypes).
@@ -375,7 +386,7 @@
            unless (defined($numericalsigfigs)) { $numericalsigfigs='1,15'; }
 
            $r->print(
-                  '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2">'.
+                  '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2" style="width:100%">'.
                   '<tr><td><label>'.&mt('Correct answer').': <input type="text" size="20" name="numericalanswer" value="'.$numericalanswer.'" /></label>&nbsp;&nbsp;'.
                   '<label>'.&mt('Unit').':  <input type="text" size="5" name="numericalunit" value="'.$qparms{$prefix.'numericalunit'}.'" /></label>&nbsp;&nbsp;'.
                   '<label>'.&mt('Format').':  <input type="text" size="5" name="numericalformat" value="'.$qparms{$prefix.'numericalformat'}.'" /></label>&nbsp;&nbsp;'.