version 1.254, 2009/03/26 11:27:26
|
version 1.262, 2009/07/30 09:42:25
|
Line 384 sub selectbox {
|
Line 384 sub selectbox {
|
my $selout="\n".&Apache::lonhtmlcommon::row_title($title) |
my $selout="\n".&Apache::lonhtmlcommon::row_title($title) |
.'<select name="'.$name.'">'; |
.'<select name="'.$name.'">'; |
foreach (@idlist) { |
foreach (@idlist) { |
$selout.='<option value=\''.$_.'\''; |
$selout.='<option value="'.$_.'"'; |
if ($_ eq $value) { |
if ($_ eq $value) { |
$selout.=' selected>'.&{$functionref}($_).'</option>'; |
$selout.=' selected="selected"'; |
} |
} |
else {$selout.='>'.&{$functionref}($_).'</option>';} |
$selout.='>'.&{$functionref}($_).'</option>'; |
} |
} |
$selout.='</select>'.&Apache::lonhtmlcommon::row_closure(); |
$selout.='</select>'.&Apache::lonhtmlcommon::row_closure(); |
return $selout; |
return $selout; |
Line 1166 sub publish {
|
Line 1166 sub publish {
|
} |
} |
} |
} |
if ($chparms) { |
if ($chparms) { |
$scrout.='<p><b>'.&mt('Obsolete parameters or saved values').':</b> '. |
$scrout.='<p><b>'.&mt('Obsolete parameters or saved values').':</b> ' |
$chparms.'</p><h1><span class="LC_warning">'.&mt('Warning!'). |
.$chparms.'</p>' |
'</span></h1><p><span class="LC_warning">'. |
.'<p class="LC_warning"><b>'.&mt('Warning!').'</b><br />' |
&mt('If this resource is in active use, student performance data from the previous version may become inaccessible.').'</span></p><hr />'; |
.&mt('If this resource is in active use, student performance data from the previous version may become inaccessible.') |
|
.'</p><hr />'; |
} |
} |
if ($metadatafields{'copyright'} eq 'priv') { |
if ($metadatafields{'copyright'} eq 'priv') { |
$scrout.='</p><h1><span class="LC_warning">'.&mt('Warning!'). |
$scrout.='<p class="LC_warning"><b>'.&mt('Warning!').'</b><br />' |
'</span></h1><p><span class="LC_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.') |
&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.').'</span></p><hr />'; |
.'</p><hr />'; |
} |
} |
|
|
# ------------------------------------------------------- Now have all metadata |
# ------------------------------------------------------- Now have all metadata |
Line 1401 END
|
Line 1402 END
|
(&Apache::loncommon::source_copyrightids)); |
(&Apache::loncommon::source_copyrightids)); |
# $intr_scrout.=&text_with_browse_field('Source Custom Distribution File','sourcerights',$metadatafields{'sourcerights'},'rights'); |
# $intr_scrout.=&text_with_browse_field('Source Custom Distribution File','sourcerights',$metadatafields{'sourcerights'},'rights'); |
my $uctitle=&mt('Obsolete'); |
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) |
$intr_scrout.="\n".&Apache::lonhtmlcommon::row_title($uctitle) |
.'<input type="checkbox" name="obsolete" '.$obsolete_checked.'/ >' |
.'<input type="checkbox" name="obsolete"'.$obsolete_checked.' />' |
.&Apache::lonhtmlcommon::row_closure(1); |
.&Apache::lonhtmlcommon::row_closure(1); |
$intr_scrout.=&text_with_browse_field('Suggested Replacement for Obsolete File', |
$intr_scrout.=&text_with_browse_field('Suggested Replacement for Obsolete File', |
'obsoletereplacement', |
'obsoletereplacement', |
Line 1640 sub phasetwo {
|
Line 1641 sub phasetwo {
|
my $srcf=$2; |
my $srcf=$2; |
my $srct=$3; |
my $srct=$3; |
my $srcd=$1; |
my $srcd=$1; |
unless ($srcd=~/^\/home\/httpd\/html\/res/) { |
my $docroot = $Apache::lonnet::perlvar{'lonDocRoot'}; |
|
unless ($srcd=~/^\Q$docroot\E\/res/) { |
print $logfile "\nPANIC: Target dir is ".$srcd; |
print $logfile "\nPANIC: Target dir is ".$srcd; |
$r->print( |
$r->print( |
"<span class=\"LC_error\">".&mt('Invalid target directory, FAIL')."</span>"); |
"<span class=\"LC_error\">".&mt('Invalid target directory, FAIL')."</span>"); |
Line 1708 sub phasetwo {
|
Line 1710 sub phasetwo {
|
$path.="/$parts[$count]"; |
$path.="/$parts[$count]"; |
if ((-e $path)!=1) { |
if ((-e $path)!=1) { |
print $logfile "\nCreating directory ".$path; |
print $logfile "\nCreating directory ".$path; |
$r->print('<p>'.&mt('Created directory').' '.$parts[$count].'</p>'); |
|
mkdir($path,0777); |
mkdir($path,0777); |
|
$r->print('<p>' |
|
.&mt('Created directory [_1]' |
|
,'<span class="LC_filename">'.$parts[$count].'</span>') |
|
.'</p>' |
|
); |
} |
} |
} |
} |
|
|
Line 1752 sub phasetwo {
|
Line 1758 sub phasetwo {
|
&Apache::lonnet::devalidate_cache_new('meta', |
&Apache::lonnet::devalidate_cache_new('meta', |
&Apache::lonnet::declutter($thisdistarget)); |
&Apache::lonnet::declutter($thisdistarget)); |
|
|
|
# ------------------------------------------------------------- Everything done |
|
$logfile->close(); |
|
$r->print('<p class="LC_success">'.&mt('Done').'</p>'); |
|
|
# ------------------------------------------------ Provide link to new resource |
# ------------------------------------------------ Provide link to new resource |
unless ($batch) { |
unless ($batch) { |
|
|
my $thissrc=$source; |
my $thissrc=$source; |
$thissrc=~s{^/home/($match_username)/public_html}{/priv/$1}; |
$thissrc=~s{^/home/($match_username)/public_html}{/priv/$1}; |
|
|
my $thissrcdir=$thissrc; |
my $thissrcdir=$thissrc; |
$thissrcdir=~s/\/[^\/]+$/\//; |
$thissrcdir=~s/\/[^\/]+$/\//; |
|
|
|
$r->print(&Apache::lonhtmlcommon::start_funclist()); |
|
unless ($env{'request.role'}=~/^(aa)/) { |
|
$r->print( |
|
&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="'.$thisdistarget.'">' |
|
.&mt('View Published Version') |
|
.'</a>') |
|
); |
|
} |
$r->print( |
$r->print( |
'<hr /><a href="'.$thisdistarget.'"><font size="+2">'. |
&Apache::lonhtmlcommon::add_item_funclist( |
&mt('View Published Version').'</font></a>'. |
'<a href="'.$thissrc.'">' |
'<p><a href="'.$thissrc.'"><font size="+2">'. |
.&mt('Back to Source') |
&mt('Back to Source').'</font></a></p>'. |
.'</a>') |
'<p><a href="'.$thissrcdir. |
.&Apache::lonhtmlcommon::add_item_funclist( |
'"><font size="+2">'. |
'<a href="'.$thissrcdir.'">' |
&mt('Back to Source Directory').'</font></a></p>'); |
.&mt('Back to Source Directory') |
|
.'</a>') |
|
.&Apache::lonhtmlcommon::end_funclist() |
|
); |
} |
} |
$logfile->close(); |
|
$r->print('<p class="LC_success">'.&mt('Done').'</p>'); |
|
return 1; |
return 1; |
} |
} |
|
|
Line 1870 sub publishdirectory {
|
Line 1888 sub publishdirectory {
|
my $resdir= |
my $resdir= |
$Apache::lonnet::perlvar{'lonDocRoot'}.'/res/'.$cudom.'/'.$cuname.'/'. |
$Apache::lonnet::perlvar{'lonDocRoot'}.'/res/'.$cudom.'/'.$cuname.'/'. |
$thisdisfn; |
$thisdisfn; |
$r->print('<h1>'.&mt('Directory').' <tt>'.$thisdisfn.'</tt></h1>'. |
$r->print(&Apache::lonhtmlcommon::start_pick_box() |
&mt('Target').': <tt>'.$resdir.'</tt><br />'); |
.&Apache::lonhtmlcommon::row_title(&mt('Directory')) |
|
.'<span class="LC_filename">'.$thisdisfn.'</span>' |
|
.&Apache::lonhtmlcommon::row_closure() |
|
.&Apache::lonhtmlcommon::row_title(&mt('Target')) |
|
.'<span class="LC_filename">'.$resdir.'</span>' |
|
); |
|
|
my $dirptr=16384; # Mask indicating a directory in stat.cmode. |
my $dirptr=16384; # Mask indicating a directory in stat.cmode. |
unless ($env{'form.phase'} eq 'two') { |
unless ($env{'form.phase'} eq 'two') { |
# ask user what they want |
# ask user what they want |
|
$r->print(&Apache::lonhtmlcommon::row_closure() |
|
.&Apache::lonhtmlcommon::row_title(&mt('Options')) |
|
); |
$r->print('<form name="pubdirpref" method="post">'. |
$r->print('<form name="pubdirpref" method="post">'. |
&hiddenfield('phase','two'). |
&hiddenfield('phase','two'). |
&hiddenfield('filename',$env{'form.filename'}). |
&hiddenfield('filename',$env{'form.filename'}). |
Line 1884 sub publishdirectory {
|
Line 1910 sub publishdirectory {
|
&checkbox('obsolete','make file(s) obsolete'). |
&checkbox('obsolete','make file(s) obsolete'). |
&checkbox('forceoverride','force directory level metadata over existing'). |
&checkbox('forceoverride','force directory level metadata over existing'). |
'<br /><input type="submit" value="'.&mt('Publish Directory').'" /></form>'); |
'<br /><input type="submit" value="'.&mt('Publish Directory').'" /></form>'); |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1) |
|
.&Apache::lonhtmlcommon::end_pick_box() |
|
); |
$lock=0; |
$lock=0; |
} else { |
} else { |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1) |
|
.&Apache::lonhtmlcommon::end_pick_box() |
|
); |
unless ($lock) { $lock=&Apache::lonnet::set_lock(&mt('Publishing [_1]',$fn)); } |
unless ($lock) { $lock=&Apache::lonnet::set_lock(&mt('Publishing [_1]',$fn)); } |
# actually publish things |
# actually publish things |
opendir(DIR,$fn); |
opendir(DIR,$fn); |
Line 1965 sub defaultmetapublish {
|
Line 1997 sub defaultmetapublish {
|
for ($count=5;$count<$#parts;$count++) { |
for ($count=5;$count<$#parts;$count++) { |
$path.="/$parts[$count]"; |
$path.="/$parts[$count]"; |
if ((-e $path)!=1) { |
if ((-e $path)!=1) { |
$r->print('<p>'.&mt('Created directory').' '.$parts[$count].'</p>'); |
|
mkdir($path,0777); |
mkdir($path,0777); |
|
$r->print('<p>' |
|
.&mt('Created directory [_1]' |
|
,'<span class="LC_filename">'.$parts[$count].'</span>') |
|
.'</p>' |
|
); |
} |
} |
} |
} |
|
|
Line 2139 sub handler {
|
Line 2175 sub handler {
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
|
# Breadcrumbs |
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
&Apache::lonhtmlcommon::add_breadcrumb({ |
|
'text' => 'Construction Space', |
|
'href' => &Apache::loncommon::authorspace(), |
|
}); |
|
&Apache::lonhtmlcommon::add_breadcrumb({ |
|
'text' => 'Resource Publication', |
|
'href' => '', |
|
}); |
|
|
my $js='<script type="text/javascript">'. |
my $js='<script type="text/javascript">'. |
&Apache::loncommon::browser_and_searcher_javascript(). |
&Apache::loncommon::browser_and_searcher_javascript(). |
'</script>'; |
'</script>'; |
$r->print(&Apache::loncommon::start_page('Resource Publication',$js)); |
$r->print(&Apache::loncommon::start_page('Resource Publication',$js) |
|
.&Apache::lonhtmlcommon::breadcrumbs() |
|
.&Apache::loncommon::head_subbox( |
|
&Apache::loncommon::CSTR_pageheader()) # FIXME crumbs broken? |
|
); |
|
|
|
|
my $thisfn=$fn; |
my $thisfn=$fn; |
Line 2206 ENDCAPTION
|
Line 2257 ENDCAPTION
|
$r->print(&Apache::lonhtmlcommon::row_closure() |
$r->print(&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_title(&mt('Co-Author')) |
.&Apache::lonhtmlcommon::row_title(&mt('Co-Author')) |
.'<span class="LC_warning">' |
.'<span class="LC_warning">' |
.&mt('[_1] at [_2]',$cuname,$cudom) |
.&Apache::loncommon::plainname($cuname,$cudom) .' ('.$cuname.':'.$cudom.')' |
.'</span>' |
.'</span>' |
); |
); |
} |
} |
Line 2243 ENDDIFF
|
Line 2294 ENDDIFF
|
} |
} |
} else { |
} else { |
&phasetwo($r,$thisfn,$thistarget,$thisembstyle,$thisdistarget); |
&phasetwo($r,$thisfn,$thistarget,$thisembstyle,$thisdistarget); |
$r->print('<hr />'); |
|
} |
} |
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |