phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: news_admin/inc class.uinews.inc.php,1.10.2.5,1.


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] CVS: news_admin/inc class.uinews.inc.php,1.10.2.5,1.10.2.6
Date: Wed, 19 Mar 2003 02:57:23 -0500

Update of /cvsroot/phpgroupware/news_admin/inc
In directory subversions:/tmp/cvs-serv13646

Modified Files:
      Tag: Version-0_9_14-branch
        class.uinews.inc.php 
Log Message:
Fix for Bug #1559

Index: class.uinews.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.uinews.inc.php,v
retrieving revision 1.10.2.5
retrieving revision 1.10.2.6
diff -C2 -r1.10.2.5 -r1.10.2.6
*** class.uinews.inc.php        21 Oct 2002 20:28:36 -0000      1.10.2.5
--- class.uinews.inc.php        19 Mar 2003 07:57:21 -0000      1.10.2.6
***************
*** 1,241 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - News                                                   
   *
!       * http://www.phpgroupware.org                                           
   *
!       * --------------------------------------------                          
   *
!       *  This program is free software; you can redistribute it and/or modify 
it *
!       *  under the terms of the GNU General Public License as published by 
the   *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
!       *  option) any later version.                                           
   *
!       * --------------------------------------------                          
   *
!       * This program was sponsered by Golden Glair productions                
   *
!       * http://www.goldenglair.com                                            
   *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       class uinews
