<% require "multibytes" child = children_details_tr knowledge = Knowledge.find(:first, :conditions => ["node_id=?", child.id], :user => @user) if child.node_type!=3 || !knowledge.comment_on path = child.path (title = child.title ) && title = (title=="NULL" ? nil : truncate(h(title),28)) (desc = child.description ) && desc = (desc=="NULL" ? nil : truncate(h(desc),80)) link = false dl = false if child.directory? image = @image_folder if child.has_variable_nodes?(:user=>@user) link = image_tag('tree/anal_viz.png', :alt=>'Anal/Vis', :title=>'Analyze/visualize variables in this folder', :border=>0,:align=>'absmiddle') end if child.entity.downloadable? if child.opendap? dl = path + '.html' # ad hoc solution : applicable only to opendap elsif @url_prefix dl = data_dl_url(path.sub(/^\//,"")) end end elsif child.knowledge? # knowledge icon image = @image_knowledge # [show] knowledge show_knowledge = image_tag('tree/show.png', :alt=>'Show', :title=>'Show knowledges', :border=>0,:align=>'absmiddle') elsif child.variable? image = @image_data link = image_tag('tree/anal_viz.png', :alt=>'Anal/Vis', :title=>'Analyze/visualize this variable', :border=>0, :align=>'absmiddle') elsif child.image? image = @image_image show_image = image_tag('tree/show.png', :alt=>'Show', :title=>'Show images', :border=>0,:align=>'absmiddle') else raise "bug" end if @mapsearch details = " path, :format => "html")}\">Details" else if child.class.respond_to?(:site) url = data_url(:path => path.sub(/^\//,""), :format => "html", :site => child.class.site.to_s) else url = data_url(:path => path.sub(/^\//,""), :format => "html") end details = link_to_remote( image_tag('tree/details.png',:alt=>'details', :title=>'Show details',:border=>0,:align=>'absmiddle'), {:update => :details, :url => url, :method => :get}, :href => url) end %> <% if link || show_image %> <%= check_box_tag("list[#{path}]") %> <% end %> <% if link %> <%= link_to(link, :action => "add_to_list", :path => path, :type => @type) %> <% elsif show_knowledge %> <%= link_to_remote(show_knowledge, :update => :details, :url => {:controller => "knowledge", :action => "show_without_layout", :path => path}) %> <% elsif show_image url = url_for(:action => :show_images, :path => path) %> <%= link_to_remote(show_image, {:update=>:details, :url=>url, :method=>:get}, :href => url) %> <% end %> <% unless @mapsearch %> <% if dl %> <%= image_tag('tree/DL.png', :alt=>'DL', :title=>'Download', :border=>0, :align=>'absmiddle') %> <% end %> <% end %> <% if @mapsearch %> <%= @no %><%= child.id %> <% end %> <%= details %> <% case child.node_type when 1 # Variable var_node = Node.find(:first, :conditions => ["path=?", path], :user => @user) node_relations = NodeRelation.find(:all, :conditions => ["name=? AND reference=?", "based_on", var_node.id]) node_ids = node_relations.collect! {|x| x.referenced_by } when 2 # Image img = Image.find(child.id) knowledge_figures = KnowledgeFigure.find(:all, {:conditions => ["image_id = ?", img.id]}) knowledge_ids = knowledge_figures.collect! {|kf| kf.knowledge_id} node_ids = knowledge_ids.collect! {|kid| Knowledge.find(:first, :conditions => ["knowledges.id=?", kid], :user => @user).node_id} end if (node_ids && node_ids.length > 0) node_ids.uniq! %> <%= link_to_remote(image_tag('tree/knowledges.png', :alt=>'knowledges',:title=>'knowledge list',:border=>0,:align=>'absmiddle'),:update => :details, :url => {:controller => "knowledge", :action => "list_without_layout", :node_ids => node_ids} ) %> <% end %> <% unless @mapsearch %> <%= image %> <% end %> <% if child.knowledge? %> <%= h(child.path.split('/')[-1]) %> <% else %> <%= h(child.name) %> <% end %> <% if child.knowledge? %> <% knowledge = Knowledge.find(child, :user => @user) %> <%= h(knowledge.title.jleft_w_dots(28)) %> <% else %> <% if title %> <%= title %> <% end %> <% end %> <%= h(Node.size2str(child.size)) %> <%= h(child.mtime.strftime('%Y-%m-%d %H:%M')) %> <% if desc %> <%= desc %> <% end %> <% if @mapsearch if @mode == "points" || @mode == "partial" %> <% SpatialAttribute.find(:all, :conditions=>"variable_id=#{child.id}").each do |s| case @mode when "points" %> (<%= h( s.longitude_lb ) %>,<%= h( s.latitude_lb ) %>) <% when "partial" %> (<%= h( s.longitude_lb ) %>,<%= h( s.latitude_lb ) %>)-(<%= h( s.longitude_rt ) %>,<%= h( s.latitude_rt ) %>) <% end end end %> <% end %> <% end %>