Re: linking clients to tickets

Bo Daley <[email protected]>
Newsgroups gmane.comp.horde.whups
Message-ID <[email protected]>
Quoting Chuck Hagenbuch <[email protected]>:

> > (in fact it might be worth removing the 'client' link stuff from
> registry.php
> > if this is going to replace that code).
>
> Done.

oops my bad -- the 'client' definition needs to stay in the registry so that the
Links api knows what to do. Attached is a patch that adds a new param ('show')
to the link definitions (determines whether or not to display the generic links
at the bottom of the page).

thanks,

bo.


-- 
Whups mailing list
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: [email protected]
links_registry.diff (text/diff, 3.6 KB)
Index: config/registry.php.dist
===================================================================
RCS file: /repository/horde/config/registry.php.dist,v
retrieving revision 1.167
diff -u -r1.167 registry.php.dist
--- config/registry.php.dist	30 Jul 2003 03:16:34 -0000	1.167
+++ config/registry.php.dist	31 Jul 2003 02:54:37 -0000
@@ -274,6 +274,17 @@
     'status' => 'active',
     'provides' => 'projects',
     'links' => array(
+        'client' => array(
+            'provider' => 'contacts',
+            'description' => _("Client"),
+            'show' => false,
+            'reverse' => array(
+                'description' => _("Client Ticket"),
+                'type' => 'task',
+                'readonly' => true,
+                'show' => false 
+                ),
+            ),
         'reseller' => array(
             'provider' => 'contacts',
             'description' => _("Reseller"),
Index: lib/Links.php
===================================================================
RCS file: /repository/horde/lib/Links.php,v
retrieving revision 1.17
diff -u -r1.17 Links.php
--- lib/Links.php	23 Jul 2003 21:28:23 -0000	1.17
+++ lib/Links.php	31 Jul 2003 02:54:37 -0000
@@ -81,6 +81,7 @@
                     $this->_link_definitions[$this->_from_application . '/' . $link_type]['description'] = gettext($description);
                     $this->_link_definitions[$this->_from_application . '/' . $link_type]['type'] = $link_type;
                     $this->_link_definitions[$this->_from_application . '/' . $link_type]['readonly'] = (isset($link_definition['readonly']) && $link_definition['readonly']);
+                    $this->_link_definitions[$this->_from_application . '/' . $link_type]['show'] = (isset($link_definition['show'])) ? $link_definition['show'] : true;
                 }
             } else {
                 $this->_link_definitions = array();
@@ -103,7 +104,8 @@
                                     'provider' => $reverse_provider,
                                     'description' => $reverse_description,
                                     'type' => $link_type,
-                                    'readonly' => (isset($link_definition['reverse']['readonly']) && $link_definition['reverse']['readonly']),
+                                    'readonly' => (isset($link_definition['reverse']['readonly']) && $link_definition['reverse']['readonly']), 
+                                    'show' => (isset($link_definition['reverse']['show']) ? $link_definition['reverse']['show'] : true),
                                 );
                             }
                         }
@@ -142,7 +144,7 @@
     {
         global $registry;
         $this->_getLinks($from_parameters);
-        $key = serialize($from_parameters);
+        $key = serialize($from_parameters); 
         return isset($this->_links[$key][$link_type]) ?
             $this->_links[$key][$link_type] :
             array();
@@ -164,9 +166,10 @@
 
         foreach ($this->_link_definitions as $link_type => $link_definition) {
             $app = $this->_link_definitions[$link_type]['provider'];
+            $show = $this->_link_definitions[$link_type]['show'];
 
-            if ($registry->hasMethod($app . '/addLink') ||
-                $registry->hasMethod($app . '/getLinkDescription')) {
+            if ($show && ($registry->hasMethod($app . '/addLink') ||
+                $registry->hasMethod($app . '/getLinkDescription'))) {
                 $type = $this->_link_definitions[$link_type]['type'];
                 $reverse = (substr($link_type, -8) == '/reverse') ? '/reverse' : '';
                 require $registry->getParam('templates', 'horde') . '/links/header.inc';
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.