fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8293] property: notifier


From: Sigurd Nes
Subject: [Fmsystem-commits] [8293] property: notifier
Date: Wed, 14 Dec 2011 15:28:31 +0000

Revision: 8293
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8293
Author:   sigurdne
Date:     2011-12-14 15:28:31 +0000 (Wed, 14 Dec 2011)
Log Message:
-----------
property: notifier

Modified Paths:
--------------
    trunk/property/inc/class.uiproject.inc.php
    trunk/property/js/yahoo/project.edit.js
    trunk/property/js/yahoo/property2.js
    trunk/property/templates/base/project.xsl

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2011-12-14 13:51:19 UTC (rev 
8292)
+++ trunk/property/inc/class.uiproject.inc.php  2011-12-14 15:28:31 UTC (rev 
8293)
@@ -945,8 +945,6 @@
                        $values['contact_id']           = 
phpgw::get_var('contact', 'int', 'POST');
                        $auto_create                            = false;
 
-                       $values['notify_contact_id'] = 
phpgw::get_var('notify_contact_id', 'int', 'POST');
-
                        $datatable = array();
 
                        /*$datatable['config']['base_java_url'] = 
"menuaction:'property.uiproject.edit',"
@@ -1656,33 +1654,26 @@
 
                        
                        $content_notify = array();
-                       $datavalues[3] = array
-                               (
-                                       'name'                                  
=> "3",
-                                       'values'                                
=> json_encode($content_notify),
-                                       'total_records'                 => 
count($content_notify),
-                                       'edit_action'                   => 
json_encode($GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.index'))),
-                                       'is_paginator'                  => 1,
-                                       'footer'                                
=> 0
-                               );
 
-                       $myColumnDefs[3] = array
-                               (
-                                       'name'          => "3",
-                                       'values'        =>      
json_encode(array(      array('key' => 
'workorder_id','label'=>lang('Workorder'),'sortable'=>true,'resizeable'=>true),
-                                                                               
                                array('key' => 
'voucher_id','label'=>lang('bilagsnr'),'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.widget.DataTable.formatLink_voucher'),
-                                                                               
                                array('key' => 
'invoice_id','label'=>lang('invoice 
number'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                array('key' => 
'vendor','label'=>lang('vendor'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                array('key' => 
'amount','label'=>lang('amount'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterRight'),
-                                                                               
                                array('key' => 
'approved_amount','label'=>lang('approved 
amount'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterRight'),
-                                                                               
                                array('key' => 
'currency','label'=>lang('currency'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                array('key' => 
'budget_responsible','label'=>lang('budget 
responsible'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                array('key' => 
'budsjettsigndato','label'=>lang('budsjettsigndato'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                array('key' => 
'transfer_time','label'=>lang('transfer 
time'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                ))
+                       $notify                         = 
CreateObject('property.notify');
+                       
+                       $location_id    = 
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
+                       $notify_info = $notify->get_yui_table_def(array
+                                                               (
+                                                                       
'location_id'           => $location_id,
+                                                                       
'location_item_id'      => $id,
+                                                                       'count' 
                        => count($myColumnDefs)
+                                                               )
+                                                       );
+                       
+                       $datavalues[] = $notify_info['datavalues'];
 
-                               );
+                       $myColumnDefs[] = $notify_info['column_defs'];
 
+                       $myButtons = array();
+                       $myButtons[] = $notify_info['buttons'];
+
+//     _debug_array($myButtons);die();
                        
//----------------------------------------------datatable settings--------
 
 
@@ -1701,6 +1692,7 @@
                                        'property_js'                           
                => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
                                        'datatable'                             
                        => $datavalues,
                                        'myColumnDefs'                          
                => $myColumnDefs,
+                                       'myButtons'                             
                        => $myButtons,
                                        'tabs'                                  
                        => self::_generate_tabs($tabs,array('coordination' => 
$suppresscoordination)),
                                        'msgbox_data'                           
                => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                        'value_origin'                          
                => isset($values['origin']) ? $values['origin'] : '',
@@ -1822,7 +1814,7 @@
                                        'value_approval_mail_address'           
=> $supervisor_email,
 
                                        'currency'                              
                        => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
-                                       'base_java_url'                         
        => "{menuaction:'property.uiproject.update_data',id:{$id}}",
+                                       'base_java_url'                         
        => 
"{menuaction:'property.notify.update_data',location_id:{$location_id},location_item_id:{$id}}",
                                );
                        //_debug_array($data);die;
 
@@ -2143,66 +2135,4 @@
 
                        return  phpgwapi_yui::tabview_generate($tabs, 
'general');
                }
-
-               function update_data()
-               {
-                       $action = phpgw::get_var('action', 'string', 'GET');
-                       switch($action)
-                       {
-                               case 'refresh_notify_contact':
-                                       return $this->refresh_notify_contact();
-                                       break;
-                               default:
-                       }
-               }
-
-               function refresh_notify_contact()
-               {
-                       $id     = phpgw::get_var('id', 'int');
-
-                       if( !$this->acl_read)
-                       {
-                               return;
-                       }
-
-//FIXME
-                       $link_file_data = array
-                       (
-                               'menuaction'    => 'property.uitts.view_file',
-                               'id'                    => $id
-                       );
-
-                       $link_to_files = 
isset($this->bo->config->config_data['files_url']) ? 
$this->bo->config->config_data['files_url']:'';
-
-                       $link_view_file = 
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
-                       $values = $this->bo->read_single($id);
-
-                       $content_files = array();
-
-                       foreach($values['files'] as $_entry )
-                       {
-                               $content_files[] = array
-                               (
-                                       'file_name' => '<a 
href="'.$link_view_file.'&amp;file_name='.$_entry['name'].'" target="_blank" 
title="'.lang('click to view file').'">'.$_entry['name'].'</a>',
-                                       'delete_file' => '<input 
type="checkbox" name="values[file_action][]" value="'.$_entry['name'].'" 
title="'.lang('Check to delete file').'">',
-                                       'attach_file' => '<input 
type="checkbox" name="values[file_attach][]" value="'.$_entry['name'].'" 
title="'.lang('Check to attach file').'">'
-                               );
-                       }                                                       
-
-                       if( phpgw::get_var('phpgw_return_as') == 'json' )
-                       {
-
-                               if(count($content_files))
-                               {
-                                       return json_encode($content_files);
-                               }
-                               else
-                               {
-                                       return "";
-                               }
-                       }
-                       return $content_files;
-               }
-
-
        }

Modified: trunk/property/js/yahoo/project.edit.js
===================================================================
--- trunk/property/js/yahoo/project.edit.js     2011-12-14 13:51:19 UTC (rev 
8292)
+++ trunk/property/js/yahoo/project.edit.js     2011-12-14 15:28:31 UTC (rev 
8293)
@@ -2,8 +2,6 @@
 var  myPaginator_1, myDataTable_1;
 var  myPaginator_2, myDataTable_2;
 var  myPaginator_3, myDataTable_3;
-var d;
-var notify_contact = 0;
 
 
/********************************************************************************/
        YAHOO.widget.DataTable.formatLink = function(elCell, oRecord, oColumn, 
oData)
@@ -107,39 +105,6 @@
 
  
/********************************************************************************/
 
