myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3198] branches/snapshots: cd branches/snapshots


From: noreply
Subject: [myexperiment-hackers] [3198] branches/snapshots: cd branches/snapshots ; svn merge -r 3168:3197 ^ /trunk
Date: Mon, 26 Nov 2012 12:34:55 +0000 (UTC)

Revision
3198
Author
dgc
Date
2012-11-26 12:34:54 +0000 (Mon, 26 Nov 2012)

Log Message

cd branches/snapshots ; svn merge -r 3168:3197 ^/trunk

Modified Paths

Added Paths

Diff

Modified: branches/snapshots/app/controllers/application_controller.rb (3197 => 3198)


--- branches/snapshots/app/controllers/application_controller.rb	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/app/controllers/application_controller.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/app/controllers/messages_controller.rb (3197 => 3198)


--- branches/snapshots/app/controllers/messages_controller.rb	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/app/controllers/messages_controller.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/app/controllers/networks_controller.rb (3197 => 3198)


--- branches/snapshots/app/controllers/networks_controller.rb	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/app/controllers/networks_controller.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/app/helpers/application_helper.rb (3197 => 3198)


--- branches/snapshots/app/helpers/application_helper.rb	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/app/helpers/application_helper.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/app/models/deprecation_event.rb (from rev 3197, trunk/app/models/deprecation_event.rb) (0 => 3198)


--- branches/snapshots/app/models/deprecation_event.rb	                        (rev 0)
+++ branches/snapshots/app/models/deprecation_event.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/app/models/network.rb (3197 => 3198)


--- branches/snapshots/app/models/network.rb	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/app/models/network.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/app/models/workflow.rb (3197 => 3198)


--- branches/snapshots/app/models/workflow.rb	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/app/models/workflow.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -25,6 +25,8 @@
   belongs_to :content_type
   belongs_to :license
 
+  has_many :workflow_processors, :dependent => :destroy
+
   before_validation :check_unique_name
   before_validation :apply_extracted_metadata
 
@@ -330,7 +332,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
@@ -364,4 +366,9 @@
     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
+
 end

Copied: branches/snapshots/app/models/wsdl_deprecation.rb (from rev 3197, trunk/app/models/wsdl_deprecation.rb) (0 => 3198)


--- branches/snapshots/app/models/wsdl_deprecation.rb	                        (rev 0)
+++ branches/snapshots/app/models/wsdl_deprecation.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/app/views/memberships/_table.rhtml (3197 => 3198)


--- branches/snapshots/app/views/memberships/_table.rhtml	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/app/views/memberships/_table.rhtml	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/app/views/networks/_breadcrumbs.rhtml (3197 => 3198)


--- branches/snapshots/app/views/networks/_breadcrumbs.rhtml	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/app/views/networks/_breadcrumbs.rhtml	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/app/views/networks/_members.rhtml (3197 => 3198)


--- branches/snapshots/app/views/networks/_members.rhtml	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/app/views/networks/_members.rhtml	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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">&nbsp;</div>
 
-<div class="clearer">&nbsp;</div>
-
 <% end %>
\ No newline at end of file

Modified: branches/snapshots/app/views/networks/_table.rhtml (3197 => 3198)


--- branches/snapshots/app/views/networks/_table.rhtml	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/app/views/networks/_table.rhtml	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/app/views/networks/content.rhtml (from rev 3197, trunk/app/views/networks/content.rhtml) (0 => 3198)


--- branches/snapshots/app/views/networks/content.rhtml	                        (rev 0)
+++ branches/snapshots/app/views/networks/content.rhtml	2012-11-26 12:34:54 UTC (rev 3198)
@@ -0,0 +1,4 @@
+<h1>Content from the <%=h @network.title -%> group</h1>
+
+<%= render :partial => "content/index" -%>
+

Modified: branches/snapshots/app/views/networks/show.rhtml (3197 => 3198)


--- branches/snapshots/app/views/networks/show.rhtml	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/app/views/networks/show.rhtml	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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">&nbsp;</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">&nbsp;</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/snapshots/app/views/workflows/_deprecation_event.html.erb (from rev 3197, trunk/app/views/workflows/_deprecation_event.html.erb) (0 => 3198)


--- branches/snapshots/app/views/workflows/_deprecation_event.html.erb	                        (rev 0)
+++ branches/snapshots/app/views/workflows/_deprecation_event.html.erb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/app/views/workflows/show.rhtml (3197 => 3198)


--- branches/snapshots/app/views/workflows/show.rhtml	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/app/views/workflows/show.rhtml	2012-11-26 12:34:54 UTC (rev 3198)
@@ -1,5 +1,7 @@
 <% t "#{h @workflow.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/snapshots/config/default_settings.yml (3197 => 3198)


--- branches/snapshots/config/default_settings.yml	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/config/default_settings.yml	2012-11-26 12:34:54 UTC (rev 3198)
@@ -532,7 +532,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/snapshots/config/routes.rb (3197 => 3198)


--- branches/snapshots/config/routes.rb	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/config/routes.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -254,7 +254,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/snapshots/db/migrate/20121107095856_create_wsdl_deprecations.rb (from rev 3197, trunk/db/migrate/20121107095856_create_wsdl_deprecations.rb) (0 => 3198)


--- branches/snapshots/db/migrate/20121107095856_create_wsdl_deprecations.rb	                        (rev 0)
+++ branches/snapshots/db/migrate/20121107095856_create_wsdl_deprecations.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/db/migrate/20121112133419_change_wsdl_deprecations.rb (from rev 3197, trunk/db/migrate/20121112133419_change_wsdl_deprecations.rb) (0 => 3198)


--- branches/snapshots/db/migrate/20121112133419_change_wsdl_deprecations.rb	                        (rev 0)
+++ branches/snapshots/db/migrate/20121112133419_change_wsdl_deprecations.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/db/migrate/20121112134053_create_deprecation_events.rb (from rev 3197, trunk/db/migrate/20121112134053_create_deprecation_events.rb) (0 => 3198)


--- branches/snapshots/db/migrate/20121112134053_create_deprecation_events.rb	                        (rev 0)
+++ branches/snapshots/db/migrate/20121112134053_create_deprecation_events.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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/snapshots/db/schema.rb (3197 => 3198)


--- branches/snapshots/db/schema.rb	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/db/schema.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -9,7 +9,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version => 98) do
+ActiveRecord::Schema.define(:version => 20121112134053) do
 
   create_table "activity_limits", :force => true do |t|
     t.string   "contributor_type", :null => false
@@ -221,6 +221,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.integer  "contribution_id"
     t.integer  "user_id"
@@ -849,4 +855,9 @@
     t.integer  "preview_id"
   end
 
+  create_table "wsdl_deprecations", :force => true do |t|
+    t.string  "wsdl"
+    t.integer "deprecation_event_id"
+  end
+
 end

Modified: branches/snapshots/lib/authorization.rb (3197 => 3198)


--- branches/snapshots/lib/authorization.rb	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/lib/authorization.rb	2012-11-26 12:34:54 UTC (rev 3198)
@@ -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 "PackVersion"
@@ -110,21 +108,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"
@@ -132,12 +130,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"
@@ -145,79 +143,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"
 
@@ -225,15 +217,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"
@@ -242,15 +234,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"
@@ -262,16 +254,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"
 
@@ -279,15 +271,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"
@@ -303,11 +295,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"
@@ -323,11 +315,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"
@@ -343,7 +335,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
 
@@ -351,7 +343,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
@@ -454,9 +447,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?
@@ -464,7 +462,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
 

Modified: branches/snapshots/public/stylesheets/styles.css (3197 => 3198)


--- branches/snapshots/public/stylesheets/styles.css	2012-11-26 10:45:27 UTC (rev 3197)
+++ branches/snapshots/public/stylesheets/styles.css	2012-11-26 12:34:54 UTC (rev 3198)
@@ -267,9 +267,9 @@
 }
 
 #hlist {
-	width: 100%;
 	margin: 0;
 	padding-left: 1em;
+  padding-right: 1em;
 }
 
 #hlist ul {
@@ -2152,7 +2152,7 @@
 }
 
 .pivot .label {
-  width: 92px;
+  width: 90px;
   overflow: hidden;
   display: inline-block;
 }
@@ -2381,3 +2381,10 @@
   -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;
+}

reply via email to

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