platform 3.1.2 → 3.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/.rvmrc +2 -0
  2. data/Gemfile.lock +4 -4
  3. data/README.rdoc +0 -3
  4. data/app/assets/javascripts/platform/api_explorer.js +4 -1
  5. data/app/controllers/platform/api/base_controller.rb +39 -20
  6. data/app/models/platform/application.rb +2 -4
  7. data/app/models/platform/developer.rb +4 -2
  8. data/app/models/platform/logged_exception.rb +2 -2
  9. data/app/models/platform/media/media.rb +6 -3
  10. data/app/views/platform/admin/apps/index.html.erb +1 -1
  11. data/app/views/platform/apps/index.html.erb +2 -2
  12. data/app/views/platform/developer/api_explorer/index.html.erb +9 -5
  13. data/app/views/platform/developer/apps/_form.html.erb +4 -2
  14. data/app/views/platform/developer/apps/index.html.erb +6 -4
  15. data/app/views/platform/developer/common/_header.html.erb +0 -1
  16. data/app/views/platform/developer/dashboard/_statistics.html.erb +1 -1
  17. data/app/views/platform/developer/dashboard/index.html.erb +1 -1
  18. data/app/views/platform/developer/help/oauth_mobile.html.erb +5 -3
  19. data/app/views/platform/developer/registration/index.html.erb +8 -123
  20. data/lib/generators/platform/api_generator.rb +74 -0
  21. data/lib/generators/platform/platform_generator.rb +1 -1
  22. data/lib/generators/platform/proxy_generator.rb +1 -2
  23. data/lib/generators/platform/templates/config/platform/config.yml +9 -8
  24. data/lib/generators/platform/templates/config/platform/data/default_applications.yml +1 -23
  25. data/lib/generators/platform/templates/config/platform/data/default_categories.yml +1 -6
  26. data/lib/generators/platform/templates/config/platform/data/default_permissions.yml +16 -0
  27. data/lib/generators/platform/templates/config/platform/site/features.yml +1 -6
  28. data/lib/generators/platform/templates/db/create_platform_tables.rb +36 -47
  29. data/lib/platform/api/proxy/base.rb +4 -0
  30. data/lib/platform/config.rb +12 -16
  31. data/lib/platform/extensions/action_view_extension.rb +13 -1
  32. data/lib/platform/extensions/hash_extension.rb +69 -0
  33. data/lib/platform/railtie.rb +1 -0
  34. data/lib/platform/version.rb +1 -1
  35. data/lib/tasks/platform.rake +1 -0
  36. data/platform.gemspec +0 -1
  37. data/test/dummy/app/assets/images/logo.png +0 -0
  38. data/test/dummy/app/controllers/api/bookmarks_controller.rb +1 -1
  39. data/test/dummy/app/models/bookmark.rb +0 -2
  40. data/test/dummy/app/models/user.rb +1 -2
  41. data/test/dummy/app/views/home/index.html.erb +2 -2
  42. data/test/dummy/app/views/layouts/_footer.html.erb +1 -1
  43. data/test/dummy/app/views/layouts/_header.html.erb +1 -1
  44. data/test/dummy/config/application.rb +0 -1
  45. data/test/dummy/config/environments/development.rb +3 -1
  46. data/test/dummy/config/initializers/platform.rb +3 -0
  47. data/test/dummy/config/platform/api/1/bookmark.yml +2 -2
  48. data/test/dummy/config/platform/config.yml +10 -9
  49. data/test/dummy/config/platform/data/default_applications.yml +4 -23
  50. data/test/dummy/config/platform/data/default_categories.yml +1 -6
  51. data/test/dummy/config/platform/site/features.yml +1 -6
  52. data/test/dummy/config/routes.rb +1 -1
  53. data/test/dummy/config/tr8n/config.yml +2 -2
  54. data/test/dummy/db/migrate/20111004075531_create_platform_tables.rb +1 -1
  55. data/test/dummy/public/developer_agreement.html +123 -0
  56. metadata +52 -46
  57. data/db/migrate/20110602232141_create_platform_tables.rb +0 -262
data/.rvmrc ADDED
@@ -0,0 +1,2 @@
1
+ rvm 1.9.2@platform --create
2
+ #rvm gemset import | grep -v -E 'already installed|default\.gems|^$'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- platform (3.1.2)
4
+ platform (3.1.3)
5
5
  acts_as_state_machine
6
6
  acts_as_tree
7
7
  coffee-script
@@ -135,7 +135,7 @@ GEM
135
135
  ruby_parser (2.0.6)
136
136
  sexp_processor (~> 3.0)
137
137
  rubyzip (0.9.4)
138
- sass (3.1.8)
138
+ sass (3.1.10)
139
139
  selenium-webdriver (2.7.0)
