summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorsten Grote <grote@kolabsys.com>2012-09-18 13:57:43 +0200
committerTorsten Grote <grote@kolabsys.com>2012-09-18 13:57:43 +0200
commitf57bdca8c8f2c6e3eaef9c6f130a4192d6180fb5 (patch)
tree90fba66e1f4ed2743d89355fc7a12e9605a10071
parentb13176a7a7f9f741c27e224614d0b097c3f86026 (diff)
parentf2bf7c79550e23562f60fd27b87a457f8b9e5b88 (diff)
downloadwebadmin-f57bdca8c8f2c6e3eaef9c6f130a4192d6180fb5.tar.gz
Merge branch 'master' of ssh://git.kolab.org/git/kolab-wap
-rw-r--r--lib/client/kolab_client_task_domain.php5
-rw-r--r--lib/client/kolab_client_task_group.php5
-rw-r--r--lib/client/kolab_client_task_main.php13
-rw-r--r--lib/client/kolab_client_task_resource.php5
-rw-r--r--lib/client/kolab_client_task_role.php6
-rw-r--r--lib/client/kolab_client_task_user.php5
-rw-r--r--lib/kolab_client_output.php14
-rw-r--r--lib/kolab_client_task.php50
-rw-r--r--lib/locale/en.php1
-rw-r--r--lib/locale/en_US.php1
-rw-r--r--public_html/js/kolab_admin.js7
-rw-r--r--public_html/skins/default/style.css5
12 files changed, 76 insertions, 41 deletions
diff --git a/lib/client/kolab_client_task_domain.php b/lib/client/kolab_client_task_domain.php
index 97d5624..8c8228c 100644
--- a/lib/client/kolab_client_task_domain.php
+++ b/lib/client/kolab_client_task_domain.php
@@ -42,9 +42,12 @@ class kolab_client_task_domain extends kolab_client_task
// display form to add domain if logged-in user has right to do so
$caps = $this->get_capability('actions');
- if($caps['domain.add']['type'] == 'w') {
+ if (!empty($caps['domain.add'])) {
$this->action_add();
}
+ else {
+ $this->output->command('set_watermark', 'taskcontent');
+ }
}
/**
diff --git a/lib/client/kolab_client_task_group.php b/lib/client/kolab_client_task_group.php
index a4b7c24..a628d50 100644
--- a/lib/client/kolab_client_task_group.php
+++ b/lib/client/kolab_client_task_group.php
@@ -42,9 +42,12 @@ class kolab_client_task_group extends kolab_client_task
// display form to add group if logged-in user has right to do so
$caps = $this->get_capability('actions');
- if($caps['group.add']['type'] == 'w') {
+ if (!empty($caps['group.add'])) {
$this->action_add();
}
+ else {
+ $this->output->command('set_watermark', 'taskcontent');
+ }
}
/**
diff --git a/lib/client/kolab_client_task_main.php b/lib/client/kolab_client_task_main.php
index 6921377..7a7a1f0 100644
--- a/lib/client/kolab_client_task_main.php
+++ b/lib/client/kolab_client_task_main.php
@@ -30,7 +30,8 @@ class kolab_client_task_main extends kolab_client_task
'domain' => 'domains',
'role' => 'roles',
'resource' => 'resources',
- 'about' => 'about',
+ 'settings' => '',
+ 'about' => '',
);
@@ -65,14 +66,12 @@ class kolab_client_task_main extends kolab_client_task
$this->menu = array();
foreach ($this->_menu as $task => $api_task) {
- if ($task !== "about") {
- if (!array_key_exists($api_task . '.list', $capabilities['actions'])) {
- //console("Skipping menu item $task for $api_task");
- continue;
- }
+ if ($api_task && !array_key_exists($api_task . '.list', $capabilities['actions'])) {
+ //console("Skipping menu item $task for $api_task");
+ continue;
}
- $this->menu[$task . '.default'] = 'menu.' . $api_task;
+ $this->menu[$task . '.default'] = 'menu.' . ($api_task ? $api_task : $task);
}
$this->output->assign('tasks', $this->menu);
diff --git a/lib/client/kolab_client_task_resource.php b/lib/client/kolab_client_task_resource.php
index ace2929..9a1626d 100644
--- a/lib/client/kolab_client_task_resource.php
+++ b/lib/client/kolab_client_task_resource.php
@@ -42,9 +42,12 @@ class kolab_client_task_resource extends kolab_client_task
// display form to add resource if logged-in user has right to do so
$caps = $this->get_capability('actions');
- if($caps['resource.add']['type'] == 'w') {
+ if (!empty($caps['resource.add'])) {
$this->action_add();
}
+ else {
+ $this->output->command('set_watermark', 'taskcontent');
+ }
}
/**
diff --git a/lib/client/kolab_client_task_role.php b/lib/client/kolab_client_task_role.php
index b625f73..4037098 100644
--- a/lib/client/kolab_client_task_role.php
+++ b/lib/client/kolab_client_task_role.php
@@ -42,10 +42,12 @@ class kolab_client_task_role extends kolab_client_task
// display form to add role if logged-in user has right to do so
$caps = $this->get_capability('actions');
- if($caps['role.add']['type'] == 'w') {
+ if (!empty($caps['role.add'])) {
$this->action_add();
}
-
+ else {
+ $this->output->command('set_watermark', 'taskcontent');
+ }
}
/**
diff --git a/lib/client/kolab_client_task_user.php b/lib/client/kolab_client_task_user.php
index 09bbca3..73dbcc3 100644
--- a/lib/client/kolab_client_task_user.php
+++ b/lib/client/kolab_client_task_user.php
@@ -42,9 +42,12 @@ class kolab_client_task_user extends kolab_client_task
// display form to add user if logged-in user has right to do so
$caps = $this->get_capability('actions');
- if($caps['user.add']['type'] == 'w') {
+ if (!empty($caps['user.add'])) {
$this->action_add();
}
+ else {
+ $this->output->command('set_watermark', 'taskcontent');
+ }
}
/**
diff --git a/lib/kolab_client_output.php b/lib/kolab_client_output.php
index d40c323..f7bb471 100644
--- a/lib/kolab_client_output.php
+++ b/lib/kolab_client_output.php
@@ -227,7 +227,7 @@ class kolab_client_output
}
/**
- * Sets conntent of a HTML object.
+ * Sets content of a HTML object.
*
* @param string $name Object's identifier (HTML ID attribute)
* @param string $content Object's content
@@ -243,6 +243,18 @@ class kolab_client_output
}
/**
+ * Returns content of a HTML object (set with set_object())
+ *
+ * @param string $name Object's identifier (HTML ID attribute)
+ *
+ * @return string Object content
+ */
+ public function get_object($name)
+ {
+ return $this->objects[$name];
+ }
+
+ /**
* Returns HTML template output.
*
* @param string $name Template name
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 7e21852..9205b43 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -51,14 +51,16 @@ class kolab_client_task
/**
* Class constructor.
+ *
+ * @param kolab_client_output $output Optional output object
*/
- public function __construct()
+ public function __construct($output = null)
{
$this->config_init();
$this->devel_mode = $this->config_get('devel_mode', false, Conf::BOOL);
- $this->output_init();
+ $this->output_init($output);
$this->api_init();
ini_set('session.use_cookies', 'On');
@@ -101,8 +103,13 @@ class kolab_client_task
/**
* Output initialization.
*/
- private function output_init()
+ private function output_init($output = null)
{
+ if ($output) {
+ $this->output = $output;
+ return;
+ }
+
$skin = $this->config_get('skin', 'default');
$this->output = new kolab_client_output($skin);
}
@@ -190,18 +197,20 @@ class kolab_client_task
$this->api->set_session_token($user['token']);
- // find user settings
- $res = $this->api->get('user.info', array('user' => $user['id']));
- $res = $res->get();
-
- if (is_array($res) && !empty($res)) {
- $user['language'] = $res['preferredlanguage'];
- $user['fullname'] = $res['cn'];
- }
- // @TODO: why user.info returns empty result for 'cn=Directory Manager' login?
- else if (preg_match('/^cn=([a-zA-Z ]+)/', $login['username'], $m)) {
+ // Find user settings
+ // Don't call API user.info for non-existing users (#1025)
+ if (preg_match('/^cn=([a-z ]+)/i', $login['username'], $m)) {
$user['fullname'] = ucwords($m[1]);
}
+ else {
+ $res = $this->api->get('user.info', array('user' => $user['id']));
+ $res = $res->get();
+
+ if (is_array($res) && !empty($res)) {
+ $user['language'] = $res['preferredlanguage'];
+ $user['fullname'] = $res['cn'];
+ }
+ }
// Save user data
$_SESSION['user'] = $user;
@@ -491,16 +500,13 @@ class kolab_client_task
return '';
}
+ $menu = array();
$task = $this->get_task();
-
- $capabilities = $this->capabilities();
+ $caps = $this->capabilities();
foreach ($this->menu as $idx => $label) {
- //console("$task: $task, idx: $idx, label: $label");
-
if (in_array($task, array('domain', 'group', 'resource', 'role', 'user'))) {
- if (!array_key_exists($task . "." . $idx, $capabilities['actions'])) {
- //console("$task.$idx not in \$capabilities['actions'], skipping", $capabilities['actions']);
+ if (!array_key_exists($task . "." . $idx, $caps['actions'])) {
continue;
}
}
@@ -519,10 +525,7 @@ class kolab_client_task
$class, $idx, $action, $this->translate($label));
}
- if (is_array($menu))
- return '<ul>' . implode("\n", $menu) . '</ul>';
- else
- return '<ul>' . $menu . '</ul>';
+ return '<ul>' . implode("\n", $menu) . '</ul>';
}
/**
@@ -1231,5 +1234,4 @@ class kolab_client_task
return $form;
}
-
}
diff --git a/lib/locale/en.php b/lib/locale/en.php
index cbf9d62..a9d4fac 100644
--- a/lib/locale/en.php
+++ b/lib/locale/en.php
@@ -62,6 +62,7 @@ $LANG['menu.kolab'] = 'Kolab';
$LANG['menu.kolabsys'] = 'Kolab Systems';
$LANG['menu.resources'] = 'Resources';
$LANG['menu.roles'] = 'Roles';
+$LANG['menu.settings'] = 'Settings';
$LANG['menu.technology'] = 'Technology';
$LANG['menu.users'] = 'Users';
diff --git a/lib/locale/en_US.php b/lib/locale/en_US.php
index a9fde09..760f513 100644
--- a/lib/locale/en_US.php
+++ b/lib/locale/en_US.php
@@ -60,6 +60,7 @@ $LANG['menu.kolab'] = 'Kolab';
$LANG['menu.kolabsys'] = 'Kolab Systems';
$LANG['menu.resources'] = 'Resources';
$LANG['menu.roles'] = 'Roles';
+$LANG['menu.settings'] = 'Settings';
$LANG['menu.technology'] = 'Technology';
$LANG['menu.users'] = 'Users';
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 701f818..2fd8899 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -1376,8 +1376,11 @@ function kolab_admin()
return;
this.display_message('user.edit.success');
- this.command('user.list', {page: this.env.list_page});
- this.set_watermark('taskcontent');
+
+ if ($('#userlist').length) {
+ this.command('user.list', {page: this.env.list_page});
+ this.set_watermark('taskcontent');
+ }
};
this.group_info = function(id)
diff --git a/public_html/skins/default/style.css b/public_html/skins/default/style.css
index d8e39ad..ece56b6 100644
--- a/public_html/skins/default/style.css
+++ b/public_html/skins/default/style.css
@@ -747,7 +747,6 @@ div.tabsbar
border-bottom: 1px solid #d0d0d0;
white-space: nowrap;
margin: 10px 5px 0 5px;
- background-color: #f0f0f0;
}
span.tablink,
@@ -888,6 +887,10 @@ fieldset.tabbed
background: url(images/resources.png) center center no-repeat;
}
+#main div.settings span.image {
+ background: url(images/resources.png) center center no-repeat;
+}
+
#main div.domain span.image {
background: url(images/domains.png) center center no-repeat;
}