Commit c3780a3c authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #4794 My account editions now load the tab class

parent 0ab168b0
......@@ -271,11 +271,8 @@ class management
}
// Check if there is a dialog opened - We don't need any buttons in this case.
if ($this->tabObject->by_object[$this->tabObject->current]) {
$current = $this->tabObject->by_object[$this->tabObject->current];
if (isset($current->dialog) && (is_object($current->dialog) || $current->dialog)) {
return "";
}
if ($this->tabObject->dialogOpened()) {
return '';
}
// Skip footer if requested;
......
......@@ -361,7 +361,7 @@ class simplePlugin extends plugin
$plInfo = pluglist::pluginInfos(get_class($this));
if ($this->parent !== NULL) {
if ($this->is_account) {
$disabled = FALSE;
$disabled = $this->acl_skip_write();
$depends = array();
if (isset($plInfo['plDepending'])) {
foreach ($plInfo['plDepending'] as $plugin) {
......@@ -380,7 +380,7 @@ class simplePlugin extends plugin
get_class($this).'_modify_state'
);
} else {
$disabled = FALSE;
$disabled = $this->acl_skip_write();
$depends = array();
if (isset($plInfo['plDepends'])) {
foreach ($plInfo['plDepends'] as $plugin) {
......@@ -809,12 +809,6 @@ class simplePlugin extends plugin
$plCategory = $key;
}
$mainTab = FALSE;
if (!$tabs) {
$infos = objects::infos($objectType);
$mainTab = (reset($config->data['TABS'][$infos['tabGroup']])['CLASS'] == $classname);
}
$lock_msg = "";
if ($edit_mode) {
/* Remove locks created by this plugin */
......@@ -836,35 +830,27 @@ class simplePlugin extends plugin
session::un_set('edit');
}
/* Create account object on demand */
/* Create tab object on demand */
if (!session::is_set($classname) || (isset($_GET['reset']) && $_GET['reset'] == 1)) {
if ($tabs) {
$account = objects::open($entry_dn, $objectType);
if ($edit_mode) {
foreach ($account->by_object as &$obj) {
$obj->setNeedEditMode(TRUE);
}
unset($obj);
}
} else {
$account = new $classname($entry_dn, NULL, NULL, $mainTab);
$account->set_acl_category($plCategory);
if ($edit_mode) {
$account->setNeedEditMode(TRUE);
}
$tabObject = objects::open($entry_dn, $objectType);
if ($edit_mode) {
$tabObject->setNeedEditMode(TRUE);
}
if (!$tabs) {
$tabObject->current = $classname;
}
if (($entry_dn != '') && ($entry_dn != 'new')) {
$account->set_acl_base($entry_dn);
$tabObject->set_acl_base($entry_dn);
} else {
$account->set_acl_base($config->current['BASE']);
$tabObject->set_acl_base($config->current['BASE']);
}
session::set($classname, $account);
session::set($classname, $tabObject);
}
$account = session::get($classname);
$tabObject = session::get($classname);
/* save changes back to object */
if (!$edit_mode || session::is_set('edit')) {
$account->save_object();
$tabObject->save_object();
}
if ($edit_mode) {
......@@ -886,11 +872,11 @@ class simplePlugin extends plugin
$info = "";
if (isset($_POST['edit_finish'])) {
/* Perform checks */
$message = $account->check();
$message = $tabObject->check();
/* No errors, save object */
if (count($message) == 0) {
$account->save();
$tabObject->save();
del_lock($entry_dn);
session::un_set('edit');
......@@ -909,20 +895,22 @@ class simplePlugin extends plugin
if ($edit_mode && $lock_msg) {
$display = $lock_msg;
} else {
$display .= $account->execute();
if ($tabs) {
$display .= $tabObject->execute();
} else {
$display .= $tabObject->by_object[$classname]->execute();
}
}
/* Store changes in session */
if (!$edit_mode || session::is_set('edit')) {
session::set($classname, $account);
session::set($classname, $tabObject);
}
/* Show page footer depending on the mode */
if ($edit_mode &&
($tabs || (!$account->dialog && $account->is_account)) &&
empty($lock_msg)) {
$info = $entry_dn.' ';
if ($edit_mode && (!$tabObject->dialogOpened()) && empty($lock_msg)) {
$display .= '<p class="plugbottom">';
$info = $entry_dn.'&nbsp;';
/* Are we in edit mode? */
if (session::is_set('edit')) {
......
......@@ -205,10 +205,9 @@ class simpleTabs
$display = '<div class="tab_content">'."\n";
$display .= $this->by_object[$this->current]->execute();
$modal_dialog = $this->by_object[$this->current]->is_modal_dialog();
/* Build tab line */
$tabs = $this->gen_tabs($modal_dialog);
$tabs = $this->gen_tabs($this->dialogOpened());
/* Footer for tabbed dialog */
$display = $tabs.$display.'</div>';
......@@ -493,6 +492,19 @@ class simpleTabs
unset($obj);
}
public function setNeedEditMode ($bool)
{
foreach ($this->by_object as &$obj) {
$obj->setNeedEditMode($bool);
}
unset($obj);
}
public function dialogOpened ()
{
return $this->by_object[$this->current]->is_modal_dialog();
}
function objectInfos()
{
if ($this->objectType === FALSE) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment