Skip to content

Commit

Permalink
V3.0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Oct 30, 2015
1 parent 491eccc commit 8b95eb2
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 28 deletions.
16 changes: 10 additions & 6 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ If you find an issue with the format, please see the 'Reporting Issues' section

Required version of Moodle
==========================
This version works with Moodle version 2015051100.00 2.9 (Build: 20150511) and above within the 2.9 branch until the
This version works with Moodle version 2015102800.00 3.0beta+ (Build: 20151028) and above within the 3.0 branch until the
next release.

Please ensure that your hardware and software complies with 'Requirements' in 'Installing Moodle' on
'docs.moodle.org/29/en/Installing_Moodle'.
'docs.moodle.org/30/en/Installing_Moodle'.

Downloads and documentation
===========================
The primary source for downloading this branch of the format is https://moodle.org/plugins/view.php?plugin=format_topcoll
with 'Select Moodle version:' set at 'Moodle 2.9'.
with 'Select Moodle version:' set at 'Moodle 3.0'.

The secondary source is a tagged version with the v2.9 prefix on https://github.com/gjb2048/moodle-format_topcoll/tags
The secondary source is a tagged version with the v3.0 prefix on https://github.com/gjb2048/moodle-format_topcoll/tags

If you download from the development area - https://github.com/gjb2048/moodle-format_topcoll/ - consider that
the code is unstable and not for use in production environments. This is because I develop the next version in stages
Expand Down Expand Up @@ -56,9 +56,9 @@ Flattr - https://flattr.com/profile/gjb2048

Sponsorships may allow me to provide you with more or better features in less time.

New features for this Moodle 2.9 version
New features for this Moodle 3.0 version
========================================
1. Same features as version 2.8.2.3 in Moodle 2.8.
1. Same features as version 2.9.1.5 in Moodle 2.9.

Installation
============
Expand Down Expand Up @@ -246,6 +246,10 @@ can be really useful in visualising the issue along with any files you consider

Version Information
===================
Version 3.0.0.1
1. First 'beta' version for M3.0.
2. Apply MDL-48947, MDL-51250 and MDL-51610.

