muck-raker 0.1.21 → 0.1.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/README.rdoc +14 -0
  2. data/Rakefile +2 -0
  3. data/VERSION +1 -1
  4. data/app/controllers/admin/muck/feeds_controller.rb +23 -157
  5. data/app/controllers/muck/entries_controller.rb +7 -7
  6. data/app/controllers/muck/feeds_controller.rb +1 -1
  7. data/app/controllers/muck/recommendations_controller.rb +20 -16
  8. data/app/controllers/muck/visits_controller.rb +20 -0
  9. data/app/helpers/muck_raker_helper.rb +5 -1
  10. data/app/models/click.rb +8 -0
  11. data/app/models/entry.rb +39 -9
  12. data/app/models/feed.rb +89 -25
  13. data/app/models/feed_parent.rb +5 -0
  14. data/app/models/recommendation.rb +5 -0
  15. data/app/models/tag_cloud.rb +4 -0
  16. data/app/views/admin/feeds/index.html.erb +29 -59
  17. data/app/views/entries/_related_entry.html.erb +1 -1
  18. data/app/views/entries/_result.html.erb +1 -1
  19. data/app/views/feeds/_feed.html.erb +14 -1
  20. data/app/views/feeds/edit.html.erb +1 -1
  21. data/app/views/parts/_add_feed.html.erb +4 -4
  22. data/app/views/recommendations/index.pjs.erb +8 -8
  23. data/app/views/recommendations/index.rss.builder +3 -3
  24. data/app/views/recommendations/index.xml.builder +8 -8
  25. data/app/views/recommendations/index_js.pjs.erb +4 -0
  26. data/app/views/recommendations/index_real_time.pjs.erb +44 -0
  27. data/app/views/recommendations/index_real_time.xml.builder +26 -0
  28. data/app/views/visits/show.html.erb +156 -0
  29. data/config/muck_raker_routes.rb +19 -15
  30. data/db/bootstrap/services.yml +23 -23
  31. data/db/migrate/20090602191243_create_muck_raker.rb +2 -2
  32. data/db/migrate/20090728165716_add_etag_to_feeds.rb +9 -0
  33. data/db/migrate/20090730045848_add_comment_cache_to_entries.rb +9 -0
  34. data/db/migrate/20090804211240_add_entry_id_to_shares.rb +9 -0
  35. data/lib/muck_raker/tasks.rb +21 -24
  36. data/locales/en.yml +18 -1
  37. data/muck-raker.gemspec +82 -6
  38. data/raker/lib/recommenderd.jar +0 -0
  39. data/test/feed_archive/http---www-oercommons-org-oai-verb-ListRecords-metadataPrefix-oer_recommender-set-collection-american-physical-society/1248886128173.xml +56 -0
  40. data/test/feed_archive/http---www-oercommons-org-oai-verb-ListRecords-metadataPrefix-oer_recommender-set-collection-arizona-state-university/1248886130492.xml +49 -0
  41. data/test/feed_archive/http---www-oercommons-org-oai-verb-ListRecords-metadataPrefix-oer_recommender-set-collection-aspire/1248886130883.xml +192 -0
  42. data/test/rails_root/Rakefile +3 -0
  43. data/test/rails_root/app/controllers/application_controller.rb +10 -1
  44. data/test/rails_root/app/models/activity.rb +3 -0
  45. data/test/rails_root/app/models/comment.rb +3 -0
  46. data/test/rails_root/app/models/share.rb +4 -0
  47. data/test/rails_root/app/models/user.rb +5 -0
  48. data/test/rails_root/app/views/default/index.html.erb +2 -0
  49. data/test/rails_root/app/views/layouts/frame.html.erb +35 -0
  50. data/test/rails_root/config/database.yml +4 -2
  51. data/test/rails_root/config/environment.rb +3 -0
  52. data/test/rails_root/config/environments/cucumber.rb +21 -0
  53. data/test/rails_root/config/global_config.yml +2 -0
  54. data/test/rails_root/config/routes.rb +1 -1
  55. data/test/rails_root/db/bootstrap/attention.yml +6 -0
  56. data/test/rails_root/db/bootstrap/feeds.yml +4268 -0
  57. data/test/rails_root/db/bootstrap/oai_endpoints.yml +6 -0
  58. data/test/rails_root/db/bootstrap/services.yml +172 -0
  59. data/test/rails_root/db/migrate/20090402033319_add_muck_activities.rb +36 -0
  60. data/test/rails_root/db/migrate/20090602191243_create_muck_raker.rb +2 -2
  61. data/test/rails_root/db/migrate/20090613173314_create_comments.rb +24 -0
  62. data/test/rails_root/db/migrate/20090728165716_add_etag_to_feeds.rb +9 -0
  63. data/test/rails_root/db/migrate/20090730044139_add_comment_cache.rb +9 -0
  64. data/test/rails_root/db/migrate/20090730045848_add_comment_cache_to_entries.rb +9 -0
  65. data/test/rails_root/db/migrate/20090730154102_allow_null_user.rb +9 -0
  66. data/test/rails_root/db/migrate/20090803185323_create_shares.rb +18 -0
  67. data/test/rails_root/db/migrate/20090804211240_add_entry_id_to_shares.rb.rb +9 -0
  68. data/test/rails_root/features/feeds.feature +13 -0
  69. data/test/rails_root/features/step_definitions/common_steps.rb +93 -0
  70. data/test/rails_root/features/step_definitions/visit_steps.rb +6 -0
  71. data/test/rails_root/features/step_definitions/webrat_steps.rb +52 -23
  72. data/test/rails_root/features/support/paths.rb +36 -0
  73. data/test/rails_root/features/visit.feature +10 -0
  74. data/test/rails_root/lib/tasks/cucumber.rake +20 -0
  75. data/test/rails_root/public/images/icons/blue_guy.png +0 -0
  76. data/test/rails_root/public/images/icons/cancel.png +0 -0
  77. data/test/rails_root/public/images/icons/close.png +0 -0
  78. data/test/rails_root/public/images/icons/delete.png +0 -0
  79. data/test/rails_root/public/images/icons/exclaim.png +0 -0
  80. data/test/rails_root/public/images/icons/grey_guy.png +0 -0
  81. data/test/rails_root/public/images/icons/hide.png +0 -0
  82. data/test/rails_root/public/images/icons/information.png +0 -0
  83. data/test/rails_root/public/images/icons/minus.png +0 -0
  84. data/test/rails_root/public/images/icons/question.png +0 -0
  85. data/test/rails_root/public/images/icons/search_box.png +0 -0
  86. data/test/rails_root/public/images/icons/star.png +0 -0
  87. data/test/rails_root/public/images/icons/stop.png +0 -0
  88. data/test/rails_root/public/images/icons/thumb_down.png +0 -0
  89. data/test/rails_root/public/images/icons/thumb_up.png +0 -0
  90. data/test/rails_root/public/images/icons/vote.png +0 -0
  91. data/test/rails_root/public/javascripts/jquery/jrails.js +1 -0
  92. data/test/rails_root/public/javascripts/muck.js +15 -1
  93. data/test/rails_root/public/javascripts/muck_activities.js +1 -1
  94. data/test/rails_root/public/stylesheets/application.css +49 -1
  95. data/test/rails_root/public/stylesheets/styles.css +2 -1
  96. data/test/rails_root/script/cucumber +2 -1
  97. data/test/rails_root/test/functional/admin/feeds_controller_test.rb +37 -0
  98. data/test/rails_root/test/functional/feed_previews_controller_test.rb +1 -1
  99. data/test/rails_root/test/functional/visits_controller_test.rb +21 -0
  100. data/test/rails_root/test/test_helper.rb +2 -1
  101. data/test/rails_root/test/unit/entry_test.rb +12 -0
  102. data/test/rails_root/test/unit/feed_parent_test.rb +17 -0
  103. data/test/rails_root/test/unit/feed_test.rb +42 -3
  104. data/test/rails_root/test/unit/tag_cloud_test.rb +4 -0
  105. metadata +89 -4
  106. data/app/models/language.rb +0 -16
  107. data/app/views/recommendations/document_not_found.html.erb +0 -13
data/app/models/feed.rb CHANGED
@@ -1,3 +1,43 @@
1
+ # == Schema Information
2
+ #
3
+ # Table name: feeds
4
+ #
5
+ # id :integer(4) not null, primary key
6
+ # uri :string(2083)
7
+ # display_uri :string(2083)
8
+ # title :string(1000)
9
+ # short_title :string(100)
10
+ # description :text
11
+ # tag_filter :string(1000)
12
+ # top_tags :text
13
+ # priority :integer(4) default(10)
14
+ # status :integer(4) default(1)
15
+ # last_requested_at :datetime
16
+ # last_harvested_at :datetime
17
+ # harvest_interval :integer(4) default(86400)
18
+ # failed_requests :integer(4) default(0)
19
+ # error_message :text
20
+ # service_id :integer(4) default(0)
21
+ # login :string(255)
22
+ # password :string(255)
23
+ # created_at :datetime
24
+ # updated_at :datetime
25
+ # entries_changed_at :datetime
26
+ # harvested_from_display_uri :string(2083)
27
+ # harvested_from_title :string(1000)
28
+ # harvested_from_short_title :string(100)
29
+ # entries_count :integer(4)
30
+ # default_language_id :integer(4) default(0)
31
+ # default_grain_size :string(255) default("unknown")
32
+ # contributor_id :integer(4)
33
+ # etag :string(255)
34
+ #
35
+ # Indexes
36
+ #
37
+ # index_feeds_on_service_id (service_id)
38
+ # index_feeds_on_uri (uri)
39
+ #
40
+
1
41
  # == Schema Information
