version 1.268, 2011/10/22 15:16:20
|
version 1.272, 2011/10/25 14:28:17
|
Line 266 sub metaread {
|
Line 266 sub metaread {
|
my ($logfile,$fn,$prefix)=@_; |
my ($logfile,$fn,$prefix)=@_; |
unless (-e $fn) { |
unless (-e $fn) { |
print($logfile 'No file '.$fn."\n"); |
print($logfile 'No file '.$fn."\n"); |
return '<div><b>' |
return '<p class="LC_warning">' |
.&mt('No file: [_1]' |
.&mt('No file: [_1]',&Apache::loncfile::display($fn)) |
,'</b> <tt>'.&Apache::loncfile::display($fn).'</tt></div>'); |
.'</p>'; |
} |
} |
print($logfile 'Processing '.$fn."\n"); |
print($logfile 'Processing '.$fn."\n"); |
my $metastring; |
my $metastring; |
Line 277 sub metaread {
|
Line 277 sub metaread {
|
$metastring=join('',<$metafh>); |
$metastring=join('',<$metafh>); |
} |
} |
&metaeval($metastring,$prefix); |
&metaeval($metastring,$prefix); |
return '<div><b>' |
return '<p class="LC_info">' |
.&mt('Processed file: [_1]' |
.&mt('Processed file: [_1]',&Apache::loncfile::display($fn)) |
,'</b> <tt>'.&Apache::loncfile::display($fn).'</tt></div>'); |
.'</p>'; |
} |
} |
|
|
######################################### |
######################################### |
Line 1080 sub publish {
|
Line 1080 sub publish {
|
# ------------------------------------------------ Check out directory hierachy |
# ------------------------------------------------ Check out directory hierachy |
|
|
my $thisdisfn=$source; |
my $thisdisfn=$source; |
$thisdisfn=~s/^\/home\/\Q$cuname\E\///; |
|
|
|
my @urlparts=split(/\//,$thisdisfn); |
$thisdisfn=~s/^\Q$docroot\E\/priv\/\Q$cudom\E\/\Q$cuname\E\///; |
|
my @urlparts=('.',split(/\//,$thisdisfn)); |
$#urlparts--; |
$#urlparts--; |
|
|
my $currentpath='/home/'.$cuname.'/'; |
my $currentpath=$docroot.'/priv/'.$cudom.'/'.$cuname.'/'; |
|
|
my $prefix='../'x($#urlparts); |
my $prefix='../'x($#urlparts); |
foreach (@urlparts) { |
foreach my $subdir (@urlparts) { |
$currentpath.=$_.'/'; |
$currentpath.=$subdir.'/'; |
$scrout.=&metaread($logfile,$currentpath.'default.meta',$prefix); |
$scrout.=&metaread($logfile,$currentpath.'default.meta',$prefix); |
$prefix=~s|^\.\./||; |
$prefix=~s|^\.\./||; |
} |
} |
Line 1223 sub publish {
|
Line 1223 sub publish {
|
my $intr_scrout.='<br />' |
my $intr_scrout.='<br />' |
.'<form name="pubform" action="/adm/publish" method="post">'; |
.'<form name="pubform" action="/adm/publish" method="post">'; |
unless ($env{'form.makeobsolete'}) { |
unless ($env{'form.makeobsolete'}) { |
my $thissrc=$source; |
|
$thissrc=~s{^/home/($match_username)/public_html}{/priv/$1}; |
|
$intr_scrout.='<p class="LC_warning">' |
$intr_scrout.='<p class="LC_warning">' |
.&mt('Searching for your resource will be based on the following metadata. Please provide as much data as possible.') |
.&mt('Searching for your resource will be based on the following metadata. Please provide as much data as possible.') |
.'</p>' |
.'</p>' |
.'<p><input type="submit" value="' |
.'<p><input type="submit" value="' |
.&mt('Finalize Publication') |
.&mt('Finalize Publication') |
.'" /> <a href="'.$thissrc.'">'.&mt('Cancel').'</a></p>'; |
.'" /> <a href="'.&Apache::loncfile::url($source).'">'.&mt('Cancel').'</a></p>'; |
} |
} |
$intr_scrout.=&Apache::lonhtmlcommon::start_pick_box(); |
$intr_scrout.=&Apache::lonhtmlcommon::start_pick_box(); |
$intr_scrout.= |
$intr_scrout.= |
Line 1767 sub phasetwo {
|
Line 1765 sub phasetwo {
|
|
|
# ------------------------------------------------ Provide link to new resource |
# ------------------------------------------------ Provide link to new resource |
unless ($batch) { |
unless ($batch) { |
my $thissrc=$source; |
|
$thissrc=~s{^/home/($match_username)/public_html}{/priv/$1}; |
|
|
|
|
my $thissrc=&Apache::loncfile::url($source); |
my $thissrcdir=$thissrc; |
my $thissrcdir=$thissrc; |
$thissrcdir=~s/\/[^\/]+$/\//; |
$thissrcdir=~s/\/[^\/]+$/\//; |
|
|
Line 1839 sub batchpublish {
|
Line 1836 sub batchpublish {
|
my %oldenv=%env; |
my %oldenv=%env; |
$srcfile=~s/\/+/\//g; |
$srcfile=~s/\/+/\//g; |
$targetfile=~s/\/+/\//g; |
$targetfile=~s/\/+/\//g; |
my $thisdisfn=$srcfile; |
|
$thisdisfn=~s/\/home\/korte\/public_html\///; |
|
$srcfile=~s/\/+/\//g; |
$srcfile=~s/\/+/\//g; |
|
|
my $docroot=$r->dir_config('lonDocRoot'); |
my $docroot=$r->dir_config('lonDocRoot'); |
Line 1857 sub batchpublish {
|
Line 1852 sub batchpublish {
|
my $thisembstyle=&Apache::loncommon::fileembstyle($thistype); |
my $thisembstyle=&Apache::loncommon::fileembstyle($thistype); |
|
|
$r->print('<h2>' |
$r->print('<h2>' |
.&mt('Publishing [_1]' |
.&mt('Publishing [_1]',&Apache::loncfile::display($srcfile)) |
,'<span class="LC_filename">'.$thisdisfn.'</span>') |
|
.'</h2>' |
.'</h2>' |
); |
); |
|
|
Line 1973 sub publishdirectory {
|
Line 1967 sub publishdirectory {
|
|
|
sub defaultmetapublish { |
sub defaultmetapublish { |
my ($r,$fn,$cuname,$cudom)=@_; |
my ($r,$fn,$cuname,$cudom)=@_; |
$fn=~s/^\/\~$cuname\//\/home\/$cuname\/public_html\//; |
|
unless (-e $fn) { |
unless (-e $fn) { |
return HTTP_NOT_FOUND; |
return HTTP_NOT_FOUND; |
} |
} |
my $target=$fn; |
my $target=$fn; |
$target=~s/^\/home\/$cuname\/public_html\//$Apache::lonnet::perlvar{'lonDocRoot'}\/res\/$cudom\/$cuname\//; |
$target=~s/^\Q$Apache::lonnet::perlvar{'lonDocRoot'}\E\/priv\//\Q$Apache::lonnet::perlvar{'lonDocRoot'}\E\/res\//; |
|
|
|
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
Line 2021 sub defaultmetapublish {
|
Line 2014 sub defaultmetapublish {
|
$r->print($reply.'</p><br />');$r->rflush; |
$r->print($reply.'</p><br />');$r->rflush; |
} |
} |
# ------------------------------------------------------------------- Link back |
# ------------------------------------------------------------------- Link back |
my $link=$fn; |
$r->print("<a href='".&Apache::lonnet::display($fn)."'>".&mt('Back to Metadata').'</a>'); |
$link=~s/^\/home\/$cuname\/public_html\//\/priv\/$cuname\//; |
|
$r->print("<a href='$link'>".&mt('Back to Metadata').'</a>'); |
|
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
Line 2246 ENDDIFF
|
Line 2237 ENDDIFF
|
} |
} |
unless ($errorcount) { |
unless ($errorcount) { |
my ($outstring,$error)= |
my ($outstring,$error)= |
&publish($fn,$thistarget,$thisembstyle); |
&publish($docroot.$fn,$docroot.$thistarget,$thisembstyle); |
$r->print($outstring); |
$r->print($outstring); |
} else { |
} else { |
$r->print('<h3 class="LC_error">'. |
$r->print('<h3 class="LC_error">'. |
Line 2254 ENDDIFF
|
Line 2245 ENDDIFF
|
'</h3>'); |
'</h3>'); |
} |
} |
} else { |
} else { |
&phasetwo($r,$fn,$thistarget,$thisembstyle,$thisdistarget); |
&phasetwo($r,$docroot.$fn,$docroot.$thistarget,$thisembstyle,$thisdistarget); |
} |
} |
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |