[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonmenu.pm
raeburn
raeburn at source.lon-capa.org
Sun May 13 19:45:07 EDT 2012
raeburn Sun May 13 23:45:07 2012 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface lonmenu.pm
Log:
- For 2.11
- Reverse part of 1.316. Remote Control retained in 2.11.0.
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.369 loncom/interface/lonmenu.pm:1.369.2.1
--- loncom/interface/lonmenu.pm:1.369 Wed Apr 11 15:21:43 2012
+++ loncom/interface/lonmenu.pm Sun May 13 23:45:07 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.369 2012/04/11 15:21:43 raeburn Exp $
+# $Id: lonmenu.pm,v 1.369.2.1 2012/05/13 23:45:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -761,6 +761,164 @@
return $cfile;
}
+sub startupremote {
+ my ($lowerurl)=@_;
+ if ($env{'environment.remote'} eq 'off') {
+ return ('<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'" />');
+ }
+#
+# The Remote actually gets launched!
+#
+ my $configmenu=&rawconfig();
+ my $esclowerurl=&escape($lowerurl);
+ my $message=&mt('"Waiting for Remote Control window to load: "+[_1]','waited');
+ return(<<ENDREMOTESTARTUP);
+<script type="text/javascript">
+// <![CDATA[
+var timestart;
+function wheelswitch() {
+ if (typeof(document.wheel) != 'undefined') {
+ if (typeof(document.wheel.spin) != 'undefined') {
+ var date=new Date();
+ var waited=Math.round(30-((date.getTime()-timestart)/1000));
+ document.wheel.spin.value=$message;
+ }
+ }
+ if (window.status=='|') {
+ window.status='/';
+ } else {
+ if (window.status=='/') {
+ window.status='-';
+ } else {
+ if (window.status=='-') {
+ window.status='\\\\';
+ } else {
+ if (window.status=='\\\\') { window.status='|'; }
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------- The wait function
+var canceltim;
+function wait() {
+ if ((menuloaded==1) || (tim==1)) {
+ window.status='Done.';
+ if (tim==0) {
+ clearTimeout(canceltim);
+ $configmenu
+ window.location='$lowerurl';
+ } else {
+ window.location='/adm/remote?action=collapse&url=$esclowerurl';
+ }
+ } else {
+ wheelswitch();
+ setTimeout('wait();',200);
+ }
+}
+
+function main() {
+ canceltim=setTimeout('tim=1;',30000);
+ window.status='-';
+ var date=new Date();
+ timestart=date.getTime();
+ wait();
+}
+
+// ]]>
+</script>
+ENDREMOTESTARTUP
+}
+
+sub setflags() {
+ return(<<ENDSETFLAGS);
+<script type="text/javascript">
+// <![CDATA[
+ menuloaded=0;
+ tim=0;
+// ]]>
+</script>
+ENDSETFLAGS
+}
+
+sub maincall() {
+ if ($env{'environment.remote'} eq 'off') { return ''; }
+ return(<<ENDMAINCALL);
+<script type="text/javascript">
+// <![CDATA[
+ main();
+// ]]>
+</script>
+ENDMAINCALL
+}
+
+sub load_remote_msg {
+ my ($lowerurl)=@_;
+
+ if ($env{'environment.remote'} eq 'off') { return ''; }
+
+ my $esclowerurl=&escape($lowerurl);
+ my $link=&mt('[_1]Continue[_2] on in Inline Menu mode'
+ ,'<a href="/adm/remote?action=collapse&url='.$esclowerurl.'">'
+ ,'</a>');
+ return(<<ENDREMOTEFORM);
+<p>
+<form name="wheel">
+<input name="spin" type="text" size="60" />
+</form>
+</p>
+<p>$link</p>
+ENDREMOTEFORM
+}
+
+sub get_menu_name {
+ my $hostid = $Apache::lonnet::perlvar{'lonHostID'};
+ $hostid =~ s/\W//g;
+ return 'LCmenu'.$hostid;
+}
+
+
+sub reopenmenu {
+ if ($env{'environment.remote'} eq 'off') { return ''; }
+ my $menuname = &get_menu_name();
+ my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
+ return('window.open('.$nothing.',"'.$menuname.'","",false);');
+}
+
+
+sub open {
+ my $returnval='';
+ if ($env{'environment.remote'} eq 'off') {
+ return
+ '<script type="text/javascript">'."\n"
+ .'// <![CDATA['."\n"
+ .'self.name="loncapaclient";'."\n"
+ .'// ]]>'."\n"
+ .'</script>';
+ }
+ my $menuname = &get_menu_name();
+
+# unless (shift eq 'unix') {
+# resizing does not work on linux because of virtual desktop sizes
+# $returnval.=(<<ENDRESIZE);
+#if (window.screen) {
+# self.resizeTo(screen.availWidth-215,screen.availHeight-55);
+# self.moveTo(190,15);
+#}
+#ENDRESIZE
+# }
+ $returnval=(<<ENDOPEN);
+// <![CDATA[
+window.status='Opening LON-CAPA Remote Control';
+var menu=window.open("/res/adm/pages/menu.html?inhibitmenu=yes","$menuname",
+"height=375,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");
+self.name='loncapaclient';
+// ]]>
+ENDOPEN
+ return '<script type="text/javascript">'.$returnval.'</script>';
+}
+
+
# ================================================================== Raw Config
sub clear {
@@ -1076,6 +1234,28 @@
return $showreqcrs;
}
+# ======================================================================= Close
+
+sub close {
+ if ($env{'environment.remote'} eq 'off') { return ''; }
+ my $menuname = &get_menu_name();
+ return(<<ENDCLOSE);
+<script type="text/javascript">
+// <![CDATA[
+window.status='Accessing Remote Control';
+menu=window.open("/adm/rat/empty.html","$menuname",
+ "height=350,width=150,scrollbars=no,menubar=no");
+window.status='Disabling Remote Control';
+menu.active=0;
+menu.autologout=0;
+window.status='Closing Remote Control';
+menu.close();
+window.status='Done.';
+// ]]>
+</script>
+ENDCLOSE
+}
+
sub dc_popup_js {
my %lt = &Apache::lonlocal::texthash(
more => '(More ...)',
More information about the LON-CAPA-cvs
mailing list