summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorLeonardo Sápiras2010-06-09 19:40:20 +0000
committerioguix2010-06-09 19:40:20 +0000
commit6134a181d1910910021d52b196601a3fa6775c39 (patch)
tree6538b2a0437d7a26c3bee3aca8bcf4bb2dda6cad /js
parent4029a6263354d777c3b9760d8e3fa8ac3f44c13a (diff)
Add auto-refresh process and prepared xact using ajax
This patch rename the existing js/locks.js as js/database.js and factorise the code to use it from both page.
Diffstat (limited to 'js')
-rw-r--r--js/locks.js64
1 files changed, 0 insertions, 64 deletions
diff --git a/js/locks.js b/js/locks.js
deleted file mode 100644
index d532bd6f..00000000
--- a/js/locks.js
+++ /dev/null
@@ -1,64 +0,0 @@
-$(document).ready(function() {
-
- var timeid = query = null;
- var controlLink = $('#control');
- var errmsg = $('<p class="errmsg">'+Database.errmsg+'</p>')
- .insertBefore(controlLink)
- .hide();
- var loading = $('<img class="loading" alt="[loading]" src="'+ Database.load_icon +'" />')
- .insertAfter(controlLink)
- .hide();
-
- function refreshLocksTable() {
- if (Database.ajax_time_refresh > 0) {
- loading.show();
- query = $.ajax({
- type: 'GET',
- dataType: 'html',
- data: {server: Database.server, database: Database.dbname, action: 'refresh_locks'},
- url: 'database.php',
- cache: false,
- contentType: 'application/x-www-form-urlencoded',
- success: function(html) {
- $('#locks_block').html(html);
- timeid = window.setTimeout(refreshLocksTable, Database.ajax_time_refresh)
- },
- error: function() {
- controlLink.click();
- errmsg.show();
- },
- complete: function () {
- loading.hide();
- }
- });
- }
- }
-
- controlLink.toggle(
- function() {
- $(errmsg).hide();
- timeid = window.setTimeout(refreshLocksTable, Database.ajax_time_refresh);
- controlLink.html('<img src="'+ Database.str_stop.icon +'" alt="" />&nbsp;'
- + Database.str_stop.text + '&nbsp;&nbsp;&nbsp;'
- );
- },
- function() {
- $(errmsg).hide();
- $(loading).hide();
- window.clearInterval(timeid);
- query.abort();
- controlLink.html('<img src="'+ Database.str_start.icon +'" alt="" />&nbsp;'
- + Database.str_start.text
- );
- }
- );
-
- /* preload images */
- $('#control img').hide()
- .attr('src', Database.str_start.icon)
- .attr('src', Database.str_stop.icon)
- .show();
-
- /* start refreshing */
- controlLink.click();
-});