fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9684] property : uicommon


From: Sigurd Nes
Subject: [Fmsystem-commits] [9684] property : uicommon
Date: Wed, 27 Jun 2012 14:19:12 +0000

Revision: 9684
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9684
Author:   sigurdne
Date:     2012-06-27 14:19:11 +0000 (Wed, 27 Jun 2012)
Log Message:
-----------
property : uicommon

Modified Paths:
--------------
    trunk/phpgwapi/js/yahoo/common.js
    trunk/phpgwapi/js/yahoo/datatable.js
    trunk/phpgwapi/templates/base/datatable_common.xsl
    trunk/property/inc/class.bogeneric.inc.php
    trunk/property/inc/class.uigeneric.inc.php
    trunk/property/inc/class.uigeneric_test.inc.php

Modified: trunk/phpgwapi/js/yahoo/common.js
===================================================================
--- trunk/phpgwapi/js/yahoo/common.js   2012-06-27 13:02:14 UTC (rev 9683)
+++ trunk/phpgwapi/js/yahoo/common.js   2012-06-27 14:19:11 UTC (rev 9684)
@@ -775,3 +775,150 @@
        });
 
 })();
+
+       YAHOO.portico.html_entity_decode = function(string)
+       {
+               var histogram = {}, histogram_r = {}, code = 0;
+               var entity = chr = '';
+
+               histogram['34'] = 'quot';
+               histogram['38'] = 'amp';
+               histogram['60'] = 'lt';
+               histogram['62'] = 'gt';
+               histogram['160'] = 'nbsp';
+               histogram['161'] = 'iexcl';
+               histogram['162'] = 'cent';
+               histogram['163'] = 'pound';
+               histogram['164'] = 'curren';
+               histogram['165'] = 'yen';
+               histogram['166'] = 'brvbar';
+               histogram['167'] = 'sect';
+               histogram['168'] = 'uml';
+               histogram['169'] = 'copy';
+               histogram['170'] = 'ordf';
+               histogram['171'] = 'laquo';
+               histogram['172'] = 'not';
+               histogram['173'] = 'shy';
+               histogram['174'] = 'reg';
+               histogram['175'] = 'macr';
+               histogram['176'] = 'deg';
+               histogram['177'] = 'plusmn';
+               histogram['178'] = 'sup2';
+               histogram['179'] = 'sup3';
+               histogram['180'] = 'acute';
+               histogram['181'] = 'micro';
+               histogram['182'] = 'para';
+               histogram['183'] = 'middot';
+               histogram['184'] = 'cedil';
+               histogram['185'] = 'sup1';
+               histogram['186'] = 'ordm';
+               histogram['187'] = 'raquo';
+               histogram['188'] = 'frac14';
+               histogram['189'] = 'frac12';
+               histogram['190'] = 'frac34';
+               histogram['191'] = 'iquest';
+               histogram['192'] = 'Agrave';
+               histogram['193'] = 'Aacute';
+               histogram['194'] = 'Acirc';
+               histogram['195'] = 'Atilde';
+               histogram['196'] = 'Auml';
+               histogram['197'] = 'Aring';
+               histogram['198'] = 'AElig';
+               histogram['199'] = 'Ccedil';
+               histogram['200'] = 'Egrave';
+               histogram['201'] = 'Eacute';
+               histogram['202'] = 'Ecirc';
+               histogram['203'] = 'Euml';
+               histogram['204'] = 'Igrave';
+               histogram['205'] = 'Iacute';
+               histogram['206'] = 'Icirc';
+               histogram['207'] = 'Iuml';
+               histogram['208'] = 'ETH';
+               histogram['209'] = 'Ntilde';
+               histogram['210'] = 'Ograve';
+               histogram['211'] = 'Oacute';
+               histogram['212'] = 'Ocirc';
+               histogram['213'] = 'Otilde';
+               histogram['214'] = 'Ouml';
+               histogram['215'] = 'times';
+               histogram['216'] = 'Oslash';
+               histogram['217'] = 'Ugrave';
+               histogram['218'] = 'Uacute';
+               histogram['219'] = 'Ucirc';
+               histogram['220'] = 'Uuml';
+               histogram['221'] = 'Yacute';
+               histogram['222'] = 'THORN';
+               histogram['223'] = 'szlig';
+               histogram['224'] = 'agrave';
+               histogram['225'] = 'aacute';
+               histogram['226'] = 'acirc';
+               histogram['227'] = 'atilde';
+               histogram['228'] = 'auml';
+               histogram['229'] = 'aring';
+               histogram['230'] = 'aelig';
+               histogram['231'] = 'ccedil';
+               histogram['232'] = 'egrave';
+               histogram['233'] = 'eacute';
+               histogram['234'] = 'ecirc';
+               histogram['235'] = 'euml';
+               histogram['236'] = 'igrave';
+               histogram['237'] = 'iacute';
+               histogram['238'] = 'icirc';
+               histogram['239'] = 'iuml';
+               histogram['240'] = 'eth';
+               histogram['241'] = 'ntilde';
+               histogram['242'] = 'ograve';
+               histogram['243'] = 'oacute';
+               histogram['244'] = 'ocirc';
+               histogram['245'] = 'otilde';
+               histogram['246'] = 'ouml';
+               histogram['247'] = 'divide';
+               histogram['248'] = 'oslash';
+               histogram['249'] = 'ugrave';
+               histogram['250'] = 'uacute';
+               histogram['251'] = 'ucirc';
+               histogram['252'] = 'uuml';
+               histogram['253'] = 'yacute';
+               histogram['254'] = 'thorn';
+               histogram['255'] = 'yuml';
+
+               // Reverse table. Cause for maintainability purposes, the 
histogram is
+               // identical to the one in htmlentities.
+               for (code in histogram) {
+                       entity = histogram[code];
+                       histogram_r[entity] = code;
+               }
+
+               return (string+'').replace(/(\&([a-zA-Z]+)\;)/g, function(full, 
m1, m2){
+                       if (m2 in histogram_r) {
+                               return String.fromCharCode(histogram_r[m2]);
+                       } else {
+                               return m2;
+                       }
+               });
+}
+
+
+       YAHOO.portico.substr_count =  function ( haystack, needle, offset, 
length )
+       {
+               var pos = 0, cnt = 0;
+
+               haystack += '';
+               needle += '';
+               if(isNaN(offset)) offset = 0;
+               if(isNaN(length)) length = 0;
+               offset--;
+
+               while( (offset = haystack.indexOf(needle, offset+1)) != -1 )
+               {
+                       if(length > 0 && (offset+needle.length) > length)
+                       {
+                               return false;
+                       } else
+                       {
+                               cnt++;
+                       }
+               }
+               return cnt;
+       }
+

