Diff
Modified: branches/wf4ever/Gemfile (3209 => 3210)
--- branches/wf4ever/Gemfile 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/Gemfile 2012-11-27 12:55:19 UTC (rev 3210)
@@ -6,18 +6,19 @@
gem "mongrel_cluster", "~> 1.0.5"
gem "rubyzip", "~> 0.9.4"
gem "oauth", "~> 0.4.3"
-gem "libxml-ruby", "~> 1.1.4"
-gem "rmagick", "~> 2.13.1"
+gem "libxml-ruby", "2.2.2"
+gem "rmagick", "2.13.1"
gem "dsl_accessor", "~> 0.4.0"
gem "ruby-openid", "~> 2.1.8"
-gem "openurl", "~> 0.1.0"
+gem "openurl", "~> 0.2.0"
gem "curb", "~> 0.7.8"
-gem "marc", "~> 0.4.1"
+gem "marc", "~> 0.4.3"
gem "ruby-hmac", "~> 0.4.0"
gem "passenger", "~> 2.2.15"
gem "htmlentities", "~> 4.3.1"
gem "taverna-scufl", "~> 0.7.2"
gem "taverna-t2flow", "~> 0.3.0"
+gem "workflow-to-galaxy", "~> 0.3.4"
gem "rdf", "~> 0.3.4.1"
gem "rdf-raptor", "~> 0.4.1"
gem "wf4ever-transformation-client", "~> 0.3.0"
Modified: branches/wf4ever/app/controllers/application_controller.rb (3209 => 3210)
--- branches/wf4ever/app/controllers/application_controller.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/controllers/application_controller.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -685,7 +685,7 @@
objects = collection.find(
:all,
:select => "#{filter_id_column} AS filter_id, #{filter_label_column} AS filter_label, #{count_expr} AS filter_count",
- :joins => merge_joins(joins, pivot_options, :auth_type => opts[:auth_type], :auth_id => opts[:auth_id]),
+ :joins => merge_joins(joins, pivot_options, collection.permission_conditions, :auth_type => opts[:auth_type], :auth_id => opts[:auth_id]),
:conditions => conditions,
:group => "#{filter_id_column}",
:limit => limit,
@@ -797,14 +797,17 @@
end
end
- def merge_joins(joins, pivot_options, opts = {})
+ def merge_joins(joins, pivot_options, permission_conditions, opts = {})
if joins.length.zero?
nil
else
joins.uniq.map do |j|
text = pivot_options["joins"][j].clone
- text.gsub!(/RESULT_TYPE/, opts[:auth_type])
- text.gsub!(/RESULT_ID/, opts[:auth_id])
+ text.gsub!(/RESULT_TYPE/, opts[:auth_type])
+ text.gsub!(/RESULT_ID/, opts[:auth_id])
+ text.gsub!(/VIEW_CONDITIONS/, permission_conditions[:view_conditions])
+ text.gsub!(/DOWNLOAD_CONDITIONS/, permission_conditions[:download_conditions])
+ text.gsub!(/EDIT_CONDITIONS/, permission_conditions[:edit_conditions])
text
end.join(" ")
end
@@ -904,7 +907,7 @@
results = collection.find(
:all,
:page => { :size => params["num"] ? params["num"].to_i : nil, :current => params["page"] },
- :joins => merge_joins(joins, pivot_options, :auth_type => auth_type, :auth_id => auth_id),
+ :joins => merge_joins(joins, pivot_options, collection.permission_conditions, :auth_type => auth_type, :auth_id => auth_id),
:conditions => conditions.length.zero? ? nil : conditions.join(" AND "),
:group => "#{group_by} #{having_clause}",
:order => order_options["order"])
Modified: branches/wf4ever/app/controllers/messages_controller.rb (3209 => 3210)
--- branches/wf4ever/app/controllers/messages_controller.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/controllers/messages_controller.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -108,7 +108,7 @@
@message = Message.new(:to => @reply.from,
:reply_id => @reply.id,
:subject => subject,
- :body => @reply.body.split(/\n/).collect {|line| ">> #{line}"}.join) # there has to be a 'ruby-er' way of doing this?
+ :body => ActionController::Base.helpers.strip_tags(@reply.body.gsub(/^/, ">> ")))
else
@message = Message.new
end
Modified: branches/wf4ever/app/controllers/networks_controller.rb (3209 => 3210)
--- branches/wf4ever/app/controllers/networks_controller.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/controllers/networks_controller.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -4,10 +4,13 @@
# See license.txt for details.
class NetworksController < ApplicationController
- before_filter :login_required, :except => [:index, :show, :search, :all]
+
+ include ApplicationHelper
+
+ before_filter :login_required, :except => [:index, :show, :content, :search, :all]
before_filter :find_networks, : [:all]
- before_filter :find_network, : [:membership_request, :show, :tag]
+ before_filter :find_network, : [:membership_request, :show, :tag, :content]
before_filter :find_network_auth_admin, : [:invite, :membership_invite, :membership_invite_external]
before_filter :find_network_auth_owner, : [:edit, :update, :destroy]
@@ -362,6 +365,31 @@
end
end
+ # GET /networks/1/content
+ def content
+ respond_to do |format|
+ format.html do
+
+ @pivot, problem = calculate_pivot(
+
+ :pivot_options => Conf.pivot_options,
+ :params => params,
+ :user => current_user,
+ :search_models => [Workflow, Blob, Pack, Service],
+ :search_limit => Conf.max_search_size,
+
+ :locked_filters => { 'GROUP_ID' => @network.id.to_s },
+
+ :active_filters => ["CATEGORY", "TYPE_ID", "TAG_ID", "USER_ID",
+ "LICENSE_ID", "GROUP_ID", "WSDL_ENDPOINT",
+ "CURATION_EVENT", "SERVICE_PROVIDER",
+ "SERVICE_COUNTRY", "SERVICE_STATUS"])
+
+ flash.now[:error] = problem if problem
+ end
+ end
+ end
+
# GET /networks/new
def new
@network = Network.new(:user_id => current_user.id)
Modified: branches/wf4ever/app/controllers/workflows_controller.rb (3209 => 3210)
--- branches/wf4ever/app/controllers/workflows_controller.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/controllers/workflows_controller.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -558,24 +558,35 @@
# PUT /workflows/1;update_version
def update_version
+ original_title = @workflow.title
+
success = false
- if params[:version]
+ if params[:version] && params[:workflow]
- original_title = @workflow.title
- version = @workflow.find_version(params[:version])
- do_preview = !params[:workflow][:preview].blank? && params[:workflow][:preview].size > 0
+ version = @workflow.find_version(params[:version])
- attributes_to_update = {
- :title => params[:workflow][:title],
- :body => params[:workflow][:body],
- :last_edited_by => current_user.id
- }
+ attributes_to_update = { :last_edited_by => current_user.id }
- # only set the preview to update if one was provided
+ # only update title if the title isn't provided from the workflow processor
- attributes_to_update[:image] = params[:workflow][:preview] if do_preview
+ unless version.can_infer_title?
+ attributes_to_update[:title] = params[:workflow][:title] if params[:workflow][:title]
+ end
+ # only update description if the description isn't provided by the workflow processor
+
+ unless version.can_infer_description?
+ attributes_to_update[:body] = params[:workflow][:body] if params[:workflow][:body]
+ end
+
+ # only set the preview to update if one was provided and it can't be
+ # generated from the workflow processer
+
+ if !version.can_generate_preview_image? && !params[:workflow][:preview].blank? && params[:workflow][:preview].size > 0
+ attributes_to_update[:image] = params[:workflow][:preview]
+ end
+
success = version.update_attributes(attributes_to_update)
end
Modified: branches/wf4ever/app/helpers/application_helper.rb (3209 => 3210)
--- branches/wf4ever/app/helpers/application_helper.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/helpers/application_helper.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -777,6 +777,10 @@
return "biocat_icon.png"
when "usercheck"
return "famfamfam_silk/flag_red.png"
+ when "transfer_ownership"
+ return "famfamfam_silk/key_go.png"
+ when "content"
+ return "famfamfam_silk/application_side_list.png"
else
return Conf.label_icons[method.to_s] if Conf.label_icons[method.to_s]
end
Copied: branches/wf4ever/app/models/deprecation_event.rb (from rev 3208, trunk/app/models/deprecation_event.rb) (0 => 3210)
--- branches/wf4ever/app/models/deprecation_event.rb (rev 0)
+++ branches/wf4ever/app/models/deprecation_event.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -0,0 +1,10 @@
+class DeprecationEvent < ActiveRecord::Base
+
+ has_many :wsdl_deprecations
+ validates_presence_of :date
+
+ def affected_workflows
+ WorkflowProcessor.find_all_by_wsdl(wsdl_deprecations.map {|wd| wd.wsdl}, :include => :workflow).map {|wp| wp.workflow}.uniq.compact
+ end
+
+end
Modified: branches/wf4ever/app/models/network.rb (3209 => 3210)
--- branches/wf4ever/app/models/network.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/models/network.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -24,7 +24,7 @@
:include => [ :comments ]) if Conf.solr_enable
format_attribute :description
-
+
def self.recently_created(limit=5)
self.find(:all, :order => "created_at DESC", :limit => limit)
end
@@ -166,21 +166,15 @@
# Finds all the contributions that have been explicitly shared via Permissions
def shared_contributions
- list = []
- self.permissions.each do |p|
- p.policy.contributions.each do |c|
- list << c unless c.nil? || c.contributable.nil?
- end
- end
- list
+ Contribution.find(:all,
+ :select => "contributions.*",
+ :joins => "JOIN policies p on (contributions.policy_id = p.id) JOIN permissions e on (p.id = e.policy_id)",
+ :conditions => [ "e.contributor_id=? AND e.contributor_type = 'Network'", id ])
end
# Finds all the contributables that have been explicitly shared via Permissions
def shared_contributables
- c = shared_contributions.map do |c| c.contributable end
-
- # filter out blogs until they've gone completely
- c.select do |x| x.class != Blog end
+ shared_contributions.map {|c| c.contributable }
end
# New member policy
@@ -227,4 +221,19 @@
def layout
Conf.layouts[layout_name]
end
+
+ after_save :update_administrators
+
+ private
+
+ # If owner changes, make old owner into an adminstrator, and delete the new owner's membership status
+ # (as group owners do not have a membership)
+ def update_administrators
+ if user_id_changed?
+ Membership.find_by_user_id_and_network_id(user_id, id).try(:destroy) # delete membership of new owner
+ Membership.create(:user_id => user_id_was, :network_id => id,
+ :administrator => true, :invited_by => User.find(user_id)).accept! # create membership for old owner
+ end
+ end
+
end
Modified: branches/wf4ever/app/models/research_object.rb (3209 => 3210)
--- branches/wf4ever/app/models/research_object.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/models/research_object.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -11,6 +11,7 @@
require 'zip/zip'
require 'rdf'
require 'rdf/raptor'
+require 'wf4ever/rosrs_client'
class ResearchObject < ActiveRecord::Base
@@ -26,6 +27,8 @@
format_attribute :description
+ attr_accessor :manifest
+
def load_graph_from_zip
begin
@@ -75,7 +78,7 @@
# create RDF graph
- manifest_name = "tmp/graph.#{Process.pid}"
+ manifest_name = "tmp/graph.#{Process.pid}.rdf"
File.open(manifest_name, "w") do |f|
f.write(content_blob.data)
@@ -90,9 +93,10 @@
graph.query([nil, nil, nil]).each do |s, p, o|
statements.create(
- :subject_text => s.to_s,
+ :subject_text => s.to_s,
:predicate_text => p.to_s,
- :objekt_text => o.to_s)
+ :objekt_text => o.to_s,
+ :context_uri => url)
end
graph
@@ -199,5 +203,89 @@
results
end
+ def create_annotation_body(resource_uri, body, namespaces)
+
+ namespaces["rdf"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+
+ doc = LibXML::XML::Document.new
+ doc.root = LibXML::XML::Node.new("rdf:RDF")
+ doc.root["xml:base"] = url
+
+ namespaces.each do |name, uri|
+ doc.root["xmlns:#{name}"] = uri
+ end
+
+ description = LibXML::XML::Node.new("rdf:Description")
+ description["rdf:about"] = resource_uri
+ description << body
+ doc.root << description
+
+ doc
+ end
+
+ def set_simple_annotation(resource_uri, predicate, namespaces, term, new_value)
+
+ session = ROSRS::Session.new(url, Conf.rodl_bearer_token)
+
+ # Remove existing annotations of the same structure
+
+ annotations = session.get_annotation_graphs(url, resource_uri)
+
+ annotations.each do |annotation|
+
+ next unless annotation[:body].count == 1
+ next unless annotation[:body].query(:predicate => predicate).count == 1
+
+ c, r, h, d = session.do_request("DELETE", annotation[:stub], {} )
+ c, r, h, d = session.do_request("DELETE", annotation[:body_uri], {} )
+ end
+
+ # Create the new annotation
+
+ annotation_body = create_annotation_body(resource_uri,
+ LibXML::XML::Node.new(term, new_value),
+ namespaces)
+
+ agraph = RDFGraph.new(:data ="" annotation_body.to_s, :format => :xml)
+
+ code, reason, stub_uri, body_uri = session.create_internal_annotation(url, resource_uri, agraph)
+ end
+
+ def set_dc_title(resource_uri, value)
+ set_simple_annotation(resource_uri,
+ RDF::DC.title,
+ { "dct" => "http://purl.org/dc/terms/" },
+ "dct:title",
+ value)
+ end
+
+ def set_dc_description(resource_uri, value)
+ set_simple_annotation(resource_uri,
+ RDF::DC.description,
+ { "dct" => "http://purl.org/dc/terms/" },
+ "dct:description",
+ value)
+ end
+
+ def manifest
+
+ return @manifest if @manifest
+
+ session = ROSRS::Session.new(url, Conf.rodl_bearer_token)
+
+ manifest_uri, manifest = session.get_manifest(url)
+
+ @manifest = manifest
+ end
+
+ def resolve_resource_uri(resource_uri)
+ RDF::URI.parse(url).join(RDF::URI.parse(resource_uri))
+ end
+
+ def aggregated_resources
+ manifest.query([nil, RDF.type, RDF::RO.Resource]).map do |statement|
+ statement.subject
+ end
+ end
end
Modified: branches/wf4ever/app/models/workflow.rb (3209 => 3210)
--- branches/wf4ever/app/models/workflow.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/models/workflow.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -28,6 +28,8 @@
belongs_to :content_type
belongs_to :license
+ has_many :workflow_processors, :dependent => :destroy
+
before_validation :check_unique_name
before_validation :apply_extracted_metadata
@@ -163,6 +165,30 @@
return proc_class.can_infer_metadata?
end
+ def can_infer_title?
+ if processor_class
+ processor_class.can_infer_title?
+ else
+ false
+ end
+ end
+
+ def can_infer_description?
+ if processor_class
+ processor_class.can_infer_description?
+ else
+ false
+ end
+ end
+
+ def can_generate_preview_image?
+ if processor_class
+ processor_class.can_generate_preview_image?
+ else
+ false
+ end
+ end
+
def type_display_name
content_type.title
end
@@ -309,7 +335,7 @@
end
def unique_wsdls
- WorkflowProcessor.find(:all, :conditions => ['workflow_id = ? AND wsdl IS NOT NULL', 16]).map do |wp| wp.wsdl end.uniq
+ WorkflowProcessor.find(:all, :conditions => ['workflow_id = ? AND wsdl IS NOT NULL', id]).map do |wp| wp.wsdl end.uniq
end
def workflows_with_similar_services
@@ -343,6 +369,11 @@
APIStatistics.statistics(self)
end
+ # Returns a hash map of lists of wsdls grouped by their related deprecation event
+ def deprecations
+ WsdlDeprecation.find_all_by_wsdl(workflow_processors.map {|wp| wp.wsdl}).group_by {|wd| wd.deprecation_event}
+ end
+
def create_annotation_body(resource_uri, body, namespaces)
namespaces["rdf"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
Modified: branches/wf4ever/app/models/workflow_version.rb (3209 => 3210)
--- branches/wf4ever/app/models/workflow_version.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/models/workflow_version.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -33,7 +33,7 @@
def processor_class
if self.content_type
- @processor_class ||= WorkflowTypesHandler.processor_class_for_type_display_name(self.content_type.title)
+ @processor_class ||= WorkflowTypesHandler.processor_class_for_type_display_name(self.content_type.title)
end
end
@@ -42,5 +42,28 @@
@display_data_format = (klass.nil? ? self.file_ext : klass.display_data_format)
end
+ def can_infer_title?
+ if processor_class
+ processor_class.can_infer_title?
+ else
+ false
+ end
+ end
+
+ def can_infer_description?
+ if processor_class
+ processor_class.can_infer_description?
+ else
+ false
+ end
+ end
+
+ def can_generate_preview_image?
+ if processor_class
+ processor_class.can_generate_preview_image?
+ else
+ false
+ end
+ end
end
Copied: branches/wf4ever/app/models/wsdl_deprecation.rb (from rev 3208, trunk/app/models/wsdl_deprecation.rb) (0 => 3210)
--- branches/wf4ever/app/models/wsdl_deprecation.rb (rev 0)
+++ branches/wf4ever/app/models/wsdl_deprecation.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -0,0 +1,10 @@
+class WsdlDeprecation < ActiveRecord::Base
+
+ validates_uniqueness_of :wsdl, :scope => :deprecation_event_id
+ belongs_to :deprecation_event
+
+ def affected_workflows
+ WorkflowProcessor.find_all_by_wsdl(wsdl, :include => :workflow).map {|wp| wp.workflow}.uniq.compact
+ end
+
+end
Modified: branches/wf4ever/app/views/memberships/_table.rhtml (3209 => 3210)
--- branches/wf4ever/app/views/memberships/_table.rhtml 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/views/memberships/_table.rhtml 2012-11-27 12:55:19 UTC (rev 3210)
@@ -39,11 +39,15 @@
<% end %>
<% if membership.accepted? %>
<% if membership.network.administrator?(membership.user_id) %>
- <%= icon "remove_group_admin", user_membership_path(membership.user_id, membership)+'?membership[administrator]=0', nil, {:method => :put}, "Remove group admin status" %>
- <% else %>
- <%= icon "make_group_admin", user_membership_path(membership.user_id, membership)+'?membership[administrator]=1', nil, {:method => :put}, "Add
-group admin status" %>
- <% end %>
+ <%= icon "remove_group_admin", user_membership_path(membership.user_id, membership)+'?membership[administrator]=0', nil, {:method => :put}, "Remove group admin status" %>
+ <% if membership.network.owner == current_user %>
+ <%= icon "transfer_ownership", network_path(membership.network, :network => {:user_id => membership.user_id}),
+ nil, {:method => :put, :confirm => "Are you sure you wish to transfer ownership of this group? You will not be able to undo this action."},
+ "Transfer ownership" %>
+ <% end %>
+ <% else %>
+ <%= icon "make_group_admin", user_membership_path(membership.user_id, membership)+'?membership[administrator]=1', nil, {:method => :put}, "Add group admin status" %>
+ <% end %>
<% end %>
</td>
</tr>
Modified: branches/wf4ever/app/views/networks/_breadcrumbs.rhtml (3209 => 3210)
--- branches/wf4ever/app/views/networks/_breadcrumbs.rhtml 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/views/networks/_breadcrumbs.rhtml 2012-11-27 12:55:19 UTC (rev 3210)
@@ -1,8 +1,11 @@
<li><%= link_to 'Groups', networks_path -%></li>
-<% if ["show", "new", "edit", "search", "all", "invite"].include? controller.action_name.to_s -%>
+<% if ["show", "content", "new", "edit", "search", "all", "invite"].include? controller.action_name.to_s -%>
<% case controller.action_name.to_s; when "show" %>
<li><%= h(@network.title) -%></li>
+ <% when "content" %>
+ <li><%= link_to "#{h(@network.title)}", network_path(@network) %></li>
+ <li>Content</li>
<% when "new" %>
<li>New Group</li>
<% when "edit" %>
Modified: branches/wf4ever/app/views/networks/_members.rhtml (3209 => 3210)
--- branches/wf4ever/app/views/networks/_members.rhtml 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/views/networks/_members.rhtml 2012-11-27 12:55:19 UTC (rev 3210)
@@ -1,16 +1,17 @@
<% size ||= 100 -%>
+<% limit ||= nil %>
<% unless collection.empty? %>
+ <% orig_collection = collection %>
+ <% collection = collection[0...limit] if limit %>
+ <div id="hlist">
+ <ul id="members">
+ <% collection.each do |member| %>
+ <%= render :partial => "networks/member", :locals => { :member => member, :size => size } %>
+ <% end %>
+ </ul>
+ <%= "+ #{orig_collection.size - limit} others" if limit && orig_collection.size > limit %>
+ </div>
-<div id="hlist">
- <ul id="members">
- <% unless collection.empty? %>
- <% for member in collection %>
- <%= render :partial => "networks/member", :locals => { :member => member, :size => size } %>
- <% end %>
- <% end %>
- </ul>
-</div>
+ <div class="clearer"> </div>
-<div class="clearer"> </div>
-
<% end %>
\ No newline at end of file
Modified: branches/wf4ever/app/views/networks/_table.rhtml (3209 => 3210)
--- branches/wf4ever/app/views/networks/_table.rhtml 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/views/networks/_table.rhtml 2012-11-27 12:55:19 UTC (rev 3210)
@@ -46,7 +46,7 @@
<% unless network.members.empty? -%>
<div class="desc" style="margin-top: 0.4em;">
<p style="font-size: 85%;"><b>Members (<%= network.members.length %>):</b></p>
- <div style="font-size: 77%;"><%= render :partial => "networks/members", :locals => { :collection => network.members(true), :size => 40 } %></div>
+ <div style="font-size: 77%;"><%= render :partial => "networks/members", :locals => { :collection => network.members(true), :size => 40, :limit => 6 } %></div>
</div>
<% end -%>
Copied: branches/wf4ever/app/views/networks/content.rhtml (from rev 3208, trunk/app/views/networks/content.rhtml) (0 => 3210)
--- branches/wf4ever/app/views/networks/content.rhtml (rev 0)
+++ branches/wf4ever/app/views/networks/content.rhtml 2012-11-27 12:55:19 UTC (rev 3210)
@@ -0,0 +1,4 @@
+<h1>Content from the <%=h @network.title -%> group</h1>
+
+<%= render :partial => "content/index" -%>
+
Modified: branches/wf4ever/app/views/networks/show.rhtml (3209 => 3210)
--- branches/wf4ever/app/views/networks/show.rhtml 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/views/networks/show.rhtml 2012-11-27 12:55:19 UTC (rev 3210)
@@ -1,6 +1,7 @@
<% t "#{h @network.title}" -%>
-<% if logged_in? %>
+<ul class="sectionIcons">
+ <% if logged_in? %>
<% if current_user.membership_request_pending?(@network.id) %>
<div class="box_standout">
<span style="text-align: left;"><b>You have already sent a membership request to join this group. Awaiting admin confirmation.</b></span>
@@ -11,7 +12,6 @@
</div>
<% end %>
- <ul class="sectionIcons">
<% unless mine? @network %>
<% if @network.member? current_user.id %>
<% cur_membership = Membership.find(:first, :conditions => ["network_id = ? AND user_id = ?", @network.id, current_user.id] ) %>
@@ -31,8 +31,9 @@
<li><%= icon('edit', edit_network_path(@network), 'Edit', nil, 'Edit Group') %></li>
<li><%= icon('destroy', network_path(@network), 'Delete Group', { :confirm => 'Are you sure?', :method => :delete }, 'Delete Group') %></li>
<% end %>
- </ul>
-<% end %>
+ <% end %>
+ <li><%= icon('content', content_network_path(@network), 'View Group Content', nil, 'View Group Content') %></li>
+</ul>
<h1>
Group: <%=h @network.title %>
@@ -44,7 +45,7 @@
|
<a href=""
|
- <a href="" Items (<%= @shared_items.length -%>)</a>
+ <%= link_to("Shared Items", content_network_path(@network)) -%>
|
<a href="" (<%= @network.creditations.length -%>)</a>
|
@@ -68,130 +69,103 @@
|
</div>
-<div class="contribution_left_box">
-
- <div class="box_simple" style="margin: 0 0 0.4em 0;">
- <% unless @network.description.nil? or @network.description.empty? %>
- <%= @network.description_html %>
- <% else %>
- <p><i>No description</i></p>
- <% end %>
- </div>
-
- <p>
- <b>Created at:</b>
- <%=datetime @network.created_at %>
- </p>
-
- <% unless @network.unique_name.nil? or @network.unique_name.empty? %>
- <p>
- <b>Unique name:</b>
- <%=h @network.unique_name %>
- </p>
- <% end %>
-
- <% if mine? @network %>
- <br/>
- <div class="box_currentuser_specific">
- <% if @network.open? %>
- You have set this Group to automatically accept all membership requests.
- <% elsif @network.membership_by_request? %>
- You have set this Group to require membership requests to be approved by a group administrator.
- <% else %>
- You have set this Group to be closed to membership requests unless invited by a group administrator.
- <% end %>
- </div>
- <% end %>
-
- <br/>
-
- <div class="contribution_section_box">
-<% address@hidden(true) -%>
-<% address@hidden() - admins -%>
- <p class="heading">
- Administrators
- <a name="group_members"></a>
- </p>
- <div>
- <%= render :partial => "networks/members", :locals => { :collection => admins, :size => 60 } %>
- </div>
- <p class="heading">
- Members
- </p>
- <div>
- <%= render :partial => "networks/members", :locals => { :collection => others, :size => 60 } %>
- </div>
- </div>
-
-</div>
+<div id="tabsContainer" class="tabsContainer"></div>
-<div class="contribution_right_box">
- <%= render :partial => "owner_box", :locals => { :network => @network } %>
- <%= render :partial => "statistics_box", :locals => { :network => @network, :items => @shared_items } %>
-
- <div class="contribution_section_box"> <!-- style="width: 130px; padding: 0.4em 0.8em; font-size: 93%;" -->
- <p>
- <b>
- This group has been credited
- <a href="" pluralize(@network.creditations.length, "time") -%></a>
- <a name="group_creditations"></a>
- </b>
- </p>
- </div>
-
- <%= render :partial => "tags/tags_box", :locals => { :taggable => @network,
- :owner_id => (@network.user_id),
- :add_path => tag_network_path(@network),
- :edit_path => edit_network_path(@network),
- :allow_edit => logged_in? ? @network.user_id == current_user.id : false } %>
-
- <%= render :partial => "announcements", :locals => { :group => @network, :count => 5 } -%>
-</div>
+<div class="tabContainer">
+ <div class="tabTitle">Overview</div>
+ <div class="tabContent">
+ <div class="contribution_left_box">
+ <div class="box_simple" style="margin: 0 0 0.4em 0;">
+ <% unless @network.description.nil? or @network.description.empty? %>
+ <%= @network.description_html %>
+ <% else %>
+ <p><i>No description</i></p>
+ <% end %>
+ </div>
-<div class="clearer"> </div>
+ <p>
+ <b>Created at:</b>
+ <%=datetime @network.created_at %>
+ </p>
-<br/>
+ <% unless @network.unique_name.nil? or @network.unique_name.empty? %>
+ <p>
+ <b>Unique name:</b>
+ <%=h @network.unique_name %>
+ </p>
+ <% end %>
-<div id="tabsContainer" class="tabsContainer"></div>
+ <a name="news"></a>
+ <h3>News</h3>
+ <%= render :partial => "layouts/news", :locals => { :collection => news(@network, true) } %>
-<div class="tabContainer">
- <div class="tabTitle">News</div>
- <div class="tabContent">
- <a name="news"></a>
- <%= render :partial => "layouts/news", :locals => { :collection => news(@network, true) } %>
- </div>
-</div>
+ </div>
-<div class="tabContainer">
- <div class="tabTitle">Shared Items (<%= @shared_items.length -%>)</div>
- <div class="tabContent" id="shared_items">
- <a name="shared_items"></a>
- <% unless @shared_items.empty? %>
- <%= view_privileges_notice %>
+ <div class="contribution_right_box">
+ <%= render :partial => "owner_box", :locals => { :network => @network } %>
+ <%= render :partial => "statistics_box", :locals => { :network => @network, :items => @shared_items } %>
- <div style="float: right; margin: 0.5em;">
- Sort:
- <select = this.options[this.selectedIndex].value;">
- <% @item_sort_options.each do |option, label| %>
- <option value="?item_sort=<%= option -%>#shared_items" <% if params[:item_sort] == option -%> selected="selected"<% end -%>><%= label -%></option>
- <% end %>
- </select>
+ <div class="contribution_section_box"> <!-- style="width: 130px; padding: 0.4em 0.8em; font-size: 93%;" -->
+ <p>
+ <b>
+ This group has been credited
+ <a href="" pluralize(@network.creditations.length, "time") -%></a>
+ <a name="group_creditations"></a>
+ </b>
+ </p>
</div>
- <%= render :partial => "contributions/table", :locals => { :collection => @shared_items } %>
+ <%= render :partial => "tags/tags_box", :locals => { :taggable => @network,
+ :owner_id => (@network.user_id),
+ :add_path => tag_network_path(@network),
+ :edit_path => edit_network_path(@network),
+ :allow_edit => logged_in? ? @network.user_id == current_user.id : false } %>
- <div style="clear: both"></div>
+ <%= render :partial => "announcements", :locals => { :group => @network, :count => 5 } -%>
+ </div>
+ <div class="clearer"> </div>
+ </div>
+</div>
- <% else %>
- <p class="none_text">No items have been shared with this Group yet.</p>
- <% end %>
- </div>
+<div class="tabContainer">
+ <div class="tabTitle">Members (<%= @network.members.size -%>)</div>
+ <div class="tabContent">
+ <a name="members"></a>
+ <div class="contribution_section_box">
+ <a name="group_members"></a>
+ <% owner = @network.owner -%>
+ <p class="heading">
+ Owner
+ </p>
+ <div>
+ <%= render :partial => "networks/members", :locals => { :collection => [owner], :size => 60 } %>
+ </div>
+ <% admins = @network.administrators(false)-%>
+ <% unless admins.empty? %>
+ <p class="heading">
+ Administrators
+ </p>
+ <div>
+ <%= render :partial => "networks/members", :locals => { :collection => admins, :size => 60 } %>
+ </div>
+ <% end %>
+ <% others = @network.members - admins - address@hidden -%>
+ <% unless others.empty? %>
+ <p class="heading">
+ Members
+ </p>
+ <div>
+ <%= render :partial => "networks/members", :locals => { :collection => others, :size => 60 } %>
+ </div>
+ <% end %>
+ </div>
+ </div>
</div>
<div class="tabContainer">
<div class="tabTitle">Creditations (<%= @network.creditations.length -%>)</div>
- <div class="tabContent">
-
+ <div class="tabContent">
+
<a name="creditations"></a>
<% unless (creditations = @network.creditations).empty? %>
<%= view_privileges_notice %>
@@ -208,45 +182,54 @@
</div>
<% if logged_in? && @network.administrator?(current_user.id) %>
-
+
<% memberships = @network.memberships_accepted %>
<div class="tabContainer">
<div class="tabTitle">Manage Memberships</div>
<div class="tabContent">
<a name="manage_memberships"></a>
+
+ <% if mine? @network %>
+ <br/>
+ <div class="box_currentuser_specific">
+ <strong>New member policy:</strong><br/>
+ <% if @network.open? %>
+ You have set this Group to automatically accept all membership requests.
+ <% elsif @network.membership_by_request? %>
+ You have set this Group to require membership requests to be approved by a group administrator.
+ <% else %>
+ You have set this Group to be closed to membership requests unless invited by a group administrator.
+ <% end %>
+ </div>
+ <% end %>
+
+ <h3>Members</h3>
<% unless memberships.empty? %>
<%= render :partial => "memberships/table", :locals => { :collection => memberships, :network => false } %>
<% else %>
<p><i>No additional members belong to this Group</i></p>
<% end %>
- </div>
- </div>
-
- <% requests = @network.memberships_requested %>
- <div class="tabContainer">
- <div class="tabTitle">Requests Pending (<%= @network.memberships_requested.length -%>)</div>
- <div class="tabContent">
+
<a name="requests_pending"></a>
+ <h3>Requests to join</h3>
+ <% requests = @network.memberships_requested %>
<% unless requests.empty? %>
<p></p>
<%= render :partial => "memberships/table", :locals => { :collection => requests, :network => false } %>
<% else %>
<p><i>No requests are pending for this Group</i></p>
<% end %>
- </div>
- </div>
-
- <% invited = @network.memberships_invited %>
- <div class="tabContainer">
- <div class="tabTitle">Invites Pending (<%= @network.memberships_invited.length -%>)</div>
- <div class="tabContent">
+
<a name="invites_pending"></a>
+ <h3>Invitations</h3>
+ <% invited = @network.memberships_invited %>
<% unless invited.empty? %>
<p></p>
<%= render :partial => "memberships/table", :locals => { :collection => invited, :network => false } %>
<% else %>
<p><i>No invites are pending for this Group</i></p>
<% end %>
+
</div>
</div>
Copied: branches/wf4ever/app/views/workflows/_deprecation_event.html.erb (from rev 3208, trunk/app/views/workflows/_deprecation_event.html.erb) (0 => 3210)
--- branches/wf4ever/app/views/workflows/_deprecation_event.html.erb (rev 0)
+++ branches/wf4ever/app/views/workflows/_deprecation_event.html.erb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -0,0 +1,32 @@
+<% wsdl_deprecations = deprecation_event[1] %>
+<% deprecation_event = deprecation_event[0] %>
+
+<% time_string = deprecation_event.date.strftime("#{deprecation_event.date.day.ordinalize} %B %Y") -%>
+<div class="deprecation_event">
+ <p>
+ <img src="" style="vertical-align: middle; float: left; margin: 0.5em"/>
+ This workflow uses one or more services that
+ <% if deprecation_event.date.past? %>
+ are deprecated as of <strong><%= time_string -%></strong>
+ (<%= time_ago_in_words(deprecation_event.date) -%> ago), and may no longer function.
+ <% else %>
+ will be deprecated on <strong><%= time_string -%></strong>
+ (in <%= time_ago_in_words(deprecation_event.date) -%>), and may no longer function after this date.
+ <% end %>
+ <a href="" {el.toggle();})">Show details...</a>
+ </p>
+ <div class="hidden" style="display: none">
+ <p><strong>Affected service WSDL<%= "s" if wsdl_deprecations.size > 1-%>:</strong></p>
+ <ul>
+ <% wsdl_deprecations.each do |wd| %>
+ <li><%= wd.wsdl -%></li>
+ <% end %>
+ </ul>
+
+ <% unless deprecation_event.details.nil? %>
+ <p class="hidden" style="display: none">
+ <strong>Details:</strong> <%= deprecation_event.details %>
+ </p>
+ <% end %>
+ </div>
+</div>
Modified: branches/wf4ever/app/views/workflows/edit_version.rhtml (3209 => 3210)
--- branches/wf4ever/app/views/workflows/edit_version.rhtml 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/views/workflows/edit_version.rhtml 2012-11-27 12:55:19 UTC (rev 3210)
@@ -1,5 +1,11 @@
<% t "Edit Version" -%>
+<% title_edit = address@hidden %>
+<% preview_edit = address@hidden %>
+<% description_edit = address@hidden %>
+
+<% can_edit_anything = title_edit || preview_edit || description_edit %>
+
<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
<h1>
@@ -25,29 +31,50 @@
<!-- Title -->
<p>
<b>Title</b>
- <span class="required">*</span>
+ <% if title_edit %>
+ <span class="required">*</span>
+ <% end %>
</p>
- <%= text_field_tag 'workflow[title]', @viewing_version.title, :size => '60' %>
+
+ <% if title_edit %>
+ <%= text_field_tag 'workflow[title]', @viewing_version.title, :size => '60' %>
+ <% else %>
+ <p class="derived_annotation_notice">The title is derived from the workflow file. Please edit the workflow directly and upload a new version to change the title of this workflow.</p>
+ <% end %>
<br/>
<!-- Preview Image -->
<p><b>Preview Image</b></p>
- <input id="workflow_preview" name="workflow[preview]" size="50" type="file" />
- <p style="font-size: 77%; color: #666666; font-style: italic; padding-top: 0;">
- Leave this blank to keep the existing preview image
- </p>
+
+ <% if preview_edit %>
+ <input id="workflow_preview" name="workflow[preview]" size="50" type="file" />
+ <p style="font-size: 77%; color: #666666; font-style: italic; padding-top: 0;">
+ Leave this blank to keep the existing preview image
+ </p>
+ <% else %>
+ <p class="derived_annotation_notice">The preview image is derived from the workflow file. Please edit the workflow directly and upload a new version to change the appearance of this workflow.</p>
+ <% end %>
<br/>
<!-- Description -->
<p><b>Description</b></p>
- <%= fckeditor_textarea(:workflow, :body, :toolbarSet => 'Simple', :width => '500px', :height => '500px') %>
-
- <br />
+ <% if description_edit %>
+ <%= fckeditor_textarea(:workflow, :body, :toolbarSet => 'Simple', :width => '500px', :height => '500px') %>
+
+ <br />
+ <% else %>
+ <p class="derived_annotation_notice">The description is derived from the workflow file. Please edit the workflow directly and upload a new version to change the description of this workflow.</p>
+ <% end %>
+
<br />
- <center><%= submit_tag "Update", :disable_with => "Updating..." %></center>
+ <center>
+ <% if can_edit_anything %>
+ <%= submit_tag "Update", :disable_with => "Updating..." %>
+ <% end %>
+ </center>
</div>
</center>
Modified: branches/wf4ever/app/views/workflows/show.rhtml (3209 => 3210)
--- branches/wf4ever/app/views/workflows/show.rhtml 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/app/views/workflows/show.rhtml 2012-11-27 12:55:19 UTC (rev 3210)
@@ -3,6 +3,8 @@
<% t "#{h title} (#{h @workflow.contributor_name}) [#{h(@workflow.type_display_name)} Workflow]" -%>
+<%= render :partial => "workflows/deprecation_event", :collection => @workflow.deprecations -%>
+
<ul class="sectionIcons">
<% if @authorised_to_edit -%>
<li><%= icon('new', new_version_workflow_path(@workflow), nil, nil, 'Upload New Version')%></li>
Modified: branches/wf4ever/config/default_settings.yml (3209 => 3210)
--- branches/wf4ever/config/default_settings.yml 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/config/default_settings.yml 2012-11-27 12:55:19 UTC (rev 3210)
@@ -540,7 +540,7 @@
joins:
- workflow_processors: INNER JOIN workflow_processors ON RESULT_TYPE = 'Workflow' AND workflow_processors.workflow_id = RESULT_ID
+ workflow_processors: INNER JOIN workflow_processors ON RESULT_TYPE = 'Workflow' AND workflow_processors.workflow_id = RESULT_ID AND DOWNLOAD_CONDITIONS = 1
taggings: LEFT OUTER JOIN taggings ON RESULT_TYPE = taggings.taggable_type AND RESULT_ID = taggings.taggable_id
services: INNER JOIN services ON RESULT_TYPE = 'Service' AND RESULT_ID = services.id
curation_events: INNER JOIN curation_events ON curation_events.object_type = RESULT_TYPE AND curation_events.object_id = RESULT_ID
Modified: branches/wf4ever/config/environment.rb (3209 => 3210)
--- branches/wf4ever/config/environment.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/config/environment.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -36,18 +36,14 @@
:acts_as_rateable,
:acts_as_solr,
:acts_as_taggable_redux,
- :acts_as_versioned,
:auto_complete,
- :browser_filters,
:encrypted_attributes,
- :exception_notification,
:fckeditor,
:headliner,
:oauth,
:oauth_plugin,
:open_id_authentication,
:paginating_find,
- :qrcode,
:query_stats,
:recaptcha,
:simile_timeline,
@@ -111,17 +107,3 @@
load 'config/environment_private.rb' if FileTest.exist?('config/environment_private.rb')
-# Fix for Ruby 1.8.7 when using Rails < 2.2
-if RUBY_VERSION == "1.8.7" && ((Rails::VERSION::MAJOR == 1) || (Rails::VERSION::MAJOR == 2 && Rails::VERSION::MINOR < 2))
- module ActionView
- module Helpers
- module TextHelper
- def truncate(text, length = 30, truncate_string = "...")
- if text.nil? then return end
- l = length - truncate_string.chars.to_a.size
- (text.chars.to_a.size > length ? text.chars.to_a[0...l].join + truncate_string : text).to_s
- end
- end
- end
- end
-end
Modified: branches/wf4ever/config/routes.rb (3209 => 3210)
--- branches/wf4ever/config/routes.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/config/routes.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -258,7 +258,8 @@
map.resources :networks,
:as => :groups,
:collection => { :all => :get, :search => :get },
- :member => { :invite => :get,
+ :member => { :content => :get,
+ :invite => :get,
:membership_invite => :post,
:membership_invite_external => :post,
:membership_request => :get,
Copied: branches/wf4ever/db/migrate/20121107095856_create_wsdl_deprecations.rb (from rev 3208, trunk/db/migrate/20121107095856_create_wsdl_deprecations.rb) (0 => 3210)
--- branches/wf4ever/db/migrate/20121107095856_create_wsdl_deprecations.rb (rev 0)
+++ branches/wf4ever/db/migrate/20121107095856_create_wsdl_deprecations.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -0,0 +1,14 @@
+class CreateWsdlDeprecations < ActiveRecord::Migration
+ def self.up
+ create_table :wsdl_deprecations do |t|
+ t.string :wsdl
+ t.datetime :deprecated_at
+ t.text :details
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :wsdl_deprecations
+ end
+end
Copied: branches/wf4ever/db/migrate/20121112133419_change_wsdl_deprecations.rb (from rev 3208, trunk/db/migrate/20121112133419_change_wsdl_deprecations.rb) (0 => 3210)
--- branches/wf4ever/db/migrate/20121112133419_change_wsdl_deprecations.rb (rev 0)
+++ branches/wf4ever/db/migrate/20121112133419_change_wsdl_deprecations.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -0,0 +1,17 @@
+class ChangeWsdlDeprecations < ActiveRecord::Migration
+ def self.up
+ add_column :wsdl_deprecations, :deprecation_event_id, :integer
+ remove_column :wsdl_deprecations, :details
+ remove_column :wsdl_deprecations, :deprecated_at
+ remove_column :wsdl_deprecations, :created_at
+ remove_column :wsdl_deprecations, :updated_at
+ end
+
+ def self.down
+ remove_column :wsdl_deprecations, :deprecation_event_id
+ add_column :wsdl_deprecations, :details, :text
+ add_column :wsdl_deprecations, :deprecated_at, :datetime
+ add_column :wsdl_deprecations, :created_at, :datetime
+ add_column :wsdl_deprecations, :updated_at, :datetime
+ end
+end
Copied: branches/wf4ever/db/migrate/20121112134053_create_deprecation_events.rb (from rev 3208, trunk/db/migrate/20121112134053_create_deprecation_events.rb) (0 => 3210)
--- branches/wf4ever/db/migrate/20121112134053_create_deprecation_events.rb (rev 0)
+++ branches/wf4ever/db/migrate/20121112134053_create_deprecation_events.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -0,0 +1,13 @@
+class CreateDeprecationEvents < ActiveRecord::Migration
+ def self.up
+ create_table :deprecation_events do |t|
+ t.string :title
+ t.datetime :date
+ t.text :details
+ end
+ end
+
+ def self.down
+ drop_table :deprecation_events
+ end
+end
Modified: branches/wf4ever/db/schema.rb (3209 => 3210)
--- branches/wf4ever/db/schema.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/db/schema.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -219,6 +219,12 @@
t.datetime "updated_at"
end
+ create_table "deprecation_events", :force => true do |t|
+ t.string "title"
+ t.datetime "date"
+ t.text "details"
+ end
+
create_table "downloads", :force => true do |t|
t.string "kind"
t.string "user_agent"
@@ -440,7 +446,6 @@
t.integer "contributor_id"
t.datetime "created_at"
t.string "contributor_type"
- t.text "ro_uri"
end
create_table "pending_invitations", :force => true do |t|
@@ -855,4 +860,9 @@
t.text "ro_uri"
end
+ create_table "wsdl_deprecations", :force => true do |t|
+ t.string "wsdl"
+ t.integer "deprecation_event_id"
+ end
+
end
Modified: branches/wf4ever/lib/authorization.rb (3209 => 3210)
--- branches/wf4ever/lib/authorization.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/lib/authorization.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -48,8 +48,6 @@
user = nil unless user.kind_of?(User)
- is_authorized = false
-
object_type = object.class == Class ? object.name : object.class.name
case object_type
@@ -82,9 +80,9 @@
case action
when "edit", "destroy"
# check to allow only admin to edit / delete the group
- is_authorized = user && user.network_admin?(object.id)
+ return user && user.network_admin?(object.id)
else
- is_authorized = true
+ return true
end
when "Comment"
@@ -92,21 +90,21 @@
when "create"
# Comments can be created by authenticated users that can view the context
- is_authorized = !user.nil? && Authorization.check('view', context, user)
+ return !user.nil? && Authorization.check('view', context, user)
when "destroy"
# Users can delete their own comments. Curators and
# administrators can delete any comment.
- is_authorized = object.user == user || (user && user.admin?) || (user && user.curator?)
+ return object.user == user || (user && user.admin?) || (user && user.curator?)
when "view"
# user can view comment if they can view the item that this comment references
- is_authorized = Authorization.check('view', object.commentable, user)
+ return Authorization.check('view', object.commentable, user)
else
# 'edit' or any other actions are not allowed on comments
- is_authorized = false
+ return false
end
when "Rating"
@@ -114,12 +112,12 @@
when "create"
# Ratings can be created by authenticated users that can view the context
- is_authorized = !user.nil? && Authorization.check('view', context, user)
+ return !user.nil? && Authorization.check('view', context, user)
when "edit", "destroy"
# Users can edit or remove their own ratings
- is_authorized = !user.nil? && object.user == user
+ return !user.nil? && object.user == user
end
when "Tagging"
@@ -127,79 +125,73 @@
when "create"
# Taggings can be created by authenticated users that can view the context
- is_authorized = !user.nil? && Authorization.check('view', context, user)
+ return !user.nil? && Authorization.check('view', context, user)
when "destroy"
# Users can delete their own taggings
- is_authorized = !user.nil? && object.user == user
+ return !user.nil? && object.user == user
end
when "Bookmark"
case action
when "create"
# Bookmarks can be created by authenticated users that can view the context
- is_authorized = !user.nil? && Authorization.check('view', context, user)
+ return !user.nil? && Authorization.check('view', context, user)
when "destroy"
# only the user who created the bookmark can delete it
- is_authorized = object.user == user
+ return object.user == user
when "view"
# everyone can view bookmarks
- is_authorized = true
+ return true
else
# 'edit' or any other actions are not allowed on comments
- is_authorized = false
+ return false
end
when "Experiment"
- if user.nil?
- is_authorized = false
+ return false if user.nil?
+
+ case object.contributor_type.to_s
+ when "User"
+ return object.contributor_id.to_i == user.id.to_i
+ when "Network"
+ return object.contributor.member?(user.id)
else
- case object.contributor_type.to_s
- when "User"
- is_authorized = object.contributor_id.to_i == user.id.to_i
- when "Network"
- is_authorized = object.contributor.member?(user.id)
- else
- is_authorized = false
- end
- end
+ return false
+ end
when "TavernaEnactor", "Runner"
- if user.nil?
- is_authorized = false
- else
- case object.contributor_type.to_s
- when "User"
- is_authorized = object.contributor_id.to_i == user.id.to_i
- when "Network"
- if ['edit', 'destroy'].include?(action.downcase)
- is_authorized = object.contributor.owner?(user.id)
- else
- is_authorized = object.contributor.member?(user.id)
- end
+ return false if user.nil?
+
+ case object.contributor_type.to_s
+ when "User"
+ return object.contributor_id.to_i == user.id.to_i
+ when "Network"
+ if ['edit', 'destroy'].include?(action.downcase)
+ return object.contributor.owner?(user.id)
else
- is_authorized = false
+ return object.contributor.member?(user.id)
end
+ else
+ return false
end
when "Job"
- if user.nil?
- is_authorized = false
+ return false if user.nil?
+
+ case object.experiment.contributor_type.to_s
+ when "User"
+ return object.experiment.contributor_id.to_i == user.id.to_i
+ when "Network"
+ return object.experiment.contributor.member?(user.id)
else
- case object.experiment.contributor_type.to_s
- when "User"
- is_authorized = object.experiment.contributor_id.to_i == user.id.to_i
- when "Network"
- is_authorized = object.experiment.contributor.member?(user.id)
- else
- is_authorized = false
- end
- end
+ return false
+ end
when "ContentType"
@@ -207,15 +199,15 @@
when "view"
# anyone can view content types
- is_authorized = true
+ return true
when "edit"
# the owner of the content type can edit
- is_authorized = !user.nil? && object.user == user
+ return !user.nil? && object.user == user
when "destroy"
# noone can destroy them yet - they just fade away from view
- is_authorized = false
+ return false
end
when "User"
@@ -224,15 +216,15 @@
when "view"
# everyone can view users
- is_authorized = true
+ return true
when "edit"
# the owner of a user record can edit
- is_authorized = !user.nil? && user == object
+ return !user.nil? && user == object
when "destroy"
# only adminstrators can delete accounts at present
- is_authorized = user && user.admin?
+ return user && user.admin?
end
when "Picture"
@@ -244,16 +236,16 @@
return true if object.owner == user
# anyone can view a user's selected pictures
- is_authorized = object.selected?
+ return object.selected?
when "edit", "destroy"
# only the owner of a picture can edit/destroy
- is_authorized = object.owner == user
+ return object.owner == user
end
when "ClientApplication"
- is_authorized = object.user == user
+ return object.user == user
when "Ontology"
@@ -261,15 +253,15 @@
when "create"
# Authenticated users can create ontologies
- is_authorized = !user.nil?
+ return !user.nil?
when "view"
# All users can view
- is_authorized = true
+ return true
when "edit", "destroy"
# Users can edit and destroy their own ontologies
- is_authorized = object.user == user
+ return object.user == user
end
when "Predicate"
@@ -285,11 +277,11 @@
when "view"
# All users can view predicates
- is_authorized = true
+ return true
else
# All other predicate permissions are inherited from the ontology
- is_authorized = Authorization.check('edit', object.ontology, user)
+ return Authorization.check('edit', object.ontology, user)
end
when "Relationship"
@@ -305,11 +297,11 @@
when "view"
# Users that can view the context can view the relationship
- is_authorized = Authorization.check('view', object.context, user)
+ return Authorization.check('view', object.context, user)
else
# All other relationship permissions depend on edit access to the context
- is_authorized = Authorization.check('edit', object.context, user)
+ return Authorization.check('edit', object.context, user)
end
when "PackContributableEntry", "PackRemoteEntry"
@@ -325,7 +317,7 @@
when "edit", "destroy"
# Users that can edit the pack can also edit / delete items
- is_authorized = Authorization.check('edit', object.pack, user)
+ return Authorization.check('edit', object.pack, user)
end
@@ -333,7 +325,8 @@
# don't recognise the kind of object that is being authorized, so
# we don't specifically know that it needs to be blocked;
# therefore, allow any actions on it
- is_authorized = true
+
+ return true
end
is_authorized
@@ -436,9 +429,14 @@
select_parts << "#{model.table_name}.*" if include_permissions
if include_permissions || permissions_only
- select_parts << "BIT_OR(#{view_conditions(user_id, friends, networks)}) AS view_permission"
- select_parts << "BIT_OR(#{download_conditions(user_id, friends, networks)}) AS download_permission"
- select_parts << "BIT_OR(#{edit_conditions(user_id, friends, networks)}) AS edit_permission"
+
+ view_conditions = view_conditions(user_id, friends, networks)
+ download_conditions = download_conditions(user_id, friends, networks)
+ edit_conditions = edit_conditions(user_id, friends, networks)
+
+ select_parts << "BIT_OR(#{view_conditions}) AS view_permission"
+ select_parts << "BIT_OR(#{download_conditions}) AS download_permission"
+ select_parts << "BIT_OR(#{edit_conditions}) AS edit_permission"
end
opts[:select] = select_parts.join(", ") unless select_parts.empty?
@@ -446,7 +444,23 @@
opts[:group] ||= 'contributions.contributable_type, contributions.contributable_id'
opts[:joins] = joins
- model.scoped(opts)
+ scope = model.scoped(opts) do
+ def permission_conditions
+ @permission_conditions
+ end
+
+ def permission_conditions=(permission_conditions)
+ @permission_conditions = permission_conditions
+ end
+ end
+
+ scope.permission_conditions = {
+ :view_conditions => view_conditions,
+ :download_conditions => download_conditions,
+ :edit_conditions => edit_conditions
+ }
+
+ scope
end
end
Deleted: branches/wf4ever/lib/tasks/qrcode_tasks.rake (3209 => 3210)
--- branches/wf4ever/lib/tasks/qrcode_tasks.rake 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/lib/tasks/qrcode_tasks.rake 2012-11-27 12:55:19 UTC (rev 3210)
@@ -1,4 +0,0 @@
-# desc "Explaining what the task does"
-# task :qrcode do
-# # Task goes here
-# end
\ No newline at end of file
Modified: branches/wf4ever/lib/workflow_processors/interface.rb (3209 => 3210)
--- branches/wf4ever/lib/workflow_processors/interface.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/lib/workflow_processors/interface.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -6,23 +6,23 @@
# Defines an interface that all workflow type processors need to adhere to.
module WorkflowProcessors
class Interface
-
+
# Begin Class Methods
-
- # These:
+
+ # These:
# - provide information about the Workflow Type supported by this processor,
# - provide information about the processor's capabilites, and
# - provide any general functionality.
-
+
# MUST be unique across all processors
def self.display_name
""
end
-
+
def self.display_data_format
""
end
-
+
def self.mime_type
"application/octet-stream"
end
@@ -36,27 +36,35 @@
def self.default_file_extension
nil
end
-
+
def self.can_determine_type_from_file?
false
end
-
+
def self.recognised?(file)
false
end
-
+
def self.can_infer_metadata?
false
end
-
+
+ def self.can_infer_title?
+ false
+ end
+
+ def self.can_infer_description?
+ false
+ end
+
def self.can_generate_preview_image?
false
end
-
+
def self.can_generate_preview_svg?
false
end
-
+
def self.show_download_section?
true
end
@@ -71,36 +79,36 @@
end
# End Object Initializer
-
-
+
+
# Begin Instance Methods
-
+
# These provide more specific functionality for a given workflow definition, such as parsing for metadata and image generation.
-
+
def get_title
nil
end
-
+
def get_description
nil
end
-
+
def get_preview_image
nil
end
-
+
def get_preview_svg
nil
end
-
+
def get_workflow_model_object
nil
end
-
+
def get_workflow_model_input_ports
-
+
end
-
+
def get_search_terms
""
end
@@ -113,6 +121,6 @@
end
# End Instance Methods
-
+
end
end
Modified: branches/wf4ever/lib/workflow_processors/taverna2.rb (3209 => 3210)
--- branches/wf4ever/lib/workflow_processors/taverna2.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/lib/workflow_processors/taverna2.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -64,6 +64,14 @@
def self.can_infer_metadata?
true
end
+
+ def self.can_infer_title?
+ true
+ end
+
+ def self.can_infer_description?
+ true
+ end
def self.can_generate_preview_image?
true
Modified: branches/wf4ever/lib/workflow_processors/taverna_scufl.rb (3209 => 3210)
--- branches/wf4ever/lib/workflow_processors/taverna_scufl.rb 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/lib/workflow_processors/taverna_scufl.rb 2012-11-27 12:55:19 UTC (rev 3210)
@@ -62,6 +62,14 @@
def self.can_infer_metadata?
true
end
+
+ def self.can_infer_title?
+ true
+ end
+
+ def self.can_infer_description?
+ true
+ end
def self.can_generate_preview_image?
true
Modified: branches/wf4ever/public/stylesheets/styles.css (3209 => 3210)
--- branches/wf4ever/public/stylesheets/styles.css 2012-11-27 12:54:32 UTC (rev 3209)
+++ branches/wf4ever/public/stylesheets/styles.css 2012-11-27 12:55:19 UTC (rev 3210)
@@ -267,9 +267,9 @@
}
#hlist {
- width: 100%;
margin: 0;
padding-left: 1em;
+ padding-right: 1em;
}
#hlist ul {
@@ -1521,6 +1521,7 @@
line-height: 1.4;
}
+.derived_annotation_notice,
.none_text {
font-style: italic;
color: #666666;
@@ -2151,7 +2152,7 @@
}
.pivot .label {
- width: 92px;
+ width: 90px;
overflow: hidden;
display: inline-block;
}
@@ -2380,6 +2381,14 @@
-webkit-border-bottom-right-radius: 6px;
}
+div.deprecation_event {
+ border: 1px solid #e24a3e;
+ background-color: #ffcccc;
+ padding: 0.5em;
+ border-radius: 3px;
+ margin-bottom: 1em;
+}
+
#statement_list TABLE {
border-collapse: collapse;
margin-bottom: 16px;
Deleted: branches/wf4ever/workflow-to-galaxy-0.3.4.gem
(Binary files differ)