phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] news_admin/inc/class.bonews.inc.php news_admin/... [s


From: Dave Hall
Subject: [Phpgroupware-cvs] news_admin/inc/class.bonews.inc.php news_admin/... [skwashd-16-compat]
Date: Wed, 23 Aug 2006 13:32:04 +0000

CVSROOT:        /cvsroot/phpgroupware
Module name:    sitemgr
Branch:         skwashd-16-compat
Changes by:     Dave Hall <skwashd>     06/08/23 13:32:03

Modified files:
        news_admin/inc : class.bonews.inc.php class.sonews.inc.php 
                         class.uiexport.inc.php 
        news_admin/setup: setup.inc.php tables_current.inc.php 
                          tables_update.inc.php 
        news_admin/templates/base: export.tpl 
        news_admin/website/templates: rss091.tpl rss1.tpl rss2.tpl 
        modules        : class.module_news.inc.php 
        sitemgr-site   : htaccess index.php 
        sitemgr-site/inc: class.sitebo.inc.php class.ui.inc.php 
Removed files:
        news_admin/website/templates: rdf.tpl rdf_row.tpl 

Log message:
        new export system with validated RSS templates, and a db change, could 
still do with some ui clean ups

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/news_admin/inc/class.bonews.inc.php?cvsroot=phpgroupware&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/news_admin/inc/class.sonews.inc.php?cvsroot=phpgroupware&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/news_admin/inc/class.uiexport.inc.php?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/news_admin/setup/setup.inc.php?cvsroot=phpgroupware&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/news_admin/setup/tables_current.inc.php?cvsroot=phpgroupware&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/news_admin/setup/tables_update.inc.php?cvsroot=phpgroupware&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/news_admin/templates/base/export.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/news_admin/website/templates/rss091.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/news_admin/website/templates/rss1.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/news_admin/website/templates/rss2.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/news_admin/website/templates/rdf.tpl?cvsroot=phpgroupware&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/news_admin/website/templates/rdf_row.tpl?cvsroot=phpgroupware&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/sitemgr/modules/class.module_news.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.2.2.5.4.1&r2=1.2.2.5.4.2
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/htaccess?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.5&r2=1.5.8.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/index.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.7.2.2.4.2&r2=1.7.2.2.4.3
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/inc/class.sitebo.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.1.2.3.4.2&r2=1.1.2.3.4.3
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/inc/class.ui.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.11.2.1&r2=1.11.2.1.4.1

Patches:
Index: news_admin/inc/class.bonews.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.bonews.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- news_admin/inc/class.bonews.inc.php 19 Aug 2006 13:38:26 -0000      1.9
+++ news_admin/inc/class.bonews.inc.php 23 Aug 2006 13:32:02 -0000      1.10
@@ -9,7 +9,7 @@
        *  option) any later version.                                           
   *
        
\**************************************************************************/
 
-       /* $Id: class.bonews.inc.php,v 1.9 2006/08/19 13:38:26 skwashd Exp $ */
+       /* $Id: class.bonews.inc.php,v 1.10 2006/08/23 13:32:02 skwashd Exp $ */
 
        /**
        * phpGroupWare News Management Logic layer
@@ -131,19 +131,6 @@
                }
 
                /**
-               * Get a list of most recent news items from any category 
(bypasses ACLs)
-               *
-               * @internal this is bad idea and needs to be removed
-               * @deprecated
-               * @param int $limit the maximum number of stories to return
-               * @return array the news stories found
-               */
-               function get_all_public_news($limit = 5)
-               {
-                       return $this->sonews->get_all_public_news($limit);
-               }
-
-               /**
                * Get a single news item
                *
                * @param int $news_id the news item sought

Index: news_admin/inc/class.sonews.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.sonews.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- news_admin/inc/class.sonews.inc.php 19 Aug 2006 13:38:26 -0000      1.9
+++ news_admin/inc/class.sonews.inc.php 23 Aug 2006 13:32:02 -0000      1.10
@@ -9,7 +9,7 @@
        *  option) any later version.                                           
   *
        
\**************************************************************************/
 
-       /* $Id: class.sonews.inc.php,v 1.9 2006/08/19 13:38:26 skwashd Exp $ */
+       /* $Id: class.sonews.inc.php,v 1.10 2006/08/23 13:32:02 skwashd Exp $ */
 
        class sonews
        {
@@ -36,7 +36,7 @@
                {
                        $sql  = 'INSERT INTO phpgw_news '
                                . ' (news_date, news_submittedby, news_content, 
news_subject, news_begin,'
-                               . ' news_end,news_teaser,news_cat,is_html) '
+                               . ' news_end,news_teaser,news_cat,is_html, 
lastmod) '
                                . 'VALUES (' . intval($news['date'])  . ','
                                . $GLOBALS['phpgw_info']['user']['account_id'] 
. ','
                                . "'" . 
$this->db->db_addslashes($news['content']) ."',"
@@ -44,7 +44,7 @@
                                . intval($news['begin']) . ',' 
                                . intval($news['end']) . ','
                                . "'" . 
$this->db->db_addslashes($news['teaser']) . "'," 
-                               . intval($news['category']) . ',' . 
intval($news['is_html']) .')';
+                               . intval($news['category']) . ',1,' . time() 
.')';
                                
                        $this->db->query($sql, __LINE__, __FILE__);
 
@@ -77,20 +77,13 @@
                                . 'news_begin=' . intval($news['begin']) . ', '
                                . 'news_end=' . intval($news['end']) . ', '
                                . 'news_cat=' . intval($news['category']) . ', '
-                               . 'is_html=' . ($news['is_html'] ? 1 : 0) .' '
+                               . 'is_html=1  '
+                               . 'lastmod=' . time() . ' '
                                . 'WHERE news_id=' . 
intval($news['id']),__LINE__,__FILE__);
                        return !!$this->db->affected_rows();
                }
 
                /**
-               * DEAD FUNCTION
-               */
-               function get_all_public_news($limit=5)
-               {
-                       die('call to : sonews::get_all_public_news');
-               }
-
-               /**
                * Get a single news item
                *
                * @param int $news_id the news item sought
@@ -112,6 +105,7 @@
                                'end'           => $this->db->f('news_end'),
                                'category'      => $this->db->f('news_cat'),
                                'is_html'       => ($this->db->f('is_html') ? 
True : False),
+                               'lastmod'       => $this->db->f('lastmod')
                        );
                        //echo '<pre>'; print_r($item); echo '</pre>';
                        return $item;
@@ -172,9 +166,11 @@
                                        'id'            => 
$this->db->f('news_id'),
                                        'begin'         => 
$this->db->f('news_begin'),
                                        'end'           => 
$this->db->f('news_end'),
+                                       'category'      => 
$this->db->f('news_cat'),
                                        'teaser'        => 
$this->db->f('news_teaser', True),
                                        'content'       => 
$this->db->f('news_content',True),
                                        'is_html'       => 
($this->db->f('is_html') ? True : False),
+                                       'lastmod'       => 
$this->db->f('lastmod')
                                );
                        }
                        return $news;

Index: news_admin/inc/class.uiexport.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.uiexport.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- news_admin/inc/class.uiexport.inc.php       4 Aug 2005 03:54:31 -0000       
1.3
+++ news_admin/inc/class.uiexport.inc.php       23 Aug 2006 13:32:02 -0000      
1.4
@@ -10,7 +10,7 @@
        * --------------------------------------------                          
   *
        
\**************************************************************************/
 
-       /* $Id: class.uiexport.inc.php,v 1.3 2005/08/04 03:54:31 skwashd Exp $ 
*/
+       /* $Id: class.uiexport.inc.php,v 1.4 2006/08/23 13:32:02 skwashd Exp $ 
*/
 
        class uiexport
        {
@@ -59,8 +59,7 @@
                                
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
                        }
 
-                       $GLOBALS['phpgw']->common->phpgw_header();
-                       echo parse_navbar();
+                       $GLOBALS['phpgw']->common->phpgw_header(true);
 
                        if ($_POST['btnSave'])
                        {
@@ -90,26 +89,19 @@
                                'left' => $left,
                                'right' => $right,
                                'lang_showing' => 
$this->nextmatchs->show_hits($this->bo->catbo->total_records,$this->start),
-                               'th_bg' => 
$GLOBALS['phpgw_info']['theme']['th_bg'],
-                               'sort_cat' => 
$this->nextmatchs->show_sort_order(
-                                       
$this->sort,'cat_name','cat_name','/index.php',lang('Category'),'&menuaction=news_admin.uiexport.exportlist'
-                               ),
                                'query' => $this->query,
                        ));
 
-                       @reset($this->bo->cats);
-                       while (list(,$cat) = @each($this->bo->cats))
+                       foreach ( $this->bo->cats as $cat )
                        {
                                $config = $this->bo->readconfig($cat['id']);
-                               $tr_color = 
$this->nextmatchs->alternate_row_color($tr_color);
-                               $GLOBALS['phpgw']->template->set_var(array(
-                                       'tr_color' => $tr_color,
+                               $GLOBALS['phpgw']->template->set_var(array
+                               (
                                        'catname' => $cat['name'],
                                        'catid' => $cat['id'],
                                        'lang_type' => lang('Format of export'),
                                        'typeselectlist' => 
$this->selectlist($this->exporttypes,$config['type']),
                                        'lang_item' => lang('Format for links 
to items'),
-                                       'itemsyntaxselectlist' => 
$this->selectlist($this->itemsyntaxtypes,$config['itemsyntax'])
                                ));
                                
$GLOBALS['phpgw']->template->set_var('confblock','');
                                foreach (array(
@@ -120,17 +112,17 @@
                                        'img_url'      => lang('Image URL'),
                                        'img_link'     => lang('Image Link')) 
as $setting => $label)
                                {
-                                       
$GLOBALS['phpgw']->template->set_var(array(
-                                               'setting' => $label,
-                                               'value' => ('<input size="80" 
type="text" name="inputconfig[' . $cat['id'] . '][' . $setting . ']" value="' . 
-                                                       $config[$setting] . '" 
/>'
-                                               )
+                                       
$GLOBALS['phpgw']->template->set_var(array
+                                       (
+                                               'config_value'  => 
$config[$setting],
+                                               'label'                 => 
$label,
+                                               'setting'               => 
$setting
                                        ));
                                        
$GLOBALS['phpgw']->template->parse('confblock','config',True);
                                }
                                
$GLOBALS['phpgw']->template->parse('Cblock','cat_list',True);
                        }
-                       $GLOBALS['phpgw']->template->pfp('out','export',True);
+                       $GLOBALS['phpgw']->template->pfp('out','export');
                }
 
                function selectlist($values,$default)

Index: news_admin/setup/setup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/setup/setup.inc.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- news_admin/setup/setup.inc.php      19 Aug 2006 04:16:50 -0000      1.18
+++ news_admin/setup/setup.inc.php      23 Aug 2006 13:32:03 -0000      1.19
@@ -9,12 +9,12 @@
        *  option) any later version.                                           
   *
        
\**************************************************************************/
 
-       /* $Id: setup.inc.php,v 1.18 2006/08/19 04:16:50 skwashd Exp $ */
+       /* $Id: setup.inc.php,v 1.19 2006/08/23 13:32:03 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.502';
+       $setup_info['news_admin']['version']   = '0.9.17.503';
        $setup_info['news_admin']['app_order'] = 4;
        $setup_info['news_admin']['enable']    = 1;
        $setup_info['news_admin']['app_group']  = 'accessories';
@@ -36,3 +36,4 @@
        );
 
 
+

Index: news_admin/setup/tables_current.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/setup/tables_current.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- news_admin/setup/tables_current.inc.php     4 Aug 2005 03:54:33 -0000       
1.6
+++ news_admin/setup/tables_current.inc.php     23 Aug 2006 13:32:03 -0000      
1.7
@@ -13,7 +13,7 @@
   * This file should be generated for you. It should never be edited by hand *
   \**************************************************************************/
 
-  /* $Id: tables_current.inc.php,v 1.6 2005/08/04 03:54:33 skwashd Exp $ */
+  /* $Id: tables_current.inc.php,v 1.7 2006/08/23 13:32:03 skwashd Exp $ */
 
   // table array for news_admin
        $phpgw_baseline = array(
@@ -28,11 +28,12 @@
                                'news_end' => array('type' => 'int','precision' 
=> '4','nullable' => True),
                                'news_cat' => array('type' => 'int','precision' 
=> '4','nullable' => True),
                                'news_teaser' => array('type' => 
'text','nullable' => True),
-                               'is_html' => array('type' => 'int','precision' 
=> '2','nullable' => False,'default' => '0')
+                               'is_html' => array('type' => 'int','precision' 
=> '2','nullable' => False,'default' => '0'),
+                               'lastmod' => array('type' => 'int','precision' 
=> '4','nullable' => False)
                        ),
                        'pk' => array('news_id'),
                        'fk' => array(),
-                       'ix' => array('news_date','news_subject'),
+                       'ix' => array('news_date','news_subject','lastmod'),
                        'uc' => array()
                ),
                'phpgw_news_export' => array(

Index: news_admin/setup/tables_update.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/setup/tables_update.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- news_admin/setup/tables_update.inc.php      15 Aug 2006 14:36:05 -0000      
1.5
+++ news_admin/setup/tables_update.inc.php      23 Aug 2006 13:32:03 -0000      
1.6
@@ -12,7 +12,7 @@
        * http://www.goldenglair.com                                            
   *
        
\**************************************************************************/
 
-       /* $Id: tables_update.inc.php,v 1.5 2006/08/15 14:36:05 skwashd Exp $ */
+       /* $Id: tables_update.inc.php,v 1.6 2006/08/23 13:32:03 skwashd Exp $ */
 
        $test[] = '0.0.1';
        function news_admin_upgrade0_0_1()
@@ -147,7 +147,6 @@
                        'nullable' => True
                ));
 
-
                $GLOBALS['setup_info']['news_admin']['currentver'] = 
'0.9.17.501';
                return $GLOBALS['setup_info']['news_admin']['currentver'];
        }
@@ -168,11 +167,27 @@
                                        . " 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';
+               $GLOBALS['setup_info']['news_admin']['currentver'] = 
'0.9.17.502';
+               return $GLOBALS['setup_info']['news_admin']['currentver'];
+       }
+
+
+       $test[] = '0.9.17.502';
+       function news_admin_upgrade0_9_17_502()
+       {
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','lastmod',array(
+                       'type' => 'int',
+                       'precision' => '4',
+                       'nullable' => False
+               ));
+
+               $GLOBALS['phpgw_setup']->oProc->query('UPDATE phpgw_news SET 
lastmod = ' . time(), __LINE__, __FILE__);
+
+               $GLOBALS['setup_info']['news_admin']['currentver'] = 
'0.9.17.503';
+               return $GLOBALS['setup_info']['news_admin']['currentver'];
        }
 ?>

Index: news_admin/templates/base/export.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/templates/base/export.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- news_admin/templates/base/export.tpl        15 Aug 2006 11:42:57 -0000      
1.1
+++ news_admin/templates/base/export.tpl        23 Aug 2006 13:32:03 -0000      
1.2
@@ -1,60 +1,26 @@
-<center>
-  <table border="0" cellspacing="2" cellpadding="2" width="80%">
-   <tr>
-    <td colspan="6" align="center" bgcolor="#c9c9c9"><b>{title}<b/></td>
-   </tr>
-   <tr>
-    <td colspan="6" align="left">
-     <table border="0" width="100%">
+<h1>{title}</h1>
+<table border="0" width="100%">
       <tr>
           {left}
-       <td align="center">{lang_showing}</td>
+               <td>{lang_showing}</td>
           {right}
       </tr>
-     </table>
-    </td>
-   </tr>
-   <tr>
-    <td>&nbsp;</td>
-    <td colspan="6" align="right">
-       <form method="POST"><input type="text" name="query" value="{query}" 
/>&nbsp;<input type="submit" name="btnSearch" value="{lang_search}" /></form>
-       </td>
-   </tr>
- </table>
- <form method="POST">
-  <table border="0" cellspacing="2" cellpadding="2" width="80%">
-   <tr bgcolor="{th_bg}" valign="middle" align="center">
-    <td>{sort_cat}</td>
-       <td>{lang_configuration}</td>
-   </tr>
+</table>
+<form method="POST"><input type="text" name="query" value="{query}"><input 
type="submit" name="btnSearch" value="{lang_search}"></form>
+<form method="POST">
    <!-- BEGIN cat_list -->
-   <tr valign="top" align="center" bgcolor="{tr_color}">
-       <td><b>{catname}</b><br /><br />
-        <input type="hidden" name="catids[]" value="{catid}" />
-        {lang_type}
-        <select name="inputconfig[{catid}][type]">{typeselectlist}</select>
-        <br /><br />
-        {lang_item}
-        <select 
name="inputconfig[{catid}][itemsyntax]">{itemsyntaxselectlist}</select>
-       </td>
-       <td>
-        <table>
+       <fieldset>
+               <legend>{catname}</legend>
          <!-- BEGIN config -->
-         <tr>
-          <td>{setting}</td>
-          <td>{value}</td>
-         </tr>
+               <label for="inputconfig_{setting}_{catid}">{label}</label>
+               <input type="text" id="inputconfig_{setting}_{catid}" 
name="inputconfig[{catid}][{setting}]" value="{config_value}"><br>
           <!-- END config -->
-        </table>
-       </td>
-   </tr>
+               <label for="inputconfig_type{cat_id}">{lang_type}</label>
+               <select id="inputconfig_type{cat_id}" 
name="inputconfig[{catid}][type]">{typeselectlist}</select>
+               <input type="hidden" name="catids[]" value="{catid}">
+       </fieldset>
    <!-- END cat_list -->
-   <tr>
-    <td colspan="3" align="center">
-     <input type="submit" name="btnSave" value="{lang_save}"> &nbsp;
+       <input type="submit" name="btnSave" value="{lang_save}"> 
      <input type="submit" name="btnDone" value="{lang_done}">
-    </td>
-   </tr>
-  </table>
- </form>
+</form>
 </center>

Index: news_admin/website/templates/rss091.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/website/templates/rss091.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- news_admin/website/templates/rss091.tpl     3 Jun 2003 03:15:12 -0000       
1.1
+++ news_admin/website/templates/rss091.tpl     23 Aug 2006 13:32:03 -0000      
1.2
@@ -1,19 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
 <rss version="0.91">
        <channel>
                <title>{title}</title>
                <link>{link}</link>
-               <description>{description}</description>
+               <description>
+                       <![CDATA[{description}]]>
+               </description>
+               <language>{lang}</language> 
+               
                <image>
-                       <title>{image_title}</title> 
-                       <url>{image_url}</url> 
-                       <link>{image_link}</link> 
+                       <title>{img_title}</title>
+                       <link>{link}</link>
+                       <url>{img_url}</url>
+                       <description>
+                               <![CDATA[{description}]]>
+                       </description>
                </image>
-<!-- BEGIN item -->
+
+               <!-- BEGIN item -->
        <item>
                <title>{subject}</title>
                <link>{item_link}</link>
-               <description>{teaser}</description>
+                       <description><![CDATA[{teaser}]]></description>
        </item>
-<!-- END item -->
+               <!-- END item -->
        </channel>
 </rss>
+

Index: news_admin/website/templates/rss1.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/website/templates/rss1.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- news_admin/website/templates/rss1.tpl       3 Jun 2003 03:15:12 -0000       
1.1
+++ news_admin/website/templates/rss1.tpl       23 Aug 2006 13:32:03 -0000      
1.2
@@ -1,3 +1,4 @@
+<?xml version="1.0"?>
 <rdf:RDF
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
   xmlns="http://purl.org/rss/1.0/";
@@ -6,7 +7,10 @@
        <channel rdf:about="{link}">
                <title>{title}</title>
                <link>{link}</link>
-               <description>{description}</description>
+               <description>
+                       <![CDATA[{description}]]>
+               </description>
+               <dc:date>{feed_dc_date}</dc:date>
 
                <image rdf:resource="{img_url}" />
                
@@ -19,16 +23,20 @@
                </items>
        </channel>
        
-       <image rdf:resource="{img_url}" />
+       <image rdf:about="{img_url}">
                <title>{img_title}</title>
                <link>{img_link}</link>
                <url>{img_url}</url>
        </image>
 <!-- BEGIN item -->
-       <item>
+       <item rdf:about="{item_link}">
                <title>{subject}</title>
                <link>{item_link}</link>
-               <description>{teaser}</description>
+               <dc:subject>{cat}</dc:subject>
+               <description>
+                       <![CDATA[{teaser}]]>
+               </description>
+               <dc:date>{item_lastmod}</dc:date>
        </item>
 <!-- END item -->
 </rdf:RDF>

Index: news_admin/website/templates/rss2.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/website/templates/rss2.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- news_admin/website/templates/rss2.tpl       3 Jun 2003 03:15:12 -0000       
1.1
+++ news_admin/website/templates/rss2.tpl       23 Aug 2006 13:32:03 -0000      
1.2
@@ -1,13 +1,30 @@
-<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/";>
+<?xml version="1.0" encoding="utf-8"?>
+<rss version="2.0">
        <channel>
                <title>{title}</title>
                <link>{link}</link>
-               <description>{description}</description>
-<!-- BEGIN item -->
+               <description>
+                       <![CDATA[{description}]]>
+               </description>
+               <language>{lang}</language> 
+               <lastBuildDate>{lastmod}</lastBuildDate>
+               <generator>phpGroupWare</generator>
+               
+               <image>
+                       <title>{img_title}</title>
+                       <link>{link}</link>
+                       <url>{img_url}</url>
+               </image>
+               <!-- BEGIN item -->
                <item>
                        <title>{subject}</title>
                        <link>{item_link}</link>
+                       <description><![CDATA[{teaser}]]></description>
+                       <category>{cat}</category>
+                       <pubDate>{item_lastmod}</pubDate>
+                       <guid isPermaLink="true">{item_link}</guid>
                </item>
-<!-- END item -->
+
+               <!-- END item -->
        </channel>
 </rss>

