phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [21179] Improvements/fix: enable cats at locations wi


From: Sigurd Nes
Subject: [Phpgroupware-cvs] [21179] Improvements/fix: enable cats at locations within apps, fix pagination4746:5203
Date: Wed, 14 Apr 2010 18:10:45 +0000

Revision: 21179
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=21179
Author:   sigurdne
Date:     2010-04-14 18:10:42 +0000 (Wed, 14 Apr 2010)
Log Message:
-----------
Improvements/fix: enable cats at locations within apps, fix pagination4746:5203

Modified Paths:
--------------
    people/sigurdne/modules/admin/trunk/inc/class.bocategories.inc.php
    people/sigurdne/modules/admin/trunk/inc/class.uicategories.inc.php
    people/sigurdne/modules/admin/trunk/templates/base/custom.xsl

Modified: people/sigurdne/modules/admin/trunk/inc/class.bocategories.inc.php
===================================================================
--- people/sigurdne/modules/admin/trunk/inc/class.bocategories.inc.php  
2010-03-26 00:59:56 UTC (rev 21178)
+++ people/sigurdne/modules/admin/trunk/inc/class.bocategories.inc.php  
2010-04-14 18:10:42 UTC (rev 21179)
@@ -12,7 +12,7 @@
        /* $Id$ */
        /* $Source$ */
 
