'.
&Apache::lonnet::gettitle($linkurl).
@@ -2310,7 +2412,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;
@@ -2321,7 +2423,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;
@@ -2400,17 +2502,20 @@ 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");
}
-# =========================================== Breadcrumbs for special functions
sub init_breadcrumbs {
my ($form,$text)=@_;
@@ -2426,7 +2531,9 @@ sub init_breadcrumbs {
bug=>'Instructor Interface'});
}
-# ================================================================ Main Handler
+
+
+
sub handler {
my $r = shift;
&Apache::loncommon::content_type($r,'text/html');
@@ -2434,14 +2541,15 @@ sub handler {
return OK if $r->header_only;
my $type = &Apache::loncommon::course_type();
+
# --------------------------------------------- Initialize help topics for this
- foreach ('Adding_Course_Doc','Main_Course_Documents',
- 'Adding_External_Resource','Navigate_Content',
- 'Adding_Folders','Docs_Overview', 'Load_Map',
- 'Supplemental','Score_Upload_Form','Adding_Pages',
- 'Importing_LON-CAPA_Resource','Uploading_From_Harddrive',
- 'Check_Resource_Versions','Verify_Content') {
- $help{$_}=&Apache::loncommon::help_open_topic('Docs_'.$_);
+ foreach my $topic ('Adding_Course_Doc','Main_Course_Documents',
+ 'Adding_External_Resource','Navigate_Content',
+ 'Adding_Folders','Docs_Overview', 'Load_Map',
+ 'Supplemental','Score_Upload_Form','Adding_Pages',
+ 'Importing_LON-CAPA_Resource','Uploading_From_Harddrive',
+ 'Check_Resource_Versions','Verify_Content') {
+ $help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);
}
# Composite help files
$help{'Syllabus'} = &Apache::loncommon::help_open_topic(
@@ -2452,9 +2560,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
@@ -2487,6 +2595,8 @@ sub handler {
my $showdoc=0;
my $containertag;
my $uploadtag;
+
+
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['folderpath','pagepath',
'pagesymb']);
@@ -2528,15 +2638,15 @@ sub handler {
$showdoc='/'.$1;
}
unless ($showdoc) { # got called from remote
- if (($env{'form.folder'}=~/^(?:group|default)_/) ||
+ if (($env{'form.folder'}=~/^(?:group|default)_/) ||
($env{'form.folder'} =~ m:^\d+/(pages|sequences)/:)) {
$forcestandard = 1;
- }
+ }
$forcesupplement=($env{'form.folder'}=~/^supplemental_/);
- if ($allowed) {
+ 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;
@@ -2546,7 +2656,7 @@ sub handler {
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));
@@ -2559,18 +2669,24 @@ sub handler {
$script .= &editing_js($udom,$uname);
}
# -------------------------------------------------------------------- Body tag
- $script = '';
+ $script = '';
+ my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}];
$r->print(&Apache::loncommon::start_page("$type Documents", $script,
- {'force_register' => $showdoc,}).
+ {'force_register' => $showdoc,
+ 'bread_crumbs' => $brcrum}).
&Apache::loncommon::help_open_menu('','',273,'RAT'));
-
+
my %allfiles = ();
my %codebase = ();
my ($upload_result,$upload_output);
if ($allowed) {
if (($env{'form.uploaddoc.filename'}) &&
($env{'form.cmd'}=~/^upload_(\w+)/)) {
-# Process file upload - phase one - upload and parse primary file.
+# Process file upload - phase one - upload and parse primary file.
undef($hadchanges);
$upload_result = &process_file_upload(\$upload_output,$coursenum,
$coursedom,\%allfiles,
@@ -2595,17 +2711,17 @@ sub handler {
$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/##;
+ $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};
+ @attributes = split(/:/,$env{'form.embedded_attrib_'.$i});
} else {
@attributes = ($env{'form.embedded_attrib_'.$i});
}
- foreach (@attributes) {
- push(@{$attribs{$i}},&unescape($_));
+ foreach my $attr (@attributes) {
+ push(@{$attribs{$i}},&unescape($attr));
}
if ($javacodebase) {
$codebase{$i} = $javacodebase;
@@ -2623,7 +2739,7 @@ sub handler {
my $updateflag = 0;
my $getstatus = &Apache::lonnet::getuploaded('GET',$primary_url,$coursedom,$coursenum,\$content,\$rtncode);
if ($getstatus eq 'ok') {
- foreach my $item (keys %newname) {
+ foreach my $item (keys(%newname)) {
if ($newname{$item} ne $origname{$item}) {
my $attrib_regexp = '';
if (@{$attribs{$item}} > 1) {
@@ -2632,8 +2748,8 @@ sub handler {
$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;
+ }
+ $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
@@ -2645,7 +2761,7 @@ sub handler {
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);
+ &Apache::lonnet::logthis('retrieval of uploaded file - '.$primary_url.' - for editing, failed: '.$getstatus);
}
}
}
@@ -2657,9 +2773,8 @@ sub handler {
'uplm' => 'Upload a new main '.lc($type).' document',
'upls' => 'Upload a new supplemental '.lc($type).' document',
'impp' => 'Import a document',
- 'pubd' => 'Published documents',
+ 'pubd' => 'Published Documents',
'copm' => 'All documents out of a published map into this folder',
- 'spec' => 'Special documents',
'upld' => 'Upload Document',
'srch' => 'Search',
'impo' => 'Import',
@@ -2672,26 +2787,99 @@ sub handler {
'extr' => 'External Resource',
'syll' => 'Syllabus',
'navc' => 'Navigate Contents',
- 'sipa' => 'Simple Page',
+ 'sipa' => 'Simple Course Page',
'sipr' => 'Simple Problem',
'drbx' => 'Drop Box',
'scuf' => 'Score Upload Form',
- 'bull' => 'Bulletin Board',
- 'mypi' => 'My Personal Info',
- 'grpo' => 'Group Files',
+ 'bull' => 'Discussion Board',
+ 'mypi' => 'My Personal Information Page',
+ 'grpo' => 'Group Portfolio',
'rost' => 'Course Roster',
- 'abou' => 'About User',
+ 'abou' => 'Personal Information Page for a User',
'imsf' => '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',
+ 'hao' => 'Hide all Options'
);
# -----------------------------------------------------------------------------
+ my $fileupload=(<
+
+FIUP
+
+ my $checkbox=(<$lt{'parse'}?
+
+ -->
+
+ $lt{'parse'}
+
+CHBO
+
+ my $fileuploadform=(<
+ $fileupload
+
+ $lt{'title'}:
+
+ $uploadtag
+
+
+
+ $checkbox
+
+
+
+
+
+ $help{'Uploading_From_Harddrive'}
+
+
+FUFORM
+
+ my $simpleeditdefaultform=(<
+ $lt{'pubd'}
+ $uploadtag
+
+
+
+
+ $help{'Importing_LON-CAPA_Resource'}
+
+
+
+
+
+ $lt{'copm'}
+
+
+ $help{'Load_Map'}
+
+
+SEDFFORM
+
+ my $extresourcesform=(<
+ $uploadtag
+
+
+ $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',
@@ -2711,74 +2899,67 @@ sub handler {
$containertag = ' ';
$uploadtag = ' ';
}
-
- $r->print(<
-
-
-
-
- $containertag
-
-
-
-
-ENDCOURSEVERIFY
- $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
- &mt('Editing the Table of Contents for your '.$type)));
+ $r->print(<
+
+
+
+
+ $containertag
+
+
+HIDDENFORM
+ }
+# --------------------------------------------------------- Main tab structure
+ my $activeClass = 1;
+ my $active = '';
+ $r->print('');
+ if (($standard) && ($allowed) && (!$forcesupplement) && (($env{'form.folderpath'}=~/^default/) || ($env{'form.pagepath'}))) {
+ if($activeClass == 1){
+ $active = 'class="active"';
+ $activeClass = 0;
+ }
+ }
+ $r->print(''.&mt('Main Course Documents').' ');
+ $active = '';
+ if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {
+ if($activeClass == 1){
+ $active = 'class="active"';
+ }
}
+ $r->print(''.&mt('Supplemental Course Documents').' ');
+ $r->print(' ');
# --------------------------------------------------------- Standard documents
- $r->print('
');
-
- if (($standard) && ($allowed) && (!$forcesupplement)) {
- $r->print('');
-# ''.&mt('Main Course Documents').
-# ($allowed?' '.$help{'Main_Course_Documents'}:'').' ');
+ my $savefolderpath;
+ 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)));
my $folder=$env{'form.folder'};
- if ($folder eq '' || $folder eq 'supplemental') {
+ if ($folder eq '' || $folder=~/^supplemental/) {
$folder='default';
+ $savefolderpath = $env{'form.folderpath'};
$env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents'));
$uploadtag = '
';
}
my $postexec='';
if ($folder eq 'default') {
- $r->print('');
+ $r->print(''
+ );
} else {
#$postexec='self.close();';
}
- $hadchanges=0;
- my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,
- $upload_output,$type);
- if ($error) {
- $r->print('
'.$error.'
');
- }
- if ($hadchanges) {
- &mark_hash_old()
- }
- &changewarning($r,$postexec);
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
'.sequence';
my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
@@ -2788,230 +2969,221 @@ ENDCOURSEVERIFY
$container='page';
}
my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container;
- $r->print(<
-
-$lt{'uplm'}
-$lt{'impp'}
-$lt{'spec'}
-
-
-
-$lt{'file'}:
-
-
-
-
-
-
-ENDFORM
- unless ($env{'form.pagepath'}) {
- $r->print(<
-
-
-ENDFORM
- }
- $r->print(' ');
+
+
+
+ my $recoverform=(<
+
+
+RFORM
+
+ my $imspform=(<
+
+
+
+IMSPFORM
+
+ my $newnavform=(<
+ $uploadtag
+
+
+
+ $help{'Navigate_Content'}
+
+
+NNFORM
+ my $newsmppageform=(<
+ $uploadtag
+
+
+ $help{'Simple Page'}
+
+
+NSPFORM
+
+ my $newsmpproblemform=(<
+ $uploadtag
+
+
+ $help{'Simple Problem'}
+
+
+
+NSPROBFORM
+
+ my $newdropboxform=(<
+ $uploadtag
+
+
+
+
+
+NDBFORM
+
+ my $newexuploadform=(<
+ $uploadtag
+
+
+
+ $help{'Score_Upload_Form'}
+
+
+NEXUFORM
+
+ my $newbulform=(<
+ $uploadtag
+
+
+
+ $help{'Bulletin Board'}
+
+
+NBFORM
+
+ my $newaboutmeform=(<
+ $uploadtag
+
+
+
+ $help{'My Personal Information Page'}
+
+
+NAMFORM
+
+ my $newaboutsomeoneform=(<
+ $uploadtag
+
+
+
+
+
+NASOFORM
+
+
+ my $newrosterform=(<
+ $uploadtag
+
+
+
+ $help{'Course Roster'}
+
+
+NROSTFORM
+
+my $specialdocumentsform;
+my $newfolderform;
+
unless ($env{'form.pagepath'}) {
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
- $r->print(<
-
-
-
-
-
-
-
-
-
-
-
-
-ENDFORM
+
+ my $newpageform=(<
+
+
+
+ $help{'Adding_Pages'}
+
+
+NPFORM
+
+ $newfolderform=(<
+
+
+
+ $help{'Adding_Folders'}
+
+
+NFFORM
+
+ my $newsylform=(<
+ $uploadtag
+
+
+
+ $help{'Syllabus'}
+
+
+NSYLFORM
+
+ my $newgroupfileform=(<
+ $uploadtag
+
+
+
+ $help{'Group Portfolio'}
+
+
+NGFFORM
+
+ $specialdocumentsform=" $newpageform $newsylform $newgroupfileform";
+ }
+ $specialdocumentsform.=" $newnavform $newsmppageform
+ $newsmpproblemform $newdropboxform
+ $newexuploadform $newbulform
+ $newaboutmeform $newaboutsomeoneform
+ $newrosterform";
+if($env{'form.pagepath'}) {
+ $specialdocumentsform=" $newsmpproblemform $newexuploadform";
+}
+
+my %orderhash = (
+ 'aa' => ['Upload Document',$fileuploadform.' '.$newfolderform],
+ 'bb' => ['Published Documents',$simpleeditdefaultform],
+ 'cc' => ['Special Documents',$specialdocumentsform],
+ 'dd' => ['Tools',$extresourcesform.' '.$imspform.' '.$recoverform.' '.&generate_admin_options($containertag,$uploadtag,\%help,\%env)],
+ 'zz' => ['Hide all Options'],
+ );
+my $tid='1';
+my $varcd = 'Main Course Documents';
+$r->print(&generate_edit_table($tid,$varcd,\%orderhash));
+ $hadchanges=0;
+ my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
+ if ($error) {
+ $r->print(''.$error.'
');
+ }
+ if ($hadchanges) {
+ &mark_hash_old();
}
+
+ &changewarning($r,'');
+$r->print('');
if ($env{'form.pagepath'}) {
- $r->print(<
-$uploadtag
-
-
- $help{'Simple Problem'}
-
-
-
-ENDBLOCK
}
- $r->print(' '."\n".
-'
');
- $r->print('
');
- }
# ----------------------------------------------------- Supplemental documents
- if (!$forcestandard) {
- $r->print('