140
140
  childprocess (>= 0.2.1)
141
141
  ffi (>= 1.0.7)
@@ -146,14 +146,14 @@ GEM
146
146
  sprockets (2.0.2)
147
147
  hike (~> 1.2)
148
148
  rack (~> 1.0)
149
- tilt (!= 1.3.0, ~> 1.1)
149
+ tilt (~> 1.1, != 1.3.0)
150
150
  sqlite3 (1.3.4)
151
151
  steak (2.0.0)
152
152
  capybara (>= 1.0.0)
153
153
  rspec-rails (>= 2.5.0)
154
154
  thor (0.14.6)
155
155
  tilt (1.3.3)
156
- tr8n (3.1.2)
156
+ tr8n (3.1.4)
157
157
  coffee-script
158
158
  kaminari
159
159
  rails (>= 3.1.0)
@@ -31,7 +31,6 @@ Add the following gems to your Gemfile:
31
31
  gem 'coffee-script'
32
32
  gem 'acts_as_tree'
33
33
  gem 'acts_as_state_machine'
34
- gem 'rmagick'
35
34
 
36
35
  And run:
37
36
 
@@ -49,7 +48,6 @@ To configure and initialize Platform engine, run the following commands:
49
48
  $ rails generate tr8n
50
49
  $ rails generate platform
51
50
  $ rake db:migrate
52
- $ rake tr8n:init
53
51
  $ rake platform:init
54
52
  $ rails s
55
53
 
@@ -65,7 +63,6 @@ The best way to get going with Platform is to run the gem as a stand-alone appli
65
63
  $ git clone git://github.com/berk/platform.git
66
64
  $ cd platform/test/dummy
67
65
  $ rake db:migrate
68
- $ rake tr8n:init
69
66
  $ rake platform:init
70
67
  $ rails s
71
68
 
@@ -33,7 +33,9 @@ function getAccessToken() {
33
33
  if (land_url.indexOf("http") == -1) {
34
34
  land_url = "http://" + land_url;
35
35
  }
36
- var oauth_url = '/platform/oauth/authorize?client_id=' + api_explorer_app_id + '&response_type=token&display=mobile&redirect_url=' + escape(land_url)
36
+ var app_id = Platform.element("app_id").value;
37
+
38
+ var oauth_url = '/platform/oauth/authorize?client_id=' + app_id + '&response_type=token&display=mobile&redirect_url=' + escape(land_url)
37
39
  var win = window.open(oauth_url, 'oauthx_auth', 'width=' + width +',height=' + height + ',top=' + top + ',left=' + left);
38
40
  }
39
41
 
@@ -304,6 +306,7 @@ function addPostField(name, value) {
304
306
  var field = document.createElement("div");
305
307
  field.id="field" + field_count;
306
308
  field.className="field";
309
+ field.style.padding="0px";
307
310
 
308
311
  var field_name_container = document.createElement("span");
309
312
  field_name_container.className="field_name_container";
@@ -88,10 +88,6 @@ module Platform
88
88
  Platform::Config.api_allow_public?
89
89
  end
90
90
 
91
- def ensure_api_enabled
92
- raise ServiceUnavailableError.new('API Disabled') unless enabled?
93
- end
94
-
95
91
  def client_app
96
92
  @client_app ||= access_token.try(:application)
97
93
  end
@@ -182,18 +178,7 @@ module Platform
182
178
  ############################################################################
183
179
  def render_response(obj, opts={})
184
180
  to_opts = params.merge(:max_models => limit, :viewer => current_user, :api_version => api_version)
185
-
186
- if obj.is_a?(Array)
187
- if obj.size == 1 and not only_list?
188
- obj = obj.first
189
- else
190
- hash = {'results' => obj.collect{|o| o.to_api_hash(to_opts)}}
191
- hash['page'] = page if page > 1 || limit == obj.size
192
- hash['previous_page'] = prev_page if page > 1
193
- hash['next_page'] = next_page if limit == obj.size
194
- obj = hash
195
- end
196
- end
181
+ obj = sanitize_results(obj, to_opts) if obj.is_a?(Array)
197
182
 
198
183
  respond_to do |format|
199
184
  format.json do
@@ -222,6 +207,19 @@ module Platform
222
207
  true
223
208
  end
224
209
 
210
+ def sanitize_results(results, opts = {})
211
+ if results.size == 1 and not only_list?
212
+ results = results.first
213
+ else
214
+ hash = {'results' => results.collect{|o| o.to_api_hash(opts)}}
215
+ hash['page'] = page if page > 1 || limit == results.size
216
+ hash['previous_page'] = prev_page if page > 1
217
+ hash['next_page'] = next_page if limit == results.size
218
+ results = hash
219
+ end
220
+ results
221
+ end
222
+
225
223
  def add_response_headers
226
224
  return unless enabled?
227
225
  return unless rate_limited?
@@ -261,21 +259,34 @@ module Platform
261
259
  raise Exception.new("must be implemented in the extanding class")
262
260
  end
263
261
 
262
+ def page_results
263
+ model_class.where(page_model_conditions)
264
+ end
265
+
266
+ def order
267
+ 'id ASC'
268
+ end
269
+
264
270
  def page_models
265
- @page_models ||= model_class.where(page_model_conditions).limit(limit).offset(offset).order('id ASC').all
271
+ @page_models ||= page_results.limit(limit).offset(offset).order(order).all
266
272
  end
267
273
 
268
274
  def page_model
269
- @page_model ||= model_class.where(page_model_conditions).first || raise(ActiveRecord::RecordNotFound)
275
+ @page_model ||= page_results.first || raise(ActiveRecord::RecordNotFound)
270
276
  end
271
277
 
272
278
  def page_model_conditions(id_fields=nil)
273
- id_fields ||= self.class.id_fields
274
- page_ids = ids(id_fields)
275
279
  return nil if page_ids.empty?
276
280
  {:id => page_ids}
277
281
  end
278
282
 
283
+ def page_ids
284
+ @page_ids ||= begin
285
+ id_fields ||= self.class.id_fields
286
+ ids(id_fields)
287
+ end
288
+ end
289
+
279
290
  # default id fields
280
291
  def self.id_fields
281
292
  [:id, :ids]
@@ -410,6 +421,10 @@ module Platform
410
421
  ############################################################################
411
422
  #### Ensurance
412
423
  ############################################################################
424
+ def ensure_api_enabled
425
+ raise ServiceUnavailableError.new('API Disabled') unless enabled?
426
+ end
427
+
413
428
  def ensure_post
414
429
  raise MethodNotAllowedError.new('POST required') unless request.post?
415
430
  end
@@ -425,6 +440,10 @@ module Platform
425
440
  def ensure_delete
426
441
  raise MethodNotAllowedError.new('DELETE required') unless request.delete?
427
442
  end
443
+
444
+ def ensure_application
445
+ raise LoginError.new("This API can only be called through an application") unless client_app
446
+ end
428
447
 
429
448
  def ensure_logged_in
430
449
  raise LoginError.new("You must be logged in to use this API") unless logged_in?
@@ -24,8 +24,6 @@
24
24
  class Platform::Application < ActiveRecord::Base
25
25
  set_table_name :platform_applications
26
26
 
27
- has_platform_api_proxy
28
-
29
27
  # useful methods - should be public
30
28
  include Platform::SimpleStringPermissions
31
29
  acts_as_tree :order => "version"
@@ -312,11 +310,11 @@ class Platform::Application < ActiveRecord::Base
312
310
  end
313
311
 
314
312
  def last_monthly_metric
315
- @last_monthly_metric ||= Platform::MonthlyApplicationMetric.find(:first, :conditions => ["application_id = ?", id], :order => "interval desc")
313
+ @last_monthly_metric ||= Platform::MonthlyApplicationMetric.find(:first, :conditions => ["application_id = ?", id], :order => "'interval' desc")
316
314
  end
317
315
 
318
316
  def last_total_metric
319
- @last_total_metric ||= Platform::TotalApplicationMetric.find(:first, :conditions => ["application_id = ?", id], :order => "interval desc")
317
+ @last_total_metric ||= Platform::TotalApplicationMetric.find(:first, :conditions => ["application_id = ?", id], :order => "'interval' desc")
320
318
  end
321
319
 
322
320
  def recently_updated_reviews
@@ -24,8 +24,6 @@
24
24
  class Platform::Developer < ActiveRecord::Base
25
25
  set_table_name :platform_developers
26
26
 
27
- has_platform_api_proxy
28
-
29
27
  belongs_to :user, :class_name => Platform::Config.user_class_name, :foreign_key => :user_id
30
28
 
31
29
  has_many :applications, :class_name => "Platform::Application"
@@ -44,4 +42,8 @@ class Platform::Developer < ActiveRecord::Base
44
42
  dev
45
43
  end
46
44
 
45
+ def app_options
46
+ @app_options ||= applications.collect{|app| [app.name, app.id]}
47
+ end
48
+
47
49
  end
@@ -40,8 +40,8 @@ class Platform::LoggedException < ActiveRecord::Base
40
40
  :backtrace => exception.backtrace,
41
41
  :session => controller.request.session,
42
42
  :request => controller.request,
43
- :user_id => Platform::Config.current_user.try(:id),
44
- :cause => exception.try(:cause)
43
+ :user_id => Platform::Config.current_user.try(:id)
44
+ # :cause => exception.try(:cause)
45
45
  )
46
46
  rescue StandardError => ex
47
47
  pp ex
