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 | */
|
Valentin Valchev | 4d1167b | 2011-09-12 14:00:50 +0000 | [diff] [blame] | 17 | var _tabs = false;
|
| 18 |
|
Carsten Ziegeler | 854d28a | 2011-07-14 11:13:23 +0000 | [diff] [blame] | 19 | function pad(value) {
|
| 20 | if ( value < 10 ) {
|
| 21 | return "0" + value;
|
| 22 | }
|
| 23 | return "" + value;
|
| 24 | }
|
| 25 |
|
Valentin Valchev | 4d1167b | 2011-09-12 14:00:50 +0000 | [diff] [blame] | 26 | function setSelectedTab() {
|
| 27 | var anchor = window.location.hash;
|
| 28 | if (anchor) {
|
| 29 | anchor = pluginRoot + '/' + anchor.substring(1) + '.nfo';
|
| 30 | _tabs.find('ul > li > a').each( function(index, element) {
|
| 31 | if (anchor == $(element).data('href.tabs')) {
|
| 32 | _tabs.tabs('select', index);
|
| 33 | return false;
|
| 34 | }
|
| 35 | return true;
|
| 36 | });
|
| 37 | }
|
| 38 | }
|
| 39 |
|
Carsten Ziegeler | 854d28a | 2011-07-14 11:13:23 +0000 | [diff] [blame] | 40 | function downloadDump(ext) {
|
| 41 | var now = new Date();
|
| 42 | var name = "configuration-status-" + now.getUTCFullYear() + pad(now.getUTCMonth() + 1) + pad(now.getUTCDate()) + "-" + pad(now.getUTCHours()) + pad(now.getUTCMinutes()) + pad(now.getUTCSeconds()) + ".";
|
| 43 | location.href = location.href + "/" + name + ext;
|
| 44 | }
|
| 45 |
|
Valentin Valchev | abcf540 | 2010-04-06 13:42:15 +0000 | [diff] [blame] | 46 | $(document).ready(function() {
|
Valentin Valchev | 4d1167b | 2011-09-12 14:00:50 +0000 | [diff] [blame] | 47 | $(window).bind( 'hashchange', setSelectedTab);
|
Valentin Valchev | abcf540 | 2010-04-06 13:42:15 +0000 | [diff] [blame] | 48 | var dlg = $('#waitDlg').dialog({
|
| 49 | modal : true,
|
| 50 | autoOpen : false,
|
| 51 | draggable: false,
|
| 52 | resizable: false,
|
| 53 | closeOnEscape: false
|
| 54 | });
|
| 55 |
|
Valentin Valchev | 4d1167b | 2011-09-12 14:00:50 +0000 | [diff] [blame] | 56 | _tabs = $('#tabs').tabs({ajaxOptions: {
|
Valentin Valchev | abcf540 | 2010-04-06 13:42:15 +0000 | [diff] [blame] | 57 | beforeSend : function() { dlg.dialog('open') },
|
Valentin Valchev | cdec1c0 | 2012-07-23 13:49:07 +0000 | [diff] [blame] | 58 | complete : function() { dlg.dialog('close')}
|
Valentin Valchev | abcf540 | 2010-04-06 13:42:15 +0000 | [diff] [blame] | 59 | }}).tabs('paging');
|
Carsten Ziegeler | 854d28a | 2011-07-14 11:13:23 +0000 | [diff] [blame] | 60 |
|
Valentin Valchev | 4d1167b | 2011-09-12 14:00:50 +0000 | [diff] [blame] | 61 | setTimeout(setSelectedTab, 1000);
|
| 62 |
|
Carsten Ziegeler | 854d28a | 2011-07-14 11:13:23 +0000 | [diff] [blame] | 63 | $('.downloadTxt').click(function() { downloadDump('txt')});
|
| 64 | $('.downloadZip').click(function() { downloadDump('zip')});
|
Valentin Valchev | abcf540 | 2010-04-06 13:42:15 +0000 | [diff] [blame] | 65 | }); |