-       class bocategories
+       class admin_bocategories
        {
                var $cats;
 
@@ -23,15 +23,17 @@
                var $filter;
                var $cat_id;
                var $total;
+               var $allrows;
 
                var $debug = False;
 
-               function bocategories()
+               function __construct()
                {
                        $appname = phpgw::get_var('appname');
+                       $location = phpgw::get_var('location');
                        if ( $appname )
                        {
-                               $this->cats = 
CreateObject('phpgwapi.categories', -1, $appname);
+                               $this->cats = 
CreateObject('phpgwapi.categories', -1, $appname, $location);
                        }
                        else
                        {
@@ -40,22 +42,16 @@
 
                        $this->read_sessiondata();
 
-                       $start  = phpgw::get_var('start', 'int');
+                       $start  = phpgw::get_var('start', 'int', 'REQUEST', 0);
                        $query  = phpgw::get_var('query');
                        $sort   = phpgw::get_var('sort');
                        $order  = phpgw::get_var('order');
                        $cat_id = phpgw::get_var('cat_id', 'int');
+                       $allrows  = phpgw::get_var('allrows', 'bool');
 
-                       if(!empty($start) || $start == 0)
-                       {
-                               if($this->debug) { echo '<br>overriding start: 
"' . $this->start . '" now "' . $start . '"'; }
-                               $this->start = $start;
-                       }
-                       else
-                       {
-                               $this->start = 0;
-                       }
+                       $this->allrows  = $allrows ? $allrows : false;
 
+                       $this->start = $start ? $start : 0;
                        if((empty($query) && !empty($this->query)) || 
!empty($query))
                        {
                                if($this->debug) { echo '<br>setting query to: 
"' . $query . '"'; }
@@ -108,14 +104,15 @@
                function get_list($global_cats=False)
                {
                        if($this->debug) { echo '<br>querying: "' . 
$this->query . '"'; }
+                       $limit = $this->allrows ? false : true;
 
                        if ($global_cats)
                        {
-                               return 
$this->cats->return_sorted_array($this->start,True,$this->query,$this->sort,$this->order,True);
+                               return 
$this->cats->return_sorted_array($this->start, $limit, $this->query, 
$this->sort, $this->order, True);
                        }
                        else
                        {
-                               return 
$this->cats->return_sorted_array($this->start,True,$this->query,$this->sort,$this->order);
+                               return 
$this->cats->return_sorted_array($this->start, $limit, $this->query, 
$this->sort, $this->order);
                        }
                }
 

Modified: people/sigurdne/modules/admin/trunk/inc/class.uicategories.inc.php
===================================================================
--- people/sigurdne/modules/admin/trunk/inc/class.uicategories.inc.php  
2010-03-26 00:59:56 UTC (rev 21178)
+++ people/sigurdne/modules/admin/trunk/inc/class.uicategories.inc.php  
2010-04-14 18:10:42 UTC (rev 21179)
@@ -51,6 +51,7 @@
                        $this->sort                     = $this->bo->sort;
                        $this->order            = $this->bo->order;
                        $this->cat_id           = $this->bo->cat_id;
+                       $this->allrows          = $this->bo->allrows;
                        if($this->debug) { $this->_debug_sqsof(); }
                }
 
@@ -87,6 +88,7 @@
                function index()
                {
                        $appname = phpgw::get_var('appname');
+                       $location = phpgw::get_var('location');
                        $global_cats  = phpgw::get_var('global_cats');
 
                        $GLOBALS['phpgw']->xslttpl->add_file('cats');
@@ -95,6 +97,7 @@
                        (
                                'menuaction'  => 'admin.uicategories.index',
                                'appname'     => $appname,
+                               'location'     => $location,
                                'global_cats' => $global_cats,
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
                        );
@@ -247,14 +250,14 @@
                                'lang_done_statustext'  => lang('return to 
admin mainscreen')
                        );
 
-                       $link_data['menuaction'] = 'admin.uicategories.index';
-
                        $nm = array
                        (
-                               'start_record'  => $this->start,
+                               'start'                 => $this->start,
                                'num_records'   => count($categories),
                                'all_records'   => 
$this->bo->cats->total_records,
-                               'link_data'             => $link_data
+                               'link_data'             => $link_data,
+                               'allow_all_rows'=> true,
+                               'allrows'               => $this->allrows
                        );
 
                        $data = array
@@ -273,6 +276,7 @@
                function edit()
                {
                        $appname                = phpgw::get_var('appname');
+                       $location               = phpgw::get_var('location');
                        $global_cats    = phpgw::get_var('global_cats');
                        $parent                 = phpgw::get_var('parent', 
'int', 'GET', 0);
                        $values                 = phpgw::get_var('values', 
'string', 'POST');
@@ -282,6 +286,7 @@
                        (
                                'menuaction'  => 'admin.uicategories.index',
                                'appname'     => $appname,
+                               'location'     => $location,
                                'global_cats' => $global_cats,
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
                        );
@@ -334,7 +339,7 @@
 
                        if ( $appname )
                        {
-                               $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($appname) . ' ' . lang('global categories') . ': ' . 
($this->cat_id?lang('edit category'):lang('add category'));
+                               $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($appname) . ' ' . $location?"::{$location}":'' . lang('global categories') 
. ': ' . ($this->cat_id?lang('edit category'):lang('add category'));
                        }
                        else
                        {
@@ -345,7 +350,7 @@
 
                        if ( $appname )
                        {
-                               
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Edit global 
category for %1',lang($appname)));
+                               
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Edit global 
category for %1',lang($appname) . $location?"::{$location}":''));
                        }
                        else
                        {
@@ -387,12 +392,14 @@
                function delete()
                {
                        $appname = phpgw::get_var('appname');
+                       $location= phpgw::get_var('location');
                        $global_cats  = phpgw::get_var('global_cats');
 
                        $link_data = array
                        (
                                'menuaction'  => 'admin.uicategories.index',
                                'appname'     => $appname,
+                               'location'     => $location,
                                'global_cats' => $global_cats,
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
                        );
@@ -432,7 +439,7 @@
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_delete'));
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = ( 
$appname ? lang($appname) . ' ' : '' ) . lang('global categories') . ': ' . 
lang('delete category');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = ( 
$appname ? lang($appname) . ' ' : '' ) .($location?"::{$location}":'') . 
lang('global categories') . ': ' . lang('delete category');
 
                        $type = $appname ? 'noglobalapp' : 'noglobal';
 
@@ -481,7 +488,8 @@
                        (
                                'menuaction'    => 'admin.uicategories.delete',
                                'cat_id'                => $this->cat_id,
-                               'appname'     => $appname,
+                               'appname'      => $appname,
+                               'location'     => $location,
                                'global_cats' => $global_cats,
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
                        );

Modified: people/sigurdne/modules/admin/trunk/templates/base/custom.xsl
===================================================================
--- people/sigurdne/modules/admin/trunk/templates/base/custom.xsl       
2010-03-26 00:59:56 UTC (rev 21178)
+++ people/sigurdne/modules/admin/trunk/templates/base/custom.xsl       
2010-04-14 18:10:42 UTC (rev 21179)
@@ -821,14 +821,20 @@
                </xsl:choose>
        </xsl:template>
 
-       <xsl:template name="choice">
+       <xsl:template name="choice" xmlns:php="http://php.net/xsl";>
                        <table cellpadding="2" cellspacing="2" width="80%" 
align="left">
                        <xsl:choose>
                                <xsl:when test="value_choice!=''">
                                        <tr class="th">
+                                               <td class="th_text" width="5%" 
align="left">
+                                                       <xsl:value-of 
select="php:function('lang', 'id')" />
+                                               </td>
                                                <td class="th_text" width="85%" 
align="left">
-                                                       <xsl:value-of 
select="lang_value"/>
+                                                       <xsl:value-of 
select="php:function('lang', 'value')" />
                                                </td>
+                                               <td class="th_text" width="85%" 
align="left">
+                                                       <xsl:value-of 
select="php:function('lang', 'order')" />
+                                               </td>
                                                <td class="th_text" width="15%" 
align="center">
                                                        <xsl:value-of 
select="lang_delete_value"/>
                                                </td>
@@ -849,10 +855,23 @@
                                                        </xsl:choose>
                                                </xsl:attribute>
                                        <td align="left">
-                                               <xsl:value-of select="value"/>
-                                               <xsl:text> </xsl:text>
+                                               <xsl:value-of select="id"/>
                                        </td>
+                                       <td align="left">
+                                               <input type="textbox" 
name="values[edit_choice][{id}]" value="{value}" size='15'>
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'value')" />
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
                                        <td align="center">
+                                               <input type="textbox" 
name="values[order_choice][{id}]" value="{order}" size='4'>
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'order')" />
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
+                                       <td align="center">
                                                <input type="checkbox" 
name="values[delete_choice][]" value="{id}"  
onMouseout="window.status='';return true;">
                                                        <xsl:attribute 
name="onMouseover">
                                                                
<xsl:text>window.status='</xsl:text>
@@ -866,10 +885,10 @@
                                </xsl:when>
                        </xsl:choose>
                        <tr>
-                               <td valign="top">
+                               <td valign="top" colspan='2'>
                                        <xsl:value-of select="lang_new_value"/>
                                </td>
-                               <td>
+                               <td valign="top" colspan='2'>
                                        <input type="text" 
name="values[new_choice]" onMouseout="window.status='';return true;">
                                                <xsl:attribute 
name="onMouseover">
                                                        
<xsl:text>window.status='</xsl:text>





reply via email to

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