version 1.128, 2004/05/11 06:45:35
|
version 1.136, 2004/08/03 20:44:33
|
Line 121 sub dumpbutton {
|
Line 121 sub dumpbutton {
|
if ($home) { |
if ($home) { |
return '</td><td bgcolor="#DDDDCC">'. |
return '</td><td bgcolor="#DDDDCC">'. |
'<input type="submit" name="dumpcourse" value="'. |
'<input type="submit" name="dumpcourse" value="'. |
&mt('Dump Course DOCS to Construction Space').'" />'; |
&mt('Dump Course DOCS to Construction Space').'" />'. |
|
&Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs'); |
} else { |
} else { |
return'</td><td bgcolor="#DDDDCC">'. |
return'</td><td bgcolor="#DDDDCC">'. |
&mt('Dump Course DOCS to Construction Space: available on other servers'); |
&mt('Dump Course DOCS to Construction Space: available on other servers'); |
Line 156 sub dumpcourse {
|
Line 157 sub dumpcourse {
|
$crs=~s/\_/\//g; |
$crs=~s/\_/\//g; |
foreach (keys %replacehash) { |
foreach (keys %replacehash) { |
my $newfilename=$title.'/'.$replacehash{$_}; |
my $newfilename=$title.'/'.$replacehash{$_}; |
$newfilename=~s/[^\w\/\.]+/\_/g; |
$newfilename=~s/[^\w\/\.\/]+/\_/g; |
my @dirs=split(/\//,$newfilename); |
my @dirs=split(/\//,$newfilename); |
my $path='/home/'.$ca.'/public_html'; |
my $path='/home/'.$ca.'/public_html'; |
my $makepath=$path; |
my $makepath=$path; |
Line 200 sub dumpcourse {
|
Line 201 sub dumpcourse {
|
$r->print( |
$r->print( |
'<input type="hidden" name="authorspace" value="'.$1.'" />'); |
'<input type="hidden" name="authorspace" value="'.$1.'" />'); |
} else { |
} else { |
$r->print('<option value="'.$1.'">'.$_.'</option>'); |
$r->print('<option value="'.$1.'">'.$1.' - '. |
|
&Apache::loncommon::plainname(split(/\@/,$1)).'</option>'); |
} |
} |
} |
} |
} |
} |
Line 223 sub dumpcourse {
|
Line 225 sub dumpcourse {
|
$title=$_; |
$title=$_; |
} |
} |
$title=~s/\.(\w+)$//; |
$title=~s/\.(\w+)$//; |
$title=~s/\W+/\_/gs; |
$title=~s/[^\w\/]+/\_/gs; |
$title.='.'.$ext; |
$title.='.'.$ext; |
$r->print("\n<td><input type='text' size='60' name='namefor_".$_."' value='".$title."' /></td></tr>\n"); |
$r->print("\n<td><input type='text' size='60' name='namefor_".$_."' value='".$title."' /></td></tr>\n"); |
} |
} |
Line 493 sub editor {
|
Line 495 sub editor {
|
$r->print(&entryline($idx,$name,$url,$folder,$allowed,$_,$coursenum)); |
$r->print(&entryline($idx,$name,$url,$folder,$allowed,$_,$coursenum)); |
$idx++; |
$idx++; |
} |
} |
|
unless ($idx) { |
|
$r->print('<tr><td>'.&mt('Currently no documents.').'</td></tr>'); |
|
} |
$r->print('</table>'); |
$r->print('</table>'); |
} |
} |
} |
} |
Line 570 END
|
Line 575 END
|
my $isfolder=0; |
my $isfolder=0; |
my $folderarg; |
my $folderarg; |
if ($uploaded) { |
if ($uploaded) { |
if ($extension eq 'sequence') { |
if ($extension eq 'sequence') { |
$icon=$iconpath.'/folder_closed.gif'; |
$icon=$iconpath.'/folder_closed.gif'; |
$url=~/$coursenum\/([\/\w]+)\.sequence$/; |
$url=~/$coursenum\/([\/\w]+)\.sequence$/; |
$url='/adm/coursedocs?'; |
$url='/adm/coursedocs?'; |
$folderarg=$1; |
$folderarg=$1; |
$isfolder=1; |
$isfolder=1; |
} |
} else { |
|
&Apache::lonnet::allowuploaded('/adm/coursedoc',$url); |
|
} |
} |
} |
$url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//; |
$url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//; |
if ((!$isfolder) && ($residx) && ($folder!~/supplemental/)) { |
if ((!$isfolder) && ($residx) && ($folder!~/supplemental/)) { |
Line 643 ENDPARMS
|
Line 650 ENDPARMS
|
# ---------------------------------------------------------------- tie the hash |
# ---------------------------------------------------------------- tie the hash |
|
|
sub tiehash { |
sub tiehash { |
|
my ($mode)=@_; |
$hashtied=0; |
$hashtied=0; |
if ($ENV{'request.course.fn'}) { |
if ($ENV{'request.course.fn'}) { |
if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db", |
if ($mode eq 'write') { |
&GDBM_READER(),0640)) { |
if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db", |
|
&GDBM_WRCREAT(),0640)) { |
|
$hashtied=2; |
|
} |
|
} else { |
|
if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db", |
|
&GDBM_READER(),0640)) { |
$hashtied=1; |
$hashtied=1; |
} |
} |
|
} |
} |
} |
} |
} |
|
|
Line 814 sub checkversions {
|
Line 829 sub checkversions {
|
} else { |
} else { |
$r->print('<h1><font color="red">'.&mt('An Error Occured while Attempting to Store your Version Settings').'</font></h1>'); |
$r->print('<h1><font color="red">'.&mt('An Error Occured while Attempting to Store your Version Settings').'</font></h1>'); |
} |
} |
&changewarning($r,''); |
&mark_hash_old(); |
} |
} |
|
&changewarning($r,''); |
if ($ENV{'form.timerange'} eq 'all') { |
if ($ENV{'form.timerange'} eq 'all') { |
# show all documents |
# show all documents |
$header=&mt('All Documents in Course'); |
$header=&mt('All Documents in Course'); |
Line 935 ENDHEADERS
|
Line 951 ENDHEADERS
|
# Set version |
# Set version |
$r->print(&Apache::loncommon::select_form($setversions{$linkurl}, |
$r->print(&Apache::loncommon::select_form($setversions{$linkurl}, |
'set_version_'.$linkurl, |
'set_version_'.$linkurl, |
('' => '', |
('select_form_order' => |
|
['',1..$currentversion,'mostrecent'], |
|
'' => '', |
'mostrecent' => 'most recent', |
'mostrecent' => 'most recent', |
map {$_,$_} (1..$currentversion)))); |
map {$_,$_} (1..$currentversion)))); |
$r->print('</nobr></td></tr><tr><td></td>'); |
$r->print('</nobr></td></tr><tr><td></td>'); |
Line 996 ENDHEADERS
|
Line 1014 ENDHEADERS
|
&untiehash(); |
&untiehash(); |
} |
} |
|
|
|
sub mark_hash_old { |
|
my $retie_hash=0; |
|
if ($hashtied) { |
|
$retie_hash=1; |
|
&untiehash(); |
|
} |
|
&tiehash('write'); |
|
$hash{'old'}=1; |
|
&untiehash(); |
|
if ($retie_hash) { &tiehash(); } |
|
} |
|
|
|
sub is_hash_old { |
|
my $untie_hash=0; |
|
if (!$hashtied) { |
|
$untie_hash=1; |
|
&tiehash(); |
|
} |
|
my $return=$hash{'old'}; |
|
if ($untie_hash) { &untiehash(); } |
|
return $return; |
|
} |
|
|
sub changewarning { |
sub changewarning { |
my ($r,$postexec)=@_; |
my ($r,$postexec)=@_; |
|
if (!&is_hash_old()) { return; } |
$r->print( |
$r->print( |
'<script>function reinit(tf) { tf.submit();'.$postexec.' }</script>'. |
'<script>function reinit(tf) { tf.submit();'.$postexec.' }</script>'. |
'<form method="post" action="/adm/roles" target="loncapaclient">'. |
'<form method="post" action="/adm/roles" target="loncapaclient">'. |
Line 1023 sub handler {
|
Line 1065 sub handler {
|
'Adding_External_Resource','Navigate_Content', |
'Adding_External_Resource','Navigate_Content', |
'Adding_Folders','Docs_Overview', 'Load_Map', |
'Adding_Folders','Docs_Overview', 'Load_Map', |
'Supplemental', 'Score_Upload_Form', |
'Supplemental', 'Score_Upload_Form', |
'Importing_LON-CAPA_Resource','Uploading_From_Harddrive') { |
'Importing_LON-CAPA_Resource','Uploading_From_Harddrive', |
|
'Check_Resource_Versions','Verify_Content') { |
$help{$_}=&Apache::loncommon::help_open_topic('Docs_'.$_); |
$help{$_}=&Apache::loncommon::help_open_topic('Docs_'.$_); |
} |
} |
# Composite help files |
# Composite help files |
Line 1218 ENDNEWSCRIPT
|
Line 1261 ENDNEWSCRIPT
|
$r->print('</head>'. |
$r->print('</head>'. |
&Apache::loncommon::bodytag('Course Documents','',$events, |
&Apache::loncommon::bodytag('Course Documents','',$events, |
'','',$showdoc). |
'','',$showdoc). |
&Apache::loncommon::help_open_faq(273). |
&Apache::loncommon::help_open_menu('','','','',273,'RAT')); |
&Apache::loncommon::help_open_bug('RAT')); |
|
unless ($showdoc) { |
unless ($showdoc) { |
# ----------------------------------------------------------------------------- |
# ----------------------------------------------------------------------------- |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
Line 1276 ENDNEWSCRIPT
|
Line 1318 ENDNEWSCRIPT
|
<form action="/adm/coursedocs" method="post" name="courseverify"> |
<form action="/adm/coursedocs" method="post" name="courseverify"> |
<table bgcolor="#AAAAAA" width="100%" cellspacing="4" cellpadding="4"> |
<table bgcolor="#AAAAAA" width="100%" cellspacing="4" cellpadding="4"> |
<tr><td bgcolor="#DDDDCC"> |
<tr><td bgcolor="#DDDDCC"> |
<input type="submit" name="verify" value="$lt{'vc'}" /> |
<input type="submit" name="verify" value="$lt{'vc'}" />$help{'Verify_Content'} |
</td><td bgcolor="#DDDDCC"> |
</td><td bgcolor="#DDDDCC"> |
<input type="submit" name="versions" value="$lt{'cv'}" /> |
<input type="submit" name="versions" value="$lt{'cv'}" />$help{'Check_Resource_Versions'} |
$dumpbut |
$dumpbut |
</td></tr></table> |
</td></tr></table> |
</form> |
</form> |
Line 1306 ENDCOURSEVERIFY
|
Line 1348 ENDCOURSEVERIFY
|
$hadchanges=0; |
$hadchanges=0; |
&editor($r,$coursenum,$coursedom,$folder,$allowed); |
&editor($r,$coursenum,$coursedom,$folder,$allowed); |
if ($hadchanges) { |
if ($hadchanges) { |
&changewarning($r,$postexec); |
&mark_hash_old() |
} |
} |
|
&changewarning($r,$postexec); |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. |
'.sequence'; |
'.sequence'; |
$r->print(<<ENDFORM); |
$r->print(<<ENDFORM); |
Line 1325 $lt{'title'}:<br />
|
Line 1368 $lt{'title'}:<br />
|
<input type="text" size="50" name="comment"> |
<input type="text" size="50" name="comment"> |
<input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" /> |
<input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" /> |
<input type="hidden" name="cmd" value="upload_default"> |
<input type="hidden" name="cmd" value="upload_default"> |
<input type="submit" value="$lt{'upld'}"> |
|
<nobr> |
<nobr> |
|
<input type="submit" value="$lt{'upld'}"> |
$help{'Uploading_From_Harddrive'} |
$help{'Uploading_From_Harddrive'} |
</nobr> |
</nobr> |
</form> |
</form> |