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

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.241   ! albertel    4: # $Id: structuretags.pm,v 1.240 2004/02/16 20:01:26 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');
1.241   ! albertel  339: 
        !           340: 	$Apache::lonhomework::problemstatus=&get_problem_status('0')
1.204     albertel  341:     } else {
                    342: 	$Apache::inputtags::part='';
                    343: 	@Apache::inputtags::partlist=();
                    344: 	$Apache::lonhomework::problemstatus='';	
                    345:     }
                    346:     @Apache::inputtags::responselist = ();
                    347:     @Apache::inputtags::importlist = ();
                    348:     @Apache::inputtags::previous=();
                    349:     @Apache::inputtags::previous_version=();
                    350:     $Apache::structuretags::printanswer='No';
                    351:     @Apache::structuretags::whileconds=();
                    352:     @Apache::structuretags::whilebody=();
                    353:     @Apache::structuretags::whileline=();
                    354:     $Apache::lonhomework::scantronmode=0;
                    355:     undef($Apache::lonhomework::name);
                    356: 
                    357: }
                    358: 
                    359: sub reset_problem_globals {
                    360:     my ($type)=@_;
                    361:     undef(%Apache::lonhomework::history);
                    362:     undef(%Apache::lonhomework::results);
                    363:     undef($Apache::inputtags::part);
1.208     albertel  364: #don't undef this, lonhomework.pm takes care of this, we use this to 
                    365: #detect if we try to do 2 problems in one file
                    366: #   undef($Apache::lonhomework::parsing_a_problem);
1.204     albertel  367:     undef($Apache::lonhomework::name);
                    368: }
                    369: 
1.241   ! albertel  370: sub set_problem_state {
1.240     albertel  371:     my ($part)=@_;
                    372:     if ($ENV{'form.problemstate'} eq 'CANNOT_ANSWER_correct') {
                    373: 	$Apache::lonhomework::history{"resource.$part.solved"}=
                    374: 	    'correct_by_student';
                    375:     }
                    376: }
                    377: 
1.241   ! albertel  378: sub get_problem_status {
        !           379:     my ($part)=@_;
        !           380:     my $problem_status=&Apache::lonnet::EXT("resource.$part.problemstatus");
        !           381:     &Apache::lonxml::debug("problem status for $part is $problem_status");
        !           382:     &Apache::lonxml::debug("env probstat is ".$ENV{'form.problemstatus'});
        !           383:     if ($ENV{'request.state'} eq 'construct' &&
        !           384: 	defined($ENV{'form.problemstatus'})) {
        !           385: 	$problem_status=$ENV{'form.problemstatus'};
        !           386:     }
        !           387:     return $problem_status;
        !           388: }
        !           389: 
