diff options
Diffstat (limited to 'lib/srtgui/templates/date-time-test.html')
-rwxr-xr-x | lib/srtgui/templates/date-time-test.html | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/lib/srtgui/templates/date-time-test.html b/lib/srtgui/templates/date-time-test.html new file mode 100755 index 00000000..d123f79c --- /dev/null +++ b/lib/srtgui/templates/date-time-test.html @@ -0,0 +1,88 @@ +{% extends "base.html" %} + +{% load static %} +{% load jobtags %} +{% load humanize %} + +{% block title %} DateTime Test {% endblock %} +{% block pagecontent %} + + <div class="col-md-5"> + <b>DateTime Info</b> + <div class="well"> + <dl class="dl-horizontal"> + <dt>UTC Current Time:</dt> + <dd>{{current_utc}}</dd> + <dt>Alameda Current Time:</dt> + <dd>{{current_ala}}</dd> + <dt>Your Current Time:</dt> + <dd>{{current_local}}</dd> + <dt>Datetime Shift</dt> + <dd>"2021-05-10 13:38:22"|shift_timezone:"{{user.get_timezone_offset}}" => {{ "2021-05-10 13:38:22"|shift_timezone:user.get_timezone_offset }},{{user.get_timezone_offset}}</dd> + </dl> + </div> + </div> + <p><i>Timezone</i> = {{user_timezone}}</p> + + <fieldset style="border: 1px solid Blue; background-color:LightBlue; padding-left: 25px; padding-right: 20px;"> + <button class="execute btn btn-primary btn-lg" id="submit-timezone"> Submit Changes </button> + +<select name="timezone" id="select-timezone"> + + {% for tz in timezone_list %} + + <option value="{{tz}}" {% if user_timezone == tz %}selected{% endif %}>{{tz}}</option> + + {% endfor %} + +</select> +</fieldset> + +<script type="text/javascript"> + + $(document).ready(function() { + function onCommitAjaxSuccess(data, textstatus) { + if (window.console && window.console.log) { + console.log("XHR returned:", data, "(" + textstatus + ")"); + } else { + alert("NO CONSOLE:\n"); + return; + } + if (data.error != "ok") { + alert("error on request:\n" + data.error); + return; + } + location.reload(true); + } + + function onCommitAjaxError(jqXHR, textstatus, error) { + console.log("ERROR:"+error+"|"+textstatus); + alert("XHR errored1:\n" + error + "\n(" + textstatus + ")"); + } + + /* ensure cookie exists {% csrf_token %} */ + function postCommitAjaxRequest(reqdata) { + var ajax = $.ajax({ + type:"POST", + data: reqdata, + url:"{% url 'xhr_date_time_test' %}", + headers: { 'X-CSRFToken': $.cookie("csrftoken")}, + success: onCommitAjaxSuccess, + error: onCommitAjaxError, + }); + } + $('#submit-timezone').click(function(){ + var timezone=$('#select-timezone').val(); + + /* Double check any public status changes */ + postCommitAjaxRequest({ + "action" : 'submit-timezone', + "timezone" : timezone, + }); + }); + + }); + +</script> + +{% endblock %} |