Skip to content

Commit

Permalink
V2.7.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Sep 21, 2014
1 parent 5b370f2 commit 710934e
Show file tree
Hide file tree
Showing 9 changed files with 412 additions and 69 deletions.
8 changes: 7 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ can be really useful in visualising the issue along with any files you consider

Version Information
===================
20th September 2014 Version 2.7.1.5
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.
3. Added the ability to set the size of the toggle icon site wide as: Small = 16px, Medium = 24px and Large = 32px.
4. Added the ability to set each corner of the toggle border radius site wide between 0.0 and 4.0em in increments of 0.1.

19th August 2014 Version 2.7.1.4
1. Fixed issue #11: Moodle notice - https://github.com/gjb2048/moodle-format_topcoll/issues/11.

Expand Down Expand Up @@ -1120,6 +1126,6 @@ Desired Enhancements

Me
==
G J Barnard MSc. BSc(Hons)(Sndw). MBCS. CEng. CITP. PGCE. - 19th August 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
31 changes: 28 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 Expand Up @@ -205,7 +211,26 @@
}
<?php
}
// Site wide configuration Site Administration -> Plugins -> Course formats -> Collapsed Topics.
$tcborderradiustl = clean_param(get_config('format_topcoll', 'defaulttoggleborderradiustl'), PARAM_TEXT);
$tcborderradiustr = clean_param(get_config('format_topcoll', 'defaulttoggleborderradiustr'), PARAM_TEXT);
$tcborderradiusbr = clean_param(get_config('format_topcoll', 'defaulttoggleborderradiusbr'), PARAM_TEXT);
$tcborderradiusbl = clean_param(get_config('format_topcoll', 'defaulttoggleborderradiusbl'), PARAM_TEXT);
?>
.course-content ul.ctopics li.section .content .toggle, .course-content ul.ctopics li.section .content.sectionhidden {
-moz-border-top-left-radius: <?php echo $tcborderradiustl ?>em;
-webkit-border-top-left-radius: <?php echo $tcborderradiustl ?>em;
border-top-left-radius: <?php echo $tcborderradiustl ?>em;
-moz-border-top-right-radius: <?php echo $tcborderradiustr ?>em;
-webkit-border-top-right-radius: <?php echo $tcborderradiustr ?>em;
border-top-right-radius: <?php echo $tcborderradiustr ?>em;
-moz-border-bottom-right-radius: <?php echo $tcborderradiusbr ?>em;
-webkit-border-bottom-right-radius: <?php echo $tcborderradiusbr ?>em;
border-bottom-right-radius: <?php echo $tcborderradiusbr ?>em;
-moz-border-bottom-left-radius: <?php echo $tcborderradiusbl ?>em;
-webkit-border-bottom-left-radius: <?php echo $tcborderradiusbl ?>em;
border-bottom-left-radius: <?php echo $tcborderradiusbl ?>em;
}
/* ]]> */
</style>
<?php
Expand Down
108 changes: 85 additions & 23 deletions lang/en/format_topcoll.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,17 @@
$string['resettoggleiconset_help'] = 'Resets the toggle icon set and toggle all hover to the default values so it will be the same as a course the first time it is in the Collapsed Topics format.';
$string['resetalltoggleiconset_help'] = 'Resets the toggle icon set and toggle all hover to the default values for all courses so it will be the same as a course the first time it is in the Collapsed Topics format.';

// Site Administration -> Plugins -> Course formats -> Collapsed Topics or Manage course formats - Settings.
// Site Administration -> Plugins -> Course formats -> Collapsed Topics.
$string['defaultheadingsub'] = 'Defaults';
$string['defaultheadingsubdesc'] = 'Default settings';
$string['configurationheadingsub'] = 'Configuration';
$string['configurationheadingsubdesc'] = 'Configuration settings';

$string['off'] = 'Off';
$string['on'] = 'On';
$string['defaultcoursedisplay'] = 'Course display default';
$string['defaultcoursedisplay'] = 'Course display';
$string['defaultcoursedisplay_desc'] = "Either show all the sections on a single page or section zero and the chosen section on page.";
$string['defaultlayoutelement'] = 'Default layout configuration';
$string['defaultlayoutelement'] = 'Layout';
// Negative view of layout, kept for previous versions until such time as they are updated.
$string['defaultlayoutelement_desc'] = "The layout setting can be one of:
Expand Down Expand Up @@ -239,7 +244,7 @@
No additions.";

