status page uses /xml-rpc?metod=config

First shot at it, nothing is editable and some conf fields are
not updated at all.
This commit is contained in:
Anders Betnér 2006-04-12 21:01:38 +00:00
parent 267528f070
commit 3fd9f6d353
6 changed files with 192 additions and 101 deletions

View File

@ -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 \ mt-daapd.css mt-daapd.png config.html index.html required.gif \
gpl-license.html aspl-license.html thanks.html feedback.html \ gpl-license.html aspl-license.html thanks.html feedback.html \
playlist.html playlist.js smart.html smart.js DAAPApplet-0.1.jar \ 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 \ EXTRA_DIST = ftr.html linkOpaque.gif status.html aspl-license.txt \
gpl-license.txt linkTransparent.gif config-update.html hdr.html \ gpl-license.txt linkTransparent.gif config-update.html hdr.html \
mt-daapd.css mt-daapd.png config.html index.html required.gif \ mt-daapd.css mt-daapd.png config.html index.html required.gif \
gpl-license.html aspl-license.html thanks.html feedback.html \ gpl-license.html aspl-license.html thanks.html feedback.html \
playlist.html playlist.js smart.html smart.js DAAPApplet-0.1.jar \ 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

View File

@ -1,105 +1,122 @@
@include hdr.html@ @include hdr.html@
<style type="text/css">
label {
float: left;
width: 11em;
font: icon;
padding-top: .3em;
padding-left: 1em;
}
input {
font: icon;
}
select {
font: icon;
}
</style>
<h1>Configuration</h1> <h1>Configuration</h1>
<p class="description"> <p class="description">
Note that the following fields will only be editable if the <!-- Note that the following fields will only be editable if the
configuration file itself is writable by the mt-daapd server. If you configuration file itself is writable by the mt-daapd server. If you
make changes to these settings, they will not be reflected in the make changes to these settings, they will not be reflected in the
running server. The server must be restarted for these values to running server. The server must be restarted for these values to
take effect.</p> take effect.-->
This is work in progress. no changes saved, some fields not updated, some not even in mt-daapd.conf</p>
<form method="post" action="/config-update.html"> <form method="get" action="#">
<table> <div class="naviheader">Server</div>
<tr> <div class="navibox">
<th>mt-daapd.conf</th> <span style="float: left; width: 11em; font:icon;padding-top: .3em; padding-left: 1em;">Config File</span>
<th class="config"><input type="submit" name="SUBMIT" value="Submit"/></th> <span id="config_path"></span><br />
</tr> <div style="clear: both;"></div>
<tr> <label for="servername">Server Name</label>
<td class="configname">Web Root</td> <input class="text" type="text" id="servername" value="" />
<td class="configdata"><input class="text" type="text" @READONLY@ name="WEB_ROOT" size="80" value="@WEB_ROOT@" /></td> &nbsp;the name iTunes and other daap clients should see.<br />
</tr> <label for="web_root">Web Root</label>
<tr> <input class="text" type="text" id="web_root" size="80" value="" /><br />
<td class="configname">Playlist File</td> <label for="port">Port</label>
<td class="configdata"><input class="text" type="text" @READONLY@ name="PLAYLIST" size="80" value="@PLAYLIST@" /></td> <input class="text" type="text" id="port" value="" />
</tr> &nbsp;The port the server should run at; default is 3689.<br />
<tr> <label for="logfile">Logfile</label>
<td class="configname">MP3 Directory</td> <input class="text" type="text" id="logfile" size="80" value="" /><br />
<td class="configdata"><input class="text" type="text" @READONLY@ name="MP3_DIR" size="80" value="@MP3_DIR@" /></td> <label for="runas">Run As</label>
</tr> <input class="text" type="text" id="runas" value="" /><br />
<tr> <label for="admin_pw">Admin Password</label>
<td class="configname">Database Directory</td> <input class="text" type="text" id="admin_pw" value="" />
<td class="configdata"><input class="text" type="text" @READONLY@ name="DB_DIR" size="80" value="@DB_DIR@" /></td> &nbsp;The password for this administration interface.<br />
</tr> <label for="password">MP3 Password</label>
<tr> <input class="text" type="text" id="password" value="" />
<td class="configname">Compilation Directories</td> &nbsp;The password clients need to access this server.<br />
<td class="configdata"><input class="text" type="text" @READONLY@ name="COMPDIRS" size="80" value="@COMPDIRS@" /></td> <label for="compress">Compress</label>
</tr> <select id="compress" size="1">
<tr> <option value="1">Yes</option>
<td class="configname">Logfile</td> <option value="0" selected="selected">No</option>
<td class="configdata"><input class="text" type="text" @READONLY@ name="LOGFILE" size="80" value="@LOGFILE@" /></td> </select>
</tr> &nbsp;Should browsing data be compressed on the way to the client?<br />
<tr> <label for="debug">Debug Level</label>
<td class="configname">Art Filename</td> <select id="debug" size="1">
<td class="configdata"><input class="text" type="text" @READONLY@ name="ART_FILENAME" size="80" value="@ART_FILENAME@" /></td> <option value="0">0</option>
</tr> <option value="1">1</option>
<tr> <option value="2">2</option>
<td class="configname">Port</td> <option value="3">3</option>
<td class="configdata"><input class="text" type="text" @READONLY@ name="PORT" value="@PORT@" /> <option value="4">4</option>
&nbsp;The port the server should run at; default is 3689.</td> <option value="5">5</option>
</tr> <option value="6">6</option>
<tr> <option value="7">7</option>
<td class="configname">Server Name</td> <option value="8">8</option>
<td class="configdata"><input class="text" type="text" @READONLY@ name="SERVERNAME" value="@SERVERNAME@" /> <option value="9">9</option>
&nbsp;the name iTunes and other daap clients should see.</td> </select>
</tr> &nbsp;Possible values are 0 to 9, 9 being the most detailed debug level.<br />
<tr>
<td class="configname">Run As</td> </div>
<td class="configdata"><input class="text" type="text" @READONLY@ name="RUNAS" value="@RUNAS@" /></td> <div class="naviheader">Music Files</div>
</tr> <div class="navibox">
<tr> <label for="mp3_dir">MP3 Directory</label>
<td class="configname">Admin Password</td> <input class="text" type="text" id="mp3_dir" size="80" value="" /><br />
<td class="configdata"><input class="text" type="text" @READONLY@ name="ADMIN_PW" value="@ADMIN_PW@" /> <label for="extensions">Extensions</label>
&nbsp;The password for this administration interface.</td> <input class="text" type="text" id="extensions" size="80" value="" /><br />
</tr> <label for="playlist">Playlist File</label>
<tr> <input class="text" type="text" id="playlist" size="80" value="" /><br />
<td class="configname">MP3 Password</td> <label for="process_m3u">Process .m3u Files</label>
<td class="configdata"><input class="text" type="text" @READONLY@ name="PASSWORD" value="@PASSWORD@" /> <input class="text" type="text" id="process_m3u" value="" />
&nbsp;The password clients need to access this server.</td> Should m3u files be processed as playlists?<br />
</tr> <label for="compdirs">Compilation Directories</label>
<tr> <input class="text" type="text" id="compdirs" size="80" value="" /><br />
<td class="configname">Extensions</td> <label for="art_filename">Art Filename</label>
<td class="configdata"><input class="text" type="text" @READONLY@ name="EXTENSIONS" value="@EXTENSIONS@" /></td> <input class="text" type="text" id="art_filename" size="80" value="" /><br />
</tr>
<tr> </div>
<td class="configname">Rescan Interval</td> <div class="naviheader">Database</div>
<td class="configdata"><input class="text" type="text" @READONLY@ name="RESCAN_INTERVAL" value="@RESCAN_INTERVAL@" /> <div class="navibox">
&nbsp;How often should mt-daapd look for new files? In seconds.</td> <label for="db_type">Database Type</label>
</tr> <select id="db_type" size="1">
<tr> <option value="sqlite">sqlite</option>
<td class="configname">Scan Type</td> <option value="sqlite3">sqlite3</option>
<td class="configdata"><input class="text" type="text" @READONLY@ name="SCAN_TYPE" value="@SCAN_TYPE@" /></td> </select><br />
</tr> <label for="db_parms">Database Directory</label>
<tr> <input class="text" type="text" id="db_parms" size="80" value="" /><br />
<td class="configname">Always Scan</td>
<td class="configdata"><input class="text" type="text" @READONLY@ name="ALWAYS_SCAN" value="@ALWAYS_SCAN@" /></td> <label for="scan_type">Scan Type</label>
</tr> <select id="scan_type" size="1">
<tr> <option value="0">0 - Normal</option>
<td class="configname">Compress</td> <option value="1">1 - Aggressive</option>
<td class="configdata"><input class="text" type="text" @READONLY@ name="COMPRESS" value="@COMPRESS@" /> <option value="2">2 - Painfully aggressive</option>
&nbsp;Should browsing data be compressed on the way to the client?</td> </select><br />
</tr> <label for="rescan">Rescan Interval</label>
<tr> <input class="text" type="text" id="rescan" value="" />
<td class="configname">Process .m3u Files</td> &nbsp;How often should mt-daapd look for new files? In seconds.<br />
<td class="configdata"><input class="text" type="text" @READONLY@ name="PROCESS_M3U" value="@PROCESS_M3U@" /> <label for="always">Always Scan</label>
Should m3u files be processed as playlists?</td> <input class="text" type="text" id="always" value="" /><br />
</tr>
<tr> </div>
<td class="configname">Debug Level</td> <div class="naviheader">Transcoding</div>
<td class="configdata"><input class="text" type="text" @READONLY@ name="DEBUGLEVEL" value="@DEBUGLEVEL@" /> <div class="navibox">
&nbsp;Possible values are 0 to 9, 9 being the most detailed debug level.</td> <label for="ssc_prog">SSC prog</label>
</tr> <input class="text" type="text" id="ssc_prog" size="80" value="" /><br />
</table> <label for="ssc_codectypes">SSC codec types</label>
<input class="text" type="text" id="ssc_codectypes" size="80" value="" /><br />
</div>
</form> </form>
@include ftr.html@ @include ftr.html@

