Annotation of loncom/homework/structuretags.pm, revision 1.240

1.34      albertel    1: # The LearningOnline Network with CAPA 
                      2: # definition of tags that give a structure to a document
1.74      albertel    3: #
1.240   ! albertel    4: # $Id: structuretags.pm,v 1.239 2004/02/16 19:50:10 albertel Exp $
1.74      albertel    5: #
                      6: # Copyright Michigan State University Board of Trustees
                      7: #
                      8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: #
                     10: # LON-CAPA is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2 of the License, or
                     13: # (at your option) any later version.
                     14: #
                     15: # LON-CAPA is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: #
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with LON-CAPA; if not, write to the Free Software
                     22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: #
                     24: # /home/httpd/html/adm/gpl.txt
                     25: #
                     26: # http://www.lon-capa.org/
                     27: #
1.33      albertel   28: # 2/19 Guy
1.44      ng         29: # 6/26/2001 fixed extra web display at end of <web></web> tags
1.60      www        30: # 8/17,8/18,8/20 Gerd Kortemeyer
1.54      www        31: 
1.133     sakharuk   32: 
1.1       albertel   33: package Apache::structuretags; 
                     34: 
                     35: use strict;
                     36: use Apache::lonnet;
1.101     sakharuk   37: use Apache::File();
1.147     www        38: use Apache::lonmenu;
1.210     albertel   39: use Apache::lonlocal;
1.231     sakharuk   40: use Apache::lonxml;
1.1       albertel   41: 
1.78      harris41   42: BEGIN {
1.193     www        43:     &Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext',
1.197     www        44: 'simpleeditbutton','definetag'));
1.10      albertel   45: }
                     46: 
                     47: sub start_web {
1.159     albertel   48:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.200     albertel   49:     my $bodytext=&Apache::lonxml::get_all_text("/web",$parser);
                     50:     if ($target eq 'web') {
                     51: 	return $bodytext;
1.159     albertel   52:     }
                     53:     return '';
1.10      albertel   54: }
                     55: 
                     56: sub end_web {
1.44      ng         57:     return '';
1.10      albertel   58: }
                     59: 
                     60: sub start_tex {
1.159     albertel   61:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.198     sakharuk   62:     my $result='';
1.200     albertel   63:     my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser);
                     64:     if ($target eq 'tex') {
                     65: 	return $bodytext.' ';
1.159     albertel   66:     }
1.198     sakharuk   67:     return $result;;
1.10      albertel   68: }
                     69: 
                     70: sub end_tex {
1.44      ng         71:     return '';
1.9       albertel   72: }
                     73: 
1.48      albertel   74: sub page_start {
1.159     albertel   75:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                     76:     my %found;
1.207     albertel   77:     foreach my $taginside (@$tagstack) {
1.159     albertel   78: 	foreach my $taglookedfor ('html','body','form') {
                     79: 	    if ($taginside =~ /^$taglookedfor$/i) {$found{$taglookedfor} = 1;}
                     80: 	}
                     81:     }
                     82: 
                     83:     my $result;
                     84:     my $head_tag_start;
                     85:     if (!defined($found{'html'})) {
                     86: 	$result=&Apache::londefdef::start_html($target,$token,$tagstack,
                     87: 					       $parstack,$parser,$safeeval);
1.218     albertel   88: 	$head_tag_start='<head>'.&Apache::lonmenu::registerurl(undef,$target);
1.159     albertel   89:     }
                     90:     my $body_tag_start;
                     91:     if (!defined($found{'body'})) {
                     92: 	$body_tag_start='<body onLoad="'.&Apache::lonmenu::loadevents().'" '.
                     93: 	    'onUnload="'.&Apache::lonmenu::unloadevents().'" ';
                     94: 	my $background=&Apache::lonxml::get_param('background',$parstack,
                     95: 						  $safeeval);
1.199     www        96: 	if ($ENV{'browser.imagesuppress'} eq 'on') { $background=''; }
1.159     albertel   97: 	if ($background) {
                     98: 	    $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
                     99: 		$background;
                    100: 	    $body_tag_start.='background="'.$background.'" ';
                    101: 	} else {
                    102: 	    my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack,
                    103: 						   $safeeval);
1.199     www       104: 	    if (($bgcolor) && ($ENV{'browser.blackwhite'} ne 'on')) {
1.159     albertel  105: 		$body_tag_start.='bgcolor="'.$bgcolor.'" ';
                    106: 	    } else {
                    107: 		$body_tag_start.='bgcolor="#ffffff"';
                    108: 	    }
1.199     www       109: 	}
                    110: 	if ($ENV{'browser.fontenhance'} eq 'on') {
                    111: 	    $body_tag_start.=' style="font-size: x-large;" ';
1.159     albertel  112: 	}
                    113: 	$body_tag_start.='>'.&Apache::lonmenu::menubuttons(undef,$target,1);
                    114: 	if ($target eq 'web' && $ENV{'request.state'} ne 'construct') {
1.165     albertel  115: 	    my ($symb,undef,undef,undef,$publicuser)=
                    116: 		&Apache::lonxml::whichuser();
                    117: 	    if ($symb eq '' && !$publicuser) {
1.159     albertel  118: 		my $help = &Apache::loncommon::help_open_topic("Ambiguous_Reference");
1.211     albertel  119: 		$help=&mt("Browsing resource, all submissions are temporary.")."<br />";
1.159     albertel  120: 		$body_tag_start.=$help;
                    121: 	    }
                    122: 	}
                    123:     }
                    124:     my $form_tag_start;
                    125:     if (!defined($found{'form'})) {
                    126: 	$form_tag_start='<form name="lonhomework" method="POST" action="'.
                    127: 	    $ENV{'request.uri'}.'">';
                    128:     }
                    129:     return ($result,$head_tag_start,$body_tag_start,$form_tag_start);
1.105     albertel  130: }
                    131: 
1.141     matthew   132: #use Time::HiRes();
1.105     albertel  133: sub get_resource_name {
1.159     albertel  134:     my ($parstack,$safeeval)=@_;
1.204     albertel  135:     if (defined($Apache::lonhomework::name)) {
                    136: 	return $Apache::lonhomework::name;
                    137:     }
1.159     albertel  138:     my $name=&Apache::lonnet::gettitle();
                    139:     if ($name eq '') {
                    140: 	$name=&Apache::lonnet::EXT('resource.title');
                    141: 	if ($name eq 'con_lost') { $name = ''; }
                    142:     }
1.204     albertel  143:     if ($name!~/\S+/) {
                    144: 	$name=$ENV{'request.uri'};
1.205     albertel  145: 	$name=~s-.*/([^/]+)$-$1-;
1.204     albertel  146:     }
1.159     albertel  147:     $Apache::lonhomework::name=$name;
                    148:     return $name;
1.105     albertel  149: }
                    150: 
                    151: sub setup_rndseed {
1.159     albertel  152:     my ($safeeval)=@_;
                    153:     my $rndseed;
1.162     albertel  154:     my ($symb)=&Apache::lonxml::whichuser();
                    155:     if ($ENV{'request.state'} eq "construct" || $symb eq '') {
1.159     albertel  156: 	$rndseed=$ENV{'form.rndseed'};
                    157: 	if (!$rndseed) {
1.162     albertel  158: 	    $rndseed=$Apache::lonhomework::history{'rndseed'};
                    159: 	    if (!$rndseed) {
                    160: 		$rndseed=time;
                    161: 	    }
1.237     albertel  162: 	    $ENV{'form.rndseed'}=$rndseed;
1.162     albertel  163: 	}
1.210     albertel  164: 	if ($ENV{'form.resetdata'} eq &mt('New Problem Variation') ||
                    165: 	    $ENV{'form.newrandomization'} eq &mt('New Randomization')) {
1.190     albertel  166: 	    srand(time);
                    167: 	    $rndseed=int(rand(2100000000));
1.159     albertel  168: 	    $ENV{'form.rndseed'}=$rndseed;
1.180     albertel  169: 	    delete($ENV{'form.resetdata'});
                    170: 	    delete($ENV{'form.newrandomization'});
1.159     albertel  171: 	}
1.187     albertel  172: 	if (defined($rndseed) && $rndseed ne int($rndseed)) {
                    173: 	   $rndseed=join(',',&Math::Random::random_seed_from_phrase($rndseed));
                    174:         }
1.221     albertel  175: 	if ($safeeval) {
                    176: 	    &Apache::lonxml::debug("Setting rndseed to $rndseed");
                    177: 	    &Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval);
                    178: 	}
1.159     albertel  179:     }
                    180:     return $rndseed;
