gunnar: server/kolab-webadmin/admin/addressbook index.php,1.1,1.2
cvs at kolab.org
cvs at kolab.org
Tue Aug 21 19:15:54 CEST 2007
- Previous message: gunnar: server/php-kolab/Kolab_Webadmin/Webadmin config.class.php, NONE, 1.1 domainmaintainer.class.php, NONE, 1.1 group.class.php, NONE, 1.1 sharedfolder.class.php, NONE, 1.1 ldap.class.php, 1.4, 1.5 user.class.php, 1.2, 1.3 webadmin.class.php, 1.4, 1.5
- Next message: gunnar: server/kolab-webadmin/admin config.php,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: gunnar
Update of /kolabrepository/server/kolab-webadmin/admin/addressbook
In directory doto:/tmp/cvs-serv8206/addressbook
Modified Files:
index.php
Log Message:
Intermediate commit while restructuring the kolab-webadmin.
Index: index.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/admin/addressbook/index.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- index.php 17 Aug 2007 08:51:26 -0000 1.1
+++ index.php 21 Aug 2007 17:15:52 -0000 1.2
@@ -1,78 +1,60 @@
<?php
-/*
- (c) 2004 Klaraedalens Datakonsult AB
- (c) 2003 Tassilo Erlewein <tassilo.erlewein at erfrakon.de>
- (c) 2003 Martin Konold <martin.konold at erfrakon.de>
- This program is Free Software under the GNU General Public License (>=v2).
- Read the file COPYING that comes with this packages for details.
-*/
+/*
+ * 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$
+ *
+ * ABOUT
+ * -----
+ *
+ * Display a list of distribution lists.
+ *
+ */
-require_once('Kolab/Webadmin/mysmarty.php');
-require_once('Kolab/Webadmin/headers.php');
-require_once('Kolab/Webadmin/locale.php');
-require_once('Kolab/Webadmin/authenticate.php');
-require_once('Kolab/Webadmin/form.class.php');
+/** Our basic webadmin class. */
+require_once('Kolab/Webadmin/webadmin.class.php');
-$errors = array();
+/** Read our configuration. */
+require_once('../config.php');
-/**** Authentication etc. ***/
-$sidx = 'addressbook';
+/** Initialize page */
+$ADMIN = new KolabWebadmin($params);
+$ADMIN->setSection('addressbook');
-if( $auth->group() != 'maintainer' && $auth->group() != 'admin') {
- array_push($errors, _("Error: You don't have Permissions to access this Menu") );
+/** 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->getVisibleAddresses());
}
-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";
+$ADMIN->setContent('addrlistall.tpl');
+$ADMIN->render();
-// 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';
- $userfilter = "cn=*";
- $filterattr = KolabForm::getRequestVar('filterattr');
- $filtertype = KolabForm::getRequestVar('filtertype');
- $filtervalue = KolabForm::getRequestVar('filtervalue');
- if( !in_array( $filterattr, array( 'cn', 'mail' ) ) ) $filterattr = 'cn';
- if( isset( $filtervalue ) && !empty( $filtervalue ) ) {
- switch( $filtertype ) {
- case 'contains': // contains
- $userfilter = "$filterattr=*".$ldap->escape($filtervalue).'*';
- break;
- case 'is': // is
- $userfilter = "$filterattr=".$ldap->escape($filtervalue);
- break;
- case 'begins': // begins with
- $userfilter = "$filterattr=".$ldap->escape($filtervalue).'*';
- break;
- case 'ends': // ends with
- $userfilter = "$filterattr=*".$ldap->escape($filtervalue);
- break;
- }
- }
- $alphalimit = '';
- if( isset( $_REQUEST['alphalimit']) ) {
- $ala='sn'; // alpha limit attibute
- switch( $_REQUEST['alphalimit'] ) {
- case 'a': $alphalimit = "(|($ala=a*)($ala=b*)($ala=c*)($ala=d*)($ala=e*)($ala=f*))"; break;
- case 'g': $alphalimit = "(|($ala=g*)($ala=h*)($ala=i*)($ala=j*)($ala=k*)($ala=l*))"; break;
- case 'm': $alphalimit = "(|($ala=m*)($ala=n*)($ala=o*)($ala=p*)($ala=q*)($ala=r*))"; break;
- case 's': $alphalimit = "(|($ala=s*)($ala=t*)($ala=u*)($ala=v*)($ala=w*)($ala=x*)($ala=y*)($ala=z*))"; break;
- case 'other': $alphalimit = "(|($ala=æ*)($ala=ø*)($ala=å*)($ala=ä*)($ala=ö*)($ala=ü*)($ala=0*)($ala=1*)($ala=2*)($ala=3*)($ala=4*)($ala=5*)($ala=6*)($ala=7*)($ala=8*)($ala=9*))"; break;
- default: $alphalimit = '';
- }
- }
$filter = "(&($userfilter)$alphalimit(objectclass=inetOrgPerson)(!(uid=*))(sn=*))";
$result = ldap_search($ldap->connection, $base_dn, $filter);
if( $result ) {
@@ -112,36 +94,11 @@
}
-/**** Insert into template and output ***/
-$smarty =& new MySmarty();
-$smarty->assign( 'errors', $errors );
-$smarty->assign( 'uid', $auth->uid() );
-$smarty->assign( 'group', $auth->group() );
-$smarty->assign( 'page_title', $menuitems[$sidx]['title'] );
-$smarty->assign( 'self_url', $_SERVER['PHP_SELF'] );
-
-$smarty->assign( 'filterattrs', array( 'cn' => _('Name'),
- 'mail' => _('Email') ) );
-$smarty->assign( 'filtertypes', array( 'contains' => _('contains'),
- 'is' => _('is'),
- 'begins' => _('begins with'),
- 'ends' => _('ends with') ) );
-$smarty->assign( 'filterattr', $filterattr );
-$smarty->assign( 'filtertype', $filtertype );
-$smarty->assign( 'filtervalue', $filtervalue );
-
-$smarty->assign( 'entries', $entries );
-$smarty->assign( 'menuitems', $menuitems );
-$smarty->assign( 'submenuitems',
- array_key_exists('submenu',
- $menuitems[$sidx])?$menuitems[$sidx]['submenu']:array() );
-$smarty->assign( 'maincontent', $template );
-$smarty->display('page.tpl');
/*
Local variables:
mode: php
- indent-tabs-mode: t
+ indent-tabs-mode: f
tab-width: 4
buffer-file-coding-system: utf-8
End:
- Previous message: gunnar: server/php-kolab/Kolab_Webadmin/Webadmin config.class.php, NONE, 1.1 domainmaintainer.class.php, NONE, 1.1 group.class.php, NONE, 1.1 sharedfolder.class.php, NONE, 1.1 ldap.class.php, 1.4, 1.5 user.class.php, 1.2, 1.3 webadmin.class.php, 1.4, 1.5
- Next message: gunnar: server/kolab-webadmin/admin config.php,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the commits
mailing list