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

raeburn raeburn@source.lon-capa.org
Fri, 20 Nov 2009 04:12:44 -0000


raeburn		Fri Nov 20 04:12:44 2009 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm loncommon.pm 
  Log:
  - More compact display of Course Title in inline menu.
  - Domain Coordinator display of course ID (+/- institutional code) now
     toggled via (More ...) or (Less ...) link.   
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.305 loncom/interface/lonmenu.pm:1.306
--- loncom/interface/lonmenu.pm:1.305	Thu Nov 19 10:26:15 2009
+++ loncom/interface/lonmenu.pm	Fri Nov 20 04:12:43 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.305 2009/11/19 10:26:15 bisitz Exp $
+# $Id: lonmenu.pm,v 1.306 2009/11/20 04:12:43 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1606,6 +1606,31 @@
 NAVCONTROL
 }
 
+sub dc_popup_js {
+    my %lt = &Apache::lonlocal::texthash(
+                                          more => '(More ...)',
+                                          less => '(Less ...)',
+                                        );
+    return <<"END";
+
+function showCourseID() {
+    document.getElementById('dccid').style.display='block';
+    document.getElementById('dccid').style.textAlign='left';
+    document.getElementById('dccid').style.textFace='normal';    
+    document.getElementById('dccidtext').innerHTML ='<a href="javascript:hideCourseID();">$lt{'less'}</a>';
+    return;
+}
+
+function hideCourseID() {
+    document.getElementById('dccid').style.display='none';
+    document.getElementById('dccidtext').innerHTML ='<a href="javascript:showCourseID()">$lt{'more'}</a>';
+    return;
+}
+
+END
+
+}
+
 sub utilityfunctions {
     my $caller = shift;
     unless ($env{'environment.remote'} eq 'off' || 
@@ -1623,6 +1648,13 @@
     my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
     my $nav_control=&nav_control_js();
 
+    my $dc_popup_cid;
+    if ($env{'user.adv'} && exists($env{'user.role.dc./'.
+                        $env{'course.'.$env{'request.course.id'}.
+                                 '.domain'}.'/'})) {
+        $dc_popup_cid = &dc_popup_js();
+    }
+
     my $start_page_annotate = 
         &Apache::loncommon::start_page('Annotator',undef,
 				       {'only_body' => 1,
@@ -1650,6 +1682,7 @@
     var currentSymb="$currentsymb";
 
 $nav_control
+$dc_popup_cid
 
 function go(url) {
    if (url!='' && url!= null) {
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.916 loncom/interface/loncommon.pm:1.917
--- loncom/interface/loncommon.pm:1.916	Wed Nov 18 20:47:59 2009
+++ loncom/interface/loncommon.pm	Fri Nov 20 04:12:43 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.916 2009/11/18 20:47:59 droeschl Exp $
+# $Id: loncommon.pm,v 1.917 2009/11/20 04:12:43 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4503,9 +4503,8 @@
                         $env{'course.'.$env{'request.course.id'}.
                                  '.domain'}.'/'})) {
         my $cid = $env{'request.course.id'};
-        $dc_info.= $cid.' '.$env{'course.'.$cid.'.internal.coursecode'};
+        $dc_info = $cid.' '.$env{'course.'.$cid.'.internal.coursecode'};
         $dc_info =~ s/\s+$//;
-        $dc_info = '('.$dc_info.')';
     }
 
     $role = '<span class="LC_nobreak">('.$role.')</span>' if $role;
@@ -4526,6 +4525,9 @@
 
 
         if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) {
+             if ($dc_info) {
+                 $dc_info = qq|<span class="LC_cusr_subheading">$dc_info</span>|;
+             }
              $bodytag .= qq|<div id="LC_nav_bar">$name $role<br />
                 <em>$realm</em> $dc_info</div>|;
             return $bodytag;
@@ -4538,7 +4540,10 @@
 
         $bodytag .= Apache::lonmenu::primary_menu();
 
-        $bodytag .= qq|<div id="LC_realm">$realm<br/>$dc_info</div>|;
+        if ($dc_info) {
+            $dc_info = &dc_courseid_toggle($dc_info);
+        }
+        $bodytag .= qq|<div id="LC_realm">$realm $dc_info</div>|;
 
         #don't show menus for public users
         if($env{'user.name'} ne 'public' && $env{'user.domain'} ne 'public'){
@@ -4571,11 +4576,15 @@
     # Explicit link to get inline menu
     my $menu= ($no_inline_link?''
 	       :'<a href="/adm/remote?action=collapse" target="_top">'.&mt('Switch to Inline Menu Mode').'</a>');
+
+    if ($dc_info) {
+        $dc_info = qq|<span class="LC_cusr_subheading">($dc_info)</span>|;
+    }
+
     $bodytag .= qq|<div id="LC_nav_bar">$name $role</div>
             <ol class="LC_primary_menu LC_right">
                 <li>$menu</li>
-            </ol><div id="LC_realm">$realm<br/>$dc_info</div>| unless $env{'form.inhibitmenu'};
-    #
+            </ol><div id="LC_realm"> $realm $dc_info</div>| unless $env{'form.inhibitmenu'};
     return(<<ENDBODY);
 $bodytag
 <table id="LC_title_bar" class="LC_with_remote">
@@ -4588,6 +4597,14 @@
 ENDBODY
 }
 
+sub dc_courseid_toggle {
+    my ($dc_info) = @_;
+    return ' <span id="dccidtext" class="LC_cusr_subheading">'.
+           '<a href="javascript:showCourseID();">'.
+           &mt('(More ...)').'</a></span>'.
+           '<div id="dccid" class="LC_dccid">'.$dc_info.'</div>';
+}
+
 sub make_attr_string {
     my ($register,$attr_ref) = @_;
 
@@ -5210,6 +5227,7 @@
 table.LC_calendar {
   border: 1px solid #000000;
   border-collapse: collapse;
+  width: 98%;
 }
 
 table.LC_calendar_pickdate {
@@ -5219,6 +5237,7 @@
 table.LC_calendar tr td {
   border: 1px solid #000000;
   vertical-align: top;
+  width: 14%;
 }
 
 table.LC_calendar tr td.LC_calendar_day_empty {
@@ -5916,6 +5935,13 @@
   margin: 10px 10px 10px 10px;
 }
 
+.LC_dccid {
+  margin: 0.2em 0 0 0;
+  padding: 0;
+  font-size: 90%;
+  display:none;
+}
+
 /* ---- Remove when done ----
 # The following styles is part of the redesign of LON-CAPA and are
 # subject to change during this project.