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

raeburn raeburn at source.lon-capa.org
Sun Jun 22 15:46:48 EDT 2014


raeburn		Sun Jun 22 19:46:48 2014 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm lonmenu.pm 
  Log:
  - Bug 6714.
    - "Show Metadata" icon in inline menu launches display of metadata in 
    a regular window except for mobile devices which use a modal window.
    - div wrapped around metadata display in modal window and nicescroll 
      used so contents are scrollable in mobile Safari on iOS.
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.253 loncom/interface/lonmeta.pm:1.254
--- loncom/interface/lonmeta.pm:1.253	Thu Jun 12 12:08:02 2014
+++ loncom/interface/lonmeta.pm	Sun Jun 22 19:46:48 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.253 2014/06/12 12:08:02 kruse Exp $
+# $Id: lonmeta.pm,v 1.254 2014/06/22 19:46:48 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -763,7 +763,7 @@
 sub handler {
     my $r=shift;
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-         ['currentpath','changecourse']);
+         ['currentpath','changecourse','modal']);
     my $uri=$r->uri;
     #
     # Set document type
@@ -854,7 +854,21 @@
                 'only_body' => 1,})
            .'<h1>'.&mt('Metadata').'</h1>'
         );
+        if ($env{'form.modal'}) {
+            my $width = 500;
+            my $height = 400;
+            my $machine = &Apache::lonnet::absolute_url();
+            $r->print(&Apache::loncommon::nicescroll_javascript('metadatawrapper',
+                                                                {cursorcolor => '#00F',
+                                                                 railalign => 'right',
+                                                                 railoffset => '{top:5,left:40}'},
+                                                                 undef,1,$machine.$uri));
+            $r->print('<div id="metadatawrapper" style="height:'.$height.'px; width:'.$width.'px; overflow: auto;">');
+        }
         &present_uneditable_metadata($r,$uri);
+        if ($env{'form.modal'}) {
+            $r->print('</div>');
+        }
     }
     $r->print(&Apache::loncommon::end_page());
     return OK;
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.427 loncom/interface/lonmenu.pm:1.428
--- loncom/interface/lonmenu.pm:1.427	Sat Feb 22 18:12:09 2014
+++ loncom/interface/lonmenu.pm	Sun Jun 22 19:46:48 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.427 2014/02/22 18:12:09 raeburn Exp $
+# $Id: lonmenu.pm,v 1.428 2014/06/22 19:46:48 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -768,11 +768,15 @@
 }
 $menuitems.="&Notes&&annotate()&";
 $menuitems.="Make notes and annotations about this resource&&1\n";
+my $is_mobile;
+if ($env{'browser.mobile'}) {
+    $is_mobile = 1;
+}
 
             unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) {
 		if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/}) && ($env{'request.noversionuri'} !~ m{^/uploaded/$match_domain/$match_courseid/docs/})) {
 		    $menuitems.=(<<ENDREALRES);
-s&6&3&catalog.png&Info&info[_1]&catalog_info()&Show Metadata
+s&6&3&catalog.png&Info&info[_1]&catalog_info('$is_mobile')&Show Metadata
 ENDREALRES
                 }
                 unless (($env{'request.noversionuri'} =~ m{^/uploaded/$match_domain/$match_courseid/docs/}) ||
@@ -1583,8 +1587,12 @@
 
 
 
-function catalog_info() {
-   openMyModal(window.location.pathname+'.meta',500,400,'yes');
+function catalog_info(isMobile) {
+    if (isMobile == 1) {
+        openMyModal(window.location.pathname+'.meta?modal=1',500,400,'yes');
+    } else {
+        loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=500,width=400,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
+    }
 }
 
 function chat_win() {




More information about the LON-CAPA-cvs mailing list