'.
+ &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
@@ -1166,7 +1185,7 @@ sub publish {
'
'.($env{'form.makeobsolete'}?'':'').'
'.
&hiddenfield('phase','two').
&hiddenfield('filename',$env{'form.filename'}).
- &hiddenfield('allmeta',&Apache::lonnet::escape($allmeta)).
+ &hiddenfield('allmeta',&escape($allmeta)).
&hiddenfield('dependencies',join(',',keys %allow));
unless ($env{'form.makeobsolete'}) {
$intr_scrout.=
@@ -1282,6 +1301,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'; }
@@ -1298,12 +1320,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');
@@ -1407,17 +1429,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;
}
}
@@ -1429,17 +1451,22 @@ 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";
+ "\n================= Publish ".localtime()." Phase Two ================\n".$env{'user.name'}.':'.$env{'user.domain'}."\n";
%metadatafields=();
%metadatakeys=();
- &metaeval(&Apache::lonnet::unescape($env{'form.allmeta'}));
+ &metaeval(&unescape($env{'form.allmeta'}));
$metadatafields{'title'}=$env{'form.title'};
$metadatafields{'author'}=$env{'form.author'};
@@ -1462,9 +1489,10 @@ sub phasetwo {
$metadatafields{'obsoletereplacement'}=
$env{'form.obsoletereplacement'};
$metadatafields{'dependencies'}=$env{'form.dependencies'};
- $metadatafields{'modifyinguser'}=$env{'user.name'}.'@'.
+ $metadatafields{'modifyinguser'}=$env{'user.name'}.':'.
$env{'user.domain'};
- $metadatafields{'authorspace'}=$cuname.'@'.$cudom;
+ $metadatafields{'authorspace'}=$cuname.':'.$cudom;
+ $metadatafields{'domain'}=$cudom;
my $allkeywords=$env{'form.addkey'};
if (exists($env{'form.keywords'})) {
@@ -1486,8 +1514,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;
}
}
@@ -1496,8 +1524,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) {
@@ -1550,7 +1578,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);
@@ -1576,8 +1604,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;
}
@@ -1592,8 +1620,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;
}
}
@@ -1625,8 +1653,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;
}
@@ -1640,7 +1668,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;
@@ -1663,7 +1691,7 @@ sub phasetwo {
unless ($batch) {
my $thissrc=$source;
- $thissrc=~s/^\/home\/(\w+)\/public_html/\/priv\/$1/;
+ $thissrc=~s{^/home/($match_username)/public_html}{/priv/$1};
my $thissrcdir=$thissrc;
$thissrcdir=~s/\/[^\/]+$/\//;
@@ -1783,7 +1811,7 @@ sub publishdirectory {
&hiddenfield('filename',$env{'form.filename'}).
&checkbox('pubrec','include subdirectories').
&checkbox('forcerepub','force republication of previously published files').
- &checkbox('forceobsolete','make file(s) obsolete').
+ &checkbox('obsolete','make file(s) obsolete').
&checkbox('forceoverride','force directory level catalog information over existing').
' ');
} else {
@@ -1815,10 +1843,16 @@ sub publishdirectory {
# previously published, modified now
$publishthis=1;
}
+ my $meta_cmtime = (stat($fn.'/'.$filename.'.meta'))[9];
+ my $meta_rmtime = (stat($resdir.'/'.$filename.'.meta'))[9];
+ if ( $meta_rmtime<$meta_cmtime ) {
+ $publishthis=1;
+ }
} else {
# never published
$publishthis=1;
}
+
if ($publishthis) {
&batchpublish($r,$fn.'/'.$filename,$resdir.'/'.$filename);
} else {
@@ -1847,8 +1881,7 @@ sub defaultmetapublish {
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
- $r->print('LON-CAPA Publishing');
- $r->print(&Apache::loncommon::bodytag('Catalog Information Publication'));
+ $r->print(&Apache::loncommon::start_page('Catalog Information Publication'));
# ---------------------------------------------------------------- Write Source
my $copyfile=$target;
@@ -1868,8 +1901,8 @@ sub defaultmetapublish {
if (copy($fn,$copyfile)) {
$r->print('
'.&mt('Copied source file').'
');
} else {
- return "".
- &mt('Failed to copy source').", $!, ".&mt('FAIL')."";
+ return "".
+ &mt('Failed to copy source').", $!, ".&mt('FAIL')."";
}
# --------------------------------------------------- Send update notifications
@@ -1884,7 +1917,7 @@ sub defaultmetapublish {
my $link=$fn;
$link=~s/^\/home\/$cuname\/public_html\//\/priv\/$cuname\//;
$r->print("".&mt('Back to Catalog Information').'');
- $r->print('