<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/views/home/show.rss.builder</filename>
    </added>
    <added>
      <filename>public/javascripts/jquery-1.2.6.js</filename>
    </added>
    <added>
      <filename>public/javascripts/jquery.hotkeys.js</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,32 @@
 class HomeController &lt; ApplicationController
+  #
+  # index
+  #
   def index
-    @feeds = Feed.paginate(:all, :per_page =&gt; 5, :page =&gt; params[:page], :order =&gt; &quot;published DESC&quot;)
+    @feeds = Feed.paginate(:all, 
+                           :per_page =&gt; 15, 
+                           :page =&gt; params[:page], 
+                           :order =&gt; &quot;published DESC&quot;)
+  end
+  
+  #
+  # used to render rss.
+  #
+  def show
+    index
+  end
+  
+  #
+  # search
+  #
+  def search
+    query = params[:query]
+    query = (query &amp;&amp; query.strip) || &quot;&quot;
+    @feeds = Feed.paginate(:all, 
+                           :conditions =&gt; [&quot;content like ? or title like ?&quot;, &quot;%&quot;+query+&quot;%&quot;, &quot;%&quot;+query+&quot;%&quot;], 
+                           :per_page =&gt; 15, 
+                           :page =&gt; params[:page], 
+                           :order =&gt; &quot;published DESC&quot;)
+    render :action =&gt; &quot;index&quot;
   end
 end</diff>
      <filename>app/controllers/home_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,21 @@
+# == Schema Information
+# Schema version: 2
+#
+# Table name: feeds
+#
+#  id          :integer(11)     not null, primary key
+#  feed_url_id :integer(11)
+#  title       :string(255)
+#  author      :string(255)
+#  link        :string(255)
+#  site_link   :string(255)
+#  site_title  :string(255)
+#  content     :text
+#  published   :datetime
+#  created_at  :datetime
+#  updated_at  :datetime
+#
+
 class Feed &lt; ActiveRecord::Base
   belongs_to :feed_url
   validates_uniqueness_of :title, :scope =&gt; [:link]</diff>
      <filename>app/models/feed.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,16 @@
+# == Schema Information
+# Schema version: 2
+#
+# Table name: feed_urls
+#
+#  id         :integer(11)     not null, primary key
+#  feed_url   :string(255)
+#  title      :string(255)
+#  star       :string(255)
+#  created_at :datetime
+#  updated_at :datetime
+#
+
 require 'hpricot'
 require 'open-uri'
 require 'uri'
@@ -23,12 +36,12 @@ class FeedUrl &lt; ActiveRecord::Base
 
    # Process rss feed and saves it into db
   def process_rss(rss)
-    puts &quot;processing rss&quot;
     time_offset = 1
     
     # taking out site/blog link and title.
     site_link = (rss/:channel/:link).first.inner_html
     site_title = (rss/:channel/:title).first.inner_html
+    puts &quot;processing rss for #{site_link}&quot;
 
     (rss/:channel/:item).each do |item|
       link = (item/:link).inner_html
@@ -45,10 +58,17 @@ class FeedUrl &lt; ActiveRecord::Base
         rss_feed.published = (item/:pubDate).inner_html
 
         if rss_feed.published.blank?
+          # if !(rss/:channel/:lastBuildDate).inner_html.blank?
+          #            puts &quot;rss feed published time blank. taking lastBuildDate one&quot;
+          #            puts (rss/:channel/:lastBuildDate).inner_html
+          #            time = (rss/:channel/:lastBuildDate).inner_html
+          #            rss_feed.published = Time.parse(time).to_s(:db)
+          #          else
           puts &quot;rss feed published time blank. calculating system one.&quot;
-          rss_feed.published = (Time.now - time_offset.hours).to_s(:db)
-          puts rss_feed.published
+          # taking it 20 days back..
+          rss_feed.published = (Time.now - (20*60*60*24) - time_offset.hours).to_s(:db)
           time_offset += 1
+           # end
         end
         
         rss_feed.title = htmlize(rss_feed.title)
@@ -60,13 +80,14 @@ class FeedUrl &lt; ActiveRecord::Base
   
   # Process atom feed and saves it into db
   def process_atom(atom)
-    puts &quot;processing atom&quot;
     time_offset = 1
     
     # taking out site/blog link and title.
-    site_link =  (atom/:feed).search(:link).select{ |i| i['type'] == &quot;text/html&quot;}.first['href']
+    site_link =  (atom/:feed).search(:link)[1]['href']
     site_title = (atom/:feed/:title).first.inner_html
     
+    puts &quot;processing atom for #{site_link}&quot;
+    
     (atom/:entry).each do |item|
       link = (item/:link).attr('href')
       if !(Feed.find_by_link(link))
@@ -85,7 +106,12 @@ class FeedUrl &lt; ActiveRecord::Base
         end
 
         if atom_feed.published.blank?
