fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9377] api: disable/activate categories


From: Sigurd Nes
Subject: [Fmsystem-commits] [9377] api: disable/activate categories
Date: Sat, 12 May 2012 18:10:27 +0000

Revision: 9377
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9377
Author:   sigurdne
Date:     2012-05-12 18:10:27 +0000 (Sat, 12 May 2012)
Log Message:
-----------
api: disable/activate categories

Modified Paths:
--------------
    trunk/admin/inc/class.uicategories.inc.php
    trunk/admin/templates/base/cats.xsl
    trunk/phpgwapi/inc/class.categories.inc.php
    trunk/phpgwapi/setup/setup.inc.php
    trunk/phpgwapi/setup/tables_current.inc.php
    trunk/phpgwapi/setup/tables_update.inc.php
    trunk/phpgwapi/templates/base/categories.xsl

Modified: trunk/admin/inc/class.uicategories.inc.php
===================================================================
--- trunk/admin/inc/class.uicategories.inc.php  2012-05-11 11:40:09 UTC (rev 
9376)
+++ trunk/admin/inc/class.uicategories.inc.php  2012-05-12 18:10:27 UTC (rev 
9377)
@@ -348,6 +348,7 @@
 
                        $GLOBALS['phpgw']->xslttpl->add_file('cats');
 
+/*
                        if ( $appname )
                        {
                                
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Edit global 
category for %1',lang($appname) . $location?"::{$location}":''));
@@ -356,7 +357,31 @@
                        {
                                
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Edit global 
category'));
                        }
+*/
+                       $active = array
+                       (
+                               array
+                               (
+                                       'id'    => 0,
+                                       'name'  => lang('inactive')
+                               ),
+                               array
+                               (
+                                       'id'    => 1,
+                                       'name'  => lang('active')
+                               ),
+                               array
+                               (
+                                       'id'    => 2,
+                                       'name'  => lang('inactive and hidden')
+                               )
+                       );
 
+                       foreach ($active as &$entry)
+                       {
+                               $entry['selected'] = $entry['id'] == 
$cats[0]['active'] ? 1 : 0;
+                       }
+
                        $data = array
                        (
                                'img_color_selector'    => 
$GLOBALS['phpgw']->common->image('phpgwapi', 'color_selector'),
@@ -376,7 +401,8 @@
                                'lang_cancel_statustext'        => lang('leave 
the category untouched and return back to the list'),
                                'lang_save_statustext'          => lang('save 
the category and return back to the list'),
                                'lang_apply_statustext'         => lang('save 
the category'),
-                               'cat_select'                    => 
$this->bo->cats->formatted_xslt_list(array('select_name' => 'values[parent]', 
'selected' => $parent,'self' => $this->cat_id,'globals' => $global_cats))
+                               'cat_select'                    => 
$this->bo->cats->formatted_xslt_list(array('select_name' => 'values[parent]', 
'selected' => $parent,'self' => $this->cat_id,'globals' => $global_cats)),
+                               'active_list'                   => 
array('options' => $active)
                        );
 
                        $link_data['menuaction'] = 'admin.uicategories.edit';

Modified: trunk/admin/templates/base/cats.xsl
===================================================================
--- trunk/admin/templates/base/cats.xsl 2012-05-11 11:40:09 UTC (rev 9376)
+++ trunk/admin/templates/base/cats.xsl 2012-05-12 18:10:27 UTC (rev 9377)
@@ -127,7 +127,7 @@
 
 <!-- BEGIN cat_edit -->
 
-       <xsl:template match="cat_edit">
+       <xsl:template match="cat_edit" xmlns:php="http://php.net/xsl";>
                <table cellpadding="2" cellspacing="2" align="center">
                        <tr>
                                <td colspan="3" align="center">
@@ -146,11 +146,9 @@
                        </tr>
                        <tr>
                                <td colspan="2"><xsl:value-of 
select="lang_name"/>:</td>
-                               <td><input name="values[name]" size="50" 
onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_name_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
+                               <td><input name="values[name]" size="50">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="lang_name_statustext"/>
                                                </xsl:attribute>
                                                <xsl:attribute name="value">
                                                        <xsl:value-of 
select="value_name"/>
@@ -160,11 +158,9 @@
                        </tr>
                        <tr>
                                <td colspan="2" valign="top"><xsl:value-of 
select="lang_descr"/>:</td>
-                               <td><textarea cols="60" rows="10" 
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_descr_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
+                               <td><textarea cols="60" rows="10" 
name="values[descr]" wrap="virtual" >
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="lang_descr_statustext"/>
                                                </xsl:attribute>
                                                <xsl:value-of 
select="value_descr"/>            
                                        </textarea>
@@ -177,6 +173,14 @@
                                        <img src="img_color_selector" 
onclick="colorSelector('colorSelector);" alt="{lang_color_selector}" 
title="lang_color_selector" />
                                </td>
                        </tr>
+                       <tr>
+                               <td colspan="2"><label 
for="value_active"><xsl:value-of select="php:function('lang', 
'active')"/></label>:</td>
+                               <td>
+                                       <select name="values[active]" 
id="value_active">
+                                               <xsl:apply-templates 
select="active_list/options"/>
+                                       </select>
+                               </td>
+                       </tr>
 
                        <tr height="50" valign="bottom">
                                <td>
@@ -215,3 +219,13 @@
                        </form>
                </table>
        </xsl:template>
+
+       <xsl:template match="options">
+               <option value="{id}">
+                       <xsl:if test="selected != 0">
+                               <xsl:attribute name="selected" 
value="selected"/>
+                       </xsl:if>
+                       <xsl:value-of disable-output-escaping="yes" 
select="name"/>
+               </option>
+       </xsl:template>
+       

Modified: trunk/phpgwapi/inc/class.categories.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.categories.inc.php 2012-05-11 11:40:09 UTC (rev 
9376)
+++ trunk/phpgwapi/inc/class.categories.inc.php 2012-05-12 18:10:27 UTC (rev 
9377)
@@ -3,7 +3,7 @@
        * Category manager
        * @author Joseph Engo <address@hidden>
        * @author Bettina Gille <address@hidden>
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2012 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage utilities
@@ -272,7 +272,8 @@
                                                'name'                  => 
$this->db->f('cat_name'),
                                                'description'   => 
$this->db->f('cat_description'),
                                                'data'                  => 
$this->db->f('cat_data'),
-                                               'last_mod'              => 
$this->db->f('last_mod')
+                                               'last_mod'              => 
$this->db->f('last_mod'),
+                                               'active'                => 
(int)$this->db->f('active')
                                        );
                                }
                        }
