[LON-CAPA-cvs] cvs: loncom /interface lonmenu.pm
www
lon-capa-cvs@mail.lon-capa.org
Mon, 17 Feb 2003 22:59:37 -0000
www Mon Feb 17 17:59:37 2003 EDT
Modified files:
/loncom/interface lonmenu.pm
Log:
Forward, backward, etc, now work. Still a lot of historical cleanup left to
do.
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.41 loncom/interface/lonmenu.pm:1.42
--- loncom/interface/lonmenu.pm:1.41 Mon Feb 17 14:28:54 2003
+++ loncom/interface/lonmenu.pm Mon Feb 17 17:59:37 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.41 2003/02/17 19:28:54 www Exp $
+# $Id: lonmenu.pm,v 1.42 2003/02/17 22:59:37 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -204,12 +204,23 @@
}
if ($textual) {
# Registered, textual output
+ my $utility=&utilityfunctions();
+ my $form=&serverform();
$result =(<<ENDREGTEXT);
+<script>
+// BEGIN LON-CAPA Internal
+$utility
+</script>
$timesync
$newmail
$buttons
$hwkadd
$editbutton
+$form
+<script>
+//END LON-CAPA Internal
+</script>
+
ENDREGTEXT
# Registered, graphical output
} else {
@@ -217,6 +228,7 @@
<script language="JavaScript">
// BEGIN LON-CAPA Internal
+var swmenu=null;
function LONCAPAreg() {
swmenu=$reopen;
@@ -267,6 +279,7 @@
<script language="JavaScript">
// BEGIN LON-CAPA Internal
+var swmenu=null;
function LONCAPAreg() {
swmenu=$reopen
@@ -435,7 +448,7 @@
if ($nobreak==2) { return ''; }
my $text=$top.' '.$bot;
$text=~s/\- //;
- return ($nobreak?'':'<br />').
+ return "\n".($nobreak?' ':'<br />').
'<a href="javascript:'.$act.';">'.$text.'</a> '.($nobreak?'':$desc);
}
}
@@ -572,6 +585,59 @@
}
+sub utilityfunctions {
+ unless ($ENV{'browser.interface'} eq 'textual') { return ''; }
+ my $currenturl=$ENV{'REQUEST_URI'};
+ my $currentsymb=$ENV{'request.symb'};
+return (<<ENDUTILITY)
+
+ var currentURL="$currenturl";
+ var reloadURL="$currenturl";
+ var currentSymb="$currentsymb";
+
+function go(url) {
+ if (url!='' && url!= null) {
+ currentURL = null;
+ currentSymb= null;
+ window.location.href=url;
+ }
+}
+
+function gopost(url,postdata) {
+ if (url!='') {
+ this.document.server.action=url;
+ this.document.server.postdata.value=postdata;
+ this.document.server.command.value='';
+ this.document.server.url.value='';
+ this.document.server.symb.value='';
+ this.document.server.submit();
+ }
+}
+
+function gocmd(url,cmd) {
+ if (url!='') {
+ this.document.server.action=url;
+ this.document.server.postdata.value='';
+ this.document.server.command.value=cmd;
+ this.document.server.url.value=currentURL;
+ this.document.server.symb.value=currentSymb;
+ this.document.server.submit();
+ }
+}
+ENDUTILITY
+}
+
+sub serverform {
+ return(<<ENDSERVERFORM);
+
+<form name="server" action="/adm/logout" method="post">
+<input type="hidden" name="postdata" value="none" />
+<input type="hidden" name="command" value="none" />
+<input type="hidden" name="url" value="none" />
+<input type="hidden" name="symb" value="none" />
+</form>
+ENDSERVERFORM
+}
# ================================================ Handler when called directly
@@ -581,23 +647,20 @@
$r->send_http_header;
return OK if $r->header_only;
+ my $utility=&utilityfunctions();
+ my $form=&serverform();
my $bodytag=&Apache::loncommon::bodytag('Main Menu');
# ------------------------------------------------------------ Print the screen
$r->print(<<ENDHEADER);
<html><head>
<title>LON-CAPA Main Menu</title>
<script>
-function go(url) {
- window.location=url;
-}
-function gopost(url) {
- window.location=url;
-}
+$utility
</script>
</head>
$bodytag
ENDHEADER
- $r->print(&rawconfig(1));
+ $r->print(&rawconfig(1).$form);
$r->print('</body></html>');
return OK;
}