[vilma] driver dependent stuff

Vilius Šumskas vilius at lnk.lt
Wed Apr 14 00:00:54 PDT 2004


Hi,

this stuff is driver dependent, so it should be in sql.php

P.S. This is preparations for my new cyrsql.php driver.

--
   Best Regards,

   Vilius Šumskas
   LNK TV system administrator
   mob.: +370 614 75713
   www.lnk.lt
-------------- next part --------------
Index: index.php
===================================================================
RCS file: /repository/vilma/domains/index.php,v
retrieving revision 1.9
diff -u -r1.9 index.php
--- index.php	3 Mar 2004 12:35:49 -0000	1.9
+++ index.php	14 Apr 2004 06:55:20 -0000
@@ -24,17 +24,9 @@
     $notification->push($domains, 'horde.error');
     $domains = array();
 }
-foreach ($domains as $id => $domain) {
-    $url = Horde::applicationUrl('domains/edit.php');
-    $domains[$id]['edit_url'] = Util::addParameter($url, 'domain_id', $domain['domain_id']);
-    $url = Horde::applicationUrl('domains/delete.php');
-    $domains[$id]['del_url'] = Util::addParameter($url, 'domain_id', $domain['domain_id']);
-    $url = Horde::applicationUrl('users/index.php');
-    $domains[$id]['view_url'] = Util::addParameter($url, 'domain_id', $domain['domain_id']);
-}
 
 /* Set up the template fields. */
-$template->set('domains', $domains, true);
+$template->set('domains', $vilma->listDomains($domains), true);
 $template->set('menu', $menu->getMenu());
 $template->set('notify', Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')));
 
-------------- next part --------------
Index: sql.php
===================================================================
RCS file: /repository/vilma/lib/Driver/sql.php,v
retrieving revision 1.12
diff -u -r1.12 sql.php
--- sql.php	9 Feb 2004 16:16:06 -0000	1.12
+++ sql.php	14 Apr 2004 06:53:00 -0000
@@ -218,6 +218,26 @@
     }
 
     /**
+     * Generates array of the domains ready for template input.
+     *
+     * @param array $domains  The domain list to process.
+     *
+     * @return array  Pe on success or PEAR error otherwise.
+     */
+    function listDomains($domains)
+    {
+        foreach ($domains as $id => $domain) {
+            $url = Horde::applicationUrl('domains/edit.php');
+            $domains[$id]['edit_url'] = Util::addParameter($url, 'domain_id', $domain['domain_id']);
+            $url = Horde::applicationUrl('domains/delete.php');
+            $domains[$id]['del_url'] = Util::addParameter($url, 'domain_id', $domain['domain_id']);
+            $url = Horde::applicationUrl('users/index.php');
+            $domains[$id]['view_url'] = Util::addParameter($url, 'domain_id', $domain['domain_id']);
+        }
+        return $domains;
+    }
+
+    /**
      * Saves a domain to the backend.
      *
      * @param array $info  The domain information to save to the backend.


More information about the vilma mailing list