[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: news_admin/inc class.bo.inc.php,1.1.2.1,1.1.2.2
From: |
Michael Totschnig <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: news_admin/inc class.bo.inc.php,1.1.2.1,1.1.2.2 class.boacl.inc.php,1.1.2.1,1.1.2.2 class.so.inc.php,1.1.2.1,1.1.2.2 class.ui.inc.php,1.1.2.1,1.1.2.2 |
Date: |
Mon, 23 Jun 2003 18:56:33 -0400 |
Update of /cvsroot/phpgroupware/news_admin/inc
In directory subversions:/tmp/cvs-serv22846/inc
Modified Files:
Tag: Version-0_9_16-branch
class.bo.inc.php class.boacl.inc.php class.so.inc.php
class.ui.inc.php
Log Message:
add 'all' argument for retrieving news from all readable categories
Index: class.bo.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.bo.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** class.bo.inc.php 23 Jun 2003 19:20:52 -0000 1.1.2.1
--- class.bo.inc.php 23 Jun 2003 22:56:30 -0000 1.1.2.2
***************
*** 50,54 ****
$this->save_sessiondata();
}
! $this->catbo = createobject('phpgwapi.categories');
$this->cats =
$this->catbo->return_array('all',0,False,'','','cat_name',True);
}
--- 50,54 ----
$this->save_sessiondata();
}
! $this->catbo =
createobject('phpgwapi.categories','','news_admin');
$this->cats =
$this->catbo->return_array('all',0,False,'','','cat_name',True);
}
***************
*** 81,87 ****
function get_newslist($cat_id, $start=0,
$order='',$sort='',$limit=0,$activeonly=False)
{
! return $this->acl->is_permitted($cat_id,PHPGW_ACL_READ)
?
! $this->sonews->get_newslist($cat_id,
$start,$order,$sort,$limit,$activeonly) :
! array();
}
--- 81,104 ----
function get_newslist($cat_id, $start=0,
$order='',$sort='',$limit=0,$activeonly=False)
{
! if ($cat_id == 'all')
! {
! $cat_id_list = array();
! foreach($this->cats as $cat)
! {
! if ($this->acl->is_readable($cat['id']))
! {
! $cat_id_list[] = $cat['id'];
! }
! }
! return $cat_id_list ?
!
$this->sonews->get_newslist($cat_id_list,
$start,$order,$sort,$limit,$activeonly,$this->total) :
! array();
! }
! else
! {
! return $this->acl->is_readable($cat_id) ?
! $this->sonews->get_newslist($cat_id,
$start,$order,$sort,$limit,$activeonly,$this->total) :
! array();
! }
}
***************
*** 98,102 ****
function add($news)
{
! return
$this->acl->is_permitted($news['category'],PHPGW_ACL_ADD) ?
$this->sonews->add($news) :
false;
--- 115,119 ----
function add($news)
{
! return $this->acl->is_writeable($news['category']) ?
$this->sonews->add($news) :
false;
***************
*** 106,111 ****
{
$oldnews = $this->so->get_news($news['id']);
! return
($this->acl->is_permitted($oldnews['category'],PHPGW_ACL_ADD) &&
!
$this->acl->is_permitted($news['category'],PHPGW_ACL_ADD)) ?
$this->sonews->edit($news) :
False;
--- 123,128 ----
{
$oldnews = $this->so->get_news($news['id']);
! return ($this->acl->is_writeable($oldnews['category'])
&&
!
$this->acl->is_writeable($news['category'])) ?
$this->sonews->edit($news) :
False;
***************
*** 131,142 ****
{
$news = $this->sonews->get_news($news_id);
! return
$this->acl->is_permitted($news['category'],PHPGW_ACL_READ) ? $news : False;
! }
!
! function total($cat_id,$activeonly=False)
! {
! return $this->acl->is_permitted($cat_id,PHPGW_ACL_READ)
?
! $this->sonews->total($cat_id,$activeonly) :
! 0;
}
}
--- 148,152 ----
{
$news = $this->sonews->get_news($news_id);
! return $this->acl->is_readable($news['category']) ?
$news : False;
}
}
Index: class.boacl.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.boacl.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** class.boacl.inc.php 23 Jun 2003 19:20:52 -0000 1.1.2.1
--- class.boacl.inc.php 23 Jun 2003 22:56:30 -0000 1.1.2.2
***************
*** 91,94 ****
--- 91,104 ----
}
+ function is_readable($cat_id)
+ {
+ return $this->is_permitted($cat_id,PHPGW_ACL_READ);
+ }
+
+ function is_writeable($cat_id)
+ {
+ return $this->is_permitted($cat_id,PHPGW_ACL_ADD);
+ }
+
function set_rights($cat_id,$read,$write)
{
Index: class.so.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.so.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** class.so.inc.php 23 Jun 2003 19:20:52 -0000 1.1.2.1
--- class.so.inc.php 23 Jun 2003 22:56:30 -0000 1.1.2.2
***************
*** 25,29 ****
! function get_newslist($cat_id, $start,
$order,$sort,$limit=0,$activeonly)
{
if ($order)
--- 25,29 ----
! function get_newslist($cat_id, $start,
$order,$sort,$limit=0,$activeonly,&$total)
{
if ($order)
***************
*** 36,44 ****
}
! $sql = 'SELECT * FROM phpgw_news WHERE news_cat=' .
intval($cat_id);
! $sql .= $activeonly ? " AND news_status='Active'" : '';
! $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__,$limit);
$news = array();
--- 36,55 ----
}
! if (is_array($cat_id))
! {
! $filter = "IN (" . implode(',',$cat_id) . ')';
! }
! else
! {
! $filter = "=" . intval($cat_id);
! }
+ $sql = 'SELECT * FROM phpgw_news WHERE news_cat ' .
$filter;
+ $sql .= $activeonly ? " AND news_status='Active'" : '';
+ $sql .= $ordermethod;
! $this->db->query($sql,__LINE__,__FILE__);
! $total = $this->db->num_rows();
!
$this->db->limit_query($sql,$start,__LINE__,__FILE__,$limit);
$news = array();
***************
*** 106,125 ****
{
$this->db->query('DELETE FROM phpgw_news WHERE
news_id=' . intval($news_id) ,__LINE__,__FILE__);
- }
-
-
- function total($cat_id,$activeonly)
- {
- $sql = 'SELECT COUNT(*) FROM phpgw_news WHERE
news_cat=' . intval($cat_id);
- $sql .= $aciveonly ? " AND news_status='Active'" : '';
- $this->db->query($sql,__LINE__,__FILE__);
- if ($this->db->next_record())
- {
- return (int) $this->db->f(0);
- }
- else
- {
- return 0;
- }
}
--- 117,120 ----
Index: class.ui.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.ui.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** class.ui.inc.php 23 Jun 2003 19:20:52 -0000 1.1.2.1
--- class.ui.inc.php 23 Jun 2003 22:56:30 -0000 1.1.2.2
***************
*** 82,86 ****
$news = $news_id ? array($news_id =>
$this->bo->get_news($news_id)) :
$this->bo->get_newslist($this->cat_id,$this->start,'','',$limit,True);
- $total = $this->bo->total($this->cat_id,True);
$this->template->set_file(array(
--- 82,85 ----
***************
*** 126,130 ****
);
}
! if ($total > $this->start + $limit)
{
$link_data['menuaction'] =
'news_admin.ui.read_news';
--- 125,129 ----
);
}
! if ($this->bo->total > $this->start + $limit)
{
$link_data['menuaction'] =
'news_admin.ui.read_news';
***************
*** 134,138 ****
);
}
! if (! $total)
{
$this->template->set_var('row_message',lang('No
entries found'));
--- 133,137 ----
);
}
! if (! $this->bo->total)
{
$this->template->set_var('row_message',lang('No
entries found'));
***************
*** 143,146 ****
--- 142,146 ----
}
+ //this is currently broken
function show_news_home()
{
***************
*** 172,177 ****
}
- $total = $this->bo->total(0,True);
-
$newslist = $this->bo->get_newslist($cat_id);
--- 172,175 ----
***************
*** 230,236 ****
}
-
- $total = $this->bo->total($cat_id,True);
-
$var = Array();
--- 228,231 ----
***************
*** 251,255 ****
$out = $this->template->fp('out','news_form');
! if ($total > 5 && ! $oldnews)
{
$link_values = array(
--- 246,250 ----
$out = $this->template->fp('out','news_form');
! if ($this->bo->total > 5 && ! $oldnews)
{
$link_values = array(
***************
*** 473,486 ****
$this->template->set_var('header_view','view');
- $total = $this->bo->total($this->cat_id);
$items =
$this->bo->get_newslist($this->cat_id,$this->start,$this->order,$this->sort);
! $left =
$this->nextmatchs->left('/index.php',$this->start,$total,'menuaction=news_admin.ui.write_news');
! $right =
$this->nextmatchs->right('/index.php',$this->start,$total,'menuaction=news_admin.ui.write_news');
$this->template->set_var(array(
'left' => $left,
'right' => $right,
! 'lang_showing' =>
$this->nextmatchs->show_hits($total,$this->start),
));
--- 468,480 ----
$this->template->set_var('header_view','view');
$items =
$this->bo->get_newslist($this->cat_id,$this->start,$this->order,$this->sort);
! $left =
$this->nextmatchs->left('/index.php',$this->start,$this->bo->total,'menuaction=news_admin.ui.write_news');
! $right =
$this->nextmatchs->right('/index.php',$this->start,$this->bo->total,'menuaction=news_admin.ui.write_news');
$this->template->set_var(array(
'left' => $left,
'right' => $right,
! 'lang_showing' =>
$this->nextmatchs->show_hits($this->bo->total,$this->start),
));
***************
*** 507,511 ****
}
! if (! $total)
{
$this->nextmatchs->template_alternate_row_color(&$this->template);
--- 501,505 ----
}
! if (! $this->bo->total)
{
$this->nextmatchs->template_alternate_row_color(&$this->template);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: news_admin/inc class.bo.inc.php,1.1.2.1,1.1.2.2 class.boacl.inc.php,1.1.2.1,1.1.2.2 class.so.inc.php,1.1.2.1,1.1.2.2 class.ui.inc.php,1.1.2.1,1.1.2.2,
Michael Totschnig <address@hidden> <=