gunnar: server/php-kolab/Kolab_Webadmin/Webadmin address.class.php, 1.4, 1.5 administrator.class.php, 1.4, 1.5 db.php, 1.3, 1.4 domainmaintainer.class.php, 1.5, 1.6 ldap.class.php, 1.12, 1.13 locale.php, 1.6, 1.7 maintainer.class.php, 1.4, 1.5 object.php, 1.4, 1.5 sharedfolder.class.php, 1.5, 1.6 user.class.php, 1.8, 1.9 webadmin.class.php, 1.11, 1.12

cvs at kolab.org cvs at kolab.org
Tue Sep 18 08:08:50 CEST 2007


Author: gunnar

Update of /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin
In directory doto:/tmp/cvs-serv14078

Modified Files:
	address.class.php administrator.class.php db.php 
	domainmaintainer.class.php ldap.class.php locale.php 
	maintainer.class.php object.php sharedfolder.class.php 
	user.class.php webadmin.class.php 
Log Message:
Draft definitions for all list views.

Index: address.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/address.class.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- address.class.php	22 Aug 2007 13:25:00 -0000	1.4
+++ address.class.php	18 Sep 2007 06:08:48 -0000	1.5
@@ -87,6 +87,49 @@
 
 };
 
+class KolabAddressListView extends KolabObjectListView {
+
+    /**
+     * Return a list title for this type of object
+     *
+     * @return 
+     */
+    function getTitle()
+    {
+        return _("Global addressbook");
+    }
+
+    /**
+     * Return a list note for this type of object
+     *
+     * @return 
+     */
+    function getNote()
+    {
+        return _("only external addresses without a kolab user account");
+    }
+
+
+    /**
+     * Return an array of table header entries for this type of object
+     *
+     * @return array The header entries
+     */
+    function _getHeader()
+    {
+        return array(_("Name"));
+    }
+    
+    /**
+     * Return an array of table row entries for this type of object
+     *
+     * @return array The row entries
+     */
+    function _getRow()
+    {
+        return array($this->_object->getName());
+    }
+}
 /*
   Local variables:
   mode: php

Index: administrator.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/administrator.class.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- administrator.class.php	22 Aug 2007 13:25:00 -0000	1.4
+++ administrator.class.php	18 Sep 2007 06:08:48 -0000	1.5
@@ -93,6 +93,39 @@
     );
 };
 
+class KolabAdministratorListView extends KolabObjectListView {
+
+    /**
+     * Return a list title for this type of object
+     *
+     * @return string The title
+     */
+    function getTitle()
+    {
+        return _("Administrators");
+    }
+
+    /**
+     * Return an array of table header entries for this type of object
+     *
+     * @return array The header entries
+     */
+    function _getHeader()
+    {
+        return array(_("Name"), _("UID"));
+    }
+    
+    /**
+     * Return an array of table row entries for this type of object
+     *
+     * @return array The row entries
+     */
+    function _getRow()
+    {
+        return array($this->_object->getName(),
+					 $this->_object->getUid());
+    }
+}
 /*
   Local variables:
   mode: php

Index: db.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/db.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- db.php	22 Aug 2007 17:33:23 -0000	1.3
+++ db.php	18 Sep 2007 06:08:48 -0000	1.4
@@ -41,15 +41,6 @@
 require_once 'Kolab/Webadmin/sharedfolder.class.php';
 require_once 'Kolab/Webadmin/user.class.php';
 
-/** Define the different Kolab object types */
-define('KOLAB_OBJECT_ADDRESS',          'Address');
-define('KOLAB_OBJECT_ADMINISTRATOR',    'Administrator');
-define('KOLAB_OBJECT_DOMAINMAINTAINER', 'DomainMaintainer');
-define('KOLAB_OBJECT_GROUP',            'Group');
-define('KOLAB_OBJECT_MAINTAINER',       'Maintainer');
-define('KOLAB_OBJECT_SHAREDFOLDER',     'SharedFolder');
-define('KOLAB_OBJECT_USER',             'User');
-
 /**
  * This class provides methods to deal with Kolab objects stored in
  * the LDAP db.

Index: domainmaintainer.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/domainmaintainer.class.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- domainmaintainer.class.php	22 Aug 2007 13:25:00 -0000	1.5
+++ domainmaintainer.class.php	18 Sep 2007 06:08:48 -0000	1.6
@@ -179,6 +179,40 @@
     }
 }
 
+class KolabDomainMaintainerListView extends KolabObjectListView {
+
+    /**
+     * Return a list title for this type of object
+     *
+     * @return 
+     */
+    function getTitle()
+    {
+        return _("Domain maintainers");
+    }
+
+    /**
+     * Return an array of table header entries for this type of object
+     *
+     * @return array The header entries
+     */
+    function _getHeader()
+    {
+        return array(_("Name"), _("UID"), _("Domains"));
+    }
+    
+    /**
+     * Return an array of table row entries for this type of object
+     *
+     * @return array The row entries
+     */
+    function _getRow()
+    {
+        return array($this->_object->getName(),
+					 $this->_object->getUid(),
+					 join(' ', $this->_object->getDomains()));
+    }
+}
 /*
   Local variables:
   mode: php

Index: ldap.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/ldap.class.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13

Index: locale.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/locale.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7

Index: maintainer.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/maintainer.class.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- maintainer.class.php	22 Aug 2007 13:25:00 -0000	1.4
+++ maintainer.class.php	18 Sep 2007 06:08:48 -0000	1.5
@@ -94,6 +94,39 @@
 
 };
 
+class KolabMaintainerListView extends KolabObjectListView {
+
+    /**
+     * Return a list title for this type of object
+     *
+     * @return 
+     */
+    function getTitle()
+    {
+        return _("Maintainers");
+    }
+
+    /**
+     * Return an array of table header entries for this type of object
+     *
+     * @return array The header entries
+     */
+    function _getHeader()
+    {
+        return array(_("Name"), _("UID"));
+    }
+    
+    /**
+     * Return an array of table row entries for this type of object
+     *
+     * @return array The row entries
+     */
+    function _getRow()
+    {
+        return array($this->_object->getName(),
+					 $this->_object->getUid());
+    }
+}
 /*
   Local variables:
   mode: php

Index: object.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/object.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- object.php	17 Sep 2007 18:01:22 -0000	1.4
+++ object.php	18 Sep 2007 06:08:48 -0000	1.5
@@ -40,6 +40,15 @@
 define('KOLAB_ATTR_UID',     'uid');
 define('KOLAB_ATTR_DELETED', 'kolabDeleteFlag');
 
+/** Define the different Kolab object types */
+define('KOLAB_OBJECT_ADDRESS',          'Address');
+define('KOLAB_OBJECT_ADMINISTRATOR',    'Administrator');
+define('KOLAB_OBJECT_DOMAINMAINTAINER', 'DomainMaintainer');
+define('KOLAB_OBJECT_GROUP',            'Group');
+define('KOLAB_OBJECT_MAINTAINER',       'Maintainer');
+define('KOLAB_OBJECT_SHAREDFOLDER',     'SharedFolder');
+define('KOLAB_OBJECT_USER',             'User');
+
 /**
  * This class provides general methods to deal with Kolab objects.
  *
@@ -65,6 +74,13 @@
     var $_dn;
 
     /**
+     * Type of this object (one of KOLAB_OBJECT_*)
+     *
+     * @var string
+     */
+    var $type;
+
+    /**
      * The cached LDAP result
      *
      * @var mixed
@@ -202,14 +218,13 @@
         }
         $sn = '';
         if (isset($this->_cache[KOLAB_ATTR_SN])) {
-            $sn = $this->_cache[KOLAB_ATTR_SN];
+            $sn = $this->_cache[KOLAB_ATTR_SN][0];
         }
         $cn = '';
         if (isset($this->_cache[KOLAB_ATTR_CN])) {
-            $cn = $this->_cache[KOLAB_ATTR_CN];
+            $cn = $this->_cache[KOLAB_ATTR_CN][0];
         }
-		var_dump(array($sn, $cn));
-		
+        
         return $this->_ldap->getFirstName($sn, $cn);
     }
     
@@ -291,7 +306,9 @@
      */
     function getListView()
     {
-        return PEAR::raiseError(_("Not implemented!"));
+        $class = get_class($this) . 'ListView';
+        $renderer = &new $class($this);
+        return $renderer;
     }
     
 };
