[LON-CAPA-cvs] cvs: loncom /auth lonlogin.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Thu, 30 Dec 2004 16:04:37 -0000
raeburn Thu Dec 30 11:04:37 2004 EDT
Modified files:
/loncom/auth lonlogin.pm
Log:
Only display 'Contact Helpdesk' link on log-in page if a valid SupportEmail address has been defined in loncapa.conf. Also include selected domain in query string passed to help request form when 'Contact Helpdesk' link is followed, so appropriate select boxes are shown.
Index: loncom/auth/lonlogin.pm
diff -u loncom/auth/lonlogin.pm:1.61 loncom/auth/lonlogin.pm:1.62
--- loncom/auth/lonlogin.pm:1.61 Sat Dec 18 18:58:34 2004
+++ loncom/auth/lonlogin.pm Thu Dec 30 11:04:37 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Login Screen
#
-# $Id: lonlogin.pm,v 1.61 2004/12/18 23:58:34 raeburn Exp $
+# $Id: lonlogin.pm,v 1.62 2004/12/30 16:04:37 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -447,7 +447,8 @@
</form>
ENDLOGIN
if ($fullgraph) {
- my $contactblock = &contactdisplay(\%lt,$sysadm,$servadm,$version);
+ my $helpdeskscript;
+ my $contactblock = &contactdisplay(\%lt,$sysadm,$servadm,$version,$authdomain,\$helpdeskscript);
$r->print(<<ENDDOCUMENT);
</td>
@@ -534,6 +535,7 @@
// the if prevents the script error if the browser can not handle this
if ( document.client.uname ) { document.client.uname.focus(); }
</script>
+$helpdeskscript
ENDDOCUMENT
}
@@ -542,11 +544,15 @@
}
sub contactdisplay {
- my ($lt,$sysadm,$servadm,$version) = @_;
+ my ($lt,$sysadm,$servadm,$version,$authdomain,$helpdeskscript) = @_;
my $contactblock;
my $showsysadm = 1;
my $showservadm = 1;
- my $showhelpdesk = 1;
+ my $showhelpdesk = 0;
+ my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
+ if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
+ $showhelpdesk = 1;
+ }
if ($showsysadm) {
$contactblock .= '<b> '.$$lt{'sysadm'}.':</b><br />'.
'<tt> '.$sysadm.'</tt><br />';
@@ -556,7 +562,21 @@
'<tt> '.$servadm.'</tt><br /> <br />';
}
if ($showhelpdesk) {
- $contactblock .= '<b> <a href="/adm/helpdesk?origurl='.&Apache::lonnet::escape('/adm/login').'">'.$$lt{'helpdesk'}.'</a></b><br />';
+ $contactblock .= '<b> <a href="javascript:helpdesk()">'.$$lt{'helpdesk'}.'</a></b><br />';
+ my $thisurl = &Apache::lonnet::escape('/adm/login');
+ $$helpdeskscript = <<"ENDSCRIPT";
+<script type="text/javascript">
+function helpdesk() {
+ var codedom = document.client.udom.value;
+ if (codedom == '') {
+ codedom = "$authdomain";
+ }
+ var querystr = "origurl=$thisurl&codedom="+codedom;
+ document.location.href = "/adm/helpdesk?"+querystr;
+ return;
+}
+</script>
+ENDSCRIPT
}
$contactblock .= <<"ENDBLOCK";
$version