MDL-27622 integrate mymobile thme into core RC2
@@ -0,0 +1,381 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Config file for mymobile theme
|
||||
*
|
||||
* @package theme
|
||||
* @subpackage mymobile
|
||||
* @copyright John Stabinger
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$THEME->name = 'mymobile';
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Name of the theme. Most likely the name of
|
||||
// the directory in which this file resides.
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
|
||||
$THEME->parents = array(
|
||||
'canvas',
|
||||
'base',
|
||||
);
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
// Which existing theme(s) in the /theme/ directory
|
||||
// do you want this theme to extend. A theme can
|
||||
// extend any number of themes. Rather than
|
||||
// creating an entirely new theme and copying all
|
||||
// of the CSS, you can simply create a new theme,
|
||||
// extend the theme you like and just add the
|
||||
// changes you want to your theme.
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
|
||||
$THEME->sheets = array(
|
||||
'jmobilerc2',
|
||||
'core',
|
||||
'media'
|
||||
);
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Name of the stylesheet(s) you've including in
|
||||
// this theme's /styles/ directory.
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
$THEME->parents_exclude_sheets = array(
|
||||
'base'=>array(
|
||||
'pagelayout',
|
||||
'dock',
|
||||
'editor',
|
||||
),
|
||||
'canvas'=>array(
|
||||
'pagelayout',
|
||||
'tabs',
|
||||
'editor',
|
||||
|
||||
),
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
$THEME->enable_dock = false;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Do you want to use the new navigation dock?
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//$THEME->editor_sheets = array('editor');
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// An array of stylesheets to include within the
|
||||
// body of the editor.
|
||||
////////////////////////////////////////////////////
|
||||
$toblock = optional_param('mymobile_blocks', false, PARAM_BOOL);
|
||||
$thisdevice = get_device_type();
|
||||
if ($thisdevice == "default" || $thisdevice == "tablet") {
|
||||
$gowide = "true";
|
||||
} else {
|
||||
$gowide = "false";
|
||||
}
|
||||
//get whether to show blocks and use appropriate pagelayout
|
||||
//this is necessary for block JS errors and other block problems
|
||||
if($toblock || $gowide == "true") {
|
||||
$THEME->layouts = array(
|
||||
'base' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
),
|
||||
'standard' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
),
|
||||
'course' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array('myblocks'),
|
||||
'defaultregion' => 'myblocks'
|
||||
),
|
||||
'coursecategory' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
),
|
||||
'incourse' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array('myblocks'),
|
||||
'defaultregion' => 'myblocks',
|
||||
),
|
||||
|
||||
'frontpage' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array('myblocks'),
|
||||
'defaultregion' => 'myblocks',
|
||||
|
||||
//'options' => array('nonavbar'=>true),
|
||||
),
|
||||
'admin' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
),
|
||||
'mydashboard' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array('myblocks'),
|
||||
'defaultregion' => 'myblocks',
|
||||
'options' => array('nonavbar'=>true),
|
||||
),
|
||||
'mypublic' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array('myblocks'),
|
||||
'defaultregion' => 'myblocks',
|
||||
),
|
||||
'login' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
'options' => array('langmenu'=>true, 'nonavbar'=>true),
|
||||
),
|
||||
'popup' => array(
|
||||
'file' => 'embedded.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true, 'noblocks'=>true, 'nonavbar'=>true),
|
||||
),
|
||||
'frametop' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true),
|
||||
),
|
||||
'maintenance' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true, 'nonavbar'=>true),
|
||||
),
|
||||
'embedded' => array(
|
||||
'file' => 'embedded.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true, 'nonavbar'=>true),
|
||||
),
|
||||
// Should display the content and basic headers only.
|
||||
'print' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true, 'nonavbar'=>false, 'noblocks'=>true),
|
||||
),
|
||||
// The pagelayout used when a redirection is occuring.
|
||||
'redirect' => array(
|
||||
'file' => 'embedded.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true, 'nonavbar'=>true, 'nocustommenu'=>true),
|
||||
),
|
||||
// The pagelayout used for reports
|
||||
'report' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true, 'nonavbar'=>false, 'noblocks'=>true),
|
||||
),
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
else {
|
||||
//get rid of block region
|
||||
$THEME->layouts = array(
|
||||
'base' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
),
|
||||
'standard' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
),
|
||||
'course' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
),
|
||||
'coursecategory' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
),
|
||||
'incourse' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
),
|
||||
|
||||
'frontpage' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
|
||||
//'options' => array('nonavbar'=>true),
|
||||
),
|
||||
'admin' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
),
|
||||
'mydashboard' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
|
||||
'options' => array('nonavbar'=>true),
|
||||
),
|
||||
'mypublic' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
),
|
||||
'login' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
'options' => array('langmenu'=>true, 'nonavbar'=>true),
|
||||
),
|
||||
'popup' => array(
|
||||
'file' => 'embedded.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true, 'noblocks'=>true, 'nonavbar'=>true),
|
||||
),
|
||||
'frametop' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true),
|
||||
),
|
||||
'maintenance' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true, 'nonavbar'=>true),
|
||||
),
|
||||
'embedded' => array(
|
||||
'file' => 'embedded.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true, 'nonavbar'=>true),
|
||||
),
|
||||
// Should display the content and basic headers only.
|
||||
'print' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true, 'nonavbar'=>false, 'noblocks'=>true),
|
||||
),
|
||||
// The pagelayout used when a redirection is occuring.
|
||||
'redirect' => array(
|
||||
'file' => 'embedded.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true, 'nonavbar'=>true, 'nocustommenu'=>true),
|
||||
),
|
||||
// The pagelayout used for reports
|
||||
'report' => array(
|
||||
'file' => 'general.php',
|
||||
'regions' => array(),
|
||||
'options' => array('nofooter'=>true, 'nonavbar'=>false, 'noblocks'=>true),
|
||||
),
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// These are all of the possible layouts in Moodle. The
|
||||
// simplest way to do this is to keep the theme and file
|
||||
// variables the same for every layout. Including them
|
||||
// all in this way allows some flexibility down the road
|
||||
// if you want to add a different layout template to a
|
||||
// specific page.
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Allows the user to provide the name of a function
|
||||
// that all CSS should be passed to before being
|
||||
// delivered.
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// $THEME->filter_mediaplugin_colors
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Used to control the colours used in the small
|
||||
// media player for the filters
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
//$THEME->javascripts = 'jquery.mobile-1.0a1.min';
|
||||
//$THEME->javascripts = array('jquery.mobile-1.0a1.min');
|
||||
$THEME->javascripts = array('jquery-1.6.4.min', 'custom', 'jquery.mobile-1.0rc2','scrollview','easing');
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// An array containing the names of JavaScript files
|
||||
// located in /javascript/ to include in the theme.
|
||||
// (gets included in the head)
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// $THEME->javascripts_footer
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// As above but will be included in the page footer.
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// $THEME->larrow
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Overrides the left arrow image used throughout
|
||||
// Moodle
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// $THEME->rarrow
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Overrides the right arrow image used throughout Moodle
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// $THEME->layouts
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// An array setting the layouts for the theme
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// $THEME->parents_exclude_javascripts
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// An array of JavaScript files NOT to inherit from
|
||||
// the themes parents
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// $THEME->parents_exclude_sheets
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// An array of stylesheets not to inherit from the
|
||||
// themes parents
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// $THEME->plugins_exclude_sheets
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// An array of plugin sheets to ignore and not
|
||||
// include.
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// $THEME->renderfactory
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Sets a custom render factory to use with the
|
||||
// theme, used when working with custom renderers.
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// $THEME->resource_mp3player_colors
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Controls the colours for the MP3 player
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
|
||||
//$THEME->csspostprocess = 'mymobile_process_css';
|
||||
@@ -0,0 +1,305 @@
|
||||
$(document).bind("mobileinit", function(){
|
||||
//mobile init stuff 11/12/10
|
||||
//turn off ajax forms...
|
||||
//$.mobile.defaultPageTransition = "fade";
|
||||
//$.mobile.touchOverflowEnabled = true;
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
//get some vars to start
|
||||
var siteurl = $('.mobilesiteurl').attr("id");
|
||||
var mytheme = $(".datatheme").attr("id");
|
||||
var mythemeb = $(".datathemeb").attr("id");
|
||||
|
||||
|
||||
//function below does generic stuff before creating all pages...
|
||||
$('div').live('pagebeforecreate',function(event, ui){
|
||||
//turn off ajax on all forms for now as of beta1
|
||||
$('form').attr("data-ajax", "false");
|
||||
//lesson
|
||||
$('.lessonbutton.standardbutton a').attr("data-role", "button");
|
||||
$('#page-mod-lesson-viewPAGE div.fitemtitle label').addClass("afirst");
|
||||
|
||||
//tablet column removal switch
|
||||
$('.slider').live("change",function() {
|
||||
var slids = $(this).val()
|
||||
M.util.set_user_preference('theme_mymobile_chosen_colpos', slids);
|
||||
if (slids == "off") {
|
||||
$('.ui-page-active').removeClass("has-myblocks");
|
||||
} else {
|
||||
$('.ui-page-active').addClass("has-myblocks");
|
||||
}
|
||||
});
|
||||
|
||||
//tabs- links set to external to fix forms
|
||||
$('div.tabtree ul.tabrow0').attr("data-role", "controlgroup");
|
||||
$('div.tabtree ul.tabrow12').attr("data-role", "controlgroup");
|
||||
$('div.tabtree li a').attr("data-role", "button").attr("data-ajax", "false");
|
||||
|
||||
//jump to current or bottom
|
||||
$('a.jumptocurrent').live('tap', function() {
|
||||
var position = $(".ui-page-active .section.current").position();
|
||||
if (!position) {
|
||||
var position = $(".ui-page-active .mobilefooter").position();
|
||||
}
|
||||
$.mobile.silentScroll(position.top);
|
||||
$(this).removeClass("ui-btn-active");
|
||||
return false;
|
||||
});
|
||||
//scroll to top
|
||||
$('a#uptotop').live('tap', function() {
|
||||
var position = $(".ui-page-active .ui-header").position();
|
||||
$.mobile.silentScroll(position.top);
|
||||
$(this).removeClass("ui-btn-active");
|
||||
return false;
|
||||
});
|
||||
//remove message notifcation overlay on tap 6/21/11
|
||||
$('a#notificationno').live('tap', function() {
|
||||
$('#newmessageoverlay').remove();
|
||||
return false;
|
||||
});
|
||||
|
||||
//calendar and other links that need to be external
|
||||
$('.maincalendar .filters a, li.activity.scorm a, div.files a, #page-user-filesPAGE li div a, .maincalendar .bottom a, .section li.url.modtype_url a, .resourcecontent .resourcemediaplugin a, #underfooter .noajax a, .block_mnet_hosts .content a, .block_private_files .content a, a.portfolio-add-link').attr("data-ajax", "false");
|
||||
|
||||
//add blank to open in window for some
|
||||
$('#page-mod-url-viewPAGE div.urlworkaround a, #page-mod-resource-viewPAGE div.resourceworkaround a, .mediaplugin a.mediafallbacklink, #page-mod-resource-viewPAGE .resourcemp3 a, .foldertree li a').attr("target", "_blank").attr("data-role", "button").attr("data-icon", "plus");
|
||||
|
||||
//// **** general stuff *** ////
|
||||
$('form fieldset').attr("data-role", "fieldcontain");
|
||||
$('form .fitem').attr("data-role", "fieldcontain");
|
||||
|
||||
//submit button for forum
|
||||
$('#page-mod-url-viewPAGE div.urlworkaround a').attr("data-role", "button");
|
||||
|
||||
//survey form fix
|
||||
$('#surveyform').attr("action", siteurl + '/mod/survey/save.php');
|
||||
|
||||
//nav select navigtation NEW
|
||||
$("#navselect").live("change",function() {
|
||||
var meb = encodeURI($(this).val());
|
||||
$(this).val("-1");
|
||||
if (meb != "" && meb != "-1") {
|
||||
$.mobile.changePage(meb);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
//course page only js
|
||||
$('div.path-course-view, .path-course-view div.generalpage').live('pagebeforecreate',function(event, ui){
|
||||
//course listing
|
||||
$('.section li img').addClass("ui-li-icon");
|
||||
$('.course-content ul.section').attr("data-role", "listview").attr("data-inset", "true").attr("data-theme", mythemeb);
|
||||
$('.sitetopic ul.section').attr("data-role", "listview").attr("data-inset", "true").attr("data-theme", mythemeb);
|
||||
|
||||
$('.topics div.left.side').addClass("ui-bar-" + mytheme);
|
||||
$('.section.hidden div.headingwrap').attr("data-theme", mythemeb);
|
||||
//$('.topics #section-0 div.left.side').removeClass("ui-li ui-li-divider ui-btn ui-bar-a");
|
||||
$('.section .resource.modtype_resource a, .section .modtype_survey a').attr("data-ajax", "false");
|
||||
|
||||
|
||||
|
||||
//toggle completion checkmarks and form fixes
|
||||
$('.togglecompletion input[type="image"]').attr("data-role", "none");
|
||||
$('.togglecompletion input[type="image"]').click(function(){
|
||||
$(".section .togglecompletion").attr("action", '');
|
||||
var mylocc = siteurl + "/course/togglecompletion.php";
|
||||
$(".section .togglecompletion").attr("action", mylocc);
|
||||
this.form.submit();
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//forum listing only stuff
|
||||
$('div#page-mod-forum-viewPAGE, #page-mod-forum-view div.generalpage').live('pagebeforecreate',function(event, ui){
|
||||
//forums listing change theme for other theme
|
||||
$('table.forumheaderlist').attr("data-role", "controlgroup");
|
||||
$('table.forumheaderlist thead tr').attr("data-role", "button").attr("data-theme", mythemeb);
|
||||
$('table.forumheaderlist td.topic a').attr("data-role", "button").attr("data-icon", "arrow-r").attr("data-iconpos", "right").attr("data-theme", mythemeb);
|
||||
});
|
||||
|
||||
$('div#page-mod-forum-viewPAGE').live('pageinit',function(event, ui){
|
||||
$('.forumheaderlist td.topic').each(function(index) {
|
||||
var ggg = $(this).nextAll("td.replies").text();
|
||||
$(this).find('a').append('<span class="ui-li-count ui-btn-up-a ui-btn-corner-all"> ' + ggg + '</span>');
|
||||
});
|
||||
});
|
||||
|
||||
//forum discussion page only stuff
|
||||
$('div#page-mod-forum-discussPAGE, #page-mod-forum-discuss div.generalpage, div.forumtype-single, .forumtype-single div.generalpage, div#page-mod-forum-postPAGE').live('pagebeforecreate',function(event, ui){
|
||||
//remove parent post because of hash remove this if has listening is fixed
|
||||
$('.options div.commands a').each(function(index) {
|
||||
var url = $(this).attr("href");
|
||||
if (url.indexOf("#") != -1)
|
||||
{
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
|
||||
//actual forum posting
|
||||
$('.forumpost div.row.header').addClass("ui-li ui-li-divider ui-btn ui-bar-" + mytheme);
|
||||
$('.options div.commands').attr("data-role", "controlgroup").attr("data-type", "horizontal");
|
||||
$('.options div.commands a').attr("data-role", "button").attr("data-ajax", "false").attr("data-inline", "true");
|
||||
$('.forumpost div.author a').attr("data-inline", "true");
|
||||
$('.options div.commands')
|
||||
.contents()
|
||||
.filter(function() {
|
||||
return this.nodeType == 3; //Node.TEXT_NODE
|
||||
}).remove();
|
||||
//function above removes | in div.commands
|
||||
});
|
||||
|
||||
//frontpage only stuff
|
||||
$('div#page-site-indexPAGE, div.pagelayout-coursecategory').live('pagebeforecreate',function(event, ui){
|
||||
//course boxes on category pages and front page stuff
|
||||
//forum posts on front page only
|
||||
$('.forumpost div.row.header').addClass("ui-li ui-li-divider ui-btn ui-bar-" + mytheme);
|
||||
$('div.subscribelink a').attr("data-role", "button").attr("data-inline", "true");
|
||||
$('.unlist').attr("data-role", "controlgroup");
|
||||
$('div.coursebox a').attr("data-role", "button").attr("data-icon", "arrow-r").attr("data-iconpos", "right").attr("data-theme", mythemeb);
|
||||
$('.box.categorybox').attr("data-role", "controlgroup");
|
||||
$('div.categorylist div.category a').attr("data-role", "button").attr("data-theme", mythemeb);
|
||||
$('#shortsearchbox, #coursesearch2 #shortsearchbox').attr("data-type", "search");
|
||||
});
|
||||
|
||||
$('div#page-site-indexPAGE').live('pageinit',function(event, ui){
|
||||
$('div.categorylist div.category').each(function(index) {
|
||||
var ggb = $(this).find("span.numberofcourse").text().replace('(','').replace(')','');
|
||||
if (ggb != "") {
|
||||
$(this).find('a').append('<span class="ui-li-count ui-btn-up-a ui-btn-corner-all">' + ggb + '</span>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//chat only stuff
|
||||
$('div#chatpage, div.path-mod-chat').live('pagebeforecreate',function(event, ui){
|
||||
$('#input-message, #button-send').attr("data-role", "none");
|
||||
$('#enterlink a').attr("data-role", "button").attr("data-ajax", "false").attr("data-icon", "plus");
|
||||
$('form, input, button').attr("data-ajax", "false");
|
||||
});
|
||||
|
||||
//login page only stuff
|
||||
$('div#page-login-indexPAGE').live('pagebeforecreate',function(event, ui){
|
||||
//signup form fix
|
||||
$('.path-login .signupform #signup').attr("action", siteurl + '/login/signup.php');
|
||||
$('.path-login #guestlogin').attr("action", siteurl + '/login/index.php');
|
||||
});
|
||||
|
||||
//messaging only stuff
|
||||
$('div#page-message-indexPAGE').live('pagebeforecreate',function(event, ui){
|
||||
//below to fix form actions here and there
|
||||
$("#usergroupform").attr("action", '');
|
||||
//if (userform == "") {
|
||||
var myloc = siteurl + "/message/index.php";
|
||||
$("#usergroupform").attr("action", myloc);
|
||||
|
||||
//messaging links
|
||||
$('.path-message td.link').attr("data-role", "controlgroup").attr("data-type", "horizontal");
|
||||
$('.path-message td.link a').attr("data-role", "button").attr("data-inline", "true");
|
||||
});
|
||||
|
||||
//database and glossary only stuff
|
||||
$('div#page-mod-data-viewPAGE, div#page-mod-glossary-viewPAGE').live('pagebeforecreate',function(event, ui){
|
||||
$('.defaulttemplate td a').attr("data-role", "button").attr("data-ajax", "false").attr("data-inline", "true");
|
||||
$('#options select, .aliases select').attr("data-native-menu", "true");
|
||||
$('#pref_search, .glossarysearchbox input[type="text"]').attr("data-type", "search");
|
||||
$('#options').attr("action", siteurl + '/mod/data/view.php');
|
||||
$('#page-mod-glossary-viewPAGE form').each(function(index) {
|
||||
var glossform = $(this).attr("action");
|
||||
if (glossform == "view.php") {
|
||||
$(this).attr("action", siteurl + '/mod/glossary/view.php');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//mymoodle only stuff
|
||||
$('div#page-my-indexPAGE').live('pagebeforecreate',function(event, ui){
|
||||
//my moodle page fixes
|
||||
//block_course_overview
|
||||
$('.block_course_overview div.headingwrap').attr("data-role", "none");
|
||||
$('.block_course_overview h3.main a').attr("data-theme", mytheme);
|
||||
|
||||
|
||||
});
|
||||
|
||||
//resource only stuff to help embedded PDFs, provides link to open in new window
|
||||
$('div#page-mod-resource-viewPAGE').live('pagebeforecreate',function(event, ui){
|
||||
$('div.resourcepdf').each(function(index) {
|
||||
var thisopen = $(this).find('#resourceobject').attr("data");
|
||||
$(this).append('<a class="mobileresource" href="' +thisopen+ '" target="_blank"></a>');
|
||||
});
|
||||
});
|
||||
|
||||
//quiz page only js
|
||||
$('div#page-mod-quiz-viewPAGE, div#page-mod-quiz-attemptPAGE, div#page-mod-quiz-summaryPAGE, div#page-mod-quiz-reviewPAGE').live('pagebeforecreate',function(event, ui){
|
||||
//add quiz timer into quiz page
|
||||
$('#quiz-timer').remove();
|
||||
$('.mymobilecontent').prepend('<div id="quiz-timer" > <span id="quiz-time-left"></span></div>');
|
||||
$('.que .info').addClass("ui-bar-" + mytheme);
|
||||
$('.que input.submit').attr("data-role", "none");
|
||||
$('div.submitbtns a, div.quizattemptcounts a').attr("data-role", "button").attr("data-ajax", "false");
|
||||
$('#page-mod-quiz-attemptPAGE .questionflag input, .path-mod-quiz .questionflag input').attr("data-role", "none");
|
||||
});
|
||||
|
||||
//assignment page only stuff
|
||||
$('#page-mod-assignment-viewPAGE').live('pagebeforecreate',function(event, ui){
|
||||
//below fixes the advanced upload edit notes button
|
||||
$('#page-mod-assignment-viewPAGE div[rel="upload.php"]').parent().attr("action", siteurl + '/mod/assignment/upload.php');
|
||||
});
|
||||
|
||||
//hotpot page only stuff
|
||||
$('div.path-mod-hotpot').live('pagebeforecreate',function(event, ui){
|
||||
$('.path-mod-hotpot button').attr("data-role", "none");
|
||||
});
|
||||
|
||||
//collapsed topic only stuff
|
||||
$('div#page-course-view-topcollPAGE').live('pagebeforecreate',function(event, ui){
|
||||
$('#page-course-view-topcollPAGE ul.section').attr("data-role", "none");
|
||||
$('.section li img').removeClass("ui-li-icon");
|
||||
$.getScript('../course/format/topcoll/lib.js');
|
||||
|
||||
$('#page-course-view-topcollPAGE tr.cps a').attr("data-role", "button").attr("data-icon", "arrow-r");
|
||||
$('#page-course-view-topcollPAGE #thetopics').attr("data-role", "controlgroup");
|
||||
$('#page-course-view-topcollPAGE td.cps_centre').each(function(index) {
|
||||
var cpsc = $(this).text().replace('<br>','').replace(')','');
|
||||
$(this).prev('td').find('a').append('<span class="ui-li-count ui-btn-up-a ui-btn-corner-all">' + cpsc + '</span>');
|
||||
});
|
||||
$('tr.cps').click(function() {
|
||||
if ($(this).hasClass('opencps')) {
|
||||
$(this).removeClass("opencps");
|
||||
}
|
||||
else {
|
||||
$(this).addClass("opencps");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//////functions below does stuff after creating page for some cleaning...
|
||||
$('div').live('pageinit',function(event, ui){
|
||||
|
||||
$('.path-calendar div.ui-radio label:first-child, .path-mod-lesson div.ui-radio label:first-child, #page-mod-wiki-createPAGE div.ui-radio label:first-child').addClass("afirst");
|
||||
$('.forumpost div.author a').removeAttr('data-role');
|
||||
//$('.questionflagimage2').removeClass("ui-btn-hidden");a#notificationyes
|
||||
|
||||
//scrollview 2/7/11 testing remove if remove scrollview
|
||||
$('.gradeparent, .pagelayout-report .no-overflow, .path-mod-choice .response, .resourcecontent.resourceimg, .usersubmissions .no-overflow, .path-course-report-log .generaltable, table.results.anonymous, table.surveytable, div.resultgraph, div.reportsummary a, #completion-progress').scrollview();
|
||||
|
||||
//image replacement
|
||||
$(this).find(".ithumb .course-content .summary img, .ithumb .course-content .activity.label img, .ithumb .sitetopic .no-overflow img").click(function() {
|
||||
var turl = $(this).attr("src");
|
||||
window.open(turl);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
||||
*
|
||||
* Uses the built in easing capabilities added In jQuery 1.1
|
||||
* to offer multiple easing options
|
||||
*
|
||||
* TERMS OF USE - jQuery Easing
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2008 George McGinley Smith
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
// t: current time, b: begInnIng value, c: change In value, d: duration
|
||||
jQuery.easing['jswing'] = jQuery.easing['swing'];
|
||||
|
||||
jQuery.extend( jQuery.easing,
|
||||
{
|
||||
def: 'easeOutQuad',
|
||||
swing: function (x, t, b, c, d) {
|
||||
//alert(jQuery.easing.default);
|
||||
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
|
||||
},
|
||||
easeInQuad: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t + b;
|
||||
},
|
||||
easeOutQuad: function (x, t, b, c, d) {
|
||||
return -c *(t/=d)*(t-2) + b;
|
||||
},
|
||||
easeInOutQuad: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t + b;
|
||||
return -c/2 * ((--t)*(t-2) - 1) + b;
|
||||
},
|
||||
easeInCubic: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t + b;
|
||||
},
|
||||
easeOutCubic: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t + 1) + b;
|
||||
},
|
||||
easeInOutCubic: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t + 2) + b;
|
||||
},
|
||||
easeInQuart: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t + b;
|
||||
},
|
||||
easeOutQuart: function (x, t, b, c, d) {
|
||||
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
||||
},
|
||||
easeInOutQuart: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
||||
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
||||
},
|
||||
easeInQuint: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t*t + b;
|
||||
},
|
||||
easeOutQuint: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
||||
},
|
||||
easeInOutQuint: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
||||
},
|
||||
easeInSine: function (x, t, b, c, d) {
|
||||
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
||||
},
|
||||
easeOutSine: function (x, t, b, c, d) {
|
||||
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
||||
},
|
||||
easeInOutSine: function (x, t, b, c, d) {
|
||||
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
||||
},
|
||||
easeInExpo: function (x, t, b, c, d) {
|
||||
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
||||
},
|
||||
easeOutExpo: function (x, t, b, c, d) {
|
||||
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
||||
},
|
||||
easeInOutExpo: function (x, t, b, c, d) {
|
||||
if (t==0) return b;
|
||||
if (t==d) return b+c;
|
||||
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
||||
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
||||
},
|
||||
easeInCirc: function (x, t, b, c, d) {
|
||||
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
||||
},
|
||||
easeOutCirc: function (x, t, b, c, d) {
|
||||
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
||||
},
|
||||
easeInOutCirc: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
||||
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
||||
},
|
||||
easeInElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
},
|
||||
easeOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
||||
},
|
||||
easeInOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
||||
},
|
||||
easeInBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*(t/=d)*t*((s+1)*t - s) + b;
|
||||
},
|
||||
easeOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
||||
},
|
||||
easeInOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
||||
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
||||
},
|
||||
easeInBounce: function (x, t, b, c, d) {
|
||||
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
||||
},
|
||||
easeOutBounce: function (x, t, b, c, d) {
|
||||
if ((t/=d) < (1/2.75)) {
|
||||
return c*(7.5625*t*t) + b;
|
||||
} else if (t < (2/2.75)) {
|
||||
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
||||
} else if (t < (2.5/2.75)) {
|
||||
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
||||
} else {
|
||||
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
||||
}
|
||||
},
|
||||
easeInOutBounce: function (x, t, b, c, d) {
|
||||
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
||||
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
*
|
||||
* TERMS OF USE - EASING EQUATIONS
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2001 Robert Penner
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
@@ -0,0 +1,802 @@
|
||||
/*
|
||||
* jQuery Mobile Framework : scrollview plugin
|
||||
* Copyright (c) 2010 Adobe Systems Incorporated - Kin Blas ([email protected])
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
||||
* Note: Code is in draft form and is subject to change
|
||||
*/
|
||||
(function($,window,document,undefined){
|
||||
|
||||
jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
|
||||
options: {
|
||||
fps: 60, // Frames per second in msecs.
|
||||
direction: null, // "x", "y", or null for both.
|
||||
|
||||
scrollDuration: 2000, // Duration of the scrolling animation in msecs.
|
||||
overshootDuration: 250, // Duration of the overshoot animation in msecs.
|
||||
snapbackDuration: 500, // Duration of the snapback animation in msecs.
|
||||
|
||||
moveThreshold: 10, // User must move this many pixels in any direction to trigger a scroll.
|
||||
moveIntervalThreshold: 150, // Time between mousemoves must not exceed this threshold.
|
||||
|
||||
scrollMethod: "translate", // "translate", "position", "scroll"
|
||||
|
||||
startEventName: "scrollstart",
|
||||
updateEventName: "scrollupdate",
|
||||
stopEventName: "scrollstop",
|
||||
|
||||
eventType: $.support.touch ? "touch" : "mouse",
|
||||
|
||||
showScrollBars: true,
|
||||
|
||||
pagingEnabled: false,
|
||||
delayedClickSelector: "a,input,textarea,select,button,.ui-btn",
|
||||
delayedClickEnabled: true
|
||||
},
|
||||
|
||||
_makePositioned: function($ele)
|
||||
{
|
||||
if ($ele.css("position") == "static")
|
||||
$ele.css("position", "relative");
|
||||
},
|
||||
|
||||
_create: function()
|
||||
{
|
||||
this._$clip = $(this.element).addClass("ui-scrollview-clip");
|
||||
var $child = this._$clip.children();
|
||||
if ($child.length > 1) {
|
||||
$child = this._$clip.wrapInner("<div></div>").children();
|
||||
}
|
||||
this._$view = $child.addClass("ui-scrollview-view");
|
||||
|
||||
this._$clip.css("overflow", this.options.scrollMethod === "scroll" ? "scroll" : "hidden");
|
||||
this._makePositioned(this._$clip);
|
||||
|
||||
this._$view.css("overflow", "hidden");
|
||||
|
||||
// Turn off our faux scrollbars if we are using native scrolling
|
||||
// to position the view.
|
||||
|
||||
this.options.showScrollBars = this.options.scrollMethod === "scroll" ? false : this.options.showScrollBars;
|
||||
|
||||
// We really don't need this if we are using a translate transformation
|
||||
// for scrolling. We set it just in case the user wants to switch methods
|
||||
// on the fly.
|
||||
|
||||
this._makePositioned(this._$view);
|
||||
this._$view.css({ left: 0, top: 0 });
|
||||
|
||||
this._sx = 0;
|
||||
this._sy = 0;
|
||||
|
||||
var direction = this.options.direction;
|
||||
this._hTracker = (direction !== "y") ? new MomentumTracker(this.options) : null;
|
||||
this._vTracker = (direction !== "x") ? new MomentumTracker(this.options) : null;
|
||||
|
||||
this._timerInterval = 1000/this.options.fps;
|
||||
this._timerID = 0;
|
||||
|
||||
var self = this;
|
||||
this._timerCB = function(){ self._handleMomentumScroll(); };
|
||||
|
||||
this._addBehaviors();
|
||||
},
|
||||
|
||||
_startMScroll: function(speedX, speedY)
|
||||
{
|
||||
this._stopMScroll();
|
||||
this._showScrollBars();
|
||||
|
||||
var keepGoing = false;
|
||||
var duration = this.options.scrollDuration;
|
||||
|
||||
this._$clip.trigger(this.options.startEventName);
|
||||
|
||||
var ht = this._hTracker;
|
||||
if (ht)
|
||||
{
|
||||
var c = this._$clip.width();
|
||||
var v = this._$view.width();
|
||||
ht.start(this._sx, speedX, duration, (v > c) ? -(v - c) : 0, 0);
|
||||
keepGoing = !ht.done();
|
||||
}
|
||||
|
||||
var vt = this._vTracker;
|
||||
if (vt)
|
||||
{
|
||||
var c = this._$clip.height();
|
||||
var v = this._$view.height();
|
||||
vt.start(this._sy, speedY, duration, (v > c) ? -(v - c) : 0, 0);
|
||||
keepGoing = keepGoing || !vt.done();
|
||||
}
|
||||
|
||||
if (keepGoing)
|
||||
this._timerID = setTimeout(this._timerCB, this._timerInterval);
|
||||
else
|
||||
this._stopMScroll();
|
||||
},
|
||||
|
||||
_stopMScroll: function()
|
||||
{
|
||||
if (this._timerID)
|
||||
{
|
||||
this._$clip.trigger(this.options.stopEventName);
|
||||
clearTimeout(this._timerID);
|
||||
}
|
||||
this._timerID = 0;
|
||||
|
||||
if (this._vTracker)
|
||||
this._vTracker.reset();
|
||||
|
||||
if (this._hTracker)
|
||||
this._hTracker.reset();
|
||||
|
||||
this._hideScrollBars();
|
||||
},
|
||||
|
||||
_handleMomentumScroll: function()
|
||||
{
|
||||
var keepGoing = false;
|
||||
var v = this._$view;
|
||||
|
||||
var x = 0, y = 0;
|
||||
|
||||
var vt = this._vTracker;
|
||||
if (vt)
|
||||
{
|
||||
vt.update();
|
||||
y = vt.getPosition();
|
||||
keepGoing = !vt.done();
|
||||
}
|
||||
|
||||
var ht = this._hTracker;
|
||||
if (ht)
|
||||
{
|
||||
ht.update();
|
||||
x = ht.getPosition();
|
||||
keepGoing = keepGoing || !ht.done();
|
||||
}
|
||||
|
||||
this._setScrollPosition(x, y);
|
||||
this._$clip.trigger(this.options.updateEventName, { x: x, y: y });
|
||||
|
||||
if (keepGoing)
|
||||
this._timerID = setTimeout(this._timerCB, this._timerInterval);
|
||||
else
|
||||
this._stopMScroll();
|
||||
},
|
||||
|
||||
_setScrollPosition: function(x, y)
|
||||
{
|
||||
this._sx = x;
|
||||
this._sy = y;
|
||||
|
||||
var $v = this._$view;
|
||||
|
||||
var sm = this.options.scrollMethod;
|
||||
|
||||
switch (sm)
|
||||
{
|
||||
case "translate":
|
||||
setElementTransform($v, x + "px", y + "px");
|
||||
break;
|
||||
case "position":
|
||||
$v.css({left: x + "px", top: y + "px"});
|
||||
break;
|
||||
case "scroll":
|
||||
var c = this._$clip[0];
|
||||
c.scrollLeft = -x;
|
||||
c.scrollTop = -y;
|
||||
break;
|
||||
}
|
||||
|
||||
var $vsb = this._$vScrollBar;
|
||||
var $hsb = this._$hScrollBar;
|
||||
|
||||
if ($vsb)
|
||||
{
|
||||
var $sbt = $vsb.find(".ui-scrollbar-thumb");
|
||||
if (sm === "translate")
|
||||
setElementTransform($sbt, "0px", -y/$v.height() * $sbt.parent().height() + "px");
|
||||
else
|
||||
$sbt.css("top", -y/$v.height()*100 + "%");
|
||||
}
|
||||
|
||||
if ($hsb)
|
||||
{
|
||||
var $sbt = $hsb.find(".ui-scrollbar-thumb");
|
||||
if (sm === "translate")
|
||||
setElementTransform($sbt, -x/$v.width() * $sbt.parent().width() + "px", "0px");
|
||||
else
|
||||
$sbt.css("left", -x/$v.width()*100 + "%");
|
||||
}
|
||||
},
|
||||
|
||||
scrollTo: function(x, y, duration)
|
||||
{
|
||||
this._stopMScroll();
|
||||
if (!duration)
|
||||
return this._setScrollPosition(x, y);
|
||||
|
||||
x = -x;
|
||||
y = -y;
|
||||
|
||||
var self = this;
|
||||
var start = getCurrentTime();
|
||||
var efunc = $.easing["easeOutQuad"];
|
||||
var sx = this._sx;
|
||||
var sy = this._sy;
|
||||
var dx = x - sx;
|
||||
var dy = y - sy;
|
||||
var tfunc = function(){
|
||||
var elapsed = getCurrentTime() - start;
|
||||
if (elapsed >= duration)
|
||||
{
|
||||
self._timerID = 0;
|
||||
self._setScrollPosition(x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
var ec = efunc(elapsed/duration, elapsed, 0, 1, duration);
|
||||
self._setScrollPosition(sx + (dx * ec), sy + (dy * ec));
|
||||
self._timerID = setTimeout(tfunc, self._timerInterval);
|
||||
}
|
||||
};
|
||||
|
||||
this._timerID = setTimeout(tfunc, this._timerInterval);
|
||||
},
|
||||
|
||||
getScrollPosition: function()
|
||||
{
|
||||
return { x: -this._sx, y: -this._sy };
|
||||
},
|
||||
|
||||
_getScrollHierarchy: function()
|
||||
{
|
||||
var svh = [];
|
||||
this._$clip.parents(".ui-scrollview-clip").each(function(){
|
||||
var d = $(this).data("scrollview");
|
||||
if (d) svh.unshift(d);
|
||||
});
|
||||
return svh;
|
||||
},
|
||||
|
||||
_getAncestorByDirection: function(dir)
|
||||
{
|
||||
var svh = this._getScrollHierarchy();
|
||||
var n = svh.length;
|
||||
while (0 < n--)
|
||||
{
|
||||
var sv = svh[n];
|
||||
var svdir = sv.options.direction;
|
||||
|
||||
if (!svdir || svdir == dir)
|
||||
return sv;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
_handleDragStart: function(e, ex, ey)
|
||||
{
|
||||
// Stop any scrolling of elements in our parent hierarcy.
|
||||
$.each(this._getScrollHierarchy(),function(i,sv){ sv._stopMScroll(); });
|
||||
this._stopMScroll();
|
||||
|
||||
var c = this._$clip;
|
||||
var v = this._$view;
|
||||
|
||||
if (this.options.delayedClickEnabled) {
|
||||
this._$clickEle = $(e.target).closest(this.options.delayedClickSelector);
|
||||
}
|
||||
this._lastX = ex;
|
||||
this._lastY = ey;
|
||||
this._doSnapBackX = false;
|
||||
this._doSnapBackY = false;
|
||||
this._speedX = 0;
|
||||
this._speedY = 0;
|
||||
this._directionLock = "";
|
||||
this._didDrag = false;
|
||||
|
||||
if (this._hTracker)
|
||||
{
|
||||
var cw = parseInt(c.css("width"), 10);
|
||||
var vw = parseInt(v.css("width"), 10);
|
||||
this._maxX = cw - vw;
|
||||
if (this._maxX > 0) this._maxX = 0;
|
||||
if (this._$hScrollBar)
|
||||
this._$hScrollBar.find(".ui-scrollbar-thumb").css("width", (cw >= vw ? "100%" : Math.floor(cw/vw*100)+ "%"));
|
||||
}
|
||||
|
||||
if (this._vTracker)
|
||||
{
|
||||
var ch = parseInt(c.css("height"), 10);
|
||||
var vh = parseInt(v.css("height"), 10);
|
||||
this._maxY = ch - vh;
|
||||
if (this._maxY > 0) this._maxY = 0;
|
||||
if (this._$vScrollBar)
|
||||
this._$vScrollBar.find(".ui-scrollbar-thumb").css("height", (ch >= vh ? "100%" : Math.floor(ch/vh*100)+ "%"));
|
||||
}
|
||||
|
||||
var svdir = this.options.direction;
|
||||
|
||||
this._pageDelta = 0;
|
||||
this._pageSize = 0;
|
||||
this._pagePos = 0;
|
||||
|
||||
if (this.options.pagingEnabled && (svdir === "x" || svdir === "y"))
|
||||
{
|
||||
this._pageSize = svdir === "x" ? cw : ch;
|
||||
this._pagePos = svdir === "x" ? this._sx : this._sy;
|
||||
this._pagePos -= this._pagePos % this._pageSize;
|
||||
}
|
||||
this._lastMove = 0;
|
||||
this._enableTracking();
|
||||
|
||||
// If we're using mouse events, we need to prevent the default
|
||||
// behavior to suppress accidental selection of text, etc. We
|
||||
// can't do this on touch devices because it will disable the
|
||||
// generation of "click" events.
|
||||
//
|
||||
// XXX: We should test if this has an effect on links! - kin
|
||||
|
||||
if (this.options.eventType == "mouse" || this.options.delayedClickEnabled)
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
},
|
||||
|
||||
_propagateDragMove: function(sv, e, ex, ey, dir)
|
||||
{
|
||||
this._hideScrollBars();
|
||||
this._disableTracking();
|
||||
sv._handleDragStart(e,ex,ey);
|
||||
sv._directionLock = dir;
|
||||
sv._didDrag = this._didDrag;
|
||||
},
|
||||
|
||||
_handleDragMove: function(e, ex, ey)
|
||||
{
|
||||
this._lastMove = getCurrentTime();
|
||||
|
||||
var v = this._$view;
|
||||
|
||||
var dx = ex - this._lastX;
|
||||
var dy = ey - this._lastY;
|
||||
var svdir = this.options.direction;
|
||||
|
||||
if (!this._directionLock)
|
||||
{
|
||||
var x = Math.abs(dx);
|
||||
var y = Math.abs(dy);
|
||||
var mt = this.options.moveThreshold;
|
||||
|
||||
if (x < mt && y < mt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var dir = null;
|
||||
var r = 0;
|
||||
if (x < y && (x/y) < 0.5) {
|
||||
dir = "y";
|
||||
}
|
||||
else if (x > y && (y/x) < 0.5) {
|
||||
dir = "x";
|
||||
}
|
||||
|
||||
if (svdir && dir && svdir != dir)
|
||||
{
|
||||
// This scrollview can't handle the direction the user
|
||||
// is attempting to scroll. Find an ancestor scrollview
|
||||
// that can handle the request.
|
||||
|
||||
var sv = this._getAncestorByDirection(dir);
|
||||
if (sv)
|
||||
{
|
||||
this._propagateDragMove(sv, e, ex, ey, dir);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
this._directionLock = svdir ? svdir : (dir ? dir : "none");
|
||||
}
|
||||
|
||||
var newX = this._sx;
|
||||
var newY = this._sy;
|
||||
|
||||
if (this._directionLock !== "y" && this._hTracker)
|
||||
{
|
||||
var x = this._sx;
|
||||
this._speedX = dx;
|
||||
newX = x + dx;
|
||||
|
||||
// Simulate resistance.
|
||||
|
||||
this._doSnapBackX = false;
|
||||
if (newX > 0 || newX < this._maxX)
|
||||
{
|
||||
if (this._directionLock === "x")
|
||||
{
|
||||
var sv = this._getAncestorByDirection("x");
|
||||
if (sv)
|
||||
{
|
||||
this._setScrollPosition(newX > 0 ? 0 : this._maxX, newY);
|
||||
this._propagateDragMove(sv, e, ex, ey, dir);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
newX = x + (dx/2);
|
||||
this._doSnapBackX = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this._directionLock !== "x" && this._vTracker)
|
||||
{
|
||||
var y = this._sy;
|
||||
this._speedY = dy;
|
||||
newY = y + dy;
|
||||
|
||||
// Simulate resistance.
|
||||
|
||||
this._doSnapBackY = false;
|
||||
if (newY > 0 || newY < this._maxY)
|
||||
{
|
||||
if (this._directionLock === "y")
|
||||
{
|
||||
var sv = this._getAncestorByDirection("y");
|
||||
if (sv)
|
||||
{
|
||||
this._setScrollPosition(newX, newY > 0 ? 0 : this._maxY);
|
||||
this._propagateDragMove(sv, e, ex, ey, dir);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
newY = y + (dy/2);
|
||||
this._doSnapBackY = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.options.pagingEnabled && (svdir === "x" || svdir === "y"))
|
||||
{
|
||||
if (this._doSnapBackX || this._doSnapBackY)
|
||||
this._pageDelta = 0;
|
||||
else
|
||||
{
|
||||
var opos = this._pagePos;
|
||||
var cpos = svdir === "x" ? newX : newY;
|
||||
var delta = svdir === "x" ? dx : dy;
|
||||
|
||||
this._pageDelta = (opos > cpos && delta < 0) ? this._pageSize : ((opos < cpos && delta > 0) ? -this._pageSize : 0);
|
||||
}
|
||||
}
|
||||
|
||||
this._didDrag = true;
|
||||
this._lastX = ex;
|
||||
this._lastY = ey;
|
||||
|
||||
this._setScrollPosition(newX, newY);
|
||||
|
||||
this._showScrollBars();
|
||||
|
||||
// Call preventDefault() to prevent touch devices from
|
||||
// scrolling the main window.
|
||||
|
||||
// e.preventDefault();
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_handleDragStop: function(e)
|
||||
{
|
||||
var l = this._lastMove;
|
||||
var t = getCurrentTime();
|
||||
var doScroll = l && (t - l) <= this.options.moveIntervalThreshold;
|
||||
|
||||
var sx = (this._hTracker && this._speedX && doScroll) ? this._speedX : (this._doSnapBackX ? 1 : 0);
|
||||
var sy = (this._vTracker && this._speedY && doScroll) ? this._speedY : (this._doSnapBackY ? 1 : 0);
|
||||
|
||||
var svdir = this.options.direction;
|
||||
if (this.options.pagingEnabled && (svdir === "x" || svdir === "y") && !this._doSnapBackX && !this._doSnapBackY)
|
||||
{
|
||||
var x = this._sx;
|
||||
var y = this._sy;
|
||||
if (svdir === "x")
|
||||
x = -this._pagePos + this._pageDelta;
|
||||
else
|
||||
y = -this._pagePos + this._pageDelta;
|
||||
|
||||
this.scrollTo(x, y, this.options.snapbackDuration);
|
||||
}
|
||||
else if (sx || sy)
|
||||
this._startMScroll(sx, sy);
|
||||
else
|
||||
this._hideScrollBars();
|
||||
|
||||
this._disableTracking();
|
||||
|
||||
if (!this._didDrag && this.options.delayedClickEnabled && this._$clickEle.length) {
|
||||
this._$clickEle
|
||||
.trigger("mousedown")
|
||||
//.trigger("focus")
|
||||
.trigger("mouseup")
|
||||
.trigger("click");
|
||||
}
|
||||
|
||||
// If a view scrolled, then we need to absorb
|
||||
// the event so that links etc, underneath our
|
||||
// cursor/finger don't fire.
|
||||
|
||||
return this._didDrag ? false : undefined;
|
||||
},
|
||||
|
||||
_enableTracking: function()
|
||||
{
|
||||
$(document).bind(this._dragMoveEvt, this._dragMoveCB);
|
||||
$(document).bind(this._dragStopEvt, this._dragStopCB);
|
||||
},
|
||||
|
||||
_disableTracking: function()
|
||||
{
|
||||
$(document).unbind(this._dragMoveEvt, this._dragMoveCB);
|
||||
$(document).unbind(this._dragStopEvt, this._dragStopCB);
|
||||
},
|
||||
|
||||
_showScrollBars: function()
|
||||
{
|
||||
var vclass = "ui-scrollbar-visible";
|
||||
if (this._$vScrollBar) this._$vScrollBar.addClass(vclass);
|
||||
if (this._$hScrollBar) this._$hScrollBar.addClass(vclass);
|
||||
},
|
||||
|
||||
_hideScrollBars: function()
|
||||
{
|
||||
var vclass = "ui-scrollbar-visible";
|
||||
if (this._$vScrollBar) this._$vScrollBar.removeClass(vclass);
|
||||
if (this._$hScrollBar) this._$hScrollBar.removeClass(vclass);
|
||||
},
|
||||
|
||||
_addBehaviors: function()
|
||||
{
|
||||
var self = this;
|
||||
if (this.options.eventType === "mouse")
|
||||
{
|
||||
this._dragStartEvt = "mousedown";
|
||||
this._dragStartCB = function(e){ return self._handleDragStart(e, e.clientX, e.clientY); };
|
||||
|
||||
this._dragMoveEvt = "mousemove";
|
||||
this._dragMoveCB = function(e){ return self._handleDragMove(e, e.clientX, e.clientY); };
|
||||
|
||||
this._dragStopEvt = "mouseup";
|
||||
this._dragStopCB = function(e){ return self._handleDragStop(e); };
|
||||
}
|
||||
else // "touch"
|
||||
{
|
||||
this._dragStartEvt = "touchstart";
|
||||
this._dragStartCB = function(e)
|
||||
{
|
||||
var t = e.originalEvent.targetTouches[0];
|
||||
return self._handleDragStart(e, t.pageX, t.pageY);
|
||||
};
|
||||
|
||||
this._dragMoveEvt = "touchmove";
|
||||
this._dragMoveCB = function(e)
|
||||
{
|
||||
var t = e.originalEvent.targetTouches[0];
|
||||
return self._handleDragMove(e, t.pageX, t.pageY);
|
||||
};
|
||||
|
||||
this._dragStopEvt = "touchend";
|
||||
this._dragStopCB = function(e){ return self._handleDragStop(e); };
|
||||
}
|
||||
|
||||
this._$view.bind(this._dragStartEvt, this._dragStartCB);
|
||||
|
||||
if (this.options.showScrollBars)
|
||||
{
|
||||
var $c = this._$clip;
|
||||
var prefix = "<div class=\"ui-scrollbar ui-scrollbar-";
|
||||
var suffix = "\"><div class=\"ui-scrollbar-track\"><div class=\"ui-scrollbar-thumb\"></div></div></div>";
|
||||
if (this._vTracker)
|
||||
{
|
||||
$c.append(prefix + "y" + suffix);
|
||||
this._$vScrollBar = $c.children(".ui-scrollbar-y");
|
||||
}
|
||||
if (this._hTracker)
|
||||
{
|
||||
$c.append(prefix + "x" + suffix);
|
||||
this._$hScrollBar = $c.children(".ui-scrollbar-x");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function setElementTransform($ele, x, y)
|
||||
{
|
||||
var v = "translate3d(" + x + "," + y + ", 0px)";
|
||||
$ele.css({
|
||||
"-moz-transform": v,
|
||||
"-webkit-transform": v,
|
||||
"transform": v
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function MomentumTracker(options)
|
||||
{
|
||||
this.options = $.extend({}, options);
|
||||
this.easing = "easeOutQuad";
|
||||
this.reset();
|
||||
}
|
||||
|
||||
var tstates = {
|
||||
scrolling: 0,
|
||||
overshot: 1,
|
||||
snapback: 2,
|
||||
done: 3
|
||||
};
|
||||
|
||||
function getCurrentTime() { return (new Date()).getTime(); }
|
||||
|
||||
$.extend(MomentumTracker.prototype, {
|
||||
start: function(pos, speed, duration, minPos, maxPos)
|
||||
{
|
||||
this.state = (speed != 0) ? ((pos < minPos || pos > maxPos) ? tstates.snapback : tstates.scrolling) : tstates.done;
|
||||
this.pos = pos;
|
||||
this.speed = speed;
|
||||
this.duration = (this.state == tstates.snapback) ? this.options.snapbackDuration : duration;
|
||||
this.minPos = minPos;
|
||||
this.maxPos = maxPos;
|
||||
|
||||
this.fromPos = (this.state == tstates.snapback) ? this.pos : 0;
|
||||
this.toPos = (this.state == tstates.snapback) ? ((this.pos < this.minPos) ? this.minPos : this.maxPos) : 0;
|
||||
|
||||
this.startTime = getCurrentTime();
|
||||
},
|
||||
|
||||
reset: function()
|
||||
{
|
||||
this.state = tstates.done;
|
||||
this.pos = 0;
|
||||
this.speed = 0;
|
||||
this.minPos = 0;
|
||||
this.maxPos = 0;
|
||||
this.duration = 0;
|
||||
},
|
||||
|
||||
update: function()
|
||||
{
|
||||
var state = this.state;
|
||||
if (state == tstates.done)
|
||||
return this.pos;
|
||||
|
||||
var duration = this.duration;
|
||||
var elapsed = getCurrentTime() - this.startTime;
|
||||
elapsed = elapsed > duration ? duration : elapsed;
|
||||
|
||||
if (state == tstates.scrolling || state == tstates.overshot)
|
||||
{
|
||||
var dx = this.speed * (1 - $.easing[this.easing](elapsed/duration, elapsed, 0, 1, duration));
|
||||
|
||||
var x = this.pos + dx;
|
||||
|
||||
var didOverShoot = (state == tstates.scrolling) && (x < this.minPos || x > this.maxPos);
|
||||
if (didOverShoot)
|
||||
x = (x < this.minPos) ? this.minPos : this.maxPos;
|
||||
|
||||
this.pos = x;
|
||||
|
||||
if (state == tstates.overshot)
|
||||
{
|
||||
if (elapsed >= duration)
|
||||
{
|
||||
this.state = tstates.snapback;
|
||||
this.fromPos = this.pos;
|
||||
this.toPos = (x < this.minPos) ? this.minPos : this.maxPos;
|
||||
this.duration = this.options.snapbackDuration;
|
||||
this.startTime = getCurrentTime();
|
||||
elapsed = 0;
|
||||
}
|
||||
}
|
||||
else if (state == tstates.scrolling)
|
||||
{
|
||||
if (didOverShoot)
|
||||
{
|
||||
this.state = tstates.overshot;
|
||||
this.speed = dx / 2;
|
||||
this.duration = this.options.overshootDuration;
|
||||
this.startTime = getCurrentTime();
|
||||
}
|
||||
else if (elapsed >= duration)
|
||||
this.state = tstates.done;
|
||||
}
|
||||
}
|
||||
else if (state == tstates.snapback)
|
||||
{
|
||||
if (elapsed >= duration)
|
||||
{
|
||||
this.pos = this.toPos;
|
||||
this.state = tstates.done;
|
||||
}
|
||||
else
|
||||
this.pos = this.fromPos + ((this.toPos - this.fromPos) * $.easing[this.easing](elapsed/duration, elapsed, 0, 1, duration));
|
||||
}
|
||||
|
||||
return this.pos;
|
||||
},
|
||||
|
||||
done: function() { return this.state == tstates.done; },
|
||||
getPosition: function(){ return this.pos; }
|
||||
});
|
||||
|
||||
jQuery.widget( "mobile.scrolllistview", jQuery.mobile.scrollview, {
|
||||
options: {
|
||||
direction: "y"
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
$.mobile.scrollview.prototype._create.call(this);
|
||||
|
||||
// Cache the dividers so we don't have to search for them everytime the
|
||||
// view is scrolled.
|
||||
//
|
||||
// XXX: Note that we need to update this cache if we ever support lists
|
||||
// that can dynamically update their content.
|
||||
|
||||
this._$dividers = this._$view.find("[data-role=list-divider]");
|
||||
this._lastDivider = null;
|
||||
},
|
||||
|
||||
_setScrollPosition: function(x, y)
|
||||
{
|
||||
// Let the view scroll like it normally does.
|
||||
|
||||
$.mobile.scrollview.prototype._setScrollPosition.call(this, x, y);
|
||||
|
||||
y = -y;
|
||||
|
||||
// Find the dividers for the list.
|
||||
|
||||
var $divs = this._$dividers;
|
||||
var cnt = $divs.length;
|
||||
var d = null;
|
||||
var dy = 0;
|
||||
var nd = null;
|
||||
|
||||
for (var i = 0; i < cnt; i++)
|
||||
{
|
||||
nd = $divs.get(i);
|
||||
var t = nd.offsetTop;
|
||||
if (y >= t)
|
||||
{
|
||||
d = nd;
|
||||
dy = t;
|
||||
}
|
||||
else if (d)
|
||||
break;
|
||||
}
|
||||
|
||||
// If we found a divider to move position it at the top of the
|
||||
// clip view.
|
||||
|
||||
if (d)
|
||||
{
|
||||
var h = d.offsetHeight;
|
||||
var mxy = (d != nd) ? nd.offsetTop : (this._$view.get(0).offsetHeight);
|
||||
if (y + h >= mxy)
|
||||
y = (mxy - h) - dy;
|
||||
else
|
||||
y = y - dy;
|
||||
|
||||
// XXX: Need to convert this over to using $().css() and supporting the non-transform case.
|
||||
|
||||
var ld = this._lastDivider;
|
||||
if (ld && d != ld) {
|
||||
setElementTransform($(ld), 0, 0);
|
||||
}
|
||||
setElementTransform($(d), 0, y + "px");
|
||||
this._lastDivider = d;
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery,window,document); // End Component
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Label module version info
|
||||
*
|
||||
* @package theme
|
||||
* @subpackage mymobile
|
||||
* @copyright John Stabinger
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'MyMobile';
|
||||
$string['region-side-post'] = 'Right';
|
||||
$string['region-side-pre'] = 'Left';
|
||||
$string['region-myblocks'] = 'block region';
|
||||
$string['choosereadme'] = '<div class="clearfix"><div class="theme_screenshot"><h2>MyMobile</h2><img src="mymobile/pix/screenshot.png" /><h2>About</h2><p>MyMobile is a mobile theme for Moodle 2.x. More information on modifying themes can be found in the <a href="http://docs.moodle.org/en/Theme">MoodleDocs</a>.</p></div></div>';
|
||||
|
||||
$string['configtitle'] = 'MyMobile theme';
|
||||
|
||||
$string['mtext'] = 'Mobile Intro Text';
|
||||
$string['mtext_desc'] = 'Add mobile only text/images to the mobile homepage.';
|
||||
|
||||
$string['mtopic'] = 'Show site topic:';
|
||||
$string['mtopic_desc'] = 'Show the standard site topic section(s) on the front page for mobile theme users (if available).';
|
||||
|
||||
$string['mimgs'] = 'Show full images on site index and course pages.';
|
||||
$string['mimgs_desc'] = 'Show full size images on site index and course pages instead of replaced thumb icon method. Default is to not show full size images.';
|
||||
|
||||
$string['mdesk'] = 'Show desktop version link:';
|
||||
$string['mdesk_desc'] = 'Show a link to the desktop version of the site, the link attempts to clear the mobile theme and use whatever theme you have as standard. Disabled by default.';
|
||||
|
||||
$string['mswatch'] = 'Mobile theme color swatch';
|
||||
$string['mswatch_desc'] = 'Toggle the color swatch of the theme between grey and light/blue.';
|
||||
|
||||
$string['mtab'] = 'Tablet View';
|
||||
$string['mtab_desc'] = 'Use the tablet view for larger devices (yes by default).';
|
||||
|
||||
$string['mtoggle'] = 'Toggle 2nd Column';
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
if (!empty($PAGE->theme->settings->mswatch)) {
|
||||
$showswatch = $PAGE->theme->settings->mswatch;
|
||||
} else {
|
||||
$showswatch = "light";
|
||||
}
|
||||
if ($showswatch == "light") {
|
||||
$dtheme = "d";
|
||||
$dthemeb = "d";
|
||||
$datatheme = "data-theme=b";
|
||||
$databodytheme = "data-theme=d";
|
||||
}
|
||||
else {
|
||||
$dtheme = "d";
|
||||
$dthemeb = "c";
|
||||
$datatheme = "data-theme=a";
|
||||
$databodytheme = "data-theme=c";
|
||||
}
|
||||
|
||||
?>
|
||||
<?php echo $OUTPUT->doctype() ?>
|
||||
<?php $mypagetype = $this->page->pagetype; ?>
|
||||
<html <?php echo $OUTPUT->htmlattributes() ?>>
|
||||
<head>
|
||||
<title><?php echo $SITE->shortname ?></title>
|
||||
<link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
|
||||
<?php if ($mypagetype != 'mod-chat-gui_ajax-index') { ?>
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1" />
|
||||
<?php } ?>
|
||||
<?php echo $OUTPUT->standard_head_html() ?>
|
||||
|
||||
</head>
|
||||
<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
|
||||
<?php echo $OUTPUT->standard_top_of_body_html() ?>
|
||||
|
||||
|
||||
|
||||
<!-- END OF HEADER -->
|
||||
<?php if ($mypagetype == 'mod-chat-gui_ajax-index') {
|
||||
?>
|
||||
<div data-role="page" id="chatpage" data-fullscreen="true" data-title="<?php p($SITE->shortname) ?>">
|
||||
<?php echo core_renderer::MAIN_CONTENT_TOKEN ?>
|
||||
<input type="button" value="back" data-role="none" id="chatback" onClick="history.back()">
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div id="content2" data-role="page" data-title="<?php p($SITE->shortname) ?>" <?php p($datatheme); ?>>
|
||||
<div data-role="header" <?php p($datatheme) ?>><h1><?php echo $PAGE->heading ?> </h1>
|
||||
<?php if ($mypagetype != "help") { ?>
|
||||
<a class="ui-btn-right" data-ajax="false" data-icon="home" href="<?php p($CFG->wwwroot) ?>" data-iconpos="notext"><?php p(get_string('home')); ?></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div data-role="content" <?php p($databodytheme); ?>>
|
||||
<?php echo core_renderer::MAIN_CONTENT_TOKEN ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<!-- START OF FOOTER -->
|
||||
|
||||
|
||||
|
||||
<?php echo $OUTPUT->standard_end_of_body_html() ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,292 @@
|
||||
<?php
|
||||
$toblock = optional_param('mymobile_blocks', false, PARAM_BOOL);
|
||||
//get blocks?
|
||||
$toset = optional_param('mymobile_settings', false, PARAM_BOOL);
|
||||
//get settings?
|
||||
|
||||
$mypagetype = $this->page->pagetype;
|
||||
$mylayoutype = $this->page->pagelayout;
|
||||
|
||||
if (!empty($PAGE->theme->settings->mswatch)) {
|
||||
$showswatch = $PAGE->theme->settings->mswatch;
|
||||
} else {
|
||||
$showswatch = 'light';
|
||||
}
|
||||
|
||||
if ($showswatch == 'light') {
|
||||
$dtheme = 'd';
|
||||
$dthemeb = 'd';
|
||||
$datatheme = 'data-theme=b';
|
||||
$databodytheme = 'data-theme=d';
|
||||
} else {
|
||||
$dtheme = 'd';
|
||||
$dthemeb = 'c';
|
||||
$datatheme = 'data-theme=a';
|
||||
$databodytheme = '';
|
||||
}
|
||||
|
||||
//custom settings
|
||||
$hasmtext = (!empty($PAGE->theme->settings->mtext));
|
||||
|
||||
if (!empty($PAGE->theme->settings->mimgs)) {
|
||||
$hasithumb = $PAGE->theme->settings->mimgs;
|
||||
} else {
|
||||
$hasithumb = 'ithumb';
|
||||
}
|
||||
|
||||
if (!empty($PAGE->theme->settings->mtopic)) {
|
||||
$showsitetopic = $PAGE->theme->settings->mtopic;
|
||||
} else {
|
||||
$showsitetopic = 'topicnoshow';
|
||||
}
|
||||
|
||||
if (!empty($PAGE->theme->settings->mtab)) {
|
||||
$showmtab = $PAGE->theme->settings->mtab;
|
||||
} else {
|
||||
$showmtab = 'tabshow';
|
||||
}
|
||||
|
||||
if ($mypagetype == 'course-view-topics' || $mypagetype == 'course-view-weeks') {
|
||||
$jumptocurrent = 'true';
|
||||
//jump to current topic only in course pages
|
||||
}
|
||||
|
||||
else {
|
||||
$jumptocurrent = 'false';
|
||||
}
|
||||
|
||||
// below sets a URL variable to use in some links
|
||||
$url = new moodle_url($this->page->url, array('mymobile_blocks' => 'true'));
|
||||
$urls = new moodle_url($this->page->url, array('mymobile_settings' => 'true'));
|
||||
|
||||
$hasheading = ($PAGE->heading);
|
||||
$hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar());
|
||||
$hasfooter = (empty($PAGE->layout_options['nofooter']));
|
||||
$hasmyblocks = $PAGE->blocks->region_has_content('myblocks', $OUTPUT);
|
||||
$bodyclasses = array();
|
||||
$bodyclasses[] = ''.$hasithumb.'';
|
||||
$bodyclasses[] = ''.$showsitetopic .'';
|
||||
//add ithumb class to decide whether to show or hide images and site topic
|
||||
|
||||
$thisdevice = $this->page->devicetypeinuse;
|
||||
if ($thisdevice == 'default' && $showmtab == 'tabshow' || $thisdevice == 'tablet' && $showmtab == 'tabshow') {
|
||||
$gowide = 'true';
|
||||
//initialize column position choices.
|
||||
mymobile_initialise_colpos($PAGE);
|
||||
$usercol = mymobile_get_colpos();
|
||||
} else {
|
||||
$gowide = 'false';
|
||||
}
|
||||
|
||||
echo $OUTPUT->doctype() ?>
|
||||
<html <?php echo $OUTPUT->htmlattributes() ?>>
|
||||
<head>
|
||||
<title><?php echo $SITE->shortname ?></title>
|
||||
<link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
|
||||
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo $OUTPUT->pix_url('m2m2x', 'theme')?>" />
|
||||
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php echo $OUTPUT->pix_url('m2m', 'theme')?>" />
|
||||
<link rel="apple-touch-icon-precomposed" href="<?php echo $OUTPUT->pix_url('m2m', 'theme')?>" />
|
||||
|
||||
<meta name="description" content="<?php echo strip_tags(format_text($SITE->summary, FORMAT_HTML)) ?>" />
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1" />
|
||||
|
||||
<?php echo $OUTPUT->standard_head_html() ?>
|
||||
|
||||
</head>
|
||||
|
||||
<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
|
||||
<?php echo $OUTPUT->standard_top_of_body_html() ?>
|
||||
|
||||
<div id="<?php p($PAGE->bodyid) ?>PAGE" data-role="page" class="generalpage <?php echo 'ajaxedclass '; p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)); ?> <?php if ($hasmyblocks && $usercol == "on") { echo 'has-myblocks'; } ?> " data-title="<?php p($SITE->shortname) ?>">
|
||||
<!-- start header -->
|
||||
<div data-role="header" <?php p($datatheme) ?> class="mymobileheader">
|
||||
<h1><?php echo $PAGE->heading ?></h1>
|
||||
<?php
|
||||
if (isloggedin() && $mypagetype != 'site-index') { ?>
|
||||
<a class="ui-btn-right" data-icon="home" href="<?php p($CFG->wwwroot) ?>" data-iconpos="notext" data-ajax="false"><?php p(get_string('home')); ?></a>
|
||||
<?php } else if (!isloggedin()) {
|
||||
echo $OUTPUT->login_info();
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- start navbar -->
|
||||
<div data-role="navbar">
|
||||
<ul>
|
||||
|
||||
<?php if ($gowide != "true" && !$hasmyblocks && !$toblock && $mypagetype == "mod-quiz-attempt" || $gowide != "true" && !$hasmyblocks && !$toblock && $mylayoutype != "incourse") {
|
||||
//if has sidepost means there are blocks so print block button
|
||||
?>
|
||||
<li><a data-theme="c" class="blockload" href="<?php echo''.$url.''; ?>"><?php p(get_string('blocks')); ?></a></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if(!$toset) { ?>
|
||||
<li><a data-theme="c" href="<?php echo''.$urls.''; ?>"><?php p(get_string('settings')); ?></a></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($jumptocurrent == 'true' && !$toblock && !$toset) { ?>
|
||||
<li><a data-theme="c" class="jumptocurrent" href="#"><?php p(get_string('jump')); ?></a></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
if (isloggedin() && $hasnavbar) { ?>
|
||||
<li><form id="navselectform"><select id="navselect" data-theme="c" data-inline="false" data-icon="false" >
|
||||
<option data-placeholder="true" value="-1"><?php p(get_string('navigation')); ?></option>
|
||||
<?php echo $OUTPUT->navbar(); ?>
|
||||
</select></form></li>
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
</div><!-- /navbar -->
|
||||
|
||||
</div>
|
||||
<div id="page-header"><!-- empty page-header needed by moodle yui --></div>
|
||||
<!-- end header -->
|
||||
<!-- main content -->
|
||||
<div data-role="content" class="mymobilecontent" <?php p($databodytheme); ?>>
|
||||
<?php if($toset) { //if we get the true, that means load/show settings only ?>
|
||||
<h2 class="jsets">
|
||||
<?php p(get_string('settings')); ?>
|
||||
</h2>
|
||||
<?php
|
||||
//load lang menu if available
|
||||
echo $OUTPUT->lang_menu();
|
||||
$mobileblocks = new mymobile_mobileblocks_renderer($this->page, null);
|
||||
?>
|
||||
<ul data-role="listview" data-theme="<?php p($dthemeb) ?>" data-dividertheme="<?php p($dtheme) ?>" data-inset="true" class="settingsul">
|
||||
<?php
|
||||
echo $mobileblocks->settings_tree($this->page->settingsnav);
|
||||
?>
|
||||
</ul>
|
||||
<?php echo $OUTPUT->login_info(); ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<div class="content-primary">
|
||||
<div class="region-content <?php if($toblock) { ?>mobile_blocksonly<?php } ?>" id="themains">
|
||||
<?php
|
||||
//only show main content if we are not showing anything else
|
||||
if(!$toblock && !$toset) { ?>
|
||||
|
||||
<?php if ($hasmtext && $mypagetype == 'site-index') { ?>
|
||||
<?php echo $PAGE->theme->settings->mtext; ?>
|
||||
<?php } ?>
|
||||
<?php echo core_renderer::MAIN_CONTENT_TOKEN ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php if($gowide == "true" && $hasmyblocks && !$toset) {
|
||||
//if we get the true, that means load/show blocks only for tablet views only ?>
|
||||
<div class="content-secondary">
|
||||
<div class="tablets">
|
||||
<h1><?php echo $PAGE->heading ?></h1>
|
||||
<span><?php echo $this->page->course->summary; ?></span>
|
||||
</div>
|
||||
|
||||
<?php if ($hasmyblocks) { ?>
|
||||
|
||||
<div data-role="collapsible-set" data-theme="<?php p($dthemeb) ?>">
|
||||
<?php echo $OUTPUT->blocks_for_region('myblocks') ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($gowide == "true" && isloggedin() && !isguestuser()) { ?>
|
||||
|
||||
<div data-role="collapsible" data-collapsed="false" <?php p($datatheme) ?> data-content-theme="<?php p($dthemeb) ?>" id="profcol">
|
||||
<h3><?php p(''.$USER->firstname.' '.$USER->lastname.''); ?></h3>
|
||||
|
||||
<div class="ui-grid-a">
|
||||
<div class="ui-block-a">
|
||||
<?php echo html_writer::tag('div', $OUTPUT->user_picture($USER, array('size'=>80)), array('class'=>'userimg'));
|
||||
?>
|
||||
</div>
|
||||
<div class="ui-block-b">
|
||||
<a data-role="button" data-icon="home" href="<?php p($CFG->wwwroot) ?>/my/"><?php p(get_string('myhome')); ?></a>
|
||||
<a data-role="button" data-icon="info" href="<?php p($CFG->wwwroot) ?>/user/profile.php"><?php p(get_string('myprofile')); ?></a>
|
||||
<a data-role="button" data-icon="back" data-ajax="false" href="<?php p($CFG->wwwroot) ?>/login/logout.php"><?php p(get_string('logout')); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-role="fieldcontain" id="sliderdiv">
|
||||
<label for="slider"><?php p(get_string('mtoggle','theme_mymobile')); ?>:</label>
|
||||
<select name="slider" class="slider" data-role="slider" data-track-theme="b">
|
||||
<option value="on">On</option>
|
||||
<option value="off">Off</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php } else if (!isloggedin() || isguestuser()) { ?>
|
||||
|
||||
<a data-role="button" <?php echo $datatheme ?> href="<?php p($CFG->wwwroot) ?>/login/index.php"><?php p(get_string('login')); ?></a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($toblock && $gowide != "true") {
|
||||
//regular block load for phones + handhelds
|
||||
if ($hasmyblocks) { ?>
|
||||
<div class="headingwrap ui-bar-<?php echo $dtheme ?> ui-footer jsetsbar">
|
||||
<h2 class="jsets ui-title">
|
||||
<?php p(get_string('blocks')); ?>
|
||||
</h2>
|
||||
</div>
|
||||
<div data-role="collapsible-set">
|
||||
<?php echo $OUTPUT->blocks_for_region('myblocks') ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- end main content -->
|
||||
|
||||
<!-- start footer -->
|
||||
<div data-role="footer" class="mobilefooter" <?php p($datatheme) ?>>
|
||||
<div data-role="navbar" class="jnav" >
|
||||
<ul>
|
||||
|
||||
<li><a id="mycal" class="callink" href="<?php p($CFG->wwwroot) ?>/calendar/view.php" data-icon="info" data-iconpos="top" ><?php p(get_string('calendar', 'calendar')); ?></a></li>
|
||||
|
||||
<?php if (!empty($CFG->messaging)) { ?>
|
||||
<li><a id="mymess" href="<?php p($CFG->wwwroot) ?>/message/index.php" data-iconpos="top" data-icon="mymessage" ><?php p(get_string('messages', 'message')); ?></a></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($mypagetype != 'site-index') { ?>
|
||||
<li><a href="#" data-inline="true" data-role="button" data-iconpos="top" data-icon="arrow-u" id="uptotop"><?php p(get_string('up')); ?></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end footer -->
|
||||
|
||||
<div id="underfooter">
|
||||
<?php
|
||||
echo $OUTPUT->login_infoB();
|
||||
echo '<div class="noajax">';
|
||||
echo $OUTPUT->standard_footer_html();
|
||||
echo '</div>';
|
||||
?>
|
||||
</div>
|
||||
|
||||
|
||||
</div><!-- ends page -->
|
||||
|
||||
<!-- empty divs with info for the JS to use -->
|
||||
<div id="<?php p(sesskey()); ?>" class="mobilesession"></div>
|
||||
<div id="<?php p($CFG->wwwroot); ?>" class="mobilesiteurl"></div>
|
||||
<div id="<?php p($dtheme); ?>" class="datatheme"></div>
|
||||
<div id="<?php p($dthemeb); ?>" class="datathemeb"></div>
|
||||
<div id="page-footer"><!-- empty page footer needed by moodle yui for embeds --></div>
|
||||
<!-- end js divs -->
|
||||
|
||||
|
||||
<?php echo $OUTPUT->standard_end_of_body_html() ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Lib file for mymobile theme
|
||||
*
|
||||
* @package theme
|
||||
* @subpackage mymobile
|
||||
* @copyright John Stabinger
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class mymobile_mobileblocks_renderer extends plugin_renderer_base {
|
||||
|
||||
public function settings_tree(settings_navigation $navigation) {
|
||||
global $CFG;
|
||||
$content = $this->navigation_node($navigation, array('class' => 'settings'));
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function navigation_tree(global_navigation $navigation) {
|
||||
global $CFG;
|
||||
$content .= $this->navigation_node($navigation, array());
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
protected function navigation_node(navigation_node $node, $attrs=array()) {
|
||||
$items = $node->children;
|
||||
|
||||
// exit if empty, we don't want an empty ul element
|
||||
if ($items->count() == 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// array of nested li elements
|
||||
$lis = array();
|
||||
foreach ($items as $item) {
|
||||
if (!$item->display) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$isbranch = ($item->children->count() > 0 || $item->nodetype == navigation_node::NODETYPE_BRANCH);
|
||||
$hasicon = (!$isbranch && $item->icon instanceof renderable);
|
||||
|
||||
if ($isbranch) {
|
||||
$item->hideicon = true;
|
||||
}
|
||||
$item->hideicon = true;
|
||||
$content = $this->output->render($item);
|
||||
if(substr($item->id, 0, 17)=='expandable_branch' && $item->children->count()==0) {
|
||||
// Navigation block does this via AJAX - we'll merge it in directly instead
|
||||
$dummypage = new mymobile_dummy_page();
|
||||
$dummypage->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
$subnav = new mymobile_expand_navigation($dummypage, $item->type, $item->key);
|
||||
if (!isloggedin() || isguestuser()) {
|
||||
$subnav->set_expansion_limit(navigation_node::TYPE_COURSE);
|
||||
}
|
||||
//below by john for too manu items...
|
||||
$subnav->set_expansion_limit(navigation_node::TYPE_COURSE);
|
||||
$branch = $subnav->find($item->key, $item->type);
|
||||
$content .= $this->navigation_node($branch);
|
||||
} else {
|
||||
$content .= $this->navigation_node($item);
|
||||
}
|
||||
|
||||
|
||||
if($isbranch && !(is_string($item->action) || empty($item->action))) {
|
||||
|
||||
$itest = $item->key;
|
||||
$content = html_writer::tag('li', $content, array('data-role' => 'list-divider', 'class' => ''.$itest.'' ));
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if($isbranch) {
|
||||
$itest = $item->key;
|
||||
$content = html_writer::tag('li', $content, array('data-role' => 'list-divider'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
$itest = $item->text;
|
||||
$content = html_writer::tag('li', $content, array('class' => ''.$itest.''));
|
||||
|
||||
|
||||
}
|
||||
$lis[] = $content;
|
||||
}
|
||||
|
||||
if (count($lis)) {
|
||||
|
||||
return implode("\n", $lis);
|
||||
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//user defined columns for tablets or not
|
||||
function mymobile_initialise_colpos(moodle_page $page) {
|
||||
user_preference_allow_ajax_update('theme_mymobile_chosen_colpos', PARAM_ALPHA);
|
||||
}
|
||||
|
||||
function mymobile_get_colpos($default='on') {
|
||||
return get_user_preferences('theme_mymobile_chosen_colpos', $default);
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 503 B |
|
After Width: | Height: | Size: 503 B |
|
After Width: | Height: | Size: 388 B |
|
After Width: | Height: | Size: 43 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 364 B |
|
After Width: | Height: | Size: 460 B |
|
After Width: | Height: | Size: 453 B |
|
After Width: | Height: | Size: 519 B |
|
After Width: | Height: | Size: 840 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 596 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 232 B |
|
After Width: | Height: | Size: 236 B |
|
After Width: | Height: | Size: 236 B |
|
After Width: | Height: | Size: 231 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 965 B |
|
After Width: | Height: | Size: 971 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 444 B |
|
After Width: | Height: | Size: 640 B |
|
After Width: | Height: | Size: 554 B |
|
After Width: | Height: | Size: 492 B |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 532 B |
|
After Width: | Height: | Size: 729 B |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 366 B |
|
After Width: | Height: | Size: 117 B |
|
After Width: | Height: | Size: 478 B |
|
After Width: | Height: | Size: 193 B |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 164 B |
|
After Width: | Height: | Size: 175 B |
|
After Width: | Height: | Size: 179 B |
|
After Width: | Height: | Size: 185 B |
|
After Width: | Height: | Size: 164 B |
|
After Width: | Height: | Size: 157 B |
|
After Width: | Height: | Size: 156 B |
|
After Width: | Height: | Size: 155 B |
|
After Width: | Height: | Size: 162 B |
|
After Width: | Height: | Size: 133 B |
|
After Width: | Height: | Size: 418 B |
|
After Width: | Height: | Size: 133 B |
|
After Width: | Height: | Size: 131 B |
|
After Width: | Height: | Size: 581 B |
|
After Width: | Height: | Size: 581 B |
|
After Width: | Height: | Size: 607 B |
|
After Width: | Height: | Size: 463 B |
|
After Width: | Height: | Size: 399 B |
|
After Width: | Height: | Size: 511 B |
|
After Width: | Height: | Size: 437 B |
|
After Width: | Height: | Size: 865 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 803 B |
|
After Width: | Height: | Size: 138 B |
|
After Width: | Height: | Size: 124 B |
|
After Width: | Height: | Size: 139 B |
|
After Width: | Height: | Size: 131 B |
|
After Width: | Height: | Size: 125 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 531 B |
|
After Width: | Height: | Size: 537 B |
|
After Width: | Height: | Size: 133 B |
|
After Width: | Height: | Size: 367 B |
|
After Width: | Height: | Size: 205 B |
|
After Width: | Height: | Size: 132 B |
|
After Width: | Height: | Size: 143 B |
|
After Width: | Height: | Size: 135 B |
|
After Width: | Height: | Size: 119 B |
|
After Width: | Height: | Size: 510 B |
|
After Width: | Height: | Size: 813 B |
|
After Width: | Height: | Size: 128 B |
|
After Width: | Height: | Size: 130 B |