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

raeburn raeburn at source.lon-capa.org
Wed May 4 01:14:49 EDT 2016


raeburn		Wed May  4 05:14:49 2016 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
    /loncom/auth	lonroles.pm 
  Log:
  - Improve display of roles page for mobile devices with small viewports.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1242 loncom/interface/loncommon.pm:1.1243
--- loncom/interface/loncommon.pm:1.1242	Tue May  3 22:33:52 2016
+++ loncom/interface/loncommon.pm	Wed May  4 05:14:45 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1242 2016/05/03 22:33:52 raeburn Exp $
+# $Id: loncommon.pm,v 1.1243 2016/05/04 05:14:45 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5897,6 +5897,12 @@
   height: auto;
 }
 
+.LC_textsize_mobile {
+  \@media only screen and (max-device-width: 480px) {
+      -webkit-text-size-adjust:100%; -moz-text-size-adjust:100%; -ms-text-size-adjust:100%;
+  }
+}
+
 .LC_icon {
   border: none;
   vertical-align: middle;
@@ -6024,6 +6030,10 @@
   vertical-align: middle;
 }
 
+.LC_breadcrumbs_hoverable {
+  background: $sidebg;
+}
+
 td.LC_table_cell_checkbox {
   text-align: center;
 }
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.313 loncom/auth/lonroles.pm:1.314
--- loncom/auth/lonroles.pm:1.313	Sat Apr  2 04:31:33 2016
+++ loncom/auth/lonroles.pm	Wed May  4 05:14:49 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.313 2016/04/02 04:31:33 raeburn Exp $
+# $Id: lonroles.pm,v 1.314 2016/05/04 05:14:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -782,8 +782,14 @@
         $start_page=&Apache::loncommon::start_page($pagetitle,undef,
                                                   {bread_crumbs=>$brcrum,crstype=>'Placement'});
     } else {
-        $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum}); 
         $funcs = &get_roles_functions($showcount,$cattype);
+        my $crumbsright;
+        if ($env{'browser.mobile'}) {
+            $crumbsright = $funcs;
+            undef($funcs);
+        }
+        $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum,
+                                                                     bread_crumbs_component=>$crumbsright});
     }
     &js_escape(\$standby);
     my $noscript='<br /><span class="LC_error">'.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.').'<br />'.&mt('As this is not the case, most functionality in the system will be unavailable.').'</span><br />';
@@ -1390,7 +1396,7 @@
     my $doheaders;
     if ((ref($sortrole) eq 'HASH') && (ref($roleclass) eq 'HASH')) {
         $r->print('<br />'
-                 .&Apache::loncommon::start_data_table()
+                 .&Apache::loncommon::start_data_table('LC_textsize_mobile')
                  .&Apache::loncommon::start_data_table_header_row()
         );
         if (!$nochoose) { $r->print('<th> </th>'); }
@@ -1917,7 +1923,7 @@
 sub adhoc_roles_row {
     my ($dcdom,$rowtype) = @_;
     my $output = &Apache::loncommon::continue_data_table_row()
-                 .' <td colspan="5">'
+                 .' <td colspan="5" class="LC_textsize_mobile">'
                  .&mt('[_1]Ad hoc[_2] roles in domain [_3] --'
                      ,'<span class="LC_cusr_emph">','</span>',$dcdom)
                  .' ';
@@ -2759,15 +2765,30 @@
     unless ($cattype eq 'none') {
         push(@links,['/adm/coursecatalog','ccat-22x22',&mt('Course catalog')]);
     }
-    my $funcs = &Apache::lonhtmlcommon::start_funclist();
-    foreach my $link (@links) {
-        $funcs .= &Apache::lonhtmlcommon::add_item_funclist(
-                      '<a href="'.$link->[0].'" class="LC_menubuttons_link">'.
-                      '<img src="/res/adm/pages/'.$link->[1].'.png" class="LC_icon" alt="'.$link->[2].'" />'.
-                      $link->[2].'</a>');
+    my $funcs;
+    if ($env{'browser.mobile'}) {
+        my @functions;
+        foreach my $link (@links) {
+            push(@functions,[$link->[0],$link->[2]]);
+        }
+        my $title = 'Display options';
+        if ($env{'user.adv'}) {
+            $title = 'Roles options';
+        }
+        $funcs = &Apache::lonmenu::create_submenu('','',$title,\@functions,1,'LC_breadcrumbs_hoverable');
+        $funcs = '<ol class="LC_primary_menu LC_floatright">'.$funcs.'</ol>';
+    } else {
+        $funcs = &Apache::lonhtmlcommon::start_funclist();
+        foreach my $link (@links) {
+            $funcs .= &Apache::lonhtmlcommon::add_item_funclist(
+                          '<a href="'.$link->[0].'" class="LC_menubuttons_link">'.
+                          '<img src="/res/adm/pages/'.$link->[1].'.png" class="LC_icon" alt="'.$link->[2].'" />'.
+                          $link->[2].'</a>');
+        }
+        $funcs .= &Apache::lonhtmlcommon::end_funclist();
+        $funcs = &Apache::loncommon::head_subbox($funcs);
     }
-    $funcs .= &Apache::lonhtmlcommon::end_funclist();
-    return &Apache::loncommon::head_subbox($funcs);
+    return $funcs;
 }
 
 sub get_queued {




More information about the LON-CAPA-cvs mailing list