--- loncom/homework/inputtags.pm 2001/08/18 07:56:51 1.44 +++ loncom/homework/inputtags.pm 2002/01/30 17:32:42 1.52 @@ -1,12 +1,37 @@ # The LearningOnline Network with CAPA # input definitons +# +# $Id: inputtags.pm,v 1.52 2002/01/30 17:32:42 albertel Exp $ +# +# Copyright Michigan State University Board of Trustees +# +# This file is part of the LearningOnline Network with CAPA (LON-CAPA). +# +# LON-CAPA is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# LON-CAPA is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LON-CAPA; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# /home/httpd/html/adm/gpl.txt +# +# http://www.lon-capa.org/ +# # 2/19 Guy package Apache::inputtags; use strict; -sub BEGIN { - &Apache::lonxml::register('Apache::inputtags',('textarea','textline','datasubmission')); +BEGIN { + &Apache::lonxml::register('Apache::inputtags',('textfield','textline','datasubmission')); } @@ -23,11 +48,13 @@ sub initialize_inputtags { @Apache::inputtags::previous=(); # id of current part, 0 means that no part is current (inside only $Apache::inputtags::part=''; - # list of problem date statuses, the first element is for - #if there is a second element it is for the current + # list of problem date statuses, the first element is for + # if there is a second element it is for the current @Apache::inputtags::status=(); - #hash of defined params for the current response + # hash of defined params for the current response %Apache::inputtags::params=(); + # list of all ids, for , these get join()ed and prepended + @Apache::inputtags::import=(); } sub start_input { @@ -44,7 +71,7 @@ sub end_input { return ''; } -sub start_textarea { +sub start_textfield { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $result = ""; my $id = &start_input($parstack,$safeeval); @@ -54,21 +81,34 @@ sub start_textarea { if ( $cols eq '') { $cols = 80; } my $rows = &Apache::lonxml::get_param('rows',$parstack,$safeeval); if ( $rows eq '') { $rows = 10; } - $result= '"; - } + if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { + return ""; + } + } &end_input; return ''; } @@ -83,11 +123,14 @@ sub start_textline { my $id=$Apache::inputtags::response['-1']; my $oldresponse = $Apache::lonhomework::history{"resource.$partid.$id.submission"}; - $result= ''; + if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { + $result= ''; + } else { + $result=''.$oldresponse.''; + } } elsif ($target eq 'edit') { - $result=&Apache::edit::tag_start($target,$token, - &Apache::lonxml::description($token)); + $result=&Apache::edit::tag_start($target,$token); $result.=&Apache::edit::text_arg('Size:','size',$token,'5').""; $result.=&Apache::edit::end_table; } elsif ($target eq 'modified') { @@ -365,7 +408,7 @@ sub gradestatus { } if ( $status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER') {$showbutton = 0;} if ( $showbutton ) { - $button = '
'; + $button = '
'; } } my $output= $previousmsg.$message.$trystr;