Revize 1500
Přidáno uživatelem Ondřej Fibich před asi 12 roky(ů)
freenetis/branches/network/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'viewing of all records' => 'Prohlížení všech záznamů',
|
||
'viewing of own records' => 'Prohlížení vlastních záznamů',
|
||
'virus' => 'Počítačový vir',
|
||
'vlan ap setting' => 'Nastavení VLAN AP',
|
||
'vlan can be only tagged or untagged' => 'VLAN může být buď tagovaný nebo netagovaný.',
|
||
'vlan count' => 'Počet VLANů',
|
||
'vlan detail' => 'Detail VLANu',
|
freenetis/branches/network/application/models/device.php | ||
---|---|---|
'ifaces', 'device_admins', 'device_engineers'
|
||
);
|
||
|
||
protected $belongs_to = array('address_point', 'user');
|
||
protected $belongs_to = array
|
||
(
|
||
'address_point', 'user'
|
||
);
|
||
|
||
public $arr_sql = array
|
||
(
|
freenetis/branches/network/application/models/iface.php | ||
---|---|---|
const TYPE_VLAN = 5;
|
||
/** Special type of interface for configuration of switches */
|
||
const TYPE_INTERNAL = 6;
|
||
/** Virtual AP over a wireless iface */
|
||
const TYPE_VLAN_AP = 7;
|
||
|
||
/** AP mode of wireless iface */
|
||
const WIRELESS_MODE_AP = 1;
|
||
... | ... | |
const WIRELESS_MODE_CLIENT = 2;
|
||
|
||
/** Directional type of antenna */
|
||
const WIRELESS_ANTENNA_DIRECTIONAL = 1;
|
||
const WIRELESS_ANTENNA_DIRECTIONAL = 1;
|
||
/** Omnidirectional type of antenna */
|
||
const WIRELESS_ANTENNA_OMNIDIRECTIONAL = 2;
|
||
const WIRELESS_ANTENNA_OMNIDIRECTIONAL = 2;
|
||
/** Sectional type of antenna */
|
||
const WIRELESS_ANTENNA_SECTIONAL = 3;
|
||
const WIRELESS_ANTENNA_SECTIONAL = 3;
|
||
|
||
/** Const for mode access */
|
||
const PORT_MODE_ACCESS = 1;
|
||
... | ... | |
self::TYPE_PORT => 'Port',
|
||
self::TYPE_BRIDGE => 'Bridge',
|
||
self::TYPE_VLAN => 'VLAN',
|
||
self::TYPE_INTERNAL => 'Internal'
|
||
self::TYPE_INTERNAL => 'Internal',
|
||
self::TYPE_VLAN_AP => 'VLAN AP'
|
||
);
|
||
|
||
/**
|
||
... | ... | |
self::TYPE_PORT => 'port',
|
||
self::TYPE_BRIDGE => 'bridge',
|
||
self::TYPE_VLAN => 'vlan',
|
||
self::TYPE_INTERNAL => 'internal'
|
||
self::TYPE_INTERNAL => 'internal',
|
||
self::TYPE_VLAN_AP => 'vlan ap'
|
||
);
|
||
|
||
/**
|
||
... | ... | |
self::TYPE_PORT => TRUE,
|
||
self::TYPE_BRIDGE => FALSE,
|
||
self::TYPE_VLAN => FALSE,
|
||
self::TYPE_INTERNAL => FALSE
|
||
self::TYPE_INTERNAL => FALSE,
|
||
self::TYPE_VLAN_AP => TRUE
|
||
);
|
||
|
||
/**
|
||
... | ... | |
),
|
||
self::TYPE_BRIDGE => array(),
|
||
self::TYPE_VLAN => array(),
|
||
self::TYPE_INTERNAL => array()
|
||
self::TYPE_INTERNAL => array(),
|
||
self::TYPE_VLAN_AP => array
|
||
(
|
||
Link_Model::MEDIUM_ROAMING, Link_Model::MEDIUM_AIR
|
||
),
|
||
);
|
||
|
||
/**
|
||
... | ... | |
self::TYPE_PORT => FALSE,
|
||
self::TYPE_BRIDGE => TRUE,
|
||
self::TYPE_VLAN => FALSE,
|
||
self::TYPE_INTERNAL => TRUE
|
||
self::TYPE_INTERNAL => TRUE,
|
||
self::TYPE_VLAN_AP => FALSE
|
||
);
|
||
|
||
/**
|
||
... | ... | |
self::TYPE_PORT => FALSE,
|
||
self::TYPE_BRIDGE => TRUE,
|
||
self::TYPE_VLAN => TRUE,
|
||
self::TYPE_INTERNAL => TRUE
|
||
self::TYPE_INTERNAL => TRUE,
|
||
self::TYPE_VLAN_AP => TRUE
|
||
);
|
||
|
||
/**
|
||
... | ... | |
self::TYPE_PORT => array(self::TYPE_ETHERNET, self::TYPE_PORT),
|
||
self::TYPE_BRIDGE => array(),
|
||
self::TYPE_VLAN => array(),
|
||
self::TYPE_INTERNAL => array()
|
||
self::TYPE_INTERNAL => array(),
|
||
self::TYPE_VLAN_AP => array(self::TYPE_WIRELESS)
|
||
);
|
||
|
||
/**
|
||
... | ... | |
self::TYPE_BRIDGE,
|
||
self::TYPE_INTERNAL
|
||
),
|
||
self::TYPE_WIRELESS => array (self::TYPE_BRIDGE),
|
||
self::TYPE_ETHERNET => array (self::TYPE_BRIDGE),
|
||
self::TYPE_WIRELESS => array(self::TYPE_BRIDGE),
|
||
self::TYPE_ETHERNET => array(self::TYPE_BRIDGE),
|
||
self::TYPE_VLAN_AP => array(self::TYPE_WIRELESS)
|
||
);
|
||
|
||
/**
|
||
... | ... | |
unset($ntypes[self::TYPE_BRIDGE]);
|
||
unset($ntypes[self::TYPE_VLAN]);
|
||
unset($ntypes[self::TYPE_INTERNAL]);
|
||
unset($ntypes[self::TYPE_VLAN_AP]);
|
||
|
||
return array_map('__', $ntypes);
|
||
}
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Function gets count of specified mac address. Used for testing existence of that mac.
|
||
* Function gets count of specified mac address.
|
||
* Used for testing existence of that mac.
|
||
*
|
||
* @param string $mac Searched mac address
|
||
* @param integer $iface_id Iface for edit restriction
|
||
... | ... | |
LEFT JOIN links l ON i.link_id = l.id
|
||
LEFT JOIN ifaces ci ON ci.link_id = l.id AND ci.id <> i.id AND
|
||
(
|
||
i.type <> ? OR
|
||
i.type NOT IN(?, ?) OR
|
||
(
|
||
i.type = ? AND
|
||
i.type IN(?, ?) AND
|
||
(
|
||
i.wireless_mode = ? AND ci.wireless_mode = ?
|
||
) OR i.wireless_mode = ?
|
||
... | ... | |
ORDER BY i.number, i.type, i.name
|
||
", array
|
||
(
|
||
self::TYPE_WIRELESS,
|
||
self::TYPE_WIRELESS,
|
||
self::TYPE_WIRELESS, self::TYPE_VLAN_AP,
|
||
self::TYPE_WIRELESS, self::TYPE_VLAN_AP,
|
||
self::WIRELESS_MODE_CLIENT,
|
||
self::WIRELESS_MODE_AP,
|
||
self::WIRELESS_MODE_AP,
|
||
... | ... | |
JOIN ifaces i ON ir.parent_iface_id = i.id
|
||
JOIN ifaces_vlans iv ON iv.iface_id = vi.id
|
||
JOIN vlans v ON iv.vlan_id = v.id
|
||
WHERE vi.device_id = ? AND vi.type = ?
|
||
WHERE vi.device_id = ? AND vi.type IN(?, ?)
|
||
ORDER BY tag_802_1q
|
||
", array($device_id, self::TYPE_VLAN));
|
||
", array($device_id, self::TYPE_VLAN, self::TYPE_VLAN_AP));
|
||
}
|
||
|
||
/**
|
||
... | ... | |
wi.wireless_mode = ?
|
||
)
|
||
LEFT JOIN devices cd ON ci.device_id = cd.id
|
||
WHERE wi.device_id = ? AND wi.type = ?
|
||
WHERE wi.device_id = ? AND wi.type IN(?, ?)
|
||
GROUP BY wi.id
|
||
", array
|
||
(
|
||
... | ... | |
self::WIRELESS_MODE_AP,
|
||
self::WIRELESS_MODE_AP,
|
||
$device_id,
|
||
self::TYPE_WIRELESS
|
||
self::TYPE_WIRELESS,
|
||
self::TYPE_VLAN_AP
|
||
));
|
||
}
|
||
|
||
... | ... | |
|
||
if ($iface && $iface->id)
|
||
{
|
||
$can_connect = Iface_Model::get_can_connect_to($iface->type);
|
||
$can_connect = self::get_can_connect_to($iface->type);
|
||
|
||
foreach ($iface->link->ifaces as $connected_iface)
|
||
{
|
||
... | ... | |
public function get_iface_for_connecting_to_iface($user_id, $type,
|
||
$gps = array(), $filter_sql = '')
|
||
{
|
||
$can_connect = Iface_Model::get_can_connect_to($type);
|
||
$can_connect = self::get_can_connect_to($type);
|
||
$user = new User_Model($user_id);
|
||
$where = '';
|
||
|
freenetis/branches/network/application/models/vlan.php | ||
---|---|---|
", $iface_id);
|
||
}
|
||
|
||
/**
|
||
* Gets default VLAN of iface
|
||
*
|
||
* @param integer $iface_id
|
||
* @return Mysql_Result
|
||
*/
|
||
public function get_default_vlan_of_interface($iface_id = null)
|
||
{
|
||
// query
|
freenetis/branches/network/application/controllers/ifaces.php | ||
---|---|---|
->options($antennas)
|
||
->style('width:200px');
|
||
}
|
||
|
||
// print VLAN AP fields only if type is VLAN AP
|
||
if ($type == Iface_Model::TYPE_VLAN_AP)
|
||
{
|
||
$parent_ifaces = array();
|
||
|
||
foreach ($device->ifaces as $iface)
|
||
{
|
||
// limit options only if type is given
|
||
if (in_array($iface->type, Iface_Model::get_can_be_child_of($type)) &&
|
||
$iface->wireless_mode == Iface_Model::WIRELESS_MODE_AP)
|
||
{
|
||
$parent_ifaces[$iface->id] = $iface->name . ' - ' . $iface->device->name;
|
||
}
|
||
}
|
||
|
||
$parent_ifaces = array
|
||
(
|
||
NULL => '------- '.__('Select interface').' -------'
|
||
) + $parent_ifaces;
|
||
|
||
$vap_form = $form->group('VLAN AP setting');
|
||
|
||
$vap_form->dropdown('parent_iface_id')
|
||
->label('Parent interface')
|
||
->options($parent_ifaces)
|
||
->rules('required')
|
||
->style('width:200px');
|
||
}
|
||
|
||
// print link field only if type can has link
|
||
if (Iface_Model::type_has_link($type))
|
||
{
|
||
... | ... | |
$iface->wireless_mode = $form_data['wireless_mode'];
|
||
$iface->wireless_antenna = $form_data['wireless_antenna'];
|
||
}
|
||
else if ($iface->type === Iface_Model::TYPE_VLAN_AP)
|
||
{
|
||
$parent_iface = new Iface_Model($form_data['parent_iface_id']);
|
||
$iface->wireless_mode = $parent_iface->wireless_mode;
|
||
$iface->wireless_antenna = $parent_iface->wireless_antenna;
|
||
}
|
||
else if ($iface->type == Iface_Model::TYPE_PORT)
|
||
{
|
||
$iface->number = $form_data['number'];
|
||
... | ... | |
|
||
$iface->save_throwable();
|
||
|
||
if ($iface->type == Iface_Model::TYPE_VLAN)
|
||
if ($iface->type == Iface_Model::TYPE_VLAN_AP)
|
||
{
|
||
$iface_relationship = new Ifaces_relationship_Model();
|
||
$iface_relationship->iface_id = $iface->id;
|
||
$iface_relationship->parent_iface_id = $form_data['parent_iface_id'];
|
||
$iface_relationship->save_throwable();
|
||
}
|
||
else if ($iface->type == Iface_Model::TYPE_VLAN)
|
||
{
|
||
$vlan_ifaces = new Ifaces_vlan_Model();
|
||
$vlan_ifaces->iface_id = $iface->id;
|
||
$vlan_ifaces->vlan_id = $form_data['vlan_id'];
|
||
... | ... | |
foreach ($iface->device->ifaces as $i)
|
||
{
|
||
// limit options only if type is given
|
||
if (in_array($i->type, Iface_Model::get_can_be_child_of($type)))
|
||
if (in_array($i->type, Iface_Model::get_can_be_child_of($type)) &&
|
||
$i->id != $iface->id)
|
||
{
|
||
$parent_ifaces[$i->id] = $i->name . ' - ' . $i->device->name;
|
||
}
|
||
... | ... | |
->style('width:200px')
|
||
->selected($iface->wireless_antenna);
|
||
}
|
||
|
||
// print VLAN AP fields only if type is VLAN AP
|
||
if ($type == Iface_Model::TYPE_VLAN_AP)
|
||
{
|
||
$parent_ifaces = array();
|
||
|
||
foreach ($iface->device->ifaces as $i)
|
||
{
|
||
// limit options only if type is given
|
||
if (in_array($i->type, Iface_Model::get_can_be_child_of($type)) &&
|
||
$i->wireless_mode == Iface_Model::WIRELESS_MODE_AP &&
|
||
$i->id != $iface->id)
|
||
{
|
||
$parent_ifaces[$i->id] = $i->name . ' - ' . $i->device->name;
|
||
}
|
||
}
|
||
|
||
$parent_ifaces = array
|
||
(
|
||
NULL => '------- '.__('Select interface').' -------'
|
||
) + $parent_ifaces;
|
||
|
||
$parent_iface_id = null;
|
||
|
||
if ($iface->ifaces_relationships->count())
|
||
{
|
||
$parent_iface_id = $iface->ifaces_relationships->current()->parent_iface_id;
|
||
}
|
||
|
||
$vap_form = $form->group('VLAN AP setting');
|
||
|
||
$vap_form->dropdown('parent_iface_id')
|
||
->label('Parent interface')
|
||
->options($parent_ifaces)
|
||
->selected($parent_iface_id)
|
||
->rules('required')
|
||
->style('width:200px');
|
||
}
|
||
|
||
// print link field only if type can has link
|
||
if (Iface_Model::type_has_link($type))
|
||
{
|
||
... | ... | |
$iface->wireless_mode = $form_data['wireless_mode'];
|
||
$iface->wireless_antenna = $form_data['wireless_antenna'];
|
||
}
|
||
else if ($iface->type === Iface_Model::TYPE_VLAN_AP)
|
||
{
|
||
$parent_iface = new Iface_Model($form_data['parent_iface_id']);
|
||
$iface->wireless_mode = $parent_iface->wireless_mode;
|
||
$iface->wireless_antenna = $parent_iface->wireless_antenna;
|
||
|
||
// delete current
|
||
foreach ($iface->ifaces_relationships as $i)
|
||
{
|
||
$i->delete_throwable();
|
||
}
|
||
|
||
$iface_relationship = new Ifaces_relationship_Model();
|
||
$iface_relationship->iface_id = $iface->id;
|
||
$iface_relationship->parent_iface_id = $form_data['parent_iface_id'];
|
||
$iface_relationship->save_throwable();
|
||
}
|
||
else if ($iface->type == Iface_Model::TYPE_PORT)
|
||
{
|
||
$iface->number = $form_data['number'];
|
freenetis/branches/network/application/controllers/json.php | ||
---|---|---|
$address_point_model = new Address_point_Model();
|
||
|
||
$address_points = $address_point_model->like('name',$term)
|
||
->groupby('name')
|
||
->orderby('name')
|
||
->find_all()
|
||
->groupby('name')
|
||
->orderby('name')
|
||
->find_all()
|
||
->select_list();
|
||
|
||
echo json_encode(array_values($address_points));
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Callback AJAX function to get only devices of choosen user to dropdown
|
||
*
|
||
* @author Michal Kliment
|
||
*/
|
||
public function get_devices_by_user()
|
||
{
|
||
$user_id = $this->input->get('user_id');
|
||
|
||
$device_model = new Device_Model();
|
||
|
||
if ($user_id && is_numeric($user_id))
|
||
{
|
||
$devices = $device_model->where('user_id',$user_id)
|
||
->orderby('name')
|
||
->find_all();
|
||
}
|
||
else
|
||
{
|
||
$devices = $device_model->orderby('name')
|
||
->find_all();
|
||
}
|
||
|
||
$arr_devices = array();
|
||
|
||
foreach ($devices as $device)
|
||
$arr_devices[] = array('id' => $device->id, 'name' => $device->name);
|
||
|
||
echo json_encode($arr_devices);
|
||
}
|
||
|
||
/**
|
||
* Callback AJAX function to get only streets of choosen town to dropdown
|
||
*
|
||
* @author Ondřej Fibich
|
freenetis/branches/network/application/views/ifaces/show.php | ||
---|---|---|
<th colspan="2"><?php echo __('VLAN detail')?></th>
|
||
</tr>
|
||
<?php
|
||
$parents = $iface->ifaces_relationships;
|
||
$vlans = $iface->ifaces_vlans;
|
||
foreach ($parents AS $parent): ?>
|
||
foreach ($iface->ifaces_relationships AS $parent): ?>
|
||
<tr>
|
||
<th><?php echo __('Parent interface') ?></th>
|
||
<td><?php echo html::anchor('ifaces/show/'.$parent->parent_iface->id, $parent->parent_iface) ?></td>
|
||
</tr>
|
||
<?php endforeach;
|
||
foreach ($vlans AS $vlan): ?>
|
||
foreach ($iface->ifaces_vlans AS $vlan): ?>
|
||
<tr>
|
||
<th><?php echo __('VLAN') ?></th>
|
||
<td><?php echo html::anchor('vlans/show/'.$vlan->vlan->id, $vlan->vlan->name) ?></td>
|
Také k dispozici: Unified diff
Novinky:
- pridana podpora pro VLAN (#185)
Upravy:
- dalsi procisteni kodu
P.S. 1500 je muj :-) :-)