--- loncom/interface/lonmenu.pm 2014/06/22 19:46:48 1.428 +++ loncom/interface/lonmenu.pm 2014/09/22 01:02:52 1.429 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.428 2014/06/22 19:46:48 raeburn Exp $ +# $Id: lonmenu.pm,v 1.429 2014/09/22 01:02:52 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1506,8 +1506,26 @@ sub utilityfunctions { my $countdown = &countdown_toggle_js(); + my $hostvar = ' +function setLCHost() { + var lcHostname=""; +'; + if ($httphost =~ m{^https?\://}) { + $hostvar .= ' var lcServer="'.$httphost.'";'."\n". + ' var hostReg = /^https?:\/\/([^\/]+)$/i;'."\n". + ' var match = hostReg.exec(lcServer);'."\n". + ' if (match.length) {'."\n". + ' if (match[1] == location.hostname) {'."\n". + ' lcHostname=lcServer;'."\n". + ' }'."\n". + ' }'."\n"; + } + + $hostvar .= ' return lcHostname;'."\n". +'}'."\n"; + return (<