Skip to content
Snippets Groups Projects
Commit b06ac37a authored by Tobias Baden's avatar Tobias Baden
Browse files

HsH_Boostnavigation - Boost 3.5

- Changed styling and script to make it work again
- ToDo: indent the courses
parent 90b7f27a
No related branches found
No related tags found
No related merge requests found
/*! hsh_boostnavigation 2018-03-08 */ /*! hsh_boostnavigation 2018-06-11 */
define(["jquery"],function(a){"use strict";function b(b,c){b.click(function(d){d.preventDefault(),"mycourses"==c?0==b.attr("data-collapse")?e.forEach(function(b){a(".list-group-item[data-key="+b+"]").attr("data-collapse","1"),a(".list-group-item[data-key="+b+"]").attr("data-hidden","0")}):1==b.attr("data-collapse")&&(e.forEach(function(b){a(".list-group-item[data-parent-key="+b+"]").attr("data-hidden","1"),a(".list-group-item[data-parent-key="+b+"]").attr("data-collapse","1")}),e.forEach(function(b){a(".list-group-item[data-key="+b+"]").attr("data-collapse","1"),a(".list-group-item[data-key="+b+"]").attr("data-hidden","1")})):0==b.attr("data-collapse")?(a(".list-group-item[data-parent-key="+c+"]").attr("data-hidden","1"),b.attr("data-collapse","1")):1==b.attr("data-collapse")&&(a(".list-group-item[data-parent-key="+c+"]").attr("data-hidden","0"),b.attr("data-collapse","0"))})}function c(c){""===e[0]&&(e=new Array);var d=a('.list-group-item[data-key="'+c+'"]');if("mycourses"===c?d.attr("data-collapse","0"):d.attr("data-collapse","1"),""!==c&&"mycourses"!==c){d.addClass("list-group-item-action semesternode"),d.attr("data-isexpandable","1");var f=a(".list-group-item[data-parent-key="+c+"]");f.attr("data-hidden","1"),f.attr("data-collapse","1"),e.includes(c)||e.push(c)}b(d,c)}function d(b){var c=a('.list-group-item[data-key="'+b+'"]');c.attr("data-hidden","0"),c.attr("data-collapse","0"),a(".list-group-item[data-parent-key="+b+"]").attr("data-hidden","0"),a(".list-group-item[data-parent-key="+b+"]").attr("data-collapse","0")}var e=[];return{init:function(a){for(var b=0,d=a.length;b<d;b++)c(a[b])},openSemester:function(a){d(a)}}}); define(["jquery"],function(a){"use strict";function b(b,c){b.click(function(d){d.preventDefault(),"mycourses"==c?0==b.attr("data-collapse")?e.forEach(function(b){a(".list-group-item[data-key="+b+"]").attr("data-collapse","1"),a(".list-group-item[data-key="+b+"]").attr("data-hidden","0")}):1==b.attr("data-collapse")&&(e.forEach(function(b){a(".list-group-item[data-parent-key="+b+"]").attr("data-hidden","1"),a(".list-group-item[data-parent-key="+b+"]").attr("data-collapse","1")}),e.forEach(function(b){a(".list-group-item[data-key="+b+"]").attr("data-collapse","1"),a(".list-group-item[data-key="+b+"]").attr("data-hidden","1")})):0==b.attr("data-collapse")?(a(".list-group-item[data-parent-key="+c+"]").attr("data-hidden","1"),b.attr("data-collapse","1")):1==b.attr("data-collapse")&&(a(".list-group-item[data-parent-key="+c+"]").attr("data-hidden","0"),b.attr("data-collapse","0"))})}function c(c){""===e[0]&&(e=new Array);var d=a('.list-group-item[data-key="'+c+'"]');if("mycourses"===c?d.attr("data-collapse","0"):d.attr("data-collapse","1"),""!==c&&"mycourses"!==c){d.addClass("list-group-item-action semesternode"),d.attr("data-isexpandable","1");var f=a(".list-group-item[data-parent-key="+c+"]");f.attr("data-hidden","1"),f.attr("data-collapse","1"),e.includes(c)||e.push(c)}b(d,c)}function d(b){var c=a('.list-group-item[data-key="'+b+'"]');c.attr("data-hidden","0"),c.attr("data-collapse","0"),a(".list-group-item[data-parent-key="+b+"]").attr("data-hidden","0"),a(".list-group-item[data-parent-key="+b+"]").attr("data-collapse","0")}var e=[];return{init:function(a){for(var b=0,d=a.length;b<d;b++)c(a[b])},openSemester:function(a){d(a)}}});
\ No newline at end of file
...@@ -19,7 +19,6 @@ define(['jquery'], function($) { ...@@ -19,7 +19,6 @@ define(['jquery'], function($) {
$('.list-group-item[data-key=' + semster + ']').attr("data-hidden", "0"); $('.list-group-item[data-key=' + semster + ']').attr("data-hidden", "0");
}); });
// TODO User-Preferences setzen
//M.util.set_user_preference('local_hsh_boostnavigation-collapse_' + nodename + '_node', 1); //M.util.set_user_preference('local_hsh_boostnavigation-collapse_' + nodename + '_node', 1);
// If the parent node is currently collapsed. // If the parent node is currently collapsed.
...@@ -48,7 +47,6 @@ define(['jquery'], function($) { ...@@ -48,7 +47,6 @@ define(['jquery'], function($) {
$('.list-group-item[data-parent-key=' + nodename + ']').attr("data-hidden", "1"); $('.list-group-item[data-parent-key=' + nodename + ']').attr("data-hidden", "1");
// Change the collapse attribute of the node itself to true. // Change the collapse attribute of the node itself to true.
node.attr("data-collapse", "1"); node.attr("data-collapse", "1");
// TODO User-Preferences setzen
//M.util.set_user_preference('local_hsh_boostnavigation-collapse_' + nodename + '_node', 1); //M.util.set_user_preference('local_hsh_boostnavigation-collapse_' + nodename + '_node', 1);
// If the parent node is currently collapsed. // If the parent node is currently collapsed.
...@@ -59,7 +57,6 @@ define(['jquery'], function($) { ...@@ -59,7 +57,6 @@ define(['jquery'], function($) {
// Change the collapse attribute of the node itself to false. // Change the collapse attribute of the node itself to false.
node.attr("data-collapse", "0"); node.attr("data-collapse", "0");
// TODO User-Preferences setzen
//M.util.set_user_preference('local_hsh_boostnavigation-collapse_' + nodename + '_node', 0); //M.util.set_user_preference('local_hsh_boostnavigation-collapse_' + nodename + '_node', 0);
} }
} }
...@@ -67,7 +64,6 @@ define(['jquery'], function($) { ...@@ -67,7 +64,6 @@ define(['jquery'], function($) {
} }
function initToggleNodes(nodename) { function initToggleNodes(nodename) {
// Sonst wäre das Array mit "" initialisiert -> Fehler
if(nodesArray[0] === "") { if(nodesArray[0] === "") {
nodesArray = new Array(); nodesArray = new Array();
} }
......
...@@ -4,8 +4,8 @@ include_once($CFG->dirroot . '/local/hsh_boostnavigation/locallib.php'); ...@@ -4,8 +4,8 @@ include_once($CFG->dirroot . '/local/hsh_boostnavigation/locallib.php');
function local_hsh_boostnavigation_extend_navigation(global_navigation $navigation) { function local_hsh_boostnavigation_extend_navigation(global_navigation $navigation) {
global $CFG, $PAGE; global $CFG, $PAGE;
$collapsenodesforjs[] = ""; $collapsenodesforjs[] = '';
$semesterList[] = ""; $semesterList[] = '';
$semesterKeys[] = ''; $semesterKeys[] = '';
// Settings übernahme // Settings übernahme
...@@ -42,8 +42,8 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati ...@@ -42,8 +42,8 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati
$coursename = empty($CFG->navshowfullcoursenames) ? $shortname : $fullname; $coursename = empty($CFG->navshowfullcoursenames) ? $shortname : $fullname;
$string = $coursename; $string = $coursename;
$newCourse = navigation_node::create($string, new moodle_url('/course/view.php', array('id' => $course->id)), global_navigation::TYPE_COURSE, null, $string); $newCourse = navigation_node::create($string, new moodle_url('/course/view.php', array('id' => $course->id)), global_navigation::TYPE_COURSE, null, $string, new pix_icon('i/course', 'grades'));
$newCourse->add_class('m-l-2'); $newCourse->add_class('m-l-3');
$newCourse->showinflatnavigation = true; $newCourse->showinflatnavigation = true;
$semester->add_node($newCourse); $semester->add_node($newCourse);
} }
...@@ -52,7 +52,6 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati ...@@ -52,7 +52,6 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati
if(!empty($semesterList)) { if(!empty($semesterList)) {
array_shift($semesterList); array_shift($semesterList);
array_shift($semesterKeys); array_shift($semesterKeys);
// Semesterlise sortieren, so dass "no-semester" unten ist // Semesterlise sortieren, so dass "no-semester" unten ist
arsort($semesterList); arsort($semesterList);
$unabhaengig = array_pop($semesterList); $unabhaengig = array_pop($semesterList);
......
...@@ -10,7 +10,7 @@ function getSemesterNodeHsH(&$rootNode, $course, &$semesterList, &$semesterKeys) ...@@ -10,7 +10,7 @@ function getSemesterNodeHsH(&$rootNode, $course, &$semesterList, &$semesterKeys)
// Wenn Kurs kein Enddatum hat (Semesterunabhöngigkeit) // Wenn Kurs kein Enddatum hat (Semesterunabhöngigkeit)
$startday = getFirstDayOfSem($course->startdate); $startday = getFirstDayOfSem($course->startdate);
if($startday == 0) { if($startday <= 0) {
// Im Array suchen, ob der Knoten für die Semesterunabhängigen Kurse schon vorhanden ist // Im Array suchen, ob der Knoten für die Semesterunabhängigen Kurse schon vorhanden ist
$parent = $semesterList[array_search($unabhaengigKey, $semesterKeys)]; $parent = $semesterList[array_search($unabhaengigKey, $semesterKeys)];
// Knoten noch nicht vorhanden // Knoten noch nicht vorhanden
......
...@@ -7,7 +7,6 @@ if ($hassiteconfig) { ...@@ -7,7 +7,6 @@ if ($hassiteconfig) {
$page = new admin_settingpage('local_hsh_boostnavigation', $page = new admin_settingpage('local_hsh_boostnavigation',
get_string('pluginname', 'local_hsh_boostnavigation', null, true)); get_string('pluginname', 'local_hsh_boostnavigation', null, true));
if ($ADMIN->fulltree) { if ($ADMIN->fulltree) {
// Default-Settings auf 0 da ein aktueller Bug besteht, der die Default-Settings nicht übernimmt. // Default-Settings auf 0 da ein aktueller Bug besteht, der die Default-Settings nicht übernimmt.
$setting = new admin_setting_configtext('local_hsh_boostnavigation/settings_nodescount', $setting = new admin_setting_configtext('local_hsh_boostnavigation/settings_nodescount',
...@@ -37,7 +36,7 @@ if ($hassiteconfig) { ...@@ -37,7 +36,7 @@ if ($hassiteconfig) {
$setting->set_updatedcallback('theme_reset_all_caches'); $setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting); $page->add($setting);
// Auswahl für die Semesterreihenfolge // Auswahl für die Semesterreihenfolge - Semesterunabhängige Kurse
$name = 'local_hsh_boostnavigation/settings_unabhaengigposition'; $name = 'local_hsh_boostnavigation/settings_unabhaengigposition';
$title = get_string('settings_unabhaengigposition', 'local_hsh_boostnavigation'); $title = get_string('settings_unabhaengigposition', 'local_hsh_boostnavigation');
$description = get_string('settings_unabhaengigposition_desc', 'local_hsh_boostnavigation'); $description = get_string('settings_unabhaengigposition_desc', 'local_hsh_boostnavigation');
......
/* Add the icon for the expanded node state. */ /* Add the icon for the expanded node state. */
.jsenabled .list-group-item.semesternode[data-isexpandable="1"][data-collapse="0"] > div::after { .jsenabled .list-group-item.semesternode[data-isexpandable="1"][data-collapse="0"] > div::after {
content: url([[pix:i/dropdown]]); content: url([[pix:i/dropdown]]);
float: right; position: absolute;
padding-left: 0.2rem; padding-left: 0.2rem;
top: .75rem;
right: .75rem;
} }
/* Add the icon for the collapsed node state. */ /* Add the icon for the collapsed node state. */
.jsenabled .list-group-item.semesternode[data-isexpandable="1"][data-collapse="1"] > div::after { .jsenabled .list-group-item.semesternode[data-isexpandable="1"][data-collapse="1"] > div::after {
content: url([[pix:t/collapsed]]); content: url([[pix:t/collapsed]]);
float: right; position: absolute;
padding-left: 0.2rem; padding-left: 0.2rem;
top: .75rem;
right: .75rem;
} }
/* Set the cursor for the collapsible nodes. */ /* Set the cursor for the collapsible nodes. */
.jsenabled .list-group-item .semesternode[data-isexpandable="1"] { .jsenabled .list-group-item .semesternode[data-isexpandable="1"] {
...@@ -26,3 +30,7 @@ ...@@ -26,3 +30,7 @@
.semesternode { .semesternode {
cursor: pointer; cursor: pointer;
} }
.list-group-item[data-hidden="1"] {
display: none;
}
\ No newline at end of file
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$plugin->component = 'local_hsh_boostnavigation'; $plugin->component = 'local_hsh_boostnavigation';
$plugin->version = 2018030802; $plugin->version = 2018061300;
$plugin->release = 'v0.7.3'; $plugin->release = 'v1.1-r1';
$plugin->requires = 2016120500; $plugin->requires = 2016120500;
#$plugin->maturity = MATURITY_STABLE; #$plugin->maturity = MATURITY_STABLE;
$plugin->dependencies = array('theme_boost' => 2016120500, $plugin->dependencies = array('theme_boost' => 2016120500,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment