infopark_fiona_connector 6.9.1.3.22208381 → 6.9.2.1.125136549
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/infopark_fiona_connector.rb +0 -3
- data/lib/rails_connector/basic_obj.rb +6 -21
- data/lib/rails_connector/date_attribute.rb +1 -1
- data/lib/rails_connector/fiona_engine.rb +4 -0
- data/lib/rails_connector/link.rb +0 -4
- data/lib/rails_connector/ses.rb +83 -0
- data/lib/search_request.rb +2 -0
- metadata +5 -6
- data/lib/comment.rb +0 -4
- data/lib/rails_connector/liquid_support/action_marker.rb +0 -75
- data/lib/rating.rb +0 -4
@@ -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
|
199
|
+
# Returns true if this object is active.
|
201
200
|
# @api public
|
202
|
-
def active?
|
201
|
+
def active?
|
203
202
|
return false if !valid_from
|
204
|
-
|
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?
|
234
|
-
!suppressed? && active?
|
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
|
-
|
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)
|
data/lib/rails_connector/link.rb
CHANGED
@@ -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
|
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.
|
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-
|
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/
|
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:
|
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,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