2
42
  #
3
43
  # Table name: feeds
@@ -32,12 +72,12 @@
32
72
  # contributor_id :integer(4)
33
73
  #
34
74
  class Feed < ActiveRecord::Base
35
-
75
+
36
76
  require 'httparty'
37
-
77
+
38
78
  include HTTParty
39
79
  format :xml
40
-
80
+
41
81
  validates_presence_of :uri
42
82
 
43
83
  has_many :feed_parents
@@ -50,34 +90,43 @@ class Feed < ActiveRecord::Base
50
90
  named_scope :by_title, :order => "title ASC"
51
91
  named_scope :recent, lambda { { :conditions => ['created_at > ?', 1.week.ago] } }
52
92
  named_scope :by_newest, :order => "created_at DESC"
93
+
94
+ attr_protected :status, :last_requested_at, :last_harvested_at, :harvest_interval, :failed_requests,
95
+ :created_at, :updated_at, :entries_changed_at, :entries_count, :contributor_id
53
96
 
54
97
  # named_scope :ready_to_harvest, lambda { |*args| { :conditions => [ "feeds.last_harvested_at < ?", args.first || 1.day.ago.end_of_day ] } }
98
+
99
+ def banned?
100
+ self.status < 0
101
+ end
55
102
 
56
103
  def after_create
57
104
  if GlobalConfig.inform_admin_of_global_feed && self.feed_parents.empty?
58
105
  RakerMailer.deliver_notification_feed_added(self) # Global feed. Email the admin to let them know a feed has been added
59
- end
106
+ end
60
107
  end
61
108
 
62
109
  # harvest_interval is stored in seconds
63
- def refresh_interval_hours
64
- if self.harvest_interval
65
- self.harvest_interval/3600
66
- else
67
- 168 # Once a week
68
- # Looks like 168 = 24 * 7 (1 week)
69
- # harvest_interval is currently stored in seconds. I'm guessing it used to be stored in hours and this is a relic
70
- end
110
+ # default is 86400 which is one day
111
+ def harvest_interval_hours
112
+ self.harvest_interval/3600
71
113
  end
72
-
73
- def refresh_interval_hours=(interval)
74
- self.harvest_interval = interval + ":00:00"
114
+
115
+ # Converts hours into seconds for harvest_interval
116
+ def harvest_interval_hours=(interval)
117
+ self.harvest_interval = interval * 3600
118
+ end
119
+
120
+ def harvest
121
+ # check to see if the feed has changed
122
+ feed = Feedzirra::Feed.fetch_and_parse(self.uri)
123
+ feed.entries
124
+ # updated_feed = Feedzirra::Feed.update(self)
125
+ # if updated_feed.updated?
126
+ # updated_feed.new_entries # get new entries
127
+ # updated_feed.sanitize_entries! # clean up
128
+ # end
75
129
  end
76
-
77
- # def self.harvest
78
- # feed = Feed.first # .ready_to_harvest.first
79
- # get(feed.uri)
80
- # end
81
130
 
82
131
  # Gathers all available feed uris from the given uri and parses them into
83
132
  # feed objects
@@ -85,22 +134,37 @@ class Feed < ActiveRecord::Base
85
134
  feeds = []
86
135
  @available_feeds = discover_feeds(uri)
87
136
  @available_feeds.each do |feed|
88
- feeds << make_feed(Feedzirra::Feed.fetch_and_parse(feed.url))
137
+ feeds << from_feedzirra(Feedzirra::Feed.fetch_and_parse(feed.url))
89
138
  end
90
139
  feeds
91
140
  end
92
-
141
+
93
142
  # Turns a feed from feedzirra into a muck feed
94
- def self.make_feed(feed)
143
+ def self.from_feedzirra(feed)
95
144
  Feed.new(:short_title => feed.title,
96
145
  :title => feed.title,
97
146
  :display_uri => feed.url,
98
147
  :uri => feed.feed_url)
99
148
  end
100
-
149
+
150
+ # provided to make feed quack like a feedzirra feed
151
+ def url
152
+ display_uri
153
+ end
154
+
155
+ # provided to make feed quack like a feedzirra feed
156
+ def feed_url
157
+ uri
158
+ end
159
+
160
+ # provided to make feed quack like a feedzirra feed
161
+ def last_modified
162
+ entries_changed_at
163
+ end
164
+
101
165
  # Looks for feeds from a given url
102
166
  def self.discover_feeds(uri)
103
167
  Feedbag.find(uri)
104
168
  end
105
-
169
+
106
170
  end
@@ -9,6 +9,11 @@
9
9
  # created_at :datetime
10
10
  # updated_at :datetime
11
11
  #
12
+ # Indexes
13
+ #
14
+ # index_feed_parents_on_feed_id (feed_id)
15
+ # index_feed_parents_on_ownable_id_and_ownable_type (ownable_id,ownable_type)
16
+ #
12
17
 
13
18
  class FeedParent < ActiveRecord::Base
14
19
  unloadable
@@ -10,6 +10,11 @@
10
10
  # clicks :integer(4) default(0)
11
11
  # avg_time_at_dest :integer(4) default(60)
12
12
  #
13
+ # Indexes
14
+ #
15
+ # index_recommendations_on_dest_entry_id (dest_entry_id)
16
+ # index_recommendations_on_entry_id (entry_id)
17
+ #
13
18
 
14
19
  class Recommendation < ActiveRecord::Base
15
20
  end
@@ -8,6 +8,10 @@
8
8
  # tag_list :string(5000)
9
9
  # grain_size :string(255) default("all")
10
10
  #
11
+ # Indexes
12
+ #
13
+ # index_tag_clouds_on_grain_size_and_language_id_and_filter (grain_size,language_id,filter) UNIQUE
14
+ #
11
15
 
12
16
  class TagCloud < ActiveRecord::Base
13
17
 
@@ -1,65 +1,35 @@
1
- <h1>OER Recommender - Registered Collections</h1>
1
+ <h1><%= t('muck.raker.feeds_title') %></h1>
2
2
  <div>
