forked from sni/thruk-plugin-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes
25 lines (19 loc) · 885 Bytes
/
routes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
##########################################################
=head2 add_routes
page: /thruk/cgi-bin/editor.cgi
=cut
$routes->{'/thruk/cgi-bin/editor.cgi'} = 'Thruk::Controller::editor::index';
# enable editor features if this plugin is loaded
$app->config->{'use_feature_editor'} = 1;
$app->config->{'plugin_editor_path'} = Thruk::Utils::get_plugin_name(__FILE__, __PACKAGE__);
# add new menu item, but only if user has access to at least some files
sub _plugin_editor_menu_visibility {
my($c) = @_;
require Thruk::Controller::editor;
return(scalar @{Thruk::Controller::editor::get_edits($c)});
}
Thruk::Utils::Menu::insert_item('System', {
'href' => '/thruk/cgi-bin/editor.cgi',
'name' => 'Editor',
'visible_cb' => 'Thruk::_plugin_editor_menu_visibility',
});