@@ -306,9 +323,7 @@
     var $_object;
 
     /**
-     * Return a list header for this type of object
-     *
-     * @return 
+     * Constructor
      */
     function KolabObjectListView($object)
     {
@@ -318,7 +333,7 @@
     /**
      * Return a list title for this type of object
      *
-     * @return 
+     * @return string The title
      */
     function getTitle()
     {
@@ -326,21 +341,82 @@
     }
 
     /**
+     * Return a list note for this type of object
+     *
+     * @return string The note
+     */
+    function getNote()
+    {
+        return PEAR::raiseError(_("Not implemented!"));
+    }
+
+    /**
      * Return a list header for this type of object
      *
-     * @return 
+     * @return string The HTML header line
      */
     function getHeader()
     {
+        $header = '';
+        foreach ($this->_getHeader() as $column) {
+            $header .= '<th>' . $column . '</th>';
+        }
+        $header .= '<th colspan="2">' . _("Action") . '</th>';
+        return $header;
+    }
+
+    /**
+     * Return an array of table header entries for this type of object
+     *
+     * @return array The header entries
+     */
+    function _getHeader()
+    {
         return PEAR::raiseError(_("Not implemented!"));
     }
     
     /**
-     * Return a list entry for this object
+     * Return a list row for this object
      *
-     * @return 
+     * @return string The HTML line
      */
     function getRow()
+    {
+        $row = '';
+        foreach ($this->_getRow() as $column) {
+            $row .= '<td class="contentcell">' . htmlspecialchars($column) . '</td>';
+        }
+        $row .= $this->getAction();
+        return $row;
+    }
+    
+    /**
+     * Return the action cell(s)
+     *
+     * @return string The HTML cell(s)
+     */
+    function getAction()
+    {
+        if ($this->_object->getDeleted()) {
+            return '<td class="actioncell" colspan="2">' 
+                . _(sprintf("%s deleted, awaiting cleanup...", 
+                            $this->_object->type)) . '</td>';
+        } else {
+            return '<td class="actioncell" align="center"><a href="edit.php?type='
+                . $this->_object->type . '&action=modify&dn=' 
+                . urlencode($this->_object->getDn()) . '">' . _("Modify") . '</a></td>' .
+                '<td class="actioncell" align="center"><a href="delete.php?type=' 
+                . $this->_object->type . '&action=delete&dn=' 
+                . urlencode($this->_object->getDn()) . '">' . _("Delete") . '</a></td>';
+        }
+    }
+
+    /**
+     * Return an array of table row entries for this type of object
+     *
+     * @return array The row entries
+     */
+    function _getRow()
     {
         return PEAR::raiseError(_("Not implemented!"));
     }

Index: sharedfolder.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/sharedfolder.class.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- sharedfolder.class.php	22 Aug 2007 13:25:00 -0000	1.5
+++ sharedfolder.class.php	18 Sep 2007 06:08:48 -0000	1.6
@@ -116,8 +116,43 @@
     {
         return $this->_doDeleteObject($dn, $delete_now, false);
     }
-  }
+}
 
