myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2833] branches/datasets: Users can specify data


From: noreply
Subject: [myexperiment-hackers] [2833] branches/datasets: Users can specify data sets for workflows.
Date: Tue, 22 Nov 2011 05:03:19 -0500 (EST)

Revision
2833
Author
fbacall
Date
2011-11-22 05:03:18 -0500 (Tue, 22 Nov 2011)

Log Message

Users can specify data sets for workflows. Lacking: authorization, API, download as zip, tests

Modified Paths

Added Paths

Diff

Added: branches/datasets/app/controllers/data_items_controller.rb (0 => 2833)


--- branches/datasets/app/controllers/data_items_controller.rb	                        (rev 0)
+++ branches/datasets/app/controllers/data_items_controller.rb	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,193 @@
+# myExperiment: app/controllers/data_items_controller.rb
+#
+# Copyright (c) 2011 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class DataItemsController < ApplicationController
+
+  before_filter :fetch_relationship, :except => [:create, :new]
+  before_filter :fetch_data_set_and_workflow
+  before_filter :fetch_port_names, : [:new, :edit]
+  before_filter :fetch_blobs, : [:new, :edit]
+
+  def create
+    @errors = []
+    @relationship = Relationship.new
+
+    data = ""
+    port = get_port
+    predicate = Predicate.find(params[:predicate_id])
+
+    if @errors.empty? && @relationship.update_attributes(:subject => data, :objekt => port, :predicate => predicate,
+                                                         :context => @data_set)
+      respond_to do |format|
+        format.html {render :partial => "data_sets/data_set", :object => @data_set}
+      end
+    else
+      @errors = @errors + @relationship.errors.full_messages
+      respond_to do |format|
+        format.html {render :partial => "data_sets/errors", :status => 400}
+      end
+    end
+  end
+
+  def update
+    @errors = []
+
+    data = ""
+    port = get_port
+    predicate = Predicate.find(params[:predicate_id])
+
+    if @errors.empty? && @relationship.update_attributes(:subject => data, :objekt => port, :predicate => predicate)
+      respond_to do |format|
+        format.html {render :partial => "data_sets/data_item", :object => @relationship,
+                            :locals => {:port_type => params[:workflow_port_type]}}
+      end
+    else
+      @errors = @errors + @relationship.errors.full_messages
+      respond_to do |format|
+        format.html {render :partial => "data_sets/errors", :status => 400}
+      end
+    end
+  end
+
+  def destroy
+    @errors = []
+
+    if @relationship.destroy
+      respond_to do |format|
+        format.html {render :partial => "data_sets/data_set", :object => @data_set}
+      end
+    end
+  end
+
+  def edit
+    respond_to do |format|
+      format.html {render :partial => "data_sets/data_item_form",
+                          :locals => {:port_type => @relationship.objekt.port_type.to_s}}
+    end
+  end
+
+  def new
+    @relationship = Relationship.new
+
+    if @port_names.empty?
+      respond_to do |format|
+        format.html {render :nothing => true, :status => 400}
+      end
+    else
+      respond_to do |format|
+        format.html {render :partial => "data_sets/data_item_form",
+                          :locals => {:port_type => params[:port_type]}}
+      end
+    end
+  end
+
+  def show
+    respond_to do |format|
+      format.html {render :partial => "data_sets/data_item", :object => @relationship,
+                          :locals => {:port_type => @relationship.objekt.port_type.to_s}}
+    end
+  end
+
+  private
+  def fetch_data_set_and_workflow
+    @data_set = DataSet.find(params[:data_set_id])
+    @workflow = @data_set.workflow
+  end
+
+  def fetch_relationship
+    @relationship = Relationship.find(params[:id])
+  end
+
+  def get_data
+    data = ""
+
+    if params[:data_type] == "text"
+      #If it wasn't associated with text data before, create some
+      if address@hidden(TextData)
+        data = "" => params[:data], :data_set => @data_set)
+        unless data.save
+          @errors = @errors + data.errors.full_messages
+        end
+      #Otherwise just update the existing text data
+      else
+        data = ""
+        unless data.update_attributes(:data ="" params[:data])
+          @errors = @errors + data.errors.full_messages
+        end
+      end
+    elsif params[:data_type] == "file"
+      #delete existing text data
+      if @relationship.subject.kind_of?(TextData)
+        @relationship.subject.destroy
+      end
+
+      data = ""
+    else
+      @errors << "Invalid data type specified."
+    end
+
+    data
+  end
+
+  def get_port
+    port = nil
+    port_type = params[:workflow_port_type]
+    version = @data_set.workflow_version
+
+    if @relationship.objekt
+      #If port has changed...
+      if (params[:workflow_port] == @relationship.objekt.name) &&
+          (port_type == @relationship.objekt.port_type.to_s) &&
+          (version == @relationship.objekt.workflow_version)
+        #Try and find one that already exists with given params
+        port = WorkflowPort.find(:first, :conditions => ["name = ? AND port_type = ? AND workflow_id = ? AND workflow_version = ?",
+                                                         params[:workflow_port], port_type, @workflow.id, version])
+      end
+    end
+
+    #If still no port, make one
+    unless port
+      #Check if port name from form is a valid port name
+      workflow_model = @data_set.workflow.get_workflow_model_object(version)
+      collection = ((port_type == "input") ? workflow_model.sources : workflow_model.sinks)
+
+      if collection.map { |s| s.name }.include?(params[:workflow_port])
+        port = WorkflowPort.new(:name => params[:workflow_port], :workflow => @workflow,
+                                :port_type => port_type, :workflow_version => version)
+        unless port.save
+          @errors = @errors + port.errors.full_messages
+        end
+      else
+        @errors << "Invalid port name specified."
+      end
+    end
+
+    port
+  end
+
+  def fetch_port_names
+    port_type = params[:port_type] || @relationship.objekt.port_type.to_s
+
+    existing_ports = @data_set.relationships.select do |r|
+      port_type == "input" && r.objekt.input? ||
+      port_type == "output" && r.objekt.output?
+    end.collect {|r| r.objekt.name}
+
+    existing_ports -= address@hidden if @relationship
+
+    version = @data_set.workflow_version
+
+    @port_names = (port_type == "input" ? @workflow.get_workflow_model_object(version).sources :
+                                          @workflow.get_workflow_model_object(version).sinks).map {|s| s.name}
+
+    @port_names = (@port_names - existing_ports)
+  end
+
+  def fetch_blobs
+    #todo: Rails 2: can eagerly load bookmarkable... but that may not make a difference to perf
+    @blobs = current_user.blobs +
+        (current_user.bookmarks.find(:all, :conditions => ["bookmarkable_type = 'Blob'"]).map {|b| b.bookmarkable})
+  end
+end
\ No newline at end of file

Added: branches/datasets/app/controllers/data_sets_controller.rb (0 => 2833)


