/**
* $registry
* $notification
* $conf
* $criteria
*
*/
public function run()
{
extract($this->_params, EXTR_REFS);
$templates = Horde::loadConfiguration('templates.php', 'templates', 'jonah');
/* Get requested channel. */
try {
$channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($criteria['feed']);
} catch (Exception $e) {
Horde::log($e, 'ERR');
$notification->push(_("Invalid channel."), 'horde.error');
Horde::url('delivery/index.php', true)->redirect();
exit;
}
$title = sprintf(_("HTML Delivery for \"%s\""), $channel['channel_name']);
$options = array();
foreach ($templates as $key => $info) {
$options[] = '<option value="' . $key . '"' . ($key == $criteria['format'] ? ' selected="selected"' : '') . '>' . $info['name'] . '</option>';
}
$template = new Horde_Template();
$template->setOption('gettext', 'true');
$template->set('url', Horde::selfUrl());
$template->set('session', Horde_Util::formInput());
$template->set('channel_id', $criteria['feed']);
$template->set('channel_name', $channel['channel_name']);
$template->set('format', $criteria['format']);
$template->set('options', $options);
// @TODO: This is ugly. storage driver shouldn't be rendering any display
// refactor this to use individual views possibly with a choice of different templates
$template->set('stories', $GLOBALS['injector']->getInstance('Jonah_Driver')->renderChannel($criteria['feed'], $criteria['format']));
// Buffer the notifications and send to the template
Horde::startBuffer();
$GLOBALS['notification']->notify(array('listeners' => 'status'));
$template->set('notify', Horde::endBuffer());
$GLOBALS['page_output']->header(array('title' => $title));
echo $template->fetch(JONAH_TEMPLATES . '/delivery/html.html');
$GLOBALS['page_output']->footer();
}