fixed many little problems in modules. Too many to count.

Added a new function to all modules
This commit is contained in:
katagia 2004-02-09 18:11:01 +00:00
parent 754b283163
commit e6206bdcaa
11 changed files with 124 additions and 18 deletions

View File

@ -286,7 +286,11 @@ class accountContainer {
echo "<a href=../help.php?module=$module&item=". $input[$i][$j]['value'] . ">" . _('Help') . "</a></td>\n";
break;
case 'message':
echo "<td";
if ($input[$i][$j]['td']['valign']!='') echo ' valign="' . $input[$i][$j]['td']['valign'] .'"';
echo ">\n";
StatusMessage($input[$i][$j]['type'], $input[$i][$j]['headline'], $input[$i][$j]['text']);
echo "</td>\n";
break;
default:
echo "<td>Unrecognized type: " . $input[$i][$j]['kind'] . "</td>\n";
@ -395,6 +399,7 @@ class accountContainer {
return 0;
}
/* This function return ldap attributes which are uses by $objectClass
* Syntax is get_attributes($objectClass)
* Return is an array with all allowed attributes
@ -537,11 +542,12 @@ class accountContainer {
// found attribute which must be set
if ($this->attributes[$attributes[$i]][$singleattribute[$j]]=='MUST') {
// Check if attribute is set
if ($this->module[$singleattribute[$j]]->attributes[$attributes[$i]]=='')
if ($this->module[$singleattribute[$j]]->attributes[$attributes[$i]]=='') {
if (!in_array($singleattribute[$j], $return)) $return[] = $singleattribute[$j];
}
}
}
}
return $return;
}
}

View File

@ -81,6 +81,14 @@ class account {
return true;
}
/* This functions return true
* if all needed settings are done
*/
function module_complete() {
if (!$this->module_ready()) return false;
return true;
}
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some

View File

@ -46,7 +46,9 @@ class inetOrgPerson {
if (!is_string($base)) trigger_error(_('Please create a new module object with $accountContainer->add_objectClass(\'inetOrgPerson\');'), E_USER_ERROR);
if ($_SESSION[$this->base]->type != 'user') trigger_error(_('inetOrgPerson can only be used for users.'), E_USER_WARNING);
// load attribtues which are used in inetOrgPerson objectClass
$this->attributes = $_SESSION[$this->base]->get_module_attributes('inetOrgPerson');
// unset attributes which are "must" but not in this module
// cn will be set to uid in module posixAccount
// Therefore module posixAccount is required an cn will be removed from main index in account_container
// Create copy of attributes
$this->orig = $this->attributes ;
// Add objectClass to attributes
@ -70,7 +72,7 @@ class inetOrgPerson {
/* This function returns a list with all required modules
*/
function get_dependencies($scope) {
if ($scope=='user') return array('require' => array('main'), 'conflict' => array('account', 'posixGroup', 'sambaDomain') );
if ($scope=='user') return array('require' => array('main', 'posixAccount'), 'conflict' => array('account', 'posixGroup', 'sambaDomain') );
return -1;
}
@ -81,6 +83,16 @@ class inetOrgPerson {
return true;
}
/* This functions return true
* if all needed settings are done
*/
function module_complete() {
if (!$this->module_ready()) return false;
if ($this->attributes['sn'][0] == '') return false;
if ($this->attributes['givenName'][0] == '') return false;
return true;
}
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some

View File

@ -77,6 +77,14 @@ class main {
return true;
}
/* This functions return true
* if all needed settings are done
*/
function module_complete() {
if (!$this->module_ready()) return false;
return true;
}
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some
@ -188,16 +196,19 @@ class main {
}
function display_html_attributes($post, $profile=false) {
$modules = $_SESSION[$this->base]->check_attributes();
if (count($modules)!=0 && !$profile) {
$modules = array_keys($_SESSION[$this->base]->module);
if (!$profile) {
$disabled = false;
// Show reason why module is disabled
for ($i=0; $i<count($modules); $i++)
$return[] = array ( 0 => array ( 'kind' => 'message', 'type' => 'ERROR', 'headline' => _('Check module'),
'text' => sprintf(_('Please set up all required attributes on %s page.'), $_SESSION[$this->base]->module[$modules[$i]]->get_alias()) ));
foreach ($modules as $module) {
if (!$_SESSION[$this->base]->module[$module]->module_complete()) {
$disabled = true;
$table[] = array ( 0 => array ( 'kind' => 'message', 'type' => 'ERROR', 'headline' => _('Check module'),
'text' => sprintf(_('Please set up all required attributes on %s page.'), $_SESSION[$this->base]->module[$module]->get_alias()) ));
}
}
}
else $disabled = true;
if (count($table)!=0) $return[] = array ( 0 => array ( 'kind' => 'table', 'value' => $table ) );
// loop through all suffixes
$function = '$suffix = $_SESSION[$_SESSION[$this->base]->config]->get_'.ucfirst($_SESSION[$this->base]->type).'Suffix();';
eval($function);

View File

@ -145,6 +145,19 @@ class posixAccount {
return true;
}
/* This functions return true
* if all needed settings are done
*/
function module_complete() {
if (!$this->module_ready()) return false;
if ($this->attributes['uid'][0] == '') return false;
if ($this->attributes['uidNumber'][0] == '') return false;
if ($this->attributes['gidNumber'][0] == '') return false;
if ($this->attributes['homeDirectory'][0] == '') return false;
if ($this->attributes['loginShell'][0] == '') return false;
return true;
}
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some
@ -362,14 +375,15 @@ class posixAccount {
if ($post['userPassword_lock']) $this->userPassword_lock=true;
else $this->userPassword_lock=false;
if (!$profile) {
if (isset($post['userPassword'])) {
if ($post['genpass']) $this->userPassword(genpasswd());
else if (isset($post['userPassword'])) {
if ($post['userPassword'] != $post['userPassword2']) {
$errors['userPassword'][] = array('ERROR', _('Password'), _('Please enter the same password in both password-fields.'));
unset ($post['userPassword2']);
}
else $this->userPassword($post['userPassword']);
}
if ($post['genpass']) $this->userPassword(genpasswd());
// Check if UID is valid. If none value was entered, the next useable value will be inserted
// load min and may uidNumber
if ($_SESSION[$this->base]->type=='user') {
@ -581,6 +595,7 @@ class posixAccount {
1 => array ( 'kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $password),
2 => array ( 'kind' => 'input', 'name' => 'genpass', 'type' => 'submit', 'value' => _('Generate password')));
if ($post['userPassword2']!='') $password2 = $post['userPassword2'];
else $password2 = $password;
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Repeat password') ),
1 => array ( 'kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $password2),
2 => array ('kind' => 'help', 'value' => 'userPassword'));

View File

@ -134,6 +134,16 @@ class posixGroup {
return true;
}
/* This functions return true
* if all needed settings are done
*/
function module_complete() {
if (!$this->module_ready()) return false;
if ($this->attributes['cn'][0] == '') return false;
if ($this->attributes['gidNumber'][0] == '') return false;
return true;
}
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some

View File

@ -86,6 +86,14 @@ class quota {
return true;
}
/* This functions return true
* if all needed settings are done
*/
function module_complete() {
if (!$this->module_ready()) return false;
return true;
}
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some

View File

@ -141,6 +141,15 @@ class sambaAccount {
return true;
}
/* This functions return true
* if all needed settings are done
*/
function module_complete() {
if (!$this->module_ready()) return false;
if ($this->attributes['rid'][0] == '') return false;
return true;
}
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some

View File

@ -109,6 +109,16 @@ class sambaGroupMapping {
return true;
}
/* This functions return true
* if all needed settings are done
*/
function module_complete() {
if (!$this->module_ready()) return false;
if ($this->attributes['sambaSID'][0] == '') return false;
if ($this->attributes['sambaGroupType'][0] == '') return false;
return true;
}
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some

View File

@ -141,6 +141,15 @@ class sambaSamAccount {
return true;
}
/* This functions return true
* if all needed settings are done
*/
function module_complete() {
if (!$this->module_ready()) return false;
if ($this->attributes['sambaSID'][0] == '') return false;
return true;
}
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some

View File

@ -102,6 +102,14 @@ class shadowAccount {
return true;
}
/* This functions return true
* if all needed settings are done
*/
function module_complete() {
if (!$this->module_ready()) return false;
return true;
}
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some