1.105     albertel  181: }
                    182: 
                    183: sub problem_edit_header {
1.159     albertel  184:     return '<input type="hidden" name="submitted" value="edit" />
1.210     albertel  185:        <input type="hidden" name="problemmode" value="'.&mt('Edit').'" />
                    186:        <input type="submit" name="problemmode" value="'.&mt('Discard Edits and View').'" />
                    187:        <input type="submit" name="problemmode" value="'.&mt('EditXML').'" />
                    188:        <input type="submit" name="Undo" value="'.&mt('undo').'" /> <hr />
                    189:        <input type="submit" name="submit" value="'.&mt('Submit Changes and Edit').'" />
1.229     www       190:        <input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" /><table><tr><td>'.
                    191:        &Apache::loncommon::help_open_topic('Problem_Editor_XML_Index',
                    192: 					   'Problem Editing Help').'</td><td>'.
                    193:        &Apache::loncommon::help_open_faq(5).
                    194:        &Apache::loncommon::help_open_bug('Authoring').'</td></tr></table>'.
1.228     www       195:        '<table border="0"><tr><td bgcolor="#DDDDDD">';
1.105     albertel  196: }
                    197: 
                    198: sub problem_edit_footer {
1.210     albertel  199:     return '</td></tr></table><br /><input type="submit" name="submit" value="'.&mt('Submit Changes and Edit').'" />
                    200:     <input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" />';
1.105     albertel  201: }
                    202: 
1.235     albertel  203: sub option {
                    204:     my ($value,$name) = @_;
                    205:     my $result ="<option value='".$value."' ";
                    206:     if ($ENV{'form.'.$name} eq $value) {
                    207: 	$result.=" selected='on' ";
                    208:     }
                    209:     $result.='>';
                    210:     return $result;
                    211: }
                    212: 
1.105     albertel  213: sub problem_web_to_edit_header {
1.159     albertel  214:     my ($rndseed)=@_;
1.210     albertel  215:     my $result.='<input type="hidden" name="problemmode" value="'.&mt('View').'" />
                    216:              <input type="submit" name="problemmode" value="'.&mt('Edit').'" />
                    217:              <input type="submit" name="problemmode" value="'.&mt('EditXML').'" />
                    218:              <input type="submit" name="newrandomization" value="'.&mt('New Randomization').'" />
                    219:              <input type="submit" name="resetdata" value="'.&mt('Reset Submissions').'" />
                    220:              <nobr><input type="submit" name="changerandseed" value="'.&mt('Change Random Seed To:').'" />
1.175     albertel  221:               <input type="text" name="rndseed" width="10" value="'.
                    222: 	       $rndseed.'"
                    223:            onChange="javascript:document.lonhomework.changerandseed.click()" /></nobr>
1.105     albertel  224:              <input type="checkbox" name="showallfoils" ';
1.159     albertel  225:     if (defined($ENV{'form.showallfoils'})) { $result.='checked="on"'; }
1.228     www       226:     $result.= ' />'.&mt('&nbsp;Show&nbsp;All&nbsp;Foils').
                    227: 	&Apache::loncommon::help_open_topic('Problem_Editor_Testing_Area','Testing Problems').
                    228: 	'<hr />';
1.235     albertel  229:     $result.="
                    230: <nobr>
                    231: Problem Status:
                    232: <select name='problemstate'>
                    233:   <option name=''></option>
                    234:   ".&option('CLOSED'               ,'problemstate').&mt("Closed")."</option>
                    235:   ".&option('CAN_ANSWER'           ,'problemstate').&mt("Answerable")."</option>
                    236:   ".&option('CANNOT_ANSWER_tries'  ,'problemstate').&mt("Open with full tries")."</option>
                    237:   ".&option('CANNOT_ANSWER_correct','problemstate').&mt("Open and correct")."</option>
                    238:   ".&option('SHOW_ANSWER'          ,'problemstate').&mt("Show Answer")."</option>
                    239: </select>
                    240: </nobr>
                    241: <nobr>
                    242: Problem Type:
                    243: <select name='problemtype'>
                    244:   <option name=''></option>
                    245:   ".&option('exam'   ,'problemtype')."Exam Problem</option>
                    246:   ".&option('problem','problemtype')."Homework problem</option>
                    247:   ".&option('survey' ,'problemtype')."Survey Question</option>
                    248: </select>
                    249: </nobr>
                    250: <nobr>
                    251: Feedback Mode:
                    252: <select name='problemstatus'>
                    253:   <option value=''></option>
                    254:   ".&option('yes','problemstatus')."Show Feedback</option>
                    255:   ".&option('no', 'problemstatus')."Don\'t Show Feedback</option>
                    256: </select>
                    257: <input type='submit' name='changeproblemmode' value='Change' />
                    258: </nobr>
                    259: <hr />";
1.159     albertel  260:     my $numtoanalyze=$ENV{'form.numtoanalyze'};
1.176     albertel  261:     if (!$numtoanalyze) { $numtoanalyze=20; }
1.210     albertel  262:     $result.= '<input type="submit" name="problemmode" value='.
                    263: 	&mt('"Calculate answers').'" /> for
1.136     albertel  264:              <input type="text" name="numtoanalyze" value="'.
1.210     albertel  265: 	     $numtoanalyze.'" size="5" /> '.&mt('versions of this problem').
                    266: 	     '.'.&Apache::loncommon::help_open_topic("Analyze_Problem",
1.176     albertel  267: 						     '',undef,undef,300).
1.210     albertel  268: 						     '<hr />';
1.159     albertel  269:     return $result;
1.48      albertel  270: }
                    271: 
1.65      albertel  272: sub initialize_storage {
1.159     albertel  273:     %Apache::lonhomework::results=();
1.162     albertel  274:     %Apache::lonhomework::history=();
1.159     albertel  275:     my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
1.162     albertel  276:     if ($ENV{'request.state'} eq 'construct' || $symb eq '') {
1.159     albertel  277: 	%Apache::lonhomework::history=
                    278: 	    &Apache::lonnet::tmprestore($ENV{'request.uri'},'',$domain,$name);
                    279: 	my ($temp)=keys %Apache::lonhomework::history ;
                    280: 	&Apache::lonxml::debug("Return message of $temp");
                    281:     } else {
                    282: 	%Apache::lonhomework::history=
                    283: 	    &Apache::lonnet::restore($symb,$courseid,$domain,$name);
                    284:     }
                    285:     #ignore error conditions
1.67      albertel  286:     my ($temp)=keys %Apache::lonhomework::history ;
1.159     albertel  287:     if ($temp =~ m/^error:.*/) { %Apache::lonhomework::history=(); }
1.65      albertel  288: }
                    289: 
                    290: # -------------------------------------------------------------finalize_storage
                    291: # Stores away the result has to a student's environment
                    292: # checks form.grade_ for specific values, other wises stores
                    293: # to the running users environment
                    294: sub finalize_storage {
1.159     albertel  295:     my $result;
                    296:     my ($temp) = keys %Apache::lonhomework::results;
                    297:     if ( $temp ne '' ) {
                    298: 	my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
1.162     albertel  299: 	if ($ENV{'request.state'} eq 'construct' || $symb eq '') {
                    300: 	    $Apache::lonhomework::results{'rndseed'}=$ENV{'form.rndseed'};
1.159     albertel  301: 	    $result=&Apache::lonnet::tmpstore(\%Apache::lonhomework::results,
                    302: 					$ENV{'request.uri'},'',$domain,$name);
                    303: 	    &Apache::lonxml::debug('Construct Store return message:'.$result);
                    304: 	} else {
                    305: 	    $result=&Apache::lonnet::cstore(\%Apache::lonhomework::results,
                    306: 					    $symb,$courseid,$domain,$name);
                    307: 	    &Apache::lonxml::debug('Store return message:'.$result);
                    308: 	}
1.67      albertel  309:     }
1.159     albertel  310:     return $result;
1.65      albertel  311: }
                    312: 
                    313: sub checkout_msg {
1.211     albertel  314:     my %lt=&Apache::lonlocal::texthash( 
                    315: 		'resource'=>'The resource needs to be checked out',
                    316: 		'id_expln'=>'As a resource gets checked out, a unique timestamped ID is given to it, and a permanent record is left in the system.',
                    317:                 'warning'=>'Checking out resources is subject to course policies, and may exclude future credit even if done erroneously.',
                    318:                 'checkout'=>'Check out Exam for Viewing',
                    319: 		'checkout?'=>'Check out Exam?');
1.159     albertel  320:     return (<<ENDCHECKOUT);
1.211     albertel  321: <h2>$lt{'resource'}</h2>
                    322:     <p>$lt{'id_expln'}</p>
                    323: <font color="red">
                    324: <p>$lt{'warning'}</p>
1.91      albertel  325: </font>
                    326: <form name="checkout" method="POST" action="$ENV{'request.uri'}">
                    327: <input type="hidden" name="doescheckout" value="yes" />
1.211     albertel  328: <input type="button" name="checkoutbutton" value="$lt{'checkout'}" onClick="javascript:if (confirm('$lt{'checkout?'}')) { document.checkout.submit(); }" />
1.65      albertel  329: </form>
                    330: ENDCHECKOUT
                    331: }
                    332: 
