From 3fd9f6d353ce09613b0213d67b59c6e930899af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Betn=C3=A9r?= Date: Wed, 12 Apr 2006 21:01:38 +0000 Subject: [PATCH] status page uses /xml-rpc?metod=config First shot at it, nothing is editable and some conf fields are not updated at all. --- admin-root/Makefile.am | 6 +- admin-root/config.html | 207 ++++++++++++++++++++++------------------ admin-root/config.js | 72 ++++++++++++++ admin-root/hdr.html | 3 + admin-root/mt-daapd.css | 4 - win32/nsi/mt-daapd.nsi | 1 + 6 files changed, 192 insertions(+), 101 deletions(-) create mode 100644 admin-root/config.js diff --git a/admin-root/Makefile.am b/admin-root/Makefile.am index f9d674f1..cf03f0d9 100644 --- a/admin-root/Makefile.am +++ b/admin-root/Makefile.am @@ -8,12 +8,14 @@ adminroot_DATA = ftr.html linkOpaque.gif status.html aspl-license.txt \ mt-daapd.css mt-daapd.png config.html index.html required.gif \ gpl-license.html aspl-license.html thanks.html feedback.html \ playlist.html playlist.js smart.html smart.js DAAPApplet-0.1.jar \ - smartpopup.html applet.html mt-daapd.js CREDITS status.js + smartpopup.html applet.html mt-daapd.js CREDITS status.js \ + config.js EXTRA_DIST = ftr.html linkOpaque.gif status.html aspl-license.txt \ gpl-license.txt linkTransparent.gif config-update.html hdr.html \ mt-daapd.css mt-daapd.png config.html index.html required.gif \ gpl-license.html aspl-license.html thanks.html feedback.html \ playlist.html playlist.js smart.html smart.js DAAPApplet-0.1.jar \ - smartpopup.html applet.html mt-daapd.js CREDITS status.js + smartpopup.html applet.html mt-daapd.js CREDITS status.js \ + config.js diff --git a/admin-root/config.html b/admin-root/config.html index 61fb23b1..c8dba311 100644 --- a/admin-root/config.html +++ b/admin-root/config.html @@ -1,105 +1,122 @@ @include hdr.html@ - +

Configuration

-Note that the following fields will only be editable if the + +This is work in progress. no changes saved, some fields not updated, some not even in mt-daapd.conf

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mt-daapd.conf
Web Root
Playlist File
MP3 Directory
Database Directory
Compilation Directories
Logfile
Art Filename
Port -  The port the server should run at; default is 3689.
Server Name -  the name iTunes and other daap clients should see.
Run As
Admin Password -  The password for this administration interface.
MP3 Password -  The password clients need to access this server.
Extensions
Rescan Interval -  How often should mt-daapd look for new files? In seconds.
Scan Type
Always Scan
Compress -  Should browsing data be compressed on the way to the client?
Process .m3u Files - Should m3u files be processed as playlists?
Debug Level -  Possible values are 0 to 9, 9 being the most detailed debug level.
+ + + + + + + + +
@include ftr.html@ diff --git a/admin-root/config.js b/admin-root/config.js new file mode 100644 index 00000000..fce298af --- /dev/null +++ b/admin-root/config.js @@ -0,0 +1,72 @@ +Event.observe(window,'load',function (e) {Config.init();}); + +// Config isn't defined until after the Event.observe above +// I could have put it below Config = ... but I want all window.load events +// at the start of the file +function init() { + Config.init(); +} + +var Config = { + init: function () { + new Ajax.Request('/xml-rpc?method=stats',{method: 'get',onComplete: Config.updateStatus}); + new Ajax.Request('/xml-rpc?method=config',{method: 'get',onComplete: Config.showConfig}); + }, + showConfig: function (request) { + $A(request.responseXML.getElementsByTagName('general')[0].childNodes).each(function (el) { + $(el.nodeName).value = Element.textContent(el); + }); + }, + updateStatus: function (request) { + $('config_path').appendChild(document.createTextNode( + Element.textContent(request.responseXML.getElementsByTagName('config_path')[0]))); + } +} +Object.extend(Element, { + removeChildren: function(element) { + while(element.hasChildNodes()) { + element.removeChild(element.firstChild); + } + }, + textContent: function(node) { + if ((!node) || !node.hasChildNodes()) { + // Empty text node + return ''; + } else { + if (node.textContent) { + // W3C ? + return node.textContent; + } else if (node.text) { + // IE + return node.text; + } + } + // We shouldn't end up here; + return ''; + } +}); +/* Detta script finns att hamta pa http://www.jojoxx.net och + far anvandas fritt sa lange som dessa rader star kvar. */ +function DataDumper(obj,n,prefix){ + var str=""; prefix=(prefix)?prefix:""; n=(n)?n+1:1; var ind=""; for(var i=0;i"); } + } else { + for(var i in obj){ str+=DataDumper(obj[i],n,i+"=>"); } + } + str+=ind+"]\n"; + } + return str; +} diff --git a/admin-root/hdr.html b/admin-root/hdr.html index 44a30080..184c7253 100644 --- a/admin-root/hdr.html +++ b/admin-root/hdr.html @@ -4,6 +4,9 @@ mt-daapd + @ispage config.html::@ + @ispage config.html::@ + @ispage config.html::@ @ispage status.html::@ @ispage status.html::@ @ispage status.html::@ diff --git a/admin-root/mt-daapd.css b/admin-root/mt-daapd.css index 15934933..d9654f28 100644 --- a/admin-root/mt-daapd.css +++ b/admin-root/mt-daapd.css @@ -94,10 +94,6 @@ pre { font-size: 120%; } -input.text -{ border: 0px solid black; - padding: 4px 0px 4px 0.5em; -} .feedbackfield { border: 0px solid black; diff --git a/win32/nsi/mt-daapd.nsi b/win32/nsi/mt-daapd.nsi index eeb4656b..0eb6d248 100644 --- a/win32/nsi/mt-daapd.nsi +++ b/win32/nsi/mt-daapd.nsi @@ -93,6 +93,7 @@ Section "MainSection" SEC01 File "..\..\admin-root\CREDITS" File "..\..\admin-root\config-update.html" File "..\..\admin-root\config.html" + File "..\..\admin-root\config.js" File "..\..\admin-root\aspl-license.txt" File "..\..\admin-root\aspl-license.html" File "..\..\admin-root\applet.html"