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

ehlerst ehlerst@source.lon-capa.org
Tue, 07 Apr 2009 20:48:40 -0000


ehlerst		Tue Apr  7 20:48:40 2009 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  changed the way to call the subroutine generate_edit_table.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.362 loncom/interface/londocs.pm:1.363
--- loncom/interface/londocs.pm:1.362	Tue Apr  7 20:12:55 2009
+++ loncom/interface/londocs.pm	Tue Apr  7 20:48:40 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.362 2009/04/07 20:12:55 ehlerst Exp $
+# $Id: londocs.pm,v 1.363 2009/04/07 20:48:40 ehlerst Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3125,21 +3125,15 @@
 }
 
 my %orderhash = (
-                'aa' => 'New Document',
-                'bb' => 'Published Documents',
-                'cc' => 'Special Documents',
-		'dd' => 'Tools',
-                'zz' => 'Hide all Options',
-                );
-my %namehash = (
-                'New Document' => $fileuploadform.'<br />'.$newfolderform,
-                'Published Documents' => $simpleeditdefaultform,
-                'Special Documents' => $specialdocumentsform,
-		'Tools' => $extresourcesform.'<br />'.$imspform.'<br />'.$recoverform.'<br />'.&generate_admin_options($containertag,$uploadtag,\%help,\%env),
+                'aa' => ['New Document',$fileuploadform.'<br />'.$newfolderform],
+                'bb' => ['Published Documents',$simpleeditdefaultform],
+                'cc' => ['Special Documents',$specialdocumentsform],
+		'dd' => ['Tools',$extresourcesform.'<br />'.$imspform.'<br />'.$recoverform.'<br />'.&generate_admin_options($containertag,$uploadtag,\%help,\%env)],
+                'zz' => ['Hide all Options'],
                 );
 my $tid='1';
 my $varcd = 'Main Course Documents';
-$r->print(&generate_edit_table($tid,$varcd,\%namehash,\%orderhash));
+$r->print(&generate_edit_table($tid,$varcd,\%orderhash));
  $hadchanges=0;
         my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
        if ($error) {
@@ -3252,20 +3246,15 @@
 
 
 my %suporderhash = (
-                'ee' => 'New Document',
-                'ff' => 'Special Documents',
-                'zz' => 'Hide all Options',
-                );
-
-my %supnamehash = (
-                'New Document' => $supupdocform.'<br />'.$supnewfolderform,
-                'Special Documents' => $supnewextform.'<br />'.$supnewsylform.'<br />'.$supnewaboutmeform,
+                'ee' => ['New Document',$supupdocform.'<br />'.$supnewfolderform],
+                'ff' => ['Special Documents',$supnewextform.'<br />'.$supnewsylform.'<br />'.$supnewaboutmeform],
+                'zz' => ['Hide all Options'],
                 );
 
 my $tid='2';
 my $varscd = 'Supplemental Course Documents';
 
-$r->print(&generate_edit_table($tid,$varscd,\%supnamehash,\%suporderhash));
+$r->print(&generate_edit_table($tid,$varscd,\%suporderhash));
 my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
        if ($error) {
            $r->print('<p><span class="LC_error">'.$error.'</span></p>');
@@ -3324,8 +3313,7 @@
 
 
 sub generate_edit_table {
-    my ($tid,$varcd,$namehash_ref,$orderhash_ref) = @_;
-    my %namehash = %{$namehash_ref};
+    my ($tid,$varcd,$orderhash_ref) = @_;
     my %orderhash = %{$orderhash_ref};
     my $form;
 
@@ -3333,16 +3321,18 @@
     $form .= '<ul id="navigation'.$tid.'" class="LC_TabContent">';
     foreach my $name (sort(keys(%orderhash))){
         if($name eq 'zz'){
-            $form .= '<span class="LC_Right"><li onclick="javascript:hideAll(this, \'navigation'.$tid.'\' ,\'content'.$tid.'\');" class="active">'.&mt($orderhash{$name}).'</li></span>';
+            $form .= '<span class="LC_Right"><li onclick="javascript:hideAll(this, \'navigation'.$tid.'\' ,\'content'.$tid.'\');" class="active">'.&mt(${$orderhash{$name}}[0]).'</li></span>';
         }else{
-            $form .= '<li onclick="javascript:showPage(this, \''.substr($orderhash{$name},0,3).$tid.'\', \'navigation'.$tid.'\',\'content'.$tid.'\');">'.&mt($orderhash{$name}).'</li>';
+            $form .= '<li onclick="javascript:showPage(this, \''.substr(${$orderhash{$name}}[0],0,3).$tid.'\', \'navigation'.$tid.'\',\'content'.$tid.'\');">'.&mt(${$orderhash{$name}}[0]).'</li>';
         }
     }
     $form .= '</ul>';
     $form .= '<div id="content'.$tid.'" style="padding: 0 0; margin: 0 0;">';
-    foreach my $field (keys(%namehash)){
-        $form .= '<div id="'.substr($field,0,3).$tid.'" class="LC_ContentBox" style="display: none;">'.$namehash{$field}.'</div>';
-      }
+    foreach my $field (keys(%orderhash)){
+	if($field ne 'zz'){
+           $form .= '<div id="'.substr(${$orderhash{$field}}[0],0,3).$tid.'" class="LC_ContentBox" style="display: none;">'.${$orderhash{$field}}[1].'</div>';
+        }
+    }
     $form .= '</div></div>';
     
     return $form;