fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14986] property: update function


From: sigurdne
Subject: [Fmsystem-commits] [14986] property: update function
Date: Sun, 8 May 2016 13:03:04 +0000 (UTC)

Revision: 14986
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14986
Author:   sigurdne
Date:     2016-05-08 13:03:04 +0000 (Sun, 08 May 2016)
Log Message:
-----------
property: update function

Modified Paths:
--------------
    trunk/property/inc/class.boadmin_location.inc.php
    trunk/property/inc/class.soadmin_location.inc.php
    trunk/property/inc/class.uiadmin_location.inc.php
    trunk/property/templates/base/admin_location.xsl

Modified: trunk/property/inc/class.boadmin_location.inc.php
===================================================================
--- trunk/property/inc/class.boadmin_location.inc.php   2016-05-08 13:02:33 UTC 
(rev 14985)
+++ trunk/property/inc/class.boadmin_location.inc.php   2016-05-08 13:03:04 UTC 
(rev 14986)
@@ -105,11 +105,9 @@
                        return $standard;
                }
 
-               function read_config()
+               function read_config($data = array())
                {
-                       $standard = $this->so->read_config(array('start' => 
$this->start, 'query' => $this->query,
-                               'sort' => $this->sort, 'order' => 
$this->order));
-
+                       $standard = $this->so->read_config($data);
                        $this->total_records = $this->so->total_records;
 
                        return $standard;

Modified: trunk/property/inc/class.soadmin_location.inc.php
===================================================================
--- trunk/property/inc/class.soadmin_location.inc.php   2016-05-08 13:02:33 UTC 
(rev 14985)
+++ trunk/property/inc/class.soadmin_location.inc.php   2016-05-08 13:03:04 UTC 
(rev 14986)
@@ -143,17 +143,18 @@
                                $querymethod = " where name $this->like 
'%$query%' or column_name $this->like '%$query%'";
                        }
 
-                       $sql = "SELECT fm_location_config.* 
,fm_location_type.name as name FROM fm_location_config  $this->join 
fm_location_type on fm_location_config.location_type=fm_location_type.id 
$querymethod";
+                       $sql = "SELECT fm_location_config.* 
,fm_location_type.name as name FROM fm_location_config"
+                               . "  $this->join fm_location_type on 
fm_location_config.location_type=fm_location_type.id $querymethod";
 
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->total_records = $this->db->num_rows();
 
                        $this->db->limit_query($sql . $ordermethod, $start, 
__LINE__, __FILE__);
 
+                       $config = array();
                        while ($this->db->next_record())
                        {
-                               $config[] = array
-                                       (
+                               $config[] = array(
                                        'column_name' => 
$this->db->f('column_name'),
                                        'input_text' => 
$this->db->f('input_text'),
                                        'f_key' => $this->db->f('f_key'),
@@ -625,9 +626,9 @@
                                        if ($column_name == 'street_id')
                                        {
                                                
$this->oProc->AddColumn('fm_location' . $values[$column_name], 'street_number', 
array(
-                                                       'type' => 'varchar', 
'precision' => 10));
+                                                       'type' => 'varchar', 
'precision' => 10, 'nullable' => true));
                                                
$this->oProc->AddColumn('fm_location' . $values[$column_name] . '_history', 
'street_number', array(
-                                                       'type' => 'varchar', 
'precision' => 10));
+                                                       'type' => 'varchar', 
'precision' => 10, 'nullable' => true));
                                                
$this->oProc->DropColumn('fm_location' . $location_type, 
$table_def['fm_location' . $location_type], 'street_number');
                                                
$this->oProc->DropColumn('fm_location' . $location_type . '_history', 
$history_table_def['fm_location' . $location_type] . '_history', 
'street_number');
                                        }

Modified: trunk/property/inc/class.uiadmin_location.inc.php
===================================================================
--- trunk/property/inc/class.uiadmin_location.inc.php   2016-05-08 13:02:33 UTC 
(rev 14985)
+++ trunk/property/inc/class.uiadmin_location.inc.php   2016-05-08 13:03:04 UTC 
(rev 14986)
@@ -325,7 +325,6 @@
                                case 'list_attribute':
                                        $values = 
$this->bo->read_attrib($params);
                                        break;
-                               default:
                                case 'list_attribute_group':
                                        $values = 
$this->bo->read_attrib_group($params);
                                        break;
@@ -1223,94 +1222,113 @@
 
                function config()
                {
-                       if (!$this->acl_manage)
+                       if (!$this->acl_read)
                        {
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uilocation.stop',
-                                       'perm' => 16, 'acl_location' => 
$this->acl_location));
+                               phpgw::no_access();
                        }
 
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::config';
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array(
-                               'admin_location',
-                               'nextmatchs',
-                               'search_field'));
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               $search = phpgw::get_var('search');
+                               $order = phpgw::get_var('order');
+                               $draw = phpgw::get_var('draw', 'int');
+                               $columns = phpgw::get_var('columns');
 