Modified: trunk/phpgwapi/js/yahoo/datatable.js
===================================================================
--- trunk/phpgwapi/js/yahoo/datatable.js        2012-06-27 13:02:14 UTC (rev 
9683)
+++ trunk/phpgwapi/js/yahoo/datatable.js        2012-06-27 14:19:11 UTC (rev 
9684)
@@ -98,12 +98,149 @@
     };
     myDataTable.sortColumn = handleSorting;
 
-       /* from Property*/
+       /* Start from Property*/
+
+  
/********************************************************************************
+ *
+ */
+       var onContextMenuBeforeShow = function(p_sType, p_aArgs)
+       {
+               var prefixSelected = '';
+               var oTarget = this.contextEventTarget;
+               if (this.getRoot() == this)
+               {
+                       if(oTarget.tagName != "TD")
+                       {
+                               oTarget = 
YAHOO.util.Dom.getAncestorByTagName(oTarget, "td");
+                       }
+                       oSelectedTR = 
YAHOO.util.Dom.getAncestorByTagName(oTarget, "tr");
+                       oSelectedTR.style.backgroundColor  = '#AAC1D8' ;
+                       oSelectedTR.style.color = "black";
+                       YAHOO.util.Dom.addClass(oSelectedTR, prefixSelected);
+               }
+       }
+
+
+ 
/********************************************************************************
+ *
+ */
+       var onContextMenuHide = function(p_sType, p_aArgs)
+       {
+               var prefixSelected = '';
+               if (this.getRoot() == this && oSelectedTR)
+               {
+                       oSelectedTR.style.backgroundColor  = "" ;
+                       oSelectedTR.style.color = "";
+                       YAHOO.util.Dom.removeClass(oSelectedTR, prefixSelected);
+               }
+       }
+ 
/********************************************************************************
+ *
+ */
+       var onContextMenuClick = function(p_sType, p_aArgs, p_myDataTable)
+       {
+               var task = p_aArgs[1];
+                       if(task)
+                       {
+                               // Extract which TR element triggered the 
context menu
+                               var elRow = 
p_myDataTable.getTrEl(this.contextEventTarget);
+                               if(elRow)
+                               {
+                                       var oRecord = 
p_myDataTable.getRecord(elRow);
+                                       var url = 
YAHOO.portico.actions[task.groupIndex].action;
+                                       var sUrl = "";
+                                       var vars2 = "";
+
+                                       
if(YAHOO.portico.actions[task.groupIndex].parameters!=null)
+                                       {
+                                               for(f=0; 
f<YAHOO.portico.actions[task.groupIndex].parameters.parameter.length; f++)
+                                               {
+                                                       param_name = 
YAHOO.portico.actions[task.groupIndex].parameters.parameter[f].name;
+                                                       param_source = 
YAHOO.portico.actions[task.groupIndex].parameters.parameter[f].source;
+                                                       vars2 = vars2 + 
"&"+param_name+"=" + oRecord.getData(param_source);
+                                               }
+                                               sUrl = url + vars2;
+                                       }
+                                       
if(YAHOO.portico.actions[task.groupIndex].parameters.parameter.length > 0)
+                                       {
+                                               //nothing
+                                       }
+                                       else //for New
+                                       {
+                                               sUrl = url;
+                                       }
+                                       //Convert all HTML entities to their 
applicable characters
+
+                                       
sUrl=YAHOO.portico.html_entity_decode(sUrl);
+
+                                       // look for the word "DELETE" in URL
+                                       
if(YAHOO.portico.substr_count(sUrl,'delete')>0)
+                                       {
+                                               confirm_msg = 
YAHOO.portico.actions[task.groupIndex].confirm_msg;
+                                               if(confirm(confirm_msg))
+                                               {
+                                                       sUrl = sUrl + 
"&confirm=yes&phpgw_return_as=json";
+                                                       delete_record(sUrl);
+                                               }
+                                       }
+                                       else
+                                       {
+                                               
if(YAHOO.portico.substr_count(sUrl,'target=_blank')>0)
+                                               {
+                                                       
window.open(sUrl,'_blank');
+                                               }
+                                               else 
if(YAHOO.portico.substr_count(sUrl,'target=_lightbox')>0)
+                                               {
+                                                       //have to be defined as 
a local function. Example in invoice.list_sub.js
+                                                       //console.log(sUrl); // 
firebug
+                                                       showlightbox(sUrl);
+                                               }
+                                               else 
if(YAHOO.portico.substr_count(sUrl,'target=_tinybox')>0)
+                                               {
+                                                       //have to be defined as 
a local function. Example in invoice.list_sub.js
+                                                       //console.log(sUrl); // 
firebug
+                                                       showtinybox(sUrl);
+                                               }
+                                               else
+                                               {
+                                                       
window.open(sUrl,'_self');
+                                               }
+                                       }
+                               }
+                       }
+       };
+ 
/********************************************************************************
+ *
+ */
+       var GetMenuContext = function()
+       {
+               var opts = new Array();
+               var p=0;
+               for(var k =0; k < YAHOO.portico.actions.length; k ++)
+               {
+                       if(YAHOO.portico.actions[k].my_name != 'add')
+                       {       opts[p]=[{text: YAHOO.portico.actions[k].text}];
+                               p++;
+                       }
+               }
+               return opts;
+   }
+
+
        myDataTable.subscribe("rowMouseoverEvent", 
myDataTable.onEventHighlightRow);
-       /* from Property*/
+
        myDataTable.subscribe("rowMouseoutEvent", 
myDataTable.onEventUnhighlightRow);
 
