[LON-CAPA-cvs] cvs: loncom /interface londocs.pm

tempelho tempelho@source.lon-capa.org
Mon, 16 Mar 2009 21:44:38 -0000


tempelho		Mon Mar 16 21:44:38 2009 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  Removed form hidden field suppactive and replaced its functionality by the usage of $env{'form.folderpath'}. Realised the option to switch between the main and the supplemental course documents at any time. 
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.355 loncom/interface/londocs.pm:1.356
--- loncom/interface/londocs.pm:1.355	Tue Mar 10 22:15:43 2009
+++ loncom/interface/londocs.pm	Mon Mar 16 21:44:38 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.355 2009/03/10 22:15:43 ehlerst Exp $
+# $Id: londocs.pm,v 1.356 2009/03/16 21:44:38 tempelho Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2891,7 +2891,7 @@
     my $activeClass = 1;
     my $active = '';
     $r->print('<ul class="LC_TabContentBigger" id="mainnav">');
-    if (($standard) && ($allowed) && (!$forcesupplement) && (!$env{'form.suppactive'})) {
+    if (($standard) && ($allowed) && (!$forcesupplement) && ($env{'form.folderpath'}=~/^default/)) {
         if($activeClass == 1){
            $active = 'class="active"';
 	   $activeClass = 0;
@@ -2899,7 +2899,7 @@
     }
     $r->print('<li '.$active.'onclick="javascript:showPage(this,\'Main Course Documents\',\'mainnav\',\'maincoursedoc\');">'.&mt('Main Course Documents').'</li>');
     $active = '';
-    if (!$forcestandard || $env{'form.suppactive'} ) {
+    if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {
         if($activeClass == 1){
            $active = 'class="active"';
         }
@@ -2907,7 +2907,7 @@
     $r->print('<li '.$active.'onclick="javascript:showPage(this,\'Supplemental Course Documents\',\'mainnav\',\'maincoursedoc\');">'.&mt('Supplemental Course Documents').'</li>');
     $r->print('</ul><div class="LC_ContentBoxSpecial" style="margin:0 0;padding:0 0;"><div id="maincoursedoc" style="margin:0 0;padding:0 0;">');
 # --------------------------------------------------------- Standard documents
-    if (($standard) && ($allowed) && (!$forcesupplement)) {
+       my $savefolderpath;
        my $active = 'style="display: none;"';
        if($activeClass == 0){
           $active = 'style="display: block;"';
@@ -2916,8 +2916,9 @@
         $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
                      &mt('Editing the Table of Contents for your '.$type)));
        my $folder=$env{'form.folder'};
-       if ($folder eq '' || $folder eq 'supplemental') {
+       if ($folder eq '' || $folder=~/^supplemental/) {
            $folder='default';
+	   $savefolderpath = $env{'form.folderpath'};
 	   $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents'));
            $uploadtag = '<input type="hidden" name="folderpath" value="'.
 	       &HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
@@ -3154,9 +3155,7 @@
 $r->print('</div>');
        if ($env{'form.pagepath'}) {
        }
-    }
 # ----------------------------------------------------- Supplemental documents
-    if (!$forcestandard) {
        my $active = 'style="display: none;"';
        if($activeClass == 1){
           $active = 'style="display: block;"';
@@ -3170,6 +3169,8 @@
 	   (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) {
           $env{'form.folderpath'} = 'supplemental&'.
                                     &escape(&mt('Supplemental '.$type.' Documents'));
+       }else{
+	  $env{'form.folderpath'} = $savefolderpath;
        }
        if ($allowed) {
 	   my $folderseq=
@@ -3192,7 +3193,6 @@
 	</textarea>
 	<br />
 	<input type="hidden" name="folderpath" value="$path" />
-	<input type="hidden" name="suppactive" value="true" />
 	<input type="hidden" name="cmd" value="upload_supplemental" />
 	<span class="LC_nobreak">
 	<input type="submit" value="$lt{'upld'}" />
@@ -3205,7 +3205,6 @@
 	<form action="/adm/coursedocs" method="post" name="supnewfolder">
 	<input type="hidden" name="folderpath" value="$path" />
 	<input type="hidden" name="importdetail" value="" />
-	<input type="hidden" name="suppactive" value="true" />
 	<span class="LC_nobreak">
 	<input name="newfolder" type="button"
 	onClick="javascript:makenewfolder(this.form,'$folderseq');"
@@ -3219,7 +3218,6 @@
 	<form action="/adm/coursedocs" method="post" name="supnewext">
 	<input type="hidden" name="folderpath" value="$path" />
 	<input type="hidden" name="importdetail" value="" />
-	<input type="hidden" name="suppactive" value="true" />
 	<span class="LC_nobreak">
 	<input name="newext" type="button" 
 	onClick="javascript:makenewext('supnewext');"
@@ -3233,7 +3231,6 @@
 	<input type="hidden" name="folderpath" value="$path" />
 	<input type="hidden" name="importdetail" 
 	value="Syllabus=/public/$coursedom/$coursenum/syllabus" />
-	<input type="hidden" name="suppactive" value="true" />
 	<span class="LC_nobreak">
 	<input name="newsyl" type="submit" value="$lt{'syll'}" />
 	$help{'Syllabus'}
@@ -3246,7 +3243,6 @@
 	<input type="hidden" name="folderpath" value="$path" />
 	<input type="hidden" name="importdetail" 
 	value="$plainname=/adm/$udom/$uname/aboutme" />
-	<input type="hidden" name="suppactive" value="true" />
 	<span class="LC_nobreak">
 	<input name="newaboutme" type="submit" value="$lt{'mypi'}" />
 	$help{'My Personal Information Page'}
@@ -3279,7 +3275,6 @@
        }
 $r->print('</div>');
 	} 
-   }
 $r->print('</div>');
     if ($allowed) {
 	$r->print('