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

tempelho tempelho@source.lon-capa.org
Fri, 30 Jan 2009 09:05:37 -0000


tempelho		Fri Jan 30 09:05:37 2009 EDT

  Modified files:              
    /loncom/interface	londocs.pm loncommon.pm 
  Log:
  Added a hover functionality to LC_TabContent, inserted two javaScripts hideAll() and showPage() to implement tab functionality to upload course documents
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.329 loncom/interface/londocs.pm:1.330
--- loncom/interface/londocs.pm:1.329	Wed Jan 28 18:10:04 2009
+++ loncom/interface/londocs.pm	Fri Jan 30 09:05:36 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.329 2009/01/28 18:10:04 droeschl Exp $
+# $Id: londocs.pm,v 1.330 2009/01/30 09:05:36 tempelho Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2872,6 +2872,7 @@
            $containertag = '<input type="hidden" name="folderpath" value="" />';
            $uploadtag = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />';
        }
+       ##############alter hashaufruf
        $r->print(&generate_admin_options($containertag,$uploadtag,\%lt,\%help,\%env));
        $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
 		     &mt('Editing the Table of Contents for your '.$type)));
@@ -3038,14 +3039,6 @@
 
        $r->print(<<ENDFORM);
 
-<ul class="LC_TabContent">
-<li>$lt{'nd'}</li>
-<li>$lt{'pm'}</li>
-<li>$lt{'pubd'}</li>
-<li>$lt{'sd'}</li>
-<li>$lt{'mo'}</li>
-<li>$lt{'hao'}</li>
-</ul>
 
 <table class="LC_docs_adddocs">
 <!-- <tr>
@@ -3125,7 +3118,7 @@
 NGFFORM
 
 
-           $r->print(<<ENDFORM);
+           my $specialdocumentsform=(<<ENDFORM);
 <br />
 $newfolderform
 <br />
@@ -3153,7 +3146,24 @@
 <br />
 $newrosterform
 ENDFORM
-       }
+
+$r->print($specialdocumentsform);
+my %orderhash = (
+                'aa_eins' => 'New Document',
+                'bb_zwei' => 'Published Documents',
+                'cc_drei' => 'Special Documents',
+		'dd_vier' => 'More Options',
+                'zz_hide' => 'Hide all Option',
+                );
+my %namehash = (
+                'New Document' => $fileuploadform,
+                'Published Documents' => $simpleeditdefaultform,
+                'Special Documents' => $specialdocumentsform,
+		'More Options' => $extresourcesform.'<br />'.$imspform.'<br />'.$recoverform,
+                'drei' => 'dr',
+                );
+$r->print(&generate_edit_table(\%namehash,\%orderhash)); 
+      }
        if ($env{'form.pagepath'}) {
            $r->print(<<ENDBLOCK);
 $newsmpproblemform
@@ -3163,6 +3173,7 @@
        }
        $r->print('</td></tr>'."\n".
 '</table>');
+#$r->print(&generate_edit_table(\%namehash,\%orderhash));
        $r->print('</td></tr>');
     }
 # ----------------------------------------------------- Supplemental documents
@@ -3294,6 +3305,7 @@
   <input type="hidden" name="residx" />
 </form>');
     }
+
   } else {
       unless ($upload_result eq 'phasetwo') {
 # -------------------------------------------------------- This is showdoc mode
@@ -3352,27 +3364,30 @@
  </form>
  <div style="clear: both; height: 0px;">&nbsp;</div>
 ENDOPTIONFORM
+
 }
 
+
 sub generate_edit_table {
-    my ($optionhash_ref,$namehash_ref,$orderhash_ref) = @_;
-    my %optionhash = %{$optionhash_ref};         #id verlinkt mit inhalt
+    my ($namehash_ref,$orderhash_ref) = @_;
+    #my %optionhash = %{$optionhash_ref};         #id verlinkt mit inhalt
     my %namehash = %{$namehash_ref};             #name verlinkt mit id
     my %orderhash = %{$orderhash_ref};           #name mit kürzel verlinkt mit name
     my $form;
-    $form = '<div class="LC_ContentBoxSpecial"><h4 class="LC_hcell">'.&mt('Upload Course Documents').'<h4>';
+    $form = '<div class="LC_ContentBoxSpecial"><h4 class="LC_hcell">'.&mt('Upload Course Documents').'</h4>';
     $form .= '<ul class="LC_TabContent">';
     foreach my $name (sort(keys(%orderhash))){
         if($name eq 'zz_hide'){
-            $form .= '<li><a onclick="hideAllSection();" href="#">'.&mt($orderhash{$name}).'</a></li>';
+            $form .= '<li onclick="javascript:hideAll();">'.&mt($orderhash{$name}).'</li>';
         }else{
-            $form .= '<li><a onclick="popUpSection(\''.$namehash{$orderhash{$name}}.'\');" href="#">'.&mt($orderhash{$name}).'</a></li>';
+            $form .= '<li onclick="javascript:showPage(this, \''.$orderhash{$name}.'\');">'.&mt($orderhash{$name}).'</li>';
         }
     }
-    foreach my $field (keys(%optionhash)){
-        $form .= '<div id="'.$field.'" class="LC_ContentBox LC_hideThis">'.$optionhash{$field}.'</div>';
+    $form .= '<div id="content" style="padding: 0 0; margin: 0 0;">';
+    foreach my $field (keys(%namehash)){
+        $form .= '<div id="'.$field.'" class="LC_ContentBox" style="display: none;">'.$namehash{$field}.'</div>';
     }
-    $form .= '</div>';
+    $form .= '</div></div>';
     return $form;
 }
 
@@ -3577,6 +3592,21 @@
     this.document.forms.renameform.submit();
 }
 
+function hideAll() {
+	currentData = document.getElementById('content');
+	currentDivs = currentData.getElementsByTagName('div');
+	for (i = 0; i < currentDivs.length; i++) {
+	currentDivs[i].style.display = 'none';
+	}
+}
+
+function showPage(current, pageId) {
+	hideAll();
+	current.className = 'active';
+	currentData = document.getElementById(pageId);
+	currentData.style.display = 'block';
+	return false;
+}
 
 ENDNEWSCRIPT
 }
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.736 loncom/interface/loncommon.pm:1.737
--- loncom/interface/loncommon.pm:1.736	Wed Jan 28 13:49:50 2009
+++ loncom/interface/loncommon.pm	Fri Jan 30 09:05:36 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.736 2009/01/28 13:49:50 muellerd Exp $
+# $Id: loncommon.pm,v 1.737 2009/01/30 09:05:36 tempelho Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5637,6 +5637,12 @@
 	font-weight:bold;
 	white-space:nowrap;
 }
+ul.LC_TabContent   li:hover{
+        background: url(/adm/lonIcons/lightGreyBG.png) repeat-x right bottom;
+        color:#BF2317;
+        text-decoration:none;
+}
+
 .LC_hideThis
 {
 	display:none;