--- loncom/publisher/lonpublisher.pm 2008/08/27 13:08:36 1.248
+++ loncom/publisher/lonpublisher.pm 2009/05/06 16:19:50 1.257
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Publication Handler
#
-# $Id: lonpublisher.pm,v 1.248 2008/08/27 13:08:36 raeburn Exp $
+# $Id: lonpublisher.pm,v 1.257 2009/05/06 16:19:50 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -384,11 +384,11 @@ sub selectbox {
my $selout="\n".&Apache::lonhtmlcommon::row_title($title)
.'';
foreach (@idlist) {
- $selout.=''.&{$functionref}($_).' ';
- }
- else {$selout.='>'.&{$functionref}($_).'';}
+ $selout.=' selected="selected"';
+ }
+ $selout.='>'.&{$functionref}($_).'';
}
$selout.=' '.&Apache::lonhtmlcommon::row_closure();
return $selout;
@@ -695,6 +695,7 @@ sub fix_ids_and_indices {
$responsecounter=0;
}
if ($lctag=~/response$/) { $responsecounter++; }
+ if ($lctag eq 'import') { $responsecounter++; }
my %parms=%{$token->[2]};
$counter=$addid{$tag};
if (!$counter) { $counter=$addid{$lctag}; }
@@ -1061,7 +1062,7 @@ sub publish {
my %oldparmstores=();
unless ($batch) {
- $scrout.='
'.&mt('Metadata Information').' ' .
+ $scrout.=''.&mt('Metadata').' ' .
&Apache::loncommon::help_open_topic("Metadata_Description")
. ' ';
}
@@ -1281,11 +1282,11 @@ END
$keywordout.=' '.$word.' ';
@@ -1400,9 +1401,9 @@ END
(&Apache::loncommon::source_copyrightids));
# $intr_scrout.=&text_with_browse_field('Source Custom Distribution File','sourcerights',$metadatafields{'sourcerights'},'rights');
my $uctitle=&mt('Obsolete');
- my $obsolete_checked=($metadatafields{'obsolete'})?' checked="1" ':'';
+ my $obsolete_checked=($metadatafields{'obsolete'})?' checked="checked"':'';
$intr_scrout.="\n".&Apache::lonhtmlcommon::row_title($uctitle)
- .' '
+ .' '
.&Apache::lonhtmlcommon::row_closure(1);
$intr_scrout.=&text_with_browse_field('Suggested Replacement for Obsolete File',
'obsoletereplacement',
@@ -1503,7 +1504,7 @@ sub phasetwo {
return 0;
}
if ($target=~/\.(\d+)\.(\w+)$/) {
- $r->print(''.&mt('Cannot publish versioned resource, FAIL').' ');
+ $r->print(''.&mt('Filename of resource contains internal version number. Cannot publish such resources, FAIL').' ');
return 0;
}
}
@@ -1651,14 +1652,14 @@ sub phasetwo {
unlink($srcd.'/'.$filename);
unlink($srcd.'/'.$filename.'.meta');
} else {
- if ($filename=~/\Q$srcf\E\.(\d+)\.\Q$srct\E$/) {
+ if ($filename=~/^\Q$srcf\E\.(\d+)\.\Q$srct\E$/) {
$maxversion=($1>$maxversion)?$1:$maxversion;
}
}
}
closedir(DIR);
$maxversion++;
- $r->print(' Creating old version '.$maxversion.'
');
+ $r->print(''.&mt('Creating old version [_1]',$maxversion).'
');
print $logfile "\nCreating old version ".$maxversion."\n";
my $copyfile=$srcd.'/'.$srcf.'.'.$maxversion.'.'.$srct;
@@ -1707,8 +1708,12 @@ sub phasetwo {
$path.="/$parts[$count]";
if ((-e $path)!=1) {
print $logfile "\nCreating directory ".$path;
- $r->print(''.&mt('Created directory').' '.$parts[$count].'
');
mkdir($path,0777);
+ $r->print(''
+ .&mt('Created directory [_1]'
+ ,''.$parts[$count].' ')
+ .'
'
+ );
}
}
@@ -1751,9 +1756,12 @@ sub phasetwo {
&Apache::lonnet::devalidate_cache_new('meta',
&Apache::lonnet::declutter($thisdistarget));
+# ------------------------------------------------------------- Everything done
+ $logfile->close();
+ $r->print(''.&mt('Done').'
');
+
# ------------------------------------------------ Provide link to new resource
unless ($batch) {
-
my $thissrc=$source;
$thissrc=~s{^/home/($match_username)/public_html}{/priv/$1};
@@ -1770,8 +1778,6 @@ sub phasetwo {
'">'.
&mt('Back to Source Directory').' ');
}
- $logfile->close();
- $r->print(''.&mt('Done').'
');
return 1;
}
@@ -1838,7 +1844,11 @@ sub batchpublish {
my $thisembstyle=&Apache::loncommon::fileembstyle($thistype);
- $r->print(''.&mt('Publishing').' '.$thisdisfn.' ');
+ $r->print(''
+ .&mt('Publishing [_1]'
+ ,''.$thisdisfn.' ')
+ .' '
+ );
# phase one takes
# my ($source,$target,$style,$batch)=@_;
@@ -1877,7 +1887,7 @@ sub publishdirectory {
&checkbox('pubrec','include subdirectories').
&checkbox('forcerepub','force republication of previously published files').
&checkbox('obsolete','make file(s) obsolete').
- &checkbox('forceoverride','force directory level catalog information over existing').
+ &checkbox('forceoverride','force directory level metadata over existing').
' ');
$lock=0;
} else {
@@ -1948,7 +1958,7 @@ sub defaultmetapublish {
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
- $r->print(&Apache::loncommon::start_page('Catalog Information Publication'));
+ $r->print(&Apache::loncommon::start_page('Metadata Publication'));
# ---------------------------------------------------------------- Write Source
my $copyfile=$target;
@@ -1960,8 +1970,12 @@ sub defaultmetapublish {
for ($count=5;$count<$#parts;$count++) {
$path.="/$parts[$count]";
if ((-e $path)!=1) {
- $r->print(''.&mt('Created directory').' '.$parts[$count].'
');
mkdir($path,0777);
+ $r->print(''
+ .&mt('Created directory [_1]'
+ ,''.$parts[$count].' ')
+ .'
'
+ );
}
}
@@ -1983,7 +1997,7 @@ sub defaultmetapublish {
# ------------------------------------------------------------------- Link back
my $link=$fn;
$link=~s/^\/home\/$cuname\/public_html\//\/priv\/$cuname\//;
- $r->print("".&mt('Back to Catalog Information').' ');
+ $r->print("".&mt('Back to Metadata').' ');
$r->print(&Apache::loncommon::end_page());
return OK;
}
@@ -2168,7 +2182,11 @@ sub handler {
my $thisembstyle=&Apache::loncommon::fileembstyle($thistype);
if ($thistype eq 'page') { $thisembstyle = 'rat'; }
- $r->print(''.&mt('Publishing [_1]',''.$thisdisfn.' ').' ');
+ $r->print(''
+ .&mt('Publishing [_1]'
+ ,''.$thisdisfn.' ')
+ .' '
+ );
$r->print(''.&mt('Resource Details').' ');