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

faziophi faziophi@source.lon-capa.org
Fri, 08 Jan 2010 00:52:07 -0000


faziophi		Fri Jan  8 00:52:07 2010 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonconfigsettings.pm 
  Log:
  Additional style for elements within an accordion, and adds jQuery
  javascript to support advanced elements.  If any <tr> elements are found
  inside an accordion container with the class "advanced", they are hidden
  by default and a "Show advanced options" checkbox is created.  Toggling
  this causes these additional options to fade in/out as desired.
  
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.929 loncom/interface/loncommon.pm:1.930
--- loncom/interface/loncommon.pm:1.929	Wed Dec 16 14:21:59 2009
+++ loncom/interface/loncommon.pm	Fri Jan  8 00:52:06 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.929 2009/12/16 14:21:59 wenzelju Exp $
+# $Id: loncommon.pm,v 1.930 2010/01/08 00:52:06 faziophi Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5074,6 +5074,14 @@
   width: 100%;
 }
 
+.ui-accordion,
+.ui-accordion table.LC_data_table,
+.ui-accordion table.LC_nested_outer{
+  border: 0px;
+  border-spacing: 0px;
+  margin: 3px;
+}
+
 table.LC_data_table tr th,
 table.LC_calendar tr th,
 table.LC_mail_list tr th,
@@ -5183,6 +5191,22 @@
   text-align: right;
 }
 
+.ui-accordion table.LC_nested tr.LC_odd_row td.LC_left_item,
+.ui-accordion table.LC_nested tr.LC_even_row td.LC_left_item {
+  text-align: right;
+  width: 40%;
+  padding-right:10px;
+  vertical-align: top;
+  padding: 5px;
+}
+
+.ui-accordion table.LC_nested tr.LC_odd_row td.LC_right_item,
+.ui-accordion table.LC_nested tr.LC_even_row td.LC_right_item {
+  text-align: left;
+  width: 60%;
+  padding: 2px 4px;
+}
+
 table.LC_nested tr.LC_odd_row td {
   background-color: #EEEEEE;
 }
@@ -6429,6 +6453,11 @@
   line-height: 150%;
 }
 
+.ui-accordion .LC_advanced_toggle {
+  float: right;
+  font-size: 90%;
+  padding: 0px 4px
+}
 
 END
 }
Index: loncom/interface/lonconfigsettings.pm
diff -u loncom/interface/lonconfigsettings.pm:1.9 loncom/interface/lonconfigsettings.pm:1.10
--- loncom/interface/lonconfigsettings.pm:1.9	Thu Jan  7 18:21:25 2010
+++ loncom/interface/lonconfigsettings.pm	Fri Jan  8 00:52:06 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: lonconfigsettings.pm,v 1.9 2010/01/07 18:21:25 faziophi Exp $
+# $Id: lonconfigsettings.pm,v 1.10 2010/01/08 00:52:06 faziophi Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -341,11 +341,23 @@
 		$("#prefs").accordion({
 			autoHeight: false
 		});
-		$("#prefs td.LC_left_item").css("text-align", "right");
-		$("#prefs td.LC_left_item").css("width", "40%");
-		$("#prefs td.LC_left_item").css("padding-right", "10px");		
-		$("#prefs td.LC_right_item").css("text-align", "left");
-		$("#prefs td.LC_right_item").css("width", "60%");		
+		if ($(".LC_nested tr.advanced").get(0)) {
+			$(".LC_nested tr.advanced").each(function() {
+				$(this).hide();
+				p = $(this).parents("div.ui-accordion-content")
+				if (p.find(".LC_advanced_toggle").length) {
+					return;
+				}
+				p.prepend("<span class=\'LC_advanced_toggle\'><input type=\"checkbox\"/>Show advanced options</span>");
+			});
+			$(".LC_advanced_toggle input").change(function() {
+				if($(this).is(":checked")) {
+					$(this).parents("div.ui-accordion-content").find("tr.advanced").fadeIn("normal");
+				} else {
+					$(this).parents("div.ui-accordion-content").find("tr.advanced").fadeOut("normal");		
+				}
+			});
+		}
 	});
 </script>
 ');