Filter links list by application

Hi,

I am looking for a solution, to filter the links list by application.
With eTemplate module, I am working on a addressbook personalization, and would like to add on the first tab, a list of links to other addressbook records.
Is there a simple way to show only addressbook links ? Or should I work on egroupware code in addressbook classes ?

Thanks in advance for your suggestions !

jies

Hi,

I am looking for a solution, to filter the links list by application.
With eTemplate module, I am working on a addressbook personalization, and
would like to add on the first tab, a list of links to other addressbook
records.
Is there a simple way to show only addressbook links ? Or should I work on
egroupware code in addressbook classes ?

eTemplate link-string widget knows a only_app parameter, for that purpose:

http://svn.stylite.de/viewvc/egroupware/trunk/etemplate/inc/class.link_widget.inc.php?view=markup

It can NOT just be set in a template, it has to be set in code as a
variable passed to the template.

Ralf

Thanks in advance for your suggestions !

jies

–
Ralf Becker
Director Software Development

Stylite GmbH
[open style of IT]

Morschheimer Strasse 15
67292 Kirchheimbolanden

fon +49 (0) 6352 70629-0
fax +49 (0) 6352 70629-30
mailto: rb@stylite.de

www.stylite.de
www.egroupware.org


Geschäftsführer Andre Keller,
Gudrun Müller, Ralf Becker
Registergericht Kaiserslautern HRB 30575
Umsatzsteuer-Id / VAT-Id: DE214280951


Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev


eGroupWare-developers mailing list
eGroupWare-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-developers

Thanks Ralf for your advice, I had a look to class.link_widget.inc.php and noticed that on line 277 the method egw_link::get_links (inside case ‘link-list’) had no only_app parameter defined.

I managed to use this parameter by catching the variable $value[‘only_app’] defined in my class.addressbook_ui.inc.php, but as soon as I use it, I get this error :

Fatal error: Cannot create references to/from string offsets nor overloaded objects in 
..../egroupware/etemplate/inc/class.boetemplate.inc.php on line 618

If I set my only_app parameter to anything but an application name, eg: test, it’s working, and result an empty list as test application doesn’t exist…

Here is a diff to show you what I have now :

@@ -264,6 +264,7 @@
 		case 'link-list':
 			$app = $value['to_app'];
 			$id  = isset($extension_data['to_id']) ? $extension_data['to_id'] : $value['to_id'];
