3 commits - lib/client public_html/js public_html/skins
Aleksander Machniak
machniak at kolabsys.com
Wed Oct 3 20:12:24 CEST 2012
lib/client/kolab_client_task_settings.php | 2
public_html/js/kolab_admin.js | 274 +++++++++---------------------
public_html/skins/default/style.css | 3
3 files changed, 94 insertions(+), 185 deletions(-)
New commits:
commit 09e33781fda8be2c314d16a2b7d7ea4a837a1b65
Author: Aleksander Machniak <alec at alec.pl>
Date: Wed Oct 3 20:11:41 2012 +0200
Added lost domain_list and domain_delete methods
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 57bc970..928ef30 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -1250,6 +1250,17 @@ function kolab_admin()
this.http_post('domain.info', {id: id});
};
+ this.domain_list = function(props)
+ {
+ this.list_handler('domain', props);
+ };
+
+ this.domain_delete = function(domainid)
+ {
+ this.set_busy(true, 'deleting');
+ this.api_post('domain.delete', {domain: domainid}, 'domain_delete_response');
+ };
+
this.domain_save = function(reload, section)
{
var data = this.serialize_form('#'+this.env.form_id),
@@ -1272,6 +1283,11 @@ function kolab_admin()
this.api_post('domain.' + action, data, 'domain_' + action + '_response');
};
+ this.domain_delete_response = function(response)
+ {
+ this.response_handler(response, 'domain.delete', 'domain.list');
+ };
+
this.domain_add_response = function(response)
{
this.response_handler(response, 'domain.add', 'domain.list');
commit 03e69d92840ee74ea0fcf20a77138e18ddb8230d
Author: Aleksander Machniak <alec at alec.pl>
Date: Wed Oct 3 20:06:52 2012 +0200
Unified list/edit/add methods for all object types
diff --git a/lib/client/kolab_client_task_settings.php b/lib/client/kolab_client_task_settings.php
index 1e87de5..4dffdb6 100644
--- a/lib/client/kolab_client_task_settings.php
+++ b/lib/client/kolab_client_task_settings.php
@@ -284,7 +284,7 @@ class kolab_client_task_settings extends kolab_client_task
}
$table = kolab_html::table(array(
- 'id' => 'typelist',
+ 'id' => 'settingstypelist',
'class' => 'list',
'head' => $head,
'body' => $rows,
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index e4bf81e..57bc970 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -1274,22 +1274,12 @@ function kolab_admin()
this.domain_add_response = function(response)
{
- if (!this.api_response(response))
- return;
-
- this.display_message('domain.add.success');
- this.command('domain.list', {page: this.env.list_page});
- this.set_watermark('taskcontent');
+ this.response_handler(response, 'domain.add', 'domain.list');
};
this.domain_edit_response = function(response)
{
- if (!this.api_response(response))
- return;
-
- this.display_message('domain.edit.success');
- this.command('domain.list', {page: this.env.list_page});
- this.set_watermark('taskcontent');
+ this.response_handler(response, 'domain.edit', 'domain.list');
};
this.user_info = function(id)
@@ -1299,13 +1289,7 @@ function kolab_admin()
this.user_list = function(props)
{
- if (!props)
- props = {};
-
- if (props.search === undefined && this.env.search_request)
- props.search_request = this.env.search_request;
-
- this.http_post('user.list', props);
+ this.list_handler('user', props);
};
this.user_delete = function(userid)
@@ -1314,22 +1298,6 @@ function kolab_admin()
this.api_post('user.delete', {user: userid}, 'user_delete_response');
};
- this.user_delete_response = function(response)
- {
- if (!this.api_response(response))
- return;
-
- var page = this.env.list_page;
-
- // goto previous page if last user on the current page has been deleted
- if (this.env.list_count)
- page -= 1;
-
- this.display_message('user.delete.success');
- this.command('user.list', {page: page});
- this.set_watermark('taskcontent');
- };
-
this.user_save = function(reload, section)
{
var data = this.serialize_form('#'+this.env.form_id),
@@ -1360,27 +1328,19 @@ function kolab_admin()
this.api_post('user.' + action, data, 'user_' + action + '_response');
};
- this.user_add_response = function(response)
+ this.user_delete_response = function(response)
{
- if (!this.api_response(response))
- return;
+ this.response_handler(response, 'user.delete', 'user.list');
+ };
- this.display_message('user.add.success');
- this.command('user.list', {page: this.env.list_page});
- this.set_watermark('taskcontent');
+ this.user_add_response = function(response)
+ {
+ this.response_handler(response, 'user.add', 'user.list');
};
this.user_edit_response = function(response)
{
- if (!this.api_response(response))
- return;
-
- this.display_message('user.edit.success');
-
- if ($('#userlist').length) {
- this.command('user.list', {page: this.env.list_page});
- this.set_watermark('taskcontent');
- }
+ this.response_handler(response, 'user.edit', 'user.list');
};
this.group_info = function(id)
@@ -1390,13 +1350,7 @@ function kolab_admin()
this.group_list = function(props)
{
- if (!props)
- props = {};
-
- if (props.search === undefined && this.env.search_request)
- props.search_request = this.env.search_request;
-
- this.http_post('group.list', props);
+ this.list_handler('group', props);
};
this.group_delete = function(groupid)
@@ -1405,22 +1359,6 @@ function kolab_admin()
this.api_post('group.delete', {group: groupid}, 'group_delete_response');
};
- this.group_delete_response = function(response)
- {
- if (!this.api_response(response))
- return;
-
- var page = this.env.list_page;
-
- // goto previous page if last record on the current page has been deleted
- if (this.env.list_count)
- page -= 1;
-
- this.display_message('group.delete.success');
- this.command('group.list', {page: page});
- this.set_watermark('taskcontent');
- };
-
this.group_save = function(reload, section)
{
var data = this.serialize_form('#'+this.env.form_id),
@@ -1443,24 +1381,19 @@ function kolab_admin()
this.api_post('group.' + action, data, 'group_' + action + '_response');
};
- this.group_add_response = function(response)
+ this.group_delete_response = function(response)
{
- if (!this.api_response(response))
- return;
+ this.response_handler(response, 'group.delete', 'group.list');
+ };
- this.display_message('group.add.success');
- this.command('group.list', {page: this.env.list_page});
- this.set_watermark('taskcontent');
+ this.group_add_response = function(response)
+ {
+ this.response_handler(response, 'group.add', 'group.list');
};
this.group_edit_response = function(response)
{
- if (!this.api_response(response))
- return;
-
- this.display_message('group.edit.success');
- this.command('group.list', {page: this.env.list_page});
- this.set_watermark('taskcontent');
+ this.response_handler(response, 'group.edit', 'group.list');
};
this.resource_info = function(id)
@@ -1470,13 +1403,7 @@ function kolab_admin()
this.resource_list = function(props)
{
- if (!props)
- props = {};
-
- if (props.search === undefined && this.env.search_request)
- props.search_request = this.env.search_request;
-
- this.http_post('resource.list', props);
+ this.list_handler('resource', props);
};
this.resource_delete = function(resourceid)
@@ -1485,22 +1412,6 @@ function kolab_admin()
this.api_post('resource.delete', {resource: resourceid}, 'resource_delete_response');
};
- this.resource_delete_response = function(response)
- {
- if (!this.api_response(response))
- return;
-
- var page = this.env.list_page;
-
- // goto previous page if last record on the current page has been deleted
- if (this.env.list_count)
- page -= 1;
-
- this.display_message('resource.delete.success');
- this.command('resource.list', {page: page});
- this.set_watermark('taskcontent');
- };
-
this.resource_save = function(reload, section)
{
var data = this.serialize_form('#'+this.env.form_id),
@@ -1523,24 +1434,19 @@ function kolab_admin()
this.api_post('resource.' + action, data, 'resource_' + action + '_response');
};
- this.resource_add_response = function(response)
+ this.resource_delete_response = function(response)
{
- if (!this.api_response(response))
- return;
+ this.response_handler(response, 'resource.delete', 'resource.list');
+ };
- this.display_message('resource.add.success');
- this.command('resource.list', {page: this.env.list_page});
- this.set_watermark('taskcontent');
+ this.resource_add_response = function(response)
+ {
+ this.response_handler(response, 'resource.add', 'resource.list');
};
this.resource_edit_response = function(response)
{
- if (!this.api_response(response))
- return;
-
- this.display_message('resource.edit.success');
- this.command('resource.list', {page: this.env.list_page});
- this.set_watermark('taskcontent');
+ this.response_handler(response, 'resource.edit', 'resource.list');
};
this.role_info = function(id)
@@ -1550,13 +1456,7 @@ function kolab_admin()
this.role_list = function(props)
{
- if (!props)
- props = {};
-
- if (props.search === undefined && this.env.search_request)
- props.search_request = this.env.search_request;
-
- this.http_post('role.list', props);
+ this.list_handler('role', props);
};
this.role_delete = function(roleid)
@@ -1565,22 +1465,6 @@ function kolab_admin()
this.api_post('role.delete', {role: roleid}, 'role_delete_response');
};
- this.role_delete_response = function(response)
- {
- if (!this.api_response(response))
- return;
-
- var page = this.env.list_page;
-
- // goto previous page if last record on the current page has been deleted
- if (this.env.list_count)
- page -= 1;
-
- this.display_message('role.delete.success');
- this.command('role.list', {page: page});
- this.set_watermark('taskcontent');
- };
-
this.role_save = function(reload, section)
{
var data = this.serialize_form('#'+this.env.form_id),
@@ -1603,24 +1487,19 @@ function kolab_admin()
this.api_post('role.' + action, data, 'role_' + action + '_response');
};
- this.role_add_response = function(response)
+ this.role_delete_response = function(response)
{
- if (!this.api_response(response))
- return;
+ this.response_handler(response, 'role.delete', 'role.list');
+ };
- this.display_message('role.add.success');
- this.command('role.list', {page: this.env.list_page});
- this.set_watermark('taskcontent');
+ this.role_add_response = function(response)
+ {
+ this.response_handler(response, 'role.add', 'role.list');
};
this.role_edit_response = function(response)
{
- if (!this.api_response(response))
- return;
-
- this.display_message('role.edit.success');
- this.command('role.list', {page: this.env.list_page});
- this.set_watermark('taskcontent');
+ this.response_handler(response, 'role.edit', 'role.list');
};
this.settings_type_info = function(id)
@@ -1652,22 +1531,6 @@ function kolab_admin()
this.api_post('type.delete', this.type_id_parse(id), 'type_delete_response');
};
- this.type_delete_response = function(response)
- {
- if (!this.api_response(response))
- return;
-
- var page = this.env.list_page;
-
- // goto previous page if last record on the current page has been deleted
- if (this.env.list_count)
- page -= 1;
-
- this.display_message('type.delete.success');
- this.command('settings.type_list', {page: page});
- this.set_watermark('taskcontent');
- };
-
this.type_save = function(reload, section)
{
var i, attr, request = {},
@@ -1740,30 +1603,59 @@ function kolab_admin()
this.api_post('type.' + action, request, 'type_' + action + '_response');
};
- this.type_add_response = function(response)
+ this.type_delete_response = function(response)
{
- if (!this.api_response(response))
- return;
+ this.response_handler(response, 'type.delete', 'settings.type_list');
+ };
- this.display_message('type.add.success');
- this.command('settings.type_list', {page: this.env.list_page});
- this.set_watermark('taskcontent');
+ this.type_add_response = function(response)
+ {
+ this.response_handler(response, 'type.add', 'settings.type_list');
};
this.type_edit_response = function(response)
{
- if (!this.api_response(response))
- return;
-
- this.display_message('type.edit.success');
- this.command('settings.type_list', {page: this.env.list_page});
- this.set_watermark('taskcontent');
+ this.response_handler(response, 'type.edit', 'settings.type_list');
};
/*********************************************************/
/********* Various helper methods *********/
/*********************************************************/
+ // universal API response handler
+ this.response_handler = function(response, action, list)
+ {
+ if (!this.api_response(response))
+ return;
+
+ this.display_message(action + '.success');
+
+ var page = this.env.list_page,
+ list_id = list.replace(/[^a-z]/, '');
+
+ // if objects list exists
+ if ($('#'+list_id).length) {
+ // goto previous page if last record on the current page has been deleted
+ if (action.match(/\.delete/) && this.env.list_count)
+ page -= 1;
+
+ this.command(list, {page: page});
+ this.set_watermark('taskcontent');
+ }
+ };
+
+ // universal list request handler
+ this.list_handler = function(type, props)
+ {
+ if (!props)
+ props = {};
+
+ if (props.search === undefined && this.env.search_request)
+ props.search_request = this.env.search_request;
+
+ this.http_post(type + '.list', props);
+ };
+
// Parses object type identifier
this.type_id_parse = function(id)
{
commit f73af9c12b8bf05ea330a9d8de87dc83b9f75723
Author: Aleksander Machniak <alec at alec.pl>
Date: Wed Oct 3 19:27:44 2012 +0200
Fix text wrapping in #loading element
diff --git a/public_html/skins/default/style.css b/public_html/skins/default/style.css
index cf597ee..16dd1a2 100644
--- a/public_html/skins/default/style.css
+++ b/public_html/skins/default/style.css
@@ -243,7 +243,7 @@ td.label {
display: none;
top: 2px;
left: 15px;
- width: 75px;
+ width: 150px;
height: 18px;
padding-left: 86px;
color: #f8fcff;
@@ -251,6 +251,7 @@ td.label {
text-shadow: black 1px 1px;
z-index: 1;
background: url(images/loading.gif) 0 3px no-repeat;
+ white-space: nowrap;
}
#topmenu .logout {
More information about the commits
mailing list