Revize 1827
Přidáno uživatelem Ondřej Fibich před více než 11 roky(ů)
freenetis/branches/1.1/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'cannot enable voip driver, allow `%s` rights for mysql user' => 'Nemohu povolit VoIP ovladač, povolte právo `%s` pro MySQL uživatele',
|
||
'cannot find detail dumps' => 'Nemohu nalézt podrobné výpisy.',
|
||
'cannot load heading of invoice' => 'Nemohu načíst hlavičku faktury',
|
||
'cannot load mac address, reason' => 'Nemohu načíst MAC adresu, důvod',
|
||
'cannot load services - data missing' => 'Nemohu načíst služby - data chybí',
|
||
'cannot open uploaded bank listing file!' => 'Nelze otevřít nahraný soubor s bankovním výpisem!',
|
||
'cannot parse fio listing header!' => 'Nelze parsovat hlavičku Fio výpisu!',
|
||
... | ... | |
'interval of update' => 'Interval aktualizace',
|
||
'invalid connect to interface - already has different link' => 'Nelze se připojit k rozhraní - již má jinou linku',
|
||
'invalid date' => 'Neplatné datum!',
|
||
'invalid input data' => 'Neplatná vstupní data',
|
||
'invalid ip address' => 'Chybná IP adresa',
|
||
'invalid mac address' => 'Chybná MAC adresa',
|
||
'invalid network address' => 'Neplatná adresa sítě !',
|
freenetis/branches/1.1/application/controllers/json.php | ||
---|---|---|
}
|
||
|
||
/**
|
||
* Callback AJAX funxtion to obtain MAC address from given IP and subnet.
|
||
*
|
||
* @author Ondřej Fibich
|
||
*/
|
||
public function obtain_mac_address()
|
||
{
|
||
$subnet_id = $this->input->get('subnet_id');
|
||
$ip_address = $this->input->get('ip_address');
|
||
|
||
$ip_address_model = new Ip_address_Model();
|
||
$dhcp_device = $ip_address_model->get_gateway_of_subnet($subnet_id);
|
||
|
||
if ($dhcp_device && $dhcp_device->id && valid::ip($ip_address))
|
||
{
|
||
try
|
||
{
|
||
$snmp = Snmp_Factory::factoryForDevice($dhcp_device->ip_address);
|
||
$mac_address = $snmp->getMacAddressOf($ip_address);
|
||
die(json_encode(array
|
||
(
|
||
'state' => 1,
|
||
'mac' => $mac_address
|
||
)));
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
Log::add_exception($e);
|
||
die(json_encode(array
|
||
(
|
||
'state' => 0,
|
||
$e->getMessage()
|
||
)));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
die(json_encode(array
|
||
(
|
||
'state' => 0,
|
||
'message' => __('Invalid input data')
|
||
)));
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* Callback AJAX function to filter's whisper for organization identifier
|
||
*
|
||
* @author Michal Kliment
|
freenetis/branches/1.1/application/views/js/devices_add.php | ||
---|---|---|
|
||
if (data['has_mac'])
|
||
{
|
||
var auto_fill = false;
|
||
|
||
html_buffer.push('<label class="device_add_label">MAC: </label>');
|
||
html_buffer.push('<input type="text" name="mac[');
|
||
html_buffer.push(i);
|
||
... | ... | |
// add mac from request
|
||
if ((default_iface >= 0) && (i == default_iface))
|
||
{
|
||
auto_fill = true;
|
||
html_buffer.push('value="<?php echo $connection_request_model->mac_address ?>" ');
|
||
}
|
||
<?php endif; ?>
|
||
|
||
html_buffer.push('class="mac_address mac_address_check" style="width: 12em" />');
|
||
|
||
if (!auto_fill) // auto loading of MAC addresses
|
||
{
|
||
html_buffer.push('<a href="#" title="<?php echo __('Automatically load mac address') ?>" class="device_add_detail_button load_mac" style="display:none">');
|
||
html_buffer.push('<?php echo html::image(array('src' => 'media/images/icons/refresh.gif')) ?>');
|
||
html_buffer.push('</a>');
|
||
}
|
||
}
|
||
else if (data['type'] == <?php echo Iface_Model::TYPE_PORT ?>)
|
||
{
|
||
... | ... | |
}
|
||
});
|
||
|
||
// automatically load MAC address
|
||
$('.load_mac').live('click', function ()
|
||
{
|
||
var $this = $(this);
|
||
var $img = $this.find('img');
|
||
var loader = '<?php echo url::base() ?>media/images/icons/animations/ajax-loader.gif';
|
||
|
||
if ($img.attr('src') == loader)
|
||
return false; // waiting
|
||
|
||
var index = $this.parent().find('input[type="text"]').attr('name').substr('mac'.length);
|
||
var ip = $('input[name="ip' + index + '"]').val();
|
||
var subnet_id = $('select[name="subnet' + index + '"]').val();
|
||
|
||
if (ip.length && subnet_id.length)
|
||
{
|
||
var oldSrc = $this.find('img').attr('src');
|
||
$img.attr('src', loader);
|
||
// get MAC
|
||
$.getJSON('<?php echo url_lang::base() ?>/json/obtain_mac_address', {ip_address:ip,subnet_id:subnet_id}, function (data)
|
||
{
|
||
$img.attr('src', oldSrc);
|
||
|
||
if (data.state)
|
||
{
|
||
$('input[name="mac' + index + '"]').val(data.mac);
|
||
$this.hide();
|
||
}
|
||
else
|
||
{
|
||
alert('<?php echo __('Cannot load mac address, reason') ?>:\n' + data.message);
|
||
}
|
||
});
|
||
}
|
||
|
||
return false;
|
||
});
|
||
|
||
// change visibility of MAc autofill after setting of a value to IP and subnet fields
|
||
$('input[name^="ip["], select[name^="subnet["]').live('keyup change', function ()
|
||
{
|
||
var ip = $(this).parent().find('input[name^="ip["]').val();
|
||
var subnet_id = $(this).parent().find('select[name^="subnet["]').val();
|
||
|
||
if (subnet_id.match(/^[0-9]+$/) && ip.match(/^([0-9]{1,3}\.){3}([0-9]{1,3})$/))
|
||
{
|
||
$(this).parent().parent().find('.load_mac').show();
|
||
}
|
||
else
|
||
{
|
||
$(this).parent().parent().find('.load_mac').hide();
|
||
}
|
||
});
|
||
|
||
<?php if (!empty($connection_request_model)): ?>
|
||
// confirm first part of form after loading
|
||
$('#device_add_form').submit();
|
Také k dispozici: Unified diff
Novinky:
- fixes #463: Automaticke nacitani MAC adresy pri pridavani zarizeni