zen 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +15 -0
- data/.mailmap +2 -0
- data/.rvmrc +2 -0
- data/.travis.yml +8 -3
- data/AUTHORS +1 -2
- data/CHANGELOG.md +48 -17
- data/README.md +44 -39
- data/Rakefile +4 -0
- data/bin/zen +5 -30
- data/lib/zen.rb +13 -19
- data/lib/zen/asset.rb +99 -64
- data/lib/zen/bin/create.rb +94 -0
- data/lib/zen/bin/runner.rb +118 -0
- data/lib/zen/controller/admin_controller.rb +52 -36
- data/lib/zen/controller/base_controller.rb +5 -5
- data/lib/zen/controller/frontend_controller.rb +7 -7
- data/lib/zen/controller/main_controller.rb +12 -10
- data/lib/zen/controller/preview.rb +15 -11
- data/lib/zen/helper/acl.rb +73 -53
- data/lib/zen/helper/blue_form_vendor.rb +689 -0
- data/lib/zen/helper/breadcrumb.rb +23 -19
- data/lib/zen/helper/message.rb +3 -3
- data/lib/zen/helper/theme.rb +18 -13
- data/lib/zen/language.rb +62 -58
- data/lib/zen/language/en/zen_general.yml +2 -4
- data/lib/zen/language/nl/zen_general.yml +2 -4
- data/lib/zen/layout/admin.xhtml +3 -12
- data/lib/zen/layout/login.xhtml +1 -6
- data/lib/zen/model/methods.rb +6 -6
- data/lib/zen/model/settings.rb +5 -4
- data/lib/zen/package.rb +47 -38
- data/lib/zen/package/all.rb +3 -5
- data/lib/zen/package/base.rb +7 -7
- data/lib/zen/package/categories/lib/categories.rb +8 -3
- data/lib/zen/package/categories/lib/categories/controller/categories.rb +81 -55
- data/lib/zen/package/categories/lib/categories/controller/category_groups.rb +45 -44
- data/lib/zen/package/categories/lib/categories/helper/category.rb +88 -0
- data/lib/zen/package/categories/lib/categories/language/en/categories.yml +5 -4
- data/lib/zen/package/categories/lib/categories/language/en/category_groups.yml +5 -4
- data/lib/zen/package/categories/lib/categories/language/nl/categories.yml +5 -4
- data/lib/zen/package/categories/lib/categories/language/nl/category_groups.yml +5 -4
- data/lib/zen/package/categories/lib/categories/model/category.rb +15 -13
- data/lib/zen/package/categories/lib/categories/model/category_group.rb +3 -3
- data/lib/zen/package/categories/lib/categories/plugin/categories.rb +36 -25
- data/lib/zen/package/categories/lib/categories/view/admin/categories/form.xhtml +49 -56
- data/lib/zen/package/categories/lib/categories/view/admin/categories/index.xhtml +48 -35
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/form.xhtml +36 -29
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/index.xhtml +42 -37
- data/lib/zen/package/comments/lib/comments.rb +4 -1
- data/lib/zen/package/comments/lib/comments/controller/comments.rb +39 -32
- data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +45 -26
- data/lib/zen/package/comments/lib/comments/helper/comment.rb +35 -0
- data/lib/zen/package/comments/lib/comments/language/en/comments.yml +9 -7
- data/lib/zen/package/comments/lib/comments/language/nl/comments.yml +10 -8
- data/lib/zen/package/comments/lib/comments/model/comment.rb +31 -17
- data/lib/zen/package/comments/lib/comments/model/comment_status.rb +15 -0
- data/lib/zen/package/comments/lib/comments/plugin/anti_spam.rb +27 -18
- data/lib/zen/package/comments/lib/comments/plugin/comments.rb +25 -20
- data/lib/zen/package/comments/lib/comments/view/admin/comments/form.xhtml +61 -54
- data/lib/zen/package/comments/lib/comments/view/admin/comments/index.xhtml +38 -23
- data/lib/zen/package/comments/migrations/1308774099_comment_status.rb +60 -0
- data/lib/zen/package/custom_fields/lib/custom_fields.rb +33 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/blue_form_parameters.rb +209 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +50 -47
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_types.rb +215 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb +111 -73
- data/lib/zen/package/custom_fields/lib/custom_fields/helper/custom_field.rb +79 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_field_groups.yml +20 -19
- data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_field_types.yml +40 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_fields.yml +34 -32
- data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_groups.yml +5 -4
- data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_types.yml +40 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_fields.yml +18 -16
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb +31 -11
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_method.rb +15 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_type.rb +50 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb +28 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/form.xhtml +33 -28
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/index.xhtml +48 -46
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/form.xhtml +61 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/index.xhtml +93 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/form.xhtml +105 -99
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/index.xhtml +43 -39
- data/lib/zen/package/custom_fields/migrations/1295255665_create_schema.rb +47 -16
- data/lib/zen/package/custom_fields/migrations/1310659580_custom_field_types.rb +148 -0
- data/lib/zen/package/custom_fields/migrations/1311694920_rename_css_class.rb +11 -0
- data/lib/zen/package/menus/lib/menus/controller/menu_items.rb +40 -35
- data/lib/zen/package/menus/lib/menus/controller/menus.rb +47 -43
- data/lib/zen/package/menus/lib/menus/helper/{menu_item.rb → menu.rb} +42 -15
- data/lib/zen/package/menus/lib/menus/language/en/menu_items.yml +5 -5
- data/lib/zen/package/menus/lib/menus/language/en/menus.yml +9 -8
- data/lib/zen/package/menus/lib/menus/language/nl/menu_items.yml +8 -8
- data/lib/zen/package/menus/lib/menus/language/nl/menus.yml +11 -10
- data/lib/zen/package/menus/lib/menus/model/menu.rb +5 -5
- data/lib/zen/package/menus/lib/menus/model/menu_item.rb +6 -5
- data/lib/zen/package/menus/lib/menus/plugin/menus.rb +41 -43
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/form.xhtml +59 -63
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/index.xhtml +35 -30
- data/lib/zen/package/menus/lib/menus/view/admin/menus/form.xhtml +46 -37
- data/lib/zen/package/menus/lib/menus/view/admin/menus/index.xhtml +37 -37
- data/lib/zen/package/menus/migrations/1297184342_create_schema.rb +5 -5
- data/lib/zen/package/menus/migrations/1308671733_rename_order_column.rb +11 -0
- data/lib/zen/package/menus/migrations/1311695030_rename_css_class.rb +17 -0
- data/lib/zen/package/sections/lib/sections.rb +18 -11
- data/lib/zen/package/sections/lib/sections/controller/section_entries.rb +115 -109
- data/lib/zen/package/sections/lib/sections/controller/sections.rb +72 -50
- data/lib/zen/package/sections/lib/sections/helper/section.rb +53 -0
- data/lib/zen/package/sections/lib/sections/language/en/section_entries.yml +5 -4
- data/lib/zen/package/sections/lib/sections/language/en/sections.yml +5 -4
- data/lib/zen/package/sections/lib/sections/language/nl/section_entries.yml +5 -4
- data/lib/zen/package/sections/lib/sections/language/nl/sections.yml +5 -4
- data/lib/zen/package/sections/lib/sections/model/section.rb +17 -9
- data/lib/zen/package/sections/lib/sections/model/section_entry.rb +192 -13
- data/lib/zen/package/sections/lib/sections/model/section_entry_status.rb +13 -0
- data/lib/zen/package/sections/lib/sections/plugin/section_entries.rb +60 -39
- data/lib/zen/package/sections/lib/sections/plugin/sections.rb +14 -11
- data/lib/zen/package/sections/lib/sections/view/admin/form.xhtml +100 -97
- data/lib/zen/package/sections/lib/sections/view/admin/index.xhtml +41 -39
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml +95 -215
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/index.xhtml +48 -40
- data/lib/zen/package/sections/migrations/1308672298_use_id_for_default_section.rb +40 -0
- data/lib/zen/package/sections/migrations/1308813320_section_entry_statuses.rb +58 -0
- data/lib/zen/package/settings/lib/settings/controller/settings.rb +5 -8
- data/lib/zen/package/settings/lib/settings/model/setting.rb +2 -37
- data/lib/zen/package/settings/lib/settings/plugin/setting_base.rb +18 -1
- data/lib/zen/package/settings/lib/settings/plugin/settings.rb +13 -7
- data/lib/zen/package/settings/lib/settings/view/admin/settings/index.xhtml +2 -1
- data/lib/zen/package/users/lib/users.rb +3 -1
- data/lib/zen/package/users/lib/users/controller/access_rules.rb +77 -60
- data/lib/zen/package/users/lib/users/controller/user_groups.rb +41 -36
- data/lib/zen/package/users/lib/users/controller/users.rb +48 -42
- data/lib/zen/package/users/lib/users/helper/users.rb +72 -0
- data/lib/zen/package/users/lib/users/language/en/access_rules.yml +6 -5
- data/lib/zen/package/users/lib/users/language/en/user_groups.yml +5 -4
- data/lib/zen/package/users/lib/users/language/en/users.yml +1 -0
- data/lib/zen/package/users/lib/users/language/nl/access_rules.yml +5 -4
- data/lib/zen/package/users/lib/users/language/nl/user_groups.yml +5 -4
- data/lib/zen/package/users/lib/users/language/nl/users.yml +1 -0
- data/lib/zen/package/users/lib/users/model/access_rule.rb +5 -1
- data/lib/zen/package/users/lib/users/model/user.rb +17 -10
- data/lib/zen/package/users/lib/users/public/admin/js/users/access_rules.js +10 -37
- data/lib/zen/package/users/lib/users/public/admin/js/users/lib/access_rules.js +49 -0
- data/lib/zen/package/users/lib/users/view/admin/access-rules/form.xhtml +105 -96
- data/lib/zen/package/users/lib/users/view/admin/access-rules/index.xhtml +48 -41
- data/lib/zen/package/users/lib/users/view/admin/user-groups/form.xhtml +42 -32
- data/lib/zen/package/users/lib/users/view/admin/user-groups/index.xhtml +43 -38
- data/lib/zen/package/users/lib/users/view/admin/users/form.xhtml +76 -67
- data/lib/zen/package/users/lib/users/view/admin/users/index.xhtml +43 -41
- data/lib/zen/package/users/lib/users/view/admin/users/login.xhtml +12 -9
- data/lib/zen/package/users/migrations/1295281013_create_schema.rb +2 -2
- data/lib/zen/plugin.rb +56 -50
- data/lib/zen/plugin/markup/lib/markup/markup.rb +33 -21
- data/lib/zen/public/admin/css/zen/buttons.css +11 -7
- data/lib/zen/public/admin/css/zen/datepicker.css +6 -6
- data/lib/zen/public/admin/css/zen/forms.css +2 -1
- data/lib/zen/public/admin/css/zen/general.css +15 -10
- data/lib/zen/public/admin/css/zen/layout.css +51 -20
- data/lib/zen/public/admin/css/zen/tables.css +39 -11
- data/lib/zen/public/admin/css/zen/tabs.css +6 -4
- data/lib/zen/public/admin/css/zen/window.css +11 -11
- data/lib/zen/public/{favicon.ico → admin/favicon.ico} +0 -0
- data/lib/zen/public/admin/images/zen/icons/asc.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/desc.png +0 -0
- data/lib/zen/public/admin/js/vendor/datepicker.js +0 -11
- data/lib/zen/public/admin/js/{mootools → vendor/mootools}/core.js +0 -1
- data/lib/zen/public/admin/js/{mootools → vendor/mootools}/more.js +100 -29
- data/lib/zen/public/admin/js/zen/index.js +48 -0
- data/lib/zen/public/admin/js/zen/lib/asset.js +111 -0
- data/lib/zen/public/admin/js/zen/{editor.js → lib/editor.js} +107 -127
- data/lib/zen/public/admin/js/zen/{editor → lib/editor}/markdown.js +7 -9
- data/lib/zen/public/admin/js/zen/{editor → lib/editor}/textile.js +7 -9
- data/lib/zen/public/admin/js/zen/lib/html_table.js +143 -0
- data/lib/zen/public/admin/js/zen/{tabs.js → lib/tabs.js} +40 -37
- data/lib/zen/public/admin/js/zen/{window.js → lib/window.js} +24 -20
- data/lib/zen/spec/bacon/color_output.rb +39 -0
- data/lib/zen/spec/helper.rb +152 -0
- data/lib/zen/spec/simplecov.rb +22 -0
- data/lib/zen/task/build.rake +20 -43
- data/lib/zen/task/clean.rake +2 -6
- data/lib/zen/task/db.rake +8 -12
- data/lib/zen/task/package.rake +4 -10
- data/lib/zen/task/plugin.rake +3 -9
- data/lib/zen/task/proto.rake +0 -62
- data/lib/zen/task/test.rake +6 -3
- data/lib/zen/task/theme.rake +4 -11
- data/lib/zen/theme.rb +22 -24
- data/lib/zen/validation.rb +34 -27
- data/lib/zen/version.rb +2 -8
- data/lib/zen/view/head.xhtml +7 -0
- data/lib/zen/view/main.xhtml +7 -22
- data/{proto/package/migrations → pkg}/.gitkeep +0 -0
- data/proto/app/app.rb +1 -0
- data/proto/app/config/config.rb +5 -4
- data/proto/app/config/database.rb +19 -41
- data/proto/app/config/middlewares.rb +32 -29
- data/proto/{package/lib/package/view/admin/package/index.xhtml → app/log/database/dev/.gitkeep} +0 -0
- data/proto/app/log/database/live/.gitkeep +0 -0
- data/spec/Rakefile +26 -0
- data/spec/fixtures/zen/asset.rb +18 -0
- data/spec/fixtures/zen/helper/acl.rb +39 -0
- data/spec/fixtures/zen/helper/message.rb +19 -0
- data/spec/fixtures/zen/language/en/spec.yml +10 -0
- data/spec/fixtures/zen/language/nl/spec.yml +7 -0
- data/spec/fixtures/zen/package.rb +17 -0
- data/spec/fixtures/zen/package/comments/controller/comments_form.rb +27 -0
- data/spec/fixtures/zen/package/settings/plugin/settings.rb +20 -0
- data/spec/fixtures/zen/plugin.rb +7 -0
- data/spec/fixtures/zen/theme/404.xhtml +1 -0
- data/spec/fixtures/zen/theme/default-section/index.xhtml +1 -0
- data/spec/fixtures/zen/theme/helper/404.xhtml +1 -0
- data/spec/fixtures/zen/theme/helper/partial.xhtml +1 -0
- data/spec/fixtures/zen/theme/helper/wrong_partial.xhtml +1 -0
- data/spec/fixtures/zen/theme/partials/partial.xhtml +1 -0
- data/spec/fixtures/zen/theme/theme.rb +11 -0
- data/spec/fixtures/zen/validation.rb +22 -0
- data/spec/helper.rb +41 -0
- data/spec/zen/all.rb +5 -0
- data/spec/zen/asset.rb +97 -0
- data/spec/zen/bin/create.rb +89 -0
- data/spec/zen/bin/runner.rb +47 -0
- data/spec/zen/controller/admin_controller.rb +26 -0
- data/spec/zen/controller/main_controller.rb +81 -0
- data/spec/zen/controller/preview.rb +33 -0
- data/spec/zen/helper/acl.rb +149 -0
- data/spec/zen/helper/breadcrumb.rb +38 -0
- data/spec/zen/helper/message.rb +31 -0
- data/spec/zen/helper/theme.rb +58 -0
- data/spec/zen/language.rb +55 -0
- data/spec/zen/package.rb +23 -0
- data/spec/zen/package/categories/controller/categories.rb +123 -0
- data/spec/zen/package/categories/controller/category_groups.rb +108 -0
- data/spec/zen/package/categories/helper/category.rb +75 -0
- data/spec/zen/package/categories/plugin/categories.rb +92 -0
- data/spec/zen/package/comments/controller/comments.rb +134 -0
- data/spec/zen/package/comments/controller/comments_form.rb +343 -0
- data/spec/zen/package/comments/helper/comment.rb +47 -0
- data/spec/zen/package/comments/plugin/anti_spam.rb +59 -0
- data/spec/zen/package/comments/plugin/comments.rb +107 -0
- data/spec/zen/package/custom_fields/blue_form_parameters.rb +183 -0
- data/spec/zen/package/custom_fields/controller/custom_field_groups.rb +120 -0
- data/spec/zen/package/custom_fields/controller/custom_field_types.rb +169 -0
- data/spec/zen/package/custom_fields/controller/custom_fields.rb +158 -0
- data/spec/zen/package/custom_fields/helper/custom_field.rb +86 -0
- data/spec/zen/package/menus/controller/menu_items.rb +110 -0
- data/spec/zen/package/menus/controller/menus.rb +110 -0
- data/spec/zen/package/menus/helper/menu.rb +75 -0
- data/spec/zen/package/menus/plugin/menus.rb +120 -0
- data/spec/zen/package/sections/controller/section_entries.rb +201 -0
- data/spec/zen/package/sections/controller/sections.rb +116 -0
- data/spec/zen/package/sections/helper/section.rb +74 -0
- data/spec/zen/package/sections/plugin/section_entries.rb +161 -0
- data/spec/zen/package/sections/plugin/sections.rb +75 -0
- data/spec/zen/package/settings/controller/settings.rb +36 -0
- data/spec/zen/package/settings/plugin/settings.rb +33 -0
- data/spec/zen/package/users/controller/access_rules.rb +90 -0
- data/spec/zen/package/users/controller/user_groups.rb +101 -0
- data/spec/zen/package/users/controller/users.rb +130 -0
- data/spec/zen/package/users/helper/users.rb +97 -0
- data/spec/zen/plugin.rb +64 -0
- data/spec/zen/plugin/helper.rb +11 -0
- data/spec/zen/plugin/markup.rb +44 -0
- data/spec/zen/theme.rb +41 -0
- data/spec/zen/validation.rb +63 -0
- data/zen.gemspec +36 -0
- metadata +159 -113
- data/MANIFEST +0 -266
- data/lib/zen/bin/app.rb +0 -40
- data/lib/zen/ext/string.rb +0 -185
- data/lib/zen/helper/common.rb +0 -106
- data/lib/zen/package/categories/lib/categories/view/admin/categories/edit.xhtml +0 -7
- data/lib/zen/package/categories/lib/categories/view/admin/categories/new.xhtml +0 -7
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/edit.xhtml +0 -7
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/new.xhtml +0 -7
- data/lib/zen/package/comments/lib/comments/view/admin/comments/edit.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/edit.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/new.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/edit.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/new.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/edit.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/new.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menus/edit.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menus/new.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/edit.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/new.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/edit.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/new.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/access-rules/edit.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/access-rules/new.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/user-groups/edit.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/user-groups/new.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/users/edit.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/users/new.xhtml +0 -7
- data/lib/zen/plugin/controller.rb +0 -59
- data/lib/zen/public/admin/css/zen/notifications.css +0 -84
- data/lib/zen/public/admin/images/zen/icons/large/error.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/large/notice.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/large/success.png +0 -0
- data/lib/zen/public/admin/js/zen/core.js +0 -73
- data/lib/zen/public/admin/js/zen/init.js +0 -80
- data/proto/package/lib/package.rb +0 -21
- data/proto/package/lib/package/controller/controllers.rb +0 -50
- data/proto/package/lib/package/language/en/languages.yml +0 -4
- data/proto/package/lib/package/model/model.rb +0 -12
@@ -21,15 +21,16 @@ messages:
|
|
21
21
|
no_rules: 'No access rules have been added yet.'
|
22
22
|
|
23
23
|
errors:
|
24
|
-
new
|
25
|
-
save
|
26
|
-
delete
|
27
|
-
no_delete
|
24
|
+
new : 'Failed to create a new access rule.'
|
25
|
+
save : 'Failed to save the access rule.'
|
26
|
+
delete : 'Failed to delete the access rule with ID #%s.'
|
27
|
+
no_delete : 'You have to specify at least one rule to delete.'
|
28
|
+
invalid_rule: 'The specified access rule is invalid.'
|
28
29
|
|
29
30
|
success:
|
30
31
|
new : 'The access rule has been created.'
|
31
32
|
save : 'The access rule has been modified.'
|
32
|
-
delete : 'The access
|
33
|
+
delete : 'The selected access rules have been deleted.'
|
33
34
|
|
34
35
|
buttons:
|
35
36
|
new : 'New rule'
|
@@ -15,10 +15,11 @@ messages:
|
|
15
15
|
no_groups: 'No user groups have been added yet.'
|
16
16
|
|
17
17
|
errors:
|
18
|
-
new
|
19
|
-
save
|
20
|
-
delete
|
21
|
-
no_delete
|
18
|
+
new : 'Failed to create a new user group.'
|
19
|
+
save : 'Failed to modify the user group.'
|
20
|
+
delete : 'Failed to delete the user group with ID #%s.'
|
21
|
+
no_delete : 'You have to specify at least one group to delete.'
|
22
|
+
invalid_group: 'The specified user group is invalid.'
|
22
23
|
|
23
24
|
success:
|
24
25
|
new : 'The new user group has been created.'
|
@@ -41,6 +41,7 @@ errors:
|
|
41
41
|
no_password_match : 'The specified passwords did not match.'
|
42
42
|
login : 'Failed to log in with the specified details.'
|
43
43
|
logout : 'Failed to log out, perhaps you are already logged out.'
|
44
|
+
invalid_user : 'The specified user is invalid.'
|
44
45
|
|
45
46
|
success:
|
46
47
|
new : 'The new user has been created.'
|
@@ -26,10 +26,11 @@ success:
|
|
26
26
|
delete: 'Alle gespecificeerde regels zijn verwijderd.'
|
27
27
|
|
28
28
|
errors:
|
29
|
-
new
|
30
|
-
save
|
31
|
-
delete
|
32
|
-
no_delete: 'U moet ten minste 1 regel specificeren om te verwijderen.'
|
29
|
+
new : 'De toegangs regel kon niet worden aangemaakt.'
|
30
|
+
save : 'De toegangs regel kon niet worden aangepast.'
|
31
|
+
delete : 'De toegangs regel met ID #%s kon niet worden verwijderd.'
|
32
|
+
no_delete : 'U moet ten minste 1 regel specificeren om te verwijderen.'
|
33
|
+
invalid_rule: 'De opgegeven regel is ongeldig.'
|
33
34
|
|
34
35
|
buttons:
|
35
36
|
new : 'Regel toevoegen'
|
@@ -20,10 +20,11 @@ success:
|
|
20
20
|
delete: 'De geselecteerde groepen zijn verwijderd.'
|
21
21
|
|
22
22
|
errors:
|
23
|
-
new
|
24
|
-
save
|
25
|
-
delete
|
26
|
-
no_delete: 'U moet ten minste 1 groep specificeren om te verwijderen.'
|
23
|
+
new : 'De gebruikers groep kon niet worden aangemaakt.'
|
24
|
+
save : 'De gebruikers groep kon niet worden aangepast.'
|
25
|
+
delete : 'De gebruikers groep met ID #%s kon niet worden verwijderd.'
|
26
|
+
no_delete : 'U moet ten minste 1 groep specificeren om te verwijderen.'
|
27
|
+
invalid_group: 'De opgegeven gebruikers groep is ongeldig.'
|
27
28
|
|
28
29
|
buttons:
|
29
30
|
new : 'Groep toevoegen'
|
@@ -48,6 +48,7 @@ errors:
|
|
48
48
|
no_password_match: 'De opgegeven wachtwoorden komen niet overeen.'
|
49
49
|
login : 'U kon niet worden ingelogd.'
|
50
50
|
logout : 'U kon niet worden uitgelogd, misschien bent u al uitgelogd.'
|
51
|
+
invalid_user : 'De opgegeven gebruiker is ongeldig.'
|
51
52
|
|
52
53
|
buttons:
|
53
54
|
login : 'Inloggen'
|
@@ -26,16 +26,21 @@ module Users
|
|
26
26
|
|
27
27
|
plugin :timestamps, :create => :created_at, :update => :updated_at
|
28
28
|
|
29
|
-
many_to_many
|
30
|
-
|
29
|
+
many_to_many(
|
30
|
+
:user_groups,
|
31
|
+
:class => "Users::Model::UserGroup",
|
32
|
+
:eager => [:access_rules]
|
33
|
+
)
|
34
|
+
|
35
|
+
one_to_many(:access_rules, :class => "Users::Model::AccessRule")
|
31
36
|
|
32
37
|
##
|
33
38
|
# Try to authenticate the user based on the specified credentials.
|
34
39
|
# If the user credentials were incorrect false will be returned,
|
35
40
|
# true otherwise.
|
36
41
|
#
|
37
|
-
# Note that this method will NOT perform any sanitizing, that should be
|
38
|
-
# by the controller instead.
|
42
|
+
# Note that this method will NOT perform any sanitizing, that should be
|
43
|
+
# handled by the controller instead.
|
39
44
|
#
|
40
45
|
# @author Yorick Peterse
|
41
46
|
# @since 0.1
|
@@ -53,9 +58,7 @@ module Users
|
|
53
58
|
if !user.nil? and user.password == password and user.status == 'open'
|
54
59
|
# Overwrite all the global settings with the user specific ones
|
55
60
|
[:language, :frontend_language, :date_format].each do |setting|
|
56
|
-
|
57
|
-
# manually.
|
58
|
-
value = ::Zen::Plugin[:settings].plugin.new(:get, setting).call.value
|
61
|
+
value = Zen::Plugin.plugin(:settings, :get, setting).value
|
59
62
|
|
60
63
|
if user.respond_to?(setting)
|
61
64
|
got = user.send(setting)
|
@@ -104,13 +107,17 @@ module Users
|
|
104
107
|
#
|
105
108
|
# @author Yorick Peterse
|
106
109
|
# @since 0.1
|
107
|
-
# @todo Email validation using regular expressions is bad, a DNS call
|
108
|
-
# much better.
|
110
|
+
# @todo Email validation using regular expressions is bad, a DNS call
|
111
|
+
# would be much better.
|
109
112
|
#
|
110
113
|
def validate
|
111
114
|
validates_presence [:email, :name]
|
112
115
|
validates_presence :status unless new?
|
113
|
-
|
116
|
+
validates_presence :password if new?
|
117
|
+
|
118
|
+
validates_format(
|
119
|
+
/[a-zA-Z0-9\.\_\%\+\-]+@[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}/, :email
|
120
|
+
)
|
114
121
|
end
|
115
122
|
end
|
116
123
|
end
|
@@ -1,33 +1,3 @@
|
|
1
|
-
/**
|
2
|
-
* Function that toggles a given select element from the list of elements.
|
3
|
-
*
|
4
|
-
* @author Yorick Peterse
|
5
|
-
* @since 0.2.5
|
6
|
-
* @param {array} controllers A list of select boxes containing all controllers.
|
7
|
-
* @param {string} selected The ID of the select element that has to be displayed.
|
8
|
-
*
|
9
|
-
*/
|
10
|
-
function toggleSelect(controllers, selected)
|
11
|
-
{
|
12
|
-
// Show the correct box and hide all others
|
13
|
-
controllers.each(function(element)
|
14
|
-
{
|
15
|
-
if ( element.id === selected )
|
16
|
-
{
|
17
|
-
element.removeClass('hidden').set('disabled', false);
|
18
|
-
}
|
19
|
-
else
|
20
|
-
{
|
21
|
-
if ( !element.hasClass('hidden') )
|
22
|
-
{
|
23
|
-
element.addClass('hidden');
|
24
|
-
}
|
25
|
-
|
26
|
-
element.set('disabled', true);
|
27
|
-
}
|
28
|
-
});
|
29
|
-
}
|
30
|
-
|
31
1
|
window.addEvent('domready', function()
|
32
2
|
{
|
33
3
|
// Hide the fields that allow a user to pick a user or group
|
@@ -74,19 +44,22 @@ window.addEvent('domready', function()
|
|
74
44
|
|
75
45
|
if ( package_select )
|
76
46
|
{
|
77
|
-
// Hide all the controller select boxes and only show the ones that
|
78
|
-
// currently selected package.
|
47
|
+
// Hide all the controller select boxes and only show the ones that
|
48
|
+
// belong to the currently selected package.
|
79
49
|
var controllers = $$('select.controllers');
|
80
50
|
|
81
51
|
// Show the first box by default
|
82
|
-
toggleSelect(
|
52
|
+
Users.AccessRules.toggleSelect(
|
53
|
+
controllers, package_select.get('value') + '_controllers'
|
54
|
+
);
|
83
55
|
|
84
|
-
// When the select element's value is changed the correct controller box
|
85
|
-
// be displayed and the old one should be hidden
|
56
|
+
// When the select element's value is changed the correct controller box
|
57
|
+
// should be displayed and the old one should be hidden
|
86
58
|
package_select.addEvent('change', function()
|
87
59
|
{
|
88
|
-
|
89
|
-
|
60
|
+
Users.AccessRules.toggleSelect(
|
61
|
+
controllers, this.get('value') + '_controllers'
|
62
|
+
);
|
90
63
|
});
|
91
64
|
}
|
92
65
|
});
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/**
|
2
|
+
* Namespace for the Users package. The Users package is used to manage users,
|
3
|
+
* user groups and access rules.
|
4
|
+
*
|
5
|
+
* @author Yorick Peterse
|
6
|
+
* @since 0.2.8
|
7
|
+
*/
|
8
|
+
var Users = {};
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Object used when managing access rules in the backend.
|
12
|
+
*
|
13
|
+
* @author Yorick Peterse
|
14
|
+
* @since 0.2.8
|
15
|
+
*/
|
16
|
+
Users.AccessRules =
|
17
|
+
{
|
18
|
+
/**
|
19
|
+
* Method that can be used to toggle the visibility of a <select>
|
20
|
+
* element based on a list of other elements.
|
21
|
+
*
|
22
|
+
* @author Yorick Peterse
|
23
|
+
* @since 0.2.5
|
24
|
+
* @param {array} controllers A list of select boxes containing all
|
25
|
+
* controllers.
|
26
|
+
* @param {string} selected The ID of the select element that has to be
|
27
|
+
* displayed.
|
28
|
+
*/
|
29
|
+
toggleSelect: function(controllers, selected)
|
30
|
+
{
|
31
|
+
// Show the correct box and hide all others
|
32
|
+
controllers.each(function(element)
|
33
|
+
{
|
34
|
+
if ( element.id === selected )
|
35
|
+
{
|
36
|
+
element.removeClass('hidden').set('disabled', false);
|
37
|
+
}
|
38
|
+
else
|
39
|
+
{
|
40
|
+
if ( !element.hasClass('hidden') )
|
41
|
+
{
|
42
|
+
element.addClass('hidden');
|
43
|
+
}
|
44
|
+
|
45
|
+
element.set('disabled', true);
|
46
|
+
}
|
47
|
+
});
|
48
|
+
}
|
49
|
+
}
|
@@ -1,111 +1,120 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
f
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
f.
|
24
|
-
lang('access_rules.labels.
|
25
|
-
:
|
26
|
-
|
27
|
-
:
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
1
|
+
<article>
|
2
|
+
<header>
|
3
|
+
<h1>#{get_breadcrumbs}</h1>
|
4
|
+
</header>
|
5
|
+
|
6
|
+
#{
|
7
|
+
form_for(
|
8
|
+
@access_rule,
|
9
|
+
:method => :post,
|
10
|
+
:action => Users::Controller::AccessRules.r(:save),
|
11
|
+
:id => :access_rule_form
|
12
|
+
) do |f|
|
13
|
+
|
14
|
+
if !@access_rule.user_id.nil?
|
15
|
+
rule_applies = 'div_user_id'
|
16
|
+
else
|
17
|
+
rule_applies = 'div_user_group_id'
|
18
|
+
end
|
19
|
+
|
20
|
+
f.input_hidden(:id, @access_rule.id)
|
21
|
+
f.input_hidden(:csrf_token, get_csrf_token)
|
22
|
+
|
23
|
+
f.input_radio(
|
24
|
+
lang('access_rules.labels.rule_applies'),
|
25
|
+
:rule_applies,
|
26
|
+
rule_applies,
|
27
|
+
:values => @rule_applies_hash
|
28
|
+
)
|
29
|
+
|
30
|
+
f.g.div(:id => 'div_user_id') do
|
31
|
+
f.select(
|
32
|
+
lang('access_rules.labels.user'),
|
33
|
+
:user_id,
|
34
|
+
:values => @form_users,
|
35
|
+
:selected => @access_rule.user_id,
|
36
|
+
:size => 1
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
f.g.div(:id => 'div_user_group_id') do
|
41
|
+
f.select(
|
42
|
+
lang('access_rules.labels.user_group'),
|
43
|
+
:user_group_id,
|
44
|
+
:values => @form_groups,
|
45
|
+
:selected => @access_rule.user_group_id,
|
46
|
+
:size => 1
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
33
50
|
f.select(
|
34
|
-
lang('access_rules.labels.
|
35
|
-
:
|
36
|
-
:values => @
|
37
|
-
:selected => @access_rule.
|
51
|
+
lang('access_rules.labels.package'),
|
52
|
+
:package,
|
53
|
+
:values => @form_packages,
|
54
|
+
:selected => @access_rule.package,
|
38
55
|
:size => 1
|
39
56
|
)
|
40
|
-
end
|
41
|
-
|
42
|
-
f.select(
|
43
|
-
lang('access_rules.labels.package'),
|
44
|
-
:package,
|
45
|
-
:values => @form_packages,
|
46
|
-
:selected => @access_rule.package,
|
47
|
-
:size => 1
|
48
|
-
)
|
49
57
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
58
|
+
# Build the select boxes for all controllers
|
59
|
+
f.g.p do
|
60
|
+
f.g.label { lang('access_rules.labels.controller') }
|
61
|
+
@form_controllers.each do |pkg, controllers|
|
62
|
+
f.g.select(
|
63
|
+
:id => "#{pkg}_controllers",
|
64
|
+
:class => 'controllers hidden',
|
65
|
+
:name => 'controller'
|
66
|
+
) do
|
67
|
+
# Show all the options
|
68
|
+
controllers.each do |key, value|
|
69
|
+
args = {:value => value}
|
60
70
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
71
|
+
# Is it selected?
|
72
|
+
if value === @access_rule.controller
|
73
|
+
args[:selected] = 'selected'
|
74
|
+
else
|
75
|
+
args.delete(:selected)
|
76
|
+
end
|
67
77
|
|
68
|
-
|
69
|
-
key
|
78
|
+
f.g.option(args) { key }
|
70
79
|
end
|
71
80
|
end
|
72
81
|
end
|
73
82
|
end
|
74
|
-
end
|
75
83
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
84
|
+
f.input_radio(
|
85
|
+
lang('access_rules.labels.create'),
|
86
|
+
:create_access,
|
87
|
+
@access_rule.create_access,
|
88
|
+
:values => @boolean_hash.invert
|
89
|
+
)
|
90
|
+
|
91
|
+
f.input_radio(
|
92
|
+
lang('access_rules.labels.read'),
|
93
|
+
:read_access,
|
94
|
+
@access_rule.read_access,
|
95
|
+
:values => @boolean_hash.invert
|
96
|
+
)
|
97
|
+
|
98
|
+
f.input_radio(
|
99
|
+
lang('access_rules.labels.update'),
|
100
|
+
:update_access,
|
101
|
+
@access_rule.update_access,
|
102
|
+
:values => @boolean_hash.invert
|
103
|
+
)
|
104
|
+
|
105
|
+
f.input_radio(
|
106
|
+
lang('access_rules.labels.delete'),
|
107
|
+
:delete_access,
|
108
|
+
@access_rule.delete_access,
|
109
|
+
:values => @boolean_hash.invert
|
110
|
+
)
|
96
111
|
|
97
|
-
f.input_radio(
|
98
|
-
lang('access_rules.labels.delete'),
|
99
|
-
:delete_access,
|
100
|
-
@access_rule.delete_access,
|
101
|
-
:values => @boolean_hash
|
102
|
-
)
|
103
|
-
|
104
|
-
f.g.div(:class => 'clearfix') do
|
105
112
|
f.g.div(:class => 'button') do
|
106
|
-
f.g.input(
|
113
|
+
f.g.input(
|
114
|
+
:type => 'submit',
|
115
|
+
:value => lang('access_rules.buttons.save')
|
116
|
+
)
|
107
117
|
end
|
108
118
|
end
|
109
|
-
|
110
|
-
|
111
|
-
}
|
119
|
+
}
|
120
|
+
</article>
|