Revize 18ac9009
Přidáno uživatelem Ondřej Fibich před asi 9 roky(ů)
application/controllers/ip_addresses.php | ||
---|---|---|
->callback('boolean')
|
||
->class('center');
|
||
|
||
$grid->order_callback_field('dns')
|
||
->label('DNS server')
|
||
->help(help::hint('dns_server'))
|
||
->callback('boolean')
|
||
->class('center');
|
||
|
||
if (module::e('notification'))
|
||
{
|
||
$grid->order_callback_field('whitelisted')
|
||
... | ... | |
->options(arr::rbool())
|
||
->selected('0');
|
||
|
||
$this->form->dropdown('dns')
|
||
->label(__('DNS server'))
|
||
->help(help::hint('dns_server'))
|
||
->options(arr::rbool())
|
||
->selected('0');
|
||
|
||
$this->form->submit('Save');
|
||
|
||
// validate form and save data
|
||
... | ... | |
$ip_address->subnet_id = $form_data['subnet_id'];
|
||
$ip_address->gateway = $form_data['gateway'];
|
||
$ip_address->service = $form_data['service'];
|
||
$ip_address->dns = $form_data['dns'];
|
||
$ip_address->member_id = NULL;
|
||
$ip_address->save_throwable();
|
||
|
||
... | ... | |
->options(arr::rbool())
|
||
->selected($ip_address->service);
|
||
|
||
$dns_zone_model = new Dns_zone_Model();
|
||
$zones_count = count($dns_zone_model->get_zones_of_primary_server($ip_address->id)) +
|
||
count($dns_zone_model->get_zones_of_secondary_server($ip_address->id));
|
||
$dns_on = $zones_count > 0;
|
||
|
||
$this->form->dropdown('dns')
|
||
->label(__('DNS server'))
|
||
->help(help::hint('dns_server'))
|
||
->options(arr::rbool())
|
||
->selected($dns_on || $ip_address->dns);
|
||
|
||
$this->form->submit('Save');
|
||
|
||
// validate form and save data
|
||
... | ... | |
$ip_address->subnet_id = $form_data['subnet_id'];
|
||
$ip_address->gateway = $form_data['gateway'];
|
||
$ip_address->service = $form_data['service'];
|
||
$ip_address->dns = ($dns_on ? 1 : $form_data['dns']);
|
||
$ip_address->member_id = NULL;
|
||
|
||
$ip_address->save_throwable();
|
||
... | ... | |
{
|
||
status::warning('Error - cannot update allowed subnets of member.');
|
||
}
|
||
|
||
if ($dns_on && !$form_data['dns'])
|
||
{
|
||
status::warning(__('Cannot turn DNS server off.') . ' ' . __('DNS server running on this IP address manages some DNS zones (%d).', $zones_count), FALSE);
|
||
}
|
||
|
||
status::success('IP address has been successfully updated.');
|
||
$this->redirect('ip_addresses/show/'.$ip_address->id);
|
||
... | ... | |
// link back
|
||
$linkback = Path::instance()->previous();
|
||
|
||
$dns_zone_model = new Dns_zone_Model();
|
||
$zones_count = count($dns_zone_model->get_zones_of_primary_server($ip_address->id)) +
|
||
count($dns_zone_model->get_zones_of_secondary_server($ip_address->id));
|
||
if ($zones_count > 0)
|
||
{
|
||
status::warning(__('Error - cant delete ip address.') . ' ' . __('DNS server running on this IP address manages some DNS zones (%d).', $zones_count), FALSE);
|
||
$this->redirect($linkback);
|
||
}
|
||
|
||
if (url::slice(url_lang::uri($linkback), 0, 2) == 'ip_addresses/show')
|
||
{
|
||
$linkback = 'ip_addresses/show_all';
|
||
... | ... | |
{
|
||
$ip_address->member_id = $ip_address->subnet->subnets_owner->member->id;
|
||
$ip_address->iface_id = NULL;
|
||
$ip_address->gateway = 0;
|
||
|
||
$ip_address->save_throwable();
|
||
}
|
Také k dispozici: Unified diff
Fix merge issue that removed all staff from developer branch :-).