--- loncom/interface/londocs.pm 2011/08/15 16:31:55 1.457
+++ loncom/interface/londocs.pm 2011/09/09 20:13:17 1.458
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.457 2011/08/15 16:31:55 raeburn Exp $
+# $Id: londocs.pm,v 1.458 2011/09/09 20:13:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1613,7 +1613,8 @@ sub handle_edit_cmd {
}
sub editor {
- my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype)=@_;
+ my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype,
+ $supplementalflag,$orderhash)=@_;
my $container= ($env{'form.pagepath'}) ? 'page'
: 'sequence';
@@ -1742,7 +1743,7 @@ sub editor {
$r->print('');
}
- my $output;
+ my ($to_show,$output);
&Apache::loncommon::start_data_table_count(); #setup a row counter
foreach my $res (@LONCAPA::map::order) {
@@ -1759,28 +1760,34 @@ sub editor {
&Apache::loncommon::end_data_table_count();
if ($shown) {
- $r->print(&Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll')
- .&Apache::loncommon::start_data_table(undef,'contentlist'));
+ $to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll')
+ .&Apache::loncommon::start_data_table(undef,'contentlist');
if ($allowed) {
- $r->print(&Apache::loncommon::start_data_table_header_row()
+ $to_show .= &Apache::loncommon::start_data_table_header_row()
.'
'.&mt('Move').' | '
.''.&mt('Actions').' | '
- .''.&mt('Document').' | ');
+ .''.&mt('Document').' | ';
if ($folder !~ /^supplemental/) {
- $r->print(''.&mt('Settings').' | ');
+ $to_show .= ''.&mt('Settings').' | ';
}
- $r->print(&Apache::loncommon::end_data_table_header_row());
+ $to_show .= &Apache::loncommon::end_data_table_header_row();
}
- $r->print($output
+ $to_show .= $output.' '
.&Apache::loncommon::end_data_table()
- .&Apache::loncommon::end_scrollbox()
- );
+ .'
'
+ .&Apache::loncommon::end_scrollbox();
} else {
- $r->print(''
+ $to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll')
+ .'
'
.&mt('Currently no documents.')
- .''
- );
+ .'
'
+ .&Apache::loncommon::end_scrollbox();
}
+ my $tid = 1;
+ if ($supplementalflag) {
+ $tid = 2;
+ }
+ $r-print(&generate_edit_table($tid,$orderhash,$to_show));
if ($allowed) {
&print_paste_buffer($r,$container);
}
@@ -2211,14 +2218,13 @@ END
$form_start
$form_end
-
-
+
$form_start
$form_end
|
- $form_start $rand_order_text $form_end |
- $form_start $parameterset $form_end |
+ $form_start $parameterset $form_end
+ $form_start $rand_order_text $form_end |
ENDPARMS
}
$line.=&Apache::loncommon::end_data_table_row();
@@ -2760,8 +2766,8 @@ sub startContentScreen {
$r->print(''.&mt('Supplemental Documents').'');
$r->print('');
- $r->print(''
- .'
');
+ $r->print('
'
+ .'
');
$r->print('
');
}
@@ -2961,11 +2967,21 @@ sub handler {
$iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/");
if ($allowed) {
+ my @tabids;
+ if ($supplementalflag) {
+ @tabids = ('002','ee2','ff2');
+ } else {
+ @tabids = ('aa1','bb1','cc1','ff1');
+ unless ($env{'form.pagepath'}) {
+ unshift(@tabids,'001');
+ push(@tabids,('dd1','ee1'));
+ }
+ }
+ my $tabidstr = join("','",@tabids);
$script .= &editing_js($udom,$uname).
- &resize_contentdiv_js();
+ &resize_contentdiv_js($tabidstr);
$addentries = {
- onload => "javascript:resize_contentdiv('contentscroll');",
- onresize => "javascript:resize_contentdiv('contentscroll');",
+ onload => "javascript:resize_contentdiv('contentscroll','1','1');",
};
}
# -------------------------------------------------------------------- Body tag
@@ -3093,22 +3109,23 @@ FIUP
CHBO
- my $fileuploada = " $help{'Uploading_From_Harddrive'}";
+ my $fileuploada = "
$help{'Uploading_From_Harddrive'}";
my $fileuploadform=(<
';
+ $fileuploadform .= $fileuploada.'
';
my $simpleeditdefaultform=(<
@@ -3124,7 +3141,7 @@ SEDFFORM
$lt{'copm'}
-
$help{'Load_Map'}
@@ -3415,7 +3432,8 @@ unless ($env{'form.pagepath'}) {
$hadchanges=0;
unless ($supplementalflag) {
- my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
+ my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
+ $supplementalflag,\%orderhash);
if ($error) {
$r->print(''.$error.'
');
}
@@ -3424,10 +3442,8 @@ unless ($env{'form.pagepath'}) {
}
&changewarning($r,'');
- $r->print(&generate_edit_table('1',\%orderhash));
}
-
- }
+ }
# Supplemental documents start here
@@ -3528,14 +3544,15 @@ my %suporderhash = (
'ff' => ['Special Documents',&create_form_ul(&create_list_elements(@specialdocs))]
);
if ($supplementalflag) {
- my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
+ my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
+ $supplementalflag,\%suporderhash);
if ($error) {
$r->print(''.$error.'
');
}
- $r->print(&generate_edit_table('2',\%suporderhash));
}
} elsif ($supplementalflag) {
- my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
+ my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
+ $supplementalflag);
if ($error) {
$r->print(''.$error.'
');
}
@@ -3638,7 +3655,7 @@ sub generate_admin_options {
sub generate_edit_table {
- my ($tid,$orderhash_ref) = @_;
+ my ($tid,$orderhash_ref,$to_show) = @_;
return unless(ref($orderhash_ref) eq 'HASH');
my %orderhash = %{$orderhash_ref};
my $form;
@@ -3647,31 +3664,35 @@ sub generate_edit_table {
if($env{'form.active'} ne ''){
$activetab = $env{'form.active'};
}
- $form = '';
- $form .= '
';
- foreach my $name (sort(keys(%orderhash))){
+ $form = ''.
+ '
';
+ foreach my $name (reverse(sort(keys(%orderhash)))) {
if($name ne '00'){
if($activetab eq '' || $activetab ne $name){
$active = '';
}elsif($activetab eq $name){
$active = 'class="active"';
}
- $form .= '- '.&mt(${$orderhash{$name}}[0]).'
';
} else {
- $form .= '- '.${$orderhash{$name}}[1].'
';
+ $form .= '- '.${$orderhash{$name}}[1].'
';
}
}
$form .= '
';
- $form .= '
';
+ $form .= '
';
+
+ if ($to_show ne '') {
+ $form .= '
'.$to_show.'
';
+ }
foreach my $field (keys(%orderhash)){
if($field ne '00'){
if($activetab eq '' || $activetab ne $field){
- $active = 'style="display: none;"';
+ $active = 'style="display: none;float:left"';
}elsif($activetab eq $field){
- $active = 'style="display:block;"';
+ $active = 'style="display:block;float:left"';
}
$form .= '
'.${$orderhash{$field}}[1]
@@ -3950,7 +3971,7 @@ function showPage(current, pageId, nav,
current.className = 'active';
currentData = document.getElementById(pageId);
currentData.style.display = 'block';
- resize_contentdiv('contentscroll');
+ activeTab = pageId;
if (nav == 'mainnav') {
var storedpath = "$docs_folderpath";
if (storedpath == '') {
@@ -3985,6 +4006,7 @@ function showPage(current, pageId, nav,
}
}
}
+ resize_contentdiv('contentscroll','1','0');
return false;
}
@@ -3999,66 +4021,171 @@ ENDNEWSCRIPT
}
sub resize_contentdiv_js {
+ my ($tabidstr) = @_;
my $viewport_js = &Apache::loncommon::viewport_geometry_js();
return < maxtabw) {
+ maxtabw = tabw;
+ }
+ } else {
+ if (document.getElementById(alltabs[i]) != null) {
+ var thistab = document.getElementById(alltabs[i]);
+ thistab.style.visibility = 'hidden';
+ thistab.style.display = 'block';
+ var tabw = document.getElementById(alltabs[i]).offsetWidth;
+ thistab.style.display = 'none';
+ thistab.style.visibility = '';
+ if (tabw > maxtabw) {
+ maxtabw = tabw;
+ }
+ }
+ }
+ }
- var primaryheight = document.getElementById("LC_nav_bar").offsetHeight;
- var secondaryheight = document.getElementById("LC_secondary_menu").offsetHeight;
- var crumbsheight = document.getElementById("LC_breadcrumbs").offsetHeight;
- var dccidheight = document.getElementById("dccid").offsetHeight;
-
- var uploadresultheight = 0;
- if (document.getElementById("uploadfileresult") != null) {
- uploadresultheight = document.getElementById("uploadfileresult").offsetHeight;
- }
- var tabbedheight = document.getElementById("tabbededitor").offsetHeight;
- var contenteditorheight = document.getElementById("contenteditor").offsetHeight;
- if (document.getElementById(scrollboxid) != null) {
- var scrollbox = document.getElementById(scrollboxid);
+ if (maxtabw > 0) {
+ var newscrollboxw;
+ if (maxtabw+paddingw+scrollboxscrollw scrollboxheight) {
- if (freespace > offset) {
- newscrollboxheight = scrollboxheight+freespace-offset;
- if (newscrollboxheight < minscrollbox) {
- newscrollboxheight = minscrollbox;
+ if (freevspace > offsetv) {
+ newscrollboxheight = scrollboxheight+freevspace-offsetv;
+ if (newscrollboxheight < minvscrollbox) {
+ newscrollboxheight = minvscrollbox;
}
scrollbox.style.height = newscrollboxheight+"px";
}
}
}
scrollboxheight = scrollbox.offsetHeight;
+ var contentlistheight = document.getElementById("contentlist").offsetHeight;
if (scrollboxscrollheight <= scrollboxheight) {
- var contentlistheight = document.getElementById("contentlist").offsetHeight;
- if ((contentlistheight+offset)