Skip to content

Commit

Permalink
changes to make it easier to deplay LatticeGrid
Browse files Browse the repository at this point in the history
  • Loading branch information
wakibbe committed Sep 14, 2009
1 parent bce2701 commit 4f13c98
Show file tree
Hide file tree
Showing 72 changed files with 838 additions and 36,619 deletions.
6 changes: 3 additions & 3 deletions app/controllers/graphs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ class GraphsController < ApplicationController
caches_page :show_org, :show_member, :member_nodes, :org_nodes

def index
redirect_to show_org_graph_url(1)
redirect_to show_org_graph_path(1)
end

def show_org
if params[:id].blank? then
redirect_to show_org_graph_url(1)
redirect_to show_org_graph_path(1)
end
end

Expand All @@ -17,7 +17,7 @@ def show_member
params[:id]=params[:id]+'.'+params[:format]
end
else
redirect_to show_org_graph_url(1)
redirect_to show_org_graph_path(1)
end
end

Expand Down
19 changes: 11 additions & 8 deletions app/controllers/investigators_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
class InvestigatorsController < ApplicationController
caches_page :show, :full_show, :list_all, :tag_cloud_side, :tag_cloud, :show_all_tags
helper :sparklines
require 'net/ldap'
require 'ldap_utilities' #specific methods
require 'ldap_utilities' #specific ldap methods

skip_before_filter :find_last_load_date, :only => [:tag_cloud_side, :tag_cloud]
skip_before_filter :handle_year, :only => [:tag_cloud_side, :tag_cloud]
Expand All @@ -11,7 +10,7 @@ class InvestigatorsController < ApplicationController
skip_before_filter :define_keywords, :only => [:tag_cloud_side, :tag_cloud]

def index
redirect_to( year_list_abstracts_url )
redirect_to( year_list_abstracts_path )
end
def list_all
@investigators = Investigator.find(:all, :include=>[:home_department,:appointments], :conditions => ['investigators.end_date is null or investigators.end_date >= :now', {:now => Date.today }], :order => "last_name, first_name")
Expand All @@ -23,7 +22,7 @@ def list_all
end
def full_show
if params[:id].nil? then
redirect_to( year_list_abstracts_url )
redirect_to( year_list_abstracts_path )
elsif !params[:page].nil? then
params.delete(:page)
redirect_to params
Expand All @@ -38,7 +37,7 @@ def full_show
end
def show
if params[:id].nil? then
redirect_to( year_list_abstracts_url)
redirect_to( year_list_abstracts_path)
elsif params[:page].nil? then
params[:page]="1"
redirect_to params
Expand All @@ -53,7 +52,7 @@ def show

def show_all_tags
if params[:id].nil? then
redirect_to( year_list_abstracts_url)
redirect_to( year_list_abstracts_path)
elsif params[:page].nil? then
params[:page]="1"
redirect_to params
Expand Down Expand Up @@ -100,8 +99,12 @@ def handle_member_name
params[:name] = @investigator.first_name + " " + @investigator.last_name
begin
pi_data = GetLDAPentry(@investigator.username)
ldap_rec=CleanPIfromLDAP(pi_data)
@investigator=MergePIrecords(@investigator,ldap_rec)
if pi_data.nil?
logger.warn("Probable error reaching the LDAP server in GetLDAPentry: GetLDAPentry returned null for #{params[:name]} using netid #{@investigator.username}.")
else
ldap_rec=CleanPIfromLDAP(pi_data)
@investigator=MergePIrecords(@investigator,ldap_rec)
end
rescue Exception => error
logger.error("Probable error reaching the LDAP server in GetLDAPentry: #{error.message}")
end
Expand Down
42 changes: 28 additions & 14 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
include TagsHelper

def menu_head_abbreviation
"Feinberg"
end
def title_abbreviation
"Feinberg"
end

require 'config'

def build_menu(nodes, org_type=nil, &block)
out="<ul>"
for unit in nodes
Expand Down Expand Up @@ -74,12 +68,12 @@ def setInvestigatorClass(citation,investigator)
end
end