@@ -43,9 +43,12 @@ class Platform::Media::Media < ActiveRecord::Base
43
43
 
44
44
  FileUtils.mkdir_p(local_dir) unless File.exist?(local_dir)
45
45
 
46
- image = Magick::ImageList.new(file.path)
47
- image = image.resize(opts[:size], opts[:size]) if opts[:size]
48
- image.write(local_path)
46
+ # you could force resize the image, but not the job of this plugin
47
+ # image = Magick::ImageList.new(file.path)
48
+ # image = image.resize(opts[:size], opts[:size]) if opts[:size]
49
+ # image.write(local_path)
50
+
51
+ FileUtils.cp(file.path, local_path)
49
52
  FileUtils.chmod(0644, local_path)
50
53
 
51
54
  save
@@ -3,7 +3,7 @@
3
3
 
4
4
  <%= will_filter_tag(@apps) %>
5
5
  <%= will_filter_table_tag(@apps, :columns => [
6
- [:icon, lambda{|app| link_to(image_tag(app.icon_url), :action => :view, :app_id => app.id)}, "width:18px;"],
6
+ [:icon, lambda{|app| link_to(image_tag(app.icon_url, :style=>"width:15px; height:15px;"), :action => :view, :app_id => app.id)}, "width:18px;"],
7
7
  [:id, lambda{|app| link_to(app.id, :action => :view, :app_id => app.id)}],
8
8
  [:developer_id, lambda{|app| link_to(app.developer.name, "") if app.developer}],
9
9
  :name,
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div class="module page_title lengthy">
4
4
  <div class="inner">
5
- <div class="hd">
5
+ <div class="hd" style="margin-bottom:20px;">
6
6
  <span style="float:right; padding-top:15px; font-size:12px;">
7
7
  <%=tr("Have an idea for an app?")%>
8
8
  <% if platform_current_user_is_developer? %>
@@ -12,7 +12,7 @@
12
12
  <% end %>
13
13
  </span>
14
14
 
15
- <h1><%= tr('Application Directory', 'Client application section title') %></h1>
15
+ <div style="font-size:28px;color:#666;"><%= tr('Application Directory', 'Client application section title') %></div>
16
16
  </div>
17
17
  </div>
18
18
  </div>
@@ -10,13 +10,17 @@
10
10
  </div>
11
11
 
12
12
  <div class="section">
13
- <% if Platform::Config.api_explorer_app? %>
13
+ <% if (platform_current_developer and platform_current_developer.app_options.any?) or Platform::Config.api_explorer_app %>
14
14
  <div class="section grey" style="margin-top:5px;margin-bottom:0px;">
15
15
  <table style="width:100%">
16
16
  <tr>
17
- <td style="width:100px; vertical-align:middle"><%=tr("Access Token:")%></td>
17
+ <% if platform_current_developer and platform_current_developer.app_options.any? %>
18
+ <td style="width:200px; vertical-align:middle"><%=select_tag("app_id", options_for_select(platform_current_developer.app_options, params[:app_id]), :style=>"width:95%")%></td>
19
+ <% else %>
20
+ <td style="width:1px;"><%=hidden_field_tag("app_id", Platform::Config.api_explorer_app_id)%></td>
21
+ <% end %>
18
22
  <td style="vertical-align:middle">
19
- <%=text_field_tag(:access_token, "", :style=>"width:600px;")%> &nbsp;
23
+ <%=text_field_tag(:access_token, "", :style=>"width:95%;", :placeholder => "Paste an access token or click on the button to the right to generate one")%> &nbsp;
20
24
  <%=link_to_function("X", "Platform.element('access_token').value = '';")%>
21
25
  </td>
22
26
  <td style="width:150px; text-align:right;">
@@ -39,9 +43,9 @@
39
43
  <%=select_tag("request_method", options_for_select(['GET', 'POST', 'PUT', 'DELETE'], params[:method] || 'GET'), :style=>"", :onChange=>"switchRequestMethod()")%>
40
44
  </td>
41
45
  <td>
42
- <table style="border:1px solid #ccc;padding:0px;margin:0px;font-size:12px;color:#888;vertical-align:middle; background-color:white;height:23px;">
46
+ <table cellspacing="0" cellpadding="0" style="border:1px solid #ccc;padding:0px;margin:0px;font-size:12px;vertical-align:middle; background-color:white;height:23px;">
43
47
  <tr>
44
- <td><span style="padding-left:5px;vertical-align:middle;white-space:nowrap;">http://<%=Platform::Config.api_base_url%>/</span></td>
48
+ <td style="background-color:#eee;"><span style="padding-left:5px;vertical-align:middle;white-space:nowrap;padding-right:0px;">http://<%=Platform::Config.api_base_url%>/</span></td>
45
49
  <td><%=text_field_tag(:api_path, params[:path], :style=>"width:500px;border:0px;padding:0px;margin:0px;font-size:12px;vertical-align:middle;", :onKeyUp=>"if (event.keyCode == 13) {api_history_index=-1; submitRequest();}")%></td>
46
50
  <td><span style="float:right;padding-right:5px;"><%=link_to_function(image_tag("platform/arrow_down.gif"), "toggleApiOptions(this)")%></span></td>
47
51
  </tr>
@@ -60,7 +60,8 @@
60
60
  <span style="float:right; font-size:10px;">
61
61
  <%=link_to_function(tr("Change your icon", 'Client application field action'), "Platform.Effects.hide('icon_preview');Platform.Effects.show('icon_field');")%>
62
62
  </span>
63
- <%=image_tag(@app.icon_url, :style => "width:16px;height:16px;")%>
63
+
64
+ <%=platform_app_icon_tag(@app) %>
64
65
  </div>
65
66
  </td>
66
67
  <td class="comments">
@@ -80,7 +81,8 @@
80
81
  <span style="float:right; font-size:10px;">
81
82
  <%=link_to_function(tr("Change your logo", 'Client application field action'), "Platform.Effects.hide('logo_preview');Platform.Effects.show('logo_field');")%>
82
83
  </span>
83
- <%=image_tag(@app.logo_url, :style => "width:75px;height:75px;")%>
84
+
85
+ <%=platform_app_logo_tag(@app) %>
84
86
  </div>
85
87
  </td>
86
88
  <td class="comments">
@@ -85,7 +85,8 @@
85
85
  <% @apps.each do |app| %>
86
86
  <% if app == @menu_app %>
87
87
  <div class="<%= (@app != @menu_app) ? 'app_item' : 'app_selected' %>">
88
- <%=image_tag(app.icon_url, :style => "vertical-align:middle;")%> &nbsp;
88
+ <%=platform_app_icon_tag(app, :style => "vertical-align:middle;") %>
89
+ &nbsp;
89
90
  <%=link_to(app.name, {:id=>app.id}) %>
90
91
  </div>
91
92
  <% app.children.each do |app| %>
@@ -96,7 +97,8 @@
96
97
  <% end %>
97
98
  <% else %>
98
99
  <div class="app_item">
99
- <%=image_tag(app.icon_url, :style => "vertical-align:middle;")%> &nbsp;
100
+ <%=platform_app_icon_tag(app, :style => "vertical-align:middle;") %>
101
+ &nbsp;
100
102
  <%=link_to(app.name, {:id=>app.id}) %>
101
103
  </div>
102
104
  <% end %>
@@ -108,7 +110,7 @@
108
110
  <table>
109
111
  <tr>
110
112
  <td style="align-vertical:top; width:90px;" rowspan="2">
111
- <%=image_tag(@app.logo_url)%>
113
+ <%=platform_app_logo_tag(@app) %>
112
114
  </td>
113
115
  <td style="align-vertical:top;">
114
116
  <div style="float:right;">
@@ -137,7 +139,7 @@
137
139
  </div>
138
140
  <% else %>
139
141
  <span style='color:red'>not submitted</span>
140
- <div style="font-size:11px;color:#999;"><%=tr("Once you have completed your application, you may submit it to the [link: App Directory].", "", :link => ["/platform/apps"])%></div>
142
+ <div style="font-size:11px;color:#999;"><%=tr("Once you have completed your application, you may submit it to the [link: App Directory].", "", :link => {:href=>"/platform/apps"})%></div>
141
143
  <% end %>
142
144
  </div>
143
145
  <% end -%>
@@ -3,7 +3,6 @@
3
3
  <% if platform_developer_tabs.size > 1 %>
4
4
  <div class="translations_navigation" dir="ltr">
5
5
  <div style="font-size:22px; font-weight: bold;padding-bottom:15px;">
6
- <%=Platform::Config.site_title%>
7
6
  <%=tr("Platform Developer Tools", "Platform developer tools label")%>
8
7
  </div>
9
8
 
@@ -18,7 +18,7 @@
18
18
  new_users_data = []
19
19
  active_users_data = []
20
20
  while start_date <= end_date do
21
- metric = Platform::DailyApplicationMetric.find(:first, :conditions => ["application_id = ? and interval = ?", app.id, start_date])
21
+ metric = Platform::DailyApplicationMetric.where("application_id = ? and 'interval' = ?", app.id, start_date).first
22
22
  new_user_count = metric ? metric.new_user_count : 0
23
23
  active_user_count = metric ? metric.active_user_count : 0
24
24
  new_users_data << [start_date.strftime("%m/%d"), new_user_count]
@@ -67,7 +67,7 @@
67
67
 
68
68
  <%=platform_toggler_tag("app_content_#{app.id}")%>
69
69
 
70
- <%=image_tag(app.icon_url, :title=>app.name) %>&nbsp;
70
+ <%=image_tag(app.icon_url, :title=>app.name, :style=>"width:16px;height:16px;") %>&nbsp;
71
71
  <a name="app_<%=app.id%>" style="text-decoration:none;color:black;"><%=app.versioned_name%></a>
72
72
  </div>
73
73
 
@@ -97,7 +97,8 @@
97
97
  </p>
98
98
  <h3><%=tr("Example")%></h3>
99
99
  <div class="code_snippet">
100
- https://<%=Platform::Config.site_base_url %>/platform/oauth/authorize?client_id=YOUR_APP_ID&redirect_uri=YOUR_APP_URL&response_type=token&display=mobile
100
+ https://<%=Platform::Config.site_base_url %>/platform/oauth/authorize?client_id=YOUR_APP_ID&
101
+ redirect_uri=YOUR_APP_URL&response_type=token&display=mobile
101
102
  </div>
102
103
  <p>
103
104
  <%=tr("By setting the display parameter to \"mobile\", you ensure that the login and the authorization screens will use a mobile layout.")%>
@@ -140,8 +141,9 @@ NSString *platformOauthBaseURL = @"https://<%=Platform::Config.site_base_url %>/
140
141
 
141
142
  NSString *yourAppURL = [NSString stringWithFormat: @"%@/authorize", YOUR_APP_ID];
142
143
 
143
- NSString *platformOauthURL = [NSString stringWithFormat:@"%@?client_id=%@&redirect_uri=%@&response_type=token&display=mobile",
144
- platformOauthBaseURL, YOUR_APP_ID, yourAppURL];
144
+ NSString *platformOauthURL = [NSString stringWithFormat:
145
+ @"%@?client_id=%@&redirect_uri=%@&response_type=token&display=mobile",
146
+ platformOauthBaseURL, YOUR_APP_ID, yourAppURL];
145
147
 
146
148
  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:platformOauthURL]];