1.204     albertel  333: sub init_problem_globals {
                    334:     my ($type)=@_;
                    335:     #initialize globals
                    336:     if ($type eq 'problem') {
                    337: 	$Apache::inputtags::part='0';
                    338: 	@Apache::inputtags::partlist=('0');
                    339: 	$Apache::lonhomework::problemstatus=
                    340: 	    &Apache::lonnet::EXT('resource.0.problemstatus');
1.235     albertel  341: 	&Apache::lonxml::debug("problem status is  $Apache::lonhomework::problemstatus");
                    342: 	&Apache::lonxml::debug("env probstat is ".$ENV{'form.problemstatus'});
                    343: 	if ($ENV{'request.state'} eq 'construct' &&
                    344: 	    defined($ENV{'form.problemstatus'})) {
                    345: 	    $Apache::lonhomework::problemstatus=$ENV{'form.problemstatus'};
                    346: 	}
1.204     albertel  347:     } else {
                    348: 	$Apache::inputtags::part='';
                    349: 	@Apache::inputtags::partlist=();
                    350: 	$Apache::lonhomework::problemstatus='';	
                    351:     }
                    352:     @Apache::inputtags::responselist = ();
                    353:     @Apache::inputtags::importlist = ();
                    354:     @Apache::inputtags::previous=();
                    355:     @Apache::inputtags::previous_version=();
                    356:     $Apache::structuretags::printanswer='No';
                    357:     @Apache::structuretags::whileconds=();
                    358:     @Apache::structuretags::whilebody=();
                    359:     @Apache::structuretags::whileline=();
                    360:     $Apache::lonhomework::scantronmode=0;
                    361:     undef($Apache::lonhomework::name);
                    362: 
                    363: }
                    364: 
                    365: sub reset_problem_globals {
                    366:     my ($type)=@_;
                    367:     undef(%Apache::lonhomework::history);
                    368:     undef(%Apache::lonhomework::results);
                    369:     undef($Apache::inputtags::part);
1.208     albertel  370: #don't undef this, lonhomework.pm takes care of this, we use this to 
                    371: #detect if we try to do 2 problems in one file
                    372: #   undef($Apache::lonhomework::parsing_a_problem);
1.204     albertel  373:     undef($Apache::lonhomework::name);
                    374: }
                    375: 
1.240   ! albertel  376: sub set_problem_status {
        !           377:     my ($part)=@_;
        !           378:     if ($ENV{'form.problemstate'} eq 'CANNOT_ANSWER_correct') {
        !           379: 	$Apache::lonhomework::history{"resource.$part.solved"}=
        !           380: 	    'correct_by_student';
        !           381:     }
        !           382: }
        !           383: 
1.9       albertel  384: sub start_problem {
1.159     albertel  385:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.19      albertel  386: 
1.184     albertel  387:     if ( $Apache::inputtags::part ne '' ||
                    388: 	 $Apache::lonhomework::parsing_a_problem) {
                    389: 	&Apache::lonxml::error('Only one &lt;problem&gt; allowed in a .problem file');
                    390: 	#my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser);
1.159     albertel  391: 	return '';
                    392:     }
1.184     albertel  393: 
                    394:     $Apache::lonhomework::parsing_a_problem=1;
1.204     albertel  395:     &init_problem_globals('problem');
1.166     albertel  396: 
                    397:     if (defined($ENV{'scantron.maxquest'})) {
                    398: 	$Apache::lonhomework::scantronmode=1;
                    399:     }
1.161     albertel  400: 
1.159     albertel  401:     if ($target ne 'analyze') {
                    402: 	&initialize_storage();
                    403: 	if ($target eq 'web') {
                    404: 	    &Apache::lonhomework::showhash(%Apache::lonhomework::history);
1.238     albertel  405: 	}
1.240   ! albertel  406:        	if ($ENV{'request.state'} eq 'construct') { &set_problem_status('0'); }
1.159     albertel  407: 	$Apache::lonhomework::type=&Apache::lonnet::EXT('resource.0.type');
1.237     albertel  408: 	if (($ENV{'request.state'} eq 'construct') &&
                    409: 	    defined($ENV{'form.problemtype'})) {
                    410: 	    $Apache::lonhomework::type=$ENV{'form.problemtype'};
                    411: 	}
1.240   ! albertel  412: 	&Apache::lonxml::debug("Found this to be of type :$Apache::ltonhomework::type:");
1.159     albertel  413:     }
1.164     albertel  414:     if ($Apache::lonhomework::type eq '' ) {
1.159     albertel  415: 	my $uri=$ENV{'request.uri'};
                    416: 	if ($uri=~/\.(\w+)$/) {
                    417: 	    $Apache::lonhomework::type=$1;
                    418: 	    &Apache::lonxml::debug("Using type of $1");
                    419: 	} else {
                    420: 	    $Apache::lonhomework::type='problem';
                    421: 	    &Apache::lonxml::debug("Using default type, problem, :$uri:");
                    422: 	}
1.87      albertel  423:     }
1.58      www       424: 
1.159     albertel  425:     #added vars to the scripting enviroment
1.213     albertel  426:     my $expression='$external::part=\''.$Apache::inputtags::part.'\';';
1.24      albertel  427:     &Apache::run::run($expression,$safeeval);
1.159     albertel  428:     my $status;
                    429:     my $accessmsg;
                    430: 
                    431:     #should get back a <html> or the neccesary stuff to start XML/MathML
                    432:     my ($result,$head_tag_start,$body_tag_start,$form_tag_start)=
                    433: 	&page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
                    434:     if ($target eq 'tex' and $ENV{'request.symb'} =~ m/\.page_/) {$result='';}
                    435: 
                    436:     if ($target eq 'analyze') { my $rndseed=&setup_rndseed($safeeval); }
                    437:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
                    438: 	$target eq 'tex') {
                    439: 	#handle exam checkout
                    440: 	if ($Apache::lonhomework::type eq 'exam') {
                    441: 	    my $token=
                    442: 		$Apache::lonhomework::history{"resource.0.outtoken"};
                    443: 	    if (($ENV{'form.doescheckout'}) && (!$token)) {
                    444: 		$token=&Apache::lonxml::maketoken();
                    445: 		$Apache::lonhomework::history{"resource.0.outtoken"}=
                    446: 		    $token;
                    447: 	    }
                    448: 	    $body_tag_start.=&Apache::lonxml::printtokenheader($target,$token);
1.142     albertel  449: 	}
1.159     albertel  450: 
                    451: 	#handle rand seed in construction space
                    452: 	my $rndseed=&setup_rndseed($safeeval);
1.162     albertel  453: 	my ($symb)=&Apache::lonxml::whichuser();
1.163     albertel  454: 	if ($ENV{'request.state'} ne "construct" && $symb eq '') {
1.162     albertel  455: 	    $form_tag_start.='<input type="hidden" name="rndseed" value="'.
                    456: 		$rndseed.'" />'.
                    457: 		    '<input type="submit" name="resetdata"
1.211     albertel  458:                              value="'.&mt('New Problem Variation').'" />'.
1.164     albertel  459: 		    '<input type="hidden" name="username"
1.185     albertel  460:                              value="'.$ENV{'form.username'}.'" /> <br />';
1.162     albertel  461: 	}
1.159     albertel  462: 	($status,$accessmsg) = &Apache::lonhomework::check_access('0');
                    463: 	push (@Apache::inputtags::status,$status);
                    464: 	my $expression='$external::datestatus="'.$status.'";';
                    465: 	$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.0.solved"}.'";';
                    466: 	&Apache::run::run($expression,$safeeval);
                    467: 	&Apache::lonxml::debug("Got $status");
                    468: 	if (( $status eq 'CLOSED' ) ||
                    469: 	    ( $status eq 'UNCHECKEDOUT') ||
                    470: 	    ( $status eq 'BANNED') ||
1.216     albertel  471: 	    ( $status eq 'UNAVAILABLE') ||
                    472: 	    ( $status eq 'INVALID_ACCESS')) {
1.159     albertel  473: 	    my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser);
                    474: 	    if ( $target eq "web" ) {
                    475: 		$result.= $head_tag_start.'</head>';
                    476: 		my $msg=$body_tag_start;
                    477: 		if ($status eq 'UNAVAILABLE') {
1.211     albertel  478: 		    $result.='<h1>'.&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'</h1>';
1.159     albertel  479: 		} else {
1.211     albertel  480: 		    $result.='<h1>'.&mt('Not open to be viewed').'</h1>';
1.159     albertel  481: 		}
1.216     albertel  482: 		if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') {
1.159     albertel  483: 		    $msg.='The problem '.$accessmsg;
                    484: 		} elsif ($status eq 'UNCHECKEDOUT') {
                    485: 		    $msg.=&checkout_msg;
                    486: 		}
                    487: 		$result.=$msg.'<br />';
                    488: 	    } elsif ($target eq 'tex') {
                    489: 		$result.='\begin{document}\noindent \vskip 1 mm  \begin{minipage}{\textwidth}\vskip 0 mm';
                    490: 		if ($status eq 'UNAVAILABLE') {
1.211     albertel  491: 		    $result.=&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'\vskip 0 mm ';
1.159     albertel  492: 		} else {
1.211     albertel  493: 		    $result.=&mt('Problem is not open to be viewed. It')." $accessmsg \\vskip 0 mm ";
1.159     albertel  494: 		}
                    495: 	    }
                    496: 	} elsif ($target eq 'web') {
                    497: 	    my $name= &get_resource_name($parstack,$safeeval);
1.227     albertel  498: 	    $result.="$head_tag_start<title>$name</title></head>
1.158     sakharuk  499:               $body_tag_start \n $form_tag_start".	
1.227     albertel  500: 	      '<input type="hidden" name="submitted" value="yes" />';
                    501: 	    # create a page header and exit
                    502: 	    if ($ENV{'request.state'} eq "construct") {
                    503: 		$result.= &problem_web_to_edit_header($ENV{'form.rndseed'});
                    504: 	    }
                    505: 	    # if we are viewing someone else preserve that info
                    506: 	    if (defined $ENV{'form.grade_symb'}) {
                    507: 		foreach my $field ('symb','courseid','domain','username') {
                    508: 		    $result .= '<input type="hidden" name="grade_'.$field.
                    509: 			'" value="'.$ENV{"form.grade_$field"}.'" />'."\n";
1.159     albertel  510: 		}
                    511: 	    }
                    512: 	} elsif ($target eq 'tex') {
1.192     sakharuk  513: 	    my $startminipage = '';
1.191     sakharuk  514: 	    if (not $ENV{'form.problem_split'}=~/yes/) {
1.192     sakharuk  515: 		$startminipage = '\begin{minipage}{\textwidth}';
1.178     sakharuk  516: 	    }
1.159     albertel  517: 	    my $id = $Apache::inputtags::part;
                    518: 	    my $weight = &Apache::lonnet::EXT("resource.$id.weight");
1.223     sakharuk  519: 	    my $packages=&Apache::lonnet::metadata($ENV{'request.uri'},'packages');
                    520: 	    my @packages = split /,/,$packages;
                    521: 	    my $allow_print_points = 0;
                    522: 	    foreach my $partial_key (@packages) {
1.230     albertel  523: 		if ($partial_key=~m/^part_0$/) {
1.223     sakharuk  524: 		    $allow_print_points=1;
1.159     albertel  525: 		}
                    526: 	    }
                    527: 	    my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); 
                    528: 	    $duedate = POSIX::strftime("%c",localtime($duedate));
                    529: 	    my $temp_file;
                    530: 	    my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.due";
                    531: 	    if (-e $filename) {
                    532: 		$temp_file = Apache::File->new($filename);
                    533: 	    } else {
                    534: 		$temp_file = Apache::File->new('>>'.$filename);
                    535: 	    }
                    536: 	    my @due_file_content = <$temp_file>;
                    537: 	    my $due_file_content = $due_file_content[$#due_file_content];
                    538: 	    chomp $due_file_content;
1.231     sakharuk  539: 	    my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval));
1.159     albertel  540: 	    if ($due_file_content ne $duedate) {
                    541: 		$temp_file = Apache::File->new('>'.$filename);
                    542: 		print $temp_file "$duedate\n";
                    543: 		if (not $ENV{'request.symb'} =~ m/\.page_/) {
                    544: 		    if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') {
1.206     sakharuk  545: 			$result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$ENV{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm\noindent '.$startminipage.'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';	
1.159     albertel  546: 		    } else {
1.206     sakharuk  547: 			$result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$ENV{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm \noindent'.$startminipage.'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';
1.159     albertel  548: 			if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
                    549: 		    }
1.104     sakharuk  550: 		} else {
1.159     albertel  551: 		    $result .= '\vskip 1mm\textit{Due date: '.$duedate.'} \\\\\\\\';
1.104     sakharuk  552: 		}
1.101     sakharuk  553: 	    } else {
1.159     albertel  554: 		if (not $ENV{'request.symb'} =~ m/\.page_/) {
1.206     sakharuk  555: 		    $result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$ENV{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm\noindent'.$startminipage.'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';	
1.159     albertel  556: 		    if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
                    557: 		} else {
                    558: 		    $result .= '\vskip 1mm \\\\\\\\';
                    559: 		}
                    560: 	    }
1.99      sakharuk  561: 	}
1.159     albertel  562:     } elsif ($target eq 'edit') {
                    563: 	$result.=$head_tag_start."</head>".$body_tag_start.$form_tag_start.
                    564: 	    &problem_edit_header();
1.226     albertel  565: 	$Apache::lonxml::warnings_error_header=
                    566: 	    &mt("Editor Errors - these errors might not effect the running of the problem, but they will likely cause problems with further use of the Edit mode. Please use the EditXML mode to fix these errors.")."<br />";
1.159     albertel  567: 	my $temp=&Apache::edit::insertlist($target,$token);
                    568: 	$result.=$temp;
                    569:     } elsif ($target eq 'modified') {
                    570: 	$result=$token->[4];
                    571: 	$result.=&Apache::edit::handle_insert();
                    572:     } else {
                    573: 	# page_start returned a starting result, delete it if we don't need it
                    574: 	$result = '';
1.99      sakharuk  575:     }
1.159     albertel  576:     return $result;
1.9       albertel  577: }
                    578: 
                    579: sub end_problem {
1.159     albertel  580:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    581:     my $result='';
                    582:     my $status=$Apache::inputtags::status['-1'];
                    583:     if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
                    584: 	$target eq 'tex') {
                    585: 	if ( $target eq 'grade' && $Apache::inputtags::part eq '0' &&
1.232     albertel  586: 	     ($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode)) {
1.159     albertel  587: 	    # if part is zero, no <part>s existed, so we need to the grading
                    588: 	    &Apache::inputtags::grade;
                    589: 	} elsif ( ($target eq 'web' || $target eq 'tex') &&
                    590: 		  $Apache::inputtags::part eq '0' &&
                    591: 		  $status ne 'UNCHECKEDOUT') {
                    592: 	    # if part is zero, no <part>s existed, so we need show the current
                    593: 	    # grading status
                    594: 	    my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part,$target);
                    595: 	    $result.= $gradestatus;
                    596: 	}
                    597: 	if (
                    598: 	    (($target eq 'web') && ($ENV{'request.state'} ne 'construct')) ||
                    599: 	    ($target eq 'answer') || ($target eq 'tex')
                    600: 	   ) {
1.227     albertel  601: 	    if ($target ne 'tex' &&
                    602: 		$ENV{'form.answer_output_mode'} ne 'tex') {
                    603: 		$result.="</form></body>\n";
1.159     albertel  604: 	    }
                    605: 	    if ($target eq 'web') {
                    606: 		$result.=&Apache::lonxml::xmlend();
                    607: 	    } elsif ($target eq 'tex') {
1.178     sakharuk  608: 		my $endminipage = '';
1.191     sakharuk  609: 		if (not $ENV{'form.problem_split'}=~/yes/) {
1.178     sakharuk  610: 		    $endminipage = '\end{minipage}';
                    611: 		}
1.174     sakharuk  612: 		$result .= '\keephidden{ENDOFPROBLEM}\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}';
1.159     albertel  613: 		if (not $ENV{'request.symb'} =~ m/\.page_/) {
1.178     sakharuk  614: 		    $result .= $endminipage.'\end{document} ';
1.159     albertel  615: 		} else {
                    616: 		    $result .= '';
                    617: 		}
                    618: 	    }
                    619: 	}
                    620: 	if ($target eq 'grade') {
                    621: 	    &Apache::lonhomework::showhash(%Apache::lonhomework::results);
                    622: 	    &finalize_storage();
                    623: 	}
