--- loncom/interface/loncommon.pm 2004/09/15 06:11:40 1.212 +++ loncom/interface/loncommon.pm 2004/10/12 22:11:26 1.217 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.212 2004/09/15 06:11:40 albertel Exp $ +# $Id: loncommon.pm,v 1.217 2004/10/12 22:11:26 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -265,16 +265,22 @@ sub browser_and_searcher_javascript { url += 'form=' + formname + '&'; if (only != null) { url += 'only=' + only + '&'; - } + } else { + url += 'only=&'; + } if (omit != null) { url += 'omit=' + omit + '&'; - } + } else { + url += 'omit=&'; + } if (titleelement != null) { url += 'titleelement=' + titleelement + '&'; - } + } else { + url += 'titleelement=&'; + } url += 'element=' + elementname + ''; var title = 'Browser'; - var options = 'scrollbars=1,resizable=1,menubar=0'; + var options = 'scrollbars=1,resizable=1,menubar=1,location=1'; options += ',width=700,height=600'; editbrowser = open(url,title,options,'1'); editbrowser.focus(); @@ -290,7 +296,9 @@ sub browser_and_searcher_javascript { url += 'form=' + formname + '&'; if (titleelement != null) { url += 'titleelement=' + titleelement + '&'; - } + } else { + url += 'titleelement=&'; + } url += 'element=' + elementname + ''; var title = 'Search'; var options = 'scrollbars=1,resizable=1,menubar=0'; @@ -611,8 +619,9 @@ sub help_open_topic { # Add the graphic my $title = &mt('Online Help'); + my $helpicon=&lonhttpdurl("/adm/help/gif/smallHelp.gif"); $template .= <<"ENDTEMPLATE"; - (Help: $topic) + (Help: $topic) ENDTEMPLATE if ($text ne '') { $template.='' }; return $template; @@ -670,6 +679,7 @@ sub help_open_menu { "". "
$text"; } + my $helpicon=&lonhttpdurl("/adm/lonIcons/helpgateway.gif"); $template .= <<"ENDTEMPLATE"; - (Help Menu) + (Help Menu) ENDTEMPLATE if ($component_help) { if (!$text) { @@ -743,8 +753,9 @@ sub help_open_bug { # Add the graphic my $title = &mt('Report a Bug'); + my $bugicon=&lonhttpdurl("/adm/lonMisc/smallBug.gif"); $template .= <<"ENDTEMPLATE"; - (Bug: $topic) + (Bug: $topic) ENDTEMPLATE if ($text ne '') { $template.='
' }; return $template; @@ -787,8 +798,9 @@ sub help_open_faq { # Add the graphic my $title = &mt('View the FAQ'); + my $faqicon=&lonhttpdurl("/adm/lonMisc/smallFAQ.gif"); $template .= <<"ENDTEMPLATE"; - (FAQ: $topic) + (FAQ: $topic) ENDTEMPLATE if ($text ne '') { $template.='' }; return $template; @@ -2415,10 +2427,8 @@ sub domainlogo { my $domain = &determinedomain(shift); # See if there is a logo if (-e '/home/httpd/html/adm/lonDomLogos/'.$domain.'.gif') { - my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'}; - if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; } - return ''.$domain.''; + my $logo=&lonhttpdurl("/adm/lonDomLogos/$domain.gif"); + return ''.$domain.''; } elsif(exists($Apache::lonnet::domaindescription{$domain})) { return $Apache::lonnet::domaindescription{$domain}; } else { @@ -2745,12 +2755,12 @@ returns cache-controlling header code =cut sub cacheheader { - unless ($ENV{'request.method'} eq 'GET') { return ''; } - my $date=strftime("%a, %d %b %Y %H:%M:%S GMT",gmtime); - my $output .=' + unless ($ENV{'request.method'} eq 'GET') { return ''; } + my $date=strftime("%a, %d %b %Y %H:%M:%S GMT",gmtime); + my $output .=' '; - return $output; + return $output; } =pod @@ -2762,12 +2772,13 @@ specifies header code to not have cache =cut sub no_cache { - my ($r) = @_; - unless ($ENV{'request.method'} eq 'GET') { return ''; } - #my $date=strftime("%a, %d %b %Y %H:%M:%S GMT",gmtime); - $r->no_cache(1); - $r->header_out("Pragma" => "no-cache"); - #$r->header_out("Expires" => $date); + my ($r) = @_; + if ($ENV{'REQUEST_METHOD'} ne 'GET' && + $ENV{'request.method'} ne 'GET') { return ''; } + my $date=strftime("%a, %d %b %Y %H:%M:%S GMT",gmtime(time)); + $r->no_cache(1); + $r->header_out("Expires" => $date); + $r->header_out("Pragma" => "no-cache"); } sub content_type { @@ -3699,6 +3710,20 @@ sub icon { return $iconname; } +sub lonhttpdurl { + my ($url)=@_; + my $lonhttpd_port=$Apache::lonnet::perlvar{'lonhttpdPort'}; + if (!defined($lonhttpd_port)) { $lonhttpd_port='8080'; } + return 'http://'.$ENV{'SERVER_NAME'}.':'.$lonhttpd_port.$url; +} + +sub connection_aborted { + my ($r)=@_; + $r->print(" ");$r->rflush(); + my $c = $r->connection; + return $c->aborted(); +} + =pod =back