Changeset 390 in t29-www for lib


Ignore:
Timestamp:
May 9, 2013, 2:37:12 PM (11 years ago)
Author:
sven
Message:
  • Vor/Zurück-Link bei Lernprojekten aktiviert
  • Anzeige fehlender englischer Übersetzungen wieder aktiviert (aufgehübscht; mit Infobox)
Location:
lib
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • lib/menu.php

    r350 r390  
    158158         * Extracts a list of (CSS) classes the link has,
    159159         * e.g. <a class="foo bar"> gives array("foo","basr").
     160         *
     161         * Caveat: This must be called before this class is destructed
     162         * by print_menu! Otherwise it will return an empty array. This is
     163         * actually bad design, print_menu destroyes the internal structure
     164         * for storage efficiencey.
     165         *
    160166         * @returns array or empty array in case of error
    161167         **/
    162168        function get_link_classes($seiten_id=false) {
    163169                $link = $this->get_link($seiten_id);
    164                 print "link:"; var_dump($this->xml);
     170                //print "link:"; var_dump($this->xml);
    165171                if(!$link) return array();
    166                 var_dump($link); exit;
     172                //var_dump($link); exit;
    167173                return isset($link['class']) ? explode(' ',$link['class']) : array();
    168174        }
  • lib/messages.php

    r347 r390  
    122122                'topnav-interlang-active' => array('Sie betrachten gerade die Seite "%s" auf Deutsch', 'You currently read the page "%s" in English'),
    123123                'topnav-interlang-nonexistent' => array('Diese Seite steht auf Deutsch nicht zur Verfügung', 'This page is not available in English'),
     124                'topnav-interlang-nonexistent-page' => '/en/no-translation.php',
    124125                'topnav-search-label'    => array('Suchen', 'Search'),
    125126                'topnav-search-page'     => array('/suche.php', '/search.php'),
  • lib/technikum29.php

    r357 r390  
    5555$lang_path = $languages[$lang][1]; # shorthand, relative to webroot. use "$webroot$lang_path" for local.
    5656
     57// "AJAX" calls are our meaning for pages without chrome
     58$ajax = isset($_GET['ajax']);
     59if($ajax) {
     60        // print only a minimal chrome, no caching.
     61        require "$lib/ajax-template.php";
     62        $ajax_tmpl = new t29AJAXTemplate($GLOBALS);
     63        $ajax_tmpl->print_page();
     64        // important: do not execute bottom code
     65        return true;
     66}
     67
    5768require "$lib/cache.php";
    5869
  • lib/template.php

    r357 r390  
    112112                $this->page_relations = $this->menu->get_page_relations();
    113113                $this->interlang_links = $this->menu->get_interlanguage_link();
     114                $this->current_link_classes = $this->menu->get_link_classes();
    114115               
    115116                // check and load additional css
     
    157158                // Link is composed as <a href="$href">$label</a>.
    158159                $this->page_relations[$relation] = t29Menu::dom_new_link($href, $label);
    159                 print_r($this->page_relations);
     160                //print_r($this->page_relations);
    160161        }
    161162
     
    228229  <?php
    229230        foreach($this->conf['header_prepend'] as $h) print $h."\n  ";
     231       
     232        if($this->conf['ajax']) print "\n  <meta name='t29.ajax' content='true'>";
    230233 
    231234        if(isset($this->conf['version'])) printf('<meta name="t29.version" content="%s">', $this->conf['version']);
     
    323326                                                if(is_null($a)) {
    324327                                                        // when interlanguage link not present (null) = no translation exists
    325                                                         $a = t29Menu::dom_new_link('#', 'not present');
     328                                                        $backtitle = isset($this->conf['titel']) ? $this->conf['titel'] : null;
     329                                                       
     330                                                        $a = t29Menu::dom_new_link(
     331                                                                $_('topnav-interlang-nonexistent-page') . '?'
     332                                                                   . htmlentities(http_build_query(array(
     333                                                                        'backurl' => $_SERVER['REQUEST_URI'],
     334                                                                        'backtitle' => $backtitle ? $backtitle : null,
     335                                                                     ))),
     336                                                                'not present'
     337                                                        );
    326338                                                        $title = sprintf($_('topnav-interlang-nonexistent', $lang));
    327339                                                        $class = 'nonexistent';
     
    355367                $print_footer_menu = ($this->conf['seite_in_nav'] == 'side') || isset($this->conf['force_footer_menu']);
    356368               
    357                 /*
    358369                // print next or prev entry when the current page has a
    359370                // "show-rel-next" or "show-rel-prev" class entry
    360                 $current_link_classes = $this->menu->get_link_classes();
    361                 print_r($current_link_classes); exit;
    362                 $show_rel_next = in_array('show-rel-next', $current_link_classes);
    363                 $show_rel_prev = in_array('show-rel-prev', $current_link_classes);
    364                 */
     371                $show_rel_next = in_array('show-rel-next', $this->current_link_classes);
     372                $show_rel_prev = in_array('show-rel-prev', $this->current_link_classes);
     373               
    365374        ?>
    366375    <footer class="in-sheet <? if(!$print_footer_menu) print "empty-footer"; ?>">
     
    371380                <ul>
    372381                        <?php
    373                           if($print_footer_menu) //|| $show_rel_prev || $show_rel_next)
     382                          //if($print_footer_menu)
    374383                                foreach($this->page_relations as $rel => $a) {
    375                                         /*
    376384                                        // only show the links wanted to be shown. Only relevant if
    377385                                        // the "show-rel-*"-magic is working.
    378                                         if( $print_footer_menu
     386                                        if( $print_footer_menu ||
    379387                                            (!$print_footer_menu && $rel == "prev" && $show_rel_prev) ||
    380388                                            (!$print_footer_menu && $rel == "next" && $show_rel_next)) {
    381                                         */
     389                                       
    382390                                                printf("\t<li class='%s'><a href='%s' title='%s'>%s <strong>%s</strong></a>\n",
    383391                                                        $rel, $href($a['href']), sprintf($_('head-rel-'.$rel), $this->relational_link_to_string($a)),
    384392                                                        $_('nav-rel-'.$rel), $this->relational_link_to_string($a)
    385393                                                );
    386                                         //} // endif
     394                                        } // endif
    387395                                } // endfor
    388396                        ?>
Note: See TracChangeset for help on using the changeset viewer.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License