1.172     albertel  624: 	if ($target eq 'answer' && ($ENV{'request.state'} eq 'construct')
1.173     albertel  625: 	    && $ENV{'form.answer_output_mode'} ne 'tex') {
1.172     albertel  626: 	    $result.='</html>'; # normally we get it from xmlend, but in CSTR
                    627: 	                        # we always show answer mode too.
1.159     albertel  628: 	}
                    629:     } elsif ($target eq 'meta') {
                    630: 	if ($Apache::inputtags::part eq '0') {
1.179     albertel  631: 	    @Apache::inputtags::response=();
1.159     albertel  632: 	    $result=&Apache::response::mandatory_part_meta;
                    633: 	}
1.215     albertel  634: 	$result.=&Apache::response::meta_part_order();
1.159     albertel  635:     } elsif ($target eq 'edit') {
                    636: 	&Apache::lonxml::debug("in end_problem with $target, edit");
                    637: 	$result = &problem_edit_footer();
                    638:     }
1.155     albertel  639: 
1.177     albertel  640:     if ($ENV{'request.state'} eq 'construct' && $target eq 'web') {
                    641: 	&Apache::inputtags::check_for_duplicate_ids();
                    642:     }
1.204     albertel  643: 
                    644:     &reset_problem_globals('problem');
1.159     albertel  645: 
                    646:     return $result;
1.48      albertel  647: }
                    648: 
1.108     albertel  649: 
1.48      albertel  650: sub start_library {
1.159     albertel  651:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    652:     my ($result,$head_tag_start,$body_tag_start,$form_tag_start);
1.204     albertel  653:     if ($$tagstack[0] eq 'library') { &init_problem_globals('library') };
1.159     albertel  654:     if ($target eq 'edit') {
                    655: 	($result,$head_tag_start,$body_tag_start,$form_tag_start)=
                    656: 	    &page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
                    657: 	$result.=$head_tag_start."</head>".$body_tag_start.$form_tag_start.
                    658: 	    &problem_edit_header();
                    659: 	my $temp=&Apache::edit::insertlist($target,$token);
                    660: 	$result.=$temp;
                    661:     } elsif ($target eq 'modified') {
                    662: 	$result=$token->[4];
                    663: 	$result.=&Apache::edit::handle_insert();
                    664:     } elsif ($target eq 'web' && $$tagstack[0] ne 'problem' &&
                    665: 	     $ENV{'request.state'} eq "construct" ) {
                    666: 	($result,$head_tag_start,$body_tag_start,$form_tag_start)=
                    667: 	    &page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
                    668: 	my $name=&get_resource_name($parstack,$safeeval);
                    669: 	my $rndseed=&setup_rndseed($safeeval);
                    670: 	$result.="$head_tag_start<title>$name</title></head>
1.105     albertel  671:               $body_tag_start \n $form_tag_start".	
1.159     albertel  672: 		  '<input type="hidden" name="submitted" value="yes" />';
                    673: 	$result.=&problem_web_to_edit_header($rndseed);
                    674:     }
                    675:     return $result;
1.48      albertel  676: }
                    677: 
                    678: sub end_library {
1.159     albertel  679:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    680:     my $result='';
                    681:     if ($target eq 'edit') {
                    682: 	$result=&problem_edit_footer();
                    683:     } elsif ($target eq 'web' && $$tagstack[0] ne 'problem' &&
                    684: 	     $ENV{'request.state'} eq "construct") {
                    685: 	$result.='</form></body>'.&Apache::lonxml::xmlend();
                    686:     }
1.204     albertel  687:     if ($$tagstack[0] eq 'library') { &reset_problem_globals('library') };
1.159     albertel  688:     return $result;
1.197     www       689: }
                    690: 
                    691: sub start_definetag {
                    692:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    693: 
                    694:     my $result;
                    695: 
                    696:     my $name = $token->[2]->{'name'};
                    697:     my $skip=&Apache::lonxml::get_all_text("/definetag",$parser);
                    698:     if ($name=~/^\//) {
                    699: 	$result=
                    700:  '<br /><table bgcolor="#FFBBBB"><tr><th>END <tt>'.$name.'</tt></th></tr>';
                    701:     } else {
                    702: 	$result=
                    703:  '<br /><table bgcolor="#BBFFBB"><tr><th>BEGIN <tt>'.$name.'</tt></th></tr>';
                    704:     }
                    705:     $skip=~s/\</\&lt\;/gs;
                    706:     $skip=~s/\>/\&gt\;/gs;
                    707:     $result.='<tr><td><pre>'.$skip.'</pre></td></tr></table>';
                    708:     return $result;
                    709: }
                    710: 
                    711: sub end_definetag {
                    712:     return '';
1.1       albertel  713: }
                    714: 
                    715: sub start_block {
1.201     albertel  716:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
1.131     albertel  717: 
                    718:     my $result;
1.1       albertel  719: 
1.160     albertel  720:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
1.131     albertel  721: 	$target eq 'tex' || $target eq 'analyze') {
1.159     albertel  722: 	my $code = $token->[2]->{'condition'};
1.201     albertel  723: 	if (defined($code)) {
1.137     albertel  724: 	    if (!$Apache::lonxml::default_homework_loaded) {
                    725: 		&Apache::lonxml::default_homework_load($safeeval);
                    726: 	    }
1.131     albertel  727: 	    $result = &Apache::run::run($code,$safeeval);
                    728: 	    &Apache::lonxml::debug("block :$code: returned :$result:");
                    729: 	} else {
                    730: 	    $result='1';
                    731: 	}
                    732: 	if ( ! $result ) {
1.201     albertel  733: 	    my $skip=&Apache::lonxml::get_all_text("/block",$parser,$style);
1.131     albertel  734: 	    &Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]");
                    735: 	}
                    736: 	$result='';
                    737:     } elsif ($target eq 'edit') {
                    738: 	$result .=&Apache::edit::tag_start($target,$token);
                    739: 	$result .=&Apache::edit::text_arg('Test Condition:','condition',
                    740: 					  $token,40);
                    741: 	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
                    742:     } elsif ($target eq 'modified') {
                    743: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
                    744: 						     $safeeval,'condition');
                    745: 	if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
