infopark_cloud_connector 6.9.2.1.125136549 → 6.9.3.1.36404185

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.
@@ -434,6 +434,7 @@ html.ip_bottombar_on {
434
434
  display: block;
435
435
  float: left;
436
436
  position: relative;
437
+ cursor: pointer;
437
438
  }
438
439
  .ip_topbar .ip_button_bar.ip_app {
439
440
  width: 100px;
@@ -585,6 +586,44 @@ html.ip_bottombar_on {
585
586
  .ip_topbar .ip_first_level .ip_button_bar.ip_no_hover:hover .ip_product_name:after {
586
587
  display: none;
587
588
  }
589
+ .ip_topbar .ip_first_level .ip_saving_state_bar {
590
+ height: 35px;
591
+ padding: 5px 10px 5px 35px;
592
+ color: #fff;
593
+ text-shadow: 0 1px 1px #333;
594
+ font-size: 11px;
595
+ font-weight: bold;
596
+ min-width: 95px;
597
+ display: block;
598
+ float: right;
599
+ position: relative;
600
+ -webkit-box-shadow: 0 -3px 3px #3e5b87 inset;
601
+ -moz-box-shadow: 0 -3px 3px #3e5b87 inset;
602
+ box-shadow: 0 -3px 3px #3e5b87 inset;
603
+ background-color: #586e94;
604
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#8094bb), color-stop(55%, #60769b), to(#365077));
605
+ background-image: -webkit-linear-gradient(#8094bb, #60769b 55%, #365077);
606
+ background-image: -moz-linear-gradient(top, #8094bb, #60769b 55%, #365077);
607
+ background-image: -o-linear-gradient(#8094bb, #60769b 55%, #365077);
608
+ background-image: linear-gradient(#8094bb, #60769b 55%, #365077);
609
+ background-repeat: no-repeat;
610
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff8094bb', endColorstr='#ff365077', GradientType=0);
611
+ }
612
+ .ip_topbar .ip_first_level .ip_saving_state_bar .ip_icon {
613
+ color: #fff;
614
+ text-shadow: 0 1px 1px #333;
615
+ font-size: 11px;
616
+ position: absolute;
617
+ top: 13px;
618
+ left: 10px;
619
+ }
620
+ .ip_topbar .ip_first_level .ip_saving_state_bar .ip_button_label span {
621
+ height: 35px;
622
+ display: table-cell;
623
+ font-size: 10px;
624
+ vertical-align: middle;
625
+ line-height: 14px;
626
+ }
588
627
  .ip_topbar_dark .ip_topbar .ip_first_level,
589
628
  .ip_topbar.ip_dark .ip_first_level {
590
629
  height: 45px;
@@ -1498,7 +1537,7 @@ a.ip_button:active {
1498
1537
  .ip_modal_small {
1499
1538
  position: fixed;
1500
1539
  left: 50%;
1501
- top: -400%;
1540
+ top: -100%;
1502
1541
  z-index: 1000;
1503
1542
  overflow: auto;
1504
1543
  border: 1px solid #fff;
@@ -1590,7 +1629,7 @@ a.ip_button:active {
1590
1629
  .ip_modal_big {
1591
1630
  position: fixed;
1592
1631
  left: 50%;
1593
- top: -400%;
1632
+ top: -100%;
1594
1633
  z-index: 1000;
1595
1634
  overflow: auto;
1596
1635
  border: 1px solid #fff;
@@ -1610,6 +1649,7 @@ a.ip_button:active {
1610
1649
  transition: top 0.25s ease-in;
1611
1650
  }
1612
1651
  .ip_modal_big.ip_show {
1652
+ visibility: visible;
1613
1653
  top: 50%;
1614
1654
  z-index: 333333;
1615
1655
  }
@@ -1700,6 +1740,26 @@ a.ip_button:active {
1700
1740
  .ip_modal_big .ip_modal_footer:after {
1701
1741
  clear: both;
1702
1742
  }
1743
+ .ip_modal_header .ip_saving_state_bar {
1744
+ position: absolute;
1745
+ top: 10px;
1746
+ right: 10px;
1747
+ padding: 3px 7px;
1748
+ }
1749
+ .ip_modal_header .ip_saving_state_bar .ip_icon {
1750
+ color: #666;
1751
+ text-shadow: 0 1px 1px #fff;
1752
+ font-size: 9px;
1753
+ margin: 0 7px 0 0;
1754
+ }
1755
+ .ip_modal_header .ip_saving_state_bar span {
1756
+ display: inline-block;
1757
+ color: #666;
1758
+ font-size: 11px;
1759
+ font-weight: bold;
1760
+ vertical-align: middle;
1761
+ line-height: 14px;
1762
+ }
1703
1763
  .ip_modal_big .ip_modal_header_tab_container {
1704
1764
  margin: 0 -10px -8px -10px;
1705
1765
  *zoom: 1;
@@ -1937,8 +1997,17 @@ a.ip_button:active {
1937
1997
  .ip_bottombar .ip_button_label {
1938
1998
  display: none;
1939
1999
  }
2000
+ .ip_topbar .ip_first_level .ip_saving_state_bar {
2001
+ min-width: 0;
2002
+ }
2003
+ .ip_topbar .ip_first_level .ip_saving_state_bar .ip_button_label {
2004
+ display: block;
2005
+ }
1940
2006
  }
1941
2007
  @media (max-width: 480px) {
2008
+ .ip_topbar .ip_first_level .ip_saving_state_bar .ip_button_label {
2009
+ display: none;
2010
+ }
1942
2011
  .ip_modal_small {
1943
2012
  width: 90%;
1944
2013
  margin: -30% 0 0 -45%;
@@ -144,12 +144,28 @@ module RailsConnector
144
144
  end
145
145
  end
146
146
 
147
- def to_param
148
- id
147
+ # Hook method to control which page classes should be avaiable for a page with given path.
148
+ # Override it to allow only certain classes or none.
149
+ # Must return either {NilClass}, or {Array}.
150
+ #
151
+ # Be aware that the given argument is a parent path.
152
+ # E.g. when creating a page with path +/products/shoes+ then the argument will be +/products+.
153
+ #
154
+ # If {NilClass} is returned, then all possible classes will be available.
155
+ # By default {NilClass} is returned.
156
+ #
157
+ # If {Array} is returned, then it should include desired class names.
158
+ # Each class name must be either a {String} or a {Symbol}.
159
+ # Only this class names will be available. Order of the class names will be preserved.
160
+ #
161
+ # @param [String] parent_path Path of the parent obj
162
+ # @return [NilClass, Array<Symbol, String>]
163
+ # @api public
164
+ def self.valid_page_classes_beneath(parent_path)
149
165
  end
150
166
 
151
- def self.configure_for_content(mode)
152
- # this method exists only for compatibility with the fiona connector.
167
+ def to_param
168
+ id
153
169
  end
154
170
 
155
171
  # A CMS administrator can specify the <tt>obj_class</tt> for a given CMS object.
@@ -686,6 +702,28 @@ module RailsConnector
686
702
  @widget_container ||= self.class.find(parent_path.split('/').last)
687
703
  end
688
704
 
705
+ # Hook method to control which widget classes should be avaiable for this page.
706
+ # Override it to allow only certain classes or none.
707
+ # Must return either {NilClass}, or {Array}.
708
+ #
709
+ # If {NilClass} is returned, then all widget classes will be available for this page.
710
+ # By default {NilClass} is returned.
711
+ #
712
+ # If {Array} is returned, then it should include desired class names.
713
+ # Each class name must be either a {String} or a {Symbol}.
714
+ # Only this class names will be available for this page.
715
+ # Order of the class names will be preserved.
716
+ #
717
+ # @param [String] field_name Name of the widget field.
718
+ # @return [NilClass, Array<Symbol, String>]
719
+ # @api public
720
+ def valid_widget_classes_for(field_name)
721
+ end
722
+
723
+ def edit_view_path
724
+ "#{obj_class.underscore}/edit"
725
+ end
726
+
689
727
  private
690
728
 
691
729
  attr_accessor :data_from_cms
@@ -708,14 +746,16 @@ module RailsConnector
708
746
 
709
747
  def prepare_attribute_value(attribute_value, attribute_type)
710
748
  case attribute_type
711
- when "markdown"
712
- StringTagging.tag_as_markdown(attribute_value, self)
713
749
  when "html"
714
750
  StringTagging.tag_as_html(attribute_value, self)
715
751
  when "date"
716
752
  DateAttribute.parse(attribute_value) if attribute_value
717
753
  when "linklist"
718
754
  LinkList.new(attribute_value)
755
+ when "reference"
756
+ self.class.find([attribute_value]).first
757
+ when "referencelist"
758
+ self.class.find(attribute_value).compact
719
759
  else
720
760
  attribute_value
721
761
  end
@@ -3,8 +3,7 @@ require 'active_support/all'
3
3
 
4
4
  module RailsConnector
5
5
 
6
- # Provides a simple wrapper for the CMS Rest API
7
- # using the credentials from {RailsConnector::Configuration.cms_api_options}.
6
+ # Provides a simple wrapper for the CMS Rest API.
8
7
  #
9
8
  # @example Request the published workspace:
10
9
  # RailsConnector::CmsRestApi.get('workspaces/published')
@@ -29,8 +28,27 @@ module RailsConnector
29
28
  # RailsConnector::CmsRestApi.task_unaware_request(:put, 'workspace/rtc/publish', nil)
30
29
  #
31
30
  class CmsRestApi
31
+ class Configuration
32
+ attr_accessor :url
33
+ attr_accessor :login
34
+ attr_accessor :api_key
35
+ attr_accessor :http_host
36
+ attr_accessor :tenant_name
37
+
38
+ def url
39
+ if @url.nil?
40
+ raise RailsConnectorError,
41
+ 'CmsRestApi configuration key "url" is missing. '\
42
+ 'Set "RailsConnector::Configuration.cms_url = <url>"'
43
+ end
32
44
 
33
- cattr_accessor :credentials
45
+ @url
46
+ end
47
+ end
48
+
49
+ cattr_accessor :configuration do
50
+ Configuration.new
51
+ end
34
52
 
35
53
  def self.get(resource_path, payload = nil, options = nil)
36
54
  request_cms_api(:get, resource_path, payload, options)
@@ -53,12 +71,6 @@ module RailsConnector
53
71
  response_for_request_cms_api(method, resource_path, payload)
54
72
  end
55
73
 
56
- # @param [Hash] value
57
- # @return [void]
58
- def self.credentials=(value)
59
- @@credentials = value.symbolize_keys
60
- end
61
-
62
74
  class << self
63
75
 
64
76
  private
@@ -114,18 +126,18 @@ module RailsConnector
114
126
  :content_type => :json,
115
127
  :accept => :json,
116
128
  }
117
- headers[:host] = credentials[:http_host] if credentials[:http_host].present?
129
+ headers[:host] = configuration.http_host if configuration.http_host.present?
118
130
 
119
131
  {
120
- :user => credentials[:login],
121
- :password => credentials[:api_key],
132
+ :user => configuration.login,
133
+ :password => configuration.api_key,
122
134
  :headers => headers,
123
135
  }
124
136
  end
125
137
 
126
138
  def url(resource_path)
127
- "#{credentials[:url]}/#{resource_path}"
139
+ "#{configuration.url}/#{resource_path}"
128
140
  end
129
141
  end
130
142
  end
131
- end
143
+ end
@@ -0,0 +1,199 @@
1
+ require "rails_connector/blob"
2
+
3
+ module RailsConnector
4
+
5
+ # @api public
6
+ class Configuration
7
+ #
8
+ # Default path of a CA certification file in PEM format.
9
+ #
10
+ # @api public
11
+ DEFAULT_CA_FILE = File.expand_path('../../../config/ca-bundle.crt', __FILE__)
12
+
13
+ class << self
14
+
15
+ # Determine if current visitor is permitted to edit content.
16
+ attr_accessor :editing_auth_callback
17
+
18
+ # Configure a callback to be invoked when the rails connector determines,
19
+ # if current visitor is permitted to edit content.
20
+ # Default is <code>false</code>.
21
+ #
22
+ # Example Usage:
23
+ # RailsConnector::Configuation.editing_auth do |env|
24
+ # request = Rack::Request.new(env)
25
+ # # return truey if current visitor is permitted to edit content, falsy otherwise
26
+ # end
27
+ # @api public
28
+ def editing_auth(&block)
29
+ if block.respond_to?(:arity) && block.arity == 1
30
+ self.editing_auth_callback = block
31
+ else
32
+ raise ArgumentError, 'editing_auth should have only one attribute!'
33
+ end
34
+ end
35
+
36
+ # TODO: Legacy compatiblity. Remove when DisplayHelper gets removed.
37
+ def editor_interface_enabled?
38
+ false
39
+ end
40
+
41
+ # The +RailsConnector+ makes heavy use of filesystem caching.
42
+ # Use this method to configure the directory that should be used to store cached data.
43
+ # By default, +RAILS_ROOT/tmp/cache+ will be used.
44
+ # @param path [String] Path to directory that should be used to store cached data.
45
+ # @example Configure +RailsConnector+ to store it's cache under +/tmp/my_cache+.
46
+ # RailsConnector::Configuration.cache_path = '/tmp/my_cache'
47
+ # @api public
48
+ def cache_path=(path)
49
+ CmsCacheStorage.backend_cache = ActiveSupport::Cache::FileStore.new(path)
50
+ end
51
+
52
+ # Gets path of a CA certification file in PEM format.
53
+ # @api public
54
+ attr_reader :ca_file
55
+
56
+ # Sets path of a CA certification file in PEM format.
57
+ # The file can contain several CA certificates.
58
+ # Certifications will be used for endpoint peer verification of various Infopark services
59
+ # e.g. Content Read Service.
60
+ # @api public
61
+ def ca_file=(path)
62
+ File.read(path) if path # Try to read the given file and fail if it doesn't exist or is not readable.
63
+ @ca_file = path
64
+ end
65
+
66
+ # Configuration for Content Read Service API.
67
+ # @api public
68
+ def content_service_url
69
+ content_service.url
70
+ end
71
+
72
+ # Set url configuration for Content Read Service API.
73
+ # @api public
74
+ def content_service_url=(value)
75
+ content_service.url = value
76
+ end
77
+
78
+ # Configuration for Content Read Service API.
79
+ # @api public
80
+ def content_service_login
81
+ content_service.login
82
+ end
83
+
84
+ # Set login configuration for Content Read Service API.
85
+ # @api public
86
+ def content_service_login=(value)
87
+ content_service.login = value
88
+ end
89
+
90
+ # Configuration for Content Read Service API.
91
+ # @api public
92
+ def content_service_api_key
93
+ content_service.api_key
94
+ end
95
+
96
+ # Set API key configuration for Content Read Service API.
97
+ # @api public
98
+ def content_service_api_key=(value)
99
+ content_service.api_key = value
100
+ end
101
+
102
+ # Url configuration for CMS Rest API.
103
+ # @api public
104
+ def cms_url
105
+ cms_api.url
106
+ end
107
+
108
+ # Set url configuration for CMS Rest API.
109
+ # @api public
110
+ def cms_url=(value)
111
+ cms_api.url = value
112
+ end
113
+
114
+ # Login configuration for CMS Rest API.
115
+ # @api public
116
+ def cms_login
117
+ cms_api.login
118
+ end
119
+
120
+ # Set login configuration for CMS Rest API.
121
+ # @api public
122
+ def cms_login=(value)
123
+ cms_api.login = value
124
+ end
125
+
126
+ # API key configuration for CMS Rest API.
127
+ # @api public
128
+ def cms_api_key
129
+ cms_api.api_key
130
+ end
131
+
132
+ # Set API key configuration for CMS Rest API.
133
+ # @api public
134
+ def cms_api_key=(value)
135
+ cms_api.api_key = value
136
+ end
137
+
138
+ def after_initialize
139
+ enable_authentication
140
+ end
141
+
142
+ def to_prepare
143
+ unless Rails.configuration.cache_classes
144
+ after_initialize
145
+ NamedLink.reset_cache
146
+ BasicObj.reset_type_cache
147
+ ::ApplicationController.__send__(:helper, :cms)
148
+ end
149
+ end
150
+
151
+ def configure_cms_database
152
+ end
153
+
154
+ attr_accessor :choose_homepage_callback
155
+
156
+ # Configure a callback to be invoked when the rails connector delivers the homepage.
157
+ # The given callback will receive the rack env
158
+ # and must return an Obj to be used as the homepage.
159
+ # If no callback is configured, Obj.homepage will be used as the default.
160
+ # @api public
161
+ def choose_homepage(&block)
162
+ self.choose_homepage_callback = block
163
+ end
164
+
165
+ def cms_routes(*args)
166
+ raise <<-EOS.gsub(/\s+/, ' ')
167
+ Calling RailsConnector::Configuration.cms_routes is not needed anymore.
168
+ Please remove it from config/routes.rb
169
+ EOS
170
+ end
171
+
172
+ def use_x_sendfile=(value)
173
+ raise 'Configuration.use_x_sendfile is now available as Rails configuration:'\
174
+ ' config.action_dispatch.x_sendfile_header = "X-Sendfile"'
175
+ end
176
+
177
+ private
178
+
179
+ def content_service
180
+ RailsConnector::ContentService.configuration
181
+ end
182
+
183
+ def cms_api
184
+ RailsConnector::CmsRestApi.configuration
185
+ end
186
+
187
+ def enable_authentication
188
+ ::ApplicationController.__send__(:include, RailsConnector::Authenticable)
189
+ end
190
+ end
191
+
192
+ # defaults
193
+ self.ca_file = DEFAULT_CA_FILE
194
+ self.editing_auth{ |env| false }
195
+ end
196
+
197
+ class ConfigurationError < StandardError
198
+ end
199
+ end
@@ -1,3 +1,5 @@
1
+ require 'timeout'
2
+
1
3
  module RailsConnector
2
4
  class ContentService
3
5
  DEFAULT_PROTOCOL = 'https'.freeze
@@ -16,6 +18,27 @@ class ContentService
16
18
  Timeout::Error,
17
19
  ].freeze
18
20
 
21
+ class Configuration
22
+ attr_accessor :url
23
+ attr_accessor :login
24
+ attr_accessor :api_key
25
+ attr_accessor :http_host
26
+
27
+ def url
28
+ if @url.nil?
29
+ raise RailsConnectorError,
30
+ 'ContentService configuration key "url" is missing. '\
31
+ 'Set "RailsConnector::Configuration.content_service_url = <url>"'
32
+ end
33
+
34
+ @url
35
+ end
36
+ end
37
+
38
+ cattr_accessor :configuration do
39
+ Configuration.new
40
+ end
41
+
19
42
  class RateLimitExceeded < StandardError
20
43
  def initialize(retry_after)
21
44
  @retry_after = retry_after
@@ -94,7 +117,7 @@ class ContentService
94
117
 
95
118
  def build_request(path, payload)
96
119
  request = Net::HTTP::Post.new("#{uri.path}/#{path}".squeeze('/'), request_headers)
97
- request.basic_auth(config['login'], config['api_key'])
120
+ request.basic_auth(configuration.login, configuration.api_key)
98
121
  request.body = MultiJson.dump(payload)
99
122
  request
100
123
  end
@@ -112,7 +135,7 @@ class ContentService
112
135
  end
113
136
 
114
137
  def uri
115
- url = config['url']
138
+ url = configuration.url
116
139
  url = "#{DEFAULT_PROTOCOL}://#{url}" unless url.match /^http/
117
140
  URI.parse(url)
118
141
  end
@@ -123,16 +146,12 @@ class ContentService
123
146
  'Accept' => 'application/json',
124
147
  'User-Agent' => user_agent,
125
148
  }
126
- if http_host = config['http_host']
127
- headers['Host'] = http_host
149
+ if configuration.http_host
150
+ headers['Host'] = configuration.http_host
128
151
  end
129
152
  headers
130
153
  end
131
154
 
132
- def config
133
- RailsConnector::Configuration.content_service
134
- end
135
-
136
155
  def user_agent
137
156
  @user_agent ||= (
138
157
  gem_info = Gem.loaded_specs["infopark_cloud_connector"]
@@ -62,14 +62,6 @@ module RailsConnector
62
62
  @link_data[:tag_name]
63
63
  end
64
64
 
65
- def markdown_type
66
- @link_data[:markdown_type]
67
- end
68
-
69
- def markdown?
70
- 'markdown' == @link_data[:source_format]
71
- end
72
-
73
65
  # Returns the file extension (e.g. zip, pdf) of this link's (internal or external) target.
74
66
  # Returns an empty string if the file extension is can not be determined.
75
67
  # @api public
@@ -1,12 +1,13 @@
1
1
  module RailsConnector
2
2
 
3
3
  class ObjDataFromHash < ObjData
4
- def initialize(hash)
4
+ def initialize(hash, type_hash = {})
5
5
  @hash = hash.stringify_keys
6
+ @type_hash = type_hash.stringify_keys
6
7
  end
7
8
 
8
9
  def value_and_type_of(attribute_name)
9
- [@hash[attribute_name], nil]
10
+ [@hash[attribute_name], @type_hash[attribute_name]]
10
11
  end
11
12
 
12
13
  def has_custom_attribute?(name)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_cloud_connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.9.2.1.125136549
4
+ version: 6.9.3.1.36404185
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-07-22 00:00:00.000000000 Z
12
+ date: 2013-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -77,12 +77,14 @@ files:
77
77
  - app/controllers/rails_connector/workspaces_controller.rb
78
78
  - app/helpers/rails_connector/cms_asset_helper.rb
79
79
  - app/helpers/rails_connector/cms_tag_helper.rb
80
+ - app/helpers/rails_connector/display_helper.rb
80
81
  - app/helpers/rails_connector/editing_helper.rb
81
82
  - app/helpers/rails_connector/marker_helper.rb
82
83
  - app/helpers/rails_connector/widget_helper.rb
83
84
  - app/views/rails_connector/_editing_javascript.html.erb
84
85
  - app/views/rails_connector/objs/create_widget.html.erb
85
86
  - app/views/rails_connector/objs/show.html.erb
87
+ - config/ca-bundle.crt
86
88
  - config/locales/de.rails_connector.models.yml
87
89
  - config/locales/en.rails_connector.models.yml
88
90
  - config/routes.rb
@@ -111,6 +113,7 @@ files:
111
113
  - lib/rails_connector/cms_backend.rb
112
114
  - lib/rails_connector/cms_cache_storage.rb
113
115
  - lib/rails_connector/cms_rest_api.rb
116
+ - lib/rails_connector/configuration.rb
114
117
  - lib/rails_connector/content_conversion.rb
115
118
  - lib/rails_connector/content_service.rb
116
119
  - lib/rails_connector/content_state.rb
@@ -154,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
154
157
  version: '0'
155
158
  segments:
156
159
  - 0
157
- hash: 117017377
160
+ hash: 973791727
158
161
  required_rubygems_version: !ruby/object:Gem::Requirement
159
162
  none: false
160
163
  requirements: