[LON-CAPA-cvs] cvs: loncom /html/res/adm/pages menu.html /interface loncommon.pm /xml scripttag.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Thu, 30 Aug 2007 22:56:43 -0000
This is a MIME encoded message
--albertel1188514603
Content-Type: text/plain
albertel Thu Aug 30 18:56:43 2007 EDT
Modified files:
/loncom/interface loncommon.pm
/loncom/html/res/adm/pages menu.html
/loncom/xml scripttag.pm
Log:
- eliminating some other location that access lonhttpurl directly
- switch remote control to note and use needed protocol for server
--albertel1188514603
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20070830185643.txt"
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.574 loncom/interface/loncommon.pm:1.575
--- loncom/interface/loncommon.pm:1.574 Thu Aug 30 16:24:15 2007
+++ loncom/interface/loncommon.pm Thu Aug 30 18:56:14 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.574 2007/08/30 20:24:15 albertel Exp $
+# $Id: loncommon.pm,v 1.575 2007/08/30 22:56:14 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3505,9 +3505,6 @@
if (!$realm) { $realm=' '; }
# Set messages
my $messages=&domainlogo($domain);
-# Port for miniserver
- my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'};
- if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; }
my $extra_body_attr = &make_attr_string($forcereg,\%design);
@@ -3625,7 +3622,7 @@
my $imgsrc = $img;
if ($img =~ /^\/adm/) {
- $imgsrc = 'http://'.$ENV{'HTTP_HOST'}.':'.$lonhttpdPort.$img;
+ $imgsrc = &lonhttpdurl($img);
}
my $upperleft='<img src="'.$imgsrc.'" alt="'.$function.'" />';
@@ -7371,16 +7368,25 @@
return &lonhttpdurl($iconname);
}
-sub lonhttpdurl {
- my ($url)=@_;
+sub lonhttpd_port {
my $lonhttpd_port=$Apache::lonnet::perlvar{'lonhttpdPort'};
if (!defined($lonhttpd_port)) { $lonhttpd_port='8080'; }
-
# IE doesn't like a secure page getting images from a non-secure
# port (when logging we haven't parsed the browser type so default
# back to secure
if ((!exists($env{'browser.type'}) || $env{'browser.type'} eq 'explorer')
&& $ENV{'SERVER_PORT'} == 443) {
+ return 443;
+ }
+ return $lonhttpd_port;
+
+}
+
+sub lonhttpdurl {
+ my ($url)=@_;
+
+ my $lonhttpd_port = &lonhttpd_port();
+ if ($lonhttpd_port == 443) {
return 'https://'.$ENV{'SERVER_NAME'}.$url;
}
return 'http://'.$ENV{'SERVER_NAME'}.':'.$lonhttpd_port.$url;
Index: loncom/html/res/adm/pages/menu.html
diff -u loncom/html/res/adm/pages/menu.html:1.120 loncom/html/res/adm/pages/menu.html:1.121
--- loncom/html/res/adm/pages/menu.html:1.120 Tue Apr 24 19:26:15 2007
+++ loncom/html/res/adm/pages/menu.html Thu Aug 30 18:56:32 2007
@@ -4,7 +4,7 @@
Remote Control
//
-// $Id: menu.html,v 1.120 2007/04/24 23:26:15 albertel Exp $
+// $Id: menu.html,v 1.121 2007/08/30 22:56:32 albertel Exp $
//
// Copyright Michigan State University Board of Trustees
//
@@ -53,6 +53,10 @@
var lonhttpdport='8080';
}
+var protocol="http://";
+if (lonhttpdport == 443) {
+ protocol="https://"
+}
var imgpath=':'+lonhttpdport+'/res/adm/pages/';
var fontpath=':'+lonhttpdport+'/adm/lonLCDfont/';
var currentURL='';
@@ -142,7 +146,7 @@
function windowcheck() {
if (clientwindow==null || clientwindow.closed) {
- clientwindow=window.open("http://"+clienthost+"/",'',
+ clientwindow=window.open(protocol+clienthost+"/",'',
"height=400,width=440,"+
"scrollbars=1,toolbar=1,status=1,resizable=1,location=1,menubar=1,"+
"left=190,top=15,screenX=190,screenY=15");
@@ -153,7 +157,7 @@
function navwindowcheck() {
if (navwindow==null || navwindow.closed) {
- navwindow=window.open("http://"+clienthost+"/adm/navmaps#curloc",
+ navwindow=window.open(protocol+clienthost+"/adm/navmaps#curloc",
"loncapanav","height=600,width=400,scrollbars=1");
}
}
@@ -209,7 +213,7 @@
function switchbutton(row,col,imgsrc,texttop,textbot,action,desc) {
var idx=10*row+col;
- this.document['b'+idx].src="http://"+clienthost+imgpath+imgsrc;
+ this.document['b'+idx].src=protocol+clienthost+imgpath+imgsrc;
hr[idx]=action;
dt[idx]=texttop;
db[idx]=textbot;
@@ -223,7 +227,7 @@
function clearbut(row,col) {
var idx=10*row+col;
- this.document['b'+idx].src="http://"+clienthost+imgpath+'empty.gif';
+ this.document['b'+idx].src=protocol+clienthost+imgpath+'empty.gif';
hr[idx]='javascript:defdis();';
dt[idx]='';
db[idx]='';
@@ -236,7 +240,7 @@
}
function setstatus(tp,bt) {
- this.document['led'].src="http://"+clienthost+imgpath+"ledblink.gif";
+ this.document['led'].src=protocol+clienthost+imgpath+"ledblink.gif";
statustop=tp;
statusbot=bt;
statuslocked=1;
@@ -246,12 +250,12 @@
function go(url) {
windowcheck();
statuslocked=0;
- this.document['led'].src="http://"+clienthost+imgpath+"ledsend.gif";
+ this.document['led'].src=protocol+clienthost+imgpath+"ledsend.gif";
if (url!='' && url!= null) {
currentURL = null;
currentSymb= null;
this.document.server.target='loncapaclient';
- this.document.server.action="http://"+clienthost+url;
+ this.document.server.action=protocol+clienthost+url;
this.document.server.postdata.value='';
this.document.server.command.value='';
this.document.server.url.value='';
@@ -268,9 +272,9 @@
} else {
this.document.server.target="loncapaclient";
}
- this.document['led'].src="http://"+clienthost+imgpath+"ledsend.gif";
+ this.document['led'].src=protocol+clienthost+imgpath+"ledsend.gif";
if (url!='' && url!= null) {
- this.document.server.action="http://"+clienthost+url;
+ this.document.server.action=protocol+clienthost+url;
this.document.server.postdata.value=currentURL;
this.document.server.command.value='';
this.document.server.url.value='';
@@ -282,10 +286,10 @@
function gopost(url,postdata,makenewwin) {
windowcheck();
statuslocked=0;
- this.document['led'].src="http://"+clienthost+imgpath+"ledsend.gif";
+ this.document['led'].src=protocol+clienthost+imgpath+"ledsend.gif";
if (url!='') {
if (makenewwin) {
- var LONcomWin=window.open("http://"+clienthost+"/adm/rat/empty.html",
+ var LONcomWin=window.open(protocol+clienthost+"/adm/rat/empty.html",
'LONcom',
"height=600,width=600,"+
"scrollbars=1,toolbar=0,status=0,resizable=1,location=0,menubar=0");
@@ -293,7 +297,7 @@
} else {
this.document.server.target='loncapaclient';
}
- this.document.server.action="http://"+clienthost+url;
+ this.document.server.action=protocol+clienthost+url;
this.document.server.postdata.value=postdata;
this.document.server.command.value='';
this.document.server.url.value='';
@@ -305,10 +309,10 @@
function gocmd(url,cmd) {
windowcheck();
statuslocked=0;
- this.document['led'].src="http://"+clienthost+imgpath+"ledsend.gif";
+ this.document['led'].src=protocol+clienthost+imgpath+"ledsend.gif";
if (url!='') {
this.document.server.target='loncapaclient';
- this.document.server.action="http://"+clienthost+url;
+ this.document.server.action=protocol+clienthost+url;
this.document.server.postdata.value='';
this.document.server.command.value=cmd;
this.document.server.url.value=currentURL;
@@ -366,7 +370,7 @@
function extenddisp() {
go('');
w_extdisp_flag=1;
- extdisp=window.open("http://"+clienthost+"/adm/rat/loading.html",
+ extdisp=window.open(protocol+clienthost+"/adm/rat/loading.html",
"ExtDisp", "scrollbars=1,width=400,height=450");
}
@@ -398,7 +402,7 @@
function edit_bookmarks() {
go('');
w_BookmarkPal_flag=1;
- bookmarkpal=window.open("http://"+clienthost+"/adm/bookmarks",
+ bookmarkpal=window.open(protocol+clienthost+"/adm/bookmarks",
"BookmarkPal", "width=400,height=505,scrollbars=0");
}
@@ -468,7 +472,7 @@
if (ch==':') { ch='colon'; }
if (ch=='/') { ch='slash'; }
} else { ch='space'; }
- this.document['i'+i].src="http://"+clienthost+fontpath+ch+'.gif';
+ this.document['i'+i].src=protocol+clienthost+fontpath+ch+'.gif';
}
for (i=0;i<=7;i++) {
if (i<ltext.length) {
@@ -478,7 +482,7 @@
if (ch==':') { ch='colon'; }
if (ch=='/') { ch='slash'; }
} else { ch='space'; }
- this.document['j'+i].src="http://"+clienthost+fontpath+ch+'.gif';
+ this.document['j'+i].src=protocol+clienthost+fontpath+ch+'.gif';
}
}
}
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.142 loncom/xml/scripttag.pm:1.143
--- loncom/xml/scripttag.pm:1.142 Fri Aug 3 19:29:54 2007
+++ loncom/xml/scripttag.pm Thu Aug 30 18:56:43 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# <script> definiton
#
-# $Id: scripttag.pm,v 1.142 2007/08/03 23:29:54 albertel Exp $
+# $Id: scripttag.pm,v 1.143 2007/08/30 22:56:43 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -80,13 +80,21 @@
return ('','no');
}
+=pod
+
+=item start_LONCAPA_INTERNAL_LONHTTPD_PORT
+
+emits a pice of javascript that says a global js variable to the
+current lonhttp port, currently used by the remote control to find out
+where to load images from
+
+=cut
+
sub start_LONCAPA_INTERNAL_LONHTTPD_PORT {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
if ($target eq 'web' || $target eq 'webgrade') {
- my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'};
- if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; }
return '<script type="text/javascript">var lonhttpdport=\''.
- $lonhttpdPort.'\';</script>';
+ &Apache::loncommon::lonhttpd_port().'\';</script>';
}
return ('','no');
}
--albertel1188514603--