[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Mon, 05 Apr 2004 20:14:06 -0000
raeburn Mon Apr 5 16:14:06 2004 EDT
Modified files:
/loncom/interface londocs.pm
Log:
Modification to permit addition of content to .sequence files in subdirectories within
/userfiles (import of IMS packages will create these types of sequence files). Changes
are required to allow subsequent editing of the contents of these sequences via DOCS.
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.111 loncom/interface/londocs.pm:1.112
--- loncom/interface/londocs.pm:1.111 Wed Mar 31 00:23:59 2004
+++ loncom/interface/londocs.pm Mon Apr 5 16:14:06 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.111 2004/03/31 05:23:59 albertel Exp $
+# $Id: londocs.pm,v 1.112 2004/04/05 20:14:06 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -280,7 +280,7 @@
# upload a file, if present
if (($ENV{'form.uploaddoc.filename'}) &&
($ENV{'form.cmd'}=~/^upload_(\w+)/)) {
- if ($folder=~/^$1/) {
+ if ( ($folder=~/^$1/) || ($1 eq 'default') ) {
# this is for a course, not a user, so set coursedoc flag
# probably the only place in the system where this should be "1"
my $url=&Apache::lonnet::userfileupload('uploaddoc',1);
@@ -398,7 +398,7 @@
my ($name,$url)=split(/\:/,$Apache::lonratedt::resources[$_]);
unless ($name) { $name=(split(/\//,$url))[-1]; }
unless ($name) { next; }
- $r->print(&entryline($idx,$name,$url,$folder,$allowed,$_));
+ $r->print(&entryline($idx,$name,$url,$folder,$allowed,$_,$coursenum));
$idx++;
}
$r->print('</table>');
@@ -408,7 +408,7 @@
# --------------------------------------------------------------- An entry line
sub entryline {
- my ($index,$title,$url,$folder,$allowed,$residx)=@_;
+ my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_;
$title=~s/\&colon\;/\:/g;
$title=&HTML::Entities::encode(&HTML::Entities::decode(
&Apache::lonnet::unescape($title)),'"<>&\'');
@@ -458,7 +458,7 @@
if ($uploaded) {
if ($extension eq 'sequence') {
$icon=$iconpath.'/folder_closed.gif';
- $url=~/\/(\w+)\.sequence/;
+ $url=~/$coursenum\/([\/\w]+)\.sequence$/;
$url='/adm/coursedocs?folder='.$1;
$isfolder=1;
} else {
@@ -1125,7 +1125,9 @@
$r->print('<tr><td bgcolor="#BBBBBB"><h2>'.&mt('Main Course Documents').
($allowed?' '.$help{'Main_Course_Documents'}:'').'</h2>');
my $folder=$ENV{'form.folder'};
- unless ($folder=~/^default/) { $folder='default'; }
+ if ($folder eq '') {
+ $folder='default';
+ }
my $postexec='';
if ($folder eq 'default') {
$r->print('<script>this.window.name="loncapaclient";</script>');