1.9       albertel  390: sub start_problem {
1.159     albertel  391:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.19      albertel  392: 
1.184     albertel  393:     if ( $Apache::inputtags::part ne '' ||
                    394: 	 $Apache::lonhomework::parsing_a_problem) {
                    395: 	&Apache::lonxml::error('Only one &lt;problem&gt; allowed in a .problem file');
                    396: 	#my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser);
1.159     albertel  397: 	return '';
                    398:     }
1.184     albertel  399: 
                    400:     $Apache::lonhomework::parsing_a_problem=1;
1.204     albertel  401:     &init_problem_globals('problem');
1.166     albertel  402: 
                    403:     if (defined($ENV{'scantron.maxquest'})) {
                    404: 	$Apache::lonhomework::scantronmode=1;
                    405:     }
1.161     albertel  406: 
1.159     albertel  407:     if ($target ne 'analyze') {
                    408: 	&initialize_storage();
                    409: 	if ($target eq 'web') {
                    410: 	    &Apache::lonhomework::showhash(%Apache::lonhomework::history);
1.238     albertel  411: 	}
1.241   ! albertel  412:        	if ($ENV{'request.state'} eq 'construct') { &set_problem_state('0'); }
1.159     albertel  413: 	$Apache::lonhomework::type=&Apache::lonnet::EXT('resource.0.type');
1.237     albertel  414: 	if (($ENV{'request.state'} eq 'construct') &&
                    415: 	    defined($ENV{'form.problemtype'})) {
                    416: 	    $Apache::lonhomework::type=$ENV{'form.problemtype'};
                    417: 	}
1.240     albertel  418: 	&Apache::lonxml::debug("Found this to be of type :$Apache::ltonhomework::type:");
1.159     albertel  419:     }
1.164     albertel  420:     if ($Apache::lonhomework::type eq '' ) {
1.159     albertel  421: 	my $uri=$ENV{'request.uri'};
                    422: 	if ($uri=~/\.(\w+)$/) {
                    423: 	    $Apache::lonhomework::type=$1;
                    424: 	    &Apache::lonxml::debug("Using type of $1");
                    425: 	} else {
                    426: 	    $Apache::lonhomework::type='problem';
                    427: 	    &Apache::lonxml::debug("Using default type, problem, :$uri:");
                    428: 	}
1.87      albertel  429:     }
1.58      www       430: 
1.159     albertel  431:     #added vars to the scripting enviroment
1.213     albertel  432:     my $expression='$external::part=\''.$Apache::inputtags::part.'\';';
1.24      albertel  433:     &Apache::run::run($expression,$safeeval);
1.159     albertel  434:     my $status;
                    435:     my $accessmsg;
                    436: 
                    437:     #should get back a <html> or the neccesary stuff to start XML/MathML
                    438:     my ($result,$head_tag_start,$body_tag_start,$form_tag_start)=
                    439: 	&page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
                    440:     if ($target eq 'tex' and $ENV{'request.symb'} =~ m/\.page_/) {$result='';}
                    441: 
                    442:     if ($target eq 'analyze') { my $rndseed=&setup_rndseed($safeeval); }
                    443:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
                    444: 	$target eq 'tex') {
                    445: 	#handle exam checkout
                    446: 	if ($Apache::lonhomework::type eq 'exam') {
                    447: 	    my $token=
                    448: 		$Apache::lonhomework::history{"resource.0.outtoken"};
                    449: 	    if (($ENV{'form.doescheckout'}) && (!$token)) {
                    450: 		$token=&Apache::lonxml::maketoken();
                    451: 		$Apache::lonhomework::history{"resource.0.outtoken"}=
                    452: 		    $token;
                    453: 	    }
                    454: 	    $body_tag_start.=&Apache::lonxml::printtokenheader($target,$token);
1.142     albertel  455: 	}
1.159     albertel  456: 
                    457: 	#handle rand seed in construction space
                    458: 	my $rndseed=&setup_rndseed($safeeval);
1.162     albertel  459: 	my ($symb)=&Apache::lonxml::whichuser();
1.163     albertel  460: 	if ($ENV{'request.state'} ne "construct" && $symb eq '') {
1.162     albertel  461: 	    $form_tag_start.='<input type="hidden" name="rndseed" value="'.
                    462: 		$rndseed.'" />'.
                    463: 		    '<input type="submit" name="resetdata"
1.211     albertel  464:                              value="'.&mt('New Problem Variation').'" />'.
1.164     albertel  465: 		    '<input type="hidden" name="username"
1.185     albertel  466:                              value="'.$ENV{'form.username'}.'" /> <br />';
1.162     albertel  467: 	}
1.159     albertel  468: 	($status,$accessmsg) = &Apache::lonhomework::check_access('0');
                    469: 	push (@Apache::inputtags::status,$status);
                    470: 	my $expression='$external::datestatus="'.$status.'";';
                    471: 	$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.0.solved"}.'";';
                    472: 	&Apache::run::run($expression,$safeeval);
                    473: 	&Apache::lonxml::debug("Got $status");
                    474: 	if (( $status eq 'CLOSED' ) ||
                    475: 	    ( $status eq 'UNCHECKEDOUT') ||
                    476: 	    ( $status eq 'BANNED') ||
1.216     albertel  477: 	    ( $status eq 'UNAVAILABLE') ||
                    478: 	    ( $status eq 'INVALID_ACCESS')) {
1.159     albertel  479: 	    my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser);
                    480: 	    if ( $target eq "web" ) {
                    481: 		$result.= $head_tag_start.'</head>';
                    482: 		my $msg=$body_tag_start;
                    483: 		if ($status eq 'UNAVAILABLE') {
1.211     albertel  484: 		    $result.='<h1>'.&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'</h1>';
1.159     albertel  485: 		} else {
1.211     albertel  486: 		    $result.='<h1>'.&mt('Not open to be viewed').'</h1>';
1.159     albertel  487: 		}
1.216     albertel  488: 		if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') {
1.159     albertel  489: 		    $msg.='The problem '.$accessmsg;
                    490: 		} elsif ($status eq 'UNCHECKEDOUT') {
                    491: 		    $msg.=&checkout_msg;
                    492: 		}
                    493: 		$result.=$msg.'<br />';
                    494: 	    } elsif ($target eq 'tex') {
                    495: 		$result.='\begin{document}\noindent \vskip 1 mm  \begin{minipage}{\textwidth}\vskip 0 mm';
                    496: 		if ($status eq 'UNAVAILABLE') {
1.211     albertel  497: 		    $result.=&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'\vskip 0 mm ';
1.159     albertel  498: 		} else {
1.211     albertel  499: 		    $result.=&mt('Problem is not open to be viewed. It')." $accessmsg \\vskip 0 mm ";
1.159     albertel  500: 		}
                    501: 	    }
                    502: 	} elsif ($target eq 'web') {
                    503: 	    my $name= &get_resource_name($parstack,$safeeval);
1.227     albertel  504: 	    $result.="$head_tag_start<title>$name</title></head>
1.158     sakharuk  505:               $body_tag_start \n $form_tag_start".	
1.227     albertel  506: 	      '<input type="hidden" name="submitted" value="yes" />';
                    507: 	    # create a page header and exit
                    508: 	    if ($ENV{'request.state'} eq "construct") {
                    509: 		$result.= &problem_web_to_edit_header($ENV{'form.rndseed'});
                    510: 	    }
                    511: 	    # if we are viewing someone else preserve that info
                    512: 	    if (defined $ENV{'form.grade_symb'}) {
                    513: 		foreach my $field ('symb','courseid','domain','username') {
                    514: 		    $result .= '<input type="hidden" name="grade_'.$field.
                    515: 			'" value="'.$ENV{"form.grade_$field"}.'" />'."\n";
1.159     albertel  516: 		}
                    517: 	    }
                    518: 	} elsif ($target eq 'tex') {
1.192     sakharuk  519: 	    my $startminipage = '';
1.191     sakharuk  520: 	    if (not $ENV{'form.problem_split'}=~/yes/) {
1.192     sakharuk  521: 		$startminipage = '\begin{minipage}{\textwidth}';
1.178     sakharuk  522: 	    }
1.159     albertel  523: 	    my $id = $Apache::inputtags::part;
                    524: 	    my $weight = &Apache::lonnet::EXT("resource.$id.weight");
1.223     sakharuk  525: 	    my $packages=&Apache::lonnet::metadata($ENV{'request.uri'},'packages');
                    526: 	    my @packages = split /,/,$packages;
                    527: 	    my $allow_print_points = 0;
                    528: 	    foreach my $partial_key (@packages) {
1.230     albertel  529: 		if ($partial_key=~m/^part_0$/) {
1.223     sakharuk  530: 		    $allow_print_points=1;
1.159     albertel  531: 		}
                    532: 	    }
                    533: 	    my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); 
                    534: 	    $duedate = POSIX::strftime("%c",localtime($duedate));
                    535: 	    my $temp_file;
                    536: 	    my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.due";
                    537: 	    if (-e $filename) {
                    538: 		$temp_file = Apache::File->new($filename);
                    539: 	    } else {
                    540: 		$temp_file = Apache::File->new('>>'.$filename);
                    541: 	    }
                    542: 	    my @due_file_content = <$temp_file>;
                    543: 	    my $due_file_content = $due_file_content[$#due_file_content];
                    544: 	    chomp $due_file_content;
1.231     sakharuk  545: 	    my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval));
1.159     albertel  546: 	    if ($due_file_content ne $duedate) {
                    547: 		$temp_file = Apache::File->new('>'.$filename);
                    548: 		print $temp_file "$duedate\n";
                    549: 		if (not $ENV{'request.symb'} =~ m/\.page_/) {
                    550: 		    if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') {
1.206     sakharuk  551: 			$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  552: 		    } else {
1.206     sakharuk  553: 			$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  554: 			if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
                    555: 		    }
1.104     sakharuk  556: 		} else {
1.159     albertel  557: 		    $result .= '\vskip 1mm\textit{Due date: '.$duedate.'} \\\\\\\\';
1.104     sakharuk  558: 		}
1.101     sakharuk  559: 	    } else {
1.159     albertel  560: 		if (not $ENV{'request.symb'} =~ m/\.page_/) {
1.206     sakharuk  561: 		    $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  562: 		    if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
                    563: 		} else {
                    564: 		    $result .= '\vskip 1mm \\\\\\\\';
                    565: 		}
                    566: 	    }