+class KolabSharedFolderListView extends KolabObjectListView {
+
+    /**
+     * Return a list title for this type of object
+     *
+     * @return 
+     */
+    function getTitle()
+    {
+        return _("Shared folders");
+    }
+
+    /**
+     * Return an array of table header entries for this type of object
+     *
+     * @return array The header entries
+     */
+    function _getHeader()
+    {
+        return array(_("Name"), _("Server"), _("Type"));
+    }
+    
+    /**
+     * Return an array of table row entries for this type of object
+     *
+     * @return array The row entries
+     */
+    function _getRow()
+    {
+        return array($this->_object->getName(),
+					 $this->_object->getServer(),
+					 $this->_object->getType());
+    }
+    
+}
 
 /*
   Local variables:

Index: user.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/user.class.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- user.class.php	17 Sep 2007 18:01:22 -0000	1.8
+++ user.class.php	18 Sep 2007 06:08:48 -0000	1.9
@@ -230,19 +230,6 @@
         return $this->getSn() . ', ' . $this->getFn();
     }
     
-    
-
-    /**
-     * Return a list view renderer for users
-     *
-     * @return 
-     */
-    function getListView()
-    {
-		$renderer = &new KolabUserListView($this);
-        return $renderer;
-    }
-    
 };
 
 class KolabUserListView extends KolabObjectListView {
@@ -258,18 +245,13 @@
     }
 
     /**
-     * Return a list header for this type of object
+     * Return an array of table header entries for this type of object
      *
-     * @return 
+     * @return array The header entries
      */
