diff --git a/cgi-bin/configshow.py b/cgi-bin/configshow.py index ea97f082..d1e90f91 100644 --- a/cgi-bin/configshow.py +++ b/cgi-bin/configshow.py @@ -5,6 +5,7 @@ import os import funct import paramiko import configparser +from datetime import datetime from pytz import timezone form = cgi.FieldStorage() diff --git a/cgi-bin/funct.py b/cgi-bin/funct.py index 293bb54c..6c6a8216 100644 --- a/cgi-bin/funct.py +++ b/cgi-bin/funct.py @@ -129,6 +129,7 @@ def head(title): '' '' '' + '' '' '' '' diff --git a/cgi-bin/options.py b/cgi-bin/options.py index 777bb5b1..0b183f4e 100644 --- a/cgi-bin/options.py +++ b/cgi-bin/options.py @@ -153,7 +153,6 @@ if serv is not None and form.getvalue('right') is not None: if serv is not None and form.getvalue('act') == "configShow": import os - from paramiko import SSHClient from datetime import datetime from pytz import timezone @@ -165,11 +164,7 @@ if serv is not None and form.getvalue('act') == "configShow": funct.get_config(serv, cfg) - print('') + print('') print("

Config from %s

" % serv) print('

' 'Expand all' diff --git a/inc/configshow.js b/inc/configshow.js new file mode 100644 index 00000000..4d2c0f49 --- /dev/null +++ b/inc/configshow.js @@ -0,0 +1,32 @@ +$( function() { + $( ".configShow" ).accordion({ + collapsible: true, + heightStyle: "content", + icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" } + }); + var headers = $('.configShow .accordion-header'); + var contentAreas = $('.configShow .ui-accordion-content ').hide() + .first().show().end(); + var expandLink = $('.accordion-expand-all'); + headers.click(function() { + // close all panels + contentAreas.slideUp(); + // open the appropriate panel + $(this).next().slideDown(); + // reset Expand all button + expandLink.text('Expand all') + .data('isAllOpen', false); + // stop page scroll + return false; + }); + // hook up the expand/collapse all + expandLink.click(function(){ + var isAllOpen = !$(this).data('isAllOpen'); + console.log({isAllOpen: isAllOpen, contentAreas: contentAreas}) + contentAreas[isAllOpen? 'slideDown': 'slideUp'](); + + expandLink.text(isAllOpen? 'Collapse All': 'Expand all') + .data('isAllOpen', isAllOpen); + }); + +}) \ No newline at end of file diff --git a/inc/script.js b/inc/script.js index 3dedfbca..cc08ee06 100644 --- a/inc/script.js +++ b/inc/script.js @@ -248,38 +248,6 @@ $( function() { $( "input[type=checkbox]" ).checkboxradio(); $( "#number" ).spinner(); $( ".controlgroup" ).controlgroup(); - $( ".configShow" ).accordion({ - collapsible: true, - heightStyle: "content", - icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" } - }); - var headers = $('.configShow .accordion-header'); - var contentAreas = $('.configShow .ui-accordion-content ').hide() - .first().show().end(); - var expandLink = $('.accordion-expand-all'); - - // add the accordion functionality - headers.click(function() { - // close all panels - contentAreas.slideUp(); - // open the appropriate panel - $(this).next().slideDown(); - // reset Expand all button - expandLink.text('Expand all') - .data('isAllOpen', false); - // stop page scroll - return false; - }); - - // hook up the expand/collapse all - expandLink.click(function(){ - var isAllOpen = !$(this).data('isAllOpen'); - console.log({isAllOpen: isAllOpen, contentAreas: contentAreas}) - contentAreas[isAllOpen? 'slideDown': 'slideUp'](); - - expandLink.text(isAllOpen? 'Collapse All': 'Expand all') - .data('isAllOpen', isAllOpen); - }); function ajaxActionServers(action, id) { var bad_ans = 'Bad config, check please';