Permalink
Browse files

Various changes to backend web setup.

Add a functional 'Change Password' screen under the main setup menu.

Display the hostname of the current backend at the bottom of the page under
the menu.

Add in placeholders for the following:
- Expert/Dev settings screen.  This menu item will only show up when a
  setting called 'EnableWebSetupDevMode' is created with a value of '1'.
  The "-O" command line option does not work for this because the menu
  is drawn using .qsp and the /Myth/GetSetting API which queries the
  database directly.
- Some tabs on the wizard screen.  The code on these is not really
  functional and these are for a sample.
  • Loading branch information...
1 parent 3b2fbdd commit 473a4e9a7dba9ed9663a6c45a935cd19b9bf2015 @cpinkham cpinkham committed Mar 26, 2011
View
10 mythtv/html/css/site.css
@@ -74,6 +74,16 @@
padding: 6px 200px 0 200px;
}
+ #hostname {
+ position: fixed;
+ bottom: 10px;
+ left: 0px;
+ width: 200px;
+ height: 20;
+ color: #26c;
+ text-align: center;
+ }
+
#menu-bg {
position: fixed;
top: 40px;
View
3 mythtv/html/index.html
@@ -14,6 +14,7 @@
$(document).ready(function() {
loadContent('/misc/overview.html');
+ showHostName();
});
</script>
@@ -43,6 +44,8 @@
<center><a class='menuitem' href='http://www.mythtv.org'>www.mythtv.org</a></center>
</div>
</div>
+<div id="hostname">
+</div>
<div id="content">
</div>
View
40 mythtv/html/js/util.js
@@ -1,3 +1,39 @@
+var gHostName = "";
+
+function getHostName() {
+ if (gHostName.length == 0) {
+ $.ajaxSetup({ async: false });
+ $.post("/Myth/GetHostName",
+ function(data) {
+ gHostName = data.QString;
+ }, "json").error(function(data) {
+ alert("Error: unable to retrieve backend hostname");
+ });
+ $.ajaxSetup({ async: true });
+ }
+
+ return gHostName;
+}
+
+function showHostName() {
+ $("#hostname").html(getHostName());
+}
+
+function getSetting(hostname, key, defValue) {
+ var result = "";
+
+ $.ajaxSetup({ async: false });
+ $.getJSON("/Myth/GetSetting",
+ { HostName: hostname, Key: key, Default: defValue },
+ function(data) {
+ result = data.SettingList.Settings[0].String;
+ }).error(function(data) {
+ alert("Error: unable to retrieve setting");
+ });
+ $.ajaxSetup({ async: true });
+
+ return result;
+}
function interceptMenuClicks() {
$('#menu ul li a').click(function(event) {
@@ -45,6 +81,10 @@ function loadContent(contentURL, jsURL) {
}
}
+function clearContent() {
+ $("#content").html("");
+}
+
function getCurrentTab(id) {
var selected = $(id).tabs('option', 'selected');
return selected;
View
13 mythtv/html/setup/css/setup.css
@@ -1,6 +1,11 @@
- #wizardcontent {
+ div.wizardcontent {
position: absolute;
- margin: 0px;
- padding: 40px 20px 20px 20px;
- left: 200px;
+ padding: 20px 10px 10px 0px;
}
+
+ /* keep wizard tabs small enough to fit on a 1024x768 size browser */
+ div.wizardtab {
+ width: 700px;
+ height: 450px;
+ }
+
View
9 mythtv/html/setup/expert.html
@@ -0,0 +1,9 @@
+<br>
+<br>
+<br>
+<br>
+<b>Expert/Dev mode would normally be hidden by default, possibly enabled via
+use of an undocumented setting available only on the command line (and later
+via expert/dev mode itself). Something like
+"mythbackend -O EnableWebSetupDevMode=1"
+</b>
View
6 mythtv/html/setup/index.html
@@ -5,6 +5,7 @@
</title>
<link rel="stylesheet" type="text/css" href="/css/site.css">
<link rel="stylesheet" type="text/css" href="/css/jquery-ui.css">
+<link rel="stylesheet" type="text/css" href="/setup/css/setup.css">
<link rel="icon" href="/images/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon">
@@ -16,8 +17,9 @@
<script language="JavaScript" type="text/javascript">
$(document).ready(function() {
- loadMenu('/setup/menus/main.html');
+ loadMenu('/setup/menus/main.qsp');
loadContent('/setup/overview.html');
+ showHostName();
});
</script>
@@ -32,6 +34,8 @@
<div id="menu-bg">
</div>
+<div id="hostname">
+</div>
<div id="content">
</div>
View
20 mythtv/html/setup/js/password.js
@@ -0,0 +1,20 @@
+
+function changePassword() {
+ var result = false;
+ var oldPassword = $("#oldPassword").val();
+ var newPassword = $("#newPassword").val();
+
+ $.post("/Myth/ChangePassword",
+ { UserName: "admin",
+ OldPassword: oldPassword,
+ NewPassword: newPassword },
+ function(data) {
+ if (data.bool == "true")
+ alert("Password successfully changed.");
+ else
+ alert("Error changing password, check backend logs for detailed information.");
+ }, "json").error(function(data) {
+ alert("Error changing password, check backend logs for detailed information.");
+ });
+}
+
View
2 mythtv/html/setup/js/wizard.js
@@ -0,0 +1,2 @@
+
+$("#wizardtabs").tabs();
View
2 mythtv/html/setup/menus/advanced.html
@@ -16,5 +16,5 @@
-->
</ul>
<br>
- <center><a class='menuitem' href="javascript:loadMenu('/setup/menus/main.html')">Back To Setup Menu</a></center>
+ <center><a class='menuitem' href="javascript:loadMenu('/setup/menus/main.qsp')">Back To Setup Menu</a></center>
</div>
View
16 mythtv/html/setup/menus/expert.html
@@ -0,0 +1,16 @@
+ <div id="header_title">
+ (This menu &amp; screen hidden by default)
+ </div>
+
+ <div id="menu-title" align=center>
+ Expert/Dev Setup
+ </div>
+
+ <div id="menu">
+ <ul>
+ <li><a class='menuitem' href='/setup/menuitem1.html'>Optional Menu Item #1</a></li>
+ <li><a class='menuitem' href='/setup/menuitem2.html'>Optional Menu Item #2</a></li>
+ </ul>
+ <br>
+ <center><a class='menuitem' href="javascript:loadMenu('/setup/menus/main.qsp')">Back To Setup Menu</a></center>
+ </div>
View
13 mythtv/html/setup/menus/main.html
@@ -1,13 +0,0 @@
- <div id="menu-title" align=center>
- Setup
- </div>
-
- <div id="menu">
- <ul>
- <li><a class='menuitem' href="javascript:loadScreen('/setup/menus/wizard.html', '/setup/wizard.html')">Setup Wizard</a></li>
- <li><a class='menuitem' href="javascript:loadScreen('/setup/menus/advanced.html')">Advanced Setup</a></li>
- </ul>
- <br>
- <center><a class='menuitem' href='/'>Back To Main Menu</a></center>
- </div>
-</div>
View
24 mythtv/html/setup/menus/main.qsp
@@ -0,0 +1,24 @@
+ <div id="menu-title" align=center>
+ Setup
+ </div>
+
+ <div id="menu">
+ <ul>
+ <li><a class='menuitem' href="javascript:loadScreen('/setup/menus/wizard.html', '/setup/wizard.html', '/setup/js/wizard.js')">Setup Wizard</a></li>
+ <li><a class='menuitem' href="javascript:loadScreen('/setup/menus/advanced.html')">Advanced Setup</a></li>
+<%
+ var myth = new Myth();
+ var sList = myth.GetSetting( '', 'EnableWebSetupDevMode', '');
+
+ if (sList.Settings['EnableWebSetupDevMode'] == 1)
+ {
+ os.write("<li><a class='menuitem' href=\"javascript:loadScreen('/setup/menus/expert.html', '/setup/expert.html')\">Expert/Dev Setup</a></li>");
+ }
+%>
+ <li><hr></li>
+ <li><a class='menuitem' href="javascript:loadSetupPage('password')">Change Password</a></li>
+ </ul>
+ <br>
+ <center><a class='menuitem' href='/'>Back To Main Menu</a></center>
+ </div>
+</div>
View
2 mythtv/html/setup/menus/wizard.html
@@ -8,5 +8,5 @@
<li><a class='menuitem' href='/setup/menuitem2.html'>Optional Menu Item #2</a></li>
</ul>
<br>
- <center><a class='menuitem' href="javascript:loadMenu('/setup/menus/main.html')">Back To Setup Menu</a></center>
+ <center><a class='menuitem' href="javascript:loadMenu('/setup/menus/main.qsp')">Back To Setup Menu</a></center>
</div>
View
9 mythtv/html/setup/password.html
@@ -0,0 +1,9 @@
+<h2>Setup Password</h2>
+<table border=0 cellpadding=2 cellspacing=2>
+ <tr><th align=right>Old Password:</th>
+ <td><input id='oldPassword' type='password' size=20></td></tr>
+ <tr><th align=right>New Password:</th>
+ <td><input id='newPassword' type='password' size=20></td></tr>
+</table>
+<input type=button value='Change Password' onClick='javascript:changePassword()'>
+<input type=button value='Cancel' onClick='javascript:clearContent()'>
View
5 mythtv/html/setup/wizard-capture.html
@@ -0,0 +1,5 @@
+<div id='wizard-capture' class='wizardtab'>
+<input type=button value='Prev' onClick='javascript:$("#wizardtabs").tabs("select", "#ui-tabs-2")'>
+<input type=button value='Save' onClick='javascript:alert("Wizard is not hooked up yet")'>
+<h2>Capture/Tuners/Etc/Fixme</h2>
+</div>
View
12 mythtv/html/setup/wizard-database.html
@@ -0,0 +1,12 @@
+<div id='wizard-database' class='wizardtab'>
+<input type=button value='Next' onClick='javascript:$("#wizardtabs").tabs("select", "#ui-tabs-2")'>
+<h2>Database Setup</h2>
+<table border=0 cellpadding=2 cellspacing=2>
+ <tr><th align=right>Database Host:</th>
+ <td><input id='dbHost' size=20></td></tr>
+ <tr><th align=right>Database User:</th>
+ <td><input id='dbUserName' size=20></td></tr>
+ <tr><th align=right>Database Password:</th>
+ <td><input id='dbPassword' size=20></td></tr>
+</table>
+</div>
View
18 mythtv/html/setup/wizard-network.qsp
@@ -0,0 +1,18 @@
+<div id='wizard-network' class='wizardtab'>
+<input type=button value='Prev' onClick='javascript:$("#wizardtabs").tabs("select", "#ui-tabs-1")'>
+<input type=button value='Next' onClick='javascript:$("#wizardtabs").tabs("select", "#ui-tabs-3")'>
+<h2>Network Setup</h2>
+<table border=0 cellpadding=2 cellspacing=2>
+ <tr><th align=right>Master Backend:</th><td id='MasterServerIP'><b>
+<%
+ var myth = new Myth();
+ var sList = myth.GetSetting( '', 'MasterServerIP', '');
+ os.write(sList.Settings['MasterServerIP']);
+%>
+</b></td></tr>
+ <tr><th align=right>Local Backend:</th>
+ <td><select id='dbHost'><option>127.0.0.1</option><option>FIXME</option></select></td></tr>
+ <tr><th align=right>Security PIN:</th>
+ <td><input id='SecurityPin' type='password' size=10></td></tr>
+</table>
+</div>
View
8 mythtv/html/setup/wizard.html
@@ -1,3 +1,9 @@
<div id="wizardcontent" class='wizardcontent'>
- <div style='position:absolute; top: 150px; width: 600px; text-align: center'><b><font size=+3>Wizard would go here</font></b></div>
+<div id="wizardtabs">
+ <ul>
+ <li><a href="/setup/wizard-database.html"><span>Database</span></a></li>
+ <li><a href="/setup/wizard-network.qsp"><span>Network</span></a></li>
+ <li><a href="/setup/wizard-capture.html"><span>Capture Cards</span></a></li>
+ </ul>
+</div>
</div>

0 comments on commit 473a4e9

Please sign in to comment.