-          atom_feed.published =  (Time.now - time_offset.hours).to_s(:db)
+          atom_feed.published =  (item/:updated).inner_html
+        end
+
+        if atom_feed.published.blank?
+          # taking it 20 days back..
+          atom_feed.published =  (Time.now - (20*60*60*24) - time_offset.hours).to_s(:db)
           time_offset += 1
         end
         
@@ -110,6 +136,7 @@ class FeedUrl &lt; ActiveRecord::Base
     return rss
   end
 
+  # htmlize the html codes back.
   def htmlize(string, link=nil)
     string.gsub!('&amp;lt;', '&lt;')
     string.gsub!('&amp;gt;', '&gt;')</diff>
      <filename>app/models/feed_url.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,24 +1,46 @@
 &lt;div id=&quot;main&quot;&gt;
-  &lt;div id=&quot;hd&quot;&gt;&lt;h1&gt;Planet Rails @ Digital Codes&lt;/h1&gt;&lt;/div&gt;
+  &lt;div id=&quot;hd&quot;&gt;&lt;h1&gt;&lt;a href=&quot;http://planetrails.digitalcodes.org&quot;&gt;PLANET RAILS&lt;/a&gt;&lt;/h1&gt;&lt;/div&gt;
+  &lt;div id=&quot;top&quot;&gt;
+    &lt;table border=0 width=&quot;100%&quot;&gt;
+      &lt;tr&gt;
+        &lt;td align=&quot;left&quot;&gt;
+           &lt;% if !params[:query].blank? %&gt;
+            &lt;div id=&quot;notice&quot;&gt;
+              Results for &quot;&lt;%= params[:query] %&gt;&quot;
+            &lt;/div&gt;
+          &lt;% end %&gt;
+        &lt;/td&gt;
+        &lt;td align=&quot;right&quot;&gt;
+          &lt;form name=&quot;search&quot; action=&quot;/search&quot; method=&quot;get&quot;&gt;
+            &lt;label&gt;Search:&lt;/label&gt; &lt;input type=&quot;text&quot; name=&quot;query&quot; value=&quot;&lt;%= params[:query] %&gt;&quot;&gt;
+          &lt;/form&gt;
+        &lt;/td&gt;
+      &lt;/tr&gt;
+    &lt;/table&gt;
+  &lt;/div&gt;
   &lt;div id=&quot;bd&quot;&gt;
     &lt;% if !@feeds.blank? %&gt;
       &lt;% for feed_item in @feeds%&gt;
         &lt;div class=&quot;div_border&quot;&gt;
           &lt;div class=&quot;post_title&quot;&gt;  
-            &lt;a href=&quot;&lt;%= h feed_item.link %&gt;&quot;&gt; &lt;%= feed_item.title %&gt;&lt;/a&gt;
+            &lt;a href=&quot;&lt;%= h feed_item.link %&gt;&quot;&gt;&lt;%= feed_item.title %&gt;&lt;/a&gt;
           &lt;/div&gt;
           &lt;div class=&quot;sub&quot;&gt;
-            Posted &lt;%= distance_of_time_in_words(Time.now, feed_item.published)%&gt; ago at &lt;a href=&quot;&lt;%= feed_item.site_link%&gt;&quot;&gt;&lt;%=feed_item.site_title %&gt;&lt;/a&gt;
+            Posted &lt;%= distance_of_time_in_words(Time.now, feed_item.published)%&gt; ago at &lt;a href=&quot;&lt;%= feed_item.site_link%&gt;&quot;&gt;&lt;%= feed_item.site_title %&gt;&lt;/a&gt;
           &lt;/div&gt;
           &lt;div class=&quot;post_entry&quot;&gt;
-            &lt;p&gt;&lt;%= white_list(feed_item.content) %&gt;&lt;/p&gt;
+            &lt;p&gt;&lt;%= feed_item.content %&gt;&lt;/p&gt;
           &lt;/div&gt;
         &lt;/div&gt;
       &lt;% end %&gt;
-    &lt;% else %&gt;
-      There are no feeds added yet.
+    &lt;% elsif !params[:query].blank? %&gt;
+      &lt;div class=&quot;div_border&quot; style=&quot;text-align:center&quot;&gt;
+        No results found.
+      &lt;/div&gt;
+    &lt;% elsif params[:query].blank? %&gt;
+      There are no feeds added yet. &lt;br /&gt;
       &lt;a href=&quot;feed_urls&quot;&gt;click here&lt;/a&gt; to add.
     &lt;% end %&gt;
   &lt;/div&gt;
-  &lt;div id=&quot;ft&quot;&gt;&lt;%= will_paginate @feeds, :class =&gt; &quot;pagination&quot; %&gt; &amp;nbsp;&amp;nbsp;| this is Digital Codes&lt;/div&gt;
+  &lt;div id=&quot;ft&quot;&gt;&lt;span class=&quot;left&quot;&gt;&lt;%= will_paginate @feeds, :class =&gt; &quot;pagination&quot; %&gt;&lt;/span&gt;&lt;span class=&quot;right&quot;&gt;Digital Codes&lt;/span&gt;&lt;/div&gt;
 &lt;/div&gt;</diff>
      <filename>app/views/home/index.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -7,11 +7,11 @@
   &lt;title&gt;FeedUrls: &lt;%= controller.action_name %&gt;&lt;/title&gt;
   &lt;%= stylesheet_link_tag 'scaffold' %&gt;
 &lt;/head&gt;
