diff --git a/assets/css/src/settings.styl b/assets/css/src/settings.styl index 6f7dcfbc0c..b08b1975c9 100644 --- a/assets/css/src/settings.styl +++ b/assets/css/src/settings.styl @@ -1,2 +1,7 @@ -.mailpoet_form th - width:300px \ No newline at end of file +.mailpoet_form .form-table th + width:20em + +// responsive +@media screen and (max-width: 782px) + .mailpoet_form .form-table th + width: auto \ No newline at end of file diff --git a/lib/Config/Menu.php b/lib/Config/Menu.php index 9f0a682335..0bbb9b4753 100644 --- a/lib/Config/Menu.php +++ b/lib/Config/Menu.php @@ -139,11 +139,70 @@ class Menu { $pages[$key] = $page; } + // Charsets + $charsets = array( + 'UTF-8', 'UTF-7', 'BIG5', 'ISO-2022-JP', + 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', + 'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6', + 'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9', + 'ISO-8859-10', 'ISO-8859-13', 'ISO-8859-14', + 'ISO-8859-15', 'Windows-1251', 'Windows-1252' + ); + + // Roles & Permissions + global $wp_roles; + $editable_roles = apply_filters('editable_roles', $wp_roles->roles); + $roles = array(); + foreach($editable_roles as $role => $role_data) { + $roles[$role] = translate_user_role($role_data['name']); + } + + $capabilities = array( + 'mailpoet_newsletters' => + __('Who can create newsletters?'), + 'mailpoet_newsletter_styles' => + __('Who can see the styles tab in the visual editor?'), + 'mailpoet_subscribers' => + __('Who can manage subscribers?'), + 'mailpoet_settings' => + __("Who can change MailPoet's settings?"), + ); + $capabilities = apply_filters('mailpoet_capabilities', $capabilities); + + // go over each capability + foreach($capabilities as $capability => $label) { + $capability_roles = array(); + // go over each role and check permission + foreach($roles as $role_key => $role_data) { + // get role object based on role key + $role = get_role($role_key); + + // assign role capability + $capability_roles[$role_key] = array( + 'capability' => $capability, + 'is_capable' => ( + in_array($role_key, array('administrator', 'super_admin')) + || ($role->has_cap($capability)) + ), + 'is_disabled' =>( + in_array($role_key, array('administrator', 'super_admin')) + ) + ); + } + $capabilities[$capability] = array( + 'label' => $label, + 'roles' => $capability_roles + ); + } + $data = array( 'segments' => $segments, 'pages' => $pages, 'flags' => $flags, - 'current_user' => $current_user + 'charsets' => $charsets, + 'current_user' => $current_user, + 'capabilities' => $capabilities, + 'roles' => $roles ); echo $this->renderer->render('settings.html', $data); diff --git a/lib/Config/Renderer.php b/lib/Config/Renderer.php index 857e027262..68bcaf37da 100644 --- a/lib/Config/Renderer.php +++ b/lib/Config/Renderer.php @@ -46,7 +46,7 @@ class Renderer { function setupSyntax() { $lexer = new TwigLexer($this->renderer, array( - 'tag_comment' => array('<%#', '%>'), + 'tag_comment' => array('<#', '#>'), 'tag_block' => array('<%', '%>'), 'tag_variable' => array('<%=', '%>'), 'interpolation' => array('%{', '}') diff --git a/lib/Twig/Functions.php b/lib/Twig/Functions.php index 7f01e0aba4..7f04f8b830 100644 --- a/lib/Twig/Functions.php +++ b/lib/Twig/Functions.php @@ -36,6 +36,11 @@ class Functions extends \Twig_Extension { 'admin_url', 'admin_url', array('is_safe' => array('all')) + ), + new \Twig_SimpleFunction( + 'get_option', + 'get_option', + array('is_safe' => array('all')) ) ); } diff --git a/views/settings.html b/views/settings.html index 1c3bf7e608..da8df3598b 100644 --- a/views/settings.html +++ b/views/settings.html @@ -22,30 +22,31 @@ +
<% endblock %> diff --git a/views/settings/advanced.html b/views/settings/advanced.html index 31e9293e72..2887f182e5 100644 --- a/views/settings/advanced.html +++ b/views/settings/advanced.html @@ -1 +1,181 @@ -advanced.html \ No newline at end of file +
+ <%= __('Roles and permissions') %> + | + <% for role in roles %> ++ <%= role %> + | + <% endfor %> +
---|---|
+ <%= capability.label %> + | + <% for role in capability.roles %> ++ + checked="checked" + <% endif %> + <% if(role.is_disabled) %> + disabled="disabled" + <% endif %> + /> + | + <% endfor %> +
+ | +
+ + + + |
+
---|---|
+ + | +
+ + + + + + |
+
+ + | +
+ + + + |
+
+ + | +
+ + + + + + |
+
+ | ++ + | +
+ + | +
+ + + + + + |
+
---|
+ + | +
+ + + + + |
+
---|---|
+ + | +
+ + + + + |
+
+ + | ++ + value="<%= settings.signup_confirmation_email_subject %>" + <% else %> + value="<%= __('Confirm your subscription to %1$s') %>" + <% endif %> + /> + | +
+ + | ++ + | +
+ + | ++ + | +