Revize 1198
Přidáno uživatelem Michal Kliment před více než 13 roky(ů)
freenetis/branches/testing/application/vendors/unit_tester/unit_testing_config.xml | ||
---|---|---|
</input>
|
||
</values>
|
||
</method>
|
||
<method name="show_vlan_iface" autogenerate="on">
|
||
<attributes>
|
||
<attribute name="vlan_iface_id" default_value="" />
|
||
</attributes>
|
||
<values>
|
||
<input></input>
|
||
<input>
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="show_ip_address" autogenerate="on">
|
||
<attributes>
|
||
<attribute name="ip_address_id" default_value="" />
|
||
</attributes>
|
||
<values>
|
||
<input></input>
|
||
<input>
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="valid_ip" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="input" default_value=""/>
|
||
... | ... | |
</input>
|
||
</values>
|
||
</method>
|
||
<method name="get_allowed_member_ips" autogenerate="on">
|
||
<attributes></attributes>
|
||
<values>
|
||
<input></input>
|
||
</values>
|
||
</method>
|
||
<method name="get_ip_addresses_of_subnet" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="subnet_id" default_value=""/>
|
freenetis/branches/testing/application/helpers/callback.php | ||
---|---|---|
$class = 'more';
|
||
|
||
if ($item->ip_address_id)
|
||
echo html::anchor(url_lang::base()."ip_addresses/show/$item->ip_address_id", $ip_address, array('class' => $class, 'title' => $title));
|
||
{
|
||
if (url_lang::current(1) == 'devices')
|
||
{
|
||
echo html::anchor(
|
||
url_lang::base()."devices/show_ip_address/$item->ip_address_id",
|
||
$ip_address, array('class' => $class, 'title' => $title)
|
||
);
|
||
}
|
||
else
|
||
{
|
||
echo html::anchor(
|
||
url_lang::base()."ip_addresses/show/$item->ip_address_id",
|
||
$ip_address,
|
||
array('class' => $class, 'title' => $title)
|
||
);
|
||
}
|
||
}
|
||
else if ($item->ip_address != '')
|
||
echo '<span style="color: green" class="'.$class.'" title="'.$title.'">'.$ip_address.'</span>';
|
||
else
|
||
... | ... | |
*/
|
||
public static function vlan_iface_field ($item, $name)
|
||
{
|
||
echo html::anchor (url_lang::base().'vlan_ifaces/show/'.$item->vlan_iface_id, $item->vlan_iface_name, array('title' => url_lang::lang('texts.Show VLAN interface')));
|
||
if (url_lang::current(TRUE) == 'devices')
|
||
echo html::anchor (url_lang::base().'devices/show_vlan_iface/'.$item->vlan_iface_id, $item->vlan_iface_name, array('title' => url_lang::lang('texts.Show VLAN interface')));
|
||
else
|
||
echo html::anchor (url_lang::base().'vlan_ifaces/show/'.$item->vlan_iface_id, $item->vlan_iface_name, array('title' => url_lang::lang('texts.Show VLAN interface')));
|
||
}
|
||
|
||
/**
|
||
... | ... | |
*/
|
||
public static function mac_address_field ($item, $name)
|
||
{
|
||
echo html::anchor(url_lang::base().'ifaces/show/'.$item->iface_id, $item->mac, array('title' => $item->iface_name));
|
||
if (url_lang::current(1) == 'devices')
|
||
echo html::anchor(url_lang::base().'devices/show_iface/'.$item->iface_id, $item->mac, array('title' => $item->iface_name));
|
||
else
|
||
echo html::anchor(url_lang::base().'ifaces/show/'.$item->iface_id, $item->mac, array('title' => $item->iface_name));
|
||
}
|
||
|
||
/**
|
freenetis/branches/testing/application/controllers/ifaces.php | ||
---|---|---|
{
|
||
$actions->add_action()
|
||
->icon_action('show')
|
||
->url('ip_addresses/show');
|
||
->url('devices/show_ip_address');
|
||
}
|
||
|
||
if ($this->acl_check_edit(
|
||
... | ... | |
if ($this->acl_check_view(
|
||
'Devices_Controller','vlan_iface',$iface->device->user->member_id))
|
||
{
|
||
if (url_lang::current(TRUE) == 'devices')
|
||
$url = 'devices/show_vlan_iface';
|
||
else
|
||
$url = 'vlan_ifaces/show';
|
||
|
||
$actions->add_action()
|
||
->icon_action('show')
|
||
->url('vlan_ifaces/show');
|
||
->url($url);
|
||
}
|
||
|
||
if ($this->acl_check_edit(
|
||
... | ... | |
if ($iface->save())
|
||
{
|
||
status::success('Interface has been successfully saved.');
|
||
url::redirect(url_lang::base().'ifaces/show/'.$iface->id);
|
||
if (Path::instance()->previous()->uri()->current(0,1) == 'devices')
|
||
url::redirect(url_lang::base() . 'devices/show_iface/' . $iface->id);
|
||
else
|
||
url::redirect(url_lang::base() . 'ifaces/show/' . $iface->id);
|
||
}
|
||
}
|
||
|
freenetis/branches/testing/application/controllers/vlan_ifaces.php | ||
---|---|---|
|
||
if ($this->acl_check_view('Devices_Controller', 'ip_address'))
|
||
{
|
||
if (url_lang::current(TRUE) == 'devices')
|
||
$url = 'devices/show_ip_address';
|
||
else
|
||
$url = 'ip_addresses/show';
|
||
|
||
$actions->add_action()
|
||
->icon_action('show')
|
||
->url('ip_addresses/show');
|
||
->url($url);
|
||
}
|
||
|
||
if ($this->acl_check_edit('Devices_Controller', 'ip_address'))
|
||
... | ... | |
|
||
$grid_ip_addresses->datasource($query);
|
||
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('vlan_ifaces/show_all', 'VLAN interfaces')
|
||
->disable_translation()
|
||
if (url_lang::current(TRUE) == 'devices')
|
||
{
|
||
if ($vlan_iface->iface->name != '')
|
||
$iface_name = $vlan_iface->iface->name." (".$vlan_iface->iface->mac.")";
|
||
else
|
||
$iface_name = $vlan_iface->iface->mac;
|
||
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link(
|
||
'members/show_all',
|
||
'Members',
|
||
$this->acl_check_view('Members_Controller','members')
|
||
)
|
||
->link(
|
||
'members/show/'.$vlan_iface->iface->device->user->member_id,
|
||
'ID '.$vlan_iface->iface->device->user->member->id.' - '.$vlan_iface->iface->device->user->member->name,
|
||
$this->acl_check_view(
|
||
'Members_Controller',
|
||
'members',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'users/show_by_member/'.$vlan_iface->iface->device->user->member_id,
|
||
"Users",
|
||
$this->acl_check_view(
|
||
'Users_Controller',
|
||
'users',$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'users/show/'.$vlan_iface->iface->device->user_id,
|
||
$vlan_iface->iface->device->user->name.' '.$vlan_iface->iface->device->user->surname.' ('.$vlan_iface->iface->device->user->login.')',
|
||
$this->acl_check_view(
|
||
'Users_Controller',
|
||
'users',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show_by_user/'.$vlan_iface->iface->device->user_id,
|
||
'Devices',
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show/'.$vlan_iface->iface->device_id,
|
||
$vlan_iface->iface->device->name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show_iface/'.$vlan_iface->iface->id,
|
||
$iface_name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'iface',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
);
|
||
}
|
||
else
|
||
{
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('vlan_ifaces/show_all', 'VLAN interfaces');
|
||
}
|
||
|
||
$breadcrumbs->disable_translation()
|
||
->text($vlan_iface->name);
|
||
|
||
$view = new View('main');
|
||
... | ... | |
if ($vlan_iface->save())
|
||
{
|
||
status::success('Vlan interface has been successfully updated.');
|
||
url::redirect(
|
||
if (Path::instance()->previous()->uri()->current(0,1) == 'devices')
|
||
url::redirect(
|
||
url_lang::base() . 'devices/show_vlan_iface/'.$vlan_iface->id
|
||
);
|
||
else
|
||
url::redirect(
|
||
url_lang::base() . 'vlan_ifaces/show/' . $vlan_iface->id
|
||
);
|
||
exit;
|
||
... | ... | |
}
|
||
// end validate
|
||
|
||
if (Path::instance()->previous()->uri()->current(0,1) == 'devices')
|
||
{
|
||
if ($vlan_iface->iface->name != '')
|
||
$iface_name = $vlan_iface->iface->name." (".$vlan_iface->iface->mac.")";
|
||
else
|
||
$iface_name = $vlan_iface->iface->mac;
|
||
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link(
|
||
'members/show_all',
|
||
'Members',
|
||
$this->acl_check_view('Members_Controller','members')
|
||
)
|
||
->link(
|
||
'members/show/'.$vlan_iface->iface->device->user->member_id,
|
||
'ID '.$vlan_iface->iface->device->user->member->id.' - '.$vlan_iface->iface->device->user->member->name,
|
||
$this->acl_check_view(
|
||
'Members_Controller',
|
||
'members',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'users/show_by_member/'.$vlan_iface->iface->device->user->member_id,
|
||
"Users",
|
||
$this->acl_check_view(
|
||
'Users_Controller',
|
||
'users',$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'users/show/'.$vlan_iface->iface->device->user_id,
|
||
$vlan_iface->iface->device->user->name.' '.$vlan_iface->iface->device->user->surname.' ('.$vlan_iface->iface->device->user->login.')',
|
||
$this->acl_check_view(
|
||
'Users_Controller',
|
||
'users',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show_by_user/'.$vlan_iface->iface->device->user_id,
|
||
'Devices',
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show/'.$vlan_iface->iface->device_id,
|
||
$vlan_iface->iface->device->name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show_iface/'.$vlan_iface->iface->id,
|
||
$iface_name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'iface',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
);
|
||
}
|
||
else
|
||
{
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('vlan_ifaces/show_all', 'VLAN interfaces',
|
||
$this->acl_check_view('Devices_Controller', 'vlan_iface'))
|
||
->disable_translation()
|
||
$this->acl_check_view('Devices_Controller', 'vlan_iface'));
|
||
}
|
||
|
||
$breadcrumbs->disable_translation()
|
||
->link('vlan_ifaces/show/' . $vlan_iface->id, $vlan_iface->name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller', 'vlan_iface',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)->enable_translation()
|
||
)
|
||
->enable_translation()
|
||
->text('Edit');
|
||
|
||
$view = new View('main');
|
freenetis/branches/testing/application/controllers/ip_addresses.php | ||
---|---|---|
}
|
||
else
|
||
{
|
||
// breadcrumbs menu
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('ip_addresses/show_all', 'IP addresses',
|
||
$this->acl_check_view('Devices_Controller', 'ip_address'))
|
||
->disable_translation()
|
||
->text($ip_address->ip_address . ' (' . $ip_address->id . ')');
|
||
if (url_lang::current(TRUE) == 'devices')
|
||
{
|
||
if ($ip_address->iface_id)
|
||
$iface = $ip_address->iface;
|
||
else
|
||
$iface = $ip_address->vlan_iface->iface;
|
||
|
||
$device_name = $iface->device->name;
|
||
|
||
if ($device_name == '')
|
||
{
|
||
$device_name = ORM::factory ('enum_type')
|
||
->get_value($device->type);
|
||
}
|
||
|
||
if ($iface->name != '')
|
||
$iface_name = $iface->name." (".$iface->mac.")";
|
||
else
|
||
$iface_name = $iface->mac;
|
||
|
||
// breadcrumbs menu
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('members/show_all', 'Members',
|
||
$this->acl_check_view('Members_Controller','members'))
|
||
->disable_translation()
|
||
->link('members/show/' .
|
||
$iface->device->user->member->id,
|
||
'ID ' . $iface->device->user->member->id .
|
||
' - ' . $iface->device->user->member->name,
|
||
$this->acl_check_view(
|
||
'Members_Controller',
|
||
'members',
|
||
$iface->device->user->member->id)
|
||
)
|
||
->enable_translation()
|
||
->link('users/show_by_member/' .
|
||
$iface->device->user->member->id, 'Users',
|
||
$this->acl_check_view(
|
||
'Users_Controller', 'users',
|
||
$iface->device->user->member->id)
|
||
)
|
||
->disable_translation()
|
||
->link('users/show/' . $iface->device->user->id,
|
||
$iface->device->user->name .
|
||
' ' . $iface->device->user->surname .
|
||
' (' . $iface->device->user->login . ')',
|
||
$this->acl_check_view(
|
||
'Users_Controller', 'users',
|
||
$iface->device->user->member_id)
|
||
)
|
||
->enable_translation()
|
||
->link(
|
||
'devices/show_by_user/'.$iface->device->user_id,
|
||
'Devices',
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show/'.$iface->device_id,
|
||
$device_name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show_iface/'.$iface_id,
|
||
$iface_name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'iface',
|
||
$iface->device->user->member_id
|
||
)
|
||
);
|
||
|
||
if ($ip_address->vlan_iface_id)
|
||
{
|
||
$breadcrumbs->link(
|
||
'devices/show_vlan_iface/'.$ip_address->vlan_iface->id,
|
||
$ip_address->vlan_iface->name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'vlan_iface',
|
||
$iface->device->user->member_id
|
||
)
|
||
);
|
||
}
|
||
|
||
$breadcrumbs->disable_translation()
|
||
->text($ip_address->ip_address);
|
||
}
|
||
else
|
||
{
|
||
// breadcrumbs menu
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('ip_addresses/show_all', 'IP addresses',
|
||
$this->acl_check_view('Devices_Controller', 'ip_address'))
|
||
->disable_translation()
|
||
->text($ip_address->ip_address . ' (' . $ip_address->id . ')');
|
||
}
|
||
|
||
}
|
||
|
||
$view = new View('main');
|
||
... | ... | |
);
|
||
}
|
||
|
||
url::redirect(url_lang::base() . 'ifaces/show/' . $iface_id);
|
||
if (Path::instance()->previous()->uri()->current(0,1) == 'devices')
|
||
url::redirect(url_lang::base() . 'devices/show_ip_address/' . $ip->id);
|
||
else
|
||
url::redirect(url_lang::base() . 'ip_addresses/show/' . $ip->id);
|
||
}
|
||
|
||
if (Path::instance()->previous()->uri()->current(0,1) == 'devices')
|
||
{
|
||
if ($iface->name != '')
|
||
$iface_name = $iface->name." (".$iface->mac.")";
|
||
else
|
||
$iface_name = $iface->mac;
|
||
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link(
|
||
'members/show_all',
|
||
'Members',
|
||
$this->acl_check_view('Members_Controller','members')
|
||
)
|
||
->link(
|
||
'members/show/'.$iface->device->user->member_id,
|
||
'ID '.$iface->device->user->member->id.' - '.$iface->device->user->member->name,
|
||
$this->acl_check_view(
|
||
'Members_Controller',
|
||
'members',
|
||
$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'users/show_by_member/'.$iface->device->user->member_id,
|
||
"Users",
|
||
$this->acl_check_view(
|
||
'Users_Controller',
|
||
'users',$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'users/show/'.$iface->device->user_id,
|
||
$iface->device->user->name.' '.$iface->device->user->surname.' ('.$iface->device->user->login.')',
|
||
$this->acl_check_view(
|
||
'Users_Controller',
|
||
'users',
|
||
$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show_by_user/'.$iface->device->user_id,
|
||
'Devices',
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show/'.$iface->device_id,
|
||
$iface->device->name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show_iface/'.$iface->id,
|
||
$iface_name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'iface',
|
||
$iface->device->user->member_id
|
||
)
|
||
);
|
||
}
|
||
else
|
||
{
|
||
|
||
// breadcrumbs menu
|
||
if ($iface->name != '')
|
||
$name = "$iface->name ($iface->mac)";
|
||
... | ... | |
$this->acl_check_view(
|
||
'Devices_Controller', 'iface',
|
||
$iface->device->user->member_id
|
||
))
|
||
->text('Add new IP address');
|
||
));
|
||
}
|
||
|
||
$breadcrumbs->text('Add new IP address');
|
||
|
||
// view
|
||
$view = new View('main');
|
||
... | ... | |
);
|
||
}
|
||
|
||
url::redirect(url_lang::base() . 'vlan_ifaces/show/' . $vlan_iface_id);
|
||
if (Path::instance()->previous()->uri()->current(0,1) == 'devices')
|
||
url::redirect(url_lang::base() . 'devices/show_ip_address/' . $ip->id);
|
||
else
|
||
url::redirect(url_lang::base() . 'ip_addresses/show/' . $ip->id);
|
||
}
|
||
|
||
if (Path::instance()->previous()->uri()->current(0,1) == 'devices')
|
||
{
|
||
if ($vlan_iface->iface->name != '')
|
||
$iface_name = $vlan_iface->iface->name." (".$vlan_iface->iface->mac.")";
|
||
else
|
||
$iface_name = $vlan_iface->iface->mac;
|
||
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link(
|
||
'members/show_all',
|
||
'Members',
|
||
$this->acl_check_view('Members_Controller','members')
|
||
)
|
||
->link(
|
||
'members/show/'.$vlan_iface->iface->device->user->member_id,
|
||
'ID '.$vlan_iface->iface->device->user->member->id.' - '.$vlan_iface->iface->device->user->member->name,
|
||
$this->acl_check_view(
|
||
'Members_Controller',
|
||
'members',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'users/show_by_member/'.$vlan_iface->iface->device->user->member_id,
|
||
"Users",
|
||
$this->acl_check_view(
|
||
'Users_Controller',
|
||
'users',$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'users/show/'.$vlan_iface->iface->device->user_id,
|
||
$vlan_iface->iface->device->user->name.' '.$vlan_iface->iface->device->user->surname.' ('.$vlan_iface->iface->device->user->login.')',
|
||
$this->acl_check_view(
|
||
'Users_Controller',
|
||
'users',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show_by_user/'.$vlan_iface->iface->device->user_id,
|
||
'Devices',
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show/'.$vlan_iface->iface->device_id,
|
||
$vlan_iface->iface->device->name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show_iface/'.$vlan_iface->iface->id,
|
||
$iface_name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'iface',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show_vlan_iface/'.$vlan_iface->id,
|
||
$vlan_iface->name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'vlan_iface',
|
||
$vlan_iface->iface->device->user->member_id
|
||
)
|
||
);
|
||
}
|
||
else
|
||
{
|
||
|
||
// breadcrumbs
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('vlan_ifaces/show_all', 'VLAN Interfaces',
|
||
... | ... | |
$vlan_iface->name . ' (' . $vlan_iface->id . ')',
|
||
$this->acl_check_view(
|
||
'Devices_Controller', 'vlan_iface', $member_id
|
||
))
|
||
->text('Add new IP address');
|
||
));
|
||
}
|
||
|
||
$breadcrumbs->text('Add new IP address');
|
||
|
||
// view
|
||
$view = new View('main');
|
||
... | ... | |
status::success('IP address is successfully updated.');
|
||
}
|
||
|
||
url::redirect(url_lang::base() . 'ip_addresses/show/' . $ip_address_id);
|
||
if (Path::instance()->previous()->uri()->current(0,1) == 'devices')
|
||
url::redirect(url_lang::base() . 'devices/show_ip_address/' . $ip_address_id);
|
||
else
|
||
url::redirect(url_lang::base() . 'ip_addresses/show/' . $ip_address_id);
|
||
|
||
}
|
||
|
||
if (Path::instance()->previous()->uri()->current(0,1) == 'devices')
|
||
{
|
||
if ($ip_address->iface_id)
|
||
$iface = $ip_address->iface;
|
||
else
|
||
$iface = $ip_address->vlan_iface->iface;
|
||
|
||
if ($iface->name != '')
|
||
$iface_name = "$iface->name ($iface->mac)";
|
||
else
|
||
$iface_name = $iface->mac;
|
||
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link(
|
||
'members/show_all',
|
||
'Members',
|
||
$this->acl_check_view('Members_Controller','members')
|
||
)
|
||
->link(
|
||
'members/show/'.$iface->device->user->member_id,
|
||
'ID '.$iface->device->user->member->id.' - '.$iface->device->user->member->name,
|
||
$this->acl_check_view(
|
||
'Members_Controller',
|
||
'members',
|
||
$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'users/show_by_member/'.$iface->device->user->member_id,
|
||
"Users",
|
||
$this->acl_check_view(
|
||
'Users_Controller',
|
||
'users',$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'users/show/'.$iface->device->user_id,
|
||
$iface->device->user->name.' '.$iface->device->user->surname.' ('.$iface->device->user->login.')',
|
||
$this->acl_check_view(
|
||
'Users_Controller',
|
||
'users',
|
||
$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show_by_user/'.$iface->device->user_id,
|
||
'Devices',
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show/'.$iface->device_id,
|
||
$iface->device->name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show_iface/'.$iface->id,
|
||
$iface_name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'iface',
|
||
$iface->device->user->member_id
|
||
)
|
||
);
|
||
|
||
if ($ip_address->vlan_iface_id)
|
||
{
|
||
$breadcrumbs->link(
|
||
'devices/show_vlan_iface/'.$ip_address->vlan_iface->id,
|
||
$ip_address->vlan_iface->name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'vlan_iface',
|
||
$iface->device->user->member_id
|
||
)
|
||
);
|
||
}
|
||
|
||
$breadcrumbs->disable_translation()
|
||
->link(
|
||
'devices/show_ip_address/'.$ip_address->id,
|
||
$ip_address->ip_address,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'vlan_iface',
|
||
$iface->device->user->member_id
|
||
)
|
||
)
|
||
->enable_translation()
|
||
->text('Edit IP address');
|
||
}
|
||
else
|
||
{
|
||
|
||
// breadcrumbs menu
|
||
$breadcrumbs = breadcrumbs::add();
|
||
|
||
... | ... | |
->enable_translation()
|
||
->text('Edit IP address');
|
||
|
||
}
|
||
|
||
// view
|
||
$view = new View('main');
|
||
$view->title = __('Edit IP address').
|
freenetis/branches/testing/application/controllers/redirect.php | ||
---|---|---|
));
|
||
// set flash message
|
||
status::success('Redirection has been successfully set.');
|
||
url::redirect(url_lang::base().'ip_addresses/show/'.$ip_address_id);
|
||
if (Path::instance()->previous()->uri()->current(0,1) == 'devices')
|
||
url::redirect(url_lang::base() . 'devices/show_ip_address/' . $ip_address_id);
|
||
else
|
||
url::redirect(url_lang::base() . 'ip_addresses/show/' . $ip_address_id);
|
||
}
|
||
|
||
if (Path::instance()->previous()->uri()->current(0,1) == 'devices')
|
||
{
|
||
if ($ip->iface_id)
|
||
$iface = $ip->iface;
|
||
else
|
||
$iface = $ip->vlan_iface->iface;
|
||
|
||
$device_name = $iface->device->name;
|
||
|
||
if ($device_name == '')
|
||
{
|
||
$device_name = ORM::factory ('enum_type')
|
||
->get_value($device->type);
|
||
}
|
||
|
||
if ($iface->name != '')
|
||
$iface_name = $iface->name." (".$iface->mac.")";
|
||
else
|
||
$iface_name = $iface->mac;
|
||
|
||
// breadcrumbs menu
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('members/show_all', 'Members',
|
||
$this->acl_check_view('Members_Controller','members'))
|
||
->disable_translation()
|
||
->link('members/show/' .
|
||
$iface->device->user->member->id,
|
||
'ID ' . $iface->device->user->member->id .
|
||
' - ' . $iface->device->user->member->name,
|
||
$this->acl_check_view(
|
||
'Members_Controller',
|
||
'members',
|
||
$iface->device->user->member->id)
|
||
)
|
||
->enable_translation()
|
||
->link('users/show_by_member/' .
|
||
$iface->device->user->member->id, 'Users',
|
||
$this->acl_check_view(
|
||
'Users_Controller', 'users',
|
||
$iface->device->user->member->id)
|
||
)
|
||
->disable_translation()
|
||
->link('users/show/' . $iface->device->user->id,
|
||
$iface->device->user->name .
|
||
' ' . $iface->device->user->surname .
|
||
' (' . $iface->device->user->login . ')',
|
||
$this->acl_check_view(
|
||
'Users_Controller', 'users',
|
||
$iface->device->user->member_id)
|
||
)
|
||
->enable_translation()
|
||
->link(
|
||
'devices/show_by_user/'.$iface->device->user_id,
|
||
'Devices',
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show/'.$iface->device_id,
|
||
$device_name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'devices',
|
||
$iface->device->user->member_id
|
||
)
|
||
)
|
||
->link(
|
||
'devices/show_iface/'.$iface->id,
|
||
$iface_name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'iface',
|
||
$iface->device->user->member_id
|
||
)
|
||
);
|
||
|
||
if ($ip->vlan_iface_id)
|
||
{
|
||
$breadcrumbs->link(
|
||
'devices/show_vlan_iface/'.$ip->vlan_iface->id,
|
||
$ip->vlan_iface->name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'vlan_iface',
|
||
$iface->device->user->member_id
|
||
)
|
||
);
|
||
}
|
||
|
||
$breadcrumbs->disable_translation()
|
||
->link(
|
||
'devices/show_ip_address/'.$ip->id,
|
||
$ip->ip_address,
|
||
$this->acl_check_view(
|
||
'Devices_Controller',
|
||
'vlan_iface',
|
||
$iface->device->user->member_id
|
||
)
|
||
);
|
||
}
|
||
else
|
||
{
|
||
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('ip_addresses/show_all', 'IP addresses',
|
||
$this->acl_check_view('Devices_Controller', 'ip_address')
|
||
)->disable_translation()
|
||
->link('ip_addresses/show/' . $ip->id,
|
||
$ip->ip_address . ' (' . $ip->id . ')',
|
||
$this->acl_check_view('Devices_Controller', 'ip_address')
|
||
)->enable_translation()
|
||
->text('Redirection of IP address');
|
||
->link('ip_addresses/show_all', 'IP addresses',
|
||
$this->acl_check_view('Devices_Controller', 'ip_address')
|
||
)->disable_translation()
|
||
->link('ip_addresses/show/' . $ip->id,
|
||
$ip->ip_address . ' (' . $ip->id . ')',
|
||
$this->acl_check_view('Devices_Controller', 'ip_address')
|
||
);
|
||
}
|
||
|
||
// view
|
||
$headline = __('Redirection of IP address');
|
||
$view = new View('main');
|
||
$view->title = $headline;
|
||
$view->breadcrumbs = $breadcrumbs->html();
|
||
$view->content = new View('form');
|
||
$view->content->headline = $headline;
|
||
$view->content->form = $form->html();
|
||
$view->render(TRUE);
|
||
}
|
||
$breadcrumbs->enable_translation()
|
||
->text('Redirection of IP address');
|
||
|
||
// view
|
||
$headline = __('Redirection of IP address');
|
||
$view = new View('main');
|
||
$view->title = $headline;
|
||
$view->breadcrumbs = $breadcrumbs->html();
|
||
$view->content = new View('form');
|
||
$view->content->headline = $headline;
|
||
$view->content->form = $form->html();
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
freenetis/branches/testing/application/controllers/devices.php | ||
---|---|---|
$gpsx, $gpsy
|
||
);
|
||
|
||
$device_saved = TRUE;
|
||
$device_saved = $device->save();
|
||
|
||
// add address point if there is no such
|
||
if (!$address_point->id)
|
||
... | ... | |
{
|
||
Ifaces_Controller::show($iface_id);
|
||
}
|
||
|
||
public function show_vlan_iface($vlan_iface_id = NULL)
|
||
{
|
||
Vlan_ifaces_Controller::show($vlan_iface_id);
|
||
}
|
||
|
||
/**
|
||
*
|
||
* Shows IP address
|
||
*
|
||
* @author Michal Kliment
|
||
* @param type $ip_address_id
|
||
*/
|
||
public function show_ip_address ($ip_address_id = NULL)
|
||
{
|
||
Ip_addresses_Controller::show($ip_address_id);
|
||
}
|
||
|
||
/**
|
||
* Function checks validity of ip address.
|
freenetis/branches/testing/application/libraries/Path.php | ||
---|---|---|
* @var array
|
||
*/
|
||
private $paths = NULL;
|
||
|
||
/**
|
||
* Returns path as only URI
|
||
* @var boolean
|
||
*/
|
||
private $uri = FALSE;
|
||
|
||
/**
|
||
* Returns path with lang (only if URI is true)
|
||
* @var boolean
|
||
*/
|
||
private $lang = TRUE;
|
||
|
||
/**
|
||
* For singleton instance
|
||
... | ... | |
* Returns URL of current position in object
|
||
*
|
||
* @author Michal Kliment
|
||
* @param intger $offset
|
||
* @param integer $length
|
||
* @return string
|
||
*/
|
||
public function current()
|
||
public function current($offset = 0, $length = NULL)
|
||
{
|
||
return $this->path[$this->id];
|
||
// returns only uri
|
||
if ($this->uri)
|
||
{
|
||
$path = url::uri($this->path[$this->id]);
|
||
|
||
// returns without lang
|
||
if (!$this->lang)
|
||
$offset++;
|
||
}
|
||
else
|
||
$path = $this->path[$this->id];
|
||
|
||
// returns rest of string
|
||
if (!$length)
|
||
$length = count(explode('/', $path))-$offset;
|
||
|
||
return url::slice($path, $offset, $length);
|
||
}
|
||
|
||
/**
|
||
... | ... | |
$this->id = count($this->path)-1;
|
||
return $this;
|
||
}
|
||
|
||
/**
|
||
* Sets boolean values for URI and lang
|
||
*
|
||
* @author Michal Kliment
|
||
* @param bolean $uri
|
||
* @param boolean $lang
|
||
* @return Path
|
||
*/
|
||
public function uri($uri = TRUE, $lang = FALSE)
|
||
{
|
||
$this->uri = $uri;
|
||
$this->lang = $lang;
|
||
return $this;
|
||
}
|
||
}
|
||
|
||
?>
|
freenetis/branches/testing/application/views/ip_addresses_show.php | ||
---|---|---|
<?php
|
||
$links = array();
|
||
|
||
if ($this->acl_check_view('Devices_Controller', 'iface') && !empty($ip_address->iface_id))
|
||
$links[] = html::anchor(url_lang::base().'ifaces/show/'.$ip_address->iface_id, __('Back to interface parameters'));
|
||
if (!$ip_address->member_id && $this->acl_check_edit('Devices_Controller', 'ip_address'))
|
||
$links[] = html::anchor(url_lang::base().'ip_addresses/edit/'.$ip_address->id, __('Edit'));
|
||
if (!$ip_address->member_id && $this->acl_check_delete('Devices_Controller', 'ip_address'))
|
||
... | ... | |
<th><?php echo __('Device') ?></th>
|
||
<td><?php echo html::anchor(url_lang::base().'devices/show/'.$device->id, $device->name) ?></td>
|
||
</tr>
|
||
<?php if (url_lang::current(TRUE) == 'devices'): ?>
|
||
<tr>
|
||
<th><?php echo __('Interface') ?></th>
|
||
<td><?php echo html::anchor(url_lang::base().'devices/show_iface/'.$iface->id, $iface->mac) ?></td>
|
||
</tr>
|
||
<?php if (isset($vlan_iface)) { ?>
|
||
<tr>
|
||
<th><?php echo __('VLAN Interface') ?></th>
|
||
<td><?php echo html::anchor(url_lang::base().'devices/show_vlan_iface/'.$vlan_iface->id, $vlan_iface->name) ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php else: ?>
|
||
<tr>
|
||
<th><?php echo __('Interface') ?></th>
|
||
<td><?php echo html::anchor(url_lang::base().'ifaces/show/'.$iface->id, $iface->mac) ?></td>
|
||
</tr>
|
||
<?php if (isset($vlan_iface)) { ?>
|
||
... | ... | |
</tr>
|
||
<?php } ?>
|
||
<?php endif ?>
|
||
<?php endif ?>
|
||
</table>
|
||
<table class="extended" cellspacing="0" style="float:left; margin-left:10px;">
|
||
<tr>
|
freenetis/branches/testing/application/views/show_vlan_iface.php | ||
---|---|---|
|
||
$links = array();
|
||
|
||
if ($this->acl_check_view('Devices_controller', 'iface'))
|
||
{
|
||
$links[] = html::anchor(url_lang::base() . 'ifaces/show/' . $vlan_iface->iface_id, __('Interface parameters'));
|
||
}
|
||
|
||
if ($this->acl_check_edit('Devices_controller', 'vlan_iface'))
|
||
{
|
||
$links[] = html::anchor(url_lang::base() . 'vlan_ifaces/edit/' . $vlan_iface->id, __('Edit'));
|
Také k dispozici: Unified diff
Opravena chyba u editace zarizeni. Vylepsena drobeckova navigace u rozhrani, VLAN rozhrani a IP adres.