Version 2.9.1.5
1. Fixed 'Strict standards warning shown when using collapsed topics format' - CONTRIB-5974.
2. Fixed iconset issue when editing the course settings.
Expand Down
3 changes: 2 additions & 1 deletion format.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ M.course.format.process_sections = function(Y, sectionlist, response, sectionfro

for (var i = sectionfrom; i <= sectionto; i++) {
// Update section title.
sectionlist.item(i).one(CSS.SECTIONNAME).setContent(response.sectiontitles[i]);
var content = Y.Node.create('<span>' + response.sectiontitles[i] + '</span>');
sectionlist.item(i).all('.'+CSS.SECTIONNAME).setHTML(content);
// If the left content section number exists, then set it.
leftcontent = sectionlist.item(i).one(SELECTORS.LEFTCONTENT);
if (leftcontent) { // Only set if the section number is shown otherwise JS crashes and stops working.
Expand Down
2 changes: 2 additions & 0 deletions lang/en/format_topcoll.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
$string['hidefromothers'] = 'Hide section';
$string['showfromothers'] = 'Show section';
$string['currentsection'] = 'This section';
$string['editsection'] = 'Edit section';
$string['deletesection'] = 'Delete section';
// These are 'topic' as they are only shown in 'topic' based structures.
$string['markedthissection'] = 'This topic is highlighted as the current topic';
$string['markthissection'] = 'Highlight this topic as the current topic';
Expand Down
12 changes: 12 additions & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ public function get_section_name($section) {
return $this->get_topcoll_section_name($course, $section, false);
}

/**
* Returns the default section name for the format.
*
* @param stdClass $section Section object from database or just field course_sections section
* @return string The default value for the section name.
*/
public function get_default_section_name($section) {
/* Follow the same logic so that this method is supported. The MDL-51610 enchancement refactored things,
but that is not appropriate for us. */
return $this->get_section_name($section);
}

/**
* Gets the name for the provided course, section and state if need to add addional text.
*
Expand Down
52 changes: 35 additions & 17 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct(moodle_page $page, $target) {
$this->togglelib = new topcoll_togglelib;
$this->courseformat = course_get_format($page->course); // Needed for collapsed topics settings retrieval.

/* Since format_topcoll_renderer::section_edit_controls() only displays the 'Set current section' control when editing
/* Since format_topcoll_renderer::section_edit_control_items() only displays the 'Set current section' control when editing
mode is on we need to be sure that the link 'Turn editing mode on' is available for a user who does not have any
other managing capability. */
$page->set_other_editing_capability('moodle/course:setcurrentsection');
Expand Down Expand Up @@ -137,9 +137,9 @@ protected function section_right_content($section, $course, $onsectionpage) {
$o = '';

if ($section->section != 0) {
$controls = $this->section_edit_controls($course, $section, $onsectionpage);
$controls = $this->section_edit_control_items($course, $section, $onsectionpage);
if (!empty($controls)) {
$o .= implode('', $controls); // No 'br' as done in styles.css with a 'display:block' so will not have to many of them when the up arrow is removed by JS.
$o .= $this->section_edit_control_menu($controls, $course, $section);
} else {
if (empty($this->tcsettings)) {
$this->tcsettings = $this->courseformat->get_settings();
Expand Down Expand Up @@ -209,7 +209,7 @@ protected function section_left_content($section, $course, $onsectionpage) {
* @param bool $onsectionpage true if being printed on a section page
* @return array of links with edit controls
*/
protected function section_edit_controls($course, $section, $onsectionpage = false) {
protected function section_edit_control_items($course, $section, $onsectionpage = false) {

if (!$this->userisediting) {
return array();
Expand All @@ -231,25 +231,43 @@ protected function section_edit_controls($course, $section, $onsectionpage = fal
if ((($this->tcsettings['layoutstructure'] == 1) || ($this->tcsettings['layoutstructure'] == 4)) &&
has_capability('moodle/course:setcurrentsection', $coursecontext)) {
if ($course->marker == $section->section) { // Show the "light globe" on/off.
$strmarkedthissection = get_string('markedthissection', 'format_topcoll');
$url->param('marker', 0);
$controls[] = html_writer::link($url, html_writer::empty_tag('img',
array('src' => $this->output->pix_url('i/marked'),
'class' => 'icon ', 'alt' => $strmarkedthissection)),
array('title' => $strmarkedthissection,
'class' => 'editing_highlight'));
$markedthissection = get_string('markedthissection', 'format_topcoll');
$highlightoff = get_string('highlightoff');
$controls['highlight'] = array('url' => $url, "icon" => 'i/marked',
'name' => $highlightoff,
'pixattr' => array('class' => '', 'alt' => $markedthissection),
'attr' => array('class' => 'editing_highlight', 'title' => $markedthissection));
} else {
$strmarkthissection = get_string('markthissection', 'format_topcoll');
$url->param('marker', $section->section);
$controls[] = html_writer::link($url, html_writer::empty_tag('img',
array('src' => $this->output->pix_url('i/marker'),
'class' => 'icon', 'alt' => $strmarkthissection)),
array('title' => $strmarkthissection,
'class' => 'editing_highlight'));
$markthissection = get_string('markthissection', 'format_topcoll');
$highlight = get_string('highlight');
$controls['highlight'] = array('url' => $url, "icon" => 'i/marker',
'name' => $highlight,
'pixattr' => array('class' => '', 'alt' => $markthissection),
'attr' => array('class' => 'editing_highlight', 'title' => $markthissection));
}
}

return array_merge($controls, parent::section_edit_controls($course, $section, $onsectionpage));
$parentcontrols = parent::section_edit_control_items($course, $section, $onsectionpage);

// If the edit key exists, we are going to insert our controls after it.
if (array_key_exists("edit", $parentcontrols)) {
$merged = array();
// We can't use splice because we are using associative arrays.
// Step through the array and merge the arrays.
foreach ($parentcontrols as $key => $action) {
$merged[$key] = $action;
if ($key == "edit") {
// If we have come to the edit key, merge these controls here.
$merged = array_merge($merged, $controls);
}
}

return $merged;
} else {
return array_merge($controls, $parentcontrols);
}
}

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

$plugin->version = 2015062205;
$plugin->maturity = MATURITY_STABLE;
$plugin->requires = 2015051100.00; // 2.9 (Build: 20150511).
$plugin->version = 2015103000;
$plugin->maturity = MATURITY_BETA;
$plugin->requires = 2015102800.00; // 3.0beta+ (Build: 20151028).
$plugin->component = 'format_topcoll';
$plugin->release = '2.9.1.5';
$plugin->release = '3.0.0.1';

0 comments on commit 8b95eb2

Please sign in to comment.