- $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'}
@@ -2917,17 +3019,15 @@ FUFORM
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(
@@ -2937,18 +3037,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(<
@@ -2963,39 +3051,21 @@ 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;
- }
- }
- $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
- my $savefolderpath;
- my $active = 'style="display: none;"';
- if($activeClass == 0){
- $active = 'style="display: block;"';
- }
- $r->print('
');
+
+# 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 = '
';
}
@@ -3024,14 +3094,14 @@ HIDDENFORM
my $recoverform=(<
-
+
RFORM
my $imspform=(<
-
+
IMSPFORM
@@ -3041,10 +3111,8 @@ IMSPFORM
$uploadtag
-
-
+
$help{'Navigate_Content'}
-
NNFORM
my $newsmppageform=(<
$uploadtag
-
- $help{'Simple Page'}
-
+
+ $help{'Simple Page'}
NSPFORM
@@ -3064,10 +3130,8 @@ NSPFORM
$uploadtag
-
- $help{'Simple Problem'}
-
+
+ $help{'Simple Problem'}
NSPROBFORM
@@ -3077,10 +3141,7 @@ NSPROBFORM
$uploadtag
-
-
-
+
NDBFORM
@@ -3089,11 +3150,8 @@ NDBFORM
$uploadtag
-
-
+
$help{'Score_Upload_Form'}
-
NEXUFORM
@@ -3102,11 +3160,8 @@ NEXUFORM
$uploadtag
-
-
+
$help{'Bulletin Board'}
-
NBFORM
@@ -3116,10 +3171,8 @@ NBFORM
$uploadtag
-
-
+
$help{'My Personal Information Page'}
-
NAMFORM
@@ -3128,10 +3181,7 @@ NAMFORM
$uploadtag
-
-
-
+
NASOFORM
@@ -3142,42 +3192,39 @@ NASOFORM
$uploadtag
-
-
+
$help{'Course Roster'}
-
NROSTFORM
my $specialdocumentsform;
+my @specialdocumentsforma;
+my $gradingform;
+my @gradingforma;
+my $communityform;
+my @communityforma;
my $newfolderform;
+my $newfolderb;
- unless ($env{'form.pagepath'}) {
- my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
-
+ my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
+
my $newpageform=(<
-
- $help{'Adding_Pages'}
-
+
+ $help{'Adding_Pages'}
NPFORM
+
$newfolderform=(<
-
- $help{'Adding_Folders'}
-
+ $lt{'newf'} $help{'Adding_Folders'}
NFFORM
@@ -3187,10 +3234,9 @@ NFFORM
$uploadtag
-
-
+
$help{'Syllabus'}
-
+
NSYLFORM
@@ -3200,64 +3246,87 @@ NSYLFORM
$uploadtag
-
-
+
$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));
- $specialdocumentsform=" $newpageform $newsylform $newgroupfileform";
- }
- $specialdocumentsform.=" $newnavform $newsmppageform
- $newsmpproblemform $newdropboxform
- $newexuploadform $newbulform
- $newaboutmeform $newaboutsomeoneform
- $newrosterform";
-if($env{'form.pagepath'}) {
- $specialdocumentsform=" $newsmpproblemform $newexuploadform";
-}
+
+
+my @tools = (
+# {' '=>$extresourcesform},
+# {' '=>$imspform},
+ {' '=>$recoverform},
+ );
my %orderhash = (
- 'aa' => ['Upload Document',$fileuploadform.' '.$newfolderform],
+ 'aa' => ['Import Documents',$fileuploadform],
'bb' => ['Published Resources',$simpleeditdefaultform],
- 'cc' => ['Special Documents',$specialdocumentsform],
- 'dd' => ['Tools',$extresourcesform.' '.$imspform.' '.$recoverform.' '.&generate_admin_options($containertag,$uploadtag,\%help,\%env)],
- 'zz' => ['Hide'],
+ 'cc' => ['Grading Resources',$gradingform],
+ 'ff' => ['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];
+ $orderhash{'dd'} = ['Community Resources',$communityform];
+ $orderhash{'ee'} = ['Special Documents',$specialdocumentsform];
+}
+
$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));
+ }
+
+ }
+
+# Supplemental documents start here
- &changewarning($r,'');
- $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
- &mt('Editing the Table of Contents for your '.$type)));
-$r->print(' ');
- if ($env{'form.pagepath'}) {
- }
-# ----------------------------------------------------- Supplemental documents
- my $active = 'style="display: none;"';
- if($activeClass == 1){
- $active = 'style="display: block;"';
- }
- $r->print('
');
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{
+ $env{'form.folderpath'} = &supplemental_base();
+ } elsif ($allowed) {
$env{'form.folderpath'} = $savefolderpath;
}
$env{'form.pagepath'} = '';
@@ -3268,8 +3337,9 @@ $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
@@ -3324,45 +3382,55 @@ SNEFORM
-
-
+
$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' => ['Upload Document',$supupdocform.' '.$supnewfolderform],
- 'ff' => ['Special Documents',$supnewextform.' '.$supnewsylform.' '.$supnewaboutmeform],
- 'zz' => ['Hide'],
+ '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);
+ 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.'
');
+ }
+ }
-my $tid='2';
-my $varscd = 'Supplemental Course Documents';
+ &endContentScreen($r);
-$r->print(&generate_edit_table($tid,$varscd,\%suporderhash));
-my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
- if ($error) {
- $r->print(''.$error.'
');
- }
-$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).' '.
@@ -3386,35 +3454,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();
- return (<
- $help{'Verify_Content'}
- $help{'Check_Resource_Versions'}
- $dumpbut
- $exportbut
-
-
-
-
-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,$varcd,$orderhash_ref) = @_;
+ my ($tid,$orderhash_ref) = @_;
+ return unless(ref($orderhash_ref) eq 'HASH');
my %orderhash = %{$orderhash_ref};
my $form;
my $activetab;
@@ -3422,37 +3535,35 @@ sub generate_edit_table {
if($env{'form.active'} ne ''){
$activetab = $env{'form.active'};
}
- $form = ''.&mt($varcd).' ';
+ $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 .= '
';
@@ -3468,7 +3579,7 @@ sub editing_js {
t_mnf => 'New Folder',
p_mnp => 'Name of New Page',
t_mnp => 'New Page',
- p_mxu => 'Title for the Uploaded Score',
+ 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',
@@ -3487,6 +3598,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_base();
+
return <
0 ){
- currentNav = document.getElementById(tabnav[0].id);
+ if(tabnav.length > 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';
}
@@ -3712,9 +3838,50 @@ 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;
}
+function injectData(current, hiddenField, name, value) {
+ currentElement = document.getElementById(hiddenField);
+ currentElement.name = name;
+ currentElement.value = value;
+ current.submit();
+}
+
ENDNEWSCRIPT
}
1;