-&lt;body&gt;
+  &lt;body&gt;
 
-&lt;p style=&quot;color: green&quot;&gt;&lt;%= flash[:notice] %&gt;&lt;/p&gt;
+  &lt;p style=&quot;color: green&quot;&gt;&lt;%= flash[:notice] %&gt;&lt;/p&gt;
 
-&lt;%= yield  %&gt;
+  &lt;%= yield  %&gt;
 
-&lt;/body&gt;
+  &lt;/body&gt;
 &lt;/html&gt;</diff>
      <filename>app/views/layouts/feed_urls.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -4,8 +4,9 @@
   &lt;head&gt;
     &lt;title&gt;Planet Rails @ Digital Codes&lt;/title&gt;
     &lt;%= stylesheet_link_tag 'style' %&gt;
+    &lt;%= javascript_include_tag 'jquery-1.2.6', 'jquery.hotkeys.js' %&gt;
   &lt;/head&gt;
-  &lt;body&gt;
+  &lt;body
     &lt;%= yield %&gt;
   &lt;/body&gt;
 &lt;/html&gt;</diff>
      <filename>app/views/layouts/home.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,12 @@
 ActionController::Routing::Routes.draw do |map|
   map.resources :feed_urls
+  map.resources :home
 
   # The priority is based upon order of creation: first created -&gt; highest priority.
 
   # Sample of regular route:
-  #   map.connect 'products/:id', :controller =&gt; 'catalog', :action =&gt; 'view'
+  map.connect '/search', :controller =&gt; 'home', :action =&gt; 'search'
+
   # Keep in mind you can assign values other than :controller and :action
 
   # Sample of named route:</diff>
      <filename>config/routes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -22,7 +22,8 @@ body {
 
 .div_border {
 	border: 1px solid #bbb;
-	margin: 10px;
+	margin-top: 10px;
+	margin-bottom: 30px;
 }
 
 .sub {
@@ -35,6 +36,39 @@ body {
 	padding-left:10px;
 }
 
+.left{
+  float:left;
+}
+
+.right{
+  float:right;
+}
+
+#notice{
+	float:left;
+}
+
+#hd{
+	padding-left:10px;
+}
+
+#hd a {
+	text-decoration : none;
+	color: black;
+}
+
+#ft{
+	padding-bottom:30px;
+}
+
+#top{
+ padding-left:8px;
+}
+
+#bd{
+	display: block;
+}
+
 pre {
 	padding-top: 15px;
 	padding-bottom: 15px;
@@ -43,4 +77,4 @@ pre {
 	background: #000;
 	color: white;
 	float: auto;
-}
\ No newline at end of file
+}</diff>
      <filename>public/stylesheets/style.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,16 @@
+# == Schema Information
+# Schema version: 2
+#
+# Table name: feed_urls
+#
+#  id         :integer(11)     not null, primary key
+#  feed_url   :string(255)
+#  title      :string(255)
+#  star       :string(255)
+#  created_at :datetime
+#  updated_at :datetime
+#
+
 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
 
 one:</diff>
      <filename>test/fixtures/feed_urls.yml</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,21 @@
+# == Schema Information
+# Schema version: 2
+#
+# Table name: feeds
+#
+#  id          :integer(11)     not null, primary key
+#  feed_url_id :integer(11)
+#  title       :string(255)
+#  author      :string(255)
+#  link        :string(255)
+#  site_link   :string(255)
+#  site_title  :string(255)
+#  content     :text
+#  published   :datetime
+#  created_at  :datetime
+#  updated_at  :datetime
+#
+
 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
 
 # one:</diff>
      <filename>test/fixtures/feeds.yml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>069e69f91978fdc89fce3af8b9484de3d736ad2b</id>
    </parent>
  </parents>
  <author>
    <name>Anil Wadghule</name>
    <email>anildigital@gmail.com</email>
  </author>
  <url>http://github.com/anildigital/planet/commit/7ee192dbf255445c5aae1e56740e42f441706e33</url>
  <id>7ee192dbf255445c5aae1e56740e42f441706e33</id>
  <committed-date>2008-06-07T08:08:14-07:00</committed-date>
  <authored-date>2008-06-07T08:08:14-07:00</authored-date>
  <message>Misc changes
 - improved algorithm.
 - css improvements
 - added search capability</message>
  <tree>a27b7702facdb3c5486217faf04e34957ab42966</tree>
  <committer>
    <name>Anil Wadghule</name>
    <email>anildigital@gmail.com</email>
  </committer>
</commit>
