drg_cms 0.5.8 → 0.5.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/drg_cms/drg_cms.js +53 -0
  3. data/app/assets/javascripts/drg_cms/jquery.the-modal.js +260 -0
  4. data/app/assets/javascripts/drg_cms_cms.js +3 -0
  5. data/app/assets/stylesheets/drg_cms/drg_cms.css +68 -33
  6. data/app/assets/stylesheets/drg_cms/the-modal.css +33 -0
  7. data/app/assets/stylesheets/drg_cms_cms.css +1 -0
  8. data/app/controllers/cmsedit_controller.rb +69 -54
  9. data/app/controllers/dc_application_controller.rb +21 -17
  10. data/app/controllers/dc_common_controller.rb +0 -0
  11. data/app/forms/all_options.yml +3 -2
  12. data/app/forms/cms_menu.yml +30 -17
  13. data/app/forms/dc_big_table_value.yml +3 -0
  14. data/app/forms/dc_filter.yml +56 -0
  15. data/app/forms/dc_key_value_store.yml +33 -0
  16. data/app/helpers/cmsedit_helper.rb +32 -82
  17. data/app/models/dc_ad.rb +27 -1
  18. data/app/models/dc_ad_stat.rb +10 -1
  19. data/app/models/dc_big_menu.rb +18 -1
  20. data/app/models/dc_big_table.rb +15 -2
  21. data/app/models/dc_big_table_locale.rb +13 -2
  22. data/app/models/dc_big_table_value.rb +14 -2
  23. data/app/models/dc_category.rb +16 -2
  24. data/app/models/dc_design.rb +17 -1
  25. data/app/models/dc_dummy.rb +5 -1
  26. data/app/models/dc_filter.rb +172 -0
  27. data/app/models/dc_folder_permission.rb +11 -1
  28. data/app/models/dc_ident.rb +9 -1
  29. data/app/models/dc_internals.rb +58 -0
  30. data/app/models/dc_journal.rb +14 -1
  31. data/app/models/dc_key_value_store.rb +8 -2
  32. data/app/models/dc_link.rb +14 -1
  33. data/app/models/dc_menu.rb +16 -1
  34. data/app/models/dc_menu_item.rb +19 -1
  35. data/app/models/dc_page.rb +43 -1
  36. data/app/models/dc_part.rb +28 -1
  37. data/app/models/dc_permission.rb +11 -1
  38. data/app/models/dc_piece.rb +25 -1
  39. data/app/models/dc_policy.rb +14 -1
  40. data/app/models/dc_policy_role.rb +10 -1
  41. data/app/models/dc_policy_rule.rb +9 -1
  42. data/app/models/dc_poll.rb +23 -1
  43. data/app/models/dc_poll_item.rb +16 -1
  44. data/app/models/dc_simple_menu.rb +16 -1
  45. data/app/models/dc_simple_menu_item.rb +17 -1
  46. data/app/models/dc_site.rb +43 -13
  47. data/app/models/dc_stat.rb +14 -3
  48. data/app/models/dc_user.rb +38 -1
  49. data/app/models/dc_user_role.rb +13 -1
  50. data/app/models/dc_visit.rb +11 -1
  51. data/app/models/drgcms_form_fields.rb +20 -4
  52. data/config/locales/drgcms_en.yml +11 -6
  53. data/config/locales/drgcms_sl.yml +8 -4
  54. data/config/locales/models_en.yml +20 -1
  55. data/config/locales/models_sl.yml +18 -0
  56. data/lib/drg_cms/version.rb +1 -1
  57. data/lib/generators/new_drg_form/new_drg_form_generator.rb +1 -1
  58. data/lib/tasks/browse_models.rake +17 -2
  59. metadata +8 -2
@@ -22,7 +22,17 @@
22
22
  #++
23
23
 
24
24
  #########################################################################
