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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 13 Feb 2004 23:59:25 -0000


albertel		Fri Feb 13 18:59:25 2004 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  - start on BUG#1682, looking for feedback on the look of the interface
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.234 loncom/homework/structuretags.pm:1.235
--- loncom/homework/structuretags.pm:1.234	Thu Feb 12 14:07:12 2004
+++ loncom/homework/structuretags.pm	Fri Feb 13 18:59:24 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.234 2004/02/12 19:07:12 albertel Exp $
+# $Id: structuretags.pm,v 1.235 2004/02/13 23:59:24 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -200,6 +200,16 @@
     <input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" />';
 }
 
+sub option {
+    my ($value,$name) = @_;
+    my $result ="<option value='".$value."' ";
+    if ($ENV{'form.'.$name} eq $value) {
+	$result.=" selected='on' ";
+    }
+    $result.='>';
+    return $result;
+}
+
 sub problem_web_to_edit_header {
     my ($rndseed)=@_;
     my $result.='<input type="hidden" name="problemmode" value="'.&mt('View').'" />
@@ -216,6 +226,37 @@
     $result.= ' />'.&mt('&nbsp;Show&nbsp;All&nbsp;Foils').
 	&Apache::loncommon::help_open_topic('Problem_Editor_Testing_Area','Testing Problems').
 	'<hr />';
+    $result.="
+<nobr>
+Problem Status:
+<select name='problemstate'>
+  <option name=''></option>
+  ".&option('CLOSED'               ,'problemstate').&mt("Closed")."</option>
+  ".&option('CAN_ANSWER'           ,'problemstate').&mt("Answerable")."</option>
+  ".&option('CANNOT_ANSWER_tries'  ,'problemstate').&mt("Open with full tries")."</option>
+  ".&option('CANNOT_ANSWER_correct','problemstate').&mt("Open and correct")."</option>
+  ".&option('SHOW_ANSWER'          ,'problemstate').&mt("Show Answer")."</option>
+</select>
+</nobr>
+<nobr>
+Problem Type:
+<select name='problemtype'>
+  <option name=''></option>
+  ".&option('exam'   ,'problemtype')."Exam Problem</option>
+  ".&option('problem','problemtype')."Homework problem</option>
+  ".&option('survey' ,'problemtype')."Survey Question</option>
+</select>
+</nobr>
+<nobr>
+Feedback Mode:
+<select name='problemstatus'>
+  <option value=''></option>
+  ".&option('yes','problemstatus')."Show Feedback</option>
+  ".&option('no', 'problemstatus')."Don\'t Show Feedback</option>
+</select>
+<input type='submit' name='changeproblemmode' value='Change' />
+</nobr>
+<hr />";
     my $numtoanalyze=$ENV{'form.numtoanalyze'};
     if (!$numtoanalyze) { $numtoanalyze=20; }
     $result.= '<input type="submit" name="problemmode" value='.
@@ -297,6 +338,12 @@
 	@Apache::inputtags::partlist=('0');
 	$Apache::lonhomework::problemstatus=
 	    &Apache::lonnet::EXT('resource.0.problemstatus');
+	&Apache::lonxml::debug("problem status is  $Apache::lonhomework::problemstatus");
+	&Apache::lonxml::debug("env probstat is ".$ENV{'form.problemstatus'});
+	if ($ENV{'request.state'} eq 'construct' &&
+	    defined($ENV{'form.problemstatus'})) {
+	    $Apache::lonhomework::problemstatus=$ENV{'form.problemstatus'};
+	}
     } else {
 	$Apache::inputtags::part='';
 	@Apache::inputtags::partlist=();