!       {
!               var $template;
!               var $bonews;
!               var $public_functions = array(
!                       'show_news'      => True,
!                       'show_news_home' => True
!               );
! 
!               function uinews()
!               {
!                       $this->template = $GLOBALS['phpgw']->template;
!                       $this->bonews   = CreateObject('news_admin.bonews');
!                       
$this->template->set_root($GLOBALS['phpgw']->common->get_tpl_dir('news_admin'));
!               }
! 
!               function show_news($show_category_select = False)
!               {
!                       global $cat_id, $start, $category_list, $oldnews;
! 
!                       if (! function_exists('parse_navbar'))
!                       {
!                               $GLOBALS['phpgw']->common->phpgw_header();
!                               echo parse_navbar();
!                       }
! 
!                       if (! $cat_id)
!                       {
!                               $cat_id = 0;
!                       }
! 
!                       $this->template->set_file(array(
!                               '_news' => 'news.tpl'
!                       ));
!                       $this->template->set_block('_news','news_form');
!                       $this->template->set_block('_news','row');
!                       $this->template->set_block('_news','category');
! 
!                       if (function_exists('get_var'))
!                       {
!                               $news_id = get_var('news_id',Array('GET'));
!                       }
!                       else
!                       {       
!                               $news_id = $GLOBALS['HTTP_GET_VARS']['news_id'];
!                       }
! 
!                       if($news_id)
!                       {
!                               $news = $this->bonews->get_news($news_id);
!                       }
!                       else
!                       {
!                               $news = $this->bonews->get_NewsList($cat_id, 
$oldnews, $start, $total);
!                       }
! 
!                       $total = $this->bonews->get_NumNewsInCat($cat_id);
! 
!                       $var = Array();
! 
!                       
$this->template->set_var('icon',$GLOBALS['phpgw']->common->image('news_admin','news-corner.gif'));
! 
!                       if ($show_category_select || $category_list)
!                       {
!                               $var['form_action'] = 
$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uinews.show_news&category_list=True');
!                               $var['lang_category'] = lang('Category');
! 
!                               $var['lang_main'] = lang('Main');
! //                            $cats = createobject('phpgwapi.categories');
!                               $var['input_category'] = 
ExecMethod('phpgwapi.categories.formated_list',
!                                       Array(
!                                               'format'        =>'select',
!                                               'type'  => 'mains',
!                                               'selected'      => $cat_id
!                                       )
!                               );
!                               $this->template->set_var($var);
!                               $this->template->parse('_category','category');
!                       }
! 
!                       foreach($news as $newsitem)
!                       {
!                               $var = Array(
!                                       'subject'       => $newsitem['subject'],
!                                       'submitedby'    => 'Submitted by ' . 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' on ' . 
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
!                                       'content'       => 
nl2br($newsitem['content'])
!                               );
! 
!                               $this->template->set_var($var);
!                               $this->template->parse('rows','row',True);
!                       }
! 
!                       $this->template->pfp('_out','news_form');
!                       if ($total > 5 && ! $oldnews)
!                       {
!                               $link_values = array(
!                                       'menuaction'    => 
'news_admin.uinews.show_news',
!                                       'oldnews'       => 'True',
!                                       'cat_id'        => $cat_id,
!                                       'category_list' => 'True'
!                               );
! 
!                               echo '<center><a href="' . 
$GLOBALS['phpgw']->link('/index.php',$link_values) . '">View news 
archives</a></center>';
!                       }
!               }
! 
!               function show_news_home()
!               {
!                       $title = '<font color="#FFFFFF">'.lang('News 
Admin').'</font>';
!                       $portalbox = CreateObject('phpgwapi.listbox',array(
!                               'title'     => $title,
!                               'primary'   => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'secondary' => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'tertiary'  => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'width'     => '100%',
!                               'outerborderwidth' => '0',
!                               'header_background_image' => 
$GLOBALS['phpgw']->common->image('phpgwapi/templates/default','bg_filler')
!                       ));
! 
!                       $app_id = 
$GLOBALS['phpgw']->applications->name2id('news_admin');
!                       $GLOBALS['portal_order'][] = $app_id;
! 
!                       $var = Array(
!                               'up'       => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'down'     => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'close'    => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'question' => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'edit'     => Array('url' => '/set_box.php', 
'app' => $app_id)
!                       );
! 
!                       while(list($key,$value) = each($var))
!                       {
!                               $portalbox->set_controls($key,$value);
!                       }
! 
!                       $total = $this->bonews->get_NumNewsInCat(0);
! 
!                       $newslist = $this->bonews->get_newslist($cat_id);
! 
!                       $image_path = 
$GLOBALS['phpgw']->common->get_image_path('news_admin');
! 
!                       foreach($newslist as $newsitem)
!                       {
!                               $portalbox->data[] = array(
!                                       'text' => $newsitem['subject'] . ' - ' 
. lang('Submitted by') . ' ' . 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' ' . 
lang('on') . ' ' . 
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
!                                       'link' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uinews.show_news&news_id='
 . $newsitem['id'])
!                               );
!                       }
! 
!                       $tmp = "\r\n"
!                               . '<!-- start News Admin -->' . "\r\n"
!                               . $portalbox->draw()
!                               . '<!-- end News Admin -->'  . "\r\n";
!                       
$GLOBALS['phpgw']->template->set_var('phpgw_body',$tmp,True);
!               }
! 
!               function show_news_website($section='mid')
!               {
!                       global $cat_id, $start, $oldnews;
! 
!                       if (! $cat_id)
!                       {
!                               $cat_id = 0;
!                       }
! 
!                       $this->template->set_file(array(
!                               '_news' => 'news_' . $section . '.tpl'
!                       ));
!                       $this->template->set_block('_news','news_form');
!                       $this->template->set_block('_news','row');
!                       $this->template->set_block('_news','category');
! 
!                       if (function_exists('get_var'))
!                       {
!                               $news_id = get_var('news_id',Array('GET'));
!                       }
!                       else
!                       {   
!                               $news_id = $GLOBALS['HTTP_GET_VARS']['news_id'];
!                       }
! 
!                       if($news_id)
!                       {
!                               $news = $this->bonews->get_news($news_id);
!                       }
!                       else
!                       {
!                               $news = 
$this->bonews->get_NewsList($cat_id,$oldnews,$start,$total);
!                       }
! 
! 
!                       $total = $this->bonews->get_NumNewsInCat($cat_id);
! 
!                       $var = Array();
! 
!                       
$this->template->set_var('icon',$GLOBALS['phpgw']->common->image('news_admin','news-corner.gif'));
! 
!                       foreach($news as $newsitem)
!                       {
!                               $var = Array(
!                                       'subject'    => $newsitem['subject'],
!                                       'submitedby' => 'Submitted by ' . 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' on ' . 
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
!                                       'content'    => 
nl2br($newsitem['content'])
!                               );
! 
!                               $this->template->set_var($var);
!                               $this->template->parse('rows','row',True);
!                       }
! 
!                       $out = $this->template->fp('out','news_form');
! 
!                       if ($total > 5 && ! $oldnews)
!                       {
!                               $link_values = array(
!                                       'menuaction'    => 
'news_admin.uinews.show_news',
!                                       'oldnews'       => 'True',
!                                       'cat_id'        => $cat_id,
!                                       'category_list' => 'True'
!                               );
! 
!                               $out .= '<center><a href="' . 
$GLOBALS['phpgw']->link('/index.php',$link_values) . '">View news 
archives</a></center>';
!                       }
!                       return $out;
!               }
!       }
--- 1,255 ----
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - News                                                   
   *
