infopark_fiona_connector 6.9.1.3.22208381 → 6.9.2.1.125136549

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,4 @@ module RailsConnector
18
18
  autoload_all_sources
19
19
  end
20
20
 
21
- autoload :Comment, "comment"
22
- autoload :Rating, "rating"
23
-
24
21
  require "rails_connector/fiona_engine" if defined?(Rails)
@@ -14,7 +14,6 @@ module RailsConnector
14
14
  "\xdf\x20\xbd\x42\x9a\x65\x8d\x72\x93\x6c\x96\x69\x91\x6e".freeze
15
15
 
16
16
  include DateAttribute
17
- include SEO
18
17
 
19
18
  self.store_full_sti_class = false
20
19
 
@@ -197,12 +196,11 @@ module RailsConnector
197
196
  object_type == :document
198
197
  end
199
198
 
200
- # Returns true if this object is active (time_when is in objects time interval)
199
+ # Returns true if this object is active.
201
200
  # @api public
202
- def active?(time_when = nil)
201
+ def active?
203
202
  return false if !valid_from
204
- time_then = time_when || BasicObj.preview_time
205
- valid_from <= time_then && (!valid_until || time_then <= valid_until)
203
+ valid_from <= Time.now && (!valid_until || Time.now <= valid_until)
206
204
  end
207
205
 
208
206
  # Returns true if this object has edited content.
@@ -230,8 +228,8 @@ module RailsConnector
230
228
 
231
229
  # Returns true if the export of the object is not suppressed and the content is active?
232
230
  # @api public
233
- def exportable?(current_time = nil)
234
- !suppressed? && active?(current_time)
231
+ def exportable?
232
+ !suppressed? && active?
235
233
  end
236
234
 
237
235
  # Returns the file name to which the Content.file_extension has been appended.
@@ -264,8 +262,7 @@ module RailsConnector
264
262
  # @api public
265
263
  def toclist(*args)
266
264
  return [] unless publication?
267
- time = args.detect {|value| value.kind_of? Time}
268
- toclist = children.find(:all).select{ |toc| toc.exportable?(time) }
265
+ toclist = children.find(:all).select{ |toc| toc.exportable? }
269
266
  toclist = toclist.reject { |toc| toc.binary? } unless args.include?(:all)
270
267
  toclist
271
268
  end
@@ -492,10 +489,6 @@ module RailsConnector
492
489
  @mime_type ||= compute_mime_type
493
490
  end
494
491
 
495
- def to_liquid
496
- LiquidSupport::ObjDrop.new(self)
497
- end
498
-
499
492
  def respond_to?(method_id, include_private=false)
500
493
  if super
501
494
  true
@@ -508,14 +501,6 @@ module RailsConnector
508
501
  end
509
502
  end
510
503
 
511
- def self.preview_time=(t)
512
- Thread.current[:preview_time] = t
513
- end
514
-
515
- def self.preview_time
516
- Thread.current[:preview_time] || Time.now
517
- end
518
-
519
504
  private
520
505
 
521
506
  def as_date(value)
@@ -19,7 +19,7 @@ module RailsConnector
19
19
  end
20
20
 
21
21
  def self.parse(iso_date_time)
22
- Time.from_iso(iso_date_time).localtime
22
+ Time.from_iso(iso_date_time).in_time_zone
23
23
  rescue ArgumentError
24
24
  raise "The value is not a valid ISO date time: #{iso_date_time.inspect}"
25
25
  end
@@ -1,5 +1,9 @@
1
1
  module ::RailsConnector
2
2
  class FionaEngine < Rails::Engine
3
+ initializer 'rails_connector.config_local', :after => :load_config_initializers,
4
+ :before => :engines_blank_point do
5
+ Dir[Rails.root + 'config/local/*.rb'].map &method(:require)
6
+ end
3
7
  end
4
8
  end
5
9
 
@@ -132,10 +132,6 @@ module RailsConnector
132
132
  @destination_object ||= Obj.find(destination) if resolved_internal?
133
133
  end
134
134
 
135
- def to_liquid
136
- LiquidSupport::LinkDrop.new(self)
137
- end
138
-
139
135
  private
140
136
 
141
137
  def resolved_internal?
@@ -0,0 +1,83 @@
1
+ require 'search_request'
2
+
3
+ module RailsConnector
4
+
5
+ # This module accesses the Infopark Search Engine Server.
6
+ # @api public
7
+ module SES
8
+
9
+ autoload :VerityAccessor, "rails_connector/ses/verity_accessor"
10
+
11
+ # This method enables Obj to perform searches using the SES Search Engine Server.
12
+ def self.enable
13
+ ::Obj.extend Obj::ClassMethods
14
+ end
15
+
16
+ module Obj
17
+ # Extends the model class Obj with the class method find_with_ses.
18
+ module ClassMethods
19
+ # Queries the search engine and returns a SearchResult. The parameters
20
+ # are passed on to a SearchRequest (a kind of DefaultSearchRequest by default).
21
+ #
22
+ # Exceptions:
23
+ # * SearchError - The search engine reported an error.
24
+ #
25
+ def find_with_ses(query_string, options = {})
26
+ SearchRequest.new(query_string, options).fetch_hits
27
+ end
28
+ end
29
+ end
30
+
31
+ class SearchError < StandardError
32
+ end
33
+
34
+ # SearchResult is the list of hits in response to a search query. Since the
35
+ # maximum number of hits to return has been specified, there might be more
36
+ # hits available in the search engine.
37
+ # @api public
38
+ class SearchResult < Array
39
+ # The total number of hits.
40
+ # @api public
41
+ attr_reader :total_hits
42
+
43
+ def initialize(total_hits)
44
+ super()
45
+ @total_hits = total_hits
46
+ end
47
+ end
48
+
49
+ # A hit represents a found document for a particular search query.
50
+ # @api public
51
+ class Hit
52
+ # The ID of the found Obj.
53
+ # @api public
54
+ attr_reader :id
55
+
56
+ # The score of the hit.
57
+ # @api public
58
+ attr_reader :score
59
+
60
+ # The raw result hash returned by the search engine, for a low-level access.
61
+ # Don't use this unless you know what you're doing.
62
+ # Be aware that this is not migration safe.
63
+ # @api public
64
+ attr_reader :doc
65
+
66
+ def initialize(id, score, doc={}, obj=nil)
67
+ @id = id
68
+ @score = score
69
+ @doc = doc
70
+ @obj = obj
71
+ end
72
+
73
+ # Returns the hit's corresponding Obj (or nil if none found in the database).
74
+ # @api public
75
+ def obj
76
+ @obj ||= ::Obj.find(@id)
77
+ rescue RailsConnector::ResourceNotFound
78
+ nil
79
+ end
80
+ end
81
+ end
82
+
83
+ end
@@ -0,0 +1,2 @@
1
+ class SearchRequest < RailsConnector::DefaultSearchRequest
2
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_fiona_connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.9.1.3.22208381
4
+ version: 6.9.2.1.125136549
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-26 00:00:00.000000000 Z
12
+ date: 2013-07-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mime-types
@@ -73,7 +73,6 @@ files:
73
73
  - app/helpers/rails_connector/cms_tag_helper.rb
74
74
  - app/helpers/rails_connector/editing_helper.rb
75
75
  - app/helpers/rails_connector/marker_helper.rb
76
- - lib/comment.rb
77
76
  - lib/infopark_fiona_connector.rb
78
77
  - lib/rails_connector/attr_dict.rb
79
78
  - lib/rails_connector/attr_value_provider.bundle
@@ -90,15 +89,15 @@ files:
90
89
  - lib/rails_connector/errors.rb
91
90
  - lib/rails_connector/fiona_engine.rb
92
91
  - lib/rails_connector/link.rb
93
- - lib/rails_connector/liquid_support/action_marker.rb
94
92
  - lib/rails_connector/lucene_search_request.rb
95
93
  - lib/rails_connector/named_link.rb
96
94
  - lib/rails_connector/news.rb
97
95
  - lib/rails_connector/permission.rb
