Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 384

Přidáno uživatelem Jiří Sviták před asi 15 roky(ů)

Mazani zarizeni, rozhrani, ip adres a bezdratovych nastaveni. Zbyva dodelat mazani portu, vlanu a vlan rozhrani a vazebni tabulky ports_vlans.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
'delete_user' => 'Smazat tohoto uživatele',
'delete_work' => 'Smazat tuto práci',
'delete' => 'Smazat',
'delete wireless setting' => 'Smazat bezdrátové nastavení',
'description' => 'Popis',
'destination account' => 'Cílový účet',
'destination credit account' => 'Cílový kreditní účet',
......
'device has been successfully updated' => 'Zařízení bylo úspěšně upraveno.',
'device information' => 'Informace o zařízení',
'device name' => 'Název zařízení',
'device still has at least one interface' => 'Zařízení má ještě nejméně jedno rozhraní.',
'devices list' => 'Seznam zařízení',
'devices list of member' => 'Seznam zařízení člena',
'devices' => 'Zařízení',
......
'error - cant delete interface' => 'Chyba - nelze smazat rozhraní.',
'error - cant delete ip address' => 'Chyba - nelze smazat IP adresu.',
'error - cant delete user' => 'Chyba - nelze smazat uživatele.',
'error - cant delete wireless setting' => 'Chyba - nelze smazat bezdrátové nastavení.',
'error - cant delete work' => 'Chyba - nelze smazat práci.',
'error - can\'t delete translation' => 'Chyba - nelze smazat překlad.',
'error - cant do the transfer' => 'Chyba - nelze provést transakci.',
......
'change password' => 'Změnit heslo',
'channel' => 'Kanál',
'id' => 'ID',
'interface name' => 'Název rozhraní',
'interface' => 'Rozhraní',
'interface has not been selected' => 'Rozhraní nebylo vybráno.',
'interfaces' => 'Rozhraní',
'ignore' => 'Ignorovat',
'import new invoice' => 'Import nové faktury',
'information' => 'Informace',
'infrastructure account' => 'Účet infrastruktury',
'install' => 'Instalovat',
'installation' => 'Instalace',
'interface detail' => 'Detail rozhraní',
'interface' => 'Rozhraní',
'interface name' => 'Název rozhraní',
'interfaces' => 'Rozhraní',
'interface detail' => 'Detail rozhraní',
'interface has been successfully saved' => 'Rozhraní bylo úspěšně uloženo.',
'interface has been successfully updated' => 'Rozhraní bylo úspěšně upraveno.',
'interface has been successfully deleted' => 'Rozhraní bylo úspěšně uloženo.',
'interface has been successfully deleted' => 'Rozhraní bylo úspěšně smazáno.',
'interface has not been selected' => 'Rozhraní nebylo vybráno.',
'interface name' => 'Název rozhraní',
'interface type' => 'Typ rozhraní',
'interface still has at least one ip address' => 'Rozhraní má ještě nejméně jednu IP adresu.',
'interface still has at least one wireless setting' => 'Rozhraní má ještě nejméně jedno bezdrátové nastavení.',
'interface type' => 'Typ rozhraní',
'interfaces list' => 'Seznam rozhraní',
'interfaces' => 'Rozhraní',
'interval of interruption collides with another interruption of this member' => 'Interval přerušení koliduje s jiným přerušením tohoto člena',
......
'ip address already exists' => 'IP adresa už existuje.',
'ip address detail' => 'Detail IP adresy',
'ip address does not match the subnet/mask' => 'IP adresa neodpovídá podsíti/masce.',
'ip address has been deleted' => 'IP adresa byla smazána.',
'ip address has been successfully deleted' => 'IP adresa byla úspěšně smazána.',
'ip address is required' => 'IP adresa je vyžadována.',
'ip address is successfully saved' => 'IP adresa byla úspěšně uložena.',
'ip address is successfully updated' => 'IP adresa byla úspěšně upravena.',
......
'vlans' => 'VLANy',
'welcome to the freenetis!' => 'Vítejte ve Freenetisu!',
'wireless setting' => 'Bezdrátové nastavení',
'wireless setting has been successfully deleted' => 'Bezdrátové nastavení bylo úspěšně smazáno.',
'wireless setting has been successfully saved' => 'Bezdrátové nastavení bylo úspěšně uloženo.',
'wireless setting has been successfully updated' => 'Bezdrátové nastavení bylo úspěšně upraveno.',
'work confirmation' => 'Potvrzení práce',
freenetis/trunk/kohana/application/models/wireless_setting.php
<?php
class Wireless_setting_Model extends ORM
{
protected $belongs_to = array('iface');
/**
* @author Jiri Svitak
* Function gets one wireless setting. Each property is translated.
......
public function get_wireless_setting_for_edit($iface_id)
{
return self::$db->query("SELECT
wmode, norm, frequence, channel, antenna, polarization
id, wmode, norm, frequence, channel, antenna, polarization
FROM wireless_settings
WHERE iface_id = $iface_id");
}
freenetis/trunk/kohana/application/models/iface.php
protected $belongs_to = array('segment','device');
protected $has_many = array('vlan_ifaces','ip_addresses');
protected $has_one = array('wireless_setting');
public function count_ifaces_of_device($device_id)
{
......
WHERE device_id = $device_id
");
}
public function count_ws_of_iface($iface_id)
{
return self::$db->query("SELECT count(*) as total
FROM wireless_settings
WHERE iface_id = $iface_id"
)->current()->total;
}
}
?>
freenetis/trunk/kohana/application/controllers/ifaces.php
$iface = new Iface_Model($iface_id);
if (!$this->acl_check_delete('Devices_Controller', 'iface', $iface->device->user->member_id))
Controller::error(1);
if ($iface->delete())
$this->session->set_flash('message', url_lang::lang('texts.Interface has been successfully deleted.'));
else
$this->session->set_flash('message', url_lang::lang('texts.Error - cant delete interface.'));
if ($ssDevice_id)
$link_back = url_lang::base().'devices/show/'.$ssDevice_id;
else
$link_back = url_lang::base().'ifaces/show_all';
$ips = $iface->find_related_ip_addresses();
// ORM doesn't work in this case (1:0 relation), so number of wireless settings has to be detected manually
$ws = $iface->count_ws_of_iface($iface_id);
//echo $result;
//print_r($ws);
//$this->profiler = new Profiler();
//echo $this->profiler->render(true);
//die();
if (count($ips) == 0 && $ws == 0)
{
if ($iface->delete())
$this->session->set_flash('message', url_lang::lang('texts.Interface has been successfully deleted.'));
else
$this->session->set_flash('message', url_lang::lang('texts.Error - cant delete interface.'));
}
else
{
if (count($ips) != 0)
$this->session->set_flash('message', url_lang::lang('texts.Interface still has at least one ip address.'));
else
$this->session->set_flash('message', url_lang::lang('texts.Interface still has at least one wireless setting.'));
}
url::redirect($link_back);
}
else
freenetis/trunk/kohana/application/controllers/wireless_settings.php
*/
function add($iface_id = null)
{
if (!$this->acl_check_add('Devices_Controller', 'wireless_setting'))
if (!$this->acl_check_new('Devices_Controller', 'wireless_setting'))
Controller::error(1);
if (isset($iface_id))
{
......
*/
function edit($iface_id)
{
if ($this->acl_check_edit('Devices_Controller', 'wireless_setting'))
if (!$this->acl_check_edit('Devices_Controller', 'wireless_setting'))
Controller::error(1);
if (isset($iface_id))
{
......
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$form->dropdown('wmode')->label(url_lang::lang('texts.Mode').':')->options($arr_modes)->rules('required')->selected($wireless->wmode);
$form->dropdown('norm')->label(url_lang::lang('texts.Norm').':')->options($arr_norms)->rules('required')->selected($wireless->norm);
$form->frequence('frequnce')->label(url_lang::lang('texts.Frequence').':')->value($wireless->frequence);
$form->input('frequence')->label(url_lang::lang('texts.Frequence').':')->value($wireless->frequence);
$form->input('channel')->label(url_lang::lang('texts.Channel').':')->value($wireless->channel);
$form->dropdown('antenna')->label(url_lang::lang('texts.Antenna').':')->options($arr_antennas)->rules('required')->selected($wireless->antenna);
$form->dropdown('polarization')->label(url_lang::lang('texts.Polarization').':')->options($arr_polarizations)->rules('required')->selected($wireless->polarization);
......
{
$form_data[$key] = htmlspecialchars($value);
}
unset($wireless_model);
$wireless_model = new Wireless_setting_Model();
$wireless_model->find_by_id($wireless->id);
$wireless_model->iface_id = $iface_id;
$wireless_model->wmode = $form_data['wmode'];
$wireless_model->norm = $form_data['norm'];
$wireless_model->frequence = $form_data['frequnce'];
$wireless_model->frequence = $form_data['frequence'];
$wireless_model->channel = $form_data['channel'];
$wireless_model->antenna = $form_data['antenna'];
$wireless_model->polarization = $form_data['polarization'];
......
Controller::warning(1);
}
}
/**
* Function deletes wireless setting from interface.
* @param $iface_id
* @return unknown_type
*/
function delete($iface_id)
{
if (isset($iface_id))
{
// gets information from session to know where to return
$ssDevice_id = $this->session->get('ssDevice_id');
$ws_model = new Wireless_setting_Model();
$ws = $ws_model->get_wireless_setting_for_edit($iface_id)->current();
$ws = $ws_model->find_by_id($ws->id);
if (!$this->acl_check_delete('Devices_Controller', 'wireless_setting', $ws->iface->device->user->member_id))
Controller::error(1);
$link_back = url_lang::base()."ifaces/show/$iface_id";
if ($ws_model->delete())
$this->session->set_flash('message', url_lang::lang('texts.Wireless setting has been successfully deleted.'));
else
$this->session->set_flash('message', url_lang::lang('texts.Error - cant delete wireless setting.'));
url::redirect($link_back);
}
else
{
Controller::warning(1);
}
}
}
?>
freenetis/trunk/kohana/application/controllers/devices.php
$sql_offset = 0;
$query = $device_model->get_all_by_member($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $member_id);
$grid = new Grid(url_lang::base().'devices/show_by_member', url_lang::lang('texts.Devices list of member').' '.$member->name,array(
$headline = url_lang::lang('texts.Devices list of member').' '.$member->name;
$grid = new Grid(url_lang::base().'devices/show_by_member', null,array(
//'separator' => '&nbsp;&nbsp;-&nbsp;&nbsp;',
//'use_paginator' => false,
//'use_selector' => false,
......
$grid->action_field('id')->label(url_lang::lang('texts.Device'))->url(url_lang::base().'devices/show')->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit(get_class($this),'devices',$member_id))
$grid->action_field('id')->label(url_lang::lang('texts.Device'))->url(url_lang::base().'devices/edit')->action(url_lang::lang('texts.Edit'))->class('center');
// if ($this->acl_check_delete('Devices_Controller', 'devices', $member_id))
// $grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'devices/delete')->action(url_lang::lang('texts.Delete'))->class('center');
if ($this->acl_check_delete('Devices_Controller', 'devices', $member_id))
$grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'devices/delete')->action(url_lang::lang('texts.Delete'))->class('center');
$grid->datasource($query);
$view = new View('template');
$view->header = new View('base/header');
$view->header->title = url_lang::lang('texts.Devices list');
$view->header->title = $headline;
$view->header->menu = Controller::render_menu();
$view->content = $grid;
$view->content = new View('show_all');
$view->content->headline = $headline;
$view->content->table = $grid;
$view->footer = new View('base/footer');
$view->render(TRUE);
}
......
$linkback = url_lang::base()."devices/show_by_member/$member_id";
else
$linkback = url_lang::base()."devices/show_all";
if ($device->delete())
$this->session->set_flash('message', url_lang::lang('texts.Device has been successfully deleted.'));
$ifaces = $device->find_related_ifaces();
if (count($ifaces) == 0)
{
if ($device->delete())
$this->session->set_flash('message', url_lang::lang('texts.Device has been successfully deleted.'));
else
$this->session->set_flash('message', url_lang::lang('texts.Error - cant delete device.'));
}
else
$this->session->set_flash('message', url_lang::lang('texts.Error - cant delete device.'));
{
$this->session->set_flash('message', url_lang::lang('texts.Device still has at least one interface.'));
}
url::redirect($linkback);
}
else
......
exit;
}
} // end of validation
$view = new View('template');
$view->header = new View('base/header');
// $view->content = new View('content', $data);
$view->content = new View('form');
$view->content->form = $form->html();
if($ssMember_id)
{
$view->content->link_back = html::anchor(url_lang::base().'devices/show_by_member/'.$ssMember_id, url_lang::lang('texts.Back to devices list of this member'));
......
$view->content->link_back = html::anchor(url_lang::base().'devices/show_all/', url_lang::lang('texts.Back to devices list'));
$view->content->headline = url_lang::lang('texts.Add new whole device');
}
$view->footer = new View('base/footer');
$view->header->title = url_lang::lang('texts.Add new whole device');
$view->header->menu = Controller::render_menu();
freenetis/trunk/kohana/application/views/show_device.php
<th><?php echo url_lang::lang('texts.ID') ?></th>
<td><?php echo $device->id ?></td>
</tr>
<!-- list of engineers will be replaced by autonomous table
<tr>
<th><?php //if(count($engineers)<=1) echo url_lang::lang('texts.Engineer'); else echo url_lang::lang('texts.Engineers')?></th>
<td><?php //echo implode(', ',$engineers) ?></td>
</tr>
-->
<tr>
<th><?php echo url_lang::lang('texts.User') ?></th>
<td><?php echo html::anchor(url_lang::base().'users/show/'.$device->user->id,$device->user->name.' '.$device->user->surname); ?></td>
</tr>
freenetis/trunk/kohana/application/views/ifaces/show.php
if (count($wireless) == 0)
echo ' | '.html::anchor(url_lang::base().'wireless_settings/add/'.$iface->id, url_lang::lang('texts.Add wireless setting'));
else
{
echo ' | '.html::anchor(url_lang::base().'wireless_settings/edit/'.$iface->id, url_lang::lang('texts.Edit wireless setting'));
echo ' | '.html::anchor(url_lang::base().'wireless_settings/delete/'.$iface->id, url_lang::lang('texts.Delete wireless setting'));
}
?>
<br /><br />
......
<th colspan="2">'.url_lang::lang("texts.Wireless setting").'</th>
</tr>
<tr>
<th>'.url_lang::lang("texts.ID").'</th>
<td>'.$setting->id.'</td>
</tr>
<tr>
<th>'.url_lang::lang("texts.Mode").'</th>
<td>'.$setting->wmode.'</td>
</tr>
freenetis/trunk/kohana/application/views/show_all.php
<h2><?php echo $headline ?></h2>
<?php echo ($message = $this->session->get('message')) ? '<div class="message">'.$message.'</div>' : '' ?>
<?php echo (isset($create)) ? $create : '' ?>
<br />
<?php echo $table ?>

Také k dispozici: Unified diff