25
- # Mongoid::Document model for dc_folder_permissions collection.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_folder_permission : Folders permissions
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # folder_name String Folder name
33
+ # inherited Mongoid::Boolean Inherit permissions from parent
34
+ # active Mongoid::Boolean Permission is valid
35
+ # dc_policy_rules Embedded:DcPolicyRule Policy rules
26
36
  #
27
37
  # Similar to DcPermission DcFolderPermission model defines documents
28
38
  # for accessing file system. Permissions defined on a parent folder automatically
@@ -22,7 +22,15 @@
22
22
  #++
23
23
 
24
24
  ########################################################################
25
- # Mongoid::Document model for dc_idents emdedded documents.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_ident : Additional identification
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # key String Key which defines ident
33
+ # value String Ident value
26
34
  #
27
35
  # dc_idents are similar to mongoid hash structure and can be used for saveing
28
36
  # key/value object. Fact is that I have overlooked the existance of MongoDB Hash field type
@@ -0,0 +1,58 @@
1
+ #--
2
+ # Copyright (c) 2012+ Damjan Rems
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+ ##########################################################################
25
+ # Internals model represents bridge to action's internal variables like
26
+ # session, params, record ... They are used for interacting with user in terms
27
+ # they understand and provides internal values behind the scene.
28
+ ##########################################################################
29
+ module DcInternals
30
+ INTERNALS = {
31
+ 'current_user' => 'session[:user_id]',
32
+ 'current_user_name' => 'session[:user_name]',
33
+ 'current_site' => 'dc_get_site.id'
34
+ }
35
+ #
36
+ @additions = {}
37
+
38
+ ##########################################################################
39
+ # Add additional internal. This method allows application specific internals
40
+ # to be added to structure and be used together with predefined values.
41
+ ##########################################################################
42
+ def self.add_internal(hash)
43
+ hash.each {|key,value| additions[key] = value}
44
+ end
45
+
46
+ ##########################################################################
47
+ # Add additional internal. This method allows application specific internals
48
+ # to be added to structure and be used together with predefined values.
49
+ ##########################################################################
50
+ def self.get(key)
51
+ key = key.sub('@','')
52
+
53
+ value = INTERNALS[key]
54
+ value = @additions[key] if value.nil?
55
+ value
56
+ end
57
+
58
+ end
@@ -22,7 +22,20 @@
22
22
  #++
23
23
 
24
24
  #########################################################################
25
- # Mongoid::Document model for dc_journals collection.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_journal : Update journal
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # user_id BSON::ObjectId User
31
+ # site_id BSON::ObjectId Site
32
+ # doc_id BSON::ObjectId doc_id
33
+ # operation String Operation
34
+ # tables String Table name
35
+ # ids String Parent ids
36
+ # ip String ip address from where operation was performed
37
+ # time DateTime Time of operation
38
+ # diff String Differences
26
39
  #
27
40
  # dc_journals collections saves all data that has been updated through cmsedit
28
41
  # controller. It saves old and new values of changed fields and can be used for
@@ -22,10 +22,16 @@
22
22
  #++
23
23
 
24
24
  #########################################################################
25
- # Mongoid::Document model for dc_key_value_stores collection.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_key_value_store : Table used for storing all kind of values
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # key String Identification key
31
+ # value String Stored value
26
32
  #
27
33
  # This model represents key/value store. Typical usage is for saving last
28
- # used document number on some internal document numbering schema.
34
+ # used document number on internal document numbering schema.
29
35
  #
30
36
  # Example:
31
37
  # doc_number = DcKeyValueStore.get_next_value('invoices', invoice_date.year)
@@ -22,7 +22,20 @@
22
22
  #++
23
23
 
24
24
  #########################################################################
25
- # Mongoid::Document model for dc_links collection.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_link : Alternative links
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # name String Link name ex. homepage
33
+ # params String Aditional parameters passed to document renderer
34
+ # active Mongoid::Boolean Link is active
35
+ # page_id BSON::ObjectId Page redirected to by this shortcut link
36
+ # created_by BSON::ObjectId created_by
37
+ # updated_by BSON::ObjectId updated_by
38
+ # dc_site_id Object Link is valid for site
26
39
  #
