steffen: server/kolab-webadmin/kolab-webadmin/php/admin/include form.class.php, 1.17, 1.18 ldap.class.php, 1.23, 1.24
cvs at intevation.de
cvs at intevation.de
Thu Jun 16 02:32:12 CEST 2005
Author: steffen
Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include
In directory doto:/tmp/cvs-serv21018/kolab-webadmin/php/admin/include
Modified Files:
form.class.php ldap.class.php
Log Message:
verification bugs (Issue804) and form elements readonly looknfeel (Issue797)
Index: form.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/form.class.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- form.class.php 10 Mar 2005 21:58:19 -0000 1.17
+++ form.class.php 16 Jun 2005 00:32:10 -0000 1.18
@@ -67,16 +67,20 @@
if( !isset( $value['value'] ) ) $value['value'] = '';
switch( $value['type'] ) {
case 'hidden': continue;
+ case 'password':
+ if( ereg( 'readonly', $value['attrs'] ) ) {
+ // If readonly, skip it -- passwords are at most write-only
+ break;
+ }
case '':
// Default is text
$value['type'] = 'text';
case 'input':
case 'text':
- case 'password':
$str .= '<tr>';
$str .= '<td>'.$value['name'].'</td>';
if( ereg( 'readonly', $value['attrs'] ) ) {
- $str .= '<td>'.$value['value'].'<input name="'.$key.'" type="hidden" value="'.$value['value'].'" /></td>';
+ $str .= '<td><p class="ctrl">'.$value['value'].'</p><input name="'.$key.'" type="hidden" value="'.$value['value'].'" /></td>';
} else {
$str .= '<td><input name="'.$key.'" type="'.$value['type'].'" value="'.$value['value'].'" '.$value['attrs'].' size="'.$size.'" /></td>';
}
@@ -94,7 +98,7 @@
$str .= '<tr>';
$str .= '<td>'.$value['name'].'</td>';
if( ereg( 'readonly', $value['attrs'] ) ) {
- $str .= '<td><p>'.htmlentities($value['value']).'</p></td>';
+ $str .= '<td><p class="ctrl">'.htmlentities($value['value']).'</p></td>';
} else {
$str .= '<td><textarea name="'.$key.'" rows="5" cols="'.$size.'" '.$value['attrs'].' onkeypress="javascript:textareakeypress()">'.$value['value'].'</textarea></td>';
}
@@ -104,7 +108,11 @@
case 'checkbox':
$str .= '<tr>';
$str .= '<td>'.$value['name'].'</td>';
- $str .= '<td><input name="'.$key.'" type="'.$value['type'].'" value="on" '.($value['value']?'checked':'').' '.$value['attrs'].' /></td>';
+ if( ereg( 'readonly', $value['attrs'] ) ) {
+ $str .= '<td><span class="ctrl">'.($value['value']?_('Yes'):_('No')).'</span></td>';
+ } else {
+ $str .= '<td><input name="'.$key.'" type="'.$value['type'].'" value="on" '.($value['value']?'checked':'').' '.$value['attrs'].' /></td>';
+ }
$str .= '<td>'.$value['comment'].'</td>';
$str .= '</tr>'."\n";
break;
@@ -112,7 +120,7 @@
$str .= '<tr>';
$str .= '<td>'.$value['name'].'</td>';
if( ereg( 'readonly', $value['attrs'] ) ) {
- $str .= '<td><p>'.htmlentities($value['options'][$value['value']]).
+ $str .= '<td><p class="ctrl">'.htmlentities($value['options'][$value['value']]).
'<input type="hidden" name="'.$key.'" value="'.$value['value'].'" /></p></td>';
} else {
$str .= '<td><select name="'.$key.'" '.$value['attrs'].' >'."\n";
@@ -131,31 +139,36 @@
case 'aclselect': // Special Kolab entry for ACLs
$str .= '<tr>';
$str .= '<td>'.$value['name'].'</td>';
- $str .= '<td><input name="user_'.$key.'" type="'.$value['type'].'" size="'.($size-15).'" value="'.$value['user'].'" '.$value['attrs'].' />';
- $str .= '<select name="perm_'.$key.'">'."\n";
- if( $value['perm'] ) $selected_perm = $value['perm'];
- else $selected_perm = 'all';
- foreach( array( 'none',
- 'post',
- 'read', 'read/post',
- 'append',
- 'write',
- 'read anon',
- 'read anon/post',
- 'read hidden',
- 'read hidden/post',
- 'all' ) as $perm ) {
- if( $perm == $selected_perm ) $s = 'selected';
- else $s = '';
- $str .= '<option value="'.$perm.'"'.$s.' >'.$perm.'</option>'."\n";
+ if( ereg( 'readonly', $value['attrs'] ) ) {
+ if( $value['user'] ) $str .= '<td><span class="ctrl">'.htmlentities($value['user']).'</span> <span class="ctrl">'.$value['perm'].'</span></td>';
+ } else {
+ $str .= '<td><input name="user_'.$key.'" type="'.$value['type'].'" size="'.($size-15).'" value="'.$value['user'].'" '.$value['attrs'].' />';
+ $str .= '<select name="perm_'.$key.'">'."\n";
+ if( $value['perm'] ) $selected_perm = $value['perm'];
+ else $selected_perm = 'all';
+ foreach( array( 'none',
+ 'post',
+ 'read', 'read/post',
+ 'append',
+ 'write',
+ 'read anon',
+ 'read anon/post',
+ 'read hidden',
+ 'read hidden/post',
+ 'all' ) as $perm ) {
+ if( $perm == $selected_perm ) $s = 'selected';
+ else $s = '';
+ $str .= '<option value="'.$perm.'"'.$s.' >'.$perm.'</option>'."\n";
+ }
+ $str .= '</select>';
+ $str .= '</td>';
}
- $str .= '</select>';
- $str .= '</td>';
- $str .= '<td>'.$value['comment'].'</td>';
+ $str .= '<td>'.$value['comment'].'</td>';
$str .= '</tr>'."\n";
break;
case 'resourcepolicy': // Special Kolab entry for group/resource policies
debug("resourcepolicy");
+ $ro = ereg( 'readonly', $value['attrs'] );
$str .= '<tr>';
$str .= '<td>'.$value['name'].'</td>';
$str .= '<td>';
@@ -165,30 +178,39 @@
unset($tmppol['']);
ksort($tmppol);
$tmppol[''] = 0;
+ $policies = array( _('Always accept'),
+ _('Always reject'),
+ _('Reject if conflicts'),
+ _('Manual if conflicts'),
+ _('Manual') );
foreach( $tmppol as $user => $pol ) {
debug("form: ".$user." => ".$pol);
- $str .= '<tr><td>';
- if( $user == 'anyone' ) {
- $str .= 'Anyone<input type="hidden" name="user_'.$key.'_'.$i.'" value="'.$user.'" '.$value['attrs'].' />';
+ if( $ro ) {
+ if( !$user ) continue;
+ $str .= '<tr><td>';
+ if( $user == 'anyone' ) $str .= '<p class="ctrl">'._('Anyone').'</p>';
+ else $str .= '<p class="ctrl">'.htmlentities($user).'</p>';
+ $str .= '</td><td><p class="ctrl">'.$policies[$pol].'</p></td></tr>'."\n";
} else {
- $str .= '<input name="user_'.$key.'_'.$i.'" type="text" size="'.($size-20)
- .'" value="'.$user.'" '.$value['attrs'].' />';
- }
- $str .= '</td><td><select name="policy_'.$key.'_'.$i.'">'."\n";
- $j = 0;
- foreach( array( _('Always accept'),
- _('Always reject'),
- _('Reject if conflicts'),
- _('Manual if conflicts'),
- _('Manual') ) as $p ) {
- if( $j == $pol ) {
- $str .= '<option value="'.$j++.'" selected>'.$p.'</option>'."\n";
+ $str .= '<tr><td>';
+ if( $user == 'anyone' ) {
+ $str .= _('Anyone').'<input type="hidden" name="user_'.$key.'_'.$i.'" value="'.$user.'" '.$value['attrs'].' />';
} else {
- $str .= '<option value="'.$j++.'">'.$p.'</option>'."\n";
+ $str .= '<input name="user_'.$key.'_'.$i.'" type="text" size="'.($size-20)
+ .'" value="'.$user.'" '.$value['attrs'].' />';
}
+ $str .= '</td><td><select name="policy_'.$key.'_'.$i.'">'."\n";
+ $j = 0;
+ foreach( $policies as $p ) {
+ if( $j == $pol ) {
+ $str .= '<option value="'.$j++.'" selected>'.$p.'</option>'."\n";
+ } else {
+ $str .= '<option value="'.$j++.'">'.$p.'</option>'."\n";
+ }
+ }
+ $i++;
+ $str .= '</select></td></tr>'."\n";
}
- $i++;
- $str .= '</select></td></tr>'."\n";
}
$str .= '</table></td>';
$str .= '<td>'.$value['comment'].'</td>';
Index: ldap.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/ldap.class.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- ldap.class.php 30 May 2005 11:53:35 -0000 1.23
+++ ldap.class.php 16 Jun 2005 00:32:10 -0000 1.24
@@ -346,6 +346,13 @@
}
} else $count += $entries['count'];
+ /* Distribution lists have a mail attr now too,
+ so it looks like we count them twice.
+ For some reason I've not seen any problems
+ with it though, so I dare not remove the code
+ below... /steffen
+ */
+
// Now count dist. lists
$cn = substr( $mail, 0, strpos( $mail, '@' ) );
$filter = '(&(objectClass=kolabGroupOfNames)(cn='.$this->escape($cn).'))';
@@ -360,7 +367,7 @@
$count++;
}
} else $count += $entries['count'];
-
+
debug("Got $count addresses");
$this->freeSearchResult();
More information about the commits
mailing list