[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: sitemgr/modules class.module_news.inc.php,1.4,1.
From: |
Michael Totschnig <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: sitemgr/modules class.module_news.inc.php,1.4,1.5 |
Date: |
Sat, 31 May 2003 21:00:41 -0400 |
Update of /cvsroot/phpgroupware/sitemgr/modules
In directory subversions:/tmp/cvs-serv31249/modules
Modified Files:
class.module_news.inc.php
Log Message:
prepare news module for RSS
urlencode [ ] in module's link function
span instead of div in edit_transformer
Index: class.module_news.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/modules/class.module_news.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.module_news.inc.php 16 May 2003 15:58:50 -0000 1.4
--- class.module_news.inc.php 1 Jun 2003 01:00:39 -0000 1.5
***************
*** 1,28 ****
<?php
- class news_transform
- {
- function news_transform(&$template)
- {
- $this->template = $template;
- }
-
- function apply_transform($title,$content)
- {
- $result ='';
- while (list(,$newsitem) = @each($content))
- {
- $this->template->set_var(array(
- 'news_title' => $newsitem['subject'],
- 'news_submitter' =>
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']),
- 'news_date' =>
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
- 'news_content' => $newsitem['content']
- ));
- $result .= $this->template->parse('out','news');
- }
- return $result;
- }
- }
-
class module_news extends Module
{
--- 1,4 ----
***************
*** 30,37 ****
{
//specification of options is postponed into the
get_user_interface function
! $this->arguments = array('category' => array('type' =>
'select', 'label' => lang('Choose a category'), 'options' => array()));
$this->properties = array();
$this->title = lang('News module');
! $this->description = ('This module is just a first
trial of hooking news_admin into sitmgr\'s new architecture.');
}
--- 6,18 ----
{
//specification of options is postponed into the
get_user_interface function
! $this->arguments = array(
! 'category' => array('type' => 'select', 'label'
=> lang('Choose a category'), 'options' => array()),
! 'rsslink' => array('type' => 'checkbox',
'label' => lang('Do you want to publish a RSS feed for this news category'))
! );
! $this->get = array('item');
$this->properties = array();
$this->title = lang('News module');
! $this->description = lang('This module publishes news
from the news_admin application on your website.');
! $this->template;
}
***************
*** 51,70 ****
}
! function set_block($block,$produce=False)
{
! parent::set_block($block,$produce);
! if ($produce)
{
! $t = Createobject('phpgwapi.Template');
! $t->set_root($this->find_template_dir());
! $t->set_file('news','newsblock.tpl');
! $this->add_transformer(new news_transform($t));
}
}
! function get_content(&$arguments,$properties)
{
! $bonews = CreateObject('news_admin.bonews');
! return $bonews->get_NewsList($arguments['category'],
false);
}
}
--- 32,89 ----
}
! function get_content(&$arguments,$properties)
{
! $bonews = CreateObject('news_admin.bonews');
!
! $this->template = Createobject('phpgwapi.Template');
! $this->template->set_root($this->find_template_dir());
! $this->template->set_file('news','newsblock.tpl');
!
$this->template->set_block('news','NewsBlock','newsitem');
!
$this->template->set_block('news','RssBlock','rsshandle');
!
! $item = $arguments['item'];
! if ($item)
! {
! $newsitem = $bonews->get_news($item);
! if ($newsitem)
! {
! $this->render($newsitem[$item]);
! return
$this->template->get_var('newsitem');
! }
! else
! {
! return lang('No matching news item');
! }
! }
!
! $newslist =
$bonews->get_NewsList($arguments['category'], false);
!
! if ($arguments['rss'])
! {
! $this->template->set_var('rsslink',
!
$GLOBALS['phpgw_info']['server']['webserver_url'] .
'/news_admin/website/export.php?cat_id=' . $arguments['category']);
! $this->template->parse('rsshandle','RssBlock');
! }
! else
! {
! $this->template->set_var('rsshandle','');
! }
!
! while (list(,$newsitem) = @each($newslist))
{
! $this->render($newsitem);
}
+ return $this->template->parse('out','news');
}
! function render($newsitem)
{
! $this->template->set_var(array(
! 'news_title' => $newsitem['subject'],
! 'news_submitter' =>
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']),
! 'news_date' =>
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
! 'news_content' => $newsitem['content']
! ));
! $this->template->parse('newsitem','NewsBlock',True);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: sitemgr/modules class.module_news.inc.php,1.4,1.5,
Michael Totschnig <address@hidden> <=