Changeset 1800

Show
Ignore:
Timestamp:
09/11/08 10:51:38 (4 months ago)
Author:
dbryson
Message:


Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • community_hive/trunk/community_hive_web/app/controllers/account_controller.rb

    r1793 r1800  
    55    self.current_user = User.authenticate(params[:login], params[:password]) 
    66    if logged_in? 
    7       redirect_back_or_default(:controller => '/main', :action => 'index') 
     7      redirect_back_or_default('/') 
    88      flash[:success] = "Logged in successfully" 
    99    else 
     
    1717    cookies.delete :auth_token 
    1818    flash[:success] = "You have been logged out." 
    19     redirect_back_or_default(:controller => '/account', :action => 'login') 
     19    redirect_back_or_default('/signin') 
    2020  end 
    2121end 
  • community_hive/trunk/community_hive_web/app/helpers/application_helper.rb

    r1785 r1800  
    22module ApplicationHelper 
    33   
    4   def menu 
    5     home = menu_element("Submit a Url",root_path()) 
    6     check = menu_element("Search Catalog",urls_path()) 
    7     [home, check] 
    8   end 
    9    
    10   def menu_element(content, address) 
    11     { :content => content, :href => address } 
    12   end 
    13    
    14   def menu_link_to(link, options = {}) 
    15     link_to(link[:content], link[:href], options) 
    16   end 
    17    
    18   def menu_li(link, options = {}) 
    19     klass = "n-#{link[:content].downcase}" 
    20     klass += " active" if current_page?(link[:href]) 
    21     content_tag(:li, menu_link_to(link, options), :class => klass) 
    22   end 
    23    
    24   def loginbar 
    25     bar = [] 
    26     if logged_in? 
    27       bar << "#{current_user.login}" 
    28       bar << "#{link_to('My Account',user_path)}" 
    29       if current_user.admin 
    30         bar << "#{link_to("Admin", :controller => 'users', :action => 'index')}" 
    31       end 
    32       bar << "#{link_to('Sign out', :controller => 'account', :action => 'logout')}" 
    33     else 
    34       bar << "#{link_to("Sign in", :controller => 'account', :action => 'login')}" 
    35     end 
    36     links = bar.join("&nbsp;|&nbsp;").to_s 
    37     content_tag(:p,links,:class => 'welcome') 
    38   end 
    394   
    405  def menu_item(content,address) 
     
    4611    bar = [] 
    4712    un = "" 
    48     bar << menu_item("Submit a Url",root_path) 
    49     bar << menu_item("Search Catalog",urls_path) 
     13    bar << menu_item("Submit a Url",urls_path) 
     14    bar << menu_item("Search Catalog",search_path) 
    5015     
    5116    if logged_in? 
    52       un = "#{current_user.login}
     17      un = "#{current_user.login} :
    5318      bar << menu_item("My Account",user_path(current_user)) 
    5419      bar << menu_item("Admin",users_path) if current_user.admin? 
     
    6025    links = bar.join("&nbsp;|&nbsp;").to_s 
    6126     
    62     content_tag(:p,"#{un}: #{links}",:class => 'welcome') 
     27    content_tag(:p,"#{un} #{links}",:class => 'welcome') 
    6328  end 
    6429   
  • community_hive/trunk/community_hive_web/app/helpers/users_helper.rb

    r1785 r1800  
    1717   
    1818   
    19   def change_access_key(user) 
    20     msg = <<-MSG 
    21 Are you sure you want to change the access key?\n 
    22 The bee will need to update the key locally before 
    23 it can communicate with the Hive.\n 
    24 Please make sure to send the new key to the Bee admin. 
    25 MSG 
    26     link_to('Change Bee Key', { :action => 'change_bee_key', :id => user }, :confirm => msg, :method => :post) 
     19  def change_admin_privs(user) 
     20    msg = "Are you sure you want to change the user's admin priviledge?" 
     21    caption = "toggle" 
     22    if user.admin 
     23      link_to(caption, {:action => 'admin_priv', :id => user}, :confirm => msg) 
     24    else 
     25      link_to(caption, {:action => 'admin_priv', :id => user}, :confirm => msg) 
     26    end 
    2727  end 
    2828end 
  • community_hive/trunk/community_hive_web/app/views/main/index.html.erb

    r1720 r1800  
    33  Send us a Url of a site you would like to check for malicious software. 
    44</p> 
    5  <%= show_message %> 
    6 <% form_tag '/main/create' do -%> 
    7   Url: <%= text_field_tag 'url', '', :size => '50' %> 
    8 <p style="font-size: small; color: #444; padding-left: 35px; padding-top: 5px; margin: 0;"> 
    9     Example: http://example.com/hello 
    10   </p> 
    11   <p> 
    12     CAPTCH HERE... 
    13   </p> 
    14   <%= submit_tag 'Check It' %> 
    15 <% end -%> 
     5  <% form_tag '/main/create' do -%> 
     6    <label>Url ( example: http://helloworld.com )</label> 
     7    <%= text_field_tag 'url', '', :size => '45' %> 
     8    &nbsp;<%= submit_tag 'Check It', :class => 'button'%> 
    169 
     10    <p> 
     11      CAPTCH HERE... 
     12    </p> 
     13  <% end -%> 
     14 
  • community_hive/trunk/community_hive_web/app/views/statistics/index.html.erb

    r1721 r1800  
    1 <h2>Statistics</h2> 
     1<h2>Numbers</h2> 
    22 
    3 <h3>Latest bad Urls</h3> 
    43<table class="search"> 
    54 <tbody> 
    65   <tr> 
    7     <td>rating</td> 
    8     <td>top level domain</td> 
     6    <td><h3>Latest Bad Urls</h3></td> 
    97   </tr> 
    108   <% for results in @latest_bad %> 
    119   <tr> 
    12      <td><%= status_image(results.status) %></td> 
    1310     <td><%= link_to results.host, :controller => 'urls', :action => 'show', :id => results %></td> 
    1411   </tr> 
     
    1613 </tbody> 
    1714</table> 
    18  
    19 <h3>Some numbers</h3> 
    20 <table> 
     15<table class="search"> 
    2116 <tbody> 
    2217   <tr> 
    23     <td>Total Urls collected:</td> 
    24     <td><%=h @total %></td> 
     18     <td><h3>Total Urls collected:</h3></td> 
     19     <td><%=h @total %></td> 
     20   </tr> 
     21    <tr> 
     22      <td><h3>Current Queue Size:</h3></td> 
     23      <td><%=h @queue %></td> 
    2524   </tr> 
    2625  </tbody> 
    2726</table> 
    2827 
    29 TODO: 
    30 - Show Bad Urls vs. All Urls in the past 24 hours 
    31 - Top 10 bad URL in the past 24  
    32 - Show the number of urls processed each day for the past week 
    3328