Changeset 649 in t29-www


Ignore:
Timestamp:
Aug 28, 2014, 3:40:34 PM (10 years ago)
Author:
sven
Message:

RSS-Feed-Probebetrieb ausgeweitet: Internationalisiert, fuer englische Version gibts jetzt auch einen RSS-Feed.

Insbesondere ist in auf englischen Newsseite jetzt testweise ein alternatives Format zum Deutschen geschaltet, auf welches das Deutsche dann auch umgeschaltet werden soll. Es bedarf weniger Pflege und generiert gleichzeitig die Newsseite, das Newsmenü und den abonnierbaren News-Feed. Wenn sich das Format bewährt, kann die deutsche Newsseite darauf auch umgestellt werden.

Ferner wurden die RSS-Feeds auf den News-Seiten textuell erwähnt. Testweise werden auch im englischen Menü wieder Vorschaubilder (Thumbnails) bei den Neuigkeiten eingeblendet, die allerdings derzeit nur auf max 64x64px verkleinerte Einblendungen der entsprechenden News-Bilder sind. Hierfür fehlt noch eine sinnvollere Methode.

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • de/news.php

    r643 r649  
    66        $neues_menu = <<< MENU
    77       
    8 - titel: "Robotik-Kurs"
    9   text: "für Kids von 11-13"
    10   link: "#August_2014"
     8- datum: "August 2014"
     9  titel: "Robotik-Kurs"
     10  untertitel: "für Kids von 11-13"
    1111       
    12 - titel: "Dechiffriermaschine"
    13   text: "Historischer 5-Bit Decoder"
    14   link: "#Juli_2014"
     12- datum: "Juli 2014"
     13  titel: "Dechiffriermaschine"
     14  untertitel: "Historischer 5-Bit Decoder"
    1515       
    16 - titel: "Notizen zum Digitalen"
    17   text: "IBM029 auf Reisen"
    18   link: "#Juni_2014"           
     16- datum: "Juni 2014"
     17  titel: "Notizen zum Digitalen"
     18  untertitel: "IBM029 auf Reisen"
    1919       
    20 - titel: "Neu: Peripherie der IBM1130"
    21   text: "Lochstreifengeräte"
    22   link: "#Mai_2014"     
     20- datum: "Mai 2014"
     21  titel: "Neu: Peripherie der IBM1130"
     22  untertitel: "Lochstreifengeräte"
    2323       
    24 - titel: "Neu: IBM 1130 Anlage"
    25   text: "Eine neue Herausforderung"
    26   link: "#Januar_2014"
     24- datum: "Januar 2014"
     25  titel: "Neu: IBM 1130 Anlage"
     26  untertitel: "Eine neue Herausforderung"
    2727 
    28 - titel: "Neuzugang: Lochkartendoppler"
    29   text: ""
    30   link: "#Dezember_2013"
     28- datum: Dezember 2013
     29  titel: "Neuzugang: Lochkartendoppler"
     30  untertitel: ""
    3131
    32 - titel: "Gamma 55 jetzt voll funktionsfähig!"
    33   text: ""
    34   link: "#September_2013"
     32- datum: September 2013
     33  titel: "Gamma 55 jetzt voll funktionsfähig!"
     34  untertitel: ""
    3535 
    3636       
     
    4343       
    4444       
    45         <p>Damit alle die öfters unsere Homepage besuchen einen schnellen Einblick in Neuigkeiten und Erweiterungen haben, wurde diese Rubrik eingeführt.</p>
     45        <p>Damit alle die öfters unsere Homepage besuchen einen schnellen Einblick in Neuigkeiten und Erweiterungen haben,
     46        wurde diese Rubrik eingeführt. Die Neuigkeiten können sie auch <a href="?format=rss" title="technikum29-Neuigkeiten abonnieren">als RSS-Feed abonnieren</a>.</p>
    4647
    4748<ul class="news-feed news-ng">
  • en/news.php

    r599 r649  
    33        $version = '$Id$';
    44        $titel = "What's new?";
    5        
     5        $menu_version = 2;
     6
    67        $neues_menu = <<< MENU
    7        
    8 - titel: "Art: Notes on digital"
    9   text: "German art"
    10   link: "#June_2014"
    11        
    12 - titel: "Facit papertape device"
    13   text: "IBM1130"
    14   link: "#May_2014"
    15  
    16 - titel: "IBM 1130"
    17   text: ""
    18   link: "#January_2014"
    19  
    20 -titel: "IBM 514"
    21   text: "Reproducing Punch"
    22   link: "#December_2013"
    23  
    24 - titel: "Gamma 55 is up und running"
    25   text: ""
    26   link: "#September_2013"
    27  
    28 - titel: "Punch-Card-Music"
    29   text: "Technique and art"     
    30   link: "#Mai_2013"
    31        
    32  
     8- datum: July 2014
     9  titel: "Historic workshop device"
     10  text: "<em>A historic 5-bit character decoder</em> from the university. Here it is used as a decryption engine in our experimental workshop."
     11  bild: /shared/photos/kommunikationstechnik/telegrafenalphabet.jpg
     12  link: /de/kommunikationstechnik/faxtechnik.php#decoder
     13
     14- datum: June 2014
     15  titel: "Art installation with cards"
     16  text:  "Our Cardpunch IBM029 were on jorney: For some time, it were part of an art installation in Tübingen (Baden-Wüttemberg, near Stuttgart)."
     17  bild: /shared/photos/rechnertechnik/tuebingen.jpg
     18  link: http://www.kunst-stoff.fr/tresorraum/wir-die-iborgs/
     19
     20- datum: May 2014
     21  titel: "Facit papertape device"
     22  untertitel: "IBM1130"
     23  text: "Periphery of the 1130: Facit tape devices"
     24  bild: /shared/photos/rechnertechnik/facit4000.jpg
     25  link: /en/computer/ibm1130.php#1130
     26
     27- datum: January 2014
     28  titel: "IBM 1130"
     29  text: "A new callenge: IBM 1130 Mainframe"
     30  bild: /shared/photos/rechnertechnik/ibm-1130.jpg
     31  link: /en/computer/ibm1130.php#ibm1130
     32
     33- datum: December 2013
     34  titel: Reproducing punch
     35  untertitel: A new IBM device
     36  text: "Recruit: A large IBM reproducing punch from the early days of computing"
     37  bild: /shared/photos/rechnertechnik/ibm-514.jpg
     38  link: /en/computer/punchcard.php#reproducing
     39
     40- datum: September 2013
     41  titel: "Gamma 55 is up und running"
     42  text: "Success! The BULL GAMMA 55 is up and running! An historical moment."
     43  bild: /shared/photos/rechnertechnik/leser617.jpg
     44  link: /en/computer/gamma55.php#ge-55
    3345
    3446MENU;
    3547// ende der menue-Eintraege
    3648
    37         if(!require("../lib/technikum29.php")) return;
     49        if(!require("../lib/news.php")) return;
    3850?>
    3951
     
    4355       posts are on top.</p>
    4456
     57<!--
     58  ACHTUNG, Testlauf im ENGLISCHEN:
     59
     60  Der Inhalt der Neuigkeiten-Datei im englischen ist nun nicht mehr "doppelt-gemoppelt", sondern
     61  wird nur noch einmal gewartet, und zwar in dem obigen Auflistungsbereich. Im Bereich hier unten
     62  wird der obige Inhalt nur noch in die gewohnte HTML-Formatierung gebracht.
     63
     64  - Sven, 28. August 2014
     65-->
     66
    4567<ul class="news-feed news-ng">
     68        <?php /* soll funktion werden in news.php */
     69//function print_newsfeed() {
     70//      global $neues_menu, $lib;
     71        require $lib.'/spyc.php';
     72        $data = Spyc::YAMLLoad($neues_menu);
     73        $fields = array('titel', 'datum', 'text');
    4674
    47 <li><a href="/de/kommunikationstechnik/faxtechnik.php#decoder">
    48         <h3>July 2014</h3>
    49         <img src="/shared/photos/kommunikationstechnik/telegrafenalphabet.jpg" width="153" height="144" />
    50         <em>A historic 5-bit character decoder</em> from the university. Here it is used as a decryption engine in our experimental workshop.
    51 </a></li>
    52 
    53 <li><a href="http://www.kunst-stoff.fr/tresorraum/wir-die-iborgs/">
    54         <h3>June 2014</h3>
    55         <img src="/shared/photos/rechnertechnik/tuebingen.jpg" width="153" height="149" />
    56         Our Cardpunch IBM029 were on jorney: For some time, it were part of an art installation in Tübingen (Baden-Wüttemberg, near Stuttgart).
    57        
    58 </a></li>
     75        $news_ul_content = '';
     76        foreach($data as $e) {
     77                if(!array_reduce(array_map(function($x) use ($fields,$e){ return isset($e[$x]); }, $fields),
     78                                function($a,$b){ return $a && $b;}, true)) {
     79                        print "<li><a href='#'>Fehler in Formatierung!<em>Dieser Menüeintrag ist falsch formatiert</em></a></li>";
     80                        $this->log->WARN("<h5>Neuigkeiten-Liste: Fehler in Formatierung</h5><p>Ein Eintrag in der Neuigkeisten-Liste ist falsch formatiert. Ich erwarte zu jedem Menüeintrag die Felder ".implode(", ", $fields).". Eine der Angaben fehlt oder ist fehlerhaft formatiert: <pre>".var_export($e, true)."</pre>");
     81                } else {
     82                        ?><li><a href="<?php print isset($e['link']) ? $e['link'] : '#'; ?>">
     83                                <h3><?php print $e['datum']; ?></h3>
     84                                <?php print isset($e['bild']) ? "<img src='$e[bild]' alt='$e[titel]'>" : ''; ?>
     85                                <?php print $e['text']; ?>
     86                        </a></li>
     87                        <?php
     88                }
     89        }
     90//}
    5991
    6092
    61 <li><a href="/en/computer/ibm1130.php#1130">
    62         <h3>May 2014</h3>
    63         <img src="/shared/photos/rechnertechnik/facit4000.jpg" width="352" height="137" />
    64         Periphery of the 1130: Facit tape devices
    65 </a></li>
    66 
    67 <li><a href="/en/computer/ibm1130.php#ibm1130">
    68         <h3>January 2014</h3>
    69         <img src="/shared/photos/rechnertechnik/ibm-1130.jpg" alt="IBM 1130" width="225" height="194" />
    70         A new callenge: IBM 1130 Mainframe
    71 </a></li>
    72 
    73 <li><a href="/en/computer/punchcard.php#reproducing">
    74         <h3>December 2013</h3>
    75         <img src="/shared/photos/rechnertechnik/ibm-514.jpg" alt="IBM 514" width="225" height="195" />
    76         Recruit: A large IBM reproducing punch from the early days of computing
    77 </a></li>
    78 
    79 <li><a href="/en/computer/gamma55.php#ge-55">
    80         <h3>September 2013</h3>
    81         <img src="/shared/photos/rechnertechnik/leser617.jpg" alt="Lochkartenleser" width="241" height="149" />
    82         Success! The BULL GAMMA 55 is up and running! An historical moment.
    83 </a></li>
    84 
    85     </ul>
     93//       print_newsfeed();
     94?>
     95</ul>
    8696
    8797
  • lib/host.php

    r561 r649  
    4949        /// This value is computed by setup().
    5050        public $script_filename;
     51
     52        /// $slash_filename: Cross-platform $script_filename, always starting with a "/".
     53        public $slash_filename;
    5154
    5255        /// $ressources: CSS and JavaScript file paths ("Assets"), as used by the RessourceLoader,
     
    229232                   
    230233                $this->script_filename = substr(realpath($_SERVER['SCRIPT_FILENAME']), strlen($this->document_root)); # e.g.: "/de/page.php"
     234
     235                # Bug when DOCUMENT_ROOT ends with trailing slash: make sure $file begins with /:
     236                $this->slash_filename = $this->script_filename;
     237                if($this->slash_filename{0} != '/') $this->slash_filename = '/'.$this->slash_filename;
    231238               
    232239                // Windows realpath() converts Unix Paths ($_SERVER) to Windows Paths (like \en\index.php).
  • lib/menu.php

    r569 r649  
    7373                require_once $this->conf['lib'].'/spyc.php';
    7474                $data = Spyc::YAMLLoad($this->load_news_data());
    75                 $fields = array('titel', 'text', 'link', /*'bild'*/);
     75                $fields = array('datum', 'titel',/* 'untertitel', 'bild'*/);
    7676
    7777                $news_ul_content = '';
     
    8080                                        function($a,$b){ return $a && $b;}, true)) {
    8181                                $li = "<li><a href='#'>Fehler in Formatierung!<em>Dieser Menüeintrag ist falsch formatiert</em></a></li>";
    82                                 $this->log->WARN("<h5>Neuigkeiten-Menü: Fehler in Formatierung</h5><p>Ein Eintrag im Neuigkeiten-Menü ist falsch formatiert.");
     82                                $this->log->WARN("<h5>Neuigkeiten-Menü: Fehler in Formatierung</h5><p>Ein Eintrag im Neuigkeiten-Menü ist falsch formatiert. Ich erwarte zu jedem Menüeintrag die Felder ".implode(", ", $fields).". Eine der Angaben fehlt oder ist fehlerhaft formatiert: <pre>".var_export($e, true)."</pre>");
    8383                        } else {
    84                                 $url = ($e['link']{0} == '#' ? $this->conf['lang_path'].'/'.self::news_file : '').$e['link'];
     84                                // Ehemals konnte die URL per "link: #August_2013" angegeben werden oder "link: /de/irgendwohin".
     85                                // $url = ($e['link']{0} == '#' ? $this->conf['lang_path'].'/'.self::news_file : '').$e['link'];
     86                                // Jetzt wird die URL automatisch aus dem Datum gebaut (slugify-artig)
     87                                $url = $this->conf['lang_path'].'/'.self::news_file.'#'.str_replace(' ', '_', $e['datum']);
    8588                                if($host)
    8689                                        $url = $host->rewrite_link($url);
    87                                 $li = "<li><a href='$url'>$e[titel]<span class='hidden'>: </span><em>$e[text]</em></a></li>";
     90
     91                                // optionales Feld: Untertitel
     92                                if(!isset($e['untertitel'])) $e['untertitel'] = '';
     93
     94                                // weiteres optionales Feld: Bildeinbindung
     95                                $img = !isset($e['bild']) ? '' : "<img src='$e[bild]' style='max-width:64px; max-height:64px;'>";
     96                                $li = "<li><a href='$url'>$img$e[titel]<span class='hidden'>: </span><em>$e[untertitel]</em></a></li>";
    8897                        }
    8998                        $news_ul_content .= "\t".$li."\n";
  • lib/messages.php

    r585 r649  
    172172                'js-interlang-notify-heading' => array("This page is also avaliable in English", "Diese Website gibt es auch auf Deutsch"),
    173173                '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?"),
     174
     175                // RSS-feed, in /lib/news.php verwendet
     176                'rss-title' => array('technikum29 Computer Museum - Was gibt es Neues?','technikum29 Computer Museum - What\'s new?'),
     177                'rss-description' => array('Neuste Geräte und Erweiterungen im technikum29-Computermuseum', 'The latest devices and news from the technikum29 computer museum'),
     178                'rss-copyright' => array('Heribert Müller und das technikum29-Team', 'Heribert Müller and the technikum29 team'),
     179               
    174180        );
    175181}
  • lib/news.php

    r644 r649  
    2323$required_fields = array('titel', 'text', 'link', /*'bild'*/);
    2424
     25# Hack, um die Sprache zu bekommen, von technikum29.php kopiert.
     26require "$lib/host.php";
     27$host = t29Host::detect();
     28$file = $host->slash_filename; # e.g.: "/de/page.php"
     29if(!isset($lang)) $lang = substr($file, 1, 2);
     30if(!in_array($lang, array('de','en'))) $lang = "de"; # check if language exists
     31
     32require $lib.'/messages.php';
     33$msg = new t29Messages($lang);
     34$p = $msg->get_shorthand_printer();
     35
    2536# und hostname davor.
    2637# $this->conf['lang_path'].'/'.self::news_file
    27 $news_url = "http://www.technikum29.de/de/news";
     38$news_url = "http://www.technikum29.de/$lang/news";
    2839# if($host)     $url = $host->rewrite_link($url);
    2940
     
    3546<rss
    3647   xmlns:atom="http://www.w3.org/2005/Atom"
    37    xml:lang="de-DE"
     48   xml:lang="<?php print $lang; ?>"
    3849   version="2.0">
    3950    <channel>
    40         <title>technikum29 Computer Museum - Was gibt es Neues?</title>
     51        <title><?php $p('rss-title'); ?></title>
    4152        <link>http://www.technikum29.de</link>
    42         <description>Neuste Geräte und Erweiterungen im technikum29-Computermuseum</description>
    43         <language>de-DE</language>
    44         <copyright>&#x2117; &amp; &#xA9; 2033-<?=date('Y'); ?> Heribert Müller und das technikum29-Team</copyright>
     53        <description><?php $p('rss-description'); ?></description>
     54        <language><?php print $lang; ?></language>
     55        <copyright>&#x2117; &amp; &#xA9; 2003-<?=date('Y'); ?> <?php $p('rss-copyright'); ?></copyright>
    4556        <pubDate><?=date('r', $pubdate); ?></pubDate>
    4657        <image>
    47                 <url>http://www.technikum29.de/shared/img-v6/banner.de.png</url>
     58                <url>http://www.technikum29.de/shared/img-v6/banner.<?php print $lang; ?>.png</url>
    4859                <title>technikum29 Computermuseum</title>
    4960                <link>http://www.technikum29.de/</link>
     
    5263        <!--<ttl><?=60*12; ?></ttl>--><!-- half a day -->
    5364       
    54         <atom:link href="http://www.technikum29.de/de/news.php?format=rss" rel="self" type="application/rss+xml" />     
     65        <atom:link href="http://www.technikum29.de/<?php print $lang; ?>/news.php?format=rss" rel="self" type="application/rss+xml" /> 
    5566       
    5667        <?php
    5768        foreach($data as $e) {
     69                // Kompatibilitaet im August 2014, Uebergangsphase
     70                if(!isset($e['text']) && isset($e['untertitel'])) $e['text'] = $e['untertitel'];
     71                if(!isset($e['link']) && isset($e['datum'])) $e['link'] = $news_url.'#'.str_replace(' ', '_', $e['datum']);
     72
    5873                if(!array_reduce(array_map(function($x) use ($required_fields,$e){ return isset($e[$x]); }, $required_fields),
    5974                                function($a,$b){ return $a && $b;}, true)) {
     
    6176                        <item>
    6277                                <title>Fehlformatierung</title>
    63                                 <description>Leider ist dieser Eintrag nicht richtig formatiert. Schauen Sie sich die News-Seite direkt an.</description>
     78                                <description><![CDATA[<html><body>
     79                                        <b>Leider ist dieser Eintrag nicht richtig formatiert</b>. Schauen Sie sich die News-Seite direkt an.
     80                                        <p><i>Details:</i></p>
     81                                        Eines der Fehler Felder <?php print implode(", ", $required_fields); ?> fehlt.
     82                                        Details: <pre><?php print var_dump($e); ?></pre>
     83                                </body></html>]]>
     84                                </description>
    6485                                <link>http://www.technikum29.de/de/news</link>
    6586                        </item>
     
    6990                        <item>
    7091                                <title><?=$e['titel']; ?></title>
    71                                 <description><?=$e['text']; ?></description>
     92                                <description><?php
     93                                        // if text contains tags like <em>, mark it as HTML
     94                                        if(strpos($e['text'], '<') !== false) { print '<![CDATA[<html><body>'; }
     95                                        print $e['text'];
     96                                        if(strpos($e['text'], '<') !== false) { print '</body></html>]]>'; } ?>
     97                                </description>
    7298                                <author>Heribert Müller</author>
    7399                                <?php
    74                                         $link =  ($e['link']{0} == '#' ? $news_url : '').$e['link'];
     100                                        if($e['link']{0} == '#') $link = $news_url . $e['link'];
     101                                        else if($e['link']{0} == '/') $link = 'http://www.technikum29.de' . $e['link'];
     102                                        else $link = $e['link'];
    75103                                ?>
    76104                                <link><?=$link; ?></link>
     
    89117// rss ausgegeben, jetzt: exit um nicht noch Seite auszugeben.
    90118exit();
    91 
    92119} else {
     120        // bin eingebunden von news-Seite
    93121        require("$lib/technikum29.php");
     122        // wichtig:
    94123        return true;
    95124}
     125
  • lib/technikum29.php

    r585 r649  
    2727require "$lib/host.php";
    2828$host = $external ? t29Host::create('t29ExternalHost') : t29Host::detect();
    29 
    30 $file = $host->script_filename; # e.g.: "/de/page.php"
    31 # Bug when DOCUMENT_ROOT ends with trailing slash: make sure $file begins with /:
    32 if($file{0} != '/') $file = "/$file";
     29$file = $host->slash_filename; # e.g.: "/de/page.php"
    3330
    3431// exactly define debugging behaviour
  • lib/template.php

    r618 r649  
    255255  <link rel="copyright" href="<?php print $href($_('footer-legal-file')); ?>" title="<?php $p('footer-legal-link'); ?>">
    256256  <link rel="search" type="application/opensearchdescription+xml" href="<?php print $href($_('topnav-search-page')); print '?action=opensearch-desc&amp;lang='.$this->conf['lang']; ?>" title="<?php $p('opensearch-desc'); ?>">
    257   <link rel="alternate" type="application/rss+xml" href="/de/news.php?format=rss" title="Neuigkeiten vom technikum29-Museum" />
     257  <link rel="alternate" type="application/rss+xml" href="/<?php print $this->conf['lang']; ?>/news.php?format=rss" title="<?php $p('rss-title'); ?>" />
    258258  <?php
    259259        // print interlanguage links for all languages except the active one
  • shared/css-v6/modules/11-header.css

    r580 r649  
    137137        float: left;
    138138        margin-right: 10px;
    139         display: none; /* ausblenden */
     139        /*display: none;*/ /* ausblenden */ /* warum ausblenden? */
    140140}
    141141
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