Changeset 347 in t29-www


Ignore:
Timestamp:
Mar 6, 2013, 3:58:15 AM (10 years ago)
Author:
sven
Message:

Diverse Verbesserungen am Homepagesystem, die bereits lange anstanden.

  • Die Suche ist endlich implementiert, wenngleich auch relativ unschoen mittels einer eingebundenen Google-Suche.

Bugfixes:

  • de/news.php: Syntaxfehler im Neuigkeiten-Menü

Backend-Aenderungen:

  • Englischsprachige Benutzer, die auf die deutsche Seite kommen oder andersrum erhalten einen Hinweis, dass es die andere Sprachversion gibt (noch nicht vollständig implementiert)
  • Es gibt ein besseres Logging-System, welches Client- und Serverausgaben verbindet
  • Das System generiert jetzt selbst Clean-URLs direkt (zumindest aus Menue/Template, Inhalte werden nicht touchiert). Das reduziert die Anzahl der Zugriffe erheblich.
  • Ein paar CSS-Details
  • navigation.xml: "#DUMME-VERLINKUNG"-Einträge entfernt
Files:
2 added
21 edited

Legend:

Unmodified
Added
Removed
  • de/details1.php

    r284 r347  
    99<h2><?php print $titel; ?></h2>
    1010
    11 <table width="100%" border="0" cellpadding="0" cellspacing="1">
     11<table width="100%" border="0" cellpadding="0" cellspacing="1" class="t29-details">
    1212  <colgroup>
    1313    <col class="middle" /> <!-- middle-Klasse nicht -->
  • de/details2.php

    r284 r347  
    88<h2><?php print $titel; ?></h2>
    99
    10 <table width="100%" border="0" cellpadding="0" cellspacing="1">
     10<table width="100%" border="0" cellpadding="0" cellspacing="1" class="t29-details">
    1111  <colgroup>
    1212    <col class="middle" /> <!-- middle-Klasse nicht -->
  • de/navigation.xml

    r342 r347  
    2424                </ul>
    2525        </li>
    26         <li class="has-submenu"><a href="/de/lernprojekte/#DUMME-VERLINKUNG">Projekte</a>
     26        <li class="has-submenu"><a href="/de/lernprojekte/">Projekte</a>
    2727                <ul class="u2">
    2828                        <li class="has-submenu"><a seiten_id="lernprojekte" class="show-rel-next" href="/de/lernprojekte/">Lernprojekte</a>
     
    5858<ul class="u1">
    5959        <li class="guide-only start"><a href="/de/">Start</a></li>
    60         <li><a href="/de/rechnertechnik/elektro-mechanik.php#DUMME-VERLINKUNG">Computer History</a>
     60        <li><a href="/de/rechnertechnik/elektro-mechanik.php">Computer History</a>
    6161                <ul class="u2">
    6262                        <li><a seiten_id="elektro-mechanik" href="/de/rechnertechnik/elektro-mechanik.php">Mechanische Rechenmaschinen</a>
     
    6666                                </ul>
    6767                        </li>
    68                         <li><a href="/de/rechnertechnik/lochkarten-edv.php#DUMME-VERLINKUNG">Lochkarten-EDV und gross-Computer</a>
     68                        <li><a href="/de/rechnertechnik/lochkarten-edv.php">Lochkarten-EDV und gross-Computer</a>
    6969                                <ul class="u3">
    7070                                        <li><a seiten_id="lochkarten" href="/de/rechnertechnik/lochkarten-edv.php" title="Lochkartengeräte">Lochkartengeräte und Peripherie</a></li>
     
    124124                                </ul>
    125125                        </li>
    126                         <li><a href="/de/rechnertechnik/elektronenroehren.php#DUMME-VERLINKUNG" title="Tischrechner mit Elektronenröhren">Elektronische Tischrechner</a>
     126                        <li><a href="/de/rechnertechnik/elektronenroehren.php" title="Tischrechner mit Elektronenröhren">Elektronische Tischrechner</a>
    127127                                <ul class="u3">
    128128                                        <li><a seiten_id="elektronenroehren" href="/de/rechnertechnik/elektronenroehren.php" title="Tischrechner mit Röhren">mit Röhren</a></li>
     
    177177                </ul>
    178178        </li>
    179         <li><a href="/de/kommunikationstechnik/rundfunk.php#DUMME-VERLINKUNG">Kommunikations-technik</a>
     179        <li><a href="/de/kommunikationstechnik/rundfunk.php">Kommunikations-technik</a>
    180180                <ul class="u2">
    181181                        <li><a seiten_id="rundfunk" href="/de/kommunikationstechnik/rundfunk.php">Rundfunk</a>
     
    204204                </ul>
    205205        </li>
    206         <li><a href="/de/kommunikationstechnik/messtechnik.php#DUMME-VERLINKUNG">Weitere Themen</a>
     206        <li><a href="/de/kommunikationstechnik/messtechnik.php">Weitere Themen</a>
    207207                <ul class="u2">
    208208                        <li><a seiten_id="messtechnik" href="/de/kommunikationstechnik/messtechnik.php">Mess- und Experimentaltechnik</a></li>
  • de/news.php

    r346 r347  
    2626  link: "#Juli_2012"
    2727 
    28 -
    29 
    3028MENU;
    3129// ende der menue-Eintraege
  • de/suche.php

    r284 r347  
    1010
    1111        require "../lib/technikum29.php";
    12        
    1312        // Todo: add interlang link from page. needs some kind of
    1413        //       callback
    1514?>
    16         <h2>Suchen</h2>
    17         <p>Hilfe zur Suchfunktion
     15        <h2>Suche</h2>
     16        <?php
     17        $search->google_search_snippet();
     18        ?>
     19        <!--
    1820        <p>Suchfeld
    1921        <?php if(isset($_GET['q'])) { ?>
     
    2123                <p>...
    2224        <?php } ?>
     25        -->
  • en/details1.php

    r296 r347  
    99<h2><?php print $titel; ?></h2>
    1010
    11 <table width="100%" border="0" cellpadding="0" cellspacing="1">
     11<table width="100%" border="0" cellpadding="0" cellspacing="1" class="t29-details">
    1212  <colgroup>
    1313    <col class="middle">
  • en/details2.php

    r296 r347  
    88<h2><?php print $titel; ?></h2>
    99
    10 <table width="100%" border="0" cellpadding="0" cellspacing="1">
     10<table width="100%" border="0" cellpadding="0" cellspacing="1" class="t29-details">
    1111  <colgroup>
    1212    <col class="middle">
  • en/navigation.xml

    r325 r347  
    2121                </ul>
    2222        </li>
    23         <li class="has-submenu"><a href="/en/development-projects.php#DUMME-VERLINKUNG">Projects</a>
     23        <li class="has-submenu"><a href="/en/development-projects.php">Projects</a>
    2424                <ul class="u2">
    2525                        <li class="has-submenu"><a seiten_id="lernprojekte" href="/en/study-projects.php">Study projects</a></li>
     
    5050                                </ul>
    5151                        </li>
    52                         <li><a href="/en/computer/punchcard.php#DUMME-VERLINKUNG">Punch card computing</a>
     52                        <li><a href="/en/computer/punchcard.php">Punch card computing</a>
    5353                                <ul class="u3">
    5454                                        <li><a seiten_id="lochkarten" href="/en/computer/punchcard.php" title="Punchers and Periphery">Punchers</a></li>
     
    109109                                </ul>
    110110                        </li>
    111                         <li><a href="/en/computer/electron-tubes.php#DUMME-VERLINKUNG">Electronical desk calculators</a>
     111                        <li><a href="/en/computer/electron-tubes.php">Electronical desk calculators</a>
    112112                                <ul class="u3">
    113113                                        <li><a seiten_id="elektronenroehren" href="/en/computer/electron-tubes.php">with electron tubes</a></li>
     
    161161                </ul>
    162162        </li>
    163         <li><a href="/en/communication/broadcasting.php#DUMME-VERLINKUNG">Communication Technology</a>
     163        <li><a href="/en/communication/broadcasting.php">Communication Technology</a>
    164164                <ul class="u2">
    165165                        <li><a seiten_id="rundfunk" href="/en/communication/broadcasting.php">Broadcasting</a>
     
    188188                </ul>
    189189        </li>
    190         <li><a href="/en/communication/measurement.php#DUMME-VERLINKUNG">Miscellaneous</a>
     190        <li><a href="/en/communication/measurement.php">Miscellaneous</a>
    191191                <ul class="u2">
    192192                        <li><a seiten_id="messtechnik" href="/en/communication/measurement.php">Measurement and Experimental technology</a></li>
  • en/search.php

    r287 r347  
    33        $version = '$Id$';
    44        $titel = 'Search';
    5        
     5        $dynamischer_inhalt = true;
     6
     7        require "../lib/search.php";
     8        $search = new t29Search();
     9        $search->page_handler();
     10
    611        require "../lib/technikum29.php";
    712?>
    813        <h2>Search</h2>
    9         <p>Search options and help
     14        <?php
     15                $search->google_search_snippet();
     16        ?>
     17        <!--
    1018        <p>Search field
    1119        <?php if(isset($_GET['q'])) { ?>
     
    1321                <p>...
    1422        <?php } ?>
     23        -->
  • lib/host.php

    r343 r347  
    2222        public $hostname = "undefined";
    2323
    24 
    2524        /**
    2625         * Factory for creating a t29Host instance automatically
     
    3736                        if(class_exists(self::webroot_local_host_classname)) {
    3837                                $x = self::webroot_local_host_classname;
    39                                 return new $x;
     38                                $host = new $x;
     39                                $host->setup();
     40                                return $host;
    4041                        } else {
    4142                                print "Warning: Hostfile $hostfile does not contain class ".self::webroot_local_host_classname."\n";
     
    4748                        case 'heribert':
    4849                        case 'localhost':
    49                                 return new t29HeribertHost;
     50                                $localhost = new t29HeribertHost;
     51                                $localhost->setup();
     52                                return $localhost;
    5053                }
    5154               
    52                 return new t29PublicHost;
     55                $publichost = new t29PublicHost;
     56                $publichost->setup();
     57                return $publichost;
     58        }
     59       
     60        /**
     61         * A constructing method which is always called by the t29Host::detect() factory.
     62         * It does some general stuff.
     63         * Of course you can always write your own setup() class - it's just your __constructor.
     64         * The constructor will of course be called before the setup() method.
     65         **/
     66        function setup() {
     67                $this->is_rewriting_host = isset($_SERVER[self::env_hidesuffix_name]);
    5368        }
    5469       
    5570        function check_url_rewrite() {
    56                 if(isset($_SERVER[self::env_hidesuffix_name])) {
     71                if($this->is_rewriting_host) {
    5772                        $path = $_SERVER['REQUEST_URI'];
    58                         $newpath = preg_replace("/\.(php|shtml?)$/i", '', $path);
     73                        $newpath = $this->rewrite_link($path);
    5974                        if($path != $newpath) {
    6075                                header('HTTP/1.1 301 Moved Permanently');
     
    6782
    6883        public function __toString() {
    69                 return 't29v6/host:'.$this->hostname;
     84                return 't29v6/'.$this->hostname;
     85        }
     86       
     87        function rewrite_link($link_target) {
     88                // rewrite link if neccessary. This function will be called hundreds of times
     89                // while rendering a page, rewriting all links found.
     90                if($this->is_rewriting_host) {
     91                        $new_target = preg_replace('/\.(?:php|shtml?)([#?].+)?$/i', '\\1', $link_target);
     92                        return $new_target;
     93                } else {
     94                        // just the identity function
     95                        return $link_target;
     96                }
     97               
     98        }
     99       
     100        function get_shorthand_link_returner() {
     101                $t = $this;
     102                return function($link_target)use($t) { return $t->rewrite_link($link_target); };
    70103        }
    71104
  • lib/logging.php

    r299 r347  
    8989        function print_all($ul_classes='') {
    9090                // causal printing function. Flushes entries afterwards!
    91                 print "<ul class='$ul_classes'>";
     91                // if $ul_classes is given, will print a list around
     92                if($ul_classes)
     93                        print "<ul class='$ul_classes'>";
    9294                foreach($this->entries as $entry) {
    9395                        printf('<li class="%s">%s</li>'.PHP_EOL, $entry[0], $entry[1]);
    9496                }
    95                 print "</ul>";
     97                if($ul_classes) print "</ul>";
    9698                $this->entries = array(); // flush entries!
    9799        }
    98100       
    99101        // convenience functions
    100         public function FATAL($line, $args = self::NO_ARGUMENTS){
    101                 $this->log($line, self::FATAL, $args);
    102         }
    103 
    104         public function INFO($line, $args = self::NO_ARGUMENTS){
    105                 $this->log($line, self::INFO, $args);
    106         }
    107 
    108         public function DEBUG($line, $args = self::NO_ARGUMENTS){
    109                 $this->log($line, self::INFO, $args);
    110         }
     102        public function FATAL($line, $args = self::NO_ARGUMENTS) { $this->log($line, self::FATAL, $args); }
     103        public function INFO($line, $args = self::NO_ARGUMENTS)  { $this->log($line, self::INFO, $args); }
     104        public function DEBUG($line, $args = self::NO_ARGUMENTS) { $this->log($line, self::DEBUG, $args); }
     105        public function WARN($line, $args = self::NO_ARGUMENTS) { $this->log($line, self::WARN, $args); }
    111106       
    112107} // class
  • lib/menu.php

    r301 r347  
    77
    88require_once dirname(__FILE__).'/messages.php';
     9require_once dirname(__FILE__).'/logging.php';
    910 
    1011class t29Menu {
    1112        public $conf;
    1213        public $xml;
     14        public $log; // just for convenience
    1315
    1416        // Bevor es eine ordentliche Dev-Moeglichkeit gibt: Der magische
     
    2628        function __construct($conf_array) {
    2729                $this->conf = $conf_array;
     30                $this->log = t29Log::get(); // just for convenience
    2831               
    2932                // create a message object if not given
     
    7073                        if(!array_reduce(array_map(function($x) use ($fields,$e){ return isset($e[$x]); }, $fields),
    7174                                        function($a,$b){ return $a && $b;}, true)) {
    72                                 $li = "<li>Fehler in Formatierung!";
     75                                $li = "<li><a href='#'>Fehler in Formatierung!<em>Dieser Menüeintrag ist falsch formatiert</em></a></li>";
     76                                $this->log->WARN("<h5>Neuigkeiten-Menü: Fehler in Formatierung</h5><p>Ein Eintrag im Neuigkeiten-Menü ist falsch formatiert.");
    7377                        } else {
    7478                                $url = ($e['link']{0} == '#' ? $this->conf['lang_path'].'/'.self::news_file : '').$e['link'];
     
    205209        /**
    206210         * @arg $xpath_menu_selection  one of the horizontal_menu / sidebar_menu consts.
    207          **/
    208         function print_menu($xpath_menu_selection) {
     211         * @arg $host Instance of t29Host which can be used for link rewriting if given.
     212         **/
     213        function print_menu($xpath_menu_selection, $host=null) {
    209214                if($this->xml_is_defective()) {
    210215                        print "The Menu file is broken.";
     
    254259                                $uld->parentNode->removeChild($uld);
    255260                        }
     261                }
     262               
     263                // alle Links mittels t29Host umwandeln (idR .php-Endung entfernen),
     264                // falls erwuenscht
     265                if($host) {
     266                        $links = $xml->xpath("//a[@href]");
     267                        foreach($links as $a)
     268                                $a['href'] = $host->rewrite_link($a['href']);
    256269                }
    257270       
  • lib/messages.php

    r335 r347  
    146146                'head-rel-prev'          => array('Zur vorherigen Seite (%s)', 'Previous Page (%s)'),
    147147                'head-rel-next'          => array('Zur folgenden Seite (%s)', 'Next Page (%s)'),
    148                 'head-rel-interlang'     => array('Deutsche Version dieser Seite (%s)', 'English Version of this page (%s)'),
     148                 //'head-rel-interlang'     => array('Deutsche Version dieser Seite (%s)', 'English Version of this page (%s)'),
    149149               
    150150                // used in /shared/js/modules/heading_links.js
     
    160160                'js-piwik-url-prefix' => '/logs/piwik/',
    161161                'js-piwik-siteid' => '1',
     162               
     163                // interlang.js
     164                'js-interlang-notify-heading' => array("This page is also avaliable in English", "Diese Website gibt es auch auf Deutsch"),
     165                'js-interlang-notify-text' => array("Do you want to switch to the English version <i>%s</i>?", "Möchtest du die deutschsprachige Seite <i>%s</i> lesen?"),
    162166        );
    163167}
  • lib/search.php

    r290 r347  
    77
    88        function page_handler() {
    9                 if(!isset($_GET['action']))
     9                if(!isset($_GET['action'])) {
     10                        // This is an "ordinary" page call.
     11                        // do some organisation stuff and return.
     12                        $this->setup_interlang();
    1013                        return;
     14                }
    1115                $action = $_GET['action'];
    1216                if(array_key_exists($action, self::$actions)) {
     
    4044                exit;
    4145        }
     46       
     47        /**
     48         * Since the search isn't denoted in the navigation.xml, the interlanguage
     49         * system doesn't work. This method fixes that by talking with t29Template.
     50         * This must be done after including technikum29.php.
     51         **/
     52        function setup_interlang() {
     53                $GLOBALS['template_callback'] = function($template) {
     54                        // Interlanguage Links: Defakto nicht cachebar da das Cachesystem fuer dynamische Seiten
     55                        // den header/footer cacht und damit auch die Interlang-Eintraege. Links wie
     56                        // "/de/suche.php"+$_SERVER['QUERY_STRING'] funktionieren daher nicht dynamisch,
     57                        // da der Head ja gecacht wird. Ist ein nicht so wichtiges FIXME.
     58                        $template->set_interlang_link("de", "/de/suche.php", "Suche");
     59                        $template->set_interlang_link("en", "/en/search.php", "Search");
     60                };
     61        }
     62       
     63        function google_search_snippet() {
     64        ?>
     65        <script>
     66                (function() {
     67                var cx = '010117769997860607363:ovbd9zjaaps';
     68                var gcse = document.createElement('script');
     69                gcse.type = 'text/javascript';
     70                gcse.async = true;
     71                gcse.src = (document.location.protocol == 'https' ? 'https:' : 'http:') +
     72                        '//www.google.com/cse/cse.js?cx=' + cx;
     73                var s = document.getElementsByTagName('script')[0];
     74                s.parentNode.insertBefore(gcse, s);
     75                })();
     76        </script>
     77        <gcse:search></gcse:search>
     78        <?php
     79        }
    4280}
  • lib/template.php

    r343 r347  
    11<?php
    22/**
    3  * technikum29v6 Page Template
     3 * technikum29v6 Page Template.
     4 * Initially written 08.01.2012, Sven Koeppel
     5 *
     6 * This file contains the t29v6 HTML5 template (header, footer, structure, ...).
    47 *
    58 * Global vars:
     
    1821        public $log; // lightweight logging system
    1922
     23        /**
     24         * The t29Template constructor.
     25         *
     26         * The template class is embedded into the t29v6 class framework. It
     27         * uses t29Log for logging, t29Messages for any localisation strings,
     28         * t29RessourceLoader for resolving URLs for CSS and JavaScript ressources.
     29         * t29Menu is a helper class considered for parsing and extracting
     30         * any relations between pages and the menu from navigation.xml.
     31         *
     32         * From the t29v6 entrypoint, technikum29.php, this class is instanced
     33         * at the end, if no caching has worked. That call looks like
     34         *
     35         *   $template = new t29Template($GLOBALS);
     36         *
     37         * which means that our configuration $this->conf will be set up from the
     38         * former global namespace. For correct working, at least some global vars
     39         * like
     40         *   $lib
     41         *   $lang
     42         *   $host
     43         *   ...
     44         * are considered as present (see above for a list).
     45         *
     46         **/
    2047        function __construct($conf_array) {
    2148                $this->conf = $conf_array;
     
    2451                require_once $this->conf['lib'].'/logging.php';
    2552                $this->log = t29Log::get();
    26 
     53               
    2754                // create a menu:
    2855                require_once $this->conf['lib'].'/menu.php';
     
    4067
    4168                // fill up configuration
    42 
     69               
    4370                // optional html headers which can be filled by hooks or parts
    4471                if(!isset($this->conf['header_prepend']))
    4572                        $this->conf['header_prepend'] = array(); // list
    4673
    47                 // as t29Host for configuration fillup fillup
     74                // ask t29Host for configuration fillup
    4875                $this->conf['host']->fillup_template_conf($this->conf);
    4976               
     
    79106                        $this->javascript_config[$key] = $this->conf[$key];
    80107               
    81                 // get all kind of relations
     108                // get all kind of relations. Pages can afterwards be overwritten with t29Template
     109                // methods (see below).
    82110                $this->page_relations = $this->menu->get_page_relations();
    83111                $this->interlang_links = $this->menu->get_interlanguage_link();
     
    100128                        $this->conf['html_title'] = $this->conf['seiten_link'] . ' - ';
    101129                $this->conf['html_title'] .= $this->msg->_('html-title');
     130               
     131                // Unfortunately mostly a t29Template instance won't be visible to a page
     132                // handled by technikum29.php. Therefore there is this small "future" trick:
     133                if(isset($this->conf['template_callback']))
     134                        $this->conf['template_callback']($this);
     135                // Now you can use code like
     136                // $template_callback = function($template) {
     137                //    $template->set_page_relation("next", "/de/example", "foo");
     138                //    $template->menu->... read and modify anything ... etc
     139                // }
     140                // so the callback function is called at the end of the template constructor.
     141                // This can be considered whenever giving a static configuration variables
     142                // is not enough.
     143        }
     144       
     145        /**
     146         * Overwrite the page relations given by the t29Menu.
     147         * By setting $relation to "prev" or "next", you can overwrite the
     148         * relations which has been set up by construction by $this->menu->get_page_relations().
     149         * Thus any page can state any relations. For sure they are only one-directional,
     150         * the other pages don't know anything about such relations because no vice-versa
     151         * introspection can be done.
     152         **/
     153        function set_page_relation($relation, $href, $label) {
     154                // good values for $relation are: "prev", "next".
     155                // Link is composed as <a href="$href">$label</a>.
     156                $this->page_relations[$relation] = t29Menu::dom_new_link($href, $label);
     157                print_r($this->page_relations);
     158        }
     159
     160        /**
     161         * Overwrite the interlanguage link list given by the t29Menu.
     162         * This does the same as set_page_relation() only for interlanguage links.
     163         **/
     164        function set_interlang_link($lang, $href, $label) {
     165                // good values for $lang are: "de", "en".
     166                // Link is composed as <a href="$href">$label</a>.
     167                $this->interlang_links[$lang] = t29Menu::dom_new_link($href, $label);
    102168        }
    103169       
     
    133199
    134200        function print_header() {
    135                 $p = $this->msg->get_shorthand_printer();
    136                 $_ = $this->msg->get_shorthand_returner();
     201                $p = $this->msg->get_shorthand_printer(); // t29Messages gettext printer
     202                $_ = $this->msg->get_shorthand_returner(); // t29Messages gettext
     203                $href = $this->conf['host']->get_shorthand_link_returner(); // t29Host link rewriter
    137204?>
    138205<!doctype html>
     
    141208  <meta charset="utf-8">
    142209  <title><?php echo $this->conf['html_title']; ?></title>
    143   <meta name="description" content="Produziert am 08.01.2012">
    144210  <meta name="author" content="technikum29-Team">
    145211  <meta name="generator" content="<?php print $this->conf['host']; ?>">
     
    155221 
    156222  <?php
    157         foreach(array_merge(array("first" => t29Menu::dom_new_link($this->conf['lang_path'], $_('head-rel-first'))),
    158           $this->page_relations) as $rel => $a) {
     223        foreach(array_merge(
     224                array("first" => t29Menu::dom_new_link($this->conf['lang_path'], $_('head-rel-first'))),
     225                $this->page_relations
     226        ) as $rel => $a) {
    159227                if($rel == 'start') continue; // not in standard
    160228                printf("\n  <link rel='%s' href='%s' title='%s' />",
    161                         $rel, $a['href'], sprintf($_('head-rel-'.$rel), $this->relational_link_to_string($a))
     229                        $rel, $href($a['href']), sprintf($_('head-rel-'.$rel), $this->relational_link_to_string($a))
    162230                );
    163231        }
    164232  ?>
    165233 
    166   <link rel="copyright" href="<?php $p('footer-legal-file'); ?>" title="<?php $p('footer-legal-link'); ?>">
    167   <link rel="search" type="application/opensearchdescription+xml" href="<?php $p('topnav-search-page'); print '?action=opensearch-desc&amp;lang='.$this->conf['lang']; ?>" title="<?php $p('opensearch-desc'); ?>">
     234  <link rel="copyright" href="<?php $href($p('footer-legal-file')); ?>" title="<?php $href($p('footer-legal-link')); ?>">
     235  <link rel="search" type="application/opensearchdescription+xml" href="<?php $href($p('topnav-search-page')); print '?action=opensearch-desc&amp;lang='.$this->conf['lang']; ?>" title="<?php $p('opensearch-desc'); ?>">
    168236  <?php
    169237        // print interlanguage links for all languages except the active one
     
    171239                if($lang != $this->conf['lang'] && !is_null($a)) {
    172240                        printf('<link rel="alternate" href="%s" hreflang="%s" title="%s">',
    173                                 $a['href'], $lang, sprintf($_('head-rel-interlang', $lang), $a)
     241                                $href($a['href']), $lang, $this->relational_link_to_string($a)
    174242                        );
    175243                }
     
    190258        <div id="background-color-container"><!-- helper -->
    191259        <section class="main content" role="main" id="content">
    192                 <?php
    193                         if(!$this->log->is_empty()) {
    194                                 print '<div class="errorpane">';
    195                                 $this->log->print_all();
    196                                 print '</div>';
    197                         }
     260                <ul class="messages panel <?php if($this->log->is_empty()) echo 'empty'; ?> nolist">
     261                <?php
     262                        // This prints out error messages collected by the log only until this point
     263                        $this->log->print_all();
     264                        // All log entries generated until final processing will be flushed out at the
     265                        // end; a userspace javascript helper will then move them here.
    198266                ?>
     267                </ul>   
    199268                <!--<header class="teaser">
    200269                        <h2 id="pdp8L">Wissenschaftliche Rechner und Minicomputer</h2>
     
    206275
    207276        function print_footer() {
    208                 $p = $this->msg->get_shorthand_printer();
    209                 $_ = $this->msg->get_shorthand_returner();
     277                $p = $this->msg->get_shorthand_printer(); // t29Messages gettext printer
     278                $_ = $this->msg->get_shorthand_returner(); // t29Messages gettext
     279                $href = $this->conf['host']->get_shorthand_link_returner(); // t29Host link rewriter
     280               
    210281        ?>
    211282        <!-- end content -->
     
    215286                        <h2 class="visuallyhidden"><?php $p("sidebar-h2-tour"); ?></h2>
    216287                        <nav class="side">
    217                                 <?php $this->menu->print_menu(t29Menu::sidebar_menu); ?>
     288                                <?php $this->menu->print_menu(t29Menu::sidebar_menu, $this->conf['host']); ?>
    218289                        </nav>
    219290                        <!-- menu changing buttons are made with javascript -->
     
    227298                <h2 class="visuallyhidden"><?php $p("sidebar-h2-mainnav"); ?></h2>
    228299                <nav class="horizontal">
    229                         <?php $this->menu->print_menu(t29Menu::horizontal_menu); ?>
     300                        <?php $this->menu->print_menu(t29Menu::horizontal_menu, $this->conf['host']); ?>
    230301                </nav>
    231302                <nav class="top">
     
    250321                                                printf("\t\t\t\t<li%s><a href='%s' title='%s'>%s</a></li>\n",
    251322                                                        (empty($class) ? '' : " class='$class'"),
    252                                                         $a['href'], htmlspecialchars($title),
     323                                                        $href($a['href']), htmlspecialchars($title),
    253324                                                        $this->conf['languages'][$lang][0] // verbose language name
    254325                                                );
     
    256327                                ?>
    257328                        </ul>
    258                         <form method="get" action="<?php $p('topnav-search-page'); ?>">
     329                        <form method="get" action="<?php $href($p('topnav-search-page')); ?>">
    259330                                <span class="no-js"><?php $p('topnav-search-label'); ?>:</span>
    260331                                <input type="text" value="" data-defaultvalue="<?php $p('topnav-search-label'); ?>" name="q" class="text">
     
    265336        <hr>
    266337        <?php
    267                 // only print menu when in sidebar where it applies
    268                 $print_footer_menu = ($this->conf['seite_in_nav'] == 'side');
     338                // only print menu when in sidebar where it applies.
     339                // it can also be forced with a global setting $force_footer_menu = 1
     340                $print_footer_menu = ($this->conf['seite_in_nav'] == 'side') || isset($this->conf['force_footer_menu']);
    269341        ?>
    270342    <footer class="in-sheet <? if(!$print_footer_menu) print "empty-footer"; ?>">
     
    278350                                foreach($this->page_relations as $rel => $a) {
    279351                                        printf("\t<li class='%s'><a href='%s' title='%s'>%s <strong>%s</strong></a>\n",
    280                                                 $rel, $a['href'], sprintf($_('head-rel-'.$rel), $this->relational_link_to_string($a)),
     352                                                $rel, $href($a['href']), sprintf($_('head-rel-'.$rel), $this->relational_link_to_string($a)),
    281353                                                $_('nav-rel-'.$rel), $this->relational_link_to_string($a)
    282354                                        );
     
    295367        <ul class="clearfix">
    296368        <li class="logo">
    297                 <a href="<?php $p('footer-legal-file'); ?>" class="img" title="technikum29 Logo">Logo</a>
     369                <a href="<?php $href($p('footer-legal-file')); ?>" class="img" title="technikum29 Logo">Logo</a>
    298370                <p><?php $p('footer-copyright-tag'); ?>
    299                    <br><?php printf('<a href="%s">%s</a>', $_('footer-legal-file'), $_('footer-legal-link')); ?>
     371                   <br><?php printf('<a href="%s">%s</a>', $href($_('footer-legal-file')), $_('footer-legal-link')); ?>
    300372                </p>
    301373        </li>
    302374        <li class="copy">
    303                 <a href="<?php $p('footer-legal-file'); ?>#image-copyright" class="img">CC</a>
    304                 <p>Viele Bilder können unter einer <a href="<?php $p('footer-legal-file'); ?>#image-copyright">CreativeCommons-Lizenz</a>
    305                    verwendet werden. <a href="<?php $p('footer-legal-file'); ?>#image-copyright">Erkundigen Sie sich</a>.</p>
     375                <a href="<?php $href($p('footer-legal-file')); ?>#image-copyright" class="img">CC</a>
     376                <p>Viele Bilder können unter einer <a href="<?php $href($p('footer-legal-file')); ?>#image-copyright">CreativeCommons-Lizenz</a>
     377                   verwendet werden. <a href="<?php $href($p('footer-legal-file')); ?>#image-copyright">Erkundigen Sie sich</a>.</p>
    306378        </li>
    307379        </ul>
    308380        -->
     381        <?php
     382                // pending log messages
     383                if(!$this->log->is_empty()) {
     384                        echo '<ul class="messages footer nolist">';
     385                        $this->log->print_all();
     386                        echo '</ul>';
     387                }
     388        ?>
    309389  </footer>
    310390</div><!-- end of div id="footer-background-container" helper -->
  • shared/css-v6/modules/01-boilerplate.css

    r289 r347  
    102102ul, ol { margin: 1em 0; padding: 0 0 0 40px; }
    103103dd { margin: 0 0 0 40px; }
    104 nav ul, nav ol, footer ul, footer ol { list-style: none; list-style-image: none; margin: 0; padding: 0; }
     104nav ul, nav ol, footer ul, footer ol, #content ul.nolist, #content ol.nolist {
     105  list-style: none; list-style-image: none; margin: 0; padding: 0; }
    105106
    106107
  • shared/css-v6/modules/11-header.css

    r299 r347  
    176176nav.top form {
    177177        /* Suche, solange sie noch nicht fertig ist, ausblenden. */
    178         display: none;
     178        /*display: none;*/ /* Online gegangen im Maerz 2013 */
    179179}
    180180
  • shared/css-v6/modules/18-content.css

    r289 r347  
    88 *              Blockdesign, etc.
    99 *
     10 *   .messages = Logging, zentralisiert (siehe logging.php, template.php und log.js)
    1011 **/
    1112
     
    6465        color: #882224;
    6566}
     67
     68/**
     69 *  Logging
     70 **/
     71
     72.messages.panel.empty {
     73        /* Hide empty message boxes */
     74        display: none;
     75}
     76
     77.messages.panel { margin-bottom: 20px; }
     78
     79.messages.panel li {
     80        margin-bottom: 5px;
     81        background-color: #FCF8E3;
     82        border: 1px solid #FBEED5;
     83        border-radius: 4px 4px 4px 4px;
     84        margin-bottom: 20px;
     85        padding: 8px 35px 8px 14px;
     86        text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
     87}
     88
     89.messages.panel p { margin: 2px 0; }
     90.messages.panel button.close {
     91        float: right;
     92}
     93
     94.messages.footer {
     95        /* sollte eigentlich gar nicht dargestellt werden, sondern von log.js
     96           in den .messages.panel-Bereich verschoben werden. */
     97        opacity: .8;
     98}
  • shared/css-v6/modules/22-v5blocks.css

    r278 r347  
    2626
    2727
    28 #content td, #content table, #content tr {
     28#content table.t29-details td,
     29#content table.t29-details,
     30#content table.t29-details tr {
    2931    font: 12px Verdana;
    3032}
    3133
    32 #content table {
     34#content table.t29-details {
    3335    border-spacing: 1px;
    3436    border-collapse: separate;
    3537}
    3638
    37 #content table p {
     39#content table.t29-details p {
    3840    text-align: justify;
    3941    line-height: 120%;
    4042}
    4143
    42 #content table p.center {
     44#content table.t29-details p.center {
    4345    margin: 5px 0px;
    4446    text-align: center;
    4547}
    4648
    47 #content td b {
     49#content table.t29-details td b {
    4850    display: block;
    4951}
    5052
    51 #content td.b, #content td.b a {
     53#content table.t29-details td.b, #content table.t29-details td.b a {
    5254    font-weight: bold;
    5355}
    5456
    55 #content table {
     57#content table.t29-details {
    5658    background-color: #7090C0;
    5759}
    5860
    59 #content td {
     61#content table.t29-details td {
    6062    padding: 2px;
    6163    vertical-align: middle;
     
    6466}
    6567
    66 #content th {
     68#content table.t29-details th {
    6769    padding: 2px;
    6870    text-align: center;
     
    7072}
    7173
    72 #content .bemerkungen {
     74#content table.t29-details .bemerkungen {
    7375    vertical-align: middle;
    7476    text-align: justify;
  • shared/js-v6/modules/log.js

    r260 r347  
    11/**
    2  * Logging functions, basics provided by HTML5 Boilerplate
     2 * t29v6 Logging subsystem
     3 *
     4 * Logging on client side is splitted in two parts:
     5 *   1. Javascript console.log calls which won't offend the user
     6 *   2. the t29.log class to notify the user.
     7 *
     8 * Considering console.log, the code is borrowed by HTML5 Boilerplate
     9 *
    310 *
    411 **/
     
    2027{console.log();return window.console;}catch(err){return window.console={};}})());
    2128
     29
     30if(!t29) window.t29 = {}; // the t29 namespace
     31t29.log = {}; // the t29.log namespace
     32
     33t29.log.setup = function() {
     34        // setup our spaces
     35        t29.log.$panel = $(".messages.panel");
     36        t29.log.$end = $(".messages.footer");
     37       
     38        // find end messages and push them to the first
     39        if((end_li = t29.log.$end.find("li")).length) {
     40                end_li.appendTo(t29.log.$panel);
     41                t29.log.$end.hide(); // hide bottom panel
     42                t29.log.$panel.removeClass("empty"); // show top panel
     43        }
     44       
     45        // setup some functions
     46        levels = ["emerg", "alert", "crit", "error", "warn", "notice", "info"];
     47        $.each(levels, function() {
     48                level = this;
     49                t29.log[level] = function(msg) { t29.log.append(level, msg) }
     50        });
     51}
     52
     53t29.log.append = function(level, msg) {
     54        // tell the panel that it's now not empty (thus it will become CSS visible)
     55        t29.log.$panel.removeClass("empty");
     56       
     57        if(jQuery.type(msg) == "string")
     58                s = msg;
     59        else {
     60                s = "";
     61                if(msg.dismissable) s += "<button class='close'>&times;</button>";
     62                if(msg.heading) s += "<h5>"+msg.heading+"</h5>";
     63                if(msg.text) s += "<p>"+msg.text+"</p>";
     64        }
     65        infoelement = $("<li>", {"class": level}).html(s).hide().appendTo(t29.log.$panel).slideDown();
     66       
     67        // fill eventual close button with action
     68        $(infoelement).find("button.close").click(function(){
     69                $(this).closest("li").slideUp();
     70        });
     71}
  • shared/js-v6/modules/startup.js

    r306 r347  
    2020        'img_license',
    2121        'lightbox',
     22        'log',
    2223
    2324        // ganz am anfang
    2425        'prefs',
     26       
     27        // needs log, t29msg
     28        'interlang',
    2529
    2630        // needs prefs
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