1.38      albertel  746:     }
1.131     albertel  747:     return $result;
1.1       albertel  748: }
                    749: 
                    750: sub end_block {
1.167     www       751:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    752:     my $result;
                    753:     if ($target eq "edit") {
                    754: 	$result.= &Apache::edit::tag_end($target,$token,'');
                    755:     }
                    756:     return $result;
                    757: }
                    758: 
                    759: sub start_languageblock {
1.201     albertel  760:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
1.167     www       761: 
                    762:     my $result;
                    763: 
                    764:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
                    765: 	$target eq 'tex' || $target eq 'analyze') {
1.201     albertel  766: 	my $include = $token->[2]->{'include'};
                    767: 	my $exclude = $token->[2]->{'exclude'};
                    768:         my %languages=&Apache::loncommon::display_languages();
                    769:         $result='1';
                    770: 	if ($include) {
                    771:             $result='';
                    772:             foreach (split(/\,/,$include)) {
                    773:                 if ($languages{$_}) { $result='1'; }
                    774:             }
                    775: 	}
                    776:         if ($exclude) {
                    777:             foreach (split(/\,/,$exclude)) {
                    778:                 if ($languages{$_}) { $result='0'; }
                    779:             }
                    780: 	}
                    781: 	if ( ! $result ) {
                    782: 	    my $skip=&Apache::lonxml::get_all_text("/languageblock",$parser,
                    783: 						   $style);
                    784: 	    &Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]");
                    785: 	}
                    786: 	$result='';
1.167     www       787:     } elsif ($target eq 'edit') {
                    788: 	$result .=&Apache::edit::tag_start($target,$token);
1.211     albertel  789: 	$result .=&Apache::edit::text_arg(&mt('Include Language:'),'include',
1.167     www       790: 					  $token,40);
1.211     albertel  791: 	$result .=&Apache::edit::text_arg(&mt('Exclude Language:'),'exclude',
1.167     www       792: 					  $token,40);
                    793: 	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
                    794:     } elsif ($target eq 'modified') {
                    795: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
1.168     albertel  796: 						     $safeeval,'include',
                    797: 						     'exclude');
1.167     www       798: 	if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
                    799:     }
                    800:     return $result;
                    801: }
                    802: 
                    803: sub end_languageblock {
1.170     www       804:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    805:     my $result;
1.201     albertel  806:     if ($target eq "edit") {
1.170     www       807: 	$result.= &Apache::edit::tag_end($target,$token,'');
                    808:     }
                    809:     return $result;
                    810: }
                    811: 
                    812: sub start_instructorcomment {
1.201     albertel  813:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
1.170     www       814: 
                    815:     my $result;
                    816: 
                    817:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
                    818: 	$target eq 'tex' || $target eq 'analyze') {
                    819:         $result=($ENV{'request.role'}=~/^(in|cc|au|ca|li)/);
                    820: 	if ( ! $result ) {
1.201     albertel  821: 	    my $skip=&Apache::lonxml::get_all_text("/instructorcomment",
                    822: 						   $parser,$style);
1.170     www       823: 	    &Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]");
                    824: 	}
                    825: 	$result='';
                    826:     } elsif ($target eq 'edit') {
                    827: 	$result .=&Apache::edit::tag_start($target,$token);
                    828: 	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
                    829:     }
                    830:     return $result;
                    831: }
                    832: 
                    833: sub end_instructorcomment {
1.159     albertel  834:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.160     albertel  835:     my $result;
                    836:     if ($target eq "edit") {
                    837: 	$result.= &Apache::edit::tag_end($target,$token,'');
                    838:     }
                    839:     return $result;
1.4       tsai      840: }
                    841: 
                    842: sub start_while {
1.159     albertel  843:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    844: 
1.160     albertel  845:     my $result;
1.161     albertel  846:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
1.160     albertel  847: 	$target eq 'tex' || $target eq 'analyze') {
                    848: 	my $code = $token->[2]->{'condition'};
1.4       tsai      849: 
1.160     albertel  850: 	push( @Apache::structuretags::whileconds, $code);
                    851: 	if (!$Apache::lonxml::default_homework_loaded) {
                    852: 	    &Apache::lonxml::default_homework_load($safeeval);
                    853: 	}
                    854: 	my $result = &Apache::run::run($code,$safeeval);
1.161     albertel  855: 	my $bodytext=&Apache::lonxml::get_all_text("/while",$parser);
1.160     albertel  856: 	push( @Apache::structuretags::whilebody, $bodytext);
1.161     albertel  857: 	push( @Apache::structuretags::whileline, $token->[5]);
                    858: 	&Apache::lonxml::debug("s code $code got -$result-");
1.160     albertel  859: 	if ( $result ) {
                    860: 	    &Apache::lonxml::newparser($parser,\$bodytext);
                    861: 	}
                    862:     } elsif ($target eq 'edit') {
                    863: 	$result .=&Apache::edit::tag_start($target,$token);
1.211     albertel  864: 	$result .=&Apache::edit::text_arg(&mt('Test Condition:'),'condition',
1.160     albertel  865: 					  $token,40);
                    866: 	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
                    867:     } elsif ($target eq 'modified') {
                    868: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
                    869: 						     $safeeval,'condition');
                    870: 	if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
1.159     albertel  871:     }
1.160     albertel  872:     return $result;
1.4       tsai      873: }
                    874: 
                    875: sub end_while {
1.159     albertel  876:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.160     albertel  877:     my $result;
                    878: 
                    879:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
                    880: 	$target eq 'tex' || $target eq 'analyze') {
                    881: 	my $code = pop(@Apache::structuretags::whileconds);
                    882: 	my $bodytext = pop(@Apache::structuretags::whilebody);
1.161     albertel  883: 	my $line = pop(@Apache::structuretags::whileline);
                    884: 	my $return = &Apache::run::run($code,$safeeval);
                    885: 	my $starttime=time;
                    886: 	my $error=0;
                    887: 	while ($return) {
                    888: 	    if (time-$starttime >
                    889: 		$Apache::lonnet::perlvar{'lonScriptTimeout'}) {
                    890: 		$return = 0; $error=1; next;
                    891: 	    }
                    892: 	    $result.=&Apache::scripttag::xmlparse($bodytext);
                    893: 	    $return = &Apache::run::run($code,$safeeval);
                    894: 	}
                    895: 	if ($error) {
1.211     albertel  896: 	    &Apache::lonxml::error('<pre>'.&mt('Code ran too long. It ran for more than').' '.$Apache::lonnet::perlvar{'lonScriptTimeout'}.' '.&mt('seconds occured while running &lt;while$gt; on line').' '.$line.'</pre>');
1.160     albertel  897: 	}
                    898:     } elsif ($target eq "edit") {
                    899: 	$result.= &Apache::edit::tag_end($target,$token,'');
1.159     albertel  900:     }
1.160     albertel  901:     return $result;
1.1       albertel  902: }
1.6       tsai      903: 
1.160     albertel  904: # <randomlist show="1">
1.6       tsai      905: #  <tag1>..</tag1>
                    906: #  <tag2>..</tag2>
                    907: #  <tag3>..</tag3>