-    function getHeader()
+    function _getHeader()
     {
-        $type = '<th>' . _("Type") . '</th>';
-        $name = '<th>' . _("Name") . '</th>';
-        $mail = '<th>' . _("E-mail") . '</th>';
-        $uid = '<th>' . _("uid") . '</th>';
-        $action = '<th colspan="2">' . _("Action") . '</th>';
-        return $type . $name . $mail . $uid . $action;
+        return array( _("Type"), _("Name"), _("E-mail"), _("UID"));
     }
     
     /**
@@ -279,27 +261,22 @@
      */
     function getRow()
     {
+		$row = '';
         if ($this->_object->getType() == 'U') {
-            $type = '<td class="contentcell" title="' . _("User Account") . '" align="center">U</td>';
+            $row .= '<td class="contentcell" title="' . _("User Account") . '" align="center">U</td>';
         } elseif ($this->_object->getType() == 'G') {
-            $type = '<td class="contentcell" title="' . _("Group Account") . '" align="center">G</td>';
+            $row .= '<td class="contentcell" title="' . _("Group Account") . '" align="center">G</td>';
         } elseif ($this->_object->getType() == 'R') {
-            $type = '<td class="contentcell" title="' . _("Resource Account") . '" align="center">R</td>';
-        } else {
-            $type = '<td class="contentcell" title="' . _("Unknown Account Type") . '" align="center">?</td>';
-        }
-        $name = '<td class="contentcell">' . htmlspecialchars($this->_object->getName()) . '</td>';
-        $email = htmlspecialchars($this->_object->getMail());
-        $mail = '<td class="contentcell"><a href="mailto:' . $email . '">' . $email . '</a></td>';
-        $uid = '<td class="contentcell">' . htmlspecialchars($this->_object->getUid()) . '</td>';
-        
-        if ($this->_object->getDeleted()) {
-            $action = '<td class="actioncell" colspan="2">' . _("User Deleted, awaiting cleanup...") . '</td>';
+            $row .= '<td class="contentcell" title="' . _("Resource Account") . '" align="center">R</td>';
         } else {
-            $action = '<td class="actioncell" align="center"><a href="user.php?action=modify&dn=' . urlencode($this->_object->getDn()) . '">' . _("Modify") . '</a></td>' .
-                '<td class="actioncell" align="center"><a href="user.php?action=delete&dn=' . urlencode($this->_object->getDn()) . '">' . _("Delete") . '</a></td>';
+            $row .= '<td class="contentcell" title="' . _("Unknown Account Type") . '" align="center">?</td>';
         }
-        return $type . $name . $mail . $uid . $action;
+        $row .= '<td class="contentcell">' . htmlspecialchars($this->_object->getName()) . '</td>';
+        $mail = htmlspecialchars($this->_object->getMail());
+        $row .= '<td class="contentcell"><a href="mailto:' . $email . '">' . $mail . '</a></td>';
+        $row .= '<td class="contentcell">' . htmlspecialchars($this->_object->getUid()) . '</td>';
+		$row .= $this->getAction();
+        return $row;
     }
     
 

Index: webadmin.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/webadmin.class.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12





More information about the commits mailing list