+       myContextMenu = new YAHOO.widget.ContextMenu("mycontextmenu", 
{trigger:myDataTable.getTbodyEl()});
+       myContextMenu.addItems(GetMenuContext());
 
+       myContextMenu.subscribe("beforeShow", onContextMenuBeforeShow);
+       myContextMenu.subscribe("hide", onContextMenuHide);
+       //Render the ContextMenu instance to the parent container of the 
DataTable
+       myContextMenu.subscribe("click", onContextMenuClick, myDataTable);
+       myContextMenu.render("datatable-container");
+
+
        for(var i=0; i < YAHOO.portico.columnDefs.length;i++)
        {
                if( YAHOO.portico.columnDefs[i].sortable )
@@ -114,6 +251,7 @@
 //             YAHOO.util.Dom.getElementsByClassName( 'yui-dt-resizerliner', 
'div' )[0].style.textAlign = 'center';
        }
 
+       /* End from Property*/
 
     var handlePagination = function(state) {
         var sortedBy  = this.get("sortedBy");
@@ -122,6 +260,7 @@
      };
     pag.unsubscribe("changeRequest", myDataTable.onPaginatorChangeRequest);
     pag.subscribe("changeRequest", handlePagination, myDataTable, true);
+
     myDataTable.doBeforeLoadData = function(oRequest, oResponse, oPayload) {
         oPayload.totalRecords = oResponse.meta.totalResultsAvailable;
                oPayload.pagination = { 
@@ -185,11 +324,52 @@
        
        var initialRequest = History.getBookmarkedState("state") || getState();
        History.register("state", initialRequest, handleHistoryNavigation);
+/*
        History.onReady(function() {
                var state = YAHOO.util.History.getCurrentState('state');
                handleHistoryNavigation(state);
        });
+
+*/
        History.initialize("yui-history-field", "yui-history-iframe");
+
+
 };
 
+
+       onDownloadClick = function()
+       {
+               var state = YAHOO.util.History.getCurrentState('state');
+alert(state);
+               //store actual values
+               actuall_funct = path_values.menuaction;
+
+               if(config_values.particular_download)
+               {
+                       path_values.menuaction = 
config_values.particular_download;
+               }
+               else
+               {
+                       donwload_func = path_values.menuaction;
+                       // modify actual function for "download" in path_values
+                       // for example: property.uilocation.index --> 
property.uilocation.download
+                       tmp_array= donwload_func.split(".")
+                       tmp_array[2]="download"; //set function DOWNLOAD
+                       donwload_func = tmp_array.join('.');
+                       path_values.menuaction=donwload_func;
+               }
+
+               ds_download = phpGWLink('index.php',path_values);
+               //show all records since the first
+               ds_download+="&allrows=1&start=0";
+               //return to "function index"
+               path_values.menuaction=actuall_funct;
+               window.open(ds_download,'window');
+   }
+
+
+
+
 YAHOO.util.Event.addListener(window, "load", 
YAHOO.portico.initializeDataTable);
+
+

Modified: trunk/phpgwapi/templates/base/datatable_common.xsl
===================================================================
--- trunk/phpgwapi/templates/base/datatable_common.xsl  2012-06-27 13:02:14 UTC 
(rev 9683)
+++ trunk/phpgwapi/templates/base/datatable_common.xsl  2012-06-27 14:19:11 UTC 
(rev 9684)
@@ -229,6 +229,15 @@
                                        </xsl:if>
                </xsl:if>
 
+                       <xsl:choose>
+                               <xsl:when test="//datatable/actions">
+                               YAHOO.portico.actions = <xsl:value-of 
select="//datatable/actions"/>;
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       YAHOO.portico.actions = [];
+                               </xsl:otherwise>
+                       </xsl:choose>
+
                        YAHOO.portico.columnDefs = [
                                <xsl:for-each select="//datatable/field">
                                        {

Modified: trunk/property/inc/class.bogeneric.inc.php
===================================================================
--- trunk/property/inc/class.bogeneric.inc.php  2012-06-27 13:02:14 UTC (rev 
9683)
+++ trunk/property/inc/class.bogeneric.inc.php  2012-06-27 14:19:11 UTC (rev 
9684)
@@ -42,8 +42,8 @@
                var $cat_id;
                var $location_info = array();
                var $appname;
+               var $allrows;
 
-
                function __construct($session=false)
                {
                        $this->so                       = 
CreateObject('property.sogeneric');

Modified: trunk/property/inc/class.uigeneric.inc.php
===================================================================
--- trunk/property/inc/class.uigeneric.inc.php  2012-06-27 13:02:14 UTC (rev 
9683)
+++ trunk/property/inc/class.uigeneric.inc.php  2012-06-27 14:19:11 UTC (rev 
9684)
@@ -3,7 +3,7 @@
        * phpGroupWare - property: a Facilities Management System.
        *
        * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free 
Software Foundation, Inc. http://www.fsf.org/
+       * @copyright Copyright (C) 
2003,2004,2005,2006,2007,2008,2009,2010,2011,2012 Free Software Foundation, 
Inc. http://www.fsf.org/
        * This file is part of phpGroupWare.
        *
        * phpGroupWare is free software; you can redistribute it and/or modify

Modified: trunk/property/inc/class.uigeneric_test.inc.php
===================================================================
--- trunk/property/inc/class.uigeneric_test.inc.php     2012-06-27 13:02:14 UTC 
(rev 9683)
+++ trunk/property/inc/class.uigeneric_test.inc.php     2012-06-27 14:19:11 UTC 
(rev 9684)
@@ -109,6 +109,7 @@
 
                function download()
                {
+                       $this->bo->allrows = true;
                        $list = $this->bo->read();
                        $uicols = $this->bo->uicols;
                        
$this->bocommon->download($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
@@ -192,71 +193,9 @@
                        $GLOBALS['phpgw_info']['apps']['manual']['section'] = 
"general.index.{$this->type}";
 
 
-                       $data = array(
-                               'js_lang'       =>js_lang('edit', 'add'),
-                               'form' => array
-                               (
-                                       'toolbar' => array
-                                       (
-                                               'item' => array
-                                               (
-                                                       array
-                                                       (
-                                                               'type' => 
'text', 
-                                'text' => lang('searchfield'),
-                                                               'name' => 
'query'
-                                                       ),
-                                                       array
-                                                       (
-                                                               'type' => 
'submit',
-                                                               'name' => 
'search',
-                                                               'value' => 
lang('Search')
-                                                       ),
-                                                       array
-                                                       (
-                                                               'type' => 
'link',
-                                                               'value' => 
lang('add'),
-                                                               'href' => 
self::link(array('menuaction' => 'property.uigeneric.edit',
-                                                                               
                'appname'               => $this->appname,
-                                                                               
                'type'                  => $this->type,
-                                                                               
                'type_id'               => $this->type_id))
-                                                       ),
-                                                       array
-                                                       (
-                                                               'type' => 
'link',
-                                                               'value' => 
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
-                                                               'href' => 
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_showall'))
-                                                       //      'href' => 
self::link(array('menuaction' => 'registration.uipending.index2', 
'phpgw_return_as' => 'json', 'all'))
-                                                       ),
-                                                       array
-                                                       (
-                                                               'type' => 
'link',
-                                                               'value' => 
lang('download'),
-                                                               'href' => 
"javascript:alert('download')"
-                                                       ),
-                                               ),
-                                       ),
-                               ),
-                       );
+                       $item = array();
 
 
-                       
if($GLOBALS['phpgw']->locations->get_attrib_table($this->location_info['acl_app'],
 $this->location_info['acl_location']))
-                       {
-                               $data['form']['toolbar']['item'][] =  array
-                                       (
-                                               'type'=> 'link',
-                                               'href' => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
-                                               array
-                                               (
-                                                       'menuaction' => 
'property.uigeneric.columns',
-                                                       'appname'               
=> $this->appname,
-                                                       'type'                  
=> $this->type,
-                                                       'type_id'               
=> $this->type_id
-                                               )
-                                       )."','','width=350,height=370')",
-                                       'value' => lang('columns'),
-                               );
-                       }
 
                        foreach ( $this->location_info['fields'] as $field )
                        {
@@ -291,18 +230,83 @@
                                        $default_value = array 
('id'=>'','name'=> lang('select') . ' ' . $field['descr']);
                                        array_unshift ($list, $default_value);
 
-                                       $data['form']['toolbar']['item'][] = 
array
-                                               (
-                                                       'type'  => 'filter',
-                                                       'name'  => 
$field['name'],
-                                                       'text'  => 
$field['descr'],
-                                                       'list'  => $list
-                                               );
-
+                                       $item[] = array
+                                       (
+                                               'type'  => 'filter',
+                                               'name'  => $field['name'],
+                                               'text'  => $field['descr'],
+                                               'list'  => $list
+                                       );
                                }
                        }
 
 
+
+                       $item[] = array
+                               (
+                                       'type' => 'text', 
+                                       'text' => lang('searchfield'),
+                                       'name' => 'query'
+                               );
+                       $item[] = array
+                               (
+                                       'type' => 'submit',
+                                       'name' => 'search',
+                                       'value' => lang('Search')
+                               );
+                       $item[] = array
+                               (
+                                       'type' => 'link',
+                                       'value' => lang('add'),
+                                       'href' => self::link(array('menuaction' 
=> 'property.uigeneric.edit',
+                                                               'appname'       
        => $this->appname,
+                                                               'type'          
        => $this->type,
+                                                               'type_id'       
        => $this->type_id))
+                               );
+                       $item[] = array
+                               (
+                                       'type' => 'link',
+                                       'value' => $_SESSION['showall'] ? 
lang('Show only active') : lang('Show all'),
+                                       'href' => self::link(array('menuaction' 
=> $this->url_prefix.'.toggle_show_showall'))
+                               //      'href' => self::link(array('menuaction' 
=> 'registration.uipending.index2', 'phpgw_return_as' => 'json', 'all'))
+                               );
+                       $item[] = array
+                               (
+                                       'type' => 'link',
+                                       'value' => lang('download'),
+                                       'href' => 'javascript:onDownloadClick()'
+                               );
+
+                       
if($GLOBALS['phpgw']->locations->get_attrib_table($this->location_info['acl_app'],
 $this->location_info['acl_location']))
+                       {
+                               $item[] =  array
+                                       (
+                                               'type'=> 'button',
+                                               'onClick' => 
"javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                               array
+                                               (
+                                                       'menuaction' => 
'property.uigeneric.columns',
+                                                       'appname'               
=> $this->appname,
+                                                       'type'                  
=> $this->type,
+                                                       'type_id'               
=> $this->type_id
+                                               )
+                                       )."','','width=350,height=370')",
+                                       'value' => lang('columns'),
+                               );
+                       }
+
+
+                       $data = array(
+                               'js_lang'       =>js_lang('edit', 'add'),
+                               'form' => array
+                               (
+                                       'toolbar' => array
+                                       (
+                                               'item' => $item
+                                       ),
+                               ),
+                       );
+
                        $data['datatable']['source'] = 
self::link(array('menuaction'    => 'property.uigeneric_test.index',
                                                'appname'                       
=> $this->appname,
                                                'type'                          
=> $this->type,
@@ -319,91 +323,7 @@
                        $uicols = $this->bo->uicols;
 
 
-                       $data['rowactions']['action'] = array();
 
-                       $parameters = array
-                               (
-                                       'parameter' => array
-                                       (
-                                               array
-                                               (
-                                                       'name'          => 
$this->location_info['id']['name'],
-                                                       'source'        =>  
$this->location_info['id']['name']
-                                               ),
-                                       )
-                               );
-
-                       if($this->acl_edit)
-                       {
-                               $data['rowactions']['action'][] = array
-                                       (
-                                               'my_name'               => 
'edit',
-                                               'statustext'    => lang('edit 
the entry'),
-                                               'text'                  => 
lang('edit'),
-                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
-                                               (
-                                                       'menuaction'            
=> isset($this->location_info['edit_action']) &&  
$this->location_info['edit_action'] ?  $this->location_info['edit_action'] : 
'property.uigeneric.edit',
-                                                       'appname'               
        => $this->appname,
-                                                       'type'                  
        => $this->type,
-                                                       'type_id'               
        => $this->type_id
-                                               )),
-                                               'parameters'    => $parameters
-                                       );
-                               $data['rowactions']['action'][] = array
-                                       (
-                                               'my_name'               => 
'edit',
-                                               'text'                  => 
lang('open edit in new window'),
-                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
-                                               (
-                                                       'menuaction'            
=> isset($this->location_info['edit_action']) &&  
$this->location_info['edit_action'] ?  $this->location_info['edit_action'] : 
'property.uigeneric.edit',
-                                                       'appname'               
=> $this->appname,
-                                                       'type'                  
        => $this->type,
-                                                       'type_id'               
        => $this->type_id,
-                                                       'target'                
        => '_blank'
-                                               )),
-                                               'parameters'    => $parameters
-                                       );
-                       }
-
-                       if($this->acl_delete)
-                       {
-                               $data['rowactions']['action'][] = array
-                                       (
-                                               'my_name'               => 
'delete',
-                                               'statustext'    => lang('delete 
the entry'),
-                                               'text'                  => 
lang('delete'),
-                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
-                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
-                                               (
-                                                       'menuaction'    => 
'property.uigeneric.delete',
-                                                       'appname'               
=> $this->appname,
-                                                       'type'                  
=> $this->type,
-                                                       'type_id'               
=> $this->type_id
-                                               )),
-                                               'parameters'    => $parameters
-                                       );
-                       }
-                       unset($parameters);
-
-                       if($this->acl_add)
-                       {
-                               $data['rowactions']['action'][] = array
-                                       (
-                                               'my_name'                       
=> 'add',
-                                               'statustext'    => lang('add'),
-                                               'text'                  => 
lang('add'),
-                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
-                                               (
-                                                       'menuaction'    => 
isset($this->location_info['edit_action']) &&  
$this->location_info['edit_action'] ?  $this->location_info['edit_action'] : 
'property.uigeneric.edit',
-                                                       'appname'               
=> $this->appname,
-                                                       'type'                  
=> $this->type,
-                                                       'type_id'               
=> $this->type_id
-                                               ))
-                                       );
-                       }
-
-
-
                        $count_uicols_name = count($uicols['name']);
                        for ($i=0;$i<$count_uicols_name;$i++)
                        {
@@ -426,6 +346,7 @@
                                'hidden' => true
                        );
 
+                       $data['datatable']['actions'] = $this->get_actions();
 
                        $appname                        =  
$this->location_info['name'];
                        $function_msg           = lang('list %1', $appname);
@@ -504,14 +425,6 @@
                                }
                        }
 
