[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonhtmlcommon.pm lonparmset.pm
raeburn
raeburn at source.lon-capa.org
Wed Jul 10 18:07:38 EDT 2013
raeburn Wed Jul 10 22:07:38 2013 EDT
Modified files:
/loncom/interface loncommon.pm lonhtmlcommon.pm lonparmset.pm
Log:
- $env{'browser.mobile'} set to mobile device based on User Agent string.
- jquery.nicescroll used for scrolling in div scrollboxes on mobile devices
(iPad, Android etc.).
-------------- next part --------------
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1136 loncom/interface/loncommon.pm:1.1137
--- loncom/interface/loncommon.pm:1.1136 Tue Jul 9 00:17:22 2013
+++ loncom/interface/loncommon.pm Wed Jul 10 22:07:37 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1136 2013/07/09 00:17:22 raeburn Exp $
+# $Id: loncommon.pm,v 1.1137 2013/07/10 22:07:37 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2349,6 +2349,8 @@
=item * $clientos
+=item * $clientmobile
+
=back
=back
@@ -2367,6 +2369,7 @@
my $clientversion='0';
my $clientmathml='';
my $clientunicode='0';
+ my $clientmobile=0;
for (my $i=0;$i<=$#browsertype;$i++) {
my ($bname,$match,$notmatch,$vreg,$minv,$univ)=split(/\:/,$browsertype[$i]);
if (($httpbrowser=~/$match/i) && ($httpbrowser!~/$notmatch/i)) {
@@ -2389,8 +2392,11 @@
($httpbrowser=~/powerpc/i)) { $clientos='mac'; }
if ($httpbrowser=~/win/i) { $clientos='win'; }
if ($httpbrowser=~/embed/i) { $clientos='pda'; }
+ if ($httpbrowser=~/(Android|iPod|iPad|iPhone|webOS|Blackberry|Windows Phone|Opera m(?:ob|in)|Fennec)/i) {
+ $clientmobile=lc($1);
+ }
return ($httpbrowser,$clientbrowser,$clientversion,$clientmathml,
- $clientunicode,$clientos,);
+ $clientunicode,$clientos,$clientmobile);
}
###############################################################
@@ -7312,6 +7318,11 @@
.'<link rel="stylesheet" type="text/css" href="'.$url.'" />'
.$inhibitprint
.$head_extra;
+ if ($env{'browser.mobile'}) {
+ $result .= '
+<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
+<meta name="apple-mobile-web-app-capable" content="yes" />';
+ }
return $result.'</head>';
}
@@ -7697,7 +7708,7 @@
my $innerwidth=$width-20;
$content=&js_ready(
&start_page('Dialog',undef,{'only_body'=>1,'bgcolor'=>'#FFFFFF'}).
- &start_scrollbox($width.'px',$innerwidth.'px',$height.'px').
+ &start_scrollbox($width.'px',$innerwidth.'px',$height.'px','modal').
$content.
&end_scrollbox().
&end_page()
@@ -7924,13 +7935,32 @@
my ($table_id,$div_id,$tdcol);
if ($id ne '') {
$table_id = " id='table_$id'";
- $div_id = " id='div_$id'";
+ $div_id = ' id="div_'.$id.'"';
}
if ($bgcolor ne '') {
$tdcol = "background-color: $bgcolor;";
}
+ my $nicescroll_js;
+ if ($env{'browser.mobile'}) {
+ $nicescroll_js = '
+<script type="text/javascript">
+// <![CDATA[
+$(document).ready(
+ function() {
+ $("#div_'.$id.'").niceScroll({cursorcolor:"#00F"});
+ }
+);
+
+// ]]>
+</script>
+';
+ }
+
return <<"END";
-<table style="width: $outerwidth; border: 1px solid none;"$table_id><tr><td style="width: $width;$tdcol"><div style="overflow:auto; width:$width; height: $height;"$div_id>
+$nicescroll_js
+
+<table style="width: $outerwidth; border: 1px solid none;"$table_id><tr><td style="width: $width;$tdcol">
+<div style="overflow:auto; width:$width; height:$height;"$div_id>
END
}
@@ -8777,7 +8807,7 @@
space to be exceeded,
Same, if upload of a file directly to a course/community via Course Editor
-will cause quota for uploaded content for the course to be exceeded.
+will cause quota for uploaded content for the course to be exceeded.
Inputs: 6
1. username or coursenum
@@ -14179,7 +14209,7 @@
# ------------------------------------ Check browser type and MathML capability
my ($httpbrowser,$clientbrowser,$clientversion,$clientmathml,
- $clientunicode,$clientos) = &decode_user_agent($r);
+ $clientunicode,$clientos,$clientmobile) = &decode_user_agent($r);
# ------------------------------------------------------------- Get environment
@@ -14210,6 +14240,7 @@
"browser.mathml" => $clientmathml,
"browser.unicode" => $clientunicode,
"browser.os" => $clientos,
+ "browser.mobile" => $clientmobile,
"server.domain" => $Apache::lonnet::perlvar{'lonDefDomain'},
"request.course.fn" => '',
"request.course.uri" => '',
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.348 loncom/interface/lonhtmlcommon.pm:1.349
--- loncom/interface/lonhtmlcommon.pm:1.348 Tue Jul 2 19:04:37 2013
+++ loncom/interface/lonhtmlcommon.pm Wed Jul 10 22:07:37 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.348 2013/07/02 19:04:37 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.349 2013/07/10 22:07:37 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1226,6 +1226,7 @@
<script type="text/javascript" src="/adm/spellchecker/js/jquery.spellchecker.min.js"></script>
<link rel="stylesheet" type="text/css" href="/adm/spellchecker/css/spellchecker.css" />
+<script type="text/javascript" src="/adm/nicescroll/jquery.nicescroll.min.js"></script>
ENDJQUERY
return $s;
@@ -2941,7 +2942,10 @@
scroll => 'contentscroll',
boxh => 'contenteditor',
);
- $paddingwfrac = 0.09;
+ $paddingwfrac = 0;
+ unless ($env{'browser.mobile'}) {
+ $paddingwfrac = 0.09;
+ }
$offsetwfrac = 0.015;
$offsetv = 20;
$minw = 250;
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.535 loncom/interface/lonparmset.pm:1.536
--- loncom/interface/lonparmset.pm:1.535 Thu Jun 27 18:22:07 2013
+++ loncom/interface/lonparmset.pm Wed Jul 10 22:07:37 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.535 2013/06/27 18:22:07 raeburn Exp $
+# $Id: lonparmset.pm,v 1.536 2013/07/10 22:07:37 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1510,33 +1510,25 @@
&whatIsMyCategory($tempparameter, \%categoryList);
}
#part to print the parm-list
- $r->print('<div class="LC_columnSection">'."\n");
-
- #Print parameters
- for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) {
- if(@{$categoryList{$key}} == 0) {
- next;
- } else {
- $r->print('<div class="LC_Box LC_400Box">'
- .'<h4 class="LC_hcell">'
- .&mt($categories{$key})
- .'</h4>'."\n");
- foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) {
- $r->print('<span class="LC_nobreak">'
- .'<label><input type="checkbox" name="pscat" ');
- $r->print('value="'.$tempkey.'" ');
- if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
- $r->print(' checked="checked"');
- }
- $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}
- : $tempkey)
- .'</label></span><br />'."\n");
+ foreach my $key (sort { $category_order{$a} <=> $category_order{$b} } keys(%categoryList)) {
+ next if (@{$categoryList{$key}} == 0);
+ next if ($key eq '');
+ $r->print('<div class="LC_Box LC_400Box">'
+ .'<h4 class="LC_hcell">'.&mt($categories{$key}).'</h4>'."\n");
+ foreach my $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) {
+ $r->print('<span class="LC_nobreak">'
+ .'<label><input type="checkbox" name="pscat" '
+ .'value="'.$tempkey.'" ');
+ if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
+ $r->print( ' checked="checked"');
}
- $r->print("</div>\n");
+ $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}
+ : $tempkey)
+ .'</label></span><br />'."\n");
}
+ $r->print('</div>');
}
-
- $r->print("</div>\n");
+ $r->print("\n");
}
#
# This function offers some links on the parameter section to get with one click a group a parameters
@@ -1701,13 +1693,13 @@
# This function shows on table Mode the available Parameters for the selected Resources
#
sub displaymenu {
- my ($r,$allparms,$pscat,$psprt,$keyorder)=@_;
+ my ($r,$allparms,$pscat,$psprt,$keyorder,$divid)=@_;
$r->print(&Apache::lonhtmlcommon::start_pick_box());
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View')));
&parmmenu($r,$allparms,$pscat,$keyorder);
- $r->print(&Apache::loncommon::start_scrollbox());
+ $r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid));
&parmboxes($r,$allparms,$pscat,$keyorder);
$r->print(&Apache::loncommon::end_scrollbox());
@@ -1781,7 +1773,7 @@
.'</div>'
);
- $r->print(&Apache::loncommon::start_scrollbox(undef,undef,undef,'mapmenuscroll'));
+ $r->print(&Apache::loncommon::start_scrollbox('700px','680px','400px','mapmenuscroll'));
$r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner'));
# Display row: "All Maps or Folders"
@@ -2293,7 +2285,7 @@
# Step 2
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2'));
- &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder);
+ &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder,'parmmenuscroll');
# Step 3
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3'));
More information about the LON-CAPA-cvs
mailing list