From b06ac37acb97753b50c96f3f61ce1942de72e17e Mon Sep 17 00:00:00 2001
From: Tobias Baden <tobias.baden@stud.hs-hannover.de>
Date: Wed, 13 Jun 2018 17:09:46 +0200
Subject: [PATCH] HsH_Boostnavigation - Boost 3.5 - Changed styling and script
 to make it work again - ToDo: indent the courses

---
 amd/build/collapse.min.js |  2 +-
 amd/src/collapse.js       |  4 ----
 lib.php                   |  9 ++++-----
 locallib.php              |  2 +-
 settings.php              |  3 +--
 styles.css                | 12 ++++++++++--
 version.php               |  5 +++--
 7 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/amd/build/collapse.min.js b/amd/build/collapse.min.js
index ea67ff8..981fac1 100644
--- a/amd/build/collapse.min.js
+++ b/amd/build/collapse.min.js
@@ -1,2 +1,2 @@
-/*! 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)}}});
\ No newline at end of file
diff --git a/amd/src/collapse.js b/amd/src/collapse.js
index fa7b60f..bbceb57 100644
--- a/amd/src/collapse.js
+++ b/amd/src/collapse.js
@@ -19,7 +19,6 @@ define(['jquery'], function($) {
                         $('.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);
 
                     // If the parent node is currently collapsed.
@@ -48,7 +47,6 @@ define(['jquery'], function($) {
                     $('.list-group-item[data-parent-key=' + nodename + ']').attr("data-hidden", "1");
                     // Change the collapse attribute of the node itself to true.
                     node.attr("data-collapse", "1");
-                    // TODO User-Preferences setzen
                     //M.util.set_user_preference('local_hsh_boostnavigation-collapse_' + nodename + '_node', 1);
 
                     // If the parent node is currently collapsed.
@@ -59,7 +57,6 @@ define(['jquery'], function($) {
                     // Change the collapse attribute of the node itself to false.
                     node.attr("data-collapse", "0");
 
-                    // TODO User-Preferences setzen
                     //M.util.set_user_preference('local_hsh_boostnavigation-collapse_' + nodename + '_node', 0);
                 }
             }
@@ -67,7 +64,6 @@ define(['jquery'], function($) {
     }
 
     function initToggleNodes(nodename) {
-        // Sonst wäre das Array mit "" initialisiert -> Fehler
         if(nodesArray[0] === "") {
             nodesArray = new Array();
         }
diff --git a/lib.php b/lib.php
index f218055..0adabd0 100644
--- a/lib.php
+++ b/lib.php
@@ -4,8 +4,8 @@ include_once($CFG->dirroot . '/local/hsh_boostnavigation/locallib.php');
 
 function local_hsh_boostnavigation_extend_navigation(global_navigation $navigation) {
     global $CFG, $PAGE;
-    $collapsenodesforjs[] = "";
-    $semesterList[] = "";
+    $collapsenodesforjs[] = '';
+    $semesterList[] = '';
     $semesterKeys[] = '';
 
     // Settings übernahme
@@ -42,8 +42,8 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati
             $coursename = empty($CFG->navshowfullcoursenames) ? $shortname : $fullname;
             $string = $coursename;
 
-            $newCourse = navigation_node::create($string, new moodle_url('/course/view.php', array('id' => $course->id)), global_navigation::TYPE_COURSE, null, $string);
-	        $newCourse->add_class('m-l-2');
+            $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-3');
             $newCourse->showinflatnavigation = true;
             $semester->add_node($newCourse);
         }
@@ -52,7 +52,6 @@ function local_hsh_boostnavigation_extend_navigation(global_navigation $navigati
     if(!empty($semesterList)) {
         array_shift($semesterList);
         array_shift($semesterKeys);
-
         // Semesterlise sortieren, so dass "no-semester" unten ist
         arsort($semesterList);
         $unabhaengig = array_pop($semesterList);
diff --git a/locallib.php b/locallib.php
index 236adce..954fecb 100644
--- a/locallib.php
+++ b/locallib.php
@@ -10,7 +10,7 @@ function getSemesterNodeHsH(&$rootNode, $course, &$semesterList, &$semesterKeys)
     // Wenn Kurs kein Enddatum hat (Semesterunabhöngigkeit)
     $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
         $parent = $semesterList[array_search($unabhaengigKey, $semesterKeys)];
         // Knoten noch nicht vorhanden
diff --git a/settings.php b/settings.php
index 9e10a00..46fddb5 100644
--- a/settings.php
+++ b/settings.php
@@ -7,7 +7,6 @@ if ($hassiteconfig) {
     $page = new admin_settingpage('local_hsh_boostnavigation',
         get_string('pluginname', 'local_hsh_boostnavigation', null, true));
 
-
     if ($ADMIN->fulltree) {
         // 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',
@@ -37,7 +36,7 @@ if ($hassiteconfig) {
         $setting->set_updatedcallback('theme_reset_all_caches');
         $page->add($setting);
 
-        // Auswahl für die Semesterreihenfolge
+        // Auswahl für die Semesterreihenfolge - Semesterunabhängige Kurse
         $name = 'local_hsh_boostnavigation/settings_unabhaengigposition';
         $title = get_string('settings_unabhaengigposition', 'local_hsh_boostnavigation');
         $description = get_string('settings_unabhaengigposition_desc', 'local_hsh_boostnavigation');
diff --git a/styles.css b/styles.css
index 8e96f65..ee53421 100644
--- a/styles.css
+++ b/styles.css
@@ -1,14 +1,18 @@
 /* Add the icon for the expanded node state. */
 .jsenabled .list-group-item.semesternode[data-isexpandable="1"][data-collapse="0"] > div::after {
     content: url([[pix:i/dropdown]]);
-    float: right;
+    position: absolute;
     padding-left: 0.2rem;
+    top: .75rem;
+    right: .75rem;
 }
 /* Add the icon for the collapsed node state. */
 .jsenabled .list-group-item.semesternode[data-isexpandable="1"][data-collapse="1"] > div::after {
     content: url([[pix:t/collapsed]]);
-    float: right;
+    position: absolute;
     padding-left: 0.2rem;
+    top: .75rem;
+    right: .75rem;
 }
 /* Set the cursor for the collapsible nodes. */
 .jsenabled .list-group-item .semesternode[data-isexpandable="1"] {
@@ -25,4 +29,8 @@
 
 .semesternode {
     cursor: pointer;
+}
+
+.list-group-item[data-hidden="1"] {
+    display: none; 
 }
\ No newline at end of file
diff --git a/version.php b/version.php
index 6f26082..536a0cf 100644
--- a/version.php
+++ b/version.php
@@ -25,8 +25,9 @@
 defined('MOODLE_INTERNAL') || die();
 
 $plugin->component = 'local_hsh_boostnavigation';
-$plugin->version = 2018030802;
-$plugin->release = 'v0.7.3';
+$plugin->version = 2018061300;
+$plugin->release = 'v1.1-r1';
+
 $plugin->requires = 2016120500;
 #$plugin->maturity = MATURITY_STABLE;
 $plugin->dependencies = array('theme_boost' => 2016120500,
-- 
GitLab