--- branches/datasets/app/controllers/data_sets_controller.rb	                        (rev 0)
+++ branches/datasets/app/controllers/data_sets_controller.rb	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,88 @@
+# myExperiment: app/controllers/data_sets_controller.rb
+#
+# Copyright (c) 2011 Unity of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class DataSetsController < ApplicationController
+
+  before_filter :fetch_workflow
+  before_filter :fetch_data_set, :except => [:create, :new, :index]
+  before_filter :fetch_data_sets, : [:index, :show]
+
+  def create
+    @data_set = @workflow.data_sets.build(params[:data_set])
+    if @data_set.save
+      respond_to do |format|
+        format.html { redirect_to workflow_data_set_url(@workflow, @data_set) }
+      end
+    else
+      respond_to do |format|
+        format.html { render :action ="" "new" }
+      end
+    end
+  end
+
+  def update
+    if @data_set.update_attributes(params[:data_set])
+      respond_to do |format|
+        format.html { redirect_to workflow_data_set_url(@workflow, @data_set) }
+      end
+    else
+      respond_to do |format|
+        format.html { render :action ="" "edit" }
+      end
+    end
+  end
+
+  def destroy
+    if @data_set.destroy
+      respond_to do |format|
+        format.html { redirect_to workflow_data_sets_url(@workflow) }
+      end
+    else
+      respond_to do |format|
+        format.html { redirect_to workflow_data_set_url(@workflow, @data_set) }
+      end
+    end
+  end
+
+  def new
+    @data_set = DataSet.new
+    respond_to do |format|
+      format.html
+    end
+  end
+
+  def edit
+    respond_to do |format|
+      format.html
+    end
+  end
+
+  def show
+    respond_to do |format|
+      format.html
+    end
+  end
+
+  def index
+    respond_to do |format|
+      format.html
+    end
+  end
+
+  private
+
+  def fetch_workflow
+    @workflow = Workflow.find(params[:workflow_id])
+  end
+
+  def fetch_data_set
+    @data_set = DataSet.find(params[:id])
+  end
+
+  def fetch_data_sets
+    @data_sets = @workflow.data_sets
+  end
+
+end

Modified: branches/datasets/app/controllers/workflows_controller.rb (2832 => 2833)


--- branches/datasets/app/controllers/workflows_controller.rb	2011-11-21 11:14:51 UTC (rev 2832)
+++ branches/datasets/app/controllers/workflows_controller.rb	2011-11-22 10:03:18 UTC (rev 2833)
@@ -21,7 +21,7 @@
   
   before_filter :check_is_owner, : [:edit, :update]
   
-  before_filter :get_example_data_sets, : [:tag_suggestions, :extra_metadata]
+  #todo: remove? before_filter :get_example_data_sets, : [:tag_suggestions, :extra_metadata]
 
   # declare sweepers and which actions should invoke them
   cache_sweeper :workflow_sweeper, : [ :create, :create_version, :launch, :update, :update_version, :destroy_version, :destroy ]

Added: branches/datasets/app/helpers/data_sets_helper.rb (0 => 2833)


--- branches/datasets/app/helpers/data_sets_helper.rb	                        (rev 0)
+++ branches/datasets/app/helpers/data_sets_helper.rb	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,8 @@
+# myExperiment: app/helpers/data_sets_helper.rb
+#
+# Copyright (c) 2011 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+module DataSetsHelper
+
+end

Added: branches/datasets/app/models/data_set.rb (0 => 2833)


--- branches/datasets/app/models/data_set.rb	                        (rev 0)
+++ branches/datasets/app/models/data_set.rb	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,23 @@
+# myExperiment: app/models/data_set.rb
+#
+# Copyright (c) 2011 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class DataSet < ActiveRecord::Base
+
+  acts_as_site_entity
+
+  validates_presence_of :title
+
+  format_attribute :description
+
+  belongs_to :workflow
+
+  #todo: Rails 2: can probably use separate finders for input/output relationships as it supports conditions on
+  # joined tables;
+  has_many :relationships, :class_name => "Relationship", :as => :context,
+           :dependent => :destroy
+
+  has_many :text_datas, :dependent => :destroy
+
+end

Modified: branches/datasets/app/models/relationship.rb (2832 => 2833)


--- branches/datasets/app/models/relationship.rb	2011-11-21 11:14:51 UTC (rev 2832)
+++ branches/datasets/app/models/relationship.rb	2011-11-22 10:03:18 UTC (rev 2833)
@@ -17,9 +17,21 @@
   after_save :touch_context
   after_destroy :touch_context
 
+  #To avoid leaving orphaned text data
+  before_destroy :destroy_text_data
+
   def touch_context
     # Rails 2 - use context.destroyed? instead of context.contribution.nil?
-    context.touch if !context.contribution.nil? && context.respond_to?(:touch)
+    if context.respond_to?(:contribution)
+      context.touch if !context.contribution.nil? && context.respond_to?(:touch)
+    end
   end
+
+  private
+
+  def destroy_text_data
+    if subject.kind_of?(TextData)
+      subject.destroy
+    end
+  end
 end
-

Added: branches/datasets/app/models/text_data.rb (0 => 2833)


--- branches/datasets/app/models/text_data.rb	                        (rev 0)
+++ branches/datasets/app/models/text_data.rb	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,14 @@
+# myExperiment: app/models/text_data.rb
+#
+# Copyright (c) 2011 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class TextData < ActiveRecord::Base
+
+  set_table_name "text_data"
+
+  belongs_to :data_set
+
+  validates_presence_of :data, :data_set_id
+
+end
\ No newline at end of file

Modified: branches/datasets/app/models/workflow.rb (2832 => 2833)


--- branches/datasets/app/models/workflow.rb	2011-11-21 11:14:51 UTC (rev 2832)
+++ branches/datasets/app/models/workflow.rb	2011-11-22 10:03:18 UTC (rev 2833)
@@ -55,6 +55,9 @@
 
   has_previews
 
+  has_many :data_sets, :dependent => :destroy, :order => ["updated_at DESC"]
+  has_many :workflow_ports, :dependent => :destroy
+
   explicit_versioning(:version_column => "current_version",
                       :extra_attributes => ["image", "svg"],
                       :white_list_columns => ["body"]) do

Added: branches/datasets/app/models/workflow_port.rb (0 => 2833)


--- branches/datasets/app/models/workflow_port.rb	                        (rev 0)
+++ branches/datasets/app/models/workflow_port.rb	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,34 @@
+# myExperiment: app/models/workflow_port.rb
+#
+# Copyright (c) 2011 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class WorkflowPort < ActiveRecord::Base
+
+  belongs_to :workflow
+
+  validates_presence_of :name, :port_type, :workflow_id, :workflow_version
+
+  #This doesn't work, messes up because port_type is a symbol?
+  #validates_uniqueness_of :name, :scope => [:port_type, :workflow_id, :workflow_version]
+
+  # Adapted from #3 of: http://zargony.com/2008/04/28/five-tips-for-developing-rails-applications
+  validates_inclusion_of :port_type, :in => [:input, :output]
+
+  def port_type
+    read_attribute(:port_type).to_sym
+  end
+
+  def port_type=(value)
+    write_attribute(:port_type, value.to_s)
+  end
+
+  def input?
+    port_type == :input
+  end
+
+  def output?
+    port_type == :output
+  end
+
+end
\ No newline at end of file

Copied: branches/datasets/app/views/data_sets/_breadcrumbs.rhtml (from rev 2800, branches/datasets/app/views/citations/_breadcrumbs.rhtml) (0 => 2833)