-                       $standard_list = $this->bo->read_config();
+                               $params = array(
+                                       'start' => $this->start,
+                                       'results' => phpgw::get_var('length', 
'int', 'REQUEST', 0),
+                                       'query' => $search['value'],
+                                       'sort' => $order[0]['dir'],
+                                       'order' => 
$columns[$order[0]['column']]['data'],
+                                       'allrows' => phpgw::get_var('length', 
'int') == -1,
+                               );
 
-                       while (is_array($standard_list) && list(, $standard) = 
each($standard_list))
-                       {
-                               $content[] = array
-                                       (
-                                       'column_name' => 
$standard['column_name'],
-                                       'name' => $standard['location_name'],
-                                       'link_edit' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiadmin_location.edit_config',
-                                               'column_name' => 
$standard['column_name'])),
-                                       'lang_edit_standardtext' => lang('edit 
the column relation'),
-                                       'text_edit' => lang('edit')
-                               );
+                               $standard_list = 
$this->bo->read_config($params);
+                               $text_edit = lang('edit');
+                               $lang_edit_standardtext = lang('edit the column 
relation');
+
+                               $content = array();
+                               foreach ($standard_list as $standard)
+                               {
+                                       $content[] = array(
+                                               'column_name' => 
$standard['column_name'],
+                                               'name' => 
$standard['location_name'],
+                                               'link_edit' => "<a title 
=\"{$lang_edit_standardtext}\" href=\"" .$GLOBALS['phpgw']->link('/index.php',
+                                                       array('menuaction' => 
'property.uiadmin_location.edit_config',
+                                                               'column_name' 
=> $standard['column_name']
+                                                       )) . 
"\">{$text_edit}</a>",
+                                       );
+                               }
+                               $result_data = array('results' => $content);
+                               $result_data['total_records'] = 
$this->bo->total_records;
+                               $result_data['draw'] = $draw;
+                               return $this->jquery_results($result_data);
                        }
 
-                       //_debug_array($content);
+                       $appname = lang('location');
+                       $function_msg = lang('list config');
 
-                       $table_header[] = array
-                               (
-                               'lang_attribute' => lang('Attributes'),
-                               'lang_edit' => lang('edit'),
-                               'lang_delete' => lang('delete'),
-                               'sort_column_name' => 
$this->nextmatchs->show_sort_order(array
-                                       (
-                                       'sort' => $this->sort,
-                                       'var' => 'column_name',
-                                       'order' => $this->order,
-                                       'extra' => array('menuaction' => 
'property.uiadmin_location.config')
-                               )),
-                               'lang_column_name' => lang('column name'),
-                               'sort_name' => 
$this->nextmatchs->show_sort_order(array
-                                       (
-                                       'sort' => $this->sort,
-                                       'var' => 'name',
-                                       'order' => $this->order,
-                                       'extra' => array('menuaction' => 
'property.uiadmin_location.config')
-                               )),
-                               'lang_name' => lang('Table Name'),
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $data = array(
+                               'datatable_name' => $appname. ': ' . 
$function_msg,
+                               'form' => array(
+                                       'toolbar' => array(
+                                       )
+                               ),
+                               'datatable' => array(
+                                       'source' => self::link(array(
+                                               'menuaction' => 
'property.uiadmin_location.config',
+                                               'phpgw_return_as' => 'json'
+                                       )),
+                                       'allrows' => true,
+                                       'editor_action' => '',
+                                       'field' => array(
+                                               array(
+                                                       'key' => 'column_name',
+                                                       'label' => lang('Name'),
+                                                       'sortable' => true
+                                               ),
+                                               array(
+                                                       'key' => 'name',
+                                                       'label' => lang('table 
name'),
+                                                       'sortable' => true
+                                               ),
+                                               array(
+                                                       'key' => 'link_edit',
+                                                       'label' => lang('edit'),
+                                                       'sortable' => false
+                                               ),
+                                       )
+                               )
                        );
 
-                       $table_add[] = array
+                       $parameters = array
                                (
-                               'lang_add' => lang('add'),
-                               'lang_add_standardtext' => lang('add a 
standard'),
-                               'add_action' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiadmin_location.edit')),
-                               'lang_done' => lang('done'),
-                               'lang_done_standardtext' => lang('back to 
admin'),
-                               'done_action' => 
$GLOBALS['phpgw']->link('/admin/index.php')
+                               'parameter' => array(
+                                       array(
+                                               'name' => 'column_name',
+                                               'source' => 'column_name'
+                                       ),
+                               )
                        );
 
-
-                       $data = array
-                               (
-                               'allow_allrows' => false,
-                               'start_record' => $this->start,
-                               'record_limit' => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records' => count($standard_list),
-                               'all_records' => $this->bo->total_records,
-                               'link_url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiadmin_location.index')),
-                               'img_path' => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi', 'default'),
-                               'lang_searchfield_standardtext' => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_standardtext' => 
lang('Submit the search string'),
-                               'query' => $this->query,
-                               'lang_search' => lang('search'),
-                               'table_header_list_config' => $table_header,
-                               'values_list_config' => $content,
-                               'table_add' => $table_add
+                       $data['datatable']['actions'][] = array(
+                               'my_name' => 'edit',
+                               'statustext' => lang('Edit'),
+                               'text' => lang('Edit'),
+                               'action' => $GLOBALS['phpgw']->link(
+                                       '/index.php', array(
+                                               'menuaction' => 
'property.uiadmin_location.edit_config',
+                                       )
+                               ),
+                               'parameters' => json_encode($parameters)
                        );
-
-                       $appname = lang('location');
-                       $function_msg = lang('list config');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('list_config' => $data));
-                       $this->save_sessiondata();
+       
+                       unset($parameters);
+                       self::render_template_xsl('datatable_jquery', $data);
                }
 
                function edit_config()

Modified: trunk/property/templates/base/admin_location.xsl
===================================================================
--- trunk/property/templates/base/admin_location.xsl    2016-05-08 13:02:33 UTC 
(rev 14985)
+++ trunk/property/templates/base/admin_location.xsl    2016-05-08 13:03:04 UTC 
(rev 14986)
@@ -11,9 +11,6 @@
                        <xsl:when test="edit_attrib">
                                <xsl:apply-templates select="edit_attrib"/>
                        </xsl:when>
-                       <xsl:when test="list_config">
-                               <xsl:apply-templates select="list_config"/>
-                       </xsl:when>
                        <xsl:when test="edit_config">
                                <xsl:apply-templates select="edit_config"/>
                        </xsl:when>
@@ -173,88 +170,6 @@
                </tr>
 </xsl:template>
 
-<!-- New template-->
-<xsl:template match="list_config">
-               <xsl:apply-templates select="menu"/>
-               <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
-                       <tr>
-                               <td align="right">
-                                       <xsl:call-template name="search_field"/>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td colspan="3" width="100%">
-                                       <xsl:call-template name="nextmatchs"/>
-                               </td>
-                       </tr>
-               </table>
-               <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
-                       <xsl:apply-templates select="table_header_list_config"/>
-                       <xsl:apply-templates select="values_list_config"/>
-               </table>
-</xsl:template>
-
-<!-- New template-->
-<xsl:template match="table_header_list_config">
-               <xsl:variable name="sort_column_name">
-                       <xsl:value-of select="sort_column_name"/>
-               </xsl:variable>
-               <xsl:variable name="sort_name">
-                       <xsl:value-of select="sort_name"/>
-               </xsl:variable>
-               <tr class="th">
-                       <td class="th_text" width="10%" align="center">
-                               <a href="{$sort_column_name}">
-                                       <xsl:value-of 
select="lang_column_name"/>
-                               </a>
-                       </td>
-                       <td class="th_text" width="10%" align="center">
-                               <a href="{$sort_name}">
-                                       <xsl:value-of select="lang_name"/>
-                               </a>
-                       </td>
-                       <td class="th_text" width="5%" align="center">
-                               <xsl:value-of select="lang_edit"/>
-                       </td>
-               </tr>
-</xsl:template>
-
-<!-- New template-->
-<xsl:template match="values_list_config">
-               <xsl:variable name="lang_edit_standardtext">
-                       <xsl:value-of select="lang_edit_standardtext"/>
-               </xsl:variable>
-               <tr>
-                       <xsl:attribute name="class">
-                               <xsl:choose>
-                                       <xsl:when test="@class">
-                                               <xsl:value-of select="@class"/>
-                                       </xsl:when>
-                                       <xsl:when test="position() mod 2 = 0">
-                                               <xsl:text>row_off</xsl:text>
-                                       </xsl:when>
-                                       <xsl:otherwise>
-                                               <xsl:text>row_on</xsl:text>
-                                       </xsl:otherwise>
-                               </xsl:choose>
-                       </xsl:attribute>
-                       <td align="left">
-                               <xsl:value-of select="column_name"/>
-                       </td>
-                       <td align="left">
-                               <xsl:value-of select="name"/>
-                       </td>
-                       <td align="center">
-                               <xsl:variable name="link_edit">
-                                       <xsl:value-of select="link_edit"/>
-                               </xsl:variable>
-                               <a href="{$link_edit}" 
onMouseover="window.status='{$lang_edit_standardtext}';return true;" 
onMouseout="window.status='';return true;">
-                                       <xsl:value-of select="text_edit"/>
-                               </a>
-                       </td>
-               </tr>
-</xsl:template>
-
 <!-- edit_config  -->
 <xsl:template match="edit_config">
                <div align="left">




reply via email to

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