* Fix up the domainlist/string array box thing so that removing items works right.

* Make template for editing domains actually display something useful.
This commit is contained in:
halex
2007-11-04 03:36:05 +00:00
parent 1311056741
commit e370c1b53d
2 changed files with 20 additions and 10 deletions
+8 -7
View File
@@ -10,21 +10,18 @@
<table cellpadding="1">
<tr>
<td style="padding-right: 16px;">Domain name:</td><td><span tal:content="name"></span></td>
</tr>
<tr>
<td style="padding-right: 16px;" colspan="2"><input type="checkbox" id="domainwide" /><label for="domainwide">Enable domain-wide aliasing</label></td>
<td style="padding-right: 16px;">Domain name:</td><td><span tal:content="name"></span><br /><input type="checkbox" id="domainwide" /><label for="domainwide">Enable domain-wide aliasing</label></td>
</tr>
<tr>
<td style="padding-right: 16px;">User-based aliasing</td>
<td>
<div style="width: 325px; visibility: none">
<div style="width: 25px; float: right;">
<a href="javascript:addToList('useralias');" style="float: right;"><img src="/img/list-add.png" width="16" height="16" border="0" alt="Add" /></a><br />
<a href="javascript:addToList('useralias', 'Please enter the user alias in the following format:\n\n<username>=<newdomain>');" style="float: right;"><img src="/img/list-add.png" width="16" height="16" border="0" alt="Add" /></a><br />
<a href="javascript:removeFromList('useralias');" id="useralias-removebtn" style="float: right;"><img src="/img/list-remove.png" width="16" height="16" border="0" alt="Remove" /></a>
</div>
<select id="useralias-box" style="width: 300px; border: 1px solid #888a85; background-color: #fff;" size="5">
<select id="useralias-box" style="width: 300px; border: 1px solid #888a85; background-color: #fff; display: none" size="5">
</select>
</div>
@@ -35,13 +32,17 @@
</div>
<script type="text/javascript">
$('useralias-box').hide(); $('useralias-box').show();
$('useralias-normal').hide(); $('useralias-box').show();
</script>
</td>
</tr>
</table>
<br />
<br />
<span class="button"><button type="reset" value="Reset">Reset</button></span> <span class="button"><button type="submit" value="Save">Save</button></span>
</form>
</p>
%(include|footer.tpl)s
+12 -3
View File
@@ -59,9 +59,14 @@ function toggleSidebar()
}
}
function addToList(div)
function addToList(div, ptxt)
{
var d = prompt("Value:", "");
prompttxt = "Value:";
if (ptxt) {
prompttxt = ptxt;
}
var d = prompt(prompttxt, "");
if (d)
{
var e = document.createElement('option');
@@ -83,7 +88,7 @@ function addToList(div)
$((div+"-box")).selectedIndex = $((div+"-box")).options.length - 1;
Effect.Appear(div + '-removebtn');
new Effect.Highlight(div);
new Effect.Highlight(div + '-box');
}
}
@@ -91,6 +96,10 @@ function removeFromList(div)
{
var start = $(div+"-box").selectedIndex;
$(div+"-box").remove(start);
// Current items in array
var items = $(div).value.split(',');
items = items.splice(items.length -1, 1);
$(div).value = items.join(',') + ",";
if ($(div+"-box").selectedIndex != start)
{
//new Effect.Highlight(div);