1.99      sakharuk  567: 	}
1.159     albertel  568:     } elsif ($target eq 'edit') {
                    569: 	$result.=$head_tag_start."</head>".$body_tag_start.$form_tag_start.
                    570: 	    &problem_edit_header();
1.226     albertel  571: 	$Apache::lonxml::warnings_error_header=
                    572: 	    &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  573: 	my $temp=&Apache::edit::insertlist($target,$token);
                    574: 	$result.=$temp;
                    575:     } elsif ($target eq 'modified') {
                    576: 	$result=$token->[4];
                    577: 	$result.=&Apache::edit::handle_insert();
                    578:     } else {
                    579: 	# page_start returned a starting result, delete it if we don't need it
                    580: 	$result = '';
1.99      sakharuk  581:     }
1.159     albertel  582:     return $result;
1.9       albertel  583: }
                    584: 
                    585: sub end_problem {
1.159     albertel  586:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    587:     my $result='';
                    588:     my $status=$Apache::inputtags::status['-1'];
                    589:     if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
                    590: 	$target eq 'tex') {
                    591: 	if ( $target eq 'grade' && $Apache::inputtags::part eq '0' &&
1.232     albertel  592: 	     ($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode)) {
1.159     albertel  593: 	    # if part is zero, no <part>s existed, so we need to the grading
                    594: 	    &Apache::inputtags::grade;
                    595: 	} elsif ( ($target eq 'web' || $target eq 'tex') &&
                    596: 		  $Apache::inputtags::part eq '0' &&
                    597: 		  $status ne 'UNCHECKEDOUT') {
                    598: 	    # if part is zero, no <part>s existed, so we need show the current
                    599: 	    # grading status
                    600: 	    my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part,$target);
                    601: 	    $result.= $gradestatus;
                    602: 	}
                    603: 	if (
                    604: 	    (($target eq 'web') && ($ENV{'request.state'} ne 'construct')) ||
                    605: 	    ($target eq 'answer') || ($target eq 'tex')
                    606: 	   ) {
1.227     albertel  607: 	    if ($target ne 'tex' &&
                    608: 		$ENV{'form.answer_output_mode'} ne 'tex') {
                    609: 		$result.="</form></body>\n";
1.159     albertel  610: 	    }
                    611: 	    if ($target eq 'web') {
                    612: 		$result.=&Apache::lonxml::xmlend();
                    613: 	    } elsif ($target eq 'tex') {
1.178     sakharuk  614: 		my $endminipage = '';
1.191     sakharuk  615: 		if (not $ENV{'form.problem_split'}=~/yes/) {
1.178     sakharuk  616: 		    $endminipage = '\end{minipage}';
                    617: 		}
1.174     sakharuk  618: 		$result .= '\keephidden{ENDOFPROBLEM}\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}';
1.159     albertel  619: 		if (not $ENV{'request.symb'} =~ m/\.page_/) {
1.178     sakharuk  620: 		    $result .= $endminipage.'\end{document} ';
1.159     albertel  621: 		} else {
                    622: 		    $result .= '';
                    623: 		}
                    624: 	    }
                    625: 	}
                    626: 	if ($target eq 'grade') {
                    627: 	    &Apache::lonhomework::showhash(%Apache::lonhomework::results);
                    628: 	    &finalize_storage();
                    629: 	}
1.172     albertel  630: 	if ($target eq 'answer' && ($ENV{'request.state'} eq 'construct')
1.173     albertel  631: 	    && $ENV{'form.answer_output_mode'} ne 'tex') {
1.172     albertel  632: 	    $result.='</html>'; # normally we get it from xmlend, but in CSTR
                    633: 	                        # we always show answer mode too.
1.159     albertel  634: 	}
                    635:     } elsif ($target eq 'meta') {
                    636: 	if ($Apache::inputtags::part eq '0') {
1.179     albertel  637: 	    @Apache::inputtags::response=();
1.159     albertel  638: 	    $result=&Apache::response::mandatory_part_meta;
                    639: 	}
1.215     albertel  640: 	$result.=&Apache::response::meta_part_order();
1.159     albertel  641:     } elsif ($target eq 'edit') {
                    642: 	&Apache::lonxml::debug("in end_problem with $target, edit");
                    643: 	$result = &problem_edit_footer();
                    644:     }
1.155     albertel  645: 
1.177     albertel  646:     if ($ENV{'request.state'} eq 'construct' && $target eq 'web') {
                    647: 	&Apache::inputtags::check_for_duplicate_ids();
                    648:     }
1.204     albertel  649: 
                    650:     &reset_problem_globals('problem');
1.159     albertel  651: 
                    652:     return $result;
1.48      albertel  653: }
                    654: 
1.108     albertel  655: 
1.48      albertel  656: sub start_library {
1.159     albertel  657:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    658:     my ($result,$head_tag_start,$body_tag_start,$form_tag_start);
1.204     albertel  659:     if ($$tagstack[0] eq 'library') { &init_problem_globals('library') };
1.159     albertel  660:     if ($target eq 'edit') {
                    661: 	($result,$head_tag_start,$body_tag_start,$form_tag_start)=
                    662: 	    &page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
                    663: 	$result.=$head_tag_start."</head>".$body_tag_start.$form_tag_start.
                    664: 	    &problem_edit_header();
                    665: 	my $temp=&Apache::edit::insertlist($target,$token);
                    666: 	$result.=$temp;
                    667:     } elsif ($target eq 'modified') {
                    668: 	$result=$token->[4];
                    669: 	$result.=&Apache::edit::handle_insert();
                    670:     } elsif ($target eq 'web' && $$tagstack[0] ne 'problem' &&
                    671: 	     $ENV{'request.state'} eq "construct" ) {
                    672: 	($result,$head_tag_start,$body_tag_start,$form_tag_start)=
                    673: 	    &page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
                    674: 	my $name=&get_resource_name($parstack,$safeeval);
                    675: 	my $rndseed=&setup_rndseed($safeeval);
                    676: 	$result.="$head_tag_start<title>$name</title></head>
1.105     albertel  677:               $body_tag_start \n $form_tag_start".	
1.159     albertel  678: 		  '<input type="hidden" name="submitted" value="yes" />';
                    679: 	$result.=&problem_web_to_edit_header($rndseed);
                    680:     }
                    681:     return $result;
1.48      albertel  682: }
                    683: 
                    684: sub end_library {
1.159     albertel  685:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    686:     my $result='';
                    687:     if ($target eq 'edit') {
                    688: 	$result=&problem_edit_footer();
                    689:     } elsif ($target eq 'web' && $$tagstack[0] ne 'problem' &&
                    690: 	     $ENV{'request.state'} eq "construct") {
                    691: 	$result.='</form></body>'.&Apache::lonxml::xmlend();
                    692:     }
1.204     albertel  693:     if ($$tagstack[0] eq 'library') { &reset_problem_globals('library') };
1.159     albertel  694:     return $result;
1.197     www       695: }
                    696: 
                    697: sub start_definetag {
                    698:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    699: 
                    700:     my $result;
                    701: 
                    702:     my $name = $token->[2]->{'name'};
                    703:     my $skip=&Apache::lonxml::get_all_text("/definetag",$parser);
                    704:     if ($name=~/^\//) {
                    705: 	$result=
                    706:  '<br /><table bgcolor="#FFBBBB"><tr><th>END <tt>'.$name.'</tt></th></tr>';
                    707:     } else {
                    708: 	$result=
                    709:  '<br /><table bgcolor="#BBFFBB"><tr><th>BEGIN <tt>'.$name.'</tt></th></tr>';
                    710:     }
                    711:     $skip=~s/\</\&lt\;/gs;
                    712:     $skip=~s/\>/\&gt\;/gs;
                    713:     $result.='<tr><td><pre>'.$skip.'</pre></td></tr></table>';
                    714:     return $result;
                    715: }
                    716: 
                    717: sub end_definetag {
                    718:     return '';
1.1       albertel  719: }
                    720: 
                    721: sub start_block {
1.201     albertel  722:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
1.131     albertel  723: 
                    724:     my $result;
1.1       albertel  725: 
1.160     albertel  726:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
1.131     albertel  727: 	$target eq 'tex' || $target eq 'analyze') {
1.159     albertel  728: 	my $code = $token->[2]->{'condition'};
1.201     albertel  729: 	if (defined($code)) {
1.137     albertel  730: 	    if (!$Apache::lonxml::default_homework_loaded) {
                    731: 		&Apache::lonxml::default_homework_load($safeeval);
                    732: 	    }
1.131     albertel  733: 	    $result = &Apache::run::run($code,$safeeval);
                    734: 	    &Apache::lonxml::debug("block :$code: returned :$result:");
                    735: 	} else {
                    736: 	    $result='1';
                    737: 	}
                    738: 	if ( ! $result ) {
1.201     albertel  739: 	    my $skip=&Apache::lonxml::get_all_text("/block",$parser,$style);
1.131     albertel  740: 	    &Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]");
                    741: 	}
                    742: 	$result='';
                    743:     } elsif ($target eq 'edit') {
                    744: 	$result .=&Apache::edit::tag_start($target,$token);
                    745: 	$result .=&Apache::edit::text_arg('Test Condition:','condition',
                    746: 					  $token,40);
                    747: 	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
                    748:     } elsif ($target eq 'modified') {
                    749: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
                    750: 						     $safeeval,'condition');
                    751: 	if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
1.38      albertel  752:     }
1.131     albertel  753:     return $result;
1.1       albertel  754: }
                    755: 
                    756: sub end_block {
1.167     www       757:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    758:     my $result;
                    759:     if ($target eq "edit") {
                    760: 	$result.= &Apache::edit::tag_end($target,$token,'');
                    761:     }
                    762:     return $result;
                    763: }
                    764: 
                    765: sub start_languageblock {
1.201     albertel  766:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
1.167     www       767: 
                    768:     my $result;
                    769: 
                    770:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
                    771: 	$target eq 'tex' || $target eq 'analyze') {
1.201     albertel  772: 	my $include = $token->[2]->{'include'};
                    773: 	my $exclude = $token->[2]->{'exclude'};
                    774:         my %languages=&Apache::loncommon::display_languages();
                    775:         $result='1';
                    776: 	if ($include) {
                    777:             $result='';
                    778:             foreach (split(/\,/,$include)) {
                    779:                 if ($languages{$_}) { $result='1'; }
                    780:             }
                    781: 	}
                    782:         if ($exclude) {
                    783:             foreach (split(/\,/,$exclude)) {
                    784:                 if ($languages{$_}) { $result='0'; }
                    785:             }
                    786: 	}
                    787: 	if ( ! $result ) {
                    788: 	    my $skip=&Apache::lonxml::get_all_text("/languageblock",$parser,
                    789: 						   $style);
                    790: 	    &Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]");
                    791: 	}
                    792: 	$result='';
1.167     www       793:     } elsif ($target eq 'edit') {
                    794: 	$result .=&Apache::edit::tag_start($target,$token);
1.211     albertel  795: 	$result .=&Apache::edit::text_arg(&mt('Include Language:'),'include',
1.167     www       796: 					  $token,40);
1.211     albertel  797: 	$result .=&Apache::edit::text_arg(&mt('Exclude Language:'),'exclude',
1.167     www       798: 					  $token,40);
                    799: 	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
                    800:     } elsif ($target eq 'modified') {
                    801: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
1.168     albertel  802: 						     $safeeval,'include',
                    803: 						     'exclude');
1.167     www       804: 	if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
                    805:     }
                    806:     return $result;
                    807: }
                    808: 
                    809: sub end_languageblock {
1.170     www       810:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    811:     my $result;
1.201     albertel  812:     if ($target eq "edit") {
1.170     www       813: 	$result.= &Apache::edit::tag_end($target,$token,'');
                    814:     }
                    815:     return $result;
                    816: }
                    817: 
                    818: sub start_instructorcomment {
1.201     albertel  819:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
1.170     www       820: 
                    821:     my $result;
                    822: 
                    823:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
                    824: 	$target eq 'tex' || $target eq 'analyze') {
                    825:         $result=($ENV{'request.role'}=~/^(in|cc|au|ca|li)/);
                    826: 	if ( ! $result ) {
1.201     albertel  827: 	    my $skip=&Apache::lonxml::get_all_text("/instructorcomment",
                    828: 						   $parser,$style);
1.170     www       829: 	    &Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]");
                    830: 	}
                    831: 	$result='';
                    832:     } elsif ($target eq 'edit') {
                    833: 	$result .=&Apache::edit::tag_start($target,$token);
                    834: 	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
                    835:     }
                    836:     return $result;
                    837: }
                    838: 
                    839: sub end_instructorcomment {
1.159     albertel  840:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.160     albertel  841:     my $result;
                    842:     if ($target eq "edit") {
                    843: 	$result.= &Apache::edit::tag_end($target,$token,'');
                    844:     }
                    845:     return $result;
1.4       tsai      846: }
                    847: 
                    848: sub start_while {
1.159     albertel  849:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    850: 
1.160     albertel  851:     my $result;
1.161     albertel  852:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
1.160     albertel  853: 	$target eq 'tex' || $target eq 'analyze') {
                    854: 	my $code = $token->[2]->{'condition'};
1.4       tsai      855: 
1.160     albertel  856: 	push( @Apache::structuretags::whileconds, $code);
                    857: 	if (!$Apache::lonxml::default_homework_loaded) {
                    858: 	    &Apache::lonxml::default_homework_load($safeeval);
                    859: 	}
                    860: 	my $result = &Apache::run::run($code,$safeeval);
1.161     albertel  861: 	my $bodytext=&Apache::lonxml::get_all_text("/while",$parser);
1.160     albertel  862: 	push( @Apache::structuretags::whilebody, $bodytext);
1.161     albertel  863: 	push( @Apache::structuretags::whileline, $token->[5]);
                    864: 	&Apache::lonxml::debug("s code $code got -$result-");
1.160     albertel  865: 	if ( $result ) {
                    866: 	    &Apache::lonxml::newparser($parser,\$bodytext);
                    867: 	}
                    868:     } elsif ($target eq 'edit') {
                    869: 	$result .=&Apache::edit::tag_start($target,$token);
1.211     albertel  870: 	$result .=&Apache::edit::text_arg(&mt('Test Condition:'),'condition',
1.160     albertel  871: 					  $token,40);
                    872: 	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
                    873:     } elsif ($target eq 'modified') {
                    874: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
                    875: 						     $safeeval,'condition');
                    876: 	if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
1.159     albertel  877:     }
1.160     albertel  878:     return $result;
1.4       tsai      879: }
                    880: 
                    881: sub end_while {
1.159     albertel  882:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.160     albertel  883:     my $result;
                    884: 
                    885:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
                    886: 	$target eq 'tex' || $target eq 'analyze') {
                    887: 	my $code = pop(@Apache::structuretags::whileconds);
                    888: 	my $bodytext = pop(@Apache::structuretags::whilebody);
1.161     albertel  889: 	my $line = pop(@Apache::structuretags::whileline);
                    890: 	my $return = &Apache::run::run($code,$safeeval);
                    891: 	my $starttime=time;
                    892: 	my $error=0;
                    893: 	while ($return) {
                    894: 	    if (time-$starttime >
                    895: 		$Apache::lonnet::perlvar{'lonScriptTimeout'}) {
                    896: 		$return = 0; $error=1; next;
                    897: 	    }
                    898: 	    $result.=&Apache::scripttag::xmlparse($bodytext);
                    899: 	    $return = &Apache::run::run($code,$safeeval);
                    900: 	}
                    901: 	if ($error) {
1.211     albertel  902: 	    &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  903: 	}
                    904:     } elsif ($target eq "edit") {
                    905: 	$result.= &Apache::edit::tag_end($target,$token,'');
1.159     albertel  906:     }
1.160     albertel  907:     return $result;
1.1       albertel  908: }
1.6       tsai      909: 
1.160     albertel  910: # <randomlist show="1">
1.6       tsai      911: #  <tag1>..</tag1>
                    912: #  <tag2>..</tag2>
                    913: #  <tag3>..</tag3>
