infopark_fiona7 0.30.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +3 -0
  3. data/Rakefile +21 -0
  4. data/app/assets/images/fiona7-logo.png +0 -0
  5. data/app/assets/images/fiona7-marker.png +0 -0
  6. data/app/assets/javascripts/fiona7.js +284 -0
  7. data/app/assets/stylesheets/fiona7-login.css.scss +15 -0
  8. data/app/assets/stylesheets/fiona7.css.scss +83 -0
  9. data/app/controllers/fiona7/blobs_controller.rb +35 -0
  10. data/app/controllers/fiona7/default_scrivito_cms_controller.rb +16 -0
  11. data/app/controllers/fiona7/release_controller.rb +24 -0
  12. data/app/controllers/fiona7/sessions_controller.rb +49 -0
  13. data/app/controllers/fiona7_login_page_controller.rb +27 -0
  14. data/app/helpers/fiona7_login_helper.rb +18 -0
  15. data/app/helpers/fiona7_override_helper.rb +47 -0
  16. data/app/models/fiona7/edited_obj.rb +15 -0
  17. data/app/models/fiona7/internal_released_obj.rb +18 -0
  18. data/app/models/fiona7/released_obj.rb +18 -0
  19. data/app/models/fiona7/write_obj.rb +63 -0
  20. data/app/models/fiona7_login_page.rb +5 -0
  21. data/app/models/x_container.rb +5 -0
  22. data/app/models/x_generic.rb +5 -0
  23. data/app/models/x_image.rb +5 -0
  24. data/app/views/fiona7_login_page/index.html.erb +14 -0
  25. data/app/views/layouts/fiona7_login_page_layout.html.erb +23 -0
  26. data/config/locales/login.yml +19 -0
  27. data/config/locales/permissions.yml +7 -0
  28. data/config/routes.rb +9 -0
  29. data/lib/fiona7/assert.rb +17 -0
  30. data/lib/fiona7/builder/batch_widget_writer.rb +107 -0
  31. data/lib/fiona7/builder/obj_builder.rb +297 -0
  32. data/lib/fiona7/builder/obj_class_builder.rb +111 -0
  33. data/lib/fiona7/builder/obj_class_updater.rb +69 -0
  34. data/lib/fiona7/builder/obj_updater.rb +25 -0
  35. data/lib/fiona7/builder/widget_builder.rb +13 -0
  36. data/lib/fiona7/builder/widget_building.rb +35 -0
  37. data/lib/fiona7/builder/widget_updater.rb +13 -0
  38. data/lib/fiona7/controllers/content_service/obj_controller.rb +125 -0
  39. data/lib/fiona7/controllers/content_service/workspace_controller.rb +19 -0
  40. data/lib/fiona7/controllers/rest_api/blob_controller.rb +11 -0
  41. data/lib/fiona7/controllers/rest_api/obj_class_controller.rb +39 -0
  42. data/lib/fiona7/controllers/rest_api/obj_controller.rb +175 -0
  43. data/lib/fiona7/controllers/rest_api/workspace_controller.rb +58 -0
  44. data/lib/fiona7/engine.rb +138 -0
  45. data/lib/fiona7/fiona_connector_patches/basic_obj.rb +9 -0
  46. data/lib/fiona7/initializer.rb +78 -0
  47. data/lib/fiona7/json/obj_class_decorator.rb +45 -0
  48. data/lib/fiona7/json/obj_decorator.rb +153 -0
  49. data/lib/fiona7/json/typeless_obj_decorator.rb +30 -0
  50. data/lib/fiona7/json/widget_decorator.rb +18 -0
  51. data/lib/fiona7/link_converter/fiona_to_scrivito.rb +37 -0
  52. data/lib/fiona7/link_converter/scrivito_to_fiona.rb +42 -0
  53. data/lib/fiona7/mode_switch.rb +7 -0
  54. data/lib/fiona7/mode_switch/abstract_mode_switch.rb +19 -0
  55. data/lib/fiona7/mode_switch/cms_routes.rb +33 -0
  56. data/lib/fiona7/mode_switch/cms_routes/fiona_connector.rb +17 -0
  57. data/lib/fiona7/mode_switch/cms_routes/scrivito_sdk.rb +20 -0
  58. data/lib/fiona7/mode_switch/cms_routes/scrivito_sdk_slave.rb +20 -0
  59. data/lib/fiona7/mode_switch/composite.rb +33 -0
  60. data/lib/fiona7/mode_switch/constants.rb +86 -0
  61. data/lib/fiona7/mode_switch/views.rb +37 -0
  62. data/lib/fiona7/naive_search_engine.rb +111 -0
  63. data/lib/fiona7/recursive_link_resolver.rb +93 -0
  64. data/lib/fiona7/routers/content_service.rb +19 -0
  65. data/lib/fiona7/routers/rest_api.rb +135 -0
  66. data/lib/fiona7/routing_monkey_patch.rb +33 -0
  67. data/lib/fiona7/scrivito_patches/attribute_content.rb +19 -0
  68. data/lib/fiona7/scrivito_patches/basic_obj.rb +92 -0
  69. data/lib/fiona7/scrivito_patches/basic_widget.rb +14 -0
  70. data/lib/fiona7/scrivito_patches/binary.rb +55 -0
  71. data/lib/fiona7/scrivito_patches/client_config.rb +19 -0
  72. data/lib/fiona7/scrivito_patches/cms_dispatch_controller.rb +31 -0
  73. data/lib/fiona7/scrivito_patches/cms_rest_api.rb +11 -0
  74. data/lib/fiona7/scrivito_patches/cms_routing.rb +66 -0
  75. data/lib/fiona7/scrivito_patches/controller_actions.rb +14 -0
  76. data/lib/fiona7/scrivito_patches/link_parser.rb +22 -0
  77. data/lib/fiona7/scrivito_patches/migrator.rb +13 -0
  78. data/lib/fiona7/scrivito_patches/obj_class.rb +16 -0
  79. data/lib/fiona7/scrivito_patches/type_computer.rb +25 -0
  80. data/lib/fiona7/scrivito_patches/workspace.rb +12 -0
  81. data/lib/fiona7/scrivito_user.rb +44 -0
  82. data/lib/fiona7/search_engine.rb +20 -0
  83. data/lib/fiona7/type_register.rb +140 -0
  84. data/lib/fiona7/type_register_mixin.rb +9 -0
  85. data/lib/fiona7/version.rb +3 -0
  86. data/lib/fiona7/version_helper.rb +84 -0
  87. data/lib/fiona7/widget_resolver.rb +37 -0
  88. data/lib/fiona7/workspace.rb +76 -0
  89. data/lib/infopark_fiona7.rb +4 -0
  90. data/lib/tasks/fiona7_tasks.rake +13 -0
  91. metadata +216 -0
