version 1.176, 2005/04/22 18:21:05
|
version 1.184, 2005/06/09 20:41:38
|
Line 852 sub group_import {
|
Line 852 sub group_import {
|
} |
} |
} |
} |
if ($url) { |
if ($url) { |
my $idx = $#Apache::lonratedt::resources + 1; |
my $idx = &Apache::lonratedt::getresidx($url); |
$Apache::lonratedt::order[$#Apache::lonratedt::order+1]=$idx; |
$Apache::lonratedt::order[$#Apache::lonratedt::order+1]=$idx; |
my $ext = 'false'; |
my $ext = 'false'; |
if ($url=~/^http:\/\//) { $ext = 'true'; } |
if ($url=~/^http:\/\//) { $ext = 'true'; } |
Line 914 sub editor {
|
Line 914 sub editor {
|
($errtext,$fatal)= |
($errtext,$fatal)= |
&mapread($coursenum,$coursedom,$folder.'.'.$container); |
&mapread($coursenum,$coursedom,$folder.'.'.$container); |
if ($#Apache::lonratedt::order<1) { |
if ($#Apache::lonratedt::order<1) { |
$Apache::lonratedt::order[0]=1; |
my $idx=&Apache::lonratedt::getresidx(); |
$Apache::lonratedt::resources[1]=''; |
if ($idx<=0) { $idx=1; } |
|
$Apache::lonratedt::order[0]=$idx; |
|
$Apache::lonratedt::resources[$idx]=''; |
} |
} |
if (defined($env{'form.markcopy'})) { |
if (defined($env{'form.markcopy'})) { |
# Mark for copying |
# Mark for copying |
Line 1018 sub editor {
|
Line 1020 sub editor {
|
if ($url=~/^http\:\/\//) { $ext='true'; } |
if ($url=~/^http\:\/\//) { $ext='true'; } |
$url=~s/\:/\:/g; |
$url=~s/\:/\:/g; |
# Now insert the URL at the bottom |
# Now insert the URL at the bottom |
my $newidx=1+$#Apache::lonratedt::resources; |
my $newidx=&Apache::lonratedt::getresidx($url); |
$Apache::lonratedt::resources[$newidx]= |
$Apache::lonratedt::resources[$newidx]= |
$title.':'.$url.':'.$ext.':normal:res'; |
$title.':'.$url.':'.$ext.':normal:res'; |
$Apache::lonratedt::order[1+$#Apache::lonratedt::order]=$newidx; |
$Apache::lonratedt::order[1+$#Apache::lonratedt::order]=$newidx; |
Line 1034 sub editor {
|
Line 1036 sub editor {
|
if (($env{'form.uploaddoc.filename'}) && |
if (($env{'form.uploaddoc.filename'}) && |
($env{'form.cmd'}=~/^upload_(\w+)/)) { |
($env{'form.cmd'}=~/^upload_(\w+)/)) { |
if ( ($folder=~/^$1/) || ($1 eq 'default') ) { |
if ( ($folder=~/^$1/) || ($1 eq 'default') ) { |
|
my $destination = 'docs/'; |
|
if ($folder eq 'default') { |
|
$destination .= 'default/'; |
|
} elsif ($folder =~ /^default_(\d+)$/) { |
|
$destination .= $1.'/'; |
|
} |
# this is for a course, not a user, so set coursedoc flag |
# this is for a course, not a user, so set coursedoc flag |
# probably the only place in the system where this should be "1" |
# probably the only place in the system where this should be "1" |
my $newidx=$#Apache::lonratedt::resources+1; |
|
my $url=&Apache::lonnet::userfileupload('uploaddoc',1,'docs/'.$newidx); |
my $newidx=&Apache::lonratedt::getresidx(); |
|
$destination .= $newidx; |
|
my $url=&Apache::lonnet::userfileupload('uploaddoc',1,$destination); |
|
|
my $ext='false'; |
my $ext='false'; |
if ($url=~/^http\:\/\//) { $ext='true'; } |
if ($url=~/^http\:\/\//) { $ext='true'; } |
$url=~s/\:/\:/g; |
$url=~s/\:/\:/g; |
Line 1066 sub editor {
|
Line 1077 sub editor {
|
if ($cmd eq 'del') { |
if ($cmd eq 'del') { |
my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]); |
my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]); |
if ($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) { |
if ($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) { |
&Apache::lonnet::removeuploadedurl($url); |
unless ($url=~/\.(page|sequence|problem|exam|quiz|assess|survey|form|library)$/) { |
|
&Apache::lonnet::removeuploadedurl($url); |
|
} |
} |
} |
|
&Apache::lonratedt::makezombie($Apache::lonratedt::order[$idx]); |
for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) { |
for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) { |
$Apache::lonratedt::order[$i]= |
$Apache::lonratedt::order[$i]= |
$Apache::lonratedt::order[$i+1]; |
$Apache::lonratedt::order[$i+1]; |
Line 1075 sub editor {
|
Line 1089 sub editor {
|
$#Apache::lonratedt::order--; |
$#Apache::lonratedt::order--; |
} elsif ($cmd eq 'cut') { |
} elsif ($cmd eq 'cut') { |
my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]); |
my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]); |
|
&Apache::lonratedt::makezombie($Apache::lonratedt::order[$idx]); |
for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) { |
for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) { |
$Apache::lonratedt::order[$i]= |
$Apache::lonratedt::order[$i]= |
$Apache::lonratedt::order[$i+1]; |
$Apache::lonratedt::order[$i+1]; |
Line 1140 sub editor {
|
Line 1155 sub editor {
|
# Loading a complete map |
# Loading a complete map |
if (($env{'form.importmap'}) && ($env{'form.loadmap'})) { |
if (($env{'form.importmap'}) && ($env{'form.loadmap'})) { |
foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) { |
foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) { |
my $idx=$#Apache::lonratedt::resources; |
my ($title,$url,$ext,$type)=split(/\:/,$_); |
$idx++; |
my $idx=&Apache::lonratedt::getresidx($url); |
$Apache::lonratedt::resources[$idx]=$_; |
$Apache::lonratedt::resources[$idx]=$_; |
$Apache::lonratedt::order |
$Apache::lonratedt::order |
[$#Apache::lonratedt::order+1]=$idx; |
[$#Apache::lonratedt::order+1]=$idx; |
Line 1837 sub is_hash_old {
|
Line 1852 sub is_hash_old {
|
} |
} |
|
|
sub changewarning { |
sub changewarning { |
my ($r,$postexec)=@_; |
my ($r,$postexec,$message,$url)=@_; |
if (!&is_hash_old()) { return; } |
if (!&is_hash_old()) { return; } |
my $pathvar='folderpath'; |
my $pathvar='folderpath'; |
my $path=&Apache::lonnet::escape($env{'form.folderpath'}); |
my $path=&Apache::lonnet::escape($env{'form.folderpath'}); |
if (defined($env{'form.pagepath'})) { |
if (!defined($url)) { |
$pathvar='pagepath'; |
if (defined($env{'form.pagepath'})) { |
$path=&Apache::lonnet::escape($env{'form.pagepath'}); |
$pathvar='pagepath'; |
$path.='&symb='.&Apache::lonnet::escape($env{'form.pagesymb'}); |
$path=&Apache::lonnet::escape($env{'form.pagepath'}); |
|
$path.='&symb='.&Apache::lonnet::escape($env{'form.pagesymb'}); |
|
} |
|
$url='/adm/coursedocs?'.$pathvar.'='.$path; |
|
} |
|
if (!defined($message)) { |
|
$message='Changes will become active for your current session after [_1], or the next time you log in.'; |
} |
} |
$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 name="reinit" method="post" action="/adm/roles" target="loncapaclient">'. |
'<input type="hidden" name="orgurl" value="/adm/coursedocs?'. |
'<input type="hidden" name="orgurl" value="'.$url. |
$pathvar.'='.$path. |
|
'" /><input type="hidden" name="selectrole" value="1" /><h3><font color="red">'. |
'" /><input type="hidden" name="selectrole" value="1" /><h3><font color="red">'. |
&mt('Changes will become active for your current session after'). |
&mt($message,' <input type="hidden" name="'. |
' <input type="hidden" name="'. |
$env{'request.role'}.'" value="1" /><input type="button" value="'. |
$env{'request.role'}.'" value="1" /><input type="button" value="'. |
&mt('re-initializing course').'" onClick="reinit(this.form)" />'). |
&mt('re-initializing course').'" onClick="reinit(this.form)"/>'.&mt(', or the next time you log in.'). |
|
$help{'Caching'}.'</font></h3></form>'); |
$help{'Caching'}.'</font></h3></form>'); |
} |
} |
|
|
Line 2143 ENDNEWSCRIPT
|
Line 2162 ENDNEWSCRIPT
|
'upls' => 'Upload a new supplemental course document', |
'upls' => 'Upload a new supplemental course document', |
'impp' => 'Import a document', |
'impp' => 'Import a document', |
'pubd' => 'Published documents', |
'pubd' => 'Published documents', |
'copm' => 'All documents out of a published map', |
'copm' => 'All documents out of a published map into this folder', |
'spec' => 'Special documents', |
'spec' => 'Special documents', |
'upld' => 'Upload Document', |
'upld' => 'Upload Document', |
'srch' => 'Search', |
'srch' => 'Search', |
Line 2249 ENDCOURSEVERIFY
|
Line 2268 ENDCOURSEVERIFY
|
</tr> |
</tr> |
<tr><td bgcolor="#DDDDDD"> |
<tr><td bgcolor="#DDDDDD"> |
$lt{'file'}:<br /> |
$lt{'file'}:<br /> |
<form action="/adm/coursedocs" method="post" enctype="multipart/form-data"> |
<form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data"> |
<input type="file" name="uploaddoc" size="40"> |
<input type="file" name="uploaddoc" size="40"> |
<br /> |
<br /> |
$lt{'title'}:<br /> |
$lt{'title'}:<br /> |
Line 2273 $help{'Importing_LON-CAPA_Resource'}
|
Line 2292 $help{'Importing_LON-CAPA_Resource'}
|
</nobr> |
</nobr> |
<p> |
<p> |
<hr /> |
<hr /> |
$lt{'copm'} |
$lt{'copm'}<br /> |
<input type="text" size="20" name="importmap"><br /> |
<input type="text" size="40" name="importmap"><br /> |
<nobr><input type=button |
<nobr><input type=button |
onClick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')" |
onClick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')" |
value="$lt{'selm'}"> <input type="submit" name="loadmap" value="$lt{'load'}"> |
value="$lt{'selm'}"> <input type="submit" name="loadmap" value="$lt{'load'}"> |
Line 2389 $uploadtag
|
Line 2408 $uploadtag
|
<input name="newaboutsomeone" type="button" value="$lt{'abou'}" |
<input name="newaboutsomeone" type="button" value="$lt{'abou'}" |
onClick="javascript:makeabout();" /> |
onClick="javascript:makeabout();" /> |
</nobr> |
</nobr> |
|
</form> |
ENDFORM |
ENDFORM |
} |
} |
if ($env{'form.pagepath'}) { |
if ($env{'form.pagepath'}) { |
Line 2409 $uploadtag
|
Line 2429 $uploadtag
|
onClick="javascript:makeexamupload();" /> |
onClick="javascript:makeexamupload();" /> |
$help{'Score_Upload_Form'} |
$help{'Score_Upload_Form'} |
</nobr> |
</nobr> |
|
</form> |
ENDBLOCK |
ENDBLOCK |
$r->print('</form>'); |
|
} |
} |
$r->print('</td></tr>'."\n". |
$r->print('</td></tr>'."\n". |
'</table>'); |
'</table>'); |
Line 2499 ENDSUPFORM
|
Line 2519 ENDSUPFORM
|
} |
} |
} |
} |
if ($allowed) { |
if ($allowed) { |
$r->print('<form name="extimport"><input type="hidden" name="title"><input type="hidden" name="url"><input type="hidden" name="useform"></form>'); |
$r->print('<form method="POST" name="extimport" action="/adm/coursedocs"><input type="hidden" name="title" /><input type="hidden" name="url" /><input type="hidden" name="useform" /></form>'); |
} |
} |
$r->print('</table>'); |
$r->print('</table>'); |
} else { |
} else { |