version 1.270, 2011/10/22 22:05:23
|
version 1.285, 2013/10/16 18:17:23
|
Line 66 invocation by F<loncapa_apache.conf>:
|
Line 66 invocation by F<loncapa_apache.conf>:
|
|
|
=head1 OVERVIEW |
=head1 OVERVIEW |
|
|
Authors can only write-access the C</~authorname/> space. They can |
Authors can only write-access the C</priv/domain/authorname/> space. |
copy resources into the resource area through the publication step, |
They can copy resources into the resource area through the |
and move them back through a recover step. Authors do not have direct |
publication step, and move them back through a recover step. |
write-access to their resource space. |
Authors do not have direct write-access to their resource space. |
|
|
During the publication step, several events will be |
During the publication step, several events will be |
triggered. Metadata is gathered, where a wizard manages default |
triggered. Metadata is gathered, where a wizard manages default |
Line 121 use HTML::LCParser;
|
Line 121 use HTML::LCParser;
|
use HTML::Entities; |
use HTML::Entities; |
use Encode::Encoder; |
use Encode::Encoder; |
use Apache::lonxml; |
use Apache::lonxml; |
use Apache::loncacc; |
|
use DBI; |
use DBI; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon(); |
use Apache::loncommon(); |
Line 266 sub metaread {
|
Line 265 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 276 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 1017 sub publish {
|
Line 1016 sub publish {
|
$outdep.= ' - <span class="LC_error">'.&mt('Currently not available'). |
$outdep.= ' - <span class="LC_error">'.&mt('Currently not available'). |
'</span>'; |
'</span>'; |
} else { |
} else { |
|
# |
|
# Store the fact that the dependency has been used by the target file |
|
# Unfortunately, usage is erroneously named sequsage in lonmeta.pm |
|
# The translation happens in lonmetadata.pm |
|
# |
my %temphash=(&Apache::lonnet::declutter($target).'___'. |
my %temphash=(&Apache::lonnet::declutter($target).'___'. |
&Apache::lonnet::declutter($thisdep).'___usage' |
&Apache::lonnet::declutter($thisdep).'___usage' |
=> time); |
=> time); |
Line 1228 sub publish {
|
Line 1232 sub publish {
|
.'</p>' |
.'</p>' |
.'<p><input type="submit" value="' |
.'<p><input type="submit" value="' |
.&mt('Finalize Publication') |
.&mt('Finalize Publication') |
.'" /> <a href="'.&Apache::loncfile::display($source).'">'.&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 1766 sub phasetwo {
|
Line 1770 sub phasetwo {
|
# ------------------------------------------------ Provide link to new resource |
# ------------------------------------------------ Provide link to new resource |
unless ($batch) { |
unless ($batch) { |
|
|
my $thissrc=&Apache::loncfile::display($source); |
my $thissrc=&Apache::loncfile::url($source); |
my $thissrcdir=$thissrc; |
my $thissrcdir=$thissrc; |
$thissrcdir=~s/\/[^\/]+$/\//; |
$thissrcdir=~s/\/[^\/]+$/\//; |
|
|
$r->print(&Apache::loncommon::head_subbox( |
$r->print( |
&Apache::lonhtmlcommon::start_funclist(). |
&Apache::lonhtmlcommon::actionbox([ |
&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="'.$thisdistarget.'">'. |
'<a href="'.$thisdistarget.'">'. |
&mt('View Published Version'). |
&mt('View Published Version'). |
'</a>'). |
'</a>', |
&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="'.$thissrc.'">'. |
'<a href="'.$thissrc.'">'. |
&mt('Back to Source'). |
&mt('Back to Source'). |
'</a>'). |
'</a>', |
&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="'.$thissrcdir.'">'. |
'<a href="'.$thissrcdir.'">'. |
&mt('Back to Source Directory'). |
&mt('Back to Source Directory'). |
'</a>'). |
'</a>']) |
&Apache::lonhtmlcommon::end_funclist()) |
|
); |
); |
} |
} |
return 1; |
return 1; |
Line 1852 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">'.&Apache::loncfile::display($srcfile).'</span>') |
|
.'</h2>' |
.'</h2>' |
); |
); |
|
|
Line 1879 sub publishdirectory {
|
Line 1878 sub publishdirectory {
|
my ($r,$fn,$thisdisfn)=@_; |
my ($r,$fn,$thisdisfn)=@_; |
$fn=~s/\/+/\//g; |
$fn=~s/\/+/\//g; |
$thisdisfn=~s/\/+/\//g; |
$thisdisfn=~s/\/+/\//g; |
my $resdir= |
my $thisdisresdir=$thisdisfn; |
$Apache::lonnet::perlvar{'lonDocRoot'}.'/res/'.$cudom.'/'.$cuname.'/'. |
$thisdisresdir=~s/^\/priv\//\/res\//; |
$thisdisfn; |
my $resdir = $r->dir_config('lonDocRoot').$thisdisresdir; |
$r->print(&Apache::lonhtmlcommon::start_pick_box() |
$r->print(&Apache::lonhtmlcommon::start_pick_box() |
.&Apache::lonhtmlcommon::row_title(&mt('Directory')) |
.&Apache::lonhtmlcommon::row_title(&mt('Directory')) |
.'<span class="LC_filename">'.$thisdisfn.'</span>' |
.'<span class="LC_filename">'.$thisdisfn.'</span>' |
.&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_title(&mt('Target')) |
.&Apache::lonhtmlcommon::row_title(&mt('Target')) |
.'<span class="LC_filename">'.$resdir.'</span>' |
.'<span class="LC_filename">'.$thisdisresdir.'</span>' |
); |
); |
|
|
my $dirptr=16384; # Mask indicating a directory in stat.cmode. |
my $dirptr=16384; # Mask indicating a directory in stat.cmode. |
Line 1896 sub publishdirectory {
|
Line 1895 sub publishdirectory {
|
$r->print(&Apache::lonhtmlcommon::row_closure() |
$r->print(&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_title(&mt('Options')) |
.&Apache::lonhtmlcommon::row_title(&mt('Options')) |
); |
); |
$r->print('<form name="pubdirpref" method="post">'. |
$r->print('<form name="pubdirpref" method="post" action="">'. |
&hiddenfield('phase','two'). |
&hiddenfield('phase','two'). |
&hiddenfield('filename',$env{'form.filename'}). |
&hiddenfield('filename',$env{'form.filename'}). |
&checkbox('pubrec','include subdirectories'). |
&checkbox('pubrec','include subdirectories'). |
Line 2015 sub defaultmetapublish {
|
Line 2014 sub defaultmetapublish {
|
$r->print($reply.'</p><br />');$r->rflush; |
$r->print($reply.'</p><br />');$r->rflush; |
} |
} |
# ------------------------------------------------------------------- Link back |
# ------------------------------------------------------------------- Link back |
$r->print("<a href='".&Apache::lonnet::display($fn)."'>".&mt('Back to Metadata').'</a>'); |
$r->print("<a href='".&Apache::loncfile::display($fn)."'>".&mt('Back to Metadata').'</a>'); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
Line 2079 sub handler {
|
Line 2078 sub handler {
|
# -------------------------------------------------------------- Check filename |
# -------------------------------------------------------------- Check filename |
|
|
my $fn=&unescape($env{'form.filename'}); |
my $fn=&unescape($env{'form.filename'}); |
($cuname,$cudom)=&Apache::loncacc::constructaccess($fn); |
($cuname,$cudom)=&Apache::lonnet::constructaccess($fn); |
# ----------------------------------------------------- Do we have permissions? |
# ----------------------------------------------------- Do we have permissions? |
unless (($cuname) && ($cudom)) { |
unless (($cuname) && ($cudom)) { |
$r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}. |
$r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}. |
Line 2144 sub handler {
|
Line 2143 sub handler {
|
# Breadcrumbs |
# Breadcrumbs |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::add_breadcrumb({ |
&Apache::lonhtmlcommon::add_breadcrumb({ |
'text' => 'Construction Space', |
'text' => 'Authoring Space', |
'href' => &Apache::loncommon::authorspace(), |
'href' => &Apache::loncommon::authorspace($fn), |
}); |
}); |
&Apache::lonhtmlcommon::add_breadcrumb({ |
&Apache::lonhtmlcommon::add_breadcrumb({ |
'text' => 'Resource Publication', |
'text' => 'Resource Publication', |
Line 2158 sub handler {
|
Line 2157 sub handler {
|
$r->print(&Apache::loncommon::start_page('Resource Publication',$js) |
$r->print(&Apache::loncommon::start_page('Resource Publication',$js) |
.&Apache::lonhtmlcommon::breadcrumbs() |
.&Apache::lonhtmlcommon::breadcrumbs() |
.&Apache::loncommon::head_subbox( |
.&Apache::loncommon::head_subbox( |
&Apache::loncommon::CSTR_pageheader()) # FIXME crumbs broken? |
&Apache::loncommon::CSTR_pageheader($docroot.$fn)) |
); |
); |
|
|
my $thisdisfn=&HTML::Entities::encode($fn,'<>&"'); |
my $thisdisfn=&HTML::Entities::encode($fn,'<>&"'); |
Line 2168 sub handler {
|
Line 2167 sub handler {
|
|
|
if ($fn=~/\/$/) { |
if ($fn=~/\/$/) { |
# -------------------------------------------------------- This is a directory |
# -------------------------------------------------------- This is a directory |
&publishdirectory($r,$fn,$thisdisfn); |
&publishdirectory($r,$docroot.$fn,$thisdisfn); |
$r->print('<hr /><a href="'.$thisdisfn.'">'.&mt('Return to Directory').'</a>'); |
$r->print('<hr /><a href="'.$thisdisfn.'">'.&mt('Return to Directory').'</a>'); |
} else { |
} else { |
# ---------------------- Evaluate individual file, and then output information. |
# ---------------------- Evaluate individual file, and then output information. |
Line 2219 ENDCAPTION
|
Line 2218 ENDCAPTION
|
$r->print(&Apache::lonhtmlcommon::row_closure() |
$r->print(&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_title(&mt('Diffs'))); |
.&Apache::lonhtmlcommon::row_title(&mt('Diffs'))); |
$r->print(<<ENDDIFF); |
$r->print(<<ENDDIFF); |
<a href='javascript:void(window.open("/adm/diff?filename=$thisdisfn&versiontwo=priv","cat","height=300,width=500,scrollbars=1,resizable=1,menubar=0,location=1"))'> |
<a href='javascript:void(window.open("/adm/diff?filename=$thisdisfn&versiontwo=priv","cat","height=300,width=500,scrollbars=1,resizable=1,menubar=0,location=1"))'> |
ENDDIFF |
ENDDIFF |
$r->print(&mt('Diffs with Current Version').'</a>'); |
$r->print(&mt('Diffs with Current Version').'</a>'); |
} |
} |
Line 2238 ENDDIFF
|
Line 2237 ENDDIFF
|
} |
} |
unless ($errorcount) { |
unless ($errorcount) { |
my ($outstring,$error)= |
my ($outstring,$error)= |
&publish($docroot.$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 2246 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()); |