<%inherit file="../include/common.part" />
<script type="text/javascript">
<!--
-$(document).ready(function(){
-
-
-// init
-tool_invalid("#edit_settings");
-
-$("#action>a").hover(
- function(){tool_over(this);},
- function(){tool_over(this);}
-).mousedown(function(){
- var id = $(this).attr("id");
- tool_active(this);
-});
-
-renew_main_event("#tool_renew", "${ctx.homepath}${ctx.path}");
-
-$("#device_tab td").each(function(){
- $(this).click(function(){
- var target = $(this).attr("id");
-
- var target_val = target.split("_");
-
- unbind_event();
- switch(target_val[0]){
- case "general":
- ajax_get("#settings_value",
- "${ctx.homepath}/host/${host_id}/networksettings/general.part",
- null);
- tool_reset("#edit_settings");
- bind_edit_event();
- break;
- case "nic":
- ajax_get("#settings_value",
- "${ctx.homepath}/host/${host_id}/networksettings/nic/" + target_val[1] + ".part",
- null);
- tool_reset("#edit_settings");
- if(target_val[1].substr(0,3) == "eth") {
- bind_edit_event();
- } else {
- tool_invalid("#edit_settings");
- }
- break;
- default:
- _ajax_alert_on("ERROR", "${_('Received an unexpected value.')}");
- }
- // icon active
- $("#device_tab td").each(function(){
- if($(this).attr("id") != target){
- $(this).removeClass("device_active");
- } else {
- $(this).addClass("device_active");
- }
- });
-
- });
-});
-
- $("#general_tab").click();
-
-});
-// lib
function get_target_id(){
- var target_id = null;
- $("#device_tab td").each(function(){
- if($(this).hasClass("device_active") == true){
- target_id = $(this).attr("id");
- }
- });
- return target_id;
+ return $("#device_tab td.device_active").attr("id");
}
function bind_edit_event() {
var val = target_id.split("_");
var edit_url;
- if(val[1] == ""){
+ if(val[1] == "" || val[1] == undefined){
edit_url = "${ctx.homepath}/host/${host_id}/networksettings/" + val[0] + ".part?mode=input";
} else {
edit_url = "${ctx.homepath}/host/${host_id}/networksettings/" + val[0] + "/" + val[1] + ".part?mode=input";
$("#edit_settings").unbind("click.edit");
}
--->
+$(document).ready(function(){
+ $("#action>a").hover(
+ function(){tool_over(this);},
+ function(){tool_over(this);}
+ ).mousedown(function(){
+ var id = $(this).attr("id");
+ tool_active(this);
+ });
+
+ $("#device_tab td").each(function(){
+ $(this).click(function(){
+ var target = $(this).attr("id");
+ var target_val = target.split("_");
+ $("#settings_value").html('<div align="center"><img src="${ctx.homepath}/static/images/now-loading.gif" alt="Now Loading" /></div>');
+ unbind_event();
+
+ switch(target_val[0]){
+ case "general":
+ ajax_get("#settings_value",
+ "${ctx.homepath}/host/${host_id}/networksettings/general.part",
+ null,
+ true);
+ tool_reset("#edit_settings");
+ bind_edit_event();
+ break;
+ case "nic":
+ ajax_get("#settings_value",
+ "${ctx.homepath}/host/${host_id}/networksettings/nic/" + target_val[1] + ".part",
+ null,
+ true);
+ tool_reset("#edit_settings");
+ if(target_val[1].substr(0,3) == "eth") {
+ bind_edit_event();
+ } else {
+ tool_invalid("#edit_settings");
+ }
+ break;
+ default:
+ _ajax_alert_on("ERROR", "${_('Received an unexpected value.')}");
+ }
+ // icon active
+ $("#device_tab td.device_active").removeClass("device_active");
+ $(this).addClass("device_active");
+ });
+ });
+
+ tool_invalid("#edit_settings");
+ renew_main_event("#tool_renew", "${ctx.homepath}${ctx.path}");
+ $("#general_tab").click();
+});
+// -->
</script>
<div id="settings_dialog"></div>
<div id="action">
<div class="alert"></div>
<div id="view">
<div id="device">
-
-<table width="99.8%" cellspacing="1" border="0" style="background-color:#bcbcbc;">
- <tr>
- <td style="background-color:#E4E4DD; padding:0px; text-align:left;" bgcolor="#FFFFFF" width="20%" valign="top">
- <table id="device_tab" width="100%" cellspacing="0" border="0" style="background-color:#e4e4dd;">
- <tr>
- <td id="general_tab" style="font-size:10px;">
- <img src="${ctx.homepath}/static/images/device-console.png">
- <span class="status">${_('General Settings')}</span>
- </td>
- </tr>
+ <table width="99.8%" cellspacing="1" border="0" style="background-color:#bcbcbc;">
+ <tr>
+ <td style="background-color:#E4E4DD; padding:0px; text-align:left;" bgcolor="#FFFFFF" width="20%" valign="top">
+ <table id="device_tab" width="100%" cellspacing="0" border="0" style="background-color:#e4e4dd;">
+ <tr>
+ <td id="general" style="font-size:10px;">
+ <img src="${ctx.homepath}/static/images/device-console.png">
+ <span class="status">${_('General Settings')}</span>
+ </td>
+ </tr>
% for dev in sorted(current.keys()):
- <tr>
- <td id="nic_${dev}" style="font-size:10px;" width="100">
- <img src="${ctx.homepath}/static/images/device-network.png">
- <span class="status">${_('Device')} ${dev}</span>
- </td>
- </tr>
+ <tr>
+ <td id="nic_${dev}" style="font-size:10px;" width="100">
+ <img src="${ctx.homepath}/static/images/device-network.png">
+ <span class="status">${_('Device')} ${dev}</span>
+ </td>
+ </tr>
% endfor
- </table>
- </td>
- <td bgcolor="#FFFFFF" valign="top" id="settings_value" width="80%" style="padding:30px;">
- </td>
- </tr>
-</table>
-
-
+ </table>
+ </td>
+ <td bgcolor="#FFFFFF" valign="top" id="settings_value" width="80%" style="padding:30px;">
+ </td>
+ </tr>
+ </table>
</div>
</div>
<br style="clear: both;"/>
<div id="nic_setting">
<form action="${ctx.homepath}${ctx.path}" method="post" id="nic_input_form" name="nic_input_form">
-
+
<div class="grayout-head">
<span class="grayout-title">
<a href="#" id="nic" class="path-a"><img src="${ctx.homepath}/static/images/settings-title.gif">${_('Network Device Settings')}</a>
<div class="grayout-contents">
- <div class="grayout-param">${_('Device')}
+ <div class="grayout-param">${_('Device')}</div>
<div class="grayout-value grayout-form">
${device| h}
</div>
<div class="grayout-param">${_('On Boot')}<span id="network_nic_onboot_help" /></div>
<div class="grayout-value grayout-form">
% if onboot == "no":
- <input type='checkbox' name='onboot'> ${_('enable')}
+ <input type='checkbox' name='onboot'> ${_('enable')}
% else:
- <input type='checkbox' name='onboot' checked='checked'> ${_('enable')}
+ <input type='checkbox' name='onboot' checked='checked'> ${_('enable')}
% endif
</div>
<select name='bootproto' id="bootproto">
% for _proto in ['static','dhcp','bootp']:
% if bootproto == _proto:
- <option value='${_proto}' selected='selected'>${_proto}</option>
+ <option value='${_proto}' selected='selected'>${_proto}</option>
% else:
- <option value='${_proto}'>${_proto}</option>
+ <option value='${_proto}'>${_proto}</option>
% endif
% endfor
</select>
</div>
<br style="clear: both;"/>
- </div>
- </form>
+ </div>
+ </form>
</div>