diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-06-15 21:12:26 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-06-15 21:12:26 +0100 |
commit | 13c75e73812927359ca8a1d606ed33bd6a75eea5 (patch) | |
tree | 9097bd0c9c5fbace84ff4489bf893e4c7b8b3c5a /static/javascript | |
parent | 8f6935203a05f3f07d7e0eef8ec47981fe997c36 (diff) |
Rejigged column names.. and javascript location.
--HG--
rename : static/mauve_utils.js => static/javascript/mauve_utils.js
Diffstat (limited to 'static/javascript')
l--------- | static/javascript | 1 | ||||
-rw-r--r-- | static/javascript/mauve_utils.js | 56 |
2 files changed, 56 insertions, 1 deletions
diff --git a/static/javascript b/static/javascript deleted file mode 120000 index e3b95b4..0000000 --- a/static/javascript +++ /dev/null @@ -1 +0,0 @@ -/usr/share/javascript
\ No newline at end of file diff --git a/static/javascript/mauve_utils.js b/static/javascript/mauve_utils.js new file mode 100644 index 0000000..3012ca3 --- /dev/null +++ b/static/javascript/mauve_utils.js @@ -0,0 +1,56 @@ + +function updateDate() { + // + // Date.getTime() returns *milliseconds* + // + var this_date = workoutDate( $('#n_hours').val(), $('#type_hours').val() ); + $('#ack_until_text').html("(until "+humanDate(this_date)+")"); + $('#ack_until').val(this_date.getTime()/1000); + + return false; +} + +function workoutDate(h, t) { + var new_date = null; + + // + // Use a synchronous ajax request to fetch the date. Note that + // Date.getTime() returns milliseconds.. + // + $.ajax({ + url: '/ajax/time_in_x_hours/'+h+"/"+t, + async: false, + success: function(data) { new_date = new Date ( new Number(data) * 1000 ); } + }); + + return new_date; +} + + +function humanDate(d) { + var new_date = null; + // + // Use a synchronous ajax convert a date to a human string. NB Date.getTime() + // returns *milliseconds* + // + $.ajax({ + url: '/ajax/time_to_s_human/'+d.getTime()/1000, + async: false, + success: function(data) { new_date = data; } + }); + + return new_date; +} + +function fetchDetail(a) { + // Use a synchronous ajax request to fetch the date. + $.get('/ajax/alerts_table_alert_detail/'+a, + function(data) { + $('#tr_summary_'+a).after(data); + // Only fetch the data once. + $('#a_detail_'+a).attr("onclick",null).click(function() { $('#tr_detail_'+a).toggle(); return false; }); + }); + + return false; +} + |