summaryrefslogtreecommitdiff
path: root/public_html
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-05-27 09:18:22 (GMT)
committerAleksander Machniak <alec@alec.pl>2013-05-27 09:18:22 (GMT)
commite2054aa50bd5ca07b6cc95e045d9178862ca511f (patch)
tree56307227a7b918c7d89b66cd75d207b1353ecef4 /public_html
parentc706af610ca487dfb6acea0b9147367603d7642d (diff)
downloadkolab-wap-e2054aa50bd5ca07b6cc95e045d9178862ca511f.tar.gz
Update domain selector after adding/removing domain (Bug #1761)
Diffstat (limited to 'public_html')
-rw-r--r--public_html/js/kolab_admin.js56
-rw-r--r--public_html/skins/default/style.css7
-rw-r--r--public_html/skins/default/ui.js14
3 files changed, 50 insertions, 27 deletions
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 0f93fcf..f3281fd 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -284,7 +284,7 @@ function kolab_admin()
return $.ajax({
type: 'POST', url: url, data: postdata, dataType: 'json',
- success: function(response) { kadm.http_response(response); },
+ success: function(response) { kadm.http_response(response, action); },
error: function(o, status, err) { kadm.http_error(o, status, err); }
});
};
@@ -307,7 +307,7 @@ function kolab_admin()
};
// handle HTTP response
- this.http_response = function(response)
+ this.http_response = function(response, action)
{
var i;
@@ -334,6 +334,7 @@ function kolab_admin()
if (response.exec)
eval(response.exec);
+ response.action = action;
this.trigger_event('http-response', response);
};
@@ -980,25 +981,34 @@ function kolab_admin()
{
var e = $(form_element),
form = form_element.form,
- elem = $('<span class="link"></span>'),
- area = $('<span class="listarea autocomplete select popup"></span>'),
- content = $('<span class="listcontent"></span>'),
+ name = form_element.name,
+ elem = $('#selectlabel_' + name),
+ area = $('<span class="listarea autocomplete select popup" id="selectarea_' + name + '"></span>'),
+ content = $('<span class="listcontent" id="selectcontent_' + name + '"></span>'),
list = this.env.assoc_fields ? this.env.assoc_fields[form_element.name] : [];
- elem.text(e.val()).css({cursor: 'pointer'})
- .click(function(e) {
- var popup = $('span.listarea', this.parentNode);
- kadm.popup_show(e, popup);
- $('input', popup).val('').focus();
- $('span.listcontent > span.listelement', popup).removeClass('selected').show();
- })
- .appendTo(form_element.parentNode);
+ if (elem.length) {
+ $('#selectarea_' + name).remove();
+ $('#selectcontent_' + name).remove();
+ }
+ else {
+ elem = $('<span class="link" id="selectlabel_' + name + '"></span>')
+ .css({cursor: 'pointer'})
+ .click(function(e) {
+ var popup = $('span.listarea', this.parentNode);
+ kadm.popup_show(e, popup);
+ $('input', popup).val('').focus();
+ $('span.listcontent > span.listelement', popup).removeClass('selected').show();
+ })
+ .appendTo(form_element.parentNode);
+ }
+
+ elem.text(e.val());
if (list.length <= 1)
return;
if (form_element.type != 'hidden') e.hide();
- area.hide();
elem = this.form_list_element(form, {
autocomplete: true,
@@ -1007,6 +1017,7 @@ function kolab_admin()
elem.appendTo(area);
content.appendTo(area);
+ area.hide().appendTo(form_element.parentNode);
// popup events
$('input', area)
@@ -1092,8 +1103,6 @@ function kolab_admin()
var elem = kadm.form_select_option_element(form, {value: v, key: v, element: e});
elem.appendTo(content);
});
-
- area.appendTo(form_element.parentNode);
};
// Creates option element for smart select
@@ -1403,17 +1412,17 @@ function kolab_admin()
this.domain_delete_response = function(response)
{
- this.response_handler(response, 'domain.delete', 'domain.list');
+ this.response_handler(response, 'domain.delete', 'domain.list', {refresh: 1});
};
this.domain_add_response = function(response)
{
- this.response_handler(response, 'domain.add', 'domain.list');
+ this.response_handler(response, 'domain.add', 'domain.list', {refresh: 1});
};
this.domain_edit_response = function(response)
{
- this.response_handler(response, 'domain.edit', 'domain.list');
+ this.response_handler(response, 'domain.edit', 'domain.list', {refresh: 1});
};
this.user_info = function(id)
@@ -1689,7 +1698,6 @@ function kolab_admin()
this.response_handler(response, 'sharedfolder.edit', 'sharedfolder.list');
};
-
this.settings_type_info = function(id)
{
this.http_post('settings.type_info', {id: id});
@@ -1825,7 +1833,7 @@ function kolab_admin()
/*********************************************************/
// universal API response handler
- this.response_handler = function(response, action, list)
+ this.response_handler = function(response, action, list, list_params)
{
if (!this.api_response(response))
return;
@@ -1841,7 +1849,11 @@ function kolab_admin()
if (this.env.list_page > 1 && this.env.list_size == 1 && action.match(/\.delete/))
page -= 1;
- this.command(list, {page: page});
+ if (!list_params)
+ list_params = {};
+
+ list_params.page = page;
+ this.command(list, list_params);
this.set_watermark('taskcontent');
}
};
diff --git a/public_html/skins/default/style.css b/public_html/skins/default/style.css
index fa808c6..6647caa 100644
--- a/public_html/skins/default/style.css
+++ b/public_html/skins/default/style.css
@@ -151,8 +151,8 @@ td.label {
color: #aaa;
font-size: 11px;
padding-top: 2px;
- display: inline-block;
- height: 18px;
+ height: 20px;
+ line-height: 20px;
}
#navigation {
@@ -257,7 +257,7 @@ td.label {
}
#topmenu .logout {
- background: url(images/buttons.png) -1px -100px no-repeat;
+ background: url(images/buttons.png) -1px -101px no-repeat;
padding-left: 20px;
margin-right: 10px;
color: white;
@@ -604,6 +604,7 @@ span.listelement {
padding: 0;
margin: 0;
height: 18px;
+ line-height: 18px;
overflow: hidden;
border-top: 1px solid #d0d0d0;
white-space: nowrap;
diff --git a/public_html/skins/default/ui.js b/public_html/skins/default/ui.js
index 45bfd51..ac56bc7 100644
--- a/public_html/skins/default/ui.js
+++ b/public_html/skins/default/ui.js
@@ -161,12 +161,22 @@ function ui_resize()
function ui_load()
{
domain_selector();
-}
+};
+
+// API response handler
+function http_response(response)
+{
+ ui_resize();
+
+ // update domain selector
+ if (response.action == 'domain.list')
+ domain_selector();
+};
/**
* UI Initialization
*/
kadm.add_event_listener('form-load', form_load);
-kadm.add_event_listener('http-response', ui_resize);
+kadm.add_event_listener('http-response', http_response);
//$(window).resize(function() { ui_resize(); });
$(window).load(function() { ui_load(); });