gunnar: server/kolab-webadmin/admin/sharedfolder 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/sharedfolder
In directory doto:/tmp/cvs-serv8206/sharedfolder

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 shared folders.
 *
 */

/** 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('sf');

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

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

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

function prepare_domain_filter_component($str) {
  return '(cn=*@'.KolabLDAP::escape($str).')';
}

// Get all entries & dynamically split the letters with growing entries
$entries = array();
if( !$errors ) {
  if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
  else $base_dn = 'k=kolab';
  if( $group == 'domain-maintainer' ) {
	$domainfilter = '(|'.join('', array_map( 'prepare_domain_filter_component', 
											 $ldap->domainsForMaintainerDn($auth->dn()))).')';
	
  } else {
	$domainfilter = '(cn=*)';
  }
  debug("domainfilter=$domainfilter");
  $filter = "(&$domainfilter(objectclass=kolabSharedFolder))";
  $result = ldap_search($ldap->connection, $base_dn, $filter);
  if( $result ) {
	$count = ldap_count_entries($ldap->connection, $result);
	$title = sprintf(_("Manage Shared Folders (%d Folders)"), $count);
	$template = 'sflistall.tpl';
	ldap_sort($ldap->connection,$result,'cn');
	$entry = ldap_first_entry($ldap->connection, $result);
	while( $entry ) {
	  $attrs = ldap_get_attributes($ldap->connection, $entry);
	  $dn = ldap_get_dn($ldap->connection,$entry);
	  $cn = $attrs['cn'][0];
	  $deleted = array_key_exists('kolabDeleteflag',$attrs)?$attrs['kolabDeleteflag'][0]:"FALSE";
	  $kolabhomeserver = $attrs['kolabHomeServer'][0];
	  
	  $folderTypeMap = array ( '' => _('Unspecified'), 'mail' => _('Mails'), 'task' => _('Tasks'), 'journal' => _('Journals'),
							   'event' => _('Events'), 'contact' => _('Contacts'), 'note' => _('Notes'));
	  if( in_array('kolabFolderType',$attrs) ) $folderType = $folderTypeMap[$attrs['kolabFolderType'][0]];
	  else $folderType = $folderTypeMap[''];

	  $entries[] = array( 'dn' => $dn,
						  'cn' => $cn,
						  'kolabhomeserver' => $kolabhomeserver,
			    			  'deleted' => $deleted,
						  'foldertype' => $folderType );
	  $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