$string['defaultlayoutstructure'] = 'Default structure configuration';
$string['defaultlayoutstructure'] = 'Structure configuration';
$string['defaultlayoutstructure_desc'] = "The structure setting can be one of:
Topic
Expand All @@ -252,35 +257,28 @@
Day";

$string['defaultlayoutcolumns'] = 'Default number of columns';
$string['defaultlayoutcolumns'] = 'Number of columns';
$string['defaultlayoutcolumns_desc'] = "Number of columns between one and four.";

$string['defaultlayoutcolumnorientation'] = 'Default column orientation';
$string['defaultlayoutcolumnorientation'] = 'Column orientation';
$string['defaultlayoutcolumnorientation_desc'] = "The default column orientation: Vertical or Horizontal.";

$string['defaulttgfgcolour'] = 'Default toggle foreground colour';
$string['defaulttgfgcolour'] = 'Toggle foreground colour';
$string['defaulttgfgcolour_desc'] = "Toggle foreground colour in hexidecimal RGB.";

$string['defaulttgfghvrcolour'] = 'Default toggle foreground hover colour';
$string['defaulttgfghvrcolour'] = 'Toggle foreground hover colour';
$string['defaulttgfghvrcolour_desc'] = "Toggle foreground hover colour in hexidecimal RGB.";

$string['defaulttgbgcolour'] = 'Default toggle background colour';
$string['defaulttgbgcolour'] = 'Toggle background colour';
$string['defaulttgbgcolour_desc'] = "Toggle background colour in hexidecimal RGB.";

$string['defaulttgbghvrcolour'] = 'Default toggle background hover colour';
$string['defaulttgbghvrcolour'] = 'Toggle background hover colour';
$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.
Note: If turning persistence off 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.";

$string['defaulttogglealignment'] = 'Default toggle text alignment';
$string['defaulttogglealignment'] = 'Toggle text alignment';
$string['defaulttogglealignment_desc'] = "'Left', 'Centre' or 'Right'.";

$string['defaulttoggleiconset'] = 'Default toggle icon set';
$string['defaulttoggleiconset'] = 'Toggle icon set';
$string['defaulttoggleiconset_desc'] = "'Arrow' => Arrow icon set.
'Bulb' => Bulb icon set.
Expand All @@ -305,12 +303,76 @@
'Switch' => Switch icon set.";

$string['defaulttoggleallhover'] = 'Default toggle all icon hovers';
$string['defaulttoggleallhover'] = 'Toggle all icon hovers';
$string['defaulttoggleallhover_desc'] = "'No' or 'Yes'.";

// Default user preference.
$string['defaultuserpreference'] = 'What to do with the toggles when the user first accesses the course or adds more sections';
$string['defaultuserpreference_desc'] = 'States what to do with the toggles when the user first accesses the course or the state of additional sections when they are added.';
$string['defaulttogglepersistence'] = 'Toggle persistence';
$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: 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. This is to save space if you do not intend to turn it back on.";

$string['defaultuserpreference'] = 'What to do with the toggles when the user first accesses the course, adds more sections or toggle peristence is off';
$string['defaultuserpreference_desc'] = 'States what to do with the toggles when the user first accesses the course, the state of additional sections when they are added or toggle persistence id off.';

// Toggle icon size.
$string['defaulttoggleiconsize'] = 'Toggle icon size';
$string['defaulttoggleiconsize_desc'] = "Icon size: Small = 16px, Medium = 24px and Large = 32px.";
$string['small'] = 'Small';
$string['medium'] = 'Medium';
$string['large'] = 'Large';

