Changeset 209


Ignore:
Timestamp:
Apr 20, 2012, 10:38:33 AM (5 years ago)
Author:
kostas.karasavvas@…
Message:

Now, for some list disambiguation, the first element of top level lists are in bold

Location:
t2-web/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • t2-web/trunk/CHANGES

    r207 r209  
    1 = Changes log for the Taverna via the Web Gem
     1= Changes log for the Taverna via the Web App
     2
     3== Version 0.1.6
     4* Now, for some list disambiguation, the first element of top level lists are in bold
     5* Increased side frames slightly
    26
    37== Version 0.1.5
  • t2-web/trunk/README

    r207 r209  
    33
    44Authors::     Konstantinos Karasavvas
    5 Gem Version:: 0.1.5
     5Gem Version:: 0.1.6
    66Contact::     mailto:kostas.karasavvas@nbic.nl
    77Licence::     MIT (See LICENCE or http://www.opensource.org/licenses/mit-license)
  • t2-web/trunk/Rakefile

    r207 r209  
    1313spec = Gem::Specification.new do |s|
    1414  s.name = 't2-web'
    15   s.version = '0.1.5'
     15  s.version = '0.1.6'
    1616  s.extra_rdoc_files = ['README', 'LICENSE', 'CHANGES']
    1717  s.summary = 'Web application that generates a Web UI form for a Taverna2 workflow, given its myExperiment id, for ease of execution. The only requirement for the user is a web browser.'
  • t2-web/trunk/bin/t2_webapp.rb

    r207 r209  
    141141
    142142
     143    # Takes list as input (or single element), returns as multi-line string
     144    # TODO: when 'typing' issues are resolved think of using system_flatten_list_results method
     145    # TODO: <b></b> is added to single images -- remember to clean after 'typing' work
     146    def flatten_list_results(data_lists)
     147      data = ""
     148      data_lists.each do |list|
     149        if list.instance_of? Array
     150          tmp_data = list.flatten.compact.map {|e| e.chomp}
     151          tmp_data[0] = "<b>" + tmp_data[0] + "</b>"
     152          data += tmp_data.join("\n") + "\n"
     153        else
     154          data += list.chomp + "\n"
     155        end
     156      end
     157      data
     158    end
     159
     160
    143161    # Takes list as input (or single element), returns as file stream
    144162    # TODO: for images it works when not a list!
    145     def flatten_list_results(list)
    146       data = ""
    147       #p list
    148       if list.instance_of? Array
    149         # flatten (sub-)list and remove nils and if present, newlines
    150         # then join list as a multi-line string
    151         data = list.flatten.compact.map {|e| e.chomp}.join("\n")
    152       else
    153         data = list.chomp
    154       end
    155 
    156       StringIO.new data
    157     end
     163    #def system_flatten_list_results(list)
     164    #  data = ""
     165    #  if list.instance_of? Array
     166    #    # flatten (sub-)list and remove nils and if present, newlines
     167    #    # then join list as a multi-line string
     168    #    data = list.flatten.compact.map {|e| e.chomp}.join("\n")
     169    #  else
     170    #    data = list.chomp
     171    #  end
     172    #  StringIO.new data
     173    #end
    158174
    159175
     
    294310
    295311      # copy results to our app's tmp
    296       copy_to_tmp("outputs/#{@run_uuid}", t2_output, data_stream)
     312      copy_to_tmp("outputs/#{@run_uuid}", t2_output, (StringIO.new data_stream))
    297313    end
    298314
     
    314330    t2_output = params[:out]
    315331
    316     data = File.open("#{settings.public_folder}/#{WEB_APP_NAME}/tmp/outputs/#{run_uuid}/#{t2_output}", "r").read
     332    display_file = "#{settings.public_folder}/#{WEB_APP_NAME}/tmp/outputs/#{run_uuid}/#{t2_output}"
     333
     334    data = File.open(display_file, "r").read
    317335
    318336    # Add HTML tags to display properly
     
    321339    # work with one image since flatten_list_results only deals with multi-line strings
    322340    # and single strings or single images (indirectly!)
    323     mime_type = %x( file --mime-type #{settings.public_folder}/#{WEB_APP_NAME}/tmp/outputs/#{run_uuid}/#{t2_output} )
    324     if mime_type =~ /image\/png|image\/jpg|image\/gif|image\/bmp/
    325       generate_image_result("/#{WEB_APP_NAME}/tmp/outputs/#{run_uuid}/#{t2_output}")
     341    mime_type = %x( file --mime-type #{display_file} )
     342   
     343    # TODO: image types can go to array and regex auto-generated
     344    # TODO: application/octet-stream is a temporary hack until we deal with 'typing' properly
     345    if mime_type =~ /image\/png|image\/jpg|image\/gif|image\/bmp|application\/octet-stream/
     346      # clean image from <b></b> --- will not be needed after we deal with 'typing' properly t2-server-0.9.x
     347      if mime_type =~ /octet-stream/
     348        unless File.file?("/#{WEB_APP_NAME}/tmp/outputs/#{run_uuid}/clean_#{t2_output}")
     349          new_length = File.size?(display_file) - 3 - 4   # for <b> and </b> respectively
     350          %x( dd if="#{display_file}" of="#{settings.public_folder}/#{WEB_APP_NAME}/tmp/outputs/#{run_uuid}/clean_#{t2_output}" bs=1 skip=3 count="#{new_length}" )
     351        end
     352        generate_image_result("/#{WEB_APP_NAME}/tmp/outputs/#{run_uuid}/clean_#{t2_output}")
     353      else
     354        generate_image_result("/#{WEB_APP_NAME}/tmp/outputs/#{run_uuid}/#{t2_output}")
     355      end
    326356    else
    327357      generate_html_result(data)
  • t2-web/trunk/views/results.haml

    r185 r209  
    2020
    2121  -# we use border for FF and framespacing for IE
    22   %frameset{ :rows => "113px, *", :border => "1", :framespacing => "1" }
     22  %frameset{ :rows => "125px, *", :border => "1", :framespacing => "1" }
    2323    %noframes
    2424      To be viewed properly, this page requires frames.
    2525    %frame{ :name => "header", :id => "header" }
    26     %frameset{ :cols => "250px, *", :border => "6", :framespacing => "6" }
     26    %frameset{ :cols => "280px, *", :border => "6", :framespacing => "6" }
    2727      %frame{ :name => "data-navigation", :id => "data-navigation" }
    2828      %frame{ :name => "data-display", :id => "data-display" }
Note: See TracChangeset for help on using the changeset viewer.