1.160     albertel  908: #  ...
1.6       tsai      909: # </randomlist>
                    910: sub start_randomlist {
1.159     albertel  911:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    912:     my $result;
                    913:     if ($target eq 'answer' || $target eq 'grade' || $target eq 'web' ||
                    914: 	$target eq 'tex' || $target eq 'analyze') {
                    915: 	my $body= &Apache::lonxml::get_all_text("/randomlist",$parser);
                    916: 	my $b_parser= HTML::TokeParser->new(\$body);
                    917: 	my $b_tok;
                    918: 	my @randomlist;
                    919: 	my $list_item;
                    920: 	while($b_tok = $b_parser->get_token() ) {
                    921: 	    if($b_tok->[0] eq 'S') { # start tag
                    922: 		# get content of the tag until matching end tag
                    923: 		# get all text upto the matching tag
                    924: 		# and push the content into @randomlist
                    925: 		$list_item = &Apache::lonxml::get_all_text('/'.$b_tok->[1],
                    926: 							   $b_parser);
                    927: 		$list_item = "$b_tok->[4]"."$list_item"."</$b_tok->[1]>";
                    928: 		push(@randomlist,$list_item);
                    929: 		#  print "<br /><b>START-TAG $b_tok->[1], $b_tok->[4],
                    930:                 #         $list_item</b>";
                    931: 	    }
                    932: 	    if($b_tok->[0] eq 'T') { # text
                    933: 		# what to do with text in between tags?
                    934: 		#  print "<b>TEXT $b_tok->[1]</b><br />";
                    935: 	    }
                    936: 	    # if($b_tok->[0] eq 'E') { # end tag, should not happen
                    937: 	    #  print "<b>END-TAG $b_tok->[1]</b><br />";
                    938: 	    # }
                    939: 	}
                    940: 	my @idx_arr = (0 .. $#randomlist);
                    941: 	&Apache::structuretags::shuffle(\@idx_arr);
                    942: 	my $bodytext = '';
                    943: 	my $show=$#randomlist;
                    944: 	my $showarg=&Apache::lonxml::get_param('show',$parstack,$safeeval);
                    945: 	$showarg--;
                    946: 	if ( ($showarg >= 0) && ($showarg < $show) ) { $show = $showarg; }
                    947: 	for(0 .. $show) {
                    948: 	    $bodytext .= "$randomlist[ $idx_arr[$_] ]";
                    949: 	}
                    950: 	&Apache::lonxml::newparser($parser,\$bodytext);
                    951:     } elsif ($target eq 'edit' ) {
                    952: 	$result .=&Apache::edit::tag_start($target,$token);
                    953: 	$result .=&Apache::edit::text_arg('Maximum Tags to Show:','show',
                    954: 					   $token,5);
                    955: 	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
                    956:     } elsif ($target eq 'modified' ) {
                    957: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
                    958: 						     $safeeval,'show');
                    959: 	if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
                    960:     }
                    961:     return $result;
1.7       tsai      962: }
                    963: 
                    964: sub shuffle {
                    965:     my $a=shift;
                    966:     my $i;
1.70      albertel  967:     if (defined(@$a)) {
1.159     albertel  968: 	&Apache::response::setrandomnumber();
                    969: 	for($i=@$a;--$i;) {
                    970: 	    my $j=int(&Math::Random::random_uniform() * ($i+1));
                    971: 	    next if $i == $j;
                    972: 	    @$a[$i,$j] = @$a[$j,$i];
                    973: 	}
1.7       tsai      974:     }
1.6       tsai      975: }
                    976: 
                    977: sub end_randomlist {
1.159     albertel  978:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    979:     my $result;
                    980:     if ($target eq 'edit' ) {
                    981: 	$result=&Apache::edit::tag_end($target,$token,
                    982: 				       'End Randomly Parsed Block');
                    983:     }
                    984:     return $result;
1.6       tsai      985: }
                    986: 
1.11      albertel  987: sub start_part {
1.159     albertel  988:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    989:     my $result='';
                    990:     my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);
                    991:     if ($id eq '') { $id = $Apache::lonxml::curdepth; }
                    992:     $Apache::inputtags::part=$id;
1.177     albertel  993:     push(@Apache::inputtags::partlist,$id);
                    994:     @Apache::inputtags::response=();
1.159     albertel  995:     @Apache::inputtags::previous=();
                    996:     @Apache::inputtags::previous_version=();
1.169     albertel  997:     $Apache::lonhomework::problemstatus=
                    998: 	&Apache::lonnet::EXT("resource.$id.problemstatus");
1.159     albertel  999:     my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
1.214     albertel 1000:     my $expression='$external::part=\''.$Apache::inputtags::part.'\';';
1.209     albertel 1001:     &Apache::run::run($expression,$safeeval);
1.159     albertel 1002: 
                   1003:     if ($target eq 'meta') {
1.224     www      1004: 	my $display=&Apache::lonxml::get_param('display',$parstack,$safeeval);
                   1005: 	return &Apache::response::mandatory_part_meta.
                   1006: 	       &Apache::response::meta_parameter_write('display','string',$display,'Part Description');
1.159     albertel 1007:     } elsif ($target eq 'web' || $target eq 'grade' ||
                   1008: 	     $target eq 'answer' || $target eq 'tex') {
                   1009: 	if ($hidden) {
                   1010: 	    my $bodytext=&Apache::lonxml::get_all_text("/part",$parser);
                   1011: 	} else {
                   1012: 	    my ($status,$accessmsg) = &Apache::lonhomework::check_access($id);
                   1013: 	    push (@Apache::inputtags::status,$status);
                   1014: 	    my $expression='$external::datestatus="'.$status.'";';
                   1015: 	    $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$id.solved"}.'";';
                   1016: 	    &Apache::run::run($expression,$safeeval);
1.240   ! albertel 1017: 	    if ($ENV{'request.state'} eq 'construct') {
        !          1018: 		&set_problem_status($Apache::inputtags::part); 
        !          1019: 	    }
1.216     albertel 1020: 	    if (( $status eq 'CLOSED' ) ||
                   1021: 		( $status eq 'UNCHECKEDOUT') ||
                   1022: 		( $status eq 'BANNED') ||
                   1023: 		( $status eq 'UNAVAILABLE') ||
                   1024: 		( $status eq 'INVALID_ACCESS')) {
1.159     albertel 1025: 		my $bodytext=&Apache::lonxml::get_all_text("/part",$parser);
                   1026: 		if ( $target eq "web" ) {
1.211     albertel 1027: 		    $result="<br />".&mt('Part is not open to be viewed. It')." $accessmsg<br />";
1.159     albertel 1028: 		} elsif ( $target eq 'tex' ) {
1.195     sakharuk 1029: 		    if (not $ENV{'form.problem_split'}=~/yes/) {
1.211     albertel 1030: 			$result="\\end{minipage}\\vskip 0 mm ".&mt('Part is not open to be viewed. It')." $accessmsg \\\\\\begin{minipage}{\\textwidth}";
1.195     sakharuk 1031: 		    } else {
1.211     albertel 1032: 			$result="\\vskip 0 mm ".&mt('Part is not open to be viewed. It')." $accessmsg \\\\";
1.195     sakharuk 1033: 		    }
1.159     albertel 1034: 		}
                   1035: 	    } else {
                   1036: 		if ($target eq 'tex') {
1.195     sakharuk 1037: 		    if (not $ENV{'form.problem_split'}=~/yes/) {
                   1038: 			$result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent';
                   1039: 		    }
1.159     albertel 1040: 		    my $weight = &Apache::lonnet::EXT("resource.$id.weight");
1.230     albertel 1041: 		    my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'packages');
1.222     sakharuk 1042: 		    my @allkeys = split /,/,$allkeys;
                   1043: 		    my $allow_print_points = 0;
                   1044: 		    foreach my $partial_key (@allkeys) {
1.230     albertel 1045: 			if ($partial_key=~m/^part_(.*)$/) {
1.222     sakharuk 1046: 			    if ($1 ne '0') {$allow_print_points=1;}
                   1047: 			}
                   1048: 		    }
                   1049: 		    if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
1.233     www      1050: 		} elsif ($target eq 'web') {
                   1051: 		    $result.='<a name="'.&Apache::lonnet::escape($Apache::inputtags::part).'" />';
1.159     albertel 1052: 		}
                   1053: 	    }
                   1054: 	}
                   1055:     } elsif ($target eq 'edit') {
                   1056: 	$result.=&Apache::edit::tag_start($target,$token);
                   1057: 	$result.=&Apache::edit::text_arg('Part ID:','id',$token).
                   1058: 	    &Apache::loncommon::help_open_topic("Part_Tag_Edit_Help").
1.224     www      1059: 	    '&nbsp;&nbsp;'.
                   1060: &Apache::edit::text_arg('Displayed Part Description:','display',$token).
1.159     albertel 1061: 		&Apache::edit::end_row().&Apache::edit::start_spanning_row();
                   1062:     } elsif ($target eq 'modified') {
                   1063: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
1.225     albertel 1064: 						     $safeeval,'id','display');
1.159     albertel 1065: 	if ($constructtag) {
1.225     albertel 1066: 	    #limiting ids to only letters numbers, and space
1.224     www      1067: 	    $token->[2]->{'id'}=~s/[^A-Za-z0-9 ]//gs;
1.159     albertel 1068: 	    $result = &Apache::edit::rebuild_tag($token);
                   1069: 	    $result.=&Apache::edit::handle_insert();
                   1070: 	}
                   1071:     }
                   1072:     return $result;
