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