def link_to_coauthors(coauthors, delimiter=", ")
coauthors.collect{|coauthor| link_to( coauthor.colleague.name,
show_investigator_path(:id=>coauthor.colleague.username, :page=>1), # can't use this form for usernames including non-ascii characters
:title => " #{coauthor.colleague.total_pubs} pubs, "+(coauthor.colleague.num_intraunit_collaborators+coauthor.colleague.num_extraunit_collaborators).to_s+" collaborators")}.join(delimiter)
end
def link_to_coauthors(coauthors, delimiter=", ")
coauthors.collect{|coauthor| link_to( coauthor.colleague.name,
show_investigator_path(:id=>coauthor.colleague.username, :page=>1), # can't use this form for usernames including non-ascii characters
:title => " #{coauthor.colleague.total_pubs} pubs, "+(coauthor.colleague.num_intraunit_collaborators+coauthor.colleague.num_extraunit_collaborators).to_s+" collaborators")}.join(delimiter)
end

def link_to_collaborators(collaborators, delimiter=", ")
collaborators.collect{|investigator| link_to( investigator.name,
show_investigator_path(:id=>investigator.username, :page=>1), # can't use this form for usernames including non-ascii characters
Expand Down Expand Up @@ -186,4 +180,24 @@ def link_to_units(appointments, delimiter="<br/>")
link_to( appointment.name, show_investigators_org_path(appointment.id),
:title => "Show investigators in #{appointment.name}")}.join(delimiter)
end

def handle_tr_format(title, object, re="", replacement="")
return "" if object.blank?
if re.blank?
string=object.to_s
else
string=object.gsub(re,replacement)
end
output = "<tr><th>#{title}</th>"
output += "<td><span id='#{title}'>#{string}</span></td>"
output += "</tr>"
return output
end

def email_link(email)
return "" if email.blank?
return mail_to(email, email.split("@").join(" at "),
:subject => email_subject(),
:encode => "javascript")
end
end
4 changes: 2 additions & 2 deletions app/models/journal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def self.publication_record( year, sortby )

def self.high_impact( )
sortby = "article_influence_score DESC"
conditions = "article_influence_score > 0.001"
conditions = "impact_factor >= 5.0"
# sortby should be one of impact_factor DESC, count_all DESC, journals.journal_abbreviation
find(:all, :limit=>25,
find(:all,
:select => "score_year, impact_factor, journal_abbreviation, issn, total_cites, impact_factor_five_year, immediacy_index, total_articles, eigenfactor_score, article_influence_score",
:conditions => conditions,
:order => "score_year DESC, #{sortby}" )
Expand Down
4 changes: 2 additions & 2 deletions app/views/abstracts/ccsg.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@

<div id="impact_factor">
<h2>Impact Factor and Eigenvalues Analysis</h2>
<h2><%= link_to "List High Impact Journals", high_impact_url %></h2>
<h2><%= link_to "List High Impact Journals", high_impact_path %></h2>
<h2>Click on the year to run the analysis</h2>
<% @year_array.each do |year| %>
<h3><%= link_to year, impact_factor_url(year, '') %></h3>
<h3><%= link_to year, impact_factor_path(year, '') %></h3>
<% end %>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/abstracts/year_list.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<h3><%= "MeSH cloud from publications for the year #{@year}" %></h3>
<div id="tag_cloud"></div>
<script language="javascript">
<%= remote_function(:url => tag_cloud_by_year_abstract_url( @year ), :method => :get, :before => "Element.show('spinner')", :complete => "Element.hide('spinner')" ) %>
<%= remote_function(:url => tag_cloud_by_year_abstract_path( @year ), :method => :get, :before => "Element.show('spinner')", :complete => "Element.hide('spinner')" ) %>
</script>
<br/>
<% end %>
2 changes: 1 addition & 1 deletion app/views/investigators/_all_tags.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h3>MeSH cloud from publications for <i><%= investigator.name %></i></h3>
<div id="tag_cloud"></div>
<script language="javascript">
<%= remote_function(:url => tag_cloud_investigator_url(investigator.id), :method => :get, :before => "Element.show('spinner')",
<%= remote_function(:url => tag_cloud_investigator_path(investigator.id), :method => :get, :before => "Element.show('spinner')",
:complete => "Element.hide('spinner')" ) %>
</script>
<br/>
4 changes: 1 addition & 3 deletions app/views/investigators/list_all.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@
<%= investigator.first_name %>
</td>
<td class="list-left">
<%= mail_to(investigator.email, investigator.email.split("@").join(" at "),
:subject => "Contact from the Feinberg Publications site",
:encode => "javascript") if ! investigator.email.blank? %>
<%= email_link(investigator.email) %>
</td>
<td class="list-left">
<%= investigator.home_department.abbreviation %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/investigators/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<h3>Keywords (MeSH):</h3>
<div id="tag_cloud_side"></div>
<script language="javascript">
<%= remote_function(:url => tag_cloud_side_investigator_url( @investigator.id), :method => :get, :before => "Element.show('spinner')",
<%= remote_function(:url => tag_cloud_side_investigator_path( @investigator.id), :method => :get, :before => "Element.show('spinner')",
:complete => "Element.hide('spinner')" ) %>
</script>
<% end %>
Expand Down
18 changes: 9 additions & 9 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,15 @@

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Feinberg Faculty Publications: <%= controller.action_name %></title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>RHLCCC Faculty Publications: <%= controller.action_name %></title>
<%= javascript_include_tag :defaults, 'FusionCharts', 'ddsmoothmenu', 'jquery.min' %>
<%= stylesheet_link_tag 'publications','ddsmoothmenu', 'ddsmoothmenu-v' %>
<%= render :partial => "shared/menu_scripts", :locals => { :menu_nodes => @menu_nodes } %>
<script>
jQuery.noConflict();
// Use jQuery via jQuery(...)
</script>
<style type="text/css">
#search {
background: url(<%= image_path("titlebar.jpg") %>) ;
}
</style>
</head>
<body>

Expand All @@ -30,9 +25,9 @@
</div>
<% end %>
<div id="main" class="autoclear">
<div id="banner"><a href="http://www.nucats.northwestern.edu" ><%= image_tag "pageheader.jpg", options={:alt=>"The Northwestern University Clinical and Translational Sciences Institute"} %></a></div>
<div id="banner"><a href="http://www.cancer.northwestern.edu" ><%= image_tag "pageheader.jpg", options={:alt=>"The Robert H. Lurie Comprehensive Cancer Center of Northwestern University"} %></a></div>
<div id="results" class="notice"><%= flash[:notice] %> <%= image_tag 'loading.gif', :id=>'spinner', :style=>"display:none; float:right;" %> </div>
<div id="title">Feinberg Publications and Abstracts Site </div>
<div id="title">Cancer Center Member Publications and Abstracts Site</div>
<div id="search">
<% form_for :keywords, :url => {:controller => 'abstracts', :action => "search"} do |form| %>
<%= form.text_field :keywords, :size => 20 %> Search
Expand All @@ -48,6 +43,11 @@
<%= link_to( image_tag( 'lattice_grid_med.gif', :size => "60x60" ), "http://wiki.bioinformatics.northwestern.edu/index.php/LatticeGrid") %> <br/>
Powered by <%= link_to( "LatticeGrid", "http://wiki.bioinformatics.northwestern.edu/index.php/LatticeGrid") %>
</div>
<br/>
<div id="nubic">
<%= link_to( image_tag( 'nubic-logo.gif', :size => "167x55" ), "http://www.nucats.northwestern.edu/centers/nubic/index.html") %>
<%= link_to( "Sponsored by NUBIC", "http://www.nucats.northwestern.edu/centers/nubic/index.html") %>
</div>
<p></p>
</div> <!-- end of side -->
<div id="maincontent">
Expand Down

0 comments on commit 4f13c98

Please sign in to comment.