summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/client/kolab_client_task_main.php24
-rw-r--r--lib/kolab_client_task.php18
-rw-r--r--lib/locale/en.php2
3 files changed, 34 insertions, 10 deletions
diff --git a/lib/client/kolab_client_task_main.php b/lib/client/kolab_client_task_main.php
index 8abb186..6921377 100644
--- a/lib/client/kolab_client_task_main.php
+++ b/lib/client/kolab_client_task_main.php
@@ -27,15 +27,27 @@ class kolab_client_task_main extends kolab_client_task
protected $_menu = array(
'user' => 'users',
'group' => 'groups',
- 'resource' => 'resources',
'domain' => 'domains',
'role' => 'roles',
+ 'resource' => 'resources',
'about' => 'about',
);
public function action_default()
{
+ // handle domain change
+ if ($domain = $this->get_input('domain', 'GET')) {
+ $result = $this->api->get('system.select_domain', array('domain' => $domain));
+
+ if (!$result->get_error_code()) {
+ $_SESSION['user']['domain'] = $domain;
+ }
+ else {
+ $this->output->command('display_message', $this->translate('error.domainselect'), 'error');
+ }
+ }
+
// assign token
$this->output->set_env('token', $_SESSION['user']['token']);
@@ -50,7 +62,7 @@ class kolab_client_task_main extends kolab_client_task
// @TODO: check capabilities
$capabilities = $this->capabilities();
- $this->menu = Array();
+ $this->menu = array();
foreach ($this->_menu as $task => $api_task) {
if ($task !== "about") {
@@ -64,9 +76,13 @@ class kolab_client_task_main extends kolab_client_task
}
$this->output->assign('tasks', $this->menu);
-
$this->output->assign('main_menu', $this->menu());
$this->output->assign('user', $_SESSION['user']);
- }
+ // Domains list
+ if ($domains = $this->get_domains()) {
+ sort($domains, SORT_LOCALE_STRING);
+ $this->output->set_env('domains', $domains);
+ }
+ }
}
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 910de6c..7e21852 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -181,8 +181,6 @@ class kolab_client_task
if ($login['username']) {
$result = $this->api->login($login['username'], $login['password'], $login['domain']);
- //console($result);
-
if ($token = $result->get('session_token')) {
$user = array(
'token' => $token,
@@ -401,6 +399,18 @@ class kolab_client_task
}
/**
+ * Returns output environment variable value
+ *
+ * @param string $name Variable name
+ *
+ * @return mixed Variable value
+ */
+ public function get_env($name)
+ {
+ return $this->output->get_env($name);
+ }
+
+ /**
* Returns configuration option value.
*
* @param string $name Option name
@@ -661,10 +671,6 @@ class kolab_client_task
{
$post = $this->get_input('login', 'POST');
- $auth = Auth::get_instance();
- $conf = Conf::get_instance();
- $auth->connect();
-
$username = kolab_html::label(array(
'for' => 'login_name',
'content' => $this->translate('login.username')), true)
diff --git a/lib/locale/en.php b/lib/locale/en.php
index a9fde09..cbf9d62 100644
--- a/lib/locale/en.php
+++ b/lib/locale/en.php
@@ -23,6 +23,7 @@ $LANG['domain.system'] = 'System';
$LANG['domain.type_id'] = 'Standard Domain';
$LANG['error'] = 'Error';
+$LANG['error.domainselect'] = 'Unable to change domain!';
$LANG['form.required.empty'] = 'Some of the required fields are empty!';
$LANG['form.maxcount.exceeded'] = 'Maximum count of items exceeded!';
@@ -46,6 +47,7 @@ $LANG['group.uniquemember'] = 'Members';
$LANG['info'] = 'Information';
$LANG['internalerror'] = 'Internal system error!';
$LANG['loading'] = 'Loading...';
+
$LANG['login.username'] = 'Username:';
$LANG['login.password'] = 'Password:';
$LANG['login.domain'] = 'Domain:';