3
- <p><a href="/feeds/new">Register a New Collection</a></p>
4
- <%= render :partial => 'feeds/feeds', :object => @feeds %>
5
-
6
- <% if @banned_feeds.size > 0 %>
7
- <h1>Banned Feeds</h1>
8
- <%= render :partial => 'feeds/feeds', :object => @banned_feeds %>
9
- <table>
10
-
11
- <% for feed in @banned_feeds %>
3
+ <p>
4
+ <%= link_to t('muck.raker.discover_feed'), new_feed_preview_path, :class => 'iframe lightbox' %>
5
+ <%= link_to t('muck.raker.add_feed'), new_feed_path, :class => 'iframe lightbox' %>
6
+ <%= link_to t('muck.raker.add_feed_advanced'), new_extended_feeds_path, :class => 'iframe lightbox' %>
7
+ </p>
8
+ <table class="feeds">
12
9
  <tr>
13
- <td><%= link_to feed.title, "/feeds/" + feed.id.to_s + "/entries" %> <%= link_to "[go]", feed.display_uri, :style => "color:red" %></td>
14
- <td>
15
- <%= link_to 'Edit', edit_feed_path(feed) %>
16
- <%
17
- =begin %>
18
- <% if feed.status >= 0 %>
19
- <%= link_to 'Ban', ban_feed_path(feed), :confirm => 'Are you sure?', :method => :post %>
20
- <% else %>
21
- <%= link_to 'Unban', unban_feed_path(feed), :confirm => 'Are you sure?', :method => :post %>
22
- <% end %>
23
- <%= link_to 'Harvest', harvest_now_feed_path(feed), :method => :post %>
24
- <%= link_to 'Delete', feed_path(feed), :method => :delete %>
25
- <%
26
- =end %>
27
- </td>
28
- <td><%=h feed.description %></td>
29
- <td><%=h feed.harvest_interval %></td>
30
- <td><%=h feed.last_harvested_at %></td>
31
- <td><%=h feed.failed_requests %></td>
32
- <td><%=h feed.error_message ? "Failed last request:" + feed.error_message : feed.status >= 0 ? "Ok" : "Banned" %></td>
33
- <td><%=h feed.uri %></td>
10
+ <th></th>
11
+ <th><%= t('muck.raker.title') %></th>
12
+ <th><%= t('muck.raker.description') %></th>
13
+ <th><%= t('muck.raker.harvest_interval') %></th>
14
+ <th><%= t('muck.raker.harvested_at') %></th>
15
+ <th><%= t('muck.raker.failed_harvests') %></th>
16
+ <th><%= t('muck.raker.status') %></th>
17
+ <th><%= t('muck.raker.uri') %></th>
34
18
  </tr>
35
- <% end %>
19
+ <%= render :partial => 'feeds/feed', :collection => @feeds, :locals => { :show_admin => true } %>
36
20
  </table>
21
+ <div class="clear">
22
+ <%= will_paginate @feeds %>
23
+ </div>
37
24
  </div>
38
- <% end %>
39
-
40
-
41
-
42
25
 
43
- <tr>
44
- <td><%= link_to feed.title, "/feeds/" + feed.id.to_s + "/entries" %> <%= link_to "[go]", feed.display_uri, :style => "color:red" %></td>
45
- <td>
46
- <%= link_to 'Edit', edit_feed_path(feed) %>
47
- <%
48
- =begin %>
49
- <% if feed.status >= 0 %>
50
- <%= link_to 'Ban', ban_feed_path(feed), :confirm => 'Are you sure?', :method => :post %>
51
- <% else %>
52
- <%= link_to 'Unban', unban_feed_path(feed), :confirm => 'Are you sure?', :method => :post %>
53
- <% end %>
54
- <%= link_to 'Harvest', harvest_now_feed_path(feed), :method => :post %>
55
- <%= link_to 'Delete', feed_path(feed), :method => :delete %>
56
- <%
57
- =end %>
58
- </td>
59
- <td><%=h feed.description %></td>
60
- <td><%=h feed.refresh_interval_hours %></td>
61
- <td><%=h feed.last_harvested_at %></td>
62
- <td><%=h feed.failed_requests %></td>
63
- <td><%=h feed.error_message ? "Failed last request:" + feed.error_message : feed.status >= 0 ? "Ok" : "Banned" %></td>
64
- <td><%=h feed.uri %></td>
65
- </tr>
26
+ <% content_for :javascript do -%>
27
+ jQuery(document).ready(function() {
28
+ jQuery('a.lightbox').fancybox({
29
+ 'hideOnContentClick': true,
30
+ 'overlayShow': true,
31
+ 'frameWidth': 700,
32
+ 'frameHeight': 600
33
+ });
34
+ });
35
+ <% end -%>
@@ -1,4 +1,4 @@
1
- <%= link_to related_entry.title + " (" + related_entry.collection + ")", "/r?id=#{related_entry.id}", :class => "title_link", :rel => "nofollow" %>
1
+ <%= link_to related_entry.title + " (" + related_entry.collection + ")", visit_path(:id => related_entry.id), :class => "title_link", :rel => "nofollow" %>
2
2
  - <%= link_to t('muck.raker.related_resources'), resource_path(related_entry.dest_entry_id), :class => "related_resources_link", :rel => "nofollow" %>
3
3
  <% if !related_entry.direct_link.nil? %> - <%= link_to t('muck.raker.metadata'), "/r?id=#{related_entry.id}&target=metadata", :class => "catalog_link" %><% end %>
4
4
  <% if related_entry.description.length > 0 %><br/><span class="description"><%= truncate_words(related_entry.description) %></span><% end %>
@@ -1,4 +1,4 @@
1
- <% link = result.direct_link.nil? ? result.permalink : result.direct_link %>
1
+ <% link = visit_path(result) %>
2
2
  <p>
3
3
  <%= link_to result.title + " (" + result.collection + ")", link, :class => "title_link", :rel => "nofollow" %>
4
4
  - <%= link_to t('muck.raker.related_resources'), resource_path(result), :class => "related_resources_link", :rel => "nofollow" %>
@@ -1,7 +1,20 @@
1
1
  <tr>
2
+ <% if defined?(show_admin) && show_admin -%>
3
+ <td>
4
+ <% form_for(feed, :url => admin_feed_path(feed), :html => { :method => :put }) do |f| -%>
5
+ <% if feed.banned? -%>
6
+ <%= hidden_field_tag :status, 'unban' %>
7
+ <%= image_submit_tag '/images/icons/exclaim.png', {:width => '15', :height => '15', :alt => t('muck.raker.validate_feed') } %>
8
+ <% else -%>
9
+ <%= hidden_field_tag :status, 'ban' %>
10
+ <%= image_submit_tag '/images/icons/accept.png', {:width => '15', :height => '15', :alt => t('muck.raker.ban_feed') } %>
11
+ <% end -%>
12
+ <% end -%>
13
+ </td>
14
+ <% end -%>
2
15
  <td><%= link_to h(feed.title || feed.display_uri), feed_path(feed) %> <%= link_to t('muck.raker.visit'), feed.display_uri, :target => '_blank' %></td>
3
16
  <td><%= h feed.description %></td>
4
- <td><%= feed.refresh_interval_hours %></td>
17
+ <td><%= feed.harvest_interval_hours %></td>
5
18
  <td><%= feed.last_harvested_at %></td>
6
19
  <td><%= feed.failed_requests %></td>
7
20
  <td><%= feed.error_message ? t('muck.raker.failed_last_request', :error => feed.error_message) : feed.status >= 0 ? t('muck.raker.ok') : t('muck.raker.banned') %></td>
@@ -96,7 +96,7 @@ function validate()
96
96
 
97
97
  <p>
98
98
  <b>How Often to Harvest the Collection</b><br />
99
- <%= select :feed, "refresh_interval_hours", [["Once a day", "24"], ["Once a week", "168"], ["Once a month", "672"]] %>
99
+ <%= select :feed, "harvest_interval_hours", [["Once a day", "24"], ["Once a week", "168"], ["Once a month", "672"]] %>
100
100
  </p>
101
101
 
102
102
  <p>
@@ -12,9 +12,9 @@
12
12
  </div>
13
13
  <% content_for :javascript do -%>
