summaryrefslogtreecommitdiffstats
path: root/lib/kolab_client_task.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-01-17 11:02:18 +0100
committerAleksander Machniak <alec@alec.pl>2014-01-17 11:02:18 +0100
commitf434be6ad70510471bf1ccada311c869a5bc6f62 (patch)
tree2db03286b4e4c77d6038f3a9ff4915b753212f94 /lib/kolab_client_task.php
parent955f4186c5e3681226d01e5f4e77ff0af99f09d6 (diff)
downloadwebadmin-f434be6ad70510471bf1ccada311c869a5bc6f62.tar.gz
Delete domains by status change and related improvements e.g.
check if domain is empty and warn the user before setting status to deleted TODO: shell script for real domains deletion
Diffstat (limited to 'lib/kolab_client_task.php')
-rw-r--r--lib/kolab_client_task.php32
1 files changed, 20 insertions, 12 deletions
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 20c4bc0..8cac7e0 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -1358,16 +1358,13 @@ class kolab_client_task
));
}
- if (!empty($data['id']) && in_array('delete', (array) $data['effective_rights']['entry'])) {
+ // add delete button
+ if ($this->is_deletable($data)) {
$id = $data['id'];
-
- // disable delete for self
- if ($id != $_SESSION['user']['id']) {
- $form->add_button(array(
- 'value' => kolab_html::escape($this->translate('button.delete')),
- 'onclick' => "kadm.{$name}_delete('{$id}')",
- ));
- }
+ $form->add_button(array(
+ 'value' => kolab_html::escape($this->translate('button.delete')),
+ 'onclick' => "kadm.{$name}_delete('{$id}')",
+ ));
}
$ac_min_len = $this->config_get('autocomplete_min_length', 1, Conf::INT);
@@ -1378,12 +1375,21 @@ class kolab_client_task
$this->output->set_env('autocomplete_min_length', $ac_min_len);
$this->output->add_translation('form.required.empty', 'form.maxcount.exceeded',
$name . '.add.success', $name . '.edit.success', $name . '.delete.success',
- $name . '.delete.confirm', 'add', 'edit', 'delete');
+ $name . '.delete.confirm', $name . '.delete.force',
+ 'add', 'edit', 'delete');
return $form;
}
/**
+ * Check wether specified object can be deleted
+ */
+ protected function is_deletable($data)
+ {
+ return !empty($data['id']) && in_array('delete', (array) $data['effective_rights']['entry']);
+ }
+
+ /**
* Search form.
*
* @return string HTML output of the form
@@ -1564,8 +1570,10 @@ class kolab_client_task
continue;
}
+ $class = array('selectable');
+
if (method_exists($this, 'list_item_handler')) {
- $item = $this->list_item_handler($item);
+ $item = $this->list_item_handler($item, $class);
}
else {
$item = array_shift($item);
@@ -1579,7 +1587,7 @@ class kolab_client_task
$cells = array();
$cells[] = array('class' => 'name', 'body' => kolab_html::escape($item),
'onclick' => "kadm.command('$task.info', '$idx')");
- $rows[] = array('id' => $i, 'class' => 'selectable', 'cells' => $cells);
+ $rows[] = array('id' => $i, 'class' => implode(' ', $class), 'cells' => $cells);
}
}
else {