+			$onlyapp = $value['only_app'];
 			if ($this->debug)
 			{
 				echo "<p>link-list-widget[$name].preprocess: value="; _debug_array($value);
@@ -272,7 +273,7 @@
 			{
 				$value['title'] = egw_link::title($app,$id);
 			}
-			$links = egw_link::get_links($app,$id,'','link_lastmod DESC',true);
+			$links = egw_link::get_links($app,$id,$onlyapp,'link_lastmod DESC',true);
 			$value['anz_links'] = count($links);
 			$extension_data = $value;

This should work, as the parameter was not used before.

I have set DEBUG constant to true in class.egw_link.inc.php, to be able to watch methods and parameters, and I can see that my only_app is used.
I can show you to be more explicit, the differences in both cases :
1 - When I use ‘test’ as only_app :

egw_link::title('addressbook','65003')='contact name' (from cache)

egw_link::get_links(app='addressbook',id='65003',only_app='test',order='link_lastmod DESC')

egw_link::title('addressbook','65003')='contact name linked' (from cache)

egw_link::get_links(app='addressbook',id='65003',only_app='test',order='link_lastmod DESC')

Then everything is showing without a problem.

2 - When I use ‘addressbook’ as only_app : (or any other existing applications)

egw_link::title('addressbook','65003')='contact name' (from cache)

egw_link::get_links(app='addressbook',id='65003',only_app='addressbook',order='link_lastmod DESC')

egw_link::titles(9,9)

egw_link::title('9','9')='Array' (from cache)

Fatal error: Cannot create references to/from string offsets nor overloaded objects in 
..../egroupware/etemplate/inc/class.boetemplate.inc.php on line 618

If any idea of what is going on, I am interested. Otherwise I am carrying on my research…

Thanks

jies

Hi,

your change in link_widget to support only_app for link-list is straight
forward and easy to add.

What version are you using, as line 618 in boetemplate is in Trunk or
1.8 sources a phpDoc function header?

Many error with newer PHP versions, like the one you run into are fixed
in current EGroupware versions. You should consider developing with at
least the stable release, better with current Trunk.

Ralf

Thanks Ralf for your advice, I had a look to class.link_widget.inc.php and
noticed that on line 277 the method egw_link::get_links (inside case
’link-list’) had no only_app parameter defined.

I managed to use this parameter by catching the variable $value[‘only_app’]
defined in my class.addressbook_ui.inc.php, but as soon as I use it, I get
this error :
Fatal error: Cannot create references to/from string offsets nor overloaded
objects in
…/egroupware/etemplate/inc/class.boetemplate.inc.php on line 618

If I set my only_app parameter to anything but an application name, eg:
test, it’s working, and result an empty list as test application doesn’t
exist…

Here is a diff to show you what I have now :

@@ -264,6 +264,7 @@
case ‘link-list’:
$app = $value[‘to_app’];
$id = isset($extension_data[‘to_id’]) ? $extension_data[‘to_id’] :
$value[‘to_id’];

  • 	$onlyapp = $value['only_app'];
    		if ($this->debug)
    		{
    			echo "<p>link-list-widget[$name].preprocess: value=";
    

_debug_array($value);
@@ -272,7 +273,7 @@
{
$value[‘title’] = egw_link::title($app,$id);
}

  • 	$links = egw_link::get_links($app,$id,'','link_lastmod DESC',true);
    
  • 	$links = egw_link::get_links($app,$id,$onlyapp,'link_lastmod
    

DESC’,true);
$value[‘anz_links’] = count($links);
$extension_data = $value;

This should work, as the parameter was not used before.

I have set DEBUG constant to true in class.egw_link.inc.php, to be able to
watch methods and parameters, and I can see that my only_app is used.
I can show you to be more explicit, the differences in both cases :
1 - When I use ‘test’ as only_app :
egw_link::title(‘addressbook’,‘65003’)=‘contact name’ (from cache)

egw_link::get_links(app=‘addressbook’,id=‘65003’,only_app=‘test’,order=‘link_lastmod
DESC’)

egw_link::title(‘addressbook’,‘65003’)=‘contact name linked’ (from cache)

egw_link::get_links(app=‘addressbook’,id=‘65003’,only_app=‘test’,order=‘link_lastmod
DESC’)

Then everything is showing without a problem.

2 - When I use ‘addressbook’ as only_app : (or any other existing
applications)

egw_link::title(‘addressbook’,‘65003’)=‘contact name’ (from cache)

egw_link::get_links(app=‘addressbook’,id=‘65003’,only_app=‘addressbook’,order=‘link_lastmod
DESC’)

egw_link::titles(9,9)

egw_link::title(‘9’,‘9’)=‘Array’ (from cache)

Fatal error: Cannot create references to/from string offsets nor overloaded
objects in
…/egroupware/etemplate/inc/class.boetemplate.inc.php on line 618

If any idea of what is going on, I am interested. Otherwise I am carrying on
my research…

Thanks

jies

–
Ralf Becker
Director Software Development

Stylite GmbH
[open style of IT]

Morschheimer Strasse 15
67292 Kirchheimbolanden

fon +49 (0) 6352 70629-0
fax +49 (0) 6352 70629-30
mailto: rb@stylite.de

www.stylite.de
www.egroupware.org


Geschäftsführer Andre Keller,
Gudrun Müller, Ralf Becker
Registergericht Kaiserslautern HRB 30575
Umsatzsteuer-Id / VAT-Id: DE214280951


Achieve Improved Network Security with IP and DNS Reputation.
Defend against bad network traffic, including botnets, malware,
phishing sites, and compromised hosts - saving your company time,
money, and embarrassment. Learn More!
http://p.sf.net/sfu/hpdev2dev-nov


eGroupWare-developers mailing list
eGroupWare-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-developers