// Toggle border radius.
$string['defaulttoggleborderradiustl'] = 'Toggle top left border radius';
$string['defaulttoggleborderradiustl_desc'] = 'Border top left radius of the toggle.';
$string['defaulttoggleborderradiustr'] = 'Toggle top right border radius';
$string['defaulttoggleborderradiustr_desc'] = 'Border top right radius of the toggle.';
$string['defaulttoggleborderradiusbr'] = 'Toggle bottom right border radius';
$string['defaulttoggleborderradiusbr_desc'] = 'Border bottom right radius of the toggle.';
$string['defaulttoggleborderradiusbl'] = 'Toggle bottom left border radius';
$string['defaulttoggleborderradiusbl_desc'] = 'Border bottom left radius of the toggle.';
$string['em0_0'] = '0.0em';
$string['em0_1'] = '0.1em';
$string['em0_2'] = '0.2em';
$string['em0_3'] = '0.3em';
$string['em0_4'] = '0.4em';
$string['em0_5'] = '0.5em';
$string['em0_6'] = '0.6em';
$string['em0_7'] = '0.7em';
$string['em0_8'] = '0.8em';
$string['em0_9'] = '0.9em';
$string['em1_0'] = '1.0em';
$string['em1_1'] = '1.1em';
$string['em1_2'] = '1.2em';
$string['em1_3'] = '1.3em';
$string['em1_4'] = '1.4em';
$string['em1_5'] = '1.5em';
$string['em1_6'] = '1.6em';
$string['em1_7'] = '1.7em';
$string['em1_8'] = '1.8em';
$string['em1_9'] = '1.9em';
$string['em2_0'] = '2.0em';
$string['em2_1'] = '2.1em';
$string['em2_2'] = '2.2em';
$string['em2_3'] = '2.3em';
$string['em2_4'] = '2.4em';
$string['em2_5'] = '2.5em';
$string['em2_6'] = '2.6em';
$string['em2_7'] = '2.7em';
$string['em2_8'] = '2.8em';
$string['em2_9'] = '2.9em';
$string['em3_0'] = '3.0em';
$string['em3_1'] = '3.1em';
$string['em3_2'] = '3.2em';
$string['em3_3'] = '3.3em';
$string['em3_4'] = '3.4em';
$string['em3_5'] = '3.5em';
$string['em3_6'] = '3.6em';
$string['em3_7'] = '3.7em';
$string['em3_8'] = '3.8em';
$string['em3_9'] = '3.9em';
$string['em4_0'] = '4.0em';

// Capabilities.
$string['topcoll:changelayout'] = 'Change or reset the layout';
Expand Down
3 changes: 1 addition & 2 deletions module.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ M.format_topcoll.init = function(Y, theCourseId, theToggleState, theNumSections,
// IE8 - humm!
var bodyNode = Y.one(document.body);
M.format_topcoll.ie8 = bodyNode.hasClass('ie8');

if (this.togglestate !== null) {
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
14 changes: 8 additions & 6 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class format_topcoll_renderer extends format_section_renderer_base {
private $togglelib;
private $isoldtogglepreference = false;
private $userisediting = false;
private $tctoggleiconsize;

/**
* Constructor method, calls the parent constructor - MDL-21097
Expand All @@ -69,6 +70,7 @@ public function __construct(moodle_page $page, $target) {

global $PAGE;
$this->userisediting = $PAGE->user_is_editing();
$this->tctoggleiconsize = clean_param(get_config('format_topcoll', 'defaulttoggleiconsize'), PARAM_TEXT);
}

/**
Expand Down Expand Up @@ -372,7 +374,7 @@ protected function section_header($section, $course, $onsectionpage, $sectionret
$toggleclass = 'toggle_closed';
$sectionclass = '';
}
$toggleclass .= ' the_toggle';
$toggleclass .= ' the_toggle '.$this->tctoggleiconsize;
$toggleurl = new moodle_url('/course/view.php', array('id' => $course->id));
$o .= html_writer::start_tag('a', array('class' => $toggleclass, 'href' => $toggleurl));

Expand All @@ -382,7 +384,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)) || ($this->userisediting)) {
$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 +412,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 @@ -473,7 +475,7 @@ protected function section_hidden($section, $courseorid = null) {

$title = get_string('notavailable');
if ((($this->mobiletheme === false) && ($this->tablettheme === false)) || ($this->userisediting)) {
$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 @@ -838,9 +840,9 @@ protected function toggle_all() {
$o .= html_writer::start_tag('div', array('class' => 'sectionbody'.$iconsetclass));
$o .= html_writer::start_tag('h4', null);
$o .= html_writer::tag('a', get_string('topcollopened', 'format_topcoll'),
array('class' => 'on', 'href' => '#', 'id' => 'toggles-all-opened'));
array('class' => 'on '.$this->tctoggleiconsize, 'href' => '#', 'id' => 'toggles-all-opened'));
$o .= html_writer::tag('a', get_string('topcollclosed', 'format_topcoll'),
array('class' => 'off', 'href' => '#', 'id' => 'toggles-all-closed'));
array('class' => 'off '.$this->tctoggleiconsize, 'href' => '#', 'id' => 'toggles-all-closed'));
$o .= html_writer::end_tag('h4');
$o .= html_writer::end_tag('div');
$o .= html_writer::end_tag('div');
Expand Down
Loading

0 comments on commit 710934e

Please sign in to comment.