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

bisitz bisitz@source.lon-capa.org
Thu, 04 Jun 2009 16:56:27 -0000


bisitz		Thu Jun  4 16:56:27 2009 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Optimizations and Corrections for Resource Parameters (Table Mode, Parameter Selection):
  (mostly related to lonparmset.pm 1.453)
  - Corrected unbalanced tags
    (Removed table closure; added anker, list and bold closure)
  - Re-added missing pick_box row_closures for &parmmenu
  - Moved pick_box row_closures for &parmmenu into &parmmenu, since both calls of &parmmenu aren't followed anymore by any other pick_box rows
  - Corrected spacing for style attribute (display:none) in list items
  - Corrected table structure of new "Select Parameters to View" part
  - Removed outdated and non-existing style "LC_parm_overview_parm_overview"
  - Removed some special unneeded styles
  - Replaced ordered list by unordered list and removed now unneeded style (Selected Parameters)
  - Simplified HTML structure for selected parameters and for detailed parameter list (Removed table in both cases)
  - Wording and optimized &mt() usage
  - Properly exclude javascript code from being interpreted as HTML code
  - Added <hr> as simple separator between detailed parameter list and hide link
  - Code style: Added/changed some line breaks for better code readability
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.453 loncom/interface/lonparmset.pm:1.454
--- loncom/interface/lonparmset.pm:1.453	Wed Jun  3 17:17:03 2009
+++ loncom/interface/lonparmset.pm	Thu Jun  4 16:56:27 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.453 2009/06/03 17:17:03 schualex Exp $
+# $Id: lonparmset.pm,v 1.454 2009/06/04 16:56:27 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -854,7 +854,7 @@
 
     return(<<ENDJS);
 <script type="text/javascript">
-
+// <![CDATA[
     function pclose() {
         parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",
                  "height=350,width=350,scrollbars=no,menubar=no");
@@ -893,6 +893,7 @@
         var newWin = window.open(url, wdwName, options);
         newWin.focus();
     }
+// ]]>
 </script>
 $selscript
 ENDJS
@@ -1248,6 +1249,7 @@
     my $tempkey;
     $r->print(<<ENDSCRIPT);
 <script type="text/javascript">
+// <![CDATA[
     function checkall(value, checkName) {
 
         var li = "_li";
@@ -1334,37 +1336,35 @@
             document.getElementById(id_li).style.display = "none";
         }
     }
-
+// ]]>
 </script>
 ENDSCRIPT
-    $r->print();
     $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View')));
 
     #part to print selected parms overview
-    $r->print('<table id="LC_parm_overview_parm_overview">'
-             .'<tr>'
-             .'<td style="vertical-align:top; width:250px"><p>'.&mt('Selected Parameters').': ');
-
-    #print out all possible parms and hide it
-    $r->print('<td>');
-    $r->print('<ol style="list-style-type:disc">');
+    $r->print(&mt('Selected Parameters:').'<br />');
+
+    #print out all possible parms and hide them by default
+    $r->print('<ul>');
     foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) {
         $r->print('<li id="'.$tempkey.'_li" value="'.$tempkey.'_li" name="pscat_li"');
         if (!($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat})) {
-            $r->print('style="display:none"');
+            $r->print(' style="display:none"');
         }
-        
-        $r->print('>'.($$allparms{$tempkey}=~/\s/ ? $$allparms{$tempkey} : $tempkey).'</li>');
-    }
-    $r->print('<a href="javascript:showParms()">('.&mt('add more parameter').')'
-             .'</a></p></td>');
-    $r->print('</td>');
-    $r->print('</tr>'
-             .'</table>');
+        $r->print('>'
+                 .($$allparms{$tempkey}=~/\s/ ? $$allparms{$tempkey} : $tempkey)
+                 .'</li>'
+        );
+    }
+    $r->print('</ul>'
+             .'<p><a href="javascript:showParms()">'
+             .&mt('Show detailed Parameter Selection')
+             .'</a></p>'
+    );
 
     &shortCuts($r,$allparms,$pscat,$keyorder);
 
-    $r->print('</table>');
+    $r->print(&Apache::lonhtmlcommon::row_closure(1));
 }
 
 sub parmboxes {
@@ -1372,8 +1372,11 @@
     my $tempkey;
 
     #part to print the parm-list
-    $r->print('<table><tr><td><fieldset id="LC_parm_overview_parm_menu" style="display:none"><legend><b>'.&mt('Parameter').'</legend>');
-    $r->print("\n".'<table>');
+    $r->print('<fieldset id="LC_parm_overview_parm_menu" style="display:none">'
+             .'<legend>'.&mt('Parameter').'</legend>'
+             ."\n"
+             .'<table>'
+    );
     my $cnt=0;
 
     $r->print('<tr>');
@@ -1395,10 +1398,14 @@
     }
     $r->print('</tr>'
              .'</table>'
-             .'<a href="javascript:hideParms()" style="font-weight:normal">('.&mt('hide more parameter').')');
+             .'<hr />'
+             .'<a href="javascript:hideParms()">'
+             .&mt('Hide')
+             .'</a>'
+    );
 
     #&shortCuts($r,$allparms,$pscat,$keyorder);
-    $r->print('</fieldset></td></tr></table>');
+    $r->print('</fieldset>');
 }
 sub shortCuts {
     my ($r,$allparms,$pscat,$keyorder)=@_;
@@ -1500,6 +1507,7 @@
         $sections .= '&nbsp;'.&mt('or').'&nbsp;';
         $sections .= qq|
 <script type="text/javascript">
+// <![CDATA[
 function group_or_section(caller) {
    if (caller == "cgroup") {
        if (document.parmform.cgroup.selectedIndex != 0) {
@@ -1511,14 +1519,17 @@
        }
    }
 }
+// ]]>
 </script>
 |;
     } else {
         $sections .= qq|
 <script type="text/javascript">
+// <![CDATA[
 function group_or_section(caller) {
     return;
 }
+// ]]>
 </script>
 |;
     }
@@ -1565,7 +1576,6 @@
     $r->print(&Apache::lonhtmlcommon::topic_bar (2,&mt('Select Parameters')));
     $r->print(&Apache::lonhtmlcommon::start_pick_box());
     &parmmenu($r,$allparms,$pscat,$keyorder);
-    #$r->print(&Apache::lonhtmlcommon::row_closure());
     $r->print(&Apache::lonhtmlcommon::end_pick_box());
     &parmboxes($r,$allparms,$pscat,$keyorder);
     $r->print(&Apache::lonhtmlcommon::start_pick_box());
@@ -2887,7 +2897,6 @@
     $r->print('<div>');
     $r->print(&Apache::lonhtmlcommon::start_pick_box());
     &parmmenu($r,\%allparms,\@pscat,\%keyorder);
-    #$r->print(&Apache::lonhtmlcommon::row_closure());
     $r->print(&Apache::lonhtmlcommon::end_pick_box());
     &parmboxes($r,\%allparms,\@pscat,\%keyorder);
     $r->print(&Apache::lonhtmlcommon::start_pick_box());