fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [12298] Fix custom column selection and add inline ed


From: Sigurd Nes
Subject: [Fmsystem-commits] [12298] Fix custom column selection and add inline editing for appropriate fields
Date: Wed, 12 Nov 2014 22:23:50 +0000

Revision: 12298
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12298
Author:   sigurdne
Date:     2014-11-12 22:23:50 +0000 (Wed, 12 Nov 2014)
Log Message:
-----------
Fix custom column selection and add inline editing for appropriate fields

Modified Paths:
--------------
    branches/dev-syncromind/phpgwapi/js/jquery/editable/jquery.jeditable.js
    branches/dev-syncromind/phpgwapi/templates/base/datatable_jquery.xsl
    branches/dev-syncromind/property/inc/class.bogeneric.inc.php
    branches/dev-syncromind/property/inc/class.sogeneric.inc.php
    branches/dev-syncromind/property/inc/class.uigeneric.inc.php

Added Paths:
-----------
    branches/dev-syncromind/property/js/portico/generic.index.js

Modified: 
branches/dev-syncromind/phpgwapi/js/jquery/editable/jquery.jeditable.js
===================================================================
--- branches/dev-syncromind/phpgwapi/js/jquery/editable/jquery.jeditable.js     
2014-11-12 22:21:18 UTC (rev 12297)
+++ branches/dev-syncromind/phpgwapi/js/jquery/editable/jquery.jeditable.js     
2014-11-12 22:23:50 UTC (rev 12298)
@@ -72,7 +72,7 @@
             onblur     : 'cancel',
             loadtype   : 'GET',
             loadtext   : 'Loading...',
-            placeholder: 'Click to edit',
+            placeholder: '...',//'Click to edit',
             loaddata   : {},
             submitdata : {},
             ajaxoptions: {}

Modified: branches/dev-syncromind/phpgwapi/templates/base/datatable_jquery.xsl
===================================================================
--- branches/dev-syncromind/phpgwapi/templates/base/datatable_jquery.xsl        
2014-11-12 22:21:18 UTC (rev 12297)
+++ branches/dev-syncromind/phpgwapi/templates/base/datatable_jquery.xsl        
2014-11-12 22:23:50 UTC (rev 12298)
@@ -206,9 +206,14 @@
                                </xsl:when>
                                <xsl:when test="type = 'link'">
                                        <td valign="top">
-                                       <a href="{href}"><xsl:value-of 
select="value"/></a>
-
-
+                                               <a href="{href}">
+                                                       <xsl:if test="onclick">
+                                                               <xsl:attribute 
name="onclick">
+                                                                       
<xsl:value-of select="onclick"/>
+                                                               </xsl:attribute>
+                                                       </xsl:if>
+                                                       <xsl:value-of 
select="value"/>
+                                               </a>
                                        </td>
                                </xsl:when>
                                <xsl:otherwise>

Modified: branches/dev-syncromind/property/inc/class.bogeneric.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.bogeneric.inc.php        
2014-11-12 22:21:18 UTC (rev 12297)
+++ branches/dev-syncromind/property/inc/class.bogeneric.inc.php        
2014-11-12 22:23:50 UTC (rev 12298)
@@ -336,4 +336,10 @@
                        }
                        return array('ResultSet'=> array('Result'=>$values));
                }
+
+               public function edit_field($data=  array())
+               {
+                       return $this->so->edit_field($data);
+               }
+
        }

Modified: branches/dev-syncromind/property/inc/class.sogeneric.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.sogeneric.inc.php        
2014-11-12 22:21:18 UTC (rev 12297)
+++ branches/dev-syncromind/property/inc/class.sogeneric.inc.php        
2014-11-12 22:23:50 UTC (rev 12298)
@@ -3562,5 +3562,15 @@
                        }
                        return $path;
                }
-       }
 
+               public function edit_field($data=  array())
+               {
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               return false;
+                       }
+                       
+                       $value_set      = 
$this->_db->validate_update(array($data['field_name'] => $data['value']));
+                       return $this->_db->query("UPDATE $table SET 
{$value_set} WHERE {$this->location_info['id']['name']} = 
'{$data['id']}'",__LINE__,__FILE__);
+               }
+       }
\ No newline at end of file

Modified: branches/dev-syncromind/property/inc/class.uigeneric.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uigeneric.inc.php        
2014-11-12 22:21:18 UTC (rev 12297)
+++ branches/dev-syncromind/property/inc/class.uigeneric.inc.php        
2014-11-12 22:23:50 UTC (rev 12298)
@@ -57,7 +57,8 @@
                                'delete'                        => true,
                                'download'                      => true,
                                'columns'                       => true,
-                               'attrib_history'        => true
+                               'attrib_history'        => true,
+                               'edit_field'            => true
                        );
 
                function __construct()
