[LON-CAPA-cvs] cvs: loncom /homework lonsimpleproblemedit.pm simpleproblem.problem simpleproblem.problem.meta /interface londocs.pm doc/loncapafiles loncapafiles.lpml

www lon-capa-cvs@mail.lon-capa.org
Wed, 09 Jul 2003 10:05:16 -0000


www		Wed Jul  9 06:05:16 2003 EDT

  Modified files:              
    /doc/loncapafiles	loncapafiles.lpml 
    /loncom/homework	lonsimpleproblemedit.pm simpleproblem.problem 
                    	simpleproblem.problem.meta 
    /loncom/interface	londocs.pm 
  Log:
  Simple DOCS problems now work for
  * radio
  * option
  * essay
  * string
  - this is probably going to be it. No need/intention to replace real problems.
  
  
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.262 doc/loncapafiles/loncapafiles.lpml:1.263
--- doc/loncapafiles/loncapafiles.lpml:1.262	Mon Jul  7 03:32:15 2003
+++ doc/loncapafiles/loncapafiles.lpml	Wed Jul  9 06:05:15 2003
@@ -2,7 +2,7 @@
  "http://lpml.sourceforge.net/DTD/lpml.dtd">
 <!-- loncapafiles.lpml -->
 
-<!-- $Id: loncapafiles.lpml,v 1.262 2003/07/07 07:32:15 www Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.263 2003/07/09 10:05:15 www Exp $ -->
 
 <!--
 
@@ -1620,7 +1620,7 @@
 <status>works/unverified</status>
 </file>
 <file>
-<source>loncom/interface/lonsimpleproblemedit.pm</source>
+<source>loncom/homework/lonsimpleproblemedit.pm</source>
 <target dist='default'>home/httpd/lib/perl/Apache/lonsimpleproblemedit.pm</target>
 <categoryname>handler</categoryname>
 <description>
Index: loncom/homework/lonsimpleproblemedit.pm
diff -u loncom/homework/lonsimpleproblemedit.pm:1.2 loncom/homework/lonsimpleproblemedit.pm:1.3
--- loncom/homework/lonsimpleproblemedit.pm:1.2	Wed Jul  9 02:23:20 2003
+++ loncom/homework/lonsimpleproblemedit.pm	Wed Jul  9 06:05:15 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Problem Parameter Setting "Editor"
 #
-# $Id: lonsimpleproblemedit.pm,v 1.2 2003/07/09 06:23:20 www Exp $
+# $Id: lonsimpleproblemedit.pm,v 1.3 2003/07/09 10:05:15 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -204,7 +204,9 @@
 # Question Type        
 	my %questiontypes=('radio'  => 
                                '1 out of N multiple choice (radio button)',
-			   'option' => 'Option Response');
+			   'option' => 'Option response',
+                           'string' => 'Short string response',
+                           'essay'  => 'Essay, open end');
         $qtype=$qparms{$prefix.'questiontype'};
         unless (defined($qtype)) { $qtype='radio'; }
         unless ($questiontypes{$qtype}) { $qtype='radio'; }
@@ -255,9 +257,28 @@
 
 # End Response
 	    $r->print('</td></tr></table><br />');
+# Hint
+	    $r->print(&hint());
 	}
+	if ($qtype eq 'string') {
+            my %stringtypes=(
+	       'cs' => 'Case sensitive',
+	       'ci' => 'Case Insensitive',
+	       'mc' => 'Multiple Choice, Order of characters unchecked');
+            my $stringanswer=$qparms{$prefix.'stringanswer'};
+            unless (defined($stringanswer)) { $stringanswer=''; }
+            my $stringtype=$qparms{$prefix.'stringtype'};
+            unless (defined($stringtype)) { $stringtype='cs'; }
+            unless ($stringtypes{$stringtype}) { $stringtype='cs'; }
+	    $r->print(
+		  '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2">'.
+	          '<tr><td>Correct answer: <input type="text" size="20" name="stringanswer" value="'.$stringanswer.'" />&nbsp;&nbsp;'.
+		      &Apache::loncommon::select_form
+		      ($stringtype,'stringtype',%stringtypes).
+		  '</td></tr></table><br />');
 # Hint
-        $r->print(&hint());
+	    $r->print(&hint());
+	}
 # Store Button
 	$r->print(
   '<input type="submit" name="storeproblem" value="Store Changes" /></form>');