@@ -368,7 +369,8 @@
                                        'parent'                => 
(int)$this->db->f('cat_parent'),
                                        'name'                  => 
$this->db->f('cat_name'),
                                        'description'   => 
$this->db->f('cat_description'),
-                                       'data'                  => 
$this->db->f('cat_data')
+                                       'data'                  => 
$this->db->f('cat_data'),
+                                       'active'                => 
(int)$this->db->f('active')
                                );
                        }
 
@@ -413,7 +415,8 @@
                                                'parent'                => 
(int)$this->db->f('cat_parent'),
                                                'name'                  => 
$this->db->f('cat_name'),
                                                'description'   => 
$this->db->f('cat_description'),
-                                               'data'                  => 
$this->db->f('cat_data')
+                                               'data'                  => 
$this->db->f('cat_data'),
+                                               'active'                => 
(int)$this->db->f('active')
                                        );
                                }
 
@@ -506,9 +509,11 @@
                                        'parent'                => 
$this->db->f('cat_parent'),
                                        'name'                  => 
$this->db->f('cat_name', true),
                                        'description'   => 
$this->db->f('cat_description', true),
-                                       'data'                  => 
$this->db->f('cat_data')
+                                       'data'                  => 
$this->db->f('cat_data'),
+                                       'active'                => 
(int)$this->db->f('active')
                                );
                        }
+
                        return $cats;
                }
 
@@ -736,6 +741,7 @@
 
                        $values['level'] = 0;
                        $values['main'] = 0;
+                       $values['active'] = (int) $values['active'];
                        if ($values['parent'] > 0)
                        {
                                $values['level']        = (int) 
$this->id2name($values['parent'],'level')+1;
@@ -754,9 +760,9 @@
                                $id_val = $values['id'] . ',';
                        }
 
-                       $this->db->query("INSERT INTO phpgw_categories ($id_col 
cat_parent, cat_owner, cat_access, cat_appname, location_id, cat_name, 
cat_description, cat_data, cat_main ,cat_level, last_mod)"
+                       $this->db->query("INSERT INTO phpgw_categories ($id_col 
cat_parent, cat_owner, cat_access, cat_appname, location_id, cat_name, 
cat_description, cat_data, cat_main ,cat_level, active, last_mod)"
                                . " VALUES ($id_val {$values['parent']}, 
{$this->account_id}, '{$values['access']}', 
'{$this->app_name}',{$this->location_id},"
-                                       ."'{$values['name']}', 
'{$values['descr']}', '{$values['data']}', {$values['main']}, 
{$values['level']}," . time() . ')',__LINE__,__FILE__);
+                                       ."'{$values['name']}', 
'{$values['descr']}', '{$values['data']}', {$values['main']}, 
{$values['level']}, {$values['active']}," . time() . ')',__LINE__,__FILE__);
 
                        if ($values['id'] > 0)
                        {
@@ -900,6 +906,7 @@
                        $sql = "UPDATE phpgw_categories SET cat_name='" . 
$values['name'] . "', cat_description='" . $values['descr']
                                        . "', cat_data='" . $values['data'] . 
"', cat_parent=" . $values['parent'] . ", cat_access='"
                                        . $values['access'] . "', cat_main=" . 
$values['main'] . ', cat_level=' . $values['level'] . ',last_mod=' . time()
+                                       . ', active = ' . (int) 
$values['active']
                                        . " WHERE cat_appname='" . 
$this->app_name . "' AND cat_id=" . $values['id'];
 
                        $this->db->query($sql,__LINE__,__FILE__);
@@ -909,6 +916,7 @@
                                'cat_id'        => $values['id'],
                                'cat_name'      => $values['name'],
                                'cat_owner'     => $this->account_id,
+                               'active'        => (int) $values['active'],
                                'location'      => 'cat_edit',
                                'location_id' => $this->location_id
                        );