-       this.notify_contact_lookup = function()
-       {
-               var oArgs = 
{menuaction:'property.uilookup.addressbook',column:'notify_contact'};
-               var strURL = phpGWLink('index.php', oArgs);
-               
Window1=window.open(strURL,"Search","left=50,top=100,width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
-       }               
-
-       this.refresh_notify_contact=function()
-       {
-               if(document.getElementById('notify_contact').value)
-               {
-                       base_java_url['notify_contact'] = 
document.getElementById('notify_contact').value;
-               }
-
-               if(document.getElementById('notify_contact').value != 
notify_contact)
-               {
-                       base_java_url['action'] = 'refresh_notify_contact';
-                       execute_async(myDataTable_3);
-                       notify_contact = 
document.getElementById('notify_contact').value;
-               }
-       }
-
-
-       this.onDOMAttrModified = function(e)
-       {
-               var attr = e.attrName || e.propertyName
-               var target = e.target || e.srcElement;
-               if (attr.toLowerCase() == 'notify_contact')
-               {
-                       refresh_notify_contact();
-               }
-       }
-
 YAHOO.util.Event.addListener(window, "load", function()
 {
        loader = new YAHOO.util.YUILoader();
@@ -153,18 +118,3 @@
     loader.insert();
 });
 
-YAHOO.util.Event.addListener(window, "load", function()
-{
-       d = document.getElementById('notify_contact');
-       if(d)
-       {
-               if (d.attachEvent)
-               {
-                       d.attachEvent('onpropertychange', onDOMAttrModified, 
false);
-               }
-               else
-               {
-                       d.addEventListener('DOMAttrModified', 
onDOMAttrModified, false);
-               }
-       }
-});

Modified: trunk/property/js/yahoo/property2.js
===================================================================
--- trunk/property/js/yahoo/property2.js        2011-12-14 13:51:19 UTC (rev 
8292)
+++ trunk/property/js/yahoo/property2.js        2011-12-14 15:28:31 UTC (rev 
8293)
@@ -595,22 +595,25 @@
                //delete quotes in myButtons, field: "fn"
                for(k=0;k<myButtons.length;k++)
                {
-                       for(m=0;m<myButtons[k].length;m++)
+                       if(typeof(myButtons[k])!="undefined")
                        {
-                               if(myButtons[k][m]['type']=='menu')
+                               for(m=0;m<myButtons[k].length;m++)
                                {
-                                       
for(p=0;p<myButtons[k][m]['value'].length;p++)
+                                       if(myButtons[k][m]['type']=='menu')
                                        {
-                                               try
-                                                 {
-                                                       
this.deletes_quotes(myButtons[k][m]['value'][p]['onclick'],"fn");
-                                                 }
-                                               catch(err)
-                                                 {
-                                                       txt="There was an error 
on this page.\n\n";
-                                                       txt+="Error 
description: " + err.description + "\n\n";
-                                                       alert(txt);
-                                                 }
+                                               
for(p=0;p<myButtons[k][m]['value'].length;p++)
+                                               {
+                                                       try
+                                                         {
+                                                               
this.deletes_quotes(myButtons[k][m]['value'][p]['onclick'],"fn");
+                                                         }
+                                                       catch(err)
+                                                         {
+                                                               txt="There was 
an error on this page.\n\n";
+                                                               txt+="Error 
description: " + err.description + "\n\n";
+                                                               alert(txt);
+                                                         }
+                                               }
                                        }
                                }
                        }

Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl   2011-12-14 13:51:19 UTC (rev 
8292)
+++ trunk/property/templates/base/project.xsl   2011-12-14 15:28:31 UTC (rev 
8293)
@@ -572,6 +572,7 @@
                                                var base_java_url = 
<xsl:value-of select="base_java_url" />;
                                                var datatable = new Array();
                                                var myColumnDefs = new Array();
+                                               var myButtons = new Array();
 
                                                <xsl:for-each 
select="datatable">
                                                        datatable[<xsl:value-of 
select="name"/>] = [
@@ -588,8 +589,10 @@
                                                <xsl:for-each 
select="myColumnDefs">
                                                        
myColumnDefs[<xsl:value-of select="name"/>] = <xsl:value-of select="values"/>
                                                </xsl:for-each>
+                                               <xsl:for-each 
select="myButtons">
+                                                       myButtons[<xsl:value-of 
select="name"/>] = <xsl:value-of select="values"/>
+                                               </xsl:for-each>
                                        </script>
-
 </div>
 
 <xsl:choose>
@@ -607,9 +610,19 @@
                                                </a>
                                        </td>
                                        <td><table><tr><td>
-                                               <input size="5" type="text" id 
= "notify_contact" name="notify_contact" value="" 
title="{$lang_contact_statustext}">
+                                               <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>
@@ -621,6 +634,11 @@
                                                <div 
id="datatable-container_3"></div>
                                        </td>
                                </tr>
+                                               <tr>
+                                                       <td class="center" 
align="center" colspan="10">
+                                                               <div 
id="datatable-buttons_3"></div>
+                                                       </td>
+                                               </tr>
                                <tr>
                                        <td valign="top">
                                                <xsl:value-of 
select="lang_branch"/>




reply via email to

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