".
''.
- 'Select '.
- 'Search';
+ ''.&mt('Select').' '.
+ ''.&mt('Search').'';
}
@@ -409,15 +409,13 @@ sub urlfixup {
if ($url =~ /^mailto:/i) { return $url; }
#internal document links need no fixing
if ($url =~ /^\#/) { return $url; }
- my ($host)=($url=~/(?:(?:http|https|ftp)\:\/\/)*([^\/]+)/);
- my %all_hostnames = &Apache::lonnet::all_hostnames();
- foreach my $hostname (values(%all_hostnames)) {
- if ($hostname eq $host) {
- $url=~s/^(?:http|https|ftp)\:\/\///;
- $url=~s/^\Q$host\E//;
- }
+ my ($host)=($url=~m{(?:(?:http|https|ftp)://)*([^/]+)});
+ my @lonids = &Apache::lonnet::machine_ids($host);
+ if (@lonids) {
+ $url=~s{^(?:http|https|ftp)://}{};
+ $url=~s/^\Q$host\E//;
}
- if ($url=~/^(?:http|https|ftp)\:\/\//) { return $url; }
+ if ($url=~m{^(?:http|https|ftp)://}) { return $url; }
$url=~s{\Q~$cuname\E}{res/$cudom/$cuname};
return $url;
}
@@ -496,11 +494,15 @@ sub get_subscribed_hosts {
$target=~/(.*)\/([^\/]+)$/;
my $srcf=$2;
opendir(DIR,$1);
+ # cycle through listed files, subscriptions used to exist
+ # as "filename.lonid"
while ($filename=readdir(DIR)) {
if ($filename=~/\Q$srcf\E\.($match_lonid)$/) {
my $subhost=$1;
- if (($subhost ne 'meta' && $subhost ne 'subscription' &&
- $subhost ne 'tmp') &&
+ if (($subhost ne 'meta'
+ && $subhost ne 'subscription'
+ && $subhost ne 'meta.subscription'
+ && $subhost ne 'tmp') &&
($subhost ne $Apache::lonnet::perlvar{'lonHostID'})) {
push(@subscribed,$subhost);
}
@@ -652,7 +654,7 @@ sub fix_ids_and_indices {
join(', ',@duplicatedids));
if ($duplicateids) {
print $logfile "Duplicate ID(s) exist, ".join(', ',@duplicatedids)."\n";
- my $outstring=''.&mt('Unable to publish file, it contains duplicated ID(s), ID(s) need to be unique. The duplicated ID(s) are').': '.join(', ',@duplicatedids).'';
+ my $outstring=''.&mt('Unable to publish file, it contains duplicated ID(s), ID(s) need to be unique. The duplicated ID(s) are').': '.join(', ',@duplicatedids).'';
return ($outstring,1);
}
if ($needsfixup) {
@@ -823,15 +825,15 @@ sub store_metadata {
# Determine if the table exists
my $status = &Apache::lonmysql::check_table('metadata');
if (! defined($status)) {
- $error='WARNING: Cannot connect to '.
- 'database!';
+ $error='WARNING: Cannot connect to '.
+ 'database!';
&Apache::lonnet::logthis($error);
return ($error,undef);
}
if ($status == 0) {
# It would be nice to actually create the table....
- $error ='WARNING: The metadata table does not '.
- 'exist in the LON-CAPA database.';
+ $error ='WARNING: The metadata table does not '.
+ 'exist in the LON-CAPA database.';
&Apache::lonnet::logthis($error);
return ($error,undef);
}
@@ -839,15 +841,16 @@ sub store_metadata {
if (($metadata{'obsolete'}) || ($metadata{'copyright'} eq 'priv') ||
($metadata{'copyright'} eq 'custom')) {
# remove this entry
- $status=&LONCAPA::lonmetadata::delete_metadata($dbh,undef,
- $metadata{'url'});
+ my $delitem = 'url = '.$dbh->quote($metadata{'url'});
+ $status = &LONCAPA::lonmetadata::delete_metadata($dbh,undef,$delitem);
+
} else {
$status = &LONCAPA::lonmetadata::update_metadata($dbh,undef,undef,
\%metadata);
}
if (defined($status) && $status ne '') {
- $error='Error occured storing new values in '.
- 'metadata table in LON-CAPA database';
+ $error='Error occured saving new values in '.
+ 'metadata table in LON-CAPA database';
&Apache::lonnet::logthis($error);
&Apache::lonnet::logthis($status);
return ($error,undef);
@@ -869,9 +872,9 @@ sub checkonthis {
if (($errorcount) || ($warningcount)) {
$r->print(' '.$uri.': ');
if ($errorcount) {
- $r->print(''.
+ $r->print(''.
$errorcount.' '.
- &mt('error(s)').' ');
+ &mt('error(s)').' ');
}
if ($warningcount) {
$r->print(''.
@@ -935,7 +938,7 @@ sub publish {
my %allow=();
unless ($logfile=Apache::File->new('>>'.$source.'.log')) {
- return (''.&mt('No write permission to user directory, FAIL').'',1);
+ return (''.&mt('No write permission to user directory, FAIL').'',1);
}
print $logfile
"\n\n================= Publish ".localtime()." Phase One ================\n".$env{'user.name'}.':'.$env{'user.domain'}."\n";
@@ -949,7 +952,7 @@ sub publish {
print $logfile "Copied original file to ".$copyfile."\n";
} else {
print $logfile "Unable to write backup ".$copyfile.':'.$!."\n";
- return ("Failed to write backup copy, $!,FAIL",1);
+ return ("Failed to write backup copy, $!,FAIL",1);
}
# ------------------------------------------------------------- IDs and indices
@@ -961,24 +964,29 @@ sub publish {
$scrout.='
'.&mt('Dependencies').'
';
my $allowstr='';
- foreach (sort(keys(%allow))) {
- my $thisdep=$_;
+ foreach my $thisdep (sort(keys(%allow))) {
if ($thisdep !~ /[^\s]/) { next; }
+ if ($thisdep =~/\$/) {
+ $scrout.=' '
+ .&mt('The resource depends on another resource with variable filename, i.e., [_1].',''.$thisdep.'').' '
+ .&mt('You likely need to explicitly allow access to all possible dependencies using the [_1]-tag.','<allow>')
+ .' ';
+ }
unless ($style eq 'rat') {
$allowstr.="\n".'';
}
$scrout.=' ';
- if ($thisdep!~/\*/ && $thisdep!~m|^/adm/|) {
+ if ($thisdep!~/[\*\$]/ && $thisdep!~m|^/adm/|) {
$scrout.='';
}
$scrout.=''.$thisdep.'';
- if ($thisdep!~/\*/ && $thisdep!~m|^/adm/|) {
+ if ($thisdep!~/[\*\$]/ && $thisdep!~m|^/adm/|) {
$scrout.='';
if (
&Apache::lonnet::getfile($Apache::lonnet::perlvar{'lonDocRoot'}.'/'.
$thisdep.'.meta') eq '-1') {
- $scrout.= ' - '.&mt('Currently not available').
- '';
+ $scrout.= ' - '.&mt('Currently not available').
+ '';
} else {
my %temphash=(&Apache::lonnet::declutter($target).'___'.
&Apache::lonnet::declutter($thisdep).'___usage'
@@ -999,9 +1007,9 @@ sub publish {
my $org;
unless ($org=Apache::File->new('>'.$source)) {
print $logfile "No write permit to $source\n";
- return (''.&mt('No write permission to').
+ return (''.&mt('No write permission to').
' '.$source.
- ', '.&mt('FAIL').'',1);
+ ', '.&mt('FAIL').'',1);
}
print($org $outstring);
}
@@ -1106,7 +1114,7 @@ sub publish {
}
}
if ($chparms) {
- $scrout.='
'.&mt('New parameters or stored values').
+ $scrout.='
'.&mt('New parameters or saved values').
': '.$chparms.'
';
}
@@ -1123,11 +1131,16 @@ sub publish {
}
}
if ($chparms) {
- $scrout.='
'.&mt('Obsolete parameters or stored values').': '.
+ $scrout.='
'.&mt('Obsolete parameters or saved values').': '.
$chparms.'
'.&mt('Warning!').
'
'.
&mt('If this resource is in active use, student performance data from the previous version may become inaccessible.').'
';
}
+ if ($metadatafields{'copyright'} eq 'priv') {
+ $scrout.='
'.&mt('Warning!').
+ '
'.
+ &mt('Copyright/distribution option "Private" is no longer supported. Select another option from below. Consider "Custom Rights" for maximum control over the usage of your resource.').'
';
+ }
# ------------------------------------------------------- Now have all metadata
@@ -1287,6 +1300,9 @@ END
$metadatafields{'copyright'}='default';
$metadatafields{'sourceavail'}='open';
}
+ if ($metadatafields{'copyright'} eq 'priv') {
+ $metadatafields{'copyright'}='domain';
+ }
# ------------------------------------------------ Dial in reasonable defaults
my $defaultoption=$metadatafields{'copyright'};
unless ($defaultoption) { $defaultoption='default'; }
@@ -1303,12 +1319,12 @@ END
$intr_scrout.=&selectbox('Copyright/Distribution','copyright',
$defaultoption,
\&Apache::loncommon::copyrightdescription,
- (grep !/^public$/,(&Apache::loncommon::copyrightids)));
+ (grep !/^(public|priv)$/,(&Apache::loncommon::copyrightids)));
} else {
$intr_scrout.=&selectbox('Copyright/Distribution','copyright',
$defaultoption,
\&Apache::loncommon::copyrightdescription,
- (&Apache::loncommon::copyrightids));
+ (grep !/^priv$/,(&Apache::loncommon::copyrightids)));
}
my $copyright_help =
Apache::loncommon::help_open_topic('Publishing_Copyright');
@@ -1412,17 +1428,17 @@ sub phasetwo {
#
unless ($env{'form.obsolete'}) {
if ($target=~/(\_\_\_|\&\&\&|\:\:\:)/) {
- $r->print(
- ''.&mt('Unsupported character combination').
- ' "'.$1.'" '.&mt('in filename, FAIL').'');
+ $r->print(''.
+ &mt('Unsupported character combination [_1] in filename, FAIL.',"'.$1.'").
+ '');
return 0;
}
unless ($target=~/\.(\w+)$/) {
- $r->print(''.&mt('No valid extension found in filename, FAIL').'');
+ $r->print(''.&mt('No valid extension found in filename, FAIL').'');
return 0;
}
if ($target=~/\.(\d+)\.(\w+)$/) {
- $r->print(''.&mt('Cannot publish versioned resource, FAIL').'');
+ $r->print(''.&mt('Cannot publish versioned resource, FAIL').'');
return 0;
}
}
@@ -1434,10 +1450,15 @@ sub phasetwo {
my $logfile;
unless ($logfile=Apache::File->new('>>'.$source.'.log')) {
$r->print(
- ''.
- &mt('No write permission to user directory, FAIL').'');
+ ''.
+ &mt('No write permission to user directory, FAIL').'');
return 0;
}
+
+ if ($source =~ /\.rights$/) {
+ $r->print('
'.&mt('Warning: It can take up to 1 hour for rights changes to fully propagate.').'
');
+ }
+
print $logfile
"\n================= Publish ".localtime()." Phase Two ================\n".$env{'user.name'}.':'.$env{'user.domain'}."\n";
@@ -1492,8 +1513,8 @@ sub phasetwo {
my $file=$metadatafields{'customdistributionfile'};
unless ($file=~/\.rights$/) {
$r->print(
- ''.&mt('No valid custom distribution rights file specified, FAIL').
- '');
+ ''.&mt('No valid custom distribution rights file specified, FAIL').
+ '');
return 0;
}
}
@@ -1502,8 +1523,8 @@ sub phasetwo {
my $mfh;
unless ($mfh=Apache::File->new('>'.$source.'.meta')) {
$r->print(
- ''.&mt('Could not write metadata, FAIL').
- '');
+ ''.&mt('Could not write metadata, FAIL').
+ '');
return 0;
}
foreach (sort keys %metadatafields) {
@@ -1556,7 +1577,7 @@ sub phasetwo {
unless ($srcd=~/^\/home\/httpd\/html\/res/) {
print $logfile "\nPANIC: Target dir is ".$srcd;
$r->print(
- "Invalid target directory, FAIL");
+ "Invalid target directory, FAIL");
return 0;
}
opendir(DIR,$srcd);
@@ -1582,8 +1603,8 @@ sub phasetwo {
$r->print('
'.&mt('Copied old target file').'
');
} else {
print $logfile "Unable to write ".$copyfile.':'.$!."\n";
- $r->print("".&mt('Failed to copy old target').
- ", $!, ".&mt('FAIL')."");
+ $r->print("".&mt('Failed to copy old target').
+ ", $!, ".&mt('FAIL')."");
return 0;
}
@@ -1598,8 +1619,8 @@ sub phasetwo {
print $logfile "Unable to write metadata ".$copyfile.':'.$!."\n";
if (-e $target.'.meta') {
$r->print(
- "".
-&mt('Failed to write old metadata copy').", $!, ".&mt('FAIL')."");
+ "".
+&mt('Failed to write old metadata copy').", $!, ".&mt('FAIL')."");
return 0;
}
}
@@ -1631,8 +1652,8 @@ sub phasetwo {
$r->print('
'.&mt('Copied source file').'
');
} else {
print $logfile "\nUnable to write ".$copyfile.':'.$!."\n";
- $r->print("".
- &mt('Failed to copy source').", $!, ".&mt('FAIL')."");
+ $r->print("".
+ &mt('Failed to copy source').", $!, ".&mt('FAIL')."");
return 0;
}
@@ -1646,7 +1667,7 @@ sub phasetwo {
} else {
print $logfile "\nUnable to write metadata ".$copyfile.':'.$!."\n";
$r->print(
- "".&mt('Failed to write metadata copy').", $!, ".&mt('FAIL')."");
+ "".&mt('Failed to write metadata copy').", $!, ".&mt('FAIL')."");
return 0;
}
$r->rflush;
@@ -1879,8 +1900,8 @@ sub defaultmetapublish {
if (copy($fn,$copyfile)) {
$r->print('