--- loncom/interface/londocs.pm 2012/12/13 04:51:41 1.484.2.19
+++ loncom/interface/londocs.pm 2012/11/30 14:46:21 1.512
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.484.2.19 2012/12/13 04:51:41 raeburn Exp $
+# $Id: londocs.pm,v 1.512 2012/11/30 14:46:21 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -391,15 +391,18 @@ sub docs_change_log {
my %orderhash;
my $container='sequence';
my $pathitem;
- if ($env{'form.folderpath'} =~ /\:1$/) {
+ if ($env{'form.pagepath'}) {
$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{^/}{};
@@ -758,9 +761,16 @@ sub print_paste_buffer {
}
}
$r->print('
'.$othercrs);
- $r->print('
+ if ($container eq 'page') {
+ $r->print('
+
+
+');
+ } else {
+ $r->print('
');
+ }
$r->print('');
} else {
$r->print(&mt('Paste buffer contains:').' '.$buffer.
@@ -1682,16 +1692,13 @@ sub handle_edit_cmd {
sub editor {
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype,
$supplementalflag,$orderhash,$iconpath,$pathitem)=@_;
- my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container);
+ my $container= ($env{'form.pagepath'}) ? 'page'
+ : 'sequence';
+ my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order);
if ($allowed) {
- (my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,
- $is_random_order,$container) =
+ (my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) =
&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";
@@ -1855,23 +1862,13 @@ sub editor {
unless ($name) { $idx++; next; }
$output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
$coursenum,$coursedom,$crstype,
- $pathitem,$supplementalflag,$container);
+ $pathitem,$supplementalflag);
$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')
@@ -1889,15 +1886,19 @@ sub editor {
.'
'
.&Apache::loncommon::end_scrollbox();
} else {
- $to_show .= $toolslink
+ $to_show = ''.&Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT')
+ .' | '.&mt('Tools:').' | '
+ .' |
'
.&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.')
@@ -1947,7 +1948,7 @@ sub process_file_upload {
my $errtext='';
my $fatal=0;
my $container='sequence';
- if ($env{'form.folderpath'} =~ /:1$/) {
+ if ($env{'form.pagepath'}) {
$container='page';
}
($errtext,$fatal)=
@@ -2037,6 +2038,7 @@ 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,
@@ -2091,14 +2093,16 @@ sub is_supplemental_title {
sub entryline {
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
- $crstype,$pathitem,$supplementalflag,$container)=@_;
- my ($foldertitle,$renametitle);
+ $crstype,$pathitem,$supplementalflag)=@_;
+ my ($foldertitle,$pagetitle,$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];
@@ -2109,17 +2113,19 @@ sub entryline {
my $line=&Apache::loncommon::start_data_table_row();
my ($form_start,$form_end,$form_common);
# Edit commands
- my ($type, $esc_path, $path, $symb);
- if ($container eq 'page') {
- $type = 'page';
- } else {
- $type = 'folder';
- }
+ my ($container, $type, $esc_path, $path, $symb);
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;
@@ -2136,7 +2142,7 @@ sub entryline {
&Apache::lonnet::declutter($currurl));
}
}
- my ($renamelink,%lt);
+ my %lt;
if ($allowed) {
my $incindex=$index+1;
my $selectbox='';
@@ -2233,7 +2239,7 @@ sub entryline {
$nocopy=1;
}
}
- my ($copylink,$cutlink,$removelink);
+ my ($copylink,$cutlink,$removelink,$renamelink);
my $skip_confirm = 0;
if ( $folder =~ /^supplemental/
|| ($url =~ m{( /smppg$
@@ -2252,7 +2258,7 @@ sub entryline {
ENDCOPY
} else {
$copylink=(<
$lt{'cp'}
+$lt{'cp'}
ENDCOPY
}
if ($nocut) {
@@ -2261,7 +2267,7 @@ ENDCOPY
ENDCUT
} else {
$cutlink=(<$lt{'ct'}
+$lt{'ct'}
ENDCUT
}
if ($noremove) {
@@ -2270,14 +2276,12 @@ ENDCUT
ENDREM
} else {
$removelink=(<$lt{'rm'}
+$lt{'rm'}
ENDREM
}
- unless ($isexternal) {
- $renamelink=(<$lt{'rn'}
+ $renamelink=(<$lt{'rn'}
ENDREN
- }
$form_start = '