SEDFFORM
my @simpleeditdefaultforma = (
- { pic03 => "$uploadtag$lt{'srch'} " },
- { pic04 => "$lt{'impo'} $help{'Importing_LON-CAPA_Resource'}" },
- { pic05 => "$lt{'book'} " },
+ { ' ' => "$uploadtag" },
+ { ' ' => "$help{'Importing_LON-CAPA_Resource'}" },
+ { ' ' => "" },
);
- $simpleeditdefaultform .= create_form_ul(create_list_elements(@simpleeditdefaultforma));
+ $simpleeditdefaultform .= &create_form_ul(&create_list_elements(@simpleeditdefaultforma));
$simpleeditdefaultform .=(<
@@ -2944,14 +3004,15 @@ SEDFFORM
SEDFFORM
- my $extresourcesform=(<
- $uploadtag
-
- $lt{'extr'} $help{'Adding_External_Resource'}
-
+ my $extresourcesform=(<
+ $uploadtag
+
+ $help{'Adding_External_Resource'}
+
ERFORM
+
if ($allowed) {
&update_paste_buffer($coursenum,$coursedom);
my %lt=&Apache::lonlocal::texthash(
@@ -2961,18 +3022,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(<
@@ -2987,44 +3036,33 @@ ERFORM
HIDDENFORM
}
-# --------------------------------------------------------- Main tab structure
-
- my $activeClass = 1;
- my $active = '';
- $r->print('');
- if (($standard) && ($allowed) && (!$forcesupplement) && (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'}eq"" || ($env{'form.pagepath'}))) {
- if($activeClass == 1){
- $active = 'class="active"';
- $activeClass = 0;
- }
- }
- if($env{'request.role'}=~/^cc/){
- $r->print(''.&mt('Main Course Documents').' ');
- }
- $active = '';
- if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {
- if($activeClass == 1){
- $active = 'class="active"';
- }
+#
+# 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 (($standard) && ($allowed) && (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'} eq "" || ($env{'form.pagepath'}))) {
+ $supplementalflag=0;
}
- $r->print(''.&mt('Supplemental Course Documents').' ');
- $r->print(' '
- .''
- .'
');
-# --------------------------------------------------------- Standard documents
- my $savefolderpath;
- my $active = 'style="display: none;"';
- if($activeClass == 0){
- $active = 'style="display: block;"';
- }
- if($env{'request.role'}=~/^cc/){
- $r->print('
');
+ if ($env{'form.forcesupplement'}) { $supplementalflag=1; }
+ if ($env{'form.forcestandard'}) { $supplementalflag=0; }
+
+# Generate the tabs
+ &startContentScreen($r,($supplementalflag?'supdocs':'docs'));
+
+
+#
+
+ my $savefolderpath;
+
+ if ($allowed) {
my $folder=$env{'form.folder'};
- if ($folder eq '' || $folder=~/^supplemental/) {
+ if ($folder eq '' || $supplementalflag) {
$folder='default';
$savefolderpath = $env{'form.folderpath'};
- $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents'));
+ $env{'form.folderpath'}='default&'.&escape(&mt('Content'));
$uploadtag = '
';
}
@@ -3053,14 +3091,14 @@ HIDDENFORM
my $recoverform=(<
- $lt{'reco'}
+
RFORM
my $imspform=(<
- $lt{'imsf'}
+
IMSPFORM
@@ -3070,7 +3108,7 @@ IMSPFORM
$uploadtag
- $lt{'navc'}
+
$help{'Navigate_Content'}
NNFORM
@@ -3079,7 +3117,7 @@ NNFORM
$uploadtag
- $lt{'sipa'}
+
$help{'Simple Page'}
NSPFORM
@@ -3089,7 +3127,7 @@ NSPFORM
$uploadtag
- $lt{'sipr'}
+
$help{'Simple Problem'}
@@ -3100,7 +3138,7 @@ NSPROBFORM
$uploadtag
- $lt{'drbx'}
+
NDBFORM
@@ -3109,7 +3147,7 @@ NDBFORM
$uploadtag
- $lt{'scuf'}
+
$help{'Score_Upload_Form'}
NEXUFORM
@@ -3119,7 +3157,7 @@ NEXUFORM
$uploadtag
- $lt{'bull'}
+
$help{'Bulletin Board'}
NBFORM
@@ -3130,7 +3168,7 @@ NBFORM
$uploadtag
- $lt{'mypi'}
+
$help{'My Personal Information Page'}
NAMFORM
@@ -3140,7 +3178,7 @@ NAMFORM
$uploadtag
- $lt{'abou'}
+
NASOFORM
@@ -3151,7 +3189,7 @@ NASOFORM
$uploadtag
- $lt{'rost'}
+
$help{'Course Roster'}
NROSTFORM
@@ -3159,6 +3197,7 @@ NROSTFORM
my $specialdocumentsform;
my @specialdocumentsforma;
my $newfolderform;
+my $newfolderb;
unless ($env{'form.pagepath'}) {
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
@@ -3168,25 +3207,20 @@ my $newfolderform;
- $lt{'newp'}
+
$help{'Adding_Pages'}
NPFORM
-
+
+
$newfolderform=(<
- $lt{'newf'} $help{'Adding_Folders'}
+ $lt{'newf'} $help{'Adding_Folders'}
NFFORM
- my @newfolderforma= (
- { pic02 => "$newfolderform" }
- );
-
-
- $newfolderform = create_form_ul(create_list_elements(@newfolderforma));
my $newsylform=(<
@@ -3194,7 +3228,7 @@ NFFORM
$uploadtag
- $lt{'syll'}
+
$help{'Syllabus'}
@@ -3206,83 +3240,86 @@ NSYLFORM
$uploadtag
- $lt{'grpo'}
+
$help{'Group Portfolio'}
NGFFORM
@specialdocumentsforma=(
- {pic06=>$newpageform},
- {pic07=>$newsylform},
- {pic08=>$newgroupfileform},
- );
-
- }
- push @specialdocumentsforma, ({pic09=>$newnavform},
- {pic10=>$newsmppageform},
- {pic11=>$newsmpproblemform},
- {pic12=>$newdropboxform},
- {pic13=>$newexuploadform},
- {pic14=>$newbulform},
- {pic15=>$newaboutmeform},
- {pic16=>$newaboutsomeoneform},
- {pic17=>$newrosterform},);
+ {' '=>$newpageform},
+ {' '=>$newsylform},
+ {' '=>$newgroupfileform},
+ );
- $specialdocumentsform = create_form_ul(create_list_elements(@specialdocumentsforma));
+ my @importdoc = (
+ {' '=>$extresourcesform},
+ {' '=>$imspform},);
+ $fileuploadform = &create_form_ul(&create_list_elements(@importdoc)) . ' ' . $fileuploadform;
+
+ push @specialdocumentsforma, ({' '=>$newnavform},
+ {' '=>$newsmppageform},
+ {' '=>$newsmpproblemform},
+ {' '=>$newdropboxform},
+ {' '=>$newexuploadform},
+ {' '=>$newbulform},
+ {' '=>$newaboutmeform},
+ {' '=>$newaboutsomeoneform},
+ {' '=>$newrosterform},);
+
+ $specialdocumentsform = &create_form_ul(&create_list_elements(@specialdocumentsforma));
+ }
if($env{'form.pagepath'}) {
@specialdocumentsforma=(
- {pic32=>$newsmpproblemform},
- {pic33=>$newexuploadform}
+ {' '=>$newsmpproblemform},
+ {' '=>$newexuploadform}
);
- $specialdocumentsform= create_form_ul(create_list_elements(@specialdocumentsforma));
+ $specialdocumentsform= &create_form_ul(&create_list_elements(@specialdocumentsforma));
}
my @tools = (
- {pic18=>$extresourcesform},
- {pic19=>$imspform},
- {pic20=>$recoverform},
+# {' '=>$extresourcesform},
+# {' '=>$imspform},
+ {' '=>$recoverform},
);
my %orderhash = (
- 'aa' => ['Upload Document',$fileuploadform.''.$newfolderform],
+ 'aa' => ['Import Documents',$fileuploadform],
'bb' => ['Published Resources',$simpleeditdefaultform],
'cc' => ['Special Documents',$specialdocumentsform],
- 'dd' => ['Tools', create_form_ul(create_list_elements(@tools)).&generate_admin_options($containertag,$uploadtag,\%help,\%env)],
- 'zz' => ['Hide'],
+ 'dd' => ['Tools', &create_form_ul(&create_list_elements(@tools)).&generate_admin_options(\%help,\%env)],
);
-my $tid='1';
-my $varcd = 'Main Course Documents';
-$r->print(&generate_edit_table($tid,$varcd,\%orderhash));
+unless($env{'form.pagepath'}) {
+ $orderhash{'00'} = ['Newfolder',$newfolderform];
+}
+
$hadchanges=0;
- my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
- if ($error) {
- $r->print(''.$error.'
');
- }
- if ($hadchanges) {
- &mark_hash_old();
- }
+ unless ($supplementalflag) {
+ my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
+ if ($error) {
+ $r->print(''.$error.'
');
+ }
+ if ($hadchanges) {
+ &mark_hash_old();
+ }
+
+ &changewarning($r,'');
+ $r->print(&generate_edit_table('1',\%orderhash));
+ }
- &changewarning($r,'');
-$r->print(' ');
}
- if ($env{'form.pagepath'}) {
- }
-# ----------------------------------------------------- Supplemental documents
- 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'));
- }else{
+ &escape(&mt('Supplemental '.$crstype.' Documents'));
+ } elsif ($allowed) {
$env{'form.folderpath'} = $savefolderpath;
}
$env{'form.pagepath'} = '';
@@ -3293,9 +3330,7 @@ $r->print('
');
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
- my @supupdocform = (
- {pic27=>"
$lt{'upld'} $help{'Uploading_From_Harddrive'}"},
- );
+ my $supupdocformbtn = "
$help{'Uploading_From_Harddrive'}";
my $supupdocform=(<
@@ -3312,28 +3347,25 @@ $r->print(' ');
SUPDOCFORM
- $supupdocform .= create_form_ul(create_list_elements(@supupdocform))."";
+ $supupdocform .= &create_form_ul(&Apache::lonhtmlcommon::htmltag('li',$supupdocformbtn,{class => 'LC_menubuttons_inline_text'}))."";
my $supnewfolderform=(<
- $lt{'newf'}
+
$help{'Adding_Folders'}
SNFFORM
- my @supnewfolderforma = ({pic28=>$supnewfolderform});
- $supnewfolderform = create_form_ul(create_list_elements(@supnewfolderforma));
-
my $supnewextform=(<
- $lt{'extr'} $help{'Adding_External_Resource'}
+ $help{'Adding_External_Resource'}
SNEFORM
@@ -3343,7 +3375,7 @@ SNEFORM
- $lt{'syll'}
+
$help{'Syllabus'}
SNSFORM
@@ -3354,36 +3386,43 @@ SNSFORM
- $lt{'mypi'}
+
$help{'My Personal Information Page'}
SNAMFORM
my @specialdocs = (
- {pic29=>$supnewextform},
- {pic30=>$supnewsylform},
- {pic31=>$supnewaboutmeform},
+ {' '
+ =>$supnewsylform},
+ {' '
+ =>$supnewaboutmeform},
);
+my @supimportdoc = (
+ {' '
+ =>$supnewextform},
+ );
+$supupdocform = &create_form_ul(&create_list_elements(@supimportdoc)) . ' ' . $supupdocform;
my %suporderhash = (
- 'ee' => ['Upload Document',$supupdocform.' '.$supnewfolderform],
- 'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))],
- 'zz' => ['Hide'],
+ '00' => ['Supnewfolder', $supnewfolderform],
+ 'ee' => ['Import Documents',$supupdocform],
+ 'ff' => ['Special Documents',&create_form_ul(&create_list_elements(@specialdocs))]
);
-
-my $tid='2';
-my $varscd = 'Supplemental Course Documents';
-
-$r->print(&generate_edit_table($tid,$varscd,\%suporderhash));
-}
-
-my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
- if ($error) {
- $r->print(''.$error.'
');
+ if ($supplementalflag) {
+ my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
+ if ($error) {
+ $r->print(''.$error.'
');
+ }
+ $r->print(&generate_edit_table('2',\%suporderhash));
+ }
+ } elsif ($supplementalflag) {
+ my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
+ if ($error) {
+ $r->print(''.$error.'
');
}
-$r->print(' ');
-$r->print('');
+ }
+ &endContentScreen($r);
if ($allowed) {
$r->print('
@@ -3395,7 +3434,7 @@ $r->print('');
');
}
} else {
- unless ($upload_result eq 'phasetwo') {
+ unless ($uploadphase) {
# -------------------------------------------------------- This is showdoc mode
$r->print("".&mt('Uploaded Document').' - '.
&Apache::lonnet::gettitle($r->uri).' '.
@@ -3408,36 +3447,80 @@ $r->print('');
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 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();
my @list = (
- {pic21=>"$lt{'vc'} $help{'Verify_Content'}"},
- {pic22=>"$lt{'cv'} $help{'Check_Resource_Versions'}"},
+ {' '
+ => "$help{'Verify_Content'}"},
+ {' '
+ =>"$help{'Check_Resource_Versions'}"},
);
if($dumpbut ne ''){
- push @list, {pic23=>$dumpbut};
+ push @list, {' '=>$dumpbut};
}
- push @list, ({pic24=>$exportbut},
- {pic25=>"$lt{'ls'} "},
- {pic26=>"$lt{'sl'} "},
+ push @list, ({' '
+ =>$exportbut},
+ {' '
+ =>" "},
+ {' '
+ =>""},
);
- return '';
+ return '';
}
sub generate_edit_table {
- my ($tid,$varcd,$orderhash_ref) = @_;
+ my ($tid,$orderhash_ref) = @_;
+ return unless(ref($orderhash_ref) eq 'HASH');
my %orderhash = %{$orderhash_ref};
my $form;
my $activetab;
@@ -3445,37 +3528,35 @@ sub generate_edit_table {
if($env{'form.active'} ne ''){
$activetab = $env{'form.active'};
}
- $form = '';
+ $form = '
';
$form .= '
';
foreach my $name (sort(keys(%orderhash))){
- if($name eq 'zz'){
- if($activetab ne ''){
- $active = 'class="right"';
- }else{
- $active = 'class="right active"';
- }
- $form .= ''.&mt(${$orderhash{$name}}[0]).' ';
- }else{
+ if($name ne '00'){
if($activetab eq '' || $activetab ne $name){
$active = '';
}elsif($activetab eq $name){
$active = 'class="active"';
}
- $form .= ''.&mt(${$orderhash{$name}}[0]).' ';
- }
+ $form .= ''.&mt(${$orderhash{$name}}[0]).' ';
+ } else {
+ $form .= ''.${$orderhash{$name}}[1].' ';
+
+ }
}
$form .= ' ';
- $form .= '
';
+ $form .= '
';
foreach my $field (keys(%orderhash)){
- if($field ne 'zz'){
- if($activetab eq '' || $activetab ne $field){
+ if($field ne '00'){
+ if($activetab eq '' || $activetab ne $field){
$active = 'style="display: none;"';
- }elsif($activetab eq $field){
+ }elsif($activetab eq $field){
$active = 'style="display:block;"';
- }
- $form .= '
'.${$orderhash{$field}}[1]
- .'
';
+ }
+ $form .= '
'.${$orderhash{$field}}[1]
+ .'
';
}
}
$form .= '
';
@@ -3510,6 +3591,18 @@ 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&Supplemental%20'.$crstype.'%20Documents';
+
return <
2 ){
- currentNav = document.getElementById(tabnav[0].id);
+ 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';
}
@@ -3735,6 +3831,40 @@ function showPage(current, pageId, nav,
current.className = 'active';
currentData = document.getElementById(pageId);
currentData.style.display = 'block';
+ 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';
+ }
+ }
+ }
return false;
}