...
 
Commits (6)
......@@ -169,12 +169,6 @@ if (memory_get_usage() > (to_byte(ini_get('memory_limit')) - 2048000)) {
msg_dialog::display(_("Configuration error"), _("Running out of memory!"), WARNING_DIALOG);
}
/* Load department list when plugin has changed. That is some kind of
compromise between speed and beeing up to date */
if (isset($_GET['reset'])) {
set_object_info();
}
/* show web frontend */
$smarty->assign("date", date("l, dS F Y H:i:s O"));
$lang = session::get('lang');
......
......@@ -3,6 +3,7 @@
{$game_screen}
{$php_errors}
<form action="main.php{$plug}" name="mainform" id="mainform" method="post" enctype="multipart/form-data">
<div style="width: 0; height: 0; overflow: hidden;"><input type="submit" name="default_submit_hidden_button"/></div>
<div class="setup-header">
<div id="header-left">
<img id="fd-logo" class="optional" src="geticon.php?context=applications&amp;icon=fusiondirectory&amp;size=48" alt="FusionDirectory logo"/>
......
......@@ -586,7 +586,8 @@ class pluglist
$cleanup = $remove_lock = FALSE;
}
} catch (Exception $e) {
$smarty->assign('header', print_header('geticon.php?context=status&icon=dialog-error&size=32', _('Fatal error!')));
$smarty->assign('headline', _('Fatal error!'));
$smarty->assign('headline_image', 'geticon.php?context=status&icon=dialog-error&size=32');
$display = '<h1>'._('An unrecoverable error occurred. Please contact your administator.').'</h1><p>';
if (ini_get('display_errors') == 1) {
$display .= nl2br(htmlentities((string)$e, ENT_COMPAT, 'UTF-8'));
......
......@@ -1065,33 +1065,6 @@ function check_command ($cmdline)
return TRUE;
}
/*!
* \brief Print plugin HTML header
*
* \param string $image the path of the image to be used next to the headline
*
* \param string $headline the headline
*
* \param string $info additional information to print
*
* \return the $display variable
*/
function print_header ($image, $headline, $info = '')
{
$smarty = get_smarty();
$smarty->assign('headline', $headline);
$smarty->assign('headline_image', $image);
$display = '';
if ($info != '') {
$display .= '<div class="pluginfo">'."\n";
$display .= "$info";
$display .= "</div>\n";
$display .= "<div></div>\n";
}
return $display;
}
/*!
* \brief Put netmask in n.n.n.n format
*
......@@ -1862,18 +1835,6 @@ function cred_decrypt ($input, $password)
return openssl_decrypt($input, 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv);
}
function get_object_info ()
{
return session::get('objectinfo');
}
function set_object_info ($str = "")
{
session::set('objectinfo', $str);
}
/*!
* \brief Test if an ip is the network range
*
......
......@@ -81,9 +81,6 @@ class management
['ActionsColumn', ['label' => 'Actions']],
];
// Whether to display a header or not.
protected $skipHeader = FALSE;
function __construct (
$objectTypes = FALSE,
array $filterElementDefinitions = [
......@@ -576,15 +573,19 @@ class management
}
/*!
* \brief Generates the plugin header which is displayed whenever a tab object is opened.
* \brief Sets smarty headline and returns the plugin header which is displayed whenever a tab object is opened.
*/
protected function getHeader (): string
{
if ($this->skipHeader) {
return '';
}
global $smarty;
return print_header($this->icon, $this->title, get_object_info());
$smarty->assign('headline', $this->title);
$smarty->assign('headline_image', $this->icon);
if (is_object($this->tabObject) && ($this->currentDn != '')) {
return '<div class="pluginfo">'.$this->currentDn."</div>\n";
}
return '';
}
function openTabObject ($object)
......@@ -608,8 +609,6 @@ class management
$this->tabObject = NULL;
$this->last_dialogObject = $this->dialogObject;
$this->dialogObject = NULL;
set_object_info();
}
protected function listAclCategories (): array
......@@ -710,8 +709,6 @@ class management
$this->currentDn = 'new';
set_object_info($this->currentDn);
// Open object
$this->openTabObject(objects::create($type));
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Create entry initiated');
......@@ -726,8 +723,6 @@ class management
$this->currentDn = 'new';
set_object_info($this->currentDn);
// Open object
$this->openTabObject(objects::createTemplate($type));
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Create template entry initiated');
......@@ -832,7 +827,6 @@ class management
// Get the dn of the object and create lock
$this->currentDn = $target;
set_object_info($this->currentDn);
if ($locks = get_locks($this->currentDn, TRUE)) {
return gen_locked_message($locks, $this->currentDn, TRUE);
}
......@@ -1221,7 +1215,6 @@ class management
$this->listing->focusDn($dn);
$entry = $this->listing->getEntry($dn);
$this->currentDn = $dn;
set_object_info($this->currentDn);
add_lock($this->currentDn, $ui->dn);
// Open object
......
......@@ -24,7 +24,6 @@
*/
class selectManagement extends management
{
protected $skipHeader = TRUE;
protected $skipCpHandler = TRUE;
public static $skipSnapshots = TRUE;
......@@ -80,4 +79,12 @@ class selectManagement extends management
return $list.$smarty->fetch(get_template_path('management/select-footer.tpl'));
}
/*!
* \brief Let header handling to parent
*/
protected function getHeader (): string
{
return '';
}
}
......@@ -495,6 +495,8 @@ class simpleManagement
*/
protected function getHeader ()
{
global $smarty;
if ($this->skipHeader) {
return '';
}
......@@ -506,7 +508,13 @@ class simpleManagement
if (!preg_match('/^geticon/', $plIcon)) {
$plIcon = get_template_path($plIcon);
}
return print_header($plIcon, $plTitle, get_object_info());
$smarty->assign('headline', $plTitle);
$smarty->assign('headline_image', $plIcon);
if (is_object($this->tabObject) && ($this->dn != '')) {
return '<div class="pluginfo">'.$this->dn."</div>\n";
}
return '';
}
/*!
......@@ -568,8 +576,6 @@ class simpleManagement
$this->dn = 'new';
$this->is_single_edit = FALSE;
set_object_info($this->dn);
// Open object
$this->openTabObject(objects::open($this->dn, $type));
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "Create new entry initiated!");
......@@ -765,7 +771,6 @@ class simpleManagement
// Get the dn of the object and creates lock
$this->dn = array_pop($target);
set_object_info($this->dn);
if ($locks = get_locks($this->dn, TRUE)) {
return gen_locked_message($locks, $this->dn, TRUE);
}
......@@ -862,7 +867,6 @@ class simpleManagement
$this->dialogObject = NULL;
$this->skipFooter = FALSE;
set_object_info();
}
/*!
......
......@@ -2121,7 +2121,7 @@ class simplePlugin implements SimpleTab
*/
static function mainInc ($classname = NULL, $entry_dn = NULL, $tabs = FALSE, $edit_mode = TRUE, $objectType = FALSE)
{
global $remove_lock, $cleanup, $display, $config, $plug, $ui;
global $remove_lock, $cleanup, $display, $config, $plug, $ui, $smarty;
if ($classname === NULL) {
$classname = get_called_class();
......@@ -2198,7 +2198,6 @@ class simplePlugin implements SimpleTab
}
/* save changes to LDAP and disable edit mode */
$info = "";
if (isset($_POST['edit_finish'])) {
/* Perform checks */
$message = $tabObject->save();
......@@ -2215,8 +2214,6 @@ class simplePlugin implements SimpleTab
msg_dialog::displayChecks($message);
}
}
} else {
$info = "";
}
/* Execute formular */
......@@ -2248,7 +2245,7 @@ class simplePlugin implements SimpleTab
} elseif (strpos($tabObject->by_object[$tabObject->current]->aclGetPermissions(''), 'w') !== FALSE) {
/* Only display edit button if there is at least one attribute writable */
$display .= '<p class="plugbottom">'."\n";
$info .= '<div style="display:inline-block" class="optional"><img class="center" alt="information" '.
$info .= '<div style="float:left;" class="optional"><img class="center" alt="information" '.
'src="geticon.php?context=status&amp;icon=dialog-information&amp;size=16"> '.
msgPool::clickEditToChange().'</div>';
$display .= '<input type="submit" name="edit" value="'.msgPool::editButton().'"/>'."\n";
......@@ -2260,7 +2257,9 @@ class simplePlugin implements SimpleTab
if (!preg_match('/^geticon/', $plIcon)) {
$plIcon = get_template_path($plIcon);
}
$display = print_header($plIcon, $plHeadline, $info).$display;
$smarty->assign('headline', $plHeadline);
$smarty->assign('headline_image', $plIcon);
$display = '<div class="pluginfo">'.$info."</div>\n".$display;
}
}
}
......@@ -187,8 +187,6 @@ class aclManagement extends management
$this->currentDn = $dn;
set_object_info($this->currentDn);
$this->openTabObject($tabObject);
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Creating new ACL assignment');
}
......
......@@ -21,7 +21,8 @@
if (!$cleanup) {
$smarty->assign('iconmenu', $plist->show_iconmenu());
$smarty->assign('header', print_header('geticon.php?context=applications&icon=config-welcome&size=48', sprintf(_('Welcome %s!'), $ui->cn)));
$smarty->assign('headline', sprintf(_('Welcome %s!'), $ui->cn));
$smarty->assign('headline_image', 'geticon.php?context=applications&icon=config-welcome&size=48');
$smarty->assign('year', date('Y'));
$smarty->assign('revision', FD_VERSION);
......