Index: sitemgr/modules/class.module_news.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/modules/class.module_news.inc.php,v
retrieving revision 1.2.2.5.4.1
retrieving revision 1.2.2.5.4.2
diff -u -b -r1.2.2.5.4.1 -r1.2.2.5.4.2
--- sitemgr/modules/class.module_news.inc.php   13 Aug 2006 11:09:46 -0000      
1.2.2.5.4.1
+++ sitemgr/modules/class.module_news.inc.php   23 Aug 2006 13:32:03 -0000      
1.2.2.5.4.2
@@ -55,7 +55,9 @@
                        if ($arguments['rsslink'])
                        {
                                $this->template->set_var('rsslink',
-                                       
$GLOBALS['phpgw_info']['server']['webserver_url'] . 
'/news_admin/website/export.php?cat_id=' . $arguments['category']);
+                                       
$GLOBALS['Common_BO']->sites->current_site['site_url'] 
+                                                                       . 
($sitemgr_info['htaccess_rewrite'] ? 'news/feed' : 'index.php?news=feed')
+                                                                       . 
($cat_id > 0 ? "cat-$cat_id" : ''));
                                $this->template->parse('rsshandle','rss');
                        }
                        else

Index: sitemgr/sitemgr-site/htaccess
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/sitemgr-site/htaccess,v
retrieving revision 1.5
retrieving revision 1.5.8.1
diff -u -b -r1.5 -r1.5.8.1
--- sitemgr/sitemgr-site/htaccess       4 Mar 2003 18:55:49 -0000       1.5
+++ sitemgr/sitemgr-site/htaccess       23 Aug 2006 13:32:03 -0000      1.5.8.1
@@ -15,3 +15,4 @@
 RewriteEngine On
 RewriteBase /
 RewriteRule ^([^/]*)$ index.php?page_name=$1&%{QUERY_STRING}
+RewriteRule ^news/([0-9a-z\-]+) index.php?news=$1&%{QUERY_STRING}

Index: sitemgr/sitemgr-site/index.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/sitemgr-site/index.php,v
retrieving revision 1.7.2.2.4.2
retrieving revision 1.7.2.2.4.3
diff -u -b -r1.7.2.2.4.2 -r1.7.2.2.4.3
--- sitemgr/sitemgr-site/index.php      27 Mar 2006 13:13:24 -0000      
1.7.2.2.4.2
+++ sitemgr/sitemgr-site/index.php      23 Aug 2006 13:32:03 -0000      
1.7.2.2.4.3
@@ -8,7 +8,7 @@
        *  Free Software Foundation; either version 2 of the License, or (at 
your  *
        *  option) any later version.                                           
   *
        
\**************************************************************************/
-       /* $Id: index.php,v 1.7.2.2.4.2 2006/03/27 13:13:24 skwashd Exp $ */
+       /* $Id: index.php,v 1.7.2.2.4.3 2006/08/23 13:32:03 skwashd Exp $ */
 
        $GLOBALS['phpgw_info']['flags'] = array
        (
@@ -66,18 +66,42 @@
                }
                $objui->displayTOC($_GET['category_id']);
        }
-       elseif ( isset($_GET['page_id']) && $_GET['page_id'])
+       else if ( isset($_GET['page_id']) && $_GET['page_id'])
        {
                $objui->displayPage($_GET['page_id']);
        }
-       elseif (isset($_GET['index']))
+       else if (isset($_GET['index']))
        {
                $objui->displayIndex();
        }
-       elseif (isset($_GET['toc']))
+       else if (isset($_GET['toc']))
        {
                $objui->displayTOC();
        }