147
149
  </pre>
@@ -1,134 +1,19 @@
1
+ <%=platform_scripts_tag %>
2
+
1
3
  <div class="module page_title lengthy">
2
4
  <div class="inner">
3
5
  <div class="hd">
4
- <h1><%= tr('Welcome to #{Platform::Config.site_title} Platform!', 'Client application section title') %></h1>
6
+ <h1><%= tr("Welcome to #{Platform::Config.site_title} Platform!", 'Client application section title') %></h1>
7
+ <div style="font-size:14px;color:#888;"><%=tr("Before you can use #{Platform::Config.site_title} API, you must agree to the following terms and policies:")%></div>
5
8
  </div>
6
9
  </div>
7
10
  </div>
8
11
 
9
- <div style="padding:10px;border:1px solid #ccc;overflow:auto;height:500px;margin:10px;font-family:Arial;font-size:12px;">
10
- <pre>
11
- <%=Platform::Config.site_title %> Platform Policies
12
-
13
- Introduction
14
-
15
- Date of Last Revision: May 24, 2011
16
-
17
- <%=Platform::Config.site_title %> Platform is an extension of <%=Platform::Config.site_title %>, whose mission is to give people the power to share and make the world more open and connected.
18
-
19
- Platform applications and developers are required to comply with the following documents:
20
-
21
- Statement of Rights and Responsibilities: requirements for anyone who uses <%=Platform::Config.site_title %>.
22
- Principles: the spirit of the law for Platform.
23
- Policies: the letter of the law for Platform.
24
-
25
- Here are some Examples and Explanations for specifics.
26
-
27
- Principles
28
-
29
- Create a great user experience
30
-
31
- Build social and engaging applications
32
- Give users choice and control
33
- Help users share expressive and relevant content
34
-
35
- Be trustworthy
36
-
37
- Respect privacy
38
- Don't mislead, confuse, defraud, or surprise users
39
- Don't spam - encourage authentic communications
40
-
41
- Policies
42
-
43
- I. Features and Functionality
44
-
45
- You must not violate any law or the rights of any individual or entity, and must not expose <%=Platform::Config.site_title %> or <%=Platform::Config.site_title %> users to harm or legal liability as determined by us in our sole discretion.
46
- You must not include functionality that proxies, requests or collects <%=Platform::Config.site_title %> usernames or passwords.
47
- You must not circumvent (or claim to circumvent) our intended limitations on core <%=Platform::Config.site_title %> features and functionality.
48
- If you offer a service for a user that integrates user data into a physical product (such as a scrapbook or calendar), you must only create a physical product for that user's personal and non-commercial use.
49
- If you exceed, or plan to exceed, any of the following thresholds please contact us as you may be subject to additional terms: (>5M MAU) or (>100M API calls per day) or (>50M impressions per day).
50
- Your website must offer an explicit "Log Out" option that also logs the user out of <%=Platform::Config.site_title %>.
51
- Special provisions for apps on Pages:
52
-
53
- a. Apps on Pages must not host media that plays automatically without a user's interaction.
54
- b. When a user visits your Page, if they have not given explicit permission by authorizing your <%=Platform::Config.site_title %> app or directly providing information to your Page, you may only use information obtained from us and the user's interaction with your Page in connection with that Page. For example, although you may use aggregate analytics for your individual Page, you must not combine information from any other sources to customize the user's experience on your Page and may not use any information about the user's interaction with your Page in any other context (such as analytics or customization across other Pages or websites).
55
-
56
- You must not use or make derivative use of <%=Platform::Config.site_title %> icons, or use terms for <%=Platform::Config.site_title %> features and functionality, if such use could confuse users into thinking that the reference is to <%=Platform::Config.site_title %> features or functionality.
57
-
58
- II. Storing and Using Data You Receive From Us
59
-
60
- You will only request the data you need to operate your application.
61
- You may cache data you receive through use of the <%=Platform::Config.site_title %> API in order to improve your application’s user experience, but you should try to keep the data up to date. This permission does not give you any rights to such data.
62
- You will have a privacy policy that tells users what user data you are going to use and how you will use, display, share, or transfer that data and you will include your privacy policy URL in the Developer Application.
63
- A user's friends' data can only be used in the context of the user's experience on your application.
64
- Subject to certain restrictions, including on transfer, users give you their basic account information when they connect with your application. For all other data obtained through use of the <%=Platform::Config.site_title %> API, you must obtain explicit consent from the user who provided the data to us before using it for any purpose other than displaying it back to the user on your application.
65
- You will not directly or indirectly transfer any data you receive from us, including user data or <%=Platform::Config.site_title %> User IDs, to (or use such data in connection with) any ad network, ad exchange, data broker, or other advertising or monetization related toolset, even if a user consents to such transfer or use. By indirectly we mean you cannot, for example, transfer data to a third party who then transfers the data to an ad network. By any data we mean all data obtained through use of the <%=Platform::Config.site_title %> Platform (API, Social Plugins, etc.), including aggregate, anonymous or derivative data.
66
- You will not use <%=Platform::Config.site_title %> User IDs for any purpose outside your application (e.g., your infrastructure, code, or services necessary to build and run your application). <%=Platform::Config.site_title %> User IDs may be used with external services that you use to build and run your application, such as a web infrastructure service or a distributed computing platform, but only if those services are necessary to running your application and the service has a contractual obligation with you to keep <%=Platform::Config.site_title %> User IDs confidential.
67
- If you need an anonymous unique identifier to share outside your application with third parties such as content partners, advertisers, or ad networks, you must use our mechanism. You must never share this anonymous unique identifier with a data broker, information broker, or any other service that we may define as such under our sole discretion.
68
- You will not sell any data. If you are acquired by or merge with a third party, you can continue to use user data within your application, but you cannot transfer data outside your application.
69
- If you stop using Platform or we disable your application, you must delete all data you have received through use of the <%=Platform::Config.site_title %> API unless: (a) it is basic account information; or (b) you have received explicit consent from the user to retain their data.
70
- You cannot use a user’s friend list outside of your application, even if a user consents to such use, but you can use connections between users who have both connected to your application.
71
- You will delete all data you receive from us concerning a user if the user asks you to do so, and will provide an easily accessible mechanism for users to make such a request. We may require you to delete data you receive from the <%=Platform::Config.site_title %> API if you violate our terms.
72
- You will not include data you receive from us concerning a user in any advertising creative, even if a user consents to such use.
73
- You must not give your secret key to another party, unless that party is an agent acting on your behalf as an operator of your application. You are responsible for all activities that occur under your account identifiers.
74
-
75
- III. Application Content
76
-
77
- A. Prohibited Content - You are responsible for all content of and within your application, including advertisements and user-generated content. You must not promote, or provide content referencing, facilitating, containing or using, the following:
78
- Alcohol-related content (unless the appropriate Demographic Restrictions are used), or sale of tobacco products, ammunition and/or firearms;
79
- Content that infringes upon the rights of any third party, including intellectual property rights, privacy, publicity or other personal or proprietary right, or that is deceptive or fraudulent;
80
- Gambling, including without limitation, any online casino, sports books, bingo or poker;
81
- Illegal activity and/or illegal contests, pyramid schemes, sweepstakes or chain letters; if you run, reference, or facilitate a legally permissible sweepstakes, contest, or other promotion you are subject to <%=Platform::Config.site_title %>'s Promotions Guidelines;
82
- Content that is hateful, threatening, defamatory, or pornographic; incites violence; or contains nudity or graphic or gratuitous violence.
83
- B. Advertisements and Cross-Promotions
84
- You must not include advertisements or promotions, cross-promote other applications, or provide web search functionality in content distributed through <%=Platform::Config.site_title %> social channels.
85
- You can only utilize advertising or similar monetization related products or services from companies that appear on this list within Apps on <%=Platform::Config.site_title %>.com.
86
-
87
- IV. Application Integration Points
88
-
89
- You must not incentivize users to use (or gate content behind the use of) <%=Platform::Config.site_title %> social channels, or imply that an incentive is directly tied to the use of our channels.
90
- You must not pre-fill any of the fields associated with the following products, unless the user manually generated the content earlier in the workflow: Stream stories (user_message parameter for <%=Platform::Config.site_title %>.streamPublish and FB.Connect.streamPublish, and message parameter for stream.publish), Photos (caption), Videos (description), Notes (title and content), Links (comment), and Jabber/XMPP.
91
- If a user grants you a publishing permission, you must still obtain consent from the user before taking any action on the user's behalf, such as publishing content or creating an event.
92
- You must provide users with an easily identifiable "skip" option whenever you present users with an option to use a <%=Platform::Config.site_title %> social channel.
93
- You must not provide users with the option to publish more than one Stream story at a time.
94
- Platform integrations, including social plugins:
95
- a. Your advertisements must not include or be paired with any Platform integrations, including social plugins such as the Like button, without our written permission.
96
- b. You must not sell or purchase placement of a Like button or Like box plugin.
97
- c. You must not incentivize users to Like any Page other than your own site or application, and any incentive you provide must be available to new and existing users who Like your Page.
98
- d. You must not obscure or cover elements of our social plugins, such as the Like button or Like box plugin.
99
- <%=Platform::Config.site_title %> messaging (i.e., email sent to an @<%=Platform::Config.site_title %>.com address) is designed for communication between users, and not a channel for applications to communicate directly with users.
100
-
101
- V. Enforcement
102
-
103
- We can take enforcement action against you and any or all of your applications if we determine in our sole judgment that you or your application violates <%=Platform::Config.site_title %> Platform Terms and Policies. Enforcement action is both automated and manual, and can include disabling your application, restricting you and your application's access to Platform functionality, terminating our agreements with you, or any other action as we in our sole discretion deem appropriate.
104
-
105
- Communication with developers takes place via an email sent from the <%=Platform::Config.site_title %>.com or <%=Platform::Config.site_title %>mail.com domain to the Developer Contact email address registered to the application. To stay in touch, please ensure that your email address is current and that you do not filter out any such messages.
106
-
107
- VI. Changes
108
-
109
- We can change these Platform Policies at any time without prior notice as we deem necessary. Your continued use of Platform constitutes acceptance of those changes.
110
-
111
- VII. Definitions
112
-
113
- By "Application" we mean canvas page application, Platform integration, or any other technical integration we have assigned an application identification number.
114
- By "<%=Platform::Config.site_title %> social channel" we mean Application Info Section, Application tab, Feed, requests (including invites), inbox attachments, Chat, Bookmarks, or any other feature of a user profile or <%=Platform::Config.site_title %> communication channel in which or through which an application can provide, display, or deliver content directed at, on behalf of, or by permission of a user.
115
- By “basic account information” we mean: name, email, gender, birthday, current city, and profile picture URL.
116
- By "<%=Platform::Config.site_title %> Platform Terms and Policies" we mean the Statement of Rights and Responsibilities and the Platform Policies.
117
- By "User data you receive from <%=Platform::Config.site_title %>" we mean any data or content (including any images, text, or other information or materials) you receive from us, that was provided by users to us, or was associated by us with a particular user.
118
-
119
- VIII. Branding and Promotion Policy
120
-
121
- You must follow the guidelines set forth in the <%=Platform::Config.site_title %> Brand Resource and Permissions Center.
122
-
123
- IX. Advertising Guidelines
124
-
125
- X. <%=Platform::Config.site_title %> Credits
126
-
127
- Developers participating in the program for accepting credits are subject to these terms.
128
- </pre>
129
- </div>
12
+ <iframe src="<%=Platform::Config.developer_agreement_path%>" style="border:1px solid #ccc;width:100%;height:500px;"></iframe>
130
13
 
131
14
  <div style="text-align:center; padding:15px;">
132
- <%= link_to(trl('Agree', 'Client application action label'), {:action => :proceed}, :class=>'button super blue xlarge') %>
15
+ <button type="button" class="platform_btn platform_submit_btn" onClick="location='/platform/developer/registration/proceed'; return false;">
16
+ <span><%=tr("Agree")%></span>
17
+ </button>
133
18
  <%=tr("or")%> <%=link_to(tr("Cancel"), Platform::Config.default_url)%>
134
19
  </div>