27
40
  # DcLink documents may be used for creating alternative url links. page_id field must
28
41
  # point to valid DcPage document which will be used for further processing.
@@ -22,7 +22,22 @@
22
22
  #++
23
23
 
24
24
  #########################################################################
25
- # Mongoid::Document model for dc_menus collection.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_menu : Menus
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # name String Menu name
33
+ # description String Short description of menu
34
+ # div_name String Div id name around menu area
35
+ # link_prepend String Link field usually holds direct link to document. Prepand field holds data, that has to be prepanded to the link.
36
+ # css String CSS for this menu
37
+ # active Mongoid::Boolean Active
38
+ # created_by BSON::ObjectId created_by
39
+ # updated_by BSON::ObjectId updated_by
40
+ # dc_menu_items Embedded:DcMenuItem Menu items
26
41
  #
27
42
  # Default menu system for DRG CMS. Model recursively embeds DcMenuItem documents
28
43
  # which (theoretically) results in infinite level of sub menus. In practice
@@ -22,7 +22,25 @@
22
22
  #++
23
23
 
24
24
  #########################################################################
25
- # Mongoid::Document model for dc_menu_items embedded documents.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_menu_item : Menu items
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # caption String Caption of menu item
33
+ # picture String Picture for the menu
34
+ # link String Link called when menu is chosen
35
+ # link_prepend String Link field usually holds direct link to document. Prepand field holds data, that has to be prepanded to the link.
36
+ # target String Target window for the link. Leave empty when same window.
37
+ # page_id BSON::ObjectId Page link
38
+ # order Integer Order on which menu item is shown. Lower number means prior position.
39
+ # active Mongoid::Boolean Is active
40
+ # policy_id BSON::ObjectId Menu item will be diplayed according to this policy
41
+ # created_by BSON::ObjectId created_by
42
+ # updated_by BSON::ObjectId updated_by
43
+ # dc_menu_items Embedded:DcMenuItem Submenu items
26
44
  #
27
45
  # DcMenuItem documents are embedded in the DcMenu document and define one menu
28
46
  # item of menu system.
@@ -117,11 +117,53 @@ def self.all_pages_for_site(site)
117
117
  inject([]) { |r,page| r << [ page.subject, page.subject_link] }
118
118
  end
119
119
 
120
+ ########################################################################
121
+ # Return filter options
122
+ ########################################################################
123
+ def self.dc_filters
124
+ {'title' => 'drgcms.filters.this_site_only', 'operation' => 'eq',
125
+ 'field' => 'dc_site_id', 'value' => '@current_site'}
126
+ end
127
+
120
128
  end
121
129
  end
122
130
 
123
131
  #########################################################################
124
- # Mongoid::Document model for dc_page documents.
132
+ # == Schema information
133
+ #
134
+ # Collection name: dc_page : Pages
135
+ #
136
+ # _id BSON::ObjectId _id
137
+ # created_at Time created_at
138
+ # updated_at Time Updated
139
+ # subject String Articles subject
140
+ # title String Browser title. Optimization for SEO.
141
+ # subject_link String Friendly link defined
142
+ # alt_link String Alternative link, by which page could be found
143
+ # sub_subject String Sub subject, short description of text
144
+ # picture String Picture used in conjunction with page
145
+ # gallery String Gallery pictures are defined in parts of page. Value defines name of parts which hold data about pictures in gallary.
146
+ # body String Content of this page
147
+ # css String CSS only for this menu page
148
+ # script String Javascript only for this page
149
+ # params String Special parameters which may come handy when displaying page
150
+ # menu_id BSON::ObjectId Top menu under where this page is displayed
151
+ # author_id BSON::ObjectId Author of the article
152
+ # dc_poll_id BSON::ObjectId Select poll, if poll is to be used with page
153
+ # author_name String Author of the article
154
+ # publish_date DateTime Publish date
155
+ # user_name String user_name
156
+ # valid_from DateTime Article is valid from date
157
+ # valid_to DateTime Article is valid to date
158
+ # comments Integer Comments on this article are allowed
159
+ # active Mongoid::Boolean Page is active
160
+ # created_by BSON::ObjectId created_by
161
+ # updated_by BSON::ObjectId updated_by
162
+ # kats Array Categories for this article
163
+ # policy_id BSON::ObjectId Access policy for the page
164
+ # dc_site_id Object dc_site_id
165
+ # dc_design_id Object Design used for rendering page
166
+ # dc_parts Embedded:DcPart Parts of the article
125
167
  #
