Revize 173
Přidáno uživatelem Michal Kliment před více než 15 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'add new whole device' => 'Přidat nové celé zařízení (router, PC, NB)',
|
||
'add new work' => 'Přidat novou práci',
|
||
'add' => 'Přidat',
|
||
'add whole new device' => 'Přidání celého nového zařízení',
|
||
'additional_contacts_infotext' => 'Další kontaktní informace',
|
||
'address' => 'Adresa',
|
||
'aditional contacts successfully updated' => 'Další kontakty úspěšně uloženy',
|
||
... | ... | |
'create new subnet' => 'Vytvoření nové podsítě',
|
||
'create new vlan interface' => 'Vytvoření nového VLAN rozhraní',
|
||
'create new vlan' => 'Vytvořit nový VLAN',
|
||
'create whole new device' => 'Vytvořit celé nové zařízení',
|
||
'current credit'=> 'Stav kreditu',
|
||
'current credit on this account is'=> 'Stav kreditu na tomto účtu je',
|
||
'czk'=> 'Kč',
|
||
... | ... | |
'destination account'=> 'Cílový účet',
|
||
'detail of transfer number'=> 'Detail transakce č.',
|
||
'details'=> 'Detaily',
|
||
'device' => 'Zařízení',
|
||
'device admin is successfully saved' => 'Správce zařízení byl úspěšně uložen.',
|
||
'device admin is successfully updated' => 'Správce zařízení byl úspěšně upraven.',
|
||
'device admins' => 'Správci zařízení',
|
||
... | ... | |
'change password'=> 'Změnit heslo',
|
||
'id' => 'ID',
|
||
'iface name' => 'Název rozhraní',
|
||
'iface' => 'Rozhraní',
|
||
'ifaces' => 'Rozhraní',
|
||
'in database can be only one infrastructure account.'=> 'V databázi může být pouze jeden účet infrastruktury.',
|
||
'in database can be only one master bank account.'=> 'V databázi může být pouze jeden hlavní bankovní účet',
|
||
... | ... | |
'interfaces list' => 'Seznam rozhraní',
|
||
'interfaces' => 'Rozhraní',
|
||
'ip address detail' => 'Detail IP adresy',
|
||
'ip address does not match the subnet/mask' => 'IP adresa neodpovídá podsíti/masce',
|
||
'ip address is successfully saved' => 'IP adresa byla úspěšně uložena.',
|
||
'ip address is successfully updated' => 'IP adresa byla úspěšně upravena.',
|
||
'ip address' => 'IP adresa',
|
freenetis/trunk/kohana/application/controllers/devices.php | ||
---|---|---|
|
||
$ssMember_id = $this->session->get('ssMember_id');
|
||
|
||
$form = new Forge(url_lang::base()."devices/add", '', 'POST', array('id' => 'article_form'));
|
||
$form = new Forge(url_lang::base()."devices/add_whole", '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
|
||
$form->group('')->label(url_lang::lang('texts.Basic data'));
|
||
$form->group('')->label(url_lang::lang('texts.Device'));
|
||
|
||
$model_user = new User_Model;
|
||
|
||
... | ... | |
$arr_subnets_ids, SORT_NUMERIC, SORT_ASC,
|
||
$arr_subnets_netnames, SORT_STRING, SORT_ASC);
|
||
|
||
$segment_model = new Segment_Model();
|
||
$segments = $segment_model->select(array('id','name'))->orderby('name')->find_all();
|
||
$arr_segments[0] = '----- '.url_lang::lang('texts.select segment').' -----';
|
||
foreach ($segments as $segment) {
|
||
$arr_segments[$segment->id] = $segment->name;
|
||
}
|
||
|
||
// form
|
||
// ----
|
||
// adding device only
|
||
... | ... | |
$form->dropdown('first_engineer_id')->label(url_lang::lang('texts.engineer').' 1:')->options($arr_engineers)->rules('required')->selected($this->session->get('user_id'));
|
||
$form->dropdown('second_engineer_id')->label(url_lang::lang('texts.engineer').' 2:')->options($arr_engineers);
|
||
|
||
|
||
$form->group('')->label(url_lang::lang('texts.Iface'));
|
||
// adding interface - copied from ifaces.php
|
||
$form->input('MAC')->label(url_lang::lang('texts.MAC').':')->rules('required|length[3,250]');
|
||
$form->textarea('comment')->label(url_lang::lang('texts.comment').':')->rules('length[0,254]')->cols('20')->rows('5');
|
||
$form->input('MAC')->label(url_lang::lang('texts.MAC').':')->rules('required|length[3,250]');
|
||
$form->dropdown('segment_id')->label(url_lang::lang('texts.Segment name'))->options($arr_segments)->rules('required');
|
||
|
||
|
||
$form->group('')->label(url_lang::lang('texts.IP address'));
|
||
// adding ip address - copied from ip_addresses.php
|
||
$form->input('IP_address')->label(url_lang::lang('texts.IP address').':')
|
||
->callback(array($this, 'valid_ip'));
|
||
$form->dropdown('subnet_id')->label(url_lang::lang('texts.Select subnet name').':')
|
||
$form->input('IP_address')->label(url_lang::lang('texts.IP address').':')->rules('required|length[7,15]')
|
||
->callback(array($this, 'valid_ip'));
|
||
$form->dropdown('subnet_id')->label(url_lang::lang('texts.Select subnet name').':')->rules('required')
|
||
->options($arr_subnets_names);
|
||
|
||
|
||
... | ... | |
$device_engineer_saved = $device_engineer_saved && $device_engineer_model->save();
|
||
}
|
||
|
||
$iface_model = new Iface_Model();
|
||
|
||
// interface model
|
||
$iface_model->device_id = $device_model->id;
|
||
$iface_model->segment_id = $segment_model->id;
|
||
$iface_model->segment_id = $form_data["segment_id"];
|
||
$iface_model->MAC = htmlspecialchars($form_data["MAC"]);
|
||
$iface_model->name = $device_model->name;
|
||
$iface_model->comment = NULL;
|
||
//$iface_model->comment = NULL;
|
||
// iface save
|
||
$iface_model_saved = $iface_model->save();
|
||
|
||
$ip_address_model = new Ip_address_Model();
|
||
|
||
// ip address model
|
||
$ip->iface_id = htmlspecialchars($form_data["iface_id"]);
|
||
$ip->vlan_iface_id = NULL;
|
||
$ip->subnet_id = $form_data['subnet_id'];
|
||
$ip->IP_address = $form_data['IP_address'];
|
||
$ip->dhcp = NULL;
|
||
$ip_address_model->iface_id = $iface_model->id;
|
||
$ip_address_model->vlan_iface_id = NULL;
|
||
$ip_address_model->subnet_id = $form_data['subnet_id'];
|
||
$ip_address_model->IP_address = $form_data['IP_address'];
|
||
$ip_address_model->dhcp = NULL;
|
||
|
||
// ip save
|
||
$ip_saved = $ip->save();
|
||
$ip_address_saved = $ip_address_model->save();
|
||
|
||
|
||
unset($form_data);
|
||
|
||
if ($device_saved && $device_engineer_saved && $iface_model_saved && $ip_saved)
|
||
if ($device_saved && $device_engineer_saved && $iface_model_saved && $ip_address_saved)
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Device is successfully saved.'));
|
||
url::redirect(url_lang::base().'devices/show/'.$device_model->id);
|
||
... | ... | |
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->headline = url_lang::lang('texts.Create new devices for member').' '.$member->name;
|
||
$view->content->headline = url_lang::lang('texts.Create whole new device for member').' '.$member->name;
|
||
}
|
||
else
|
||
{
|
||
$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.Create new devices');
|
||
$view->content->headline = url_lang::lang('texts.Create whole new device');
|
||
}
|
||
|
||
|
||
|
||
$view->footer = new View('base/footer');
|
||
|
||
$view->header->title = url_lang::lang('texts.Add new device');
|
||
$view->header->title = url_lang::lang('texts.Add whole new device');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->render(TRUE);
|
||
}
|
||
//----- end ADD WHOLE DEVICE---------------------------------------------------
|
||
//=============================================================================
|
||
|
||
|
||
function valid_ip($input) {
|
||
//$method=$form->IP_address->method; // <FORM> method = POST, GET, ...
|
||
$ip=ip2long($this->input->post('IP_address')); // Submitted values
|
||
$subnet_id=$this->input->post('subnet_id');
|
||
|
||
if ($subnet_id==0) { // subnet was not selected
|
||
if ($ip > 0) // try to find a subnet matching to the ip
|
||
$input->add_error('required', url_lang::lang('texts.Subnet not selected - trying to guess!'));
|
||
else
|
||
$input->add_error('required', url_lang::lang('texts.Invalid IP!'));
|
||
return false;
|
||
|
||
}
|
||
|
||
$subnet=$this->arr_net_by_id[$subnet_id];
|
||
$mask=$this->arr_mask_by_id[$subnet_id];
|
||
|
||
if ($ip>0) $this->check_ip($ip, $subnet, $mask, $input);
|
||
else $input->add_error('required', url_lang::lang('texts.IP address required!'));
|
||
|
||
}
|
||
function check_ip($ip, $net, $mask, $input) {
|
||
$mask=0xffffffff<<(32-$mask) & 0xffffffff;
|
||
//printf(" ip=%lx, net=%lx, mask=%lx, AND=%lx", $ip, $net, $mask, $ip & $mask);
|
||
|
||
if (($ip & $mask) != $net)
|
||
$input->add_error('required', url_lang::lang('texts.IP address does not match the subnet/mask'));
|
||
else if ($ip==$net || $ip==($net | ~$mask))
|
||
$input->add_error('required', url_lang::lang('texts.Invalid IP!'));
|
||
|
||
}
|
||
|
||
}
|
||
?>
|
||
|
freenetis/trunk/kohana/CHANGELOG | ||
---|---|---|
|
||
|
||
|
||
Revize 172 - duben 2009
|
||
Revize 172-173 - duben 2009
|
||
|
||
Opraveno přidávání kompletního zařízení, nyní přidává i informace o rozhraní a IP adrese.
|
||
Přidání tohoto changelogu :-)
|
||
|
||
*************************************************************************************************************************
|
Také k dispozici: Unified diff
Opravena funkce na pridavani kompletnich zarizeni vcetne IP adres a MAC.