';
+ return "".&mt('IMS Export')."".
+ &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').' ';
}
@@ -279,6 +280,7 @@ sub exportcourse {
my %discussiontime = &Apache::lonnet::dump('discussiontimes',
$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
my $numdisc = keys(%discussiontime);
+ my $numprobs = 0;
my $navmap = Apache::lonnavmaps::navmap->new();
if (!defined($navmap)) {
$r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package').
@@ -309,6 +311,7 @@ sub exportcourse {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['archive','discussion']);
+ my $format = $env{'form.format'};
my @exportitems = &Apache::loncommon::get_env_multiple('form.archive');
my @discussions = &Apache::loncommon::get_env_multiple('form.discussion');
if (@exportitems == 0 && @discussions == 0) {
@@ -330,9 +333,10 @@ sub exportcourse {
my $imsresources;
my $tempexport;
my $copyresult;
- my $ims_manifest = &create_ims_store($now,\$manifestok,\$outcome,\$tempexport);
+ my $testbank;
+ my $ims_manifest = &create_ims_store($now,\$manifestok,\$outcome,\$tempexport,$format,\$testbank);
if ($manifestok) {
- &build_package($now,$navmap,\@exportitems,\@discussions,\$outcome,$tempexport,\$copyresult,$ims_manifest);
+ &build_package($now,$navmap,\@exportitems,\@discussions,\$outcome,$tempexport,\$copyresult,$ims_manifest,$format,$testbank);
close($ims_manifest);
#Create zip file in prtspool
@@ -358,7 +362,7 @@ sub exportcourse {
} else {
$outcome = '
'
.&mt('Unfortunately you will not be able to retrieve'
- .' an IMS archive of this posts at this time,'
+ .' an IMS archive of your course at this time,'
.' because there was a problem creating a'
.' manifest file.')
.'
'.&mt('Caution: this folder is set to randomly pick a subset of resources. Adding or removing resources from this folder will change the set of resources that the students see, resulting in spurious or missing credit for completed problems, not limited to ones you modify. Do not modify the contents of this folder if it is in active student use.').'
');
- }
- if ($is_random_order) {
- $r->print('
'.&mt('Caution: this folder is set to randomly order its contents. Adding or removing resources from this folder will change the order of resources shown.').'
');
+ ($is_random_order?'
'.&mt('random order').'
':'').
+ '');
+ if ($randompick>=0) {
+ $r->print('
'
+ .&mt('Caution: this folder is set to randomly pick a subset'
+ .' of resources. Adding or removing resources from this'
+ .' folder will change the set of resources that the'
+ .' students see, resulting in spurious or missing credit'
+ .' for completed problems, not limited to ones you'
+ .' modify. Do not modify the contents of this folder if'
+ .' it is in active student use.')
+ .'
'
+ .&mt('Caution: this folder is set to randomly order its'
+ .' contents. Adding or removing resources from this folder'
+ .' will change the order of resources shown.')
+ .'
\n");
if ($allowed) {
+ $r->print(&generate_edit_table($tid,$orderhash,$to_show));
&print_paste_buffer($r,$container);
+ } else {
+ $r->print($to_show);
}
return;
}
@@ -1636,11 +1799,10 @@ sub editor {
sub process_file_upload {
my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd) = @_;
# upload a file, if present
- my $parseaction;
- if ($env{'form.parserflag'}) {
+ my ($parseaction,$showupload,$nextphase,$mimetype);
+ if ($env{'form.parserflag'}) {
$parseaction = 'parse';
}
- my $phase_status;
my $folder=$env{'form.folder'};
if ($folder eq '') {
$folder='default';
@@ -1659,7 +1821,8 @@ sub process_file_upload {
$LONCAPA::map::resources[1]='';
}
if ($fatal) {
- return 'failed';
+ $$upload_output = '
'.&mt('The uploaded file has not been stored as an error occurred reading the contents of the current folder.').'
';
+ return;
}
my $destination = 'docs/';
if ($folder =~ /^supplemental/) {
@@ -1670,13 +1833,23 @@ sub process_file_upload {
} elsif ($folder =~ /^(default|supplemental)_(\d+)$/) {
$destination .= $2.'/';
}
-# this is for a course, not a user, so set coursedoc flag
-# probably the only place in the system where this should be "1"
+# this is for a course, not a user, so set context to coursedoc.
my $newidx=&LONCAPA::map::getresidx();
$destination .= $newidx;
- my $url=&Apache::lonnet::userfileupload('uploaddoc',1,$destination,
+ my $url=&Apache::lonnet::userfileupload('uploaddoc','coursedoc',$destination,
$parseaction,$allfiles,
- $codebase);
+ $codebase,undef,undef,undef,undef,
+ undef,undef,\$mimetype);
+ if ($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E.*/([^/]+)$}) {
+ my $stored = $1;
+ $showupload = '
\n");
}
- $r->print(''.&mt('Return to DOCS').'');
}
sub verifycontent {
my ($r) = @_;
my $crstype = &Apache::loncommon::course_type();
- my $loaderror=&Apache::lonnet::overloaderror($r);
- if ($loaderror) { return $loaderror; }
$r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents'));
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents'));
+ &startContentScreen($r,'tools');
$hashtied=0;
undef %alreadyseen;
%alreadyseen=();
@@ -2232,9 +2387,9 @@ sub verifycontent {
if ($hash{$key}=~/\.(page|sequence)$/) {
if (($key=~/^src_/) && ($alreadyseen{&unescape($hash{$key})})) {
$r->print(''.
- &mt('The following sequence or page is included more than once in your '.$crstype.': ').
+ &mt('The following sequence or page is included more than once in your '.$crstype.':').' '.
&unescape($hash{$key}).' '.
- &mt('Note that grading records for problems included in this sequence or folder will overlap.'));
+ &mt('Note that grading records for problems included in this sequence or folder will overlap.').'');
}
}
if (($key=~/^src\_(.+)$/) && (!$alreadyseen{&unescape($hash{$key})})) {
@@ -2242,8 +2397,7 @@ sub verifycontent {
}
}
&untiehash();
- $r->print('
');
}
@@ -2258,6 +2412,8 @@ sub checkversions {
my $crstype = &Apache::loncommon::course_type();
$r->print(&Apache::loncommon::start_page("Check $crstype Document Versions"));
$r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions"));
+ &startContentScreen($r,'tools');
+
my $header='';
my $startsel='';
my $monthsel='';
@@ -2308,7 +2464,7 @@ sub checkversions {
if ($haschanged) {
if (&Apache::lonnet::put('resourceversions',\%newsetversions,
$env{'course.'.$env{'request.course.id'}.'.domain'},
- $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') {
+ $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') {
$r->print('
'.&mt('Your Version Settings have been Saved').'
');
} else {
$r->print('
'.&mt('An Error Occured while Attempting to Save your Version Settings').'
');
@@ -2318,7 +2474,7 @@ sub checkversions {
&changewarning($r,'');
if ($env{'form.timerange'} eq 'all') {
# show all documents
- $header=&mt('All Documents in '.$crstype);
+ $header=&mt('All Documents in '.$crstype);
$allsel=1;
foreach my $key (keys(%hash)) {
if ($key=~/^ids\_(\/res\/.+)$/) {
@@ -2363,7 +2519,7 @@ sub checkversions {
$env{'course.'.$env{'request.course.id'}.'.domain'},
$env{'course.'.$env{'request.course.id'}.'.num'});
my %lt=&Apache::lonlocal::texthash
- ('st' => 'Version changes since start of '.$crstype,
+ ('st' => 'Version changes since start of '.$crstype,
'lm' => 'Version changes since last Month',
'lw' => 'Version changes since last Week',
'sy' => 'Version changes since Yesterday',
@@ -2435,11 +2591,11 @@ ENDHEADERS
# Set version
$r->print(&Apache::loncommon::select_form($setversions{$linkurl},
'set_version_'.$linkurl,
- ('select_form_order' =>
+ {'select_form_order' =>
['',1..$currentversion,'mostrecent'],
'' => '',
'mostrecent' => &mt('most recent'),
- map {$_,$_} (1..$currentversion))));
+ map {$_,$_} (1..$currentversion)}));
$r->print('
');
my $lastold=1;
for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
@@ -2449,7 +2605,7 @@ ENDHEADERS
$lastold=$prevvers;
}
}
- #
+ #
# Code to figure out how many version entries should go in
# each of the four columns
my $entries_per_col = 0;
@@ -2460,7 +2616,7 @@ ENDHEADERS
$entries_per_col = $num_entries/4 + 1;
}
my $entries_count = 0;
- $r->print('
');
+ $r->print('
');
my $cols_output = 1;
for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
my $url=$root.'.'.$prevvers.'.'.$extension;
@@ -2493,7 +2649,7 @@ ENDHEADERS
}
}
$r->print('');
- $r->print('
'.&mt('Done').'.
');
+ $r->print('
'.&mt('Done').'
');
&untiehash();
}
@@ -2551,7 +2707,6 @@ sub changewarning {
$env{'request.role'}.'" value="1" />').
$help{'Caching'}.''."\n\n");
-
}
@@ -2569,8 +2724,67 @@ sub init_breadcrumbs {
bug=>'Instructor Interface'});
}
+# subroutine to list form elements
+sub create_list_elements {
+ my @formarr = @_;
+ my $list = '';
+ for my $button (@formarr){
+ for my $picture(keys %$button) {
+ $list .= &Apache::lonhtmlcommon::htmltag('li', $picture.' '.$button->{$picture}, {class => 'LC_menubuttons_inline_text'});
+ }
+ }
+ return $list;
+}
+
+# subroutine to create ul from list elements
+sub create_form_ul {
+ my $list = shift;
+ my $ul = &Apache::lonhtmlcommon::htmltag('ul',$list, {class => 'LC_ListStyleNormal'});
+ return $ul;
+}
+
+#
+# Start tabs
+#
+
+sub startContentScreen {
+ my ($r,$mode)=@_;
+ $r->print('
');
+
+ my $active = '';
+# does this user have privileges to modify docs?
+ my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
+
+ my $onclick;
+ my $href;
+
+ if ($allowed) {
+ $r->print('
');
+}
+
+#
+# End tabs
+#
+sub endContentScreen {
+ my ($r)=@_;
+ $r->print('
');
+}
+sub supplemental_base {
+ return 'supplemental&'.&escape(&mt('Supplemental '.&Apache::loncommon::course_type().' Documents'));
+}
sub handler {
my $r = shift;
@@ -2579,6 +2793,7 @@ sub handler {
return OK if $r->header_only;
my $crstype = &Apache::loncommon::course_type();
+#
# --------------------------------------------- Initialize help topics for this
foreach my $topic ('Adding_Course_Doc','Main_Course_Documents',
'Adding_External_Resource','Navigate_Content',
@@ -2597,9 +2812,9 @@ sub handler {
'Option_Response_Simple');
$help{'Bulletin Board'} = &Apache::loncommon::help_open_topic(
'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages');
- $help{'My Personal Info'} = &Apache::loncommon::help_open_topic(
+ $help{'My Personal Information Page'} = &Apache::loncommon::help_open_topic(
'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages');
- $help{'Group Files'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');
+ $help{'Group Portfolio'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');
$help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
# does this user have privileges to modify docs
@@ -2617,44 +2832,90 @@ sub handler {
&init_breadcrumbs('versions','Check/Set Resource Versions');
&checkversions($r);
} elsif ($allowed && $env{'form.dumpcourse'}) {
- &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' DOCS to Construction Space');
+ &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' Documents to Construction Space');
&dumpcourse($r);
} elsif ($allowed && $env{'form.exportcourse'}) {
&init_breadcrumbs('exportcourse','IMS Export');
&exportcourse($r);
} else {
-# is this a standard course?
+#
+# Done catching special calls
+# The whole rest is for course and supplemental documents
+# Get the parameters that may be needed
+#
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+ ['folderpath','pagepath',
+ 'pagesymb','forcesupplement','forcestandard']);
+
+# standard=1: this is a "new-style" course with an uploaded map as top level
+# standard=2: this is a "old-style" course, and there is nothing we can do
my $standard=($env{'request.course.uri'}=~/^\/uploaded\//);
- my $forcestandard = 0;
- my $forcesupplement;
+
+# Decide whether this should display supplemental or main content
+# supplementalflag=1: show supplemental documents
+# supplementalflag=0: show standard documents
+
+
+ my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/);
+ if (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'} eq "" || ($env{'form.pagepath'})) {
+ $supplementalflag=0;
+ }
+ if ($env{'form.forcesupplement'}) { $supplementalflag=1; }
+ if ($env{'form.forcestandard'}) { $supplementalflag=0; }
+ unless ($allowed) { $supplementalflag=1; }
+ unless ($standard) { $supplementalflag=1; }
+
my $script='';
my $showdoc=0;
+ my $addentries = {};
my $containertag;
my $uploadtag;
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['folderpath','pagepath',
- 'pagesymb']);
+
+# Where do we store these for when we come back?
+ my $stored_folderpath='docs_folderpath';
+ if ($supplementalflag) {
+ $stored_folderpath='docs_sup_folderpath';
+ }
+
# No folderpath, no pagepath, see if we have something stored
if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'})) {
- &Apache::loncommon::restore_course_settings('docs_folderpath',
+ &Apache::loncommon::restore_course_settings($stored_folderpath,
{'folderpath' => 'scalar'});
}
- if (!$env{'form.folderpath'}) {
- &Apache::loncommon::restore_course_settings('docs_folderpath',
- {'pagepath' => 'scalar'});
+
+# If we are not allowed to make changes, all we can see are supplemental docs
+ if (!$allowed) {
+ $env{'form.pagepath'}='';
+ unless ($env{'form.folderpath'} =~ /^supplemental/) {
+ $env{'form.folderpath'} = &supplemental_base();
+ }
}
- if ($env{'form.pagepath'}) {
- $env{'form.folderpath'}='';
+# If we still not have a folderpath, see if we can resurrect at pagepath
+ if (!$env{'form.folderpath'} && $allowed) {
+ &Apache::loncommon::restore_course_settings($stored_folderpath,
+ {'pagepath' => 'scalar'});
}
+# Make the zeroth entry in supplemental docs page paths, so we can get to top level
if ($env{'form.folderpath'} =~ /^supplemental_\d+/) {
- $env{'form.folderpath'} = 'supplemental&'.
- &escape(&mt('Supplemental '.$crstype.' Documents')).'&'.
+ $env{'form.folderpath'} = &supplemental_base()
+ .'&'.
$env{'form.folderpath'};
}
- &Apache::loncommon::store_course_settings('docs_folderpath',
+# If after all of this, we still don't have any paths, make them
+ unless (($env{'form.pagepath'}) || ($env{'form.folderpath'})) {
+ if ($supplementalflag) {
+ $env{'form.folderpath'}=&supplemental_base();
+ } else {
+ $env{'form.folderpath'}='default';
+ }
+ }
+
+# Store this
+ &Apache::loncommon::store_course_settings($stored_folderpath,
{'pagepath' => 'scalar',
'folderpath' => 'scalar'});
+
if ($env{'form.folderpath'}) {
my (@folderpath)=split('&',$env{'form.folderpath'});
$env{'form.foldername'}=&unescape(pop(@folderpath));
@@ -2665,33 +2926,40 @@ sub handler {
$env{'form.pagename'}=&unescape(pop(@pagepath));
$env{'form.folder'}=pop(@pagepath);
$containertag = ''.
- '';
- $uploadtag = ''.
- '';
+ '';
+ $uploadtag =
+ ''.
+ ''.
+ '';
+ } else {
+ my $folderpath=$env{'form.folderpath'};
+ if (!$folderpath) {
+ if ($env{'form.folder'} eq '' ||
+ $env{'form.folder'} eq 'supplemental') {
+ $folderpath='default&'.
+ &escape(&mt('Main '.$crstype.' Documents'));
+ }
+ }
+ $containertag = '';
+ $uploadtag = '';
}
if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
$showdoc='/'.$1;
}
- unless ($showdoc) { # got called from remote
- if (($env{'form.folder'}=~/^(?:group|default)_/) ||
- ($env{'form.folder'} =~ m:^\d+/(pages|sequences)/:)) {
- $forcestandard = 1;
- }
- $forcesupplement=($env{'form.folder'}=~/^supplemental_/);
-
- if ($allowed) {
+ if ($showdoc) { # got called in sequence from course
+ $allowed=0;
+ } else {
+ if ($allowed) {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);
- $script=&Apache::lonratedt::editscript('simple');
+ $script=&Apache::lonratedt::editscript('simple');
}
- } else { # got called in sequence from course
- $allowed=0;
}
# get course data
my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};
my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};
-# get personal data
+# get personal data
my $uname=$env{'user.name'};
my $udom=$env{'user.domain'};
my $plainname=&escape(&Apache::loncommon::plainname($uname,$udom));
@@ -2701,7 +2969,22 @@ sub handler {
$iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/");
if ($allowed) {
- $script .= &editing_js($udom,$uname);
+ my @tabids;
+ if ($supplementalflag) {
+ @tabids = ('002','ee2','ff2');
+ } else {
+ @tabids = ('aa1','bb1','cc1','ff1');
+ unless ($env{'form.pagepath'}) {
+ unshift(@tabids,'001');
+ push(@tabids,('dd1','ee1'));
+ }
+ }
+ my $tabidstr = join("','",@tabids);
+ $script .= &editing_js($udom,$uname).
+ &resize_contentdiv_js($tabidstr);
+ $addentries = {
+ onload => "javascript:resize_contentdiv('contentscroll','1','1');",
+ };
}
# -------------------------------------------------------------------- Body tag
$script = ''."\n";
- my $brcrum = [{href=>"/adm/createuser",text=>"Edit $crstype"}];
- $r->print(&Apache::loncommon::start_page("Edit $crstype", $script,
- {'force_register' => $showdoc,
- 'bread_crumbs' => $brcrum}).
- &Apache::loncommon::help_open_menu('','',273,'RAT'));
-
+
+ # Breadcrumbs
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ unless ($showdoc) {
+ &Apache::lonhtmlcommon::add_breadcrumb({
+ href=>"/adm/coursedocs",text=>"$crstype Contents"});
+
+ $r->print(&Apache::loncommon::start_page("$crstype Contents", $script,
+ {'force_register' => $showdoc,
+ 'add_entries' => $addentries,
+ })
+ .&Apache::loncommon::help_open_menu('','',273,'RAT')
+ .&Apache::lonhtmlcommon::breadcrumbs(
+ 'Editing the Table of Contents for your '.$crstype,
+ 'Docs_Adding_Course_Doc')
+ );
+ } else {
+ $r->print(&Apache::loncommon::start_page("$crstype documents",undef,
+ {'force_register' => $showdoc,}));
+ }
+
my %allfiles = ();
my %codebase = ();
- my ($upload_result,$upload_output);
+ my ($upload_result,$upload_output,$uploadphase);
if ($allowed) {
if (($env{'form.uploaddoc.filename'}) &&
($env{'form.cmd'}=~/^upload_(\w+)/)) {
-# Process file upload - phase one - upload and parse primary file.
+ my $context = $1;
+ # Process file upload - phase one - upload and parse primary file.
undef($hadchanges);
- $upload_result = &process_file_upload(\$upload_output,$coursenum,
- $coursedom,\%allfiles,
- \%codebase,$1);
+ $uploadphase = &process_file_upload(\$upload_output,$coursenum,$coursedom,
+ \%allfiles,\%codebase,$context);
if ($hadchanges) {
&mark_hash_old();
}
- if ($upload_result eq 'phasetwo') {
- $r->print($upload_output);
- }
- } elsif ($env{'form.phasetwo'}) {
- my %newname = ();
- my %origname = ();
- my %attribs = ();
- my $updateflag = 0;
- my $residx = $env{'form.newidx'};
- my $primary_url = &unescape($env{'form.primaryurl'});
-# Process file upload - phase two - gather secondary files.
- for (my $i=0; $i<$env{'form.phasetwo'}; $i++) {
- if ($env{'form.embedded_item_'.$i.'.filename'}) {
- my $javacodebase;
- $newname{$i} = &process_secondary_uploads(\$upload_output,$coursedom,$coursenum,'embedded_item_',$i,$residx);
- $origname{$i} = &unescape($env{'form.embedded_orig_'.$i});
- if (exists($env{'form.embedded_codebase_'.$i})) {
- $javacodebase = &unescape($env{'form.embedded_codebase_'.$i});
- $origname{$i} =~ s#^\Q$javacodebase\E/##;
- }
- my @attributes = ();
- if ($env{'form.embedded_attrib_'.$i} =~ /:/) {
- @attributes = split(/:/,$env{'form.embedded_attrib_'.$i});
- } else {
- @attributes = ($env{'form.embedded_attrib_'.$i});
- }
- foreach my $attr (@attributes) {
- push(@{$attribs{$i}},&unescape($attr));
- }
- if ($javacodebase) {
- $codebase{$i} = $javacodebase;
- $codebase{$i} =~ s#/$##;
- $updateflag = 1;
- }
- }
- unless ($newname{$i} eq $origname{$i}) {
- $updateflag = 1;
- }
- }
-# Process file upload - phase three - modify primary file
- if ($updateflag) {
- my ($content,$rtncode);
- my $updateflag = 0;
- my $getstatus = &Apache::lonnet::getuploaded('GET',$primary_url,$coursedom,$coursenum,\$content,\$rtncode);
- if ($getstatus eq 'ok') {
- foreach my $item (keys(%newname)) {
- if ($newname{$item} ne $origname{$item}) {
- my $attrib_regexp = '';
- if (@{$attribs{$item}} > 1) {
- $attrib_regexp = join('|',@{$attribs{$item}});
- } else {
- $attrib_regexp = $attribs{$item}[0];
- }
- if ($content =~ m#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#) {
- }
- $content =~ s#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#$1$newname{$item}$2#gi;
- }
- if (exists($codebase{$item})) {
- $content =~ s/(codebase\s*=\s*["']?)\Q$codebase{$item}\E(["']?)/$1.$2/i; #' stupid emacs
- }
- }
-# Save edited file.
- my $saveresult;
- my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};
- my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'};
- my $url = &Apache::lonnet::store_edited_file($primary_url,$content,$docudom,$docuname,\$saveresult);
- } else {
- &Apache::lonnet::logthis('retrieval of uploaded file - '.$primary_url.' - for editing, failed: '.$getstatus);
- }
- }
+ $r->print($upload_output);
+ } elsif ($env{'form.phase'} eq 'upload_embedded') {
+ # Process file upload - phase two - upload embedded objects
+ $uploadphase = 'check_embedded';
+ my $primaryurl = &HTML::Entities::encode($env{'form.primaryurl'},'<>&"');
+ my $state = &embedded_form_elems($uploadphase,$primaryurl,
+ $env{'form.newidx'});
+ my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};
+ my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'};
+ my ($destination,$dir_root) = &embedded_destination();
+ my $url_root = '/uploaded/'.$docudom.'/'.$docuname;
+ my $actionurl = '/adm/coursedocs';
+ my ($result,$flag) =
+ &Apache::loncommon::upload_embedded('coursedoc',$destination,
+ $docuname,$docudom,$dir_root,$url_root,undef,undef,undef,$state,
+ $actionurl);
+ $r->print($result.&return_to_editor());
+ } elsif ($env{'form.phase'} eq 'check_embedded') {
+ # Process file upload - phase three - modify references in HTML file
+ $uploadphase = 'modified_orightml';
+ my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};
+ my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'};
+ my ($destination,$dir_root) = &embedded_destination();
+ $r->print(&Apache::loncommon::modify_html_refs('coursedoc',$destination,
+ $docuname,$docudom,undef,
+ $dir_root).
+ &return_to_editor());
}
}
- unless ($showdoc || $upload_result eq 'phasetwo') {
+ unless ($showdoc || $uploadphase) {
# -----------------------------------------------------------------------------
my %lt=&Apache::lonlocal::texthash(
'uplm' => 'Upload a new main '.lc($crstype).' document',
'upls' => 'Upload a new supplemental '.lc($crstype).' document',
'impp' => 'Import a document',
- 'pubd' => 'Published documents',
'copm' => 'All documents out of a published map into this folder',
- 'spec' => 'Special documents',
- 'upld' => 'Upload Document',
+ 'upld' => 'Import Document',
'srch' => 'Search',
'impo' => 'Import',
- 'book' => 'Import Bookmarks',
+ 'wish' => 'Import from Wishlist',
'selm' => 'Select Map',
'load' => 'Load Map',
- 'reco' => 'Recover Deleted Resources',
+ 'reco' => 'Recover Deleted Documents',
'newf' => 'New Folder',
'newp' => 'New Composite Page',
'extr' => 'External Resource',
'syll' => 'Syllabus',
- 'navc' => 'Navigate Contents',
+ 'navc' => 'Table of Contents',
'sipa' => 'Simple Course Page',
'sipr' => 'Simple Problem',
'drbx' => 'Drop Box',
- 'scuf' => 'Score Upload Form',
+ 'scuf' => 'External Scores (handgrade, upload, clicker)',
'bull' => 'Discussion Board',
'mypi' => 'My Personal Information Page',
- 'grpo' => 'Group Portfolios',
+ 'grpo' => 'Group Portfolio',
'rost' => 'Course Roster',
- 'abou' => 'About User',
+ 'abou' => 'Personal Information Page for a User',
'imsf' => 'IMS Import',
'imsl' => 'Import IMS package',
'file' => 'File',
'title' => 'Title',
'comment' => 'Comment',
- 'parse' => 'If HTML file, upload embedded images/multimedia files'
+ 'parse' => 'Upload embedded images/multimedia files if HTML file',
+ 'nd' => 'Upload Document',
+ 'pm' => 'Published Map',
+ 'sd' => 'Special Document',
+ 'mo' => 'More Options',
);
# -----------------------------------------------------------------------------
- my %tabtitles = (
- main => {
- Course => &mt('Main Course Documents'),
- Community => &mt('Main Community Documents'),
- },
- supplemental => {
- Course => &mt('Supplemental Course Documents'),
- Community => &mt('Supplemental Community Documents'),
- },
- );
+ my $fileupload=(<
+
+FIUP
+
+ my $checkbox=(<$lt{'parse'}?
+
+ -->
+
+ $lt{'parse'}
+
+CHBO
+
+ my $fileuploada = " $help{'Uploading_From_Harddrive'}";
+ my $fileuploadform=(<
+
+ $fileupload
+
+ $lt{'title'}:
+
+ $uploadtag
+
+
+
+ $checkbox
+
+FUFORM
+ $fileuploadform .= $fileuploada.'';
+
+ my $simpleeditdefaultform=(<
+
+SEDFFORM
+ my @simpleeditdefaultforma = (
+ { '' => "$uploadtag$lt{'srch'}" },
+ { '' => "$lt{'impo'}$help{'Importing_LON-CAPA_Resource'}" },
+ { '' => "$lt{'wish'}" },
+ );
+ $simpleeditdefaultform .= &create_form_ul(&create_list_elements(@simpleeditdefaultforma));
+ $simpleeditdefaultform .=(<
+ $lt{'copm'}
+
+
+ $help{'Load_Map'}
+
+SEDFFORM
+
+ my $extresourcesform=(<
+ $uploadtag
+
+ $lt{'extr'}$help{'Adding_External_Resource'}
+
+ERFORM
+
+
if ($allowed) {
&update_paste_buffer($coursenum,$coursedom);
- my $dumpbut=&dumpbutton();
- my $exportbut=&exportbutton();
my %lt=&Apache::lonlocal::texthash(
'vc' => 'Verify Content',
'cv' => 'Check/Set Resource Versions',
@@ -2861,66 +3167,35 @@ sub handler {
'sl' => 'Show Log'
);
- my $folderpath=$env{'form.folderpath'};
- if (!$folderpath) {
- if ($env{'form.folder'} eq '' ||
- $env{'form.folder'} eq 'supplemental') {
- $folderpath='default&'.&escape($tabtitles{'main'}{$crstype});
- }
- }
- unless ($env{'form.pagepath'}) {
- $containertag = '';
- $uploadtag = '';
- }
+ $r->print(<
+
+
+
+
+ $containertag
+
+
+HIDDENFORM
+ }
- $r->print(<
-
-
-
-
- $containertag
-
-
-
-
-ENDCOURSEVERIFY
- $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
- &mt('Editing the Table of Contents for your '.$crstype)));
- }
-# --------------------------------------------------------- Standard documents
- $r->print('