Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 646

Přidáno uživatelem Jiří Sviták před více než 14 roky(ů)

Upravy gridu pro IP adresy, prace na administraci presmerovani. U transakci schvalenych se uklada jejich pridavatel.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
'back to list of translations' => 'Zpět na seznam překladů',
'back to list of works of user' => 'Zpět na seznam prací uživatele',
'back to login' => 'Zpět na přihlášení',
'back to messages for redirection' => 'Zpět na zprávy pro přesměrování',
'back to ports list' => 'Zpět na seznam portů',
'back to profile of association' => 'Zpět na profil sdružení',
'back to project accounts' => 'Zpět na projektové účty',
......
'edit account' => 'Upravit účet',
'edit address point' => 'Upravit adresní bod',
'edit cloud' => 'Upravit oblast',
'edit content' => 'Upravit obsah',
'edit device' => 'Upravit zařízení',
'edit device admin' => 'Upravit správce zařízení',
'edit enum type' => 'Upravit výčet',
......
'edit ip address redirection' => 'Upravit přesměrování IP adresy',
'edit member' => 'Upravit člena',
'edit member limit' => 'Upravit limit člena',
'edit parameters' => 'Upravit parametry',
'edit port' => 'Úprava portu',
'edit redirection message' => 'Úprava zprávy přesměrování',
'edit registrations' => 'Upravit přihlášky',
......
'message has been successfully updated' => 'Zpráva byla úspěšně aktualizována',
'message is already active' => 'Zpráva je již aktivní',
'message is active, cannot be deleted' => 'Zpráva je aktivní, nemůže být smazána',
'message name' => 'Název zprávy',
'messages for redirection' => 'Zprávy pro přesměrování',
'middle name' => 'Prostřední jméno',
'minimal duration of interrupt is one month' => 'Minimální délka přerušení je jeden měsíc',
......
'network address does not match the mask' => 'Síťová adresa neodpovídá zadané masce.',
'networks' => 'Síť',
'never' => 'Nikdy',
'never redirect' => 'Nikdy nepřesměrovat',
'new bank accounts' => 'Nové bankovní účty',
'new device admin has been successfully saved' => 'Nový správce zařízení byl úspěšně uložen.',
'new device engineer has been successfully saved' => 'Nový technik zařízení byl úspěšně uložen.',
......
'price vat' => 'Cena s DPH',
'primary dns' => 'Primární DNS.',
'primary user of member cannot be deleted' => 'Primárního uživatele člena nelze smazat.',
'priority' => 'Priorita',
'project account' => 'Účet projektu',
'project subaccounts' => 'Projektové podúčty',
'project site' => 'Stránky projektu',
......
'select user' => 'Vyber uživatele',
'select vlan' => 'Vyber VLAN',
'selected account does not exist'=>'Vybraný účet neexistuje',
'self cancelable' => 'Samozrušitelná',
'self-registration' => 'Samo-registrace',
'send e-mail' => 'Pošli e-mail',
'send e-mail notification after expiration' => 'Poslat zprávu na e-mail po vypršení přesměrování',
freenetis/trunk/kohana/application/models/ip_address.php
$where .= ' AND '.$key.' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci';
}
}
return self::$db->query("SELECT ifaces.name AS iface_name, vlan_ifaces.name AS vlan_iface_name, subnets.name as subnet_name, ip_addresses.*
FROM ip_addresses
LEFT JOIN ifaces ON ifaces.id = ip_addresses.iface_id
LEFT JOIN vlan_ifaces ON vlan_ifaces.id = ip_addresses.VLAN_iface_id
LEFT JOIN subnets ON subnets.id=ip_addresses.subnet_id
return self::$db->query("
SELECT ip.*,
IFNULL(i1.name, i2.name) AS iface_name,
vi.name AS vlan_iface_name,
s.name as subnet_name,
d.id AS device_id, d.name AS device_name
FROM ip_addresses ip
LEFT JOIN ifaces i1 ON i1.id = ip.iface_id
LEFT JOIN vlan_ifaces vi ON vi.id = ip.VLAN_iface_id
LEFT JOIN ifaces i2 ON i2.id = vi.iface_id
LEFT JOIN devices d ON d.id = IFNULL(i1.device_id, i2.device_id)
LEFT JOIN subnets s ON s.id = ip.subnet_id
$where
ORDER BY $order_by $order_by_direction
LIMIT $limit_from, $limit_results");
......
WHERE m.id = $member_id
");
}
/**
* Gets all ip addresses of device.
* @author Jiri Svitak
* @param $device_id
* @return unknown_type
*/
public function get_ip_addresses_of_device($device_id)
{
return self::$db->query("
SELECT ip.*, s.name AS subnet_name
FROM ip_addresses ip
LEFT JOIN subnets s ON s.id = ip.subnet_id
LEFT JOIN ifaces i1 ON i1.id = ip.iface_id
LEFT JOIN vlan_ifaces vi ON vi.id = ip.vlan_iface_id
LEFT JOIN ifaces i2 ON i2.id = vi.iface_id
WHERE IFNULL(i1.device_id, i2.device_id) = $device_id
");
}
public function get_allowed_member_ips()
{
freenetis/trunk/kohana/application/models/message.php
* Gets all active redirections from junction table messages_ip_addresses.
* @return unknown_type
*/
public function get_all_redirections($limit_from = 0, $limit_results = 20, $order_by = 'ip_address_id', $order_by_direction = 'DESC', $filter_values = array())
public function get_all_redirections($limit_from = 0, $limit_results = 20, $order_by = 'ip_address_id', $order_by_direction = 'ASC', $filter_values = array())
{
return self::$db->query("
SELECT *
freenetis/trunk/kohana/application/controllers/messages.php
<?php
class Messages_Controller extends Controller
{
function show_all($limit_results = 500, $order_by = 'id', $order_by_direction = 'desc', $page_word = null, $page = 1)
function show_all($limit_results = 500, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
{
// access rights
if (!$this->acl_check_view('Redirection_Controller', 'redirection'))
......
$grid->add_new_button(url_lang::base().'messages/show_all', url_lang::lang('texts.Messages for redirection'));
$grid->add_new_button(url_lang::base().'redirect/settings', url_lang::lang('texts.Settings'));
$grid->order_field('id')->label('ID');
/*
$grid->order_field('from')->label(url_lang::lang('texts.Date from'));
$grid->order_field('to')->label(url_lang::lang('texts.Date to'));
$grid->order_field('extension')->label(url_lang::lang('texts.Type'));
$grid->order_field('opening_balance')->label(url_lang::lang('texts.Opening balance'));
$grid->order_field('closing_balance')->label(url_lang::lang('texts.Closing balance'));
if ($this->acl_check_view('Accounts_Controller', 'bank_transfers'))
$grid->action_field('id') ->label(url_lang::lang('texts.Bank transfers'))->url(url_lang::base().'bank_transfers/show_by_bank_statement')->action(url_lang::lang('texts.Show'));
*/
$grid->order_field('name')->label(url_lang::lang('texts.Name'));
//if ($this->acl_check_view('Accounts_Controller', 'bank_transfers'))
$grid->action_field('id') ->label(url_lang::lang('texts.Message'))->url(url_lang::base().'messages/show')->action(url_lang::lang('texts.Show'));
$grid->datasource($messages);
$view = new View('main');
......
$view->render(TRUE);
}
function edit($message_id)
/**
* Shows message including properties.
* @author Jiri Svitak
* @param $message_id
* @return unknown_type
*/
function show($message_id = null)
{
if (!isset($message_id))
{
Controller::warning(PARAMETER);
}
$message = new Message_Model($message_id);
if ($message->id == 0)
{
Controller::error(RECORD);
}
/*
$member_id = $device->user->member_id;
if (!$this->acl_check_view(get_class($this),'devices',$member_id))
Controller::error(ACCESS);
*/
//print_r($message);
//echo $message->self_cancel; die();
$headline = url_lang::lang('texts.Message');
$view = new View('main');
$view->title = $headline;
$view->content = '';
$view->content = new View('messages_show');
$view->content->headline = $headline;
$view->content->message = $message;
$view->render(true);
}
/**
* Edits message parameters.
* @author Jiri Svitak
* @param $message_id
* @return unknown_type
*/
function edit_parameters($message_id = null)
{
if (!isset($message_id))
Controller::warning(PARAMETER);
$message = new Message_Model($message_id);
// access rights
//if (!$this->acl_check_edit('Accounts_Controller', 'transfers'))
// Controller::error(ACCESS);
$form = new Forge(url_lang::base().'messages/edit/'.$message_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$form->group('')->label(url_lang::lang('texts.Basic information'));
$form->input('text')->label(url_lang::lang('texts.Name').':')->rules('required|length[3,200]')->value($message->text);
$form->input('priority')->label(url_lang::lang('texts.Priority').':')->value($message->priority);
$form->dropdown('type')->label(url_lang::lang('texts.Type').':');
$form->dropdown('system')->label(url_lang::lang('texts.System message').':');
$form->submit('submit')->value(url_lang::lang('texts.Edit'));
special::required_forge_style($form, ' *', 'required');
if($form->validate())
{
$form_data = $form->as_array();
unset($form_data);
if ($message->save())
$this->session->set_flash('message', url_lang::lang('texts.Transfer has been successfully updated.'));
else
$this->session->set_flash('message', url_lang::lang('texts.Error - cant update transfer.'));
}
else
{
$headline = url_lang::lang('texts.Editing redirection message parameters');
$view = new View('main');
$view->title = $headline;
$view->content = new View('form');
$view->content->headline = $headline;
$view->content->form = $form->html();
$view->render(TRUE);
}
}
/**
* Edits html content of message.
* @return unknown_type
*/
function edit_content($message_id = null)
{
$editor = new TextEditor();
$editor->setWidth(656);
$editor->setHeight(480);
$editor->setFieldName('editor');
$view = new View('main');
$view->title = url_lang::lang('texts');
$view->content = $editor;
$view->title = url_lang::lang('texts.Message content');
$view->content = new View('messages_edit_content');
$view->content->editor = $editor->getHtml();
$view->content->head = $editor->getHeadHtml();
$view->render(true);
}
}
?>
freenetis/trunk/kohana/application/controllers/ip_addresses.php
$grid->add_new_button(url_lang::base().'ip_addresses/add', url_lang::lang('texts.Add new IP address'));
//$grid->order_field('id')->label(url_lang::lang('texts.ID'));
$grid->order_field('ip_address')->label(url_lang::lang('texts.ip addresses'));
$grid->order_field('iface_name')->label(url_lang::lang('texts.Interface name'));
$grid->order_field('vlan_iface_name')->label(url_lang::lang('texts.VLAN interface name'));
//$grid->order_field('iface_name')->label(url_lang::lang('texts.Interface name'));
//$grid->order_field('vlan_iface_name')->label(url_lang::lang('texts.VLAN interface name'));
$grid->order_field('subnet_name')->label(url_lang::lang('texts.Subnet name'));
$grid->callback_field('device_name')->label(url_lang::lang('texts.Device name'))->callback('Ip_addresses_Controller::device_name');
if ($this->acl_check_view('Devices_Controller','ip_address'))
$grid->action_field('id')->label(url_lang::lang('texts.Show'))->url(url_lang::base().'ip_addresses/show')->action(url_lang::lang('texts.Show'))->class('center');
//if ($this->acl_check_edit('Devices_Controller','ip_address'))
// $grid->action_field('id')->label(url_lang::lang('texts.Edit'))->url(url_lang::base().'ip_addresses/edit')->action(url_lang::lang('texts.Edit'))->class('center');
if ($this->acl_check_edit('Devices_Controller','ip_address'))
$grid->action_field('id')->label(url_lang::lang('texts.Edit'))->url(url_lang::base().'ip_addresses/edit')->action(url_lang::lang('texts.Edit'))->class('center');
if ($this->acl_check_edit('Devices_Controller','ip_address'))
$grid->action_field('id')->label(url_lang::lang('texts.Redirection'))->url(url_lang::base().'redirection/addip')->action(url_lang::lang('texts.Redirect'))->class('center');
if ($this->acl_check_edit('Devices_Controller','ip_address'))
$grid->action_field('id')->label(url_lang::lang('texts.Smokeping'))->url(url_lang::base().'monitoring/add_smokeping')->action(url_lang::lang('texts.Monitor'))->class('center');
......
$view->render(TRUE);
} // end of show_all function
public static function device_name($item, $name)
{
echo html::anchor(url_lang::base()."devices/show/$item->device_id", $item->device_name);
}
/**
* Shows details of ip address.
* @param $ip_address_id id of ip address to show
......
$this->form->dropdown('gateway')->label(url_lang::lang('texts.Gateway'))->options(array('0'=> url_lang::lang('texts.No'), '1'=> url_lang::lang('texts.Yes')))->selected('0');
$this->form->dropdown('service')->label(url_lang::lang('texts.Service'))->options(array('0'=> url_lang::lang('texts.No'), '1'=> url_lang::lang('texts.Yes')))->selected('0');
$this->form->dropdown('whitelisted')->label(url_lang::lang('texts.Never redirect'))->options(array('0'=> url_lang::lang('texts.No'), '1'=> url_lang::lang('texts.Yes')))->selected('0');
/**
* Removed by dulik for SVN rev. 98 - does not work with JavaScript disabled
* @todo Proper Ajax should be implemented - see http://learn.kohanaphp.com/2008/06/17/jquery-and-kohana-unobtrusive-ajax/
......
$ip->subnet_id = $form_data['subnet_id'];
$ip->gateway = $form_data['gateway'];
$ip->service = $form_data['service'];
$ip->whitelisted = $form_data['whitelisted'];
unset($form_data);
if ($ip->save())
{
......
{
//$form->ip_address->value("ahoj"); //demo of how to fill a field after validation error
}
//----- end validate --------------------------------------------------
$link_back = html::anchor(url_lang::base().'ip_addresses/show_all', url_lang::lang('texts.Back to IP addresses list'));
$view = new View('main');
......
$this->form->dropdown('gateway')->label(url_lang::lang('texts.Gateway'))->options(array('0'=> url_lang::lang('texts.No'), '1'=> url_lang::lang('texts.Yes')))->selected($ip_address->gateway);
$this->form->dropdown('service')->label(url_lang::lang('texts.Service'))->options(array('0'=> url_lang::lang('texts.No'), '1'=> url_lang::lang('texts.Yes')))->selected($ip_address->service);
$this->form->dropdown('whitelisted')->label(url_lang::lang('texts.Never redirect'))->options(array('0'=> url_lang::lang('texts.No'), '1'=> url_lang::lang('texts.Yes')))->selected($ip_address->whitelisted);
$this->form->submit('submit')->value(url_lang::lang('texts.Save'));
special::required_forge_style($this->form, ' *', 'required');
......
$ip->subnet_id = $form_data['subnet_id'];
$ip->gateway = $form_data['gateway'];
$ip->service = $form_data['service'];
$ip->whitelisted = $form_data['whitelisted'];
unset($form_data);
if ($ip->save()) {
$this->session->set_flash('message', url_lang::lang('texts.IP address is successfully updated.'));
if ($ip->iface_id) url::redirect(url_lang::base().'ifaces/show/'.$ip->iface_id);
else url::redirect(url_lang::base().'vlan_ifaces/show/'.$ip->vlan_iface_id);
exit;
url::redirect(url_lang::base().'ip_addresses/show/'.$ip_address_id);
/*
if (isset($this->session->get('ssIface_id')))
url::redirect(url_lang::base().'ifaces/show/'.$ip->iface_id);
else
url::redirect(url_lang::base().'vlan_ifaces/show/'.$ip->vlan_iface_id);
*/
}
}
freenetis/trunk/kohana/application/controllers/works.php
$transfer->creation_datetime = date('Y-m-d H:i:s');
$transfer->text = $work->description;
$transfer->amount = $form_data["rating"];
$transfer->user_id = $this->session->get('user_id');
$transfer_saved = $transfer->save();
$work->transfer_id = $transfer->id;
freenetis/trunk/kohana/application/views/menu.php
</ul>
</li>
<?php
/*
<?php if ($this->acl_check_view('Redirection_Controller', 'redirection')) { ?>
<li class="redirection"><h2><?php echo url_lang::lang('texts.Redirection') ?></h2>
<ul>
......
<li><?php echo html::anchor(url_lang::base().'redirection/log', url_lang::lang('texts.Redirection logs')) ?></li>
</ul>
</li><?php } ?>
<?php */?>
<?php if ($this->acl_check_view('Accounts_Controller', 'accounts') || $this->acl_check_view('Accounts_Controller', 'unidentified_transfers')) { ?>
<li class="transfer"><h2><?php echo url_lang::lang('texts.Finances') ?></h2>
<ul>
......
<?php if ($this->acl_check_view('Address_points_Controller', 'address_point')) {?>
<li><?php echo html::anchor(url_lang::base().'address_points', url_lang::lang('texts.Address points')) ?></li>
<?php } ?>
<?php if ($this->acl_check_view('Redirection_Controller', 'redirection')) {?>
<li><?php echo html::anchor(url_lang::base().'messages/show_all', url_lang::lang('texts.Redirection')) ?></li>
<?php } ?>
<?php if ($this->acl_check_view('Settings_Controller', 'system')) { ?>
<li><?php echo html::anchor(url_lang::base().'settings', url_lang::lang('texts.Settings')) ?></li>
<li><?php echo html::anchor(url_lang::base().'access_rights', url_lang::lang('texts.Access rights')) ?></li>
<li><?php echo html::anchor(url_lang::base().'fees', url_lang::lang('texts.Fees')) ?></li>
<li><?php echo html::anchor(url_lang::base().'login_logs', url_lang::lang('texts.Login logs')) ?></li>
<li><?php echo html::anchor(url_lang::base().'stats', url_lang::lang('texts.Stats')) ?></li>
<li><?php echo html::anchor(url_lang::base().'settings', url_lang::lang('texts.Settings')) ?></li>
<li><?php echo html::anchor(url_lang::base().'fees', url_lang::lang('texts.Fees')) ?></li>
<li><?php echo html::anchor(url_lang::base().'access_rights', url_lang::lang('texts.Access rights')) ?></li>
<li><?php echo html::anchor(url_lang::base().'stats', url_lang::lang('texts.Stats')) ?></li>
<li><?php echo html::anchor(url_lang::base().'translations', url_lang::lang('texts.Translations')) ?></li>
<li><?php echo html::anchor(url_lang::base().'enum_types', url_lang::lang('texts.Enumerations')) ?></li>
<?php } ?>
freenetis/trunk/kohana/application/views/ip_addresses_show.php
$links[] = html::anchor(url_lang::base().'ifaces/show/'.$ip_address->iface_id, url_lang::lang('texts.Back to interface parameters'));
if ($this->acl_check_edit('Devices_Controller', 'ip_address'))
$links[] = html::anchor(url_lang::base().'ip_addresses/edit/'.$ip_address->id, url_lang::lang('texts.Edit'));
if ($this->acl_check_delete('Devices_Controller', 'ip_address'))
$links[] = html::anchor(url_lang::base().'ip_addresses/delete/'.$ip_address->id, url_lang::lang('texts.Delete'));
echo implode(' | ', $links);
?>
<br /><br />
<table class="extended" cellspacing="0" style="float:left;">
<tr>
<th><?php echo url_lang::lang('texts.IP address ID') ?></th>
<th><?php echo url_lang::lang('texts.ID') ?></th>
<td><?php echo $ip_address->id ?></td>
</tr>
<tr>
......
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Gateway') ?></th>
<td><?php echo $ip_address->gateway?url_lang::lang('texts.Yes'):url_lang::lang('texts.No') ?></td>
<td><?php echo $ip_address->gateway ? url_lang::lang('texts.Yes') : url_lang::lang('texts.No') ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Service') ?></th>
<td><?php echo $ip_address->service?url_lang::lang('texts.Yes'):url_lang::lang('texts.No') ?></td>
<td><?php echo $ip_address->service ? url_lang::lang('texts.Yes') : url_lang::lang('texts.No') ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Never redirect') ?></th>
<td><?php echo $ip_address->whitelisted ? url_lang::lang('texts.Yes') : url_lang::lang('texts.No') ?></td>
</tr>
</table><br />
freenetis/trunk/kohana/application/views/messages_edit_content.php
<?php
echo $head;
echo $editor;
?>
freenetis/trunk/kohana/application/views/messages_show.php
<h2><?php echo $headline ?></h2>
<?php
//echo ($message = $this->session->get('message')) ? '<div class="message">'.$message.'</div>' : '';
$links = array();
$links[] = html::anchor(url_lang::base().'messages/show_all', url_lang::lang('texts.Back to messages for redirection'));
$links[] = html::anchor(url_lang::base().'messages/edit_parameters/'.$message->id, url_lang::lang('texts.Edit parameters'));
$links[] = html::anchor(url_lang::base().'messages/edit_content/'.$message->id, url_lang::lang('texts.Edit content'));
echo implode (' | ', $links)
?>
<br /><br />
<table class="extended" style="float:left" cellspacing="0">
<tr>
<th><?php echo url_lang::lang('texts.ID') ?></th>
<td><?php echo $message->id ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Message name') ?></th>
<td><?php echo $message->name ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Type') ?></th>
<td><?php echo $message->type ?></td>
</tr>
</table>
<table class="extended" style="float:left; margin-left:25px" cellspacing="0">
<tr>
<th><?php echo url_lang::lang("texts.Priority") ?></th>
<td><?php echo $message->priority ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang("texts.System") ?></th>
<td><?php echo $message->system ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang("texts.Self cancelable") ?></th>
<td><?php echo $message->self_cancel ?></td>
</tr>
</table>
<br class="clear" />
<br />
<?php echo $message->text ?>

Také k dispozici: Unified diff