fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8295] property: more on notification


From: Sigurd Nes
Subject: [Fmsystem-commits] [8295] property: more on notification
Date: Wed, 14 Dec 2011 22:31:11 +0000

Revision: 8295
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8295
Author:   sigurdne
Date:     2011-12-14 22:31:10 +0000 (Wed, 14 Dec 2011)
Log Message:
-----------
property: more on notification

Modified Paths:
--------------
    trunk/property/inc/class.bolookup.inc.php
    trunk/property/inc/class.notify.inc.php
    trunk/property/inc/class.uilookup.inc.php
    trunk/property/js/yahoo/notify.js
    trunk/property/templates/base/project.xsl

Modified: trunk/property/inc/class.bolookup.inc.php
===================================================================
--- trunk/property/inc/class.bolookup.inc.php   2011-12-14 18:24:40 UTC (rev 
8294)
+++ trunk/property/inc/class.bolookup.inc.php   2011-12-14 22:31:10 UTC (rev 
8295)
@@ -158,6 +158,7 @@
                                {
                                        $contact['email'] = 
isset($comms[$contact['contact_id']]['work email']) ? 
$comms[$contact['contact_id']]['work email'] : '';
                                        $contact['wphone'] = 
isset($comms[$contact['contact_id']]['work phone']) ?  
$comms[$contact['contact_id']]['work phone'] : '';
+                                       $contact['mobile'] = 
isset($comms[$contact['contact_id']]['mobile (cell) phone']) ?  
$comms[$contact['contact_id']]['mobile (cell) phone'] : '';
                                }
                                if (in_array($contact['contact_id'], 
$user_contacts) )
                                {

Modified: trunk/property/inc/class.notify.inc.php
===================================================================
--- trunk/property/inc/class.notify.inc.php     2011-12-14 18:24:40 UTC (rev 
8294)
+++ trunk/property/inc/class.notify.inc.php     2011-12-14 22:31:10 UTC (rev 
8295)
@@ -70,6 +70,11 @@
 
                public function read($data = array())
                {
+                       if(!isset($data['location_id']) || 
!isset($data['location_item_id']))
+                       {
+                               throw new Exception("property_notify::read() - 
Missing location info in input");
+                       }       
+
                        $location_id = (int) $data['location_id'];
                        $location_item_id = (int) $data['location_item_id'];
                        
@@ -80,7 +85,7 @@
                        . " {$this->_join} phpgw_contact_person ON 
phpgw_notification.contact_id = phpgw_contact_person.person_id"
                        . " WHERE location_id = {$location_id} AND 
location_item_id = {$location_item_id}";
                        $this->_db->query($sql,__LINE__,__FILE__);
-//_debug_array($sql);
+
                        $values         = array();
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                        $lang_yes       = lang('yes');
@@ -102,6 +107,12 @@
                                        'last_name'                             
=> $this->_db->f('last_name', true)
                                );
                        }
+
+                       foreach ($values as &$entry)
+                       {
+                               $entry['comms'] = 
execMethod('addressbook.boaddressbook.get_comm_contact_data',$entry['contact_id']);
+                       }
+_debug_array($values);
                        return $values;
                }
 
@@ -117,12 +128,12 @@
 //_debug_array($data);die();
                        if(!isset($data['location_id']) || 
!isset($data['location_item_id']))
                        {
-                               throw new 
Exception("property_notify::get_yui_table_def - Missing location info in 
input");
+                               throw new 
Exception("property_notify::get_yui_table_def() - Missing location info in 
input");
                        }       
 
                        if(!isset($data['count']))
                        {
-                               throw new 
Exception("property_notify::get_yui_table_def - Missing count in input");       
              
+                               throw new 
Exception("property_notify::get_yui_table_def() - Missing count in input");     
              
                        }       
 
                        $content = $this->read($data);
@@ -146,7 +157,7 @@
                                                                                
                        array('key' => 'first_name','label'=>lang('first 
name'),'sortable'=>true,'resizeable'=>true),
                                                                                
                        array('key' => 'last_name','label'=>lang('last 
name'),'sortable'=>true,'resizeable'=>true),
                                                                                
                        array('key' => 
'notification_method','label'=>lang('method'),'sortable'=>true,'resizeable'=>true),
-                                                                               
                        array('key' => 'is_active','label'=>lang('is 
active'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                        array('key' => 
'is_active','label'=>lang('active'),'sortable'=>true,'resizeable'=>true),
                                                                                
                        array('key' => 
'entry_date','label'=>lang('entry_date'),'sortable'=>true,'resizeable'=>true),
                                                                                
                        array('key' => 'select','label'=> lang('select'), 
'sortable'=>false,'resizeable'=>false,'formatter'=>'myFormatterCheck_notify','width'=>30)
                                                                                
                        ))
@@ -156,20 +167,23 @@
                        (
                                'name'   => "{$count}",
                                'values'  => json_encode(array(
-                                       array('id' 
=>'values[check_all]','type'=>'buttons', 'value'=>'Receipt', 'label'=> 
lang('check all'), 'funct'=> 'check_all_notify' , 'classname'=> 'actionButton', 
'value_hidden'=>""),
-                                       array('id' 
=>'values[delete_receipt]','type'=>'buttons', 'value'=>'Delete Receipt', 
'label'=> lang('Delete receipt'), 'funct'=> 'onActionsClick_notify' , 
'classname'=> 'actionButton', 'value_hidden'=>""),
-                                       array('id' 
=>'values[enable_alarm]','type'=>'buttons', 'value'=>'Enable', 'label'=> 
lang('enable'), 'funct'=> 'onActionsClick_notify' , 'classname'=> 
'actionButton', 'value_hidden'=>""),
-                                       array('id' 
=>'values[disable_alarm]','type'=>'buttons', 'value'=>'Disable', 
'label'=>lang('disable'), 'funct'=> 'onActionsClick_notify' , 'classname'=> 
'actionButton', 'value_hidden'=>""),
+                                       array('id' 
=>'check_all','type'=>'buttons', 'value'=>'', 'label'=> lang('check all'), 
'funct'=> 'check_all_notify' , 'classname'=> 'actionButton', 
'value_hidden'=>""),
+                                       array('id' 
=>'notify[email]','type'=>'buttons', 'value'=>'email', 'label'=> lang('email'), 
'funct'=> 'onActionsClick_notify' , 'classname'=> 'actionButton', 
'value_hidden'=>""),
+                                       array('id' 
=>'notify[sms]','type'=>'buttons', 'value'=>'sms', 'label'=> 'SMS', 'funct'=> 
'onActionsClick_notify' , 'classname'=> 'actionButton', 'value_hidden'=>""),
+                                       array('id' 
=>'notify[enable]','type'=>'buttons', 'value'=>'enable', 'label'=> 
lang('enable'), 'funct'=> 'onActionsClick_notify' , 'classname'=> 
'actionButton', 'value_hidden'=>""),
+                                       array('id' 
=>'notify[disable]','type'=>'buttons', 'value'=>'disable', 
'label'=>lang('disable'), 'funct'=> 'onActionsClick_notify' , 'classname'=> 
'actionButton', 'value_hidden'=>""),
+                                       array('id' 
=>'notify[delete]','type'=>'buttons', 'value'=>'delete', 'label'=> 
lang('Delete'), 'funct'=> 'onActionsClick_notify' , 'classname'=> 
'actionButton', 'value_hidden'=>""),
                                ))
                        );
 
 
                        $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'notify', 'property' );
 
+                       $lang_view = lang('view');
                        $code = <<<JS
        YAHOO.widget.DataTable.formatLink_notify = function(elCell, oRecord, 
oColumn, oData)
        {
-               elCell.innerHTML = "<a 
href="+datatable[{$count}][0]["edit_action"]+"&ab_id="+oData+">" + oData + 
"</a>";
+               elCell.innerHTML = "<a 
href="+datatable[{$count}][0]["edit_action"]+"&ab_id="+oData+" 
title='"+oData+"'>{$lang_view}</a>";
        };
 
        this.refresh_notify_contact=function()
@@ -249,6 +263,44 @@
                                return;
                        }
 
+                       if($notify = phpgw::get_var('notify'))
+                       {
+                               $ids = $notify['ids'];
+                               if($ids)
+                               {
+                                       $value_set = array();
+
+                                       if($notify['email'])
+                                       {
+                                               
$value_set['notification_method'] = 'email';
+                                       }       
+                                       else if($notify['sms'])
+                                       {
+                                               
$value_set['notification_method'] = 'sms';
+                                       }       
+                                       else if($notify['enable'])
+                                       {
+                                               $value_set['is_active'] = 1;
+                                       }       
+                                       else if($notify['disable'])
+                                       {
+                                               $value_set['is_active'] = '';
+                                       }       
+                                       else if($notify['delete'])
+                                       {
+                                               $sql = "DELETE FROM 
phpgw_notification WHERE id IN (". implode(',', $ids) . ')';
+                                       }       
+                                       
+                                       if($value_set)
+                                       {
+                                               $value_set      = 
$this->_db->validate_update($value_set);
+                                               $sql = "UPDATE 
phpgw_notification SET {$value_set} WHERE id IN (". implode(',', $ids) . ')';
+                                       }
+                                       
$this->_db->query($sql,__LINE__,__FILE__);                      
+                               }
+                       }
+
+
                        if($location_id && $location_item_id && $contact_id)
                        {
                                $sql = "SELECT id FROM phpgw_notification WHERE 
location_id = {$location_id} AND location_item_id = {$location_item_id} AND 
contact_id = {$contact_id}";

Modified: trunk/property/inc/class.uilookup.inc.php
===================================================================
--- trunk/property/inc/class.uilookup.inc.php   2011-12-14 18:24:40 UTC (rev 
8294)
+++ trunk/property/inc/class.uilookup.inc.php   2011-12-14 22:31:10 UTC (rev 
8295)
@@ -227,12 +227,12 @@
                        }
 
                        $uicols = array (
-                               'input_type'    =>      
array('text','text','text','text','text'),
-                               'name'                  =>      
array('contact_id','contact_name','email','wphone','is_user'),
-                               'sort_field'    =>      
array('person_id','last_name','','',''),
-                               'sortable'              =>      
array(true,true,false,false,false),
-                               'formatter'             =>      
array('','','','',''),
-                               'descr'                 =>      
array(lang('ID'),lang('Name'),lang('email'),lang('phone'), lang('is user'))
+                               'input_type'    =>      
array('text','text','text','text','text','text'),
+                               'name'                  =>      
array('contact_id','contact_name','email','wphone','mobile','is_user'),
+                               'sort_field'    =>      
array('person_id','last_name','','','',''),
+                               'sortable'              =>      
array(true,true,false,false,false,false),
+                               'formatter'             =>      
array('','','','','',''),
+                               'descr'                 =>      
array(lang('ID'),lang('Name'),lang('email'),lang('phone'),lang('mobile'), 
lang('is user'))
                        );
 
                        $addressbook_list = array();

Modified: trunk/property/js/yahoo/notify.js
===================================================================
--- trunk/property/js/yahoo/notify.js   2011-12-14 18:24:40 UTC (rev 8294)
+++ trunk/property/js/yahoo/notify.js   2011-12-14 22:31:10 UTC (rev 8295)
@@ -7,10 +7,11 @@
 
/********************************************************************************/
        this.cleanValuesHiddenActionsButtons=function()
        {
-       //      YAHOO.util.Dom.get('hd_values[set_receipt]').value = '';
-               YAHOO.util.Dom.get('hd_values[delete_receipt]').value = '';
-               YAHOO.util.Dom.get('hd_values[enable_alarm]').value = '';
-               YAHOO.util.Dom.get('hd_values[disable_alarm]').value = '';
+               YAHOO.util.Dom.get('hd_notify[email]').value = '';
+               YAHOO.util.Dom.get('hd_notify[sms]').value = '';
+               YAHOO.util.Dom.get('hd_notify[enable]').value = '';
+               YAHOO.util.Dom.get('hd_notify[disable]').value = '';
+               YAHOO.util.Dom.get('hd_notify[delete]').value = '';
        }
 
 
@@ -29,7 +30,8 @@
 
        var myFormatterCheck_notify = function(elCell, oRecord, oColumn, oData)
        {
-               elCell.innerHTML = "<center><input type=\"checkbox\" 
class=\"mychecks\"  value=\"\" 
name=\"values[notify]["+oRecord.getData('id')+"]\"/></center>";
+               var id = oRecord.getData('id');
+               elCell.innerHTML = "<center><input type=\"checkbox\" 
class=\"mychecks\"  value=\""+id+"\" name=\"notify[ids][]\"/></center>";
        }
 
        check_all_notify = function()

Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl   2011-12-14 18:24:40 UTC (rev 
8294)
+++ trunk/property/templates/base/project.xsl   2011-12-14 22:31:10 UTC (rev 
8295)
@@ -613,16 +613,6 @@
                                                <input size="5" type="hidden" 
id = "notify_contact" name="notify_contact" value="" 
title="{$lang_contact_statustext}">
                                                </input>
                                                <input size="30" type="text" 
name="notify_contact_name" value="" onClick="notify_contact_lookup();" readonly 
= 'readonly' title="{$lang_contact_statustext}"/>
-                                               <select 
id="notify_contact_method" name="notify_contact_method">
-                                                       <option 
value="email"><xsl:value-of select="php:function('lang', 'email')" /></option>
-                                                       <option 
value="sms">SMS</option>                                                
-                                               </select>
-                                               <select 
id="notify_contact_edit" name="notify_contact_edit">
-                                                       <option 
value="add"><xsl:value-of select="php:function('lang', 'add')" /></option>
-                                                       <option 
value="edit"><xsl:value-of select="php:function('lang', 'edit')" /></option>
-                                                       <option 
value="delete"><xsl:value-of select="php:function('lang', 'delete')" /></option>
-                                               </select>
-                                               
                                        </td></tr></table></td>
                                </tr>
                                <tr>




reply via email to

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