steffen: server/kolab-webadmin/kolab-webadmin/www/admin/user user.php, 1.51, 1.52

cvs at intevation.de cvs at intevation.de
Thu Feb 24 03:11:45 CET 2005


Author: steffen

Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user
In directory doto:/tmp/cvs-serv1202/kolab-webadmin/www/admin/user

Modified Files:
	user.php 
Log Message:
keep html form element names close to ldap attribute names

Index: user.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/user.php,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- user.php	23 Feb 2005 22:17:59 -0000	1.51
+++ user.php	24 Feb 2005 02:11:43 -0000	1.52
@@ -172,23 +172,23 @@
 
 function fill_form_for_modify( &$form, $dn, &$ldap_object ) {
   global $auth;
-  if (is_array($ldap_object['sn'])) $lastname = $ldap_object['sn'][0];
-  else $lastname = $ldap_object['sn'];
+  if (is_array($ldap_object['sn'])) $sn = $ldap_object['sn'][0];
+  else $sn = $ldap_object['sn'];
   if (is_array($ldap_object['cn'])) $cn = $ldap_object['cn'][0];
   else $cn = $ldap_object['cn'];
-  if ($lastname) {
-    $a = strlen($lastname);
+  if ($sn) {
+    $a = strlen($sn);
     if ($cn) {
       $b = strlen($cn);
-      $firstname = substr($cn, 0, $b - $a);
+      $givenname = substr($cn, 0, $b - $a);
     }
   }
   if (is_array($ldap_object['mail'])) $mail = $ldap_object['mail'][0];
   else $mail = $ldap_object['mail'];
   if (is_array($ldap_object['uid'])) $uid = $ldap_object['uid'][0];
   else $uid = $ldap_object['uid'];
-  $form->entries['firstname']['value'] = $firstname;
-  $form->entries['lastname']['value'] = $lastname;
+  $form->entries['givenname']['value'] = $givenname;
+  $form->entries['sn']['value'] = $sn;
   $form->entries['password_0']['value'] = '';
   $form->entries['password_1']['value'] = '';
   $form->entries['mail']['value'] = $mail;
@@ -231,7 +231,7 @@
 	$policies[$user] = $pol;
   }
   if( !isset( $policies['anyone'] ) ) $policies['anyone'] = 4 /*ACT_MANUAL*/;
-  $form->entries['resourceaction']['policies'] = $policies;  
+  $form->entries['kolabinvitationpolicy']['policies'] = $policies;  
 
   foreach( array( 'title', 'o', 'ou', 'roomNumber', 'street', 
 				  'postOfficeBox', 'postalCode', 'l', 'c', 
@@ -331,10 +331,10 @@
   $comment_kolabhomeserver = _('Non volatile');
 }
 
-$entries = array( 'firstname' => array( 'name' => _('First Name'),
+$entries = array( 'givenname' => array( 'name' => _('First Name'),
 					'validation' => 'notempty',
 					'comment' => _('Required') ),
-		  'lastname' => array( 'name' => _('Last Name'),
+		  'sn' => array( 'name' => _('Last Name'),
 				       'validation' => 'notempty',
 				       'comment' => _('Required') ),
 		  'password_0' => array( 'name' => _('Password'),
@@ -360,7 +360,7 @@
 							   'options' => array( _('User Account'), _('Internal User Account'), _('Group Account'), _('Resource Account') ),
 							   'value'   => 0,
 							   'comment' => _('NOTE: An internal user is a user that will not be visible in the address book')),
-		  'resourceaction' => array( 'name' => _('Invitation Policy'),
+		  'kolabinvitationpolicy' => array( 'name' => _('Invitation Policy'),
 									 'type' => 'resourcepolicy',
 									 'policies' => array('anyone' => 4),
 									 'validation' => 'checkpolicy',
@@ -389,10 +389,10 @@
   $entries['cyrus-userquota'] = array( 'name' => _('User Quota in MBytes'),
 				 'comment' => _('Leave blank for unlimited') );
 } else {
-  $entries['firstname']['attrs'] = 'readonly';
-  $entries['lastname']['attrs'] = 'readonly';
-  $entries['firstname']['comment'] = '';
-  $entries['lastname']['comment'] = '';
+  $entries['givenname']['attrs'] = 'readonly';
+  $entries['sn']['attrs'] = 'readonly';
+  $entries['givenname']['comment'] = '';
+  $entries['sn']['comment'] = '';
   $entries['alias']['attrs'] = 'readonly';
   $entries['kolabhomeserver']['attrs'] = 'readonly';
   $entries['accttype']['attrs'] = 'readonly';
@@ -427,9 +427,9 @@
      } else {
        $ldap_object = array();
        $ldap_object['objectClass'] = array('top', 'inetOrgPerson','kolabInetOrgPerson');
-       $ldap_object['sn'] = trim($_POST['lastname']);
-       $ldap_object['cn'] = trim($_POST['firstname']).' '.$ldap_object['sn'];
-	   $ldap_object['givenName'] = trim($_POST['firstname']);
+       $ldap_object['sn'] = trim($_POST['sn']);
+       $ldap_object['cn'] = trim($_POST['givenname']).' '.$ldap_object['sn'];
+	   $ldap_object['givenName'] = trim($_POST['givenname']);
        if( !empty( $_POST['password_0'] ) ) {
 		 $ldap_object['userPassword'] = '{sha}'.base64_encode( pack('H*', 
 																	sha1( $_POST['password_0'])));
@@ -486,9 +486,9 @@
 		 // Handle group/resource policies
 		 $i = 0;
 		 $ldap_object['kolabInvitationPolicy'] = array();
-		 while( isset( $_POST['user_resourceaction_'.$i] ) ) {
-		   $user = $_POST['user_resourceaction_'.$i];
-		   $pol  = (int)$_POST['policy_resourceaction_'.$i];
+		 while( isset( $_POST['user_kolabinvitationpolicy_'.$i] ) ) {
+		   $user = $_POST['user_kolabinvitationpolicy_'.$i];
+		   $pol  = (int)$_POST['policy_kolabinvitationpolicy_'.$i];
 		   debug("Looking at $user:$pol");
 		   $i++;
 		   if( !empty($user) && 0 <= $pol && $pol < 5  ) {





More information about the commits mailing list