--- loncom/interface/londocs.pm 2012/11/16 23:37:15 1.509
+++ loncom/interface/londocs.pm 2012/12/03 14:47:30 1.519
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.509 2012/11/16 23:37:15 raeburn Exp $
+# $Id: londocs.pm,v 1.519 2012/12/03 14:47:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -41,6 +41,7 @@ use Apache::lonclonecourse;
use Apache::lonnavmaps;
use Apache::lonnavdisplay();
use Apache::lonuserstate();
+use Apache::lonextresedit();
use HTML::Entities;
use HTML::TokeParser;
use GDBM_File;
@@ -390,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{^/}{};
@@ -760,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.
@@ -1691,12 +1682,17 @@ 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 ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) =
- &Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1);
- $r->print($breadcrumbtrail);
+ my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container);
+ if ($allowed) {
+ (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";
@@ -1859,35 +1855,61 @@ 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 ($shown) {
- $to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll')
- .&Apache::loncommon::start_data_table(undef,'contentlist');
- if ($allowed) {
- $to_show .= &Apache::loncommon::start_data_table_header_row()
- .'
'.&mt('Move').' | '
- .''.&mt('Actions').' | '
- .''.&mt('Document').' | ';
- if ($folder !~ /^supplemental/) {
- $to_show .= ''.&mt('Settings').' | ';
+
+ if (($allowed) || ($supplementalflag && $folder eq 'supplemental')) {
+ if ($shown) {
+ if ($allowed) {
+ $to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll')
+ .&Apache::loncommon::start_data_table(undef,'contentlist')
+ .&Apache::loncommon::start_data_table_header_row()
+ .''.&mt('Move').' | '
+ .''.&mt('Actions').' | '
+ .''.&mt('Document').' | ';
+ if ($folder !~ /^supplemental/) {
+ $to_show .= ''.&mt('Settings').' | ';
+ }
+ $to_show .= &Apache::loncommon::end_data_table_header_row()
+ .$output.' '
+ .&Apache::loncommon::end_data_table()
+ .'
'
+ .&Apache::loncommon::end_scrollbox();
+ } else {
+ $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();
}
- $to_show .= &Apache::loncommon::end_data_table_header_row();
+ } else {
+ $to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll')
+ .''
+ .&mt('Currently no documents.')
+ .'
'
+ .&Apache::loncommon::end_scrollbox();
}
- $to_show .= $output.' '
- .&Apache::loncommon::end_data_table()
- .'
'
- .&Apache::loncommon::end_scrollbox();
} else {
- $to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll')
- .''
- .&mt('Currently no documents.')
- .'
'
- .&Apache::loncommon::end_scrollbox();
+ if ($shown) {
+ $to_show = ''
+ .&Apache::loncommon::start_data_table('LC_tableOfContent')
+ .$output
+ .&Apache::loncommon::end_data_table()
+ .'
';
+ } else {
+ $to_show = ''
+ .&mt('Currently no documents.')
+ .'
'
+ }
}
my $tid = 1;
if ($supplementalflag) {
@@ -1899,19 +1921,6 @@ sub editor {
$readfile));
&print_paste_buffer($r,$container,$folder,$coursedom,$coursenum);
} else {
- if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
- #Function Box for Supplemental Content for users with mdc priv.
- my $funcname = &mt('Folder Editor');
- $r->print(
- &Apache::loncommon::head_subbox(
- &Apache::lonhtmlcommon::start_funclist().
- &Apache::lonhtmlcommon::add_item_funclist(
- ''.
- ''.
- '').
- &Apache::lonhtmlcommon::end_funclist()));
- }
$r->print($to_show);
}
return;
@@ -1932,7 +1941,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)=
@@ -2022,7 +2031,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,
@@ -2077,16 +2085,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];
@@ -2097,34 +2103,34 @@ 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 (!$supplementalflag && $residx) {
+ if ($residx) {
my $currurl = $url;
$currurl =~ s{^http(|s)(:|:)//}{/adm/wrapper/ext/};
if ($currurl =~ m{^/adm/wrapper/ext/}) {
$isexternal = 1;
}
- my $path = 'uploaded/'.
- $env{'course.'.$env{'request.course.id'}.'.domain'}.'/'.
- $env{'course.'.$env{'request.course.id'}.'.num'}.'/';
- $symb = &Apache::lonnet::encode_symb($path.$folder.".$container",
- $residx,
- &Apache::lonnet::declutter($currurl));
+ if (!$supplementalflag) {
+ my $path = 'uploaded/'.
+ $env{'course.'.$env{'request.course.id'}.'.domain'}.'/'.
+ $env{'course.'.$env{'request.course.id'}.'.num'}.'/';
+ $symb = &Apache::lonnet::encode_symb($path.$folder.".$container",
+ $residx,
+ &Apache::lonnet::declutter($currurl));
+ }
}
- my %lt;
+ my ($renamelink,%lt);
if ($allowed) {
my $incindex=$index+1;
my $selectbox='';
@@ -2221,7 +2227,7 @@ sub entryline {
$nocopy=1;
}
}
- my ($copylink,$cutlink,$removelink,$renamelink);
+ my ($copylink,$cutlink,$removelink);
my $skip_confirm = 0;
if ( $folder =~ /^supplemental/
|| ($url =~ m{( /smppg$
@@ -2240,7 +2246,7 @@ sub entryline {
ENDCOPY
} else {
$copylink=(<$lt{'cp'}
+$lt{'cp'}
ENDCOPY
}
if ($nocut) {
@@ -2249,7 +2255,7 @@ ENDCOPY
ENDCUT
} else {
$cutlink=(<$lt{'ct'}
+$lt{'ct'}
ENDCUT
}
if ($noremove) {
@@ -2258,12 +2264,14 @@ ENDCUT
ENDREM
} else {
$removelink=(<$lt{'rm'}
+$lt{'rm'}
ENDREM
}
- $renamelink=(<$lt{'rn'}
+ unless ($isexternal) {
+ $renamelink=(<$lt{'rn'}
ENDREN
+ }
$form_start = '