1.11      albertel 1073: }
                   1074: 
                   1075: sub end_part {
1.159     albertel 1076:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1077:     &Apache::lonxml::debug("in end_part $target ");
                   1078:     my $status=$Apache::inputtags::status['-1'];
                   1079:     my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
                   1080:     my $result='';
                   1081:     if ( $target eq 'meta' ) {
                   1082: 	$result='';
1.232     albertel 1083:     } elsif ($target eq 'grade' && 
                   1084: 	     ($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) &&
                   1085: 	     !$hidden) {
1.159     albertel 1086: 	$result=&Apache::inputtags::grade;
                   1087:     } elsif (($target eq 'web' || $target eq 'tex') && !$hidden ) {
                   1088: 	my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part,
                   1089: 							$target);
1.212     albertel 1090: 	if ($Apache::lonhomework::type eq 'exam' && $target eq 'tex') {
                   1091: 	    $gradestatus='';
                   1092: 	}
1.159     albertel 1093: 	$result=$gradestatus;
1.181     albertel 1094:     } elsif ($target eq 'edit') {
                   1095: 	$result=&Apache::edit::end_table();
1.159     albertel 1096:     }
                   1097:     pop @Apache::inputtags::status;
                   1098:     $Apache::inputtags::part='';
                   1099:     return $result;
1.11      albertel 1100: }
1.1       albertel 1101: 
1.25      albertel 1102: sub start_preduedate {
1.159     albertel 1103:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1104:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') {
1.236     albertel 1105: 	&Apache::lonxml::debug("State in preduedate is ". $Apache::inputtags::status['-1']);
1.159     albertel 1106: 	if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&
1.236     albertel 1107: 	    $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') {
                   1108: 	    &Apache::lonxml::debug("Wha? ". ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER'));
1.159     albertel 1109: 	    &Apache::lonxml::get_all_text("/preduedate",$parser);
                   1110: 	}
1.24      albertel 1111:     }
1.159     albertel 1112:     return '';
1.24      albertel 1113: }
                   1114: 
1.25      albertel 1115: sub end_preduedate {
1.159     albertel 1116:     return '';
1.24      albertel 1117: }
                   1118: 
1.25      albertel 1119: sub start_postanswerdate {
1.159     albertel 1120:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.234     albertel 1121:     if ($target eq 'web' || $target eq 'grade') {
1.159     albertel 1122: 	if ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') {
                   1123: 	    &Apache::lonxml::get_all_text("/postanswerdate",$parser);
                   1124: 	}
                   1125:     } elsif ($target eq 'tex') {
1.234     albertel 1126: 	&Apache::lonxml::get_all_text("/postanswerdate",$parser);
1.159     albertel 1127:     }
                   1128:     return '';
1.24      albertel 1129: }
                   1130: 
1.25      albertel 1131: sub end_postanswerdate {
1.159     albertel 1132:     return '';
1.24      albertel 1133: }
                   1134: 
1.25      albertel 1135: sub start_notsolved {
1.159     albertel 1136:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1137:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
                   1138: 	$target eq 'tex') {
                   1139: 	my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
                   1140: 	&Apache::lonxml::debug("not solved has :$gradestatus:");
1.239     albertel 1141: 	if ($gradestatus =~ /^correct/ &&
                   1142: 	    &Apache::response::show_answer()) {
1.159     albertel 1143: 	    &Apache::lonxml::debug("skipping");
                   1144: 	    &Apache::lonxml::get_all_text("/notsolved",$parser);
                   1145: 	}
1.24      albertel 1146:     }
1.159     albertel 1147:     return '';
1.24      albertel 1148: }
                   1149: 
1.25      albertel 1150: sub end_notsolved {
1.159     albertel 1151:     return '';
1.24      albertel 1152: }
                   1153: 
                   1154: sub start_solved {
1.159     albertel 1155:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1156:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
                   1157: 	$target eq 'tex') {
                   1158: 	my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
1.239     albertel 1159: 	if ($gradestatus !~ /^correct/ ||
                   1160: 	    !&Apache::response::show_answer()) {
1.159     albertel 1161: 	    &Apache::lonxml::get_all_text("/solved",$parser);
                   1162: 	}
1.24      albertel 1163:     }
1.159     albertel 1164:     return '';
1.24      albertel 1165: }
                   1166: 
                   1167: sub end_solved {
1.159     albertel 1168:     return '';
1.24      albertel 1169: }
1.34      albertel 1170: 
                   1171: sub start_startouttext {
1.159     albertel 1172:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1173:     my @result=(''.'');
                   1174:     if ($target eq 'edit' || $target eq 'modified' ) { @result=('','no'); }
                   1175:     return (@result);
1.34      albertel 1176: }
1.159     albertel 1177: 
1.34      albertel 1178: sub end_startouttext {
1.159     albertel 1179:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1180:     my $result='';
                   1181:     my $text='';
                   1182: 
                   1183:     if ($target eq 'edit') {
                   1184: 	$text=&Apache::lonxml::get_all_text("endouttext",$parser);
1.211     albertel 1185: 	$result.=&Apache::edit::start_table($token)."<tr><td>".&mt('Text Block')."</td>
                   1186: <td>".&mt('Delete:').
1.159     albertel 1187:                  &Apache::edit::deletelist($target,$token)
                   1188: 		 ."</td>
1.42      albertel 1189: <td>".
1.159     albertel 1190:                  &Apache::edit::insertlist($target,$token).
                   1191: 		 &Apache::edit::end_row().
                   1192:                  &Apache::edit::start_spanning_row()."\n"
1.188     bowersj2 1193: 		 . &Apache::loncommon::helpLatexCheatsheet () .
1.159     albertel 1194: 		 &Apache::edit::editfield($token->[1],$text,"",80,4);
                   1195:     }
                   1196:     if ($target eq 'modified') {
1.219     albertel 1197: 	$result='<startouttext />'.&Apache::edit::modifiedfield("endouttext",$parser);
1.159     albertel 1198:     }
                   1199:     if ($target eq 'tex') {
                   1200: 	$result .= '\noindent ';
                   1201:     }
                   1202:     return $result;
1.34      albertel 1203: }
1.159     albertel 1204: 
1.34      albertel 1205: sub start_endouttext {
1.159     albertel 1206:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1207:     my $result='';
                   1208:     if ($target eq "edit" ) { $result="</td></tr>".&Apache::edit::end_table()."\n"; }
                   1209:     if ($target eq "modified") {
                   1210: 	$result='<endouttext />'.
                   1211: 	    &Apache::edit::handle_insertafter('startouttext'); }
                   1212:     return $result;
1.34      albertel 1213: }
1.159     albertel 1214: 
1.34      albertel 1215: sub end_endouttext {
1.159     albertel 1216:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1217:     my @result=('','');
                   1218:     if ($target eq "edit" || $target eq 'modified') { @result=('','no'); }
                   1219:     return (@result);
1.34      albertel 1220: }
1.159     albertel 1221: 
1.45      albertel 1222: sub delete_startouttext {
1.159     albertel 1223:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1224:     #  my $text=&Apache::lonxml::get_all_text("endouttext",$parser);
                   1225:     my $text=$$parser['-1']->get_text("/endouttext");
                   1226:     my $ntoken=$$parser['-1']->get_token();
                   1227:     &Apache::lonxml::debug("Deleting :$text: and :$ntoken->[0]:$ntoken->[1]:$ntoken->[2]: for startouttext");
                   1228:     &Apache::lonxml::end_tag($tagstack,$parstack,$ntoken);
                   1229:     # Deleting 2 parallel tag pairs, but we need the numbers later to look like
                   1230:     # they did the last time round
                   1231:     &Apache::lonxml::increasedepth($ntoken);
                   1232:     &Apache::lonxml::decreasedepth($ntoken);
                   1233:     return 1;
1.193     www      1234: }
                   1235: 
                   1236: sub start_simpleeditbutton {
                   1237:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1238:     my $result='';
                   1239:     if (($target eq 'web') &&
                   1240:         (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
1.220     www      1241:         my $url=$ENV{'request.noversionuri'};
1.193     www      1242:         $url=~s/\?.*$//;
1.194     www      1243: 	$result='<table width="100%" bgcolor="#FFFFAA" border="2"><tr><td>'.
1.211     albertel 1244:                 '<a href="'.$url.'/smpedit">'.&mt('Simple Problem Editor').'</a> - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.').
1.196     www      1245: &Apache::loncommon::help_open_topic('Caching').'</td></tr></table><br />';
1.193     www      1246:     }
                   1247:     return $result;
                   1248: }
                   1249: 
                   1250: sub end_simpleeditbutton {
                   1251:     return '';
1.45      albertel 1252: }
1.34      albertel 1253: 
1.1       albertel 1254: 1;
                   1255: __END__

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>