14
14
  jQuery(document).ready(function() {
15
- jQuery('#add_feed_uri').onclick({
16
- jQuery(this).hide();
17
- jQuery('#finding_uri_message').show();
18
- });
15
+ jQuery('#add_feed_uri').onclick({
16
+ jQuery(this).hide();
17
+ jQuery('#finding_uri_message').show();
18
+ });
19
19
  });
20
20
  <% end -%>
@@ -1,12 +1,12 @@
1
1
  <%
2
- @json_recommendations = @document.json_recommendations(@limit, params[:order] || "mixed", true, params[:omit_feeds] || nil)
2
+ @json_recommendations = @entry.json_recommendations(@limit, params[:order] || "mixed", true, params[:omit_feeds] || nil)
3
3
  if !@json_recommendations.nil?
4
- @direct_link_text = params[:direct_link_text] || t(:direct_link)
4
+ @direct_link_text = params[:direct_link_text] || t('muck.raker.direct_link')
5
5
  %>
6
- var catalog_page = <%= !@document.direct_link.nil? and @uri == @document.permalink %>;
6
+ var catalog_page = <%= !@entry.direct_link.nil? and @uri == @entry.permalink %>;
7
7
  var document_host = '<%= @host %>';
8
8
  var recs = <%= @json_recommendations %>;
9
- var app = "http://www.oerrecommender.org/";
9
+ var app = "http://folksemantic.com/";
10
10
  <% if @details == true -%>
