Index: /de/navigation.xml
===================================================================
--- /de/navigation.xml (revision 925)
+++ /de/navigation.xml (revision 926)
@@ -45,9 +45,9 @@
-
@@ -245,5 +245,5 @@
Informationen für Lehrer
- Robotik-Workshop
+ Robotik-Workshop
Index: /lib/menu.php
===================================================================
--- /lib/menu.php (revision 925)
+++ /lib/menu.php (revision 926)
@@ -229,4 +229,11 @@
$e[$attribute_name] = (self::dom_has_attribute($e, $attribute_name) ? ($e[$attribute_name].$seperator) : '') . $content;
}
+
+ public static function dom_attribute_contains($simplexml_element, $attribute_name, $needle) {
+ if(isset($simplexml_element[$attribute_name])) {
+ return strpos((string)$simplexml_element[$attribute_name], $needle) !== false;
+ } else
+ return false;
+ }
/**
@@ -354,19 +361,27 @@
$sidebar = $xml[0];
+ // nur Sidebar-Links kriegen eine Relation aufgeloest
$return = array();
- $current_a = $sidebar->xpath("//a[@seiten_id='$seiten_id']");
- if(count($current_a)) {
+ $current_a = $sidebar->xpath(".//a[@seiten_id='$seiten_id']");
+ $seiten_id_in_sidebar = count($current_a);
+ // ggf. nochmal global suchen:
+ $current_a = $seiten_id_in_sidebar ? $current_a[0] : $this->get_link($seiten_id);
+ if($current_a) {
// wenn aktuelle seite eine geraeteseite ist
if(in_array('geraete', $this->get_link_ul_classes($seiten_id))) {
// pfad: a ->li->ul.geraete->li->li/a
- $geraetelink = $current_a[0]->xpath("../../../a");
+ $geraetelink = $current_a->xpath("../../../a");
if(count($geraetelink))
$return['prev'] = $geraetelink[0];
$return['next'] = null; // kein Link nach vorne
} else {
- foreach(array(
- "prev" => "preceding::a[@seiten_id]",
- "next" => "following::a[@seiten_id]") as $rel => $xpath) {
- $nodes = $current_a[0]->xpath($xpath);
+ $searches = array();
+ if($seiten_id_in_sidebar || self::dom_attribute_contains($current_a, 'class', 'show-rel-prev'))
+ $searches['prev'] = 'preceding::a[@seiten_id]';
+ if($seiten_id_in_sidebar || self::dom_attribute_contains($current_a, 'class', 'show-rel-next'))
+ $searches['next'] = 'following::a[@seiten_id]';
+
+ foreach($searches as $rel => $xpath) {
+ $nodes = $current_a->xpath($xpath);
foreach($rel == "prev" ? array_reverse($nodes) : $nodes as $link) {
$is_geraete = count($link->xpath("ancestor::ul[contains(@class, 'geraete')]"));
@@ -377,10 +392,26 @@
} // end for prev next
} // end if geraete
- } else {
- // TODO PENDING: Der Fall tritt derzeit niemals ein, da das XML
- // sich dann doch irgendwie auf alles bezieht ($sidebar = alles) und
- // ueberall gesucht wird. Ist aber okay. oder?
- $return['start'] = t29Menu::dom_new_link('#', 'bla');
- }
+ }
+
+ // Short circuit fuer Links ueberall:
+ // Wenn der aktuelle Link ein "next" oder "prev"-Attribut besitzt, dann ueberschreibt
+ // das alle bisherigen Ergebnisse.
+ // Benutzung: foo, bar
+ //
+ // Funktioniert wahrscheinlich, aber nicht getestet/genutzt, da bislang nur "show-rel-{prev,next}"
+ // genutzt wird (direkte Nachbarn)
+ /*
+ if(!$current_a)
+ // falls $current_a nicht in der sidebar ist, nochmal global suchen
+ $current_a = $this->get_link($seiten_id);
+ $short_circuits = array('prev', 'next');
+ foreach($short_circuits as $rel) {
+ if($current_a[$rel]) {
+ $target = $this->get_link((string) $current_a[$rel]);
+ if($target)
+ $return[$rel] = $target;
+ }
+ }
+ */
// Linkliste aufarbeiten: Nullen rausschmeissen (nur deko) und
@@ -398,18 +429,4 @@
}
- // Nov 2015: short circuit: Manuell "ueberladene" bzw. uebertragene Seitenrelationen
- /**
- * Benutzung: Auf Inhaltseite zb. $manuell_naechste_seite = array('href'=>'/de/sonstwas.php', 'label'=>'Computertechnik');
- **/
- /*
- $manual_keys = array('next' => "manuell_naechste_seite", 'prev' => 'manuell_vorherige_seite');
- foreach($manual_keys as $key => $confkey) {
- if(isset($this->conf[$confkey])) {
- $retrun[$key] = self::dom_new_link($confkey['href'], $confkey['label']);
- }
- }
- */
- // Funktioniert allerding gerade nicht!
-
return $return;
}
Index: /lib/template.php
===================================================================
--- /lib/template.php (revision 925)
+++ /lib/template.php (revision 926)
@@ -393,5 +393,6 @@
// only print menu when in sidebar where it applies.
// it can also be forced with a global setting $force_footer_menu = 1
- $print_footer_menu = ($this->conf['seite_in_nav'] == 'side') || isset($this->conf['force_footer_menu']);
+ $print_footer_menu = count($this->page_relations) || isset($this->conf['force_footer_menu']);
+ // old test: ($this->conf['seite_in_nav'] == 'side') || isset($this->conf['force_footer_menu']);
// print next or prev entry when the current page has a
@@ -400,8 +401,4 @@
$show_rel_prev = in_array('show-rel-prev', $this->current_link_classes);
- // Footer-String, um Footer je nach Footer-Menue "da" oder "nicht da" einbinden zu koennen
- $footer_text = <<