Show More
@@ -1,127 +1,127 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 | <%inherit file="/base/base.mako"/> |
|
2 | <%inherit file="/base/base.mako"/> | |
3 |
|
3 | |||
4 | <%def name="title()"> |
|
4 | <%def name="title()"> | |
5 | ${_('Authentication Settings')} |
|
5 | ${_('Authentication Settings')} | |
6 | %if c.rhodecode_name: |
|
6 | %if c.rhodecode_name: | |
7 | · ${h.branding(c.rhodecode_name)}} |
|
7 | · ${h.branding(c.rhodecode_name)}} | |
8 | %endif |
|
8 | %endif | |
9 | </%def> |
|
9 | </%def> | |
10 |
|
10 | |||
11 | <%def name="breadcrumbs_links()"> |
|
11 | <%def name="breadcrumbs_links()"> | |
12 | ${h.link_to(_('Admin'),h.route_path('admin_home'))} |
|
12 | ${h.link_to(_('Admin'),h.route_path('admin_home'))} | |
13 | » |
|
13 | » | |
14 | ${_('Authentication Plugins')} |
|
14 | ${_('Authentication Plugins')} | |
15 | </%def> |
|
15 | </%def> | |
16 |
|
16 | |||
17 | <%def name="menu_bar_nav()"> |
|
17 | <%def name="menu_bar_nav()"> | |
18 | ${self.menu_items(active='admin')} |
|
18 | ${self.menu_items(active='admin')} | |
19 | </%def> |
|
19 | </%def> | |
20 |
|
20 | |||
21 | <%def name="menu_bar_subnav()"> |
|
21 | <%def name="menu_bar_subnav()"> | |
22 | ${self.admin_menu(active='authentication')} |
|
22 | ${self.admin_menu(active='authentication')} | |
23 | </%def> |
|
23 | </%def> | |
24 |
|
24 | |||
25 | <%def name="main()"> |
|
25 | <%def name="main()"> | |
26 |
|
26 | |||
27 | <div class="box"> |
|
27 | <div class="box"> | |
28 |
|
28 | |||
29 | <div class='sidebar-col-wrapper'> |
|
29 | <div class='sidebar-col-wrapper'> | |
30 |
|
30 | |||
31 | <div class="sidebar"> |
|
31 | <div class="sidebar"> | |
32 | <ul class="nav nav-pills nav-stacked"> |
|
32 | <ul class="nav nav-pills nav-stacked"> | |
33 | % for item in resource.get_root().get_nav_list(): |
|
33 | % for item in resource.get_root().get_nav_list(): | |
34 | <li ${'class=active' if item == resource else ''}> |
|
34 | <li ${('class=active' if item == resource else '')}> | |
35 | <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a> |
|
35 | <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a> | |
36 | </li> |
|
36 | </li> | |
37 | % endfor |
|
37 | % endfor | |
38 | </ul> |
|
38 | </ul> | |
39 | </div> |
|
39 | </div> | |
40 |
|
40 | |||
41 | <div class="main-content-full-width"> |
|
41 | <div class="main-content-full-width"> | |
42 | ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)} |
|
42 | ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)} | |
43 | <div class="panel panel-default"> |
|
43 | <div class="panel panel-default"> | |
44 |
|
44 | |||
45 | <div class="panel-heading"> |
|
45 | <div class="panel-heading"> | |
46 | <h3 class="panel-title">${_("Enabled and Available Plugins")}</h3> |
|
46 | <h3 class="panel-title">${_("Enabled and Available Plugins")}</h3> | |
47 | </div> |
|
47 | </div> | |
48 |
|
48 | |||
49 | <div class="panel-body"> |
|
49 | <div class="panel-body"> | |
50 |
|
50 | |||
51 |
|
51 | |||
52 | <div class="label">${_("Ordered Activated Plugins")}</div> |
|
52 | <div class="label">${_("Ordered Activated Plugins")}</div> | |
53 | <div class="textarea text-area editor"> |
|
53 | <div class="textarea text-area editor"> | |
54 | ${h.textarea('auth_plugins',cols=120,rows=20,class_="medium")} |
|
54 | ${h.textarea('auth_plugins',cols=120,rows=20,class_="medium")} | |
55 | </div> |
|
55 | </div> | |
56 | <div class="field"> |
|
56 | <div class="field"> | |
57 | <p class="help-block pre-formatting">${_('List of plugins, separated by commas.' |
|
57 | <p class="help-block pre-formatting">${_('List of plugins, separated by commas.' | |
58 | '\nThe order of the plugins is also the order in which ' |
|
58 | '\nThe order of the plugins is also the order in which ' | |
59 | 'RhodeCode Enterprise will try to authenticate a user.')} |
|
59 | 'RhodeCode Enterprise will try to authenticate a user.')} | |
60 | </p> |
|
60 | </p> | |
61 | </div> |
|
61 | </div> | |
62 |
|
62 | |||
63 | <table class="rctable"> |
|
63 | <table class="rctable"> | |
64 | <th>${_('Activate')}</th> |
|
64 | <th>${_('Activate')}</th> | |
65 | <th>${_('Plugin Name')}</th> |
|
65 | <th>${_('Plugin Name')}</th> | |
66 | <th>${_('Documentation')}</th> |
|
66 | <th>${_('Documentation')}</th> | |
67 | <th>${_('Plugin ID')}</th> |
|
67 | <th>${_('Plugin ID')}</th> | |
68 | <th>${_('Enabled')}</th> |
|
68 | <th>${_('Enabled')}</th> | |
69 | %for plugin in available_plugins: |
|
69 | %for plugin in available_plugins: | |
70 | <tr class="${'inactive' if (not plugin.is_active() and plugin.get_id() in enabled_plugins) else ''}"> |
|
70 | <tr class="${('inactive' if (not plugin.is_active() and plugin.get_id() in enabled_plugins) else '')}"> | |
71 | <td> |
|
71 | <td> | |
72 | <span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${'btn-success' if plugin.get_id() in enabled_plugins else ''}"> |
|
72 | <span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${('btn-success' if plugin.get_id() in enabled_plugins else '')}"> | |
73 | ${_('activated') if plugin.get_id() in enabled_plugins else _('not active')} |
|
73 | ${(_('activated') if plugin.get_id() in enabled_plugins else _('not active'))} | |
74 | </span> |
|
74 | </span> | |
75 | </td> |
|
75 | </td> | |
76 | <td>${plugin.get_display_name()}</td> |
|
76 | <td>${plugin.get_display_name()}</td> | |
77 | <td> |
|
77 | <td> | |
78 | % if plugin.docs(): |
|
78 | % if plugin.docs(): | |
79 | <a href="${plugin.docs()}">docs</a> |
|
79 | <a href="${plugin.docs()}">docs</a> | |
80 | % endif |
|
80 | % endif | |
81 | </td> |
|
81 | </td> | |
82 | <td>${plugin.get_id()}</td> |
|
82 | <td>${plugin.get_id()}</td> | |
83 | <td>${h.bool2icon(plugin.is_active(),show_at_false=False)}</td> |
|
83 | <td>${h.bool2icon(plugin.is_active(),show_at_false=False)}</td> | |
84 | </tr> |
|
84 | </tr> | |
85 | %endfor |
|
85 | %endfor | |
86 | </table> |
|
86 | </table> | |
87 |
|
87 | |||
88 | <div class="buttons"> |
|
88 | <div class="buttons"> | |
89 | ${h.submit('save',_('Save'),class_="btn")} |
|
89 | ${h.submit('save',_('Save'),class_="btn")} | |
90 | </div> |
|
90 | </div> | |
91 | </div> |
|
91 | </div> | |
92 | </div> |
|
92 | </div> | |
93 | ${h.end_form()} |
|
93 | ${h.end_form()} | |
94 | </div> |
|
94 | </div> | |
95 | </div> |
|
95 | </div> | |
96 | </div> |
|
96 | </div> | |
97 |
|
97 | |||
98 | <script> |
|
98 | <script> | |
99 | $('.toggle-plugin').click(function(e){ |
|
99 | $('.toggle-plugin').click(function(e){ | |
100 | var auth_plugins_input = $('#auth_plugins'); |
|
100 | var auth_plugins_input = $('#auth_plugins'); | |
101 | var elems = []; |
|
101 | var elems = []; | |
102 |
|
102 | |||
103 | $.each(auth_plugins_input.val().split(',') , function (index, element) { |
|
103 | $.each(auth_plugins_input.val().split(',') , function (index, element) { | |
104 | if (element !== "") { |
|
104 | if (element !== "") { | |
105 | elems.push(element.strip()) |
|
105 | elems.push(element.strip()) | |
106 | } |
|
106 | } | |
107 | }); |
|
107 | }); | |
108 |
|
108 | |||
109 | var cur_button = e.currentTarget; |
|
109 | var cur_button = e.currentTarget; | |
110 | var plugin_id = $(cur_button).attr('plugin_id'); |
|
110 | var plugin_id = $(cur_button).attr('plugin_id'); | |
111 | if($(cur_button).hasClass('btn-success')){ |
|
111 | if($(cur_button).hasClass('btn-success')){ | |
112 | elems.splice(elems.indexOf(plugin_id), 1); |
|
112 | elems.splice(elems.indexOf(plugin_id), 1); | |
113 | auth_plugins_input.val(elems.join(',\n')); |
|
113 | auth_plugins_input.val(elems.join(',\n')); | |
114 | $(cur_button).removeClass('btn-success'); |
|
114 | $(cur_button).removeClass('btn-success'); | |
115 | cur_button.innerHTML = _gettext('not active'); |
|
115 | cur_button.innerHTML = _gettext('not active'); | |
116 | } |
|
116 | } | |
117 | else{ |
|
117 | else{ | |
118 | if (elems.indexOf(plugin_id) === -1) { |
|
118 | if (elems.indexOf(plugin_id) === -1) { | |
119 | elems.push(plugin_id); |
|
119 | elems.push(plugin_id); | |
120 | } |
|
120 | } | |
121 | auth_plugins_input.val(elems.join(',\n')); |
|
121 | auth_plugins_input.val(elems.join(',\n')); | |
122 | $(cur_button).addClass('btn-success'); |
|
122 | $(cur_button).addClass('btn-success'); | |
123 | cur_button.innerHTML = _gettext('activated'); |
|
123 | cur_button.innerHTML = _gettext('activated'); | |
124 | } |
|
124 | } | |
125 | }); |
|
125 | }); | |
126 | </script> |
|
126 | </script> | |
127 | </%def> |
|
127 | </%def> |
@@ -1,134 +1,135 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 | <%inherit file="/base/base.mako"/> |
|
2 | <%inherit file="/base/base.mako"/> | |
3 |
|
3 | |||
4 | <%def name="title()"> |
|
4 | <%def name="title()"> | |
5 | ${_('Authentication Settings')} |
|
5 | ${_('Authentication Settings')} | |
6 | %if c.rhodecode_name: |
|
6 | %if c.rhodecode_name: | |
7 | · ${h.branding(c.rhodecode_name)}} |
|
7 | · ${h.branding(c.rhodecode_name)}} | |
8 | %endif |
|
8 | %endif | |
9 | </%def> |
|
9 | </%def> | |
10 |
|
10 | |||
11 | <%def name="breadcrumbs_links()"> |
|
11 | <%def name="breadcrumbs_links()"> | |
12 | ${h.link_to(_('Admin'),h.route_path('admin_home'))} |
|
12 | ${h.link_to(_('Admin'),h.route_path('admin_home'))} | |
13 | » |
|
13 | » | |
14 | ${h.link_to(_('Authentication Plugins'),request.resource_path(resource.__parent__, route_name='auth_home'))} |
|
14 | ${h.link_to(_('Authentication Plugins'),request.resource_path(resource.__parent__, route_name='auth_home'))} | |
15 | » |
|
15 | » | |
16 | ${resource.display_name} |
|
16 | ${resource.display_name} | |
17 | </%def> |
|
17 | </%def> | |
18 |
|
18 | |||
19 | <%def name="menu_bar_nav()"> |
|
19 | <%def name="menu_bar_nav()"> | |
20 | ${self.menu_items(active='admin')} |
|
20 | ${self.menu_items(active='admin')} | |
|
21 | </%def> | |||
|
22 | ||||
|
23 | <%def name="menu_bar_subnav()"> | |||
|
24 | ${self.admin_menu(active='authentication')} | |||
21 | </%def> |
|
25 | </%def> | |
22 |
|
26 | |||
23 | <%def name="main()"> |
|
27 | <%def name="main()"> | |
|
28 | ||||
24 | <div class="box"> |
|
29 | <div class="box"> | |
25 | <div class="title"> |
|
30 | ||
26 | ${self.breadcrumbs()} |
|
|||
27 | </div> |
|
|||
28 | <div class='sidebar-col-wrapper'> |
|
31 | <div class='sidebar-col-wrapper'> | |
29 |
|
32 | |||
30 | ## TODO: This is repeated in the auth root template and should be merged |
|
|||
31 | ## into a single solution. |
|
|||
32 | <div class="sidebar"> |
|
33 | <div class="sidebar"> | |
33 | <ul class="nav nav-pills nav-stacked"> |
|
34 | <ul class="nav nav-pills nav-stacked"> | |
34 | % for item in resource.get_root().get_nav_list(): |
|
35 | % for item in resource.get_root().get_nav_list(): | |
35 | <li ${'class=active' if item == resource else ''}> |
|
36 | <li ${('class=active' if item == resource else '')}> | |
36 | <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a> |
|
37 | <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a> | |
37 | </li> |
|
38 | </li> | |
38 | % endfor |
|
39 | % endfor | |
39 | </ul> |
|
40 | </ul> | |
40 | </div> |
|
41 | </div> | |
41 |
|
42 | |||
42 | <div class="main-content-full-width"> |
|
43 | <div class="main-content-full-width"> | |
43 | <div class="panel panel-default"> |
|
44 | <div class="panel panel-default"> | |
44 | <div class="panel-heading"> |
|
45 | <div class="panel-heading"> | |
45 | <h3 class="panel-title">${_('Plugin')}: ${resource.display_name}</h3> |
|
46 | <h3 class="panel-title">${_('Plugin')}: ${resource.display_name}</h3> | |
46 | </div> |
|
47 | </div> | |
47 | <div class="panel-body"> |
|
48 | <div class="panel-body"> | |
48 | <div class="plugin_form"> |
|
49 | <div class="plugin_form"> | |
49 | <div class="fields"> |
|
50 | <div class="fields"> | |
50 | ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)} |
|
51 | ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)} | |
51 | <div class="form"> |
|
52 | <div class="form"> | |
52 |
|
53 | |||
53 | %for node in plugin.get_settings_schema(): |
|
54 | %for node in plugin.get_settings_schema(): | |
54 | <% |
|
55 | <% | |
55 | label_to_type = {'label-checkbox': 'bool', 'label-textarea': 'textarea'} |
|
56 | label_to_type = {'label-checkbox': 'bool', 'label-textarea': 'textarea'} | |
56 | %> |
|
57 | %> | |
57 |
|
58 | |||
58 | <div class="field"> |
|
59 | <div class="field"> | |
59 | <div class="label ${label_to_type.get(node.widget)}"><label for="${node.name}">${node.title}</label></div> |
|
60 | <div class="label ${label_to_type.get(node.widget)}"><label for="${node.name}">${node.title}</label></div> | |
60 | <div class="input"> |
|
61 | <div class="input"> | |
61 | %if node.widget in ["string", "int", "unicode"]: |
|
62 | %if node.widget in ["string", "int", "unicode"]: | |
62 | ${h.text(node.name, defaults.get(node.name), class_="large")} |
|
63 | ${h.text(node.name, defaults.get(node.name), class_="large")} | |
63 | %elif node.widget == "password": |
|
64 | %elif node.widget == "password": | |
64 | ${h.password(node.name, defaults.get(node.name), class_="large")} |
|
65 | ${h.password(node.name, defaults.get(node.name), class_="large")} | |
65 | %elif node.widget == "bool": |
|
66 | %elif node.widget == "bool": | |
66 | <div class="checkbox">${h.checkbox(node.name, True, checked=defaults.get(node.name))}</div> |
|
67 | <div class="checkbox">${h.checkbox(node.name, True, checked=defaults.get(node.name))}</div> | |
67 | %elif node.widget == "select": |
|
68 | %elif node.widget == "select": | |
68 | ${h.select(node.name, defaults.get(node.name), node.validator.choices, class_="select2AuthSetting")} |
|
69 | ${h.select(node.name, defaults.get(node.name), node.validator.choices, class_="select2AuthSetting")} | |
69 | %elif node.widget == "select_with_labels": |
|
70 | %elif node.widget == "select_with_labels": | |
70 | ${h.select(node.name, defaults.get(node.name), node.choices, class_="select2AuthSetting")} |
|
71 | ${h.select(node.name, defaults.get(node.name), node.choices, class_="select2AuthSetting")} | |
71 | %elif node.widget == "textarea": |
|
72 | %elif node.widget == "textarea": | |
72 | <div class="textarea" style="margin-left: 0px">${h.textarea(node.name, defaults.get(node.name), rows=10)}</div> |
|
73 | <div class="textarea" style="margin-left: 0px">${h.textarea(node.name, defaults.get(node.name), rows=10)}</div> | |
73 | %elif node.widget == "readonly": |
|
74 | %elif node.widget == "readonly": | |
74 | ${node.default} |
|
75 | ${node.default} | |
75 | %else: |
|
76 | %else: | |
76 | This field is of type ${node.typ}, which cannot be displayed. Must be one of [string|int|bool|select]. |
|
77 | This field is of type ${node.typ}, which cannot be displayed. Must be one of [string|int|bool|select]. | |
77 | %endif |
|
78 | %endif | |
78 |
|
79 | |||
79 | %if node.name in errors: |
|
80 | %if node.name in errors: | |
80 | <span class="error-message">${errors.get(node.name)}</span> |
|
81 | <span class="error-message">${errors.get(node.name)}</span> | |
81 | <br /> |
|
82 | <br /> | |
82 | %endif |
|
83 | %endif | |
83 | <p class="help-block pre-formatting">${node.description}</p> |
|
84 | <p class="help-block pre-formatting">${node.description}</p> | |
84 | </div> |
|
85 | </div> | |
85 | </div> |
|
86 | </div> | |
86 | %endfor |
|
87 | %endfor | |
87 |
|
88 | |||
88 | ## Allow derived templates to add something below the form |
|
89 | ## Allow derived templates to add something below the form | |
89 | ## input fields |
|
90 | ## input fields | |
90 | %if hasattr(next, 'below_form_fields'): |
|
91 | %if hasattr(next, 'below_form_fields'): | |
91 | ${next.below_form_fields()} |
|
92 | ${next.below_form_fields()} | |
92 | %endif |
|
93 | %endif | |
93 |
|
94 | |||
94 | <div class="buttons"> |
|
95 | <div class="buttons"> | |
95 | ${h.submit('save',_('Save'),class_="btn")} |
|
96 | ${h.submit('save',_('Save'),class_="btn")} | |
96 | </div> |
|
97 | </div> | |
97 |
|
98 | |||
98 | </div> |
|
99 | </div> | |
99 | ${h.end_form()} |
|
100 | ${h.end_form()} | |
100 | </div> |
|
101 | </div> | |
101 | </div> |
|
102 | </div> | |
102 |
|
103 | |||
103 | % if request.GET.get('schema'): |
|
104 | % if request.GET.get('schema'): | |
104 | ## this is for development and creation of example configurations for documentation |
|
105 | ## this is for development and creation of example configurations for documentation | |
105 | <pre> |
|
106 | <pre> | |
106 | % for node in plugin.get_settings_schema(): |
|
107 | % for node in plugin.get_settings_schema(): | |
107 | *option*: `${node.name}` => `${defaults.get(node.name)}`${'\n # '.join(['']+node.description.splitlines())} |
|
108 | *option*: `${node.name}` => `${defaults.get(node.name)}`${'\n # '.join(['']+node.description.splitlines())} | |
108 |
|
109 | |||
109 | % endfor |
|
110 | % endfor | |
110 | </pre> |
|
111 | </pre> | |
111 |
|
112 | |||
112 | % endif |
|
113 | % endif | |
113 |
|
114 | |||
114 | </div> |
|
115 | </div> | |
115 | </div> |
|
116 | </div> | |
116 | </div> |
|
117 | </div> | |
117 |
|
118 | |||
118 | </div> |
|
119 | </div> | |
119 | </div> |
|
120 | </div> | |
120 |
|
121 | |||
121 |
|
122 | |||
122 | <script> |
|
123 | <script> | |
123 | $(document).ready(function() { |
|
124 | $(document).ready(function() { | |
124 | var select2Options = { |
|
125 | var select2Options = { | |
125 | containerCssClass: 'drop-menu', |
|
126 | containerCssClass: 'drop-menu', | |
126 | dropdownCssClass: 'drop-menu-dropdown', |
|
127 | dropdownCssClass: 'drop-menu-dropdown', | |
127 | dropdownAutoWidth: true, |
|
128 | dropdownAutoWidth: true, | |
128 | minimumResultsForSearch: -1 |
|
129 | minimumResultsForSearch: -1 | |
129 | }; |
|
130 | }; | |
130 | $('.select2AuthSetting').select2(select2Options); |
|
131 | $('.select2AuthSetting').select2(select2Options); | |
131 |
|
132 | |||
132 | }); |
|
133 | }); | |
133 | </script> |
|
134 | </script> | |
134 | </%def> |
|
135 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now