Revize 1451
Přidáno uživatelem David Raška před více než 12 roky(ů)
freenetis/branches/network/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'add contact' => 'Přidat kontakt',
|
||
'add device template' => 'Přidat šablonu zařízení',
|
||
'add details to ip address' => 'Přidat detaily k IP adrese',
|
||
'add details to interface' => 'Přidat detaily k rozhraní',
|
||
'add details to link' => 'Přidat detaily k lince',
|
||
'add items' => 'Přidat položky',
|
||
'add member fee payment by cash' => 'Přidat platbu členského příspěvku hotově',
|
||
'add new' => 'Přidat nový',
|
freenetis/branches/network/application/controllers/json.php | ||
---|---|---|
|
||
if ($iface->id && $iface->link_id)
|
||
{
|
||
die(json_encode($iface->link->as_array()));
|
||
$arr = $iface->link->as_array();
|
||
$arr['bitrate'] = network::bytes2str($arr['bitrate'], 'M');
|
||
die(json_encode($arr));
|
||
}
|
||
else
|
||
{
|
freenetis/branches/network/application/controllers/devices.php | ||
---|---|---|
$types[NULL] = '----- '.__('select type').' -----';
|
||
asort($types);
|
||
|
||
$arr_unit = array
|
||
(
|
||
'K' => 'kbps',
|
||
'M' => 'Mbps',
|
||
'G' => 'Gbps',
|
||
'T' => 'Tbps'
|
||
);
|
||
|
||
// wireless modes
|
||
$wirelessmodes = array
|
||
(
|
||
NULL => '----- '.__('Select mode').' -----'
|
||
) + Iface_Model::get_wireless_modes();
|
||
|
||
// wireless antenna types
|
||
$wirelessantennas = array
|
||
(
|
||
NULL => '----- '.__('Select antenna').' -----'
|
||
) + Iface_Model::get_wireless_antennas();
|
||
|
||
// all device templates
|
||
$device_templates = array
|
||
(
|
||
... | ... | |
(
|
||
NULL => '----- '.__('select town').' -----'
|
||
) + ORM::factory('town')->select_list_with_quater();
|
||
|
||
// wireless norms
|
||
$wirelessnorms = Link_Model::get_wireless_norms();
|
||
|
||
// wireless polarizations
|
||
$wirelesspolarizations = Link_Model::get_wireless_polarizations();
|
||
|
||
// ports
|
||
$port_modes = array
|
||
(
|
||
NULL => '----- '.__('select mode').' -----'
|
||
) + Iface_Model::get_port_modes();
|
||
|
||
// ethernet mediums
|
||
$eth_mediums = array
|
||
(
|
||
Link_Model::ROAMING => Link_Model::get_medium_type(Link_Model::ROAMING),
|
||
Link_Model::CABLE => Link_Model::get_medium_type(Link_Model::CABLE)
|
||
);
|
||
|
||
// wireless mediums
|
||
$wl_mediums = array
|
||
(
|
||
Link_Model::ROAMING => Link_Model::get_medium_type(Link_Model::ROAMING),
|
||
Link_Model::AIR => Link_Model::get_medium_type(Link_Model::AIR)
|
||
);
|
||
|
||
// port mediums
|
||
$port_mediums = array
|
||
(
|
||
Link_Model::ROAMING => Link_Model::get_medium_type(Link_Model::ROAMING),
|
||
Link_Model::CABLE => Link_Model::get_medium_type(Link_Model::CABLE),
|
||
Link_Model::SINGLE_FIBER => Link_Model::get_medium_type(Link_Model::SINGLE_FIBER),
|
||
Link_Model::MULTI_FIBER => Link_Model::get_medium_type(Link_Model::MULTI_FIBER)
|
||
);
|
||
|
||
// list of engineers
|
||
if ($this->acl_check_edit('Devices_Controller', 'main_engineer'))
|
||
... | ... | |
$view->content->form = $form->html();
|
||
$view->content->headline = __('Add new whole device');
|
||
$view->content->yes_no_option = $yes_no_option;
|
||
$view->content->port_modes = $port_modes;
|
||
$view->content->wireless_modes = $wirelessmodes;
|
||
$view->content->wireless_antennas = $wirelessantennas;
|
||
$view->content->norms = $wirelessnorms;
|
||
$view->content->polarizations = $wirelesspolarizations;
|
||
$view->content->bit_units = $arr_unit;
|
||
$view->content->eth_mediums = $eth_mediums;
|
||
$view->content->wl_mediums = $wl_mediums;
|
||
$view->content->port_mediums = $port_mediums;
|
||
$view->render(TRUE);
|
||
} // end of function add
|
||
|
freenetis/branches/network/application/views/devices/add.php | ||
---|---|---|
</form>
|
||
</div>
|
||
|
||
<div id="dialog_iface_detail" style="display: none">
|
||
<form class="form">
|
||
<table class="form" cellspacing="0">
|
||
<tr>
|
||
<th><label><?php echo __('Interface name') ?>:</label></th>
|
||
<td><?php echo form::input('iface_name_input','','class="textbox" minlength="3" maxlength="250"') ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Comment') ?>:</label></th>
|
||
<td><?php echo form::textarea('comment_input','','class="textbox" rows="5" cols="20"') ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Number') ?>:</label></th>
|
||
<td><?php echo form::input('port_number_input','','class="number textbox"') ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Port mode') ?>:</label></th>
|
||
<td><?php echo form::dropdown('port_mode_input', $port_modes,'class="textbox"') ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Wireless mode') ?>:</label></th>
|
||
<td><?php echo form::dropdown('wireless_mode_input', $wireless_modes,'class="textbox"') ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Wireless antenna') ?>:</label></th>
|
||
<td><?php echo form::dropdown('wireless_antenna_input', $wireless_antennas,'class="textbox"') ?></td>
|
||
</tr>
|
||
</table>
|
||
<button class="submit" type="button"><?php echo __('Save') ?></button>
|
||
</form>
|
||
</div>
|
||
|
||
<div id="dialog_link_detail" style="display: none">
|
||
<form class="form">
|
||
<table class="form" cellspacing="0">
|
||
<tr>
|
||
<th><label><?php echo __('Name') ?>:</label></th>
|
||
<td><?php echo form::input('link_name_input','','class="textbox"') ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Comment') ?>:</label></th>
|
||
<td><?php echo form::textarea('link_comment_input','','class="textbox" rows="5" cols="20"') ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Medium') ?>:</label></th>
|
||
<td><?php echo form::dropdown('eth_medium_input',$eth_mediums) ?>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Medium') ?>:</label></th>
|
||
<td><?php echo form::dropdown('wl_medium_input',$wl_mediums) ?>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Medium') ?>:</label></th>
|
||
<td><?php echo form::dropdown('port_medium_input',$port_mediums) ?>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Norm') ?>:</label></th>
|
||
<td><?php echo form::dropdown('norm_input', $norms) ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Bitrate') ?>:</label></th>
|
||
<td><?php echo form::input('bitrate_input','','class="number textbox" style="width:100px; margin-right:5px;"') ?>
|
||
<?php echo form::dropdown('bitrate_unit_input', $bit_units) ?>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Duplex') ?>:</label></th>
|
||
<td><?php echo form::dropdown('duplex_input', $yes_no_option) ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('SSID') ?>:</label></th>
|
||
<td><?php echo form::input('ssid_input','','class="textbox"') ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Frequency') ?>:</label></th>
|
||
<td><?php echo form::input('frequency_input','','class="number textbox"') ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Channel') ?>:</label></th>
|
||
<td><?php echo form::input('channel_input','','class="number textbox"') ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Channel width') ?>:</label></th>
|
||
<td><?php echo form::input('channel_width_input','','class="number textbox"') ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><label><?php echo __('Polarization') ?>:</label></th>
|
||
<td><?php echo form::dropdown('polarization_input', $polarizations) ?></td>
|
||
</tr>
|
||
</table>
|
||
<button class="submit" type="button"><?php echo __('Save') ?></button>
|
||
</form>
|
||
</div>
|
||
|
freenetis/branches/network/application/views/js/devices_add.php | ||
---|---|---|
function add_detail_to_ip()
|
||
{
|
||
var $td = $(this).parent().parent();
|
||
$('#dialog_ip_address_detail form').validate();
|
||
|
||
// set form with current values
|
||
$('#gateway_input').val($td.find('input[name^="gateway"]').val());
|
||
... | ... | |
// dialog button action submit
|
||
$('#dialog_ip_address_detail form button').unbind('click').click(function ()
|
||
{
|
||
if ($('#dialog_ip_address_detail form').validate().valid())
|
||
if ($('#dialog_ip_address_detail form').valid())
|
||
{
|
||
// fill in hidden fields
|
||
$td.find('input[name^="gateway"]').val($('#gateway_input').val())
|
||
... | ... | |
*/
|
||
function add_detail_to_link()
|
||
{
|
||
var $td = $(this).parent().parent();
|
||
$('#dialog_link_detail form').validate();
|
||
|
||
// set form with current values
|
||
$('#link_name_input').val($td.find('input[name^="link_name"]').val());
|
||
$('#link_comment_input').val($td.find('input[name^="link_comment"]').val());
|
||
$('#eth_medium_input').val($td.find('input[name^="medium"]').val());
|
||
$('#wl_medium_input').val($td.find('input[name^="medium"]').val());
|
||
$('#port_medium_input').val($td.find('input[name^="medium"]').val());
|
||
|
||
$bitrate = $td.find('input[name^="bitrate"]').val();
|
||
$('#bitrate_input').val(substr($bitrate, 0, $bitrate.length-1));
|
||
$('#bitrate_unit_input').val(substr($bitrate, -1));
|
||
|
||
$('#duplex_input').val($td.find('input[name^="duplex"]').val());
|
||
$('#ssid_input').val($td.find('input[name^="wireless_ssid"]').val());
|
||
$('#norm_input').val($td.find('input[name^="wireless_norm"]').val());
|
||
$('#frequency_input').val($td.find('input[name^="wireless_frequency"]').val());
|
||
$('#channel_input').val($td.find('input[name^="wireless_channel"]').val());
|
||
$('#channel_width_input').val($td.find('input[name^="wireless_channel_width"]').val());
|
||
$('#polarization_input').val($td.find('input[name^="wireless_polarization"]').val());
|
||
|
||
// dialog button action submit
|
||
$('#dialog_link_detail form button').unbind('click').click(function ()
|
||
{
|
||
if ($('#dialog_link_detail form').valid())
|
||
{
|
||
// fill in hidden fields
|
||
switch (parseInt($td.find('input[name^="type"]').val()))
|
||
{
|
||
case <?php echo Iface_Model::TYPE_WIRELESS ?>:
|
||
$td.find('input[name^="medium"]').val($('#wl_medium_input').val());
|
||
break;
|
||
case <?php echo Iface_Model::TYPE_ETHERNET ?>:
|
||
$td.find('input[name^="medium"]').val($('#eth_medium_input').val());
|
||
break;
|
||
case <?php echo Iface_Model::TYPE_PORT ?>:
|
||
$td.find('input[name^="medium"]').val($('#port_medium_input').val());
|
||
break;
|
||
};
|
||
$td.find('input[name^="link_name"]').val($('#link_name_input').val());
|
||
$td.find('input[name^="link_comment"]').val($('#link_comment_input').val());
|
||
$td.find('input[name^="bitrate"]').val($('#bitrate_input').val() + $('#bitrate_unit_input').val());
|
||
$td.find('input[name^="duplex"]').val($('#duplex_input').val());
|
||
$td.find('input[name^="wireless_ssid"]').val($('#ssid_input').val());
|
||
$td.find('input[name^="wireless_norm"]').val($('#norm_input').val());
|
||
$td.find('input[name^="wireless_frequency"]').val($('#frequency_input').val());
|
||
$td.find('input[name^="wireless_channel"]').val($('#channel_input').val());
|
||
$td.find('input[name^="wireless_channel_width"]').val($('#channel_width_input').val());
|
||
$td.find('input[name^="wireless_polarization"]').val($('#polarization_input').val());
|
||
|
||
// close dialog
|
||
$('#dialog_link_detail').dialog('close');
|
||
}
|
||
});
|
||
|
||
$('#eth_medium_input').parent().parent().show();
|
||
$('#wl_medium_input').parent().parent().show();
|
||
$('#port_medium_input').parent().parent().show();
|
||
$('#ssid_input').parent().parent().show();
|
||
$('#norm_input').parent().parent().show();
|
||
$('#frequency_input').parent().parent().show();
|
||
$('#channel_input').parent().parent().show();
|
||
$('#channel_width_input').parent().parent().show();
|
||
$('#polarization_input').parent().parent().show();
|
||
|
||
switch (parseInt($td.find('input[name^="type"]').val()))
|
||
{
|
||
case <?php echo Iface_Model::TYPE_WIRELESS ?>:
|
||
$('#eth_medium_input').parent().parent().hide();
|
||
$('#port_medium_input').parent().parent().hide();
|
||
break;
|
||
case <?php echo Iface_Model::TYPE_ETHERNET ?>:
|
||
$('#wl_medium_input').parent().parent().hide();
|
||
$('#port_medium_input').parent().parent().hide();
|
||
$('#ssid_input').parent().parent().hide();
|
||
$('#norm_input').parent().parent().hide();
|
||
$('#frequency_input').parent().parent().hide();
|
||
$('#channel_input').parent().parent().hide();
|
||
$('#channel_width_input').parent().parent().hide();
|
||
$('#polarization_input').parent().parent().hide();
|
||
break;
|
||
case <?php echo Iface_Model::TYPE_PORT ?>:
|
||
$('#wl_medium_input').parent().parent().hide();
|
||
$('#eth_medium_input').parent().parent().hide();
|
||
$('#ssid_input').parent().parent().hide();
|
||
$('#norm_input').parent().parent().hide();
|
||
$('#frequency_input').parent().parent().hide();
|
||
$('#channel_input').parent().parent().hide();
|
||
$('#channel_width_input').parent().parent().hide();
|
||
$('#polarization_input').parent().parent().hide();
|
||
break;
|
||
};
|
||
|
||
// open dialog
|
||
$('#dialog_link_detail').dialog({
|
||
title: '<?php echo __('Add details to link') ?>',
|
||
modal: true,
|
||
position: ['center', 100],
|
||
width: 500
|
||
});
|
||
|
||
return false;
|
||
}
|
||
|
||
/**
|
||
... | ... | |
*/
|
||
function add_detail_to_iface()
|
||
{
|
||
var $td = $(this).parent().parent();
|
||
$('#dialog_iface_detail form').validate();
|
||
|
||
// set form with current values
|
||
$('#iface_name_input').val($td.find('input[name^="name"]').val());
|
||
$('#comment_input').val($td.find('input[name^="comment"]').val());
|
||
$('#port_number_input').val($td.find('input[name^="number"]').val());
|
||
$('#port_mode_input').val($td.find('input[name^="port_mode"]').val());
|
||
$('#wireless_mode_input').val($td.find('input[name^="wireless_mode"]').val());
|
||
$('#wireless_antenna_input').val($td.find('input[name^="wireless_antenna"]').val());
|
||
|
||
// dialog button action submit
|
||
$('#dialog_iface_detail form button').unbind('click').click(function ()
|
||
{
|
||
if ($('#dialog_iface_detail form').valid())
|
||
{
|
||
// fill in hidden fields
|
||
$td.find('input[name^="name"]').val($('#iface_name_input').val());
|
||
$td.find('input[name^="comment"]').val($('#comment_input').val());
|
||
$td.find('input[name^="number"]').val($('#port_number_input').val());
|
||
$td.find('input[name^="port_mode"]').val($('#port_mode_input').val());
|
||
$td.find('input[name^="wireless_mode"]').val($('#wireless_mode_input').val());
|
||
$td.find('input[name^="wireless_antenna"]').val($('#wireless_antenna_input').val());
|
||
|
||
//set texts
|
||
if (parseInt($td.find('input[name^="type"]').val()) == <?php echo Iface_Model::TYPE_PORT ?>)
|
||
{
|
||
$td.find('.port_name').text('Port ' + $('#port_number_input').val() + ', <?php echo __('Mode') ?> ' + port_modes[$('#port_mode_input').val()]);
|
||
}
|
||
else
|
||
{
|
||
$td.find('.iface_name').text($('#iface_name_input').val());
|
||
}
|
||
// close dialog
|
||
$('#dialog_iface_detail').dialog('close');
|
||
}
|
||
return false;
|
||
});
|
||
|
||
$('#port_number_input').parent().parent().show();
|
||
$('#port_mode_input').parent().parent().show();
|
||
$('#wireless_mode_input').parent().parent().show();
|
||
$('#wireless_antenna_input').parent().parent().show();
|
||
|
||
switch (parseInt($td.find('input[name^="type"]').val()))
|
||
{
|
||
case <?php echo Iface_Model::TYPE_WIRELESS ?>:
|
||
$('#port_number_input').parent().parent().hide();
|
||
$('#port_mode_input').parent().parent().hide();
|
||
break;
|
||
case <?php echo Iface_Model::TYPE_ETHERNET ?>:
|
||
$('#port_number_input').parent().parent().hide();
|
||
$('#port_mode_input').parent().parent().hide();
|
||
$('#wireless_mode_input').parent().parent().hide();
|
||
$('#wireless_antenna_input').parent().parent().hide();
|
||
break;
|
||
case <?php echo Iface_Model::TYPE_PORT ?>:
|
||
$('#wireless_mode_input').parent().parent().hide();
|
||
$('#wireless_antenna_input').parent().parent().hide();
|
||
break;
|
||
case <?php echo Iface_Model::TYPE_INTERNAL ?>:
|
||
$('#port_number_input').parent().parent().hide();
|
||
$('#port_mode_input').parent().parent().hide();
|
||
$('#wireless_mode_input').parent().parent().hide();
|
||
$('#wireless_antenna_input').parent().parent().hide();
|
||
break;
|
||
};
|
||
|
||
// open dialog
|
||
$('#dialog_iface_detail').dialog({
|
||
title: '<?php echo __('Add details to interface') ?>',
|
||
modal: true,
|
||
position: ['center', 100],
|
||
width: 500
|
||
});
|
||
|
||
return false;
|
||
}
|
||
|
||
/**
|
||
... | ... | |
var type = $p.find('input[name^="type"]').val();
|
||
|
||
$p.find('input[name^="link_id"]').val(null);
|
||
$p.find('input[name^="link_name"]').val(null);
|
||
$p.find('input[name^="link_comment"]').val(null);
|
||
$p.find('input[name^="medium"]').val((type == <?php echo Iface_Model::TYPE_WIRELESS ?>) ? <?php echo Link_Model::AIR ?> : <?php echo Link_Model::CABLE ?>);
|
||
$p.find('input[name^="link_name"]').val((type == <?php echo Iface_Model::TYPE_WIRELESS ?>) ? '<?php echo network::str2bytes(Link_Model::get_wireless_max_bitrate(Link_Model::NORM_802_11_G) . 'M') ?>' : '<?php echo network::str2bytes('100M') ?>');
|
||
$p.find('input[name^="link_comment"]').val($('#link_comment_input').val());
|
||
$p.find('input[name^="bitrate"]').val($('#bitrate_input').val() + $('#bitrate_unit_input').val());
|
||
$p.find('input[name^="bitrate"]').val((data['type'] == <?php echo Iface_Model::TYPE_WIRELESS ?>) ? '<?php echo Link_Model::get_wireless_max_bitrate(Link_Model::NORM_802_11_G) ?>M' : '100M');
|
||
$p.find('input[name^="duplex"]').val(0);
|
||
$p.find('input[name^="wireless_ssid"]').val(null);
|
||
$p.find('input[name^="wireless_norm"]').val((type == <?php echo Iface_Model::TYPE_WIRELESS ?>) ? '<?php echo Link_Model::NORM_802_11_G ?>' : null);
|
||
... | ... | |
var iface_hidden_a = new Array();
|
||
iface_hidden_a['name[' + i + ']'] = (item.name == undefined) ? null : item.name;
|
||
iface_hidden_a['comment[' + i + ']'] = null;
|
||
iface_hidden_a['number[' + i + ']'] = null;
|
||
iface_hidden_a['port_mode[' + i + ']'] = null;
|
||
iface_hidden_a['number[' + i + ']'] = (item.number == undefined) ? null : item.number;
|
||
iface_hidden_a['port_mode[' + i + ']'] = (item.port_mode == undefined) ? null : item.port_mode;
|
||
iface_hidden_a['type[' + i + ']'] = data['type'];
|
||
iface_hidden_a['wireless_mode[' + i + ']'] = (item.wireless_mode == undefined) ? null : item.wireless_mode;
|
||
iface_hidden_a['wireless_antenna[' + i + ']'] = (item.wireless_antenna == undefined) ? null : item.wireless_antenna;
|
||
... | ... | |
{
|
||
var link_hidden_a = new Array();
|
||
link_hidden_a['link_id[' + i + ']'] = null;
|
||
link_hidden_a['link_name[' + i + ']'] = null;
|
||
link_hidden_a['link_comment[' + i + ']'] = null;
|
||
link_hidden_a['medium[' + i + ']'] = (data['type'] == <?php echo Iface_Model::TYPE_WIRELESS ?>) ? <?php echo Link_Model::AIR ?> : <?php echo Link_Model::CABLE ?>;
|
||
link_hidden_a['bitrate[' + i + ']'] = (data['type'] == <?php echo Iface_Model::TYPE_WIRELESS ?>) ? '<?php echo network::str2bytes(Link_Model::get_wireless_max_bitrate(Link_Model::NORM_802_11_G) . 'M') ?>' : '<?php echo network::str2bytes('100M') ?>';
|
||
link_hidden_a['bitrate[' + i + ']'] = (data['type'] == <?php echo Iface_Model::TYPE_WIRELESS ?>) ? '<?php echo Link_Model::get_wireless_max_bitrate(Link_Model::NORM_802_11_G) ?>M' : '100M';
|
||
link_hidden_a['duplex[' + i + ']'] = 0;
|
||
link_hidden_a['wireless_ssid[' + i + ']'] = null;
|
||
link_hidden_a['wireless_norm[' + i + ']'] = (data['type'] == <?php echo Iface_Model::TYPE_WIRELESS ?>) ? '<?php echo Link_Model::NORM_802_11_G ?>' : null;
|
||
... | ... | |
}
|
||
|
||
$td = $('<td>').append($('<label>').addClass('device_add_label').text('<?php echo __('Name') ?>: ')).append(
|
||
$('<b>').text(item['name'])
|
||
$('<b>').addClass('iface_name').text(item['name'])
|
||
).append($('<br>'));
|
||
|
||
if (data['has_mac'])
|
||
... | ... | |
else if (data['type'] == <?php echo Iface_Model::TYPE_PORT ?>)
|
||
{
|
||
$td.html(
|
||
$('<b>').css('fontSize', '110%').text(
|
||
$('<b>').addClass('port_name').css('fontSize', '110%').text(
|
||
'Port ' + item.number + ', <?php echo __('Mode') ?> ' + port_modes[item.port_mode]
|
||
)
|
||
);
|
Také k dispozici: Unified diff
Upravy:
- Dialogy uprav detailu rozhrani a linek pri pridavani zarizeni