'.&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/) {
@@ -1622,13 +1046,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 = ''.&mt('This file contains embedded multimedia objects, which need to be uploaded.').'
'.$embedded;
+ $nextphase = $uploadphase;
+ } else {
+ $$upload_output .= $embedded;
+ }
+ } else {
+ $$upload_output .= &mt('Embedded item(s) already present, so no additional upload(s) required').' | ');
my $lastold=1;
for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
@@ -2393,7 +1852,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;
@@ -2404,7 +1863,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;
@@ -2419,7 +1878,7 @@ ENDHEADERS
$r->print(' '.&mt('Diffs').'');
+ '" target="diffs">'.&mt('Diffs').'');
}
$r->print(' ');
if (++$entries_count % $entries_per_col == 0) {
@@ -2437,7 +1896,7 @@ ENDHEADERS
}
}
$r->print('');
- $r->print(''.&mt('Done').'.');
+ $r->print(''.&mt('Done').' ');
&untiehash();
}
@@ -2483,14 +1942,18 @@ sub changewarning {
$message='Changes will become active for your current session after [_1], or the next time you log in.';
}
$r->print("\n\n".
-''."\n".
+''."\n".
''."\n\n");
+ &mt('re-initializing '.$course_type).'" onclick="reinit(this.form)" />').
+$help{'Caching'}.''."\n\n");
}
@@ -2498,7 +1961,7 @@ sub init_breadcrumbs {
my ($form,$text)=@_;
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs",
- text=>"Edit ".&Apache::loncommon::course_type(),
+ text=>&Apache::loncommon::course_type().' Editor',
faq=>273,
bug=>'Instructor Interface',
help => 'Docs_Adding_Course_Doc'});
@@ -2508,17 +1971,70 @@ 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('');
+ if (($mode eq 'navmaps') || ($mode eq 'supplemental')) {
+ $r->print('- '.&mt('Content Overview').'
'."\n");
+ $r->print('- '.&mt('Content Search').'
'."\n");
+ $r->print('- '.&mt('Content Index').'
'."\n");
+ $r->print('- '.&mt('Supplemental Content').'
');
+ } else {
+ $r->print('- '.&mt('Content Editor').'
');
+ $r->print('- '.&mt('Supplemental Content Editor').'
');
+ }
+ $r->print("\n".' '."\n");
+ $r->print(''.
+ ' '.
+ ' ');
+}
+
+#
+# End tabs
+#
+sub endContentScreen {
+ my ($r)=@_;
+ $r->print(' ');
+}
+sub supplemental_base {
+ return 'supplemental&'.&escape(&mt('Supplemental '.&Apache::loncommon::course_type().' Content'));
+}
sub handler {
my $r = shift;
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
return OK if $r->header_only;
- my $type = &Apache::loncommon::course_type();
-
+ 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',
@@ -2537,13 +2053,19 @@ 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
- my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
+
+ my $allowed;
+# URI is /adm/supplemental when viewing supplemental docs in non-edit mode.
+ unless ($r->uri eq '/adm/supplemental') {
+ # does this user have privileges to modify content.
+ $allowed = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});
+ }
+
if ($allowed && $env{'form.verify'}) {
&init_breadcrumbs('verify','Verify Content');
&verifycontent($r);
@@ -2557,83 +2079,212 @@ 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','Export '.&Apache::loncommon::course_type().' to IMS');
- &exportcourse($r);
+ &init_breadcrumbs('exportcourse','IMS Export');
+ &Apache::imsexport::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',
+ 'symb','command']);
+
+# 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 $container;
my $containertag;
my $uploadtag;
+# Do we directly jump somewhere?
+
+ if ($env{'form.command'} eq 'direct') {
+ my ($mapurl,$id,$resurl);
+ if ($env{'form.symb'} ne '') {
+ ($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($env{'form.symb'});
+ if ($resurl=~/\.(sequence|page)$/) {
+ $mapurl=$resurl;
+ } elsif ($resurl eq 'adm/navmaps') {
+ $mapurl=$env{'course.'.$env{'request.course.id'}.'.url'};
+ }
+ my $mapresobj;
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ if (ref($navmap)) {
+ $mapresobj = $navmap->getResourceByUrl($mapurl);
+ }
+ $mapurl=~s{^.*/([^/]+)\.(\w+)$}{$1};
+ my $type=$2;
+ my $path;
+ if (ref($mapresobj)) {
+ my $pcslist = $mapresobj->map_hierarchy();
+ if ($pcslist ne '') {
+ foreach my $pc (split(/,/,$pcslist)) {
+ next if ($pc <= 1);
+ my $res = $navmap->getByMapPc($pc);
+ if (ref($res)) {
+ my $thisurl = $res->src();
+ $thisurl=~s{^.*/([^/]+)\.\w+$}{$1};
+ my $thistitle = $res->title();
+ $path .= '&'.
+ &Apache::lonhtmlcommon::entity_encode($thisurl).'&'.
+ &Apache::lonhtmlcommon::entity_encode($thistitle).
+ ':'.$res->randompick().
+ ':'.$res->randomout().
+ ':'.$res->encrypted().
+ ':'.$res->randomorder();
+ }
+ }
+ }
+ $path .= '&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
+ &Apache::lonhtmlcommon::entity_encode($mapresobj->title()).
+ ':'.$mapresobj->randompick().
+ ':'.$mapresobj->randomout().
+ ':'.$mapresobj->encrypted().
+ ':'.$mapresobj->randomorder();
+ } else {
+ my $maptitle = &Apache::lonnet::gettitle($mapurl);
+ $path = '&default&...::::'.
+ '&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
+ &Apache::lonhtmlcommon::entity_encode($maptitle).'::::';
+ }
+ $path = 'default&'.
+ &Apache::lonhtmlcommon::entity_encode('Main Course Documents').
+ $path;
+ if ($type eq 'sequence') {
+ $env{'form.folderpath'}=$path;
+ $env{'form.pagepath'}='';
+ } else {
+ $env{'form.pagepath'}=$path;
+ $env{'form.folderpath'}='';
+ }
+ } elsif ($env{'form.supppath'} ne '') {
+ $env{'form.folderpath'}=$env{'form.supppath'};
+ }
+ } elsif ($env{'form.command'} eq 'editdocs') {
+ $env{'form.folderpath'} = 'default&'.
+ &Apache::lonhtmlcommon::entity_encode('Main Course Content');
+ $env{'form.pagepath'}='';
+ } elsif ($env{'form.command'} eq 'editsupp') {
+ $env{'form.folderpath'} = 'default&'.
+ &Apache::lonhtmlcommon::entity_encode('Supplemental Content');
+ $env{'form.pagepath'}='';
+ }
+
+# Where do we store these for when we come back?
+ my $stored_folderpath='docs_folderpath';
+ if ($supplementalflag) {
+ $stored_folderpath='docs_sup_folderpath';
+ }
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['folderpath','pagepath',
- 'pagesymb']);
# 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 '.$type.' 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));
$env{'form.folder'}=pop(@folderpath);
+ $container='sequence';
}
if ($env{'form.pagepath'}) {
my (@pagepath)=split('&',$env{'form.pagepath'});
$env{'form.pagename'}=&unescape(pop(@pagepath));
$env{'form.folder'}=pop(@pagepath);
+ $container='page';
$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));
@@ -2643,142 +2294,140 @@ 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,$supplementalflag).
+ &resize_contentdiv_js($tabidstr);
+ $addentries = {
+ onload => "javascript:resize_contentdiv('contentscroll','1','1');",
+ };
}
# -------------------------------------------------------------------- Body tag
- $script = '';
- my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}];
- $r->print(&Apache::loncommon::start_page("$type Documents", $script,
- {'force_register' => $showdoc,
- 'bread_crumbs' => $brcrum}).
- &Apache::loncommon::help_open_menu('','',273,'RAT'));
-
+ $script = ''."\n";
+
+ # 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());
+ } elsif ($env{'form.phase'} eq 'decompress_uploaded') {
+ $uploadphase = 'decompress_phase_one';
+ $r->print(&decompression_phase_one().
+ &return_to_editor());
+ } elsif ($env{'form.phase'} eq 'decompress_cleanup') {
+ $uploadphase = 'decompress_phase_two';
+ $r->print(&decompression_phase_two().
+ &return_to_editor());
}
}
- unless ($showdoc || $upload_result eq 'phasetwo') {
+ unless ($showdoc || $uploadphase) {
# -----------------------------------------------------------------------------
my %lt=&Apache::lonlocal::texthash(
- 'uplm' => 'Upload a new main '.lc($type).' document',
- 'upls' => 'Upload a new supplemental '.lc($type).' document',
+ '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',
- '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',
- 'sipa' => 'Simple Page',
+ '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 Info',
- 'grpo' => 'Group Files',
+ 'mypi' => 'My Personal Information Page',
+ 'grpo' => 'Group Portfolio',
'rost' => 'Course Roster',
- 'abou' => 'About User',
- 'imsf' => 'Import IMS package',
+ 'abou' => 'Personal Information Page for a User',
+ 'imsf' => 'IMS Import',
+ 'imsl' => 'Import IMS package',
'file' => 'File',
'title' => 'Title',
'comment' => 'Comment',
- 'parse' => 'Upload embedded images/multimedia files if HTML file!',
- 'nd' => 'New Document',
+ 'parse' => 'Upload embedded images/multimedia files if HTML file',
+ 'nd' => 'Upload Document',
'pm' => 'Published Map',
'sd' => 'Special Document',
'mo' => 'More Options',
- 'hao' => 'Hide all Options'
);
# -----------------------------------------------------------------------------
my $fileupload=(<
CHBO
+ my $fileuploada = " $help{'Uploading_From_Harddrive'}";
my $fileuploadform=(<
+
$fileupload
$lt{'title'}:
-
+
$uploadtag
-
+
$checkbox
-
-
-
-
- $help{'Uploading_From_Harddrive'}
-
-
FUFORM
+ $fileuploadform .= $fileuploada.'';
my $simpleeditdefaultform=(<
- $lt{'pubd'}
- $uploadtag
-
-
-
-
- $help{'Importing_LON-CAPA_Resource'}
-
-
-
-
-
+
+SEDFFORM
+ my @simpleeditdefaultforma = (
+ { '' => "$uploadtag" },
+ { '' => "$help{'Importing_LON-CAPA_Resource'}" },
+ { '' => "" },
+ );
+ $simpleeditdefaultform .= &create_form_ul(&create_list_elements(@simpleeditdefaultforma));
+ $simpleeditdefaultform .=(<
$lt{'copm'}
-
$help{'Load_Map'}
-
SEDFFORM
- my $extresourcesform=(<
- $uploadtag
-
-
- $help{'Adding_External_Resource'}
-
-
+ my $extresourcesform=(<
+ $uploadtag
+
+ $help{'Adding_External_Resource'}
+
ERFORM
+
if ($allowed) {
&update_paste_buffer($coursenum,$coursedom);
my %lt=&Apache::lonlocal::texthash(
@@ -2860,18 +2500,6 @@ ERFORM
'sl' => 'Show Log'
);
- my $folderpath=$env{'form.folderpath'};
- if (!$folderpath) {
- if ($env{'form.folder'} eq '' ||
- $env{'form.folder'} eq 'supplemental') {
- $folderpath='default&'.
- &escape(&mt('Main '.$type.' Documents'));
- }
- }
- unless ($env{'form.pagepath'}) {
- $containertag = '';
- $uploadtag = '';
- }
$r->print(<
@@ -2886,53 +2514,39 @@ ERFORM
HIDDENFORM
}
-# --------------------------------------------------------- Main tab structure
- my $activeClass = 1;
- $r->print('');
- if (($standard) && ($allowed) && (!$forcesupplement)) {
- my $active = '';
- if($activeClass == 1){
- $active = 'class="active"';
- $activeClass = 0;
- }
- $r->print('- '.&mt('Main Course Documents').'
');
- }
- if (!$forcestandard) {
- my $active = '';
- if($activeClass == 1){
- $active = 'class="active"';
- }
- $r->print('- '.&mt('Supplemental Course Documents').'
');
- }
- $r->print('- '.&mt('Special Admin Options').'
');
- $r->print(' ');
-# --------------------------------------------------------- Standard documents
- if (($standard) && ($allowed) && (!$forcesupplement)) {
- my $active = 'style="display: none;"';
- if($activeClass == 0){
- $active = 'style="display: block;"';
- }
- $r->print(' ');
- $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
- &mt('Editing the Table of Contents for your '.$type)));
+
+# Generate the tabs
+ my $mode;
+ if (($supplementalflag) && (!$allowed)) {
+ &Apache::lonnavdisplay::startContentScreen($r,'supplemental');
+ } else {
+ &startContentScreen($r,($supplementalflag?'suppdocs':'docs'));
+ }
+
+#
+
+ my $savefolderpath;
+
+ if ($allowed) {
my $folder=$env{'form.folder'};
- if ($folder eq '' || $folder eq 'supplemental') {
+ if ($folder eq '' || $supplementalflag) {
$folder='default';
- $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents'));
+ $savefolderpath = $env{'form.folderpath'};
+ $env{'form.folderpath'}='default&'.&escape(&mt('Content'));
$uploadtag = ' ';
}
my $postexec='';
if ($folder eq 'default') {
- $r->print('');
+ $r->print(''."\n"
+ );
} else {
#$postexec='self.close();';
}
- $hadchanges=0;
- if ($hadchanges) {
- &mark_hash_old();
- }
- &changewarning($r,$postexec);
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
'.sequence';
my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
@@ -2947,234 +2561,241 @@ HIDDENFORM
my $recoverform=(<
-
+
RFORM
my $imspform=(<
-
+
IMSPFORM
my $newnavform=(<
+
$uploadtag
-
-
+
$help{'Navigate_Content'}
-
NNFORM
my $newsmppageform=(<
+
$uploadtag
-
- $help{'Simple Page'}
-
+
+ $help{'Simple Page'}
NSPFORM
my $newsmpproblemform=(<
+
$uploadtag
-
- $help{'Simple Problem'}
-
+
+ $help{'Simple Problem'}
NSPROBFORM
my $newdropboxform=(<
- $uploadtag
+
+ $uploadtag
-
-
-
-
+
+
NDBFORM
my $newexuploadform=(<
+
$uploadtag
-
-
+
$help{'Score_Upload_Form'}
-
NEXUFORM
my $newbulform=(<
+
$uploadtag
-
-
+
$help{'Bulletin Board'}
-
NBFORM
my $newaboutmeform=(<
+
$uploadtag
-
-
- $help{'My Personal Info'}
-
+
+ $help{'My Personal Information Page'}
NAMFORM
my $newaboutsomeoneform=(<
+
$uploadtag
-
-
-
+
NASOFORM
my $newrosterform=(<
+
$uploadtag
-
-
+
$help{'Course Roster'}
-
NROSTFORM
- unless ($env{'form.pagepath'}) {
- my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
+my $specialdocumentsform;
+my @specialdocumentsforma;
+my $gradingform;
+my @gradingforma;
+my $communityform;
+my @communityforma;
+my $newfolderform;
+my $newfolderb;
+ my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
+
my $newpageform=(<
-
- $help{'Adding_Pages'}
-
+
+
+ $help{'Adding_Pages'}
NPFORM
- my $newfolderform=(<
-
- $help{'Adding_Folders'}
-
+
+ $lt{'newf'}$help{'Adding_Folders'}
NFFORM
my $newsylform=(<
+
$uploadtag
-
-
+
$help{'Syllabus'}
-
+
NSYLFORM
-
+
my $newgroupfileform=(<
+
$uploadtag
-
-
- $help{'Group Files'}
-
+
+ $help{'Group Portfolio'}
NGFFORM
+ @specialdocumentsforma=(
+ {''=>$newpageform},
+ {''=>$newsylform},
+ {''=>$newnavform},
+ {''=>$newsmppageform},
+ );
+ $specialdocumentsform = &create_form_ul(&create_list_elements(@specialdocumentsforma));
+
+
+ my @importdoc = (
+ {''=>$extresourcesform},
+ {''=>$imspform},);
+ $fileuploadform = &create_form_ul(&create_list_elements(@importdoc)) . ' ' . $fileuploadform;
+
+ @gradingforma=(
+ {''=>$newsmpproblemform},
+ {''=>$newdropboxform},
+ {''=>$newexuploadform},
+
+ );
+ $gradingform = &create_form_ul(&create_list_elements(@gradingforma));
+
+ @communityforma=(
+ {''=>$newbulform},
+ {''=>$newaboutmeform},
+ {''=>$newaboutsomeoneform},
+ {''=>$newrosterform},
+ {''=>$newgroupfileform},
+ );
+ $communityform = &create_form_ul(&create_list_elements(@communityforma));
- my $specialdocumentsform=(<$newfolderform
- $newpageform
- $newsylform
- $newnavform
- $newsmppageform
- $newsmpproblemform
- $newdropboxform
- $newexuploadform
- $newbulform
- $newaboutmeform
- $newaboutsomeoneform
- $newgroupfileform
- $newrosterform
-SPDOFORM
+my @tools = (
+# {''=>$extresourcesform},
+# {''=>$imspform},
+ {''=>$recoverform},
+ );
my %orderhash = (
- 'aa' => 'New Document',
- 'bb' => 'Published Documents',
- 'cc' => 'Special Documents',
- 'dd' => 'More Options',
- 'zz' => 'Hide all Options',
- );
-my %namehash = (
- 'New Document' => $fileuploadform,
- 'Published Documents' => $simpleeditdefaultform,
- 'Special Documents' => $specialdocumentsform,
- 'More Options' => $extresourcesform.' '.$imspform.' '.$recoverform,
+ 'aa' => ['Import Documents',$fileuploadform],
+ 'bb' => ['Published Resources',$simpleeditdefaultform],
+ 'cc' => ['Grading Resources',$gradingform],
+ 'ff' => ['Tools', &create_form_ul(&create_list_elements(@tools)).&generate_admin_options(\%help,\%env)],
);
-my $tid='1';
-my $content='content';
-my $navigation='navigation';
-my $varcd = 'Main Course Documents';
-$r->print(&generate_edit_table($tid,$content,$navigation,$varcd,\%namehash,\%orderhash));
-my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
- if ($error) {
- $r->print(''.$error.' ');
- }
-$r->print('');
- }
- if ($env{'form.pagepath'}) {
- }
+unless ($env{'form.pagepath'}) {
+ $orderhash{'00'} = ['Newfolder',$newfolderform];
+ $orderhash{'dd'} = ['Community Resources',$communityform];
+ $orderhash{'ee'} = ['Special Documents',$specialdocumentsform];
+}
+
+ $hadchanges=0;
+ unless ($supplementalflag) {
+ my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
+ $supplementalflag,\%orderhash,$iconpath);
+ if ($error) {
+ $r->print(' '.$error.' ');
+ }
+ if ($hadchanges) {
+ &mark_hash_old();
+ }
+
+ &changewarning($r,'');
+ }
}
-# ----------------------------------------------------- Supplemental documents
- if (!$forcestandard) {
- my $active = 'style="display: none;"';
- if($activeClass == 1){
- $active = 'style="display: block;"';
- }
- $r->print(' ');
+
+# Supplemental documents start here
+
my $folder=$env{'form.folder'};
- unless ($folder=~/^supplemental/) {
+ unless ($supplementalflag) {
$folder='supplemental';
}
if ($folder =~ /^supplemental$/ &&
(($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) {
- $env{'form.folderpath'} = 'supplemental&'.
- &escape(&mt('Supplemental '.$type.' Documents'));
+ $env{'form.folderpath'} = &supplemental_base();
+ } elsif ($allowed) {
+ $env{'form.folderpath'} = $savefolderpath;
}
+ $env{'form.pagepath'} = '';
if ($allowed) {
my $folderseq=
'/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time.
@@ -3182,8 +2803,10 @@ $r->print(' ');
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
+ my $supupdocformbtn = " $help{'Uploading_From_Harddrive'}";
my $supupdocform=(<
+ ');
$lt{'comment'}:
-
+
-
-
- $help{'Uploading_From_Harddrive'}
-
-
SUPDOCFORM
+ $supupdocform .= &create_form_ul(&Apache::lonhtmlcommon::htmltag('li',$supupdocformbtn,{class => 'LC_menubuttons_inline_text'}))."";
my $supnewfolderform=(<
+
-
- $help{'Adding_Folders'}
-
+
+ $help{'Adding_Folders'}
SNFFORM
-
+
my $supnewextform=(<
+
-
- $help{'Adding_External_Resource'}
-
+ $help{'Adding_External_Resource'}
SNEFORM
my $supnewsylform=(<
+
-
-
+
$help{'Syllabus'}
-
SNSFORM
my $supnewaboutmeform=(<
+
SNAMFORM
-
+my @specialdocs = (
+ {''
+ =>$supnewsylform},
+ {''
+ =>$supnewaboutmeform},
+ );
+my @supimportdoc = (
+ {''
+ =>$supnewextform},
+ );
+$supupdocform = &create_form_ul(&create_list_elements(@supimportdoc)) . ' ' . $supupdocform;
my %suporderhash = (
- 'ee' => 'New Document',
- 'ff' => 'Special Documents',
- 'zz' => 'Hide all Options',
+ '00' => ['Supnewfolder', $supnewfolderform],
+ 'ee' => ['Import Documents',$supupdocform],
+ 'ff' => ['Special Documents',&create_form_ul(&create_list_elements(@specialdocs))]
);
+ if ($supplementalflag) {
+ my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
+ $supplementalflag,\%suporderhash,$iconpath);
+ if ($error) {
+ $r->print(''.$error.' ');
+ }
+ }
+ } elsif ($supplementalflag) {
+ my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
+ $supplementalflag,'',$iconpath);
+ if ($error) {
+ $r->print(''.$error.' ');
+ }
+ }
-my %supnamehash = (
- 'New Document' => $supupdocform,
- 'Special Documents' => $supnewfolderform.' '.$supnewextform.' '.$supnewsylform.' '.$supnewaboutmeform,
- );
+ &endContentScreen($r);
-my $tid='2';
-my $content='content';
-my $navigation='navigation';
-my $varscd = 'Supplemental Course Documents';
-
-$r->print(&generate_edit_table($tid,$content,$navigation,$varscd,\%supnamehash,\%suporderhash));
-my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
- if ($error) {
- $r->print(''.$error.' ');
- }
-$r->print(' ');
- }
- }
-$r->print('');
-$r->print(&generate_admin_options($containertag,$uploadtag,\%help,\%env));
-$r->print(' ');
-$r->print('');
if ($allowed) {
$r->print('
');
}
} else {
- unless ($upload_result eq 'phasetwo') {
+ unless ($uploadphase) {
# -------------------------------------------------------- This is showdoc mode
$r->print("".&mt('Uploaded Document').' - '.
&Apache::lonnet::gettitle($r->uri).''.
@@ -3304,91 +2919,240 @@ $r->print('');
}
$r->print(&Apache::loncommon::end_page());
return OK;
-}
+}
+
+sub embedded_form_elems {
+ my ($phase,$primaryurl,$newidx) = @_;
+ my $folderpath = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
+ return <
+
+
+
+
+STATE
+}
+
+sub embedded_destination {
+ my $folder=$env{'form.folder'};
+ my $destination = 'docs/';
+ if ($folder =~ /^supplemental/) {
+ $destination = 'supplemental/';
+ }
+ if (($folder eq 'default') || ($folder eq 'supplemental')) {
+ $destination .= 'default/';
+ } elsif ($folder =~ /^(default|supplemental)_(\d+)$/) {
+ $destination .= $2.'/';
+ }
+ $destination .= $env{'form.newidx'};
+ my $dir_root = '/userfiles';
+ return ($destination,$dir_root);
+}
+
+sub return_to_editor {
+ my $actionurl = '/adm/coursedocs';
+ return ' '."\n".
+ ''."\n".
+ ''.&mt('Return to Editor').
+ '';
+}
+
+sub decompression_info {
+ my ($destination,$dir_root) = &embedded_destination();
+ my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
+ my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};
+ my $container='sequence';
+ my $hiddenelem;
+ if ($env{'form.pagepath'}) {
+ $container='page';
+ $hiddenelem = ''."\n";
+ } else {
+ $hiddenelem = ''."\n";
+ }
+ if ($env{'form.newidx'}) {
+ $hiddenelem .= ''."\n";
+ }
+ if ($env{'form.comment'}) {
+ $hiddenelem .= ''."\n";
+ }
+ return ($destination,$dir_root,$londocroot,$docudom,$docuname,$container,
+ $hiddenelem);
+}
+
+sub decompression_phase_one {
+ my ($dir,$file,$warning,$error,$output);
+ my ($destination,$dir_root,$londocroot,$docudom,$docuname,$container,$hiddenelem)=
+ &decompression_info();
+ if ($env{'form.archiveurl'} !~ m{^/uploaded/\Q$docudom/$docuname/docs/\E(?:default|supplemental|\d+).*/([^/]+)$}) {
+ $error = &mt('Archive file "[_1]" not in the expected location.',$env{'form.archiveurl'});
+ } else {
+ my $file = $1;
+ $output = &Apache::loncommon::process_decompression($docudom,$docuname,$file,$destination,$dir_root,$hiddenelem);
+ if ($env{'form.archivedelete'}) {
+ my $map = $env{'form.folder'}.'.'.$container;
+ my ($delwarning,$delresult);
+ my ($errtext,$fatal) = &mapread($docuname,$docudom,$map);
+ if ($fatal) {
+ if ($container eq 'page') {
+ $delwarning = &mt('An error occurred retrieving the contents of the current page.');
+ } else {
+ $delwarning = &mt('An error occurred retrieving the contents of the current folder.');
+ }
+ $delwarning .= &mt('As a result the archive file has not been removed.');
+ } else {
+ my $currcmd = $env{'form.cmd'};
+ $env{'form.cmd'} = 'del_'.$env{'form.position'};
+ if (&handle_edit_cmd($docuname,$docudom)) {
+ ($errtext,$fatal) = &storemap($docuname,$docudom,$map);
+ if ($fatal) {
+ if ($container eq 'page') {
+ $delwarning = &mt('An error occurred updating the contents of the current page.');
+ } else {
+ $delwarning = &mt('An error occurred updating the contents of the current folder.');
+ }
+ }
+ }
+ $env{'form.cmd'} = $currcmd;
+ $delresult = &mt('Archive file removed after extracting files.');
+ }
+ if ($delwarning) {
+ $output .= ''.
+ $delwarning.
+ ' ';
+ }
+ if ($delresult) {
+ $output .= ''.
+ $delresult.
+ ' ';
+ }
+ }
+ }
+ if ($error) {
+ $output .= ''.&mt('Not extracted.').' '.
+ $error.' '."\n";
+ }
+ if ($warning) {
+ $output .= ''.$warning.' '."\n";
+ }
+ return $output;
+}
+
+sub decompression_phase_two {
+ my ($destination,$dir_root,$londocroot,$docudom,$docuname,$container,$hiddenelem)=
+ &decompression_info();
+ my $output =
+ &Apache::loncommon::process_extracted_files('coursedocs',$docudom,$docuname,
+ $destination,$dir_root,$hiddenelem);
+ return $output;
+}
sub generate_admin_options {
- my ($containertag,$uploadtag,$help_ref,$env_ref) = @_;
- my %lt=&Apache::lonlocal::texthash(
+ my ($help_ref,$env_ref) = @_;
+ my %lt=&Apache::lonlocal::texthash(
'vc' => 'Verify Content',
'cv' => 'Check/Set Resource Versions',
'ls' => 'List Symbs',
- 'sl' => 'Show Log'
+ 'sl' => 'Show Log',
+ 'imse' => 'IMS Export',
+ 'dcd' => 'Dump Course Documents to Construction Space: available on other servers'
);
my %help = %{$help_ref};
my %env = %{$env_ref};
my $dumpbut=&dumpbutton();
my $exportbut=&exportbutton();
- return (<
-
-
-
-ENDOPTIONFORM
+ my @list = (
+ {''
+ => "$help{'Verify_Content'}"},
+ {''
+ =>"$help{'Check_Resource_Versions'}"},
+ );
+ if($dumpbut ne ''){
+ push @list, {''=>$dumpbut};
+ }
+ push @list, ({''
+ =>$exportbut},
+ {''
+ =>""},
+ {''
+ =>""},
+ );
+ return '';
}
sub generate_edit_table {
- my ($tid,$content,$navigation,$varcd,$namehash_ref,$orderhash_ref) = @_;
- my %namehash = %{$namehash_ref}; #name verlinkt mit id
- my %orderhash = %{$orderhash_ref}; #name mit kürzel verlinkt mit name
+ my ($tid,$orderhash_ref,$to_show,$iconpath,$jumpto) = @_;
+ return unless(ref($orderhash_ref) eq 'HASH');
+ my %orderhash = %{$orderhash_ref};
my $form;
+ my $activetab;
+ my $active;
+ if($env{'form.active'} ne ''){
+ $activetab = $env{'form.active'};
+ }
+ my $backicon = $iconpath.'clickhere.gif';
+ my $backtext = &mt('Back to Overview');
+ $form = ''.
+ ' '.
+ '- '.
+ ''.
+ ''.$backtext.'
';
+ foreach my $name (reverse(sort(keys(%orderhash)))) {
+ if($name ne '00'){
+ if($activetab eq '' || $activetab ne $name){
+ $active = '';
+ }elsif($activetab eq $name){
+ $active = 'class="active"';
+ }
+ $form .= '- '.&mt(${$orderhash{$name}}[0]).'
';
+ } else {
+ $form .= '- '.${$orderhash{$name}}[1].'
';
-
+ }
+ }
+ $form .= ' ';
+ $form .= ' ';
- $form = ' '.&mt($varcd).'';
- $form .= ' ';
- foreach my $name (sort(keys(%orderhash))){
- if($name eq 'zz'){
- $form .= '- '.&mt($orderhash{$name}).'
';
- }else{
- $form .= '- '.&mt($orderhash{$name}).'
';
+ if ($to_show ne '') {
+ $form .= ''.$to_show.' ';
+ }
+ foreach my $field (keys(%orderhash)){
+ if($field ne '00'){
+ if($activetab eq '' || $activetab ne $field){
+ $active = 'style="display: none;float:left"';
+ }elsif($activetab eq $field){
+ $active = 'style="display:block;float:left"';
+ }
+ $form .= ''.${$orderhash{$field}}[1]
+ .' ';
}
}
- $form .= '';
- foreach my $field (keys(%namehash)){
- $form .= ' '.$namehash{$field}.' ';
- }
$form .= ' ';
-
+
return $form;
}
sub editing_js {
- my ($udom,$uname) = @_;
+ my ($udom,$uname,$supplementalflag) = @_;
my $now = time();
my %lt = &Apache::lonlocal::texthash(
p_mnf => 'Name of New Folder',
t_mnf => 'New Folder',
p_mnp => 'Name of New Page',
t_mnp => 'New Page',
- p_mxu => 'Title for the Uploaded Score',
- p_msp => 'Title for the Page',
+ p_mxu => 'Title for the External Score',
+ p_msp => 'Name of Simple Course Page',
p_msb => 'Title for the Problem',
p_mdb => 'Title for the Drop Box',
p_mbb => 'Title for the Discussion Board',
- p_mab => "Enter user:domain for User's 'About Me' Page",
- p_mab2 => "About [_99]",
+ p_mab => "Enter user:domain for User's Personal Information Page",
+ p_mab2 => 'Personal Information Page of ',
p_mab_alrt1 => 'Not a valid user:domain',
p_mab_alrt2 => 'Please enter both user and domain in the format user:domain',
p_chn => 'New Title',
@@ -3401,6 +3165,23 @@ sub editing_js {
p_ctr2b => '?[_98]'
);
+ my $crstype = &Apache::loncommon::course_type();
+ my $docs_folderpath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'},'<>&"');
+ my $docs_pagepath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.pagepath'},'<>&"');
+ my $main_container_page;
+ if ($docs_folderpath eq '') {
+ if ($docs_pagepath ne '') {
+ $main_container_page = 1;
+ }
+ }
+ my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents';
+ my $toplevelsupp = &supplemental_base();
+
+ my $backtourl = '/adm/navmaps';
+ if ($supplementalflag) {
+ $backtourl = '/adm/supplemental';
+ }
+
return < 2 ){
+ currentNav = document.getElementById(tabnav[1].id);
+ currentLis = currentNav.getElementsByTagName('LI');
+ for(i = 0; i< currentLis.length; i++){
+ if(currentLis[i].className == 'active') {
+ funcString = currentLis[i].onclick.toString();
+ tab = funcString.split('"');
+ if(tab.length < 2) {
+ tab = funcString.split("'");
+ }
+ currentData = document.getElementById(tab[1]);
+ currentData.style.display = 'block';
+ }
+ }
+ }
+}
+
function showPage(current, pageId, nav, data) {
hideAll(current, nav, data);
+ openTabs(pageId);
unselectInactive(nav);
current.className = 'active';
currentData = document.getElementById(pageId);
currentData.style.display = 'block';
+ activeTab = pageId;
+ if (nav == 'mainnav') {
+ var storedpath = "$docs_folderpath";
+ if (storedpath == '') {
+ storedpath = "$docs_pagepath";
+ }
+ var storedpage = "$main_container_page";
+ var reg = new RegExp("^supplemental");
+ if (pageId == 'mainCourseDocuments') {
+ if (storedpage == 1) {
+ document.simpleedit.folderpath.value = '';
+ document.uploaddocument.folderpath.value = '';
+ } else {
+ if (reg.test(storedpath)) {
+ document.simpleedit.folderpath.value = '$toplevelmain';
+ document.uploaddocument.folderpath.value = '$toplevelmain';
+ document.newext.folderpath.value = '$toplevelmain';
+ } else {
+ document.simpleedit.folderpath.value = storedpath;
+ document.uploaddocument.folderpath.value = storedpath;
+ document.newext.folderpath.value = storedpath;
+ }
+ }
+ } else {
+ if (reg.test(storedpath)) {
+ document.simpleedit.folderpath.value = storedpath;
+ document.supuploaddocument.folderpath.value = storedpath;
+ document.supnewext.folderpath.value = storedpath;
+ } else {
+ document.simpleedit.folderpath.value = '$toplevelsupp';
+ document.supuploaddocument.folderpath.value = '$toplevelsupp';
+ document.supnewext.folderpath.value = '$toplevelsupp';
+ }
+ }
+ }
+ resize_contentdiv('contentscroll','1','0');
return false;
}
+function injectData(current, hiddenField, name, value) {
+ currentElement = document.getElementById(hiddenField);
+ currentElement.name = name;
+ currentElement.value = value;
+ current.submit();
+}
+
+function toContents(jumpto) {
+ var newurl = '$backtourl';
+ if (jumpto != '') {
+ newurl = newurl+'?postdata='+jumpto;
+;
+ }
+ location.href=newurl;
+}
+
ENDNEWSCRIPT
}
+
+sub resize_contentdiv_js {
+ my ($tabidstr) = @_;
+ my $viewport_js = &Apache::loncommon::viewport_geometry_js();
+ return < maxtabw) {
+ maxtabw = actabw;
+ }
+ } else {
+ if (document.getElementById(alltabs[i]) != null) {
+ var thistab = document.getElementById(alltabs[i]);
+ thistab.style.visibility = 'hidden';
+ thistab.style.display = 'block';
+ var tabw = document.getElementById(alltabs[i]).offsetWidth;
+ thistab.style.display = 'none';
+ thistab.style.visibility = '';
+ if (tabw > maxtabw) {
+ maxtabw = tabw;
+ }
+ }
+ }
+ }
+
+ if (maxtabw > 0) {
+ var newscrollboxw;
+ if (maxtabw+paddingw+scrollboxscrollw scrollboxheight) {
+ if (freevspace > offsetv) {
+ newscrollboxheight = scrollboxheight+freevspace-offsetv;
+ if (newscrollboxheight < minvscrollbox) {
+ newscrollboxheight = minvscrollbox;
+ }
+ scrollbox.style.height = newscrollboxheight+"px";
+ }
+ }
+ }
+ scrollboxheight = scrollbox.offsetHeight;
+ var contentlistheight = document.getElementById("contentlist").offsetHeight;
+
+ if (scrollboxscrollheight <= scrollboxheight) {
+ if ((contentlistheight+offsetv) |