Modified: trunk/phpgwapi/setup/setup.inc.php
===================================================================
--- trunk/phpgwapi/setup/setup.inc.php  2012-05-11 11:40:09 UTC (rev 9376)
+++ trunk/phpgwapi/setup/setup.inc.php  2012-05-12 18:10:27 UTC (rev 9377)
@@ -12,7 +12,7 @@
        // Basic information about this app
        $setup_info['phpgwapi']['name']      = 'phpgwapi';
        $setup_info['phpgwapi']['title']     = 'phpgwapi';
-       $setup_info['phpgwapi']['version']   = '0.9.17.538';
+       $setup_info['phpgwapi']['version']   = '0.9.17.539';
        $setup_info['phpgwapi']['versions']['current_header'] = '1.31';
        $setup_info['phpgwapi']['versions']['system'] = '1.0';
        $setup_info['phpgwapi']['enable']    = 3;

Modified: trunk/phpgwapi/setup/tables_current.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_current.inc.php 2012-05-11 11:40:09 UTC (rev 
9376)
+++ trunk/phpgwapi/setup/tables_current.inc.php 2012-05-12 18:10:27 UTC (rev 
9377)
@@ -227,6 +227,7 @@
                                'cat_data' => array('type' => 'text'),
                                'last_mod' => array('type' => 'int','precision' 
=> 4,'default' => '0','nullable' => False),
                                'location_id' => array('type' => 
'int','precision' => 4,'default' => '0','nullable' => True),
+                               'active' => array('type' => 'int','precision' 
=> '2','default' => '1','nullable' => True),
                        ),
                        'pk' => array('cat_id'),
                        'fk' => array(),

Modified: trunk/phpgwapi/setup/tables_update.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_update.inc.php  2012-05-11 11:40:09 UTC (rev 
9376)
+++ trunk/phpgwapi/setup/tables_update.inc.php  2012-05-12 18:10:27 UTC (rev 
9377)
@@ -3049,3 +3049,25 @@
                        return $GLOBALS['setup_info']['phpgwapi']['currentver'];
                }
        }
+
+
+       /**
+       * change datatype to bigint
+       *
+       * @return string the new version number
+       */
+       $test[] = '0.9.17.538';
+       function phpgwapi_upgrade0_9_17_538()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_categories','active', 
array('type' => 'int','precision' => '2','default' => '1','nullable' => True)); 
                         
+               $GLOBALS['phpgw_setup']->oProc->query('UPDATE phpgw_categories 
SET active = 1',__LINE__,__FILE__);
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['phpgwapi']['currentver'] = 
'0.9.17.539';
+                       return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+               }
+       }
+

Modified: trunk/phpgwapi/templates/base/categories.xsl
===================================================================
--- trunk/phpgwapi/templates/base/categories.xsl        2012-05-11 11:40:09 UTC 
(rev 9376)
+++ trunk/phpgwapi/templates/base/categories.xsl        2012-05-12 18:10:27 UTC 
(rev 9377)
@@ -33,7 +33,7 @@
        <xsl:template match="cat_select">
        <xsl:variable name="lang_cat_statustext"><xsl:value-of 
select="lang_cat_statustext"/></xsl:variable>
        <xsl:variable name="select_name"><xsl:value-of 
select="select_name"/></xsl:variable>
-               <select name="{$select_name}" class="forms" 
onMouseover="window.status='{$lang_cat_statustext}'; return true;" 
onMouseout="window.status='';return true;">
+               <select id = "global_category_id" name="{$select_name}" 
class="forms" onMouseover="window.status='{$lang_cat_statustext}'; return 
true;" onMouseout="window.status='';return true;">
                        <option value="0"><xsl:value-of 
select="lang_no_cat"/></option>
                                <xsl:apply-templates select="cat_list"/>
                </select>




reply via email to

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