Revize 1834
Přidáno uživatelem Ondřej Fibich před více než 11 roky(ů)
freenetis/branches/1.1/media/css/style.css | ||
---|---|---|
border: 1px solid red;
|
||
}
|
||
|
||
.error_text {
|
||
color: white;
|
||
background-color: red;
|
||
padding: 2px;
|
||
}
|
||
|
||
.dispNone {
|
||
display:none;
|
||
}
|
freenetis/branches/1.1/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'date to (last day in month)' => 'Datum do (poslední den v měsíci)',
|
||
'date vat' => 'Datum uskutečnění zdanitelného plnění',
|
||
'day' => 'Den',
|
||
'days' => 'Dní',
|
||
'day book' => 'Účetní deník',
|
||
'db' => 'DŽ',
|
||
'db schema revision' => 'Revize struktury DB',
|
||
... | ... | |
'devices with user as engineer' => 'zařízení s uživatelem jako technik',
|
||
'dhcp configuration' => 'Konfigurace DHCP',
|
||
'dhcp configuration file was successfully generated' => 'Konfigurační soubor pro DHCP byl úspěšně vygenerován',
|
||
'dhcp server maximal timeout' => 'Maximální doba neaktivity DHCP serveru',
|
||
'dhcp servers' => 'DHCP servery',
|
||
'direction' => 'Směr',
|
||
'directional' => 'směrová',
|
||
'directory' => 'adresář',
|
||
... | ... | |
'minimal password level' => 'Minimální úroveň hesla',
|
||
'minimal suggest amount' => 'Minimální navrhovaná částka',
|
||
'minimum of traffic' => 'Minimální provoz',
|
||
'minutes' => 'minut',
|
||
'mod_rewrite is enabled' => 'Mod_rewrite je povolen',
|
||
'mod_rewrite is not enabled' => 'Mod_rewrite není povolen',
|
||
'mode' => 'Mód',
|
||
... | ... | |
'searching' => 'Vyhledávání',
|
||
'searching of term' => 'Vyhledávání výrazu',
|
||
'second-degree certified engineers' => 'Certifikovaní technici druhého stupně',
|
||
'seconds' => 'sekund',
|
||
'secondary dns' => 'Sekundární DNS.',
|
||
'section' => 'Sekce',
|
||
'sectional' => 'sektorová',
|
||
... | ... | |
'wrong phone number of reciever' => 'Nesprávné telefonní číslo příjemce',
|
||
'wrote on' => 'napsal(a)',
|
||
'year' => 'Rok',
|
||
'years' => 'Let',
|
||
'yearly' => 'ročně',
|
||
'yes' => 'ano',
|
||
'you can redirect your inner mail to your e-mail box by editing your e-mail %s' => 'Múžete nastavit přesměrování vnitřní pošty na vaši e-mailovou adresu editací e-mailu %s.',
|
freenetis/branches/1.1/application/i18n/cs_CZ/help.php | ||
---|---|---|
'deduct_member_fees' => 'Zobrazí formulář, který nabídne měsíc a rok pro stržení členských příspěvků. Strhávání členských příspěvků není automatizované a je třeba ho provádět jednou měsíčně, nejlépe uprostřed měsíce od 16. dne hospodářem sdružení. Výsledkem bude, že pro daný měsíc všem členům podle jejich tarifu buden stržen členský příspěvek.',
|
||
'deduct_device_repayments' => 'Provede stržení splátek zařízení. Jedná se o zařízení, která si člen koupil od sdružení. Pokud ve vašem sdružení neprovádíte prodej zařízení na splátky, patrně tuto možnost nevyužijete.',
|
||
'device_admin_users_filter' => 'Umožnuje vyfiltrovat pouze zařízení určité uživatele. Ti jsou zapsané ve tvaru ID člena - jméno příjmení uživatele.',
|
||
'dhcp_server_reload_timeout' => 'Pokud poslední načtení konfigurace DHCP serveru proběhlo před tímto počtem sekund, je server považován za neaktivní.',
|
||
'dns_servers' => 'Jedná se o DNS servery sdružení. Jednotlivé servery zapište na samostatný řádek.',
|
||
'engineer' => 'Technik, který provedl instalaci zařízení.',
|
||
'engineers' => 'Technici, kteří provedli instalaci, výměnu nebo opravu zařízení.',
|
freenetis/branches/1.1/application/i18n/en_US/help.php | ||
---|---|---|
'deduct_member_fees' => 'Form appears, which offers a month and year to tear down the membership fee. Entrainment of membership fees is not automatic and must be carried out once a month, preferably in the middle of the 16th month of landlord associations. The result is that for a given month to all members according to their tariff driven demolished membership fee.',
|
||
'deduct_device_repayments' => 'Performs demolition equipment payments. It is a device that you bought from member associations. If your association do not carry on installment sale of equipment, probably will not use this option.',
|
||
'device_admin_users_filter' => 'Allows to filter out only certain user devices. They are written in the form of a member ID - name surname of user.',
|
||
'dhcp_server_reload_timeout' => 'If last reloading of dhcp server was made before this number of seconds DHCP server is threated as inactive.',
|
||
'dns_servers' => 'It are dns servers of association. You should write each server to one line.',
|
||
'engineer' => 'Engineer, who has performed device installation.',
|
||
'engineers' => 'Engineers, who has performed installation, replacement or repair of device.',
|
freenetis/branches/1.1/application/helpers/callback.php | ||
---|---|---|
|
||
// return result
|
||
echo implode(', ',$pieces);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Callback for display GPS
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* DHCP last access color diff.
|
||
*
|
||
* @param object $item
|
||
* @param string $name
|
||
*/
|
||
public static function dhcp_servers_last_access_diff_field($item, $name)
|
||
{
|
||
$timeout = Settings::get('dhcp_server_reload_timeout');
|
||
|
||
if (empty($item->$name))
|
||
{
|
||
echo '<b class="error_text">' . __('Never') . '</b>';
|
||
}
|
||
else if (abs(time() - strtotime($item->$name)) > $timeout)
|
||
{
|
||
echo '<b class="error_text">';
|
||
self::datetime_diff($item, $name);
|
||
echo '</b>';
|
||
}
|
||
else
|
||
{
|
||
echo self::datetime_diff($item, $name);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Callback function to print e-mail From address
|
||
*
|
||
* @author Michal Kliment
|
||
... | ... | |
*/
|
||
public static function log_queues_type_field($item, $name)
|
||
{
|
||
echo '<b style="padding:2px; color:white; background-color:'
|
||
echo '<b class="error_text" style="background-color:'
|
||
. Log_queue_Model::get_type_color($item->type) . '">'
|
||
. Log_queue_Model::get_type_name($item->type) . '<b>';
|
||
}
|
freenetis/branches/1.1/application/models/device.php | ||
---|---|---|
'device_name' => 'd.name',
|
||
'username' => 'concat(u.name,\' \',u.surname)',
|
||
'device_type' => 'd.type',
|
||
'member_id' => 'users.member_id'
|
||
'member_id' => 'users.member_id',
|
||
);
|
||
|
||
/**
|
||
... | ... | |
$where = count($conds) ? 'WHERE '.implode(' AND ', $conds) : '';
|
||
|
||
// order by check
|
||
if (in_array($params['order_by'], $this->arr_sql))
|
||
if (array_key_exists($params['order_by'], $this->arr_sql))
|
||
$order_by = $this->arr_sql[$params['order_by']];
|
||
else
|
||
$order_by = $this->db->escape_column($params['order_by']);
|
||
... | ... | |
return $this->db->query("
|
||
SELECT COUNT(device_id) AS total FROM
|
||
(
|
||
SELECT * FROM
|
||
SELECT device_id FROM
|
||
(
|
||
SELECT d.id AS device_id, d.type,
|
||
IFNULL(f.translated_term, e.value) AS type_name, d.name,
|
||
... | ... | |
) count
|
||
", Config::get('lang'))->current()->total;
|
||
} // end of count_all_devices
|
||
|
||
/**
|
||
* Gets filtered DHCP servers list
|
||
*
|
||
* @param array $params
|
||
* @return Mysql_Result
|
||
*/
|
||
public function get_all_dhcp_servers($params = array())
|
||
{
|
||
// default params
|
||
$default_params = array
|
||
(
|
||
'order_by' => 'access_time',
|
||
'order_by_direction' => 'asc'
|
||
);
|
||
|
||
$params = array_merge($default_params, $params);
|
||
$where = '';
|
||
|
||
// filter
|
||
if (isset($params['filter_sql']) && $params['filter_sql'] != '')
|
||
$where = 'WHERE ' . $params['filter_sql'];
|
||
|
||
// order by check
|
||
if (array_key_exists($params['order_by'], $this->arr_sql))
|
||
$order_by = $this->arr_sql[$params['order_by']];
|
||
else
|
||
$order_by = $this->db->escape_column($params['order_by']);
|
||
|
||
// order by direction check
|
||
if (strtolower($params['order_by_direction']) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
else
|
||
$order_by_direction = 'desc';
|
||
|
||
if (isset($params['limit']) && isset($params['offset']))
|
||
$limit = 'LIMIT ' . intval($params['offset']) . ', ' . intval($params['limit']);
|
||
else
|
||
$limit = '';
|
||
|
||
return $this->db->query("
|
||
SELECT * FROM (
|
||
SELECT d.id AS device_id, d.type,
|
||
IFNULL(f.translated_term, e.value) AS type_name, d.name,
|
||
d.name AS device_name, u.id AS user_id, u.name AS user_name,
|
||
u.surname AS user_surname, u.login AS user_login,
|
||
d.login, d.password, d.price, d.trade_name, d.payment_rate,
|
||
d.buy_date, m.name AS member_name, st.street, t.town,
|
||
ap.street_number, d.comment, s.id AS subnet_id,
|
||
s.name AS subnet_name, d.access_time, ip.ip_address,
|
||
ip.id AS ip_address_id
|
||
FROM subnets s
|
||
JOIN ip_addresses ip ON s.id = ip.subnet_id
|
||
JOIN ifaces i ON i.id = ip.iface_id
|
||
JOIN devices d ON d.id = i.device_id
|
||
JOIN users u ON d.user_id = u.id
|
||
JOIN members m ON u.member_id = m.id
|
||
LEFT JOIN address_points ap ON d.address_point_id = ap.id
|
||
LEFT JOIN streets st ON ap.street_id = st.id
|
||
LEFT JOIN towns t ON ap.town_id = t.id
|
||
LEFT JOIN enum_types e ON d.type = e.id
|
||
LEFT JOIN translations f ON lang = ? AND e.value = f.original_term
|
||
WHERE s.dhcp > 0 AND ip.gateway > 0
|
||
) d
|
||
$where
|
||
GROUP BY device_id
|
||
ORDER BY $order_by $order_by_direction
|
||
$limit
|
||
", Config::get('lang'));
|
||
} // end of get_all_dhcp_servers
|
||
|
||
/**
|
||
* Count filtered DHCP servers
|
||
*
|
||
* @param array $params
|
||
* @return int
|
||
*/
|
||
public function count_all_dhcp_servers($filter_sql = '')
|
||
{
|
||
$where = '';
|
||
|
||
// filter
|
||
if ($filter_sql != '')
|
||
$where = "WHERE $filter_sql";
|
||
|
||
// query
|
||
return $this->db->query("
|
||
SELECT COUNT(device_id) AS c FROM (
|
||
SELECT device_id FROM (
|
||
SELECT d.id AS device_id, d.type,
|
||
IFNULL(f.translated_term, e.value) AS type_name, d.name,
|
||
d.name AS device_name, u.id AS user_id, u.name AS user_name,
|
||
u.surname AS user_surname, u.login AS user_login,
|
||
d.login, d.password, d.price, d.trade_name, d.payment_rate,
|
||
d.buy_date, m.name AS member_name, st.street, t.town,
|
||
ap.street_number, d.comment, s.id AS subnet_id,
|
||
s.name AS subnet_name, d.access_time, ip.ip_address,
|
||
ip.id AS ip_address_id
|
||
FROM subnets s
|
||
JOIN ip_addresses ip ON s.id = ip.subnet_id
|
||
JOIN ifaces i ON i.id = ip.iface_id
|
||
JOIN devices d ON d.id = i.device_id
|
||
JOIN users u ON d.user_id = u.id
|
||
JOIN members m ON u.member_id = m.id
|
||
LEFT JOIN address_points ap ON d.address_point_id = ap.id
|
||
LEFT JOIN streets st ON ap.street_id = st.id
|
||
LEFT JOIN towns t ON ap.town_id = t.id
|
||
LEFT JOIN enum_types e ON d.type = e.id
|
||
LEFT JOIN translations f ON lang = ? AND e.value = f.original_term
|
||
WHERE s.dhcp > 0 AND ip.gateway > 0
|
||
) d
|
||
$where
|
||
GROUP BY device_id
|
||
) d2
|
||
", Config::get('lang'))->current()->c;
|
||
} // end of count_all_dhcp_servers
|
||
|
||
/**
|
||
* Count inactive DHCP servers
|
||
*
|
||
* @return int
|
||
*/
|
||
public function count_inactive_dhcp_servers()
|
||
{
|
||
$min = time() - Settings::get('dhcp_server_reload_timeout');
|
||
|
||
return $this->db->query("
|
||
SELECT COUNT(device_id) AS c FROM (
|
||
SELECT d.id AS device_id
|
||
FROM subnets s
|
||
JOIN ip_addresses ip ON s.id = ip.subnet_id
|
||
JOIN ifaces i ON i.id = ip.iface_id
|
||
JOIN devices d ON d.id = i.device_id
|
||
WHERE s.dhcp > 0 AND ip.gateway > 0 AND
|
||
(d.access_time < ? OR d.access_time IS NULL)
|
||
GROUP BY device_id
|
||
) d2
|
||
", date('Y-m-d H:i:s', $min))->current()->c;
|
||
} // end of count_inactive_dhcp_servers
|
||
|
||
/**
|
||
* Returns all devices of user
|
||
*
|
||
* @author Michal Kliment
|
freenetis/branches/1.1/application/controllers/settings.php | ||
---|---|---|
->rules('valid_address_ranges')
|
||
->value(str_replace(",","\n", Settings::get('dns_servers')))
|
||
->class('autosize');
|
||
|
||
$this->form->input('dhcp_server_reload_timeout')
|
||
->label('DHCP server maximal timeout')
|
||
->rules('required|valid_numeric')
|
||
->class('increase_decrease_buttons')
|
||
->value(Settings::get('dhcp_server_reload_timeout'))
|
||
->style('width:50px')
|
||
->help('dhcp_server_reload_timeout');
|
||
|
||
$this->form->group('Module settings');
|
||
|
freenetis/branches/1.1/application/controllers/devices.php | ||
---|---|---|
} // end of show_all function
|
||
|
||
/**
|
||
* Shows all DHCP servers with their access times
|
||
*
|
||
* @param int $limit_results
|
||
* @param string $order_by
|
||
* @param string $order_by_direction
|
||
* @param string $page_word
|
||
* @param int $page
|
||
*/
|
||
public function show_all_dhcp_servers($limit_results = 50,
|
||
$order_by = 'access_time', $order_by_direction = 'ASC',
|
||
$page_word = null, $page = 1)
|
||
{
|
||
// access control
|
||
if (!$this->acl_check_view(get_class($this), 'devices'))
|
||
Controller::error(ACCESS);
|
||
|
||
$filter_form = new Filter_form('d');
|
||
|
||
$filter_form->add('access_time')
|
||
->type('date')
|
||
->label('Last access time');
|
||
|
||
$filter_form->add('name')
|
||
->callback('json/device_name');
|
||
|
||
$filter_form->add('type')
|
||
->type('select')
|
||
->values(ORM::factory('Enum_type')->get_values(Enum_type_model::DEVICE_TYPE_ID));
|
||
|
||
$filter_form->add('trade_name')
|
||
->callback('json/device_trade_name');
|
||
|
||
$filter_form->add('subnet_id')
|
||
->type('select')
|
||
->values(ORM::factory('subnet')->select_list())
|
||
->label('Subnet');
|
||
|
||
$filter_form->add('ip_address')
|
||
->callback('json/ip_address');
|
||
|
||
$filter_form->add('town')
|
||
->type('combo')
|
||
->callback('json/town_name');
|
||
|
||
$filter_form->add('street')
|
||
->type('combo')
|
||
->callback('json/street_name');
|
||
|
||
$filter_form->add('street_number')
|
||
->type('number');
|
||
|
||
$filter_form->add('comment');
|
||
|
||
// get new selector
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
$device_model = new Device_Model();
|
||
$total_devices = $device_model->count_all_dhcp_servers($filter_form->as_sql());
|
||
|
||
// limit check
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_devices)
|
||
$sql_offset = 0;
|
||
|
||
// query
|
||
$devices = $device_model->get_all_dhcp_servers(array
|
||
(
|
||
'offset' => $sql_offset,
|
||
'limit' => (int) $limit_results,
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'filter_sql' => $filter_form->as_sql()
|
||
));
|
||
|
||
// headline
|
||
$headline = __('DHCP servers');
|
||
|
||
// grid of devices
|
||
$grid = new Grid('ddhcp_servers', null, array
|
||
(
|
||
'current' => $limit_results,
|
||
'selector_increace' => 50,
|
||
'selector_min' => 50,
|
||
'selector_max_multiplier' => 20,
|
||
'base_url' => Config::get('lang'). '/devices/show_all_dhcp_servers/'
|
||
. $limit_results.'/'.$order_by.'/'.$order_by_direction,
|
||
'uri_segment' => 'page',
|
||
'total_items' => $total_devices,
|
||
'items_per_page' => $limit_results,
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
'filter' => $filter_form
|
||
));
|
||
|
||
$grid->order_field('device_id')
|
||
->label('ID')
|
||
->class('center');
|
||
|
||
$grid->order_field('device_name')
|
||
->link('devices/show', 'device_name');
|
||
|
||
$grid->order_field('type_name')
|
||
->label('Type');
|
||
|
||
$grid->order_link_field('subnet_id')
|
||
->link('subnets/show', 'subnet_name')
|
||
->label('Subnet');
|
||
|
||
$grid->order_link_field('ip_address_id')
|
||
->link('ip_addresses/show', 'ip_address')
|
||
->label('IP address');
|
||
|
||
$grid->order_callback_field('access_time')
|
||
->callback('callback::dhcp_servers_last_access_diff_field')
|
||
->label('Last access time');
|
||
|
||
$actions = $grid->grouped_action_field();
|
||
|
||
if ($this->acl_check_view('Devices_Controller', 'devices'))
|
||
{
|
||
$actions->add_action('device_id')
|
||
->icon_action('show')
|
||
->url('devices/show');
|
||
}
|
||
|
||
$grid->datasource($devices);
|
||
|
||
// view
|
||
$view = new View('main');
|
||
$view->title = $headline;
|
||
$view->breadcrumbs = $headline;
|
||
$view->content = new View('show_all');
|
||
$view->content->headline = $headline;
|
||
$view->content->table = $grid;
|
||
$view->render(TRUE);
|
||
} // end of show_all_dhcp_servers
|
||
|
||
/**
|
||
* Function shows all devices of user.
|
||
*/
|
||
public function show_by_user($user_id = null, $limit_results = 10,
|
freenetis/branches/1.1/application/libraries/Settings.php | ||
---|---|---|
'local_subnets_update_interval' => 86400,
|
||
// time threshold in minutes, before module is shown as inactive
|
||
'module_status_timeout' => 2,
|
||
// time theshold in seconds, before DHCP server is out of date
|
||
'dhcp_server_reload_timeout' => 1800,
|
||
// are connection requests enabled?
|
||
'connection_request_enable' => 0,
|
||
// username regex #360
|
freenetis/branches/1.1/application/libraries/MY_Controller.php | ||
---|---|---|
/** @var integer */
|
||
public $count_of_unvoted_works_reports_of_voter = 0;
|
||
/** @var integer */
|
||
public $count_inactive_dhcp_servers = 0;
|
||
/** @var integer */
|
||
public $count_unfilled_phone_invoices = 0;
|
||
/** @var integer */
|
||
public $count_unidentified_transfers = 0;
|
||
... | ... | |
status::mwarning(url_lang::lang('help.log_queues_info', $link), FALSE);
|
||
}
|
||
}
|
||
|
||
|
||
// DHCP servers (#469)
|
||
if ($this->acl_check_view('Devices_Controller', 'devices'))
|
||
{
|
||
$this->count_inactive_dhcp_servers =
|
||
ORM::factory('device')->count_inactive_dhcp_servers();
|
||
}
|
||
|
||
}
|
||
|
||
/**
|
freenetis/branches/1.1/application/views/menu.php | ||
---|---|---|
<?php echo html::menu_item_counter($this->devices_down_count, 'red') ?>
|
||
</li>
|
||
<?php endif ?>
|
||
|
||
<li>
|
||
<?php echo html::anchor('devices/show_all_dhcp_servers', __('DHCP servers')) ?>
|
||
<?php echo html::menu_item_counter($this->count_inactive_dhcp_servers, 'red') ?>
|
||
</li>
|
||
<?php endif ?>
|
||
<?php if ($this->acl_check_view('Devices_Controller', 'devices') || $this->acl_check_view('Connection_Requests_Controller', 'request')): ?>
|
||
</ul>
|
Také k dispozici: Unified diff
Novinky:
- fixes #469: Seznam DHCP serveru