-                       // right in datatable
-                       if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
-                       {
-                               $json['rights'] = 
$datatable['rowactions']['action'];
-                       }
-
-
-
                        
                        // Pagination and sort values
 
@@ -542,6 +455,96 @@
 
                }
 
+               protected function get_actions()
+               {
+
+                       $action = array();
+
+                       $parameters = array
+                               (
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 
$this->location_info['id']['name'],
+                                                       'source'        =>  
$this->location_info['id']['name']
+                                               ),
+                                       )
+                               );
+
+                       if($this->acl_edit)
+                       {
+                               $action[] = array
+                                       (
+                                               'my_name'               => 
'edit',
+                                               'statustext'    => lang('edit 
the entry'),
+                                               'text'                  => 
lang('edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'            
=> isset($this->location_info['edit_action']) &&  
$this->location_info['edit_action'] ?  $this->location_info['edit_action'] : 
'property.uigeneric.edit',
+                                                       'appname'               
        => $this->appname,
+                                                       'type'                  
        => $this->type,
+                                                       'type_id'               
        => $this->type_id
+                                               )),
+                                               'parameters'    => $parameters
+                                       );
+                               $action[] = array
+                                       (
+                                               'my_name'               => 
'edit',
+                                               'text'                  => 
lang('open edit in new window'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'            
=> isset($this->location_info['edit_action']) &&  
$this->location_info['edit_action'] ?  $this->location_info['edit_action'] : 
'property.uigeneric.edit',
+                                                       'appname'               
=> $this->appname,
+                                                       'type'                  
        => $this->type,
+                                                       'type_id'               
        => $this->type_id,
+                                                       'target'                
        => '_blank'
+                                               )),
+                                               'parameters'    => $parameters
+                                       );
+                       }
+
+                       if($this->acl_delete)
+                       {
+                               $action[] = array
+                                       (
+                                               'my_name'               => 
'delete',
+                                               'statustext'    => lang('delete 
the entry'),
+                                               'text'                  => 
lang('delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
'property.uigeneric.delete',
+                                                       'appname'               
=> $this->appname,
+                                                       'type'                  
=> $this->type,
+                                                       'type_id'               
=> $this->type_id
+                                               )),
+                                               'parameters'    => $parameters
+                                       );
+                       }
+                       unset($parameters);
+
+                       if($this->acl_add)
+                       {
+                               $action[] = array
+                                       (
+                                               'my_name'                       
=> 'add',
+                                               'statustext'    => lang('add'),
+                                               'text'                  => 
lang('add'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
isset($this->location_info['edit_action']) &&  
$this->location_info['edit_action'] ?  $this->location_info['edit_action'] : 
'property.uigeneric.edit',
+                                                       'appname'               
=> $this->appname,
+                                                       'type'                  
=> $this->type,
+                                                       'type_id'               
=> $this->type_id
+                                               ))
+                                       );
+                       }
+
+                       return json_encode($action);
+               }
+
+
                function edit()
                {
                        if(!$this->acl_add)




reply via email to

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