added button status
This commit is contained in:
parent
8c44807366
commit
e0d76141d5
|
@ -1,6 +1,9 @@
|
||||||
??? 0.5.rc3
|
??? 0.5.rc3
|
||||||
- fixed bugs:
|
- fixed bugs:
|
||||||
-> buttons on account page are better sorted
|
-> buttons on account page are better sorted
|
||||||
|
-> account module: some problems solved when used for user accounts
|
||||||
|
-> nisMailAlias: fixed missing RDN possibility
|
||||||
|
-> fixed conflicts when accounts were built with other base modules
|
||||||
|
|
||||||
|
|
||||||
18.08.2005 0.5.rc2
|
18.08.2005 0.5.rc2
|
||||||
|
|
|
@ -550,6 +550,32 @@ your module needs any additional input then set this to <span
|
||||||
style="font-weight: bold;">false</span>. The user will be notified
|
style="font-weight: bold;">false</span>. The user will be notified
|
||||||
that your module needs more input.<br>
|
that your module needs more input.<br>
|
||||||
<br>
|
<br>
|
||||||
|
<h3>2.2.4. getButtonStatus<br>
|
||||||
|
</h3>
|
||||||
|
<br>
|
||||||
|
<table border="0" cellpadding="2" cellspacing="2">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="vertical-align: top; text-align: center;"><span
|
||||||
|
style="font-weight: bold;">function getButtonStatus()</span><br>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
This function tells LAM if the module button on the account page is
|
||||||
|
visible and active.<br>
|
||||||
|
The function may return these values:<br>
|
||||||
|
<ul>
|
||||||
|
<li><span style="font-weight: bold;">enabled:</span> button is
|
||||||
|
visible and active</li>
|
||||||
|
<li><span style="font-weight: bold;">disabled:</span> button is
|
||||||
|
visible and deactivated (greyed)</li>
|
||||||
|
<li><span style="font-weight: bold;">hidden:</span> no button will be
|
||||||
|
shown<br>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
<h3>2.2.4. get_help</h3>
|
<h3>2.2.4. get_help</h3>
|
||||||
<br>
|
<br>
|
||||||
<table border="0" cellpadding="2" cellspacing="2">
|
<table border="0" cellpadding="2" cellspacing="2">
|
||||||
|
|
|
@ -540,6 +540,15 @@ class baseModule {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls if the module button the account page is visible and activated.
|
||||||
|
*
|
||||||
|
* @return string status ("enabled", "disabled", "hidden")
|
||||||
|
*/
|
||||||
|
function getButtonStatus() {
|
||||||
|
return "enabled";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the attribute values follow the LDAP syntax.
|
* Checks if the attribute values follow the LDAP syntax.
|
||||||
* Not every LDAP attribute allows UTF-8 strings. Therefore we do a syntax check here
|
* Not every LDAP attribute allows UTF-8 strings. Therefore we do a syntax check here
|
||||||
|
|
|
@ -943,11 +943,14 @@ class accountContainer {
|
||||||
// Loop for module
|
// Loop for module
|
||||||
// $x is used to count up tabindex
|
// $x is used to count up tabindex
|
||||||
for ($i=1; $i<count($this->order); $i++ ) {
|
for ($i=1; $i<count($this->order); $i++ ) {
|
||||||
|
$buttonStatus = $this->module[$this->order[$i]]->getButtonStatus();
|
||||||
|
// skip hidden buttons
|
||||||
|
if ($buttonStatus == 'hidden') continue;
|
||||||
// print normal button
|
// print normal button
|
||||||
echo "<input style=\"width:" . $buttonWidth ."em;margin:2px;\" name=\"form_main_".$this->order[$i]."\" type=\"submit\" value=\"";
|
echo "<input style=\"width:" . $buttonWidth ."em;margin:2px;\" name=\"form_main_".$this->order[$i]."\" type=\"submit\" value=\"";
|
||||||
echo $this->module[$this->order[$i]]->get_alias();
|
echo $this->module[$this->order[$i]]->get_alias();
|
||||||
echo "\" tabindex=$x";
|
echo "\" tabindex=$x";
|
||||||
if ($this->subpage == 'finish') echo " disabled";
|
if (($buttonStatus == 'disabled') || $this->subpage == 'finish') echo " disabled";
|
||||||
echo ">\n<br>";
|
echo ">\n<br>";
|
||||||
$x++;
|
$x++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,10 +119,27 @@ class account extends baseModule {
|
||||||
* @return boolean true if LDAP operation can be done
|
* @return boolean true if LDAP operation can be done
|
||||||
*/
|
*/
|
||||||
function module_complete() {
|
function module_complete() {
|
||||||
if ($this->attributes['uid'][0] == '') return false;
|
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||||
|
if (!in_array('posixAccount', $modules) && $this->attributes['uid'][0] == '') return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls if the module button the account page is visible and activated.
|
||||||
|
*
|
||||||
|
* @return string status ("enabled", "disabled", "hidden")
|
||||||
|
*/
|
||||||
|
function getButtonStatus() {
|
||||||
|
if (!$_SESSION[$this->base]->isNewAccount) {
|
||||||
|
// check if account is based on our object class
|
||||||
|
$objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass'];
|
||||||
|
if (is_array($objectClasses) && !in_array('account', $objectClasses)) {
|
||||||
|
return "disabled";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "enabled";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns a list of all possible pages of this module.
|
* This function returns a list of all possible pages of this module.
|
||||||
*
|
*
|
||||||
|
@ -156,6 +173,10 @@ class account extends baseModule {
|
||||||
* lamdaemon are lamdaemon commands to modify homedir, quotas, ...
|
* lamdaemon are lamdaemon commands to modify homedir, quotas, ...
|
||||||
*/
|
*/
|
||||||
function save_attributes() {
|
function save_attributes() {
|
||||||
|
// skip saving if account is based on another structural object class
|
||||||
|
if (!$_SESSION[$this->base]->isNewAccount && !in_array('account', $_SESSION[$this->base]->attributes_orig['objectClass'])) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
// Get easy attributes
|
// Get easy attributes
|
||||||
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig);
|
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig);
|
||||||
// Return attributes
|
// Return attributes
|
||||||
|
@ -171,9 +192,13 @@ class account extends baseModule {
|
||||||
function process_attributes(&$post) {
|
function process_attributes(&$post) {
|
||||||
// Load attributes
|
// Load attributes
|
||||||
$this->attributes['description'][0] = $post['description'];
|
$this->attributes['description'][0] = $post['description'];
|
||||||
|
// user name if no posixAccount
|
||||||
|
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||||
|
if (!in_array('posixAccount', $modules)) {
|
||||||
$this->attributes['uid'][0] = $post['uid'];
|
$this->attributes['uid'][0] = $post['uid'];
|
||||||
if (!get_preg($this->attributes['uid'][0], '!upper')) $triggered_messages['uid'][] = $this->messages['uid'][2];
|
if (!get_preg($this->attributes['uid'][0], '!upper')) $triggered_messages['uid'][] = $this->messages['uid'][2];
|
||||||
if (!get_preg($this->attributes['uid'][0], 'username')) $triggered_messages['uid'][] = $this->messages['uid'][3];
|
if (!get_preg($this->attributes['uid'][0], 'username')) $triggered_messages['uid'][] = $this->messages['uid'][3];
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -350,10 +350,33 @@ class inetOrgPerson extends baseModule {
|
||||||
* @return boolean true, if all is ok
|
* @return boolean true, if all is ok
|
||||||
*/
|
*/
|
||||||
function module_complete() {
|
function module_complete() {
|
||||||
|
if (!$_SESSION[$this->base]->isNewAccount) {
|
||||||
|
// check if account is based on our object class
|
||||||
|
$objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass'];
|
||||||
|
if (is_array($objectClasses) && !in_array('inetOrgPerson', $objectClasses)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($this->attributes['sn'][0] == '') return false;
|
if ($this->attributes['sn'][0] == '') return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls if the module button the account page is visible and activated.
|
||||||
|
*
|
||||||
|
* @return string status ("enabled", "disabled", "hidden")
|
||||||
|
*/
|
||||||
|
function getButtonStatus() {
|
||||||
|
if (!$_SESSION[$this->base]->isNewAccount) {
|
||||||
|
// check if account is based on our object class
|
||||||
|
$objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass'];
|
||||||
|
if (is_array($objectClasses) && !in_array('inetOrgPerson', $objectClasses)) {
|
||||||
|
return "disabled";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "enabled";
|
||||||
|
}
|
||||||
|
|
||||||
/* This function returns a list of all html-pages in module
|
/* This function returns a list of all html-pages in module
|
||||||
* This is usefull for mass upload and pdf-files
|
* This is usefull for mass upload and pdf-files
|
||||||
* because lam can walk trough all pages itself and do some
|
* because lam can walk trough all pages itself and do some
|
||||||
|
@ -372,6 +395,10 @@ class inetOrgPerson extends baseModule {
|
||||||
* lamdaemon are lamdaemon commands to modify homedir, quotas, ...
|
* lamdaemon are lamdaemon commands to modify homedir, quotas, ...
|
||||||
*/
|
*/
|
||||||
function save_attributes() {
|
function save_attributes() {
|
||||||
|
// skip saving if account is based on another structural object class
|
||||||
|
if (!$_SESSION[$this->base]->isNewAccount && !in_array('inetOrgPerson', $_SESSION[$this->base]->attributes_orig['objectClass'])) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig);
|
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig);
|
||||||
// do not set password if posixAccount is active
|
// do not set password if posixAccount is active
|
||||||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||||
|
|
|
@ -52,6 +52,8 @@ class nisMailAlias extends baseModule {
|
||||||
$return["ldap_filter"] = array('or' => "(objectClass=nisMailAlias)");
|
$return["ldap_filter"] = array('or' => "(objectClass=nisMailAlias)");
|
||||||
// alias name
|
// alias name
|
||||||
$return["alias"] = _("Mail aliases");
|
$return["alias"] = _("Mail aliases");
|
||||||
|
// RDN attribute
|
||||||
|
$return["RDN"] = array("cn" => "normal");
|
||||||
// module dependencies
|
// module dependencies
|
||||||
$return['dependencies'] = array('depends' => array(), 'conflicts' => array());
|
$return['dependencies'] = array('depends' => array(), 'conflicts' => array());
|
||||||
// help Entries
|
// help Entries
|
||||||
|
@ -144,6 +146,10 @@ class nisMailAlias extends baseModule {
|
||||||
* <br>"modify" are attributes which have to been modified in LDAP entry
|
* <br>"modify" are attributes which have to been modified in LDAP entry
|
||||||
*/
|
*/
|
||||||
function save_attributes() {
|
function save_attributes() {
|
||||||
|
// skip saving if account is based on another structural object class
|
||||||
|
if (!$_SESSION[$this->base]->isNewAccount && !in_array('nisMailAlias', $_SESSION[$this->base]->attributes_orig['objectClass'])) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
return $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig);
|
return $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,9 +250,32 @@ class nisMailAlias extends baseModule {
|
||||||
* This function returns true if all needed settings are done.
|
* This function returns true if all needed settings are done.
|
||||||
*/
|
*/
|
||||||
function module_complete() {
|
function module_complete() {
|
||||||
|
if (!$_SESSION[$this->base]->isNewAccount) {
|
||||||
|
// check if account is based on our object class
|
||||||
|
$objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass'];
|
||||||
|
if (is_array($objectClasses) && !in_array('nisMailAlias', $objectClasses)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return $this->inputCorrect;
|
return $this->inputCorrect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls if the module button the account page is visible and activated.
|
||||||
|
*
|
||||||
|
* @return string status ("enabled", "disabled", "hidden")
|
||||||
|
*/
|
||||||
|
function getButtonStatus() {
|
||||||
|
if (!$_SESSION[$this->base]->isNewAccount) {
|
||||||
|
// check if account is based on our object class
|
||||||
|
$objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass'];
|
||||||
|
if (is_array($objectClasses) && !in_array('nisMailAlias', $objectClasses)) {
|
||||||
|
return "disabled";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "enabled";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In this function the LDAP account is built up.
|
* In this function the LDAP account is built up.
|
||||||
*
|
*
|
||||||
|
|
|
@ -48,16 +48,6 @@ class posixGroup extends baseModule {
|
||||||
// change gids of users and hosts?
|
// change gids of users and hosts?
|
||||||
var $changegids;
|
var $changegids;
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new posixGroup object.
|
|
||||||
*
|
|
||||||
* @param string $scope account type
|
|
||||||
*/
|
|
||||||
function posixGroup($scope) {
|
|
||||||
// call parent constructor
|
|
||||||
parent::baseModule($scope);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In this function the LDAP account is built up.
|
* In this function the LDAP account is built up.
|
||||||
|
@ -225,11 +215,6 @@ class posixGroup extends baseModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function display_html_delete(&$post) {
|
|
||||||
// Get list of primary groupmembers.
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays selections to add or remove users from current group.
|
* Displays selections to add or remove users from current group.
|
||||||
*
|
*
|
||||||
|
@ -504,12 +489,36 @@ class posixGroup extends baseModule {
|
||||||
* if all needed settings are done
|
* if all needed settings are done
|
||||||
*/
|
*/
|
||||||
function module_complete() {
|
function module_complete() {
|
||||||
|
if (!$_SESSION[$this->base]->isNewAccount) {
|
||||||
|
// check if account is based on our object class
|
||||||
|
$objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass'];
|
||||||
|
if (is_array($objectClasses) && !in_array('posixGroup', $objectClasses)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($this->attributes['cn'][0] == '') return false;
|
if ($this->attributes['cn'][0] == '') return false;
|
||||||
if ($this->attributes['gidNumber'][0] == '') return false;
|
if ($this->attributes['gidNumber'][0] == '') return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls if the module button the account page is visible and activated.
|
||||||
|
*
|
||||||
|
* @return string status ("enabled", "disabled", "hidden")
|
||||||
|
*/
|
||||||
|
function getButtonStatus() {
|
||||||
|
if (!$_SESSION[$this->base]->isNewAccount) {
|
||||||
|
// check if account is based on our object class
|
||||||
|
$objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass'];
|
||||||
|
if (is_array($objectClasses) && !in_array('posixGroup', $objectClasses)) {
|
||||||
|
return "disabled";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "enabled";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This function returns a list of all html-pages in module
|
/* This function returns a list of all html-pages in module
|
||||||
* This is usefull for mass upload and pdf-files
|
* This is usefull for mass upload and pdf-files
|
||||||
* because lam can walk trough all pages itself and do some
|
* because lam can walk trough all pages itself and do some
|
||||||
|
@ -728,6 +737,10 @@ class posixGroup extends baseModule {
|
||||||
* modify are attributes which have to been modified in ldap entry
|
* modify are attributes which have to been modified in ldap entry
|
||||||
*/
|
*/
|
||||||
function save_attributes() {
|
function save_attributes() {
|
||||||
|
// skip saving if account is based on another structural object class
|
||||||
|
if (!$_SESSION[$this->base]->isNewAccount && !in_array('posixGroup', $_SESSION[$this->base]->attributes_orig['objectClass'])) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig);
|
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig);
|
||||||
// unset password when needed
|
// unset password when needed
|
||||||
if (isset($return[$_SESSION[$this->base]->dn]['add']['userPassword']))
|
if (isset($return[$_SESSION[$this->base]->dn]['add']['userPassword']))
|
||||||
|
|
Loading…
Reference in New Issue