72
admin-root/config.js Normal file
View File

@ -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<n;i++){ ind+=" "; }
if(typeof(obj)=="string"){
str+=ind+prefix+"String:\""+obj+"\"\n";
} else if(typeof(obj)=="number"){
str+=ind+prefix+"Number:"+obj+"\n";
} else if(typeof(obj)=="function"){
str+=ind+prefix+"Function:"+obj+"\n";
} else if(typeof(obj) == 'boolean') {
str+=ind+prefix+"Boolean:" + obj + "\n";
} else {
var type="Array";
for(var i in obj){ type=(type=="Array"&&i==parseInt(i))?"Array":"Object"; }
str+=ind+prefix+type+"[\n";
if(type=="Array"){
for(var i in obj){ str+=DataDumper(obj[i],n,i+"=>"); }
} else {
for(var i in obj){ str+=DataDumper(obj[i],n,i+"=>"); }
}
str+=ind+"]\n";
}
return str;
}

View File

@ -4,6 +4,9 @@
<title>mt-daapd</title> <title>mt-daapd</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="mt-daapd.css" /> <link rel="stylesheet" type="text/css" href="mt-daapd.css" />
@ispage config.html:<script type="text/javascript" src="lib-js/prototype.js"></script>:@
@ispage config.html:<script type="text/javascript" src="lib-js/script.aculo.us/effects.js"></script>:@
@ispage config.html:<script type="text/javascript" src="config.js"></script>:@
@ispage status.html:<script type="text/javascript" src="lib-js/prototype.js"></script>:@ @ispage status.html:<script type="text/javascript" src="lib-js/prototype.js"></script>:@
@ispage status.html:<script type="text/javascript" src="lib-js/script.aculo.us/effects.js"></script>:@ @ispage status.html:<script type="text/javascript" src="lib-js/script.aculo.us/effects.js"></script>:@
@ispage status.html:<script type="text/javascript" src="status.js"></script>:@ @ispage status.html:<script type="text/javascript" src="status.js"></script>:@

View File

@ -94,10 +94,6 @@ pre
{ font-size: 120%; { font-size: 120%;
} }
input.text
{ border: 0px solid black;
padding: 4px 0px 4px 0.5em;
}
.feedbackfield .feedbackfield
{ border: 0px solid black; { border: 0px solid black;

View File

@ -93,6 +93,7 @@ Section "MainSection" SEC01
File "..\..\admin-root\CREDITS" File "..\..\admin-root\CREDITS"
File "..\..\admin-root\config-update.html" File "..\..\admin-root\config-update.html"
File "..\..\admin-root\config.html" File "..\..\admin-root\config.html"
File "..\..\admin-root\config.js"
File "..\..\admin-root\aspl-license.txt" File "..\..\admin-root\aspl-license.txt"
File "..\..\admin-root\aspl-license.html" File "..\..\admin-root\aspl-license.html"
File "..\..\admin-root\applet.html" File "..\..\admin-root\applet.html"