--- loncom/interface/londocs.pm 2012/11/29 20:37:07 1.511
+++ loncom/interface/londocs.pm 2012/12/29 17:37:21 1.525
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.511 2012/11/29 20:37:07 raeburn Exp $
+# $Id: londocs.pm,v 1.525 2012/12/29 17:37:21 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -391,18 +391,15 @@ sub docs_change_log {
my %orderhash;
my $container='sequence';
my $pathitem;
- if ($env{'form.pagepath'}) {
+ if ($env{'form.folderpath'} =~ /\:1$/) {
$container='page';
- $pathitem = '';
- } else {
- my $folderpath=$env{'form.folderpath'};
- if ($folderpath eq '') {
- $folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Documents'));
- }
- $pathitem = '';
}
+ my $folderpath=$env{'form.folderpath'};
+ if ($folderpath eq '') {
+ $folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Documents').':::::');
+ }
+ $pathitem = '';
my $readfile="/uploaded/$coursedom/$coursenum/$folder.$container";
my $jumpto = $readfile;
$jumpto =~ s{^/}{};
@@ -761,16 +758,9 @@ sub print_paste_buffer {
}
}
$r->print('
'.$othercrs);
- if ($container eq 'page') {
- $r->print('
-
-
-');
- } else {
- $r->print('
+ $r->print('
');
- }
$r->print('');
} else {
$r->print(&mt('Paste buffer contains:').' '.$buffer.
@@ -1692,16 +1682,23 @@ sub handle_edit_cmd {
sub editor {
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype,
$supplementalflag,$orderhash,$iconpath,$pathitem)=@_;
- my $container= ($env{'form.pagepath'}) ? 'page'
- : 'sequence';
- my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order);
+ my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container);
if ($allowed) {
- (my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) =
+ (my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,
+ $is_random_order,$container) =
&Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1);
$r->print($breadcrumbtrail);
+ } elsif ($env{'form.folderpath'} =~ /\:1$/) {
+ $container = 'page';
+ } else {
+ $container = 'sequence';
}
- my $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container";
+ my $jumpto;
+
+ unless ($supplementalflag) {
+ $jumpto = "'uploaded/$coursedom/$coursenum/$folder.$container'";
+ }
unless ($allowed) {
$randompick = -1;
@@ -1862,13 +1859,23 @@ sub editor {
unless ($name) { $idx++; next; }
$output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
$coursenum,$coursedom,$crstype,
- $pathitem,$supplementalflag);
+ $pathitem,$supplementalflag,$container);
$idx++;
$shown++;
}
&Apache::loncommon::end_data_table_count();
if (($allowed) || ($supplementalflag && $folder eq 'supplemental')) {
+ my $toolslink = '
'
+ .&Apache::loncommon::help_open_menu('Navigation Screen',
+ 'Navigation_Screen',undef,'RAT')
+ .' | '.&mt('Tools:').' | '
+ .' |
';
if ($shown) {
if ($allowed) {
$to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll')
@@ -1886,19 +1893,15 @@ sub editor {
.'
'
.&Apache::loncommon::end_scrollbox();
} else {
- $to_show = ''.&Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT')
- .' | '.&mt('Tools:').' | '
- .' |
'
+ $to_show .= $toolslink
.&Apache::loncommon::start_data_table('LC_tableOfContent')
.$output.' '
.&Apache::loncommon::end_data_table();
}
} else {
+ if (!$allowed) {
+ $to_show .= $toolslink;
+ }
$to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll')
.''
.&mt('Currently no documents.')
@@ -1948,7 +1951,7 @@ sub process_file_upload {
my $errtext='';
my $fatal=0;
my $container='sequence';
- if ($env{'form.pagepath'}) {
+ if ($env{'form.folderpath'} =~ /:1$/) {
$container='page';
}
($errtext,$fatal)=
@@ -2038,7 +2041,6 @@ sub process_file_upload {
my $archiveurl = &HTML::Entities::encode($url,'<>&"');
my %archiveitems = (
folderpath => $env{'form.folderpath'},
- pagepath => $env{'form.pagepath'},
cmd => $nextphase,
newidx => $newidx,
position => $position,
@@ -2093,16 +2095,14 @@ sub is_supplemental_title {
sub entryline {
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
- $crstype,$pathitem,$supplementalflag)=@_;
- my ($foldertitle,$pagetitle,$renametitle);
+ $crstype,$pathitem,$supplementalflag,$container)=@_;
+ my ($foldertitle,$renametitle);
if (&is_supplemental_title($title)) {
($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);
- $pagetitle = $foldertitle;
} else {
$title=&HTML::Entities::encode($title,'"<>&\'');
$renametitle=$title;
$foldertitle=$title;
- $pagetitle=$title;
}
my $orderidx=$LONCAPA::map::order[$index];
@@ -2113,19 +2113,17 @@ sub entryline {
my $line=&Apache::loncommon::start_data_table_row();
my ($form_start,$form_end,$form_common);
# Edit commands
- my ($container, $type, $esc_path, $path, $symb);
+ my ($type, $esc_path, $path, $symb);
+ if ($container eq 'page') {
+ $type = 'page';
+ } else {
+ $type = 'folder';
+ }
if ($env{'form.folderpath'}) {
- $type = 'folder';
- $container = 'sequence';
$esc_path=&escape($env{'form.folderpath'});
$path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
# $htmlfoldername=&HTML::Entities::encode($env{'form.foldername'},'<>&"');
}
- if ($env{'form.pagepath'}) {
- $type = $container = 'page';
- $esc_path=&escape($env{'form.pagepath'});
- $path = &HTML::Entities::encode($env{'form.pagepath'},'<>&"');
- }
my $isexternal;
if ($residx) {
my $currurl = $url;
@@ -2142,7 +2140,7 @@ sub entryline {
&Apache::lonnet::declutter($currurl));
}
}
- my %lt;
+ my ($renamelink,%lt);
if ($allowed) {
my $incindex=$index+1;
my $selectbox='';
@@ -2239,7 +2237,7 @@ sub entryline {
$nocopy=1;
}
}
- my ($copylink,$cutlink,$removelink,$renamelink);
+ my ($copylink,$cutlink,$removelink);
my $skip_confirm = 0;
if ( $folder =~ /^supplemental/
|| ($url =~ m{( /smppg$
@@ -2258,7 +2256,7 @@ sub entryline {
ENDCOPY
} else {
$copylink=(<
$lt{'cp'}
+$lt{'cp'}
ENDCOPY
}
if ($nocut) {
@@ -2267,7 +2265,7 @@ ENDCOPY
ENDCUT
} else {
$cutlink=(<$lt{'ct'}
+$lt{'ct'}
ENDCUT
}
if ($noremove) {
@@ -2276,12 +2274,14 @@ ENDCUT
ENDREM
} else {
$removelink=(<$lt{'rm'}
+$lt{'rm'}
ENDREM
}
- $renamelink=(<$lt{'rn'}
+ unless ($isexternal) {
+ $renamelink=(<$lt{'rn'}
ENDREN
+ }
$form_start = '