--- branches/datasets/app/views/data_sets/_breadcrumbs.rhtml	                        (rev 0)
+++ branches/datasets/app/views/data_sets/_breadcrumbs.rhtml	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,28 @@
+<li><%= link_to 'Workflows', workflows_path -%></li>
+
+<li><b>&#187;</b></li>
+
+<li><%= link_to "#{h(@workflow.title)}", workflow_path(@workflow) -%></li>
+
+<li><b>&#187;</b></li>
+
+<% if controller.action_name.to_s == "index" %>
+  <li>Data Sets</li>
+<% else %>
+  <li><%= link_to 'Data Sets', workflow_data_sets_path(@workflow) -%></li>
+<% end %>
+
+<% case controller.action_name.to_s; when "show" %>
+  <li><b>&#187;</b></li>
+  <li><%= h(@data_set.title) %></li>
+<% when "new" %>
+  <li><b>&#187;</b></li>
+  <li>Create new data set</li>
+<% when "edit" %>
+  <li><b>&#187;</b></li>
+  <li><%= link_to h(@data_set.title), workflow_data_set_path(@workflow, @data_set) %></li>
+  <li><b>&#187;</b></li>
+  <li>Edit</li>
+<% else %>
+  <!-- no breadcrumb -->
+<% end %>

Added: branches/datasets/app/views/data_sets/_data_item.rhtml (0 => 2833)


--- branches/datasets/app/views/data_sets/_data_item.rhtml	                        (rev 0)
+++ branches/datasets/app/views/data_sets/_data_item.rhtml	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,63 @@
+<%
+   data = ""
+   port = data_item.objekt
+%>
+
+<% port_td = capture do %>
+  <td class="port <%= port_type -%>">
+    <h5><img src="" <%= port_type.capitalize %> Name</h5>
+    <div>
+      <input title="<%= port.name -%>" type="text" readonly="readonly" value="<%= port.name -%>" size="21" class="readonly"/>
+    </div>
+  </td>
+<% end  %>
+
+<% data_td = capture do %>
+  <td class="data">
+    <h5><img src="" Data</h5>
+    <% if data.kind_of?(TextData) %>
+      <div>
+        <%= text_area_tag :data, data.data, :readonly =>"readonly", :rows => 1, :cols => 50, :class => "readonly" %>
+      </div>
+    <% elsif data.kind_of?(Blob) %>
+      <div class="file_data">
+        <div style="float:left">
+          <b>Title:</b> <%= link_to "#{h truncate(data.label, 70)}", file_path(data), :class => "file_link" %><br/>
+          <b>Type: </b> <%= h data.content_type.title %><br/>
+          <b>Size: </b> <%= number_to_human_size(data.content_blob.data.size) %><br/>
+        </div>
+        <div style="float:right">
+          <ul class="sectionIcons">
+            <li>
+              <%= icon('download', download_file_path(data), nil, nil, 'Download') %>
+            </li>
+          </ul>
+        </div>
+      </div>
+    <% end  %>
+  </td>
+<% end  %>
+
+<%= port_type == "input" ? data_td : port_td %>
+<td class="arrow"><img src=""
+<%= port_type == "input" ? port_td : data_td %>
+
+<%# if mine? @workflow %>
+<td class="controls">
+  <%= icon('destroy', {:url ="" data_set_data_item_path(@data_set, data_item), :method => :delete,
+                      :update => {:success => "data_set_container"},
+                      :loading => "$('data_item_#{data_item.id}_spinner').show();",
+                      :complete => "$('data_item_#{data_item.id}_spinner').hide();"},
+           nil, {:method => :delete,
+                 :confirm => "Are you sure?",
+                 :title => "Delete this #{data.kind_of?(TextData) ? "data" : "association"}"}, "", true) %>
+  <br/>
+  <%= icon('edit', {:url ="" edit_data_set_data_item_path(@data_set, data_item), :method => :get,
+                    :update => {:success => "item_#{data_item.id}"},
+                    :loading => "$('data_item_#{data_item.id}_spinner').show();",
+                    :complete => "$('data_item_#{data_item.id}_spinner').hide();"},
+           nil, {:title => "Edit this association"}, "", true) %>
+  <br/>
+  <img id="data_item_<%=data_item.id-%>_spinner" src="" style="display:none; vertical-align: middle;"/>
+</td>
+<%# end %>

Added: branches/datasets/app/views/data_sets/_data_item_form.rhtml (0 => 2833)


--- branches/datasets/app/views/data_sets/_data_item_form.rhtml	                        (rev 0)
+++ branches/datasets/app/views/data_sets/_data_item_form.rhtml	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,104 @@
+<%
+  data = ""
+  port = @relationship.objekt
+  data_type = ""
+  data_type = "file" if data.kind_of?(Blob)
+  data_type = "text" if data.kind_of?(TextData)
+
+  port_names_for_select = @port_names.map do |p|
+    %(<option #{"selected=\"selected\"" if (port && port.name == p)}
+        value="#{p}" title="#{h p}">#{h truncate(p,20)}</option>)
+  end
+
+  blob_names_for_select = @blobs.map do |b|
+    %(<option #{"selected=\"selected\"" if (data == b)}
+        value="#{b.id}" title="#{h b.title}">#{h truncate(b.title,30)}</option>)
+  end
+
+  container_element = @relationship.id.nil? ? "data_item_#{port_type}_form" : "address@hidden"
+  unique_id = @relationship.id.to_s || port_type
+%>
+
+<td colspan="4" style="padding: 0">
+  <% port_td = capture do %>
+    <td class="port <%= port_type -%>" style="vertical-align: top">
+      <h5><%= port_type == "input" ? "3" : "1" -%>. Select <%= port_type %></h5>
+      <div>
+        <%= select_tag(:workflow_port, port_names_for_select) %>
+      </div>
+    </td>
+  <% end  %>
+
+  <% data_td = capture do %>
+    <td class="data">
+      <h5>
+        <%= port_type == "input" ? "1" : "2" -%>. Select data type
+        <div class="data_type">
+          <%= radio_button_tag "data_type", "text", data_type == "text" || data_type.blank?,
+                               { :id => "data_type_text_#{unique_id}",
+                                 : "$$('##{container_element} .data_form').each(function (f){ f.hide()});"+
+                                             "$('text_data_form_#{unique_id}').show();" } %>
+          <label for=""
+
+          <span style="color: #999"> | </span>
+          <%= radio_button_tag "data_type", "file", data_type == "file", { :id => "data_type_file_#{unique_id}",
+                               : "$$('##{container_element} .data_form').each(function (f){ f.hide()});"+
+                                           "$('file_data_form_#{unique_id}').show();" } %>
+          <label for=""
+        </div>
+      </h5>
+
+      <div class="data_form" id="text_data_form_<%=unique_id-%>" <%= "style=\"display: none\"" if data_type != "text" && !data_type.blank? -%>>
+        <h5><%= port_type == "input" ? "2" : "3" -%>. Input your data</h5>
+        <%= text_area_tag(:data, (data.data if data_type == "text"), :rows => 4, :cols => 50) %>
+      </div>
+
+      <div class="data_form" id="file_data_form_<%=unique_id-%>" <%= "style=\"display: none\"" if data_type != "file" -%> >
+        <h5><%= port_type == "input" ? "2" : "3" -%>. Select data file</h5>
+
+        <%= select_tag :file_id, blob_names_for_select %><br/>
+
+      </div>
+      <br class="clearer"/>
+
+    </td>
+  <% end  %>
+  <% form_remote_tag  :url ="" (@relationship.id.nil? ? data_set_data_items_path(@data_set) : data_set_data_item_path(@data_set, @relationship)),
+                      :method => (@relationship.id.nil? ? :post : :put),
+                      :update => {:success => (@relationship.id.nil? ? "data_set_container" : container_element),
+                                  :failure => "data_item_form_errors"},
+                      :failure => "$('data_item_form_errors').show();",
+                      :loading => "$('relationship_form_spinner_#{unique_id}').show();",
+                      :complete => "$('relationship_form_spinner_#{unique_id}').hide();" do %>
+    <%# todo: fix this %>
+    <%= hidden_field_tag :predicate_id, port_type == "input" ? Predicate.find_by_title("exampleInputTo").id : Predicate.find_by_title("exampleOutputFrom").id %>
+
+    <div id="data_item_form_errors" style="display:none"></div>
+
+    <table>
+      <tr>
+        <%= port_type == "input" ? data_td : port_td %>
+        <td class="arrow"><img src=""
+        <%= port_type == "input" ? port_td : data_td %>
+
+        <td class="controls">
+          <%= hidden_field_tag(:workflow_port_type, port_type) %>
+          <%= submit_tag "Save" %><br/>
+          or<br/>
+          <% if @relationship.id.nil? %>
+            <%= link_to "Cancel", "#", : "$$('##{container_element} td').each(function (e){ e.remove()});return false;" %>
+          <% else %>
+            <%= link_to "Cancel", "#", : remote_function(:url ="" data_set_data_item_path(@data_set, @relationship),
+                                                     :method => :get,
+                                                     :update => {:success => container_element},
+                                                     :loading => "$('relationship_form_spinner_#{unique_id}').show();",
+                                                     :complete => "$('relationship_form_spinner_#{unique_id}').hide();")+
+                                                     ";return false" %>
+          <% end %>
+          <br/>
+          <img id="relationship_form_spinner_<%=unique_id-%>" src="" style="display:none; vertical-align: middle;"/>
+        </td>
+      </tr>
+    </table>
+  <% end %>
+</td>

Added: branches/datasets/app/views/data_sets/_data_set.rhtml (0 => 2833)


--- branches/datasets/app/views/data_sets/_data_set.rhtml	                        (rev 0)
+++ branches/datasets/app/views/data_sets/_data_set.rhtml	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,87 @@
+<div class="data_set">
+  <h1><%= @data_set.title %></h1>
+
+  <% if @data_set.workflow_version != @workflow.current_version %>
+    <div class="box_infotext">
+      <img src=""
+      This data set relates to an <%= (@data_set.workflow_version <=> @workflow.current_version) == -1 ? "older" : "newer"-%>
+       version of <%= h @workflow.title -%> and may not be suitable for use with the current version.
+    </div>
+  <% end %>
+
+  <h3>Description</h3>
+  <% unless @data_set.description.blank? %>
+    <div class="contribution_description">
+      <%= @data_set.description_html %>
+    </div>
+  <% else %>
+    <p class="none_text">
+      No description
+    </p>
+  <% end %>
+
+  <h3>Input data</h3>
+  <table>
+    <tbody>
+      <% (@data_set.relationships.select{|r| r.objekt.input?}).each do |i| %>
+        <tr class="data_item" id="item_<%= i.id -%>">
+          <%= render :partial => "data_sets/data_item", :object => i, :locals => {:port_type => "input"} %>
+        </tr>
+        <%# Blank row for spacing %>
+        <tr><td style="padding: 3px"></td></tr>
+      <% end %>
+      <tr id="data_item_input_form">
+      </tr>
+    </tbody>
+  </table>
+  <% if @data_set.relationships.select{|r| r.objekt.input?}.empty? %>
+    <span class="none_text">No output data specified</span>
+  <% end  %>
+  <%# if mine? @workflow %>
+  <ul class="sectionIcons">
+    <li>
+      <%= icon('new', {:url ="" new_data_set_data_item_path(:data_set_id => @data_set.id, :port_type => "input"), :method => :get,
+                       :update => {:success => "data_item_input_form"},
+                       :failure => "alert('No more inputs left to specify.')",
+                       :loading => "$('data_item_input_form_spinner').show();",
+                       :complete => "$('data_item_input_form_spinner').hide();"}, nil, nil,
+               'Add input data', true) %>
+      <img id="data_item_input_form_spinner" src="" style="display:none; vertical-align: middle;"/>
+    </li>
+  </ul>
+  <%# end %>
+
+  <h3>Output data</h3>
+
+  <table>
+    <tbody>
+      <% (@data_set.relationships.select{|r| r.objekt.output?}).each do |o| %>
+        <tr class="data_item" id="item_<%= o.id -%>">
+          <%= render :partial => "data_sets/data_item", :object => o, :locals => {:port_type => "output"} %>
+        </tr>
+        <%# Blank row for spacing %>
+        <tr><td style="padding: 3px"></td></tr>
+      <% end %>
+      <tr id="data_item_output_form">
+      </tr>
+    </tbody>
+  </table>
+
+  <% if @data_set.relationships.select{|r| r.objekt.output?}.empty? %>
+    <span class="none_text">No output data specified</span>
+  <% end  %>
+  <%# if mine? @workflow %>
+  <ul class="sectionIcons">
+    <li>
+      <%= icon('new', {:url ="" new_data_set_data_item_path(:data_set_id => @data_set.id, :port_type => "output"), :method => :get,
+                       :update => {:success => "data_item_output_form"},
+                       :failure => "alert('No more outputs left to specify.')",
+                       :loading => "$('data_item_output_form_spinner').show();",
+                       :complete => "$('data_item_output_form_spinner').hide();"}, nil, nil,
+               'Add output data', true) %>
+      <img id="data_item_output_form_spinner" src="" style="display:none; vertical-align: middle;"/>
+    </li>
+  </ul>
+  <%# end %>
+
+</div>

Added: branches/datasets/app/views/data_sets/_errors.rhtml (0 => 2833)


--- branches/datasets/app/views/data_sets/_errors.rhtml	                        (rev 0)
+++ branches/datasets/app/views/data_sets/_errors.rhtml	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,8 @@
+<div id="errorExplanation" class="errorExplanation">
+  <h2><%= @errors.size -%> <%= @errors.size == 1 ? "error" : "errors" -%> prohibited this data item from being saved</h2>
+  <ul>
+    <% @errors.each do |e| %>
+      <li><%= e -%></li>
+    <% end %>
+  </ul>
+</div>
\ No newline at end of file

Added: branches/datasets/app/views/data_sets/_form.rhtml (0 => 2833)


--- branches/datasets/app/views/data_sets/_form.rhtml	                        (rev 0)
+++ branches/datasets/app/views/data_sets/_form.rhtml	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,32 @@
+<%= _javascript__include_tag :fckeditor %>
+
+<% form_for :data_set,
+            :html => {:method => (@data_set.id.nil? ? :post : :put)},
+            :url ="" (@data_set.id.nil? ? workflow_data_sets_url(@workflow) : workflow_data_set_url(@workflow, @data_set)) do |f| %>
+
+  <%= error_messages_for :data_set %>
+
+  <p>
+    <b>Title:</b><br/>
+    <%= f.text_field :title %>
+  </p>
+
+  <p>
+    <b>Description:</b><br/>
+    <%= fckeditor_textarea(:data_set, :description, :toolbarSet => 'Simple', :width => '600px', :height => '300px') %>
+  </p>
+
+  <p>
+    <b>Workflow version:</b> <%= f.select :workflow_version,
+                 @workflow.versions.reverse.map {|w| ["#{w.version.to_s} address@hidden(w.version)}", w.version.to_s] } %>
+  </p>
+
+
+  <%= f.hidden_field :category, :value => "example_data" %>
+
+  <%= submit_tag (@data_set.id.nil? ? "Create" : "Update") %>
+  or
+  <%= link_to "Cancel", (@data_set.id.nil? ? workflow_data_sets_path(@workflow) :
+                                             workflow_data_set_path(@workflow, @data_set)) %>
+<% end %>
+

Added: branches/datasets/app/views/data_sets/edit.rhtml (0 => 2833)


--- branches/datasets/app/views/data_sets/edit.rhtml	                        (rev 0)
+++ branches/datasets/app/views/data_sets/edit.rhtml	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,4 @@
+<h1>Edit Data Set: <%= @data_set.title %></h1>
+<div id="data_set_form_container">
+  <%= render :partial => "data_sets/form" %>
+</div>
\ No newline at end of file

Added: branches/datasets/app/views/data_sets/index.rhtml (0 => 2833)


--- branches/datasets/app/views/data_sets/index.rhtml	                        (rev 0)
+++ branches/datasets/app/views/data_sets/index.rhtml	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,32 @@
+<ul class="sectionIcons">
+  <li>
+    <%= icon('new', new_workflow_data_set_path(@workflow), nil, nil, 'Create new data set') %>
+  </li>
+</ul>
+
+<h1>Data Sets</h1>
+
+<% if @workflow.data_sets.empty? %>
+  <span class="none_text">No data sets provided.</span>
+<% else %>
+  <table class="data_set_list">
+  <tbody>
+    <tr>
+      <th>Title</th><th>Date Created</th><th>Workflow Version</th>
+    </tr>
+    <% @workflow.data_sets.sort_by(&:workflow_version).reverse_each do |data_set| %>
+      <tr class="data_set <%= "old_version" if data_set.workflow_version < @workflow.current_version-%>">
+        <td style="width: 25em">
+          <%= link_to data_set.title, workflow_data_set_path(@workflow, data_set) %>
+        </td>
+        <td>
+          <%= time_ago_in_words(data_set.created_at) %> ago
+        </td>
+        <td>
+          <%= "#{data_set.workflow_version} address@hidden(data_set.workflow_version)}" %>
+        </td>
+      </tr>
+    <% end %>
+  </tbody>
+  </table>
+<% end %>
\ No newline at end of file

Added: branches/datasets/app/views/data_sets/new.rhtml (0 => 2833)


--- branches/datasets/app/views/data_sets/new.rhtml	                        (rev 0)
+++ branches/datasets/app/views/data_sets/new.rhtml	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,4 @@
+<h1>New Data Set</h1>
+<div id="data_set_form_container">
+  <%= render :partial => "data_sets/form" %>
+</div>
\ No newline at end of file

Added: branches/datasets/app/views/data_sets/show.rhtml (0 => 2833)


--- branches/datasets/app/views/data_sets/show.rhtml	                        (rev 0)
+++ branches/datasets/app/views/data_sets/show.rhtml	2011-11-22 10:03:18 UTC (rev 2833)
@@ -0,0 +1,33 @@
+<div id="data_sets_container">
+  <div id="data_set_selector" style="float: left" class="sectionIcons">
+    Jump to data set:
+    <%= select_tag :data_set, (@data_sets.collect {|d| "<option #{"selected = \"selected\"" if d == @data_set}value=\"#{d.id}\">#{truncate h(d.title), 25}</option>"}),
+                   : "window.location = '#{workflow_data_sets_path(@workflow)}/' + $F('data_set');",
+                   :style => "width: 15em"%>
+  </div>
+  <div style="float: right; margin: 0.5em">
+    <ul class="sectionIcons">
+      <li>
+        <%= icon('download', "#", nil, nil, 'Download this data set') %>
+      </li>
+      <li>
+        <%= icon('edit', edit_workflow_data_set_path(@workflow, @data_set), nil, nil, 'Edit data set') %>
+      </li>
+      <li>
+        <%= icon('destroy', workflow_data_set_path(@workflow, @data_set), nil,
+                 {:method => :delete, :confirm => "Are you sure wish to delete this data set? All associated text data "+
+                                                  "will be deleted, but any uploaded files will remain on #{Conf.sitename}."},
+                 'Delete data set') %>
+      </li>
+    </ul>
+  </div>
+  <br class="clearer"/>
+
+  <div id="data_set_container">
+    <% if @data_set %>
+      <%= render :partial => "data_sets/data_set", :object => @data_set %>
+    <% else %>
+      <span class="none_text">No data sets defined</span>
+    <% end %>
+  </div>
+</div>
\ No newline at end of file

Modified: branches/datasets/config/routes.rb (2832 => 2833)


--- branches/datasets/config/routes.rb	2011-11-21 11:14:51 UTC (rev 2832)
+++ branches/datasets/config/routes.rb	2011-11-22 10:03:18 UTC (rev 2833)
@@ -127,8 +127,15 @@
     workflow.resources :reviews
     workflow.resources :previews
     workflow.resources :comments, :collection => { :timeline => :get }
+    workflow.resources :data_sets
   end
 
+  #todo: Rails 2. Nest this in the above and use :shallow => true
+  map.resources :data_items, :controller => "data_items",
+                :path_prefix => "/data_sets/:data_set_id",
+                :name_prefix => "data_set_"
+
+
   # workflow redirect for linked data model
   map.workflow_version           '/workflows/:id/versions/:version',         :conditions => { :method => :get }, :controller => 'workflows', :action ="" 'show'
   map.formatted_workflow_version '/workflows/:id/versions/:version.:format', :conditions => { :method => :get }, :controller => 'workflows', :action ="" 'show'

Modified: branches/datasets/config/schema.d/workflows.xml (2832 => 2833)


--- branches/datasets/config/schema.d/workflows.xml	2011-11-21 11:14:51 UTC (rev 2832)
+++ branches/datasets/config/schema.d/workflows.xml	2011-11-22 10:03:18 UTC (rev 2833)
@@ -54,34 +54,36 @@
   <table name="data_sets">
 
     <column type="integer"  name="user_id"/>
-    <column type="string"   name="contributable_type"/>
-    <column type="integer"  name="contributable_id"/>
+    <column type="integer"  name="workflow_id"/>
     <column type="datetime" name="created_at"/>
     <column type="datetime" name="updated_at"/>
     <column type="text"     name="title"/>
     <column type="text"     name="description"/>
     <column type="text"     name="description_html"/>
     <column type="text"     name="category"/>
+    <column type="integer"  name="workflow_version"/>
 
     <belongs-to target="users"/>
-    <belongs-to target="contributable" polymorphic="true"/>
+    <belongs-to target="workflow"/>
 
-    <has-many target="data_items" foreign_key="data_set_id" dependent="destroy"/>
-
   </table>
 
-  <table name="data_items">
-
+  <table name="text_data">
     <column type="integer"  name="data_set_id"/>
-    <column type="datetime" name="created_at"/>
-    <column type="datetime" name="updated_at"/>
-    <column type="text"     name="category"/>
-    <column type="text"     name="label"/>
     <column type="text"     name="data"/>
 
-    <belongs-to target="users"/>
-    <belongs-to target="data_sets"/>
+    <belongs-to target="data_set"/>
+  </table>
 
+  <table name="workflow_ports">
+
+    <column type="integer"    name="workflow_id"/>
+    <column type="integer"    name="workflow_version"/>
+    <column type="string"     name="name"/>
+    <column type="string"     name="port_type"/>
+
+    <belongs-to target="workflow"/>
+
   </table>
 
   <table name="workflow_processors">

Modified: branches/datasets/db/schema.rb (2832 => 2833)


--- branches/datasets/db/schema.rb	2011-11-21 11:14:51 UTC (rev 2832)
+++ branches/datasets/db/schema.rb	2011-11-22 10:03:18 UTC (rev 2833)
@@ -39,17 +39,17 @@
   end
 
   create_table "blobs", :force => true do |t|
+    t.column "contributor_id",   :integer
+    t.column "contributor_type", :string
     t.column "local_name",       :string
-    t.column "contributor_id",   :integer
-    t.column "body_html",        :text
     t.column "created_at",       :datetime
+    t.column "updated_at",       :datetime
+    t.column "title",            :string
     t.column "body",             :text
-    t.column "title",            :string
+    t.column "body_html",        :text
     t.column "content_blob_id",  :integer
-    t.column "updated_at",       :datetime
+    t.column "content_type_id",  :integer
     t.column "license_id",       :integer
-    t.column "content_type_id",  :integer
-    t.column "contributor_type", :string
   end
 
   create_table "blog_posts", :force => true do |t|
@@ -128,12 +128,12 @@
   end
 
   create_table "concepts", :force => true do |t|
-    t.column "vocabulary_id",    :integer
-    t.column "created_at",       :datetime
+    t.column "updated_at",       :datetime
     t.column "description_html", :text
-    t.column "updated_at",       :datetime
     t.column "phrase",           :string
     t.column "description",      :text
+    t.column "vocabulary_id",    :integer
+    t.column "created_at",       :datetime
   end
 
   create_table "content_blobs", :force => true do |t|
@@ -141,34 +141,34 @@
   end
 
   create_table "content_types", :force => true do |t|
+    t.column "user_id",          :integer
+    t.column "title",            :string
+    t.column "description",      :text
+    t.column "description_html", :text
+    t.column "mime_type",        :string
     t.column "created_at",       :datetime
+    t.column "updated_at",       :datetime
     t.column "category",         :string
-    t.column "description_html", :text
-    t.column "title",            :string
-    t.column "updated_at",       :datetime
-    t.column "mime_type",        :string
-    t.column "user_id",          :integer
-    t.column "description",      :text
   end
 
   create_table "contributions", :force => true do |t|
-    t.column "label",                :string
-    t.column "rating",               :float
+    t.column "contributor_id",       :integer
+    t.column "contributor_type",     :string
+    t.column "contributable_id",     :integer
     t.column "contributable_type",   :string
-    t.column "contributor_id",       :integer
-    t.column "layout",               :string
+    t.column "policy_id",            :integer
     t.column "created_at",           :datetime
-    t.column "policy_id",            :integer
     t.column "updated_at",           :datetime
-    t.column "license_id",           :integer
+    t.column "downloads_count",      :integer,  :default => 0
+    t.column "viewings_count",       :integer,  :default => 0
+    t.column "rating",               :float
     t.column "rank",                 :float
     t.column "content_type_id",      :integer
+    t.column "license_id",           :integer
     t.column "site_downloads_count", :integer,  :default => 0
-    t.column "viewings_count",       :integer,  :default => 0
-    t.column "contributor_type",     :string
-    t.column "downloads_count",      :integer,  :default => 0
     t.column "site_viewings_count",  :integer,  :default => 0
-    t.column "contributable_id",     :integer
+    t.column "label",                :string
+    t.column "layout",               :string
   end
 
   add_index "contributions", ["contributable_id", "contributable_type"], :name => "index_contributions_on_contributable_id_and_contributable_type"
@@ -194,34 +194,25 @@
     t.column "updated_at",   :datetime
   end
 
-  create_table "data_items", :force => true do |t|
-    t.column "label",       :text
-    t.column "data",        :text
-    t.column "category",    :text
-    t.column "created_at",  :datetime
-    t.column "data_set_id", :integer
-    t.column "updated_at",  :datetime
-  end
-
   create_table "data_sets", :force => true do |t|
-    t.column "contributable_type", :string
-    t.column "category",           :text
-    t.column "description_html",   :text
-    t.column "created_at",         :datetime
-    t.column "title",              :text
-    t.column "updated_at",         :datetime
-    t.column "user_id",            :integer
-    t.column "description",        :text
-    t.column "contributable_id",   :integer
+    t.column "category",         :text
+    t.column "description_html", :text
+    t.column "created_at",       :datetime
+    t.column "title",            :text
+    t.column "updated_at",       :datetime
+    t.column "version",          :integer
+    t.column "user_id",          :integer
+    t.column "workflow_id",      :integer
+    t.column "description",      :text
   end
 
   create_table "downloads", :force => true do |t|
-    t.column "kind",               :string
+    t.column "contribution_id",    :integer
+    t.column "user_id",            :integer
     t.column "created_at",         :datetime
+    t.column "user_agent",         :string
     t.column "accessed_from_site", :boolean,  :default => false
-    t.column "user_id",            :integer
-    t.column "user_agent",         :string
-    t.column "contribution_id",    :integer
+    t.column "kind",               :string
   end
 
   add_index "downloads", ["contribution_id"], :name => "index_downloads_on_contribution_id"
@@ -294,11 +285,11 @@
   end
 
   create_table "labels", :force => true do |t|
-    t.column "vocabulary_id", :integer
+    t.column "concept_id",    :integer
     t.column "language",      :string
     t.column "text",          :string
+    t.column "vocabulary_id", :integer
     t.column "label_type",    :string
-    t.column "concept_id",    :integer
   end
 
   create_table "license_attributes", :force => true do |t|
@@ -393,46 +384,46 @@
   add_index "oauth_tokens", ["token"], :name => "index_oauth_tokens_on_token", :unique => true
 
   create_table "ontologies", :force => true do |t|
-    t.column "created_at",       :datetime
-    t.column "description_html", :text
+    t.column "prefix",           :string
+    t.column "updated_at",       :datetime
     t.column "uri",              :string
-    t.column "prefix",           :string
     t.column "title",            :string
-    t.column "updated_at",       :datetime
+    t.column "description_html", :text
+    t.column "description",      :text
     t.column "user_id",          :integer
-    t.column "description",      :text
+    t.column "created_at",       :datetime
   end
 
   create_table "pack_contributable_entries", :force => true do |t|
+    t.column "pack_id",               :integer,  :null => false
+    t.column "contributable_id",      :integer,  :null => false
+    t.column "contributable_version", :integer
+    t.column "contributable_type",    :string
     t.column "comment",               :text
-    t.column "contributable_type",    :string
-    t.column "contributable_version", :integer
+    t.column "user_id",               :integer,  :null => false
     t.column "created_at",            :datetime
     t.column "updated_at",            :datetime
-    t.column "pack_id",               :integer,  :null => false
-    t.column "user_id",               :integer,  :null => false
-    t.column "contributable_id",      :integer,  :null => false
   end
 
   create_table "pack_remote_entries", :force => true do |t|
+    t.column "pack_id",       :integer,  :null => false
+    t.column "title",         :string
+    t.column "uri",           :string
+    t.column "alternate_uri", :string
     t.column "comment",       :text
+    t.column "user_id",       :integer,  :null => false
     t.column "created_at",    :datetime
-    t.column "uri",           :string
-    t.column "title",         :string
     t.column "updated_at",    :datetime
-    t.column "pack_id",       :integer,  :null => false
-    t.column "user_id",       :integer,  :null => false
-    t.column "alternate_uri", :string
   end
 
   create_table "packs", :force => true do |t|
     t.column "contributor_id",   :integer
+    t.column "contributor_type", :string
+    t.column "title",            :string
+    t.column "description",      :text
+    t.column "description_html", :text
     t.column "created_at",       :datetime
-    t.column "description_html", :text
-    t.column "title",            :string
     t.column "updated_at",       :datetime
-    t.column "description",      :text
-    t.column "contributor_type", :string
   end
 
   create_table "pending_invitations", :force => true do |t|
@@ -470,32 +461,32 @@
   end
 
   create_table "policies", :force => true do |t|
+    t.column "contributor_id",   :integer
+    t.column "contributor_type", :string
     t.column "name",             :string
-    t.column "contributor_id",   :integer
     t.column "created_at",       :datetime
     t.column "updated_at",       :datetime
+    t.column "share_mode",       :integer
     t.column "update_mode",      :integer
-    t.column "share_mode",       :integer
-    t.column "contributor_type", :string
+    t.column "public_download",  :boolean,  :default => false
     t.column "public_view",      :boolean,  :default => false
-    t.column "public_download",  :boolean,  :default => false
   end
 
   create_table "predicates", :force => true do |t|
-    t.column "created_at",       :datetime
+    t.column "updated_at",       :datetime
+    t.column "title",            :string
     t.column "description_html", :text
-    t.column "title",            :string
+    t.column "phrase",           :string
     t.column "ontology_id",      :integer
-    t.column "updated_at",       :datetime
-    t.column "phrase",           :string
+    t.column "description",      :text
     t.column "equivalent_to",    :text
-    t.column "description",      :text
+    t.column "created_at",       :datetime
   end
 
   create_table "previews", :force => true do |t|
-    t.column "created_at",    :datetime
     t.column "svg_blob_id",   :integer
     t.column "image_blob_id", :integer
+    t.column "created_at",    :datetime
   end
 
   create_table "profiles", :force => true do |t|
@@ -529,15 +520,15 @@
   add_index "ratings", ["user_id"], :name => "index_ratings_on_user_id"
 
   create_table "relationships", :force => true do |t|
-    t.column "context_id",   :integer
-    t.column "created_at",   :datetime
-    t.column "context_type", :string
     t.column "objekt_type",  :string
     t.column "objekt_id",    :integer
+    t.column "subject_type", :string
     t.column "subject_id",   :integer
+    t.column "user_id",      :integer
+    t.column "created_at",   :datetime
+    t.column "context_id",   :integer
     t.column "predicate_id", :integer
-    t.column "subject_type", :string
-    t.column "user_id",      :integer
+    t.column "context_type", :string
   end
 
   create_table "remote_workflows", :force => true do |t|
@@ -560,84 +551,84 @@
   add_index "reviews", ["user_id"], :name => "index_reviews_on_user_id"
 
   create_table "service_categories", :force => true do |t|
+    t.column "uri",          :string
+    t.column "updated_at",   :datetime
+    t.column "service_id",   :integer
     t.column "label",        :string
-    t.column "uri",          :string
     t.column "retrieved_at", :datetime
     t.column "created_at",   :datetime
-    t.column "updated_at",   :datetime
-    t.column "service_id",   :integer
   end
 
   create_table "service_deployments", :force => true do |t|
-    t.column "service_provider_id",  :integer
     t.column "iso3166_country_code", :string
     t.column "city",                 :string
     t.column "submitter_label",      :string
     t.column "uri",                  :string
-    t.column "retrieved_at",         :datetime
-    t.column "created_at",           :datetime
+    t.column "updated_at",           :datetime
     t.column "submitter_uri",        :string
     t.column "country",              :string
-    t.column "updated_at",           :datetime
     t.column "service_id",           :integer
+    t.column "created",              :datetime
+    t.column "service_provider_id",  :integer
     t.column "flag_url",             :string
-    t.column "created",              :datetime
     t.column "endpoint",             :string
+    t.column "retrieved_at",         :datetime
+    t.column "created_at",           :datetime
   end
 
   create_table "service_providers", :force => true do |t|
     t.column "name",         :string
     t.column "uri",          :string
-    t.column "retrieved_at", :datetime
-    t.column "created_at",   :datetime
     t.column "updated_at",   :datetime
     t.column "description",  :text
     t.column "created",      :datetime
+    t.column "retrieved_at", :datetime
+    t.column "created_at",   :datetime
   end
 
   create_table "service_tags", :force => true do |t|
+    t.column "uri",          :string
+    t.column "updated_at",   :datetime
+    t.column "service_id",   :integer
     t.column "label",        :string
-    t.column "uri",          :string
     t.column "retrieved_at", :datetime
     t.column "created_at",   :datetime
-    t.column "updated_at",   :datetime
-    t.column "service_id",   :integer
   end
 
   create_table "service_types", :force => true do |t|
+    t.column "updated_at",   :datetime
+    t.column "service_id",   :integer
     t.column "label",        :string
     t.column "retrieved_at", :datetime
     t.column "created_at",   :datetime
-    t.column "updated_at",   :datetime
-    t.column "service_id",   :integer
   end
 
   create_table "services", :force => true do |t|
+    t.column "documentation_uri",        :string
     t.column "iso3166_country_code",     :string
     t.column "city",                     :string
     t.column "name",                     :string
-    t.column "contributor_id",           :integer
+    t.column "provider_uri",             :string
     t.column "submitter_label",          :string
     t.column "uri",                      :string
-    t.column "retrieved_at",             :datetime
-    t.column "created_at",               :datetime
+    t.column "updated_at",               :datetime
     t.column "monitor_symbol_url",       :string
+    t.column "monitor_last_checked",     :datetime
+    t.column "monitor_label",            :string
     t.column "country",                  :string
     t.column "submitter_uri",            :string
-    t.column "updated_at",               :datetime
+    t.column "monitor_small_symbol_url", :string
     t.column "monitor_message",          :text
-    t.column "monitor_label",            :string
-    t.column "monitor_last_checked",     :datetime
-    t.column "monitor_small_symbol_url", :string
     t.column "description",              :text
-    t.column "flag_url",                 :string
     t.column "wsdl",                     :string
-    t.column "provider_label",           :string
+    t.column "created",                  :datetime
     t.column "contributor_type",         :string
-    t.column "documentation_uri",        :string
+    t.column "contributor_id",           :integer
+    t.column "flag_url",                 :string
     t.column "endpoint",                 :string
-    t.column "provider_uri",             :string
-    t.column "created",                  :datetime
+    t.column "provider_label",           :string
+    t.column "retrieved_at",             :datetime
+    t.column "created_at",               :datetime
   end
 
   create_table "sessions", :force => true do |t|
@@ -687,11 +678,16 @@
     t.column "updated_at",       :datetime
   end
 
+  create_table "text_data", :force => true do |t|
+    t.column "data",        :text
+    t.column "data_set_id", :integer
+  end
+
   create_table "topic_feedbacks", :force => true do |t|
+    t.column "score",     :integer
+    t.column "topic_id",  :integer
     t.column "submit_dt", :datetime
     t.column "user_id",   :integer
-    t.column "score",     :integer
-    t.column "topic_id",  :integer
   end
 
   create_table "topic_runs", :force => true do |t|
@@ -700,16 +696,16 @@
   end
 
   create_table "topic_tag_map", :force => true do |t|
+    t.column "topic_id",     :integer
     t.column "display_flag", :boolean
     t.column "tag_id",       :integer
-    t.column "topic_id",     :integer
     t.column "probability",  :float
   end
 
   create_table "topic_workflow_map", :force => true do |t|
+    t.column "topic_id",     :integer
     t.column "display_flag", :boolean
     t.column "workflow_id",  :integer
-    t.column "topic_id",     :integer
     t.column "probability",  :float
   end
 
@@ -720,12 +716,12 @@
   end
 
   create_table "user_reports", :force => true do |t|
+    t.column "subject_type", :string
+    t.column "content",      :text
+    t.column "subject_id",   :integer
+    t.column "user_id",      :integer
     t.column "report",       :text
     t.column "created_at",   :datetime
-    t.column "subject_id",   :integer
-    t.column "subject_type", :string
-    t.column "user_id",      :integer
-    t.column "content",      :text
   end
 
   create_table "users", :force => true do |t|
@@ -761,65 +757,72 @@
   add_index "viewings", ["contribution_id"], :name => "index_viewings_on_contribution_id"
 
   create_table "vocabularies", :force => true do |t|
+    t.column "user_id",          :integer
+    t.column "title",            :string
+    t.column "description",      :text
+    t.column "description_html", :text
     t.column "created_at",       :datetime
-    t.column "description_html", :text
+    t.column "updated_at",       :datetime
+    t.column "prefix",           :string
     t.column "uri",              :string
-    t.column "prefix",           :string
-    t.column "title",            :string
-    t.column "updated_at",       :datetime
-    t.column "user_id",          :integer
-    t.column "description",      :text
   end
 
+  create_table "workflow_ports", :force => true do |t|
+    t.column "name",        :string
+    t.column "port_type",   :string
+    t.column "version",     :integer
+    t.column "workflow_id", :integer
+  end
+
   create_table "workflow_processors", :force => true do |t|
     t.column "name",           :string
     t.column "wsdl_operation", :string
+    t.column "wsdl",           :string
     t.column "workflow_id",    :integer
-    t.column "wsdl",           :string
   end
 
   create_table "workflow_versions", :force => true do |t|
+    t.column "workflow_id",       :integer
+    t.column "version",           :integer
     t.column "contributor_id",    :integer
+    t.column "contributor_type",  :string
+    t.column "title",             :string
+    t.column "unique_name",       :string
+    t.column "body",              :text
+    t.column "body_html",         :text
+    t.column "created_at",        :datetime
+    t.column "updated_at",        :datetime
+    t.column "image",             :string
+    t.column "svg",               :string
     t.column "revision_comments", :text
-    t.column "created_at",        :datetime
-    t.column "body_html",         :text
-    t.column "body",              :text
-    t.column "title",             :string
     t.column "content_blob_id",   :integer
-    t.column "license",           :string
-    t.column "updated_at",        :datetime
+    t.column "file_ext",          :string
     t.column "last_edited_by",    :string
-    t.column "svg",               :string
-    t.column "unique_name",       :string
     t.column "content_type_id",   :integer
-    t.column "version",           :integer
-    t.column "workflow_id",       :integer
-    t.column "contributor_type",  :string
+    t.column "license",           :string
     t.column "preview_id",        :integer
-    t.column "image",             :string
-    t.column "file_ext",          :string
   end
 
   add_index "workflow_versions", ["workflow_id"], :name => "index_workflow_versions_on_workflow_id"
 
   create_table "workflows", :force => true do |t|
     t.column "contributor_id",   :integer
+    t.column "contributor_type", :string
+    t.column "image",            :string
+    t.column "svg",              :string
+    t.column "title",            :string
+    t.column "unique_name",      :string
+    t.column "body",             :text
+    t.column "body_html",        :text
     t.column "created_at",       :datetime
-    t.column "body_html",        :text
-    t.column "body",             :text
-    t.column "title",            :string
+    t.column "updated_at",       :datetime
+    t.column "current_version",  :integer
     t.column "content_blob_id",  :integer
-    t.column "updated_at",       :datetime
+    t.column "file_ext",         :string
     t.column "last_edited_by",   :string
-    t.column "svg",              :string
+    t.column "content_type_id",  :integer
     t.column "license_id",       :integer
-    t.column "unique_name",      :string
-    t.column "content_type_id",  :integer
-    t.column "current_version",  :integer
-    t.column "contributor_type", :string
     t.column "preview_id",       :integer
-    t.column "image",            :string
-    t.column "file_ext",         :string
   end
 
 end

Modified: branches/datasets/public/stylesheets/styles.css (2832 => 2833)


--- branches/datasets/public/stylesheets/styles.css	2011-11-21 11:14:51 UTC (rev 2832)
+++ branches/datasets/public/stylesheets/styles.css	2011-11-22 10:03:18 UTC (rev 2833)
@@ -2409,4 +2409,147 @@
   font-weight: bold;
   margin-bottom: 1.5em;
   line-height: 1.4;
-}
\ No newline at end of file
+}
+
+.data_set table {
+  width: 100%;
+}
+
+.data_set td {
+  padding: 0.5em;
+  -moz-border-radius: 5px;
+  text-align: left;
+  vertical-align: top;
+}
+
+.data_set td.arrow {
+  width: 16px;
+  vertical-align: middle;
+}
+
+.data_set td.port {
+  width: 14em;
+  border-width: 1px;
+  border-style: solid;
+}
+
+.data_set td.data {
+  border: 1px solid #CCC;
+  background-color: #EEE;
+  width: 32em;
+}
+
+.data_set td.controls {
+  vertical-align: middle;
+  width: 4em;
+  text-align: center;
+}
+
+.data_set .input {
+  border-color: #FBB;
+  background-color: #FDD;
+}
+
+.data_set .output {
+  border-color: #9F9;
+  background-color: #CFC;
+}
+
+.data_set h5 {
+  font-weight: bold;
+  margin-bottom: 0.5em;
+  vertical-align: middle;
+}
+
+.data_set img {
+  vertical-align: middle;
+}
+
+.data_set td div.data {
+  text-align: center;
+  vertical-align: middle;
+}
+
+#data_set_container {
+
+}
+
+#data_set_selector {
+  background-color: #EEF6FF;
+  border: 1px solid #BBB;
+  line-height: 1;
+  padding: 0.5em;
+}
+
+a.data_type {
+  display: inline-block;
+  border: 1px solid #ccc;
+  background-color: #eee;
+  padding: 4px;
+  margin-right: 0.5em;
+}
+
+a.data_type:hover {
+  background-color: #afa;
+}
+
+div.data_type {
+  color: #555;
+  font-weight: normal;
+  font-size: 100%;
+  display: inline;
+  margin-left: 1em;
+}
+
+div.data_type input {
+  vertical-align: middle;
+}
+
+div.data_type div * {
+  vertical-align: middle;
+}
+
+div.data_form {
+  margin-top: 1em;
+}
+
+.data_set input[type=text].readonly, .data_set textarea.readonly {
+  background-color: #FFF;
+  border: 1px dashed #CCC;
+  padding: 3px;
+}
+
+.data_set .input input[type=text].readonly, .data_set .input textarea.readonly {
+  background-color: #FEE;
+  border-color: #FBB;
+}
+
+.data_set .output input[type=text].readonly, .data_set .output textarea.readonly {
+  background-color: #EFE;
+  border-color: #9F9;
+}
+
+
+table.data_set_list {
+  width: 100%;
+}
+
+table.data_set_list th {
+  text-align: left;
+}
+
+table.data_set_list .old_version {
+  color: #999;
+}
+
+table.data_set_list a {
+  display: block;
+}
+
+.data_set td.data .file_data {
+  padding: 0.5em;
+  background-color: #fff;
+  border: 1px solid #ccc;
+  overflow: auto;
+  line-height: 1.1;
+}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]