1.160     albertel  914: #  ...
1.6       tsai      915: # </randomlist>
                    916: sub start_randomlist {
1.159     albertel  917:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    918:     my $result;
                    919:     if ($target eq 'answer' || $target eq 'grade' || $target eq 'web' ||
                    920: 	$target eq 'tex' || $target eq 'analyze') {
                    921: 	my $body= &Apache::lonxml::get_all_text("/randomlist",$parser);
                    922: 	my $b_parser= HTML::TokeParser->new(\$body);
                    923: 	my $b_tok;
                    924: 	my @randomlist;
                    925: 	my $list_item;
                    926: 	while($b_tok = $b_parser->get_token() ) {
                    927: 	    if($b_tok->[0] eq 'S') { # start tag
                    928: 		# get content of the tag until matching end tag
                    929: 		# get all text upto the matching tag
                    930: 		# and push the content into @randomlist
                    931: 		$list_item = &Apache::lonxml::get_all_text('/'.$b_tok->[1],
                    932: 							   $b_parser);
                    933: 		$list_item = "$b_tok->[4]"."$list_item"."</$b_tok->[1]>";
                    934: 		push(@randomlist,$list_item);
                    935: 		#  print "<br /><b>START-TAG $b_tok->[1], $b_tok->[4],
                    936:                 #         $list_item</b>";
                    937: 	    }
                    938: 	    if($b_tok->[0] eq 'T') { # text
                    939: 		# what to do with text in between tags?
                    940: 		#  print "<b>TEXT $b_tok->[1]</b><br />";
                    941: 	    }
                    942: 	    # if($b_tok->[0] eq 'E') { # end tag, should not happen
                    943: 	    #  print "<b>END-TAG $b_tok->[1]</b><br />";
                    944: 	    # }
                    945: 	}
                    946: 	my @idx_arr = (0 .. $#randomlist);
                    947: 	&Apache::structuretags::shuffle(\@idx_arr);
                    948: 	my $bodytext = '';
                    949: 	my $show=$#randomlist;
                    950: 	my $showarg=&Apache::lonxml::get_param('show',$parstack,$safeeval);
                    951: 	$showarg--;
                    952: 	if ( ($showarg >= 0) && ($showarg < $show) ) { $show = $showarg; }
                    953: 	for(0 .. $show) {
                    954: 	    $bodytext .= "$randomlist[ $idx_arr[$_] ]";
                    955: 	}
                    956: 	&Apache::lonxml::newparser($parser,\$bodytext);
                    957:     } elsif ($target eq 'edit' ) {
                    958: 	$result .=&Apache::edit::tag_start($target,$token);
                    959: 	$result .=&Apache::edit::text_arg('Maximum Tags to Show:','show',
                    960: 					   $token,5);
                    961: 	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
                    962:     } elsif ($target eq 'modified' ) {
                    963: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
                    964: 						     $safeeval,'show');
                    965: 	if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
                    966:     }
                    967:     return $result;
1.7       tsai      968: }
                    969: 
                    970: sub shuffle {
                    971:     my $a=shift;
                    972:     my $i;
1.70      albertel  973:     if (defined(@$a)) {
1.159     albertel  974: 	&Apache::response::setrandomnumber();
                    975: 	for($i=@$a;--$i;) {
                    976: 	    my $j=int(&Math::Random::random_uniform() * ($i+1));
                    977: 	    next if $i == $j;
                    978: 	    @$a[$i,$j] = @$a[$j,$i];
                    979: 	}
1.7       tsai      980:     }
1.6       tsai      981: }
                    982: 
                    983: sub end_randomlist {
1.159     albertel  984:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    985:     my $result;
                    986:     if ($target eq 'edit' ) {
                    987: 	$result=&Apache::edit::tag_end($target,$token,
                    988: 				       'End Randomly Parsed Block');
                    989:     }
                    990:     return $result;
1.6       tsai      991: }
                    992: 
1.11      albertel  993: sub start_part {
1.159     albertel  994:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    995:     my $result='';
                    996:     my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);
                    997:     if ($id eq '') { $id = $Apache::lonxml::curdepth; }
                    998:     $Apache::inputtags::part=$id;
1.177     albertel  999:     push(@Apache::inputtags::partlist,$id);
                   1000:     @Apache::inputtags::response=();
1.159     albertel 1001:     @Apache::inputtags::previous=();
                   1002:     @Apache::inputtags::previous_version=();
