--- loncom/interface/londocs.pm 2003/02/14 19:35:54 1.49 +++ loncom/interface/londocs.pm 2003/06/08 01:46:41 1.59 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.49 2003/02/14 19:35:54 www Exp $ +# $Id: londocs.pm,v 1.59 2003/06/08 01:46:41 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -179,6 +179,20 @@ sub editor { # Store the changed version &storemap($coursenum,$coursedom,$folder.'.sequence'); } +# Loading a complete map + if (($ENV{'form.importmap'}) && ($ENV{'form.loadmap'})) { + foreach +(&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$ENV{'form.importmap'}))) { + my $idx=$#Apache::lonratedt::resources; + $idx++; + $Apache::lonratedt::resources[$idx]=$_; + $Apache::lonratedt::order + [$#Apache::lonratedt::order+1]=$idx; + } + +# Store the changed version + &storemap($coursenum,$coursedom,$folder.'.sequence'); + } } # ---------------------------------------------------------------- End commands # ---------------------------------------------------------------- Print screen @@ -188,7 +202,7 @@ sub editor { my ($name,$url)=split(/\:/,$Apache::lonratedt::resources[$_]); unless ($name) { $name=(split(/\//,$url))[-1]; } unless ($name) { $name='NO RESOURCE'; $url='/adm/notfound.html'; } - $r->print(&entryline($idx,$name,$url,$folder,$allowed)); + $r->print(&entryline($idx,$name,$url,$folder,$allowed,$_)); $idx++; } $r->print(''); @@ -198,7 +212,7 @@ sub editor { # --------------------------------------------------------------- An entry line sub entryline { - my ($index,$title,$url,$folder,$allowed)=@_; + my ($index,$title,$url,$folder,$allowed,$residx)=@_; $title=~s/\&colon\;/\:/g; $title=&HTML::Entities::encode(&HTML::Entities::decode( &Apache::lonnet::unescape($title)),'\"\<\>\&\''); @@ -218,16 +232,18 @@ sub entryline { # Edit commands if ($allowed) { $line.=(< -
+ + - -
+ UP
+
+ DOWN
- -Remove +
+ +Remove -Rename +Rename END } # Figure out what kind of a resource this is @@ -249,6 +265,16 @@ END } } $url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//; + if ($residx) { + $url.=(($url=~/\?/)?'&':'?').'symb='. + &Apache::lonnet::escape(&Apache::lonnet::symbclean( + &Apache::lonnet::declutter('uploaded/'. + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.'/'. + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.'/'.$folder. + '.sequence'). + '___'.$residx.'___'. + &Apache::lonnet::declutter($url))); + } if ($isfolder) { $url.='&foldername='. &Apache::lonnet::escape($foldertitle); } $line.='print(< @@ -548,6 +580,16 @@ function makesmppage() { } } +function makesmpproblem() { + $noeggforyou + var title=prompt('Listed Title for the Problem'); + if (title) { + this.document.forms.newsmpproblem.importdetail.value= + title+'=/adm/wrapper/uploaded/$udom/$uname/$now.problem'; + this.document.forms.newsmpproblem.submit(); + } +} + function makebulboard() { var title=prompt('Listed Title for the Bulletin Board'); if (title) { @@ -575,6 +617,14 @@ function changename(folder,index,oldtitl this.document.forms.renameform.submit(); } } + +function removeres(folder,index,oldtitle) { + if ((oldtitle=='NO RESOURCE') || (confirm('Remove "'+oldtitle+'"?'))) { + this.document.forms.renameform.cmd.value='del_'+index; + this.document.forms.renameform.folder.value=folder; + this.document.forms.renameform.submit(); + } +} ENDNEWSCRIPT @@ -610,12 +660,20 @@ ENDCOURSEVERIFY ($allowed?' '.$help{'Main_Course_Documents'}:'').''); my $folder=$ENV{'form.folder'}; unless ($folder=~/^default/) { $folder='default'; } + my $postexec=''; + if ($folder eq 'default') { + $r->print(''); + } else { + $postexec='self.close();'; + } $hadchanges=0; &editor($r,$coursenum,$coursedom,$folder,$allowed); if ($hadchanges) { - $r->print('
'. -'

Changes will become active for your current session after , or the next time you log in.

'); + $r->print( +''. +'
'. +'

Changes will become active for your current session after , or the next time you log in.

'); } my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. '.sequence'; @@ -629,75 +687,115 @@ $ENV{'request.role'}.'" value="re-initia File:
- +
-Title:
+Title:
+ $help{'Uploading_From_Harddrive'} +
+ + + -$help{'Importing_LON-CAPA_Resource'} +$help{'Importing_LON-CAPA_Resource'} +
+

+


+ + +

+
+ $help{'Adding_Folders'} +value="New Folder" />$help{'Adding_Folders'} +
+ $help{'Adding_External_Resource'} +
+ - $help{'Creating_From_Template'} + $help{'Creating_From_Template'} +
+
+ $help{'Navigate_Content'} +
+ $help{'Creating_From_Template'} + +
+
+ + + + +$help{'Creating_From_Template'} +
+ -$help{'Creating_From_Template'} +$help{'Creating_From_Template'} +
+
+ -$help{'Creating_From_Template'} +$help{'Creating_From_Template'} +
+ ENDFORM @@ -724,55 +822,77 @@ ENDFORM
- +
Comment:
+ - $help{'Uploading_From_Harddrive'} + $help{'Uploading_From_Harddrive'} +
+
+ + $help{'Importing_LON-CAPA_Resource'} +

+


+ + +

+ $help{'Adding_Folders'} +
+ $help{'Adding_External_Resource'} +
+ -$help{'Creating_From_Template'} +$help{'Creating_From_Template'} +
+
+ -$help{'Creating_From_Template'} +$help{'Creating_From_Template'} +
+ ENDSUPFORM