gunnar: server/kolab-webadmin/admin/domainmaintainer index.php, NONE, 1.1 index.php.in, 1.1, NONE

cvs at kolab.org cvs at kolab.org
Tue Aug 21 19:15:54 CEST 2007


Author: gunnar

Update of /kolabrepository/server/kolab-webadmin/admin/domainmaintainer
In directory doto:/tmp/cvs-serv8206/domainmaintainer

Added Files:
	index.php 
Removed Files:
	index.php.in 
Log Message:
Intermediate commit while restructuring the kolab-webadmin.

--- NEW FILE: index.php ---
<?php
/*  
 *  COPYRIGHT
 *  ---------
 *
 *  See ../AUTHORS file
 *
 *
 *  LICENSE
 *  -------
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *  $Revision: 1.1 $
 *
 *  ABOUT
 *  -----
 *
 *  Generate a list of domain maintainers.
 *
 */

/** Our basic webadmin class. */
require_once('Kolab/Webadmin/webadmin.class.php');

/** Read our configuration. */
require_once('../config.php');

/** Initialize page */
$ADMIN = new KolabWebadmin($params);
$ADMIN->setSection('domain-maintainer');

/** Access logic */
if(!$ADMIN->isMaintainer() && 
   !$ADMIN->isAdmin() ) {
	$ADMIN->assign('errors', 
				   array(_("Error: You don't have Permissions to access this Menu")));
} else {
	/** Extract data from LDAP */
	$ADMIN->assign('entries', $ADMIN->getVisisbleDomainMaintainers());
}

$ADMIN->setContent('domainmaintainerlistall.tpl');
$ADMIN->render();


require_once('Kolab/Webadmin/menu.php');

/**** Submenu for current page ***/
$menuitems[$sidx]['selected'] = 'selected';

/**** Extract data from LDAP ***/

// read selector for register display
if (isset($HTTP_GET_VARS['alphaselect'])) $alphaselect = $HTTP_GET_VARS['alphaselect'];
else $alphaselect = "[A-F]";
if (isset($HTTP_GET_VARS['page'])) $page = $HTTP_GET_VARS['page'];
else $page = "1";

// Get all entries & dynamically split the letters with growing entries
if( !$errors ) {
  if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
  else $base_dn = 'k=kolab';

  $maintainers = $ldap->groupMembers( "cn=internal,$base_dn", 'domain-maintainer' );

  $filter = "(&(cn=*)(objectclass=kolabInetOrgPerson)(!(uid=manager))(sn=*))";
  $result = ldap_search($ldap->connection, $base_dn, $filter, array( 'uid', 'sn', 'cn', 'kolabDeleteflag' ));

  if( $result ) {
	$title = _('Manage Maintainers (').count($maintainers)._(' Maintainers)');
	// if there are more than 2000 entries, split in 26 categories for every letter,
	// or if more than 50, put in groups, or else just show all.
	if (false && $count > 2000) {
	  // ... TODO
	  $template = 'maintainerlistalpha.tpl';
	} else if( false && $count > 50 ) {
	  // ... TODO
	  $template = 'maintainerlistgroup.tpl';
	}  else {
	  $template = 'domainmaintainerlistall.tpl';
	  $starttime = getmicrotime();
	  ldap_sort($ldap->connection,$result,'sn');
	  $endtime = getmicrotime();
	  //print "sorting took ".($endtime-$starttime)."<br/>";
	  $entry = ldap_first_entry($ldap->connection, $result);
	  while( $entry ) {
		$attrs = ldap_get_attributes($ldap->connection, $entry);
		$dn = ldap_get_dn($ldap->connection,$entry);
		$deleted = array_key_exists('kolabDeleteflag',$attrs)?$attrs['kolabDeleteflag'][0]:"FALSE";
        $userid = $attrs['uid'][0];
        $sn = $attrs['sn'][0];
        $cn = $attrs['cn'][0];
        $a = strlen($sn);
        $b = strlen($cn);
        $fn = substr($cn, 0, $b - $a);
		// skip admins and maintainers
		if( array_key_exists( $dn, $maintainers ) ) {
		  $domains = $ldap->domainsForMaintainerDn($dn);
		  $entries[] = array( 'dn' => $dn,
							  'sn' => $sn,
							  'fn' => $fn,
							  'uid' => $userid,
							  'domains' => join(' ', $domains),
							  'deleted' => $deleted );
		}
		$entry = ldap_next_entry( $ldap->connection,$entry );
	  }
	}
  }
}

/*
  Local variables:
  mode: php
  indent-tabs-mode: f
  tab-width: 4
  buffer-file-coding-system: utf-8
  End:
 */
?>

--- index.php.in DELETED ---





More information about the commits mailing list