1.241   ! albertel 1003:     $Apache::lonhomework::problemstatus=&get_problem_status($id);
1.159     albertel 1004:     my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
1.214     albertel 1005:     my $expression='$external::part=\''.$Apache::inputtags::part.'\';';
1.209     albertel 1006:     &Apache::run::run($expression,$safeeval);
1.159     albertel 1007: 
                   1008:     if ($target eq 'meta') {
1.224     www      1009: 	my $display=&Apache::lonxml::get_param('display',$parstack,$safeeval);
                   1010: 	return &Apache::response::mandatory_part_meta.
                   1011: 	       &Apache::response::meta_parameter_write('display','string',$display,'Part Description');
1.159     albertel 1012:     } elsif ($target eq 'web' || $target eq 'grade' ||
                   1013: 	     $target eq 'answer' || $target eq 'tex') {
                   1014: 	if ($hidden) {
                   1015: 	    my $bodytext=&Apache::lonxml::get_all_text("/part",$parser);
                   1016: 	} else {
                   1017: 	    my ($status,$accessmsg) = &Apache::lonhomework::check_access($id);
                   1018: 	    push (@Apache::inputtags::status,$status);
                   1019: 	    my $expression='$external::datestatus="'.$status.'";';
                   1020: 	    $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$id.solved"}.'";';
                   1021: 	    &Apache::run::run($expression,$safeeval);
1.240     albertel 1022: 	    if ($ENV{'request.state'} eq 'construct') {
1.241   ! albertel 1023: 		&set_problem_state($Apache::inputtags::part); 
1.240     albertel 1024: 	    }
1.216     albertel 1025: 	    if (( $status eq 'CLOSED' ) ||
                   1026: 		( $status eq 'UNCHECKEDOUT') ||
                   1027: 		( $status eq 'BANNED') ||
                   1028: 		( $status eq 'UNAVAILABLE') ||
                   1029: 		( $status eq 'INVALID_ACCESS')) {
1.159     albertel 1030: 		my $bodytext=&Apache::lonxml::get_all_text("/part",$parser);
                   1031: 		if ( $target eq "web" ) {
1.211     albertel 1032: 		    $result="<br />".&mt('Part is not open to be viewed. It')." $accessmsg<br />";
1.159     albertel 1033: 		} elsif ( $target eq 'tex' ) {
1.195     sakharuk 1034: 		    if (not $ENV{'form.problem_split'}=~/yes/) {
1.211     albertel 1035: 			$result="\\end{minipage}\\vskip 0 mm ".&mt('Part is not open to be viewed. It')." $accessmsg \\\\\\begin{minipage}{\\textwidth}";
1.195     sakharuk 1036: 		    } else {
1.211     albertel 1037: 			$result="\\vskip 0 mm ".&mt('Part is not open to be viewed. It')." $accessmsg \\\\";
1.195     sakharuk 1038: 		    }
1.159     albertel 1039: 		}
                   1040: 	    } else {
                   1041: 		if ($target eq 'tex') {
1.195     sakharuk 1042: 		    if (not $ENV{'form.problem_split'}=~/yes/) {
                   1043: 			$result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent';
                   1044: 		    }
1.159     albertel 1045: 		    my $weight = &Apache::lonnet::EXT("resource.$id.weight");
1.230     albertel 1046: 		    my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'packages');
1.222     sakharuk 1047: 		    my @allkeys = split /,/,$allkeys;
                   1048: 		    my $allow_print_points = 0;
                   1049: 		    foreach my $partial_key (@allkeys) {
1.230     albertel 1050: 			if ($partial_key=~m/^part_(.*)$/) {
1.222     sakharuk 1051: 			    if ($1 ne '0') {$allow_print_points=1;}
                   1052: 			}
                   1053: 		    }
                   1054: 		    if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
1.233     www      1055: 		} elsif ($target eq 'web') {
                   1056: 		    $result.='<a name="'.&Apache::lonnet::escape($Apache::inputtags::part).'" />';
1.159     albertel 1057: 		}
                   1058: 	    }
                   1059: 	}
                   1060:     } elsif ($target eq 'edit') {
                   1061: 	$result.=&Apache::edit::tag_start($target,$token);
                   1062: 	$result.=&Apache::edit::text_arg('Part ID:','id',$token).
                   1063: 	    &Apache::loncommon::help_open_topic("Part_Tag_Edit_Help").
1.224     www      1064: 	    '&nbsp;&nbsp;'.
                   1065: &Apache::edit::text_arg('Displayed Part Description:','display',$token).
1.159     albertel 1066: 		&Apache::edit::end_row().&Apache::edit::start_spanning_row();
                   1067:     } elsif ($target eq 'modified') {
                   1068: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
1.225     albertel 1069: 						     $safeeval,'id','display');
1.159     albertel 1070: 	if ($constructtag) {
1.225     albertel 1071: 	    #limiting ids to only letters numbers, and space
1.224     www      1072: 	    $token->[2]->{'id'}=~s/[^A-Za-z0-9 ]//gs;
1.159     albertel 1073: 	    $result = &Apache::edit::rebuild_tag($token);
                   1074: 	    $result.=&Apache::edit::handle_insert();
                   1075: 	}
                   1076:     }
                   1077:     return $result;
1.11      albertel 1078: }
                   1079: 
                   1080: sub end_part {
1.159     albertel 1081:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1082:     &Apache::lonxml::debug("in end_part $target ");
                   1083:     my $status=$Apache::inputtags::status['-1'];
                   1084:     my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
                   1085:     my $result='';
                   1086:     if ( $target eq 'meta' ) {
                   1087: 	$result='';
1.232     albertel 1088:     } elsif ($target eq 'grade' && 
                   1089: 	     ($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) &&
                   1090: 	     !$hidden) {
1.159     albertel 1091: 	$result=&Apache::inputtags::grade;
                   1092:     } elsif (($target eq 'web' || $target eq 'tex') && !$hidden ) {
                   1093: 	my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part,
                   1094: 							$target);
1.212     albertel 1095: 	if ($Apache::lonhomework::type eq 'exam' && $target eq 'tex') {
                   1096: 	    $gradestatus='';
                   1097: 	}
1.159     albertel 1098: 	$result=$gradestatus;
1.181     albertel 1099:     } elsif ($target eq 'edit') {
                   1100: 	$result=&Apache::edit::end_table();
1.159     albertel 1101:     }
                   1102:     pop @Apache::inputtags::status;
                   1103:     $Apache::inputtags::part='';
                   1104:     return $result;
1.11      albertel 1105: }
1.1       albertel 1106: 
1.25      albertel 1107: sub start_preduedate {
1.159     albertel 1108:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1109:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') {
1.236     albertel 1110: 	&Apache::lonxml::debug("State in preduedate is ". $Apache::inputtags::status['-1']);
1.159     albertel 1111: 	if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&
1.236     albertel 1112: 	    $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') {
                   1113: 	    &Apache::lonxml::debug("Wha? ". ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER'));
1.159     albertel 1114: 	    &Apache::lonxml::get_all_text("/preduedate",$parser);
                   1115: 	}
1.24      albertel 1116:     }
1.159     albertel 1117:     return '';
1.24      albertel 1118: }
                   1119: 
1.25      albertel 1120: sub end_preduedate {
1.159     albertel 1121:     return '';
1.24      albertel 1122: }
                   1123: 
1.25      albertel 1124: sub start_postanswerdate {
1.159     albertel 1125:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.234     albertel 1126:     if ($target eq 'web' || $target eq 'grade') {
1.159     albertel 1127: 	if ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') {
                   1128: 	    &Apache::lonxml::get_all_text("/postanswerdate",$parser);
                   1129: 	}
                   1130:     } elsif ($target eq 'tex') {
1.234     albertel 1131: 	&Apache::lonxml::get_all_text("/postanswerdate",$parser);
1.159     albertel 1132:     }
                   1133:     return '';
1.24      albertel 1134: }
                   1135: 
