Moved inline - javascript to external file in preparation of X-Content-Security-Policy (also, the code looks cleaner, yay)

Signed-off-by: Florian Aders (EleRas) <eleras@froxlor.org>
This commit is contained in:
Florian Aders (EleRas)
2011-06-16 18:59:16 +02:00
parent b9bb1a1286
commit 3e21cb0298
10 changed files with 87 additions and 45 deletions

View File

@@ -18,15 +18,15 @@ $header
<table class="formtable">
<tr>
<td><b>{$lng['admin']['configfiles']['distribution']}:</b></td>
<td><if $distribution != ''><input type="hidden" name="distribution" value="$distribution"/><a href="{$linker->getLink(array('section' => 'configfiles', 'page' => $page))}">{$configfiles[$distribution]['label']}</a><else><select name="distribution" onchange="javascript: window.location.href='{$linker->getLink(array('section' => 'configfiles', 'page' => $page))}&amp;distribution=' + this.options[ this.selectedIndex ].value;"><option value="choose">{$lng['admin']['configfiles']['choosedistribution']}</option>{$distributions_select}</select></if></td>
<td><if $distribution != ''><input type="hidden" name="distribution" value="$distribution"/><a href="{$linker->getLink(array('section' => 'configfiles', 'page' => $page))}">{$configfiles[$distribution]['label']}</a><else><select id="config_distribution" name="distribution"><option value="choose">{$lng['admin']['configfiles']['choosedistribution']}</option>{$distributions_select}</select></if></td>
</tr>
<tr>
<td><b>{$lng['admin']['configfiles']['service']}:</b></td>
<td><if $service != ''><input type="hidden" name="service" value="$service"/><a href="{$linker->getLink(array('section' => 'configfiles', 'page' => $page, 'distribution' => $distribution))}">{$configfiles[$distribution]['services'][$service]['label']}</a><else><select name="service" onchange="javascript: window.location.href='{$linker->getLink(array('section' => 'configfiles', 'page' => $page, 'distribution' => $distribution))}&amp;service=' + this.options[ this.selectedIndex ].value;"><option value="choose">{$lng['admin']['configfiles']['chooseservice']}</option>{$services_select}</select></if></td>
<td><if $service != ''><input type="hidden" name="service" value="$service"/><a href="{$linker->getLink(array('section' => 'configfiles', 'page' => $page, 'distribution' => $distribution))}">{$configfiles[$distribution]['services'][$service]['label']}</a><else><select id="config_service" name="service"><option value="choose">{$lng['admin']['configfiles']['chooseservice']}</option>{$services_select}</select></if></td>
</tr>
<tr>
<td><b>{$lng['admin']['configfiles']['daemon']}:</b></td>
<td><select name="daemon" onchange="javascript: window.location.href='{$linker->getLink(array('section' => 'configfiles', 'page' => $page, 'distribution' => $distribution, 'service' => $service))}&amp;daemon=' + this.options[ this.selectedIndex ].value;"><option value="choose">{$lng['admin']['configfiles']['choosedaemon']}</option>{$daemons_select}</select></td>
<td><select id="config_daemon" name="daemon"><option value="choose">{$lng['admin']['configfiles']['choosedaemon']}</option>{$daemons_select}</select></td>
</tr>
<tr>
<td><input class="bottom" type="submit" value="{$lng['panel']['next']}" /></td>

View File

@@ -1,38 +1,54 @@
$(document).ready(function() {
// make rel="external" links open in a new window
$("a[rel='external']").attr('target', '_blank');
$(".main").css('min-height', $("nav").height() - 34);
$(".dboarditem:last").css('min-height', $(".dboarditem:first").height());
$("a[rel='external']").attr('target', '_blank');
$(".main").css('min-height', $("nav").height() - 34);
$(".dboarditem:last").css('min-height', $(".dboarditem:first").height());
// set focus on username-field if on loginpage
if ($(".loginpage").length != 0) {
$("#loginname").focus();
}
// set focus on username-field if on loginpage
if ($(".loginpage").length != 0) {
$("#loginname").focus();
}
if ($("table.formtable").length != 0) {
$("table.formtable tr").hover(function() {
$(this).css("background-color", "#fff");
}, function() {
$(this).css("background-color", "#f5f5f5");
});
}
if ($("table.bradiusodd").leingth != 0) {
$("table.bradiusodd tbody tr").not(':last-child').hover(function() {
$(this).css("background-color", "#fff");
}, function() {
$(this).css("background-color", "#f5f5f5");
});
// last row needs border-radius
$("table.bradiusodd tbody tr:last-child").hover(function() {
$(this).children().css("background-color", "#fff");
$(this).children(':first-child').css("-webkit-border-bottom-left-radius", "20px");
$(this).children(':first-child').css("-moz-border-radius-bottomleft", "20px");
$(this).children(':first-child').css("border-bottom-left-radius", "20px");
},
function() {
$(this).children().css("background-color", "#f5f5f5");
}
);
}
if ($("table.formtable").length != 0) {
$("table.formtable tr").hover(function() {
$(this).css("background-color", "#fff");
}, function() {
$(this).css("background-color", "#f5f5f5");
});
}
if ($("table.bradiusodd").length != 0) {
$("table.bradiusodd tbody tr").not(':last-child').hover(function() {
$(this).css("background-color", "#fff");
}, function() {
$(this).css("background-color", "#f5f5f5");
});
// last row needs border-radius
$("table.bradiusodd tbody tr:last-child").hover(function() {
$(this).children().css("background-color", "#fff");
$(this).children(':first-child').css("-webkit-border-bottom-left-radius", "20px");
$(this).children(':first-child').css("-moz-border-radius-bottomleft", "20px");
$(this).children(':first-child').css("border-bottom-left-radius", "20px");
},
function() {
$(this).children().css("background-color", "#f5f5f5");
}
);
}
// Auto-select next field in configfile - wizard
$('#config_distribution').change(function (){
window.location.href=window.location.href + '&distribution=' + this.options[ this.selectedIndex ].value;
});
$('#config_service').change(function (){
window.location.href=window.location.href + '&service=' + this.options[ this.selectedIndex ].value;
});
$('#config_daemon').change(function (){
window.location.href=window.location.href + '&daemon=' + this.options[ this.selectedIndex ].value;
});
// Back-button
$('#yesnobutton').click(function() {
history.back();
});
});

View File

@@ -10,7 +10,7 @@ $header
<input type="hidden" name="send" value="send" />
{$hiddenparams}
<input type="submit" name="submitbutton" value="{$lng['panel']['yes']}" />&nbsp;
<input type="button" class="nobutton" value="{$lng['panel']['no']}" onclick="history.back();" />
<input type="button" class="nobutton" value="{$lng['panel']['no']}" id="yesnobutton" />
</div>
</div>
</div>

View File

@@ -11,7 +11,7 @@ $header
<input type="hidden" name="send" value="send" />
{$hiddenparams}
<input type="submit" name="submitbutton" value="{$lng['panel']['yes']}" />&nbsp;
<input type="button" class="nobutton" value="{$lng['panel']['no']}" onclick="history.back();" />
<input type="button" class="nobutton" value="{$lng['panel']['no']}" id="yesnobutton" />
</div>
</div>
</div>