3 commits - lib/client lib/kolab_client_output.php lib/kolab_client_task.php lib/locale public_html/js public_html/skins
Aleksander Machniak
machniak at kolabsys.com
Tue Sep 18 13:55:23 CEST 2012
lib/client/kolab_client_task_domain.php | 5 ++-
lib/client/kolab_client_task_group.php | 5 ++-
lib/client/kolab_client_task_main.php | 13 +++----
lib/client/kolab_client_task_resource.php | 5 ++-
lib/client/kolab_client_task_role.php | 6 ++-
lib/client/kolab_client_task_user.php | 5 ++-
lib/kolab_client_output.php | 14 +++++++-
lib/kolab_client_task.php | 50 +++++++++++++++---------------
lib/locale/en.php | 1
lib/locale/en_US.php | 1
public_html/js/kolab_admin.js | 7 +++-
public_html/skins/default/style.css | 5 ++-
12 files changed, 76 insertions(+), 41 deletions(-)
New commits:
commit f2bf7c79550e23562f60fd27b87a457f8b9e5b88
Merge: 4111a9b 74cc89e
Author: Aleksander Machniak <alec at alec.pl>
Date: Tue Sep 18 13:54:13 2012 +0200
Merge branch 'master' of ssh://git.kolab.org/git/kolab-wap
commit 4111a9bfeb071a39af4da2c826fafa404cd53c79
Author: Aleksander Machniak <alec at alec.pl>
Date: Tue Sep 18 13:53:40 2012 +0200
Don't call user.info for directory manager
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 30302b1..9205b43 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -197,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;
commit 3801726c39ce29d874bc6e2a85f24ada9c4d3069
Author: Aleksander Machniak <alec at alec.pl>
Date: Tue Sep 18 13:29:10 2012 +0200
- Add Settings menu with interface for current user information management.
Settings menu will be used for object types management.
- Fix some bugs and code cleanup
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..30302b1 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);
}
@@ -491,16 +498,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 +523,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 +1232,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 be30a88..3c4199a 100644
--- a/public_html/skins/default/style.css
+++ b/public_html/skins/default/style.css
@@ -740,7 +740,6 @@ div.tabsbar
border-bottom: 1px solid #d0d0d0;
white-space: nowrap;
margin: 10px 5px 0 5px;
- background-color: #f0f0f0;
}
span.tablink,
@@ -881,6 +880,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;
}
More information about the commits
mailing list