Permalink
Browse files

Created Archives module

- Allows serving individual list archives by sub-url
- Fixes issues that were in v1 of website
- Fixes 404 conditions from
  http://framework.zend.com/wiki/display/ZFDEV/Mailing+Lists
  • Loading branch information...
1 parent d64e55b commit e7c1e1c218da5190af8b9f65d97e553166d2c9c3 @weierophinney weierophinney committed Sep 24, 2012
@@ -10,6 +10,7 @@
return array(
'modules' => array(
'Application',
+ 'Archives',
'PageController',
'Changelog',
'Downloads',
@@ -76,29 +76,6 @@
),
),
),
- 'archives' => array(
- 'type' => 'Segment',
- 'options' => array(
- 'route' => '/archives[/]',
- 'defaults' => array(
- '__NAMESPACE__' => 'PageController\Controller',
- 'controller' => 'Page',
- 'page' => 'contact/archives',
- ),
- ),
- 'may_terminate' => true,
- 'child_routes' => array(
- 'subscribe' => array(
- 'type' => 'Segment',
- 'options' => array(
- 'route' => 'subscribe[/]',
- 'defaults' => array(
- 'page' => 'contact/subscribe',
- ),
- ),
- ),
- ),
- ),
'irc' => array(
'type' => 'Segment',
'options' => array(
View
@@ -0,0 +1,19 @@
+<?php
+namespace Archives;
+
+class Module
+{
+ public function getAutoloaderConfig()
+ {
+ return array('Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ 'Archives' => __DIR__ . '/src/Archives',
+ ),
+ ));
+ }
+
+ public function getConfig()
+ {
+ return include __DIR__ . '/config/module.config.php';
+ }
+}
@@ -0,0 +1,50 @@
+<?php
+return array(
+ 'controllers' => array(
+ 'invokables' => array(
+ 'Archives\Archives' => 'Archives\ArchivesController',
+ ),
+ ),
+ 'view_manager' => array(
+ 'template_path_stack' => array(
+ 'archives' => __DIR__ . '/../view',
+ ),
+ ),
+ 'router' => array(
+ 'routes' => array(
+ 'archives' => array(
+ 'type' => 'Segment',
+ 'options' => array(
+ 'route' => '/archives[/]',
+ 'defaults' => array(
+ 'controller' => 'Archives\Archives',
+ 'action' => 'list',
+ ),
+ ),
+ 'may_terminate' => true,
+ 'child_routes' => array(
+ 'lists' => array(
+ 'type' => 'Regex',
+ 'options' => array(
+ 'regex' => '(?P<id>announcements|auth|core|contributors|database|documentation|general|gdata|i18n|formats|mvc|server|web-services)/?',
+ 'defaults' => array(
+ 'id' => 'all',
+ ),
+ 'spec' => '%id%',
+ ),
+ ),
+ 'subscribe' => array(
+ 'type' => 'Segment',
+ 'options' => array(
+ 'route' => 'subscribe[/]',
+ 'defaults' => array(
+ 'action' => 'subscribe',
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+);
+
@@ -0,0 +1,65 @@
+<?php
+
+namespace Archives;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\ViewModel;
+
+class ArchivesController extends AbstractActionController
+{
+ /**
+ * All mailing list IDs assigned by Nabble
+ */
+ const ALL = 'f634137';
+ const ANNOUNCEMENTS = 'f680114';
+ const AUTH = 'f676055';
+ const CONTRIBUTORS = 'f680267';
+ const CORE = 'f678360';
+ const DATABASE = 'f671793';
+ const DOCUMENTATION = 'f679193';
+ const FORMATS = 'f677857';
+ const GDATA = 'f675049';
+ const GENERAL = 'f634138';
+ const I18N = 'f677025';
+ const MVC = 'f663775';
+ const SERVER = 'f680177';
+ const WEB_SERVICES = 'f675401';
+
+ protected $map = array(
+ 'all' => self::ALL,
+ 'announcements' => self::ANNOUNCEMENTS,
+ 'auth' => self::AUTH,
+ 'core' => self::CORE,
+ 'contributors' => self::CONTRIBUTORS,
+ 'database' => self::DATABASE,
+ 'documentation' => self::DOCUMENTATION,
+ 'formats' => self::FORMATS,
+ 'gdata' => self::GDATA,
+ 'general' => self::GENERAL,
+ 'i18n' => self::I18N,
+ 'mvc' => self::MVC,
+ 'server' => self::SERVER,
+ 'web-services' => self::WEB_SERVICES,
+ );
+
+ public function listAction()
+ {
+ $list = $this->params()->fromRoute('id', 'all');
+ $list = strtolower($list);
+ if (!isset($this->map[$list])) {
+ $list = 'all';
+ }
+ $model = new ViewModel(array(
+ 'list' => $this->map[$list],
+ ));
+ $model->setTemplate('archives/list');
+ return $model;
+ }
+
+ public function subscribeAction()
+ {
+ $model = new ViewModel();
+ $model->setTemplate('archives/subscribe');
+ return $model;
+ }
+}
@@ -3,10 +3,11 @@ $this->layout()->active = 'participate';
$this->render('page-controller/contact/sidebar');
$this->headTitle()->prepend('Contact');
$this->headTitle()->prepend('Mailing List Archives');
+$list = $this->list;
?>
<section class="contact">
<h1>Mailing List Archives</h1>
<a id="nabblelink" href="http://zend-framework-community.634137.n4.nabble.com/">Zend Framework Community</a>
- <script src="http://zend-framework-community.634137.n4.nabble.com/embed/f634137"></script>
+ <script src="http://zend-framework-community.634137.n4.nabble.com/embed/<?php echo $list ?>"></script>
</section>

0 comments on commit e7c1e1c

Please sign in to comment.