!       * http://www.phpgroupware.org                                           
   *
!       * --------------------------------------------                          
   *
!       *  This program is free software; you can redistribute it and/or modify 
it *
!       *  under the terms of the GNU General Public License as published by 
the   *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
!       *  option) any later version.                                           
   *
!       * --------------------------------------------                          
   *
!       * This program was sponsered by Golden Glair productions                
   *
!       * http://www.goldenglair.com                                            
   *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       class uinews
!       {
!               var $template;
!               var $bonews;
!               var $public_functions = array(
!                       'show_news'      => True,
!                       'show_news_home' => True
!               );
! 
!               function uinews()
!               {
!                       $this->template = $GLOBALS['phpgw']->template;
!                       $this->bonews   = CreateObject('news_admin.bonews');
!                       
$this->template->set_root($GLOBALS['phpgw']->common->get_tpl_dir('news_admin'));
!               }
! 
!               function show_news($show_category_select = False)
!               {
!                       global $cat_id, $start, $category_list, $oldnews;
! 
!                       if (! function_exists('parse_navbar'))
!                       {
!                               $GLOBALS['phpgw']->common->phpgw_header();
!                               echo parse_navbar();
!                       }
! 
!                       if (! $cat_id)
!                       {
!                               $cat_id = 0;
!                       }
! 
!                       if (function_exists('get_var'))
!                       {
!                               $news_id = get_var('news_id',Array('GET'));
!                       }
!                       else
!                       {       
!                               $news_id = $GLOBALS['HTTP_GET_VARS']['news_id'];
!                       }
! 
!                       if($news_id)
!                       {
!                               $news = $this->bonews->get_news($news_id);
!                       }
!                       else
!                       {
!                               $news = $this->bonews->get_NewsList($cat_id, 
$oldnews, $start, $total);
!                       }
! 
!                       $total = $this->bonews->get_NumNewsInCat($cat_id);
! 
!                       if($total)
!                       {
!                       $this->template->set_file(array(
!                               '_news' => 'news.tpl'
!                       ));
!                       $this->template->set_block('_news','news_form');
!                       $this->template->set_block('_news','row');
!                       $this->template->set_block('_news','category');
!   
!                       $var = Array();
!   
!                       
$this->template->set_var('icon',$GLOBALS['phpgw']->common->image('news_admin','news-corner.gif'));
!   
!                       if ($show_category_select || $category_list)
!                       {
!                               $var['form_action'] = 
$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uinews.show_news&category_list=True');
!                               $var['lang_category'] = lang('Category');
!   
!                               $var['lang_main'] = lang('Main');
!   //                          $cats = createobject('phpgwapi.categories');
!                               $var['input_category'] = 
ExecMethod('phpgwapi.categories.formated_list',
!                                       Array(
!                                               'format'        =>'select',
!                                               'type'  => 'mains',
!                                               'selected'      => $cat_id
!                                       )
!                               );
!                               $this->template->set_var($var);
!                               $this->template->parse('_category','category');
!                       }
!   
!                       foreach($news as $newsitem)
!                       {
!                               $var = Array(
!                                       'subject'       => $newsitem['subject'],
!                                       'submitedby'    => 'Submitted by ' . 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' on ' . 
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
!                                       'content'       => 
nl2br($newsitem['content'])
!                               );
!   
!                               $this->template->set_var($var);
!                               $this->template->parse('rows','row',True);
!                       }
!   
!                       $this->template->pfp('_out','news_form');
!                       if ($total > 5 && ! $oldnews)
!                       {
!                               $link_values = array(
!                                       'menuaction'    => 
'news_admin.uinews.show_news',
!                                       'oldnews'       => 'True',
!                                       'cat_id'        => $cat_id,
!                                       'category_list' => 'True'
!                               );
!   
!                               echo '<center><a href="' . 
$GLOBALS['phpgw']->link('/index.php',$link_values) . '">View news 
archives</a></center>';
!                       }
!                       }
!                       else
!                       {
!                               echo '<p align="center">' . lang('no news') . 
'</p>';
!                       }
!               }
! 
!               function show_news_home()
!               {
!                       $title = '<font color="#FFFFFF">'.lang('News 
Admin').'</font>';
!                       $portalbox = CreateObject('phpgwapi.listbox',array(
!                               'title'     => $title,
!                               'primary'   => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'secondary' => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'tertiary'  => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'width'     => '100%',
!                               'outerborderwidth' => '0',
!                               'header_background_image' => 
$GLOBALS['phpgw']->common->image('phpgwapi/templates/default','bg_filler')
!                       ));
! 
!                       $app_id = 
$GLOBALS['phpgw']->applications->name2id('news_admin');
!                       $GLOBALS['portal_order'][] = $app_id;
! 
!                       $var = Array(
!                               'up'       => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'down'     => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'close'    => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'question' => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'edit'     => Array('url' => '/set_box.php', 
'app' => $app_id)
!                       );
! 
!                       while(list($key,$value) = each($var))
!                       {
!                               $portalbox->set_controls($key,$value);
!                       }
! 
!                       $total = $this->bonews->get_NumNewsInCat(0);
! 
!                       $newslist = $this->bonews->get_newslist($cat_id);
! 
!                       $image_path = 
$GLOBALS['phpgw']->common->get_image_path('news_admin');
! 
!                       if(is_array($newslist))
!                       {
!                       foreach($newslist as $newsitem)
!                       {
!                               $portalbox->data[] = array(
!                                       'text' => $newsitem['subject'] . ' - ' 
. lang('Submitted by') . ' ' . 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' ' . 
lang('on') . ' ' . 
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
!                                       'link' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uinews.show_news&news_id='
 . $newsitem['id'])
!                               );
!                       }
!                       }
!                       else
!                       {
!                               $portalbox->data[] = array('text' => lang('no 
news'));
!                       }
! 
!                       $tmp = "\r\n"
!                               . '<!-- start News Admin -->' . "\r\n"
!                               . $portalbox->draw()
!                               . '<!-- end News Admin -->'  . "\r\n";
!                       
$GLOBALS['phpgw']->template->set_var('phpgw_body',$tmp,True);
!               }
! 
!               function show_news_website($section='mid')
!               {
!                       global $cat_id, $start, $oldnews;
! 
!                       if (! $cat_id)
!                       {
!                               $cat_id = 0;
!                       }
! 
!                       $this->template->set_file(array(
!                               '_news' => 'news_' . $section . '.tpl'
!                       ));
!                       $this->template->set_block('_news','news_form');
!                       $this->template->set_block('_news','row');
!                       $this->template->set_block('_news','category');
! 
!                       if (function_exists('get_var'))
!                       {
!                               $news_id = get_var('news_id',Array('GET'));
!                       }
!                       else
!                       {   
!                               $news_id = $GLOBALS['HTTP_GET_VARS']['news_id'];
!                       }
! 
!                       if($news_id)
!                       {
!                               $news = $this->bonews->get_news($news_id);
!                       }
!                       else
!                       {
!                               $news = 
$this->bonews->get_NewsList($cat_id,$oldnews,$start,$total);
!                       }
! 
! 
!                       $total = $this->bonews->get_NumNewsInCat($cat_id);
! 
!                       $var = Array();
! 
!                       
$this->template->set_var('icon',$GLOBALS['phpgw']->common->image('news_admin','news-corner.gif'));
! 
!                       foreach($news as $newsitem)
!                       {
!                               $var = Array(
!                                       'subject'    => $newsitem['subject'],
!                                       'submitedby' => 'Submitted by ' . 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' on ' . 
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
!                                       'content'    => 
nl2br($newsitem['content'])
!                               );
! 
!                               $this->template->set_var($var);
!                               $this->template->parse('rows','row',True);
!                       }
! 
!                       $out = $this->template->fp('out','news_form');
! 
!                       if ($total > 5 && ! $oldnews)
!                       {
!                               $link_values = array(
!                                       'menuaction'    => 
'news_admin.uinews.show_news',
!                                       'oldnews'       => 'True',
!                                       'cat_id'        => $cat_id,
!                                       'category_list' => 'True'
!                               );
! 
!                               $out .= '<center><a href="' . 
$GLOBALS['phpgw']->link('/index.php',$link_values) . '">View news 
archives</a></center>';
!                       }
!                       return $out;
!               }
!       }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]