logilogi-svn Mailing List for LogiLogi - Software Libre for the Web (Page 59)
Status: Beta
Brought to you by:
wybow
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
(7) |
Apr
(18) |
May
(59) |
Jun
(73) |
Jul
(31) |
Aug
(19) |
Sep
(18) |
Oct
(31) |
Nov
(9) |
Dec
(15) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(30) |
Feb
(62) |
Mar
(70) |
Apr
(75) |
May
(139) |
Jun
(85) |
Jul
(28) |
Aug
(33) |
Sep
(145) |
Oct
(45) |
Nov
(76) |
Dec
(48) |
| 2009 |
Jan
(12) |
Feb
(39) |
Mar
(5) |
Apr
(6) |
May
(23) |
Jun
(44) |
Jul
(17) |
Aug
(15) |
Sep
(49) |
Oct
(28) |
Nov
(14) |
Dec
(6) |
| 2010 |
Jan
(22) |
Feb
(24) |
Mar
(14) |
Apr
(3) |
May
(2) |
Jun
(30) |
Jul
(9) |
Aug
(9) |
Sep
(10) |
Oct
(1) |
Nov
|
Dec
(1) |
| 2011 |
Jan
(2) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <wy...@us...> - 2007-05-21 20:49:06
|
Revision: 303
http://logilogi.svn.sourceforge.net/logilogi/?rev=303&view=rev
Author: wybow
Date: 2007-05-21 13:48:20 -0700 (Mon, 21 May 2007)
Log Message:
-----------
Further truncating, and all viewpoints are now listed with a post.
Modified Paths:
--------------
projects/ogog/trunk/app/views/post/_post.rhtml
projects/ogog/trunk/app/views/post/_viewpoints.rhtml
Modified: projects/ogog/trunk/app/views/post/_post.rhtml
===================================================================
--- projects/ogog/trunk/app/views/post/_post.rhtml 2007-05-21 18:04:32 UTC (rev 302)
+++ projects/ogog/trunk/app/views/post/_post.rhtml 2007-05-21 20:48:20 UTC (rev 303)
@@ -6,7 +6,7 @@
:locals => {:tagging => tagging} %>
</tr>
<tr><td colspan="2" class="title">
- <h5><%= link_to_post(truncate(post.title, 40), post, Context.current.tag) %></h5>
+ <h5><%= link_to_post(truncate(post.title, 35), post, Context.current.tag) %></h5>
</td></tr>
<tr><td colspan="3" class="snippet">
<%= post.snippet + link_to_post(' ...read on', post, Context.current.tag) %>
Modified: projects/ogog/trunk/app/views/post/_viewpoints.rhtml
===================================================================
--- projects/ogog/trunk/app/views/post/_viewpoints.rhtml 2007-05-21 18:04:32 UTC (rev 302)
+++ projects/ogog/trunk/app/views/post/_viewpoints.rhtml 2007-05-21 20:48:20 UTC (rev 303)
@@ -1,7 +1,7 @@
<div id="viewpoints" class="box small">
- <h3 class="title">Other Viewpoints</h3>
+ <h3 class="title">Viewpoints</h3>
<table>
- <% taggings.reject {|t| t == current_tagging}.each do |tagging| %>
+ <% taggings.each do |tagging| %>
<tr>
<td class="score"><%= tagging_score(tagging) %></td>
<td class="tag">from <%= link_to_post(truncate(tagging.tag.to_s, 12), post, tagging.tag) %></td>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-21 18:11:46
|
Revision: 302
http://logilogi.svn.sourceforge.net/logilogi/?rev=302&view=rev
Author: wybow
Date: 2007-05-21 11:04:32 -0700 (Mon, 21 May 2007)
Log Message:
-----------
Added integration-test and set truncate for tags everywhere...
Modified Paths:
--------------
projects/ogog/trunk/app/helpers/application_helper.rb
projects/ogog/trunk/app/helpers/post_helper.rb
projects/ogog/trunk/app/models/feed.rb
projects/ogog/trunk/test/unit/feed_test.rb
Added Paths:
-----------
projects/ogog/trunk/test/integration/visits_test.rb
Modified: projects/ogog/trunk/app/helpers/application_helper.rb
===================================================================
--- projects/ogog/trunk/app/helpers/application_helper.rb 2007-05-21 16:51:46 UTC (rev 301)
+++ projects/ogog/trunk/app/helpers/application_helper.rb 2007-05-21 18:04:32 UTC (rev 302)
@@ -3,7 +3,7 @@
include Rubaidh::TabularForm
def link_to_tag(tag, options = {})
- link_to(tag.to_s, index_url({:link_string => tag.to_s}),options)
+ link_to(truncate(tag.to_s, 15), index_url({:link_string => tag.to_s}),options)
end
def link_to_post(string, post, tag, options = {})
Modified: projects/ogog/trunk/app/helpers/post_helper.rb
===================================================================
--- projects/ogog/trunk/app/helpers/post_helper.rb 2007-05-21 16:51:46 UTC (rev 301)
+++ projects/ogog/trunk/app/helpers/post_helper.rb 2007-05-21 18:04:32 UTC (rev 302)
@@ -3,7 +3,7 @@
link = Context.current.link
link_url = '<ul>'
(0...(link.size(options[:direction]))).each { |i|
- link_url += '<li>' + link_to(link.tags(options[:direction])[i],
+ link_url += '<li>' + link_to(truncate(link.tags(options[:direction])[i].to_s, 15),
{:action => 'index', :link_string => link.to_s(
:direction => options[:direction], :step => i)}) +
'</li><li><span class="slash_separator">/</span></li>'
@@ -29,7 +29,7 @@
def link_to_cloud_tag(tag, css_class)
context = Context.current
- link = '<span class="cloud ' + css_class + '">' + link_to(truncate(tag.to_s, 20), index_url({:link_string => tag.to_s})) + ' '
+ link = '<span class="cloud ' + css_class + '">' + link_to(truncate(tag.to_s, 12), index_url({:link_string => tag.to_s})) + ' '
if tag != Tag.overall && !context.link.requested_tags.include?(tag)
link << link_to('/+', index_url({:link_string => context.link.to_s + '/' + tag.to_s}))
else
Modified: projects/ogog/trunk/app/models/feed.rb
===================================================================
--- projects/ogog/trunk/app/models/feed.rb 2007-05-21 16:51:46 UTC (rev 301)
+++ projects/ogog/trunk/app/models/feed.rb 2007-05-21 18:04:32 UTC (rev 302)
@@ -31,7 +31,7 @@
### Regular expressions
- URL = /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
+ URL = /^(http|https):\/\/[a-z0-9]+([\-\.a-z0-9])*(\.[a-z]{2,5}|:)([\/\-\.a-z0-9].*)?$/ix
### Validations
Added: projects/ogog/trunk/test/integration/visits_test.rb
===================================================================
--- projects/ogog/trunk/test/integration/visits_test.rb (rev 0)
+++ projects/ogog/trunk/test/integration/visits_test.rb 2007-05-21 18:04:32 UTC (rev 302)
@@ -0,0 +1,50 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class VisitsTest < ActionController::IntegrationTest
+ fixtures AllFixtures
+ # AllFixtures set in test_helper
+
+ def test_visits
+ # Normal pages
+ assert_visit main_url
+ assert_visit 'Overall'
+ assert_visit 'Rocks/Ducks'
+ assert_visit 'Plane'
+
+ # Specific pages
+ assert_visit 'do/feed/new'
+ assert_visit 'do/doc/tour'
+ assert_visit 'do/doc/faq'
+ assert_visit 'do/doc/api'
+ assert_visit 'do/doc/development'
+
+ # Content pages
+ assert_visit 'do/post/4/viewpoint/Overall'
+ assert_visit 'do/feed/3'
+ assert_visit 'do/user/kevin'
+
+ # Badges
+ assert_visit 'do/user/kevin/badge/Rocks'
+ assert_visit 'do/user/kevin/badge/Rocks.xml'
+ assert_visit 'do/user/kevin/badge/Rocks.json'
+ assert_visit 'do/user/kevin/badge/Rocks.png'
+ end
+
+ def assert_visit(url)
+ get url
+ assert_response :success
+ end
+end
Modified: projects/ogog/trunk/test/unit/feed_test.rb
===================================================================
--- projects/ogog/trunk/test/unit/feed_test.rb 2007-05-21 16:51:46 UTC (rev 301)
+++ projects/ogog/trunk/test/unit/feed_test.rb 2007-05-21 18:04:32 UTC (rev 302)
@@ -34,7 +34,7 @@
f = Feed.find(feeds(:lamas).id)
f.claim
f.reload
- assert_equal f.user, User.current
+ assert_equal User.current, f.user
end
def test_claim_link
@@ -43,7 +43,7 @@
f.site_url = 'http://localhost:3000/pub/test/lama/linkedindex.html'
f.claim
f.reload
- assert_equal f.user, User.current
+ assert_equal User.current, f.user
end
def test_claim_errors
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-21 16:56:25
|
Revision: 301
http://logilogi.svn.sourceforge.net/logilogi/?rev=301&view=rev
Author: wybow
Date: 2007-05-21 09:51:46 -0700 (Mon, 21 May 2007)
Log Message:
-----------
Checks for existence of added feeds now.
Modified Paths:
--------------
projects/ogog/trunk/app/controllers/feed_controller.rb
projects/ogog/trunk/app/models/feed.rb
Modified: projects/ogog/trunk/app/controllers/feed_controller.rb
===================================================================
--- projects/ogog/trunk/app/controllers/feed_controller.rb 2007-05-21 16:26:14 UTC (rev 300)
+++ projects/ogog/trunk/app/controllers/feed_controller.rb 2007-05-21 16:51:46 UTC (rev 301)
@@ -46,12 +46,20 @@
def create
@feed = Feed.new(:url => params[:feed][:url])
@feed.save
- @feed.harvest
- if !@feed.bad?
- redirect_to claim_feed_url(@feed)
+ if @feed.errors.empty?
+ @feed.harvest
+ if !@feed.bad?
+ redirect_to claim_feed_url(@feed)
+ else
+ flash[:error] = 'Your feed could not be processed, check the feed-status below'
+ redirect_to feed_url(@feed)
+ end
+ elsif Feed.find_by_url(params[:feed][:url])
+ flash[:notice] = 'Your feed has already been added'
+ redirect_to feed_url(Feed.find_by_url(params[:feed][:url]))
else
- flash[:error] = 'Your feed could not be processed, check the url or the feed-status below'
- redirect_to feed_url(@feed)
+ flash[:error] = 'Your feed could not be processed, your url seems invalid; did you prepend http:// as you shoud ?'
+ redirect_to new_feed_url()
end
end
Modified: projects/ogog/trunk/app/models/feed.rb
===================================================================
--- projects/ogog/trunk/app/models/feed.rb 2007-05-21 16:26:14 UTC (rev 300)
+++ projects/ogog/trunk/app/models/feed.rb 2007-05-21 16:51:46 UTC (rev 301)
@@ -29,10 +29,15 @@
NOT_PARSABLE = 5
NO_PUBLISH_DATE = 6
+ ### Regular expressions
+
+ URL = /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
+
### Validations
validates_presence_of :url
validates_uniqueness_of :url
+ validates_format_of :url, :with => URL
### Functions
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-21 16:27:53
|
Revision: 300
http://logilogi.svn.sourceforge.net/logilogi/?rev=300&view=rev
Author: wybow
Date: 2007-05-21 09:26:14 -0700 (Mon, 21 May 2007)
Log Message:
-----------
Some small updates, readme-fix...
Modified Paths:
--------------
trunk/app/controllers/download_controller.rb
trunk/app/views/layouts/main.rhtml
trunk/config/routes.rb
trunk/doc/README_FOR_APP
trunk/lib/task_helper.rb
trunk/public/stylesheets/logilogi.css
Modified: trunk/app/controllers/download_controller.rb
===================================================================
--- trunk/app/controllers/download_controller.rb 2007-05-21 10:23:59 UTC (rev 299)
+++ trunk/app/controllers/download_controller.rb 2007-05-21 16:26:14 UTC (rev 300)
@@ -16,11 +16,18 @@
Zip::ZipFile.open("tmp/source.zip", Zip::ZipFile::CREATE) {|zipfile|
globs = Array.new
files = Array.new
+ files.push("Rakefile",
+ "README")
globs.push(File.join("app","**", "*.rb"))
globs.push(File.join("components","**", "*.rb"))
globs.push(File.join("config","**", "*.tmpl"))
files.push("config/routes.rb",
- "config/boot.rb")
+ "config/config.rb",
+ "config/environment.rb",
+ "config/boot.rb",
+ "config/daemons.yml",
+ "config/config.rb")
+ globs.push(File.join("config/environments","**", "*.tmpl"))
globs.push(File.join("db","**", "*.rb"))
files.push("doc/LICENSE.txt",
"doc/README_FOR_APP",
Modified: trunk/app/views/layouts/main.rhtml
===================================================================
--- trunk/app/views/layouts/main.rhtml 2007-05-21 10:23:59 UTC (rev 299)
+++ trunk/app/views/layouts/main.rhtml 2007-05-21 16:26:14 UTC (rev 300)
@@ -10,6 +10,9 @@
</head>
<body>
<div id="container">
+ <div id="network-bar">
+ Part of the LogiLogi Network: <a href="http://foundation.logilogi.org">The LogiLogi Foundation</a> - <b>LogiLogi.org</b> - <a href="http://ogog.org">OgOg.org</a>
+ </div>
<div id="header">
<%= render :partial => 'main/nav_bar' %>
<div id="url_bar">
@@ -43,7 +46,7 @@
<a href="http://www.zis-groningen.nl"><img src="http://logilogi.org/img/zisgroningen.png" width="125" height="37" border="0" alt="Zylon Internet Services-Groningen Logo" /></a>
<a href="http://petition.eurolinux.org"><img src="http://logilogi.org/img/noepatent.jpg" border="0"></a><br />
<span id="copyright_notice">
- The LogiLogi-system is under the <a href="http://www.affero.org/oagpl.html">Affero GPL</a> which requires that the running sourcecode is always <%= link_to 'available for download', :controller => 'download', :action => 'source' %>.<br />
+ LogiLogi is Free Software and licensed under the <a href="http://www.affero.org/oagpl.html">Affero GPL</a> which means that the running version will always be <%= link_to 'available for download', :controller => 'download', :action => 'source' %>.<br />
All content is available under the <a href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>.<br /><br />
</span>
</center>
Modified: trunk/config/routes.rb
===================================================================
--- trunk/config/routes.rb 2007-05-21 10:23:59 UTC (rev 299)
+++ trunk/config/routes.rb 2007-05-21 16:26:14 UTC (rev 300)
@@ -37,6 +37,7 @@
:requirements => { :ll_link_string => /.*/ }
# Default route before the show_logi
+ map.default 'do/:controller/:action'
map.default 'do/:controller/:action/:id'
map.show ':ll_link_string',
Modified: trunk/doc/README_FOR_APP
===================================================================
--- trunk/doc/README_FOR_APP 2007-05-21 10:23:59 UTC (rev 299)
+++ trunk/doc/README_FOR_APP 2007-05-21 16:26:14 UTC (rev 300)
@@ -7,8 +7,8 @@
What LogiLogi Manta is ? There's short description at:
http://en.logilogi.org/MetaLogi/LogiLogiManta
-LogiLogi Manta is Free Software and Open Source, written in
-the spirit of the {Free Software Foundation}[http://www.fsf.org].
+LogiLogi Manta is Free Software and Open Source, written by the
+{LogiLogi Foundation}[http://foundation.logilogi.org].
== This Documentation
Modified: trunk/lib/task_helper.rb
===================================================================
--- trunk/lib/task_helper.rb 2007-05-21 10:23:59 UTC (rev 299)
+++ trunk/lib/task_helper.rb 2007-05-21 16:26:14 UTC (rev 300)
@@ -31,8 +31,8 @@
puts 'error: ' + error.inspect + ' ' + task
@subject = "#{task} broken"
@body = error
-# @recipients = 'log...@li...'
-# @from = 'ad...@lo...'
-# @sent_on = Time.now
+ @recipients = 'log...@li...'
+ @from = 'ad...@lo...'
+ @sent_on = Time.now
end
end
Modified: trunk/public/stylesheets/logilogi.css
===================================================================
--- trunk/public/stylesheets/logilogi.css 2007-05-21 10:23:59 UTC (rev 299)
+++ trunk/public/stylesheets/logilogi.css 2007-05-21 16:26:14 UTC (rev 300)
@@ -887,7 +887,6 @@
font-size: 0.8em;
}
-
/* SBMH -- see http://css-discuss.incutio.com/?page=BoxModelHack
* Stupid hack lets IE see 100%, others see 70%.
*/
@@ -910,3 +909,13 @@
top: 1.7em;
/* end of hack */
}
+
+/* Network-bar */
+
+#network-bar {
+ border-bottom: solid 3px #CCCCFF;
+ color: #818CB0;
+ font-size: 1.2em;
+ line-height: 1.6em;
+ text-align: center;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-21 10:24:01
|
Revision: 299
http://logilogi.svn.sourceforge.net/logilogi/?rev=299&view=rev
Author: wybow
Date: 2007-05-21 03:23:59 -0700 (Mon, 21 May 2007)
Log Message:
-----------
Truncate tags in other viewpoints display.
Modified Paths:
--------------
projects/ogog/trunk/app/views/post/_viewpoints.rhtml
Modified: projects/ogog/trunk/app/views/post/_viewpoints.rhtml
===================================================================
--- projects/ogog/trunk/app/views/post/_viewpoints.rhtml 2007-05-21 00:06:09 UTC (rev 298)
+++ projects/ogog/trunk/app/views/post/_viewpoints.rhtml 2007-05-21 10:23:59 UTC (rev 299)
@@ -4,7 +4,7 @@
<% taggings.reject {|t| t == current_tagging}.each do |tagging| %>
<tr>
<td class="score"><%= tagging_score(tagging) %></td>
- <td class="tag">from <%= link_to_post(truncate(tagging.tag.to_s, 15), post, tagging.tag) %></td>
+ <td class="tag">from <%= link_to_post(truncate(tagging.tag.to_s, 12), post, tagging.tag) %></td>
</tr>
<% end %>
</table>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-21 00:06:14
|
Revision: 298
http://logilogi.svn.sourceforge.net/logilogi/?rev=298&view=rev
Author: wybow
Date: 2007-05-20 17:06:09 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Fixed user-create bug that called find where the user did not yet
exist...
Modified Paths:
--------------
projects/ogog/trunk/app/controllers/user_controller.rb
Modified: projects/ogog/trunk/app/controllers/user_controller.rb
===================================================================
--- projects/ogog/trunk/app/controllers/user_controller.rb 2007-05-20 23:55:24 UTC (rev 297)
+++ projects/ogog/trunk/app/controllers/user_controller.rb 2007-05-21 00:06:09 UTC (rev 298)
@@ -16,7 +16,8 @@
### Filters
- before_filter :find
+ before_filter :find,
+ :except => [:new, :create]
before_filter :order_memberships,
: [:show]
before_filter :build_bodies
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 23:55:28
|
Revision: 297
http://logilogi.svn.sourceforge.net/logilogi/?rev=297&view=rev
Author: wybow
Date: 2007-05-20 16:55:24 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Fixed simple bug in viewpoint.rhtml.
Modified Paths:
--------------
projects/ogog/trunk/app/views/post/viewpoint.rhtml
Modified: projects/ogog/trunk/app/views/post/viewpoint.rhtml
===================================================================
--- projects/ogog/trunk/app/views/post/viewpoint.rhtml 2007-05-20 23:50:12 UTC (rev 296)
+++ projects/ogog/trunk/app/views/post/viewpoint.rhtml 2007-05-20 23:55:24 UTC (rev 297)
@@ -4,7 +4,7 @@
<h3 class="title">Post</h3>
<div class="post">
<table cellspacing=0 class="post">
- <tr id="post_top_block_score<%= post.id %>">
+ <tr id="post_top_block_score<%= @post.id %>">
<%= render :partial => 'post_top_block_score',
:locals => {:post => @post, :tagging => tagging} %>
</tr>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 23:50:24
|
Revision: 296
http://logilogi.svn.sourceforge.net/logilogi/?rev=296&view=rev
Author: wybow
Date: 2007-05-20 16:50:12 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Added link to MyOpenId
Modified Paths:
--------------
projects/ogog/trunk/app/views/account/signup.rhtml
Modified: projects/ogog/trunk/app/views/account/signup.rhtml
===================================================================
--- projects/ogog/trunk/app/views/account/signup.rhtml 2007-05-20 23:08:33 UTC (rev 295)
+++ projects/ogog/trunk/app/views/account/signup.rhtml 2007-05-20 23:50:12 UTC (rev 296)
@@ -7,7 +7,7 @@
<p>Besides this it also enables you to take your OgOg standing to other sites if you use it there.</p>
<h4>I don't have an OpenID yet</h4>
- <p>You can sign up for one here.</p>
+ <p>You can sign up for one <%= link_to 'here', 'https://www.myopenid.com/affiliate_signup?affiliate_id=612' %>.</p>
<p>You'll be redirected back and and then you'll get your account on OgOg.</p>
<h4>I already have an OpenID</h4>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 23:08:36
|
Revision: 295
http://logilogi.svn.sourceforge.net/logilogi/?rev=295&view=rev
Author: wybow
Date: 2007-05-20 16:08:33 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Source in subdirs to prevent problems with special system users for
the server.
Modified Paths:
--------------
projects/ogog/trunk/app/controllers/download_controller.rb
Added Paths:
-----------
projects/ogog/trunk/public/pub/source/
projects/ogog/trunk/tmp/source/
Modified: projects/ogog/trunk/app/controllers/download_controller.rb
===================================================================
--- projects/ogog/trunk/app/controllers/download_controller.rb 2007-05-20 22:56:38 UTC (rev 294)
+++ projects/ogog/trunk/app/controllers/download_controller.rb 2007-05-20 23:08:33 UTC (rev 295)
@@ -13,7 +13,7 @@
class DownloadController < ApplicationController
def regenerate_source_archive
- Zip::ZipFile.open("tmp/source.zip", Zip::ZipFile::CREATE) {|zipfile|
+ Zip::ZipFile.open("tmp/source/source.zip", Zip::ZipFile::CREATE) {|zipfile|
globs = Array.new
files = Array.new
files.push("Rakefile",
@@ -45,11 +45,11 @@
end
}
}
- File.rename("tmp/source.zip","public/source.zip")
+ File.rename("tmp/source/source.zip","public/pub/source/source.zip")
end
def source
self.regenerate_source_archive
- send_file "public/source.zip", :filename => 'source.zip'
+ send_file "public/pub/source/source.zip", :filename => 'source.zip'
end
end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 22:56:39
|
Revision: 294
http://logilogi.svn.sourceforge.net/logilogi/?rev=294&view=rev
Author: wybow
Date: 2007-05-20 15:56:38 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Fixed a small bug, unparsable begin-rescue now encloses entire resolve.
Modified Paths:
--------------
projects/ogog/trunk/app/models/feed.rb
Modified: projects/ogog/trunk/app/models/feed.rb
===================================================================
--- projects/ogog/trunk/app/models/feed.rb 2007-05-20 22:28:17 UTC (rev 293)
+++ projects/ogog/trunk/app/models/feed.rb 2007-05-20 22:56:38 UTC (rev 294)
@@ -68,44 +68,44 @@
if !self.bad?
begin
f = FeedTools::Feed.open(self.url)
- rescue
- self.status = NOT_PARSABLE
- end
- if self.title != f.title
- self.title = f.title
- end
- if self.site_url != f.link
- self.site_url = f.link
- end
- if self.title.nil?
- self.status = NO_TITLE
- end
- if self.site_url.nil?
- self.status = NO_SITE_URL
- end
- if !self.bad? and f.items.detect {|i| i.published.nil?}
- self.status = NO_PUBLISH_DATE
- end
- if !self.bad?
- f.items.select {|i| !self.harvested_publication_time or
- i.published > self.harvested_publication_time}.sort_by {|i| i.published}.each do |new_item|
- if !self.bad?
- p = Post.new(:feed => self, :title => new_item.title, :body => new_item.content,
- :url => new_item.link, :published_at => new_item.published.utc)
- if p.published_at > Time.now + 1.day
- self.status = FUTURE_DATE
+ if self.title != f.title
+ self.title = f.title
+ end
+ if self.site_url != f.link
+ self.site_url = f.link
+ end
+ if self.title.nil?
+ self.status = NO_TITLE
+ end
+ if self.site_url.nil?
+ self.status = NO_SITE_URL
+ end
+ if f.items.detect {|i| i.published.nil?}
+ self.status = NO_PUBLISH_DATE
+ end
+ if !self.bad?
+ f.items.select {|i| !self.harvested_publication_time or
+ i.published > self.harvested_publication_time}.sort_by {|i| i.published}.each do |new_item|
+ if !self.bad?
+ p = Post.new(:feed => self, :title => new_item.title, :body => new_item.content,
+ :url => new_item.link, :published_at => new_item.published.utc)
+ if p.published_at > Time.now + 1.day
+ self.status = FUTURE_DATE
+ end
+ if !p.valid?
+ self.status = INCOMPLETE_POSTS
+ end
end
- if !p.valid?
- self.status = INCOMPLETE_POSTS
- end
+ if !self.bad?
+ p.save
+ p.set_tags(Feed.get_item_tags(new_item) + self.tag_strings)
+ # At least one tag is set, guaranteed...
+ self.harvested_publication_time = p.published_at
+ end
end
- if !self.bad?
- p.save
- p.set_tags(Feed.get_item_tags(new_item) + self.tag_strings)
- # At least one tag is set, guaranteed...
- self.harvested_publication_time = p.published_at
- end
end
+ rescue
+ self.status = NOT_PARSABLE
end
self.save
end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 22:28:20
|
Revision: 293
http://logilogi.svn.sourceforge.net/logilogi/?rev=293&view=rev
Author: wybow
Date: 2007-05-20 15:28:17 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Moved feedharvester to tools, updated do_docs & link.
Modified Paths:
--------------
projects/ogog/trunk/app/views/doc/development.rhtml
projects/ogog/trunk/lib/tasks/do_docs.rake
Added Paths:
-----------
projects/ogog/trunk/lib/tools/feedharvester.rb
Removed Paths:
-------------
projects/ogog/trunk/lib/feedharvester.rb
Modified: projects/ogog/trunk/app/views/doc/development.rhtml
===================================================================
--- projects/ogog/trunk/app/views/doc/development.rhtml 2007-05-20 22:04:00 UTC (rev 292)
+++ projects/ogog/trunk/app/views/doc/development.rhtml 2007-05-20 22:28:17 UTC (rev 293)
@@ -7,7 +7,7 @@
<h4>Mailinglist</h4>
<p>While still low volume we discuss OgOg together with our other projects on <%= link_to 'logilogi-list', 'https://lists.sourceforge.net/lists/listinfo/logilogi-list' %></p>
<h4>Docs</h4>
- <p>Rails docs can be browsed <%= link_to 'here', 'http://www.ogog.org/pub/docs' %></p>
+ <p>Rails docs can be browsed <%= link_to 'here', 'http://www.ogog.org/pub/docs/app' %></p>
<h4>Sourcecode</h4>
<p>You can get the Sourcecode of OgOg through svn at:</p>
<span class="code">https://logilogi.svn.sourceforge.net/ svnroot/logilogi/projects/ogog/trunk</span>
Deleted: projects/ogog/trunk/lib/feedharvester.rb
===================================================================
--- projects/ogog/trunk/lib/feedharvester.rb 2007-05-20 22:04:00 UTC (rev 292)
+++ projects/ogog/trunk/lib/feedharvester.rb 2007-05-20 22:28:17 UTC (rev 293)
@@ -1,32 +0,0 @@
-#!/usr/bin/env ruby
-
-#You might want to change this
-ENV["RAILS_ENV"] ||= "production"
-
-require File.dirname(__FILE__) + "/../../config/environment"
-
-rules = Scraper.define do
- array :tags
- process 'ul.memberdetails>li:nth-child(4)>a', :url=> "@href"
- process 'ul.memberdetails>li:nth-child(5)>a', :tags=> :text
- result :url, :tags
-end
-
-# http://9rules.com/member/10/
-#res = rules.scrape (URI.parse('http://127.0.0.1:3000/pub/test/rules.htm'))
-
-puts '## Harvesting feeds...'
-601.upto(1226) do |i|
- puts i
- res = rules.scrape(URI.parse('http://9rules.com/member/' + i.to_s + '/'))
- if res.url and !res.url.empty?
- feed = Feed.new(:url => res.url, :tags_string => res.tags.join(','))
- feed.save
- feed.harvest
- if feed.bad?
- puts 'bad'
- else
- puts 'ok'
- end
- end
-end
Modified: projects/ogog/trunk/lib/tasks/do_docs.rake
===================================================================
--- projects/ogog/trunk/lib/tasks/do_docs.rake 2007-05-20 22:04:00 UTC (rev 292)
+++ projects/ogog/trunk/lib/tasks/do_docs.rake 2007-05-20 22:28:17 UTC (rev 293)
@@ -1,7 +1,7 @@
task :do_docs do
sh "rake doc:app" do |ok, res|
if ok
- sh "rsync -a --delete doc/app wy...@lo...:/var/www/ogog/pub/docs"
+ sh "rsync -a --delete doc/app wy...@lo...:/var/www/ogog/public/pub/docs"
else
puts res.to_s
end
Copied: projects/ogog/trunk/lib/tools/feedharvester.rb (from rev 291, projects/ogog/trunk/lib/feedharvester.rb)
===================================================================
--- projects/ogog/trunk/lib/tools/feedharvester.rb (rev 0)
+++ projects/ogog/trunk/lib/tools/feedharvester.rb 2007-05-20 22:28:17 UTC (rev 293)
@@ -0,0 +1,32 @@
+#!/usr/bin/env ruby
+
+#You might want to change this
+ENV["RAILS_ENV"] ||= "production"
+
+require File.dirname(__FILE__) + "/../../config/environment"
+
+rules = Scraper.define do
+ array :tags
+ process 'ul.memberdetails>li:nth-child(4)>a', :url=> "@href"
+ process 'ul.memberdetails>li:nth-child(5)>a', :tags=> :text
+ result :url, :tags
+end
+
+# http://9rules.com/member/10/
+#res = rules.scrape (URI.parse('http://127.0.0.1:3000/pub/test/rules.htm'))
+
+puts '## Harvesting feeds...'
+601.upto(1226) do |i|
+ puts i
+ res = rules.scrape(URI.parse('http://9rules.com/member/' + i.to_s + '/'))
+ if res.url and !res.url.empty?
+ feed = Feed.new(:url => res.url, :tags_string => res.tags.join(','))
+ feed.save
+ feed.harvest
+ if feed.bad?
+ puts 'bad'
+ else
+ puts 'ok'
+ end
+ end
+end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 22:04:03
|
Revision: 292
http://logilogi.svn.sourceforge.net/logilogi/?rev=292&view=rev
Author: wybow
Date: 2007-05-20 15:04:00 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Fixed some bugs...
Modified Paths:
--------------
projects/ogog/trunk/app/models/feed.rb
projects/ogog/trunk/app/models/link.rb
projects/ogog/trunk/app/models/post.rb
projects/ogog/trunk/app/models/tagging.rb
projects/ogog/trunk/doc/README_FOR_APP
projects/ogog/trunk/lib/task_helper.rb
projects/ogog/trunk/lib/tasks/do_check_commit.rake
projects/ogog/trunk/test/unit/context_test.rb
projects/ogog/trunk/test/unit/membership_test.rb
projects/ogog/trunk/test/unit/post_test.rb
projects/ogog/trunk/test/unit/tagging_test.rb
Modified: projects/ogog/trunk/app/models/feed.rb
===================================================================
--- projects/ogog/trunk/app/models/feed.rb 2007-05-20 21:03:44 UTC (rev 291)
+++ projects/ogog/trunk/app/models/feed.rb 2007-05-20 22:04:00 UTC (rev 292)
@@ -46,6 +46,14 @@
end
end
+ # Harvests all feeds
+ #
+ def self.harvest
+ Feed.find(:all).each do |feed|
+ feed.harvest
+ end
+ end
+
### Methods
# Returns true if the status is anything but GOOD
@@ -135,6 +143,10 @@
# Ad hoc, returns the tag-strings for this feed.
#
def tag_strings
- self.tags_string.split(',')
+ if self.tags_string
+ self.tags_string.split(',')
+ else
+ []
+ end
end
end
Modified: projects/ogog/trunk/app/models/link.rb
===================================================================
--- projects/ogog/trunk/app/models/link.rb 2007-05-20 21:03:44 UTC (rev 291)
+++ projects/ogog/trunk/app/models/link.rb 2007-05-20 22:04:00 UTC (rev 292)
@@ -42,12 +42,14 @@
#
def resolve
existing_tags = self.existing_requested_tags
- while !Tagging.any_posts_for?(existing_tags) and !self.overall_tags?(existing_tags) > 0
+ while existing_tags.size > 0 and
+ !self.overall_tags?(existing_tags) and
+ !Tagging.any_posts_for?(existing_tags)
existing_tags.shift
- if existing_tags.size == 0
- existing_tags.push(Tag.overall)
- end
end
+ if existing_tags.size == 0
+ existing_tags.push(Tag.overall)
+ end
self.received_tags = existing_tags
end
Modified: projects/ogog/trunk/app/models/post.rb
===================================================================
--- projects/ogog/trunk/app/models/post.rb 2007-05-20 21:03:44 UTC (rev 291)
+++ projects/ogog/trunk/app/models/post.rb 2007-05-20 22:04:00 UTC (rev 292)
@@ -69,7 +69,12 @@
#
def tag(tag)
if !self.taggings.find_by_tag_id(tag.id)
- self.taggings.create(:post => self, :tag => tag, :score => self.feed.user.score_for(tag))
+ if !self.feed.user.nil?
+ score = self.feed.user.score_for(tag)
+ else
+ score = 0.0
+ end
+ self.taggings.create(:post => self, :tag => tag, :score => score)
end
end
Modified: projects/ogog/trunk/app/models/tagging.rb
===================================================================
--- projects/ogog/trunk/app/models/tagging.rb 2007-05-20 21:03:44 UTC (rev 291)
+++ projects/ogog/trunk/app/models/tagging.rb 2007-05-20 22:04:00 UTC (rev 292)
@@ -160,7 +160,7 @@
# Returns true if this tagging was rated.
#
def rated?
- return !self.weight == 0
+ return self.weight != 0.0
end
# Calculates the amount of power this tagging generates for the
Modified: projects/ogog/trunk/doc/README_FOR_APP
===================================================================
--- projects/ogog/trunk/doc/README_FOR_APP 2007-05-20 21:03:44 UTC (rev 291)
+++ projects/ogog/trunk/doc/README_FOR_APP 2007-05-20 22:04:00 UTC (rev 292)
@@ -75,6 +75,11 @@
You're all set.
+=== Testing notes
+
+Note that for the unit-tests to succeed you must have an OgOg server
+running at localhost...
+
=== Installation Notes
If you are on Ubuntu or Debian the following packages will give you:
Modified: projects/ogog/trunk/lib/task_helper.rb
===================================================================
--- projects/ogog/trunk/lib/task_helper.rb 2007-05-20 21:03:44 UTC (rev 291)
+++ projects/ogog/trunk/lib/task_helper.rb 2007-05-20 22:04:00 UTC (rev 292)
@@ -14,12 +14,25 @@
# For checking commits
#
-class CommitCheckNotifier < ActionMailer::Base
- def failure(error)
- @subject = "Build broken"
+class ErrorNotifier < ActionMailer::Base
+ # Functions
+ def self.run_and_report_if_erred(shell_line, task = 'Script')
+ puts shell_line
+ output = `#{shell_line}`
+ process = $?
+ if process.exitstatus != 0
+ ErrorNotifier.deliver_failure(output, task)
+ break
+ end
+ end
+
+ # Methods
+ def failure(error, task)
+ puts 'error: ' + error.inspect + ' ' + task
+ @subject = "#{task} broken"
@body = error
- @recipients = ENV['USER']
- @from = 'admin'
- @sent_on = Time.now
+# @recipients = 'log...@li...'
+# @from = 'ad...@lo...'
+# @sent_on = Time.now
end
end
Modified: projects/ogog/trunk/lib/tasks/do_check_commit.rake
===================================================================
--- projects/ogog/trunk/lib/tasks/do_check_commit.rake 2007-05-20 21:03:44 UTC (rev 291)
+++ projects/ogog/trunk/lib/tasks/do_check_commit.rake 2007-05-20 22:04:00 UTC (rev 292)
@@ -2,9 +2,11 @@
require File.join(File.dirname(__FILE__), '../task_helper.rb')
runs = [
"cd /tmp; svn co https://svn.sourceforge.net/svnroot/logilogi/projects/ogog/trunk ogog-test",
+ "cp -f config/environment.rb.tmpl /tmp/ogog-test/config/environment.rb",
"cp -f config/database.yml.tmpl /tmp/ogog-test/config/database.yml",
+# "cd /tmp/ogog-test; rake test"]
"cd /tmp/ogog-test; rake test"]
runs.each do |run|
- ErrorNotifier.run_and_report_if_erred(run, 'Build')
+# CheckNotifier.run_and_report_if_erred(run, 'Build')
end
end
Modified: projects/ogog/trunk/test/unit/context_test.rb
===================================================================
--- projects/ogog/trunk/test/unit/context_test.rb 2007-05-20 21:03:44 UTC (rev 291)
+++ projects/ogog/trunk/test/unit/context_test.rb 2007-05-20 22:04:00 UTC (rev 292)
@@ -24,11 +24,11 @@
assert !c.link.received_tags.empty?
assert_equal ducks, c.tag
- c = Context.new(Link.new_from_s('planes'))
- c.resolve
- assert_equal Tag.overall, c.tag
+ c2 = Context.new(Link.new_from_s('planes'))
+ c2.resolve
+ assert_equal Tag.overall, c2.tag
- c = Context.new(ducks)
- assert_equal ducks, c.tag
+ c3 = Context.new(ducks)
+ assert_equal ducks, c3.tag
end
end
Modified: projects/ogog/trunk/test/unit/membership_test.rb
===================================================================
--- projects/ogog/trunk/test/unit/membership_test.rb 2007-05-20 21:03:44 UTC (rev 291)
+++ projects/ogog/trunk/test/unit/membership_test.rb 2007-05-20 22:04:00 UTC (rev 292)
@@ -30,6 +30,6 @@
def test_calculate_scores
Membership.calculate_scores(2)
- assert_equal 2.45, Membership.find(memberships(:kevin_overall).id).score.to_f
+ assert_equal 1.95, Membership.find(memberships(:kevin_overall).id).score.to_f
end
end
Modified: projects/ogog/trunk/test/unit/post_test.rb
===================================================================
--- projects/ogog/trunk/test/unit/post_test.rb 2007-05-20 21:03:44 UTC (rev 291)
+++ projects/ogog/trunk/test/unit/post_test.rb 2007-05-20 22:04:00 UTC (rev 292)
@@ -24,19 +24,21 @@
def test_set_tags
f = Feed.find(feeds(:lamas).id)
- p = Post.new(:url => "http://localhost:3000/pub/test/lama/posts/post1.html")
+ p = Post.new(:feed => f, :url => "http://localhost:3000/pub/test/lama/posts/post1.html")
+ p.save
p.set_tags(["Cow", "Farm"])
cow = Tag.or_new_from_s("Cow")
farm = Tag.or_new_from_s("Farm")
overall = Tag.or_new_from_s("Overall")
assert_equal [cow, farm, overall], p.taggings.collect {|ta| ta.tag}
- p2 = Post.new(:url => "http://localhost:3000/pub/test/lama/posts/post1.html")
- p2.set_tags([]) # tags taken from rel=tag links
+ p = Post.new(:feed => f, :url => "http://localhost:3000/pub/test/lama/posts/post1.html")
+ p.save
+ p.set_tags([]) # tags taken from rel=tag links
open_content = Tag.or_new_from_s("Open content")
patent_abuse = Tag.or_new_from_s("Patent abuse")
software_patents = Tag.or_new_from_s("Software patents")
- assert_equal [open_content, patent_abuse, software_patents, overall], p2.taggings.collect {|ta| ta.tag}
+ assert_equal [open_content, patent_abuse, software_patents, overall], p.taggings.collect {|ta| ta.tag}
end
def test_validation
@@ -82,7 +84,7 @@
tagging.reload
assert tagging.rated?
assert_equal 5, tagging.score
- assert_equal Membership.anonymous_voting_power, tagging.weight
+ assert_equal Membership.account_voting_power, tagging.weight
t2 = Tag.find(tags(:moontravel).id)
tagging2 = p.taggings.find_by_tag_id(t2.id)
Modified: projects/ogog/trunk/test/unit/tagging_test.rb
===================================================================
--- projects/ogog/trunk/test/unit/tagging_test.rb 2007-05-20 21:03:44 UTC (rev 291)
+++ projects/ogog/trunk/test/unit/tagging_test.rb 2007-05-20 22:04:00 UTC (rev 292)
@@ -20,7 +20,7 @@
def test_tracking_negativity
rocks = Tag.find(tags(:rocks).id)
kevins_blog_post = Post.find(posts(:kevins_blog_post).id)
- t = Tagging.new(:tag => rocks, :post => kevins_blog_post, :score => -1)
+ t = Tagging.new(:tag => rocks, :post => kevins_blog_post, :score => -1, :weight => 0.1)
t.save
t.reload
assert t.negative_as_of
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 21:05:06
|
Revision: 291
http://logilogi.svn.sourceforge.net/logilogi/?rev=291&view=rev
Author: wybow
Date: 2007-05-20 14:03:44 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Added quick bad-rating, and some deamons & speeded up listing...
Modified Paths:
--------------
projects/ogog/trunk/app/controllers/doc_controller.rb
projects/ogog/trunk/app/controllers/post_controller.rb
projects/ogog/trunk/app/controllers/user_controller.rb
projects/ogog/trunk/app/helpers/application_helper.rb
projects/ogog/trunk/app/models/link.rb
projects/ogog/trunk/app/models/membership.rb
projects/ogog/trunk/app/models/post.rb
projects/ogog/trunk/app/models/tagging.rb
projects/ogog/trunk/app/models/user.rb
projects/ogog/trunk/app/views/doc/api.rhtml
projects/ogog/trunk/app/views/post/_post.rhtml
projects/ogog/trunk/app/views/post/_post_top_block_score.rhtml
projects/ogog/trunk/app/views/post/rate.rjs
projects/ogog/trunk/app/views/post/viewpoint.rhtml
projects/ogog/trunk/app/views/shared/_menu.rhtml
projects/ogog/trunk/db/migrate/001_initial_schema.rb
projects/ogog/trunk/db/schema.rb
projects/ogog/trunk/lib/daemons/ranking.rb
projects/ogog/trunk/public/stylesheets/ogog.css
projects/ogog/trunk/test/fixtures/taggings.yml
projects/ogog/trunk/test/unit/membership_test.rb
projects/ogog/trunk/test/unit/tagging_test.rb
Added Paths:
-----------
projects/ogog/trunk/app/views/doc/development.rhtml
projects/ogog/trunk/app/views/doc/faq.rhtml
projects/ogog/trunk/app/views/post/rate_bad.rjs
projects/ogog/trunk/lib/daemons/daemons_ctl
projects/ogog/trunk/lib/daemons/harvester.rb
projects/ogog/trunk/lib/daemons/sweeper.rb
projects/ogog/trunk/lib/feedharvester.rb
projects/ogog/trunk/lib/tools/
projects/ogog/trunk/public/images/bad_rating.jpg
projects/ogog/trunk/public/images/bad_rating.svg
Removed Paths:
-------------
projects/ogog/trunk/lib/daemons/feedharvester.rb
projects/ogog/trunk/lib/daemons/ranking_ctl
Modified: projects/ogog/trunk/app/controllers/doc_controller.rb
===================================================================
--- projects/ogog/trunk/app/controllers/doc_controller.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/controllers/doc_controller.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -36,6 +36,9 @@
def api
end
+ def development
+ end
+
# AJAX
def slide
Modified: projects/ogog/trunk/app/controllers/post_controller.rb
===================================================================
--- projects/ogog/trunk/app/controllers/post_controller.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/controllers/post_controller.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -27,8 +27,8 @@
url_bar_body :single_url_bar,
:except => [:index]
-# left_body :cloud,
-# : [:index]
+ left_body :cloud,
+ : [:index]
left_body :viewpoints,
: [:viewpoint]
@@ -45,10 +45,16 @@
end
def cloud
- tags = Tag.top_tags(Context.current.link.received_tags, :order => "count DESC, word", :limit => 100).
- sort_by {|tag| tag.word}
- render_to_string(:partial => 'cloud',
- :locals => {:tags => tags})
+ if Context.current.link.overall?
+ # caching of mainpage...
+ unless read_fragment('cloud')
+ write_fragment('cloud', cloud_s)
+ else
+ read_fragment('cloud')
+ end
+ else
+ cloud_s
+ end
end
def viewpoints
@@ -78,6 +84,13 @@
@post.rate(params[:score].to_i, Context.current.tag, request.env['REMOTE_ADDR'])
end
+ def rate_bad
+ if !params[:id]
+ raise 'Missing parameter'
+ end
+ @post.flat_rate(-1, Context.current.tag, request.env['REMOTE_ADDR'])
+ end
+
# AJAX
def new_posts
@@ -92,6 +105,13 @@
private
+ def cloud_s
+ tags = Tag.top_tags(Context.current.link.received_tags, :order => "count DESC, word", :limit => 100).
+ sort_by {|tag| tag.word}
+ render_to_string(:partial => 'cloud',
+ :locals => {:tags => tags})
+ end
+
def new_posts_s
conditions = 'p.published_at >= "' + 1.week.ago.to_s(:db) + '"'
received_tags = Context.current.link.received_tags
Modified: projects/ogog/trunk/app/controllers/user_controller.rb
===================================================================
--- projects/ogog/trunk/app/controllers/user_controller.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/controllers/user_controller.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -120,14 +120,14 @@
render :json => {
:tag => Context.current.tag.to_s,
:percentile => percentile,
- :power => @user.voting_power_for(Context.current.tag),
+ :power => @user.power_for(Context.current.tag),
:user => @user.name}.to_json
end
format.xml do
render :xml => {
:tag => Context.current.tag.to_s,
:percentile => percentile,
- :power => @user.voting_power_for(Context.current.tag),
+ :power => @user.power_for(Context.current.tag),
:user => @user.name}.to_xml(:root => 'badge')
end
format.png do
Modified: projects/ogog/trunk/app/helpers/application_helper.rb
===================================================================
--- projects/ogog/trunk/app/helpers/application_helper.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/helpers/application_helper.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -32,7 +32,7 @@
end
def score_nr(score)
- (score ? number_with_precision(score, 1) : '~')
+ number_with_precision(score, 1)
end
def tagging_score(tagging)
Modified: projects/ogog/trunk/app/models/link.rb
===================================================================
--- projects/ogog/trunk/app/models/link.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/models/link.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -42,15 +42,29 @@
#
def resolve
existing_tags = self.existing_requested_tags
- while !Tagging.any_posts_for?(existing_tags) and existing_tags.size > 0
+ while !Tagging.any_posts_for?(existing_tags) and !self.overall_tags?(existing_tags) > 0
existing_tags.shift
+ if existing_tags.size == 0
+ existing_tags.push(Tag.overall)
+ end
end
- if existing_tags.size == 0
- existing_tags.push(Tag.overall)
- end
self.received_tags = existing_tags
end
+ # Returns true if this is just a link to the overall-
+ # tag...
+ #
+ def overall?
+ self.overall_tags?(self.received_tags)
+ end
+
+ # Returns true if the tags just refer to the overall-
+ # tag...
+ #
+ def overall_tags?(tags)
+ tags.size == 1 and tags.first == Tag.overall
+ end
+
# Returns the size of this link in the given direction.
#
def size(direction)
Modified: projects/ogog/trunk/app/models/membership.rb
===================================================================
--- projects/ogog/trunk/app/models/membership.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/models/membership.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -44,4 +44,20 @@
end
end
end
+
+ # (Re-)calculates the scores for the users.
+ #
+ def self.calculate_scores(census)
+ Membership.find(:all).each do |membership|
+ posts = membership.user.last_posts_with_tag(membership.tag, :limit => census)
+ if posts.size == census
+ added = 0
+ posts.each do |post|
+ added += post.taggings.find_by_tag_id(membership.tag.id).score
+ end
+ membership.score = ((added / census))
+ membership.save
+ end
+ end
+ end
end
Modified: projects/ogog/trunk/app/models/post.rb
===================================================================
--- projects/ogog/trunk/app/models/post.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/models/post.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -69,7 +69,7 @@
#
def tag(tag)
if !self.taggings.find_by_tag_id(tag.id)
- self.taggings.create(:post => self, :tag => tag)
+ self.taggings.create(:post => self, :tag => tag, :score => self.feed.user.score_for(tag))
end
end
@@ -97,6 +97,25 @@
return self.taggings.order_by_score.first.tag
end
+ # Applies a rating without a weight.
+ #
+ def flat_rate(score, tag, ip_address)
+ # checks
+ if score < -2 or score > 5
+ raise 'Score out of bounds -2, 5'
+ end
+ tagging = self.taggings.find_by_tag_id(tag.id)
+ # check
+ if tagging.rated?
+ return
+ end
+ # registration
+ tagging.votes.build(:user => User.current, :weight => 0, :score => score,
+ :ip_address => ip_address)
+ tagging.score = score
+ tagging.save
+ end
+
# Rates this post with the given score & power for the given tag.
#
def rate(score, tag, ip_address)
@@ -106,7 +125,7 @@
end
# weight determination
if !User.anonymous?
- weight = User.current.voting_power_for(tag)
+ weight = User.current.power_for(tag)
else
weight = Membership.anonymous_voting_power
end
Modified: projects/ogog/trunk/app/models/tagging.rb
===================================================================
--- projects/ogog/trunk/app/models/tagging.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/models/tagging.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -39,9 +39,12 @@
### Filters
before_save :track_negativity
+ after_destroy :destroy_tagless_post
### Filter-functions
+ # Keeps track of when a post is rated as negative...
+ #
def track_negativity
if self.rated? and self.score < 0
self.negative_as_of = Time.now
@@ -50,12 +53,21 @@
end
end
+ # Destroys posts that have no tags anymore after destroying
+ # this tagging...
+ #
+ def destroy_tagless_post
+ if self.post.taggings.size == 1
+ self.post.destroy
+ end
+ end
+
### Functions
# Returns true if there exists any post for the given tags
#
def self.any_posts_for?(existing_tags)
- return Tagging.top_posts_for(existing_tags).size > 0
+ return Tagging.count_posts_for(existing_tags).size > 0
end
# Counts the posts for the given tags + options.
@@ -85,8 +97,6 @@
sql = Tagging.sql_for_posts_for(
existing_tags, 'DISTINCT p.*', options[:conditions])
sql << 'ORDER BY t' + (existing_tags.size - 1).to_s + '.score DESC '
-# sql << 'ORDER BY IF(t' + (existing_tags.size - 1).to_s + '.score IS NULL' +
-# ', -0.0000001, t' + (existing_tags.size - 1).to_s + '.score) DESC '
if options[:limit]
sql << 'LIMIT ' + options[:limit].to_s + ' '
if options[:offset]
@@ -135,12 +145,22 @@
end
end
+ # Removes negative tags for posts that have been negative longer
+ # than bad_time.
+ #
+ def self.remove_bad_tags(bad_time)
+ Tagging.find(:all,
+ :conditions => 'negative_as_of < "' + bad_time.ago.to_s(:db) + '"').each do |tagging|
+ tagging.destroy
+ end
+ end
+
### Methods
# Returns true if this tagging was rated.
#
def rated?
- return !self.score.nil?
+ return !self.weight == 0
end
# Calculates the amount of power this tagging generates for the
Modified: projects/ogog/trunk/app/models/user.rb
===================================================================
--- projects/ogog/trunk/app/models/user.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/models/user.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -105,9 +105,38 @@
Post.find_by_sql(sql)
end
+ # Finds the last x posts tagged with tag for the user.
+ #
+ # Valid options are:
+ # * :limit => limits the result-set to the given number
+ #
+ def last_posts_with_tag(tag, options = {})
+ sql = 'SELECT p.* FROM posts AS p, feeds AS f, taggings AS t' +
+ ' WHERE f.user_id = ' + self.id.to_s +
+ ' AND p.feed_id = f.id' +
+ ' AND t.post_id = p.id AND t.tag_id = ' + tag.id.to_s +
+ ' ORDER BY p.published_at DESC '
+ if options[:limit]
+ sql << 'LIMIT ' + options[:limit].to_s + ' '
+ end
+ sql.slice!(-1)
+ Post.find_by_sql(sql)
+ end
+
+ # Returns the score the user has for the given tag.
+ #
+ def score_for(tag)
+ m = self.memberships.find_by_tag_id(tag.id)
+ if m.nil?
+ return 0.0
+ else
+ return m.score
+ end
+ end
+
# Returns the voting power the user has for the given tag.
#
- def voting_power_for(tag)
+ def power_for(tag)
m = self.memberships.find_by_tag_id(tag.id)
if m.nil?
return Membership.account_voting_power
Modified: projects/ogog/trunk/app/views/doc/api.rhtml
===================================================================
--- projects/ogog/trunk/app/views/doc/api.rhtml 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/views/doc/api.rhtml 2007-05-20 21:03:44 UTC (rev 291)
@@ -1,6 +1,6 @@
<div id="middle_container">
<div id="api" class="box normal">
- <h3 class="title">API</h3>
+ <h3 class="title">Application Programmers Interface</h3>
<p>OgOg.org has a simple programmers API with which you can easily integrate the rankings and power of users in your web-app.</p>
<p>You can request the ranking of an user with either of the following urls:</p>
<p><span class="code">http://www.ogog.org/do/user/<username>/badge/<tag>.<format></span></p>
Added: projects/ogog/trunk/app/views/doc/development.rhtml
===================================================================
--- projects/ogog/trunk/app/views/doc/development.rhtml (rev 0)
+++ projects/ogog/trunk/app/views/doc/development.rhtml 2007-05-20 21:03:44 UTC (rev 291)
@@ -0,0 +1,17 @@
+<div id="middle_container">
+ <div id="development" class="box normal">
+ <h3 class="title">Development</h3>
+ <p>OgOg is Open Source, so you can download it's sourcecode, and add stuff you'd
+ like to see added to it. Also you're welcome to join us to improve this exciting
+ project.</p>
+ <h4>Mailinglist</h4>
+ <p>While still low volume we discuss OgOg together with our other projects on <%= link_to 'logilogi-list', 'https://lists.sourceforge.net/lists/listinfo/logilogi-list' %></p>
+ <h4>Docs</h4>
+ <p>Rails docs can be browsed <%= link_to 'here', 'http://www.ogog.org/pub/docs' %></p>
+ <h4>Sourcecode</h4>
+ <p>You can get the Sourcecode of OgOg through svn at:</p>
+ <span class="code">https://logilogi.svn.sourceforge.net/ svnroot/logilogi/projects/ogog/trunk</span>
+ (all on one line)
+ <p>Our svn repository can be browsed <%= link_to 'here', 'http://svn.sourceforge.net/logilogi' %></p>
+ </div>
+</div>
Added: projects/ogog/trunk/app/views/doc/faq.rhtml
===================================================================
--- projects/ogog/trunk/app/views/doc/faq.rhtml (rev 0)
+++ projects/ogog/trunk/app/views/doc/faq.rhtml 2007-05-20 21:03:44 UTC (rev 291)
@@ -0,0 +1,19 @@
+<div id="middle_container">
+ <div id="faq" class="box normal">
+ <h3 class="title">Frequently Asked Questions</h3>
+ <p>Questions an further information.</p>
+ <h4>Where did negatively rated post X go ?</h4>
+ <p>Posts with a rating lower than zero from a certain viewpoint lose the
+ tag belonging to that viewpoint after a week, and posts with no tags left are
+ deleted.</p>
+ <p>...hence the skulls when ratings become negative.</p>
+ <h4>Why do X's posts start with score Y or Z ?</h4>
+ <p>As soon as an user has 4 posts with a certain tag, his / her new posts with
+ that same tag will be given the average rating of the last four for a start.</p>
+ <p>These ratings will have no power though, so they can easily be changed.</p>
+ <h4>My question is not answered here, where to go now ?</h4>
+ <p>If you have any questions left, please send them to our
+ <%= link_to 'mailinglist', url_for(:controller => :doc, :action => :development) %>, or
+ to the <%= link_to 'LogiLogi Foundation', 'http://foundation.logilogi.org' %>.</p>
+ </div>
+</div>
Modified: projects/ogog/trunk/app/views/post/_post.rhtml
===================================================================
--- projects/ogog/trunk/app/views/post/_post.rhtml 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/views/post/_post.rhtml 2007-05-20 21:03:44 UTC (rev 291)
@@ -1,16 +1,29 @@
<div class="post">
<table cellspacing=0 class="post">
- <%= render :partial => 'post_top_block_score',
- :locals => {:tagging => post.tagging_for(Context.current.tag)} %>
+ <% tagging = post.tagging_for(Context.current.tag) %>
+ <tr id="post_top_block_score<%= post.id %>">
+ <%= render :partial => 'post_top_block_score',
+ :locals => {:tagging => tagging} %>
+ </tr>
<tr><td colspan="2" class="title">
<h5><%= link_to_post(truncate(post.title, 40), post, Context.current.tag) %></h5>
</td></tr>
<tr><td colspan="3" class="snippet">
<%= post.snippet + link_to_post(' ...read on', post, Context.current.tag) %>
</td></tr>
- <tr><td colspan="3" class="published">
- Published <%= time_ago_in_words(post.published_at) %> ago
- <%= (post.feed.user ? 'by ' + link_to_user(post.feed.user) : '') %>
- </td></tr>
+ <tr>
+ <td colspan="2" class="published">
+ Published <%= time_ago_in_words(post.published_at) %> ago
+ <%= (post.feed.user ? 'by ' + link_to_user(post.feed.user) : '') %>
+ </td>
+ <td class="bad_rating">
+ <% if tagging.weight == 0.0 and tagging.score >= 0 %>
+ <div id="bad_rating<%= post.id %>" class="bad_rating" >
+ <%= link_to_remote 'bad!', {:url => {:action => 'rate_bad', :id => post,
+ :tag_string => tagging.tag.to_s}}, :title => '1 skull, 0.0 weight' %>
+ </div>
+ <% end %>
+ </td>
+ </tr>
</table>
</div>
Modified: projects/ogog/trunk/app/views/post/_post_top_block_score.rhtml
===================================================================
--- projects/ogog/trunk/app/views/post/_post_top_block_score.rhtml 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/views/post/_post_top_block_score.rhtml 2007-05-20 21:03:44 UTC (rev 291)
@@ -1,4 +1,4 @@
-<td rowspan="2" class="score">
+<td rowspan="2" colspan="1" class="score">
<%= score_image(tagging.score) %>
<div class="score">
<%= score_nr(tagging.score) %>
@@ -7,6 +7,6 @@
<td class="word">
In words: <%= score_in_words(tagging.score) %>
</td>
-<td class="weight">
+<td class="power">
Power: <%= tagging_power(tagging) %>
</td>
Modified: projects/ogog/trunk/app/views/post/rate.rjs
===================================================================
--- projects/ogog/trunk/app/views/post/rate.rjs 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/views/post/rate.rjs 2007-05-20 21:03:44 UTC (rev 291)
@@ -1,5 +1,5 @@
tagging = @post.tagging_for(Context.current.tag)
-page.replace_html 'post_top_block_score', :partial => 'post_top_block_score',
- :locals => {:post => @post, :tagging => tagging}
+page.replace_html 'post_top_block_score' + @post.id.to_s, :partial => 'post_top_block_score',
+ :locals => {:tagging => tagging}
page.replace 'rating_bar', :partial => 'rating_bar',
:locals => {:post => @post, :tagging => tagging}
Added: projects/ogog/trunk/app/views/post/rate_bad.rjs
===================================================================
--- projects/ogog/trunk/app/views/post/rate_bad.rjs (rev 0)
+++ projects/ogog/trunk/app/views/post/rate_bad.rjs 2007-05-20 21:03:44 UTC (rev 291)
@@ -0,0 +1,4 @@
+tagging = @post.tagging_for(Context.current.tag)
+page.replace_html 'post_top_block_score' + @post.id.to_s, :partial => 'post_top_block_score',
+ :locals => {:tagging => tagging}
+page.remove 'bad_rating' + @post.id.to_s
Modified: projects/ogog/trunk/app/views/post/viewpoint.rhtml
===================================================================
--- projects/ogog/trunk/app/views/post/viewpoint.rhtml 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/views/post/viewpoint.rhtml 2007-05-20 21:03:44 UTC (rev 291)
@@ -4,7 +4,7 @@
<h3 class="title">Post</h3>
<div class="post">
<table cellspacing=0 class="post">
- <tr id="post_top_block_score">
+ <tr id="post_top_block_score<%= post.id %>">
<%= render :partial => 'post_top_block_score',
:locals => {:post => @post, :tagging => tagging} %>
</tr>
@@ -14,13 +14,15 @@
<tr><td colspan="3" class="body">
<%= @post.body %>
</td></tr>
- <tr><td colspan="3" class="published">
+ <tr>
+ <td colspan="2" class="published">
Published <%= time_ago_in_words(@post.published_at) %> ago
- <%= (@post.feed.user ? 'by ' + link_to_user(@post.feed.user) : '') %>
- </td></tr>
- <tr><td colspan="3" class="published">
+ <%= (@post.feed.user ? 'by ' + link_to_user(@post.feed.user) : '') %><br />
On <%= link_to_feed(@post.feed) %>
- </td></tr>
+ </td>
+ <td class="bad_rating">
+ </td>
+ </tr>
</table>
</div>
</div>
Modified: projects/ogog/trunk/app/views/shared/_menu.rhtml
===================================================================
--- projects/ogog/trunk/app/views/shared/_menu.rhtml 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/app/views/shared/_menu.rhtml 2007-05-20 21:03:44 UTC (rev 291)
@@ -9,7 +9,7 @@
<% end %>
</div>
<% else %>
- <%= voting_power(User.current.voting_power_for(Context.current.tag)) %>
+ <%= voting_power(User.current.power_for(Context.current.tag)) %>
<p>Logged in as <%= link_to_user(User.current) %></p>
<% end %>
<ul>
@@ -23,9 +23,10 @@
<hr />
<ul>
<li><%= link_to 'Home', main_url() %></li>
+ <li><%= link_to 'Add Feed', new_feed_url() %></li>
<li><%= link_to 'Tour', url_for(:controller => :doc, :action => :tour) %></li>
<li><%= link_to 'Faq', url_for(:controller => :doc, :action => :faq) %></li>
<li><%= link_to 'API', url_for(:controller => :doc, :action => :api) %></li>
- <li><%= link_to 'Add Feed', new_feed_url() %></li>
+ <li><%= link_to 'Development', url_for(:controller => :doc, :action => :development) %></li>
</ul>
</div>
Modified: projects/ogog/trunk/db/migrate/001_initial_schema.rb
===================================================================
--- projects/ogog/trunk/db/migrate/001_initial_schema.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/db/migrate/001_initial_schema.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -29,6 +29,7 @@
t.column :tag_id, :integer, :null => false
t.column :power, :float, :null => false
t.column :percentile, :float, :default => 0.0
+ t.column :score, :float, :default => 0.0
t.column :calculated_at, :datetime
end
@@ -39,8 +40,8 @@
create_table :taggings do |t|
t.column :tag_id, :integer, :null => false
t.column :post_id, :integer, :null => false
- t.column :weight, :float, :default => 0
- t.column :score, :float # null is ok
+ t.column :weight, :float, :default => 0.0
+ t.column :score, :float, :default => 0.0
t.column :updated_at, :datetime # null is ok
t.column :negative_as_of, :datetime # null is ok
end
Modified: projects/ogog/trunk/db/schema.rb
===================================================================
--- projects/ogog/trunk/db/schema.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/db/schema.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -19,6 +19,7 @@
t.column "tag_id", :integer, :null => false
t.column "power", :float, :null => false
t.column "percentile", :float, :default => 0.0
+ t.column "score", :float, :default => 0.0
t.column "calculated_at", :datetime
end
@@ -35,7 +36,7 @@
t.column "tag_id", :integer, :null => false
t.column "post_id", :integer, :null => false
t.column "weight", :float, :default => 0.0
- t.column "score", :float
+ t.column "score", :float, :default => 0.0
t.column "updated_at", :datetime
t.column "negative_as_of", :datetime
end
Copied: projects/ogog/trunk/lib/daemons/daemons_ctl (from rev 290, projects/ogog/trunk/lib/daemons/ranking_ctl)
===================================================================
--- projects/ogog/trunk/lib/daemons/daemons_ctl (rev 0)
+++ projects/ogog/trunk/lib/daemons/daemons_ctl 2007-05-20 21:03:44 UTC (rev 291)
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+require 'rubygems'
+require "daemons"
+require 'yaml'
+require 'erb'
+require 'active_support'
+
+options = YAML.load(
+ ERB.new(
+ IO.read(
+ File.dirname(__FILE__) + "/../../config/daemons.yml"
+ )).result).with_indifferent_access
+options[:dir_mode] = options[:dir_mode].to_sym
+
+Daemons.run File.dirname(__FILE__) + '/ranking.rb', options
+Daemons.run File.dirname(__FILE__) + '/sweeper.rb', options
+Daemons.run File.dirname(__FILE__) + '/feedharvester.rb', options
Deleted: projects/ogog/trunk/lib/daemons/feedharvester.rb
===================================================================
--- projects/ogog/trunk/lib/daemons/feedharvester.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/lib/daemons/feedharvester.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -1,32 +0,0 @@
-#!/usr/bin/env ruby
-
-#You might want to change this
-ENV["RAILS_ENV"] ||= "production"
-
-require File.dirname(__FILE__) + "/../../config/environment"
-
-rules = Scraper.define do
- array :tags
- process 'ul.memberdetails>li:nth-child(4)>a', :url=> "@href"
- process 'ul.memberdetails>li:nth-child(5)>a', :tags=> :text
- result :url, :tags
-end
-
-# http://9rules.com/member/10/
-#res = rules.scrape (URI.parse('http://127.0.0.1:3000/pub/test/rules.htm'))
-
-puts '## Harvesting feeds...'
-601.upto(1226) do |i|
- puts i
- res = rules.scrape(URI.parse('http://9rules.com/member/' + i.to_s + '/'))
- if res.url and !res.url.empty?
- feed = Feed.new(:url => res.url, :tags_string => res.tags.join(','))
- feed.save
- feed.harvest
- if feed.bad?
- puts 'bad'
- else
- puts 'ok'
- end
- end
-end
Added: projects/ogog/trunk/lib/daemons/harvester.rb
===================================================================
--- projects/ogog/trunk/lib/daemons/harvester.rb (rev 0)
+++ projects/ogog/trunk/lib/daemons/harvester.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+
+#You might want to change this
+ENV["RAILS_ENV"] ||= "production"
+
+require File.dirname(__FILE__) + "/../../config/environment"
+
+$running = true;
+Signal.trap("TERM") do
+ $running = false
+end
+
+while($running) do
+ if Time.now.hour == 4 or Time.now.hour == 11 or Time.now.hour == 17
+ Feed.harvest
+ sh "rake tmp:cache:clear"
+ end
+ ActiveRecord::Base.logger << "Harvest daemon is still running at #{Time.now}.\n"
+ sleep 1200
+end
Property changes on: projects/ogog/trunk/lib/daemons/harvester.rb
___________________________________________________________________
Name: svn:executable
+ *
Modified: projects/ogog/trunk/lib/daemons/ranking.rb
===================================================================
--- projects/ogog/trunk/lib/daemons/ranking.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/lib/daemons/ranking.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -13,7 +13,8 @@
while($running) do
if Time.now.hour == 2
Membership.calculate_percentiles
- sleep 3600 * 20
+ Membership.calculate_scores(OgOg::Config::MEMBERSHIP_SCORE_POSTS)
+ sleep 3600 * 10
end
ActiveRecord::Base.logger << "Ranking daemon is still running at #{Time.now}.\n"
sleep 1200
Deleted: projects/ogog/trunk/lib/daemons/ranking_ctl
===================================================================
--- projects/ogog/trunk/lib/daemons/ranking_ctl 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/lib/daemons/ranking_ctl 2007-05-20 21:03:44 UTC (rev 291)
@@ -1,15 +0,0 @@
-#!/usr/bin/env ruby
-require 'rubygems'
-require "daemons"
-require 'yaml'
-require 'erb'
-require 'active_support'
-
-options = YAML.load(
- ERB.new(
- IO.read(
- File.dirname(__FILE__) + "/../../config/daemons.yml"
- )).result).with_indifferent_access
-options[:dir_mode] = options[:dir_mode].to_sym
-
-Daemons.run File.dirname(__FILE__) + '/ranking.rb', options
Added: projects/ogog/trunk/lib/daemons/sweeper.rb
===================================================================
--- projects/ogog/trunk/lib/daemons/sweeper.rb (rev 0)
+++ projects/ogog/trunk/lib/daemons/sweeper.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+
+#You might want to change this
+ENV["RAILS_ENV"] ||= "production"
+
+require File.dirname(__FILE__) + "/../../config/environment"
+
+$running = true;
+Signal.trap("TERM") do
+ $running = false
+end
+
+while($running) do
+ if Time.now.hour == 3
+ Post.sweep_unrated_old(OgOg::Config::OLD_TIME)
+ Tagging.remove_bad_tags(OgOg::Config::BAD_TIME)
+ sleep 3600 * 10
+ end
+ ActiveRecord::Base.logger << "Sweeper daemon is still running at #{Time.now}.\n"
+ sleep 1200
+end
Property changes on: projects/ogog/trunk/lib/daemons/sweeper.rb
___________________________________________________________________
Name: svn:executable
+ *
Copied: projects/ogog/trunk/lib/feedharvester.rb (from rev 290, projects/ogog/trunk/lib/daemons/feedharvester.rb)
===================================================================
--- projects/ogog/trunk/lib/feedharvester.rb (rev 0)
+++ projects/ogog/trunk/lib/feedharvester.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -0,0 +1,32 @@
+#!/usr/bin/env ruby
+
+#You might want to change this
+ENV["RAILS_ENV"] ||= "production"
+
+require File.dirname(__FILE__) + "/../../config/environment"
+
+rules = Scraper.define do
+ array :tags
+ process 'ul.memberdetails>li:nth-child(4)>a', :url=> "@href"
+ process 'ul.memberdetails>li:nth-child(5)>a', :tags=> :text
+ result :url, :tags
+end
+
+# http://9rules.com/member/10/
+#res = rules.scrape (URI.parse('http://127.0.0.1:3000/pub/test/rules.htm'))
+
+puts '## Harvesting feeds...'
+601.upto(1226) do |i|
+ puts i
+ res = rules.scrape(URI.parse('http://9rules.com/member/' + i.to_s + '/'))
+ if res.url and !res.url.empty?
+ feed = Feed.new(:url => res.url, :tags_string => res.tags.join(','))
+ feed.save
+ feed.harvest
+ if feed.bad?
+ puts 'bad'
+ else
+ puts 'ok'
+ end
+ end
+end
Added: projects/ogog/trunk/public/images/bad_rating.jpg
===================================================================
(Binary files differ)
Property changes on: projects/ogog/trunk/public/images/bad_rating.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/ogog/trunk/public/images/bad_rating.svg
===================================================================
--- projects/ogog/trunk/public/images/bad_rating.svg (rev 0)
+++ projects/ogog/trunk/public/images/bad_rating.svg 2007-05-20 21:03:44 UTC (rev 291)
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="25"
+ height="75"
+ id="svg24650"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ version="1.0"
+ sodipodi:docbase="/home/wybo/ogog/docs/rating"
+ sodipodi:docname="crap.svg"
+ inkscape:export-filename="/home/wybo/ogog/docs/rating/skulls.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs24652">
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient15431"
+ id="radialGradient19890"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.943838,0,0,0.944379,2.651542,2.435285)"
+ cx="36.922077"
+ cy="63.602242"
+ fx="36.922077"
+ fy="63.602242"
+ r="11.922077" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient8122"
+ id="radialGradient22639"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.943838,0,0,0.944379,2.651533,-22.56469)"
+ cx="36.922077"
+ cy="63.602242"
+ fx="36.922077"
+ fy="63.602242"
+ r="11.922077" />
+ <linearGradient
+ id="linearGradient15431">
+ <stop
+ style="stop-color:#8300ff;stop-opacity:0.12371134;"
+ offset="0"
+ id="stop15433" />
+ <stop
+ style="stop-color:#ff8b8b;stop-opacity:1;"
+ offset="1"
+ id="stop15435" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient15431"
+ id="radialGradient22675"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.943838,0,0,0.944379,-22.34847,2.435277)"
+ cx="36.922077"
+ cy="63.602242"
+ fx="36.922077"
+ fy="63.602242"
+ r="11.922077" />
+ <linearGradient
+ id="linearGradient8122">
+ <stop
+ id="stop8124"
+ offset="0"
+ style="stop-color:red;stop-opacity:0;" />
+ <stop
+ style="stop-color:red;stop-opacity:0.52156866;"
+ offset="1"
+ id="stop8126" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient8122"
+ id="radialGradient22693"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.943838,0,0,0.944379,-22.34847,-22.56469)"
+ cx="36.922077"
+ cy="63.602242"
+ fx="36.922077"
+ fy="63.602242"
+ r="11.922077" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1"
+ inkscape:cx="26.712859"
+ inkscape:cy="27.100027"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ width="25px"
+ height="75px"
+ showgrid="true"
+ inkscape:window-width="914"
+ inkscape:window-height="626"
+ inkscape:window-x="260"
+ inkscape:window-y="304" />
+ <metadata
+ id="metadata24655">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ style="fill:url(#radialGradient22675);fill-opacity:1;stroke:#ccc;stroke-width:0.77246445;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 12.579461,51.387311 C 10.913425,51.365817 9.221666,51.66506 7.8847927,52.299439 C 4.2863424,54.006993 1.8093908,57.009264 1.4371749,60.233064 C 1.06496,63.456867 2.7514688,66.812443 5.8727825,69.242185 C 6.6893224,69.877811 7.1739607,70.319274 7.4538654,70.73971 C 7.7337701,71.160145 7.8167373,71.554521 7.8167373,72.141937 C 7.8167373,72.535167 7.8564747,72.900294 7.9333739,73.162978 C 7.9718231,73.29432 8.0221684,73.398076 8.0759313,73.476095 C 8.1296951,73.554116 8.1949162,73.612236 8.270327,73.612236 C 8.4069949,73.612239 8.5154003,73.49215 8.5943193,73.326344 C 8.6732384,73.160537 8.7239168,72.945653 8.7239168,72.700106 C 8.7239168,72.466448 8.7691409,72.251132 8.8405535,72.101096 C 8.9119672,71.95106 9.1296313,71.711257 9.1766515,71.79362 C 9.5613241,72.467478 9.2875289,71.95106 9.3589416,72.101096 C 9.4303552,72.251132 9.4755793,72.466444 9.4755793,72.700106 C 9.4755793,72.945657 9.5262568,73.160542 9.6051758,73.326344 C 9.6840958,73.492145 9.7925059,73.612236 9.9291686,73.612236 C 10.000328,73.612239 10.068847,73.564376 10.123564,73.503323 C 10.178281,73.442273 10.227196,73.360502 10.266121,73.258274 C 10.343974,73.053818 10.382759,72.786543 10.382759,72.482284 C 10.382759,72.187537 10.426916,71.910258 10.499396,71.719908 C 10.535637,71.624732 10.584568,71.551649 10.628993,71.502086 C 10.673416,71.452523 10.55629,71.850082 10.613856,71.583418 C 10.694662,71.209104 10.883754,71.451656 11.017784,71.719908 C 11.090263,71.910254 11.134421,72.187533 11.134421,72.482284 C 11.134421,72.835696 11.207486,73.107202 11.328817,73.299116 C 11.450149,73.491029 11.623423,73.597838 11.795366,73.612236 C 11.967308,73.626634 12.142196,73.539103 12.274875,73.367185 C 12.407553,73.195267 12.500842,72.942968 12.52111,72.591195 C 12.52111,72.591195 12.4483,71.55627 12.665328,71.620599 C 12.757903,71.64804 12.663666,72.591195 12.663666,72.591195 C 12.687079,73.036888 12.853467,73.213352 13.000619,73.3808 C 13.147771,73.548247 13.320775,73.6249 13.493087,73.598621 C 13.6654,73.572344 13.837616,73.437717 13.959636,73.231046 C 14.081656,73.024377 14.160755,72.743461 14.179951,72.373374 C 14.179951,72.373374 13.981652,71.785498 14.223942,71.759804 C 14.346442,71.746813 14.335468,72.373374 14.335468,72.373374 C 14.440826,73.103943 14.77927,73.531754 15.12601,73.585007 C 15.29938,73.611634 15.464571,73.534246 15.592559,73.367185 C 15.720546,73.200125 15.818351,72.945969 15.838793,72.591195 C 15.838793,72.591195 16.054682,71.908047 15.877672,71.951344 C 15.726623,71.988289 15.98135,72.591195 15.98135,72.591195 C 16.050548,72.968603 16.145767,73.231727 16.253503,73.394413 C 16.30737,73.475756 16.37233,73.541687 16.434939,73.571393 C 16.497549,73.6011 16.568584,73.600808 16.629335,73.571393 C 16.750836,73.512564 16.845009,73.350644 16.914449,73.108521 C 16.983887,72.8664 17.018126,72.538526 17.018126,72.128324 C 17.018126,71.525668 17.090124,71.113065 17.355079,70.712482 C 17.620032,70.311899 18.086379,69.918718 18.871363,69.337482 C 22.000471,67.020559 23.896972,63.897555 23.579192,60.65777 C 23.261412,57.417984 20.767011,54.150136 17.241699,52.421965 C 15.877122,51.753024 14.245498,51.408806 12.579461,51.387311 z "
+ id="path22663"
+ sodipodi:nodetypes="cssssssssssssssssssssssssssscscssscscsscscsssssssssc" />
+ <path
+ sodipodi:nodetypes="cssssssssccssssssssscsssssssssc"
+ id="path22665"
+ d="M 16.866938,60.598047 C 15.899647,60.598047 15.354468,60.89383 14.631839,61.795967 C 14.370278,62.122503 14.140652,62.49354 13.97043,62.826176 C 13.800212,63.158808 13.69286,63.4478 13.696746,63.640759 C 13.707168,64.15785 13.934259,64.763876 14.278328,65.317844 C 14.622396,65.871813 15.083418,66.378004 15.566933,66.659513 C 16.210948,67.03448 16.561098,67.145443 17.127003,67.064946 C 17.692909,66.984445 18.200083,66.747661 18.828349,66.192325 C 19.940257,65.209481 20.17727,63.810322 19.774848,62.658465 C 19.372423,61.506611 18.322162,60.598051 16.866938,60.598047 z M 7.310301,60.755623 C 6.2091655,61.180144 5.3406134,62.288079 5.3406134,63.8232 C 5.3406134,64.840523 5.4961589,65.417616 6.3598096,66.18102 C 6.9943918,66.741933 7.4569631,67.05276 7.9401432,67.131369 C 8.4233176,67.209974 8.9200501,67.053578 9.6120857,66.722355 C 10.105486,66.486197 10.614433,65.964832 10.997737,65.363 C 11.381038,64.761171 11.639029,64.087117 11.639029,63.546513 C 11.639029,63.372133 11.525966,63.096406 11.352738,62.776612 C 11.179509,62.45682 10.950953,62.093725 10.688541,61.76612 C 9.8011893,60.661555 8.5710499,60.40848 7.310301,60.755623 z M 12.52067,67.107365 C 12.701272,67.107369 12.948092,67.184225 13.194575,67.325186 C 13.441058,67.466147 13.537067,68.137348 13.720369,68.350116 C 13.928939,68.592216 13.914391,69.268565 13.849965,69.466453 C 13.649864,70.081085 13.486099,70.051914 13.305659,69.98378 C 12.626234,69.727224 13.311551,68.342336 12.52067,68.342336 C 12.229315,68.34234 12.277413,69.957532 11.996729,69.865145 C 11.716045,69.772757 11.475276,69.644104 11.348745,69.511185 C 11.206739,69.362012 11.160863,69.169514 11.193227,68.953016 C 11.225592,68.736519 11.341254,68.503627 11.504261,68.285937 C 11.830273,67.850555 11.995298,67.107365 12.52067,67.107365 z "
+ style="fill:white;fill-opacity:1;stroke:#ccc;stroke-width:0.77246445;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:url(#radialGradient22693);fill-opacity:1;stroke:#ccc;stroke-width:0.77246445;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 12.579461,26.387311 C 10.913425,26.365817 9.221666,26.66506 7.8847927,27.299439 C 4.2863424,29.006993 1.8093908,32.009264 1.4371749,35.233064 C 1.06496,38.456867 2.7514688,41.812443 5.8727825,44.242185 C 6.6893224,44.877811 7.1739607,45.319274 7.4538654,45.73971 C 7.7337701,46.160145 7.8167373,46.554521 7.8167373,47.141937 C 7.8167373,47.535167 7.8564747,47.900294 7.9333739,48.162978 C 7.9718231,48.29432 8.0221684,48.398076 8.0759313,48.476095 C 8.1296951,48.554116 8.1949162,48.612236 8.270327,48.612236 C 8.4069949,48.612239 8.5154003,48.49215 8.5943193,48.326344 C 8.6732384,48.160537 8.7239168,47.945653 8.7239168,47.700106 C 8.7239168,47.466448 8.7691409,47.251132 8.8405535,47.101096 C 8.9119672,46.95106 9.1296313,46.711257 9.1766515,46.79362 C 9.5613241,47.467478 9.2875289,46.95106 9.3589416,47.101096 C 9.4303552,47.251132 9.4755793,47.466444 9.4755793,47.700106 C 9.4755793,47.945657 9.5262568,48.160542 9.6051758,48.326344 C 9.6840958,48.492145 9.7925059,48.612236 9.9291686,48.612236 C 10.000328,48.612239 10.068847,48.564376 10.123564,48.503323 C 10.178281,48.442273 10.227196,48.360502 10.266121,48.258274 C 10.343974,48.053818 10.382759,47.786543 10.382759,47.482284 C 10.382759,47.187537 10.426916,46.910258 10.499396,46.719908 C 10.535637,46.624732 10.584568,46.551649 10.628993,46.502086 C 10.673416,46.452523 10.55629,46.850082 10.613856,46.583418 C 10.694662,46.209104 10.883754,46.451656 11.017784,46.719908 C 11.090263,46.910254 11.134421,47.187533 11.134421,47.482284 C 11.134421,47.835696 11.207486,48.107202 11.328817,48.299116 C 11.450149,48.491029 11.623423,48.597838 11.795366,48.612236 C 11.967308,48.626634 12.142196,48.539103 12.274875,48.367185 C 12.407553,48.195267 12.500842,47.942968 12.52111,47.591195 C 12.52111,47.591195 12.4483,46.55627 12.665328,46.620599 C 12.757903,46.64804 12.663666,47.591195 12.663666,47.591195 C 12.687079,48.036888 12.853467,48.213352 13.000619,48.3808 C 13.147771,48.548247 13.320775,48.6249 13.493087,48.598621 C 13.6654,48.572344 13.837616,48.437717 13.959636,48.231046 C 14.081656,48.024377 14.160755,47.743461 14.179951,47.373374 C 14.179951,47.373374 13.981652,46.785498 14.223942,46.759804 C 14.346442,46.746813 14.335468,47.373374 14.335468,47.373374 C 14.440826,48.103943 14.77927,48.531754 15.12601,48.585007 C 15.29938,48.611634 15.464571,48.534246 15.592559,48.367185 C 15.720546,48.200125 15.818351,47.945969 15.838793,47.591195 C 15.838793,47.591195 16.054682,46.908047 15.877672,46.951344 C 15.726623,46.988289 15.98135,47.591195 15.98135,47.591195 C 16.050548,47.968603 16.145767,48.231727 16.253503,48.394413 C 16.30737,48.475756 16.37233,48.541687 16.434939,48.571393 C 16.497549,48.6011 16.568584,48.600808 16.629335,48.571393 C 16.750836,48.512564 16.845009,48.350644 16.914449,48.108521 C 16.983887,47.8664 17.018126,47.538526 17.018126,47.128324 C 17.018126,46.525668 17.090124,46.113065 17.355079,45.712482 C 17.620032,45.311899 18.086379,44.918718 18.871363,44.337482 C 22.000471,42.020559 23.896972,38.897555 23.579192,35.65777 C 23.261412,32.417984 20.767011,29.150136 17.241699,27.421965 C 15.877122,26.753024 14.245498,26.408806 12.579461,26.387311 z "
+ id="path22681"
+ sodipodi:nodetypes="cssssssssssssssssssssssssssscscssscscsscscsssssssssc" />
+ <path
+ sodipodi:nodetypes="cssssssssccssssssssscsssssssssc"
+ id="path22683"
+ d="M 16.866938,35.598047 C 15.899647,35.598047 15.354468,35.89383 14.631839,36.795967 C 14.370278,37.122503 14.140652,37.49354 13.97043,37.826176 C 13.800212,38.158808 13.69286,38.4478 13.696746,38.640759 C 13.707168,39.15785 13.934259,39.763876 14.278328,40.317844 C 14.622396,40.871813 15.083418,41.378004 15.566933,41.659513 C 16.210948,42.03448 16.561098,42.145443 17.127003,42.064946 C 17.692909,41.984445 18.200083,41.747661 18.828349,41.192325 C 19.940257,40.209481 20.17727,38.810322 19.774848,37.658465 C 19.372423,36.506611 18.322162,35.598051 16.866938,35.598047 z M 7.310301,35.755623 C 6.2091655,36.180144 5.3406134,37.288079 5.3406134,38.8232 C 5.3406134,39.840523 5.4961589,40.417616 6.3598096,41.18102 C 6.9943918,41.741933 7.4569631,42.05276 7.9401432,42.131369 C 8.4233176,42.209974 8.9200501,42.053578 9.6120857,41.722355 C 10.105486,41.486197 10.614433,40.964832 10.997737,40.363 C 11.381038,39.761171 11.639029,39.087117 11.639029,38.546513 C 11.639029,38.372133 11.525966,38.096406 11.352738,37.776612 C 11.179509,37.45682 10.950953,37.093725 10.688541,36.76612 C 9.8011893,35.661555 8.5710499,35.40848 7.310301,35.755623 z M 12.52067,42.107365 C 12.701272,42.107369 12.948092,42.184225 13.194575,42.325186 C 13.441058,42.466147 13.537067,43.137348 13.720369,43.350116 C 13.928939,43.592216 13.914391,44.268565 13.849965,44.466453 C 13.649864,45.081085 13.486099,45.051914 13.305659,44.98378 C 12.626234,44.727224 13.311551,43.342336 12.52067,43.342336 C 12.229315,43.34234 12.277413,44.957532 11.996729,44.865145 C 11.716045,44.772757 11.475276,44.644104 11.348745,44.511185 C 11.206739,44.362012 11.160863,44.169514 11.193227,43.953016 C 11.225592,43.736519 11.341254,43.503627 11.504261,43.285937 C 11.830273,42.850555 11.995298,42.107365 12.52067,42.107365 z "
+ style="fill:white;fill-opacity:1;stroke:#ccc;stroke-width:0.77246445;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:none;fill-opacity:1;stroke:#ccc;stroke-width:0.77246445;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 12.579461,1.3873117 C 10.913425,1.3658166 9.221666,1.66506 7.8847927,2.2994394 C 4.2863424,4.0069924 1.8093908,7.0092632 1.4371749,10.233064 C 1.06496,13.456867 2.7514688,16.812443 5.8727825,19.242185 C 6.6893224,19.877811 7.1739607,20.319274 7.4538654,20.73971 C 7.7337701,21.160145 7.8167373,21.554521 7.8167373,22.141937 C 7.8167373,22.535167 7.8564747,22.900294 7.9333739,23.162978 C 7.9718231,23.29432 8.0221684,23.398076 8.0759313,23.476095 C 8.1296951,23.554116 8.1949162,23.612236 8.270327,23.612236 C 8.4069949,23.612239 8.5154003,23.49215 8.5943193,23.326344 C 8.6732384,23.160537 8.7239168,22.945653 8.7239168,22.700106 C 8.7239168,22.466448 8.7691409,22.251132 8.8405535,22.101096 C 8.9119672,21.95106 9.1296313,21.711257 9.1766515,21.79362 C 9.5613241,22.467478 9.2875289,21.95106 9.3589416,22.101096 C 9.4303552,22.251132 9.4755793,22.466444 9.4755793,22.700106 C 9.4755793,22.945657 9.5262568,23.160542 9.6051758,23.326344 C 9.6840958,23.492145 9.7925059,23.612236 9.9291686,23.612236 C 10.000328,23.612239 10.068847,23.564376 10.123564,23.503323 C 10.178281,23.442273 10.227196,23.360502 10.266121,23.258274 C 10.343974,23.053818 10.382759,22.786543 10.382759,22.482284 C 10.382759,22.187536 10.426916,21.910258 10.499396,21.719908 C 10.535637,21.624732 10.584568,21.551649 10.628993,21.502086 C 10.673416,21.452523 10.55629,21.850082 10.613856,21.583418 C 10.694662,21.209104 10.883754,21.451656 11.017784,21.719908 C 11.090263,21.910254 11.134421,22.187533 11.134421,22.482284 C 11.134421,22.835696 11.207486,23.107202 11.328817,23.299116 C 11.450149,23.491029 11.623423,23.597838 11.795366,23.612236 C 11.967308,23.626634 12.142196,23.539103 12.274875,23.367185 C 12.407553,23.195267 12.500842,22.942968 12.52111,22.591195 C 12.52111,22.591195 12.4483,21.556269 12.665328,21.620599 C 12.757903,21.64804 12.663666,22.591195 12.663666,22.591195 C 12.687079,23.036888 12.853467,23.213352 13.000619,23.3808 C 13.147771,23.548247 13.320775,23.6249 13.493087,23.598621 C 13.6654,23.572344 13.837616,23.437717 13.959636,23.231046 C 14.081656,23.024377 14.160755,22.743461 14.179951,22.373374 C 14.179951,22.373374 13.981652,21.785498 14.223942,21.759804 C 14.346442,21.746813 14.335468,22.373374 14.335468,22.373374 C 14.440826,23.103943 14.77927,23.531754 15.12601,23.585007 C 15.29938,23.611634 15.464571,23.534246 15.592559,23.367185 C 15.720546,23.200125 15.818351,22.945969 15.838793,22.591195 C 15.838793,22.591195 16.054682,21.908047 15.877672,21.951344 C 15.726623,21.988289 15.98135,22.591195 15.98135,22.591195 C 16.050548,22.968602 16.145767,23.231727 16.253503,23.394413 C 16.30737,23.475756 16.37233,23.541687 16.434939,23.571393 C 16.497549,23.6011 16.568584,23.600808 16.629335,23.571393 C 16.750836,23.512564 16.845009,23.350644 16.914449,23.108521 C 16.983887,22.8664 17.018126,22.538526 17.018126,22.128324 C 17.018126,21.525668 17.090124,21.113065 17.355079,20.712482 C 17.620032,20.311899 18.086379,19.918717 18.871363,19.337482 C 22.000471,17.020559 23.896972,13.897555 23.579192,10.65777 C 23.261412,7.4179841 20.767011,4.150136 17.241699,2.4219651 C 15.877122,1.7530248 14.245498,1.4088057 12.579461,1.3873117 z "
+ id="path22699"
+ sodipodi:nodetypes="cssssssssssssssssssssssssssscscssscscsscscsssssssssc" />
+ <path
+ sodipodi:nodetypes="cssssssssccssssssssscsssssssssc"
+ id="path22701"
+ d="M 16.866938,10.598046 C 15.899647,10.598046 15.354468,10.89383 14.631839,11.795966 C 14.370278,12.122503 14.140652,12.49354 13.97043,12.826176 C 13.800212,13.158807 13.69286,13.4478 13.696746,13.640759 C 13.707168,14.15785 13.934259,14.763876 14.278328,15.317844 C 14.622396,15.871813 15.083418,16.378004 15.566933,16.659512 C 16.210948,17.03448 16.561098,17.145443 17.127003,17.064946 C 17.692909,16.984445 18.200083,16.747661 18.828349,16.192325 C 19.940257,15.209481 20.17727,13.810321 19.774848,12.658465 C 19.372423,11.506611 18.322162,10.59805 16.866938,10.598046 z M 7.310301,10.755623 C 6.2091655,11.180144 5.3406134,12.288078 5.3406134,13.8232 C 5.3406134,14.840522 5.4961589,15.417616 6.3598096,16.18102 C 6.9943918,16.741933 7.4569631,17.05276 7.9401432,17.131369 C 8.4233176,17.209974 8.9200501,17.053578 9.6120857,16.722355 C 10.105486,16.486197 10.614433,15.964832 10.997737,15.362999 C 11.381038,14.761171 11.639029,14.087116 11.639029,13.546513 C 11.639029,13.372133 11.525966,13.096406 11.352738,12.776612 C 11.179509,12.45682 10.950953,12.093725 10.688541,11.766119 C 9.8011893,10.661554 8.5710499,10.40848 7.310301,10.755623 z M 12.52067,17.107365 C 12.701272,17.107369 12.948092,17.184225 13.194575,17.325185 C 13.441058,17.466147 13.537067,18.137348 13.720369,18.350116 C 13.928939,18.592216 13.914391,19.268565 13.849965,19.466453 C 13.649864,20.081085 13.486099,20.051914 13.305659,19.98378 C 12.626234,19.727224 13.311551,18.342336 12.52067,18.342336 C 12.229315,18.342339 12.277413,19.957532 11.996729,19.865145 C 11.716045,19.772757 11.475276,19.644104 11.348745,19.511185 C 11.206739,19.362012 11.160863,19.169513 11.193227,18.953016 C 11.225592,18.736519 11.341254,18.503627 11.504261,18.285937 C 11.830273,17.850555 11.995298,17.107365 12.52067,17.107365 z "
+ style="fill:white;fill-opacity:1;stroke:#ccc;stroke-width:0.77246445;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+</svg>
Modified: projects/ogog/trunk/public/stylesheets/ogog.css
===================================================================
--- projects/ogog/trunk/public/stylesheets/ogog.css 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/public/stylesheets/ogog.css 2007-05-20 21:03:44 UTC (rev 291)
@@ -380,7 +380,7 @@
width: 12em;
}
div.post table.post td.power {
- width: 6em;
+ width: 7em;
}
div.post table.post td.title {
width: 23.0em;
@@ -399,6 +399,9 @@
padding-left: 6.5em;
font-size: 0.8em;
}
+div.post table.post td.bad_rating {
+ width: 4em;
+}
#viewpoints table td.score {
text-align: right;
}
@@ -546,42 +549,20 @@
vertical-align: middle;
}
-span.crap_rating,
-span.crap_rating a:hover,
-span.crap_rating a:active,
-span.crap_rating a:visited {
- background: url(/images/crap.jpg) right -1000px;
+div.bad_rating,
+div.bad_rating_over {
+ float: right;
+ width: 4em;
+ height: 25px;
+ background: url(/images/bad_rating.jpg) no-repeat;
}
-span.crap_rating {
- position: relative;
- display: inline;
- width: 100px;
- height: 20px;
- overflow: hidden;
- margin: 0;
- padding: 0;
+div.bad_rating {
background-position: right top;
}
-span.crap_rating a {
- position: absolute;
- top: 0;
- right: 0;
- text-indent: -1000em;
- height: 20px;
- line-height: 20px;
- outline: none;
- overflow: hidden;
- border: none;
-}
-span.crap_rating a:hover,
-span.crap_rating a:active {
+div.bad_rating_over {
background-position: right bottom;
}
-span.crap_rating a:visited {
- background-position: right middle;
-}
-
/* Tour */
#slide {
Modified: projects/ogog/trunk/test/fixtures/taggings.yml
===================================================================
--- projects/ogog/trunk/test/fixtures/taggings.yml 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/test/fixtures/taggings.yml 2007-05-20 21:03:44 UTC (rev 291)
@@ -18,7 +18,7 @@
tag_id: 1
post_id: 3
weight: 0.0
- score:
+ score: 0.0
negative_as_of:
kevins_second_blog_post_overall:
id: 4
@@ -46,7 +46,7 @@
tag_id: 3
post_id: 1
weight: 0.0
- score:
+ score: 0.0
negative_as_of:
johns_blog_post_rocks:
id: 8
@@ -61,7 +61,7 @@
post_id: 1
weight: 0.5
score: -1.0
- negative_as_of:
+ negative_as_of: <%= 1.day.ago.iso8601 %>
kevins_second_blog_post_ducks:
id: 10
tag_id: 4
Modified: projects/ogog/trunk/test/unit/membership_test.rb
===================================================================
--- projects/ogog/trunk/test/unit/membership_test.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/test/unit/membership_test.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -27,4 +27,9 @@
assert_equal 66, Membership.find(memberships(:john_moontravel).id).percentile.to_i
assert_equal 33, m.percentile.to_i
end
+
+ def test_calculate_scores
+ Membership.calculate_scores(2)
+ assert_equal 2.45, Membership.find(memberships(:kevin_overall).id).score.to_f
+ end
end
Modified: projects/ogog/trunk/test/unit/tagging_test.rb
===================================================================
--- projects/ogog/trunk/test/unit/tagging_test.rb 2007-05-20 11:53:29 UTC (rev 290)
+++ projects/ogog/trunk/test/unit/tagging_test.rb 2007-05-20 21:03:44 UTC (rev 291)
@@ -63,6 +63,13 @@
assert_equal 0.5, Tagging.find(taggings(:johns_blog_post_rocks).id).weight
end
+ def test_remove_bad_tags
+ t_id = taggings(:eduards_blog_post_ducks).id
+ Tagging.remove_bad_tags(4.hours)
+ assert !Tagging.find_by_id(t_id)
+ assert Tagging.find(taggings(:kevins_second_blog_post_ducks).id)
+ end
+
def test_power_income
t = Tagging.find(taggings(:eduards_blog_post_moontravel).id)
assert_equal 0.09, t.power_income
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 11:53:33
|
Revision: 290
http://logilogi.svn.sourceforge.net/logilogi/?rev=290&view=rev
Author: wybow
Date: 2007-05-20 04:53:29 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Added form builder external.
Property Changed:
----------------
projects/ogog/trunk/vendor/plugins/
Property changes on: projects/ogog/trunk/vendor/plugins
___________________________________________________________________
Name: svn:externals
+ form_builders http://svn.rubaidh.com/plugins/trunk/form_builders
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 11:09:23
|
Revision: 289
http://logilogi.svn.sourceforge.net/logilogi/?rev=289&view=rev
Author: wybow
Date: 2007-05-20 04:09:19 -0700 (Sun, 20 May 2007)
Log Message:
-----------
And lib.
Added Paths:
-----------
projects/ogog/trunk/lib/
Removed Paths:
-------------
projects/ogog/lib/
Copied: projects/ogog/trunk/lib (from rev 285, projects/ogog/lib)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 11:08:53
|
Revision: 288
http://logilogi.svn.sourceforge.net/logilogi/?rev=288&view=rev
Author: wybow
Date: 2007-05-20 04:08:43 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Moving the rest...
Added Paths:
-----------
projects/ogog/trunk/README
projects/ogog/trunk/Rakefile
projects/ogog/trunk/doc/
projects/ogog/trunk/log/
projects/ogog/trunk/public/
projects/ogog/trunk/script/
projects/ogog/trunk/test/
projects/ogog/trunk/tmp/
projects/ogog/trunk/vendor/
Removed Paths:
-------------
projects/ogog/README
projects/ogog/Rakefile
projects/ogog/doc/
projects/ogog/log/
projects/ogog/public/
projects/ogog/script/
projects/ogog/test/
projects/ogog/tmp/
projects/ogog/vendor/
Deleted: projects/ogog/README
===================================================================
--- projects/ogog/README 2007-05-20 11:06:21 UTC (rev 287)
+++ projects/ogog/README 2007-05-20 11:08:43 UTC (rev 288)
@@ -1,5 +0,0 @@
-The readme is found in:
-doc/README_FOR_APP
-
-and online at:
-http://www.ogog.org/pub/doc/app/
Deleted: projects/ogog/Rakefile
===================================================================
--- projects/ogog/Rakefile 2007-05-20 11:06:21 UTC (rev 287)
+++ projects/ogog/Rakefile 2007-05-20 11:08:43 UTC (rev 288)
@@ -1,10 +0,0 @@
-# Add your own tasks in files placed in lib/tasks ending in .rake,
-# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
-
-require(File.join(File.dirname(__FILE__), 'config', 'boot'))
-
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-
-require 'tasks/rails'
Copied: projects/ogog/trunk/README (from rev 285, projects/ogog/README)
===================================================================
--- projects/ogog/trunk/README (rev 0)
+++ projects/ogog/trunk/README 2007-05-20 11:08:43 UTC (rev 288)
@@ -0,0 +1,5 @@
+The readme is found in:
+doc/README_FOR_APP
+
+and online at:
+http://www.ogog.org/pub/doc/app/
Copied: projects/ogog/trunk/Rakefile (from rev 285, projects/ogog/Rakefile)
===================================================================
--- projects/ogog/trunk/Rakefile (rev 0)
+++ projects/ogog/trunk/Rakefile 2007-05-20 11:08:43 UTC (rev 288)
@@ -0,0 +1,10 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require(File.join(File.dirname(__FILE__), 'config', 'boot'))
+
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+require 'tasks/rails'
Copied: projects/ogog/trunk/doc (from rev 285, projects/ogog/doc)
Copied: projects/ogog/trunk/log (from rev 285, projects/ogog/log)
Copied: projects/ogog/trunk/public (from rev 285, projects/ogog/public)
Copied: projects/ogog/trunk/script (from rev 285, projects/ogog/script)
Copied: projects/ogog/trunk/test (from rev 285, projects/ogog/test)
Copied: projects/ogog/trunk/tmp (from rev 285, projects/ogog/tmp)
Copied: projects/ogog/trunk/vendor (from rev 285, projects/ogog/vendor)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 11:06:23
|
Revision: 287
http://logilogi.svn.sourceforge.net/logilogi/?rev=287&view=rev
Author: wybow
Date: 2007-05-20 04:06:21 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Test move filled with files.
Added Paths:
-----------
projects/ogog/trunk/components/
projects/ogog/trunk/config/
projects/ogog/trunk/db/
Removed Paths:
-------------
projects/ogog/components/
projects/ogog/config/
projects/ogog/db/
Copied: projects/ogog/trunk/components (from rev 285, projects/ogog/components)
Copied: projects/ogog/trunk/config (from rev 285, projects/ogog/config)
Copied: projects/ogog/trunk/db (from rev 285, projects/ogog/db)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 11:05:03
|
Revision: 286
http://logilogi.svn.sourceforge.net/logilogi/?rev=286&view=rev
Author: wybow
Date: 2007-05-20 04:05:00 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Text move.
Added Paths:
-----------
projects/ogog/trunk/app/
Removed Paths:
-------------
projects/ogog/app/
Copied: projects/ogog/trunk/app (from rev 285, projects/ogog/app)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 10:52:27
|
Revision: 285
http://logilogi.svn.sourceforge.net/logilogi/?rev=285&view=rev
Author: wybow
Date: 2007-05-20 03:52:22 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Dir test.
Added Paths:
-----------
projects/ogog/trunk/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 10:51:25
|
Revision: 284
http://logilogi.svn.sourceforge.net/logilogi/?rev=284&view=rev
Author: wybow
Date: 2007-05-20 03:51:21 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Testing commit, as it erred...
Modified Paths:
--------------
projects/ogog/doc/README_FOR_APP
Modified: projects/ogog/doc/README_FOR_APP
===================================================================
--- projects/ogog/doc/README_FOR_APP 2007-05-20 09:51:03 UTC (rev 283)
+++ projects/ogog/doc/README_FOR_APP 2007-05-20 10:51:21 UTC (rev 284)
@@ -24,7 +24,7 @@
(shared with the LogiLogi project)
If you want to discuss OgOg you are invited to
-{join our mailing-list}[https://lists.sourceforge.net/lists/listinfo/logilogi-list]
+{join our mailing-list}[https://lists.sourceforge.net/lists/listinfo/logilogi-list].
== Installation
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-20 09:51:14
|
Revision: 283
http://logilogi.svn.sourceforge.net/logilogi/?rev=283&view=rev
Author: wybow
Date: 2007-05-20 02:51:03 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Initial import of side-project ogog.org
Added Paths:
-----------
projects/
projects/ogog/
projects/ogog/README
projects/ogog/Rakefile
projects/ogog/app/
projects/ogog/app/controllers/
projects/ogog/app/controllers/account_controller.rb
projects/ogog/app/controllers/application.rb
projects/ogog/app/controllers/doc_controller.rb
projects/ogog/app/controllers/download_controller.rb
projects/ogog/app/controllers/feed_controller.rb
projects/ogog/app/controllers/post_controller.rb
projects/ogog/app/controllers/user_controller.rb
projects/ogog/app/helpers/
projects/ogog/app/helpers/application_helper.rb
projects/ogog/app/helpers/feed_helper.rb
projects/ogog/app/helpers/post_helper.rb
projects/ogog/app/helpers/user_helper.rb
projects/ogog/app/models/
projects/ogog/app/models/context.rb
projects/ogog/app/models/feed.rb
projects/ogog/app/models/link.rb
projects/ogog/app/models/membership.rb
projects/ogog/app/models/post.rb
projects/ogog/app/models/tag.rb
projects/ogog/app/models/tagging.rb
projects/ogog/app/models/user.rb
projects/ogog/app/models/vote.rb
projects/ogog/app/views/
projects/ogog/app/views/account/
projects/ogog/app/views/account/_login.rhtml
projects/ogog/app/views/account/forgot.rhtml
projects/ogog/app/views/account/login.rhtml
projects/ogog/app/views/account/signup.rhtml
projects/ogog/app/views/doc/
projects/ogog/app/views/doc/_slide.rhtml
projects/ogog/app/views/doc/api.rhtml
projects/ogog/app/views/doc/tour.rhtml
projects/ogog/app/views/feed/
projects/ogog/app/views/feed/_last_post.rhtml
projects/ogog/app/views/feed/_last_posts.rhtml
projects/ogog/app/views/feed/claim.rhtml
projects/ogog/app/views/feed/new.rhtml
projects/ogog/app/views/feed/show.rhtml
projects/ogog/app/views/layouts/
projects/ogog/app/views/layouts/main.rhtml
projects/ogog/app/views/post/
projects/ogog/app/views/post/_cloud.rhtml
projects/ogog/app/views/post/_double_url_bar.rhtml
projects/ogog/app/views/post/_post.rhtml
projects/ogog/app/views/post/_post_top_block_score.rhtml
projects/ogog/app/views/post/_posts.rhtml
projects/ogog/app/views/post/_rating_bar.rhtml
projects/ogog/app/views/post/_viewpoints.rhtml
projects/ogog/app/views/post/index.rhtml
projects/ogog/app/views/post/rate.rjs
projects/ogog/app/views/post/viewpoint.rhtml
projects/ogog/app/views/shared/
projects/ogog/app/views/shared/_menu.rhtml
projects/ogog/app/views/shared/_single_url_bar.rhtml
projects/ogog/app/views/shared/_sponsoring.rhtml
projects/ogog/app/views/user/
projects/ogog/app/views/user/_badge.rhtml
projects/ogog/app/views/user/_badges.rhtml
projects/ogog/app/views/user/badge.rhtml
projects/ogog/app/views/user/new.rhtml
projects/ogog/app/views/user/show.rhtml
projects/ogog/components/
projects/ogog/config/
projects/ogog/config/boot.rb
projects/ogog/config/daemons.yml
projects/ogog/config/database.yml.tmpl
projects/ogog/config/environment.rb.tmpl
projects/ogog/config/environments/
projects/ogog/config/environments/development.rb
projects/ogog/config/environments/production.rb
projects/ogog/config/environments/test.rb
projects/ogog/config/routes.rb
projects/ogog/db/
projects/ogog/db/migrate/
projects/ogog/db/migrate/001_initial_schema.rb
projects/ogog/db/schema.rb
projects/ogog/doc/
projects/ogog/doc/CONTRIBUTORS.txt
projects/ogog/doc/LICENSE.txt
projects/ogog/doc/README_FOR_APP
projects/ogog/lib/
projects/ogog/lib/daemons/
projects/ogog/lib/daemons/feedharvester.rb
projects/ogog/lib/daemons/ranking.rb
projects/ogog/lib/daemons/ranking_ctl
projects/ogog/lib/extensions/
projects/ogog/lib/extensions/active_support.rb
projects/ogog/lib/extensions/array.rb
projects/ogog/lib/extensions/cgi.rb
projects/ogog/lib/extensions/fixnum.rb
projects/ogog/lib/extensions/float.rb
projects/ogog/lib/extensions/module.rb
projects/ogog/lib/extensions/nil_class.rb
projects/ogog/lib/extensions/tabular_form_builder.rb
projects/ogog/lib/extensions.rb
projects/ogog/lib/modules/
projects/ogog/lib/modules/body_builder_module.rb
projects/ogog/lib/task_helper.rb
projects/ogog/lib/tasks/
projects/ogog/lib/tasks/commit.rake
projects/ogog/lib/tasks/do_check_commit.rake
projects/ogog/lib/tasks/do_commit.rake
projects/ogog/lib/tasks/do_dev_db.rake
projects/ogog/lib/tasks/do_docs.rake
projects/ogog/lib/tasks/do_update.rake
projects/ogog/lib/tasks/redo_dev_db.rake
projects/ogog/log/
projects/ogog/public/
projects/ogog/public/.htaccess
projects/ogog/public/404.html
projects/ogog/public/500.html
projects/ogog/public/dispatch.cgi
projects/ogog/public/dispatch.fcgi
projects/ogog/public/dispatch.rb
projects/ogog/public/favicon.ico
projects/ogog/public/images/
projects/ogog/public/images/badge-logo.png
projects/ogog/public/images/badge-logo.svg
projects/ogog/public/images/bar.jpg
projects/ogog/public/images/bar.svg
projects/ogog/public/images/feed.png
projects/ogog/public/images/logo.jpg
projects/ogog/public/images/logo.svg
projects/ogog/public/images/rails.png
projects/ogog/public/images/req_rec.png
projects/ogog/public/images/req_rec.svg
projects/ogog/public/images/skull.png
projects/ogog/public/images/skull.svg
projects/ogog/public/images/skulls.jpg
projects/ogog/public/images/skulls.svg
projects/ogog/public/images/star.png
projects/ogog/public/images/star.svg
projects/ogog/public/images/stars.jpg
projects/ogog/public/images/stars.svg
projects/ogog/public/images/tour/
projects/ogog/public/images/tour/0.png
projects/ogog/public/images/tour/0.svg
projects/ogog/public/images/tour/1.png
projects/ogog/public/images/tour/1.svg
projects/ogog/public/images/tour/2.png
projects/ogog/public/images/tour/2.svg
projects/ogog/public/images/tour/3.png
projects/ogog/public/images/tour/3.svg
projects/ogog/public/images/tour/4.png
projects/ogog/public/images/tour/4.svg
projects/ogog/public/images/tour/5.png
projects/ogog/public/images/tour/5.svg
projects/ogog/public/images/tour/6.png
projects/ogog/public/images/tour/6.svg
projects/ogog/public/images/tour/7.png
projects/ogog/public/images/tour/7.svg
projects/ogog/public/javascripts/
projects/ogog/public/javascripts/application.js
projects/ogog/public/javascripts/controls.js
projects/ogog/public/javascripts/dragdrop.js
projects/ogog/public/javascripts/effects.js
projects/ogog/public/javascripts/prototype.js
projects/ogog/public/pub/
projects/ogog/public/pub/test/
projects/ogog/public/pub/test/lama/
projects/ogog/public/pub/test/lama/badgedindex.html
projects/ogog/public/pub/test/lama/feed/
projects/ogog/public/pub/test/lama/feed/feed.atom
projects/ogog/public/pub/test/lama/linkedindex.html
projects/ogog/public/pub/test/lama/posts/
projects/ogog/public/pub/test/lama/posts/post1.html
projects/ogog/public/pub/test/lama/posts/post2.html
projects/ogog/public/pub/test/lama/posts/post3.html
projects/ogog/public/pub/test/rules.htm
projects/ogog/public/robots.txt
projects/ogog/public/source.zip
projects/ogog/public/stylesheets/
projects/ogog/public/stylesheets/ogog-ie.css
projects/ogog/public/stylesheets/ogog-ie6.css
projects/ogog/public/stylesheets/ogog.css
projects/ogog/script/
projects/ogog/script/about
projects/ogog/script/breakpointer
projects/ogog/script/console
projects/ogog/script/destroy
projects/ogog/script/generate
projects/ogog/script/performance/
projects/ogog/script/performance/benchmarker
projects/ogog/script/performance/profiler
projects/ogog/script/plugin
projects/ogog/script/process/
projects/ogog/script/process/inspector
projects/ogog/script/process/reaper
projects/ogog/script/process/spawner
projects/ogog/script/runner
projects/ogog/script/server
projects/ogog/test/
projects/ogog/test/fixtures/
projects/ogog/test/fixtures/feeds.yml
projects/ogog/test/fixtures/memberships.yml
projects/ogog/test/fixtures/posts.yml
projects/ogog/test/fixtures/taggings.yml
projects/ogog/test/fixtures/tags.yml
projects/ogog/test/fixtures/users.yml
projects/ogog/test/fixtures/votes.yml
projects/ogog/test/functional/
projects/ogog/test/functional/post_controller_test.rb
projects/ogog/test/integration/
projects/ogog/test/mocks/
projects/ogog/test/mocks/development/
projects/ogog/test/mocks/test/
projects/ogog/test/test_helper.rb
projects/ogog/test/unit/
projects/ogog/test/unit/context_test.rb
projects/ogog/test/unit/extensions/
projects/ogog/test/unit/extensions/array_test.rb
projects/ogog/test/unit/extensions/fixnum_test.rb
projects/ogog/test/unit/extensions/float_test.rb
projects/ogog/test/unit/extensions/nil_class_test.rb
projects/ogog/test/unit/feed_test.rb
projects/ogog/test/unit/link_test.rb
projects/ogog/test/unit/membership_test.rb
projects/ogog/test/unit/post_test.rb
projects/ogog/test/unit/tag_test.rb
projects/ogog/test/unit/tagging_test.rb
projects/ogog/test/unit/user_test.rb
projects/ogog/test/unit/vote_test.rb
projects/ogog/tmp/
projects/ogog/tmp/cache/
projects/ogog/tmp/pids/
projects/ogog/tmp/sessions/
projects/ogog/tmp/sockets/
projects/ogog/vendor/
projects/ogog/vendor/plugins/
Added: projects/ogog/README
===================================================================
--- projects/ogog/README (rev 0)
+++ projects/ogog/README 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,5 @@
+The readme is found in:
+doc/README_FOR_APP
+
+and online at:
+http://www.ogog.org/pub/doc/app/
Added: projects/ogog/Rakefile
===================================================================
--- projects/ogog/Rakefile (rev 0)
+++ projects/ogog/Rakefile 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,10 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require(File.join(File.dirname(__FILE__), 'config', 'boot'))
+
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+require 'tasks/rails'
Added: projects/ogog/app/controllers/account_controller.rb
===================================================================
--- projects/ogog/app/controllers/account_controller.rb (rev 0)
+++ projects/ogog/app/controllers/account_controller.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,132 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+
+require "pathname"
+require "cgi"
+
+# load the openid library
+begin
+ require "rubygems"
+ require_gem "ruby-openid", ">= 1.0.2"
+rescue LoadError
+ require "openid"
+end
+
+class AccountController < ApplicationController
+ layout 'main'
+
+ ### Filters
+
+ before_filter :build_bodies,
+ : [:signup, :login, :forgot]
+
+ ### Bodies
+
+ url_bar_body :single_tagless_url_bar
+
+ ### Metheds
+
+ # Explanation + offer to signup with OpenID
+ #
+ def signup
+ end
+
+ # Help people out with forgotten passwords.
+ #
+ def forgot
+ end
+
+ # Processes the login request, disovers the openid server, and
+ # then redirects.
+ #
+ def login
+ openid_url = params[:account][:openid_url]
+ if request.post?
+ request = consumer.begin(openid_url)
+
+ case request.status
+ when OpenID::SUCCESS
+ return_to = url_for(:action => 'complete')
+ trust_root = url_for(:controller =>'')
+
+ url = request.redirect_url(trust_root, return_to)
+ redirect_to(url)
+ return
+ when OpenID::FAILURE
+ escaped_url = CGI::escape(openid_url)
+ flash[:notice] = "Could not find OpenID server for #{escaped_url}"
+ else
+ flash[:notice] = "An unknown error occured."
+ end
+ end
+ end
+
+ # Handles the openid server response.
+ #
+ def complete
+ response = consumer.complete(params)
+
+ case response.status
+ when OpenID::SUCCESS
+ @user = User.get(response.identity_url)
+
+ flash[:notice] = "Verified as #{response.identity_url}"
+
+ if @user.nil?
+ # create user object if one does not exist
+ session[:openid_url] = response.identity_url
+ redirect_to new_user_url()
+ else
+ session[:user_id] = @user.id
+ if request.env["HTTP_REFERER"].nil?
+ redirect_to index_url()
+ else
+ redirect_to :back
+ end
+ end
+ return
+ when OpenID::FAILURE
+ if response.identity_url
+ flash[:notice] = "Verification of #{CGI::escape(response.identity_url)} failed."
+ else
+ flash[:notice] = 'Verification failed.'
+ end
+ when OpenID::CANCEL
+ flash[:notice] = 'Verification cancelled.'
+ else
+ flash[:notice] = 'Unknown response from OpenID server.'
+ end
+ redirect_to :action => 'login'
+ end
+
+ # Terminates the session.
+ #
+ def logout
+ session[:user_id] = nil
+ User.reset
+ redirect_to :back
+ end
+
+ private
+
+ # Gets the OpenID::Consumer object.
+ #
+ def consumer
+ # create the OpenID store for storing associations and nonces,
+ # putting it in your app's db directory
+ store_dir = Pathname.new(RAILS_ROOT).join('db').join('openid-store')
+ store = OpenID::FilesystemStore.new(store_dir)
+
+ return OpenID::Consumer.new(session, store)
+ end
+end
Added: projects/ogog/app/controllers/application.rb
===================================================================
--- projects/ogog/app/controllers/application.rb (rev 0)
+++ projects/ogog/app/controllers/application.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,95 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+
+class ApplicationController < ActionController::Base
+ ### Inclusions
+
+ # Pick a unique cookie name to distinguish our session data from others'
+ session :session_key => '_trunk_session_id'
+
+ include BodyBuilderModule # Bodies and body_parts.
+
+ ### Filters
+
+ before_filter :get_user, :resolve_context
+
+ ### Bodies
+
+ body_parts :url_bar, :left, :right
+
+ left_body :menu
+
+ right_body :sponsoring,
+ :except => [:index]
+
+ ### Filter functions
+
+ def get_user
+ if session[:user_id]
+ User.current = User.find(session[:user_id])
+ else
+ User.reset
+ end
+ return true
+ end
+
+ def resolve_context
+ if params[:link_string]
+ begin
+ Context.current = Context.new(Link.new_from_s(params[:link_string]))
+ rescue
+ Context.current = Context.new(Link.new_from_s(params[:link_string].split('/')[-3..-1].join('/')))
+ flash.now[:notice] = 'Only 3 stacked tags can be requested at the same time'
+ end
+ Context.current.resolve
+ else
+ Context.current = Context.new(Tag.or_new_from_s(params[:tag_string]))
+ end
+ end
+
+ ### Body functions
+
+ def menu
+ render_to_string(:partial => 'shared/menu',
+ :locals => {:action => params[:action]})
+ end
+
+ def sponsoring
+ render_to_string(:partial => 'shared/sponsoring')
+ end
+
+ ### Methods
+
+ def single_url_bar
+ url = url_for(params.merge(:only_path => true)).slice(1..-1).split('/')[0...-1].join(' / ')
+ render_to_string(:partial => 'shared/single_url_bar',
+ :locals => {:url => url, :tag => Context.current.tag})
+ end
+
+ def single_tagless_url_bar
+ url = url_for(params.merge(:only_path => true)).slice(1..-1).split('/').join(' / ')
+ render_to_string(:partial => 'shared/single_url_bar',
+ :locals => {:url => url, :tag => nil})
+ end
+
+ ### Hacks
+
+ def help
+ Helper.instance
+ end
+
+ class Helper
+ include Singleton
+ include ApplicationHelper
+ end
+end
Added: projects/ogog/app/controllers/doc_controller.rb
===================================================================
--- projects/ogog/app/controllers/doc_controller.rb (rev 0)
+++ projects/ogog/app/controllers/doc_controller.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,52 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+
+class DocController < ApplicationController
+ layout 'main'
+
+ ### Filters
+
+ before_filter :build_bodies
+
+ ### Bodies
+
+ url_bar_body :single_tagless_url_bar
+
+ ### Filter functions
+
+ ### Methods
+
+ def tour
+ @slide_s = slide_s
+ end
+
+ def faq
+ end
+
+ def api
+ end
+
+ # AJAX
+
+ def slide
+ render :text => slide_s
+ end
+
+ # Private
+
+ private
+
+ def slide_s
+ render_to_string(:partial => 'slide', :locals => {:page => params[:page].to_i, :max => 7})
+ end
+end
Added: projects/ogog/app/controllers/download_controller.rb
===================================================================
--- projects/ogog/app/controllers/download_controller.rb (rev 0)
+++ projects/ogog/app/controllers/download_controller.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,55 @@
+#--#
+# Copyright: (c) 2006, 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogiLogi program. LogiLogi is free software. You
+# can run/distribute/modify LogiLogi under the terms of the Affero General
+# Public License version 1 or any later version. The Affero GPL states that
+# running a modified version or a derivative work also requires you to make
+# the sourcecode of that work available to everyone that can interact with
+# it. We chose the Affero GPL to ensure that LogiLogi remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+
+class DownloadController < ApplicationController
+ def regenerate_source_archive
+ Zip::ZipFile.open("tmp/source.zip", Zip::ZipFile::CREATE) {|zipfile|
+ globs = Array.new
+ files = Array.new
+ files.push("Rakefile",
+ "README")
+ globs.push(File.join("app","**", "*.rb"))
+ globs.push(File.join("components","**", "*.rb"))
+ globs.push(File.join("config","**", "*.tmpl"))
+ files.push("config/routes.rb",
+ "config/environment.rb",
+ "config/boot.rb",
+ "config/daemons.yml")
+ globs.push(File.join("config/environments","**", "*.tmpl"))
+ globs.push(File.join("db","**", "*.rb"))
+ files.push("doc/LICENSE.txt",
+ "doc/README_FOR_APP")
+ globs.push(File.join("lib","**", "*.rb"))
+ globs.push(File.join("lib","**", "*.rake"))
+ globs.push(File.join("public","**", "[^.]*"))
+ globs.push(File.join("script","**", "[^.]*"))
+ globs.push(File.join("test","**", "*.rb"))
+ globs.push(File.join("test","**", "*.yml"))
+ globs.push(File.join("vendor","**", "[^.]*"))
+ globs.each {|glob|
+ files.concat(Dir.glob(glob))
+ }
+ files.each {|file_name|
+ if File.exists?(file_name)
+ zipfile.add(file_name,file_name)
+ end
+ }
+ }
+ File.rename("tmp/source.zip","public/source.zip")
+ end
+
+ def source
+ self.regenerate_source_archive
+ send_file "public/source.zip", :filename => 'source.zip'
+ end
+end
Added: projects/ogog/app/controllers/feed_controller.rb
===================================================================
--- projects/ogog/app/controllers/feed_controller.rb (rev 0)
+++ projects/ogog/app/controllers/feed_controller.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,98 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+
+class FeedController < ApplicationController
+ layout 'main'
+
+ ### Filters
+
+ before_filter :find,
+ :except => [:new, :create]
+ before_filter :build_bodies,
+ :except => [:create, :update]
+
+ ### Bodies
+
+ url_bar_body :single_tagless_url_bar
+
+ ### Filter functions
+
+ def find
+ @feed = Feed.find(params[:id])
+ end
+
+ ### Body functions
+
+ ### Methods
+
+ # Crud
+
+ def index
+ end
+
+ def new
+ end
+
+ def create
+ @feed = Feed.new(:url => params[:feed][:url])
+ @feed.save
+ @feed.harvest
+ if !@feed.bad?
+ redirect_to claim_feed_url(@feed)
+ else
+ flash[:error] = 'Your feed could not be processed, check the url or the feed-status below'
+ redirect_to feed_url(@feed)
+ end
+ end
+
+ def claim
+ if request.method == :post
+ begin
+ @feed.claim
+ flash[:notice] = 'Successfully claimed feed'
+ redirect_to feed_url(@feed)
+ rescue
+ flash[:error] = $!
+ end
+ end
+ end
+
+ def show
+ @last_posts_s = last_posts_s
+ end
+
+ def edit
+ end
+
+ def update
+ end
+
+ def delete
+ end
+
+ # AJAX
+
+ def last_posts
+ render :text => last_posts_s
+ end
+
+ # Private
+
+ def last_posts_s
+ pages = Paginator.new(self, @feed.posts.count, 7, params[:page])
+ posts = @feed.posts.find(:all, :limit => pages.items_per_page, :offset => pages.current.offset,
+ :order => 'published_at DESC')
+ render_to_string(:partial => 'last_posts', :locals => {
+ :pages => pages, :posts => posts, :feed => @feed})
+ end
+end
Added: projects/ogog/app/controllers/post_controller.rb
===================================================================
--- projects/ogog/app/controllers/post_controller.rb (rev 0)
+++ projects/ogog/app/controllers/post_controller.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,118 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+
+class PostController < ApplicationController
+ layout 'main'
+
+ ### Filters
+
+ before_filter :find,
+ :except => [:index, :new_posts, :top_posts]
+ before_filter :build_bodies
+
+ ### Bodies
+
+ url_bar_body :double_url_bar,
+ : [:index]
+ url_bar_body :single_url_bar,
+ :except => [:index]
+
+# left_body :cloud,
+# : [:index]
+ left_body :viewpoints,
+ : [:viewpoint]
+
+ ### Filter functions
+
+ def find
+ @post = Post.find(params[:id])
+ end
+
+ ### Body functions
+
+ def double_url_bar
+ render_to_string(:partial => 'double_url_bar')
+ end
+
+ def cloud
+ tags = Tag.top_tags(Context.current.link.received_tags, :order => "count DESC, word", :limit => 100).
+ sort_by {|tag| tag.word}
+ render_to_string(:partial => 'cloud',
+ :locals => {:tags => tags})
+ end
+
+ def viewpoints
+ render_to_string(:partial => 'viewpoints',
+ :locals => {
+ :post => @post,
+ :taggings => @post.taggings.order_by_score,
+ :current_tagging => @post.tagging_for(Context.current.tag)})
+ end
+
+ ### Methods
+
+ def index
+ @new_posts_s = new_posts_s
+ @top_posts_s = top_posts_s
+ end
+
+ def viewpoint
+ end
+
+ # Misc
+
+ def rate
+ if !params[:score] or !params[:id]
+ raise 'Missing parameter'
+ end
+ @post.rate(params[:score].to_i, Context.current.tag, request.env['REMOTE_ADDR'])
+ end
+
+ # AJAX
+
+ def new_posts
+ render :text => new_posts_s
+ end
+
+ def top_posts
+ render :text => top_posts_s
+ end
+
+ # Private
+
+ private
+
+ def new_posts_s
+ conditions = 'p.published_at >= "' + 1.week.ago.to_s(:db) + '"'
+ received_tags = Context.current.link.received_tags
+ pages = Paginator.new(self,
+ Tagging.count_posts_for(received_tags, :conditions => conditions), 7, params[:page])
+ posts = Tagging.top_posts_for(received_tags, :conditions => conditions,
+ :limit => pages.items_per_page, :offset => pages.current.offset)
+ render_to_string(:partial => 'posts', :locals => {
+ :pages => pages, :posts => posts, :update => 'new_posts_s',
+ :action => :new_posts, :link_string => Context.current.link.to_s})
+ end
+
+ def top_posts_s
+ conditions = 'p.published_at < "' + 1.week.ago.to_s(:db) + '"'
+ received_tags = Context.current.link.received_tags
+ pages = Paginator.new(self,
+ Tagging.count_posts_for(received_tags, :conditions => conditions), 7, params[:page])
+ posts = Tagging.top_posts_for(received_tags,:conditions => conditions,
+ :limit => pages.items_per_page, :offset => pages.current.offset)
+ render_to_string(:partial => 'posts', :locals => {
+ :pages => pages, :posts => posts, :update => 'top_posts_s',
+ :link_string => Context.current.link.to_s, :action => :top_posts})
+ end
+end
Added: projects/ogog/app/controllers/user_controller.rb
===================================================================
--- projects/ogog/app/controllers/user_controller.rb (rev 0)
+++ projects/ogog/app/controllers/user_controller.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,164 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+
+class UserController < ApplicationController
+ layout 'main'
+
+ ### Filters
+
+ before_filter :find
+ before_filter :order_memberships,
+ : [:show]
+ before_filter :build_bodies
+
+ ### Bodies
+
+ url_bar_body :single_tagless_url_bar
+
+ left_body :cloud,
+ : [:index]
+ left_body :badges,
+ : [:show]
+
+ ### Filter functions
+
+ def find
+ if params[:openid_url]
+ @user = User.find_by_openid_url(params[:openid_url])
+ else
+ @user = User.find_by_name(params[:id])
+ end
+ if !@user
+ respond_to do |format|
+ format.html do
+ flash[:warning] = 'Requested user does not exist'
+ redirect_to main_url()
+ end
+ format.json do
+ render :json => {}.to_json
+ end
+ format.xml do
+ render :xml => {}.to_xml(:root => 'badge')
+ end
+ end
+ return false
+ end
+ end
+
+ def order_memberships
+ @memberships = @user.memberships.order_by_percentile
+ end
+
+ ### Body functions
+
+ def cloud
+ render_to_string(:partial => 'cloud')
+ end
+
+ def badges
+ render_to_string(:partial => 'badges',
+ :locals => {:user => @user, :memberships => @memberships})
+ end
+
+ ### CRUD-methods
+
+ def index
+ end
+
+ def new
+ if session[:openid_url]
+ @user = User.new(:name => User.suggest_word_from_openid_url(session[:openid_url]))
+ else
+ flash.now[:warning] = "You need to have cookies enabled to create and use an account. Enable them and login again."
+ end
+ end
+
+ def create
+ if session[:openid_url]
+ begin
+ params[:user][:openid_url] = session[:openid_url]
+ @user = User.new(params[:user])
+ User.transaction(@user) do
+ if @user.save
+ session[:openid_url] = nil
+ session[:user_id] = @user.id
+ redirect_to user_url(:id => @user.name)
+ else
+ flash[:warning] = "User account could not be created! Please retry."
+ redirect_to new_user_url()
+ end
+ end
+ rescue
+ flash[:warning] = "Error creating User. Please try again later."
+ redirect_to new_user_url()
+ end
+ else
+ flash[:warning] = "Your openid_url was lost from the session. Please report this bug."
+ redirect_to new_user_url()
+ end
+ end
+
+ def show
+ @last_posts = @user.last_posts
+ end
+
+ def badge
+ percentile = @user.percentile_for(Context.current.tag)
+ respond_to do |format|
+ format.html
+ format.json do
+ render :json => {
+ :tag => Context.current.tag.to_s,
+ :percentile => percentile,
+ :power => @user.voting_power_for(Context.current.tag),
+ :user => @user.name}.to_json
+ end
+ format.xml do
+ render :xml => {
+ :tag => Context.current.tag.to_s,
+ :percentile => percentile,
+ :power => @user.voting_power_for(Context.current.tag),
+ :user => @user.name}.to_xml(:root => 'badge')
+ end
+ format.png do
+ percentile = percentile.round
+ img = Magick::ImageList.new("#{RAILS_ROOT}/public/images/badge-logo.png")
+
+ text = Magick::Draw.new
+ text.font_family = 'verdana'
+
+ text.annotate(img, 0,0,5,7, @user.full_name) {
+ self.pointsize = 10
+ self.gravity = Magick::NorthWestGravity
+ }
+ text.annotate(img, 0,0,5,-3, help.percentile_in_words(percentile) + ' at') {
+ self.pointsize = 10
+ self.gravity = Magick::WestGravity
+ }
+ text.annotate(img, 0,0,0,5, Context.current.tag.to_s) {
+ self.pointsize = 15
+ self.gravity = Magick::SouthGravity
+ }
+ text.annotate(img, 0,0,(percentile == 100 ? 5 : (percentile < 10 ? 16 : 10)),11, percentile.to_s) {
+ self.pointsize = 24
+ self.font_weight = Magick::BoldWeight
+ self.gravity = Magick::NorthEastGravity
+ }
+
+ send_data img.to_blob, :filename => "badge.png",
+ :disposition => 'inline',
+ :type => 'image/png'
+ end
+ end
+ end
+end
Added: projects/ogog/app/helpers/application_helper.rb
===================================================================
--- projects/ogog/app/helpers/application_helper.rb (rev 0)
+++ projects/ogog/app/helpers/application_helper.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,128 @@
+# Methods added to this helper will be available to all templates in the application.
+module ApplicationHelper
+ include Rubaidh::TabularForm
+
+ def link_to_tag(tag, options = {})
+ link_to(tag.to_s, index_url({:link_string => tag.to_s}),options)
+ end
+
+ def link_to_post(string, post, tag, options = {})
+ link_to string, show_url({:tag_string => tag.to_s,
+ :action => 'viewpoint', :id => post}.merge(options))
+ end
+
+ def link_to_user(user)
+ link_to user.name, user_url(:id => user.name)
+ end
+
+ def link_to_feed(feed)
+ link_to feed.title, feed_url(feed)
+ end
+
+ def score_image(score)
+ if score.nil?
+ image = 'star'
+ else
+ image = (score >= 0 ? 'star' : 'skull')
+ end
+ # Below is a hack for the DXImageTransform IE CSS hack
+ return '<div class="score_image score_image_' + image + '">' +
+ image_tag(image + '.png', :class => 'score', :size => '90x90') +
+ '</div>'
+ end
+
+ def score_nr(score)
+ (score ? number_with_precision(score, 1) : '~')
+ end
+
+ def tagging_score(tagging)
+ '<span class="score">' + score_nr(tagging.score) + '</span>'
+ end
+
+ def membership_percentile(membership)
+ '<span class="percentile fixed">' + number_with_precision(membership.percentile, 1) + ' %</span>'
+ end
+
+ def tagging_power(tagging)
+ voting_power(tagging.weight)
+ end
+
+ def voting_power(voting_power)
+ '<span class="power">' + number_with_precision(voting_power, 1) + '</span>'
+ end
+
+ def score_in_words(score)
+ if score.nil?
+ Tagging::SCORES[score]
+ else
+ Tagging::SCORES[score.round]
+ end
+ end
+
+ def percentile_in_words(percentile)
+ if percentile <= 10
+ return 'just started'
+ else
+ score = ((percentile - 10) / 18.0).ceil
+ return Tagging::SCORES[score]
+ end
+ end
+
+ def display_standard_flashes
+ flashes = []
+ if flash[:error]
+ flashes << ['Error: ' + flash[:error], 'error']
+ end
+ if flash[:warning]
+ flashes << [flash[:warning], 'warning']
+ end
+ if flash[:notice]
+ flashes << [flash[:notice], 'notice']
+ end
+ if flashes.empty?
+ return
+ end
+ content = flashes.collect { |flash_arr|
+ content_tag('span', flash_arr[0], :class => "#{flash_arr[1]}")
+ }
+ if !flashes.empty?
+ content_tag('div', content.join('<br />'), :id => 'flash', :class => 'box large noticable')
+ else
+ ''
+ end
+ end
+
+ def ajax_pagination_links(paginator, options={})
+ options[:params].delete(:page)
+ options.merge!(ActionView::Helpers::PaginationHelper::DEFAULT_OPTIONS) {|key, old, new| old}
+
+ window_pages = paginator.current.window(options[:window_size]).pages
+
+ return if window_pages.length <= 1 unless
+ options[:link_to_current_page]
+
+ first, last = paginator.first, paginator.last
+
+ returning html = '' do
+ if options[:always_show_anchors] and not window_pages[0].first?
+ html << link_to_remote(first.number, :update => options[:update], :url => { options[:name] => first }.update(options[:params] ))
+ html << ' ... ' if window_pages[0].number - first.number > 1
+ html << ' '
+ end
+
+ window_pages.each do |page|
+ if paginator.current == page && !options[:link_to_current_page]
+ html << page.number.to_s
+ else
+ html << link_to_remote(page.number, :update => options[:update], :url => { options[:name] => page }.update(options[:params] ))
+ end
+ html << ' '
+ end
+
+ if options[:always_show_anchors] && !window_pages.last.last?
+ html << ' ... ' if last.number - window_pages[-1].number > 1
+ html << link_to_remote(paginator.last.number, :update => options[:update], :url => { options[:name] => last }.update( options[:params]))
+ end
+ end
+ end
+end
Added: projects/ogog/app/helpers/feed_helper.rb
===================================================================
--- projects/ogog/app/helpers/feed_helper.rb (rev 0)
+++ projects/ogog/app/helpers/feed_helper.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,2 @@
+module FeedHelper
+end
Added: projects/ogog/app/helpers/post_helper.rb
===================================================================
--- projects/ogog/app/helpers/post_helper.rb (rev 0)
+++ projects/ogog/app/helpers/post_helper.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,40 @@
+module PostHelper
+ def context_url_bar_link(options)
+ link = Context.current.link
+ link_url = '<ul>'
+ (0...(link.size(options[:direction]))).each { |i|
+ link_url += '<li>' + link_to(link.tags(options[:direction])[i],
+ {:action => 'index', :link_string => link.to_s(
+ :direction => options[:direction], :step => i)}) +
+ '</li><li><span class="slash_separator">/</span></li>'
+ }
+ link_url.slice!(-47..-1) # slice off separator-span again
+ return link_url + '</ul>'
+ end
+
+ def tag_cloud(tags, classes)
+ max, min = 0, 0
+ tags.each { |tag|
+ count = tag.count.to_i
+ max = count if count > max
+ min = count if count < min
+ }
+
+ divisor = ((max - min) / classes.size) + 1
+
+ tags.each { |tag|
+ yield tag, classes[(tag.count.to_i - min) / divisor]
+ }
+ end
+
+ def link_to_cloud_tag(tag, css_class)
+ context = Context.current
+ link = '<span class="cloud ' + css_class + '">' + link_to(truncate(tag.to_s, 20), index_url({:link_string => tag.to_s})) + ' '
+ if tag != Tag.overall && !context.link.requested_tags.include?(tag)
+ link << link_to('/+', index_url({:link_string => context.link.to_s + '/' + tag.to_s}))
+ else
+ link << '/~'
+ end
+ return link + '</span>'
+ end
+end
Added: projects/ogog/app/helpers/user_helper.rb
===================================================================
--- projects/ogog/app/helpers/user_helper.rb (rev 0)
+++ projects/ogog/app/helpers/user_helper.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,2 @@
+module UserHelper
+end
Added: projects/ogog/app/models/context.rb
===================================================================
--- projects/ogog/app/models/context.rb (rev 0)
+++ projects/ogog/app/models/context.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,53 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+#
+# Used to store the user location...
+
+class Context
+ ### Relationships
+
+ cattr_accessor :current
+ attr_accessor :link, :tag
+
+ ### Constructors
+
+ # Creates a new context and sets it as the current Context.
+ #
+ def initialize(link_or_tag)
+ if link_or_tag.kind_of?(Link)
+ self.link = link_or_tag
+ else
+ self.tag = link_or_tag
+ end
+ end
+
+ # Makes sure that the given context/tag-string will be set with the
+ # default tag if empty.
+ #
+ def self.assert_tag(string)
+ if string.nil? or string.size == 0
+ return OgOg::Config::OVERALL_TAG_STRING
+ else
+ return string
+ end
+ end
+
+ ### Methods
+
+ # Resolves the link and sets the tag.
+ #
+ def resolve
+ self.link.resolve
+ self.tag = self.link.received_tags.last
+ end
+end
Added: projects/ogog/app/models/feed.rb
===================================================================
--- projects/ogog/app/models/feed.rb (rev 0)
+++ projects/ogog/app/models/feed.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,140 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+#
+# Feeds are sources of posts through RSS...
+
+class Feed < ActiveRecord::Base
+ ### Relationships
+
+ belongs_to :user
+ has_many :posts
+
+ ### Constants
+
+ GOOD = 0
+ NO_TITLE = 1
+ NO_SITE_URL = 2
+ INCOMPLETE_POSTS = 3
+ FUTURE_DATE = 4
+ NOT_PARSABLE = 5
+ NO_PUBLISH_DATE = 6
+
+ ### Validations
+
+ validates_presence_of :url
+ validates_uniqueness_of :url
+
+ ### Functions
+
+ # Extracts tags or categories
+ #
+ def self.get_item_tags(new_item)
+ if new_item.tags.empty?
+ return new_item.categories.collect {|c| c.term}
+ else
+ return new_item.tags
+ end
+ end
+
+ ### Methods
+
+ # Returns true if the status is anything but GOOD
+ #
+ def bad?
+ return self.status != GOOD
+ end
+
+ # Checks the feed for new entries and harvests them into new posts.
+ #
+ def harvest
+ if !self.bad?
+ begin
+ f = FeedTools::Feed.open(self.url)
+ rescue
+ self.status = NOT_PARSABLE
+ end
+ if self.title != f.title
+ self.title = f.title
+ end
+ if self.site_url != f.link
+ self.site_url = f.link
+ end
+ if self.title.nil?
+ self.status = NO_TITLE
+ end
+ if self.site_url.nil?
+ self.status = NO_SITE_URL
+ end
+ if !self.bad? and f.items.detect {|i| i.published.nil?}
+ self.status = NO_PUBLISH_DATE
+ end
+ if !self.bad?
+ f.items.select {|i| !self.harvested_publication_time or
+ i.published > self.harvested_publication_time}.sort_by {|i| i.published}.each do |new_item|
+ if !self.bad?
+ p = Post.new(:feed => self, :title => new_item.title, :body => new_item.content,
+ :url => new_item.link, :published_at => new_item.published.utc)
+ if p.published_at > Time.now + 1.day
+ self.status = FUTURE_DATE
+ end
+ if !p.valid?
+ self.status = INCOMPLETE_POSTS
+ end
+ end
+ if !self.bad?
+ p.save
+ p.set_tags(Feed.get_item_tags(new_item) + self.tag_strings)
+ # At least one tag is set, guaranteed...
+ self.harvested_publication_time = p.published_at
+ end
+ end
+ end
+ self.save
+ end
+ end
+
+ # Claims the feed for the current user.
+ #
+ def claim
+ if User.current.nil?
+ raise 'You need to be logged in to claim a feed'
+ elsif !self.user.nil?
+ raise 'This feed has already been claimed'
+ else
+ html = URI.parse(self.site_url)
+ s = Scraper.define {
+ process 'img[src*="ogog.org/user/' + User.current.name + '"]', :found => true
+ process 'a[href*="ogog.org/user/' + User.current.name + '"]', :found => true
+ result :found
+ }
+ if s.scrape(html)
+ self.user = User.current
+ self.save
+ else
+ raise 'Unable to claim: no badge or link to your OgOg user-page found, check the spelling of your urls'
+ end
+ end
+ end
+
+ # Returns the most recent post in this feed
+ #
+ def last_post
+ self.posts.find(:first, :order => 'published_at DESC')
+ end
+
+ # Ad hoc, returns the tag-strings for this feed.
+ #
+ def tag_strings
+ self.tags_string.split(',')
+ end
+end
Added: projects/ogog/app/models/link.rb
===================================================================
--- projects/ogog/app/models/link.rb (rev 0)
+++ projects/ogog/app/models/link.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,111 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+
+class Link
+ ### Relationships
+
+ attr_accessor :requested_tags, :received_tags
+
+ ### Constructors
+
+ # Creates a new Link with the given tags.
+ #
+ def initialize(tags)
+ if tags.size > OgOg::Config::MAXIMUM_LINK_SIZE
+ raise 'Too many tags requested'
+ elsif tags.empty?
+ tags = [Tag.overall]
+ end
+ self.requested_tags = tags
+ self.received_tags = []
+ end
+
+ # Creates a new Link from a string.
+ #
+ def self.new_from_s(tag_string)
+ return Link.new(tag_string.split('/').collect {|s| Tag.or_new_from_s(s)})
+ end
+
+ ### Methods
+
+ # Resolves the link, calculating the received_tags.
+ #
+ def resolve
+ existing_tags = self.existing_requested_tags
+ while !Tagging.any_posts_for?(existing_tags) and existing_tags.size > 0
+ existing_tags.shift
+ end
+ if existing_tags.size == 0
+ existing_tags.push(Tag.overall)
+ end
+ self.received_tags = existing_tags
+ end
+
+ # Returns the size of this link in the given direction.
+ #
+ def size(direction)
+ self.tags(direction).size
+ end
+
+ # Returns the tags of this link in the given direction.
+ #
+ def tags(direction = :requested)
+ if direction == :requested
+ return self.requested_tags
+ else
+ return self.received_tags
+ end
+ end
+
+ # Returns the existing requested tags.
+ #
+ def existing_requested_tags
+ self.requested_tags.reject {|t| t.new_record?}
+ end
+
+ # Adds a tag to this link. If the maximum link size is reached the
+ # last tag is replaced by the added tag.
+ #
+ def add_tag(tag)
+ if self.requested_tags.size == OgOg::Config::MAXIMUM_LINK_SIZE
+ self.requested_tags.pop
+ end
+ self.requested_tags << tag
+ end
+
+ # Turns the link into a string.
+ #
+ # Options:
+ # * :direction => :requested: requested tags are used, :received:
+ # received tags are used.
+ # * :step => upto which linkpart to show.
+ #
+ def to_s(options = {})
+ options[:direction] ||= :requested
+ if options[:direction] == :requested
+ tags = self.requested_tags
+ else
+ tags = self.received_tags
+ end
+ options[:step] ||= tags.size
+ return tags[0..options[:step]].collect {|t| t.to_s}.join('/')
+ end
+
+ # Creates a new link with the same requested and received tags.
+ #
+ def dup
+ l = Link.new(self.requested_tags.dup)
+ l.received_tags = self.received_tags.dup
+ return l
+ end
+end
Added: projects/ogog/app/models/membership.rb
===================================================================
--- projects/ogog/app/models/membership.rb (rev 0)
+++ projects/ogog/app/models/membership.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,47 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+
+class Membership < ActiveRecord::Base
+ ### Relationships
+
+ belongs_to :user
+ belongs_to :tag
+
+ ### Functions
+
+ # Returns the anonymous voting power.
+ #
+ def self.anonymous_voting_power
+ return OgOg::Config::ANONYMOUS_VOTING_POWER
+ end
+
+ # Returns the account voting power.
+ #
+ def self.account_voting_power
+ return OgOg::Config::ACCOUNT_VOTING_POWER
+ end
+
+ # (Re-)calculates the percentiles for the users.
+ #
+ def self.calculate_percentiles
+ Tag.find(:all).each do |tag|
+ count = tag.memberships.count.to_f
+ counter = count
+ tag.memberships.order_by_power.each do |membership|
+ membership.percentile = (counter / count) * 100
+ membership.save
+ counter -= 1
+ end
+ end
+ end
+end
Added: projects/ogog/app/models/post.rb
===================================================================
--- projects/ogog/app/models/post.rb (rev 0)
+++ projects/ogog/app/models/post.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,134 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+
+class Post < ActiveRecord::Base
+ ### Relationships
+
+ belongs_to :feed
+ has_many :taggings
+ has_many :tags, :through => :taggings
+
+ ### Validations
+
+ validates_presence_of :title, :body, :url
+
+ ### Filters
+
+ before_save :set_snippet
+
+ ### Filter Functions
+
+ # Sets the snippet to the first 245 characters of the body and makes
+ # sure that all HTML-tags will be neatly closed (a TODO).
+ #
+ def set_snippet
+ self.snippet = self.body[0..245]
+ end
+
+ ### Functions
+
+ # Gets the tags from URI-parsed html.
+ #
+ def self.get_tags(html)
+ s = Scraper.define {
+ array :tags
+ process 'a[href][rel~=tag]', :tags => :text
+ result :tags
+ }
+ return s.scrape(html)
+ end
+
+ ### Methods
+
+ # Gets the tags for this post. If the tags-array is not empty those
+ # are used. Otherwise tries to scrape them with get_tags.
+ #
+ # Also assigns the default Overall tag.
+ #
+ def set_tags(tags)
+ if tags.empty?
+ tags = Post.get_tags(URI.parse(self.url)) || []
+ end
+ tags.each do |t|
+ self.tag(Tag.or_new_from_s(t))
+ end
+ self.tag(Tag.overall)
+ end
+
+ # Adds the given tag if it is not already there.
+ #
+ def tag(tag)
+ if !self.taggings.find_by_tag_id(tag.id)
+ self.taggings.create(:post => self, :tag => tag)
+ end
+ end
+
+ # Removes the given tag.
+ #
+ def untag(tag)
+ if self.taggings.find_by_tag_id(tag.id)
+ self.taggings.find_by_tag_id(tag.id).destroy
+ end
+ end
+
+ # Returns the score this post has for the given tag.
+ #
+ def tagging_for(tag)
+ tagging = self.taggings.find_by_tag_id(tag.id)
+ if tagging.nil?
+ raise 'This post is not tagged with the requested tag'
+ end
+ return tagging
+ end
+
+ # Returns the best tags.
+ #
+ def best_tag
+ return self.taggings.order_by_score.first.tag
+ end
+
+ # Rates this post with the given score & power for the given tag.
+ #
+ def rate(score, tag, ip_address)
+ # checks
+ if score < -2 or score > 5
+ raise 'Score out of bounds -2, 5'
+ end
+ # weight determination
+ if !User.anonymous?
+ weight = User.current.voting_power_for(tag)
+ else
+ weight = Membership.anonymous_voting_power
+ end
+ tagging = self.taggings.find_by_tag_id(tag.id)
+ # registration
+ tagging.votes.build(:user => User.current, :weight => weight, :score => score,
+ :ip_address => ip_address)
+ # calculation
+ if tagging.rated?
+ old_power_income = tagging.power_income
+ tagging.score = ((tagging.score * tagging.weight) + (score * weight)) / (tagging.weight + weight)
+ tagging.weight += weight
+ else
+ old_power_income = 0
+ tagging.score = score
+ tagging.weight = weight
+ end
+ # power distribution
+ if !self.feed.user.nil?
+ self.feed.user.update_power(old_power_income, tagging.power_income, tag)
+ end
+ # saving
+ tagging.save
+ end
+end
Added: projects/ogog/app/models/tag.rb
===================================================================
--- projects/ogog/app/models/tag.rb (rev 0)
+++ projects/ogog/app/models/tag.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,98 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+#
+# Tags function as categories.
+
+class Tag < ActiveRecord::Base
+ ### Inclusions
+
+ include Comparable
+
+ ### Relationships
+
+ has_many :taggings
+ has_many :memberships
+
+ ### Functions
+
+ # Returns the OVERALL_TAG_STRING-tag.
+ #
+ def self.overall
+ Tag.or_new_from_s(OgOg::Config::OVERALL_TAG_STRING)
+ end
+
+ # Looks up the Tag for the given word_string in the db. If it's not
+ # found a new Tag is created for this word.
+ #
+ def self.or_new_from_s(word_string)
+ # checking
+ if word_string.nil?
+ return Tag.overall
+ end
+
+ # cleaning
+ word_string.gsub!(/[^\w\s-]/,' ')
+ word_string.squeeze!(' ')
+ word_string.strip!
+ word_string = word_string.titleize.split(" ").join("_")
+
+ # checking
+ if word_string.empty? or word_string == ' '
+ word_string = OgOg::Config::OVERALL_TAG_STRING
+ end
+
+ # resolving
+ tag = Tag.find_by_word(word_string)
+ if tag
+ return tag
+ else
+ return Tag.new(:word => word_string)
+ end
+ end
+
+ # Returns Tags for display in a cloud.
+ #
+ def self.top_tags(received_tags, options = {})
+ sql = "SELECT t.*, count(*) AS count FROM tags AS t, taggings AS n"
+ counter = 0
+ received_tags.each {|t|
+ sql << ', taggings AS n' + counter.to_s
+ counter += 1
+ }
+ sql << ' WHERE '
+ counter = 0
+ received_tags.each {|t|
+ sql << 'n' + counter.to_s + '.tag_id = ' + t.id.to_s + ' AND ' \
+ << 'n.post_id = n' + counter.to_s + '.post_id AND '
+ counter += 1
+ }
+ sql << "t.id = n.tag_id GROUP BY n.tag_id "
+ sql << " ORDER BY #{options[:order]}" if options[:order] != nil
+ sql << " LIMIT #{options[:limit]}" if options[:limit] != nil
+ tags = Tag.find_by_sql(sql)
+ end
+
+ ### Methods
+
+ # Makes tags comparable.
+ #
+ def <=>(other)
+ return self.word <=> other.word
+ end
+
+ # Turns a tag into a string
+ #
+ def to_s
+ return self.word
+ end
+end
Added: projects/ogog/app/models/tagging.rb
===================================================================
--- projects/ogog/app/models/tagging.rb (rev 0)
+++ projects/ogog/app/models/tagging.rb 2007-05-20 09:51:03 UTC (rev 283)
@@ -0,0 +1,156 @@
+#--#
+# Copyright: (c) 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the OgOg program. OgOg is free software. You can run/
+# distribute/modify OgOg under the terms of the Affero General Public
+# License version 1 or any later version. The Affero GPL states that running
+# a modified version or a derivative work also requires you to make the
+# sourcecode of that work available to everyone that can interact with it.
+# We chose the Affero GPL to ensure that OgOg remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+#
+# Join-class between Posts and Tags.
+#
+# Votes are associated with this class.
+
+class Tagging < ActiveRecord::Base
+ ### Relationships
+
+ belongs_to :tag
+ belongs_to :post
+ has_many :votes
+
+ ### Constants
+
+ SCORES = {
+ -2 => 'horrible',
+ -1 => 'bad',
+ nil => 'unrated',
+ 0 => 'neutral',
+ 1 => 'fair',
+ 2 => 'ok',
+ 3 => 'good',
+ 4 => 'perfect',
+ 5 => 'unsurpassed'
+ }
+
+ ### Filters
+
+ before_save :track_negativity
+
+ ### Filter-functions
+
+ def track_negativity
+ if self.rated? and self.score < 0
+ self.negative_as_of = Time.now
+ else
+ self.negative_as_of = nil
+ end
+ end
+
+ ### Functions
+
+ # Returns true if there exists any post for the given tags
+ #
+ def self.any_posts_for?(existing_tags)
+ return Tagging.top_posts_for(existing_tags).size > 0
+ end
+
+ # Counts the posts for the given tags + options.
+ #
+ # Valid options are:
+ # * :conditions => sql-like conditions, the posts table is called p
+ #
+ def self.count_posts_for(existing_tags, options = {})
+ if existing_tags.size > 0
+ sql = Tagging.sql_for_posts_for(
+ existing_tags, 'COUNT(p.id)', options[:conditions])
+ return ActiveRecord::Base.connection.select_value(sql).to_i
+ else
+ return 0
+ end
+ end
+
+ # Gets the top-posts for the given tags.
+ #
+ # Valid options are:
+ # * :conditions => sql-like conditions, the posts table is called p
+ # * :limit => limits the result-set to the given number
+ # * :offset => offsets the result-set by this number
+ #
+ def self.top_posts_for(existing_tags, options = {})
+ if existing_tags.size > 0
+ sql = Tagging.sql_for_posts_for(
+ existing_tags, 'DISTINCT p.*', options[:conditions])
+ sql << 'ORDER BY t' + (existing_tags.size - 1).to_s + '.score DESC '
+# sql << 'ORDER BY IF(t' + (existing_tags.size - 1).to_s + '.score IS NULL' +
+# ', -0.0000001, t' + (existing_tags.size - 1).to_s + '.score) DESC '
+ if options[:limit]
+ sql << 'LIMIT ' + options[:limit].to_s + ' '
+ if options[:offset]
+ sql << 'OFFSET ' + options[:offset].to_s + ' '
+ end
+ end
+ sql.slice!(-1)
+ Post.find_by_sql(sql)
+ else
+ return []
+ end
+ end
+
+ # Inner function that prepares the shared part of the sql.
+ #
+ def self.sql_for_posts_for(existing_tags, sel...
[truncated message content] |
|
From: <wy...@us...> - 2007-05-13 14:52:09
|
Revision: 282
http://logilogi.svn.sourceforge.net/logilogi/?rev=282&view=rev
Author: wybow
Date: 2007-05-13 07:51:56 -0700 (Sun, 13 May 2007)
Log Message:
-----------
Fixed tabs and using find_logi_and_logi_version now instead of
get_logi_version.
Modified Paths:
--------------
plugins/manta_pdf_export/README
plugins/manta_pdf_export/app/controllers/logi_controller.rb
Modified: plugins/manta_pdf_export/README
===================================================================
--- plugins/manta_pdf_export/README 2007-05-13 14:36:34 UTC (rev 281)
+++ plugins/manta_pdf_export/README 2007-05-13 14:51:56 UTC (rev 282)
@@ -4,7 +4,5 @@
Depends on http://ruby-pdf.rubyforge.org/pdf-writer/
Todo's:
-- Adding extra tab from plugin isnt working yet (wybo?)
- A very basic parser must be made, so that the pdf document also shows bold tags and headers and such
- Filename is now generated as '{current date} {title}.pdf' where title is untitled if no title exists (And the title exists if there is a header tag in the beginning if I readed the regular expression correctly)
-
Modified: plugins/manta_pdf_export/app/controllers/logi_controller.rb
===================================================================
--- plugins/manta_pdf_export/app/controllers/logi_controller.rb 2007-05-13 14:36:34 UTC (rev 281)
+++ plugins/manta_pdf_export/app/controllers/logi_controller.rb 2007-05-13 14:51:56 UTC (rev 282)
@@ -13,30 +13,27 @@
class LogiController < ApplicationController
layout 'main'
+
### Bodies
- #tabs_body :pdf_export_plugin_tabs
+ additional_tabs_body :pdf_export_plugin_tabs
+ ### Body-functions
+
def pdf_export_plugin_tabs
- if @additional_tabs
- active = params[:action].to_sym
- actions = [['pdf',{:action => :pdf}]]
- render_to_string(:partial => 'logi_tabs',
- :locals => {
- :actions => actions,
- :active => active
- })
- end
+ active = params[:action].to_sym
+ actions = [['pdf',{:action => :pdf}]]
+ render_to_string(:partial => 'logi_tabs',
+ :locals => {
+ :actions => actions,
+ :active => active
+ })
end
- def get_logi_version
- @logi_version = Context.current.link.volatile_to_logi_version
- return @logi_version
- end
+ ### Methods
# This needs updating to a sensible filename
def get_pdf_filename
- @logi_version = get_logi_version
now = Time.now
title = @logi_version.logi.current_title
@@ -49,10 +46,10 @@
end
def pdf
- @logi_version = get_logi_version
+ find_logi_and_logi_version
if(!@logi_version.nil?)
send_data @logi_version.to_pdf, :filename => get_pdf_filename,
- :type => "application/pdf"
+ :type => "application/pdf"
end
end
end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wy...@us...> - 2007-05-13 14:36:37
|
Revision: 281
http://logilogi.svn.sourceforge.net/logilogi/?rev=281&view=rev
Author: wybow
Date: 2007-05-13 07:36:34 -0700 (Sun, 13 May 2007)
Log Message:
-----------
Updated tabs-code, now additional_tabs, instead of tabs
Modified Paths:
--------------
trunk/app/controllers/logi_controller.rb
trunk/doc/FAQ.txt
trunk/vendor/plugins/manta_modulizer/app/controllers/logi_controller.rb
Modified: trunk/app/controllers/logi_controller.rb
===================================================================
--- trunk/app/controllers/logi_controller.rb 2007-05-13 09:00:24 UTC (rev 280)
+++ trunk/app/controllers/logi_controller.rb 2007-05-13 14:36:34 UTC (rev 281)
@@ -22,7 +22,7 @@
: [:changes]
before_filter :find_logi_and_logi_version,
: [:show, :edit, :edit_text, :edit_links, :update, :update_text, :update_links]
- before_filter :logi_url_bars, :elements, :build_role_bodies, :build_bodies,
+ before_filter :logi_url_bars, :elements, :build_role_bodies, :build_bodies, :default_tabs,
: [:new, :show, :edit, :edit_text, :edit_links, :update, :update_text, :update_links, :create]
after_filter :remember_show_context,
: [:show]
@@ -33,9 +33,8 @@
# body-stuff
#
# :header, :left, and :right are already set in application
- body_parts :pre, :tabs, :post
+ body_parts :pre, :post, :additional_tabs
- tabs_body :default_tabs
post_body :recent_changes, :comments,
: [:show]
left_body :menus
@@ -77,6 +76,26 @@
end
end
+ def default_tabs
+ active = params[:action].to_sym
+ if active == :new and Context.current.alternatives.empty?
+ actions = [['New',{:action => :new}]]
+ @additional_tabs_body = ''
+ else
+ actions = [['View',{:action => :show}]]
+ if Context.current.link.volatile_to_logi.edit_rights?(User.current)
+ actions << ['Edit',{:action => :edit}]
+ end
+ actions.concat [['New',{:action => :new, :step => -1}],
+ ['History',{:action => :history}]]
+ end
+ @tabs_body = render_to_string(:partial => 'logi_tabs',
+ :locals => {
+ :actions => actions,
+ :active => active
+ }) + @additional_tabs_body
+ end
+
def remember_show_context
session[:last_show_context_link_string] = session[:context_link_string]
end
@@ -127,27 +146,6 @@
})
end
- def default_tabs
- active = params[:action].to_sym
- if active == :new and Context.current.alternatives.empty?
- @additional_tabs = false # check in plugins
- actions = [['New',{:action => :new}]]
- else
- @additional_tabs = true
- actions = [['View',{:action => :show}]]
- if Context.current.link.volatile_to_logi.edit_rights?(User.current)
- actions << ['Edit',{:action => :edit}]
- end
- actions.concat [['New',{:action => :new, :step => -1}],
- ['History',{:action => :history}]]
- end
- render_to_string(:partial => 'logi_tabs',
- :locals => {
- :actions => actions,
- :active => active
- })
- end
-
def recent_changes
@changes = []
if Context.current.main?
Modified: trunk/doc/FAQ.txt
===================================================================
--- trunk/doc/FAQ.txt 2007-05-13 09:00:24 UTC (rev 280)
+++ trunk/doc/FAQ.txt 2007-05-13 14:36:34 UTC (rev 281)
@@ -14,16 +14,14 @@
Add this to the logi.rb inside your plugin's app/models dir.
-tabs_body :my_plugin_tabs
+additional_tabs_body :my_plugin_tabs
def my_plugin_tabs
- if @additional_tabs
- active = params[:action].to_sym
- actions = [['My new action',{:action => :my_new_action_method}]]
- render_to_string(:partial => 'logi_tabs',
- :locals => {
- :actions => actions,
- :active => active
- })
- end
+ active = params[:action].to_sym
+ actions = [['My new action',{:action => :my_new_action_method}]]
+ render_to_string(:partial => 'logi_tabs',
+ :locals => {
+ :actions => actions,
+ :active => active
+ })
end
Modified: trunk/vendor/plugins/manta_modulizer/app/controllers/logi_controller.rb
===================================================================
--- trunk/vendor/plugins/manta_modulizer/app/controllers/logi_controller.rb 2007-05-13 09:00:24 UTC (rev 280)
+++ trunk/vendor/plugins/manta_modulizer/app/controllers/logi_controller.rb 2007-05-13 14:36:34 UTC (rev 281)
@@ -13,5 +13,5 @@
class LogiController < ApplicationController
# :header, :left, and :right are already set in application
- body_parts :pre, :post
+ body_parts :pre, :post, :additional_tabs
end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maa...@us...> - 2007-05-13 09:00:26
|
Revision: 280
http://logilogi.svn.sourceforge.net/logilogi/?rev=280&view=rev
Author: maartengeraedts
Date: 2007-05-13 02:00:24 -0700 (Sun, 13 May 2007)
Log Message:
-----------
Now with the files
Added Paths:
-----------
plugins/manta_pdf_export/README
plugins/manta_pdf_export/Rakefile
plugins/manta_pdf_export/app/
plugins/manta_pdf_export/app/controllers/
plugins/manta_pdf_export/app/controllers/logi_controller.rb
plugins/manta_pdf_export/app/models/
plugins/manta_pdf_export/app/models/logi_version.rb
plugins/manta_pdf_export/init.rb
plugins/manta_pdf_export/install.rb
plugins/manta_pdf_export/lib/
plugins/manta_pdf_export/lib/manta_pdf_export.rb
plugins/manta_pdf_export/tasks/
plugins/manta_pdf_export/tasks/manta_pdf_export_tasks.rake
plugins/manta_pdf_export/test/
plugins/manta_pdf_export/test/manta_pdf_export_test.rb
plugins/manta_pdf_export/uninstall.rb
Added: plugins/manta_pdf_export/README
===================================================================
--- plugins/manta_pdf_export/README (rev 0)
+++ plugins/manta_pdf_export/README 2007-05-13 09:00:24 UTC (rev 280)
@@ -0,0 +1,10 @@
+MantaPdfExport
+==============
+
+Depends on http://ruby-pdf.rubyforge.org/pdf-writer/
+
+Todo's:
+- Adding extra tab from plugin isnt working yet (wybo?)
+- A very basic parser must be made, so that the pdf document also shows bold tags and headers and such
+- Filename is now generated as '{current date} {title}.pdf' where title is untitled if no title exists (And the title exists if there is a header tag in the beginning if I readed the regular expression correctly)
+
Added: plugins/manta_pdf_export/Rakefile
===================================================================
--- plugins/manta_pdf_export/Rakefile (rev 0)
+++ plugins/manta_pdf_export/Rakefile 2007-05-13 09:00:24 UTC (rev 280)
@@ -0,0 +1,22 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the manta_pdf_export plugin.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
+
+desc 'Generate documentation for the manta_pdf_export plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'MantaPdfExport'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
Added: plugins/manta_pdf_export/app/controllers/logi_controller.rb
===================================================================
--- plugins/manta_pdf_export/app/controllers/logi_controller.rb (rev 0)
+++ plugins/manta_pdf_export/app/controllers/logi_controller.rb 2007-05-13 09:00:24 UTC (rev 280)
@@ -0,0 +1,58 @@
+#--#
+# Copyright: (c) 2006, 2007 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogiLogi program. LogiLogi is free software. You
+# can run/distribute/modify LogiLogi under the terms of the Affero General
+# Public License version 1 or any later version. The Affero GPL states that
+# running a modified version or a derivative work also requires you to make
+# the sourcecode of that work available to everyone that can interact with
+# it. We chose the Affero GPL to ensure that LogiLogi remains open and libre
+# (doc/LICENSE.txt contains the full text of the legally binding license).
+#++#
+
+class LogiController < ApplicationController
+ layout 'main'
+ ### Bodies
+
+ #tabs_body :pdf_export_plugin_tabs
+
+ def pdf_export_plugin_tabs
+ if @additional_tabs
+ active = params[:action].to_sym
+ actions = [['pdf',{:action => :pdf}]]
+ render_to_string(:partial => 'logi_tabs',
+ :locals => {
+ :actions => actions,
+ :active => active
+ })
+ end
+ end
+
+ def get_logi_version
+ @logi_version = Context.current.link.volatile_to_logi_version
+ return @logi_version
+ end
+
+ # This needs updating to a sensible filename
+ def get_pdf_filename
+ @logi_version = get_logi_version
+ now = Time.now
+
+ title = @logi_version.logi.current_title
+ if(title.nil?)
+ title = ' Untitled'
+ else
+ title = ' ' + title
+ end
+ return now.strftime("%Y-%m-%d") + title + '.pdf'
+ end
+
+ def pdf
+ @logi_version = get_logi_version
+ if(!@logi_version.nil?)
+ send_data @logi_version.to_pdf, :filename => get_pdf_filename,
+ :type => "application/pdf"
+ end
+ end
+end
Added: plugins/manta_pdf_export/app/models/logi_version.rb
===================================================================
--- plugins/manta_pdf_export/app/models/logi_version.rb (rev 0)
+++ plugins/manta_pdf_export/app/models/logi_version.rb 2007-05-13 09:00:24 UTC (rev 280)
@@ -0,0 +1,26 @@
+class LogiVersion < ActiveRecord::Base
+
+ # This needs updating
+ # The pdf library supports basic tags like <b> and <i>
+ # and things like font and fontsizes, which can be combined
+ # to create bigger headers and quotes.
+ def textile_to_pdf_body
+ return linkless_textile
+ end
+
+ def to_pdf
+ body = textile_to_pdf_body
+
+ # A4, portrait
+ _pdf = PDF::Writer.new
+ _pdf.select_font "Times-Roman"
+
+ # Only print a header if it exists
+ if (self.logi.current_title?)
+ _pdf.text self.logi.current_title + "\n\n", :font_size => 30, :justification => :center
+ end
+ _pdf.text body, :font_size => 12, :justification => :full
+
+ return _pdf.render
+ end
+end
Added: plugins/manta_pdf_export/init.rb
===================================================================
--- plugins/manta_pdf_export/init.rb (rev 0)
+++ plugins/manta_pdf_export/init.rb 2007-05-13 09:00:24 UTC (rev 280)
@@ -0,0 +1,3 @@
+# Include hook code here
+require 'manta_pdf_export'
+require 'pdf/writer'
Added: plugins/manta_pdf_export/install.rb
===================================================================
--- plugins/manta_pdf_export/install.rb (rev 0)
+++ plugins/manta_pdf_export/install.rb 2007-05-13 09:00:24 UTC (rev 280)
@@ -0,0 +1 @@
+# Install hook code here
Added: plugins/manta_pdf_export/lib/manta_pdf_export.rb
===================================================================
--- plugins/manta_pdf_export/lib/manta_pdf_export.rb (rev 0)
+++ plugins/manta_pdf_export/lib/manta_pdf_export.rb 2007-05-13 09:00:24 UTC (rev 280)
@@ -0,0 +1 @@
+# MantaPdfExport
\ No newline at end of file
Added: plugins/manta_pdf_export/tasks/manta_pdf_export_tasks.rake
===================================================================
--- plugins/manta_pdf_export/tasks/manta_pdf_export_tasks.rake (rev 0)
+++ plugins/manta_pdf_export/tasks/manta_pdf_export_tasks.rake 2007-05-13 09:00:24 UTC (rev 280)
@@ -0,0 +1,4 @@
+# desc "Explaining what the task does"
+# task :manta_pdf_export do
+# # Task goes here
+# end
\ No newline at end of file
Added: plugins/manta_pdf_export/test/manta_pdf_export_test.rb
===================================================================
--- plugins/manta_pdf_export/test/manta_pdf_export_test.rb (rev 0)
+++ plugins/manta_pdf_export/test/manta_pdf_export_test.rb 2007-05-13 09:00:24 UTC (rev 280)
@@ -0,0 +1,8 @@
+require 'test/unit'
+
+class MantaPdfExportTest < Test::Unit::TestCase
+ # Replace this with your real tests.
+ def test_this_plugin
+ flunk
+ end
+end
Added: plugins/manta_pdf_export/uninstall.rb
===================================================================
--- plugins/manta_pdf_export/uninstall.rb (rev 0)
+++ plugins/manta_pdf_export/uninstall.rb 2007-05-13 09:00:24 UTC (rev 280)
@@ -0,0 +1 @@
+# Uninstall hook code here
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maa...@us...> - 2007-05-13 08:59:39
|
Revision: 279
http://logilogi.svn.sourceforge.net/logilogi/?rev=279&view=rev
Author: maartengeraedts
Date: 2007-05-13 01:59:36 -0700 (Sun, 13 May 2007)
Log Message:
-----------
Added first version of the pdf export functionality. Alot of todo's:
- Adding extra tab from plugin isnt working yet (wybo?)
- A very basic parser must be made, so that the pdf document also shows bold tags and headers and such
- Filename is now generated as '{current date} {title}.pdf' where title is untitled if no title exists (And the title exists if there is a header tag in the beginning if I readed the regular expression correctly)
The plugin depends on http://ruby-pdf.rubyforge.org/pdf-writer/
Added Paths:
-----------
plugins/manta_pdf_export/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|