OSDN Git Service

PATCH: [ 1880489 ] Web: Translations status as RSS feed
authorTim Gerundt <tim@gerundt.de>
Sun, 27 Jan 2008 00:31:15 +0000 (00:31 +0000)
committerTim Gerundt <tim@gerundt.de>
Sun, 27 Jan 2008 00:31:15 +0000 (00:31 +0000)
Web/images/rss.png [new file with mode: 0644]
Web/page.inc
Web/translations/index.php
Web/translations/status_branch.php
Web/translations/status_branch_rss.php [new file with mode: 0644]
Web/translations/status_trunk.php
Web/translations/status_trunk_rss.php [new file with mode: 0644]
Web/translations/translations.inc

diff --git a/Web/images/rss.png b/Web/images/rss.png
new file mode 100644 (file)
index 0000000..b3c949d
Binary files /dev/null and b/Web/images/rss.png differ
index 23b390c..b3ae37b 100644 (file)
@@ -26,7 +26,7 @@
    */
   class Page {
     var $_title, $_charset;
-    var $_description, $_keywords;
+    var $_description, $_keywords, $_rssfeeds;
     var $_tab;
     var $_stablerelease;
 
@@ -38,6 +38,7 @@
       $this->_charset = 'ISO-8859-1';
       $this->_description = 'WinMerge HomePage: Visual text file comparison and merging (Open Source software).';
       $this->_keywords = 'WinMerge, free, download, Beyond Compare, Scooter Software, DLSuperC, DLSubCF, Component Software Diff, Viff, TreeDiff, FileSync, WMatch, Quick Spot, NTDMatch, windiff, WDIFF, FolderMatch, Merge 99, Merge99, PMdiff, PMDiff, PMDIFF, pmdiff, visual, visually, file, folder, directory, synchronization, comparison, graphical, document, text, compare, diff, difference, revision, Araxis, compare folders, compare files, synchronize folders, merge files, merge folders, Y2K, Year 2000, Year 2K, side-by-side, VFC, GFC, gdiff, CSDiff, OS2GFC, vdiff, ediff, fc';
+      $this->_rssfeeds = array();
       $this->_tab = WINMERGE_2_6;
       /* _Stable Release */
       $this->_stablerelease = new Release;
     }
 
     /**
+     * add RSS feed to the page head
+     */
+    function addRssFeed($url, $title = 'RSS') {
+      $this->_rssfeeds[$url] = $title;
+    }
+
+    /**
      * set the tab from the page
      */
     function setTab($tab) {
       $temp .= "  <style type=\"text/css\" media=\"screen\">@import \"/css/screen.css\";</style>\n";
       $temp .= "  <link rel=\"stylesheet\" type=\"text/css\" media=\"print\" href=\"/css/print.css\">\n";
       $temp .= "  <link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/favicon.ico\">\n";
+      foreach ($this->_rssfeeds as $rssurl => $rsstitle) { //for all RSS feeds...
+        $temp .= "  <link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . $rsstitle . "\" href=\"" . $rssurl . "\">\n";
+      }
       $temp .= "</head>\n\n";
       $temp .= "<body>\n";
       $temp .= "<div id=\"head\">\n";
     }
 
     /**
+     * print a RSS feed link
+     */
+    function printRssFeedLink($url, $text = '') {
+      $temp = "<a href=\"" . $url . "\"><img src=\"/images/rss.png\" alt=\"RSS\" border=\"0\"></a>";
+      if ($text != '') { //if WITH text...
+        $temp .= " <a href=\"" . $url . "\"> " . $text . "</a>";
+      }
+      print($temp);
+    }
+
+    /**
      * get the tabs menu from the page
      */
     function getTabs() {
index 7be6824..1a4c7d8 100644 (file)
@@ -2,6 +2,8 @@
   include('../page.inc');\r
 \r
   $page = new Page;\r
+  //$page->addRssFeed('status_branch_rss.php', 'Translations Status (Branch)');\r
+  $page->addRssFeed('status_trunk_rss.php', 'Translations Status (Trunk)');\r
   $page->printHead('WinMerge: Translations', TAB_TRANSLATIONS);\r
 ?>\r
 <h2>Translations</h2>\r
@@ -26,8 +28,8 @@
 <p>The following two pages inform you about the translations status of the stable and developer version of WinMerge:</p>\r
 <ul>\r
   <li><a href="http://winmerge.org/Wiki/Translations">Stable Version (Branch)</a></li>\r
-  <!--<li><a href="status_branch.php">Stable Version (Branch)</a></li>-->\r
-  <li><a href="status_trunk.php">Developer Version (Trunk)</a></li>\r
+  <!--<li><a href="status_branch.php">Stable Version (Branch)</a> <?php $page->printRssFeedLink('status_branch_rss.php'); ?></li>-->\r
+  <li><a href="status_trunk.php">Developer Version (Trunk)</a> <?php $page->printRssFeedLink('status_trunk_rss.php'); ?></li>\r
 </ul>\r
 <?php\r
   $page->printFoot();\r
index 5c992ac..4783901 100644 (file)
@@ -3,12 +3,15 @@
   include('translations.inc');\r
 \r
   $page = new Page;\r
+  $page->addRssFeed('status_branch_rss.php');\r
   $page->printHead('WinMerge: Translations Status (Branch)', TAB_TRANSLATIONS);\r
   \r
   $status = $page->convertXml2Array('status_branch.xml');\r
-  print("<h2>Translations Status (Branch)</h2>\n");\r
+  print("<h2>Translations Status (Branch) ");\r
+  $page->printRssFeedLink('status_branch_rss.php');\r
+  print("</h2>\n");\r
   if (!empty($status)) {\r
-    printTranslationsStatus($status, 'http://winmerge.svn.sourceforge.net/viewvc/winmerge/branch/R2_6/Src/Languages/');\r
+    printTranslationsStatus($status, 'http://winmerge.svn.sourceforge.net/viewvc/winmerge/branch/R2_8/Src/Languages/');\r
     printTranslationsStatusGraphLegend();\r
     print("<h3>Translators</h3>\n");\r
     printTranslationsTranslators($status);\r
diff --git a/Web/translations/status_branch_rss.php b/Web/translations/status_branch_rss.php
new file mode 100644 (file)
index 0000000..0e1256b
--- /dev/null
@@ -0,0 +1,10 @@
+<?php\r
+  header('Content-type: application/rss+xml');\r
+  \r
+  include('../page.inc');\r
+  include('translations.inc');\r
+  \r
+  $page = new Page;\r
+  $status = $page->convertXml2Array('status_branch.xml');\r
+  printTranslationsStatusRSS($status, 'Branch', 'http://winmerge.svn.sourceforge.net/viewvc/winmerge/branch/R2_8/Src/Languages/');\r
+?>
\ No newline at end of file
index a83d418..6ea3bc9 100644 (file)
@@ -3,10 +3,13 @@
   include('translations.inc');\r
 \r
   $page = new Page;\r
+  $page->addRssFeed('status_trunk_rss.php');\r
   $page->printHead('WinMerge: Translations Status (Trunk)', TAB_TRANSLATIONS);\r
   \r
   $status = $page->convertXml2Array('status_trunk.xml');\r
-  print("<h2>Translations Status (Trunk)</h2>\n");\r
+  print("<h2>Translations Status (Trunk) ");\r
+  $page->printRssFeedLink('status_trunk_rss.php');\r
+  print("</h2>\n");\r
   if (!empty($status)) {\r
     printTranslationsStatus($status, 'http://winmerge.svn.sourceforge.net/viewvc/winmerge/trunk/Src/Languages/');\r
     printTranslationsStatusGraphLegend();\r
diff --git a/Web/translations/status_trunk_rss.php b/Web/translations/status_trunk_rss.php
new file mode 100644 (file)
index 0000000..a36152d
--- /dev/null
@@ -0,0 +1,10 @@
+<?php\r
+  header('Content-type: application/rss+xml');\r
+  \r
+  include('../page.inc');\r
+  include('translations.inc');\r
+  \r
+  $page = new Page;\r
+  $status = $page->convertXml2Array('status_trunk.xml');\r
+  printTranslationsStatusRSS($status, 'Trunk', 'http://winmerge.svn.sourceforge.net/viewvc/winmerge/trunk/Src/Languages/');\r
+?>
\ No newline at end of file
index fa236aa..a8b19d7 100644 (file)
   /**\r
    * ...\r
    */\r
+  function printTranslationsStatusRSS($xmlarray, $version, $svnurl) {\r
+    global $page;\r
+    \r
+    $update = $xmlarray['TRANSLATIONS'][0]['UPDATE'][0]['VALUE'];\r
+    $temp = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";\r
+    $temp .= "<rss version=\"2.0\">\n";\r
+    $temp .= "  <channel>\n";\r
+    $temp .= "    <title>WinMerge Translations Status (" . $version . ")</title>\n";\r
+    $temp .= "    <link>http://winmerge.org/</link>\n";\r
+    $temp .= "    <description>...</description>\n";\r
+    $temp .= "    <item>\n";\r
+    $temp .= "      <title>Status from " . $update . "</title>\n";\r
+    $temp .= "      <description>\n";\r
+    $temp .= "        <![CDATA[\n";\r
+    \r
+    $temp .= "<ul>\n";\r
+    $translations = $xmlarray['TRANSLATIONS'][0]['TRANSLATION'];\r
+    $translations = $page->multisortArray($translations, 'LANGUAGE', SORT_ASC);\r
+    for ($i = 0; $i < count($translations); $i++) { //For all translations...\r
+      $translation = $translations[$i];\r
+      $language_name = $translation['LANGUAGE'][0]['VALUE'];\r
+      if ($language_name != 'English') { //If NOT English...\r
+        $file_name = $translation['FILE'][0]['VALUE'];\r
+        $translation_update = $translation['UPDATE'][0]['VALUE'];\r
+        $strings = $translation['STRINGS'][0];\r
+        $strings_untranslated = $strings['UNTRANSLATED'][0]['VALUE'];\r
+        \r
+        $temp .= "  <li>\n";\r
+        $temp .= "    <a href=\"" . $svnurl . $file_name . "\">" . $language_name . "</a> (" . $strings_untranslated . " Untranslated)\n";\r
+        $temp .= "  </li>\n";\r
+      }\r
+    }\r
+    $temp .= "</ul>\n";\r
+    \r
+    $temp .= "        ]]>\n";\r
+    $temp .= "      </description>\n";\r
+    $temp .= "      <guid>" . $update . "</guid>\n";\r
+    $temp .= "      <link>http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "</link>\n";\r
+    $temp .= "    </item>\n";\r
+    $temp .= "  </channel>\n";\r
+    $temp .= "</rss>\n";\r
+    print($temp);\r
+  }\r
+  \r
+  /**\r
+   * ...\r
+   */\r
   function printTranslationsTranslators($xmlarray) {\r
     global $page;\r
     \r