1.25      albertel 1136: sub end_postanswerdate {
1.159     albertel 1137:     return '';
1.24      albertel 1138: }
                   1139: 
1.25      albertel 1140: sub start_notsolved {
1.159     albertel 1141:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1142:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
                   1143: 	$target eq 'tex') {
                   1144: 	my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
                   1145: 	&Apache::lonxml::debug("not solved has :$gradestatus:");
1.239     albertel 1146: 	if ($gradestatus =~ /^correct/ &&
                   1147: 	    &Apache::response::show_answer()) {
1.159     albertel 1148: 	    &Apache::lonxml::debug("skipping");
                   1149: 	    &Apache::lonxml::get_all_text("/notsolved",$parser);
                   1150: 	}
1.24      albertel 1151:     }
1.159     albertel 1152:     return '';
1.24      albertel 1153: }
                   1154: 
1.25      albertel 1155: sub end_notsolved {
1.159     albertel 1156:     return '';
1.24      albertel 1157: }
                   1158: 
                   1159: sub start_solved {
1.159     albertel 1160:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1161:     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
                   1162: 	$target eq 'tex') {
                   1163: 	my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
1.239     albertel 1164: 	if ($gradestatus !~ /^correct/ ||
                   1165: 	    !&Apache::response::show_answer()) {
1.159     albertel 1166: 	    &Apache::lonxml::get_all_text("/solved",$parser);
                   1167: 	}
1.24      albertel 1168:     }
1.159     albertel 1169:     return '';
1.24      albertel 1170: }
                   1171: 
                   1172: sub end_solved {
1.159     albertel 1173:     return '';
1.24      albertel 1174: }
1.34      albertel 1175: 
                   1176: sub start_startouttext {
1.159     albertel 1177:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1178:     my @result=(''.'');
                   1179:     if ($target eq 'edit' || $target eq 'modified' ) { @result=('','no'); }
                   1180:     return (@result);
1.34      albertel 1181: }
1.159     albertel 1182: 
1.34      albertel 1183: sub end_startouttext {
1.159     albertel 1184:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1185:     my $result='';
                   1186:     my $text='';
                   1187: 
                   1188:     if ($target eq 'edit') {
                   1189: 	$text=&Apache::lonxml::get_all_text("endouttext",$parser);
1.211     albertel 1190: 	$result.=&Apache::edit::start_table($token)."<tr><td>".&mt('Text Block')."</td>
                   1191: <td>".&mt('Delete:').
1.159     albertel 1192:                  &Apache::edit::deletelist($target,$token)
                   1193: 		 ."</td>
1.42      albertel 1194: <td>".
1.159     albertel 1195:                  &Apache::edit::insertlist($target,$token).
                   1196: 		 &Apache::edit::end_row().
                   1197:                  &Apache::edit::start_spanning_row()."\n"
1.188     bowersj2 1198: 		 . &Apache::loncommon::helpLatexCheatsheet () .
1.159     albertel 1199: 		 &Apache::edit::editfield($token->[1],$text,"",80,4);
                   1200:     }
                   1201:     if ($target eq 'modified') {
1.219     albertel 1202: 	$result='<startouttext />'.&Apache::edit::modifiedfield("endouttext",$parser);
1.159     albertel 1203:     }
                   1204:     if ($target eq 'tex') {
                   1205: 	$result .= '\noindent ';
                   1206:     }
                   1207:     return $result;
1.34      albertel 1208: }
1.159     albertel 1209: 
1.34      albertel 1210: sub start_endouttext {
1.159     albertel 1211:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1212:     my $result='';
                   1213:     if ($target eq "edit" ) { $result="</td></tr>".&Apache::edit::end_table()."\n"; }
                   1214:     if ($target eq "modified") {
                   1215: 	$result='<endouttext />'.
                   1216: 	    &Apache::edit::handle_insertafter('startouttext'); }
                   1217:     return $result;
1.34      albertel 1218: }
1.159     albertel 1219: 
1.34      albertel 1220: sub end_endouttext {
1.159     albertel 1221:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1222:     my @result=('','');
                   1223:     if ($target eq "edit" || $target eq 'modified') { @result=('','no'); }
                   1224:     return (@result);
1.34      albertel 1225: }
1.159     albertel 1226: 
1.45      albertel 1227: sub delete_startouttext {
1.159     albertel 1228:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1229:     #  my $text=&Apache::lonxml::get_all_text("endouttext",$parser);
                   1230:     my $text=$$parser['-1']->get_text("/endouttext");
                   1231:     my $ntoken=$$parser['-1']->get_token();
                   1232:     &Apache::lonxml::debug("Deleting :$text: and :$ntoken->[0]:$ntoken->[1]:$ntoken->[2]: for startouttext");
                   1233:     &Apache::lonxml::end_tag($tagstack,$parstack,$ntoken);
                   1234:     # Deleting 2 parallel tag pairs, but we need the numbers later to look like
                   1235:     # they did the last time round
                   1236:     &Apache::lonxml::increasedepth($ntoken);
                   1237:     &Apache::lonxml::decreasedepth($ntoken);
                   1238:     return 1;
1.193     www      1239: }
                   1240: 
                   1241: sub start_simpleeditbutton {
                   1242:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                   1243:     my $result='';
                   1244:     if (($target eq 'web') &&
                   1245:         (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
1.220     www      1246:         my $url=$ENV{'request.noversionuri'};
1.193     www      1247:         $url=~s/\?.*$//;
1.194     www      1248: 	$result='<table width="100%" bgcolor="#FFFFAA" border="2"><tr><td>'.
1.211     albertel 1249:                 '<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      1250: &Apache::loncommon::help_open_topic('Caching').'</td></tr></table><br />';
1.193     www      1251:     }
                   1252:     return $result;
                   1253: }
                   1254: 
                   1255: sub end_simpleeditbutton {
                   1256:     return '';
1.45      albertel 1257: }
1.34      albertel 1258: 
1.1       albertel 1259: 1;
                   1260: __END__

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