--- loncom/interface/loncommon.pm 2008/03/23 23:06:31 1.636.2.4
+++ loncom/interface/loncommon.pm 2009/05/07 16:25:02 1.806
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.636.2.4 2008/03/23 23:06:31 raeburn Exp $
+# $Id: loncommon.pm,v 1.806 2009/05/07 16:25:02 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -61,12 +61,15 @@ use POSIX qw(strftime mktime);
use Apache::lonmenu();
use Apache::lonenc();
use Apache::lonlocal;
+use Apache::lonnet();
use HTML::Entities;
use Apache::lonhtmlcommon();
use Apache::loncoursedata();
use Apache::lontexconvert();
use Apache::lonclonecourse();
use LONCAPA qw(:DEFAULT :match);
+use DateTime::TimeZone;
+use DateTime::Locale::Catalog;
# ---------------------------------------------- Designs
use vars qw(%defaultdesign);
@@ -78,6 +81,7 @@ my $readit;
## Global Variables
##
+
# ----------------------------------------------- SSI with retries:
#
@@ -91,7 +95,7 @@ my $readit;
Performs an ssi with some number of retries. Retries continue either
until the result is ok or until the retry count supplied by the
-caller is exhausted.
+caller is exhausted.
Inputs:
@@ -123,20 +127,23 @@ sub ssi_with_retries {
my ($resource, $retries, %form) = @_;
- my $ok = 0; # True if we got a good response.
+ my $ok = 0; # True if we got a good response.
my $content;
my $response;
# Try to get the ssi done. within the retries count:
do {
- ($content, $response) = &Apache::lonnet::ssi($resource, %form);
- $ok = $response->is_success;
- $retries--;
+ ($content, $response) = &Apache::lonnet::ssi($resource, %form);
+ $ok = $response->is_success;
+ if (!$ok) {
+ &Apache::lonnet::logthis("Failed ssi_with_retries on $resource: ".$response->is_success.', '.$response->code.', '.$response->message);
+ }
+ $retries--;
} while (!$ok && ($retries > 0));
if (!$ok) {
- $content = ''; # On error return an empty content.
+ $content = ''; # On error return an empty content.
}
return ($content, $response);
@@ -264,7 +271,7 @@ BEGIN {
}
}
&Apache::lonnet::logthis(
- "INFO: Read file types");
+ "INFO: Read file types");
$readit=1;
} # end of unless($readit)
@@ -280,14 +287,14 @@ BEGIN {
=over 4
-=item * browser_and_searcher_javascript ()
+=item * &browser_and_searcher_javascript()
XXReturns a string
containing javascript with two functions, C and
C. Returned string does not contain EscriptE
tags.
-=item * openbrowser(formname,elementname,only,omit) [javascript]
+=item * &openbrowser(formname,elementname,only,omit) [javascript]
inputs: formname, elementname, only, omit
@@ -300,7 +307,7 @@ with the given extension. Can be a comm
Specifying 'omit' will restrict the browser to NOT displaying files
with the given extension. Can be a comma separated list.
-=item * opensearcher(formname, elementname) [javascript]
+=item * &opensearcher(formname,elementname) [javascript]
Inputs: formname, elementname
@@ -385,7 +392,7 @@ sub storeresurl {
unless ($resurl=~/^\/res/) { return 0; }
$resurl=~s/\/$//;
&Apache::lonnet::put('environment',{'lastresurl' => $resurl});
- &Apache::lonnet::appenv('environment.lastresurl' => $resurl);
+ &Apache::lonnet::appenv({'environment.lastresurl' => $resurl});
return 1;
}
@@ -399,9 +406,9 @@ sub studentbrowser_javascript {
|| ($env{'request.role'}=~/^(au|dc|su)/)
) { return ''; }
return (<<'ENDSTDBRW');
-
+ENDAUTHORBRW
+}
+
sub coursebrowser_javascript {
my ($domainfilter,$sec_element,$formname)=@_;
my $crs_or_grp_alert = &mt('Please select the type of LON-CAPA entity - Course or Group - for which you wish to add/modify a user role');
my $output = '
- block
and html for two