phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] news_admin inc/class.uinews.inc.php setup/setup...


From: Dave Hall
Subject: [Phpgroupware-cvs] news_admin inc/class.uinews.inc.php setup/setup...
Date: Tue, 15 Aug 2006 14:36:05 +0000

CVSROOT:        /cvsroot/phpgroupware
Module name:    news_admin
Changes by:     Dave Hall <skwashd>     06/08/15 14:36:05

Modified files:
        inc            : class.uinews.inc.php 
        setup          : setup.inc.php tables_update.inc.php 
Added files:
        inc            : class.news_admin_bo_hooks.inc.php 

Log message:
        more changes, moved html2text to api, removed stuff already in the api, 
added new hooks and generally cleaned up ready for 18

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/news_admin/inc/class.uinews.inc.php?cvsroot=phpgroupware&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/news_admin/inc/class.news_admin_bo_hooks.inc.php?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/news_admin/setup/setup.inc.php?cvsroot=phpgroupware&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/news_admin/setup/tables_update.inc.php?cvsroot=phpgroupware&r1=1.4&r2=1.5

Patches:
Index: inc/class.uinews.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.uinews.inc.php,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- inc/class.uinews.inc.php    15 Aug 2006 11:42:53 -0000      1.40
+++ inc/class.uinews.inc.php    15 Aug 2006 14:36:05 -0000      1.41
@@ -14,7 +14,7 @@
  * Many enhancements were sponsored by ecotrader.net                        *
  \**************************************************************************/
 
-/* $Id: class.uinews.inc.php,v 1.40 2006/08/15 11:42:53 skwashd Exp $ */
+/* $Id: class.uinews.inc.php,v 1.41 2006/08/15 14:36:05 skwashd Exp $ */
 
 class uinews
 {
@@ -486,7 +486,7 @@
                                        $GLOBALS['data_cleaner'] = 
createObject('phpgwapi.data_cleaner');
                                }
                                $content = 
stripslashes($GLOBALS['data_cleaner']->clean($GLOBALS['RAW_REQUEST']['nl_content'],
 false));
-                               $html2text = 
createObject('news_admin.html2text', $content);
+                               $html2text = createObject('phpgwapi.html2text', 
$content);
                                $content_txt = $html2text->get_text();
                                unset($html2text);
 

Index: setup/setup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/setup/setup.inc.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- setup/setup.inc.php 15 Aug 2006 11:42:57 -0000      1.16
+++ setup/setup.inc.php 15 Aug 2006 14:36:05 -0000      1.17
@@ -9,12 +9,12 @@
        *  option) any later version.                                           
   *
        
\**************************************************************************/
 
-       /* $Id: setup.inc.php,v 1.16 2006/08/15 11:42:57 skwashd Exp $ */
+       /* $Id: setup.inc.php,v 1.17 2006/08/15 14:36:05 skwashd Exp $ */
 
        /* Basic information about this app */
        $setup_info['news_admin']['name']      = 'news_admin';
        //$setup_info['news_admin']['title']     = 'News Admin';
-       $setup_info['news_admin']['version']   = '0.9.17.501';
+       $setup_info['news_admin']['version']   = '0.9.17.502';
        $setup_info['news_admin']['app_order'] = 4;
        $setup_info['news_admin']['enable']    = 1;
        $setup_info['news_admin']['app_group']  = 'accessories';

Index: setup/tables_update.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/setup/tables_update.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- setup/tables_update.inc.php 4 Aug 2005 03:54:33 -0000       1.4
+++ setup/tables_update.inc.php 15 Aug 2006 14:36:05 -0000      1.5
@@ -12,38 +12,32 @@
        * http://www.goldenglair.com                                            
   *
        
\**************************************************************************/
 
-       /* $Id: tables_update.inc.php,v 1.4 2005/08/04 03:54:33 skwashd Exp $ */
+       /* $Id: tables_update.inc.php,v 1.5 2006/08/15 14:36:05 skwashd Exp $ */
 
        $test[] = '0.0.1';
        function news_admin_upgrade0_0_1()
        {
-               global $setup_info;
-
-               $setup_info['news_admin']['currentver'] = '0.8.1';
-               return $setup_info['news_admin']['currentver'];
+               $GLOBALS['setup_info']['news_admin']['currentver'] = '0.8.1';
+               return $GLOBALS['setup_info']['news_admin']['currentver'];
        }
 
        $test[] = '0.8.1';
        function news_admin_upgrade0_8_1()
        {
-               global $setup_info, $phpgw_setup;
+               
$GLOBALS['phpgw_setup']->oProc->RenameTable('webpage_news','phpgw_news');
 
-               $phpgw_setup->oProc->RenameTable('webpage_news','phpgw_news');
-
-               $setup_info['news_admin']['currentver'] = '0.8.1.001';
-               return $setup_info['news_admin']['currentver'];
+               $GLOBALS['setup_info']['news_admin']['currentver'] = 
'0.8.1.001';
+               return $GLOBALS['setup_info']['news_admin']['currentver'];
        }
 
        $test[] = '0.8.1.001';
        function news_admin_upgrade0_8_1_001()
        {
-               global $setup_info, $phpgw_setup;
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','news_cat',array('type' 
=> 'int','precision' => 4,'nullable' => True));
+               $GLOBALS['phpgw_setup']->oProc->query("update phpgw_news set 
news_cat='0'",__LINE__,__FILE__);
 
-               
$phpgw_setup->oProc->AddColumn('phpgw_news','news_cat',array('type' => 
'int','precision' => 4,'nullable' => True));
-               $phpgw_setup->oProc->query("update phpgw_news set 
news_cat='0'",__LINE__,__FILE__);
-
-               $setup_info['news_admin']['currentver'] = '0.8.1.002';
-               return $setup_info['news_admin']['currentver'];
+               $GLOBALS['setup_info']['news_admin']['currentver'] = 
'0.8.1.002';
+               return $GLOBALS['setup_info']['news_admin']['currentver'];
        }
 
        $test[] = '0.8.1.002';
@@ -157,4 +151,28 @@
                $GLOBALS['setup_info']['news_admin']['currentver'] = 
'0.9.17.501';
                return $GLOBALS['setup_info']['news_admin']['currentver'];
        }
