cvs: doc-editor / TODO /js main.js /php ExtJsController.php NewsReader.php class.php

From: Date: Sat, 18 Apr 2009 09:18:45 +0000
Subject: cvs: doc-editor / TODO /js main.js /php ExtJsController.php NewsReader.php class.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-3783@lists.php.net to get a copy of this message
yannick Sat Apr 18 09:18:45 2009 UTC Added files: /doc-editor/php NewsReader.php Modified files: /doc-editor/js main.js /doc-editor/php class.php ExtJsController.php /doc-editor TODO Log: Implemente new NewsReader class http://cvs.php.net/viewvc.cgi/doc-editor/js/main.js?r1=1.40&r2=1.41&diff_format=u Index: doc-editor/js/main.js diff -u doc-editor/js/main.js:1.40 doc-editor/js/main.js:1.41 --- doc-editor/js/main.js:1.40 Sat Apr 18 08:02:36 2009 +++ doc-editor/js/main.js Sat Apr 18 09:18:45 2009 @@ -512,7 +512,7 @@ url: './php/controller.php' }), baseParams: { - task: 'get-mailing-info' + task: 'get-last-news' }, reader: new Ext.data.JsonReader({ root: 'Items', http://cvs.php.net/viewvc.cgi/doc-editor/php/class.php?r1=1.33&r2=1.34&diff_format=u Index: doc-editor/php/class.php diff -u doc-editor/php/class.php:1.33 doc-editor/php/class.php:1.34 --- doc-editor/php/class.php:1.33 Sat Apr 18 08:15:43 2009 +++ doc-editor/php/class.php Sat Apr 18 09:18:45 2009 @@ -1321,35 +1321,6 @@ } /** - * Get all mail from documentation's LANG mailing list. - * @return An indexed array (id, title, description, link, pubDate). - */ - function get_last_mailing() { - - $url = 'http://news.php.net/group.php?format=rss&group=php.doc'; - - if ($this->cvsLang != 'en') { - $url .= '.' . strtolower(str_replace('_', '-', $this->cvsLang)); - } - - $xml = new SimpleXMLElement(file_get_contents($url)); - - $channel = $xml->channel; - - $i = 0; - foreach ($channel->item as $item) { - $result[$i]['id'] = $i; - $result[$i]['title'] = (string) $item->title; - $result[$i]['description'] = preg_replace('/(<a href[^>]+">)([^>]+)(<\/a>)/', "$2", (string) $item->description); - $result[$i]['link'] = (string) $item->link; - $result[$i]['pubDate'] = date('Y/m/d H:i:s', strtotime((string) $item->pubDate)); - $i++; - } - return $result; - - } - - /** * Get encoding of a file, regarding his XML's header. * @param $file The file to get encoding from. * @param $mode The mode. Must be 'file' if $file is a path to the file, or 'content' if $file is the content of the file. http://cvs.php.net/viewvc.cgi/doc-editor/php/ExtJsController.php?r1=1.13&r2=1.14&diff_format=u Index: doc-editor/php/ExtJsController.php diff -u doc-editor/php/ExtJsController.php:1.13 doc-editor/php/ExtJsController.php:1.14 --- doc-editor/php/ExtJsController.php:1.13 Sat Apr 18 08:15:43 2009 +++ doc-editor/php/ExtJsController.php Sat Apr 18 09:18:45 2009 @@ -11,6 +11,7 @@ require_once './class.php'; require_once './LockFile.php'; require_once './BugReader.php'; +require_once './NewsReader.php'; /** * Ext JS controller class @@ -296,7 +297,10 @@ public function get_mailing_info() { $this->phpDoc->isLogged(); - $r = $this->phpDoc->get_last_mailing(); + + $bugs = new NewsReader($this->phpDoc->cvsLang); + $r = $bugs->getLastNews(); + return $this->getResponse(array('nbItems' => count($r), 'Items' => $r)); } http://cvs.php.net/viewvc.cgi/doc-editor/TODO?r1=1.7&r2=1.8&diff_format=u Index: doc-editor/TODO diff -u doc-editor/TODO:1.7 doc-editor/TODO:1.8 --- doc-editor/TODO:1.7 Sat Apr 18 08:16:10 2009 +++ doc-editor/TODO Sat Apr 18 09:18:45 2009 @@ -4,7 +4,7 @@ * Dedicate a wiki page to the doc-editor (and move this TODO there) * Take a decision once and for all about the app name, and its spelling * Take a decision about the license, and update all the files accordingly -* Use the $Revision: 1.7 $ keyword (in comments, about popup, ..) +* Use the $Revision: 1.8 $ keyword (in comments, about popup, ..) * Allow use for other systems - Other PHP Projects (peardoc, gtkdocs, php-src/README*, phpweb/reST/) - Other VCS Systems (SVN, GIT) @@ -26,7 +26,6 @@ the en/ tree (and other languages? we _should_ be able to rely on TranslationStatus on its own - Create a CvsClient class to handle all the CVS operations (fsockopen() and exec()) - - Create a NewsReader class * Controller - Implement Apache rewriting to have controller actions look like http://foo.com/do/task/?arg=val http://cvs.php.net/viewvc.cgi/doc-editor/php/NewsReader.php?view=markup&rev=1.1 Index: doc-editor/php/NewsReader.php +++ doc-editor/php/NewsReader.php <?php /** * A class for read News form http://news.php.net * */ class NewsReader { /** * The lang * * @var string */ private $lang; /** * Initialise * * @param string $lang */ function __construct($lang) { $this->lang = $lang; } /** * Get all news for this LANG. * * @return An indexed array (id, title, description, link, pubDate) readable by ExtJs */ function getLastNews() { $result = array(); $url = 'http://news.php.net/group.php?format=rss&group=php.doc'; if ($this->lang != 'en') { $url .= '.' . strtolower(str_replace('_', '-', $this->lang)); } $xml = new SimpleXMLElement(file_get_contents($url)); $channel = $xml->channel; $i = 0; foreach ($channel->item as $item) { $result[$i]['id'] = $i; $result[$i]['title'] = (string) $item->title; $result[$i]['description'] = preg_replace('/(<a href[^>]+">)([^>]+)(<\/a>)/', "$2", (string) $item->description); $result[$i]['link'] = (string) $item->link; $result[$i]['pubDate'] = date('Y/m/d H:i:s', strtotime((string) $item->pubDate)); $i++; } return $result; } }

« previous php.doc.cvs (#3783) next »