blob: 96c28c11e9809df4d31d08deba35fd3a5f6a56bc [file] [log] [blame]
Carsten Ziegeler854d28a2011-07-14 11:13:23 +00001/*
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 Valchev4d1167b2011-09-12 14:00:50 +000017var _tabs = false;
18
Carsten Ziegeler854d28a2011-07-14 11:13:23 +000019function pad(value) {
20 if ( value < 10 ) {
21 return "0" + value;
22 }
23 return "" + value;
24}
25
Valentin Valchev4d1167b2011-09-12 14:00:50 +000026function 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 Ziegeler854d28a2011-07-14 11:13:23 +000040function 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 Valchevabcf5402010-04-06 13:42:15 +000046$(document).ready(function() {
Valentin Valchev4d1167b2011-09-12 14:00:50 +000047 $(window).bind( 'hashchange', setSelectedTab);
Valentin Valchevabcf5402010-04-06 13:42:15 +000048 var dlg = $('#waitDlg').dialog({
49 modal : true,
50 autoOpen : false,
51 draggable: false,
52 resizable: false,
53 closeOnEscape: false
54 });
55
Valentin Valchev4d1167b2011-09-12 14:00:50 +000056 _tabs = $('#tabs').tabs({ajaxOptions: {
Valentin Valchevabcf5402010-04-06 13:42:15 +000057 beforeSend : function() { dlg.dialog('open') },
Valentin Valchev4d1167b2011-09-12 14:00:50 +000058 complete : function() { dlg.dialog('close')},
Valentin Valchevabcf5402010-04-06 13:42:15 +000059 }}).tabs('paging');
Carsten Ziegeler854d28a2011-07-14 11:13:23 +000060
Valentin Valchev4d1167b2011-09-12 14:00:50 +000061 setTimeout(setSelectedTab, 1000);
62
Carsten Ziegeler854d28a2011-07-14 11:13:23 +000063 $('.downloadTxt').click(function() { downloadDump('txt')});
64 $('.downloadZip').click(function() { downloadDump('zip')});
Valentin Valchevabcf5402010-04-06 13:42:15 +000065});