+
+       $test[] = '0.9.17.501';
+       function news_admin_upgrade0_9_17_501()
+       {
+               $cats = array();
+               //We skip using cats class as it is too problematic using it in 
setup
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT cat_id, cat_name 
FROM phpgw_categories WHERE cat_appname = 'news_admin'", __LINE__, __FILE__);
+               while ( $GLOBALS['phpgw_setup']->oProc->next_record() )
+               {
+                       $cats[$GLOBALS['phpgw_setup']->oProc->f('cat_id')] = 
$GLOBALS['phpgw_setup']->oProc->f('cat_name', true);
+               }
+
+               //The ACL class is useless when run in setup, so we do the 
insert directly - our api is sooo gr8 d00dz! - not!
+               $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO 
phpgw_acl_location (appname, id, descr, allow_grant)'
+                                       . " VALUES ('news_admin', '.', 'Top', 
1)", __LINE__, __FILE__);
+               foreach ( $cats as $cat_id => $cat_name )
+               {
+                       echo "INSERTING $cat_id $cat_name<br>";
+                       $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO 
phpgw_acl_location (appname, id, descr, allow_grant)'
+                                       . " VALUES ('news_admin', 'L{$cat_id}', 
'{$cat_name}', 1)", __LINE__, __FILE__);
+
+               }
+               return $GLOBALS['setup_info']['news_admin']['currentver'] = 
'0.9.17.502';
+       }
 ?>

Index: inc/class.news_admin_bo_hooks.inc.php
===================================================================
RCS file: inc/class.news_admin_bo_hooks.inc.php
diff -N inc/class.news_admin_bo_hooks.inc.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ inc/class.news_admin_bo_hooks.inc.php       15 Aug 2006 14:36:05 -0000      
1.1
@@ -0,0 +1,57 @@
+<?php
+       /**
+       * News Admin Hooks Manager
+       * @author Dave Hall - skwashd at phpgroupware.org
+       * @copyright Copyright (C) 2006 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @package tts
+       * @version $Id: class.news_admin_bo_hooks.inc.php,v 1.1 2006/08/15 
14:36:05 skwashd Exp $
+       */
+
+       /**
+       * Centralise hook management to make life a little easier
+       *
+       * @package news_admin
+       */
+       class tts_bo_hooks
+       {
+               
+               /**
+               * Handle a new category being added, namely to create the 
required location 
+               * and db table for custom fields
+               */
+               function cat_add($cat_data)
+               {
+                       if ( $cat_data['cat_owner'] != -1 )
+                       {
+                               return false; //nothing needed to be done, we 
only care about global cats
+                       }
+                       
$GLOBALS['phpgw']->acl->add_location("L{$cat_data['cat_id']}", lang('news 
category: %1', $cat_data['cat_name']), 'news_admin', true);
+               }
+
+               /**
+               * Handle a category being deleted, namely to remove the 
location 
+               * and table for custom fields
+               */
+               function cat_delete($cat_data)
+               {
+                       if ( $cat_data['cat_owner'] != -1 )
+                       {
+                               return false; //nothing needed to be done, we 
only care about global cats
+                       }
+                       
$GLOBALS['phpgw']->acl->add_location(delete_repository('news_admin', 
"L{$cat_data['cat_id']}");
+               }
+               
+               /**
+               * Handle a category being editted, namely to update the 
location info
+               */
+               function cat_edit($cat_data)
+               {
+                       if ( $cat_data['cat_owner'] != -1 )
+                       {
+                               return false; //nothing needed to be done, we 
only care about global cats
+                       }
+                       
$GLOBALS['phpgw']->acl->update_location_description("L{$cat_data['cat_id']}", 
lang('news category: %1', $cat_data['cat_name']), 'news_admin');
+               }
+       }
+?>




reply via email to

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