11
11
  function truncate(text, length) {
12
12
  nEnd = text.indexOf(" ", 200);
@@ -21,10 +21,10 @@ function format_date(published_at) {
21
21
  }
22
22
  <% end %>
23
23
  document.write('<div class="oer_recommender_container">');
24
- <% if params[:title] %>document.write('<div class="oer_recommender_title"><%= t(:gm_title) %></div>');<% end %>
24
+ <% if params[:title] %>document.write('<div class="oer_recommender_title"><%= t('muck.raker.gm_title') %></div>');<% end %>
25
25
  document.write('<div class="oer_recommender_list">');
26
26
  for(nRec = 0; nRec < recs.length; nRec++) {
27
- r = recs[nRec];
27
+ r = recs[nRec].entry;
28
28
  metadata_link = catalog_page && document_host == r.uri.substring(0, document_host.length);
29
29
  direct_link = metadata_link && r.direct_link;
30
30
  document.write('<p class="oer_recommender_item">');
@@ -32,13 +32,13 @@ for(nRec = 0; nRec < recs.length; nRec++) {
32
32
  if (direct_link) document.write(' <a class="oer_recommender_direct_link" href="' + app + 'r?id=' + r.id + '&target=direct_link"><%= @direct_link_text %></a>');
33
33
  <% if @details == true -%>
34
34
  document.write(' <span class="oer_recommender_published_at">(' + format_date(r.published_at) + ')</span>');
35
- document.write(' <span class="oer_recommender_relevance_score"><%= t(:relevance)%>: ' + Math.round(r.relevance*100)/100 + '</span>');
35
+ document.write(' <span class="oer_recommender_relevance_score"><%= t('muck.raker.relevance')%>: ' + Math.round(r.relevance*100)/100 + '</span>');
36
36
  document.write('<br/><span class="oer_recommender_description">' + truncate(r.description) + '</span>');
37
37
  document.write('<br/><span class="oer_recommender_uri">' + r.uri + '</span>');
38
38
  <% end -%>
39
39
  document.write('</a></p>');
40
40
  }
41
41
  document.write('</div>');
42
- <% if params[:more_link] %>document.write('<div class="oer_recommender_more_link"><a href="' + app + 'documents/<%= @document.id %>"><%= t(:gm_more_prompt) %></a></div>');<% end %>
42
+ <% if params[:more_link] %>document.write('<div class="oer_recommender_more_link"><a href="' + app + 'documents/<%= @entry.id %>"><%= t('muck.raker.gm_more_prompt') %></a></div>');<% end %>
43
43
  document.write('</div>');
44
44
  <% end %>
@@ -1,7 +1,7 @@
1
- if @document.nil?
1
+ if @entry.nil?
2
2
  @recommendations = Array.new
3
3
  else
4
- @recommendations = @document.ranked_recommendations(@limit, params[:order] || "mixed")
4
+ @recommendations = @entry.ranked_recommendations(@limit, params[:order] || "mixed")
5
5
  end
6
6
 
7
7
  headers["Content-Type"] = "application/rss+xml"
@@ -10,7 +10,7 @@ xml.instruct!
10
10
  xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/", "xmlns:oerr" => "http://www.oerrecommender.org/oerr/elements/1.0/" do
11
11
  xml.channel do
12
12
 
13
- xml.title "OER Recommender recommendations for " + @document.permalink
13
+ xml.title "OER Recommender recommendations for " + @entry.permalink
14
14
  xml.link url_for(request.env["REQUEST_URI"])
15
15
  # xml.pubDate CGI.rfc1123_date @entries.first.updated_at if @entries.any?
16
16
  # xml.description "Blog posts for " + @event.title
@@ -1,23 +1,23 @@
1
1
  xml.instruct!
2
2
 
3
- if @document.nil?
3
+ if @entry.nil?
4
4
  xml.recommendations
5
5
  else
6
6
 
7
- @recommendations = @document.ranked_recommendations(@limit, params[:order] || "mixed", @details)
8
- #xml.recommendations(:document_id => @document.nil? ? "" : @document.id, :uri => @uri, :title => t(:gm_title), :more_prompt => t(:gm_more_prompt), :direct_link_text => t(:direct_link), :locale => @document.language) do
9
- xml.recommendations(:document_id => @document.nil? ? "" : @document.id, :uri => @uri, :title => t("muck.raker.gm_title"), :more_prompt => t("muck.raker.gm_more_prompt"), :direct_link_text => t("muck.raker.direct_link")) do
7
+ @recommendations = @entry.ranked_recommendations(@limit, params[:order] || "mixed", @details)
8
+ #xml.recommendations(:document_id => @entry.nil? ? "" : @entry.id, :uri => @uri, :title => t(:gm_title), :more_prompt => t(:gm_more_prompt), :direct_link_text => t(:direct_link), :locale => @entry.language) do
9
+ xml.recommendations(:document_id => @entry.nil? ? "" : @entry.id, :uri => @uri, :title => t("muck.raker.gm_title"), :more_prompt => t("muck.raker.gm_more_prompt"), :direct_link_text => t("muck.raker.direct_link")) do
10
10
  @recommendations.each do |recommendation|
11
11
  xml.recommendation do
12
12
  xml.title recommendation["title"]
13
13
  xml.collection recommendation["collection"]
14
- # xml.link "http://www.folksemantic.com/r?id=" + recommendation["id"].to_s
15
- xml.link "http://localhost:3000/r?id=" + recommendation["id"].to_s
14
+ xml.link "http://folksemantic.com/r?id=" + recommendation["recommendation_id"].to_s
15
+ # xml.link "http://localhost:3000/r?id=" + recommendation["recommendation_id"].to_s
16
16
  xml.has_direct_link "true" if (recommendation["direct_link"] != nil and @uri[0..20] == recommendation["uri"][0..20])
17
17
 
18
18
  if @details == true
19
- # xml.direct_link "http://www.folksemantic.com/r?id=" + recommendation["recommendation_id"].to_s + "&u=" + recommendation["direct_link"] if recommendation["direct_link"] != nil
20
- xml.direct_link "http://localhost:3000/r?id=" + recommendation["id"].to_s + "&u=" + recommendation["direct_link"] if recommendation["direct_link"] != nil
19
+ xml.direct_link "http://www.folksemantic.com/r?id=" + recommendation["recommendation_id"].to_s + "&u=" + recommendation["direct_link"] if recommendation["direct_link"] != nil
20
+ # xml.direct_link "http://localhost:3000/r?id=" + recommendation["id"].to_s + "&u=" + recommendation["direct_link"] if recommendation["direct_link"] != nil
21
21
  xml.uri recommendation["uri"]
22
22
  xml.direct_uri recommendation["direct_link"]
23
23
  xml.description recommendation["description"]