Index: loncom/homework/simpleproblem.problem
diff -u loncom/homework/simpleproblem.problem:1.3 loncom/homework/simpleproblem.problem:1.4
--- loncom/homework/simpleproblem.problem:1.3	Wed Jul  9 02:23:20 2003
+++ loncom/homework/simpleproblem.problem	Wed Jul  9 06:05:15 2003
@@ -15,6 +15,10 @@
     $position[$i]=&EXT('resource.0.position'.$i);
     unless ($position[$i]) { $position[$i]='random'; }
 }
+$stringanswer=&EXT('resource.0.stringanswer');
+unless ($stringanswer) { $stringanswer=''; }
+$stringtype=&EXT('resource.0.stringtype');
+unless ($stringtype) { $stringtype='cs'; }
 </script>
 
 <startouttext />&EXT('resource.0.questiontext')<endouttext />
@@ -98,5 +102,22 @@
 </hintgroup>
 </optionresponse>
 </block>
+
+<block condition="&EXT('resource.0.questiontype') eq 'essay'"> 
+<essayresponse id="essaysegment">
+<textfield></textfield>
+</essayresponse>
+</block>
+
+<block condition="&EXT('resource.0.questiontype') eq 'string'"> 
+<stringresponse id="stringsegment" answer="$stringanswer" type="$stringtype">
+<textline>
+</textline>
+<hintgroup>
+<startouttext />&EXT('resource.0.hinttext')<endouttext />
+</hintgroup>
+</stringresponse>
+</block>
+
 
 </problem>
Index: loncom/homework/simpleproblem.problem.meta
diff -u loncom/homework/simpleproblem.problem.meta:1.2 loncom/homework/simpleproblem.problem.meta:1.3
--- loncom/homework/simpleproblem.problem.meta:1.2	Wed Jul  9 02:23:20 2003
+++ loncom/homework/simpleproblem.problem.meta	Wed Jul  9 06:05:15 2003
@@ -20,6 +20,8 @@
 
 <parameter part="0" id="optionsegment" package="optionresponse"></parameter>
 <parameter part="0" id="radiosegment" package="radiobuttonresponse"></parameter>
+<parameter part="0" id="essaysegment" package="essayresponse"></parameter>
+<parameter part="0" id="stringsegment" package="stringresponse"></parameter>
 
 <parameter part="0" package="part"></parameter>
 <stores part="0" name="awarded" type="float" display="Partial Credit Factor [Part: 0]"></stores>
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.63 loncom/interface/londocs.pm:1.64
--- loncom/interface/londocs.pm:1.63	Mon Jul  7 03:32:16 2003
+++ loncom/interface/londocs.pm	Wed Jul  9 06:05:15 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.63 2003/07/07 07:32:16 www Exp $
+# $Id: londocs.pm,v 1.64 2003/07/09 10:05:15 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -539,13 +539,7 @@
     $iconpath = $r->dir_config('lonIconsURL') . "/";
 
     my $now=time;
-#
-# FIXME: hack to disable new problem
-#
-    my $noeggforyou='';
-    unless ($ENV{'user.debug'}) {
-	$noeggforyou='alert("Sorry, not implemented yet."); return 0;';
-    }
+
 # print screen
     $r->print(<<ENDDOCUMENT);
 <html>
@@ -590,7 +584,6 @@
 }
 
 function makesmpproblem() {
-   $noeggforyou
    var title=prompt('Listed Title for the Problem');
    if (title) { 
     this.document.forms.newsmpproblem.importdetail.value=