Changeset 926 in t29-www
- Timestamp:
- Mar 24, 2016, 1:43:35 AM (7 years ago)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
de/navigation.xml
r884 r926 45 45 </ul> 46 46 </li> 47 <li class="has-submenu open-to-left"><a seiten_id="lehrerinfo" href="/de/lehrerinfo.php">Didaktik+Workshop</a>47 <li class="has-submenu open-to-left"><a seiten_id="lehrerinfo" class="show-rel-next" href="/de/lehrerinfo.php">Didaktik+Workshop</a> 48 48 <ul class="u2"> 49 49 <li><a href="/de/lehrerinfo.php#Konzeption">Konzeption</a></li> 50 50 <li><a href="/de/lehrerinfo.php#Lehrerinfo">Information für Lehrer</a></li> 51 <li><a href="/robotik/" seiten_id="robotik-ferienkurs" >Robotik-Kurse</a></li>51 <li><a href="/robotik/" seiten_id="robotik-ferienkurs" class="show-rel-prev">Robotik-Kurse</a></li> 52 52 </ul> 53 53 </li> … … 245 245 246 246 <li><a href="/de/lehrerinfo.php">Informationen für Lehrer</a></li> 247 <li><a href="/robotik/" seiten_id="robotik-ferienkurs">Robotik-Workshop</a></li>247 <li><a href="/robotik/">Robotik-Workshop</a></li> 248 248 </ul> 249 249 </li> -
lib/menu.php
r880 r926 229 229 $e[$attribute_name] = (self::dom_has_attribute($e, $attribute_name) ? ($e[$attribute_name].$seperator) : '') . $content; 230 230 } 231 232 public static function dom_attribute_contains($simplexml_element, $attribute_name, $needle) { 233 if(isset($simplexml_element[$attribute_name])) { 234 return strpos((string)$simplexml_element[$attribute_name], $needle) !== false; 235 } else 236 return false; 237 } 231 238 232 239 /** … … 354 361 $sidebar = $xml[0]; 355 362 363 // nur Sidebar-Links kriegen eine Relation aufgeloest 356 364 $return = array(); 357 $current_a = $sidebar->xpath("//a[@seiten_id='$seiten_id']"); 358 if(count($current_a)) { 365 $current_a = $sidebar->xpath(".//a[@seiten_id='$seiten_id']"); 366 $seiten_id_in_sidebar = count($current_a); 367 // ggf. nochmal global suchen: 368 $current_a = $seiten_id_in_sidebar ? $current_a[0] : $this->get_link($seiten_id); 369 if($current_a) { 359 370 // wenn aktuelle seite eine geraeteseite ist 360 371 if(in_array('geraete', $this->get_link_ul_classes($seiten_id))) { 361 372 // pfad: a ->li->ul.geraete->li->li/a 362 $geraetelink = $current_a [0]->xpath("../../../a");373 $geraetelink = $current_a->xpath("../../../a"); 363 374 if(count($geraetelink)) 364 375 $return['prev'] = $geraetelink[0]; 365 376 $return['next'] = null; // kein Link nach vorne 366 377 } else { 367 foreach(array( 368 "prev" => "preceding::a[@seiten_id]", 369 "next" => "following::a[@seiten_id]") as $rel => $xpath) { 370 $nodes = $current_a[0]->xpath($xpath); 378 $searches = array(); 379 if($seiten_id_in_sidebar || self::dom_attribute_contains($current_a, 'class', 'show-rel-prev')) 380 $searches['prev'] = 'preceding::a[@seiten_id]'; 381 if($seiten_id_in_sidebar || self::dom_attribute_contains($current_a, 'class', 'show-rel-next')) 382 $searches['next'] = 'following::a[@seiten_id]'; 383 384 foreach($searches as $rel => $xpath) { 385 $nodes = $current_a->xpath($xpath); 371 386 foreach($rel == "prev" ? array_reverse($nodes) : $nodes as $link) { 372 387 $is_geraete = count($link->xpath("ancestor::ul[contains(@class, 'geraete')]")); … … 377 392 } // end for prev next 378 393 } // end if geraete 379 } else { 380 // TODO PENDING: Der Fall tritt derzeit niemals ein, da das XML 381 // sich dann doch irgendwie auf alles bezieht ($sidebar = alles) und 382 // ueberall gesucht wird. Ist aber okay. oder? 383 $return['start'] = t29Menu::dom_new_link('#', 'bla'); 384 } 394 } 395 396 // Short circuit fuer Links ueberall: 397 // Wenn der aktuelle Link ein "next" oder "prev"-Attribut besitzt, dann ueberschreibt 398 // das alle bisherigen Ergebnisse. 399 // Benutzung: <a seiten_id="a" href="a.html" next="b">foo</a>, <a seiten_id="b">bar</a> 400 // 401 // Funktioniert wahrscheinlich, aber nicht getestet/genutzt, da bislang nur "show-rel-{prev,next}" 402 // genutzt wird (direkte Nachbarn) 403 /* 404 if(!$current_a) 405 // falls $current_a nicht in der sidebar ist, nochmal global suchen 406 $current_a = $this->get_link($seiten_id); 407 $short_circuits = array('prev', 'next'); 408 foreach($short_circuits as $rel) { 409 if($current_a[$rel]) { 410 $target = $this->get_link((string) $current_a[$rel]); 411 if($target) 412 $return[$rel] = $target; 413 } 414 } 415 */ 385 416 386 417 // Linkliste aufarbeiten: Nullen rausschmeissen (nur deko) und … … 398 429 } 399 430 400 // Nov 2015: short circuit: Manuell "ueberladene" bzw. uebertragene Seitenrelationen401 /**402 * Benutzung: Auf Inhaltseite zb. $manuell_naechste_seite = array('href'=>'/de/sonstwas.php', 'label'=>'Computertechnik');403 **/404 /*405 $manual_keys = array('next' => "manuell_naechste_seite", 'prev' => 'manuell_vorherige_seite');406 foreach($manual_keys as $key => $confkey) {407 if(isset($this->conf[$confkey])) {408 $retrun[$key] = self::dom_new_link($confkey['href'], $confkey['label']);409 }410 }411 */412 // Funktioniert allerding gerade nicht!413 414 431 return $return; 415 432 } -
lib/template.php
r880 r926 393 393 // only print menu when in sidebar where it applies. 394 394 // it can also be forced with a global setting $force_footer_menu = 1 395 $print_footer_menu = ($this->conf['seite_in_nav'] == 'side') || isset($this->conf['force_footer_menu']); 395 $print_footer_menu = count($this->page_relations) || isset($this->conf['force_footer_menu']); 396 // old test: ($this->conf['seite_in_nav'] == 'side') || isset($this->conf['force_footer_menu']); 396 397 397 398 // print next or prev entry when the current page has a … … 400 401 $show_rel_prev = in_array('show-rel-prev', $this->current_link_classes); 401 402 402 // Footer-String, um Footer je nach Footer-Menue "da" oder "nicht da" einbinden zu koennen403 $footer_text = <<<FOOTER404 405 FOOTER;406 403 ?> 407 404 <footer class="in-sheet <?php if(!$print_footer_menu) print "empty-footer"; ?>">
Note: See TracChangeset
for help on using the changeset viewer.