--- loncom/interface/lonmenu.pm 2004/12/03 06:51:50 1.134 +++ loncom/interface/lonmenu.pm 2005/01/31 19:24:02 1.142 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.134 2004/12/03 06:51:50 raeburn Exp $ +# $Id: lonmenu.pm,v 1.142 2005/01/31 19:24:02 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -145,9 +145,14 @@ ENDMAINMENU my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain); # Do we have a NAV link? if ($ENV{'request.course.id'}) { - $navmaps=(<<ENDNAV); + my $link='/adm/navmaps?postdata='.$escurl.'&postsymb='. + $escsymb; + if ($ENV{'environment.remotenavmap'} eq 'on') { + $link="javascript:gonav('".$link."')"; + } + $navmaps=(<<ENDNAV); <td bgcolor="$tabbg"> -<a href="javascript:gonav('/adm/navmaps?postdata=$escurl&postsymb=$escsymb')"><font color="$font">$lt{'nav'}</font></a></td> +<a href="$link"><font color="$font">$lt{'nav'}</font></a></td> ENDNAV if (($ENV{'request.noversionuri'}=~/^\/adm\//) && ($ENV{'request.noversionuri'}!~/^\/adm\/wrapper\//) && @@ -393,10 +398,10 @@ s&6&1&list.gif&list[_1]&dir[_1]&golist(' s&6&2&rtrv.gif&retrieve[_1]&version[_1]&gocstr('/adm/retrieve','/~$uname/$thisdisfn')&Retrieve old version s&6&3&pub.gif&publish[_1]&resource[_1]&gocstr('/adm/publish','/~$uname/$thisdisfn')&Publish this resource s&7&1&del.gif&delete[_1]&resource[_2]&gocstr('/adm/cfile?action=delete','/~$uname/$thisdisfn')&Delete this resource -s&7&2&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout','/~$uname/$thisdisfn')&Prepare a printable document +s&7&2&prt.gif&prepare[_1]&printout[_1]&gocstr('/adm/printout','/~$uname/$thisdisfn')&Prepare a printable document ENDMENUITEMS } - } else { + } elsif (defined($ENV{'request.course.id'})) { $menuitems=(<<ENDMENUITEMS); c&3&1 s&2&1&back.gif&backward[_1]&&gopost('/adm/flip','back:'+currentURL)&Go to the previous resource in the course sequence&1 @@ -460,10 +465,12 @@ $tableend ENDREGTEXT # Registered, graphical output } else { - my $requri=(split(/\?/,$ENV{'request.noversionuri'}))[0]; + my $requri=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$ENV{'request.noversionuri'}))[0])); $requri=&Apache::lonenc::check_encrypt(&Apache::lonnet::unescape($requri)); my $cursymb=&Apache::lonenc::check_encrypt($ENV{'request.symb'}); my $navstatus=&get_nav_status(); + my $clearcstr; + if ($ENV{'user.adv'}) { $clearcstr='clearbut(6,1)'; } $result = (<<ENDREGTHIS); <script type="text/javascript"> @@ -498,7 +505,7 @@ var swmenu=null; swmenu.clearbut(7,3); swmenu.menucltim=swmenu.setTimeout( 'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+ - 'clearbut(9,1);clearbut(9,3);clearbut(6,3);clearbut(6,1)', + 'clearbut(9,1);clearbut(9,3);clearbut(6,3);$clearcstr', 2000); } @@ -551,12 +558,14 @@ ENDDONOTREGTHIS } sub loadevents() { - if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } + if ($ENV{'request.state'} eq 'construct' || + $ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } return 'LONCAPAreg();'; } sub unloadevents() { - if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } + if ($ENV{'request.state'} eq 'construct' || + $ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } return 'LONCAPAstale();'; } @@ -1018,6 +1027,27 @@ function gocstr(url,filename) { this.document.cstrdelete.submit(); return; } + if (url == '/adm/printout') { + this.document.cstrprint.postdata.value = filename + this.document.cstrprint.curseed.value = 0; + this.document.cstrprint.problemtype.value = 0; + if (this.document.lonhomework) { + if ((this.document.lonhomework.rndseed) && (this.document.lonhomework.rndseed.value != null) && (this.document.lonhomework.rndseed.value != '')) { + this.document.cstrprint.curseed.value = this.document.lonhomework.rndseed.value + } + if (this.document.lonhomework.problemtype) { + for (var i=0; i<this.document.lonhomework.problemtype.options.length; i++) { + if (this.document.lonhomework.problemtype.options[i].selected) { + if (this.document.lonhomework.problemtype.options[i].value != null && this.document.lonhomework.problemtype.options[i].value != '') { + this.document.cstrprint.problemtype.value = this.document.lonhomework.problemtype.options[i].value + } + } + } + } + } + this.document.cstrprint.submit(); + return; + } if (url !='') { this.document.constspace.filename.value = filename; this.document.constspace.action = url; @@ -1066,6 +1096,12 @@ sub constspaceform { <input type="hidden" name="action" value="delete" /> <input type="hidden" name="filename" value="" /> </form> +<form name="cstrprint" action="/adm/printout" target="_parent" method="post"> +<input type="hidden" name="postdata" value="" /> +<input type="hidden" name="curseed" value="" /> +<input type="hidden" name="problemtype" value="" /> +</form> + ENDCONSTSPACEFORM } @@ -1111,7 +1147,7 @@ sub handler { $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain); $font=&Apache::loncommon::designparm($function.'.font',$domain); my $script_tag; - if ($ENV{'environment.remote'} eq 'on') { + if ($ENV{'environment.remote'} ne 'off') { my $utility=&utilityfunctions('/adm/menu'); $script_tag=(<<ENDSCRIPT); <script type="text/javascript">