--- loncom/interface/londocs.pm 2010/08/16 00:30:47 1.433
+++ loncom/interface/londocs.pm 2010/08/25 00:12:38 1.437
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.433 2010/08/16 00:30:47 raeburn Exp $
+# $Id: londocs.pm,v 1.437 2010/08/25 00:12:38 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2718,9 +2718,11 @@ sub handler {
$env{'form.pagename'}=&unescape(pop(@pagepath));
$env{'form.folder'}=pop(@pagepath);
$containertag = ''.
- '';
- $uploadtag = ''.
- '';
+ '';
+ $uploadtag =
+ ''.
+ ''.
+ '';
} else {
my $folderpath=$env{'form.folderpath'};
if (!$folderpath) {
@@ -2918,7 +2920,7 @@ sub create_form_ul {
'upld' => 'Import Document',
'srch' => 'Search',
'impo' => 'Import',
- 'book' => 'Import Bookmarks',
+ 'wish' => 'Import from Wishlist',
'selm' => 'Select Map',
'load' => 'Load Map',
'reco' => 'Recover Deleted Documents',
@@ -2991,7 +2993,7 @@ SEDFFORM
my @simpleeditdefaultforma = (
{ '
' => "$uploadtag" },
{ '
' => "$help{'Importing_LON-CAPA_Resource'}" },
- { '
' => "" },
+ { '
' => "" },
);
$simpleeditdefaultform .= create_form_ul(create_list_elements(@simpleeditdefaultforma));
$simpleeditdefaultform .=(<print(''.$tabtitles{'main'}{$crstype}.'');
$active = '';
if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {
@@ -3070,7 +3071,6 @@ HIDDENFORM
}
}
$r->print(''.$tabtitles{'supplemental'}{$crstype}.'');
$r->print('');
} else {
@@ -3119,7 +3119,7 @@ HIDDENFORM
my $recoverform=(<
-
+
RFORM
@@ -3276,9 +3276,13 @@ NGFFORM
{'
'=>$newpageform},
{'
'=>$newsylform},
{'
'=>$newgroupfileform},
- );
-
- }
+ );
+
+ my @importdoc = (
+ {'
'=>$extresourcesform},
+ {'
'=>$imspform},);
+ $fileuploadform = create_form_ul(create_list_elements(@importdoc)) . '
' . $fileuploadform;
+
push @specialdocumentsforma, ({'
'=>$newnavform},
{'
'=>$newsmppageform},
{'
'=>$newsmpproblemform},
@@ -3290,6 +3294,7 @@ NGFFORM
{'
'=>$newrosterform},);
$specialdocumentsform = create_form_ul(create_list_elements(@specialdocumentsforma));
+ }
if($env{'form.pagepath'}) {
@@ -3303,21 +3308,19 @@ if($env{'form.pagepath'}) {
my @tools = (
# {'
'=>$extresourcesform},
# {'
'=>$imspform},
- {'
'=>$recoverform},
+ {'
'=>$recoverform},
);
-my @importdoc = (
- {'
'=>$extresourcesform},
- {'
'=>$imspform},
-);
-$fileuploadform = create_form_ul(create_list_elements(@importdoc)) . '
' . $fileuploadform;
my %orderhash = (
- '00' => ['Newfolder',$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)],
+ 'dd' => ['Tools', create_form_ul(create_list_elements(@tools)).&generate_admin_options(\%help,\%env)],
);
+unless($env{'form.pagepath'}) {
+ $orderhash{'00'} = ['Newfolder',$newfolderform];
+}
+
my $tid='1';
$hadchanges=0;
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
@@ -3333,8 +3336,6 @@ $r->print(&generate_edit_table($tid,\%or
$r->print('');
}
- if ($env{'form.pagepath'}) {
- }
# ----------------------------------------------------- Supplemental documents
$active = 'style="display: none;"';
if($activeClass == 1){
@@ -3481,8 +3482,8 @@ $r->print('');
}
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',
@@ -3589,8 +3590,14 @@ sub editing_js {
);
my $crstype = &Apache::loncommon::course_type();
- my $docs_folderpath = $env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'};
- my $docs_pagepath = $env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.pagepath'};
+ 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';
@@ -3827,15 +3834,29 @@ function showPage(current, pageId, nav,
if (storedpath == '') {
storedpath = "$docs_pagepath";
}
+ var storedpage = "$main_container_page";
var reg = new RegExp("^supplemental");
if (pageId == 'mainCourseDocuments') {
- if (reg.test(storedpath)) {
- document.simpleedit.folderpath.value = '$toplevelmain';
- document.uploaddocument.folderpath.value = '$toplevelmain';
- document.newext.folderpath.value = '$toplevelmain';
+ 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)) {
+ 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';