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

🚑 fix(management) Fix code style and remove commented code

parent e42cc152
......@@ -26,7 +26,8 @@ class ListingEntry implements ArrayAccess
private $attrs;
protected $listing;
public function __construct(managementListing $listing, $type, $dn, array $attrs, $row = NULL) {
public function __construct(managementListing $listing, $type, $dn, array $attrs, $row = NULL)
{
$this->listing = $listing;
$this->type = $type;
$this->dn = $dn;
......@@ -34,7 +35,8 @@ class ListingEntry implements ArrayAccess
$this->row = $row;
}
public function offsetSet($offset, $value) {
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
......@@ -42,15 +44,18 @@ class ListingEntry implements ArrayAccess
}
}
public function offsetExists($offset) {
public function offsetExists($offset)
{
return isset($this->attrs[$offset]);
}
public function offsetUnset($offset) {
public function offsetUnset($offset)
{
unset($this->attrs[$offset]);
}
public function offsetGet($offset) {
public function offsetGet($offset)
{
return (isset($this->attrs[$offset]) ? $this->attrs[$offset] : NULL);
}
......
......@@ -121,11 +121,6 @@ class management
}
$this->configureActions();
//~ $this->configureFilter();
//~ if ($this->baseMode === FALSE) {
//~ $this->headpage->setBase($config->current['BASE']);
//~ }
}
protected function configureActions()
......@@ -364,8 +359,8 @@ class management
function execute()
{
// Ensure that html posts and gets are kept even if we see a 'Entry islocked' dialog.
//~ $vars = array('/^act$/','/^listing/','/^PID$/');
//~ session::set('LOCK_VARS_TO_USE', $vars);
$vars = array('/^act$/','/^listing/','/^PID$/');
session::set('LOCK_VARS_TO_USE', $vars);
/* Display the copy & paste dialog, if it is currently open */
$ret = $this->copyPasteHandler();
......@@ -406,11 +401,6 @@ class management
// Update filter
if ($this->filter) {
$this->filter->update();
//~ session::global_set(get_class($this).'_filter', $this->filter);
//~ session::set('autocomplete', $this->filter);
//~ if (!$this->filter->isValid()) {
//~ msg_dialog::display(_('Filter error'), _('The filter is incomplete!'), ERROR_DIALOG);
//~ }
}
// Update list
......@@ -424,22 +414,6 @@ class management
{
global $config;
//~ $smarty = get_smarty();
//~ $filters = array();
//~ foreach ($this->objectTypes as $object) {
//~ $filters[] = array(
//~ 'id' => 'FILTER'.$object,
//~ 'label' => sprintf(_('Show %s'), $config->data['OBJECTS'][$object]['name'])
//~ );
//~ }
//~ if (!static::$skipTemplates) {
//~ $filters[] = array(
//~ 'id' => 'FILTERTEMPLATE',
//~ 'label' => sprintf(_('Show %s'), _('Template'))
//~ );
//~ }
//~ $smarty->assign('objectFilters', $filters);
$smarty = get_smarty();
$smarty->assign('usePrototype', 'true');
$smarty->assign('FILTER', $this->filter->render());
......
......@@ -95,29 +95,6 @@ class managementFilter
$smarty->assign('TEMPLATES', $this->showTemplates);
}
// Load template and replace elementsHtml[]
//~ foreach ($this->elements as $tag => $element) {
//~ $htmlCode = "";
//~ switch ($element['type']) {
//~ case "textfield":
//~ $htmlCode = $this->getTextfield($element);
//~ $smarty->assign($tag.'DESC', sprintf(_('Searches in %s'), implode(', ', $element['autocomplete']['attribute'])));
//~ break;
//~ case "checkbox":
//~ $htmlCode = $this->getCheckbox($element);
//~ break;
//~ case "combobox":
//~ $htmlCode = $this->getCombobox($element);
//~ break;
//~ default:
//~ throw new Exception ('Unknown element type specified: '.$element['type'].'!');
//~ }
//~ $smarty->assign("$tag", $htmlCode);
//~ }
// load the file from the theme folder
$file = get_template_path('management/filter.tpl');
......
......@@ -592,6 +592,7 @@ class managementListing
$result['targets'][] = $this->entriesIndex[$target];
}
} elseif (isset($_REQUEST['dn']) && preg_match('/^listing_([a-zA-Z_]+)$/', $key, $m)) {
// TODO fix this
/* Pre-render list to init things if a dn is gonna be opened on first load */
$dn = urldecode($_REQUEST['dn']);
$action = $m[1];
......@@ -617,6 +618,7 @@ class managementListing
$this->render();
session::global_set('size_limit', $oldsizelimit);
$this->filter->elementValues['NAME'] = '';
$result['action'] = $action;
$result['targets'][] = $dn;
// Make sure no other management class intercept the same dn
......
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