Skip to content

Commit

Permalink
V2.6.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Sep 22, 2014
1 parent b36916e commit aa90590
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 22 deletions.
6 changes: 5 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ can be really useful in visualising the issue along with any files you consider

Version Information
===================
20th September 2014 Version 2.6.1.7
1. Fixed issue where a debug message was being written to the PHP error log.
2. When toggle persistence is off then the state of the toggles on page load will depend on the default user preference setting.

18th August 2014 Version 2.6.1.6
1. Fixed CONTRIB-5211: Section 5 does not remain expanded when browsing away and back.

Expand Down Expand Up @@ -1103,6 +1107,6 @@ Desired Enhancements

Me
==
G J Barnard MSc. BSc(Hons)(Sndw). MBCS. CEng. CITP. PGCE. - 17th April 2014.
G J Barnard MSc. BSc(Hons)(Sndw). MBCS. CEng. CITP. PGCE. - 20th September 2014.
Moodle profile: http://moodle.org/user/profile.php?id=442195.
Web profile : http://about.me/gjbarnard
12 changes: 9 additions & 3 deletions format.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,14 @@
if (!empty($displaysection)) {
$renderer->print_single_section_page($course, null, null, null, null, $displaysection);
} else {
user_preference_allow_ajax_update('topcoll_toggle_' . $course->id, PARAM_TOPCOLL);
$userpreference = get_user_preferences('topcoll_toggle_' . $course->id);
$defaulttogglepersistence = clean_param(get_config('format_topcoll', 'defaulttogglepersistence'), PARAM_INT);

if ($defaulttogglepersistence == 1) {
user_preference_allow_ajax_update('topcoll_toggle_' . $course->id, PARAM_TOPCOLL);
$userpreference = get_user_preferences('topcoll_toggle_' . $course->id);
} else {
$userpreference = null;
}
$renderer->set_user_preference($userpreference);

$defaultuserpreference = clean_param(get_config('format_topcoll', 'defaultuserpreference'), PARAM_INT);
Expand All @@ -96,7 +102,7 @@
$course->id,
$userpreference,
$course->numsections,
clean_param(get_config('format_topcoll', 'defaulttogglepersistence'), PARAM_INT),
$defaulttogglepersistence,
$defaultuserpreference));

$tcsettings = $courseformat->get_settings();
Expand Down
8 changes: 4 additions & 4 deletions lang/en/format_topcoll.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
'Weeks' - where each section is presented as a week in ascending week order from the start date of the course.
'Current Week First' - which is the same as weeks but the current week is shown at the top and preceding weeks in decending order are displayed below except in editing mode where the structure is the same as 'Weeks'.
'Current Week First' - which is the same as weeks but the current week is shown at the top and preceding weeks in descending order are displayed below except in editing mode where the structure is the same as 'Weeks'.
'Current Topic First' - which is the same as 'Topics' except that the current topic is shown at the top if it has been set.
Expand Down Expand Up @@ -265,11 +265,11 @@
$string['defaulttgbghvrcolour_desc'] = "Toggle background hover colour in hexidecimal RGB.";

$string['defaulttogglepersistence'] = 'Toggle persistence';
$string['defaulttogglepersistence_desc'] = "'On' or 'Off'. You may wish to turn off for an AJAX performance increase but user toggle selections will not be recalled on page refresh or revisit.
$string['defaulttogglepersistence_desc'] = "'On' or 'Off'. Turn off for an AJAX performance increase but user toggle selections will not be remembered on page refresh or revisit.
Note: If turning persistence off remove any rows containing 'topcoll_toggle_x' in the 'name' field
Note: When turning persistence off, please remove any rows containing 'topcoll_toggle_x' in the 'name' field
of the 'user_preferences' table in the database. Where the 'x' in 'topcoll_toggle_x' will be
a course id.";
a course id. This is to save space if you do not intend to turn it back on.";

$string['defaulttogglealignment'] = 'Default toggle text alignment';
$string['defaulttogglealignment_desc'] = "'Left', 'Centre' or 'Right'.";
Expand Down
22 changes: 16 additions & 6 deletions module.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ M.format_topcoll.courseid;
M.format_topcoll.togglePersistence = 1; // Toggle persistence - 1 = on, 0 = off.
M.format_topcoll.ourYUI;
M.format_topcoll.numSections;
M.format_topcoll.ie8;

// Namespace constants:
M.format_topcoll.TOGGLE_6 = 1;
Expand Down Expand Up @@ -68,7 +69,10 @@ M.format_topcoll.init = function(Y, theCourseId, theToggleState, theNumSections,
this.numSections = parseInt(theNumSections);
this.togglePersistence = theTogglePersistence;

if (this.togglestate !== null) {
// IE8 - humm!
var bodyNode = Y.one(document.body);
M.format_topcoll.ie8 = bodyNode.hasClass('ie8');
if ((this.togglestate !== null) && (this.togglePersistence == 1)) { // Toggle persistence - 1 = on, 0 = off.
if (this.is_old_preference(this.togglestate) == true) {
// Old preference, so convert to new.
this.convert_to_new_preference();
Expand Down Expand Up @@ -160,6 +164,12 @@ M.format_topcoll.toggle_topic = function(targetNode, toggleNum) {
targetNode.next('.toggledsection').removeClass('sectionopen');
state = false;
}
//IE 8 Hack/workaround to force IE8 to repaint everything
if (M.format_topcoll.ie8) {
M.format_topcoll.ourYUI.all(".toggle a").addClass('ie8_hackclass_donotuseincss').removeClass('ie8_hackclass_donotuseincss');
console.log('IE8 repaint.');
}

this.set_toggle_state(toggleNum, state);
this.save_toggles();
};
Expand Down Expand Up @@ -219,8 +229,8 @@ M.format_topcoll.convert_to_new_preference = function() {
this.togglestate = "";
var logbintext = "";

for (var i = 1; i <= 43; i = i+6) {
bin = toggleBinary.substring(i, i+6);
for (var i = 1; i <= 43; i = i + 6) {
bin = toggleBinary.substring(i, i + 6);
value = parseInt(bin, 2);
this.togglestate += this.encode_value_to_character(value);
logbintext += bin + ' ';
Expand All @@ -242,14 +252,14 @@ M.format_topcoll.set_toggle_state = function(togglenum, state) {
"use strict";
var togglecharpos = this.get_toggle_pos(togglenum);
var toggleflag = this.get_toggle_flag(togglenum, togglecharpos);
var value = this.decode_character_to_value(this.togglestate.charAt(togglecharpos-1));
var value = this.decode_character_to_value(this.togglestate.charAt(togglecharpos - 1));
if (state == true) {
value |= toggleflag;
} else {
value &= ~toggleflag;
}
var newchar = this.encode_value_to_character(value);
var start = this.togglestate.substring(0,togglecharpos-1);
var start = this.togglestate.substring(0,togglecharpos - 1);
var end = this.togglestate.substring(togglecharpos);
this.togglestate = start + newchar + end;
};
Expand All @@ -276,7 +286,7 @@ M.format_topcoll.get_max_digit = function() {

M.format_topcoll.get_toggle_flag = function(togglenum, togglecharpos) {
"use strict";
var toggleflagpos = togglenum - ((togglecharpos-1)*6);
var toggleflagpos = togglenum - ((togglecharpos - 1) * 6);
var flag;
switch (toggleflagpos) {
case 1:
Expand Down
6 changes: 3 additions & 3 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ protected function section_header($section, $course, $onsectionpage, $sectionret

$title = $this->courseformat->get_topcoll_section_name($course, $section, true);
if (($this->mobiletheme === false) && ($this->tablettheme === false)) {
$o .= $this->output->heading($title, 3, 'sectionname');
$o .= $this->output->heading($title, 3, 'section-title');
} else {
$o .= html_writer::tag('h3', $title); // Moodle H3's look bad on mobile / tablet with CT so use plain.
}
Expand Down Expand Up @@ -410,7 +410,7 @@ protected function section_header($section, $course, $onsectionpage, $sectionret
$hasnamesecpg = ($section->section == 0 && (string) $section->name !== '');

if ($hasnamesecpg) {
$o .= $this->output->heading($this->section_title($section, $course), 3, 'sectionname');
$o .= $this->output->heading($this->section_title($section, $course), 3, 'section-title');
}
$o .= html_writer::start_tag('div', array('class' => 'summary'));
$o .= $this->format_summary_text($section);
Expand Down Expand Up @@ -474,7 +474,7 @@ protected function section_hidden($section) {

$title = get_string('notavailable');
if (($this->mobiletheme === false) && ($this->tablettheme === false)) {
$o .= $this->output->heading($title, 3, 'sectionname');
$o .= $this->output->heading($title, 3, 'section-title');
} else {
$o .= html_writer::tag('h3', $title); // Moodle H3's look bad on mobile / tablet with CT so use plain.
}
Expand Down
1 change: 0 additions & 1 deletion settopcollpref.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@

// Get and set the value.
$value = required_topcoll_param('value', $USER->ajax_updatable_user_prefs[$name]);
error_log($name.' is before: '.$USER->ajax_updatable_user_prefs[$name].' after: '.$value);
// Update
if (!set_user_preference($name, $value)) {
print_error('errorsettinguserpref');
Expand Down
4 changes: 2 additions & 2 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ body.tablettheme .course-content ul.ctopics li.tcsection .content, body.tabletth
word-break: break-all;
}

.course-content ul.ctopics li.section .content .toggle a h3.sectionname,
.course-content ul.ctopics li.section .content.sectionhidden h3.sectionname {
.course-content ul.ctopics li.section .content .toggle a h3.section-title,
.course-content ul.ctopics li.section .content.sectionhidden h3.section-title {
margin: 4px;
}

Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
*/
defined('MOODLE_INTERNAL') || die();

$plugin->version = 2014041801;
$plugin->version = 2014041802;
$plugin->maturity = MATURITY_STABLE;
$plugin->requires = 2013111800.00; // 2.6 (Build: 20131118).
$plugin->component = 'format_topcoll';
$plugin->release = '2.6.1.6';
$plugin->release = '2.6.1.7';

0 comments on commit aa90590

Please sign in to comment.