@@ -237,10 +238,8 @@
 
                function columns()
                {
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
 
-                       //cramirez: necesary for windows.open . Avoid error JS
-                       phpgwapi_yui::load_widget('tabview');
-
                        $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
                        $GLOBALS['phpgw_info']['flags']['noframework'] = true;
                        $values = phpgw::get_var('values');
@@ -317,12 +316,19 @@
                                                                'type' => 
'link',
                                                                'value' => 
lang('new'),
                                                                'href' => 
self::link(array(
-                                                                       
'menuaction' => 'property.uigeneric.add', 
-                                                                       
'appname'    => $this->appname,
+                                                                       
'menuaction' => 'property.uigeneric.add',
+                                                                       
'appname'    => $this->bo->appname,
                                                                        'type'  
     => $this->type,
-                                                                       
'type_id'    => $this->type_id                                                  
        
+                                                                       
'type_id'    => $this->type_id
                                                                        )),
                                                                'class' => 
'new_item'
+                                                       ),
+                                                       array(
+                                                               'type' => 
'link',
+                                                               'value' => 
lang('columns'),
+                                                               'href' => '#',
+                                                               'class' => '',
+                                                               'onclick'=> 
"choose_columns({menuaction:'property.uigeneric.columns', 
appname:'{$this->bo->appname}',type:'{$this->type}', 
type_id:'{$this->type_id}'})"
                                                        )
                                                )
                                        )
@@ -342,7 +348,10 @@
                                                                        
'export'     => true,
                                                                        
'allrows'    => true)),
                                        'allrows'       => true,
-                                       'editor_action' => '',
+                                       'editor_action' => 
self::link(array('menuaction' => 'property.uigeneric.edit_field',
+                                                                       
'appname'    => $this->appname,
+                                                                       'type'  
     => $this->type,
+                                                                       
'type_id'    => $this->type_id)),
                                        'field' => array()
                                )
                        );
@@ -367,9 +376,20 @@
                                                                        
'sortable' => ($uicols['sortable'][$k]) ? true : false,
                                                                        
'hidden' => ($uicols['input_type'][$k] == 'hidden') ? true : false
                                                                );
-                                       if ($uicols['name'][$k] == 'id') {
+                                       if ($uicols['name'][$k] == 'id')
+                                       {
                                                $params['formatter'] = 
'JqueryPortico.formatLink';
                                        }
+                                       switch ($uicols['datatype'][$k])
+                                       {
+                                               case 'email':
+                                               case 'varchar':
+                                               case 'I':
+                                               case 'V':
+                                               $params['editor'] = true;
+                                               break;
+                                       }
+
                                        array_push 
($data['datatable']['field'], $params);
                        }
 
@@ -455,7 +475,11 @@
                                                ))
                                        );
                        }
-                       
+
+                       self::add_javascript('property', 'portico', 
'generic.index.js');
+                       self::add_javascript('phpgwapi', 'tinybox2', 
'packed.js');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/tinybox2/style.css');
+               
                        self::render_template_xsl('datatable_jquery', $data);
 
                }
@@ -1014,4 +1038,44 @@
                                                                                
'type_id'               => $this->type_id));
                        }
                }
+
+               public function edit_field()
+               {
+                       $id = phpgw::get_var('id', 'int', 'POST');
+                       $field_name = phpgw::get_var('field_name', 'string');
+
+                       if(!$this->acl_edit)
+                       {
+                               return lang('no access');
+                       }
+
+                       if ($id && $field_name)
+                       {
+
+                               $data = array
+                               (
+                                       'id'                    => $id,
+                                       'field_name'    => $field_name,
+                                       'value'                 => 
phpgw::get_var('value')
+                               );
+
+                               try
+                               {
+                                       $this->bo->edit_field($data);
+                               }
+
+                               catch(Exception $e)
+                               {
+                                       if ( $e )
+                                       {
+                                               echo $e->getMessage();
+                                       }
+                               }
+                               echo true;
+                       }
+                       else
+                       {
+                               echo "ERROR";
+                       }
+               }
        }

Added: branches/dev-syncromind/property/js/portico/generic.index.js
===================================================================
--- branches/dev-syncromind/property/js/portico/generic.index.js                
                (rev 0)
+++ branches/dev-syncromind/property/js/portico/generic.index.js        
2014-11-12 22:23:50 UTC (rev 12298)
@@ -0,0 +1,10 @@
+       this.choose_columns = function(oArgs)
+       {
+               var requestUrl = phpGWLink('index.php', oArgs);
+               TINY.box.show({iframe:requestUrl, 
boxid:'frameless',width:750,height:450,fixed:false,maskid:'darkmask',maskopacity:40,
 mask:true, animate:true, close: true,closejs:function(){refresh_page();}});
+       };
+
+       function refresh_page()
+       {
+               location.reload();
+       }




reply via email to

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