+       else if (isset($_GET['news']) )
+       {
+               if ( strpos($_GET['news'], 'feed') === 0 )
+               {
+                        $cat_id = 0;
+                        if ( strpos($_GET['news'], 'feed-cat-') === 0 )
+                        {
+                               $cat_id =  (int) substr($_GET['news'], 9);
+                               exit;
+                        }
+                        $objbo->export_news($cat_id);
+                        exit;
+               }
+               else if ( strpos($_GET['news'], 'cat-') === 0 )
+               {
+                       $objui->displayNews( 0, (int) substr($_GET['news'], 4) 
);
+                       exit;
+               }
+               else
+               {
+                       $objui->displayNews( (int) $_GET['news']);
+                       exit;
+               }
+       }
        else
        {
                if ($sitemgr_info['home_page_id'])

Index: sitemgr/sitemgr-site/inc/class.sitebo.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/sitemgr-site/inc/class.sitebo.inc.php,v
retrieving revision 1.1.2.3.4.2
retrieving revision 1.1.2.3.4.3
diff -u -b -r1.1.2.3.4.2 -r1.1.2.3.4.3
--- sitemgr/sitemgr-site/inc/class.sitebo.inc.php       15 May 2006 11:08:37 
-0000      1.1.2.3.4.2
+++ sitemgr/sitemgr-site/inc/class.sitebo.inc.php       23 Aug 2006 13:32:03 
-0000      1.1.2.3.4.3
@@ -8,7 +8,7 @@
        * Free Software Foundation; either version 2 of the License, or (at 
your  *
        * option) any later version.                                            
  *
        
\*************************************************************************/
-       /* $Id: class.sitebo.inc.php,v 1.1.2.3.4.2 2006/05/15 11:08:37 skwashd 
Exp $ */
+       /* $Id: class.sitebo.inc.php,v 1.1.2.3.4.3 2006/08/23 13:32:03 skwashd 
Exp $ */
 
        class sitebo
        {
@@ -27,6 +27,109 @@
                        $this->isuser = 
($GLOBALS['phpgw_info']['user']['account_lid'] != $GLOBALS['anonymous_user']);
                }
 
+               /**
+               * Export a news category as a feed
+               *
+               * @param int $cat_id the category for the feed, 0 == all 
available
+               */
+               function export_news($cat_id = 0)
+               {
+                       //echo '<pre>' . 
print_r($GLOBALS['Common_BO']->sites->current_site, true) . '</pre>';
+                       $news_obj = createObject('news_admin.bonews');
+       
+                       $limit  = (isset($_GET['limit']) ? trim($_GET['limit']) 
: 15);
+
+                       $lang = 'en';
+                       $descr =  '';
+                       if ( isset($GLOBALS['sitemgr_info']['userlang']) && 
isset($GLOBALS['Common_BO']->sites->current_site['site_desc' . 
$GLOBALS['sitemgr_info']['userlang']]) )
+                       {
+                               $lang = $GLOBALS['sitemgr_info']['userlang'];
+                               $descr = 
$GLOBALS['Common_BO']->sites->current_site['site_desc' . 
$GLOBALS['sitemgr_info']['userlang']];
+                       }
+                       else
+                       {
+                               $descr = 
$GLOBALS['Common_BO']->sites->current_site['site_desc_en'];
+                       }
+
+                       if ( $cat_id > 0 )
+                       {
+                               $site = 
execMethod('news_admin.soexport.readconfig', $cat_id);
+                               if ( !isset($site['type']) )
+                               {
+                                       die("THIS CATEGORY IS NOT PUBLICLY 
ACCESSIBLE");
+                               }
+
+                               $formats = array(1 => 'rss091', 2 => 'rss1', 3 
=> 'rss2');
+                               $format = $formats[$site['type']];
+                               unset($formats);
+
+                               $site['export_link'] = 
$GLOBALS['Common_BO']->sites->current_site['site_url'] 
+                                       . ($sitemgr_info['htaccess_rewrite'] ? 
'news/feed-cat-' : 'index.php?news=feed-cat-') . $cat_id;
+                       }
+                       else
+                       {
+                               $format = 'rss1';
+                               $site = array
+                               (
+                                       'title'                 => 
$GLOBALS['Common_BO']->sites->current_site['site_name'],
+                                       'link'                  => 
$GLOBALS['Common_BO']->sites->current_site['site_url'],
+                                       'img_title'             => 
lang('feed_icon'),
+                                       'img_url'               => 
$GLOBALS['Common_BO']->sites->current_site['site_url'] . "images/feed-icon.png",
+                                       'img_link'              => 
$GLOBALS['Common_BO']->sites->current_site['site_url']
+                               );
+                       }
+                       
+
+                       $dc_date_fmt = ( floor(phpversion()) >= 5  ? 'c' : 
'Y-m-d\TH:i:s\Z'); // 'c' introduced in php5 - http://php.net/date
+                       $tpl = createObject('phpgwapi.Template', 
PHPGW_SERVER_ROOT . '/news_admin/website/templates/' );
+                       $tpl->set_file('news', "{$format}.tpl");
+                       $tpl->set_block('news', 'item', 'items');
+                       if($format == 'rss1')
+                       {
+                               $tpl->set_block('news', 'seq', 'seqs');
+                       }
+
+                       $lastmod = 0;
+                       $news = $news_obj->get_newslist($cat_id, 0, '', '', 
$limit, true);
+                       if(is_array($news))
+                       {
+                               $date_fmt = ($format == 'rss1' ? $dc_date_fmt : 
'r');
+                               $news_link = 
$GLOBALS['Common_BO']->sites->current_site['site_url'] . 
($sitemgr_info['htaccess_rewrite'] ? 'news/' : 'index.php?news=');
+                               foreach($news as $news_id => $news_data) 
+                               {
+                                       if ( $news_data['lastmod'] > $lastmod )
+                                       {
+                                               $lastmod = 
$news_data['lastmod'];
+                                       }
+
+                                       $news_data['item_lastmod'] = 
date($date_fmt, $news_data['lastmod']);
+                                       $news_data['cat'] = 
$GLOBALS['Common_BO']->cats->so->cats->id2name($news_data['category']);
+                                       $tpl->set_var($news_data);
+
+                                       $tpl->set_var('item_link', 
"{$news_link}{$news_id}");
+                                       if($format == 'rss1')
+                                       {
+                                               $tpl->parse('seqs','seq',True);
+                                       }
+                       
+                                       $tpl->parse('items','item',True);
+                               }
+                       }
+                       else
+                       {
+                               $tpl->set_var('items', '');
+                       }
+                       $site['lang'] = $lang;
+                       $site['description'] = $descr;
+                       $site['lastmod'] = date('r', $lastmod);
+                       $site['feed_dc_date'] = date($dc_date_fmt, $lastmod);
+                       
+                       Header('Content-Type: application/rdf+xml; 
charset=UTF-8');
+                       Header("Last-Modified: {$site['lastmod']}" );
+                       $tpl->set_var($site);
+                       $tpl->pparse('out','news');
+               }
+
                function getcatwrapper($cat_id)
                {
                        $availablelangsforcat = 
$this->catbo->getlangarrayforcategory($cat_id);
@@ -216,6 +319,23 @@
                        return true;
                }
 
+               function loadNews($item_id, $cat_id = 0)
+               {
+                       global $page;
+
+                       $page->title = lang('News');
+                       $page->subtitle = '';
+                       $page->toc = True;
+                       $page->cat_id = CURRENT_SITE_ID;
+                       $page->block = CreateObject('sitemgr.Block_SO',True);
+                       $page->block->module_name = 'news';
+                       $page->block->arguments = array('item' => $item, 
'category' => $cat_id);
+                       $page->block->module_id = 
$GLOBALS['Common_BO']->modules->getmoduleid('toc');
+                       $page->block->view = SITEMGR_VIEWABLE_EVERBODY;
+                       $page->block->state = SITEMGR_STATE_PUBLISH;
+                       return true;
+               }
+
                function getPageLinks($category_id, $showhidden=true)
                {
                        $pages=$this->pages_bo->getPageIDList($category_id);

Index: sitemgr/sitemgr-site/inc/class.ui.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/sitemgr-site/inc/class.ui.inc.php,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.1.4.1
diff -u -b -r1.11.2.1 -r1.11.2.1.4.1
--- sitemgr/sitemgr-site/inc/class.ui.inc.php   23 Jun 2003 20:31:21 -0000      
1.11.2.1
+++ sitemgr/sitemgr-site/inc/class.ui.inc.php   23 Aug 2006 13:32:03 -0000      
1.11.2.1.4.1
@@ -9,7 +9,7 @@
        * option) any later version.                                            
   *
        
\**************************************************************************/
 
-       /* $Id: class.ui.inc.php,v 1.11.2.1 2003/06/23 20:31:21 totschnig Exp $ 
*/
+       /* $Id: class.ui.inc.php,v 1.11.2.1.4.1 2006/08/23 13:32:03 skwashd Exp 
$ */
 
        class ui
        {
@@ -23,6 +23,13 @@
                        $this->t = new Template3($templateroot);
                }
 
+               function displayNews($item, $cat_id = 0)
+               {
+                       global $objbo;
+                       $objbo->loadNews($item, $cat_id);
+                       $this->generatePage();
+               }
+
                function displayPageByName($page_name)
                {
                        global $objbo;

Index: news_admin/website/templates/rdf.tpl
===================================================================
RCS file: news_admin/website/templates/rdf.tpl
diff -N news_admin/website/templates/rdf.tpl
--- news_admin/website/templates/rdf.tpl        20 Dec 2000 03:34:12 -0000      
1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?><rdf:RDF
-xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
-xmlns="http://my.netscape.com/rdf/simple/0.9/";>
-        <channel>
-                <title>{site_title}</title>
-                <link>{site_link}</link>
-                <description>{site_description}</description>
-        </channel>
-
-        <image>
-                <title>{img_title}</title>
-                <url>{img_url}</url>
-                <link>{img_link}</link>
-        </image>
-
-{rows}
-
-</rdf:RDF>
\ No newline at end of file

Index: news_admin/website/templates/rdf_row.tpl
===================================================================
RCS file: news_admin/website/templates/rdf_row.tpl
diff -N news_admin/website/templates/rdf_row.tpl
--- news_admin/website/templates/rdf_row.tpl    20 Dec 2000 03:34:12 -0000      
1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,4 +0,0 @@
-        <item>
-                <title>{title}</title>
-                <link>{link}</link>
-        </item>
\ No newline at end of file




reply via email to

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