Carsten Ziegeler | 854d28a | 2011-07-14 11:13:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | * contributor license agreements. See the NOTICE file distributed with |
| 4 | * this work for additional information regarding copyright ownership. |
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | * (the "License"); you may not use this file except in compliance with |
| 7 | * the License. You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
Felix Meschberger | fbdfa02 | 2010-02-17 09:12:34 +0000 | [diff] [blame] | 17 | /* shuts down server after [num] seconds */ |
| 18 | function shutdown(num, formname, elemid) { |
| 19 | var elem = $('#' + elemid); |
| 20 | var secs=" second"; |
| 21 | var ellipsis="..."; |
| 22 | if (num > 0) { |
| 23 | if (num != 1) { |
| 24 | secs+="s"; |
| 25 | } |
| 26 | elem.html(num+secs+ellipsis); |
| 27 | setTimeout('shutdown('+(--num)+', "'+formname+'", "'+elemid+'")',1000); |
| 28 | } else { |
| 29 | $('#' + formname).submit(); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | /* aborts server shutdown and redirects to [target] */ |
| 34 | function abort(target) { |
| 35 | top.location.href=target; |
| 36 | } |
| 37 | |
| 38 | /* displays a date in the user's local timezone */ |
| 39 | function localTm(time) { |
| 40 | return (time ? new Date(time) : new Date()).toLocaleString(); |
| 41 | } |
| 42 | /* fill in the data */ |
| 43 | $(document).ready(function() { |
| 44 | if(typeof statData == 'undefined') return; |
| 45 | for(i in statData) { |
| 46 | var target = $('#' + i); |
| 47 | if (target.val()) { |
| 48 | target.val(statData[i]); |
| 49 | } else { |
| 50 | target.text(statData[i]); |
| 51 | } |
| 52 | } |
Felix Meschberger | fbdfa02 | 2010-02-17 09:12:34 +0000 | [diff] [blame] | 53 | var st = statData.shutdownTimer; |
| 54 | $('#shutdownform').css('display', st ? 'none' : 'block'); |
| 55 | $('#shutdownform2').css('display', st ? 'block' : 'none'); |
| 56 | $('#shutdown_type').val(statData.shutdownType); |
| 57 | }); |