@@ -0,0 +1,9 @@
1
+ require 'fiona7/type_register'
2
+
3
+ module Fiona7
4
+ module TypeRegisterMixin
5
+ def type_register
6
+ @type_register ||= TypeRegister.instance
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module Fiona7
2
+ VERSION = "0.30.0.1"
3
+ end
@@ -0,0 +1,84 @@
1
+ #require 'fiona7/released_obj'
2
+ #require 'fiona7/edited_obj'
3
+
4
+ require 'digest/sha1'
5
+
6
+ module Fiona7
7
+ class VersionHelper
8
+ def initialize(workspace_id)
9
+ @workspace_id = workspace_id.to_sym
10
+ end
11
+
12
+ def revision_id
13
+ if @workspace_id == :published
14
+ published_revision_id
15
+ else
16
+ rtc_revision_id
17
+ end
18
+ end
19
+
20
+ def content_state_id
21
+ if @workspace_id == :published
22
+ published_content_state_id
23
+ else
24
+ rtc_content_state_id
25
+ end
26
+ end
27
+
28
+ def base_revision_id
29
+ published_revision_id
30
+ end
31
+
32
+ def base_content_state_id
33
+ published_content_state_id
34
+ end
35
+
36
+ protected
37
+ def published_revision_id
38
+ klass = ReleasedObj
39
+ last_changed = klass.maximum(:last_changed)
40
+ obj_count = klass.count
41
+ revision_id = Digest::SHA1.hexdigest("published:#{last_changed}:#{obj_count}").sub(/^./, 'f')
42
+
43
+ revision_id[0] = 'f'
44
+ revision_id
45
+ end
46
+
47
+ def rtc_revision_id
48
+ klass = EditedObj
49
+ changed = klass.connection.execute("SELECT * from #{klass.table_name} WHERE last_changed = '#{klass.maximum(:last_changed)}' ORDER BY obj_id").to_json
50
+ obj_count = klass.count
51
+ revision_id = Digest::SHA1.hexdigest("rtc:#{changed}:#{obj_count}")
52
+
53
+ revision_id[0] = 'b'
54
+ revision_id
55
+ end
56
+
57
+ def published_content_state_id
58
+ obj_class_names = RailsConnector::ObjClass.select([:obj_class_name, :is_enabled]).map {|o| "#{o.name}:#{o.is_enabled}"}.join("|")
59
+ attribute_names = RailsConnector::Attribute.select(:attribute_name).map(&:name).join("|")
60
+ attribute_joins = self.obj_class_attrs
61
+ Digest::SHA1.hexdigest("#{published_revision_id}:#{obj_class_names}:#{attribute_names}:#{attribute_joins}")
62
+ end
63
+
64
+ def rtc_content_state_id
65
+ obj_class_names = RailsConnector::ObjClass.select([:obj_class_name, :is_enabled]).map {|o| "#{o.name}:#{o.is_enabled}"}.join("|")
66
+ attribute_names = RailsConnector::Attribute.select(:attribute_name).map(&:name).join("|")
67
+ attribute_joins = self.obj_class_attrs
68
+ Digest::SHA1.hexdigest("#{rtc_revision_id}:#{obj_class_names}:#{attribute_names}:#{attribute_joins}")
69
+ end
70
+
71
+ def obj_class_attrs
72
+ if Fiona7.mode == :standalone
73
+ ''
74
+ elsif Fiona7.mode == :legacy
75
+ klass = ReleasedObj
76
+ table_name = "#{klass.table_name_prefix}obj_class_attrs"
77
+ klass.connection.execute("SELECT * from #{table_name}").to_a.map {|(id1,id2)| "#{id1}:#{id2}" }.join("|")
78
+ else
79
+ raise "Invalid Fiona7.mode = #{Fiona7.mode}"
80
+ end
81
+ end
82
+
83
+ end
84
+ end
@@ -0,0 +1,37 @@
1
+ module Fiona7
2
+ class WidgetResolver
3
+ def initialize(widget_pool_value, klass=WriteObj)
4
+ self.value = widget_pool_value
5
+ self.klass = klass
6
+
7
+ preload
8
+ end
9
+
10
+ attr_reader :id_map, :path_map, :instance_map
11
+
12
+ protected
13
+ attr_accessor :value, :klass
14
+ attr_writer :id_map, :path_map, :instance_map
15
+
16
+ def preload
17
+ widget_id_to_object_id_map = Hash[
18
+ self.value.map {|link| [link.title, link.destination_object_id] }
19
+ ]
20
+ object_id_to_widget_instance_map = Hash[
21
+ self.klass.where(obj_id: widget_id_to_object_id_map.values).map {|obj| [obj.id, obj] }
22
+ ]
23
+
24
+ self.id_map = widget_id_to_object_id_map.dup
25
+ self.path_map = Hash[
26
+ widget_id_to_object_id_map.map {|widget_id, obj_id|
27
+ [widget_id, object_id_to_widget_instance_map[obj_id].path]
28
+ }
29
+ ]
30
+ self.instance_map = Hash[
31
+ widget_id_to_object_id_map.map {|widget_id, obj_id|
32
+ [widget_id, object_id_to_widget_instance_map[obj_id]]
33
+ }
34
+ ]
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,76 @@
1
+ require 'fiona7/version_helper'
2
+ require 'fiona7/assert'
3
+
4
+ module Fiona7
5
+ class Workspace
6
+ attr_reader :id, :title
7
+
8
+ class << self
9
+ def rtc
10
+ self.new(:rtc)
11
+ end
12
+
13
+ def published
14
+ self.new(:published)
15
+ end
16
+ end
17
+
18
+ def initialize(id)
19
+ @id = id.to_sym
20
+ Assert.constraint(
21
+ @id == :rtc || @id == :published,
22
+ "Only published and rtc workspaces are possible"
23
+ )
24
+ @version_helper = VersionHelper.new(@id)
25
+ end
26
+
27
+ def title
28
+ if self.id == :rtc
29
+ 'Edited'
30
+ else
31
+ nil
32
+ end
33
+ end
34
+
35
+ def revision_id
36
+ self.version_helper.revision_id
37
+ end
38
+
39
+ def content_state_id
40
+ self.version_helper.content_state_id
41
+ end
42
+
43
+ def base_revision_id
44
+ self.version_helper.base_revision_id if self.id == :rtc
45
+ end
46
+
47
+ def base_content_state_id
48
+ self.version_helper.base_content_state_id if self.id == :rtc
49
+ end
50
+
51
+ def memberships
52
+ {}
53
+ end
54
+
55
+ def as_json(*options)
56
+ r = {
57
+ id: self.id,
58
+ title: self.title,
59
+ revision_id: self.revision_id,
60
+ content_state_id: self.content_state_id,
61
+ memberships: self.memberships
62
+ }
63
+
64
+ r.merge!({
65
+ base_revision_id: self.base_revision_id,
66
+ base_content_state_id: self.base_content_state_id
67
+ }) if self.id == :rtc
68
+
69
+ r.as_json(*options)
70
+ end
71
+
72
+
73
+ protected
74
+ attr_reader :version_helper
75
+ end
76
+ end
@@ -0,0 +1,4 @@
1
+ require "fiona7/engine"
2
+
3
+ module Fiona7
4
+ end
@@ -0,0 +1,13 @@
1
+ namespace :fiona7 do
2
+ desc "Initialize Fiona7"
3
+ task :initialize => :environment do
4
+ require "fiona7/initializer"
5
+
6
+ initializer = Fiona7::Initializer.new
7
+
8
+ initializer.sanity_check
9
+ initializer.classes_and_attributes
10
+ initializer.set_valid_sub_obj_classes
11
+ initializer.create_login_page
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,216 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: infopark_fiona7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.30.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tomasz Przedmojski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.1.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.1.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: scrivito
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.30'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.30'
41
+ - !ruby/object:Gem::Dependency
42
+ name: scrivito_sdk
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: scrivito_editors
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: infopark_fiona_connector
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 7.0.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 7.0.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: infopark_reactor
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 1.12.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 1.12.0
97
+ description: scrivito-compatible interface for classic Fiona
98
+ email:
99
+ - tomasz.przedmojski@infopark.de
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - README.md
105
+ - Rakefile
106
+ - app/assets/images/fiona7-logo.png
107
+ - app/assets/images/fiona7-marker.png
108
+ - app/assets/javascripts/fiona7.js
109
+ - app/assets/stylesheets/fiona7-login.css.scss
110
+ - app/assets/stylesheets/fiona7.css.scss
111
+ - app/controllers/fiona7/blobs_controller.rb
112
+ - app/controllers/fiona7/default_scrivito_cms_controller.rb
113
+ - app/controllers/fiona7/release_controller.rb
114
+ - app/controllers/fiona7/sessions_controller.rb
115
+ - app/controllers/fiona7_login_page_controller.rb
116
+ - app/helpers/fiona7_login_helper.rb
117
+ - app/helpers/fiona7_override_helper.rb
118
+ - app/models/fiona7/edited_obj.rb
119
+ - app/models/fiona7/internal_released_obj.rb
120
+ - app/models/fiona7/released_obj.rb
121
+ - app/models/fiona7/write_obj.rb
122
+ - app/models/fiona7_login_page.rb
123
+ - app/models/x_container.rb
124
+ - app/models/x_generic.rb
125
+ - app/models/x_image.rb
126
+ - app/views/fiona7_login_page/index.html.erb
127
+ - app/views/layouts/fiona7_login_page_layout.html.erb
128
+ - config/locales/login.yml
129
+ - config/locales/permissions.yml
130
+ - config/routes.rb
131
+ - lib/fiona7/assert.rb
132
+ - lib/fiona7/builder/batch_widget_writer.rb
133
+ - lib/fiona7/builder/obj_builder.rb
134
+ - lib/fiona7/builder/obj_class_builder.rb
135
+ - lib/fiona7/builder/obj_class_updater.rb
136
+ - lib/fiona7/builder/obj_updater.rb
137
+ - lib/fiona7/builder/widget_builder.rb
138
+ - lib/fiona7/builder/widget_building.rb
139
+ - lib/fiona7/builder/widget_updater.rb
140
+ - lib/fiona7/controllers/content_service/obj_controller.rb
141
+ - lib/fiona7/controllers/content_service/workspace_controller.rb
142
+ - lib/fiona7/controllers/rest_api/blob_controller.rb
143
+ - lib/fiona7/controllers/rest_api/obj_class_controller.rb
144
+ - lib/fiona7/controllers/rest_api/obj_controller.rb
145
+ - lib/fiona7/controllers/rest_api/workspace_controller.rb
146
+ - lib/fiona7/engine.rb
147
+ - lib/fiona7/fiona_connector_patches/basic_obj.rb
148
+ - lib/fiona7/initializer.rb
149
+ - lib/fiona7/json/obj_class_decorator.rb
150
+ - lib/fiona7/json/obj_decorator.rb
151
+ - lib/fiona7/json/typeless_obj_decorator.rb
152
+ - lib/fiona7/json/widget_decorator.rb
153
+ - lib/fiona7/link_converter/fiona_to_scrivito.rb
154
+ - lib/fiona7/link_converter/scrivito_to_fiona.rb
155
+ - lib/fiona7/mode_switch.rb
156
+ - lib/fiona7/mode_switch/abstract_mode_switch.rb
157
+ - lib/fiona7/mode_switch/cms_routes.rb
158
+ - lib/fiona7/mode_switch/cms_routes/fiona_connector.rb
159
+ - lib/fiona7/mode_switch/cms_routes/scrivito_sdk.rb
160
+ - lib/fiona7/mode_switch/cms_routes/scrivito_sdk_slave.rb
161
+ - lib/fiona7/mode_switch/composite.rb
162
+ - lib/fiona7/mode_switch/constants.rb
163
+ - lib/fiona7/mode_switch/views.rb
164
+ - lib/fiona7/naive_search_engine.rb
165
+ - lib/fiona7/recursive_link_resolver.rb
166
+ - lib/fiona7/routers/content_service.rb
167
+ - lib/fiona7/routers/rest_api.rb
168
+ - lib/fiona7/routing_monkey_patch.rb
169
+ - lib/fiona7/scrivito_patches/attribute_content.rb
170
+ - lib/fiona7/scrivito_patches/basic_obj.rb
171
+ - lib/fiona7/scrivito_patches/basic_widget.rb
172
+ - lib/fiona7/scrivito_patches/binary.rb
173
+ - lib/fiona7/scrivito_patches/client_config.rb
174
+ - lib/fiona7/scrivito_patches/cms_dispatch_controller.rb
175
+ - lib/fiona7/scrivito_patches/cms_rest_api.rb
176
+ - lib/fiona7/scrivito_patches/cms_routing.rb
177
+ - lib/fiona7/scrivito_patches/controller_actions.rb
178
+ - lib/fiona7/scrivito_patches/link_parser.rb
179
+ - lib/fiona7/scrivito_patches/migrator.rb
180
+ - lib/fiona7/scrivito_patches/obj_class.rb
181
+ - lib/fiona7/scrivito_patches/type_computer.rb
182
+ - lib/fiona7/scrivito_patches/workspace.rb
183
+ - lib/fiona7/scrivito_user.rb
184
+ - lib/fiona7/search_engine.rb
185
+ - lib/fiona7/type_register.rb
186
+ - lib/fiona7/type_register_mixin.rb
187
+ - lib/fiona7/version.rb
188
+ - lib/fiona7/version_helper.rb
189
+ - lib/fiona7/widget_resolver.rb
190
+ - lib/fiona7/workspace.rb
191
+ - lib/infopark_fiona7.rb
192
+ - lib/tasks/fiona7_tasks.rake
193
+ homepage: https://wwww.infopark.de
194
+ licenses: []
195
+ metadata: {}
196
+ post_install_message:
197
+ rdoc_options: []
198
+ require_paths:
199
+ - lib
200
+ required_ruby_version: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ version: '0'
205
+ required_rubygems_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ requirements: []
211
+ rubyforge_project:
212
+ rubygems_version: 2.2.2
213
+ signing_key:
214
+ specification_version: 4
215
+ summary: scrivito-compatible interface for classic Fiona
216
+ test_files: []