98
96
  - lib/rails_connector/rack_middlewares.rb
97
+ - lib/rails_connector/ses.rb
99
98
  - lib/rails_connector/ses/verity_accessor.rb
100
99
  - lib/rails_connector/verity_search_request.rb
101
- - lib/rating.rb
100
+ - lib/search_request.rb
102
101
  homepage: http://www.infopark.de
103
102
  licenses: []
104
103
  post_install_message:
@@ -113,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
112
  version: '0'
114
113
  segments:
115
114
  - 0
116
- hash: 813754529
115
+ hash: -343485329
117
116
  required_rubygems_version: !ruby/object:Gem::Requirement
118
117
  none: false
119
118
  requirements:
data/lib/comment.rb DELETED
@@ -1,4 +0,0 @@
1
- # The Comment model inherits all of its behavior from
2
- # {RailsConnector::DefaultComment}.
3
- class Comment < RailsConnector::DefaultComment
4
- end
@@ -1,75 +0,0 @@
1
- module RailsConnector
2
-
3
- # @api public
4
- module LiquidSupport
5
-
6
- # Usage example for actionmarkers in Liquid templates:
7
- # {% actionmarker obj.images[0] editImageWizard param_a:value_a param_b:value_b %}
8
- # [Edit image]
9
- # {% endactionmarker %}
10
- #
11
- # The first parameter may be an instance of {ObjDrop} (usually +obj+ in Liquid templates),
12
- # +Array+ (such as a +LinkList+ field), or {LinkDrop} (as in the example above).
13
- #
14
- # The second parameter is the action to be run on the target objects.
15
- # Additional parameters to be forwarded to the action can be added as <tt>key:value</tt> pairs.
16
- # All parameters are evaluated in the current Liquid context and thus may contain,
17
- # for example, method calls on objects.
18
- #
19
- # Internally, the parameter <tt>:context</tt> is always set to the currently viewed object (+obj+)
20
- # and can not be overwritten.
21
- #
22
- # The Liquid actionmarker uses {RailsConnector::MarkerHelper#action_marker}.
23
- # @api public
24
- class ActionMarker < Liquid::Block
25
- def initialize(tag_name, markup, tokens)
26
- @obj_name, @method_name = markup.to_s.split(/\s+/)
27
- unless @obj_name && @method_name
28
- raise Liquid::SyntaxError.new("Syntax Error in 'actionmarker' - Valid syntax: actionmarker obj [action] [foo:bar]")
29
- end
30
- @params = {}
31
- markup.scan(/#{Liquid::TagAttributes}(#{Liquid::SpacelessFilter})?/) do |key, value, spaceless_filter|
32
- @params[key] = spaceless_filter.blank? ? value : "#{value}|#{spaceless_filter}"
33
- end
34
- super
35
- end
36
-
37
- def render(context)
38
- context.registers[:action_view].action_marker(
39
- (context[@method_name] || @method_name).to_s,
40
- target_objs(context),
41
- :params => params(context),
42
- :context => context['obj'].__drop_content
43
- ) do
44
- context.stack { render_all(@nodelist, context) }
45
- end
46
- end
47
-
48
- protected
49
-
50
- def target_objs(context)
51
- [ context[@obj_name] ].flatten.map do |item|
52
- case item
53
- when RailsConnector::Link
54
- item.destination_object
55
- when LinkDrop
56
- item.destination.__drop_content
57
- else
58
- item.__drop_content
59
- end
60
- end
61
- end
62
-
63
- def params(context)
64
- result = {}
65
- @params.each do |key, value|
66
- result[(context[key] || key).to_s] = (context[value] || value).to_s
67
- end
68
- result
69
- end
70
- end
71
-
72
- Liquid::Template.register_tag('actionmarker', ActionMarker)
73
- end
74
-
75
- end
data/lib/rating.rb DELETED
@@ -1,4 +0,0 @@
1
- # The Rating model inherits all of its behavior from
2
- # {RailsConnector::DefaultRating}.
3
- class Rating < RailsConnector::DefaultRating
4
- end