126
168
  # DcPage documents are anchors for urls. Default DcApplicationController::dc_process_default_request()
127
169
  # method searches for DcPage document by subject_link, id or alt_link. When found it loads
@@ -23,7 +23,34 @@
23
23
  require_dependency DrgCms.model 'dc_piece'
24
24
 
25
25
  ########################################################################
26
- # Mongoid::Document model for dc_part embedded documents.
26
+ # == Schema information
27
+ #
28
+ # Collection name: dc_part : Parts of page
29
+ #
30
+ # _id BSON::ObjectId _id
31
+ # created_at Time created_at
32
+ # updated_at Time Last updated at
33
+ # name String Parts can be searched by name or by id
34
+ # description String Short description of part
35
+ # picture String Picture contents of part
36
+ # thumbnail String Small version of picture if available
37
+ # body String Content of this part
38
+ # css String CSS
39
+ # script String Script, if script is included in part
40
+ # script_type String Script type
41
+ # params String params
42
+ # piece_id BSON::ObjectId Piece name if part is connected to piece
43
+ # div_id String Div id (position name) where this part is displayed as defined on design
44
+ # site_id BSON::ObjectId site_id
45
+ # order Integer Order between parts
46
+ # active Mongoid::Boolean Part is active
47
+ # valid_from DateTime Part is valid from
48
+ # valid_to DateTime Part is valid to
49
+ # created_by BSON::ObjectId created_by
50
+ # updated_by BSON::ObjectId Last updated by
51
+ # _type String _type
52
+ # policy_id BSON::ObjectId Access policy for the part
53
+ # link String Link when part can be accessed with pretty link
27
54
  #
28
55
  # DcPart model is used for embedding parts of final document into other models. It declares fields
29
56
  # which may be used in various scenarios. For example:
@@ -22,7 +22,17 @@
22
22
  #++
23
23
 
24
24
  ########################################################################
25
- # Mongoid::Document model for dc_permissions collection.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_permission : Collection permissions
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # table_name String Permission is valid for collection
33
+ # is_default Mongoid::Boolean This is default permission for all collections in database
34
+ # active Mongoid::Boolean Permission is active
35
+ # dc_policy_rules Embedded:DcPolicyRule Defined policy rules
26
36
  #
27
37
  # dc_permissions collection is used for saving documents which define permissions
28
38
  # for accessing individual collections within DRG CMS system. Document which is marked
@@ -57,7 +57,31 @@ end
57
57
  end
58
58
 
59
59
  ########################################################################
60
- # Mongoid::Document model for dc_piece documents.
60
+ # == Schema information
61
+ #
62
+ # Collection name: dc_piece : Pieces of content
63
+ #
64
+ # _id BSON::ObjectId _id
65
+ # created_at Time created_at
66
+ # updated_at Time Last updated at
67
+ # name String Unique name for piece
68
+ # description String Short description of piece
69
+ # picture String Picture contents of piece
70
+ # thumbnail String Small version of picture if available
71
+ # body String Content of this piece
72
+ # css String CSS
73
+ # script String Script, if script is included in piece
74
+ # script_type String Script type
75
+ # params String params
76
+ # piece_id BSON::ObjectId Piece
77
+ # div_id String Div (position name) id on design where this piece is rendered
78
+ # site_id BSON::ObjectId Site name where this piece will belong to
79
+ # order Integer Order to be used when pieces are positioned in the same div (location)
80
+ # active Mongoid::Boolean Piece is active
81
+ # valid_from DateTime Piece is valid from
82
+ # valid_to DateTime Piece is valid to
83
+ # created_by BSON::ObjectId created_by
84
+ # updated_by BSON::ObjectId Last updated by
61
85
  #
62
86
  # DcPiece collection is used for documents or pieces of web site which are common to site
63
87
  # or perhaps to all sites in database. For example page footer is a good candidate
@@ -22,7 +22,20 @@
22
22
  #++
23
23
 
24
24
  ########################################################################
25
- # Mongoid::Document model for dc_policy documents embedded into dc_sites collection documents.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_policy : Access policy declarations
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # name String Unique policy name
33
+ # description String Description for this policy
34
+ # is_default Mongoid::Boolean This is default policy for the site
35
+ # active Mongoid::Boolean Policy is active
36
+ # updated_by BSON::ObjectId updated_by
37
+ # message String Error message when blocked by this policy
38
+ # dc_policy_rules Embedded:DcPolicyRule Policy rules
26
39
  #
27
40
  # DcPolicy documents define policies for accessing data on web site. Policies define which
28
41
  # user roles (defined in dc_policy_roles collection) has no access, can view or edit data (sees CMS menu) on
@@ -22,7 +22,16 @@
22
22
  #++
23
23
 
24
24
  ########################################################################
25
- # Mongoid::Document model for dc_policy_roles collection.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_policy_role : User roles
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # name String Role name
33
+ # system_name String System role name if required by application
34
+ # active Mongoid::Boolean Role is active
26
35
  #
27
36
  # Documents in this model define all available user roles in the application. Roles
28
37
  # are defined by unique name which is valid for current application or as alternative name (system_name)
@@ -78,7 +78,15 @@ end
78
78
  end
79
79
 
80
80
  #########################################################################
81
- # Mongoid::Document model for dc_policy_rule documents embedded into documents.
81
+ # == Schema information
82
+ #
83
+ # Collection name: dc_policy_rule : Access policy rules
84
+ #
85
+ # _id BSON::ObjectId _id
86
+ # created_at Time created_at
87
+ # updated_at Time updated_at
88
+ # dc_policy_role_id Object User role access defined by this rule
89
+ # permission Integer Access permission
82
90
  #
83
91
  # DcPolicyRule documents define policies for accessing data. DRG CMS uses policy rules for
84
92
  # defining policies in DcSite, DcPermission and DcFolderPermission documents.
@@ -22,7 +22,29 @@
22
22
  #++
23
23
 
24
24
  ########################################################################
25
- # Mongoid::Document model for dc_poll documents.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_poll : Polls
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # name String Unique poll name
33
+ # title String Title for the poll
34
+ # sub_text String Short description of the poll
35
+ # pre_display String pre_display
36
+ # operation String Operation performed on submit
37
+ # parameters String Aditional parameters for operation
38
+ # display String Select how fields are positioned on form
39
+ # css String CSS specific to this poll
40
+ # form String You can specified input items by providing form acording to rules of drgCMS form.
41
+ # valid_from DateTime Pole is valid from
42
+ # valid_to DateTime Pole is valid to
43
+ # captcha_type String Catpcha type name if captcha is used
44
+ # active Mongoid::Boolean active
45
+ # created_by BSON::ObjectId created_by
46
+ # updated_by BSON::ObjectId updated_by
47
+ # dc_poll_items Embedded:DcPollItem Items for this poll
26
48
  #
27
49
  # DcPoll documents are used for different questionaries and formulars which can
28
50
  # be accessed independent or connected with DcPage documents. Entry fields can be defined