--- loncom/interface/lonmenu.pm 2014/06/22 19:48:05 1.369.2.52 +++ loncom/interface/lonmenu.pm 2014/09/22 01:33:17 1.369.2.53 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.369.2.52 2014/06/22 19:48:05 raeburn Exp $ +# $Id: lonmenu.pm,v 1.369.2.53 2014/09/22 01:33:17 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2017,8 +2017,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 (<