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