myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3491] branches/events: cd branches/events ; svn


From: noreply
Subject: [myexperiment-hackers] [3491] branches/events: cd branches/events ; svn merge -r 3166:3490 ^/trunk
Date: Wed, 3 Apr 2013 15:44:22 +0000 (UTC)

Revision
3491
Author
dgc
Date
2013-04-03 15:44:21 +0000 (Wed, 03 Apr 2013)

Log Message

cd branches/events ; svn merge -r 3166:3490 ^/trunk

Modified Paths

Added Paths

Removed Paths

Property Changed

Diff

Copied: branches/events/.gitignore (from rev 3490, trunk/.gitignore) (0 => 3491)


--- branches/events/.gitignore	                        (rev 0)
+++ branches/events/.gitignore	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,6 @@
+/index
+/.project
+/tmp
+/log
+/Gemfile.lock
+.redcar

Copied: branches/events/.rvmrc (from rev 3490, trunk/.rvmrc) (0 => 3491)


--- branches/events/.rvmrc	                        (rev 0)
+++ branches/events/.rvmrc	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+# This is an RVM Project .rvmrc file, used to automatically load the ruby
+# development environment upon cd'ing into the directory
+
+# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
+# Only full ruby name is supported here, for short names use:
+#     echo "rvm use 1.8.7" > .rvmrc
+environment_id="address@hidden"
+
+# Uncomment the following lines if you want to verify rvm version per project
+# rvmrc_rvm_version="1.16.16 (stable)" # 1.10.1 seams as a safe start
+# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
+#   echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
+#   return 1
+# }
+
+# First we attempt to load the desired environment directly from the environment
+# file. This is very fast and efficient compared to running through the entire
+# CLI and selector. If you want feedback on which environment was used then
+# insert the word 'use' after --create as this triggers verbose mode.
+if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
+  && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
+then
+  \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
+  [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
+    \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
+else
+  # If the environment file has not yet been created, use the RVM CLI to select.
+  rvm --create  "$environment_id" || {
+    echo "Failed to create RVM environment '${environment_id}'."
+    return 1
+  }
+fi
+
+# If you use bundler, this might be useful to you:
+if [[ -s Gemfile ]] && {
+  ! builtin command -v bundle >/dev/null ||
+  builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
+}
+then
+  printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
+  gem install bundler
+fi
+if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
+then
+  bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
+fi

Modified: branches/events/Gemfile (3490 => 3491)


--- branches/events/Gemfile	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/Gemfile	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,9 +1,7 @@
 source "http://rubygems.org"
 
-gem "rails", "2.3.14"
-gem "mysql", "~> 2.8.1"
-gem "mongrel", "~> 1.1.5"
-gem "mongrel_cluster", "~> 1.0.5"
+gem "rails", "2.3.17"
+gem "mysql2", "~> 0.2.18"
 gem "rubyzip", "~> 0.9.4"
 gem "oauth", "~> 0.4.3"
 gem "libxml-ruby", "2.2.2"
@@ -14,9 +12,19 @@
 gem "curb", "~> 0.7.8"
 gem "marc", "~> 0.4.3"
 gem "ruby-hmac", "~> 0.4.0"
-gem "passenger", "~> 2.2.15"
+gem "passenger", "~> 3.0.19"
 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 "taverna-t2flow", "~> 0.4.0"
+gem "workflow-to-galaxy", "~> 0.3.5"
+gem "rdf", "~> 0.3.4.1"
+gem "rdf-raptor", "~> 0.4.1"
+gem "rdf-n3"
+gem "recaptcha", "~> 0.3.4"
+gem "encrypted_strings", "~> 0.3.3"
+gem "encrypted_attributes", "~> 0.4.1"
+gem "sunspot_rails", "~> 2.0.0"
+gem "sunspot_solr", "~> 2.0.0"
+gem "will_paginate", "~> 2.3.16"
+gem "open_id_authentication", "~> 1.1.0"
 

Modified: branches/events/Rakefile (3490 => 3491)


--- branches/events/Rakefile	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/Rakefile	2013-04-03 15:44:21 UTC (rev 3491)
@@ -5,19 +5,19 @@
 
 require 'rake'
 require 'rake/testtask'
-require 'rake/rdoctask'
+require 'rdoc/task'
 
 require 'tasks/rails'
 
 desc 'Rebuild Solr index'
 task "myexp:refresh:solr" do
   require File.dirname(__FILE__) + '/config/environment'
-  Workflow.rebuild_solr_index
-  Blob.rebuild_solr_index
-  User.rebuild_solr_index
-  Network.rebuild_solr_index
-  Pack.rebuild_solr_index
-  Service.rebuild_solr_index
+  Workflow.solr_reindex
+  Blob.solr_reindex
+  User.solr_reindex
+  Network.solr_reindex
+  Pack.solr_reindex
+  Service.solr_reindex
 end
 
 desc 'Refresh contribution caches'

Modified: branches/events/app/controllers/api_controller.rb (3490 => 3491)


--- branches/events/app/controllers/api_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/api_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -4,7 +4,7 @@
 # See license.txt for details.
 
 require 'base64'
-require 'lib/rest'
+require 'rest'
 
 class ApiController < ApplicationController
 

Modified: branches/events/app/controllers/application_controller.rb (3490 => 3491)


--- branches/events/app/controllers/application_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/application_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -6,7 +6,10 @@
 # Filters added to this controller apply to all controllers in the application.
 # Likewise, all the methods added will be available for all controllers.
 
+require 'pivoting'
+
 class ApplicationController < ActionController::Base
+
   helper :all # include all helpers, all the time
   protect_from_forgery # See ActionController::RequestForgeryProtection for details
 
@@ -25,6 +28,8 @@
   before_filter :check_external_site_request
 
   include ActionView::Helpers::NumberHelper
+
+  layout :configure_layout
   
   def check_for_sleeper
     if request.method != :get && logged_in?
@@ -183,19 +188,28 @@
 
     # this method will return an error message is something goes wrong (empty string in case of success)
     error_msg = ""
-    
 
     # BEGIN validation and initialisation
-    
+
+    # If a group policy was selected, use that, and delete the old custom one (if there was one).
+    if params[:policy_type] == "group"
+      if contributable.contribution.policy && !contributable.contribution.policy.group_policy?
+        contributable.contribution.policy.destroy
+      end
+      contributable.contribution.policy_id = params[:group_policy]
+      contributable.contribution.save
+      return
+    end
+
     # This variable will hold current settings of the policy in case something
     # goes wrong and a revert would be needed at some point
     last_saved_policy = nil
     
     return if params[:sharing].nil? or params[:sharing][:class_id].blank?
-    
+
     sharing_class  = params[:sharing][:class_id]
     updating_class = (params[:updating] and !params[:updating][:class_id].blank?) ? params[:updating][:class_id] : "6"
-    
+
     # Check allowed sharing_class values
     return unless [ "0", "1", "2", "3", "4", "7" ].include? sharing_class
     
@@ -211,9 +225,9 @@
     
     # BEGIN initialisation and validation
 
-    unless contributable.contribution.policy
+    if contributable.contribution.policy.nil? || contributable.contribution.policy.group_policy?
       last_saved_policy = Policy._default(current_user, nil) # second parameter ensures that this policy is not applied anywhere
-      
+
       policy = Policy.new(:name => 'auto',
           :contributor_type => 'User', :contributor_id => current_user.id,
           :share_mode         => sharing_class,
@@ -256,10 +270,25 @@
       policy.delete_all_user_permissions
     end
     
-    
+
     # Process explicit Group permissions now
+    process_permissions(policy, params)
+
+    logger.debug("------ Workflow create summary ------------------------------------")
+    logger.debug("current_user   = #{current_user.id}")
+    logger.debug("updating_class = #{updating_class}")
+    logger.debug("sharing_class  = #{sharing_class}")
+    logger.debug("policy         = #{policy}")
+    logger.debug("group_sharing  = #{params[:group_sharing]}")
+    logger.debug("-------------------------------------------------------------------")
+
+    # returns some message in case of errors (or empty string in case of success)
+    return error_msg
+  end
+
+  def process_permissions(policy, params)
     if params[:group_sharing]
-      
+
       # First delete any Permission objects that don't have a checked entry in the form
       policy.permissions.each do |p|
         params[:group_sharing].each do |n|
@@ -271,17 +300,17 @@
           end
         end
       end
-    
+
       # Now create or update Permissions
       params[:group_sharing].each do |n|
-        
+
         # Note: n[1] is used because n is an array and n[1] returns it's value (which in turn is a hash)
         # In this hash, is a value with key 'id' is present then the checkbox for that group was checked.
         if n[1][:id]
-          
+
           n_id = n[1][:id].to_i
           level = n[1][:level]
-          
+
           unless (perm = Permission.find(:first, :conditions => ["policy_id = ? AND contributor_type = ? AND contributor_id = ?", policy.id, 'Network', n_id]))
             # Only create new Permission if it doesn't already exist
             p = Permission.new(:policy => policy, :contributor => (Network.find(n_id)))
@@ -290,31 +319,20 @@
             # Update the 'level' on the existing permission
             perm.set_level!(level) if level
           end
-          
+
         else
-          
+
           n_id = n[0].to_i
-          
+
           # Delete permission if it exists (because this one is unchecked)
           if (perm = Permission.find(:first, :conditions => ["policy_id = ? AND contributor_type = ? AND contributor_id = ?", policy.id, 'Network', n_id]))
             perm.destroy
           end
-          
+
         end
-      
+
       end
     end
-
-    logger.debug("------ Workflow create summary ------------------------------------")
-    logger.debug("current_user   = #{current_user.id}")
-    logger.debug("updating_class = #{updating_class}")
-    logger.debug("sharing_class  = #{sharing_class}")
-    logger.debug("policy         = #{policy}")
-    logger.debug("group_sharing  = #{params[:group_sharing]}")
-    logger.debug("-------------------------------------------------------------------")
-
-    # returns some message in case of errors (or empty string in case of success)
-    return error_msg
   end
 
   def update_credits(creditable, params)
@@ -415,601 +433,22 @@
     send_file(file_name, *opts)
   end
 
-  # Pivot code
-
-  def calculate_pivot(opts = {})
-
-    begin
-      expr = parse_filter_expression(opts[:params]["filter"], opts[:pivot_options], :active_filters => opts[:active_filters])
-    rescue Exception => ex
-      problem = "Problem with query _expression_: #{ex}"
-    end
-
-    pivot = contributions_list(opts[:params], opts[:user], opts[:pivot_options],
-        :model            => opts[:model],
-        :auth_type        => opts[:auth_type],
-        :auth_id          => opts[:auth_id],
-        :group_by         => opts[:group_by],
-        :active_filters   => opts[:active_filters],
-        :lock_filter      => opts[:locked_filters],
-        :search_models    => opts[:search_models],
-        :search_limit     => opts[:search_limit],
-        :filters          => expr)
-
-    [pivot, problem]
-  end
-  
-  TOKEN_UNKNOWN         = 0x0000
-  TOKEN_AND             = 0x0001
-  TOKEN_OR              = 0x0002
-  TOKEN_WORD            = 0x0003
-  TOKEN_OPEN            = 0x0004
-  TOKEN_CLOSE           = 0x0005
-  TOKEN_STRING          = 0x0006
-  TOKEN_EOS             = 0x00ff
-
-  NUM_TOKENS            = 6
-
-  STATE_INITIAL         = 0x0000
-  STATE_EXPECT_OPEN     = 0x0100
-  STATE_EXPECT_STR      = 0x0200
-  STATE_EXPECT_EXPR_END = 0x0300
-  STATE_EXPECT_END      = 0x0400
-  STATE_COMPLETE        = 0x0500
-
-  def parse_filter_expression(expr, pivot_options, opts = {})
-
-    def unescape_string(str)
-      str.match(/^"(.*)"$/)[1].gsub(/\\"/, '"')
-    end
-
-    return nil if expr.nil?
-
-    state  = STATE_INITIAL
-    data   = ""
-
-    begin
-
-      tokens = expr.match(/^
-
-          \s* (\sAND\s)         | # AND operator
-          \s* (\sOR\s)          | # OR operator
-          \s* (\w+)             | # a non-keyword word
-          \s* (\()              | # an open paranthesis
-          \s* (\))              | # a close paranthesis
-          \s* ("(\\.|[^\\"])*")   # double quoted string with backslash escapes
-
-          /ix)
-
-      if tokens.nil?
-        token = TOKEN_UNKNOWN
-      else
-        (1..NUM_TOKENS).each do |i|
-          token = i if tokens[i]
-        end
-      end
-
-      if token == TOKEN_UNKNOWN
-        token = TOKEN_EOS if expr.strip.empty?
-      end
-
-      case state | token
-        when STATE_INITIAL         | TOKEN_WORD   : state = STATE_EXPECT_OPEN     ; data << { :name => tokens[0], :expr => [] }
-        when STATE_EXPECT_OPEN     | TOKEN_OPEN   : state = STATE_EXPECT_STR
-        when STATE_EXPECT_STR      | TOKEN_STRING : state = STATE_EXPECT_EXPR_END ; data.last[:expr] << tokens[0] 
-        when STATE_EXPECT_EXPR_END | TOKEN_AND    : state = STATE_EXPECT_STR      ; data.last[:expr] << :and 
-        when STATE_EXPECT_EXPR_END | TOKEN_OR     : state = STATE_EXPECT_STR      ; data.last[:expr] << :or 
-        when STATE_EXPECT_EXPR_END | TOKEN_CLOSE  : state = STATE_EXPECT_END
-        when STATE_EXPECT_END      | TOKEN_AND    : state = STATE_INITIAL         ; data << :and 
-        when STATE_EXPECT_END      | TOKEN_OR     : state = STATE_INITIAL         ; data << :or 
-        when STATE_EXPECT_END      | TOKEN_EOS    : state = STATE_COMPLETE
-
-        else raise "Error parsing query _expression_"
-      end
-
-      expr = tokens.post_match unless state == STATE_COMPLETE
-
-    end while state != STATE_COMPLETE
-
-    # validate and reduce expressions to current capabilities
-
-    valid_filters = pivot_options["filters"].map do |f| f["query_option"] end
-    valid_filters = valid_filters.select do |f| opts[:active_filters].include?(f) end
-
-    data.each do |category|
-      case category
-      when :or
-        raise "Unsupported query _expression_"
-      when :and
-        # Fine
-      else
-        raise "Unknown filter category" unless valid_filters.include?(category[:name])
-
-        counts = { :and => 0, :or => 0 }
-
-        category[:expr].each do |bit|
-          counts[bit] = counts[bit] + 1 if bit.class == Symbol
-        end
-
-        raise "Unsupported query _expression_" if counts[:and] > 0 && counts[:or] > 0
-
-        # haven't implemented 'and' within a particular filter yet
-        raise "Unsupported query _expression_" if counts[:and] > 0
-
-        if category[:expr].length == 1
-          category[:expr] = { :terms => [unescape_string(category[:expr].first)] }
-        else
-          category[:expr] = {
-            :operator => category[:expr][1],
-            :terms    => category[:expr].select do |t|
-              t.class == String
-            end.map do |t|
-              unescape_string(t)
-            end
-          }
-        end
-      end
-    end
-
-    data
-  end
-
-  def contributions_list(params = nil, user = nil, pivot_options = nil, opts = {})
-
-    def escape_sql(str)
-      str.gsub(/\\/, '\&\&').gsub(/'/, "''")
-    end
-
-    def build_url(params, opts, expr, parts, pivot_options, extra = {})
-
-      query = {}
-
-      if parts.include?(:filter)
-        bits = []
-        pivot_options["filters"].each do |filter|
-          if !opts[:lock_filter] || opts[:lock_filter][filter["query_option"]].nil?
-            if find_filter(expr, filter["query_option"])
-              bits << filter["query_option"] + "(\"" + find_filter(expr, filter["query_option"])[:expr][:terms].map do |t| t.gsub(/"/, '\"') end.join("\" OR \"") + "\")"
-            end
-          end
-        end
-
-        if bits.length > 0
-          query["filter"] = bits.join(" AND ")
-        end
-      end
-
-      query["query"]        = params[:query]        if params[:query]
-      query["order"]        = params[:order]        if parts.include?(:order)
-      query["filter_query"] = params[:filter_query] if parts.include?(:filter_query)
-
-      query.merge!(extra)
-
-      query
-    end
-
-    def comparison(lhs, rhs)
-      if rhs.length == 1
-        "#{lhs} = '#{escape_sql(rhs.first)}'"
-      else
-        "#{lhs} IN ('#{rhs.map do |bit| escape_sql(bit) end.join("', '")}')"
-      end
-    end
-
-    def create_search_results_table(search_query, opts)
-
-      begin
-        solr_results = opts[:search_models].first.multi_solr_search(search_query,
-            :models         => opts[:search_models],
-            :limit          => opts[:search_limit],
-            :results_format => :ids)
-      rescue
-        return false
-      end
-
-      conn = ActiveRecord::Base.connection
-
-      conn.execute("CREATE TEMPORARY TABLE search_results (id INT AUTO_INCREMENT UNIQUE KEY, result_type VARCHAR(255), result_id INT)")
-
-      # This next part converts the search results to SQL values
-      #
-      # from:  { "id" => "Workflow:4" }, { "id" => "Pack:6" }, ...
-      # to:    "(NULL, 'Workflow', '4'), (NULL, 'Pack', '6'), ..."
-
-      if solr_results.results.length > 0
-        insert_part = solr_results.results.map do |result|
-          "(NULL, " + result["id"].split(":").map do |bit|
-            "'#{bit}'"
-          end.join(", ") + ")"
-        end.join(", ")
- 
-        conn.execute("INSERT INTO search_results VALUES #{insert_part}")
-      end
-
-      true
-    end
-
-    def drop_search_results_table
-      ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS search_results")
-    end
-
-    def column(column, opts)
-      if column == :auth_type
-        opts[:auth_type]
-      else
-        column
-      end
-    end
-
-    def calculate_filter(collection, params, filter, pivot_options, user, opts = {})
-
-      # apply all the joins and conditions except for the current filter
-
-      joins      = []
-      conditions = []
-
-      pivot_options["filters"].each do |other_filter|
-        if filter_list = find_filter(opts[:filters], other_filter["query_option"])
-          unless opts[:inhibit_other_conditions]
-            conditions << comparison(column(other_filter["id_column"], opts), filter_list[:expr][:terms]) unless other_filter == filter
-          end
-          joins += other_filter["joins"] if other_filter["joins"]
-        end
-      end
-
-      filter_id_column    = column(filter["id_column"],    opts)
-      filter_label_column = column(filter["label_column"], opts)
-
-      joins += filter["joins"] if filter["joins"]
-      conditions << "#{filter_id_column} IS NOT NULL" if filter["not_null"]
-
-      unless opts[:inhibit_filter_query]
-        if params[:filter_query]
-          conditions << "(#{filter_label_column} LIKE '%#{escape_sql(params[:filter_query])}%')"
-        end
-      end
-
-      current = find_filter(opts[:filters], filter["query_option"]) ? find_filter(opts[:filters], filter["query_option"])[:expr][:terms] : []
-
-      if opts[:ids].nil?
-        limit = 10
-      else
-        conditions << "(#{filter_id_column} IN ('#{opts[:ids].map do |id| escape_sql(id) end.join("','")}'))"
-        limit = nil
-      end
-
-      conditions = conditions.length.zero? ? nil : conditions.join(" AND ")
-
-      count_expr = "COUNT(DISTINCT #{opts[:auth_type]}, #{opts[:auth_id]})"
-
-      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]),
-          :conditions => conditions,
-          :group => "#{filter_id_column}",
-          :limit => limit,
-          :order => "#{count_expr} DESC, #{filter_label_column}")
-
-      objects = objects.select do |x| !x[:filter_id].nil? end
-
-      objects = objects.map do |object|
-
-        value = object.filter_id.to_s
-        selected = current.include?(value)
-
-        label_expr = deep_clone(opts[:filters])
-        label_expr -= [find_filter(label_expr, filter["query_option"])] if find_filter(label_expr, filter["query_option"])
-
-        unless selected && current.length == 1
-          label_expr << { :name => filter["query_option"], :expr => { :terms => [value] } }
-        end
-
-        checkbox_expr = deep_clone(opts[:filters])
-
-        if expr_filter = find_filter(checkbox_expr, filter["query_option"])
-
-          if selected
-            expr_filter[:expr][:terms] -= [value]
-          else
-            expr_filter[:expr][:terms] += [value]
-          end
-
-          checkbox_expr -= [expr_filter] if expr_filter[:expr][:terms].empty?
-
-        else
-          checkbox_expr << { :name => filter["query_option"], :expr => { :terms => [value] } }
-        end
-
-        label_uri = build_url(params, opts, label_expr, [:filter, :order], pivot_options, "page" => nil)
-
-        checkbox_uri = build_url(params, opts, checkbox_expr, [:filter, :order], pivot_options, "page" => nil)
-
-        label = object.filter_label.clone
-        label = visible_name(label) if filter["visible_name"]
-        label = label.capitalize    if filter["capitalize"]
-
-        plain_label = object.filter_label
-
-        if params[:filter_query]
-          label.sub!(Regexp.new("(#{params[:filter_query]})", Regexp::IGNORECASE), '<b>\1</b>')
-        end
-
-        {
-          :object       => object,
-          :value        => value,
-          :label        => label,
-          :plain_label  => plain_label,
-          :count        => object.filter_count,
-          :checkbox_uri => checkbox_uri,
-          :label_uri    => label_uri,
-          :selected     => selected
-        }
-      end
-
-      [current, objects]
-    end
-
-    def calculate_filters(collection, params, opts, pivot_options, user)
-
-      # produce the filter list
-
-      filters = deep_clone(pivot_options["filters"])
-      cancel_filter_query_url = nil
-
-      filters.each do |filter|
-
-        # calculate the top n items of the list
-
-        filter[:current], filter[:objects] = calculate_filter(collection, params, filter, pivot_options, user, opts)
-
-        # calculate which active filters are missing (because they weren't in the
-        # top part of the list or have a count of zero)
-
-        missing_filter_ids = filter[:current] - filter[:objects].map do |ob| ob[:value] end
-
-        if missing_filter_ids.length > 0
-          filter[:objects] += calculate_filter(collection, params, filter, pivot_options, user, opts.merge(:ids => missing_filter_ids))[1]
-        end
-
-        # calculate which active filters are still missing (because they have a
-        # count of zero)
-
-        missing_filter_ids = filter[:current] - filter[:objects].map do |ob| ob[:value] end
-        
-        if missing_filter_ids.length > 0
-          zero_list = calculate_filter(collection, params, filter, pivot_options, user, opts.merge(:ids => missing_filter_ids, :inhibit_other_conditions => true))[1]
-
-          zero_list.each do |x| x[:count] = 0 end
-
-          zero_list.sort! do |a, b| a[:label] <=> b[:label] end
-
-          filter[:objects] += zero_list
-        end
-      end
-
-      [filters, cancel_filter_query_url]
-    end
-
-    def find_filter(filters, name)
-      filters.find do |f|
-        f[:name] == name
-      end
-    end
-
-    def merge_joins(joins, pivot_options, 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
-        end.join(" ")
-      end
-    end
-
-    pivot_options["filters"] = pivot_options["filters"].select do |f|
-      opts[:active_filters].include?(f["query_option"])
-    end
-
-    joins      = []
-    conditions = []
-
-    # parse the filter _expression_ if provided.  convert filter _expression_ to
-    # the old format.  this will need to be replaced eventually
-
-    opts[:filters] ||= []
-    
-    include_reset_url = opts[:filters].length > 0
-
-    # filter out top level logic operators for now
-
-    opts[:filters] = opts[:filters].select do |bit|
-      bit.class == Hash
-    end
-
-    # apply locked filters
-
-    if opts[:lock_filter]
-      opts[:lock_filter].each do |filter, value|
-        opts[:filters] << { :name => filter, :expr => { :terms => [value] } }
-      end
-    end
-
-    # perform search if requested
-
-    query_problem = false
-
-    if params["query"]
-      drop_search_results_table
-      if !create_search_results_table(params["query"], opts)
-        params["query"] = nil
-        query_problem = true
-      end
-    end
-
-    if params[:query]
-      klass     = SearchResult
-      auth_type = "search_results.result_type"
-      auth_id   = "search_results.result_id"
-      group_by  = "search_results.result_type, search_results.result_id"
-    else
-      klass     = opts[:model]     || Contribution
-      auth_type = opts[:auth_type] || "contributions.contributable_type"
-      auth_id   = opts[:auth_id]   || "contributions.contributable_id"
-      group_by  = opts[:group_by]  || "contributions.contributable_type, contributions.contributable_id"
-    end
-
-    # determine joins, conditions and order for the main results
-
-    pivot_options["filters"].each do |filter|
-      if filter_list = find_filter(opts[:filters], filter["query_option"])
-        conditions << comparison(column(filter["id_column"], opts.merge( { :auth_type => auth_type, :auth_id => auth_id } )), filter_list[:expr][:terms])
-        joins += filter["joins"] if filter["joins"]
-      end
-    end
-
-    order_options = pivot_options["order"].find do |x|
-      x["option"] == params[:order]
-    end
-
-    order_options ||= pivot_options["order"].first
-
-    joins += order_options["joins"] if order_options["joins"]
-
-    having_bits = []
-
-#   pivot_options["filters"].each do |filter|
-#     if params["and_#{filter["query_option"]}"]
-#       having_bits << "GROUP_CONCAT(DISTINCT #{filter["id_column"]} ORDER BY #{filter["id_column"]}) = \"#{escape_sql(opts[:filters][filter["query_option"]])}\""
-#     end
-#   end
-
-    having_clause = ""
-
-    if having_bits.length > 0
-      having_clause = "HAVING #{having_bits.join(' AND ')}"
-    end
-
-    # perform the results query
-
-    collection = Authorization.scoped(klass,
-        :authorised_user => user,
-        :include_permissions => true,
-        :auth_type => auth_type,
-        :auth_id => auth_id)
-
-    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),
-        :conditions => conditions.length.zero? ? nil : conditions.join(" AND "),
-        :group => "#{group_by} #{having_clause}",
-        :order => order_options["order"])
-        
-    # produce a query hash to match the current filters
-
-    opts[:filter_params] = {}
-
-    pivot_options["filters"].each do |filter|
-      if params[filter["query_option"]]
-        next if opts[:lock_filter] && opts[:lock_filter][filter["query_option"]]
-        opts[:filter_params][filter["query_option"]] = params[filter["query_option"]]
-      end
-    end
-
-    # produce the filter list
-
-    opts_for_filter_query = opts.merge( { :auth_type => auth_type,
-        :auth_id => auth_id, :group_by => group_by } )
-
-    filters, cancel_filter_query_url = calculate_filters(collection, params, opts_for_filter_query, pivot_options, user)
-
-    # produce the summary.  If a filter query is specified, then we need to
-    # recalculate the filters without the query to get all of them.
-
-    if params[:filter_query]
-      filters2 = calculate_filters(collection, params, opts_for_filter_query.merge( { :inhibit_filter_query => true } ), pivot_options, user)[0]
-    else
-      filters2 = filters
-    end
-
-    summary = ""
-
-    filters2.select do |filter|
-
-      next if opts[:lock_filter] && opts[:lock_filter][filter["query_option"]]
-
-      selected = filter[:objects].select do |x| x[:selected] end
-      current  = selected.map do |x| x[:value] end
-
-      if selected.length > 0
-        selected_labels = selected.map do |x|
-
-          expr = deep_clone(opts[:filters])
-
-          f = find_filter(expr, filter["query_option"])
-  
-          expr -= f[:expr][:terms] -= [x[:value]]
-          expr -= [f] if f[:expr][:terms].empty?
-
-          x[:plain_label] + ' <a href="" + url_for(build_url(params, opts, expr,
-          [:filter, :filter_query, :order], pivot_options)) +
-            '">' + " <img src='' /></a>"
-
-        end
-
-        bits = selected_labels.map do |label| label end.join(" <i>or</i> ")
-
-        summary << '<span class="filter-in-use"><b>' + filter["title"].capitalize + "</b>: " + bits + "</span> "
-      end
-    end
-
-    if params[:filter_query]
-      cancel_filter_query_url = build_url(params, opts, opts[:filters], [:filter, :order], pivot_options)
-    end
-
-    if include_reset_url
-      reset_filters_url = build_url(params, opts, opts[:filters], [:order], pivot_options)
-    end
-
-    # remove filters that do not help in narrowing down the result set
-
-    filters = filters.select do |filter|
-      if filter[:objects].empty?
-        false
-      elsif opts[:lock_filter] && opts[:lock_filter][filter["query_option"]]
-        false
-      else
-        true
-      end
-    end
-
-    {
-      :results                 => results,
-      :filters                 => filters,
-      :reset_filters_url       => reset_filters_url,
-      :cancel_filter_query_url => cancel_filter_query_url,
-      :filter_query_url        => build_url(params, opts, opts[:filters], [:filter], pivot_options),
-      :summary                 => summary,
-      :pivot_options           => pivot_options,
-      :query_problem           => query_problem
-    }
-  end
-
   #Applies the layout for the Network with the given network_id to the object (contributable)
   def update_layout(object,network_id)
-    if network_id.blank?
-      object.contribution.layout = nil
-      object.contribution.save
+    if object.is_a?(Policy)
+      policy = object
     else
+      policy = object.contribution.policy
+    end
+    if network_id.blank? || network_id == "Default"
+      policy.layout = nil
+      policy.save
+    else
       network = Network.find(network_id.to_i)
       # Have to call .reload on permissions or the cached permissions from before "update_policy" was called are used
-      if network && find_permission_for_contributor(object.contribution.policy.permissions.reload, "Network", network_id.to_i)
-        object.contribution.layout = network.layout_name
-        object.contribution.save
+      if network && find_permission_for_contributor(policy.permissions.reload, "Network", network_id.to_i)
+        policy.layout = network.layout_name
+        policy.save
       else
         object.errors.add_to_base("You may only choose layouts for groups that this #{object.class.name.downcase} is shared with.")
       end
@@ -1051,4 +490,96 @@
       format.html { redirect_to target, (referrer.blank? ? nil : params) }
     end
   end
+
+  # Intercept 404/500 etc. errors and display a custom page
+  def render_optional_error_file(status_code)
+    if status_code == :unauthorized
+      render_401
+    elsif status_code == :not_found
+      render_404
+    elsif status_code == :internal_server_error
+      render_500
+    else
+      super
+    end
+  end
+
+  def render_401(message = nil)
+    @message = message
+    respond_to do |format|
+      format.html { render :template => "errors/401", :status => 401 }
+      format.xml do
+        headers["WWW-Authenticate"] = %(Basic realm="Web Password")
+        render :nothing => true, :status => 401
+      end
+      format.all { render :nothing => true, :status => 401 }
+    end
+  end
+
+  def render_404(message = nil)
+    @message = message
+    respond_to do |format|
+      format.html { render :template => "errors/404", :status => 404 }
+      format.all { render :nothing => true, :status => 404 }
+    end
+  end
+
+  def render_500(message = nil)
+    @message = message
+    respond_to do |format|
+      format.html { render :template => "errors/500", :status => 500 }
+      format.all { render :nothing => true, :status => 500 }
+    end
+  end
+
+  def check_context
+    if params[:user_id]
+      @context = User.find_by_id(params[:user_id])
+      error("User not found") if @context.nil?
+    elsif params[:network_id]
+      @context = Network.find_by_id(params[:network_id])
+      error("Group not found") if @context.nil?
+    end
+  end
+
+  # Selects layout (aka skin) for contributables/groups or uses site's default.
+  # Sets a variable that is used for choosing the right stylesheets etc., then returns the layout name for rails
+  #  to render the view with.
+  def configure_layout
+    contributable = (@workflow || @pack || @blob)
+    layout = nil
+
+    # For testing skins
+    if params["layout_preview"]
+      layout = Conf.layouts[params["layout_preview"]]
+    # Skins on resources
+    elsif contributable && contributable.contribution && contributable.contribution.policy
+      if contributable.contribution.policy.layout
+        layout = Conf.layouts[contributable.contribution.policy.layout]
+        if layout.nil?
+          logger.error("Missing layout for #{contributable.class.name} #{contributable.id}: "+
+                      "#{contributable.contribution.policy.layout}")
+        end
+      end
+    # Skins on groups, or when in a group context
+    elsif (network = @network) || (@context.is_a?(Network) && (network = @context))
+      layout = network.layout
+    end
+
+    # Check skin exists
+    if layout && layout["layout"] && !File.exists?("#{RAILS_ROOT}/app/views/layouts/#{layout["layout"]}.html.erb")
+      logger.error("Missing layout #{RAILS_ROOT}/app/views/layouts/#{layout["layout"]}.html.erb")
+      layout = nil
+    end
+
+    # Use default skin if all else fails
+    if layout.nil?
+      @layout = {"layout" => 'application', "stylesheets" => [Conf.stylesheet]}
+    else
+      @layout = layout
+    end
+
+    @layout["layout"]
+  end
+
 end

Modified: branches/events/app/controllers/blobs_controller.rb (3490 => 3491)


--- branches/events/app/controllers/blobs_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/blobs_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -15,6 +15,8 @@
   before_filter :set_sharing_mode_variables, : [:show, :new, :create, :edit, :update]
   
   before_filter :check_is_owner, : [:edit, :update, :suggestions, :process_suggestions]
+
+  before_filter :check_context, : :index
   
   # declare sweepers and which actions should invoke them
   cache_sweeper :blob_sweeper, : [ :create, :update, :destroy ]
@@ -38,7 +40,7 @@
     
     send_data(@version.content_blob.data, :filename => @version.local_name, :type => @version.content_type.mime_type)
     
-    #send_file("#{RAILS_ROOT}/#{controller_name}/address@hidden/address@hidden/address@hidden", :filename => @blob.local_name, :type => @blob.content_type.mime_type)
+    #send_file("#{Rails.root}/#{controller_name}/address@hidden/address@hidden/address@hidden", :filename => @blob.local_name, :type => @blob.content_type.mime_type)
   end
 
   # GET /files/:id/download/:name
@@ -68,6 +70,20 @@
     respond_to do |format|
       format.html {
 
+        @query = params[:query]
+        @query_type = 'files'
+        pivot_options = Conf.pivot_options.dup
+        unless @query.blank?
+          pivot_options["order"] = [{"order" => "id ASC", "option" => "relevance", "label" => "Relevance"}] + pivot_options["order"]
+        end
+
+        locked_filters = { 'CATEGORY' => 'Blob' }
+
+        if @context
+          context_filter = visible_name(@context).upcase + "_ID"
+          locked_filters[context_filter] = @context.id.to_s
+        end
+
         @pivot, problem = calculate_pivot(
 
             :pivot_options  => Conf.pivot_options,
@@ -76,7 +92,7 @@
             :search_models  => [Blob],
             :search_limit   => Conf.max_search_size,
 
-            :locked_filters => { 'CATEGORY' => 'Blob' },
+            :locked_filters => locked_filters,
 
             :active_filters => ["CATEGORY", "TYPE_ID", "TAG_ID", "USER_ID",
                                 "LICENSE_ID", "GROUP_ID", "WSDL_ENDPOINT",
@@ -85,9 +101,6 @@
 
         flash.now[:error] = problem if problem
 
-        @query = params[:query]
-        @query_type = 'files'
-
         # index.rhtml
       }
     end
@@ -148,7 +161,10 @@
       @blob = Blob.new(params[:blob])
       @blob.content_blob = ContentBlob.new(:data ="" data)
 
-      @blob.content_type = ContentType.find_or_create_by_mime_type(:user => current_user, :mime_type => content_type, :category=> 'Blob')
+      @blob.content_type = ContentType.find_or_create_by_mime_type(:user => current_user,
+                                                                   :title => content_type,
+                                                                   :mime_type => content_type,
+                                                                   :category=> 'Blob')
 
       respond_to do |format|
         if @blob.save
@@ -162,13 +178,12 @@
           @blob.contribution.update_attributes(params[:contribution])
         
           policy_err_msg = update_policy(@blob, params)
-          update_layout(@blob, params[:layout])
-        
+
           update_credits(@blob, params)
           update_attributions(@blob, params, current_user)
         
           if policy_err_msg.blank?
-
+            update_layout(@blob, params[:layout]) unless params[:policy_type] == "group"
             @version = @blob.find_version(1)
 
             format.html {
@@ -212,7 +227,10 @@
     if params[:blob][:data] && params[:blob][:data].size > 0
       @blob.build_content_blob(:data ="" params[:blob][:data].read)
       @blob.local_name = params[:blob][:data].original_filename
-      @blob.content_type = ContentType.find_or_create_by_mime_type(:user => current_user, :title => params[:blob][:data].content_type, :mime_type => params[:blob][:data].content_type, :category => 'Blob')
+      @blob.content_type = ContentType.find_or_create_by_mime_type(:user => current_user,
+                                                                   :title => params[:blob][:data].content_type,
+                                                                   :mime_type => params[:blob][:data].content_type,
+                                                                   :category => 'Blob')
     end
 
     params[:blob].delete(:data)
@@ -231,9 +249,10 @@
         policy_err_msg = update_policy(@blob, params)
         update_credits(@blob, params)
         update_attributions(@blob, params, current_user)
-        update_layout(@blob, params[:layout])
-        
+
         if policy_err_msg.blank?
+          update_layout(@blob, params[:layout]) unless params[:policy_type] == "group"
+
           format.html {
 
             if @blob.new_version_number
@@ -299,7 +318,7 @@
     @blob.tags_user_id = current_user # acts_as_taggable_redux
     @blob.tag_list = "address@hidden, #{convert_tags_to_gem_format params[:tag_list]}" if params[:tag_list]
     @blob.update_tags # hack to get around acts_as_versioned
-    @blob.solr_save if Conf.solr_enable
+    @blob.solr_index if Conf.solr_enable
     
     respond_to do |format|
       format.html { 
@@ -441,13 +460,13 @@
 
       else
         if logged_in? 
-          error("File not found (id not authorized)", "is invalid (not authorized)")
+          render_401("You are not authorized to access this file.")
         else
           find_blob_auth if login_required
         end
       end
     rescue ActiveRecord::RecordNotFound
-      error("File not found", "is invalid")
+      render_404("File not found.")
     end
   end
   
@@ -475,7 +494,7 @@
   
   def check_is_owner
     if @blob
-      error("You are not authorised to manage this File", "") unless @blob.owner?(current_user)
+      render_401("You are not authorised to manage this file.") unless @blob.owner?(current_user)
     end
   end
   

Deleted: branches/events/app/controllers/blog_posts_controller.rb (3490 => 3491)


--- branches/events/app/controllers/blog_posts_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/blog_posts_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,139 +0,0 @@
-# myExperiment: app/controllers/blog_posts_controller.rb
-#
-# Copyright (c) 2007 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-class BlogPostsController < ApplicationController
-  before_filter :login_required
-  
-  before_filter :find_blog_and_blog_posts, : [:index]
-  before_filter :find_blog_and_blog_post, : [:show, :edit, :update, :destroy]
-  before_filter :find_blog_auth, : [:new]
-  
-  # GET /blog_posts
-  def index
-    respond_to do |format|
-      format.html # index.rhtml
-    end
-  end
-
-  # GET /blog_posts/1
-  def show
-    respond_to do |format|
-      format.html # show.rhtml
-    end
-  end
-
-  # GET /blog_posts/new
-  def new
-    @blog_post = BlogPost.new(:blog => @blog)
-  end
-
-  # GET /blog_posts/1;edit
-  def edit
-
-  end
-
-  # POST /blog_posts
-  def create
-
-    return error('Creating new blog content is disabled', 'is disabled')
-    
-    @blog_post = BlogPost.new(params[:blog_post])
-
-    respond_to do |format|
-      if @blog_post.save
-        flash[:notice] = 'BlogPost was successfully created.'
-        format.html { redirect_to blog_url(@blog_post.blog) }
-      else
-        format.html { render :action ="" "new" }
-      end
-    end
-  end
-
-  # PUT /blog_posts/1
-  def update
-    respond_to do |format|
-      if @blog_post.update_attributes(params[:blog_post])
-        flash[:notice] = 'BlogPost was successfully updated.'
-        format.html { redirect_to blog_url(@blog_post.blog) }
-      else
-        format.html { render :action ="" "edit" }
-      end
-    end
-  end
-
-  # DELETE /blog_posts/1
-  def destroy
-    @blog_post.destroy
-
-    respond_to do |format|
-      format.html { redirect_to blog_url(@blog_post.blog) }
-    end
-  end
-  
-protected
-
-  def find_blog_auth
-
-    action_permissions = {
-      "create"  => "create",
-      "destroy" => "destroy",
-      "edit"    => "edit",
-      "index"   => "view",
-      "new"     => "create",
-      "show"    => "view",
-      "update"  => "edit"
-    }
-
-    begin
-      blog = Blog.find(params[:blog_id])
-      
-      if Authorization.check(action_permissions[action_name], blog, current_user)
-        @blog = blog
-      else
-        error("Blog not found (id not authorized)", "is invalid (not authorized)")
-      end
-    rescue ActiveRecord::RecordNotFound
-      error("Blog not found", "is invalid")
-    end
-  end
-  
-  def find_blog_posts
-    options = { :order => "created_at DESC" }
-    options = options.merge({ :conditions => ["blog_id = ?", @blog.id] }) if @blog
-    
-    @blog_posts = BlogPost.find(:all, options)
-  end
-  
-  def find_blog_post
-    begin
-      @blog_post = BlogPost.find(params[:id], :conditions => ["blog_id = ?", @blog.id])
-    rescue ActiveRecord::RecordNotFound
-      error("Blog Post not found", "is invalid")
-    end
-  end
-  
-  def find_blog_and_blog_posts
-    find_blog_auth
-    
-    find_blog_posts if @blog
-  end
-  
-  def find_blog_and_blog_post
-    find_blog_auth
-    
-    find_blog_post if @blog
-  end
-  
-private
-
-  def error(notice, message, attr=:id)
-    flash[:error] = notice
-    (err = BlogPost.new.errors).add(attr, message)
-    
-    respond_to do |format|
-      format.html { redirect_to blog_blog_posts_url(params[:blog_id]) }
-    end
-  end
-end

Deleted: branches/events/app/controllers/blogs_controller.rb (3490 => 3491)


--- branches/events/app/controllers/blogs_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/blogs_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,151 +0,0 @@
-# myExperiment: app/controllers/blogs_controller.rb
-#
-# Copyright (c) 2007 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-class BlogsController < ApplicationController
-  before_filter :login_required, :except => [:index, :show]
-  
-  before_filter :find_blogs, : [:index]
-  #before_filter :find_blog_auth, : [:show, :edit, :update, :destroy]
-  before_filter :find_blog_auth, :except => [:index, :new, :create, :update, :destroy]
-  
-  # GET /blogs
-  def index
-    respond_to do |format|
-      format.html # index.rhtml
-    end
-  end
-
-  # GET /blogs/1
-  def show
-    @viewing = Viewing.create(:contribution => @blog.contribution, :user => (logged_in? ? current_user : nil))
-    
-    @sharing_mode  = @blog.contribution.policy.share_mode
-    
-    respond_to do |format|
-      format.html # show.rhtml
-    end
-  end
-
-  # GET /blogs/new
-  def new
-    @blog = Blog.new
-
-    @sharing_mode  = 0
-  end
-
-  # GET /blogs/1;edit
-  def edit
-    @sharing_mode  = @blog.contribution.policy.share_mode
-  end
-
-  # POST /blogs
-  def create
-
-    return error('Creating new blog content is disabled', 'is disabled')
-
-    params[:blog][:contributor_type] = "User"
-    params[:blog][:contributor_id]   = current_user.id
-    
-    @blog = Blog.new(params[:blog])
-    
-    respond_to do |format|
-      if @blog.save
-
-        @blog.contribution.update_attributes(params[:contribution])
-
-        update_policy(@blog, params)
-        
-        flash[:notice] = 'Blog was successfully created.'
-        format.html { redirect_to blog_url(@blog) }
-      else
-        format.html { render :action ="" "new" }
-      end
-    end
-  end
-
-  # PUT /blogs/1
-  def update
-    
-    # remove protected columns
-    if params[:blog]
-      [:contributor_id, :contributor_type, :created_at, :updated_at].each do |column_name|
-        params[:blog].delete(column_name)
-      end
-    end
-    
-    respond_to do |format|
-      if @blog.update_attributes(params[:blog])
-        
-        # security fix (only allow the owner to change the policy)
-        @blog.contribution.update_attributes(params[:contribution]) if @blog.contribution.owner?(current_user)
-        
-        update_policy(@blog, params)
-
-        flash[:notice] = 'Blog was successfully updated.'
-        format.html { redirect_to blog_url(@blog) }
-      else
-        format.html { render :action ="" "edit" }
-      end
-    end
-  end
-
-  # DELETE /blogs/1
-  def destroy
-    @blog.destroy
-
-    respond_to do |format|
-      format.html { redirect_to blogs_url }
-    end
-  end
-  
-protected
-
-  def find_blogs
-    @blogs = Blog.find(:all, 
-                       :order => "title ASC, created_at DESC",
-                       :page => { :size => 20, 
-                                  :current => params[:page] })
-  end
-  
-  def find_blog_auth
-
-    action_permissions = {
-      "create"  => "create",
-      "destroy" => "destroy",
-      "edit"    => "edit",
-      "index"   => "view",
-      "new"     => "create",
-      "show"    => "view",
-      "update"  => "edit",
-    }
-
-    begin
-      blog = Blog.find(params[:id])
-      
-      if Authorization.check(action_permissions[action_name], blog, current_user)
-        @blog = blog
-      else
-        if logged_in? 
-          error("Blog not found (id not authorized)", "is invalid (not authorized)")
-        else
-          find_blog_auth if login_required
-        end
-      end
-    rescue ActiveRecord::RecordNotFound
-      error("Blog not found", "is invalid")
-    end
-  end
-  
-private
-
-  def error(notice, message, attr=:id)
-    flash[:error] = notice
-    (err = Blog.new.errors).add(attr, message)
-    
-    respond_to do |format|
-      format.html { redirect_to blogs_url }
-    end
-  end
-end

Modified: branches/events/app/controllers/bookmarks_controller.rb (3490 => 3491)


--- branches/events/app/controllers/bookmarks_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/bookmarks_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -6,7 +6,6 @@
 class BookmarksController < ApplicationController
   before_filter :login_required
   
-  before_filter :find_bookmarks_auth, : [:index]
   before_filter :find_bookmark_auth, : [:show, :edit, :update, :destroy]
 
   # declare sweepers and which actions should invoke them
@@ -37,14 +36,6 @@
   
 protected
 
-  def find_bookmarks_auth
-    @bookmarks = Bookmark.find(:all, 
-                               :conditions => ["user_id = ?", current_user.id], 
-                               :order => "created_at DESC",
-                               :page => { :size => 20, 
-                                          :current => params[:page] })
-  end
-  
   def find_bookmark_auth
     begin
       @bookmark = Bookmark.find(params[:id], :conditions => ["user_id = ?", current_user.id])

Modified: branches/events/app/controllers/comments_controller.rb (3490 => 3491)


--- branches/events/app/controllers/comments_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/comments_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -39,7 +39,7 @@
 
       if success
         Activity.create(:subject => current_user, :action ="" 'create', :objekt => comment, :auth => @context)
-        @context.solr_save if @context.respond_to?(:solr_save)
+        @context.solr_index if @context.respond_to?(:solr_index)
       end
     end
     
@@ -55,7 +55,7 @@
   # DELETE /:context_type/:context_id/comments/:id
   def destroy
     @comment.destroy
-    @context.solr_save if @context.respond_to?(:solr_save)
+    @context.solr_index if @context.respond_to?(:solr_index)
     
     respond_to do |format|
       format.html { render :partial => "comments/comments", :locals => { :commentable => @context } }

Modified: branches/events/app/controllers/content_types_controller.rb (3490 => 3491)


--- branches/events/app/controllers/content_types_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/content_types_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -12,8 +12,13 @@
 
     params[:num] = 25 unless params[:num]
 
-    @content_types = ContentType.find(:all, :order => 'title ASC',
-        :page => { :size => params[:num], :current => params[:page] })
+    if params[:mime_type]
+      @content_types = ContentType.find_all_by_mime_type(params[:mime_type], :order => 'title ASC')
+    else
+      @content_types = ContentType.find(:all, :order => 'title ASC')
+    end
+
+    @content_types = @content_types.paginate(:page => params[:page], :per_page => params[:num])
   end
 
   # GET /content_types/1

Modified: branches/events/app/controllers/feedback_controller.rb (3490 => 3491)


--- branches/events/app/controllers/feedback_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/feedback_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,3 +1,5 @@
+require 'recaptcha'
+
 class FeedbackController < ApplicationController
   before_filter :only_index, :except => [:index, :create]
   

Copied: branches/events/app/controllers/group_policies_controller.rb (from rev 3490, trunk/app/controllers/group_policies_controller.rb) (0 => 3491)


--- branches/events/app/controllers/group_policies_controller.rb	                        (rev 0)
+++ branches/events/app/controllers/group_policies_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,120 @@
+# myExperiment: app/controllers/group_policies_controller.rb
+#
+# Copyright (c) 2013 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class GroupPoliciesController < ApplicationController
+
+  include ApplicationHelper
+  
+  before_filter :login_required
+  before_filter :find_group
+  before_filter :find_policy, : [:show, :edit, :update, :destroy]
+  before_filter :check_admin
+
+  def index
+    @policies = Policy.find_all_by_contributor_type_and_contributor_id('Network', @group.id)
+
+    respond_to do |format|
+      format.html
+    end
+  end
+
+  def show
+    respond_to do |format|
+      format.html { render :action ="" "edit" }
+    end
+  end
+
+  def new
+    @policy = Policy.new
+  end
+
+  def edit
+    
+  end
+
+  def create
+    @policy = Policy.new(:name => params[:name],
+                         :contributor => @group,
+                         :share_mode  => params[:share_mode],
+                         :update_mode => 6
+    )
+
+    respond_to do |format|
+      if @policy.save
+        process_permissions(@policy, params)
+        update_layout(@policy, params[:layout])
+        flash[:notice] = 'Policy was successfully created.'
+        format.html { redirect_to network_policies_path(@group) }
+      else
+        format.html { render :action ="" "new" }
+      end
+    end
+  end
+
+  def update
+    respond_to do |format|
+      if @policy.update_attributes(:name => params[:name], :share_mode => params[:share_mode])
+        process_permissions(@policy, params)
+        update_layout(@policy, params[:layout])
+        flash[:notice] = 'Policy was successfully updated'
+        format.html { redirect_to network_policies_path(@group) }
+      else
+        format.html { render :action ="" "edit" }
+      end
+    end
+  end
+
+  def destroy
+    if @policy.contributions.size == 0
+      @policy.destroy
+
+      respond_to do |format|
+        flash[:notice] = "Policy was successfully deleted"
+        format.html { redirect_to network_policies_path(@group) }
+      end
+    else
+      error("This policy is being used by address@hidden resources and may not be deleted.")
+    end
+  end
+  
+  
+  protected
+  
+  def find_group
+    begin
+      @group = Network.find(params[:network_id])
+    rescue ActiveRecord::RecordNotFound
+      error("Group couldn't be found")
+    end
+  end
+
+  def find_policy
+    begin
+      @policy = Policy.find(params[:id])
+    rescue ActiveRecord::RecordNotFound
+      error("Policy couldn't be found")
+    end
+  end
+
+  
+  def check_admin
+    unless @group.administrator?(current_user.id)
+      error("Only group administrators are allowed to manage policies")
+    end
+  end
+
+  private
+
+  def error(message)
+    flash[:error] = message
+    return_to_path = @group.nil? ? networks_path : network_policies_path(@group)
+    
+    respond_to do |format|
+      format.html { redirect_to return_to_path }
+    end
+  end
+
+  
+end

Modified: branches/events/app/controllers/messages_controller.rb (3490 => 3491)


--- branches/events/app/controllers/messages_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/messages_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -18,10 +18,10 @@
     @message_folder = "inbox"
     @messages = Message.find(:all, 
                              :conditions => ["`to` = ? AND `deleted_by_recipient` = ?", current_user.id, false],
-                             :order => produce_sql_ordering_string(params[:sort_by], params[:order]),
-                             :page => { :size => 20, 
-                                        :current => params[:page] })
+                             :order => produce_sql_ordering_string(params[:sort_by], params[:order]))
     
+    @messages = @messages.paginate(:page => params[:page], :per_page => 20)
+
     respond_to do |format|
       format.html # index.rhtml
     end
@@ -33,10 +33,10 @@
     @message_folder = "outbox"
     @messages = Message.find(:all, 
                              :conditions => ["`from` = ? AND `deleted_by_sender` = ?", current_user.id, false],
-                             :order => produce_sql_ordering_string(params[:sort_by], params[:order]),
-                             :page => { :size => 20, 
-                                        :current => params[:page] })
+                             :order => produce_sql_ordering_string(params[:sort_by], params[:order]))
     
+    @messages = @messages.paginate(:page => params[:page], :per_page => 20)
+
     respond_to do |format|
       format.html # sent.rhtml
     end
@@ -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/events/app/controllers/networks_controller.rb (3490 => 3491)


--- branches/events/app/controllers/networks_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/networks_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -3,11 +3,16 @@
 # Copyright (c) 2007 University of Manchester and the University of Southampton.
 # See license.txt for details.
 
+require 'recaptcha'
+
 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]
   
@@ -250,99 +255,8 @@
 
   # GET /networks/1
   def show
-
-    @item_sort_options = [
-      ["rank",          "Rank"],
-      ["most_recent",   "Most recent"],
-      ["title",         "Title"],
-      ["uploader",      "Uploader"],
-      ["last_updated",  "Last updated"],
-      ["rating",        "User rating"],
-      ["licence",       "Licence"],
-      ["content_type",  "Content Type"]
-    ]
-
     @shared_items = @network.shared_contributions
 
-    case params[:item_sort]
-
-      when "rank"; @shared_items.sort! do |a, b|
-        b.rank <=> a.rank
-      end
-
-      when "title"; @shared_items.sort! do |a, b|
-        a.contributable.label <=> b.contributable.label
-      end
-
-      when "most_recent"; @shared_items.sort! do |a, b|
-        b.contributable.created_at <=> a.contributable.created_at
-      end
-
-      when "uploader"; @shared_items.sort! do |a, b|
-        if a.contributor.label == b.contributor.label
-          b.rank <=> a.rank
-        else
-          a.contributor.label <=> b.contributor.label
-        end
-      end
-
-      when "last_updated"; @shared_items.sort! do |a, b|
-        b.contributable.updated_at <=> a.contributable.updated_at
-      end
-
-      when "rating"; @shared_items.sort! do |a, b|
-
-        a_rating = a.rating
-        b_rating = b.rating
-
-        if a_rating == b_rating
-          b.rank <=> a.rank
-        else
-          b.rating <=> a.rating
-        end
-      end
-
-      when "licence"; @shared_items.sort! do |a, b|
-
-        a_has_licence = a.contributable.respond_to?('license')
-        b_has_licence = b.contributable.respond_to?('license')
-
-        if (a_has_licence && b_has_licence)
-          if a.contributable.license == b.contributable.license
-            b.rank <=> a.rank
-          else
-            a.contributable.license.title <=> b.contributable.license.title
-          end
-        elsif (a_has_licence && !b_has_licence)
-          -1
-        elsif (!a_has_licence && b_has_licence)
-          1
-        else
-          b.rank <=> a.rank
-        end
-      end
-
-      when "content_type"; @shared_items.sort! do |a, b|
-
-        a_has_content_type = a.contributable.respond_to?('content_type')
-        b_has_content_type = b.contributable.respond_to?('content_type')
-
-        if (a_has_content_type && b_has_content_type)
-          if a.contributable.content_type == b.contributable.content_type
-            b.rank <=> a.rank
-          else
-            a.contributable.content_type.title <=> b.contributable.content_type.title
-          end
-        elsif (a_has_content_type && !b_has_content_type)
-          -1
-        elsif (!a_has_content_type && b_has_content_type)
-          1
-        else
-          b.rank <=> a.rank
-        end
-      end
-    end
-
     respond_to do |format|
       format.html {
          
@@ -362,6 +276,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)
@@ -374,6 +313,9 @@
 
   # POST /networks
   def create
+
+    params[:network][:user_id] = current_user.id
+
     @network = Network.new(params[:network])
 
     respond_to do |format|
@@ -394,6 +336,9 @@
 
   # PUT /networks/1
   def update
+
+    params[:network].delete(:user_id)
+
     respond_to do |format|
       if @network.update_attributes(params[:network])
         Activity.create(:subject => current_user, :action ="" 'edit', :objekt => @network)
@@ -421,7 +366,7 @@
     @network.tags_user_id = current_user
     @network.tag_list = "address@hidden, #{convert_tags_to_gem_format params[:tag_list]}" if params[:tag_list]
     @network.update_tags # hack to get around acts_as_versioned
-    @network.solr_save if Conf.solr_enable
+    @network.solr_index if Conf.solr_enable
     
     respond_to do |format|
       format.html { 
@@ -453,9 +398,7 @@
   def find_networks
     @networks = Network.find(:all, 
                              :order => "title ASC",
-                             :page => { :size => 20, 
-                                        :current => params[:page] },
-                             :include => [ :owner ])
+                             :include => [ :owner ]).paginate(:page => params[:page], :per_page => 20)
   end
 
   def find_network
@@ -471,9 +414,12 @@
 
   def find_network_auth_owner
     begin
-      @network = Network.find(params[:id], :conditions => ["networks.user_id = ?", current_user.id], :include => [ :owner, :memberships ])
+      @network = Network.find(params[:id], :include => [ :owner, :memberships ])
+      unless @network.owner == current_user || current_user.admin?
+        error("Group not found (id not authorized)", "is invalid (not group administrator)")
+      end
     rescue ActiveRecord::RecordNotFound
-      error("Group not found (id not authorized)", "is invalid (not group adminsitrator)")
+      error("Group not found (id not authorized)", "is invalid (not group administrator)")
     end
   end
   

Modified: branches/events/app/controllers/oauth_controller.rb (3490 => 3491)


--- branches/events/app/controllers/oauth_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/oauth_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -41,38 +41,30 @@
     end
     @address@hidden
     redirect_url=params[:oauth_callback]||@token.client_application.callback_url
-    if (@token.client_application.key_type == 'System') || @client_applications.include?(@token.client_application)
-      unless @token.invalidated?
-        if request.post?
-          if params[:authorize]=='1'
-            @token.authorize!(current_user)
-            if redirect_url
-              redirect_to redirect_url+"address@hidden"
-            else
-              render :action=""
-            end
-          elsif params[:commit]=="Save Changes"
-            @token.invalidate!
-            if redirect_url
-              redirect_to redirect_url+"?oauth_failure=1"
-            else
-              render :action=""
-            end
+    unless @token.invalidated?
+      if request.post?
+        if params[:authorize]=='1'
+          @token.authorize!(current_user)
+          if redirect_url
+            redirect_to redirect_url+"address@hidden"
+          else
+            render :action=""
           end
+        elsif params[:commit]=="Save Changes"
+          @token.invalidate!
+          if redirect_url
+            redirect_to redirect_url+"?oauth_failure=1"
+          else
+            render :action=""
+          end
         end
-      else
-       if redirect_url
-         redirect_to redirect_url+"?oauth_failure=1"
-       else
-         render :action=""
-       end
       end
     else
-       if redirect_url
-         redirect_to redirect_url+"?oauth_failure=1"
-       else
-         render :action=""
-       end
+     if redirect_url
+       redirect_to redirect_url+"?oauth_failure=1"
+     else
+       render :action=""
+     end
     end
   end
 
@@ -87,7 +79,6 @@
 
   def index
     @client_applications=current_user.client_applications
-    @admin_client_applications=ClientApplication.find(:all, :conditions => ["user_id != ? and creator_id = ?", current_user.id, current_user.id])
     @tokens=current_user.tokens.find :all, :conditions=>'oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null'
   end
 
@@ -110,23 +101,20 @@
       flash[:notice]="Client Application successfully registered!"
       redirect_to :action=""
     else
+      @permissions = TABLES['REST'][:data]
+      @address@hidden
+      @permissions_for=params[:key_permissions]
       render :action=""
     end
   end
 
   def show
-    if (!(@client_application.user_id == current_user.id or @client_application.creator_id == current_user.id))
-      @client_application = nil
-    end
     @address@hidden
   end
 
   def edit
     @permissions = TABLES['REST'][:data]
     @address@hidden
-    if (!(@client_application.user_id == current_user.id or @client_application.creator_id == current_user.id))
-        @client_application = nil
-    end
     @address@hidden
     unless @client_application.nil?
       @address@hidden
@@ -134,13 +122,11 @@
   end
 
   def update
-    if (current_user.admin? or @client_application.key_type=="User")
-      @client_application.permissions.delete_all
-      if params[:key_permissions] 
-        for key_permission in params[:key_permissions] do
-          @key_permission = KeyPermission.new(:client_application_id => @client_application.id, :for ="" key_permission[0])
-           @key_permission.save
-        end
+    @client_application.permissions.delete_all
+    if params[:key_permissions]
+      for key_permission in params[:key_permissions] do
+        @key_permission = KeyPermission.new(:client_application_id => @client_application.id, :for ="" key_permission[0])
+         @key_permission.save
       end
     end
     if @client_application.update_attributes(params[:client_application])
@@ -168,7 +154,8 @@
       "index"         => "view",
       "request_token" => "view",
       "test_request"  => "view",
-      "show"          => "view"
+      "show"          => "view",
+      "update"        => "edit"
     }
 
     if action_name == 'update'
@@ -178,13 +165,13 @@
     end
     begin
       client_app=ClientApplication.find(id)
-      if Authorization.check(action_permissions[action_name], client_app, current_user)
+      if Authorization.check(action_permissions[action_name] || action_name, client_app, current_user)
         @client_application = client_app
       else
-        error("Client Application not found (id not authorized)", "is invalid (not authorized)")
+        render_401
       end
     rescue ActiveRecord::RecordNotFound
-      error("Client Application not found", "is invalid")
+      render_404("Client Application not found")
     end
   end
 

Modified: branches/events/app/controllers/openid_controller.rb (3490 => 3491)


--- branches/events/app/controllers/openid_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/openid_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -72,7 +72,7 @@
   def consumer
     # create the OpenID store for storing associations and nonces,
     # putting it in your app's db directory
-    store_dir = Pathname.new(RAILS_ROOT).join('db').join('openid-store')
+    store_dir = Pathname.new(Rails.root).join('db').join('openid-store')
     store = OpenID::Store::Filesystem.new(store_dir)
 
     return OpenID::Consumer.new(session, store)

Modified: branches/events/app/controllers/packs_controller.rb (3490 => 3491)


--- branches/events/app/controllers/packs_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/packs_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -11,7 +11,9 @@
   before_filter :find_pack_auth, :except => [:index, :new, :create, :search]
   
   before_filter :set_sharing_mode_variables, : [:show, :new, :create, :edit, :update]
-  
+
+  before_filter :check_context, : :index
+
   # declare sweepers and which actions should invoke them
   cache_sweeper :pack_sweeper, : [ :create, :update, :destroy ]
   cache_sweeper :pack_entry_sweeper, : [ :create_item, :quick_add, :update_item, :destroy_item ]
@@ -30,6 +32,20 @@
     respond_to do |format|
       format.html {
 
+        @query = params[:query]
+        @query_type = 'packs'
+        pivot_options = Conf.pivot_options.dup
+        unless @query.blank?
+          pivot_options["order"] = [{"order" => "id ASC", "option" => "relevance", "label" => "Relevance"}] + pivot_options["order"]
+        end
+
+        locked_filters = { 'CATEGORY' => 'Pack' }
+
+        if @context
+          context_filter = visible_name(@context).upcase + "_ID"
+          locked_filters[context_filter] = @context.id.to_s
+        end
+
         @pivot, problem = calculate_pivot(
 
             :pivot_options  => Conf.pivot_options,
@@ -38,7 +54,7 @@
             :search_models  => [Pack],
             :search_limit   => Conf.max_search_size,
 
-            :locked_filters => { 'CATEGORY' => 'Pack' },
+            :locked_filters => locked_filters,
 
             :active_filters => ["CATEGORY", "TYPE_ID", "TAG_ID", "USER_ID",
                                 "LICENSE_ID", "GROUP_ID", "WSDL_ENDPOINT",
@@ -47,9 +63,6 @@
 
         flash.now[:error] = problem if problem
 
-        @query = params[:query]
-        @query_type = 'packs'
-
         # index.rhtml
       }
     end
@@ -131,9 +144,8 @@
         
         # update policy
         policy_err_msg = update_policy(@pack, params)
-        update_layout(@pack, params[:layout])
-        
         if policy_err_msg.blank?
+          update_layout(@pack, params[:layout]) unless params[:policy_type] == "group"
           flash[:notice] = 'Pack was successfully created.'
           format.html { redirect_to pack_url(@pack) }
         else
@@ -160,9 +172,8 @@
       if @pack.update_attributes(params[:pack])
         @pack.refresh_tags(convert_tags_to_gem_format(params[:pack][:tag_list]), current_user) if params[:pack][:tag_list]
         policy_err_msg = update_policy(@pack, params)
-        update_layout(@pack, params[:layout])
-        
         if policy_err_msg.blank?
+          update_layout(@pack, params[:layout]) unless params[:policy_type] == "group"
           flash[:notice] = 'Pack was successfully updated.'
           format.html { redirect_to pack_url(@pack) }
         else
@@ -235,7 +246,7 @@
     @pack.tags_user_id = current_user # acts_as_taggable_redux
     @pack.tag_list = "address@hidden, #{convert_tags_to_gem_format params[:tag_list]}" if params[:tag_list]
     @pack.update_tags # hack to get around acts_as_versioned
-    @pack.solr_save if Conf.solr_enable
+    @pack.solr_index if Conf.solr_enable
     
     respond_to do |format|
       format.html { 
@@ -418,6 +429,24 @@
     end
   end
   
+  def snapshot
+
+    success = @pack.snapshot!
+
+    respond_to do |format|
+      format.html {
+        if success
+          @pack.reload
+          flash[:notice] = 'Pack snapshot was successfully created.'
+          redirect_to pack_version_path(@pack, @pack.versions.last.version)
+        else
+          flash[:error] = 'There was a problem with creating the snapshot.'
+          redirect_to pack_path(@pack)
+        end
+      }
+    end
+  end
+
   protected
   
   # Check that a protocol is specified in the URI; prepend HTTP:// otherwise
@@ -453,7 +482,8 @@
       "statistics"       => "view",
       "tag"              => "view",
       "update"           => "edit",
-      "update_item"      => "edit"
+      "update_item"      => "edit",
+      "snapshot"         => "edit"
     }
 
     begin
@@ -462,6 +492,8 @@
       if Authorization.check(action_permissions[action_name], pack, current_user)
         @pack = pack
         
+        @version = @pack.find_version(params[:version]) if params[:version]
+
         @authorised_to_edit = logged_in? && Authorization.check("edit", @pack, current_user)
         @authorised_to_download = Authorization.check("download", @pack, current_user)
         
@@ -471,10 +503,10 @@
                             
         @base_host = base_host
       else
-        error("You are not authorised to perform this action", "is not authorized")
+        render_401("You are not authorized to access this pack.")
       end
     rescue ActiveRecord::RecordNotFound
-      error("Pack not found", "is invalid")
+      render_404("Pack not found.")
     end
   end
   

Copied: branches/events/app/controllers/policies_controller.rb (from rev 3490, trunk/app/controllers/policies_controller.rb) (0 => 3491)


--- branches/events/app/controllers/policies_controller.rb	                        (rev 0)
+++ branches/events/app/controllers/policies_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,17 @@
+# myExperiment: app/controllers/group_policies_controller.rb
+#
+# Copyright (c) 2013 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class PoliciesController < ApplicationController
+
+  def show
+    @policy = Policy.find(params[:id])
+
+    unless current_user == @policy.contributor ||
+           @policy.contributor_type == 'Network' && @policy.contributor.administrator?(current_user.id)
+      render :code => 401
+    end
+  end
+
+end

Modified: branches/events/app/controllers/profiles_controller.rb (3490 => 3491)


--- branches/events/app/controllers/profiles_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/profiles_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -7,7 +7,6 @@
 
   before_filter :login_required, :except => [:index, :show]
 
-  before_filter :find_profiles, : [:index]
   before_filter :find_profile, :except => [:index]
   before_filter :auth, :except => [:index, :show]
   
@@ -101,14 +100,6 @@
   
 protected
 
-  def find_profiles
-    @profiles = Profile.find(:all, 
-                             :include => :owner, 
-                             :order => "users.name ASC",
-                             :page => { :size => 20, 
-                                        :current => params[:page] })
-  end
-
   def find_profile
     begin
       @user = User.find(params[:user_id])

Modified: branches/events/app/controllers/search_controller.rb (3490 => 3491)


--- branches/events/app/controllers/search_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/search_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -29,7 +29,11 @@
     end
 
     if @type == "all"
-      search_all
+      if shortcut = Conf.shortcut_keywords[params[:query].downcase]
+        redirect_to(shortcut)
+      else
+        search_all
+      end
     else
       case params[:type]
       when 'workflows'
@@ -150,7 +154,10 @@
       begin
         query = params["q"].downcase
 
-        results = User.multi_solr_search(query, :models => [Workflow, Blob, User], :limit => 25).results
+        results = Sunspot.search [Workflow, Blob, User] do
+          fulltext query
+          adjust_solr_params { |p| p[:defType] = 'edismax' }
+        end.results
 
         results.each do |result|
           case result.class.name
@@ -185,10 +192,12 @@
   def search_all
 
     @query = params[:query]
+    pivot_options = Conf.pivot_options.dup
+    pivot_options["order"] = [{"order" => "id ASC", "option" => "relevance", "label" => "Relevance"}] + pivot_options["order"]
 
     @pivot, problem = calculate_pivot(
 
-        :pivot_options    => Conf.pivot_options,
+        :pivot_options    => pivot_options,
         :params           => params,
         :user             => current_user,
         :search_models    => [Workflow, Blob, Pack, User, Network, Service],
@@ -207,7 +216,7 @@
     model_name = params[:type].singularize.camelize
     model_name = Conf.model_aliases[model_name] if Conf.model_aliases[model_name]
 
-    model = eval(model_name)
+    model = model_name.constantize
 
     @collection_label = params[:type].singularize
     @controller_name  = model_name.underscore.pluralize
@@ -217,6 +226,8 @@
     @query = params[:query] || ''
     @query.strip!
 
+    query = @query
+
     limit = params[:num] ? params[:num] : Conf.default_search_size
 
     limit = 1                    if limit < 1
@@ -226,9 +237,15 @@
 
     if Conf.solr_enable && address@hidden
       begin
-        solr_results = model.find_by_solr(@query.downcase, :offset => offset, :limit => limit)
-        @total_count = solr_results.total
-        @collection  = PaginatedArray.new(solr_results.results,
+
+        search_results = model.search do
+          fulltext query.downcase
+          adjust_solr_params { |p| p[:defType] = 'edismax' }
+          paginate :page => params[:page], :per_page => limit
+        end
+
+        @total_count = search_results.total
+        @collection  = PaginatedArray.new(search_results.results,
             :offset => offset, :limit => limit, :total => @total_count)
       rescue
         flash.now[:error] = "There was a problem with your search query."

Modified: branches/events/app/controllers/services_controller.rb (3490 => 3491)


--- branches/events/app/controllers/services_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/services_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -8,19 +8,9 @@
   include ApplicationHelper
 
   before_filter :find_service,  : [:show]
-  before_filter :find_services, : [:all]
   
   # GET /algorithms;search
   def search
-#   @query = params[:query] || ''
-#   @query.strip!
-#   
-#   @contributables = (Conf.solr_enable && address@hidden) ? Algorithm.find_by_solr(@query, :limit => 100).results : []
-#   @total_count = (Conf.solr_enable && address@hidden) ? Algorithm.count_by_solr(@query) : 0
-#   
-#   respond_to do |format|
-#     format.html # search.rhtml
-#   end
   end
   
   # GET /services
@@ -67,13 +57,6 @@
   
   protected
   
-  def find_services
-    @contributables = Service.find(:all, 
-                       :order => "created_at DESC",
-                       :page => { :size => 20, 
-                       :current => params[:page] })
-  end
-  
   def find_service
     begin
       service = Service.find(params[:id])

Modified: branches/events/app/controllers/sessions_controller.rb (3490 => 3491)


--- branches/events/app/controllers/sessions_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/sessions_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -4,6 +4,7 @@
 # See license.txt for details.
 
 require 'uri'
+require 'open_id_authentication'
 require 'openid'
 require 'openid/extensions/sreg'
 require 'openid/store/filesystem'
@@ -178,7 +179,7 @@
   def consumer
     # create the OpenID store for storing associations and nonces,
     # putting it in your app's db directory
-    store_dir = Pathname.new(RAILS_ROOT).join('db').join('openid-store')
+    store_dir = Pathname.new(Rails.root).join('db').join('openid-store')
     store = OpenID::Store::Filesystem.new(store_dir)
 
     return OpenID::Consumer.new(session, store)

Modified: branches/events/app/controllers/topics_controller.rb (3490 => 3491)


--- branches/events/app/controllers/topics_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/topics_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,3 @@
-# -*- coding: undecided -*-
 # myExperiment: app/controllers/topics_controller.rb
 #
 # Copyright (c) 2007 University of Manchester and the University of Southampton.

Modified: branches/events/app/controllers/users_controller.rb (3490 => 3491)


--- branches/events/app/controllers/users_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/users_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -4,10 +4,11 @@
 # See license.txt for details.
 
 require 'open-uri'
+require 'recaptcha'
 
 class UsersController < ApplicationController
 
-  contributable_actions = [:workflows, :files, :packs, :blogs]
+  contributable_actions = [:workflows, :files, :packs]
   show_actions = [:show, :news, :friends, :groups, :credits, :tags, :favourites] + contributable_actions
 
   before_filter :login_required, :except => [:index, :new, :create, :search, :all, :confirm_email, :forgot_password, :reset_password] + show_actions
@@ -90,11 +91,6 @@
     render :action ="" 'show'
   end
 
-  def blogs
-    @tab = "Blogs"
-    render :action ="" 'show'
-  end
-
   def credits
     @tab = "Credits"
     render :action ="" 'show'
@@ -756,11 +752,11 @@
   def find_users
     @users = User.find(:all, 
                        :order => "users.name ASC",
-                       :page => { :size => 20, 
-                                  :current => params[:page] },
                        :conditions => "users.activated_at IS NOT NULL",
                        :include => :profile)
-                       
+
+    @users = @users.paginate(:page => params[:page], :per_page => 20)
+
     @users.each do |user|
       user.salt = nil
       user.crypted_password = nil

Modified: branches/events/app/controllers/workflows_controller.rb (3490 => 3491)


--- branches/events/app/controllers/workflows_controller.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/controllers/workflows_controller.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -21,6 +21,8 @@
   
   before_filter :check_is_owner, : [:edit, :update]
 
+  before_filter :check_context, : :index
+
   # declare sweepers and which actions should invoke them
   cache_sweeper :workflow_sweeper, : [ :create, :create_version, :launch, :update, :update_version, :destroy_version, :destroy ]
   cache_sweeper :download_viewing_sweeper, : [ :show, :download, :named_download, :galaxy_tool, :galaxy_tool_download, :launch ]
@@ -124,7 +126,7 @@
     end
 
     @workflow.reload
-    @workflow.solr_save if Conf.solr_enable
+    @workflow.solr_index if Conf.solr_enable
   end
   
   # GET /workflows/1;download
@@ -216,15 +218,29 @@
     respond_to do |format|
       format.html do
 
+        @query = params[:query]
+        @query_type = 'workflows'
+        pivot_options = Conf.pivot_options.dup
+        unless @query.blank?
+          pivot_options["order"] = [{"order" => "id ASC", "option" => "relevance", "label" => "Relevance"}] + pivot_options["order"]
+        end
+
+        locked_filters = { 'CATEGORY' => 'Workflow' }
+
+        if @context
+          context_filter = visible_name(@context).upcase + "_ID"
+          locked_filters[context_filter] = @context.id.to_s
+        end
+
         @pivot, problem = calculate_pivot(
 
-            :pivot_options  => Conf.pivot_options,
+            :pivot_options  => pivot_options,
             :params         => params,
             :user           => current_user,
             :search_models  => [Workflow],
             :search_limit   => Conf.max_search_size,
 
-            :locked_filters => { 'CATEGORY' => 'Workflow' },
+            :locked_filters => locked_filters,
 
             :active_filters => ["CATEGORY", "TYPE_ID", "TAG_ID", "USER_ID",
                                 "LICENSE_ID", "GROUP_ID", "WSDL_ENDPOINT",
@@ -233,9 +249,6 @@
 
         flash.now[:error] = problem if problem
 
-        @query = params[:query]
-        @query_type = 'workflows'
-
       end
       format.rss do
         address@hidden = Workflow.find(:all, :order => "updated_at DESC") # list all (if required)
@@ -357,7 +370,7 @@
         if params[:workflow][:tag_list]
           @workflow.refresh_tags(convert_tags_to_gem_format(params[:workflow][:tag_list]), current_user)
           @workflow.reload
-          @workflow.solr_save if Conf.solr_enable
+          @workflow.solr_index if Conf.solr_enable
         end
         
         begin
@@ -371,12 +384,11 @@
         update_credits(@workflow, params)
         update_attributions(@workflow, params, current_user)
 
-        update_layout(@workflow, params[:layout])
-        
         # Refresh the types handler list of types if a new type was supplied this time.
         WorkflowTypesHandler.refresh_all_known_types! if params[:workflow][:type] == 'other'
 
         if policy_err_msg.blank?
+          update_layout(@workflow, params[:layout]) unless params[:policy_type] == "group"
         	flash[:notice] = 'Workflow was successfully created.'
           format.html {
             if (@workflow.get_tag_suggestions.length > 0 || (@workflow.body.nil? || @workflow.body == ''))
@@ -482,6 +494,7 @@
         begin
           @workflow.extract_metadata
         rescue
+          raise unless Rails.env == 'production'
         end
 
         Activity.create(:subject => current_user, :action ="" 'create', :objekt => @workflow.versions.last, :extra => @workflow.versions.last.version, :auth => @workflow)
@@ -547,16 +560,15 @@
         if params[:workflow][:tag_list]
           @workflow.refresh_tags(convert_tags_to_gem_format(params[:workflow][:tag_list]), current_user)
           @workflow.reload
-          @workflow.solr_save if Conf.solr_enable
+          @workflow.solr_index if Conf.solr_enable
         end
 
         policy_err_msg = update_policy(@workflow, params)
         update_credits(@workflow, params)
         update_attributions(@workflow, params, current_user)
 
-        update_layout(@workflow, params[:layout])
-
         if policy_err_msg.blank?
+          update_layout(@workflow, params[:layout]) unless params[:policy_type] == "group"
           flash[:notice] = 'Workflow was successfully updated.'
           format.html { redirect_to workflow_url(@workflow) }
         else
@@ -645,7 +657,7 @@
     
     if params[:version]
       if @workflow.find_version(params[:version]) == false
-        error("Version not found (is invalid)", "not found (is invalid)", :version)
+        render_404("Workflow version not found.")
       end
       if @workflow.versions.length < 2
         error("Can't delete all versions", " is not allowed", :version)
@@ -785,7 +797,7 @@
             @viewing_version_number = params[:version].to_i
             @viewing_version = viewing
           else
-            error("Workflow version not found (possibly has been deleted)", "not found (is invalid)", :version)
+            render_404("Workflow version not found.")
           end
         else
           @viewing_version_number = @latest_version_number
@@ -820,12 +832,10 @@
         logger.debug("@viewing_version_number = address@hidden")
         logger.debug("@workflow.image != nil = address@hidden != nil}")
       else
-        error("Workflow not found (id not authorized)", "is invalid (not authorized)", nil, 401)
-        return false
+        render_401("You are not authorized to access this workflow.")
       end
     rescue ActiveRecord::RecordNotFound
-      error("Workflow not found", "is invalid")
-      return false
+      render_404("Workflow not found.")
     end
   end
   
@@ -937,7 +947,7 @@
   
   def check_is_owner
     if @workflow
-      error("You are not authorised to manage this Workflow", "") unless @workflow.owner?(current_user)
+      render_401("You are not authorized to manage this workflow.") unless @workflow.owner?(current_user)
     end
   end
   
@@ -965,16 +975,12 @@
     end
   end
 
-  def error(notice, message, attr=:id, status=nil)
+  def error(notice, message, attr=:id)
     flash[:error] = notice
     (err = Workflow.new.errors).add(attr, message)
     
     respond_to do |format|
       format.html { redirect_to workflows_url }
-      format.xml do
-        headers["WWW-Authenticate"] = %(Basic realm="Web Password") if status == 401
-        render :text => notice, :status => status
-      end
     end
   end
   

Modified: branches/events/app/helpers/application_helper.rb (3490 => 3491)


--- branches/events/app/helpers/application_helper.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/helpers/application_helper.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -234,25 +234,14 @@
     link_to("Request Friendship", new_user_friendship_url(:user_id => user_id))
   end
   
-  def versioned_workflow_link(workflow_id, version_number, long_description=true)
-    if workflow_id.kind_of? Fixnum
-      workflow = Workflow.find(:first, :conditions => ["id = ?", workflow_id])
-      return nil unless workflow
-    elsif workflow_id.kind_of? Workflow
-      workflow = workflow_id
+  def versioned_resource_link(resource, version_number, long_description=true)
+    ver = resource.find_version(version_number)
+    if ver
+      url = "" :version => version_number)
     else
       return nil
     end
     
-    if (ver = workflow.find_version(version_number))
-      url = "" => 'workflows',
-                    :action ="" 'show',
-                    :id => workflow.id,
-                    :version => version_number)
-    else
-      return nil
-    end
-    
     return nil unless url
     
     if long_description
@@ -390,14 +379,6 @@
       else
         return nil
       end
-    when "Blog"
-      if b = Blog.find(:first, :conditions => ["id = ?", contributableid])
-        name = h(b.title)
-        
-        return link ? link_to(name, blog_url(b)) : name
-      else
-        return nil
-      end
     when "Workflow"
       if w = Workflow.find(:first, :conditions => ["id = ?", contributableid])
         name = h(w.title)
@@ -796,8 +777,6 @@
       return "manhattan_studio/folder-closed_16.png"
     when "remote-resource"
       return "famfamfam_silk/page_world.png"
-    when "blog"
-      return "famfamfam_silk/note.png"
     when "workflow"
       return "redmond_studio/applications_16.png"
     when "policy"
@@ -870,6 +849,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
@@ -912,13 +895,7 @@
   end
 
   def highlight_all(text, string)
-    rtn = text
-    
-    string.each(separator=" ") { |substr|
-      rtn = highlight(text, substr)
-    }
-    
-    return rtn
+    highlight(text, string.split(' '))
   end
   
   def workflows_for_attribution_form
@@ -1278,11 +1255,15 @@
     perm
   end
   
-  def currentusers_things_url(thing)
+  def currentusers_things_url(klass)
     return nil unless current_user
-    return url_for(:controller => 'users',
-                   :id => current_user.id,
-                   :action ="" thing)
+    if Conf.contributable_models.include?(klass)
+      return polymorphic_url([current_user, klass.pluralize.underscore.to_sym])
+    else
+      return url_for(:controller => 'users',
+                     :id => current_user.id,
+                     :action ="" controller_visible_name(klass))
+    end
   end
   
   def view_privileges_notice
@@ -1430,7 +1411,7 @@
     
     return rtn unless depth.to_i < 2
     
-    collections = [[contributor], contributor.contributions, contributor.workflows, contributor.blogs]
+    collections = [[contributor], contributor.contributions, contributor.workflows]
     recursions = []
     
     case contributor.class.to_s
@@ -1549,19 +1530,6 @@
         
         rtn << [item.created_at, "#{editor} created the #{link} #{item.contributable_type.downcase == "blob" ? "File" : item.contributable_type.downcase} for #{owner_string}."]
       end
-    when "Blog"
-      if restrict_contributor
-        return rtn unless (restrict_contributor.class.to_s == item.contributor_type.to_s and restrict_contributor.id.to_i == item.contributor_id.to_i)
-      end
-      
-      owner = contributor(item.contributor_id, item.contributor_type)
-    
-      item.posts.each do |blog_post|
-        next if before and blog_post.created_at > before
-        next if after and blog_post.created_at < after
-        
-        rtn << [blog_post.created_at, "#{owner} has created a new post on #{contributable(item.id, "Blog")}."]
-      end
     when "Workflow"
       item.versions.each do |workflow|
         next if workflow.version.to_i == 1
@@ -1574,7 +1542,7 @@
           next unless (workflow.contributor_type.to_s == restrict_contributor.class.to_s and workflow.contributor_id.to_i == restrict_contributor.id.to_i)
         end
         
-        rtn << [workflow.updated_at, "#{editor} edited the #{versioned_workflow_link(item.id, workflow.version, false)} Workflow."]
+        rtn << [workflow.updated_at, "#{editor} edited the #{versioned_resource_link(item, workflow.version, false)} Workflow."]
       end
     when "PictureSelection"
       return rtn if before and item.created_at > before
@@ -1649,7 +1617,7 @@
 
   def callback_url(item)
     item_url = nil
-    if session && session[:callback]:
+    if session && session[:callback]
       case session[:callback][:format]
       when 'uri'
         item_url = rest_resource_uri(item)
@@ -1683,27 +1651,23 @@
     result
   end
 
-  #Selects layout for contributables/groups or uses site's default
-  def configure_layout
-    contributable = (@workflow || @pack || @blog_post || @blob)
-    layout = nil
-
-    if params["layout_preview"]
-      layout = Conf.layouts[params["layout_preview"]]
-    elsif contributable && contributable.contribution
-      layout = Conf.layouts[contributable.contribution.layout]
-      if layout.nil?
-        logger.error("Missing layout for #{contributable.class.name} #{contributable.id}: "+
-                    "#{contributable.contribution.layout}")
-      end
-    elsif @network
-      layout = @network.layout
-      if layout.nil?
-        logger.error("Missing layout for Group address@hidden: address@hidden")
-      end
+  def context_prefix(context)
+    case context
+    when User
+      prefix = "#{context.name}'"
+      prefix << 's' if context.name[-1] != 's'
+    when Network
+      prefix = context.name
+    else
+      prefix = ''
     end
 
-    @layout = layout || {"layout" => Conf.page_template, "stylesheets" => [Conf.stylesheet]}
+    prefix
   end
 
+  # Creates a URL from a path and a hash of parameters
+  def url_with_params(url, params)
+    url + '?' + params.delete_if {|k,v| v.nil? || v.empty?}.to_query
+  end
+
 end

Deleted: branches/events/app/helpers/blog_posts_helper.rb (3490 => 3491)


--- branches/events/app/helpers/blog_posts_helper.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/helpers/blog_posts_helper.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,7 +0,0 @@
-# myExperiment: app/helpers/blog_posts_helper.rb
-#
-# Copyright (c) 2007 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-module BlogPostsHelper
-end

Deleted: branches/events/app/helpers/blogs_helper.rb (3490 => 3491)


--- branches/events/app/helpers/blogs_helper.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/helpers/blogs_helper.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,7 +0,0 @@
-# myExperiment: app/helpers/blogs_helper.rb
-#
-# Copyright (c) 2007 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-module BlogsHelper
-end

Modified: branches/events/app/helpers/users_helper.rb (3490 => 3491)


--- branches/events/app/helpers/users_helper.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/helpers/users_helper.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -12,7 +12,6 @@
       when 'Blob'; url = ""
       when 'Workflow'; url = ""
       when 'Pack'; url = ""
-      when 'Blog'; url = ""
       else;        url = ""
     end
     

Modified: branches/events/app/models/blob.rb (3490 => 3491)


--- branches/events/app/models/blob.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/blob.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -8,6 +8,7 @@
 require 'acts_as_creditable'
 require 'acts_as_attributor'
 require 'acts_as_attributable'
+require 'sunspot_rails'
 
 class Blob < ActiveRecord::Base
 
@@ -32,10 +33,24 @@
 
     :mutable => [ :title, :body, :body_html ]
 
-  acts_as_solr(:fields => [:title, :local_name, :body, :kind, :contributor_name, :tag_list],
-               :boost => "rank",
-               :include => [ :comments ]) if Conf.solr_enable
+  if Conf.solr_enable
+    searchable do
+      text :title, :as => 'title', :boost => 2.0
+      text :local_name, :as => 'file_name'
+      text :body, :as => 'description'
+      text :kind, :as => 'kind'
+      text :contributor_name, :as => 'contributor_name'
 
+      text :tags, :as => 'tag' do
+        tags.map { |tag| tag.name }
+      end
+
+      text :comments, :as => 'comment' do
+        comments.map { |comment| comment.comment }
+      end
+    end
+  end
+
   belongs_to :content_blob, :dependent => :destroy
   belongs_to :content_type
   belongs_to :license
@@ -44,6 +59,7 @@
   validates_presence_of :content_type
 
   validates_presence_of :title
+  validates_presence_of :local_name
 
   validates_each :content_blob do |record, attr, value|
     if value.data.size > Conf.max_upload_size

Deleted: branches/events/app/models/blog.rb (3490 => 3491)


--- branches/events/app/models/blog.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/blog.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,26 +0,0 @@
-# myExperiment: app/models/blog.rb
-#
-# Copyright (c) 2007 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-require 'acts_as_site_entity'
-require 'acts_as_contributable'
-
-class Blog < ActiveRecord::Base
-
-  acts_as_site_entity
-
-  acts_as_contributable
-  
-  acts_as_bookmarkable
-  acts_as_commentable
-  acts_as_rateable
-  acts_as_taggable
-
-  has_many :posts,
-           :class_name => "BlogPost",
-           :order => "blog_posts.created_at DESC",
-           :dependent => :destroy
-           
-  validates_presence_of :title
-end

Deleted: branches/events/app/models/blog_post.rb (3490 => 3491)


--- branches/events/app/models/blog_post.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/blog_post.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,12 +0,0 @@
-# myExperiment: app/models/blog_post.rb
-#
-# Copyright (c) 2007 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-class BlogPost < ActiveRecord::Base
-  belongs_to :blog
-  
-  format_attribute :body
-
-  validates_presence_of :title, :body
-end

Modified: branches/events/app/models/client_application.rb (3490 => 3491)


--- branches/events/app/models/client_application.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/client_application.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -6,9 +6,6 @@
            :class_name => "KeyPermission",
            :order => "key_permissions.for",
            :dependent => :destroy
-  belongs_to :creator,
-             :class_name => "User",
-	     :foreign_key => "creator_id"
   validates_presence_of :name,:url,:key,:secret
   validates_uniqueness_of :key
   before_validation_on_create :generate_keys

Modified: branches/events/app/models/comment.rb (3490 => 3491)


--- branches/events/app/models/comment.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/comment.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -10,8 +10,6 @@
 
   has_many :activities, :as => :objekt, :dependent => :destroy
   
-  acts_as_solr :fields => [ :comment ] if Conf.solr_enable
-  
   acts_as_simile_timeline_event(
     :fields => {
       :start       => :created_at,

Modified: branches/events/app/models/content_blob.rb (3490 => 3491)


--- branches/events/app/models/content_blob.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/content_blob.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -7,8 +7,13 @@
 require 'digest/sha1'
 
 class ContentBlob < ActiveRecord::Base
-  validates_presence_of :data
 
+  validate do |record|
+    if record.data.nil? || record.data.length == 0
+      record.errors.add(:data, 'cannot be empty.')
+    end
+  end
+
   before_save do |blob|
     blob.update_checksums
   end

Copied: branches/events/app/models/deprecation_event.rb (from rev 3490, trunk/app/models/deprecation_event.rb) (0 => 3491)


--- branches/events/app/models/deprecation_event.rb	                        (rev 0)
+++ branches/events/app/models/deprecation_event.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -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/events/app/models/federation_source.rb (3490 => 3491)


--- branches/events/app/models/federation_source.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/federation_source.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -3,12 +3,11 @@
 # Copyright (c) 2007 University of Manchester and the University of Southampton.
 # See license.txt for details.
 
-require 'lib/acts_as_site_entity'
-require 'lib/acts_as_contributor'
+require 'acts_as_site_entity'
+require 'acts_as_contributor'
 
 class FederationSource < ActiveRecord::Base
   acts_as_site_entity
   acts_as_contributor
-  acts_as_structured_data
 end
 

Modified: branches/events/app/models/mailer.rb (3490 => 3491)


--- branches/events/app/models/mailer.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/mailer.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -2,10 +2,10 @@
 
   helper :application
 
-  def feedback(name, subject, content)
+  def feedback(name, subj, content)
     recipients Conf.feedback_email_address
     from Conf.notifications_email_address
-    subject "#{Conf.sitename} feedback from #{name}"
+    subject "#{Conf.sitename} feedback from #{name}: #{subj}"
     
     body :name => name, 
          :subject => subject, 

Modified: branches/events/app/models/network.rb (3490 => 3491)


--- branches/events/app/models/network.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/network.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -6,6 +6,7 @@
 require 'acts_as_contributor'
 require 'acts_as_creditor'
 require 'acts_as_site_entity'
+require 'sunspot_rails'
 
 class Network < ActiveRecord::Base
   acts_as_contributor
@@ -17,14 +18,28 @@
   acts_as_taggable
   
   has_many :blobs, :as => :contributor
-  has_many :blogs, :as => :contributor
   has_many :workflows, :as => :contributor
-  
-  acts_as_solr(:fields => [ :title, :unique_name, :owner_name, :description, :tag_list ],
-               :include => [ :comments ]) if Conf.solr_enable
+  has_many :policies, :as => :contributor
 
+  if Conf.solr_enable
+    searchable do
+      text :title, :as => 'title', :boost => 2.0
+      text :unique_name
+      text :owner_name, :as => 'owner_name'
+      text :description, :as => 'description'
+
+      text :tags, :as => 'tag' do
+        tags.map { |tag| tag.name }
+      end
+
+      text :comments, :as => 'comment' do
+        comments.map { |comment| comment.comment }
+      end
+    end
+  end
+
   format_attribute :description
-  
+
   def self.recently_created(limit=5)
     self.find(:all, :order => "created_at DESC", :limit => limit)
   end
@@ -44,7 +59,6 @@
   validates_associated :owner
   
   validates_presence_of :user_id, :title
-  
   # bugfix. after unique_name has been set, if you un-set it, Rails throws an error!
   validates_uniqueness_of :unique_name, :if => Proc.new { |network| !(network.unique_name.nil? or network.unique_name.empty?) }
   
@@ -61,6 +75,10 @@
   def owner_name
     owner.name
   end
+
+  def name
+    title
+  end
                           
   # announcements belonging to the group;
   #
@@ -166,21 +184,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 +239,23 @@
   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?
+      if (user_id)
+        Membership.find_by_user_id_and_network_id(user_id, id).try(:destroy) # delete membership of new owner
+      end  
+      if (user_id_was)
+        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
+
 end

Modified: branches/events/app/models/pack.rb (3490 => 3491)


--- branches/events/app/models/pack.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/pack.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -9,8 +9,8 @@
 require 'zip/zip'
 require 'tempfile'
 require 'cgi'
+require 'sunspot_rails'
 
-
 class Pack < ActiveRecord::Base
 
   acts_as_site_entity :owner_text => 'Creator'
@@ -24,28 +24,53 @@
 
   has_many :relationships, :dependent => :destroy, :as => :context
 
+  has_many :versions, :class_name => "PackVersion"
+
+  belongs_to :license
+
+  def find_version(version)
+    match = versions.find(:first, :conditions => ["version = ?", version])
+    return match if match
+
+    raise ActiveRecord::RecordNotFound.new("Couldn't find Pack with pack_id=#{id} and version=#{version}")
+  end
+
   validates_presence_of :title
   
   format_attribute :description
   
-  acts_as_solr(:fields => [ :title, :description, :contributor_name, :tag_list ],
-               :boost => "rank",
-               :include => [ :comments ]) if Conf.solr_enable
-  
+  if Conf.solr_enable
+    searchable do
+      text :title, :as => 'title', :boost => 2.0
+      text :description, :as => 'description'
+      text :contributor_name, :as => 'contributor_name'
+
+      text :tags, :as => 'tag' do
+        tags.map { |tag| tag.name }
+      end
+
+      text :comments, :as => 'comment' do
+        comments.map { |comment| comment.comment }
+      end
+    end
+  end
+
   has_many :contributable_entries,
            :class_name => "PackContributableEntry",
            :foreign_key => :pack_id,
+           :conditions => "version IS NULL",
            :order => "created_at DESC",
            :dependent => :destroy
   
   has_many :remote_entries,
            :class_name => "PackRemoteEntry",
            :foreign_key => :pack_id,
+           :conditions => "version IS NULL",
            :order => "created_at DESC",
            :dependent => :destroy
   
   def items_count
-    return contributable_entries.count + remote_entries.count
+    contributable_entries.count + remote_entries.count
   end
   
   # returns packs that have largest total number of items
@@ -631,6 +656,58 @@
     APIStatistics.statistics(self)
   end
  
+  def snapshot!
+  
+    self.current_version = self.current_version ? self.current_version + 1 : 1
+
+    inhibit_timestamps do
+ 
+      version = versions.build(
+          :version          => current_version,
+          :contributor      => contributor,
+          :title            => title,
+          :description      => description,
+          :description_html => description_html)
+
+      contributable_entries.each do |entry|
+
+        version.contributable_entries.build(
+            :pack => self,
+            :contributable_id => entry.contributable_id,
+            :contributable_type => entry.contributable_type,
+            :contributable_version => entry.contributable_version,
+            :comment => entry.comment,
+            :user_id => entry.user_id,
+            :version => current_version,
+            :created_at => entry.created_at,
+            :updated_at => entry.updated_at)
+      end
+
+      remote_entries.each do |entry|
+
+        tt = version.remote_entries.build(
+            :pack => self,
+            :title => entry.title,
+            :uri => entry.uri,
+            :alternate_uri => entry.alternate_uri,
+            :comment => entry.comment,
+            :user_id => entry.user_id,
+            :version => current_version,
+            :created_at => entry.created_at,
+            :updated_at => entry.updated_at)
+      end
+    end
+    
+    save
+  end
+
+  def describe_version(version_number)
+    return "" if versions.count < 2
+    return "(earliest)" if version_number == versions.first.version
+    return "(latest)" if version_number == versions.last.version
+    return ""
+  end
+
   protected
   
   # produces html string containing the required messaged, enclosed within left-padded P tag, belonging to 'none_text' class

Modified: branches/events/app/models/pack_contributable_entry.rb (3490 => 3491)


--- branches/events/app/models/pack_contributable_entry.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/pack_contributable_entry.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -21,12 +21,26 @@
   after_destroy :touch_pack
 
   def check_unique
-    if self.contributable_version.blank?
-      i = PackContributableEntry.find(:first, :conditions => ["pack_id = ? AND contributable_type = ? AND contributable_id = ? AND contributable_version IS NULL", self.pack_id, self.contributable_type, self.contributable_id]) 
+
+    conditions = ["pack_id = ?", "version = ?", "contributable_type = ?", "contributable_id = ?"]
+    arguments = [self.pack_id, self.version, self.contributable_type, self.contributable_id]
+    
+    if self.contributable_version.nil?
+      conditions << "contributable_version IS NULL"
     else
-      i = PackContributableEntry.find(:first, :conditions => ["pack_id = ? AND contributable_type = ? AND contributable_id = ? AND contributable_version = ?", self.pack_id, self.contributable_type, self.contributable_id, self.contributable_version])
+      conditions << "contributable_version = ?"
+      arguments << self.contributable_version
     end
-    
+
+    if self.version.nil?
+      conditions << "version IS NULL"
+    else
+      conditions << "version = ?"
+      arguments << self.version
+    end
+
+    i = PackContributableEntry.find(:first, :conditions => [conditions.join(" AND ")] + arguments) 
+ 
     if i
       errors.add_to_base("This item already exists in the pack")
       return false
@@ -71,7 +85,7 @@
   end
 
   def item_as_list
-    return [contributable]
+    return [get_contributable_version]
   end
 
   def touch_pack

Modified: branches/events/app/models/pack_remote_entry.rb (3490 => 3491)


--- branches/events/app/models/pack_remote_entry.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/pack_remote_entry.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -19,7 +19,7 @@
   after_destroy :touch_pack
 
   def check_unique
-    if PackRemoteEntry.find(:first, :conditions => ["pack_id = ? AND uri = ?", self.pack_id, self.uri])
+    if PackRemoteEntry.find(:first, :conditions => ["pack_id = ? AND version = ? AND uri = ?", self.pack_id, self.version, self.uri])
       errors.add_to_base("This external link already exists in the pack")
       return false
     else

Copied: branches/events/app/models/pack_version.rb (from rev 3490, trunk/app/models/pack_version.rb) (0 => 3491)


--- branches/events/app/models/pack_version.rb	                        (rev 0)
+++ branches/events/app/models/pack_version.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,50 @@
+# myExperiment: app/models/pack_version.rb
+#
+# Copyright (c) 2012 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class PackVersion < ActiveRecord::Base
+
+  validates_presence_of :title
+
+  belongs_to :pack
+  belongs_to :contributor, :polymorphic => true
+
+  format_attribute :description
+
+  has_many :contributable_entries,
+           :class_name => "PackContributableEntry",
+           :dependent => :destroy,
+           :finder_sql =>
+              'SELECT *
+               FROM pack_contributable_entries
+               WHERE pack_id = #{pack_id} AND version = #{version}
+               ORDER BY created_at DESC'
+  
+  has_many :remote_entries,
+           :class_name => "PackRemoteEntry",
+           :dependent => :destroy,
+           :finder_sql =>
+              'SELECT *
+               FROM pack_remote_entries
+               WHERE pack_id = #{pack_id} AND version = #{version}
+               ORDER BY created_at DESC'
+
+  def items_count
+    contributable_entries.count + remote_entries.count
+  end
+  
+  def versioned_resource
+    pack
+  end
+
+  def items_count
+    return contributable_entries.count + remote_entries.count
+  end
+
+  def contributables
+    contributable_entries.map do |e| e.contributable end
+  end
+  
+end
+

Modified: branches/events/app/models/policy.rb (3490 => 3491)


--- branches/events/app/models/policy.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/policy.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -61,4 +61,8 @@
       end
     end
   end
+
+  def group_policy?
+    contributor_type == "Network"
+  end
 end

Modified: branches/events/app/models/profile.rb (3490 => 3491)


--- branches/events/app/models/profile.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/profile.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -39,17 +39,6 @@
 
   acts_as_site_entity :owner_text => 'User'
   
-  acts_as_solr :fields => [ :email,
-                            :website,
-                            :body,
-                            :field_or_industry,
-                            :occupation_or_roles,
-                            :organisations,
-                            :location_city,
-                            :location_country,
-                            :interests,
-                            :contact_details ] if Conf.solr_enable
-  
   def avatar?
     not (picture_id.nil? or picture_id.zero?)
   end

Modified: branches/events/app/models/review.rb (3490 => 3491)


--- branches/events/app/models/review.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/review.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -12,8 +12,6 @@
   
   before_create :check_multiple
   
-  acts_as_solr :fields => [ :title, :review ] if Conf.solr_enable
-  
   # returns the 'last created' Reviews
   # the maximum number of results is set by #limit#
   def self.latest(limit=10)

Copied: branches/events/app/models/semantic_annotation.rb (from rev 3490, trunk/app/models/semantic_annotation.rb) (0 => 3491)


--- branches/events/app/models/semantic_annotation.rb	                        (rev 0)
+++ branches/events/app/models/semantic_annotation.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,3 @@
+class SemanticAnnotation < ActiveRecord::Base
+  belongs_to :subject, :polymorphic => true
+end

Modified: branches/events/app/models/service.rb (3490 => 3491)


--- branches/events/app/models/service.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/service.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -3,8 +3,9 @@
 # Copyright (c) 2007 University of Manchester and the University of Southampton.
 # See license.txt for details.
 
-require 'lib/acts_as_site_entity'
-require 'lib/acts_as_contributable'
+require 'acts_as_site_entity'
+require 'acts_as_contributable'
+require 'sunspot_rails'
 
 class Service < ActiveRecord::Base
   acts_as_site_entity
@@ -15,12 +16,28 @@
   has_many :service_tags
   has_many :service_deployments
 
-  acts_as_solr(:fields => [ :submitter_label, :name, :provider_label, :endpoint,
-      :wsdl, :city, :country, :description, :extra_search_terms ]) if Conf.solr_enable
+  if Conf.solr_enable
+    searchable do
+      text :submitter_label
+      text :name
+      text :provider_label
+      text :endpoint
+      text :wsdl
+      text :city
+      text :country
+      text :description
 
-  def extra_search_terms
-    service_categories.map do |category| category.label end +
-    service_tags.map do |tag| tag.label end +
-    service_types.map do |types| types.label end
+      text :categories do
+        service_categories.map do |category| category.label end
+      end
+
+      text :tags do
+        service_tags.map do |tag| tag.label end
+      end
+
+      text :types do
+        service_types.map do |types| types.label end
+      end
+    end
   end
 end

Modified: branches/events/app/models/taverna_enactor.rb (3490 => 3491)


--- branches/events/app/models/taverna_enactor.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/taverna_enactor.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -7,6 +7,7 @@
 require 'enactor/client'
 require 'document/data'
 require 'document/report'
+require 'encrypted_attributes'
 
 class TavernaEnactor < ActiveRecord::Base
   
@@ -16,11 +17,11 @@
   validates_presence_of :contributor
   
   validates_presence_of :username
-  validates_presence_of :crypted_password
+  validates_presence_of :password
   validates_presence_of :url
   validates_presence_of :title
   
-  encrypts :password, :mode => :symmetric, :key => Conf.sym_encryption_key
+  encrypts :password, :mode => :symmetric, :password => Conf.sym_encryption_key
   
   def label
     title
@@ -172,6 +173,6 @@
   
   # Lazy loading of enactor service client.
   def service_client
-    @client ||= Enactor::Client.new(self.url, self.username, self.crypted_password.decrypt)
+    @client ||= Enactor::Client.new(self.url, self.username, self.password.decrypt)
   end
 end

Modified: branches/events/app/models/user.rb (3490 => 3491)


--- branches/events/app/models/user.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/user.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -8,6 +8,7 @@
 require 'acts_as_site_entity'
 require 'acts_as_contributor'
 require 'acts_as_creditor'
+require 'sunspot_rails'
 
 class User < ActiveRecord::Base
   
@@ -290,14 +291,31 @@
   acts_as_contributor
   
   has_many :blobs, :as => :contributor, :dependent => :destroy
-  has_many :blogs, :as => :contributor, :dependent => :destroy
   has_many :workflows, :as => :contributor, :dependent => :destroy
   has_many :packs, :as => :contributor, :dependent => :destroy
   
   acts_as_creditor
 
-  acts_as_solr(:fields => [ :name, :tag_list ], :include => [ :profile ], :if => "activated_at") if Conf.solr_enable
+  if Conf.solr_enable
+    searchable :if => :activated_at do
+      text :name, :as => 'name', :boost => 2.0
+      text :email, :as => 'email' do profile.email end
+      text :website, :as => 'website' do profile.website end
+      text :body, :as => 'description' do profile.body end
+      text :field_or_industry, :as => 'field_or_industry' do profile.field_or_industry end
+      text :occupation_or_roles, :as => 'occupation_or_role' do profile.occupation_or_roles end
+      text :organisations, :as => 'organisation' do profile.organisations end
+      text :location_city, :as => 'city' do profile.location_city end
+      text :location_country, :as => 'country' do profile.location_country end
+      text :interests, :as => 'interest' do profile.interests end
+      text :contact_details, :as => 'contact' do profile.contact_details end
 
+      text :tags, :as => 'tag' do
+        tags.map { |tag| tag.name }
+      end
+    end
+  end
+
   validates_presence_of :name
   
   has_one :profile,
@@ -632,6 +650,11 @@
     self.spam_score = score
   end
 
+  # Shared group policies that the user can apply to their uploaded resources
+  def group_policies
+    all_networks.map {|n| n.policies}.flatten
+  end
+
 protected
 
   # clean up emails and username before validation
@@ -732,7 +755,7 @@
       # END DEBUG
     end
   end
-    
+
 private
 
   # clean string to remove spaces and force lowercase

Modified: branches/events/app/models/workflow.rb (3490 => 3491)


--- branches/events/app/models/workflow.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/workflow.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -10,7 +10,8 @@
 require 'acts_as_attributable'
 require 'acts_as_reviewable'
 require 'acts_as_runnable'
-require 'lib/previews'
+require 'previews'
+require 'sunspot_rails'
 
 require 'scufl/model'
 require 'scufl/parser'
@@ -25,6 +26,10 @@
   belongs_to :content_type
   belongs_to :license
 
+  has_many :workflow_processors, :dependent => :destroy
+  has_many :workflow_ports, :dependent => :destroy
+  has_many :semantic_annotations, :as => :subject, :dependent => :destroy
+
   before_validation :check_unique_name
   before_validation :apply_extracted_metadata
 
@@ -44,23 +49,46 @@
   
   acts_as_reviewable
 
-  acts_as_structured_data
-
   has_previews
 
   has_versions :workflow_versions,
   
     :attributes => [ :contributor, :title, :unique_name, :body, :body_html,
                      :content_blob_id, :file_ext, :last_edited_by,
-                     :content_type_id, :preview_id, :image, :svg ],
+                     :content_type_id, :preview_id, :image, :svg,
+                     :revision_comments],
 
     :mutable => [ :contributor, :title, :unique_name, :body, :body_html,
                   :file_ext, :last_edited_by, :content_type_id, :image, :svg ]
 
-  acts_as_solr(:fields => [ :title, :body, :filename, :tag_list, :contributor_name, :kind, :get_all_search_terms ],
-               :boost => "rank",
-               :include => [ :comments ]) if Conf.solr_enable
+  if Conf.solr_enable
+    searchable do
 
+      text :title, :as => 'title', :boost => 2.0
+      text :body, :as => 'description'
+      text :filename, :as => 'file_name'
+      text :contributor_name, :as => 'contributor_name'
+      text :kind, :as => 'kind'
+      text :get_all_search_terms
+
+      text :tags, :as => 'tag' do
+        tags.map { |tag| tag.name }
+      end
+
+      text :comments, :as => 'comment' do
+        comments.map { |comment| comment.comment }
+      end
+
+      text :review_titles, :as => 'review_title' do
+        reviews.map { |review| review.title }
+      end
+
+      text :review_bodies, :as => 'review_body' do
+        reviews.map { |review| review.review }
+      end
+    end
+  end
+
   acts_as_runnable
   
   validates_presence_of :title
@@ -228,11 +256,26 @@
 
   def filename(version=nil)
 
+    def aux(record)
+
+      extension = ""
+
+      if record.processor_class && record.processor_class.default_file_extension
+        extension = ".#{record.processor_class.default_file_extension}"
+      end
+
+      if record.file_ext
+        extension = ".#{record.file_ext}"
+      end
+
+      extension
+    end
+
     if version.blank?
-      return "#{unique_name}.#{file_ext || self.processor_class.default_file_extension}"
+      "#{unique_name}#{aux(self)}"
     else
-      return nil unless (workflow_version = self.find_version(version))
-      return "#{workflow_version.unique_name}.#{workflow_version.file_ext || workflow_version.processor_class.default_file_extension}"
+      workflow_version = self.find_version(version)
+      "#{workflow_version.unique_name}#{aux(workflow_version)}"
     end
   end
   
@@ -242,14 +285,18 @@
 
   def get_all_search_terms
 
-    words = StringIO.new
+    begin
+      words = StringIO.new
 
-    versions.each do |version|
-      words << get_search_terms(version.version)
+      versions.each do |version|
+        words << get_search_terms(version.version)
+      end
+
+      words.rewind
+      words.read
+    rescue
+      nil
     end
-
-    words.rewind
-    words.read
   end
 
   def get_tag_suggestions()
@@ -316,6 +363,7 @@
   def delete_metadata
     if processor_class
       WorkflowProcessor.destroy_all(["workflow_id = ?", id])
+      WorkflowPort.destroy_all(["workflow_id = ?", id])
     end
   end
 
@@ -323,14 +371,14 @@
     if processor_class
       delete_metadata
       begin
-        processor_class.new(content_blob.data).extract_metadata(id)
+        processor_class.new(content_blob.data).extract_metadata(self)
       rescue
       end
     end
   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 +412,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/events/app/models/workflow_port.rb (from rev 3490, trunk/app/models/workflow_port.rb) (0 => 3491)


--- branches/events/app/models/workflow_port.rb	                        (rev 0)
+++ branches/events/app/models/workflow_port.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,5 @@
+class WorkflowPort < ActiveRecord::Base
+  validates_inclusion_of :port_type, :in => ["input", "output"]
+  belongs_to :workflow
+  has_many :semantic_annotations, :as => :subject, :dependent => :destroy
+end

Modified: branches/events/app/models/workflow_processor.rb (3490 => 3491)


--- branches/events/app/models/workflow_processor.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/workflow_processor.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -5,5 +5,6 @@
 
 class WorkflowProcessor < ActiveRecord::Base
   belongs_to :workflow
+  has_many :semantic_annotations, :as => :subject, :dependent => :destroy
 end
 

Modified: branches/events/app/models/workflow_sweeper.rb (3490 => 3491)


--- branches/events/app/models/workflow_sweeper.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/workflow_sweeper.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -22,8 +22,8 @@
   end
 
   def after_destroy(workflow)
-    expire_sidebar_assets(workflow.contribution.contributor_id) if workflow.contribution.contributor_type == 'User'
-    expire_listing(workflow.contribution.contributor_id, workflow.contribution.contributor_type) if workflow.contribution.contributor_type == 'Network'
+    expire_sidebar_assets(workflow.contributor_id) if workflow.contributor_type == 'User'
+    expire_listing(workflow.contributor_id, workflow.contributor_type) if workflow.contributor_type == 'Network'
     expire_listing(workflow.id, 'Workflow')
     expire_home_cache
   end

Modified: branches/events/app/models/workflow_version.rb (3490 => 3491)


--- branches/events/app/models/workflow_version.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/models/workflow_version.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -3,7 +3,7 @@
 # Copyright (c) 2012 University of Manchester and the University of Southampton.
 # See license.txt for details.
 
-require 'lib/previews'
+require 'previews'
 
 class WorkflowVersion < ActiveRecord::Base
 

Copied: branches/events/app/models/wsdl_deprecation.rb (from rev 3490, trunk/app/models/wsdl_deprecation.rb) (0 => 3491)


--- branches/events/app/models/wsdl_deprecation.rb	                        (rev 0)
+++ branches/events/app/models/wsdl_deprecation.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -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/events/app/views/announcements/_form.rhtml (3490 => 3491)


--- branches/events/app/views/announcements/_form.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/announcements/_form.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,4 @@
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 
 <%= error_messages_for 'announcement' %>
 
@@ -7,6 +7,6 @@
 <%= form.text_field :title, :size => 70 %></p>
 
 <p><label for=""
-<%= fckeditor_textarea(:announcement, :body, :toolbarSet => 'Simple', :width => '700px', :height => '500px') %></p>
+<%= form.text_area(:body, :width => '700px', :height => '500px', :class => 'ckeditor') -%>
 <!--[eoform:announcement]-->
 

Modified: branches/events/app/views/blobs/_breadcrumbs.rhtml (3490 => 3491)


--- branches/events/app/views/blobs/_breadcrumbs.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/blobs/_breadcrumbs.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,5 +1,14 @@
-<li><%= link_to 'Files', blobs_path -%></li>
+<% if @context %>
+  <li><%= link_to visible_name(@context).pluralize, polymorphic_url(@context.class.name.underscore.pluralize) %></li>
+  <li><%= link_to @context.name, @context %></li>
+<% end %>
 
+<% if controller.action_name == 'index' %>
+  <li>Files</li>
+<% else %>
+  <li><%= link_to 'Files', blobs_path %></li>
+<% end %>
+
 <% if ["show", "new", "edit", "all", "search", "suggestions"].include? controller.action_name.to_s -%>
   
   <% case controller.action_name.to_s; when "show" -%>

Modified: branches/events/app/views/blobs/_table.rhtml (3490 => 3491)


--- branches/events/app/views/blobs/_table.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/blobs/_table.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,107 +1,112 @@
 <% query ||= false -%>
-<% odd_row = false -%>
-<% unless collection.empty? %>
 
-<table class="alt_table">
-	<% for blob in collection %>
-		<% # If only one item in collection, check if 'show' permission is available (eg: if this partial was called from contributions/table) -%>
-		<% if collection.size == 1 -%>
-			<% show ||= Authorization.check('view', blob, current_user) -%>
-		<% else -%>
-			<% show = Authorization.check('view', blob, current_user) -%>
-		<% end -%>
-	  <% if show -%>
-			<tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" %>">
-				<% cache(:controller => 'files_cache', :action ="" 'listing', :id => blob.id) do -%>
-					<td style="width: 100px;">
-						<p style="margin-top:0; padding-top:0; text-align: center;"><b>Uploader:</b></p>
-						<center><%= contributor(blob.contribution.contributor_id, blob.contribution.contributor_type, true, 60) %></center>
-					</td>
-					<td style="text-align: left;">
-						<a name="<%= blob.local_name.gsub(/ /, "_") %>"></a>
-						<p class="title">
-							<%= icon "blob", nil, nil, nil, '' %>
-							<% title = contributable_name(blob.id, 'Blob') %>
-							<%=link_to(query ? highlight_all(title, query) : title, blob_path(blob)) %>
-						</p>
-						
-						<p style="font-size: 85%; margin-top: 0; padding-top: 0;">
-							<b>Created:</b> <%=datetime blob.contribution.created_at, false %>
-							<% unless blob.contribution.created_at == blob.contribution.updated_at %>
-								|	<b>Last updated:</b> <%=datetime blob.contribution.updated_at, false %>
-							<% end %>
-						</p>
-						
-						<% unless (creditors = blob.creditors).empty? %>
-							<p style="font-size:85%;">
-							<b>Credits:</b>
-							<% creditors.each do |c| %>
-								<% if c.creditor_type == 'User' %>
-									<%= icon('user', nil, nil, nil, '') %> 
-								<% elsif c.creditor_type == 'Network' %>
-									<%= icon('network-member', nil, nil, nil, '') %>
-								<% end %>
-								<%= contributor(c.creditor_id, c.creditor_type) %>
-							<% end %>
-							</p>
-						<% end %>
-						<% unless (attributors = blob.attributors).empty? %>
-							<p style="font-size:85%;">
-							<b>Attributions:</b>
-							<% attributors.each do |a| %>
-								<% if Authorization.check("view", a.attributor, current_user) -%>
-									<% if a.attributor_type == 'Workflow' %>
-										<%= icon('workflow', nil, nil, nil, '') %> 
-									<% elsif a.attributor_type == 'Blob' %>
-										<%= icon('blob', nil, nil, nil, '') %>
-									<% end %>
-									<%= contributable(a.attributor_id, a.attributor_type) %>
-								<% end -%>
-							<% end %>
-							</p>
-						<% end %>
-						
-            <% if blob.license_id.nil? %>
-              <p style="font-size:85%;"><b>License: </b>No license</p>
-            <% else %>
-              <p style="font-size:85%;"><b>License: </b><% @license = License.find(blob.license_id) %><%= link_to h(@license.title), license_path(@license) %></p>
+<% collection.each do |blob| %>
+  <% # If only one item in collection, check if 'show' permission is available (eg: if this partial was called from contributions/table) -%>
+  <% if collection.size == 1 -%>
+    <% show ||= Authorization.check('view', blob, current_user) -%>
+  <% else -%>
+    <% show = Authorization.check('view', blob, current_user) -%>
+  <% end -%>
+  <% if show -%>
+
+    <div class="resource_list_item <%= blob.contribution.policy.layout -%>">
+
+      <div class="avatar_panel">
+        <span class="owner"><%= owner_text blob -%></span>
+        <%= contributor(blob.contribution.contributor_id, blob.contribution.contributor_type, true, 60) %>
+        <% if layout = blob.contribution.policy.layout %>
+          <% begin %>
+            <%= render :partial => "layouts/skins/branding/#{layout}" %>
+          <% rescue ActionView::MissingTemplate %>
+          <% end %>
+        <% end %>
+      </div>
+
+      <div class="main_panel">
+
+        <div class="actions">
+          <%= icon "show", blob_path(blob), nil, nil, "View" %>
+          <% if Authorization.check("download", blob, current_user) %><%= icon "download", download_blob_path(blob) %><% end %>
+          <% if mine?(blob) %><%= icon "manage", edit_blob_path(blob), nil, nil, "Manage" %><% end %>
+        </div>
+
+        <% cache(:controller => 'files_cache', :action ="" 'listing', :id => blob.id) do -%>
+          <a name="<%= blob.local_name.gsub(/ /, "_") %>"></a>
+          <p class="title">
+            <%= icon "blob", nil, nil, nil, '' %>
+            <% truncated_title = truncate(blob.title, :length => 55) %>
+            <%=link_to(query ? highlight_all(truncated_title, query) : truncated_title, blob_path(blob),
+                       :title => blob.title) %>
+          </p>
+
+          <p>
+            <b>Created:</b> <%=datetime blob.contribution.created_at, false %>
+            <% unless blob.contribution.created_at == blob.contribution.updated_at %>
+              |	<b>Last updated:</b> <%=datetime blob.contribution.updated_at, false %>
             <% end %>
-						
-						<div class="desc" style="font-size: 85%;">
-							<% if blob.body and blob.body.length > 0 %>
-					  		<% desc = truncate(strip_html(blob.body), :length => 500) %>
-					    	<%= query ? highlight_all(desc, query) : desc %>
-						  <% else -%>
-								<span class="none_text">No description</span>	
-							<% end %>
-						</div>
-						
-						<p style="font-size:85%;"><b>File type: </b><%= h blob.content_type.title %></p>
-						
-						<p style="font-size: 85%;">
-							<a href="" blob_path(blob) + '#ratings' -%>"><b>Rating: </b><%= number_with_precision(blob.rating, :precision => 1) %> / 5 (<%= pluralize blob.ratings.count, 'rating' %>)</a> |
-							<a href="" blob_path(blob) + '#comments' -%>"><b>Comments: </b><%= blob.comments.count %></a> |
-							<b>Viewed:</b> <%=pluralize blob.contribution.site_viewings_count, "time" %> |
-				      <b>Downloaded:</b> <%=pluralize blob.contribution.site_downloads_count, "time" %>
-						</p>
-						
-						<% unless (tags = blob.tags).empty? %>
-							<a href="" blob_path(blob) + '#tags' -%>"><p style="font-size: 85%;"><b>Tags:</b></p></a>
-							<div style="display:inline;" class="tags_onesize"><%= tag_cloud_from_collection tags, true %></div>
-						<% else %>
-							<p style="font-size: 85%;"><i>This File has no tags!</i></p>
-						<% end %>	
-					</td>
-				<% end %>
-					
-					<td class="actions" style="width: 80px;">
-				    <%= icon "show", blob_path(blob), nil, nil, "View" %>
-					  <% if Authorization.check("download", blob, current_user) %><%= icon "download", download_blob_path(blob) %><% end %>
-				    <% if mine?(blob) %><%= icon "manage", edit_blob_path(blob), nil, nil, "Manage" %><% end %>
-				  </td>
-			</tr>
-		<% end %>
-	<% end %>
-</table>
+          </p>
 
+          <% unless (creditors = blob.creditors).empty? %>
+            <p>
+              <b>Credits:</b>
+              <% creditors.each do |c| %>
+                <% if c.creditor_type == 'User' %>
+                  <%= icon('user', nil, nil, nil, '') %>
+                <% elsif c.creditor_type == 'Network' %>
+                  <%= icon('network-member', nil, nil, nil, '') %>
+                <% end %>
+                <%= contributor(c.creditor_id, c.creditor_type) %>
+              <% end %>
+            </p>
+          <% end %>
+          <% unless (attributors = blob.attributors).empty? %>
+            <p>
+              <b>Attributions:</b>
+              <% attributors.each do |a| %>
+                <% if Authorization.check("view", a.attributor, current_user) -%>
+                  <% if a.attributor_type == 'Workflow' %>
+                    <%= icon('workflow', nil, nil, nil, '') %>
+                  <% elsif a.attributor_type == 'Blob' %>
+                    <%= icon('blob', nil, nil, nil, '') %>
+                  <% end %>
+                  <%= contributable(a.attributor_id, a.attributor_type) %>
+                <% end -%>
+              <% end %>
+            </p>
+          <% end %>
+
+          <% if blob.license_id.nil? %>
+            <p><b>License: </b>No license</p>
+          <% else %>
+            <p><b>License: </b><% @license = License.find(blob.license_id) %><%= link_to h(@license.title), license_path(@license) %></p>
+          <% end %>
+
+          <div class="desc">
+            <% if blob.body and blob.body.length > 0 %>
+              <% desc = truncate(strip_html(blob.body), :length => 500) %>
+              <%= query ? highlight_all(desc, query) : desc %>
+            <% else -%>
+              <span class="none_text">No description</span>
+            <% end %>
+          </div>
+
+          <p><b>File type: </b><%= h blob.content_type.title %></p>
+
+          <p>
+            <a href="" blob_path(blob) + '#ratings' -%>"><b>Rating: </b><%= number_with_precision(blob.rating, :precision => 1) %> / 5 (<%= pluralize blob.ratings.count, 'rating' %>)</a> |
+            <a href="" blob_path(blob) + '#comments' -%>"><b>Comments: </b><%= blob.comments.count %></a> |
+            <b>Viewed:</b> <%=pluralize blob.contribution.site_viewings_count, "time" %> |
+            <b>Downloaded:</b> <%=pluralize blob.contribution.site_downloads_count, "time" %>
+          </p>
+
+          <% unless (tags = blob.tags).empty? %>
+            <a href="" blob_path(blob) + '#tags' -%>"><p><b>Tags:</b></p></a>
+            <div style="display:inline;" class="tags_onesize"><%= tag_cloud_from_collection tags, true %></div>
+          <% else %>
+            <p><i>This File has no tags!</i></p>
+          <% end %>
+        <% end %>
+      </div>
+    </div>
+  <% end %>
 <% end %>

Modified: branches/events/app/views/blobs/edit.rhtml (3490 => 3491)


--- branches/events/app/views/blobs/edit.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/blobs/edit.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,6 +1,6 @@
 <% t "Manage" -%>
 
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 <%= _javascript__include_tag "osp.js" %>
 
 <h1>Manage File: <%= contributable_name(@blob.id, 'Blob') %></h1>
@@ -31,7 +31,7 @@
   	<strong>Description: </strong>
 	</p>
 	<center>
-		<%= fckeditor_textarea(:blob, :body, :toolbarSet => 'Simple', :width => '600px', :height => '300px') %>
+		<%= f.text_area(:body, :width => '600px', :height => '300px', :class => 'ckeditor') %>
 	</center>
   
   <br/>

Modified: branches/events/app/views/blobs/index.rhtml (3490 => 3491)


--- branches/events/app/views/blobs/index.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/blobs/index.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,4 @@
-<h1>Files</h1>
+<h1><%= context_prefix(@context) -%> Files</h1>
 
 <%= render :partial => "content/index" -%>
 

Modified: branches/events/app/views/blobs/new.rhtml (3490 => 3491)


--- branches/events/app/views/blobs/new.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/blobs/new.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,6 +1,6 @@
 <% t "New" -%>
 
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 <%= _javascript__include_tag "osp.js" %>
 
 <h1>Upload File</h1>
@@ -28,7 +28,7 @@
   	<strong>Description: </strong>
 	</p>
 	<center>
-		<%= fckeditor_textarea(:blob, :body, :toolbarSet => 'Simple', :width => '600px', :height => '300px') %>
+		<%= text_area_tag('blob[body]', nil, :width => '600px', :height => '300px', :class => 'ckeditor') %>
 	</center>
 
   <br />

Modified: branches/events/app/views/blobs/show.rhtml (3490 => 3491)


--- branches/events/app/views/blobs/show.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/blobs/show.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -47,12 +47,14 @@
 			    <b>File name:</b>
 			    <%=h @version.local_name %>
 			</p>
-			
+
+  <% if  @version.content_type %>			
 			<p>
 			    <b>File type:</b>
 			    <%=h @version.content_type.title %>
 			</p>
-			
+	<% end %>
+  
 			<br/>
 			
 			<h3>

Modified: branches/events/app/views/blobs/suggestions.rhtml (3490 => 3491)


--- branches/events/app/views/blobs/suggestions.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/blobs/suggestions.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,6 +1,6 @@
 <% t "#{contributable_name(@version.id, 'Blob')} (#{h @blob.contributor_name})" -%>
 
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 
 <h1>Suggestions</h1>
 
@@ -15,15 +15,7 @@
     its purpose.</em></p>
 
     <p>
-      <textarea id='description_editor' name='description'></textarea>
-      <script type="text/_javascript_">
-      //<![CDATA[
-      var oFCKeditor = new FCKeditor('description_editor', '600px', '300px', 'Simple');
-      oFCKeditor.BasePath = "/_javascript_s/fckeditor/"
-      oFCKeditor.Config['CustomConfigurationsPath'] = '/_javascript_s/fckcustom.js';
-      oFCKeditor.ReplaceTextarea();
-      //]]>
-      </script>
+      <%= text_area_tag(:description, nil, :width => '600px', :height => '300px', :class => 'ckeditor') -%>
     </p>
 
   <% end %>
@@ -37,15 +29,7 @@
     version.</p>
 
     <p>
-      <textarea id='revision_comments_editor' name='revision_comments'></textarea>
-      <script type="text/_javascript_">
-      //<![CDATA[
-      var oFCKeditor = new FCKeditor('revision_comments_editor', '600px', '300px', 'Simple');
-      oFCKeditor.BasePath = "/_javascript_s/fckeditor/"
-      oFCKeditor.Config['CustomConfigurationsPath'] = '/_javascript_s/fckcustom.js';
-      oFCKeditor.ReplaceTextarea();
-      //]]>
-      </script>
+      <%= text_area_tag(:revision_comments, nil, :width => '600px', :height => '200px', :class => 'ckeditor') -%>
     </p>
 
   <% end %>

Modified: branches/events/app/views/comments/_comments.rhtml (3490 => 3491)


--- branches/events/app/views/comments/_comments.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/comments/_comments.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,4 @@
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 
 <h2>
 	<%= icon "comments", nil, nil, { :style => "vertical-align: middle;" }, "" -%>
@@ -41,13 +41,13 @@
 			<% # Hack for FCKEditor: -%>
 			<% @comment = Comment.new; @comment.id = 0 -%>
 			
-			<% form_remote_tag(:url ="" rest_resource_uri(commentable) + "/comments",
-								 :before => fckeditor_before_js("comment", "comment"),
+			<% form_remote_tag(:url ="" polymorphic_path(commentable) + "/comments",
+								 :before => 'for (instance in CKEDITOR.instances) { CKEDITOR.instances[instance].updateElement() }',
 							   :update => 'commentsBox', 
 							   :loading => "Element.show('addcomment_indicator')",
-	               :complete => "Element.hide('addcomment_indicator'); new Effect.Highlight('comments', { duration: 1.5 }); $('comment').value = '';") do %>
+	               :complete => "Element.hide('addcomment_indicator'); new Effect.Highlight('comments', { duration: 1.5 }); $('comment').value = ''; CKEDITOR.replace('comment_comment')") do %>
 				
-				<%= fckeditor_textarea("comment", "comment", :ajax => true, :toolbarSet => 'Basic', :width => '99%', :height => '200px') %>
+				<%= text_area_tag("comment[comment]", nil, :width => '99%', :height => '200px', :class => 'ckeditor') %>
 				<% if false %><textarea id="comment" name="comment" rows="10" style="width: 99%;"></textarea><% end %>
 				<br/>
 				<%= submit_tag "Submit Comment" %>

Modified: branches/events/app/views/content/_index.rhtml (3490 => 3491)


--- branches/events/app/views/content/_index.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/content/_index.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -3,7 +3,7 @@
     <% if @pivot[:filters].length > 0 %>
       <div class="category">Search filter terms</div>
       <div class="search_filters">
-        <form action="" url_for(request.query_parameters) -%>" method="GET">
+        <form action="" url_with_params(request.path, request.query_parameters) -%>" method="GET">
           <div class="filter_search_box">
             <input class="query" name="filter_query" value="<%= params[:filter_query] -%>" />
             <% @pivot[:filter_query_url].each do |key, value| %>
@@ -11,7 +11,7 @@
             <% end %>
             <% if @pivot[:cancel_filter_query_url] %>
               <%= link_to('<img src="" />',
-                  @pivot[:cancel_filter_query_url]) -%>
+                          url_with_params(request.path, @pivot[:cancel_filter_query_url])) -%>
             <% else %>
               <input class="submit" type="image" src="" name="submit" />
             <% end %>
@@ -32,8 +32,11 @@
             <div class="options">
               <% filter[:objects].each do |object| %>
                 <div title='<%= h(object[:plain_label]) -%>'<%= object[:selected] ? ' class="selected"' : '' -%>>
-                  <input class='checkbox' type='checkbox'  <% if object[:selected] %> checked='checked' <% end %> />
-                  <%= link_to("<div class='count'>#{object[:count]}</div> <div class='label'><span class='truncate'>#{object[:label]}</span></div>", object[:label_uri]) -%>
+                  <input class='checkbox' type='checkbox'  <% if object[:selected] %> checked='checked' <% end %> />
+                  <a href="" url_with_params(request.path, object[:label_uri]) -%>">
+                    <div class='count'><%= object[:count] -%></div>
+                    <div class='label'><span class='truncate'><%= object[:label] -%></span></div>
+                  </a>
                 </div>
               <% end %>
             </div>
@@ -54,7 +57,7 @@
       Sort by:
       <select  = this.options[this.selectedIndex].value;">
         <% @pivot[:pivot_options]["order"].each do |args| %>
-          <option value="<%= url_for(request.query_parameters.merge("order" => args["option"])) -%>"
+          <option value="<%= url_with_params(request.path, request.query_parameters.merge({:order => args["option"]})) -%>"
           <% if params[:order] == args["option"] -%> selected="selected"<% end -%>><%= args["label"] -%></option>
         <% end %>
       </select>
@@ -64,18 +67,18 @@
     </div>
     <div class="summary">
       <div class="result-count">
-        Showing <%= pluralize(@pivot[:results].size, 'result') -%>.
+        Showing <%= pluralize(@pivot[:results].total_entries, 'result') -%>.
         <% if @pivot[:results].size > 1 %>Use the <%if @pivot[:filters].length > 0 %>filters on the left and the <% end %>
         search box below to refine the results.<% end %>
       </div>
       <div>
-        <form action="" url_for(request.query_parameters) -%>" method="GET">
+        <form action="" url_with_params(request.path, request.query_parameters) -%>" method="GET">
           <div class="search_box">
             <input class="query" name="query" value="<%= params[:query] -%>" />
             <% if request.query_parameters["filter"] %>
               <input name="filter" type="hidden" value="<%= request.query_parameters["filter"].gsub('"', '&quot;') -%>" />
             <% end %>
-            <input class="submit" type="submit" value="Search"></input>
+            <input class="submit" type="submit" value="Search"/>
           </div>
           <% if @pivot[:query_problem] %>
             <div class="search_query_problem">
@@ -84,7 +87,7 @@
           <% end %>
           <% if params[:query] && controller.class != SearchController %>
             <div class="remove_search_query">
-              <%= link_to("Remove search query", url_for(request.query_parameters.merge({ "query", nil }))) -%>
+              <%= link_to("Remove search query", url_with_params(request.path, request.query_parameters.merge({ "query" => nil }))) -%>
             </div>
           <% end %>
         </form>

Modified: branches/events/app/views/content_types/edit.rhtml (3490 => 3491)


--- branches/events/app/views/content_types/edit.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/content_types/edit.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,6 +1,6 @@
 <% t "Manage" -%>
 
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 
 
 <h1>Manage Content Type: <%= h @content_type.title %></h1>
@@ -21,7 +21,7 @@
   	<strong>Description: </strong>
 	</p>
 	<center>
-		<%= fckeditor_textarea(:content_type, :description, :toolbarSet => 'Simple', :width => '600px', :height => '300px') %>
+    <%= f.text_area(:description, :width => '600px', :height => '300px', :class => 'ckeditor') -%>
 	</center>
   
   <br/>

Modified: branches/events/app/views/content_types/index.rhtml (3490 => 3491)


--- branches/events/app/views/content_types/index.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/content_types/index.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -10,25 +10,27 @@
 
   <%= render :partial => "layouts/paginate", :locals => { :collection => @content_types } %>
 
-  <center>
-    <table class="simple">
-      <thead>
-        <tr>
-          <td>Title</td>
-          <td>Count</td>
-          <td>Category</td>
-        </tr>
-      </thead>
-      <tbody>
-        <% @content_types.each do |ct| %>
+  <div style="clear: both">
+    <center>
+      <table class="simple">
+        <thead>
           <tr>
-            <td><%= link_to(h(ct.title), content_type_path(ct)) %></td>
-            <td style="text-align: right"><%= Contribution.count(:conditions => ['content_type_id = ?', ct.id]) -%></td>
-            <td><%= visible_name(ct.category) %></td>
-        <% end %>
-      </tbody>
-    </table>
-  </center>
+            <td>Title</td>
+            <td>Count</td>
+            <td>Category</td>
+          </tr>
+        </thead>
+        <tbody>
+          <% @content_types.each do |ct| %>
+            <tr>
+              <td><%= link_to(h(ct.title), content_type_path(ct)) %></td>
+              <td style="text-align: right"><%= Contribution.count(:conditions => ['content_type_id = ?', ct.id]) -%></td>
+              <td><%= visible_name(ct.category) %></td>
+          <% end %>
+        </tbody>
+      </table>
+    </center>
+  </div>
           
   <ul>
   </ul>

Modified: branches/events/app/views/contributions/_license_form.rhtml (3490 => 3491)


--- branches/events/app/views/contributions/_license_form.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/contributions/_license_form.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -35,8 +35,8 @@
             <strong>What license do you want people to adhere to if they download and use this File?</strong>
         </p>
         <div style="padding-left: 1em;">
-          <%= select(object, :license_id, [["No license", 0]] + License.find(:all).collect {|l| [l.title, l.id] },
-            { :selected => @license ? @license.id : 0 },
+          <%= select(object, :license_id, [["No license", '']] + License.find(:all).collect {|l| [l.title, l.id] },
+            { :selected => @license ? @license.id : '' },
             {  : remote_function(:update => 'license_info',
                  :url ="" {:controller => 'licenses', :action="" 'update_license_info' },
                  :with => "'license_id=' + escape(value)")}) %>

Modified: branches/events/app/views/contributions/_sharing_form.rhtml (3490 => 3491)


--- branches/events/app/views/contributions/_sharing_form.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/contributions/_sharing_form.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -6,6 +6,10 @@
 
 <% perms = [] %>
 <% perms = contributable.contribution.policy.permissions if edit %>
+<% applicable_networks = current_user.all_networks %>
+<% group_policies = current_user.group_policies %>
+<% using_group_policy = edit && contributable.contribution.policy.group_policy? %>
+<% group_policies = group_policies | [contributable.contribution.policy] if using_group_policy %>
 
 <div class="fold">
 
@@ -22,29 +26,76 @@
   </div>
 
   <div class="foldContent" style="display: none;">
-
     <div class="box_infotext">
-    	<p>
-    		Here you can specify who can <b>view</b> and <b>download</b> this <%= c_type %> on <%= Conf.sitename %>.
-			</p>
-			
-			<% if update_perms -%>
-				<p>
-					You can also set <b>update</b> permissions for this <%= c_type %>.
-					<%= link_to_function "Click here" + expand_image, visual_effect(:toggle_blind, "update_perms_info", :duration => 0.3) %> for more information.
-				</p>
-				<div id="update_perms_info" class="box_simple" style="display: none; margin: 0.5em 0;">
-					<%= update_perms_info_text(contributable) -%>
-				</div>
-			<% end -%>
-			
-			<p>
-				You can also explicitly share this <%= c_type %> with your Groups.
-			</p>  
-		</div>
+      <p>
+        Here you can specify who can <b>view</b> and <b>download</b> this <%= c_type %> on <%= Conf.sitename %>.
+      </p>
 
+      <% if update_perms -%>
+        <p>
+          You can also set <b>update</b> permissions for this <%= c_type %>.
+          <%= link_to_function "Click here" + expand_image, visual_effect(:toggle_blind, "update_perms_info", :duration => 0.3) %> for more information.
+        </p>
+        <div id="update_perms_info" class="box_simple" style="display: none; margin: 0.5em 0;">
+          <%= update_perms_info_text(contributable) -%>
+        </div>
+      <% end -%>
+
+      <p>
+        You can also explicitly share this <%= c_type %> with your Groups.
+      </p>
+   </div>
+
+    <% if group_policies.size > 0 %>
+      <br/>
+      <div class="box_infotext">
+      	<p>
+      		One or more of your groups has a <strong>Group Policy</strong> defined.
+          A Group Policy is a pre-defined set of sharing rules that can be applied to this <%= c_type -%> instead of manually managing permissions.
+  			</p>
+        <p>
+          Select whether you wish you use a Group Policy or manually manage permissions below.
+        </p>
+  		</div>
+      <p><strong>How do you wish to manage the sharing rules for this <%= c_type -%>?</strong></p>
+      <div class="box_editing" style="padding-left: 1em; font-size: 93%;">
+        <p>
+          <input type="radio" name="policy_type" value="custom" id="policy_option_custom"
+                 <%= 'checked="checked"' if !using_group_policy -%> 
+          <label for="" permissions manually</label>
+        </p>
+
+        <p>
+          <input type="radio" name="policy_type" value="group" id="policy_option_group"
+                 <%= 'checked="checked"' if using_group_policy -%> 
+          <label for="" a Group Policy</label>
+        </p>
+      </div>
+    <% else %>
+      <input type="hidden" name="policy_type" value="custom"/>
+    <% end %>
+
 		<br/>
-		
+
+    <div id="group_policy" <%= 'style="display: none"' if !using_group_policy-%>>
+      <p><strong>Which Group Policy do you wish to apply to this <%= c_type -%>?</strong></p>
+      <div class="box_editing" style="padding-left: 1em; font-size: 93%;">
+        <select name="group_policy">
+          <% group_policies.group_by {|p| p.contributor.title}.each do |network, policies| %>
+            <% unless policies.empty? %>
+              <optgroup label="<%= h network -%>">
+                <% policies.each do |policy| %>
+                  <option value="<%= policy.id -%>"><%= policy.name -%></option>
+                <% end %>
+              </optgroup>
+            <% end %>
+          <% end %>
+        </select>
+      </div>
+    </div>
+
+    <div id="custom_policy" <%= 'style="display: none"' if using_group_policy-%>>
+
 		<!-- View/Download Permissions -->
     <p><strong>Who can view and download this <%= c_type %> on <%= Conf.sitename %>?</strong></p>
 
@@ -141,7 +192,7 @@
 		
 		<br/>
 
-    <% unless (applicable_networks = (current_user.networks + current_user.networks_owned)).empty? %>
+    <% unless applicable_networks.empty? %>
       <!-- Explicit Group Permissions -->
       <p><strong>Share with my Groups:</strong></p>
 
@@ -174,9 +225,9 @@
                 visiting the 'edit' page.
               </p>
             </div>
-            <% selected_option = (Conf.layouts[contributable.contribution.layout]["network_id"] unless
-                (contributable.contribution.nil? || contributable.contribution.layout.nil? ||
-                 Conf.layouts[contributable.contribution.layout].nil?)) %>
+            <% selected_option = (Conf.layouts[contributable.contribution.policy.layout]["network_id"] unless
+                (contributable.contribution.nil? || contributable.contribution.policy.nil? ||
+                 contributable.contribution.policy.layout.nil? || Conf.layouts[contributable.contribution.policy.layout].nil?)) %>
             <%= select_tag "layout", "<option value="">Default</option>" +
                 options_from_collection_for_select(applicable_networks.select {|n| n.layout_name if Conf.layouts[n.layout_name]},
                                                    'id','title', selected_option) %>
@@ -184,6 +235,8 @@
         <% end %>
       </div>
     <% end %>
+
+    </div>
   </div>
 </div>
 

Modified: branches/events/app/views/experiments/edit.rhtml (3490 => 3491)


--- branches/events/app/views/experiments/edit.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/experiments/edit.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,4 @@
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 
 <h1>Edit Experiment</h1>
 
@@ -11,7 +11,7 @@
 			<%= form.text_field :title, :size => 86 %>
 			
 			<p><b>Description</b></p>
-			<%= fckeditor_textarea(:experiment, :description, :toolbarSet => 'Simple', :width => '550px', :height => '300px') %>
+      <%= form.text_area(:description, :width => '550px', :height => '300px', :class => 'ckeditor') -%>
 			
 			<br/>
 			

Modified: branches/events/app/views/experiments/new.rhtml (3490 => 3491)


--- branches/events/app/views/experiments/new.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/experiments/new.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,4 @@
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 
 <h1>New Experiment</h1>
 
@@ -11,7 +11,7 @@
 			<%= form.text_field :title, :size => 86 %>
 			
 			<p><b>Description</b></p>
-			<%= fckeditor_textarea(:experiment, :description, :toolbarSet => 'Simple', :width => '550px', :height => '300px') %>
+      <%= form.text_area(:description, :width => '550px', :height => '300px', :class => 'ckeditor') -%>
 			
 			<br/>
 			

Modified: branches/events/app/views/feedback/index.rhtml (3490 => 3491)


--- branches/events/app/views/feedback/index.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/feedback/index.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -43,7 +43,7 @@
     	<%= text_field_tag :email, (logged_in? && current_user.email) ? current_user.email : params[:email], :size => 30 %>
 			
 			<p><b>Subject</b></p>
-    	<%= text_field_tag :subject, params[:subject], :size => 60 %>
+    	<%= text_field_tag :subject, params[:subject], :style => "width: 400px" %>
 			
 			<p><b>Message</b></p>
 			<textarea id="feedback_content" name="content" rows="8" style="width: 400px;"><%= params[:content] %></textarea><br/>

Modified: branches/events/app/views/gadgets/_asset_manager.rhtml (3490 => 3491)


--- branches/events/app/views/gadgets/_asset_manager.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/gadgets/_asset_manager.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -8,7 +8,7 @@
       <li><%= link_to(pluralize(current_user.friends.length, "Friend"), currentusers_things_url('friends')) %></li>
       <li><%= link_to(pluralize(current_user.networks_owned.length + current_user.networks.length, "Group"), currentusers_things_url('groups')) %></li>
       <% filter_contributables(current_user.contributions).each do |klass,contributables| %>
-        <li><%= link_to(pluralize(contributables.length, controller_visible_name(klass.humanize.pluralize)), currentusers_things_url(controller_visible_name(klass.humanize.pluralize).downcase)) %></li>
+				<li><%= link_to(pluralize(contributables.length, controller_visible_name(klass.humanize.pluralize).singularize), currentusers_things_url(klass)) %></li>
       <% end %>
     </ul>
   </div>
@@ -51,7 +51,7 @@
       <% filter_contributables(current_user.contributions, true).each do |klass, array| %>
         <div>
           <div class="title">
-          	<%= link_to(visible_name(klass.humanize).pluralize, currentusers_things_url(controller_visible_name(klass.humanize.pluralize).downcase)) %>
+          	<%= link_to(visible_name(klass.humanize).pluralize, currentusers_things_url(klass)) %>
 		  		</div>
           <div class="content">
             <ul class="gadget_list">

Modified: branches/events/app/views/group_announcements/_form.rhtml (3490 => 3491)


--- branches/events/app/views/group_announcements/_form.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/group_announcements/_form.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,4 @@
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 
 <%= error_messages_for 'announcement' %>
 
@@ -10,7 +10,7 @@
 
 <p>
 	<label for="" @announcement.nil? ? "" : @announcement.id -%>_body_editor"><b>Body</b></label><br/>
-  <center><%= fckeditor_textarea(:announcement, :body, :toolbarSet => 'Simple', :width => '535px', :height => '300px') %></center>
+  <center><%= form.text_area(:body, :width => '535px', :height => '300px', :class => 'ckeditor') -%></center>
 	<br/>
 	<label for=""
 		<%= check_box "announcement", "public", :style => "margin-right: 0.3em;" -%>Make this announcement public

Modified: branches/events/app/views/jobs/new.rhtml (3490 => 3491)


--- branches/events/app/views/jobs/new.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/jobs/new.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,4 @@
-<%= _javascript__include_tag "fckeditor/fckeditor.js" -%>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 
 <h1>New Job</h1>
 
@@ -54,7 +54,7 @@
 			<%= form.text_field :title, :size => 86 %>
 			
 			<p><b>Description</b></p>
-			<%= fckeditor_textarea(:job, :description, :toolbarSet => 'Simple', :width => '550px', :height => '300px') %>
+      <%= form.text_area(:description, :width => '550px', :height => '300px', :class => 'ckeditor') -%>
 			
 			<br/>
 			

Deleted: branches/events/app/views/layouts/_biovel.rhtml (3490 => 3491)


--- branches/events/app/views/layouts/_biovel.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/layouts/_biovel.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,26 +0,0 @@
-<% @logo_link_url  = "http://biovel.eu/" # The URL that the logo links to when clicked
-   @logo_image_url = "/images/biovel.png" # The logo image %>
-
-<% content_for :site_info_links do %>
-
-<% end %>
-
-<% content_for :logo do %>
-  <div style="float: left; margin-bottom: 0.5em">
-    <%= link_to image_tag(@logo_image_url), @logo_link_url, :style => "float: left" -%>
-    <div style="float: left; margin-top: 1em; margin-left: 1em">
-      <div style="font-weight: bold; vertical-align: middle">
-        <a href="" @logo_link_url -%>" class="biovel_logo_link">
-          <span style="font-size: 280%"><span style="color:black;">B</span>io<span style="color:black">V</span>e<span style="color:black">L</span></span><br/>
-          <span style="font-size: 100%">Biodiversity Virtual e-Laboratory</span>
-        </a>
-      </div>
-      <div style="margin: 0.5em 0 0 1em; color: black;">
-        on <%= link_to image_tag("/images/logo_tiny.png", :style=>"-moz-border-radius: 2px; border-radius: 2px; vertical-align: middle;border: 1px solid #ccc"), "/" -%>
-      </div>
-    </div>
-  </div>
-  <br class="clearer"/>
-<% end %>
-
-<%= render :partial => "layouts/myexperiment" %>

Modified: branches/events/app/views/layouts/_breadcrumbs_bar.rhtml (3490 => 3491)


--- branches/events/app/views/layouts/_breadcrumbs_bar.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/layouts/_breadcrumbs_bar.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -3,7 +3,8 @@
 		<td>
 			<ul class="breadcrumb_list">
 				<li><%= link_to "Home", home_url %></li>
-				<%= render :partial => "breadcrumbs" %>
+        <% # no better way to check for breadcrumbs partial...  %>
+				<%= render :partial => "breadcrumbs" rescue nil %>
 			</ul>
 		</td>
 		<td style="text-align: right; padding-left: 1em;">

Deleted: branches/events/app/views/layouts/_elico.rhtml (3490 => 3491)


--- branches/events/app/views/layouts/_elico.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/layouts/_elico.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,49 +0,0 @@
-<%# Defines a new header, then calls main myExperiment layout %>
-
-<% content_for :header do %>
-</div>
-
-<div id="elico_header">
-  <div class="logo">
-    <div style="float: left; margin-bottom: 0.5em">
-      <img src="" style="float: left; vertical-align: middle; width: 60px; height: 60px"/>
-      <div style="float: left; margin-top: 1em; margin-left: 1em">
-        <div style="font-size: 220%; font-weight: bold; vertical-align: middle">Data Mining Portal</div>
-        <div style="margin: 0.5em 0 0 1em">
-          on <%= link_to image_tag("/images/logo_tiny.png", :style=>"-moz-border-radius: 2px; border-radius: 2px; vertical-align: middle;border: 1px solid white"), "/" -%>
-        </div>
-      </div>
-    </div>
-    <div style="float: right; font-size: 120%; margin-top: 1.5em">
-      e-Laboratory for Interdisciplinary Collaborative Data Mining
-    </div>
-    <br class="clearer"/>
-  </div>
-  <div id="elico_links_bar">
-    <div id="inner">
-      <div style="float: left;" class="links">
-        <%= link_to "About", "http://www.e-lico.eu/?q=node/4", :target => '_blank' %> |
-        <%= link_to "Mailing List", "http://lists.e-lico.eu/mailman/listinfo/dm-myexperiment", :target => '_blank' %> |
-        <%= link_to "Publications", "http://www.e-lico.eu/?q=publications", :target => '_blank' %>
-      </div>
-      <div style="float: right;" class="links">
-        <%= render :partial => 'layouts/user_links' %>
-      </div>
-      <br class="clearer"/>
-    </div>
-  </div>
-</div>
-
-<div id="doc2" class="yui-t4" style="*overflow: visible; *height: auto">
-  <div id="hd">
-    <div id="myexp_tabs">
-      <%= render :partial => 'layouts/tab_bar' %>
-    </div>
-    <div id="myexp_searchbar">
-      <%= render :partial => "layouts/search" %>
-    </div>
-  </div>
-<% end %>
-
-<%# TODO: In rails 2, this can possibly be removed, and the layout specified when rendering the partial in application.rhtml %>
-<%= render :partial => "layouts/myexperiment" %>

Copied: branches/events/app/views/layouts/_myexperiment.html.erb (from rev 3490, trunk/app/views/layouts/_myexperiment.html.erb) (0 => 3491)


--- branches/events/app/views/layouts/_myexperiment.html.erb	                        (rev 0)
+++ branches/events/app/views/layouts/_myexperiment.html.erb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,114 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
+  <%= t :site => "#{Conf.sitename} &#45; #{controller_visible_name(controller.controller_name.humanize)}", :separator => "&#45;" %>
+  <% if @lod_rdf %><link rel="alternate" href="" @lod_rdf -%>" type="application/rdf+xml" title="RDF+XML" /><% end %>
+  <% if @lod_xml %><link rel="alternate" href="" @lod_xml -%>" type="application/xml" title="REST XML" /><% end %>
+  <link rel="shortcut icon" href="" type="image/x-icon"/>
+  <%= stylesheet_link_tag 'reset-fonts-grids', 'base-min', 'acts_as_taggable_stylesheet',
+                          'star_rating', 'gadgets', 'misc_skinning', address@hidden"stylesheets"] %>
+  <%= _javascript__include_tag :defaults, "boxover.js", "tabs.js", "folds.js" %>
+
+  <% if controller.action_name.downcase == "timeline" %>
+    <script src="" type="text/_javascript_"></script>
+  <% end -%>
+
+  <%= render :partial => "layouts/feed_link_tags" %>
+
+  <%= yield :head_options -%>
+</head>
+<body>
+
+<%= render :partial => "layouts/integrations/#{session[:came_from]}" unless session[:came_from].blank? %>
+
+<div id="doc2" class="yui-t4">
+
+  <% if @content_for_header %>
+    <%= yield :header %>
+  <% else %>
+    <div id="hd">
+      <div id="myexp_header">
+        <div class="logo">
+          <% if @content_for_logo %>
+            <%= yield :logo %>
+          <% else %>
+            <%= link_to image_tag(Conf.site_logo), "/" %>
+          <% end %>
+        </div>
+        <div id="myexp_links">
+          <div id="site_info_links" class="links">
+            <% if @content_for_site_info_links %>
+              <%= yield :site_info_links %>
+            <% else %>
+              <%= render :partial => 'layouts/site_info_links' %>
+            <% end %>
+          </div>
+          <div id="user_links" class="links">
+            <%= render :partial => 'layouts/user_links' %>
+          </div>
+        </div>
+      </div>
+      <div id="myexp_tabs">
+        <% if @content_for_tabs %>
+          <%= yield :tabs %>
+        <% else %>
+          <%= render :partial => 'layouts/tab_bar' %>
+        <% end %>
+      </div>
+      <div id="myexp_searchbar">
+        <%= render :partial => "layouts/search" %>
+      </div>
+    </div>
+  <% end %>
+
+
+  <% if @content_for_body %>
+    <%= yield :body %>
+  <% else %>
+    <div id="bd">
+      <div id="yui-main">
+        <div class="yui-b">
+          <div id="myexp_breadcrumbs_bar">
+            <%= render :partial => "layouts/breadcrumbs_bar" %>
+          </div>
+          <div id="myexp_content">
+            <%= render :partial => 'layouts/alerts' %>
+
+            <%= yield :layout %>
+
+          </div>
+        </div>
+      </div>
+      <div id="myexp_sidebar" class="yui-b">
+        <%= render :partial => "layouts/sidebar" %>
+      </div>
+    </div>
+  <% end %>
+
+
+  <% if @content_for_footer %>
+    <%= yield :footer %>
+  <% else %>
+      <% cache(:controller => 'global_cache', :action ="" 'footer') do -%>
+        <div id="ft">
+          <%= render :partial => "layouts/footer" %>
+        </div>
+      <br class="clearer"/>
+    <% end -%>
+  <% end %>
+
+
+  <%= render :partial => "layouts/debug" if Conf.show_debug %>
+</div>
+
+<%= render :partial => "layouts/web_analytics" if Conf.google_web_analytics["enable"] %>
+
+<% if @content_for_analytics %>
+  <%= yield :analytics %>
+<% end %>
+
+</body>
+</html>

Deleted: branches/events/app/views/layouts/_myexperiment.rhtml (3490 => 3491)


--- branches/events/app/views/layouts/_myexperiment.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/layouts/_myexperiment.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,109 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
-  <%= t :site => "#{Conf.sitename} &#45; #{controller_visible_name(controller.controller_name.humanize)}", :separator => "&#45;" %>
-  <% if @lod_rdf %><link rel="alternate" href="" @lod_rdf -%>" type="application/rdf+xml" title="RDF+XML" /><% end %>
-  <% if @lod_xml %><link rel="alternate" href="" @lod_xml -%>" type="application/xml" title="REST XML" /><% end %>
-  <link rel="shortcut icon" href="" type="image/x-icon"/>
-  <%= stylesheet_link_tag 'reset-fonts-grids', 'base-min', 'acts_as_taggable_stylesheet', 'star_rating', 'gadgets', address@hidden"stylesheets"] %>
-  <%= _javascript__include_tag :defaults, "boxover.js" %>
-
-  <% if controller.action_name.downcase == "timeline" %>
-    <script src="" type="text/_javascript_"></script>
-  <% end -%>
-
-  <%= render :partial => "layouts/feed_link_tags" %>
-
-  <%= yield :head_options -%>
-</head>
-<body>
-
-<%= render :partial => "layouts/integrations/#{session[:came_from]}" unless session[:came_from].blank? %>
-
-<div id="doc2" class="yui-t4">
-
-  <% if @content_for_header %>
-    <%= yield :header %>
-  <% else %>
-    <div id="hd">
-      <div id="myexp_header">
-        <div class="logo">
-          <% if @content_for_logo %>
-            <%= yield :logo %>
-          <% else %>
-            <%= link_to image_tag(Conf.site_logo), "/" %>
-          <% end %>
-          </div>
-        <div id="myexp_links">
-          <div style="text-align: left; float: left;" id="site_info_links" class="links">
-            <% if @content_for_site_info_links %>
-              <%= yield :site_info_links %>
-            <% else %>
-              <%= render :partial => 'layouts/site_info_links' %>
-            <% end %>
-          </div>
-          <div style="text-align: right; float: right;" id="user_links" class="links">
-            <%= render :partial => 'layouts/user_links' %>
-          </div>
-        </div>
-        <div class="clearer">&nbsp;</div>
-      </div>
-      <div id="myexp_tabs">
-        <%= render :partial => 'layouts/tab_bar' %>
-      </div>
-      <div id="myexp_searchbar">
-        <%= render :partial => "layouts/search" %>
-      </div>
-    </div>
-  <% end %>
-
-
-  <% if @content_for_body %>
-    <%= yield :body %>
-  <% else %>
-    <div id="bd">
-      <div id="yui-main">
-        <div class="yui-b">
-          <div id="myexp_breadcrumbs_bar">
-            <%= render :partial => "layouts/breadcrumbs_bar" %>
-          </div>
-          <div id="myexp_content">
-            <%= render :partial => 'layouts/alerts' %>
-
-            <%= yield :layout %>
-
-          </div>
-        </div>
-      </div>
-      <div id="myexp_sidebar" class="yui-b">
-        <%= render :partial => "layouts/sidebar" %>
-      </div>
-    </div>
-  <% end %>
-
-
-  <% if @content_for_footer %>
-    <%= yield :footer %>
-  <% else %>
-      <% cache(:controller => 'global_cache', :action ="" 'footer') do -%>
-        <div id="ft">
-          <%= render :partial => "layouts/footer" %>
-        </div>
-      <br class="clearer"/>
-    <% end -%>
-  <% end %>
-
-
-  <%= render :partial => "layouts/debug" if Conf.show_debug %>
-</div>
-
-<%= _javascript__include_tag "tabs.js" %>
-<%= _javascript__include_tag "folds.js" %>
-
-<%= render :partial => "layouts/web_analytics" if Conf.google_web_analytics["enable"] %>
-
-</body>
-</html>

Modified: branches/events/app/views/layouts/_paginate.rhtml (3490 => 3491)


--- branches/events/app/views/layouts/_paginate.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/layouts/_paginate.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,3 +1,5 @@
+<%= stylesheet_link_tag "pagination" %>
+
 <% if local_assigns[:sort_by] %>
   <div style="float: right; margin: 1em;">
     Sort by:
@@ -20,37 +22,7 @@
   </div>
 <% end %>
 
-<% if collection.page_count != collection.first_page -%>
-<div class="pagination">
-
-  <ul>
-  <% if collection.previous_page? -%>
-         <li class="nextpage">
-	    	    <%= link_to('&#171; previous', request.query_parameters.merge("page" => collection.previous_page)) %>
-	    	 </li>
-	  <% else -%>
-         <li class="disabledpage">&#171; previous</li>
-	  <% end -%>
- 
-    <% last_page = 0 -%>
-    <% windowed_pagination_links(collection, :window_size => 2, :link_to_current_page => true, :always_show_anchors => true) do |n| -%>
-       <% if collection.page == n -%>
-            <li class="currentpage"><%= n %></li>
-       <% else -%>
-	          <li><%= "..." if last_page+1 < n %>
-	           <%= link_to(n, request.query_parameters.merge("page" => n)) %>
-	          </li>
-	       <% end -%>
-	      <% last_page = n -%>
-	  <% end -%>
- 
-    <% if collection.next_page? -%>
-     <li class="nextpage">
-        <%= link_to('next &#187;', request.query_parameters.merge("page" => collection.next_page)) %>
-     </li>
-    <% else -%>
-      <li class="disabledpage">next &#187;</li>
-    <% end -%>
-  </ul>
+<div class="digg_pagination" style="text-align: center">
+  <%= will_paginate(collection, :outer_window => 0, :inner_window => 2) -%>
 </div>
-<% end -%>
+

Deleted: branches/events/app/views/layouts/_scape.html.erb (3490 => 3491)


--- branches/events/app/views/layouts/_scape.html.erb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/layouts/_scape.html.erb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,9 +0,0 @@
-<% @logo_link_url  = "http://www.scape-project.eu/" # The URL that the logo links to when clicked
-   @logo_image_url = "/images/scape_logo.png" # The logo image %>
-
-<% content_for :site_info_links do %>
-  <a target="_blank" href="" SCAPE</a> |
-  <a target="_blank" href="" Wiki</a>
-<% end %>
-
-<%= render :partial => "layouts/skin_template" %>

Copied: branches/events/app/views/layouts/application.html.erb (from rev 3490, trunk/app/views/layouts/application.html.erb) (0 => 3491)


--- branches/events/app/views/layouts/application.html.erb	                        (rev 0)
+++ branches/events/app/views/layouts/application.html.erb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1 @@
+<%= render :partial => Conf.page_template %>

Deleted: branches/events/app/views/layouts/application.rhtml (3490 => 3491)


--- branches/events/app/views/layouts/application.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/layouts/application.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,2 +0,0 @@
-<% configure_layout %>
-<%= render :partial => @layout["layout"] %>
\ No newline at end of file

Copied: branches/events/app/views/layouts/integrations/_statjr.html.erb (from rev 3490, trunk/app/views/layouts/integrations/_statjr.html.erb) ( => )


Modified: branches/events/app/views/licenses/_form.rhtml
===================================================================
--- branches/events/app/views/licenses/_form.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/licenses/_form.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,4 @@
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 <%= _javascript__include_tag 'license_attributes' %>
 
 <!--[form:license]-->
@@ -15,7 +15,7 @@
 <%= render :partial => "license_attributes/attributes_form", :locals => { :edit => true, :license => @license } %>
 
 <h2><label for=""
-<%= fckeditor_textarea(:license, :description, :toolbarSet => 'Simple', :width => '700px', :height => '300px') %></p>
+<%= form.text_area :description, :width => '700px', :height => '300px', :class => 'ckeditor'  -%></p>
 <br/><br/>
 
 <!--[eoform:license]-->

Modified: branches/events/app/views/memberships/_table.rhtml (3490 => 3491)


--- branches/events/app/views/memberships/_table.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/memberships/_table.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -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/events/app/views/networks/_breadcrumbs.rhtml (3490 => 3491)


--- branches/events/app/views/networks/_breadcrumbs.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/networks/_breadcrumbs.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,8 +1,15 @@
-<li><%= link_to 'Groups', networks_path -%></li>
+<% if controller.action_name == 'index' %>
+  <li>Groups</li>
+<% else %>
+  <li><%= link_to 'Groups', networks_path %></li>
+<% end %>
 
-<% 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/events/app/views/networks/_form.rhtml (3490 => 3491)


--- branches/events/app/views/networks/_form.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/networks/_form.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,4 @@
-  <%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+  <%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 	
 	<p>
     <b>Owner</b><br />
@@ -43,6 +43,6 @@
 	<p>
   	<strong>Description: </strong>
 	</p>
-	<%= fckeditor_textarea(:network, :description, :toolbarSet => 'Simple', :width => '700px', :height => '300px') %>
+	<%= form.text_area(:description, :width => '700px', :height => '300px', :class => 'ckeditor') %>
 
  

Modified: branches/events/app/views/networks/_members.rhtml (3490 => 3491)


--- branches/events/app/views/networks/_members.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/networks/_members.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -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/events/app/views/networks/_table.rhtml (3490 => 3491)


--- branches/events/app/views/networks/_table.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/networks/_table.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,89 +1,91 @@
 <% query ||= false -%>
-<% odd_row = false -%>
-<% unless collection.empty? -%>
-	<table class="alt_table">
-		<% for network in collection -%>
-			<tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" %>">
-					<td style="width: 120px;">
-						<p style="margin-top:0; padding-top:0; text-align: center;"><b>Owner:</b></p>
-						<center><%= contributor(network.user_id, "User", true, 80) %></center>
-					</td>
-					<td style="text-align: left;">
-						<p class="title">
-							<% if (current_user != 0) && (network.user_id == current_user.id) %>
-								<%= icon "network-owned", nil, nil, nil, '' %>
-							<% else %>
-								<%= icon "network-member", nil, nil, nil, '' %>
-							<% end %>
-							<%=link_to(query ? highlight_all(h(network.title), query) : h(network.title), network_path(network)) %>
-						</p>
-				<% cache(:controller => 'groups_cache', :action ="" 'listing', :id => network.id) do -%>
-						<p style="font-size: 85%;">
-							<% if network.unique_name and network.unique_name.length > 0 %>
-								<b>Unique name: </b><%=h network.unique_name -%>
-							<% end %>
-							<b>Created: </b><%=datetime network.created_at, true -%>
-						</p>
-						
-						<div class="desc">
-							<div style="font-size: 85%;">
-							<% if network.description and network.description.length > 0 -%>
-								<% desc = truncate(strip_html(network.description), :length => 400) -%>
-								<%= query ? highlight_all(desc, query) : desc -%>
-							<% else -%>
-								<span class="none_text">No description</span>
-							<% end -%>
-							</div>
-						</div>
-						
-						<p class="standout" style="margin-top: 0.4em;">
-							<%= pluralize network.shared_contributions.length, "shared item" -%>
-							&nbsp;&nbsp;|&nbsp;&nbsp;
-							<% # both private & public announcements -%>
-							<%= pluralize network.announcements.length, "announcements" -%>
-						</p>
-						
-						<% 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>
-						<% end -%>
-						
-						<% unless (tags = network.tags).empty? -%>
-							<a href="" network_path(network) + '#tags' -%>"><p style="font-size: 85%;"><b>Tags:</b></p></a>
-							<div style="display:inline;" class="tags_onesize"><%= tag_cloud_from_collection tags, true %></div>
-					  <% else -%>
-							<p style="font-size: 85%;"><i>This Group has not been tagged yet!</i></p>
-					  <% end -%>
-				<% end -%>
-						<% latest_announcement = network.announcements_for_user(current_user).first -%>
-						<% unless latest_announcement.nil? -%>
-						  <p style="font-size: 85%; margin-top: 0.7em;">
-							  <b>Latest announcement:</b>:
-								<%= link_to latest_announcement.title, group_announcement_path(network, latest_announcement) -%>
-							</p>
-						<% end -%>
-					</td>
-					<td class="actions">
-						<%= icon "show", network_path(network), nil, nil, "View" %>
-						<% if mine? network -%>
-							<%= icon "manage", edit_network_path(network) %>
-						<% elsif logged_in? %> <!-- admins can't leave the group or request membership! -->
-						  <% if network.member?(current_user.id) %>
-							  <!-- user is not an admin, but a member already -->
-								<% cur_membership = Membership.find(:first, :conditions => ["network_id = ? AND user_id = ?", network.id, current_user.id] ) %>
-			          <% if cur_membership %>
-			            <%= icon('network-leave', user_membership_path(cur_membership.user_id, cur_membership) + "?return_to=" + networks_path, nil, { :confirm => "Are you sure want to leave this group?", :method => :delete }, 'Leave Group') %>
-			          <% end %>
-							<% elsif !current_user.membership_pending?(network.id) && !network.invitation_only? %>
-							  <!-- not an admin, not a member yet and hasn't got pending request -->
-								<%= request_membership_link(current_user.id, network.id) %>
-							<% end %>
-						<% end -%>
-					</td>
-			</tr>
-		<% end -%>
-	</table>
-	<br/>
-<% end -%>
+
+<% collection.each do |network| -%>
+
+  <div class="resource_list_item">
+
+    <div class="avatar_panel" style="width: 7em">
+      <span class="owner">Owner</span>
+      <%= contributor(network.user_id, "User", true, 80) %>
+    </div>
+
+    <div class="main_panel" style="margin-left: 7.5em">
+
+      <div class="actions">
+        <%= icon "show", network_path(network), nil, nil, "View" %>
+        <% if mine? network -%>
+          <%= icon "manage", edit_network_path(network) %>
+        <% elsif logged_in? %> <!-- admins can't leave the group or request membership! -->
+          <% if network.member?(current_user.id) %>
+            <!-- user is not an admin, but a member already -->
+            <% cur_membership = Membership.find(:first, :conditions => ["network_id = ? AND user_id = ?", network.id, current_user.id] ) %>
+            <% if cur_membership %>
+              <%= icon('network-leave', user_membership_path(cur_membership.user_id, cur_membership) + "?return_to=" + networks_path, nil, { :confirm => "Are you sure want to leave this group?", :method => :delete }, 'Leave Group') %>
+            <% end %>
+          <% elsif !current_user.membership_pending?(network.id) && !network.invitation_only? %>
+            <!-- not an admin, not a member yet and hasn't got pending request -->
+            <%= request_membership_link(current_user.id, network.id) %>
+          <% end %>
+        <% end -%>
+      </div>
+
+      <p class="title">
+        <% if (current_user != 0) && (network.user_id == current_user.id) %>
+          <%= icon "network-owned", nil, nil, nil, '' %>
+        <% else %>
+          <%= icon "network-member", nil, nil, nil, '' %>
+        <% end %>
+        <% truncated_title = truncate(network.title, :length => 45) %>
+        <%=link_to(query ? highlight_all(truncated_title, query) : truncated_title, network_path(network),
+                   :title => network.title) %>
+      </p>
+
+      <% cache(:controller => 'groups_cache', :action ="" 'listing', :id => network.id) do -%>
+        <p>
+          <% if network.unique_name and network.unique_name.length > 0 %>
+            <b>Unique name: </b><%=h network.unique_name -%>
+          <% end %>
+          <br/>
+          <b>Created: </b><%=datetime network.created_at, true -%>
+        </p>
+
+        <div class="desc">
+          <% if network.description and network.description.length > 0 -%>
+            <% desc = truncate(strip_html(network.description), :length => 400) -%>
+            <%= query ? highlight_all(desc, query) : desc -%>
+          <% else -%>
+            <span class="none_text">No description</span>
+          <% end -%>
+        </div>
+
+        <p class="standout">
+          <%= pluralize network.shared_contributions.length, "shared item" -%>
+          &nbsp;&nbsp;|&nbsp;&nbsp;
+          <% # both private & public announcements -%>
+          <%= pluralize network.announcements.length, "announcements" -%>
+        </p>
+
+        <% unless network.members.empty? -%>
+          <div class="desc">
+            <p><b>Members (<%= network.members.length %>):</b></p>
+            <div style="font-size: 77%;"><%= render :partial => "networks/members", :locals => { :collection => network.members(true), :size => 40, :limit => 6 } %></div>
+          </div>
+        <% end -%>
+
+        <% unless (tags = network.tags).empty? -%>
+          <a href="" network_path(network) + '#tags' -%>"><p style="font-size: 85%;"><b>Tags:</b></p></a>
+          <div style="display:inline;" class="tags_onesize"><%= tag_cloud_from_collection tags, true %></div>
+        <% else -%>
+          <p><i>This Group has not been tagged yet!</i></p>
+        <% end -%>
+      <% end -%>
+      <% latest_announcement = network.announcements_for_user(current_user).first -%>
+      <% unless latest_announcement.nil? -%>
+        <p style="margin-top: 0.7em;">
+          <b>Latest announcement:</b>:
+          <%= link_to latest_announcement.title, group_announcement_path(network, latest_announcement) -%>
+        </p>
+      <% end -%>
+    </div>
+  </div>
+<% end %>

Copied: branches/events/app/views/networks/content.rhtml (from rev 3490, trunk/app/views/networks/content.rhtml) (0 => 3491)


--- branches/events/app/views/networks/content.rhtml	                        (rev 0)
+++ branches/events/app/views/networks/content.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,4 @@
+<h1>Content from the <%=h @network.title -%> group</h1>
+
+<%= render :partial => "content/index" -%>
+

Modified: branches/events/app/views/networks/show.rhtml (3490 => 3491)


--- branches/events/app/views/networks/show.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/networks/show.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -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,11 +12,10 @@
 			</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] ) %>
-			  <% if cur_membership %>
+			  <% if false %>
 			    <li><%= icon('network-leave', user_membership_path(cur_membership.user_id, cur_membership), nil, { :confirm => "Are you sure want to leave this group?", :method => :delete }, 'Leave Group') %></li>
 			  <% end %>
 			<% elsif !current_user.membership_pending?(@network.id) && address@hidden %>
@@ -26,13 +26,17 @@
     <% if @network.administrator?(current_user.id) %>
       <li><%= icon('announcement', new_group_announcement_path(@network), 'Make a new Group Announcement', nil, 'Make a Group Announcement') -%></li>
 			<li><%= icon('network-invite', invite_network_path(@network), 'Invite People', nil, 'Invite People') -%></li>
+      <li><%= icon('policy', network_policies_path(@network), 'Group Policies', nil, 'Group Policies') -%></li>
     <% end %>
     <% if mine? @network %>
 			<li><%= icon('edit', edit_network_path(@network), 'Edit', nil, 'Edit Group') %></li>
+    <% end %>
+    <% if mine?(@network) || current_user.admin? %>
       <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 +48,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 +72,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 +185,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>
 

Modified: branches/events/app/views/oauth/_form.rhtml (3490 => 3491)


--- branches/events/app/views/oauth/_form.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/oauth/_form.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,54 +1,17 @@
 <div class="field">
-	<label for=""
-	<%=f.text_field :name %>
+  <label for=""
+  <%=f.text_field :name %>
 </div>
 <div class="field">
-        <% if current_user.admin? %>
-          <label for=""
-	  <% unless @client_application.id %>  
-	    <%= select_tag "client_application[key_type]", options_for_select([ "User", "System"], "User") %>
-	  <% else %>
-	    <%= select_tag "client_application[key_type]", options_for_select([ "User", "System"], @client_application.key_type) %>
-	  <% end %>
+  <label for="" Application URL*</label><br/>
+  <%=f.text_field :url%>
 </div>
 <div class="field">
-	  <label for="" User*</label><br/>
-          <% unless @client_application.id %>
-            <select id="client_application[user_id]" name="client_application[user_id]" %>
-              <% all_users().each do |u| %>
-	        <option <%= 'selected="selected"' if u.id==current_user.id %> value="<%= u.id %>"><%= h(u.name) %></option><% end %>
-            </select>
-          <% else %>
-            <select id="client_application[user_id]" name="client_application[user_id]">
-              <% all_users().each do |u| %>
-	         <option <%= 'selected="selected"' if address@hidden %> value="<%= u.id %>"><%= h(u.name) %></option><% end %>
-            </select>
-	  <% end %>
-	<% else %>
-          <%= f.hidden_field :user_id, :value => current_user.id %>
-	  <% unless @client_application.id %>
-	    <%= f.hidden_field :key_type, :value => "User" %>
-	  <% else %>
-	     <%= f.hidden_field :key_type, :value => @client_application.key_type %>
-	  <% end %>
-	<% end %>
-	<% unless @client_application.id %>
-	  <%= f.hidden_field :creator_id, :value => current_user.id %>
-	<% else %>
-	  <%= f.hidden_field :creator_id, :value => @client_application.creator_id %>
-	<% end %>
-
+  <label for="" URL*</label><br/>
+  <%=f.text_field :callback_url%>
 </div>
 <div class="field">
-	<label for="" Application URL*</label><br/>
-	<%=f.text_field :url%>
+  <label for="" URL</label><br/>
+  <%=f.text_field :support_url%>
 </div>
-<div class="field">
-	<label for="" URL*</label><br/>
-	<%=f.text_field :callback_url%>
-</div>
-<div class="field">
-	<label for="" URL</label><br/>
-	<%=f.text_field :support_url%>
-</div>
 

Modified: branches/events/app/views/oauth/_permissions.rhtml (3490 => 3491)


--- branches/events/app/views/oauth/_permissions.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/oauth/_permissions.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,5 +1,4 @@
 <h2>Permissions</h2>
-<% checkboxes=[] %>
 <% permissions_categorised=permissions_categorised(@permissions) %>
 <% for category,permissions in permissions_categorised %>
   <h3><%= category.capitalize %></h3>
@@ -8,34 +7,16 @@
     <% for type,data in permission -%>
       <% key=data['URI'] -%>
       <% key_type = "#{type} #{key}" -%>
-      <% if (@permissions_for.include?(key_type)) %>
-        <%=check_box_tag "key_permissions[#{type} #{key}]", 1,  true %> <%= type %> <%= key %>
-      <% else %>
-        <%=check_box_tag "key_permissions[#{type} #{key}]" %> <%= type %> <%= key %>
-      <% end -%>
-      <% checkboxes.push("key_permissions[#{type} #{key}]"); %>
-      &nbsp;&nbsp;&nbsp;&nbsp;
+      <% checked = @permissions_for.include?(key_type) %>
+      <%= check_box_tag "key_permissions[#{type} #{key}]", 1,  checked, :class => "permission" %> <%= type %> <%= key %>
     <% end %>
   <% end -%>
   </p>
 <% end %>
 <br/>
 <p style="text-align:center;" >
-  <input type="button" name="check_all" value="Check All"  checkboxes = new Array();
-  <% i = 0 -%> 
-  <% for c in checkboxes %>
-      <%= "checkboxes[#{i}]='#{c}';" -%>
-      <% i=i+1 -%>
-  <% end -%>
-  checkAll(checkboxes);" />
-  &nbsp;&nbsp;&nbsp;&nbsp;
-  <input type="button" name="uncheck_all" value="Uncheck All"  checkboxes = new Array();
-  <% i = 0 -%>
-  <% for c in checkboxes %>
-      <%= "checkboxes[#{i}]='#{c}';" -%>
-      <% i=i+1 -%>
-  <% end -%>
-  uncheckAll(checkboxes);" />
+  <input type="button" name="check_all" value="Check All"  (e) { e.checked = true });"/>
+  <input type="button" name="uncheck_all" value="Uncheck All"  (e) { e.checked = false });"/>
 </p>
 
 

Modified: branches/events/app/views/oauth/edit.rhtml (3490 => 3491)


--- branches/events/app/views/oauth/edit.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/oauth/edit.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,17 +1,13 @@
 <h1>Edit OAuth details for <address@hidden></h1>
 
-<% form_for :client_application, :url ="" { :action ="" :update } do |f| %>
-       <%= f.hidden_field :id %>
-       <%= render :partial => "form", :locals => { :f => f } %>
-       <% if (@client_application.nil? or current_user.admin?) %>
-         <%= render :partial => "permissions", :locals => { :f => f } %>
-       <% else %>
-         <% if (@client_application.key_type=="User") %>
-	   <%= render :partial => "permissions", :locals => { :f => f } %>
-         <% else %>
-	   <%= render :partial => "show_permissions"  %>
-         <% end %>
-       <% end %>
- <br/><br/>        
+<% form_for @client_application, :url ="" { :action ="" "update", :controller => "oauth" }, :method => :put do |f| %>
+
+  <%= f.hidden_field :id %>
+
+  <%= render :partial => "form", :locals => { :f => f } %>
+
+  <%= render :partial => "permissions", :locals => { :f => f } %>
+
+ <br/><br/>
  <p style="text-align: center; font-weight: bold;"><%= submit_tag "Update" %></p>
 <% end %>

Modified: branches/events/app/views/oauth/index.rhtml (3490 => 3491)


--- branches/events/app/views/oauth/index.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/oauth/index.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -31,16 +31,6 @@
 		<div><%=link_to client.name,:action=""
 	<%end%>
 <%end%>
-<% if current_user.admin? %>
-<h3>Client Applications You Have Created For Other Users</h3>
-<% if @admin_client_applications.empty? %>
-	<p>You do not currently have any client applications that you have created or other users.</p>
-<%else%>
-	<address@hidden do |client|%>
-                <div><%=link_to client.name,:action=""
-        <%end%>
-<% end %>
-<% end %>
 <ul class="sectionIcons">
 	<li><%= icon "register_application", {:controller =>'oauth',:action="" nil, nil, "Register Client Application" %></li>
 </ul>

Modified: branches/events/app/views/oauth/show.rhtml (3490 => 3491)


--- branches/events/app/views/oauth/show.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/oauth/show.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -6,9 +6,6 @@
 <p>
         <b>Main Application URL:</b> <address@hidden>
 </p>
-<p>
-	<b>Key Type:</b> <address@hidden>
-</p>
 <% if current_user.admin? %>
 <p>
 	<b>For User:</b> <a href="" user_path(@client_application.user.id) %>"><address@hidden></a>

Modified: branches/events/app/views/packs/_breadcrumbs.rhtml (3490 => 3491)


--- branches/events/app/views/packs/_breadcrumbs.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/packs/_breadcrumbs.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,5 +1,14 @@
-<li><%= link_to 'Packs', packs_path %></li>
+<% if @context %>
+  <li><%= link_to visible_name(@context).pluralize, polymorphic_url(@context.class.name.underscore.pluralize) %></li>
+  <li><%= link_to @context.name, @context %></li>
+<% end %>
 
+<% if controller.action_name == 'index' %>
+  <li>Packs</li>
+<% else %>
+  <li><%= link_to 'Packs', packs_path %></li>
+<% end %>
+
 <% if ["show", "new", "edit", "all", "new_item", "edit_item", "search"].include? controller.action_name.to_s %>
   <% case controller.action_name.to_s; when "show" %>
     <li><%= h(@pack.title) %></li>

Modified: branches/events/app/views/packs/_items.rhtml (3490 => 3491)


--- branches/events/app/views/packs/_items.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/packs/_items.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,6 +1,6 @@
 <div id="packItems">
 	
-	<% if pack.items_count > 0 -%>
+	<% if (contributable_entries.size + remote_entries.size) > 0 -%>
 		
 		<% if false -%>
 		<%= view_privileges_notice -%>
@@ -10,7 +10,7 @@
 		<ul id="packItemsList">
 			
 			<!-- Contributable Item Entries -->
-			<% pack.contributable_entries.each do |e| %>
+			<% contributable_entries.each do |e| %>
 				<% show = e.available? ? Authorization.check("view", e.contributable, current_user) : false -%>
 				<li>
 					<table>
@@ -37,8 +37,7 @@
 									
 										<b><%= visible_name(e.contributable_type) -%>:</b>
 										<% unless e.contributable_version.blank? -%>
-											<% # HACK: only workflows are versioned at the moment -%>
-											<%= versioned_workflow_link e.contributable_id, e.contributable_version, false -%>
+											<%= versioned_resource_link e.contributable, e.contributable_version, false -%>
 											<% if false %><span style="color: #666666;">(version <%= e.contributable_version -%>)</span><% end %>
 										<% else -%>
 											<%= contributable(e.contributable_id, e.contributable_type) %>
@@ -98,7 +97,7 @@
 			<% end -%>
 			
 			<!-- Remote Item Entries -->
-			<% pack.remote_entries.each do |e| %>
+			<% remote_entries.each do |e| %>
 				<li>
 					<table>
 						<tr>

Modified: branches/events/app/views/packs/_table.rhtml (3490 => 3491)


--- branches/events/app/views/packs/_table.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/packs/_table.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,74 +1,80 @@
 <% query ||= false -%>
-<% odd_row = false -%>
-<% unless collection.empty? %>
 
-<table class="alt_table">
-	<% for pack in collection %>
-		<% # If only one item in collection, check if 'show' permission is available (eg: if this partial was called from contributions/table) -%>
-		<% if collection.size == 1 -%>
-			<% show ||= Authorization.check("view", pack, current_user) -%>
-		<% else -%>
-			<% show = Authorization.check("view", pack, current_user) -%>
-		<% end -%>
-	  <% if show -%>
-			<% cache(:controller => 'packs_cache', :action ="" 'listing', :id => pack.id) do -%>
-				<tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" %>">
-					<td style="width: 100px;">
-						<p style="margin-top:0; padding-top:0; text-align: center;"><b><%= owner_text pack -%>:</b></p>
-						<center><%= contributor(pack.contribution.contributor_id, pack.contribution.contributor_type, true, 60) %></center>
-					</td>
-					<td style="text-align: left;">
-						<a name="<%= pack.title.gsub(/ /, "_") %>"></a>
-						<p class="title">
-							<%= icon "pack", nil, nil, nil, '' %>
-							<% title = contributable_name(pack.id, 'Pack') %>
-							<%=link_to(query ? highlight_all(title, query) : title, pack_path(pack)) %>
-						</p>
-						
-						<p style="font-size: 85%; margin-top: 0; padding-top: 0;">
-							<b>Created:</b> <%=datetime pack.contribution.created_at, false %>
-							<% unless pack.contribution.created_at == pack.contribution.updated_at %>
-								|	<b>Last updated:</b> <%=datetime pack.contribution.updated_at, false %>
-							<% end %>
-						</p>
-						
-						<div class="desc" style="font-size: 85%;">
-							<% unless pack.description.blank? %>
-					  		<% desc = truncate(strip_html(pack.description), :length => 500) %>
-					    	<%= query ? highlight_all(desc, query) : desc %>
-						  <% else -%>
-								<span class="none_text">No description</span>
-							<% end %>
-						</div>
-						
-						<p class="standout" style="margin-top: 0.4em;">
-							<%= pluralize pack.items_count, "item" -%> in this pack
-						</p>
-						
-						<p style="font-size: 85%;">
-							<a href="" pack_path(pack) + '#comments' -%>"><b>Comments: </b><%= pack.comments.count %></a> |
-							<b>Viewed:</b> <%=pluralize pack.contribution.site_viewings_count, "time" %> |
-				      <b>Downloaded:</b> <%=pluralize pack.contribution.site_downloads_count, "time" %>
-						</p>
-						
-						<% unless (tags = pack.tags).empty? %>
-							<a href="" pack_path(pack) + '#tags' -%>"><p style="font-size: 85%;"><b>Tags:</b></p></a>
-							<div style="display:inline;" class="tags_onesize"><%= tag_cloud_from_collection tags, true %></div>
-						<% else %>
-							<p style="font-size: 85%;"><i>This Pack has no tags!</i></p>
-						<% end %>	
-					</td>
-					
-					<td class="actions" style="width: 80px;">
-				    <%= icon "show", pack_path(pack), nil, nil, "View" %>
-						<% if Authorization.check("download", pack, current_user) -%><%= icon('download', download_pack_path(pack), nil, nil, 'Download') -%><% end -%>
-				    <% if mine?(pack) %><%= icon "manage", edit_pack_path(pack), nil, nil, "Manage" %><% end %>
-						<% if Authorization.check("edit", pack, current_user) -%><%= icon('new', new_item_pack_path(pack), nil, nil, 'Add New Item') -%><% end -%>
-				  </td>
-				</tr>
-			<% end %>
-		<% end %>
-	<% end %>
-</table>
+<% collection.each do |pack| %>
+  <% # If only one item in collection, check if 'show' permission is available (eg: if this partial was called from contributions/table) -%>
+  <% if collection.size == 1 -%>
+    <% show ||= Authorization.check("view", pack, current_user) -%>
+  <% else -%>
+    <% show = Authorization.check("view", pack, current_user) -%>
+  <% end -%>
+  <% if show -%>
 
+    <div class="resource_list_item <%= pack.contribution.policy.layout -%>">
+
+      <div class="avatar_panel">
+        <span class="owner"><%= owner_text pack -%></span>
+        <%= contributor(pack.contribution.contributor_id, pack.contribution.contributor_type, true, 60) %>
+        <% if layout = pack.contribution.policy.layout %>
+          <% begin %>
+            <%= render :partial => "layouts/skins/branding/#{layout}" %>
+          <% rescue ActionView::MissingTemplate %>
+          <% end %>
+        <% end %>
+      </div>
+
+      <div class="main_panel">
+
+        <div class="actions">
+          <%= icon "show", pack_path(pack), nil, nil, "View" %>
+          <% if Authorization.check("download", pack, current_user) -%><%= icon('download', download_pack_path(pack), nil, nil, 'Download') -%><% end -%>
+          <% if mine?(pack) %><%= icon "manage", edit_pack_path(pack), nil, nil, "Manage" %><% end %>
+          <% if Authorization.check("edit", pack, current_user) -%><%= icon('new', new_item_pack_path(pack), nil, nil, 'Add New Item') -%><% end -%>
+        </div>
+
+        <% cache(:controller => 'packs_cache', :action ="" 'listing', :id => pack.id) do -%>
+          <a name="<%= pack.title.gsub(/ /, "_") %>"></a>
+          <p class="title">
+            <%= icon "pack", nil, nil, nil, '' %>
+            <% truncated_title = truncate(pack.title, :length => 55) %>
+            <%=link_to(query ? highlight_all(truncated_title, query) : truncated_title, pack_path(pack),
+                       :title => pack.title) %>
+          </p>
+
+          <br/>
+          <p>
+            <b>Created:</b> <%=datetime pack.contribution.created_at, false %>
+            <% unless pack.contribution.created_at == pack.contribution.updated_at %>
+              |	<b>Last updated:</b> <%=datetime pack.contribution.updated_at, false %>
+            <% end %>
+          </p>
+
+          <div class="desc">
+            <% unless pack.description.blank? %>
+              <% desc = truncate(strip_html(pack.description), :length => 500) %>
+              <%= query ? highlight_all(desc, query) : desc %>
+            <% else -%>
+              <span class="none_text">No description</span>
+            <% end %>
+          </div>
+
+          <p class="standout">
+            <%= pluralize pack.items_count, "item" -%> in this pack
+          </p>
+
+          <p>
+            <a href="" pack_path(pack) + '#comments' -%>"><b>Comments: </b><%= pack.comments.count %></a> |
+            <b>Viewed:</b> <%=pluralize pack.contribution.site_viewings_count, "time" %> |
+            <b>Downloaded:</b> <%=pluralize pack.contribution.site_downloads_count, "time" %>
+          </p>
+
+          <% unless (tags = pack.tags).empty? %>
+            <a href="" pack_path(pack) + '#tags' -%>"><p><b>Tags:</b></p></a>
+            <div style="display:inline;" class="tags_onesize"><%= tag_cloud_from_collection tags, true %></div>
+          <% else %>
+            <p><i>This Pack has no tags!</i></p>
+          <% end %>
+        <% end %>
+      </div>
+    </div>
+  <% end %>
 <% end %>

Copied: branches/events/app/views/packs/_version_selector.rhtml (from rev 3490, trunk/app/views/packs/_version_selector.rhtml) (0 => 3491)


--- branches/events/app/views/packs/_version_selector.rhtml	                        (rev 0)
+++ branches/events/app/views/packs/_version_selector.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,82 @@
+<script type="text/_javascript_">
+  function showVersion(form) {
+    var url = ""
+		location.href = ""
+		form.submit
+  }
+</script>
+
+<div class="contribution_version_selector_box">
+
+  <table>
+    <tbody>
+      <tr>
+        <td class="heading" style="vertical-align: top;">
+          <% if version %>
+            <%= info_icon_with_tooltip("This box shows version #{version.version.to_s} for this entry") -%>
+            <span><%= "Version #{version.version.to_s} #{resource.describe_version(version.version)}" -%></span>
+            <span class="count_text">(of <%= resource.versions.length -%>)</span>
+          <% else %>
+            <%= info_icon_with_tooltip("This box shows the live version for this entry") -%>
+            <span>Live view</span>
+            <% if resource.versions.length > 0 %>
+              <span class="count_text">(<%= resource.versions.length -%> versions available)</span>
+            <% end %>
+          <% end %>
+          <a name="versions"></a>
+        </td>
+        <td>
+          <% if resource.versions.length > 0 %>
+             <form  return false;" style="text-align: right;">
+              <b>View version: </b>
+              <select id="resource_versions" 
+                <option value="<%= polymorphic_path(resource) %>" <%= "selected" if version.nil? -%>>Live view</option>
+                <% resource.versions.reverse.each do |v| %>
+                  <option value="<%= send(path, resource, v.version.to_s) %>" <%= "selected" if !version.nil? && v.version == version.version -%>>
+                      <%= "#{v.version.to_s} #{resource.describe_version(v.version)}" %>
+                  </option>
+                <% end %>
+              </select>
+            </form>
+          <% end %>
+        </td>
+      </tr>
+    </tbody>
+  </table>
+      
+  <% if version %>
+    <div id="version_info_box" style="color: #666666;  font-size: 85%; margin: 0.6em 0.5em 0.2em 0.5em; border-top: 1px solid #DDDDDD; padding-top: 0.4em;">
+      <p style="text-align: center;">
+        <b>Version created on:</b>
+        <span><%= datetime version.created_at, false %></span>
+        <% if version.respond_to?(:contributor_id) && version.respond_to?(:contributor_type) %>
+          <b>by:</b>
+          <span><%= contributor(version.contributor_id, version.contributor_type) %></span>
+        <% end %>
+        <% if !version.revision_comments.blank? %>
+          <span>&nbsp;&nbsp;|&nbsp;&nbsp;</span>
+          <span><%= link_to_function "Revision comment " + expand_image, visual_effect(:toggle_blind, "version_info_box_comments", :duration => 0.3) %></span>
+        <% end %>
+      </p>
+      
+      <% unless version.created_at == version.updated_at %>
+        <p style="text-align: center;">
+          <b>Last edited on:</b>
+          <span><%= datetime version.updated_at, false %></span>
+          <% if version.respond_to?(:last_edited_by) %>
+            <b>by:</b>
+            <span><%= contributor(version.last_edited_by, "User") %></span>
+          <% end %>
+        </p>
+      <% end %>
+    </div>
+  <% end %>
+  
+  <% if version && !version.revision_comments.blank? -%>
+    <div id="version_info_box_comments" style="display: none; border: 1px dotted #CCCCCC; padding: 0.3em 0.5em;">
+      <%= white_list version.revision_comments %>
+    </div>
+  <% end %>
+
+</div>
+

Modified: branches/events/app/views/packs/edit.rhtml (3490 => 3491)


--- branches/events/app/views/packs/edit.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/packs/edit.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,6 +1,6 @@
 <% t "Manage" -%>
 
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 <%= _javascript__include_tag "osp.js" %>
 
 <h1>Manage Pack: <%= contributable_name(@pack.id, 'Pack') %></h1>
@@ -20,7 +20,7 @@
 			<%= f.text_field :title, :size => 86 %>
 			
 		  <p><b>Description: </b></p>
-			<%= fckeditor_textarea(:pack, :description, :toolbarSet => 'Simple', :width => '550px', :height => '300px') %>
+			<%= f.text_area(:description, :width => '550px', :height => '300px', :class => 'ckeditor') %>
 		</div>
 	</center>
   
@@ -30,6 +30,8 @@
   
   <% if @pack.owner?(current_user) %>
   	<%= render :partial => "contributions/sharing_form",  :locals => { :edit => true, :contributable => @pack, :update_perms => true } %>
+
+    <%= render :partial => "contributions/license_form", :locals => { :object => :pack, :contributable => @pack, :edit => true } -%>
   <% end %>
 
   <p>

Modified: branches/events/app/views/packs/index.rhtml (3490 => 3491)


--- branches/events/app/views/packs/index.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/packs/index.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -20,5 +20,6 @@
 		<center><%= image_tag 'packs.png' -%></center>
 	</div>
 </div>
+<h1><%= context_prefix(@context) -%> Packs</h1>
 
 <%= render :partial => "content/index" -%>

Modified: branches/events/app/views/packs/new.rhtml (3490 => 3491)


--- branches/events/app/views/packs/new.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/packs/new.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,6 +1,6 @@
 <% t "New" -%>
 
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 <%= _javascript__include_tag "osp.js" %>
 
 <h1>New Pack</h1>
@@ -16,7 +16,7 @@
 			<%= text_field_tag "pack[title]", nil, :size => 86 %>
 			
 		  <p><b>Description: </b></p>
-			<%= fckeditor_textarea(:pack, :description, :toolbarSet => 'Simple', :width => '550px', :height => '300px') %>
+      <%= text_area_tag 'pack[description]', nil, :width => '550px', :height => '300px', :class => 'ckeditor' -%>
 		</div>
 	</center>
 
@@ -25,6 +25,8 @@
   <%= render :partial => "tags/tags_form", :locals => { :edit => false, :taggable => @pack } %>
   
   <%= render :partial => "contributions/sharing_form",  :locals => { :edit => false, :contributable => @pack, :update_perms => true } %>
+
+  <%= render :partial => "contributions/license_form", :locals => { :object => :pack, :contributable => @pack, :edit => false } -%>
   
   <p style="text-align: center;">
     <%= submit_tag "Create", :disable_with => "Creating..." %>

Modified: branches/events/app/views/packs/show.rhtml (3490 => 3491)


--- branches/events/app/views/packs/show.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/packs/show.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,10 +1,17 @@
 <% t "#{contributable_name(@pack.id, 'Pack')} (#{h @pack.contributor_name})" -%>
 
+<% items_count = @version ? @version.items_count : @pack.items_count %>
+<% contributable_entries = @version ? @version.contributable_entries : @pack.contributable_entries %>
+<% remote_entries        = @version ? @version.remote_entries        : @pack.remote_entries        %>
+
 <% if @authorised_to_edit %>
 	<ul class="sectionIcons">
 		<% if mine?(@pack) -%>
 			<li><%= icon('manage', edit_pack_path(@pack), nil, nil, 'Manage Pack') -%></li>
 		<% end -%>
+    <% if @authorised_to_edit -%>
+			<li><%= icon('new', snapshot_pack_path(@pack), nil, { :confirm => 'Are you sure that you would like to create a new snapshot of this Pack?', :method => :post }, 'Create snapshot') %></li>
+    <% end -%>	
 		<% if Authorization.check("destroy", @pack, current_user) %>
 			<li><%= icon('destroy', pack_path(@pack), nil, { :confirm => 'This deletes the Pack and all metadata such as tags and comments, BUT does not delete the actual items pointed to in the Pack. Are you sure you would like to delete this Pack?', :method => :delete }, 'Delete Pack') %></li>
 		<% end %>
@@ -32,6 +39,9 @@
 
 <div class="contribution_left_box">
 	<div class="contribution_version_box">
+
+    <%= render(:partial => "packs/version_selector", :locals => { :resource => @pack, :version => @version, :path => :pack_version_path }) %>
+
 		<div class="contribution_version_inner_box">
 			
 			<h3>
@@ -65,10 +75,10 @@
 				<% end %>
 				
 				<%= info_icon_with_tooltip("This section shows all the items that are pointed to in this pack. This can be a combination of internal and external items.") -%>
-				Items <span class="count_text">(<%= @pack.items_count -%>)</span>
+				Items <span class="count_text">(<%= items_count -%>)</span>
 			</h4>
 			
-			<%= render :partial => "items", :locals => { :pack => @pack, :authorised_to_edit => @authorised_to_edit } -%>
+			<%= render :partial => "items", :locals => { :pack => @pack, :contributable_entries => contributable_entries, :remote_entries => remote_entries, :authorised_to_edit => @authorised_to_edit } -%>
 
 			<br/><br/>
 			<h4>
@@ -122,10 +132,12 @@
 	
 	<div class="contribution_section_box">
 		<p style="font-size: 108%;">
-		 	<b><%= pluralize @pack.items_count, "item" %> in this pack</b>
+		 	<b><%= pluralize items_count, "item" %> in this pack</b>
 		</p>
 	</div>
-	
+
+  <%= render :partial => "contributions/license_box", :locals => { :contributable => @pack } %>
+
   <%= render :partial => "contributions/curation_box", :locals => { :contributable => @pack } %>
 
 	<%= render :partial => "tags/tags_box", :locals => { :taggable => @pack, 

Modified: branches/events/app/views/profiles/_form.rhtml (3490 => 3491)


--- branches/events/app/views/profiles/_form.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/profiles/_form.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,4 @@
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 
 <p style="color: #666666; font-weight: bold;">
 	Note: information you enter on this page will be visible to everyone (ie: will be public), but all fields are optional.
@@ -107,7 +107,7 @@
 	</span>
 </p>
 
-<%= fckeditor_textarea(:profile, :body, :toolbarSet => 'Simple', :width => '700px', :height => '300px') %>
+<%= form.text_area(:body, :width => '700px', :height => '300px', :class => 'ckeditor') -%>
 
 <br/>
 <br/>

Modified: branches/events/app/views/reviews/_form.rhtml (3490 => 3491)


--- branches/events/app/views/reviews/_form.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/reviews/_form.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,4 @@
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 
 <%= error_messages_for 'review' %>
 
@@ -25,4 +25,4 @@
 </div>
 
 <p><b>Your review</b></p>
-<%= fckeditor_textarea(:review, :review, :toolbarSet => 'Basic', :width => '455px', :height => '400px') %>
+<%= form.text_area(:review, :width => '455px', :height => '400px', :class => 'ckeditor') -%>

Modified: branches/events/app/views/reviews/_reviews.rhtml (3490 => 3491)


--- branches/events/app/views/reviews/_reviews.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/reviews/_reviews.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,5 +1,3 @@
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
-
 <h2>
 	<%= icon "review", nil, "Reviews", { :style => "vertical-align: middle;" }, "" -%>
 	<span style="vertical-align: middle;"><%= link_to "Reviews", workflow_reviews_path(reviewable) %></span>

Modified: branches/events/app/views/runners/edit.rhtml (3490 => 3491)


--- branches/events/app/views/runners/edit.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/runners/edit.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -25,7 +25,7 @@
 				<%= text_field_tag "runner[username]", @runner.username, :size => 30 %>
 				
 				<p><b>Password</b> (will be encrypted)</p>
-				<%= text_field_tag "runner[password]", @runner.crypted_password.decrypt, :size => 30 %>
+				<%= text_field_tag "runner[password]", @runner.password.decrypt, :size => 30 %>
 			</fieldset>
 			
 			<br/>
@@ -55,4 +55,4 @@
 			<center><%= submit_tag "Update", :disable_with => "Updating..." %></center>
 		<% end -%>
 	</div>
-</center>
\ No newline at end of file
+</center>

Modified: branches/events/app/views/users/_avatar.rhtml (3490 => 3491)


--- branches/events/app/views/users/_avatar.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/users/_avatar.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,7 +1,7 @@
 <% size ||= 100 -%>
 <% you_string ||= "" -%>
 <% if user.kind_of? Fixnum then user = User.find(user) end -%>
-<div style="text-align:center; width: <%= size+6 %>px; line-height: 1.2em; padding: 0.2em 0;">
+<div class="avatar" style="width: <%= size+6 %>px">
 	<%= avatar(user, size) %>
 	<span style="display:block;margin-top:2px;text-align:center;">
 		<% if size > 59 %>

Modified: branches/events/app/views/users/_breadcrumbs.rhtml (3490 => 3491)


--- branches/events/app/views/users/_breadcrumbs.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/users/_breadcrumbs.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,8 @@
-<li><%= link_to 'Users', users_path -%></li>
+<% if controller.action_name == 'index' %>
+  <li>Users</li>
+<% else %>
+  <li><%= link_to 'Users', users_path %></li>
+<% end %>
 
 <% if ["edit"].include? controller.action_name.to_s -%>
 	<li><%= link_to h(@user.name), user_path(@user) -%></li>

Modified: branches/events/app/views/users/_listing.rhtml (3490 => 3491)


--- branches/events/app/views/users/_listing.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/users/_listing.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,5 +1,5 @@
   <td style="width: 100px"><div style="text-align: center; font-weight: bold">Member</div><br /><br /><center><%= contributor(user.id, 'User', true, 60) %></center></td>
-  <td class="mid" style="text-align: left;">
+  <td class="mid" style="text-align: left; max-width: 370px;">
 
     <p style="margin-top:0; padding-top:0; font-weight:bold; font-size: 108%;">
       <%= icon "user", nil, nil, nil, '' %>

Modified: branches/events/app/views/users/show.rhtml (3490 => 3491)


--- branches/events/app/views/users/show.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/users/show.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -232,7 +232,8 @@
 					<% filter_contributables(@user.contributions).each do |klass, contributables| %>
 						<p>
 				      <b>
-				      	<%= link_to(pluralize(Authorization.scoped(klass.constantize, :authorised_user => current_user).find(:all, :select => "0", :conditions => { :contributor_type => 'User', :contributor_id => @user.id } ).length, controller_visible_name(klass.humanize.pluralize)), url_for(:action ="" controller_visible_name(klass.humanize.pluralize).downcase)) %>
+				      	<%= link_to(pluralize(Authorization.scoped(klass.constantize, :authorised_user => current_user).find(:all, :select => "0", :conditions => { :contributor_type => 'User', :contributor_id => @user.id } ).length, controller_visible_name(klass.humanize.pluralize)),
+                            polymorphic_url(address@hidden, klass.pluralize.underscore.to_sym])) %>
 							</b>
 				    </p>
 					<% end %>
@@ -410,13 +411,6 @@
     <% contributables = (@user.contributions.select do |c| c.contributable_type == 'Pack' end).map do |c| c.contributable end  %>
     <%= render :partial => "packs/table", :locals => { :collection => contributables } %>
 
-  <% when "Blogs" %>
-		
-		<%= view_privileges_notice %>
-		<br/>
-    <% contributables = (@user.contributions.select do |c| c.contributable_type == 'Blog' end).map do |c| c.contributable end  %>
-    <%= render :partial => "blogs/table", :locals => { :collection => contributables } %>
-
   <% when "Credits" %>
 
     <% unless (creditations = @user.creditations).empty? %>

Modified: branches/events/app/views/workflows/_breadcrumbs.rhtml (3490 => 3491)


--- branches/events/app/views/workflows/_breadcrumbs.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/workflows/_breadcrumbs.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,5 +1,14 @@
-<li><%= link_to 'Workflows', workflows_path %></li>
+<% if @context %>
+  <li><%= link_to visible_name(@context).pluralize, polymorphic_url(@context.class.name.underscore.pluralize) %></li>
+  <li><%= link_to @context.name, @context %></li>
+<% end %>
 
+<% if controller.action_name == 'index' %>
+  <li>Workflows</li>
+<% else %>
+  <li><%= link_to 'Workflows', workflows_path %></li>
+<% end %>
+
 <% if ["show", "new", "edit", "search", "all", "new_version", "edit_version", "comments_timeline", "galaxy_tool"].include? controller.action_name.to_s %>
   <% case controller.action_name.to_s; when "show" %>
     <li><%= h(@workflow.title) %></li>

Copied: branches/events/app/views/workflows/_deprecation_event.html.erb (from rev 3490, trunk/app/views/workflows/_deprecation_event.html.erb) (0 => 3491)


--- branches/events/app/views/workflows/_deprecation_event.html.erb	                        (rev 0)
+++ branches/events/app/views/workflows/_deprecation_event.html.erb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -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/events/app/views/workflows/_main_metadata_form.rhtml (3490 => 3491)


--- branches/events/app/views/workflows/_main_metadata_form.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/workflows/_main_metadata_form.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -71,7 +71,7 @@
 				
 				<!-- Description -->
 				<p><b>Description</b></p>
-				<%= fckeditor_textarea(:new_workflow, :body, :toolbarSet => 'Simple', :width => '500px', :height => '300px') %>
+        <%= text_area_tag("new_workflow[body]", nil, :width => '500px', :height => '300px', :class => 'ckeditor') -%>
 		
 		</div>
 	

Modified: branches/events/app/views/workflows/_table.rhtml (3490 => 3491)


--- branches/events/app/views/workflows/_table.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/workflows/_table.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,139 +1,135 @@
 <% query ||= false -%>
-<% odd_row = false -%>
 
-<% unless collection.empty? %>
+<% collection.each do |workflow| %>
+  <% # If only one item in collection, check if 'show' permission is available (eg: if this partial was called from contributions/table) -%>
+  <% if collection.size == 1 -%>
+    <% show ||= Authorization.check("view", workflow, current_user) -%>
+  <% else -%>
+    <% show = Authorization.check("view", workflow, current_user) -%>
+  <% end -%>
+  <% if show -%>
 
-<table class="alt_table">	
-	<% for workflow in collection %>
-		<% # If only one item in collection, check if 'show' permission is available (eg: if this partial was called from contributions/table) -%>
-		<% if collection.size == 1 -%>
-			<% show ||= Authorization.check("view", workflow, current_user) -%>
-		<% else -%>
-			<% show = Authorization.check("view", workflow, current_user) -%>
-		<% end -%>
-	  <% if show -%>
-		<tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" %>">
-			<% cache(:controller => 'workflows_cache', :action ="" 'listing', :id => workflow.id) do -%>
-			    <td style="width: 100px;">
-						<div class="workflow_type_box" style="width: auto; margin-bottom: 2em;">
-              <%= link_to(h(workflow.content_type.title), content_type_path(workflow.content_type)) %>
-						</div>
-			    	<p style="margin-top:0; padding-top:0; text-align: center;"><b><%= owner_text workflow -%></b></p>
-						<center><%= contributor(workflow.contribution.contributor_id, workflow.contribution.contributor_type, true, 60) %></center>
-					</td>
-			    <td style="text-align: left; width: 587px">
-			      <a name="<%= workflow.title.gsub(/ /, "_") %>"></a>
-			      <p class="title">
-					  	<%= icon "workflow", nil, nil, nil, '' %>
-							<% title = contributable_name(workflow.id, 'Workflow') %>
-							<%=link_to(query ? highlight_all(title, query) : title, workflow_path(workflow)) %>
-							<span style="font-weight:normal;">
-								(v<%= workflow.current_version %>)
-							</span>
-					  </p>
-					
-						<p style="font-size: 85%; margin-top: 0; padding-top: 0;">
-							<b>Created:</b> <%=datetime workflow.contribution.created_at, false -%>
-							<% unless workflow.contribution.created_at == workflow.contribution.updated_at %>
-								|	<b>Last updated:</b> <%=datetime workflow.contribution.updated_at, false -%>
-							<% end %>
-						</p>
-						
-					  <% unless (creditors = workflow.creditors).empty? %>
-					  	<p style="font-size:85%;">
-							<b>Credits:</b>
-							<% creditors.each do |c| %>
-								<% if c.creditor_type == 'User' %>
-									<%= icon('user', nil, nil, nil, '') %> 
-								<% elsif c.creditor_type == 'Network' %>
-									<%= icon('network-member', nil, nil, nil, '') %>
-								<% end %>
-								<%= contributor(c.creditor_id, c.creditor_type) %>
-							<% end %>
-					  	</p>
-					  <% end %>
-					  <% unless (attributors = workflow.attributors).empty? %>
-					  	<p style="font-size:85%;">
-							<b>Attributions:</b>
-							<% attributors.each do |a| %>
-								<% if Authorization.check("view", a.attributor, current_user) -%>
-									<% if a.attributor_type == 'Workflow' %>
-										<%= icon('workflow', nil, nil, nil, '') %> 
-									<% elsif a.attributor_type == 'Blob' %>
-										<%= icon('blob', nil, nil, nil, '') %>
-									<% end %>
-									<%= contributable(a.attributor_id, a.attributor_type) %>
-								<% end %>
-							<% end %>
-					  	</p>
-					  <% end %>
-						
-            <% if workflow.license_id.nil? %>
-              <p style="font-size:85%;"><b>License: </b>No license</p>
-            <% else %>
-              <p style="font-size:85%;"><b>License: </b><% @license = License.find(workflow.license_id) %><%= link_to h(@license.title), license_path(@license) %></p>
+    <div class="resource_list_item <%= workflow.contribution.policy.layout -%>">
+
+      <div class="avatar_panel">
+        <div class="workflow_type_box">
+          <%= link_to(h(workflow.content_type.title), content_type_path(workflow.content_type)) %>
+        </div>
+        <span class="owner"><%= owner_text workflow -%></span>
+        <%= contributor(workflow.contribution.contributor_id, workflow.contribution.contributor_type, true, 60) %>
+        <% if layout = workflow.contribution.policy.layout %>
+          <% begin %>
+            <%= render :partial => "layouts/skins/branding/#{layout}" %>
+          <% rescue ActionView::MissingTemplate %>
+          <% end %>
+        <% end %>
+      </div>
+
+      <div class="main_panel">
+
+        <div class="actions">
+          <%= icon "show", workflow_path(workflow), nil, nil, "View" %>
+          <% if Authorization.check("download", workflow, current_user) -%>
+            <%= icon "download", download_workflow_path(workflow), nil, nil, "Download (v#{workflow.versions.count})" %>
+            <% if ( session[:callback] && (session[:callback][:types].include?(workflow.content_type_id))) -%>
+              <%= icon "download", callback_url(workflow).to_s, nil, {:rel => 'nofollow'}, session[:callback][:label] -%>
             <% end %>
-					  
-            <% desc_style = "font-size: 85%;" %>
+          <% end %>
+          <% if mine?(workflow) %>
+            <%= icon "manage", edit_workflow_path(workflow), nil, nil, "Manage" %>
+          <% end %>
+        </div>
+        <% cache(:controller => 'workflows_cache', :action ="" 'listing', :id => workflow.id) do -%>
+          <a name="<%= workflow.title.gsub(/ /, "_") %>"></a>
 
-            <% unless workflow.image.nil? && workflow.svg.nil? -%>
-              <p style="margin: 0; border: 0; width: 101px; float: left">
-                <%= link_to image_tag(workflow_preview_path(workflow, 'thumb'), :class => 'framed_nospace'), workflow_path(workflow) %>
-              </p>
+          <p class="title">
+            <%= icon "workflow", nil, nil, nil, '' %>
+            <% truncated_title = truncate(workflow.title, :length => 45) %>
+            <%=link_to(query ? highlight_all(truncated_title, query) : truncated_title, workflow_path(workflow),
+                       :title => workflow.title) %>
+            <span style="font-weight:normal;">
+              (<%= workflow.current_version %>)
+            </span>
+          </p>
 
-              <% desc_style << " margin-left: 110px; width: 250px;" %>
-            <% end -%>
+          <p>
+            <b>Created:</b> <%=datetime workflow.contribution.created_at, false -%>
+            <% unless workflow.contribution.created_at == workflow.contribution.updated_at %>
+              |	<b>Last updated:</b> <%=datetime workflow.contribution.updated_at, false -%>
+            <% end %>
+          </p>
 
-            <p style="margin: 0; padding: 0; border: 0;">
-              <div class="desc" style="<%= desc_style -%>">
-                <% if workflow.body and workflow.body.length > 0 -%>
-                  <% desc = truncate(strip_html(workflow.body), :length => 500) -%>
-                  <%= query ? highlight_all(desc, query) : desc %>
-                <% else -%>
-                  <span class="none_text">No description</span>                      
-                <% end -%>
-              </div>
+          <% unless (creditors = workflow.creditors).empty? %>
+            <p>
+              <b>Credits:</b>
+              <% creditors.each do |c| %>
+                <% if c.creditor_type == 'User' %>
+                  <%= icon('user', nil, nil, nil, '') %>
+                <% elsif c.creditor_type == 'Network' %>
+                  <%= icon('network-member', nil, nil, nil, '') %>
+                <% end %>
+                <%= contributor(c.creditor_id, c.creditor_type) %>
+              <% end %>
             </p>
-					  
-            <div style="clear: both"></div>
+          <% end %>
 
-					  <p style="font-size: 85%;">
-							<a href="" workflow_path(workflow) + '#ratings' -%>"><b>Rating: </b><%= number_with_precision(workflow.rating, :precision => 1) %> / 5 (<%= pluralize workflow.ratings.count, 'rating' %>)</a> |
-							<a href="" workflow_path(workflow) + '#versions' -%>"><b>Versions: </b><%= workflow.versions.count %></a> |
-							<a href="" workflow_path(workflow) + '#reviews' -%>"><b>Reviews: </b><%= workflow.reviews.count %></a> |
-							<a href="" workflow_path(workflow) + '#comments' -%>"><b>Comments: </b><%= workflow.comments.count %></a> |
-							<a href="" workflow_path(workflow) + '#citations' -%>"><b>Citations: </b><%= workflow.citations.count %></a>
-					  </p>
-						
-						<p style="font-size: 85%;">
-							<b>Viewed:</b> <%=pluralize workflow.contribution.site_viewings_count, "time" %> |
-				      <b>Downloaded:</b> <%=pluralize workflow.contribution.site_downloads_count, "time" %>
-						</p>
-					  
-					  <% unless (tags = workflow.tags).empty? %>
-							<a href="" workflow_path(workflow) + '#tags' -%>"><p style="font-size: 85%;"><b>Tags</b> (<%=tags.count-%>):</p></a>
-							<div style="display:inline;" class="tags_onesize"><%= tag_cloud_from_collection tags, true %></div>
-					  <% else %>
-							<p style="font-size: 85%;"><i>This Workflow has no tags!</i></p>
-					  <% end %>	
-			    </td>
-			<% end -%>
-			    <td class="actions" style="width: 120px;">
-			      <%= icon "show", workflow_path(workflow), nil, nil, "View" %>
-				  	<% if Authorization.check("download", workflow, current_user) -%>
-						<%= icon "download", download_workflow_path(workflow), nil, nil, "Download (v#{workflow.versions.count})" %>
-						<% if ( session[:callback] && (session[:callback][:types].include?(workflow.content_type_id))) -%>
-							<%= icon "download", callback_url(workflow).to_s, nil, {:rel => 'nofollow'}, session[:callback][:label] -%>
-						<% end %>
-					<% end %>
-			      <% if mine?(workflow) %><%= icon "manage", edit_workflow_path(workflow), nil, nil, "Manage" %><% end %>
-						<br/><br/>
-						
-			    </td>
-		</tr>
-  	<% end -%>
-	<% end -%>
+          <% unless (attributors = workflow.attributors).empty? %>
+            <p>
+              <b>Attributions:</b>
+              <% attributors.each do |a| %>
+                <% if Authorization.check("view", a.attributor, current_user) -%>
+                  <% if a.attributor_type == 'Workflow' %>
+                    <%= icon('workflow', nil, nil, nil, '') %>
+                  <% elsif a.attributor_type == 'Blob' %>
+                    <%= icon('blob', nil, nil, nil, '') %>
+                  <% end %>
+                  <%= contributable(a.attributor_id, a.attributor_type) %>
+                <% end %>
+              <% end %>
+            </p>
+          <% end %>
 
-</table>
+          <% if workflow.license_id.nil? %>
+            <p><b>License: </b>No license</p>
+          <% else %>
+            <p><b>License: </b><% @license = License.find(workflow.license_id) %><%= link_to h(@license.title), license_path(@license) %></p>
+          <% end %>
 
+          <div class="desc">
+            <% unless workflow.image.nil? && workflow.svg.nil? -%>
+              <div class="preview">
+                <%= link_to image_tag(workflow_preview_path(workflow, 'thumb'), :class => 'framed_nospace'), workflow_path(workflow) %>
+              </div>
+            <% end -%>
+            <% if workflow.body and workflow.body.length > 0 -%>
+              <% desc = truncate(strip_html(workflow.body), :length => 500) -%>
+              <%= query ? highlight_all(desc, query) : desc %>
+            <% else -%>
+              <span class="none_text">No description</span>
+            <% end -%>
+          </div>
+
+          <p>
+            <a href="" workflow_path(workflow) + '#ratings' -%>"><b>Rating: </b><%= number_with_precision(workflow.rating, :precision => 1) %> / 5 (<%= pluralize workflow.ratings.count, 'rating' %>)</a> |
+            <a href="" workflow_path(workflow) + '#versions' -%>"><b>Versions: </b><%= workflow.versions.count %></a> |
+            <a href="" workflow_path(workflow) + '#reviews' -%>"><b>Reviews: </b><%= workflow.reviews.count %></a> |
+            <a href="" workflow_path(workflow) + '#comments' -%>"><b>Comments: </b><%= workflow.comments.count %></a> |
+            <a href="" workflow_path(workflow) + '#citations' -%>"><b>Citations: </b><%= workflow.citations.count %></a>
+          </p>
+
+          <p>
+            <b>Viewed:</b> <%=pluralize workflow.contribution.site_viewings_count, "time" %> |
+            <b>Downloaded:</b> <%=pluralize workflow.contribution.site_downloads_count, "time" %>
+          </p>
+
+          <% unless (tags = workflow.tags).empty? %>
+            <a href="" workflow_path(workflow) + '#tags' -%>"><p><b>Tags</b> (<%=tags.count-%>):</p></a>
+            <div style="display:inline;" class="tags_onesize"><%= tag_cloud_from_collection tags, true %></div>
+          <% else %>
+            <p><i>This Workflow has no tags!</i></p>
+          <% end %>
+        <% end -%>
+      </div>
+    </div>
+  <% end -%>
 <% end %>

Modified: branches/events/app/views/workflows/edit_version.rhtml (3490 => 3491)


--- branches/events/app/views/workflows/edit_version.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/workflows/edit_version.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -6,7 +6,7 @@
 
 <% can_edit_anything = title_edit || preview_edit || description_edit %>
 
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 
 <h1>
 	Edit Version <%= @viewing_version_number.to_s %>
@@ -61,7 +61,7 @@
 			<!-- Description -->
 			<p><b>Description</b></p>
       <% if description_edit %>
-        <%= fckeditor_textarea(:workflow, :body, :toolbarSet => 'Simple', :width => '500px', :height => '500px') %>
+        <%= text_area_tag('workflow[body]', @viewing_version.body, :width => '500px', :height => '500px', :class => 'ckeditor') -%>
     
         <br />
       <% else %>

Modified: branches/events/app/views/workflows/index.rhtml (3490 => 3491)


--- branches/events/app/views/workflows/index.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/workflows/index.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,4 @@
-<h1>Workflows</h1>
+<h1><%= context_prefix(@context) -%> Workflows</h1>
 
 <%= render :partial => "content/index" -%>
 

Modified: branches/events/app/views/workflows/new.rhtml (3490 => 3491)


--- branches/events/app/views/workflows/new.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/workflows/new.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,6 +1,6 @@
 <% t "New" -%>
 
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 <%= _javascript__include_tag "osp.js" %>
 
 <h1>Upload Workflow</h1>

Modified: branches/events/app/views/workflows/new_version.rhtml (3490 => 3491)


--- branches/events/app/views/workflows/new_version.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/workflows/new_version.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,6 +1,6 @@
 <% t "Upload New Version" -%>
 
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 
 <h1>
 	Upload New Version
@@ -60,7 +60,7 @@
 	
 	<center>
 	  <div class="box_form" style="width: 600px; text-align: center;">
-			<%= fckeditor_textarea(:new_workflow, "rev_comments", :toolbarSet => 'Basic', :width => '580px', :height => '300px') %>
+      <%= text_area_tag("new_workflow[rev_comments]", nil, :width => '580px', :height => '300px', :class => 'ckeditor') -%>
 		</div>
 	</center>
 	

Modified: branches/events/app/views/workflows/show.rhtml (3490 => 3491)


--- branches/events/app/views/workflows/show.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/workflows/show.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -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/events/app/views/workflows/tag_suggestions.rhtml (3490 => 3491)


--- branches/events/app/views/workflows/tag_suggestions.rhtml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/app/views/workflows/tag_suggestions.rhtml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +1,4 @@
-<%= _javascript__include_tag "fckeditor/fckeditor.js" %>
+<%= _javascript__include_tag "ckeditor/ckeditor.js" %>
 <%= _javascript__include_tag "tag_suggestions.js" %>
 
 <h1>Extra workflow metadata</h1>
@@ -18,7 +18,7 @@
       <!-- Description -->
       <p><b>Description</b></p>
 
-    <%= fckeditor_textarea(:workflow, :body, :toolbarSet => 'Simple', :width => '500px', :height => '300px') %>
+    <%= text_area_tag("workflow[body]", nil, :width => '500px', :height => '300px', :class => 'ckeditor') -%>
 
   <% end %>
 

Copied: branches/events/config/.gitignore (from rev 3490, trunk/config/.gitignore) (0 => 3491)


--- branches/events/config/.gitignore	                        (rev 0)
+++ branches/events/config/.gitignore	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,3 @@
+/database.yml
+/settings.yml
+/captcha.yml

Deleted: branches/events/config/base_schema.xml (3490 => 3491)


--- branches/events/config/base_schema.xml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/config/base_schema.xml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,98 +0,0 @@
-<?xml version="1.0"?>
-<schema>
-
-  <table name="contributions">
-
-    <column type="integer"  name="contributor_id"/>
-    <column type="string"   name="contributor_type"/>
-    <column type="integer"  name="contributable_id"/>
-    <column type="string"   name="contributable_type"/>
-    <column type="integer"  name="policy_id"/>
-    <column type="datetime" name="created_at"/>
-    <column type="datetime" name="updated_at"/>
-    <column type="integer"  name="downloads_count"      default="0"/>
-    <column type="integer"  name="viewings_count"       default="0"/>
-    <column type="integer"  name="site_downloads_count" default="0"/>
-    <column type="integer"  name="site_viewings_count"  default="0"/>
-    <column type="float"    name="rating"/>
-    <column type="float"    name="rank"/>
-    <column type="string"   name="label"/>
-    <column type="integer"  name="content_type_id"/>
-    <column type="integer"  name="license_id"/>
-    <column type="string"   name="layout"/>
-
-    <index>
-      <column name="contributable_id"/>
-      <column name="contributable_type"/>
-    </index>
-
-    <index>
-      <column name="contributor_id"/>
-      <column name="contributor_type"/>
-    </index>
-
-  </table>
-
-  <table name="policies">
-   
-    <column type="integer"  name="contributor_id"/>
-    <column type="string"   name="contributor_type"/>
-    <column type="string"   name="name"/>
-    <column type="datetime" name="created_at"/>
-    <column type="datetime" name="updated_at"/>
-    <column type="integer"  name="share_mode"/>
-    <column type="integer"  name="update_mode"/>
-    <column type="boolean"  name="public_view"     default="false"/>
-    <column type="boolean"  name="public_download" default="false"/>
-
-  </table>
-
-  <table name="downloads">
-
-    <column type="integer"  name="contribution_id"/>
-    <column type="integer"  name="user_id"/>
-    <column type="datetime" name="created_at"/>
-    <column type="string"   name="user_agent"/>
-    <column type="boolean"  name="accessed_from_site" default="false"/>
-    <column type="string"   name="kind"/>
-
-    <index>
-      <column name="contribution_id"/>
-    </index>
-
-  </table>
-
-  <table name="content_types">
-
-    <column type="integer"  name="user_id"/>
-    <column type="string"   name="title"/>
-    <column type="text"     name="description"/>
-    <column type="text"     name="description_html"/>
-    <column type="string"   name="category"/>
-    <column type="string"   name="mime_type"/>
-    <column type="datetime" name="created_at"/>
-    <column type="datetime" name="updated_at"/>
-
-  </table>
-
-  <table name="user_reports">
-
-    <column type="integer"  name="user_id"/>
-    <column type="string"   name="subject_type"/>
-    <column type="integer"  name="subject_id"/>
-    <column type="text"     name="content"/>
-    <column type="text"     name="report"/>
-    <column type="datetime" name="created_at"/>
-
-  </table>
-
-  <table name="previews">
-
-    <column type="integer"  name="image_blob_id"/>
-    <column type="integer"  name="svg_blob_id"/>
-    <column type="datetime" name="created_at"/>
-
-  </table>
-
-</schema>
-

Modified: branches/events/config/database.yml.pre (3490 => 3491)


--- branches/events/config/database.yml.pre	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/config/database.yml.pre	2013-04-03 15:44:21 UTC (rev 3491)
@@ -12,8 +12,8 @@
 # And be sure to use new-style password hashing:
 #   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
 development:
-  adapter: mysql
-  database: m2_development
+  adapter: mysql2
+  database: myexperiment_development
   username: root
   password:
   host: localhost
@@ -22,15 +22,15 @@
 # re-generated from your development database when you run 'rake'.
 # Do not set this db to the same as development or production.
 test:
-  adapter: mysql
-  database: m2_test
+  adapter: mysql2
+  database: myexperiment_test
   username: root
   password:
   host: localhost
 
 production:
-  adapter: mysql
-  database: m2_production
+  adapter: mysql2
+  database: myexperiment_production
   username: root
   password: 
   host: localhost

Modified: branches/events/config/default_settings.yml (3490 => 3491)


--- branches/events/config/default_settings.yml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/config/default_settings.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -41,7 +41,7 @@
 # contributable_models - These are the models for the things that myExperiment
 #                        contributors can contribute.
 
-contributable_models: [Workflow, Blob, Pack, Blog]
+contributable_models: [Workflow, Blob, Pack]
 
 # page_template - This is the page template for all the pages except for
 #                 the front page of the web site.
@@ -161,10 +161,6 @@
     link:       /packs
     controller: packs
 
-  - label:      Services
-    link:       /services
-    controller: services
-
   - label:      Topics
     link:       /topics
     controller: topics
@@ -532,7 +528,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
@@ -544,6 +540,7 @@
     topic_workflow_map: INNER JOIN topic_workflow_map ON contributions.id = topic_workflow_map.workflow_id
     users: INNER JOIN users ON contributions.contributor_type = 'User' AND contributions.contributor_id = users.id
     licences: LEFT OUTER JOIN licenses ON contributions.license_id = licenses.id
+    component_profiles: LEFT OUTER JOIN workflows ON RESULT_TYPE = 'Workflow' AND workflows.id = RESULT_ID LEFT OUTER JOIN component_profiles ON workflows.component_profile_id = component_profiles.id
 
   order:
 
@@ -667,5 +664,20 @@
     label_column: services.monitor_label
     joins: [services]
 
+  - query_option: COMPONENT_PROFILE_ID
+    title: component profile
+    id_column: component_profiles.id
+    label_column: component_profiles.name
+    joins: [component_profiles]
+
   num_options: ["10", "20", "25", "50", "100"]
 
+# Shortcut keywords
+#   These are special keywords that, when typed into the search box (when 'All' is selected) will instantly jump to a
+#   specified page instead of returning a list of search results.
+#
+# Example (when 'biovel' is searched for, it will jump to the group's page):
+#
+# shortcut_keywords:
+#   biovel: /groups/643
+#
\ No newline at end of file

Modified: branches/events/config/environment.rb (3490 => 3491)


--- branches/events/config/environment.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/config/environment.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,12 +1,13 @@
 # Be sure to restart your server when you modify this file
 
 # Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.3.17' unless defined? RAILS_GEM_VERSION
 
 # Bootstrap the Rails environment, frameworks, and default configuration
 require File.join(File.dirname(__FILE__), 'boot')
-require 'lib/conf'
+require 'conf'
 require 'uri'
+require 'forwardable' # Needed for Sunspot
 
 Rails::Initializer.run do |config|
   # Settings in config/environments/* take precedence over those specified here.
@@ -26,7 +27,6 @@
   # :all can be used as a placeholder for all plugins not explicitly named
   # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
   config.plugins = [
-    :encrypted_strings,
     :widgets,
     :country_select,
     :white_list,
@@ -34,20 +34,12 @@
     :acts_as_bookmarkable,
     :acts_as_commentable,
     :acts_as_rateable,
-    :acts_as_solr,
     :acts_as_taggable_redux,
     :auto_complete,
-    :encrypted_attributes,
-    :fckeditor,
     :headliner,
     :oauth,
     :oauth_plugin,
-    :open_id_authentication,
-    :paginating_find,
-    :query_stats,
-    :recaptcha,
     :simile_timeline,
-    :structured_data,
     :validates_email_veracity_of,
     :versioning
   ]
@@ -77,8 +69,6 @@
 
 # Include your application configuration below
 
-require 'lib/conf'
-
 # SMTP configuration
 
 require 'smtp_tls'

Modified: branches/events/config/environments/production.rb (3490 => 3491)


--- branches/events/config/environments/production.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/config/environments/production.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -4,7 +4,7 @@
 # Code is not reloaded between requests
 config.cache_classes = true
 
-config.log_path="log/production.#{Time.new().strftime(fmt='%Y%m%d')}.#{Process.pid}.log"
+config.log_path="log/production.#{Time.new().strftime(fmt='%Y%m%d')}.log"
 
 # Full error reports are disabled and caching is turned on
 config.action_controller.consider_all_requests_local = false

Deleted: branches/events/config/initializers/mongrel.rb (3490 => 3491)


--- branches/events/config/initializers/mongrel.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/config/initializers/mongrel.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,84 +0,0 @@
-# from https://gist.github.com/826692
-
-if ['2.3.8', '2.3.9', '2.3.10', '2.3.11', '2.3.14'].include?(Rails.version) && Gem.available?('mongrel', '~>1.1.5') && self.class.const_defined?(:Mongrel)
-  
-  # Pulled right from latest rack. Old looked like this in 1.1.0 version.
-  # 
-  # def [](k)
-  #   super(@names[k] ||= @names[k.downcase])
-  # end
-  # 
-  module Rack
-    module Utils
-      class HeaderHash < Hash
-        def [](k)
-          super(@names[k]) if @names[k]
-          super(@names[k.downcase])
-        end
-      end
-    end
-  end
-  
-  # Code pulled from the ticket above.
-  # 
-  class Mongrel::CGIWrapper
-    def header_with_rails_fix(options = 'text/html')
-      @head['cookie'] = options.delete('cookie').flatten.map { |v| v.sub(/^\n/,'') } if options.class != String and options['cookie']
-      header_without_rails_fix(options)
-    end
-    alias_method_chain :header, :rails_fix
-  end
-  
-  # Pulled right from 2.3.8 ActionPack. Simple diff was
-  # 
-  # if headers.include?('Set-Cookie')
-  #   headers['cookie'] = headers.delete('Set-Cookie').split("\n")
-  # end
-  # 
-  # to 
-  # 
-  # if headers['Set-Cookie']
-  #   headers['cookie'] = headers.delete('Set-Cookie').split("\n")
-  # end
-  #       
-  module ActionController
-    class CGIHandler
-      def self.dispatch_cgi(app, cgi, out = $stdout)
-        env = cgi.__send__(:env_table)
-        env.delete "HTTP_CONTENT_LENGTH"
-        cgi.stdinput.extend ProperStream
-        env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
-        env.update({
-          "rack.version" => [0,1],
-          "rack.input" => cgi.stdinput,
-          "rack.errors" => $stderr,
-          "rack.multithread" => false,
-          "rack.multiprocess" => true,
-          "rack.run_once" => false,
-          "rack.url_scheme" => ["yes", "on", "1"].include?(env["HTTPS"]) ? "https" : "http"
-        })
-        env["QUERY_STRING"] ||= ""
-        env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
-        env["REQUEST_PATH"] ||= "/"
-        env.delete "PATH_INFO" if env["PATH_INFO"] == ""
-        status, headers, body = app.call(env)
-        begin
-          out.binmode if out.respond_to?(:binmode)
-          out.sync = false if out.respond_to?(:sync=)
-          headers['Status'] = status.to_s
-          if headers['Set-Cookie']
-            headers['cookie'] = headers.delete('Set-Cookie').split("\n")
-          end
-          out.write(cgi.header(headers))
-          body.each { |part|
-            out.write part
-            out.flush if out.respond_to?(:flush)
-          }
-        ensure
-          body.close if body.respond_to?(:close)
-        end
-      end
-    end
-  end
-  
-end

Copied: branches/events/config/initializers/open_id_authentication.rb (from rev 3490, trunk/config/initializers/open_id_authentication.rb) (0 => 3491)


--- branches/events/config/initializers/open_id_authentication.rb	                        (rev 0)
+++ branches/events/config/initializers/open_id_authentication.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,2 @@
+require 'open_id_authentication'
+ActionController::Base.send :include, OpenIdAuthentication::ControllerMethods

Copied: branches/events/config/initializers/stringio_patch.rb (from rev 3490, trunk/config/initializers/stringio_patch.rb) (0 => 3491)


--- branches/events/config/initializers/stringio_patch.rb	                        (rev 0)
+++ branches/events/config/initializers/stringio_patch.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,18 @@
+# myExperiment: config/initializers/stringio_patch.rb
+#
+# Copyright (c) 2012 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+if RUBY_VERSION < "1.9.1"
+  class StringIO
+    def readpartial(*args)
+      result = read(*args)
+      if result.nil?
+        raise EOFError
+      else
+        result
+      end
+    end
+  end
+end
+

Copied: branches/events/config/initializers/will_paginate.rb (from rev 3490, trunk/config/initializers/will_paginate.rb) (0 => 3491)


--- branches/events/config/initializers/will_paginate.rb	                        (rev 0)
+++ branches/events/config/initializers/will_paginate.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,12 @@
+# myExperiment: config/initializers/will_paginate.rb
+#
+# Copyright (c) 2013 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+# Set the default entries per page to be 10 in line with the old plugin
+
+require 'will_paginate'
+
+WillPaginate.per_page = 10
+
+

Modified: branches/events/config/routes.rb (3490 => 3491)


--- branches/events/config/routes.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/config/routes.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,47 +1,10 @@
-require 'lib/rest'
+require 'rest'
 
 ActionController::Routing::Routes.draw do |map|
 
   # rest routes
   rest_routes(map)
 
-  # LoD routes
-  if Conf.rdfgen_enable
-
-    map.connect '/:contributable_type/:contributable_id/attributions/:attribution_id.:format',
-      :controller => 'linked_data', :action ="" 'attributions', :conditions => { :method => :get }
-
-    map.connect '/:contributable_type/:contributable_id/citations/:citation_id.:format',
-      :controller => 'linked_data', :action ="" 'citations', :conditions => { :method => :get },
-      :requirements => { :citation_id => /[0-9]*/ }
-
-    map.connect '/:contributable_type/:contributable_id/comments/:comment_id.:format',
-      :controller => 'linked_data', :action ="" 'comments', :conditions => { :method => :get }
-
-    map.connect '/:contributable_type/:contributable_id/credits/:credit_id.:format',
-      :controller => 'linked_data', :action ="" 'credits', :conditions => { :method => :get }
-
-    map.connect '/users/:user_id/favourites/:favourite_id.:format',
-      :controller => 'linked_data', :action ="" 'favourites', :conditions => { :method => :get }
-
-    map.connect '/packs/:contributable_id/local_pack_entries/:local_pack_entry_id.:format',
-      :controller => 'linked_data', :action ="" 'local_pack_entries',
-      :contributable_type => 'packs', :conditions => { :method => :get }
-
-    map.connect '/packs/:contributable_id/remote_pack_entries/:remote_pack_entry_id.:format',
-      :controller => 'linked_data', :action ="" 'remote_pack_entries',
-      :contributable_type => 'packs', :conditions => { :method => :get }
-
-    map.connect '/:contributable_type/:contributable_id/policies/:policy_id.:format',
-      :controller => 'linked_data', :action ="" 'policies', :conditions => { :method => :get }
-
-    map.connect '/:contributable_type/:contributable_id/ratings/:rating_id.:format',
-      :controller => 'linked_data', :action ="" 'ratings', :conditions => { :method => :get }
-
-    map.connect '/tags/:tag_id/taggings/:tagging_id.:format',
-      :controller => 'linked_data', :action ="" 'taggings', :conditions => { :method => :get }
-  end
-
   map.content '/content', :controller => 'content', :action ="" 'index', :conditions => { :method => :get }
   map.formatted_content '/content.:format', :controller => 'content', :action ="" 'index', :conditions => { :method => :get }
 
@@ -69,7 +32,7 @@
   map.resources :predicates
 
   # mashup
-  map.resource :mashup
+  map.resource :mashup, :controller => 'mashup'
   
   # search
   map.resource :search,
@@ -100,6 +63,7 @@
                  :download => :get,
                  :quick_add => :post,
                  :resolve_link => :post,
+                 :snapshot => :post,
                  :items => :get } do |pack|
     pack.resources :comments, :collection => { :timeline => :get }
     pack.resources :relationships, :collection => { :edit_relationships => :get }
@@ -138,6 +102,10 @@
   map.blob_version           '/files/:id/versions/:version',         :conditions => { :method => :get }, :controller => 'blobs', :action ="" 'show'
   map.formatted_blob_version '/files/:id/versions/:version.:format', :conditions => { :method => :get }, :controller => 'blobs', :action ="" 'show'
 
+  # pack redirect for linked data model
+  map.pack_version           '/packs/:id/versions/:version',         :conditions => { :method => :get }, :controller => 'packs', :action ="" 'show'
+  map.formatted_pack_version '/packs/:id/versions/:version.:format', :conditions => { :method => :get }, :controller => 'packs', :action ="" 'show'
+
   map.blob_version_suggestions '/files/:id/versions/:version/suggestions', :conditions => { :method => :get }, :controller => 'blobs', :action ="" 'suggestions'
   map.blob_version_process_suggestions '/files/:id/versions/:version/process_suggestions', :conditions => { :method => :post }, :controller => 'blobs', :action ="" 'process_suggestions'
 
@@ -182,12 +150,6 @@
     blob.resources :comments, :collection => { :timeline => :get }
   end
 
-  # blogs
-  map.resources :blogs do |blog|
-    # blogs have nested posts
-    blog.resources :blog_posts
-  end
-
   # services
   map.resources :services, :collection => { :search => :get }
   
@@ -201,11 +163,11 @@
   map.resources :messages, :collection => { :sent => :get, :delete_all_selected => :delete }
 
   # all oauth
-  map.oauth '/oauth',:controller=>'oauth',:action=""
   map.authorize '/oauth/authorize',:controller=>'oauth',:action=""
   map.request_token '/oauth/request_token',:controller=>'oauth',:action=""
   map.access_token '/oauth/access_token',:controller=>'oauth',:action=""
   map.test_request '/oauth/test_request',:controller=>'oauth',:action=""
+  map.resources :oauth
 
   # User timeline
   map.connect 'users/timeline', :controller => 'users', :action ="" 'timeline'
@@ -218,7 +180,7 @@
   map.connect 'users/forgot_password', :controller => "users", :action ="" "forgot_password"
   map.connect 'users/reset_password/:reset_code', :controller => "users", :action ="" "reset_password"
   
-  [ 'news', 'friends', 'groups', 'workflows', 'files', 'packs', 'forums', 'blogs', 'credits', 'tags', 'favourites' ].each do |tab|
+  [ 'news', 'friends', 'groups', 'forums', 'credits', 'tags', 'favourites' ].each do |tab|
     map.connect "users/:id/#{tab}", :controller => 'users', :action ="" tab
   end
   
@@ -247,12 +209,18 @@
 
     # user's reports of inappropriate content
     user.resources :reports, :controller => :user_reports
+
+    # user's uploaded resources
+    user.resources :workflows, : :index
+    user.resources :blobs, : :index, :as => :files
+    user.resources :packs, : :index
   end
 
   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, 
@@ -260,6 +228,12 @@
                  :tag => :post } do |network|
     network.resources :group_announcements, :as => :announcements, :name_prefix => nil
     network.resources :comments, :collection => { :timeline => :get }
+    network.resources :policies, :controller => 'group_policies'
+
+    # resources shared with network
+    network.resources :workflows, : :index
+    network.resources :blobs, : :index, :as => :files
+    network.resources :packs, : :index
   end
   
   # The priority is based upon order of creation: first created -> highest priority.
@@ -300,6 +274,8 @@
   map.resources :licenses
   map.resources :license_attributes
 
+  map.resources :policies, : :show
+
   # Generate special alias routes for external sites point to
   Conf.external_site_integrations.each_value do |data|
     map.connect data["path"], data["redirect"].symbolize_keys #Convert string keys to symbols
@@ -307,6 +283,42 @@
 
   map.connect 'clear_external_site_session_info', :controller => 'application', :action ="" 'clear_external_site_session_info'
 
+  # LoD routes
+  if Conf.rdfgen_enable
+
+    map.connect '/:contributable_type/:contributable_id/attributions/:attribution_id.:format',
+      :controller => 'linked_data', :action ="" 'attributions', :conditions => { :method => :get }
+
+    map.connect '/:contributable_type/:contributable_id/citations/:citation_id.:format',
+      :controller => 'linked_data', :action ="" 'citations', :conditions => { :method => :get }
+
+    map.connect '/:contributable_type/:contributable_id/comments/:comment_id.:format',
+      :controller => 'linked_data', :action ="" 'comments', :conditions => { :method => :get }
+
+    map.connect '/:contributable_type/:contributable_id/credits/:credit_id.:format',
+      :controller => 'linked_data', :action ="" 'credits', :conditions => { :method => :get }
+
+    map.connect '/users/:user_id/favourites/:favourite_id.:format',
+      :controller => 'linked_data', :action ="" 'favourites', :conditions => { :method => :get }
+
+    map.connect '/packs/:contributable_id/local_pack_entries/:local_pack_entry_id.:format',
+      :controller => 'linked_data', :action ="" 'local_pack_entries',
+      :contributable_type => 'packs', :conditions => { :method => :get }
+
+    map.connect '/packs/:contributable_id/remote_pack_entries/:remote_pack_entry_id.:format',
+      :controller => 'linked_data', :action ="" 'remote_pack_entries',
+      :contributable_type => 'packs', :conditions => { :method => :get }
+
+    map.connect '/:contributable_type/:contributable_id/policies/:policy_id.:format',
+      :controller => 'linked_data', :action ="" 'policies', :conditions => { :method => :get }
+
+    map.connect '/:contributable_type/:contributable_id/ratings/:rating_id.:format',
+      :controller => 'linked_data', :action ="" 'ratings', :conditions => { :method => :get }
+
+    map.connect '/tags/:tag_id/taggings/:tagging_id.:format',
+      :controller => 'linked_data', :action ="" 'taggings', :conditions => { :method => :get }
+  end
+
   # Install the default route as the lowest priority.
   map.connect ':controller/:action/:id'
 end

Copied: branches/events/config/sunspot.yml (from rev 3490, trunk/config/sunspot.yml) (0 => 3491)


--- branches/events/config/sunspot.yml	                        (rev 0)
+++ branches/events/config/sunspot.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,18 @@
+production:
+  solr:
+    hostname: localhost
+    port: 8983
+    log_level: WARNING
+
+development:
+  solr:
+    hostname: localhost
+    port: 8982
+    log_level: INFO
+
+test:
+  solr:
+    hostname: localhost
+    port: 8981
+    log_level: WARNING
+    

Modified: branches/events/config/tables.xml


(Binary files differ)

Copied: branches/events/db/migrate/000_removal_of_structured_data.rb (from rev 3490, trunk/db/migrate/000_removal_of_structured_data.rb) (0 => 3491)


--- branches/events/db/migrate/000_removal_of_structured_data.rb	                        (rev 0)
+++ branches/events/db/migrate/000_removal_of_structured_data.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,310 @@
+class RemovalOfStructuredData < ActiveRecord::Migration
+  def self.up
+
+    # Don't create these tables in if the (now removed) structured_data plugin
+    # has already created them.
+
+    return if ActiveRecord::Base.connection.tables.include?("contributions")
+
+    create_table "concept_relations" do |t|
+      t.integer "subject_concept_id"
+      t.string  "relation_type"
+      t.integer "object_concept_id"
+    end
+
+    create_table "concepts" do |t|
+      t.datetime "updated_at"
+      t.text     "description_html"
+      t.string   "phrase"
+      t.text     "description"
+      t.integer  "vocabulary_id"
+      t.datetime "created_at"
+    end
+
+    create_table "content_types" do |t|
+      t.integer  "user_id"
+      t.string   "title"
+      t.text     "description"
+      t.text     "description_html"
+      t.string   "mime_type"
+      t.datetime "created_at"
+      t.datetime "updated_at"
+      t.string   "category"
+    end
+
+    create_table "contributions" do |t|
+      t.integer  "contributor_id"
+      t.string   "contributor_type"
+      t.integer  "contributable_id"
+      t.string   "contributable_type"
+      t.integer  "policy_id"
+      t.datetime "created_at"
+      t.datetime "updated_at"
+      t.integer  "downloads_count",      :default => 0
+      t.integer  "viewings_count",       :default => 0
+      t.float    "rating"
+      t.float    "rank"
+      t.integer  "content_type_id"
+      t.integer  "license_id"
+      t.integer  "site_downloads_count", :default => 0
+      t.integer  "site_viewings_count",  :default => 0
+      t.string   "label"
+      t.string   "layout"
+    end
+
+    add_index "contributions",     ["contributable_id", "contributable_type"]
+    add_index "contributions",     ["contributor_id", "contributor_type"]
+
+    create_table "downloads" do |t|
+      t.integer  "contribution_id"
+      t.integer  "user_id"
+      t.datetime "created_at"
+      t.string   "user_agent"
+      t.boolean  "accessed_from_site", :default => false
+      t.string   "kind"
+    end
+
+    add_index :downloads, ["contribution_id"]
+
+    create_table "federation_sources" do |t|
+      t.string "name"
+    end
+
+    create_table "labels" do |t|
+      t.integer "concept_id"
+      t.string  "language"
+      t.string  "text"
+      t.integer "vocabulary_id"
+      t.string  "label_type"
+    end
+
+    create_table "ontologies" do |t|
+      t.string   "prefix"
+      t.datetime "updated_at"
+      t.string   "uri"
+      t.string   "title"
+      t.text     "description_html"
+      t.text     "description"
+      t.integer  "user_id"
+      t.datetime "created_at"
+    end
+
+    create_table "pack_contributable_entries" do |t|
+      t.integer  "pack_id",               :null => false
+      t.integer  "contributable_id",      :null => false
+      t.integer  "contributable_version"
+      t.string   "contributable_type"
+      t.text     "comment"
+      t.integer  "user_id",               :null => false
+      t.datetime "created_at"
+      t.datetime "updated_at"
+    end
+
+    create_table "pack_remote_entries" do |t|
+      t.integer  "pack_id",       :null => false
+      t.string   "title"
+      t.string   "uri"
+      t.string   "alternate_uri"
+      t.text     "comment"
+      t.integer  "user_id",       :null => false
+      t.datetime "created_at"
+      t.datetime "updated_at"
+    end
+
+    create_table "packs" do |t|
+      t.integer  "contributor_id"
+      t.string   "contributor_type"
+      t.string   "title"
+      t.text     "description"
+      t.text     "description_html"
+      t.datetime "created_at"
+      t.datetime "updated_at"
+    end
+
+    create_table "policies" do |t|
+      t.integer  "contributor_id"
+      t.string   "contributor_type"
+      t.string   "name"
+      t.datetime "created_at"
+      t.datetime "updated_at"
+      t.integer  "share_mode"
+      t.integer  "update_mode"
+      t.boolean  "public_download",  :default => false
+      t.boolean  "public_view",      :default => false
+    end
+
+    create_table "predicates" do |t|
+      t.datetime "updated_at"
+      t.string   "title"
+      t.text     "description_html"
+      t.string   "phrase"
+      t.integer  "ontology_id"
+      t.text     "description"
+      t.text     "equivalent_to"
+      t.datetime "created_at"
+    end
+
+    create_table "previews" do |t|
+      t.integer  "svg_blob_id"
+      t.integer  "image_blob_id"
+      t.datetime "created_at"
+    end
+
+    create_table "relationships" do |t|
+      t.string   "objekt_type"
+      t.integer  "objekt_id"
+      t.string   "subject_type"
+      t.integer  "subject_id"
+      t.integer  "user_id"
+      t.datetime "created_at"
+      t.integer  "context_id"
+      t.integer  "predicate_id"
+      t.string   "context_type"
+    end
+
+    create_table "service_categories" do |t|
+      t.string   "uri"
+      t.datetime "updated_at"
+      t.integer  "service_id"
+      t.string   "label"
+      t.datetime "retrieved_at"
+      t.datetime "created_at"
+    end
+
+    create_table "service_deployments" do |t|
+      t.string   "iso3166_country_code"
+      t.string   "city"
+      t.string   "submitter_label"
+      t.string   "uri"
+      t.datetime "updated_at"
+      t.string   "submitter_uri"
+      t.string   "country"
+      t.integer  "service_id"
+      t.datetime "created"
+      t.integer  "service_provider_id"
+      t.string   "flag_url"
+      t.string   "endpoint"
+      t.datetime "retrieved_at"
+      t.datetime "created_at"
+    end
+
+    create_table "service_providers" do |t|
+      t.string   "name"
+      t.string   "uri"
+      t.datetime "updated_at"
+      t.text     "description"
+      t.datetime "created"
+      t.datetime "retrieved_at"
+      t.datetime "created_at"
+    end
+
+    create_table "service_tags" do |t|
+      t.string   "uri"
+      t.datetime "updated_at"
+      t.integer  "service_id"
+      t.string   "label"
+      t.datetime "retrieved_at"
+      t.datetime "created_at"
+    end
+
+    create_table "service_types" do |t|
+      t.datetime "updated_at"
+      t.integer  "service_id"
+      t.string   "label"
+      t.datetime "retrieved_at"
+      t.datetime "created_at"
+    end
+
+    create_table "services" do |t|
+      t.string   "documentation_uri"
+      t.string   "iso3166_country_code"
+      t.string   "city"
+      t.string   "name"
+      t.string   "provider_uri"
+      t.string   "submitter_label"
+      t.string   "uri"
+      t.datetime "updated_at"
+      t.string   "monitor_symbol_url"
+      t.datetime "monitor_last_checked"
+      t.string   "monitor_label"
+      t.string   "country"
+      t.string   "submitter_uri"
+      t.string   "monitor_small_symbol_url"
+      t.text     "monitor_message"
+      t.text     "description"
+      t.string   "wsdl"
+      t.datetime "created"
+      t.string   "contributor_type"
+      t.integer  "contributor_id"
+      t.string   "flag_url"
+      t.string   "endpoint"
+      t.string   "provider_label"
+      t.datetime "retrieved_at"
+      t.datetime "created_at"
+    end
+
+    create_table "topic_feedbacks" do |t|
+      t.integer  "score"
+      t.integer  "topic_id"
+      t.datetime "submit_dt"
+      t.integer  "user_id"
+    end
+
+    create_table "topic_runs" do |t|
+      t.datetime "runtime"
+      t.string   "description"
+    end
+
+    create_table "topic_tag_map" do |t|
+      t.integer "topic_id"
+      t.boolean "display_flag"
+      t.integer "tag_id"
+      t.float   "probability"
+    end
+
+    create_table "topic_workflow_map" do |t|
+      t.integer "topic_id"
+      t.boolean "display_flag"
+      t.integer "workflow_id"
+      t.float   "probability"
+    end
+
+    create_table "topics" do |t|
+      t.string  "name"
+      t.integer "orig_run_id"
+      t.integer "run_id"
+    end
+
+    create_table "user_reports" do |t|
+      t.string   "subject_type"
+      t.text     "content"
+      t.integer  "subject_id"
+      t.integer  "user_id"
+      t.text     "report"
+      t.datetime "created_at"
+    end
+
+    create_table "vocabularies" do |t|
+      t.integer  "user_id"
+      t.string   "title"
+      t.text     "description"
+      t.text     "description_html"
+      t.datetime "created_at"
+      t.datetime "updated_at"
+      t.string   "prefix"
+      t.string   "uri"
+    end
+
+    create_table "workflow_processors" do |t|
+      t.string  "name"
+      t.string  "wsdl_operation"
+      t.string  "wsdl"
+      t.integer "workflow_id"
+    end
+  end
+
+  def self.down
+    raise ActiveRecord::IrreversibleMigration 
+  end
+end
+

Modified: branches/events/db/migrate/075_add_indexes_to_frequently_used_tables.rb (3490 => 3491)


--- branches/events/db/migrate/075_add_indexes_to_frequently_used_tables.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/db/migrate/075_add_indexes_to_frequently_used_tables.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -5,8 +5,8 @@
 
     add_index :workflow_versions, ["workflow_id"], :name => "workflow_versions_workflow_id_index"
 
-    add_index :contributions, ["contributable_id", "contributable_type"], :name => "contributions_contributable_index"
-    add_index :contributions, ["contributor_id",   "contributor_type"],   :name => "contributions_contributor_index"
+#   add_index :contributions, ["contributable_id", "contributable_type"], :name => "contributions_contributable_index"
+#   add_index :contributions, ["contributor_id",   "contributor_type"],   :name => "contributions_contributor_index"
 
     add_index :memberships, ["user_id"],    :name => "memberships_user_id_index"
     add_index :memberships, ["network_id"], :name => "memberships_network_id_index"
@@ -25,8 +25,8 @@
 
     remove_index :workflow_versions, :name => "workflow_versions_workflow_id_index"
 
-    remove_index :contributions, :name => "contributions_contributable_index"
-    remove_index :contributions, :name => "contributions_contributor_index"
+#   remove_index :contributions, :name => "contributions_contributable_index"
+#   remove_index :contributions, :name => "contributions_contributor_index"
 
     remove_index :memberships, :name => "memberships_user_id_index"
     remove_index :memberships, :name => "memberships_network_id_index"

Modified: branches/events/db/migrate/086_rename_indexes_to_automatic_names.rb (3490 => 3491)


--- branches/events/db/migrate/086_rename_indexes_to_automatic_names.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/db/migrate/086_rename_indexes_to_automatic_names.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -7,8 +7,8 @@
   def self.up
     remove_index "bookmarks",         :name => "fk_bookmarks_user"
     remove_index "comments",          :name => "fk_comments_user"
-    remove_index "contributions",     :name => "contributions_contributable_index"
-    remove_index "contributions",     :name => "contributions_contributor_index"
+#   remove_index "contributions",     :name => "contributions_contributable_index"
+#   remove_index "contributions",     :name => "contributions_contributor_index"
     remove_index "friendships",       :name => "friendships_friend_id_index"
     remove_index "friendships",       :name => "friendships_user_id_index"
     remove_index "memberships",       :name => "memberships_network_id_index"

Deleted: branches/events/db/migrate/097_add_activities.rb (3490 => 3491)


--- branches/events/db/migrate/097_add_activities.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/db/migrate/097_add_activities.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,32 +0,0 @@
-# myExperiment: db/migrate/097_add_activities.rb
-#
-# Copyright (c) 2012 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-class AddActivities < ActiveRecord::Migration
-  def self.up
-    create_table :activities do |t|
-
-      t.string  :subject_type
-      t.integer :subject_id
-      t.string  :subject_label
-
-      t.string  :action
-
-      t.string  :objekt_type
-      t.integer :objekt_id
-      t.string  :objekt_label
-
-      t.string  :auth_type
-      t.integer :auth_id
-
-      t.string  :extra
-
-      t.datetime :created_at
-    end
-  end
-
-  def self.down
-    drop_table :activities
-  end
-end

Copied: branches/events/db/migrate/098_create_pack_versions.rb (from rev 3490, trunk/db/migrate/098_create_pack_versions.rb) (0 => 3491)


--- branches/events/db/migrate/098_create_pack_versions.rb	                        (rev 0)
+++ branches/events/db/migrate/098_create_pack_versions.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,33 @@
+# myExperiment: db/migrate/097_create_pack_versions.rb
+#
+# Copyright (c) 2012 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class CreatePackVersions < ActiveRecord::Migration
+
+  def self.up
+    create_table :pack_versions do |t|
+      t.integer  "pack_id"
+      t.integer  "version"
+      t.text     "revision_comments"
+      t.string   "title"
+      t.text     "description"
+      t.text     "description_html"
+      t.datetime "created_at"
+      t.datetime "updated_at"
+    end
+
+    add_column :packs, :current_version, :integer
+    add_column :pack_contributable_entries, :version, :integer
+    add_column :pack_remote_entries, :version, :integer
+  end
+
+  def self.down
+    remove_column :packs, :current_version
+    remove_column :pack_contributable_entries, :version
+    remove_column :pack_remote_entries, :version
+
+    drop_table :pack_versions
+  end
+end
+

Copied: branches/events/db/migrate/099_add_activities.rb (from rev 3490, branches/events/db/migrate/097_add_activities.rb) (0 => 3491)


--- branches/events/db/migrate/099_add_activities.rb	                        (rev 0)
+++ branches/events/db/migrate/099_add_activities.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,32 @@
+# myExperiment: db/migrate/097_add_activities.rb
+#
+# Copyright (c) 2012 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class AddActivities < ActiveRecord::Migration
+  def self.up
+    create_table :activities do |t|
+
+      t.string  :subject_type
+      t.integer :subject_id
+      t.string  :subject_label
+
+      t.string  :action
+
+      t.string  :objekt_type
+      t.integer :objekt_id
+      t.string  :objekt_label
+
+      t.string  :auth_type
+      t.integer :auth_id
+
+      t.string  :extra
+
+      t.datetime :created_at
+    end
+  end
+
+  def self.down
+    drop_table :activities
+  end
+end

Copied: branches/events/db/migrate/20121107095856_create_wsdl_deprecations.rb (from rev 3490, trunk/db/migrate/20121107095856_create_wsdl_deprecations.rb) (0 => 3491)


--- branches/events/db/migrate/20121107095856_create_wsdl_deprecations.rb	                        (rev 0)
+++ branches/events/db/migrate/20121107095856_create_wsdl_deprecations.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -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/events/db/migrate/20121112133419_change_wsdl_deprecations.rb (from rev 3490, trunk/db/migrate/20121112133419_change_wsdl_deprecations.rb) (0 => 3491)


--- branches/events/db/migrate/20121112133419_change_wsdl_deprecations.rb	                        (rev 0)
+++ branches/events/db/migrate/20121112133419_change_wsdl_deprecations.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -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/events/db/migrate/20121112134053_create_deprecation_events.rb (from rev 3490, trunk/db/migrate/20121112134053_create_deprecation_events.rb) (0 => 3491)


--- branches/events/db/migrate/20121112134053_create_deprecation_events.rb	                        (rev 0)
+++ branches/events/db/migrate/20121112134053_create_deprecation_events.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -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

Copied: branches/events/db/migrate/20121126093655_create_semantic_annotations.rb (from rev 3490, trunk/db/migrate/20121126093655_create_semantic_annotations.rb) (0 => 3491)


--- branches/events/db/migrate/20121126093655_create_semantic_annotations.rb	                        (rev 0)
+++ branches/events/db/migrate/20121126093655_create_semantic_annotations.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,14 @@
+class CreateSemanticAnnotations < ActiveRecord::Migration
+  def self.up
+    create_table :semantic_annotations do |t|
+      t.integer :subject_id
+      t.string :subject_type
+      t.string :predicate
+      t.string :object
+    end
+  end
+
+  def self.down
+    drop_table :semantic_annotations
+  end
+end

Copied: branches/events/db/migrate/20121126095828_create_workflow_ports.rb (from rev 3490, trunk/db/migrate/20121126095828_create_workflow_ports.rb) (0 => 3491)


--- branches/events/db/migrate/20121126095828_create_workflow_ports.rb	                        (rev 0)
+++ branches/events/db/migrate/20121126095828_create_workflow_ports.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,13 @@
+class CreateWorkflowPorts < ActiveRecord::Migration
+  def self.up
+    create_table :workflow_ports do |t|
+      t.string :name
+      t.string :port_type
+      t.integer :workflow_id
+    end
+  end
+
+  def self.down
+    drop_table :workflow_ports
+  end
+end

Copied: branches/events/db/migrate/20130114091326_move_layout_to_policy.rb (from rev 3490, trunk/db/migrate/20130114091326_move_layout_to_policy.rb) (0 => 3491)


--- branches/events/db/migrate/20130114091326_move_layout_to_policy.rb	                        (rev 0)
+++ branches/events/db/migrate/20130114091326_move_layout_to_policy.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,20 @@
+class MoveLayoutToPolicy < ActiveRecord::Migration
+  def self.up
+    # Add column to policies
+    add_column :policies, :layout, :string
+    # Copy values
+    ActiveRecord::Base.record_timestamps = false
+    execute 'UPDATE policies,contributions SET policies.layout = contributions.layout WHERE policies.id = contributions.policy_id'
+    ActiveRecord::Base.record_timestamps = true
+    # Remove column from contributions
+    remove_column :contributions, :layout
+  end
+
+  def self.down
+    add_column :contributions, :layout, :string
+    ActiveRecord::Base.record_timestamps = false
+    execute 'UPDATE policies,contributions SET contributions.layout = policies.layout WHERE policies.id = contributions.policy_id'
+    ActiveRecord::Base.record_timestamps = true
+    remove_column :policies, :layout
+  end
+end

Copied: branches/events/db/migrate/20130124144906_remove_blogs.rb (from rev 3490, trunk/db/migrate/20130124144906_remove_blogs.rb) (0 => 3491)


--- branches/events/db/migrate/20130124144906_remove_blogs.rb	                        (rev 0)
+++ branches/events/db/migrate/20130124144906_remove_blogs.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,15 @@
+class RemoveBlogs < ActiveRecord::Migration
+  def self.up
+    drop_table :blogs
+  end
+
+  def self.down
+    create_table :blogs do |t|
+      t.column :contributor_id, :integer
+      t.column :contributor_type, :string
+      t.column :title, :string
+      t.column :created_at, :datetime
+      t.column :updated_at, :datetime
+    end
+  end
+end

Copied: branches/events/db/migrate/20130124144917_remove_blog_posts.rb (from rev 3490, trunk/db/migrate/20130124144917_remove_blog_posts.rb) (0 => 3491)


--- branches/events/db/migrate/20130124144917_remove_blog_posts.rb	                        (rev 0)
+++ branches/events/db/migrate/20130124144917_remove_blog_posts.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,16 @@
+class RemoveBlogPosts < ActiveRecord::Migration
+  def self.up
+    drop_table :blog_posts
+  end
+
+  def self.down
+    create_table :blog_posts do |t|
+      t.column :blog_id, :integer
+      t.column :title, :string
+      t.column :body, :text
+      t.column :created_at, :datetime
+      t.column :updated_at, :datetime
+      t.column :body_html, :text
+    end
+  end
+end

Copied: branches/events/db/migrate/20130215162325_change_runner_passwords.rb (from rev 3490, trunk/db/migrate/20130215162325_change_runner_passwords.rb) (0 => 3491)


--- branches/events/db/migrate/20130215162325_change_runner_passwords.rb	                        (rev 0)
+++ branches/events/db/migrate/20130215162325_change_runner_passwords.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,16 @@
+# myExperiment: db/migrate/20130215162325_change_runner_passwords.rb
+#
+# Copyright (c) 2013 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class ChangeRunnerPasswords < ActiveRecord::Migration
+  def self.up
+    remove_column :taverna_enactors, :crypted_password
+    add_column    :taverna_enactors, :password, :string
+  end
+
+  def self.down
+    add_column    :taverna_enactors, :crypted_password, :string
+    remove_column :taverna_enactors, :password
+  end
+end

Copied: branches/events/db/migrate/20130304123620_add_license_id_to_packs.rb (from rev 3490, trunk/db/migrate/20130304123620_add_license_id_to_packs.rb) (0 => 3491)


--- branches/events/db/migrate/20130304123620_add_license_id_to_packs.rb	                        (rev 0)
+++ branches/events/db/migrate/20130304123620_add_license_id_to_packs.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,9 @@
+class AddLicenseIdToPacks < ActiveRecord::Migration
+  def self.up#
+    add_column :packs, :license_id, :integer
+  end
+
+  def self.down
+    remove_column :packs, :license_id
+  end
+end

Copied: branches/events/db/migrate/20130308084600_remove_key_type_from_client_applications.rb (from rev 3490, trunk/db/migrate/20130308084600_remove_key_type_from_client_applications.rb) (0 => 3491)


--- branches/events/db/migrate/20130308084600_remove_key_type_from_client_applications.rb	                        (rev 0)
+++ branches/events/db/migrate/20130308084600_remove_key_type_from_client_applications.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,9 @@
+class RemoveKeyTypeFromClientApplications < ActiveRecord::Migration
+  def self.up
+    remove_column :client_applications, :key_type
+  end
+
+  def self.down
+    add_column :client_applications, :key_type, :string
+  end
+end

Copied: branches/events/db/migrate/20130308085716_remove_creator_id_from_client_applications.rb (from rev 3490, trunk/db/migrate/20130308085716_remove_creator_id_from_client_applications.rb) (0 => 3491)


--- branches/events/db/migrate/20130308085716_remove_creator_id_from_client_applications.rb	                        (rev 0)
+++ branches/events/db/migrate/20130308085716_remove_creator_id_from_client_applications.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,9 @@
+class RemoveCreatorIdFromClientApplications < ActiveRecord::Migration
+  def self.up
+    remove_column :client_applications, :creator_id
+  end
+
+  def self.down
+    add_column :client_applications, :creator_id, :integer
+  end
+end

Modified: branches/events/db/schema.rb (3490 => 3491)


--- branches/events/db/schema.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/db/schema.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -9,7 +9,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version => 97) do
+ActiveRecord::Schema.define(:version => 20130308085716) do
 
   create_table "activities", :force => true do |t|
     t.string   "subject_type"
@@ -88,23 +88,6 @@
     t.integer  "current_version"
   end
 
-  create_table "blog_posts", :force => true do |t|
-    t.integer  "blog_id"
-    t.string   "title"
-    t.text     "body"
-    t.datetime "created_at"
-    t.datetime "updated_at"
-    t.text     "body_html"
-  end
-
-  create_table "blogs", :force => true do |t|
-    t.integer  "contributor_id"
-    t.string   "contributor_type"
-    t.string   "title"
-    t.datetime "created_at"
-    t.datetime "updated_at"
-  end
-
   create_table "bookmarks", :force => true do |t|
     t.string   "title",             :limit => 50, :default => ""
     t.datetime "created_at",                                      :null => false
@@ -115,6 +98,27 @@
 
   add_index "bookmarks", ["user_id"], :name => "index_bookmarks_on_user_id"
 
+  create_table "checksums", :id => false, :force => true do |t|
+    t.integer "id"
+    t.string  "sha1"
+  end
+
+  add_index "checksums", ["id"], :name => "i1", :unique => true
+
+  create_table "checksums_new", :id => false, :force => true do |t|
+    t.integer "id"
+    t.string  "sha1"
+  end
+
+  add_index "checksums_new", ["id"], :name => "i1", :unique => true
+
+  create_table "checksums_new_new", :id => false, :force => true do |t|
+    t.integer "id"
+    t.string  "sha1"
+  end
+
+  add_index "checksums_new_new", ["id"], :name => "ii", :unique => true
+
   create_table "citations", :force => true do |t|
     t.integer  "user_id"
     t.integer  "workflow_id"
@@ -139,10 +143,8 @@
     t.string   "key",          :limit => 50
     t.string   "secret",       :limit => 50
     t.integer  "user_id"
-    t.string   "key_type"
     t.datetime "created_at"
     t.datetime "updated_at"
-    t.integer  "creator_id"
   end
 
   add_index "client_applications", ["key"], :name => "index_client_applications_on_key", :unique => true
@@ -209,7 +211,6 @@
     t.integer  "site_downloads_count", :default => 0
     t.integer  "site_viewings_count",  :default => 0
     t.string   "label"
-    t.string   "layout"
   end
 
   add_index "contributions", ["contributable_id", "contributable_type"], :name => "index_contributions_on_contributable_id_and_contributable_type"
@@ -235,6 +236,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"
@@ -432,6 +439,7 @@
     t.integer  "user_id",               :null => false
     t.datetime "created_at"
     t.datetime "updated_at"
+    t.integer  "version"
   end
 
   create_table "pack_remote_entries", :force => true do |t|
@@ -443,8 +451,20 @@
     t.integer  "user_id",       :null => false
     t.datetime "created_at"
     t.datetime "updated_at"
+    t.integer  "version"
   end
 
+  create_table "pack_versions", :force => true do |t|
+    t.integer  "pack_id"
+    t.integer  "version"
+    t.text     "revision_comments"
+    t.string   "title"
+    t.text     "description"
+    t.text     "description_html"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+  end
+
   create_table "packs", :force => true do |t|
     t.integer  "contributor_id"
     t.string   "contributor_type"
@@ -453,6 +473,8 @@
     t.text     "description_html"
     t.datetime "created_at"
     t.datetime "updated_at"
+    t.integer  "current_version"
+    t.integer  "license_id"
   end
 
   create_table "pending_invitations", :force => true do |t|
@@ -504,6 +526,7 @@
     t.integer  "update_mode"
     t.boolean  "public_download",  :default => false
     t.boolean  "public_view",      :default => false
+    t.string   "layout"
   end
 
   create_table "predicates", :force => true do |t|
@@ -584,6 +607,13 @@
 
   add_index "reviews", ["user_id"], :name => "index_reviews_on_user_id"
 
+  create_table "semantic_annotations", :force => true do |t|
+    t.integer "subject_id"
+    t.string  "subject_type"
+    t.string  "predicate"
+    t.string  "object"
+  end
+
   create_table "service_categories", :force => true do |t|
     t.string   "uri"
     t.datetime "updated_at"
@@ -707,9 +737,9 @@
     t.string   "contributor_type"
     t.string   "url"
     t.string   "username"
-    t.string   "crypted_password"
     t.datetime "created_at"
     t.datetime "updated_at"
+    t.string   "password"
   end
 
   create_table "topic_feedbacks", :force => true do |t|
@@ -798,6 +828,12 @@
     t.string   "uri"
   end
 
+  create_table "workflow_ports", :force => true do |t|
+    t.string  "name"
+    t.string  "port_type"
+    t.integer "workflow_id"
+  end
+
   create_table "workflow_processors", :force => true do |t|
     t.string  "name"
     t.string  "wsdl_operation"
@@ -849,4 +885,9 @@
     t.integer  "preview_id"
   end
 
+  create_table "wsdl_deprecations", :force => true do |t|
+    t.string  "wsdl"
+    t.integer "deprecation_event_id"
+  end
+
 end

Deleted: branches/events/go.sh (3490 => 3491)


--- branches/events/go.sh	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/go.sh	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-ruby ./script/server --environment=production --port=80
-

Copied: branches/events/installers/ubuntu/.gitignore (from rev 3490, trunk/installers/ubuntu/.gitignore) (0 => 3491)


--- branches/events/installers/ubuntu/.gitignore	                        (rev 0)
+++ branches/events/installers/ubuntu/.gitignore	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1 @@
+/settings.bash

Copied: branches/events/installers/ubuntu/dependencies.bash (from rev 3490, trunk/installers/ubuntu/dependencies.bash) (0 => 3491)


--- branches/events/installers/ubuntu/dependencies.bash	                        (rev 0)
+++ branches/events/installers/ubuntu/dependencies.bash	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+echo "Installing required packages using apt-get install"
+sudo apt-get update || { echo "Could not update apt-get. Aborting ..."; exit 5; }
+sudo -n apt-get install -y build-essential exim4 git-core curl libcurl3 libcurl3-gnutls libcurl4-gnutls-dev openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev mysql-server libmysqlclient-dev libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion libmagickwand-dev graphviz gcj-jre-headless || { echo "Could not install required using apt-get install. Aborting ..."; exit 6; }
+

Modified: branches/events/installers/ubuntu/install.bash (3490 => 3491)


--- branches/events/installers/ubuntu/install.bash	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/installers/ubuntu/install.bash	2013-04-03 15:44:21 UTC (rev 3491)
@@ -19,9 +19,7 @@
 sudo su -c "echo mysql-server-5.1 mysql-server/root_password password `echo "'"``echo ${mysql_root_password}``echo "'"` | debconf-set-selections" || { echo "Could not set debconf option mysql-server-5.1 mysql-server/root_password. Aborting ..."; exit 3; }
 sudo su -c "echo mysql-server-5.1 mysql-server/root_password_again password `echo "'"``echo ${mysql_root_password}``echo "'"` | debconf-set-selections" || { echo "Could not set debconf option mysql-server-5.1 mysql-server/root_password_again. Aborting ..."; exit 4; }
 
-echo "Installing required packages using apt-get install"
-sudo apt-get update || { echo "Could not update apt-get. Aborting ..."; exit 5; }
-sudo -n apt-get install -y build-essential exim4 git-core curl libcurl3 libcurl3-gnutls libcurl4-openssl-dev openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev mysql-server libmysqlclient-dev libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion libmagickwand-dev graphviz gcj-jre-headless || { echo "Could not install required using apt-get install. Aborting ..."; exit 6; }
+source "${basedir}/dependencies.bash"
 
 echo "Installing and configuring RVM"
 sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer ) || { echo "Could not install RVM. Aborting ..."; exit 7; }

Modified: branches/events/lib/account_management.rb (3490 => 3491)


--- branches/events/lib/account_management.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/account_management.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -12,8 +12,6 @@
     :announcements              => { :owner => :user_id },
     :attributions               => { :owner => :derived },
     :blobs                      => { :owner => :contributor },
-    :blogs                      => { :owner => :contributor },
-    :blog_posts                 => { :owner => :derived },
     :bookmarks                  => { :owner => :user_id },
     :citations                  => { :owner => :user_id },
     :client_applications        => { :owner => :user_id },

Modified: branches/events/lib/acts_as_contributable.rb (3490 => 3491)


--- branches/events/lib/acts_as_contributable.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/acts_as_contributable.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -83,6 +83,7 @@
         end
 
         def contributor_name
+          return nil if contribution.nil?
           return contribution.contributor.name  if contribution.contributor.respond_to?('name')
           return contribution.contributor.title if contribution.contributor.respond_to?('title')
         end

Modified: branches/events/lib/authorization.rb (3490 => 3491)


--- branches/events/lib/authorization.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/authorization.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -48,13 +48,11 @@
 
     user = nil unless user.kind_of?(User)
     
-    is_authorized = false
-
     object_type = object.class == Class ? object.name : object.class.name
 
     case object_type
 
-      when "Workflow", "Blog", "Blob", "Pack", "Service", "Contribution"
+      when "Workflow", "Blob", "Pack", "Service", "Contribution"
 
         # workflows can only be created by authenticated users
         if (action == "create") && [Workflow, Blob, Pack].include?(object)
@@ -72,9 +70,9 @@
 
         # return the response
         case action
-          when "view";     return ob.view_permission == "1"
-          when "download"; return ob.download_permission == "1"
-          when "edit";     return ob.edit_permission == "1"
+          when "view";     return ob.view_permission.to_s == "1"
+          when "download"; return ob.download_permission.to_s == "1"
+          when "edit";     return ob.edit_permission.to_s == "1"
           else;            return false
         end
         
@@ -82,31 +80,49 @@
         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"
+        case action
+          when "create"
+
+            # If a user can edit a pack, they can create a version of it.
+            is_authorized = Authorization.check('edit', context, user)
+
+          when "view"
+
+            # If a user can view a pack, they can view versions of it.
+            is_authorized = Authorization.check('view', context, user)
+
+          else
+            
+            # Editing or deleting versions of a pack is not allowed.
+            is_authorized = false
+        end
+
       when "Comment"
         case action
           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 +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"
@@ -127,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"
 
@@ -207,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"
@@ -224,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"
@@ -244,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"
 
@@ -261,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"
@@ -285,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"
@@ -305,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"
@@ -325,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
 
@@ -333,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
@@ -436,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?
@@ -446,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/events/lib/conf.rb (3490 => 3491)


--- branches/events/lib/conf.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/conf.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -254,6 +254,10 @@
     self.model_alias_convert(self.model_aliases.invert, str)
   end
 
+  def self.shortcut_keywords
+    self.fetch_entry('shortcut_keywords') || {}
+  end
+
 private
 
   def self.model_alias_convert(map, str)

Modified: branches/events/lib/country_codes.rb (3490 => 3491)


--- branches/events/lib/country_codes.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/country_codes.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,6 +1,7 @@
 module CountryCodes
     @@codes = Hash.new
     File.open('config/countries.tab').each do |record|
+      record = record.force_encoding('iso-8859-1') if RUBY_VERSION > "1.8.7"
       parts = record.split("\t")
       @@codes[parts[0]] = parts[1].strip
     end
@@ -25,4 +26,4 @@
     def self.valid_code?(code)
       @@codes.key?(code)
     end
-end
\ No newline at end of file
+end

Modified: branches/events/lib/maintenance/backup.rb (3490 => 3491)


--- branches/events/lib/maintenance/backup.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/maintenance/backup.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -119,8 +119,6 @@
       table(:model => Attribution,            :filter  => true, :auth_object => "attributable")
       table(:name  => "auto_tables")
       table(:model => Blob,                   :filter  => true)
-      table(:model => Blog,                   :no_data => true)
-      table(:model => BlogPost,               :no_data => true)
       table(:model => Bookmark)
       table(:model => Citation,               :filter  => true, :auth_object => "workflow")
       table(:model => ClientApplication,      :no_data => true)

Copied: branches/events/lib/pivoting.rb (from rev 3490, trunk/lib/pivoting.rb) (0 => 3491)


--- branches/events/lib/pivoting.rb	                        (rev 0)
+++ branches/events/lib/pivoting.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,607 @@
+# Pivot code
+
+TOKEN_UNKNOWN         = 0x0000
+TOKEN_AND             = 0x0001
+TOKEN_OR              = 0x0002
+TOKEN_WORD            = 0x0003
+TOKEN_OPEN            = 0x0004
+TOKEN_CLOSE           = 0x0005
+TOKEN_STRING          = 0x0006
+TOKEN_EOS             = 0x00ff
+
+NUM_TOKENS            = 6
+
+STATE_INITIAL         = 0x0000
+STATE_EXPECT_OPEN     = 0x0100
+STATE_EXPECT_STR      = 0x0200
+STATE_EXPECT_EXPR_END = 0x0300
+STATE_EXPECT_END      = 0x0400
+STATE_COMPLETE        = 0x0500
+
+def calculate_pivot(opts = {})
+
+  begin
+    expr = parse_filter_expression(opts[:params]["filter"], opts[:pivot_options], :active_filters => opts[:active_filters])
+  rescue Exception => ex
+    if Rails.env == "production"
+      problem = "Problem with query _expression_: #{ex}"
+    else
+      raise ex
+    end
+  end
+
+  pivot = contributions_list(opts[:params], opts[:user], opts[:pivot_options],
+                             :model            => opts[:model],
+                             :auth_type        => opts[:auth_type],
+                             :auth_id          => opts[:auth_id],
+                             :group_by         => opts[:group_by],
+                             :active_filters   => opts[:active_filters],
+                             :lock_filter      => opts[:locked_filters],
+                             :search_models    => opts[:search_models],
+                             :search_limit     => opts[:search_limit],
+                             :no_pagination    => opts[:no_pagination],
+                             :filters          => expr)
+
+  [pivot, problem]
+end
+
+def parse_filter_expression(expr, pivot_options, opts = {})
+
+  def unescape_string(str)
+    str.match(/^"(.*)"$/)[1].gsub(/\\"/, '"')
+  end
+
+  return nil if expr.nil?
+
+  state  = STATE_INITIAL
+  data   = ""
+
+  begin
+
+    tokens = expr.match(/^
+
+          \s* (\sAND\s)         | # AND operator
+          \s* (\sOR\s)          | # OR operator
+          \s* (\w+)             | # a non-keyword word
+          \s* (\()              | # an open paranthesis
+          \s* (\))              | # a close paranthesis
+          \s* ("(\\.|[^\\"])*")   # double quoted string with backslash escapes
+
+          /ix)
+
+    if tokens.nil?
+      token = TOKEN_UNKNOWN
+    else
+      (1..NUM_TOKENS).each do |i|
+        token = i if tokens[i]
+      end
+    end
+
+    if token == TOKEN_UNKNOWN
+      token = TOKEN_EOS if expr.strip.empty?
+    end
+
+    case state | token
+      when STATE_INITIAL         | TOKEN_WORD   ; state = STATE_EXPECT_OPEN     ; data << { :name => tokens[0], :expr => [] }
+      when STATE_EXPECT_OPEN     | TOKEN_OPEN   ; state = STATE_EXPECT_STR
+      when STATE_EXPECT_STR      | TOKEN_STRING ; state = STATE_EXPECT_EXPR_END ; data.last[:expr] << tokens[0]
+      when STATE_EXPECT_EXPR_END | TOKEN_AND    ; state = STATE_EXPECT_STR      ; data.last[:expr] << :and
+      when STATE_EXPECT_EXPR_END | TOKEN_OR     ; state = STATE_EXPECT_STR      ; data.last[:expr] << :or
+      when STATE_EXPECT_EXPR_END | TOKEN_CLOSE  ; state = STATE_EXPECT_END
+      when STATE_EXPECT_END      | TOKEN_AND    ; state = STATE_INITIAL         ; data << :and
+      when STATE_EXPECT_END      | TOKEN_OR     ; state = STATE_INITIAL         ; data << :or
+      when STATE_EXPECT_END      | TOKEN_EOS    ; state = STATE_COMPLETE
+
+      else raise "Error parsing query _expression_"
+    end
+
+    expr = tokens.post_match unless state == STATE_COMPLETE
+
+  end while state != STATE_COMPLETE
+
+  # validate and reduce expressions to current capabilities
+
+  valid_filters = pivot_options["filters"].map do |f| f["query_option"] end
+  valid_filters = valid_filters.select do |f| opts[:active_filters].include?(f) end
+
+  data.each do |category|
+    case category
+      when :or
+        raise "Unsupported query _expression_"
+      when :and
+        # Fine
+      else
+        raise "Unknown filter category" unless valid_filters.include?(category[:name])
+
+        counts = { :and => 0, :or => 0 }
+
+        category[:expr].each do |bit|
+          counts[bit] = counts[bit] + 1 if bit.class == Symbol
+        end
+
+        raise "Unsupported query _expression_" if counts[:and] > 0 && counts[:or] > 0
+
+        # haven't implemented 'and' within a particular filter yet
+        raise "Unsupported query _expression_" if counts[:and] > 0
+
+        if category[:expr].length == 1
+          category[:expr] = { :terms => [unescape_string(category[:expr].first)] }
+        else
+          category[:expr] = {
+              :operator => category[:expr][1],
+              :terms    => category[:expr].select do |t|
+                t.class == String
+              end.map do |t|
+                unescape_string(t)
+              end
+          }
+        end
+    end
+  end
+
+  data
+end
+
+def contributions_list(params = nil, user = nil, pivot_options = nil, opts = {})
+
+  def escape_sql(str)
+    str.gsub(/\\/, '\&\&').gsub(/'/, "''")
+  end
+
+  def build_url(params, opts, expr, parts, pivot_options, extra = {})
+
+    query = {}
+
+    if parts.include?(:filter)
+      bits = []
+      pivot_options["filters"].each do |filter|
+        if !opts[:lock_filter] || opts[:lock_filter][filter["query_option"]].nil?
+          if find_filter(expr, filter["query_option"])
+            bits << filter["query_option"] + "(\"" + find_filter(expr, filter["query_option"])[:expr][:terms].map do |t| t.gsub(/"/, '\"') end.join("\" OR \"") + "\")"
+          end
+        end
+      end
+
+      if bits.length > 0
+        query["filter"] = bits.join(" AND ")
+      end
+    end
+
+    query["query"]        = params[:query]        if params[:query]
+    query["order"]        = params[:order]        if parts.include?(:order)
+    query["filter_query"] = params[:filter_query] if parts.include?(:filter_query)
+
+    query.merge!(extra)
+
+    query
+  end
+
+  def comparison(lhs, rhs)
+    if rhs.length == 1
+      "#{lhs} = '#{escape_sql(rhs.first)}'"
+    else
+      "#{lhs} IN ('#{rhs.map do |bit| escape_sql(bit) end.join("', '")}')"
+    end
+  end
+
+  def create_search_results_table(search_query, opts)
+
+    begin
+
+      search_results = Sunspot.search opts[:search_models] do
+        fulltext search_query
+        adjust_solr_params { |p| p[:defType] = 'edismax' }
+        paginate :page => 1, :per_page => opts[:search_limit]
+      end
+
+    rescue
+      return false
+    end
+
+    conn = ActiveRecord::Base.connection
+
+    conn.execute("CREATE TEMPORARY TABLE search_results (id INT AUTO_INCREMENT UNIQUE KEY, result_type VARCHAR(255), result_id INT)")
+
+    # This next part converts the search results to an SQL "VALUES" clause
+    #
+    # e.g. "(NULL, 'Workflow', '4'), (NULL, 'Pack', '6'), ..."
+
+    if search_results.results.length > 0
+      values = search_results.results.map do |result|
+        "(NULL, '#{result.class.name}', '#{result.id}')"
+      end.join(", ")
+
+      conn.execute("INSERT INTO search_results VALUES #{values}")
+    end
+
+    true
+  end
+
+  def drop_search_results_table
+    ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS search_results")
+  end
+
+  def column(column, opts)
+    if column == :auth_type
+      opts[:auth_type]
+    else
+      column
+    end
+  end
+
+  def calculate_filter(collection, params, filter, pivot_options, user, opts = {})
+
+    # apply all the joins and conditions except for the current filter
+
+    joins      = []
+    conditions = []
+
+    pivot_options["filters"].each do |other_filter|
+      if filter_list = find_filter(opts[:filters], other_filter["query_option"])
+        unless opts[:inhibit_other_conditions]
+          conditions << comparison(column(other_filter["id_column"], opts), filter_list[:expr][:terms]) unless other_filter == filter
+        end
+        joins += other_filter["joins"] if other_filter["joins"]
+      end
+    end
+
+    filter_id_column    = column(filter["id_column"],    opts)
+    filter_label_column = column(filter["label_column"], opts)
+
+    joins += filter["joins"] if filter["joins"]
+    conditions << "#{filter_id_column} IS NOT NULL" if filter["not_null"]
+
+    unless opts[:inhibit_filter_query]
+      if params[:filter_query]
+        conditions << "(#{filter_label_column} LIKE '%#{escape_sql(params[:filter_query])}%')"
+      end
+    end
+
+    current = find_filter(opts[:filters], filter["query_option"]) ? find_filter(opts[:filters], filter["query_option"])[:expr][:terms] : []
+
+    if opts[:ids].nil?
+      limit = 10
+    else
+      conditions << "(#{filter_id_column} IN ('#{opts[:ids].map do |id| escape_sql(id) end.join("','")}'))"
+      limit = nil
+    end
+
+    conditions = conditions.length.zero? ? nil : conditions.join(" AND ")
+
+    count_expr = "COUNT(DISTINCT #{opts[:auth_type]}, #{opts[:auth_id]})"
+
+    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, collection.permission_conditions, :auth_type => opts[:auth_type], :auth_id => opts[:auth_id]),
+        :conditions => conditions,
+        :group => "#{filter_id_column}",
+        :limit => limit,
+        :order => "#{count_expr} DESC, #{filter_label_column}")
+
+    objects = objects.select do |x| !x[:filter_id].nil? end
+
+    objects = objects.map do |object|
+
+      value = object.filter_id.to_s
+      selected = current.include?(value)
+
+      label_expr = deep_clone(opts[:filters])
+      label_expr -= [find_filter(label_expr, filter["query_option"])] if find_filter(label_expr, filter["query_option"])
+
+      unless selected && current.length == 1
+        label_expr << { :name => filter["query_option"], :expr => { :terms => [value] } }
+      end
+
+      checkbox_expr = deep_clone(opts[:filters])
+
+      if expr_filter = find_filter(checkbox_expr, filter["query_option"])
+
+        if selected
+          expr_filter[:expr][:terms] -= [value]
+        else
+          expr_filter[:expr][:terms] += [value]
+        end
+
+        checkbox_expr -= [expr_filter] if expr_filter[:expr][:terms].empty?
+
+      else
+        checkbox_expr << { :name => filter["query_option"], :expr => { :terms => [value] } }
+      end
+
+      label_uri = build_url(params, opts, label_expr, [:filter, :order], pivot_options, "page" => nil)
+
+      checkbox_uri = build_url(params, opts, checkbox_expr, [:filter, :order], pivot_options, "page" => nil)
+
+      label = object.filter_label.clone
+      label = visible_name(label) if filter["visible_name"]
+      label = label.capitalize    if filter["capitalize"]
+
+      plain_label = object.filter_label
+
+      if params[:filter_query]
+        label = label.sub(Regexp.new("(#{params[:filter_query]})", Regexp::IGNORECASE), '<b>\1</b>')
+      end
+
+      {
+          :object       => object,
+          :value        => value,
+          :label        => label,
+          :plain_label  => plain_label,
+          :count        => object.filter_count,
+          :checkbox_uri => checkbox_uri,
+          :label_uri    => label_uri,
+          :selected     => selected
+      }
+    end
+
+    [current, objects]
+  end
+
+  def calculate_filters(collection, params, opts, pivot_options, user)
+
+    # produce the filter list
+
+    filters = deep_clone(pivot_options["filters"])
+    cancel_filter_query_url = nil
+
+    filters.each do |filter|
+
+      # calculate the top n items of the list
+
+      filter[:current], filter[:objects] = calculate_filter(collection, params, filter, pivot_options, user, opts)
+
+      # calculate which active filters are missing (because they weren't in the
+      # top part of the list or have a count of zero)
+
+      missing_filter_ids = filter[:current] - filter[:objects].map do |ob| ob[:value] end
+
+      if missing_filter_ids.length > 0
+        filter[:objects] += calculate_filter(collection, params, filter, pivot_options, user, opts.merge(:ids => missing_filter_ids))[1]
+      end
+
+      # calculate which active filters are still missing (because they have a
+      # count of zero)
+
+      missing_filter_ids = filter[:current] - filter[:objects].map do |ob| ob[:value] end
+
+      if missing_filter_ids.length > 0
+        zero_list = calculate_filter(collection, params, filter, pivot_options, user, opts.merge(:ids => missing_filter_ids, :inhibit_other_conditions => true))[1]
+
+        zero_list.each do |x| x[:count] = 0 end
+
+        zero_list.sort! do |a, b| a[:label] <=> b[:label] end
+
+        filter[:objects] += zero_list
+      end
+    end
+
+    [filters, cancel_filter_query_url]
+  end
+
+  def find_filter(filters, name)
+    filters.find do |f|
+      f[:name] == name
+    end
+  end
+
+  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!(/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
+  end
+
+  pivot_options["filters"] = pivot_options["filters"].select do |f|
+    opts[:active_filters].include?(f["query_option"])
+  end
+
+  joins      = []
+  conditions = []
+
+  # parse the filter _expression_ if provided.  convert filter _expression_ to
+  # the old format.  this will need to be replaced eventually
+
+  opts[:filters] ||= []
+
+  include_reset_url = opts[:filters].length > 0
+
+  # filter out top level logic operators for now
+
+  opts[:filters] = opts[:filters].select do |bit|
+    bit.class == Hash
+  end
+
+  # apply locked filters
+
+  if opts[:lock_filter]
+    opts[:lock_filter].each do |filter, value|
+      opts[:filters] << { :name => filter, :expr => { :terms => [value] } }
+    end
+  end
+
+  # perform search if requested
+
+  query_problem = false
+
+  if params["query"]
+    drop_search_results_table
+    if !create_search_results_table(params["query"], opts)
+      params["query"] = nil
+      query_problem = true
+    end
+  end
+
+  if params[:query]
+    klass     = SearchResult
+    auth_type = "search_results.result_type"
+    auth_id   = "search_results.result_id"
+    group_by  = "search_results.result_type, search_results.result_id"
+  else
+    klass     = opts[:model]     || Contribution
+    auth_type = opts[:auth_type] || "contributions.contributable_type"
+    auth_id   = opts[:auth_id]   || "contributions.contributable_id"
+    group_by  = opts[:group_by]  || "contributions.contributable_type, contributions.contributable_id"
+  end
+
+  # determine joins, conditions and order for the main results
+
+  pivot_options["filters"].each do |filter|
+    if filter_list = find_filter(opts[:filters], filter["query_option"])
+      conditions << comparison(column(filter["id_column"], opts.merge( { :auth_type => auth_type, :auth_id => auth_id } )), filter_list[:expr][:terms])
+      joins += filter["joins"] if filter["joins"]
+    end
+  end
+
+  order_options = pivot_options["order"].find do |x|
+    x["option"] == params[:order]
+  end
+
+  order_options ||= pivot_options["order"].first
+
+  joins += order_options["joins"] if order_options["joins"]
+
+  having_bits = []
+
+#   pivot_options["filters"].each do |filter|
+#     if params["and_#{filter["query_option"]}"]
+#       having_bits << "GROUP_CONCAT(DISTINCT #{filter["id_column"]} ORDER BY #{filter["id_column"]}) = \"#{escape_sql(opts[:filters][filter["query_option"]])}\""
+#     end
+#   end
+
+  having_clause = ""
+
+  if having_bits.length > 0
+    having_clause = "HAVING #{having_bits.join(' AND ')}"
+  end
+
+  # perform the results query
+
+  collection = Authorization.scoped(klass,
+                                    :authorised_user => user,
+                                    :include_permissions => true,
+                                    :auth_type => auth_type,
+                                    :auth_id => auth_id)
+
+  result_options = {: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"]}
+
+  results = collection.find(:all, result_options)
+
+  unless opts[:no_pagination]
+    results = results.paginate(:page => params["page"], :per_page => params["num"] ? params["num"].to_i : nil)
+  end
+
+  # produce a query hash to match the current filters
+
+  opts[:filter_params] = {}
+
+  pivot_options["filters"].each do |filter|
+    if params[filter["query_option"]]
+      next if opts[:lock_filter] && opts[:lock_filter][filter["query_option"]]
+      opts[:filter_params][filter["query_option"]] = params[filter["query_option"]]
+    end
+  end
+
+  # produce the filter list
+
+  opts_for_filter_query = opts.merge( { :auth_type => auth_type,
+                                        :auth_id => auth_id, :group_by => group_by } )
+
+  filters, cancel_filter_query_url = calculate_filters(collection, params, opts_for_filter_query, pivot_options, user)
+
+  # produce the summary.  If a filter query is specified, then we need to
+  # recalculate the filters without the query to get all of them.
+
+  if params[:filter_query]
+    filters2 = calculate_filters(collection, params, opts_for_filter_query.merge( { :inhibit_filter_query => true } ), pivot_options, user)[0]
+  else
+    filters2 = filters
+  end
+
+  summary = ""
+
+  filters2.select do |filter|
+
+    next if opts[:lock_filter] && opts[:lock_filter][filter["query_option"]]
+
+    selected = filter[:objects].select do |x| x[:selected] end
+    current  = selected.map do |x| x[:value] end
+
+    if selected.length > 0
+      selected_labels = selected.map do |x|
+
+        expr = deep_clone(opts[:filters])
+
+        f = find_filter(expr, filter["query_option"])
+
+        expr -= f[:expr][:terms] -= [x[:value]]
+        expr -= [f] if f[:expr][:terms].empty?
+
+        x[:plain_label] + ' <a href="" + url_for(build_url(params, opts, expr,
+                                                           [:filter, :filter_query, :order], pivot_options)) +
+            '">' + " <img src='' /></a>"
+
+      end
+
+      bits = selected_labels.map do |label| label end.join(" <i>or</i> ")
+
+      summary << '<span class="filter-in-use"><b>' + filter["title"].capitalize + "</b>: " + bits + "</span> "
+    end
+  end
+
+  if params[:filter_query]
+    cancel_filter_query_url = build_url(params, opts, opts[:filters], [:filter, :order], pivot_options)
+  end
+
+  if include_reset_url
+    reset_filters_url = build_url(params, opts, opts[:filters], [:order], pivot_options)
+  end
+
+  # remove filters that do not help in narrowing down the result set
+
+  filters = filters.select do |filter|
+    if filter[:objects].empty?
+      false
+    elsif opts[:lock_filter] && opts[:lock_filter][filter["query_option"]]
+      false
+    else
+      true
+    end
+  end
+
+  {
+      :results                 => results,
+      :filters                 => filters,
+      :reset_filters_url       => reset_filters_url,
+      :cancel_filter_query_url => cancel_filter_query_url,
+      :filter_query_url        => build_url(params, opts, opts[:filters], [:filter], pivot_options),
+      :summary                 => summary,
+      :pivot_options           => pivot_options,
+      :query_problem           => query_problem
+  }
+end
+
+def visible_name(entity)
+  name = entity.class.name
+
+  if Conf.model_aliases.value?(name)
+    Conf.model_aliases.each do |al, model|
+      name = al if name == model
+    end
+  end
+
+  name
+end
+

Modified: branches/events/lib/rest.rb (3490 => 3491)


--- branches/events/lib/rest.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/rest.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -3,10 +3,12 @@
 # Copyright (c) 2007 University of Manchester and the University of Southampton.
 # See license.txt for details.
 
-require 'lib/conf'
-require 'lib/excel_xml'
+require 'conf'
+require 'excel_xml'
 require 'xml/libxml'
 require 'uri'
+require 'pivoting'
+require 'will_paginate'
 
 include LibXML
 
@@ -36,7 +38,7 @@
     rules.map do |method, rules|
       next unless rules["Method"]       == "GET"
       next unless rules["Type"]         == "crud"
-      
+
       result[rules["Model Entity"]] = rules["REST Entity"]
     end
   end
@@ -74,13 +76,13 @@
   message = "Unknown Error"
 
   case code
-    when 200: message = "OK"
-    when 307: message = "Temporary Redirect"
-    when 400: message = "Bad Request"
-    when 401: message = "Unauthorized"
-    when 403: message = "Forbidden"
-    when 404: message = "Not Found"
-    when 500: message = "Internal Server Error"
+    when 200; message = "OK"
+    when 307; message = "Temporary Redirect"
+    when 400; message = "Bad Request"
+    when 401; message = "Unauthorized"
+    when 403; message = "Forbidden"
+    when 404; message = "Not Found"
+    when 500; message = "Internal Server Error"
   end
 
   if (code >= 300) && (code < 400)
@@ -190,7 +192,11 @@
           list_element[key] = value
         end
 
-        collection = eval("ob.#{model_data['Accessor'][i]}")
+        if query['version'] and model_data['Versioned'][i] == 'yes'
+          collection = eval(sprintf("ob.find_version(%d).%s", query['version'], model_data['Accessor'][i]))
+        else
+          collection = eval("ob.#{model_data['Accessor'][i]}")
+        end
 
         collection = [collection] if model_data['Encoding'][i] == 'item as list'
 
@@ -341,7 +347,7 @@
 end
 
 def find_entity_name_from_object(ob)
-  ob = ob.versioned_resource if ob.respond_to?(:version)
+  ob = ob.versioned_resource if ob.respond_to?(:versioned_resource)
   OBJECT_CLASS_TO_ENTITY_NAME[ob.class.name.underscore]
 end
 
@@ -383,6 +389,7 @@
   if query['version']
     return rest_response(400, :reason => "Object does not support versioning") unless ob.respond_to?('versions')
     return rest_response(404, :reason => "Specified version does not exist") if query['version'].to_i < 1
+    return rest_response(404, :reason => "Specified version does not exist") if query['version'].to_i > ob.versions.last.version
   end
 
   # Work out which elements to include in the response.
@@ -589,11 +596,10 @@
     obs = find_paginated_auth( { :model => model_name.camelize, :find_args => find_args }, limit, page, filters, user) { |args, size, page|
 
       find_args = args[:find_args].clone
-      find_args[:page] = { :size => size, :current => page }
 
-      results = eval(args[:model]).find(:all, find_args)
+      results = args[:model].constantize.find(:all, find_args).paginate(:page => page, :per_page => size)
 
-      results unless results.page > results.page_count
+      results unless results.empty?
     }
   end
 
@@ -663,8 +669,6 @@
     when 'Review';                 return workflow_review_url(ob.reviewable, ob)
     when 'Comment';                return "#{rest_resource_uri(ob.commentable)}/comments/#{ob.id}"
     when 'Bookmark';               return nil
-    when 'Blog';                   return blog_url(ob)
-    when 'BlogPost';               return blog_blog_post_url(ob.blog, ob)
     when 'Rating';                 return "#{rest_resource_uri(ob.rateable)}/ratings/#{ob.id}"
     when 'Tag';                    return tag_url(ob)
     when 'Picture';                return user_picture_url(ob.owner, ob)
@@ -675,7 +679,7 @@
     when 'Experiment';             return experiment_url(ob)
     when 'TavernaEnactor';         return runner_url(ob)
     when 'Job';                    return experiment_job_url(ob.experiment, ob)
-    when 'PackContributableEntry'; return ob.contributable ? rest_resource_uri(ob.contributable) : nil
+    when 'PackContributableEntry'; return ob.contributable ? rest_resource_uri(ob.get_contributable_version) : nil
     when 'PackRemoteEntry';        return ob.uri
     when 'ContentType';            return content_type_url(ob)
     when 'License';                return license_url(ob)
@@ -684,11 +688,15 @@
     when 'Predicate';              return predicate_url(ob)
     when 'Relationship';           return nil
 
-    when 'Creditation';     return nil
-    when 'Attribution';     return nil
-    when 'Tagging';         return nil
+    when 'Creditation';            return nil
+    when 'Attribution';            return nil
+    when 'Tagging';                return nil
 
-    when 'WorkflowVersion'; return "#{rest_resource_uri(ob.workflow)}?version=#{ob.version}"
+    when 'WorkflowVersion';        return "#{rest_resource_uri(ob.workflow)}?version=#{ob.version}"
+    when 'BlobVersion';            return "#{rest_resource_uri(ob.blob)}?version=#{ob.version}"
+    when 'PackVersion';            return pack_version_url(ob, ob.version)
+
+    when 'Policy';                 return policy_url(ob)
   end
 
   raise "Class not processed in rest_resource_uri: #{ob.class.to_s}"
@@ -706,8 +714,6 @@
     when 'Review';                 return "#{base}/review.xml?id=#{ob.id}"
     when 'Comment';                return "#{base}/comment.xml?id=#{ob.id}"
     when 'Bookmark';               return "#{base}/favourite.xml?id=#{ob.id}"
-    when 'Blog';                   return "#{base}/blog.xml?id=#{ob.id}"
-    when 'BlogPost';               return "#{base}/blog-post.xml?id=#{ob.id}"
     when 'Rating';                 return "#{base}/rating.xml?id=#{ob.id}"
     when 'Tag';                    return "#{base}/tag.xml?id=#{ob.id}"
     when 'Picture';                return "#{base}/picture.xml?id=#{ob.id}"
@@ -729,10 +735,14 @@
     when 'Predicate';              return "#{base}/predicate.xml?id=#{ob.id}"
     when 'Relationship';           return "#{base}/relationship.xml?id=#{ob.id}"
 
-    when 'Creditation';     return "#{base}/credit.xml?id=#{ob.id}"
-    when 'Attribution';     return nil
+    when 'Creditation';           return "#{base}/credit.xml?id=#{ob.id}"
+    when 'Attribution';           return nil
 
-    when 'WorkflowVersion'; return "#{base}/workflow.xml?id=#{ob.workflow.id}&version=#{ob.version}"
+    when 'WorkflowVersion';       return "#{base}/workflow.xml?id=#{ob.workflow.id}&version=#{ob.version}"
+    when 'BlobVersion';           return "#{base}/file.xml?id=#{ob.blob.id}&version=#{ob.version}"
+    when 'PackVersion';           return "#{base}/pack.xml?id=#{ob.pack.id}&version=#{ob.version}"
+
+    when 'Policy';                 return "#{base}/policy.xml?id=#{ob.id}"
   end
 
   raise "Class not processed in rest_access_uri: #{ob.class.to_s}"
@@ -757,6 +767,8 @@
     when 'PackContributableEntry'; return rest_object_tag_text(ob.contributable)
     when 'PackRemoteEntry';        return 'external'
     when 'WorkflowVersion';        return 'workflow'
+    when 'BlobVersion';            return 'file'
+    when 'PackVersion';            return 'pack'
     when 'Comment';                return 'comment'
     when 'Bookmark';               return 'favourite'
     when 'ContentType';            return 'type'
@@ -765,6 +777,7 @@
     when 'Ontology';               return 'ontology'
     when 'Predicate';              return 'predicate'
     when 'Relationship';           return 'relationship'
+    when 'Policy';                 return 'policy'
   end
 
   return 'object'
@@ -789,6 +802,8 @@
     when 'PackContributableEntry'; return rest_object_label_text(ob.contributable)
     when 'PackRemoteEntry';        return ob.title     
     when 'WorkflowVersion';        return ob.title
+    when 'BlobVersion';            return ob.title
+    when 'PackVersion';            return ob.title
     when 'ContentType';            return ob.title
     when 'License';                return ob.title
     when 'CurationEvent';          return ob.category
@@ -799,6 +814,7 @@
     when 'Review';                 return ob.title
     when 'Job';                    return ob.title
     when 'TavernaEnactor';         return ob.title
+    when 'Policy';                 return ob.name
   end
 
   return ''
@@ -831,8 +847,6 @@
   return [User, $1, is_local]           if uri.path =~ /^\/users\/([\d]+)$/
   return [Review, $1, is_local]         if uri.path =~ /^\/[^\/]+\/[\d]+\/reviews\/([\d]+)$/
   return [Comment, $1, is_local]        if uri.path =~ /^\/[^\/]+\/[\d]+\/comments\/([\d]+)$/
-  return [Blog, $1, is_local]           if uri.path =~ /^\/blogs\/([\d]+)$/
-  return [BlogPost, $1, is_local]       if uri.path =~ /^\/blogs\/[\d]+\/blog_posts\/([\d]+)$/
   return [Tag, $1, is_local]            if uri.path =~ /^\/tags\/([\d]+)$/
   return [Picture, $1, is_local]        if uri.path =~ /^\/users\/[\d]+\/pictures\/([\d]+)$/
   return [Message, $1, is_local]        if uri.path =~ /^\/messages\/([\d]+)$/
@@ -936,7 +950,7 @@
   Policy.new(:contributor => user, :name => 'auto', :share_mode => 7, :update_mode => 6)
 end
 
-def update_permissions(ob, permissions)
+def update_permissions(ob, permissions, user)
 
   share_mode  = 7
   update_mode = 6
@@ -945,30 +959,80 @@
 
   if permissions
 
-    # clear out any permission records for this contributable
+    if (group_policy = permissions.find_first('group-policy-id/text()'))
 
-    ob.contribution.policy.permissions.each do |p|
-      p.destroy
-    end
+      # Check if valid id
+      if (policy = Policy.find_by_id(group_policy.to_s.to_i)) && policy.group_policy?
+        if user.group_policies.include?(policy)
 
-    permissions.find('permission').each do |permission|
+          existing_policy = ob.contribution.policy
+          existing_policy.destroy unless existing_policy.group_policy?
+          ob.contribution.policy = policy
+          ob.contribution.save
+          return
 
-      # handle public privileges
+        else
+          ob.errors.add_to_base("You must be a member of #{group_policy.contributor.title} to use group policy: #{group_policy}")
+          raise
+        end
+      else
+        ob.errors.add_to_base("#{group_policy} does not appear to be a valid group policy ID")
+        raise
+      end
+    else
 
-      if permission.find_first('category/text()').to_s == 'public'
+      # Create a policy for the resource if one doesn't exist, or if the previous policy was a shared one.
+      if ob.contribution.policy.nil? || ob.contribution.policy.group_policy?
+        ob.contribution.policy = create_default_policy(user)
+        ob.contribution.save
+      end
 
-        privileges = {}
+      # clear out any permission records for this contributable
+      ob.contribution.policy.permissions.each do |p|
+        p.destroy
+      end
 
-        permission.find('privilege').each do |el|
-          privileges[el['type']] = true
-        end
+      permissions.find('permission').each do |permission|
 
-        if privileges["view"] && privileges["download"]
-          share_mode = 0
-        elsif privileges["view"]
-          share_mode = 2
-        else
-          share_mode = 7
+        # handle public privileges
+
+        case permission.find_first('category/text()').to_s
+        when 'public'
+          privileges = {}
+
+          permission.find('privilege').each do |el|
+            privileges[el['type']] = true
+          end
+
+          if privileges["view"] && privileges["download"]
+            share_mode = 0
+          elsif privileges["view"]
+            share_mode = 2
+          else
+            share_mode = 7
+          end
+        when 'group'
+          id = permission.find_first('id/text()').to_s.to_i
+          privileges = {}
+
+          permission.find('privilege').each do |el|
+            privileges[el['type']] = true
+          end
+
+          network = Network.find_by_id(id)
+          if network.nil?
+            ob.errors.add_to_base("Couldn't share with group #{id} - Not found")
+            raise
+          else
+            Permission.create(:contributor => network,
+                              :policy => ob.contribution.policy,
+                              :view => privileges["view"],
+                              :download => privileges["download"],
+                              :edit => privileges["edit"])
+            unless (use_layout = permission.find_first('use-layout/text()')).nil?
+              ob.contribution.policy.layout = network.layout_name if use_layout.to_s == 'true'
+            end
+          end
         end
       end
     end
@@ -983,14 +1047,14 @@
   # Obtain object
 
   case action
-    when 'create':
+    when 'create';
       return rest_response(401, :reason => "Not authorised to create a workflow") unless Authorization.check('create', Workflow, opts[:user], nil)
       if opts[:query]['id']
         ob, error = obtain_rest_resource('Workflow', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
       else
         ob = Workflow.new(:contributor => opts[:user])
       end
-    when 'view', 'edit', 'destroy':
+    when 'view', 'edit', 'destroy';
       ob, error = obtain_rest_resource('Workflow', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
     else
       raise "Invalid action '#{action}'"
@@ -1135,13 +1199,14 @@
     # Elements to update if we're not dealing with a workflow version
 
     if opts[:query]['version'].nil?
+      update_permissions(ob, permissions, opts[:user])
+    end
 
-      if ob.contribution.policy.nil?
-        ob.contribution.policy = create_default_policy(opts[:user])
-        ob.contribution.save
-      end
-
-      update_permissions(ob, permissions)
+    # Extract internals and stuff
+    if ob.is_a?(WorkflowVersion)
+      ob.workflow.extract_metadata
+    else
+      ob.extract_metadata
     end
   end
 
@@ -1169,14 +1234,14 @@
   # Obtain object
 
   case action
-    when 'create':
+    when 'create';
       return rest_response(401, :reason => "Not authorised to create a file") unless Authorization.check('create', Blob, opts[:user], nil)
       if opts[:query]['id']
         ob, error = obtain_rest_resource('Blob', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
       else
         ob = Blob.new(:contributor => opts[:user])
       end
-    when 'view', 'edit', 'destroy':
+    when 'view', 'edit', 'destroy';
       ob, error = obtain_rest_resource('Blob', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
     else
       raise "Invalid action '#{action}'"
@@ -1198,6 +1263,7 @@
     description      = parse_element(data, :text,   '/file/description')
     license_type     = parse_element(data, :text,   '/file/license-type')
     type             = parse_element(data, :text,   '/file/type')
+    filename         = parse_element(data, :text,   '/file/filename')
     content_type     = parse_element(data, :text,   '/file/content-type')
     content          = parse_element(data, :binary, '/file/content')
     revision_comment = parse_element(data, :text,   '/file/revision-comment')
@@ -1221,6 +1287,17 @@
         end
       end
     end
+
+    # file name
+
+    if filename && !filename.blank?
+      ob.local_name = filename
+    else
+      if ob.local_name.blank?
+        ob.errors.add("Filename", "missing")
+        return rest_response(400, :object => ob)
+      end
+    end
    
     # handle type
 
@@ -1273,13 +1350,7 @@
     return rest_response(400, :object => ob) unless success
 
     if opts[:query]['version'].nil?
-
-      if ob.contribution.policy.nil?
-        ob.contribution.policy = create_default_policy(opts[:user])
-        ob.contribution.save
-      end
-
-      update_permissions(ob, permissions)
+      update_permissions(ob, permissions, opts[:user])
     end
   end
 
@@ -1307,10 +1378,25 @@
   # Obtain object
 
   case action
-    when 'create':
+    when 'create';
       return rest_response(401, :reason => "Not authorised to create a pack") unless Authorization.check('create', Pack, opts[:user], nil)
-      ob = Pack.new(:contributor => opts[:user])
-    when 'view', 'edit', 'destroy':
+      if id = opts[:query]['id']
+        ob = Pack.find_by_id(id)
+        if ob.nil?
+          return rest_response(404, :reason => "Couldn't find a Pack with id #{id}")
+        else
+          if Authorization.check('edit', ob, opts[:user])
+            ob.snapshot!
+            return rest_get_request(ob, opts[:user], { "id" => ob.id.to_s })
+          else
+            return rest_response(401, :reason => "Not authorised to snapshot pack #{id}")
+          end
+        end
+      else
+        ob = Pack.new(:contributor => opts[:user])
+      end
+
+    when 'view', 'edit', 'destroy';
       ob, error = obtain_rest_resource('Pack', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
     else
       raise "Invalid action '#{action}'"
@@ -1331,6 +1417,19 @@
 
     permissions  = data.find_first('/pack/permissions')
 
+    if license_type = parse_element(data, :text,   '/pack/license-type')
+      if license_type == ""
+        ob.license = nil
+      else
+        ob.license = License.find_by_unique_name(license_type)
+
+        if ob.license.nil?
+          ob.errors.add("License type")
+          return rest_response(400, :object => ob)
+        end
+      end
+    end
+
     # build the contributable
 
     ob.title       = title        if title
@@ -1340,12 +1439,7 @@
       return rest_response(400, :object => ob)
     end
 
-    if ob.contribution.policy.nil?
-      ob.contribution.policy = create_default_policy(opts[:user])
-      ob.contribution.save
-    end
-
-    update_permissions(ob, permissions)
+    update_permissions(ob, permissions, opts[:user])
   end
 
   rest_get_request(ob, opts[:user], { "id" => ob.id.to_s })
@@ -1379,7 +1473,7 @@
   # Obtain object
 
   case action
-    when 'create':
+    when 'create';
 
       return rest_response(401, :reason => "Not authorised to create an external pack item") unless Authorization.check('create', PackRemoteEntry, opts[:user], pack)
       return rest_response(400, :reason => "Pack not found") if pack.nil?
@@ -1392,7 +1486,7 @@
           :alternate_uri => alternate_uri,
           :comment       => comment)
 
-    when 'view', 'edit', 'destroy':
+    when 'view', 'edit', 'destroy';
 
       ob, error = obtain_rest_resource('PackRemoteEntry', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
 
@@ -1446,12 +1540,15 @@
     pack          = parse_element(data, :resource, '/internal-pack-item/pack')
     item          = parse_element(data, :resource, '/internal-pack-item/item')
     comment       = parse_element(data, :text,     '/internal-pack-item/comment')
+
+    version_node  = data.find_first('/internal-pack-item/item/@version')
+    version       = version_node ? version_node.value.to_i : nil
   end
 
   # Obtain object
 
   case action
-    when 'create':
+    when 'create';
 
       return rest_response(401, :reason => "Not authorised to create an internal pack item") unless Authorization.check('create', PackContributableEntry, opts[:user], pack)
       return rest_response(400, :reason => "Pack not found") if pack.nil?
@@ -1459,9 +1556,10 @@
       ob = PackContributableEntry.new(:user => opts[:user],
           :pack          => pack,
           :contributable => item,
-          :comment       => comment)
+          :comment       => comment,
+          :contributable_version => version)
 
-    when 'view', 'edit', 'destroy':
+    when 'view', 'edit', 'destroy';
 
       ob, error = obtain_rest_resource('PackContributableEntry', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
 
@@ -1550,7 +1648,12 @@
     q      = args[:query]
     models = args[:models]
 
-    search_result = models[0].multi_solr_search(q, :limit => size, :offset => size * (page - 1), :models => models)
+    search_result = Sunspot.search models do
+      fulltext q
+      adjust_solr_params { |p| p[:defType] = 'edismax' }
+      paginate :page => page, :per_page => size
+    end
+
     search_result.results unless search_result.total < (size * (page - 1))
   }
 end
@@ -1569,9 +1672,9 @@
     if bits.length == 4
 
       case bits[1]
-        when 'workflows': model = Workflow
-        when 'files': model = Blob
-        when 'packs': model = Pack
+        when 'workflows'; model = Workflow
+        when 'files'; model = Blob
+        when 'packs'; model = Pack
         else return rest_response(400, :reason => "Unknown category '#{bits[1]}'")
       end
 
@@ -1751,8 +1854,8 @@
 def whoami_redirect(opts)
   if opts[:user].class == User
     case opts[:format]
-      when "xml": rest_response(307, :location => rest_access_uri(opts[:user]))
-      when "rdf": rest_response(307, :location => formatted_user_url(:id => opts[:user].id, :format => 'rdf'))
+      when "xml"; rest_response(307, :location => rest_access_uri(opts[:user]))
+      when "rdf"; rest_response(307, :location => formatted_user_url(:id => opts[:user].id, :format => 'rdf'))
     end
   else
     rest_response(401, :reason => "Not logged in")
@@ -1820,6 +1923,70 @@
   privileges
 end
 
+# Permissions - only visible to users with edit permissions
+
+def permissions(ob, user, query)
+
+  policy = ob.is_a?(Policy) ? ob : ob.contribution.policy
+
+  def permission_node(view, download, edit, category, id = nil, layout = false)
+    node = LibXML::XML::Node.new('permission')
+    category_node = LibXML::XML::Node.new('category')
+    category_node << category
+    node << category_node
+    if id
+      id_node = LibXML::XML::Node.new('id')
+      id_node << id
+      node << id_node
+    end
+    if view
+      privilege = LibXML::XML::Node.new('privilege')
+      privilege['type'] = "view"
+      node << privilege
+    end
+    if download
+      privilege = LibXML::XML::Node.new('privilege')
+      privilege['type'] = "download"
+      node << privilege
+    end
+    if edit
+      privilege = LibXML::XML::Node.new('privilege')
+      privilege['type'] = "edit"
+      node << privilege
+    end
+    if layout
+      use_layout_node = LibXML::XML::Node.new('use-layout')
+      use_layout_node << 'true'
+      node << use_layout_node
+    end
+
+    if view || edit || download
+      node
+    else
+      nil
+    end
+  end
+
+  permissions = LibXML::XML::Node.new('permissions')
+  permissions << permission_node([0,1,2].include?(policy.share_mode),
+                                 policy.share_mode == 0,
+                                 false,
+                                 'public')
+
+  unless ob.is_a?(Policy)
+    permissions['uri'] = rest_access_uri(policy)
+    permissions['resource'] = rest_resource_uri(policy)
+    permissions['policy-type'] = policy.group_policy? ? 'group' : 'user-specified'
+  end
+
+  policy.permissions.select {|p| p.contributor_type == "Network"}.each do |perm|
+    permissions << permission_node(perm.view, perm.download, perm.edit, 'group', perm.contributor_id,
+                                   policy.layout == perm.contributor.layout_name)
+  end
+
+  permissions
+end
+
 # Comments
 
 def comment_aux(action, opts)
@@ -1835,11 +2002,11 @@
   # Obtain object
 
   case action
-    when 'create':
+    when 'create';
       return rest_response(401, :reason => "Not authorised to create a comment") unless Authorization.check('create', Comment, opts[:user], subject)
 
       ob = Comment.new(:user => opts[:user])
-    when 'view', 'edit', 'destroy':
+    when 'view', 'edit', 'destroy';
       ob, error = obtain_rest_resource('Comment', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
     else
       raise "Invalid action '#{action}'"
@@ -1923,7 +2090,7 @@
         event.save
       end
 
-      subject.solr_save
+      subject.solr_index
 
       return rest_get_request(ob, opts[:user], { "id" => ob.id.to_s })
     end
@@ -1971,11 +2138,11 @@
   # Obtain object
 
   case action
-    when 'create':
+    when 'create';
       return rest_response(401, :reason => "Not authorised to create a favourite") unless Authorization.check('create', Bookmark, opts[:user], target)
 
       ob = Bookmark.new(:user => opts[:user])
-    when 'view', 'edit', 'destroy':
+    when 'view', 'edit', 'destroy';
       ob, error = obtain_rest_resource('Bookmark', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
     else
       raise "Invalid action '#{action}'"
@@ -2034,11 +2201,11 @@
   # Obtain object
 
   case action
-    when 'create':
+    when 'create';
       return rest_response(401, :reason => "Not authorised to create a rating") unless Authorization.check('create', Rating, opts[:user], subject)
 
       ob = Rating.new(:user => opts[:user])
-    when 'view', 'edit', 'destroy':
+    when 'view', 'edit', 'destroy';
       ob, error = obtain_rest_resource('Rating', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
     else
       raise "Invalid action '#{action}'"
@@ -2100,11 +2267,11 @@
   # Obtain object
 
   case action
-    when 'create':
+    when 'create';
       return rest_response(401, :reason => "Not authorised to create a tagging") unless Authorization.check('create', Tagging, opts[:user], subject)
 
       ob = Tagging.new(:user => opts[:user])
-    when 'view', 'edit', 'destroy':
+    when 'view', 'edit', 'destroy';
       ob, error = obtain_rest_resource('Tagging', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
     else
       raise "Invalid action '#{action}'"
@@ -2153,10 +2320,10 @@
   # Obtain object
 
   case action
-    when 'create':
+    when 'create';
       return rest_response(401, :reason => "Not authorised to create an ontology") unless Authorization.check('create', Ontology, opts[:user], nil)
       ob = Ontology.new(:user => opts[:user])
-    when 'view', 'edit', 'destroy':
+    when 'view', 'edit', 'destroy';
       ob, error = obtain_rest_resource('Ontology', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
     else
       raise "Invalid action '#{action}'"
@@ -2223,10 +2390,10 @@
   # Obtain object
 
   case action
-    when 'create':
+    when 'create';
       return rest_response(401, :reason => "Not authorised to create a predicate") unless Authorization.check('create', Predicate, opts[:user], ontology)
       ob = Predicate.new
-    when 'view', 'edit', 'destroy':
+    when 'view', 'edit', 'destroy';
       ob, error = obtain_rest_resource('Predicate', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
     else
       raise "Invalid action '#{action}'"
@@ -2285,10 +2452,10 @@
   # Obtain object
 
   case action
-    when 'create':
+    when 'create';
       return rest_response(401, :reason => "Not authorised to create a relationship") unless Authorization.check('create', Relationship, opts[:user], context)
       ob = Relationship.new(:user => opts[:user])
-    when 'view', 'edit', 'destroy':
+    when 'view', 'edit', 'destroy';
       ob, error = obtain_rest_resource('Relationship', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
     else
       raise "Invalid action '#{action}'"
@@ -2332,10 +2499,146 @@
 # Call dispatcher
 
 def rest_call_request(opts)
-# begin
+  begin
     send(opts[:rules]['Function'], opts)
-# rescue
-#   return rest_response(500)
-# end
+  rescue
+    if Rails.env == "production"
+      return rest_response(500)
+    else
+      raise
+    end
+  end
 end
 
+
+# Component Querying
+def get_components(opts)
+  query = opts[:query]
+
+  annotations = query['annotations']  # annotations on workflow itself
+  # annotations on workflow features
+  inputs = query["input"]
+  outputs = query["output"]
+  processors = query["processor"]
+
+  # Filter workflow set
+  pivot, problem = calculate_pivot(
+      :pivot_options  => Conf.pivot_options,
+      :params         => query,
+      :user           => opts[:user],
+      :search_models  => [Workflow],
+      :no_pagination  => true,
+      :locked_filters => { 'CATEGORY' => 'Workflow' },
+      :active_filters => ["CATEGORY", "TYPE_ID", "TAG_ID", "USER_ID",
+                          "LICENSE_ID", "GROUP_ID", "WSDL_ENDPOINT",
+                          "CURATION_EVENT", "SERVICE_PROVIDER",
+                          "SERVICE_COUNTRY", "SERVICE_STATUS"])
+
+  workflow_ids = pivot[:results].map {|r| r.is_a?(SearchResult) ? r.result_id : r.contributable_id }
+
+  begin
+    matches = filter_by_semantic_annotations(workflow_ids, inputs, outputs, processors, annotations)
+  rescue RuntimeError => e
+    if e.message == "Bad Syntax"
+      return rest_response(400)
+    else
+      raise e
+    end
+  end
+
+  # Render
+  produce_rest_list(opts[:uri], opts[:rules], query, matches, "workflows", [], opts[:user])
+end
+
+def get_policies(opts)
+  policies = []
+
+  if opts[:user].is_a?(User)
+    if opts[:query]["type"] == 'group'
+      policies = opts[:user].group_policies
+    else
+      policies = opts[:user].policies + opts[:user].group_policies
+    end
+  end
+
+  produce_rest_list(opts[:uri], opts[:rules], opts[:query], policies, "policies", [], opts[:user])
+end
+
+
+private
+
+# Here be dragons!
+def filter_by_semantic_annotations(workflow_ids, inputs, outputs, processors, annotations)
+
+  # This method returns an array of workflow ids for workflows that possess all of the specified features.
+  def get_workflow_feature_matches(workflow_ids, features, model, query_conditions, query_conditions_excluding)
+    # "features" is an array of sets of annotations to be queried, in the form [ '"<ann1>","<ann2>"' , '"<ann3>"' ]
+    # Where "<ann1>" etc. is in the form "pred1 obj1", where pred1 and obj1 are the predicate and object parts of an RDF triple, respectively..
+    # The above example states that the workflow must have a <feature> that has annotations "pred1 obj1" and "pred2 obj2", AND
+    # another, different <feature> with "pred3 obj3".
+
+    selected = []
+    feature_matches = features.collect do |key,set|
+      raise "Bad Syntax" unless set =~ /^("[^ ]+ [^"]+")(,"[^ ]+ [^"]+")*$/
+
+      feature_annotations = set.split('","').collect {|a| a.gsub('"','')}
+      # "<ann1>", "<ann2>" (example)
+      matching_features = feature_annotations.collect { |a|
+        # Find all <features> with semantic annotation "<predicate> <object>" (example)
+        predicate, object = a.split(" ", 2)
+        unless selected.empty?
+          model.find(:all, :include => :semantic_annotations,
+                           :conditions => [query_conditions, workflow_ids, predicate, object, selected])
+        else
+          model.find(:all, :include => :semantic_annotations,
+                           :conditions => [query_conditions_excluding, workflow_ids, predicate, object])
+        end
+
+      }.inject {|f, matches| matches & f} # Get the intersection of <features> that have each annotation.
+                                          #   ie. the set of <features> that have ALL the required annotations
+      selected += matching_features
+      matching_features.collect {|wp| wp.workflow_id} # Get the workflows that those features belong to
+    end
+
+    feature_matches.inject {|matches, matches_all| matches_all & matches}
+  end
+
+
+  # Filter for workflows that have the required inputs
+  if inputs
+    workflow_ids = workflow_ids & get_workflow_feature_matches(workflow_ids, inputs, WorkflowPort,
+                                    "workflow_id IN (?) AND semantic_annotations.predicate = ? AND semantic_annotations.object = ? AND port_type = 'input' AND workflow_ports.id NOT IN (?)",
+                                    "workflow_id IN (?) AND semantic_annotations.predicate = ? AND semantic_annotations.object = ? AND port_type = 'input'")
+  end
+
+  # Filter for workflows that have the required outputs
+  if outputs
+    workflow_ids = workflow_ids & get_workflow_feature_matches(workflow_ids, outputs, WorkflowPort,
+                                    "workflow_id IN (?) AND semantic_annotations.predicate = ? AND semantic_annotations.object = ? AND port_type = 'output' AND workflow_ports.id NOT IN (?)",
+                                    "workflow_id IN (?) AND semantic_annotations.predicate = ? AND semantic_annotations.object = ? AND port_type = 'output'")
+  end
+
+  # Filter for workflows that have the required processors
+  if processors
+    workflow_ids = workflow_ids & get_workflow_feature_matches(workflow_ids, processors, WorkflowProcessor,
+                                    "workflow_id IN (?) AND semantic_annotations.predicate = ? AND semantic_annotations.object = ? AND workflow_processors.id NOT IN (?)",
+                                    "workflow_id IN (?) AND semantic_annotations.predicate = ? AND semantic_annotations.object = ?")
+  end
+
+  # Filter for workflows that have the required semantic annotations
+  unless annotations.blank?
+    raise "Bad Syntax" unless annotations =~ /^("[^ ]+ [^"]+")(,"[^ ]+ [^"]+")*$/
+
+    annotations = annotations.split('","').collect {|a| a.gsub('"','')}
+
+    matches_semantic_annotation_requirements = annotations.collect { |a|
+      predicate, object = a.split(" ", 2)
+      SemanticAnnotation.find_all_by_predicate_and_object_and_subject_type(predicate, object, "Workflow").map {|a| a.subject_id}
+    }
+
+    workflow_ids = workflow_ids & matches_semantic_annotation_requirements.inject {|matches, matches_all| matches_all & matches}
+  end
+
+  # Workflows that match ALL the requirements - the intersection of all the sub arrays.
+  Workflow.find_all_by_id(workflow_ids)
+end

Modified: branches/events/lib/sanity_test.rb (3490 => 3491)


--- branches/events/lib/sanity_test.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/sanity_test.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -54,13 +54,12 @@
 
   users         = User.find(:all)
   workflows     = Workflow.find(:all)
-  blogs         = Blog.find(:all)
   blobs         = Blob.find(:all)
   packs         = Pack.find(:all)
   services      = Service.find(:all)
   contributions = Contribution.find(:all)
 
-  known_contributables = workflows + blobs + blogs + packs + services
+  known_contributables = workflows + blobs + packs + services
 
   should_be_empty("All users must have a name",
       users.select do |u| u.name == nil or u.name.length == 0 end)
@@ -76,9 +75,6 @@
   should_be_empty("All files must have a contribution record",
       blobs.select do |b| b.contribution.nil? end)
 
-  should_be_empty("All blogs must have a contribution record",
-      blogs.select do |b| b.contribution.nil? end)
-
   should_be_empty("All packs must have a contribution record",
       packs.select do |f| f.contribution.nil? end)
 

Deleted: branches/events/lib/tasks/fckeditor_tasks.rake (3490 => 3491)


--- branches/events/lib/tasks/fckeditor_tasks.rake	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/tasks/fckeditor_tasks.rake	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,97 +0,0 @@
-# desc "Explaining what the task does"
-# task :fckeditor do
-#   # Task goes here
-# end
-
-namespace :fckeditor do
-  def setup 
-    require "config/environment"
-    require 'fileutils'
-    
-    directory = File.join(RAILS_ROOT, '/vendor/plugins/fckeditor/')
-    require "#{directory}lib/fckeditor"
-    require "#{directory}lib/fckeditor_version"
-    require "#{directory}lib/fckeditor_file_utils"
-  end
-  
-  desc 'Install the FCKEditor components'
-  task :install do
-    setup
-    puts "** Installing FCKEditor Plugin version #{FckeditorVersion.current}..."           
-
-    FckeditorFileUtils.destroy_and_install 
-         
-    puts "** Successfully installed FCKEditor Plugin version #{FckeditorVersion.current}"
-  end
-  
-  def fetch(path)
-    response = Net::HTTP.get_response(URI.parse(path))
-    case response
-    when Net::HTTPSuccess     then 
-      response
-    when Net::HTTPRedirection then 
-      puts "** Redirected to #{response['location']}"
-      fetch(response['location'])
-    else
-      response.error!
-    end
-  end
-  
-  desc "Update the FCKEditor code to the latest nightly build"    
-  task :download do
-    require 'net/http'
-    require 'zip/zipfilesystem'
-
-    setup
-    version = ENV['VERSION'] || "Nightly"
-    installed_version = "2.4.2"
-
-    puts "** Current FCKEditor version: #{installed_version}..."   
-    puts "** Downloading #{version} (1.2mb - please be patient)..."
-
-    rails_tmp_path = File.join(RAILS_ROOT, "/tmp/")
-    tmp_zip_path = File.join(rails_tmp_path, "fckeditor_#{version}.zip")
-    
-    # Creating tmp dir if it doesn't exist
-    Dir.mkdir(rails_tmp_path) unless File.exists? rails_tmp_path    
-
-    # Download nightly build (http://www.fckeditor.net/nightly/FCKeditor_N.zip)
-    # Releases (http://downloads.sourgefourge.net/fckeditor/FCKEditor_[2.4.3, 2.5b, 2.4.2].zip)    
-    nightly = version=='Nightly' ? true : false
-    domain = nightly ? "http://www.fckeditor.net" : "http://downloads.sourceforge.net"
-    path = nightly ? "/nightly/FCKeditor_N.zip" : "/fckeditor/FCKeditor_#{version}.zip"
-    
-    puts "** Download from #{domain}#{path}"
-    #Net::HTTP.start(domain) { |http|
-      response = fetch("#{domain}#{path}")
-      
-      open(tmp_zip_path, "wb") { |file|
-        file.write(response.body)
-      }
-    #}
-    puts "** Download successful"
-    
-    puts "** Extracting FCKeditor"
-    Zip::ZipFile.open(tmp_zip_path) do |zipfile|
-      zipfile.each do |entry|
-        filename = File.join(rails_tmp_path, entry.name)
-        FileUtils.rm_f(filename)
-        FileUtils.mkdir_p(File.dirname(filename))
-        entry.extract(filename)
-      end
-    end
-    
-    puts "** Backing up existing FCKEditor install to /public/_javascript_s/fckeditor_bck"
-    FckeditorFileUtils.backup_existing
-
-    puts "** Shifting files to /public/_javascript_s/fckeditor"
-    FileUtils.cp_r File.join(RAILS_ROOT, "/tmp/fckeditor/"), File.join(RAILS_ROOT, "/public/_javascript_s/")
-    
-    puts "** Clean up"
-    FileUtils.remove_file(tmp_zip_path, true)
-    FileUtils.remove_entry(File.join(rails_tmp_path, "fckeditor/"), true)
-    
-    puts "** Successfully updated to FCKEditor version: #{version}..."  
-  end
-end
-

Deleted: branches/events/lib/tasks/structured_data_tasks.rake (3490 => 3491)


--- branches/events/lib/tasks/structured_data_tasks.rake	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/tasks/structured_data_tasks.rake	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,4 +0,0 @@
-# desc "Explaining what the task does"
-# task :structured_data do
-#   # Task goes here
-# end

Modified: branches/events/lib/workflow_processors/interface.rb (3490 => 3491)


--- branches/events/lib/workflow_processors/interface.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/workflow_processors/interface.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -117,7 +117,7 @@
       XML::Node.new("components")
     end
 
-    def extract_metadata(workflow_id)
+    def extract_metadata(workflow)
     end
 
     # End Instance Methods

Copied: branches/events/lib/workflow_processors/statjr_ebook.rb (from rev 3490, trunk/lib/workflow_processors/statjr_ebook.rb) (0 => 3491)


--- branches/events/lib/workflow_processors/statjr_ebook.rb	                        (rev 0)
+++ branches/events/lib/workflow_processors/statjr_ebook.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,189 @@
+# myExperiment: lib/workflow_processors/bioextract_processosr.rb
+#
+# Copyright (c) 2008 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+module WorkflowProcessors
+
+  class StatjrEbook < WorkflowProcessors::Interface
+
+    # Begin Class Methods
+
+    # These:
+    # - provide information about the Workflow Type supported by this processor,
+
+    # MUST be unique across all processors
+    def self.display_name
+      "StatJR eBook"
+    end
+
+    def self.display_data_format
+      "ZIP"
+    end
+
+    def self.mime_type
+      "application/zip"
+    end
+
+    # All the file extensions supported by this workflow processor.
+    # Must be all in lowercase.
+    def self.file_extensions_supported
+      [ "zip" ]
+    end
+
+    def self.can_determine_type_from_file?
+      true
+    end
+
+    def self.recognised?(file)
+      begin
+        file.rewind
+        deep_model = WorkflowProcessors::StatjrEbookLib::Parser.parse(file.read)
+        file.rewind
+#        Rails.logger.info "deep model: #{deep_model.title}" 
+        return !deep_model.nil?
+      rescue
+        Rails.logger.info $!
+        return false
+      end
+    end
+
+    def self.can_infer_metadata?
+      ##return true
+      return false
+    end
+
+    def self.can_generate_preview_image?
+      false
+    end
+
+    def self.can_generate_preview_svg?
+      false
+    end
+
+    # End Class Methods
+
+
+    # Begin Object Initializer
+
+    def initialize(workflow_definition)
+      super(workflow_definition)
+      @deep_model = WorkflowProcessors::StatjrEbookLib::Parser.parse(workflow_definition)
+    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
+      return nil if @deep_model.nil?
+      return (@deep_model.title.blank? ? "[untitled]" : @deep_model.title)
+    end
+
+    def get_description
+      return nil if @deep_model.nil?
+      return @deep_model.description
+    end
+
+    def get_workflow_model_object
+      return @deep_model
+    end
+    
+    def get_preview_image
+      nil
+    end
+
+    def get_preview_svg
+      nil
+    end
+
+    def get_workflow_model_input_ports
+
+    end
+
+    def get_search_terms
+      ""
+    end
+
+    def get_components
+    end
+
+    # End Instance Methods
+  end
+
+
+  module StatjrEbookLib
+
+    class Model
+      # The author of the workflow.
+      attr_accessor :author
+
+      # The name/title of the workflow.
+      attr_accessor :title
+
+      # A small piece of descriptive text for the workflow.
+      attr_accessor :description
+
+    end
+
+    module Parser
+
+      require "zip/zip"
+      require 'rdf/raptor'
+
+      def self.parse(stream)
+        begin
+          Tempfile.open("deep", "tmp") do |zip_file|
+            zip_file.write(stream)
+            zip_file.close
+
+            Zip::ZipFile.open(zip_file.path) do |zip|
+              ebookdef = zip.read("ebookdef.ttl")
+              graph = RDF::Graph.new()
+              reader = RDF::Reader.for(:turtle).new(ebookdef)
+              graph << reader
+              ns_ebook = RDF::Vocabulary.new("http://purl.org/net/deep/ns#")
+              ns_dcterms = RDF::Vocabulary.new("http://purl.org/dc/terms/")
+              query = RDF::Query.new do
+                pattern [:ebook, RDF.type, ns_ebook.EbookFile]
+                pattern [:ebook, ns_dcterms.title, :title]
+              end
+              ebook = nil
+              title = nil
+              desc = nil
+              query.execute(graph).each do |solution|
+                ebook = solution.ebook
+                title = solution.title.to_s
+              end
+
+              return nil unless ebook
+
+              query = RDF::Query.new do
+                pattern [ebook, ns_dcterms.description, :desc]
+              end
+              query.execute(graph).each do |solution|
+                desc = solution.desc.to_s
+              end
+              return create_model(ebook, title, desc)
+            end
+          end
+        rescue
+          Rails.logger.info $!
+          nil
+        end
+      end
+      def self.create_model(ebook, title, description) # :nodoc:
+        model = StatjrEbookLib::Model.new
+        model.title = title
+        model.description = description
+        return model
+      end
+
+    end
+
+  end
+
+end

Modified: branches/events/lib/workflow_processors/taverna2.rb (3490 => 3491)


--- branches/events/lib/workflow_processors/taverna2.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/workflow_processors/taverna2.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -9,6 +9,8 @@
   require 't2flow/parser'
   require 't2flow/dot'
   require 'libxml'
+  require 'rdf'
+  require 'rdf/n3'
   
   require 'file_upload'
 
@@ -243,6 +245,15 @@
           node
         end
 
+        def build_semantic_annotation_element(object)
+          build('semantic_annotation') do |semantic_annotation_element|
+            if object.semantic_annotation
+              semantic_annotation_element << build('type', object.semantic_annotation.type)
+              semantic_annotation_element << build('content', object.semantic_annotation.content)
+            end
+          end
+        end
+
         build(tag) do |components|
 
           components << build('dataflows') do |dataflows_element|
@@ -281,6 +292,8 @@
                           end
                         end
                       end
+
+                      source_element << build_semantic_annotation_element(source) if source.semantic_annotation
                     end
                   end
                 end
@@ -297,7 +310,6 @@
 
                         if sink.descriptions
                           sink.descriptions.each do |sink_description|
-
                             sink_descriptions_element << build('description', sink_description)
                           end
                         end
@@ -312,6 +324,7 @@
                           end
                         end
                       end
+                      sink_element << build_semantic_annotation_element(sink) if sink.semantic_annotation
                     end
                   end
                 end
@@ -335,6 +348,7 @@
                       processor_element << build('biomoby-service-name',   processor.biomoby_service_name)   if processor.biomoby_service_name
                       processor_element << build('biomoby-category',       processor.biomoby_category)       if processor.biomoby_category
                       processor_element << build('value',                  processor.value)                  if processor.value
+                      processor_element << build_semantic_annotation_element(processor)                      if processor.semantic_annotation
 
                       if processor.dataflow_id
                         nested_dataflow = base_model.dataflow(processor.dataflow_id)
@@ -364,6 +378,8 @@
                     end
                   end
                 end
+
+                dataflow_element << build_semantic_annotation_element(dataflow.annotations) if dataflow.annotations.semantic_annotation
               end
             end
           end
@@ -373,16 +389,48 @@
       aux(@t2flow_model, @t2flow_model, 'components')
     end
     
-    def extract_metadata(workflow_id)
+    def extract_metadata(workflow)
 
       @t2flow_model.all_processors.each do |processor|
-        WorkflowProcessor.create(:workflow_id => workflow_id,
+        workflow_processor = WorkflowProcessor.create(:workflow => workflow,
             :name           => processor.name,
             :wsdl           => processor.wsdl,
             :wsdl_operation => processor.wsdl)
+        create_semantic_annotations(workflow_processor, processor.semantic_annotation) if processor.semantic_annotation
       end
+
+      @t2flow_model.sources.each do |source|
+        port = WorkflowPort.create(:workflow => workflow,
+                            :port_type => "input",
+                            :name => source.name)
+        create_semantic_annotations(port, source.semantic_annotation) if source.semantic_annotation
+      end
+
+      @t2flow_model.sinks.each do |sink|
+        port = WorkflowPort.create(:workflow => workflow,
+                            :port_type => "output",
+                            :name => sink.name)
+        create_semantic_annotations(port, sink.semantic_annotation) if sink.semantic_annotation
+      end
+
+      create_semantic_annotations(workflow, @t2flow_model.main.annotations.semantic_annotation) if @t2flow_model.main.annotations.semantic_annotation
     end
 
+    def create_semantic_annotations(subject, semantic_annotations)
+      if semantic_annotations.type == "text/rdf+n3"
+        g = RDF::Graph.new
+        g << RDF::Reader.for(:n3).new(semantic_annotations.content)
+
+        g.each_statement do |statement|
+          predicate = statement.predicate.to_s
+          object = statement.object.to_s
+          SemanticAnnotation.create(:subject => subject, :predicate => predicate, :object => object)
+        end
+      else
+        raise "Unsupported annotation content type (#{semantic_annotations.type}) for #{subject}."
+      end
+    end
+
     # End Instance Methods
   end
 end

Modified: branches/events/lib/workflow_processors/taverna_scufl.rb (3490 => 3491)


--- branches/events/lib/workflow_processors/taverna_scufl.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/workflow_processors/taverna_scufl.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -289,10 +289,10 @@
       aux(@scufl_model, 'components')
     end
 
-    def extract_metadata(workflow_id)
+    def extract_metadata(workflow)
 
       @scufl_model.all_processors.each do |processor|
-        WorkflowProcessor.create(:workflow_id => workflow_id,
+        WorkflowProcessor.create(:workflow => workflow,
             :name           => processor.name,
             :wsdl           => processor.wsdl,
             :wsdl_operation => processor.wsdl_operation)

Modified: branches/events/lib/workflow_types_handler.rb (3490 => 3491)


--- branches/events/lib/workflow_types_handler.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/lib/workflow_types_handler.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -6,7 +6,7 @@
 # Helper class to deal with Workflow types and processors.
 # Note that workflow types can exist that don't have corresponding processors.
 
-require 'lib/workflow_processors/interface'
+require 'workflow_processors/interface'
 
 class WorkflowTypesHandler
   
@@ -131,7 +131,7 @@
 # so that they are then accessible via the ObjectSpace.
 # We assume (and this is a rails convention for anything in the /lib/ directory), 
 # that filenames for example "my_class.rb" correspond to class names for example MyClass.
-Dir.chdir(File.join(RAILS_ROOT, "lib/workflow_processors")) do
+Dir.chdir(File.join(Rails.root, "lib/workflow_processors")) do
   Dir.glob("*.rb").each do |f|
     ("workflow_processors/" + f.gsub(/.rb/, '')).camelize.constantize
   end

Deleted: branches/events/migrate.sh (3490 => 3491)


--- branches/events/migrate.sh	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/migrate.sh	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,61 +0,0 @@
-#!/bin/bash
-
-export RAILS_ENV=production
-
-RAILS_ROOT=/var/www/m2
-DB_USER=root
-DB=m2_${RAILS_ENV}
-DUMP_SRC=~/myexperiment/backup/myexperiment_production.sql
-WORKFLOW_SRC=~/myexperiment/backup/workflow
-SCUFL_SRC=${WORKFLOW_SRC}/scufl
-
-if [ ! -e $DUMP_SRC ]; then
-  echo SQL dump not found: $DUMP_SRC
-  exit
-fi
-
-if [ ! -e $WORKFLOW_SRC ]; then
-  echo Workflow directory not found: $WORKFLOW_SRC
-  exit
-fi
-
-cd ${RAILS_ROOT}
-
-rm -rf index carlin
-mkdir carlin
-
-cd carlin
-
-rm -rf public/pictures
-rm -rf public/workflow
-cp ${DUMP_SRC} myexperiment_production.sql
-cp -r ${SCUFL_SRC} scufl
-
-grep 'INSERT INTO `pictures`'       < ${DUMP_SRC} >  import.sql
-grep 'INSERT INTO `posts`'          < ${DUMP_SRC} >> import.sql
-grep 'INSERT INTO `topics`'         < ${DUMP_SRC} >> import.sql
-
-grep -v 'INSERT INTO `boards`' < myexperiment_production.sql > temp2.sql
-grep -v 'INSERT INTO `channelmessages`'    < temp2.sql > temp3.sql
-grep -v 'INSERT INTO `channels`'    < temp3.sql > temp4.sql
-grep -v 'INSERT INTO `channels_users`'    < temp4.sql > temp5.sql
-grep -v 'INSERT INTO `channel_topics`'    < temp5.sql > temp6.sql
-grep -v 'INSERT INTO `experiments`'    < temp6.sql > temp7.sql
-grep -v 'INSERT INTO `lists`'    < temp7.sql > temp8.sql
-grep -v 'INSERT INTO `plugin_schema_info`'    < temp8.sql > temp9.sql
-grep -v 'INSERT INTO `pictures`'    < temp9.sql > temp10.sql
-grep -v 'INSERT INTO `posts`'    < temp10.sql > temp11.sql
-grep -v 'INSERT INTO `replies`'    < temp11.sql > temp12.sql
-grep -v 'INSERT INTO `schema_info`'    < temp12.sql > temp13.sql
-grep -v 'INSERT INTO `todos`'    < temp13.sql > temp14.sql
-grep -v 'INSERT INTO `topics`'    < temp14.sql > myexperiment_production.sql
-
-mysql --user=${DB_USER} -e "drop database ${DB}"
-mysql --user=${DB_USER} -e "create database ${DB}"
-rake db:migrate
-mysql --user=${DB_USER} ${DB} < import.sql
-
-cd ${RAILS_ROOT}
-
-echo 'include Squirrel; Squirrel.go false, true' | ruby script/console
-

Copied: branches/events/public/.gitignore (from rev 3490, trunk/public/.gitignore) (0 => 3491)


--- branches/events/public/.gitignore	                        (rev 0)
+++ branches/events/public/.gitignore	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,2 @@
+/pictures
+/workflow

Modified: branches/events/public/images/biovel.png


(Binary files differ)

Deleted: branches/events/public/_javascript_s/fckcustom.js (3490 => 3491)


--- branches/events/public/_javascript_s/fckcustom.js	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/public/_javascript_s/fckcustom.js	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,33 +0,0 @@
-// CHANGE FOR APPS HOSTED IN SUBDIRECTORY
-FCKRelativePath = '';
-
-// DON'T CHANGE THESE
-FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Connector='+FCKRelativePath+'/fckeditor/command';
-FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Image&Connector='+FCKRelativePath+'/fckeditor/command';
-FCKConfig.FlashBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Flash&Connector='+FCKRelativePath+'/fckeditor/command';
-
-FCKConfig.LinkUploadURL = FCKRelativePath+'/fckeditor/upload';
-FCKConfig.ImageUploadURL = FCKRelativePath+'/fckeditor/upload?Type=Image';
-FCKConfig.FlashUploadURL = FCKRelativePath+'/fckeditor/upload?Type=Flash';
-FCKConfig.SpellerPagesServerScript = FCKRelativePath+'/fckeditor/check_spelling';
-FCKConfig.AllowQueryStringDebug = false;
-FCKConfig.SpellChecker = 'SpellerPages';
-
-// ONLY CHANGE BELOW HERE
-FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/silver/';
-
-FCKConfig.ToolbarSets["Simple"] = [
-	['Source','-','-','Templates'],
-	['Cut','Copy','Paste','PasteWord','-','Print','SpellCheck'],
-	['Undo','Redo','-','Find','Replace','-','SelectAll'],
-	'/',
-	['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
-	['OrderedList','UnorderedList','-','Outdent','Indent'],
-	['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
-	['Link','Unlink'],
-	'/',
-	['Image','Table','Rule','Smiley'],
-	['FontName','FontSize'],
-	['TextColor','BGColor'],
-	['-','About']
-] ;

Modified: branches/events/public/_javascript_s/folds.js (3490 => 3491)


--- branches/events/public/_javascript_s/folds.js	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/public/_javascript_s/folds.js	2013-04-03 15:44:21 UTC (rev 3491)
@@ -94,5 +94,7 @@
   }
 }
 
-initialiseFolds();
+document.observe("dom:loaded", function() {
+  initialiseFolds();
+});
 

Modified: branches/events/public/_javascript_s/tabs.js (3490 => 3491)


--- branches/events/public/_javascript_s/tabs.js	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/public/_javascript_s/tabs.js	2013-04-03 15:44:21 UTC (rev 3491)
@@ -181,5 +181,7 @@
   return false;
 }
 
-addEvent('load', window, initialiseTabs);
+document.observe("dom:loaded", function() {
+  initialiseTabs();
+});
 

Modified: branches/events/public/stylesheets/biovel.css (3490 => 3491)


--- branches/events/public/stylesheets/biovel.css	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/public/stylesheets/biovel.css	2013-04-03 15:44:21 UTC (rev 3491)
@@ -18,9 +18,8 @@
   background-image: url('/images/sidebar_alpha.png');
 }
 
-
 .logo a {
-  color: #99cc33;
+  color: #333;
 }#
 
 .logo a:hover {
@@ -35,18 +34,21 @@
 /* To add a white margin around the content */
 
 #doc2 {
-  padding: 0 1em;
-  border-color: #DFD96D;
-  border-style: solid;
-  border-width: 0 4px;
+  box-shadow: 0 0 16px 4px #7f793f;
 }
 
 #myexp_header {
-  margin: 0em 0.5em;
+  margin: 0 0.5em;
 }
 
-#hd
-{
-  padding-top: 1em;
+#site_info_links {
+  display: none;
 }
 
+.tabnav li.return_tab {
+  margin-right: 1em;
+}
+
+.tabnav li.return_tab a:hover {
+  background-color: #cd0b37;
+}

Copied: branches/events/public/stylesheets/misc_skinning.css (from rev 3490, trunk/public/stylesheets/misc_skinning.css) (0 => 3491)


--- branches/events/public/stylesheets/misc_skinning.css	                        (rev 0)
+++ branches/events/public/stylesheets/misc_skinning.css	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,7 @@
+table.alt_table tr.odd_row.biovel td, table.alt_table tr.even_row.biovel td, .resource_list_item.biovel {
+  background-color: #EEFFCC;
+}
+
+table.alt_table.biovel, .resource_list_item.biovel {
+  border-color: #99cc33;
+}

Copied: branches/events/public/stylesheets/pagination.css (from rev 3490, trunk/public/stylesheets/pagination.css) (0 => 3491)


--- branches/events/public/stylesheets/pagination.css	                        (rev 0)
+++ branches/events/public/stylesheets/pagination.css	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,46 @@
+.digg_pagination {
+  background: white;
+  cursor: default;
+  /* self-clearing method: */ }
+.digg_pagination a, .digg_pagination span, .digg_pagination em {
+  padding: 0.2em 0.5em;
+  display: block;
+  float: left;
+  margin-right: 1px; }
+.digg_pagination .disabled {
+  color: #999999;
+  border: 1px solid #dddddd; }
+.digg_pagination .current {
+  font-style: normal;
+  font-weight: bold;
+  background: #456aaa;
+  color: white;
+  border: 1px solid #456aaa; }
+.digg_pagination a {
+  text-decoration: none;
+  color: #105cb6;
+  border: 1px solid #456aaa; }
+.digg_pagination a:hover, .digg_pagination a:focus {
+  color: #000033;
+  border-color: #000033; }
+.digg_pagination .page_info {
+  background: #456aaa;
+  color: white;
+  padding: 0.4em 0.6em;
+  width: 22em;
+  margin-bottom: 0.3em;
+  text-align: center; }
+.digg_pagination .page_info b {
+  color: #000033;
+  background: #456aaa;
+  padding: 0.1em 0.25em; }
+.digg_pagination:after {
+  display: block;
+  height: 0;
+  clear: both;
+  visibility: hidden; }
+* html .digg_pagination {
+  height: 1%; }
+*:first-child + html .digg_pagination {
+  overflow: hidden; }
+

Modified: branches/events/public/stylesheets/styles.css (3490 => 3491)


--- branches/events/public/stylesheets/styles.css	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/public/stylesheets/styles.css	2013-04-03 15:44:21 UTC (rev 3491)
@@ -53,7 +53,7 @@
 	border: none;
 	padding: 0 0 0.3em 0;
 	margin: 1em 0 0.8em 0;
-	border-bottom: 1px solid #C8C8C8;
+	border-bottom: 1px dotted #999999;
 }
 
 h4 {
@@ -72,7 +72,7 @@
 }
 
 th,td {
-	/*text-align: center;*/
+	text-align: center;
 	border: none;
 	/*border: 1px solid #CCCCCC;*/
 }
@@ -128,12 +128,12 @@
 
 #myexp_header {
   padding-top: 1em;
-	margin: 0 0.5em 0 0.5em;
+	margin: 0 0.5em 1em 0.5em;
+  overflow: auto;
 }
 
 .logo {
 	float: left;
-	width: 300px;
 }
 
 .links {
@@ -144,15 +144,19 @@
 #myexp_links
 {
 	float: right;
-	width: 600px;
 	font-size: 93%;
 }
 
 #site_info_links {
+  text-align: left;
+  float: left;
+  padding-top: 6px;
+  margin-right: 100px;
 }
-/*  margin: 0.5em 0; */
 
+
 #user_links {
+  text-align: right;
   float: right;
 }
 
@@ -191,11 +195,6 @@
 	padding: 0 6px 0 6px;
 	background-color: #456AAA;
   width: 180px;
-
-  border-radius: 0px 0px 8px 8px;
-  -moz-border-radius: 0px 0px 8px 8px;
-  -webkit-border-bottom-left-radius: 8px;
-  -webkit-border-bottom-right-radius: 8px;
 }
 
 /* Begin Footer styles */
@@ -272,9 +271,9 @@
 }
 
 #hlist {
-	width: 100%;
 	margin: 0;
 	padding-left: 1em;
+  padding-right: 1em;
 }
 
 #hlist ul {
@@ -831,13 +830,13 @@
 
 table.alt_table {
 	border-collapse: collapse;
+  border: 1px solid #ccc;
+  margin-bottom: 0.5em;
 }
 
 table.alt_table td {
-	border-top: 1px solid #BBBBBB;
-	border-bottom: 1px solid #BBBBBB;
 	margin-bottom: 0.5em;
-	padding: 1em 0.5em;
+	padding: 0.5em;
 	vertical-align: top;
   width: 737px;
 }
@@ -873,12 +872,12 @@
 	font-weight: normal;
 }
 
-table.alt_table p.title {
+p.title {
 	margin-top: 0;
 	padding-top: 0;
 	margin-bottom: 0.2em;
 	font-weight: bold;
-	font-size: 108%;
+  font-size: 120%;
 }
 
 table.alt_table .desc {
@@ -893,19 +892,6 @@
   width: 360px;
 }
 
-table.alt_table .standout {
-	border: 1px dotted #999999;
-	margin: 0.2em 0;
-	padding: 0.4em 0.6em;
-	background-color: #FFFFCC;
-	text-align: left;
-	line-height: 1;
-	font-size: 93%;
-	font-weight: bold;
-	color: #333333;
-	width: 360px;
-}
-
 table.alt_table tr td.contributable {
 	margin: 0.5em 0;
 	padding: 1em;
@@ -927,50 +913,6 @@
 	border: 1px dotted #999999;
 }
 
-/* http://www.mis-algoritmos.com/wp-content/uploads/pagstyle.php?q=manu */
-.pagination {
-	padding: 3px;
-	margin: 3px;
-	text-align: center;
-}
-
-.pagination ul {
-	list-style-type: none;
-}
-
-.pagination ul li {
-	display: inline;
-}
-
-.pagination a {
-	padding: 2px 5px 2px 5px;
-	margin: 2px;
-	border: 1px solid #317eff;
-	text-decoration: none; /* no underline */
-	color: #179032;
-}
-
-.pagination a:hover,.pagination a:active {
-	border: 1px solid #CE0434;
-	color: #179032;
-}
-
-.pagination .currentpage {
-	padding: 2px 5px 2px 5px;
-	margin: 2px;
-	border: 1px solid #179032;
-	font-weight: bold;
-	background-color: #179032;
-	color: #FFF;
-}
-
-.pagination .disabledpage {
-	padding: 2px 5px 2px 5px;
-	margin: 2px;
-	border: 1px solid #EEE;
-	color: #DDD;
-}
-
 .network_banner { /*width: 640px;*/
 	padding-left: 10px;
 	padding-right: 10px;
@@ -993,17 +935,13 @@
 }
 
 .sectionIcons li {
-	display: inline;
+	display: inline-block;
 	vertical-align: middle;
 	margin: 0;
 	margin-left: 8px;
 	/*border: 2px solid #F5F5F5;*/ 
 }
 
-.sectionIcons li:first {
-	margin-left: 0;
-}
-
 .sectionIcons li:hover {
 }
 
@@ -1015,7 +953,7 @@
 	width: 100%;
 	padding: 0.5em 0.5em;
 	*padding: 0.2em 0.5em;
-	line-height: 1.0;
+	line-height: 2.5;
 	text-decoration: none;
 	border: 1px solid #BBBBBB;
 	background-color: #EEF6FF;
@@ -1057,13 +995,12 @@
 	vertical-align: middle;
 }
 
-.icon A {
-	white-space: nowrap;
+.icon a {
 	padding-right: 2px;
 	vertical-align: middle;
 }
 
-.icon IMG {
+.icon img {
 	padding: 2px;
 	vertical-align: middle;
 }
@@ -1087,20 +1024,16 @@
 	line-height: 1.5;
 }
 
-.contribution_mini_nav HR {
-  border: none;
-	height: 1px;
-  color: #E0E0E0;
-  background-color: #E0E0E0;
-}
-
 .contribution_left_box {
 	float: left;
 	width: 73.5%;
 }
 
-.contribution_description PRE {
-  background: inherit;
+.contribution_description {
+	text-align: left;
+	background-color: #FFFFFF;
+	border: 1px solid #CCCCCC;
+	padding: 0.3em 1em;
 }
 
 .contribution_preview img {
@@ -1115,10 +1048,12 @@
 }
 
 .contribution_section_box {
-	background-color: #F8F8C8;
-	border-bottom: 1px solid #CCCC99;
-	border-right: 1px solid #CCCC99;
+	background-image: url('/images/box-bg1.png');
+	background-position: top;
+	background-repeat: repeat-x;
+	background-color: #FFFFCC;
 	padding: 0.3em 0.3em;
+	border: 1px dotted #999999;
 	text-align: center;
 	margin-bottom: 0.6em;
 }
@@ -1147,7 +1082,7 @@
 
 .contribution_section_box .stats_box p {
 	font-size: 93%;
-	text-align: centre;
+	text-align: center;
 	line-height: 1.3;
 	padding: 0;
 }
@@ -1211,7 +1146,9 @@
 }
 
 .contribution_version_box {
+	border: 1px dotted #999999;
 	margin-bottom: 1em;
+	background-color: #F7F7F7;
 }
 
 .contribution_version_box .title {
@@ -1221,9 +1158,13 @@
 }
 
 .contribution_version_selector_box {
-	background-color: #F8F8C8;
-	border-bottom: 1px solid #CCCC99;
 	padding: 0.6em 0.5em 0.4em 0.5em;
+	border: 0px dotted #999999;
+	border-width: 0 0 1px 0;
+	background-image: url('/images/box-bg1.png');
+	background-position: top;
+	background-repeat: repeat-x;
+	background-color: #FFFFCC;
 	color: #333333;
 }
 
@@ -1334,20 +1275,13 @@
 }
 
 .addCommentBox {
-	margin-top: 10px;
-  padding: 8px;
-	background-color: #E0E0E0;
+	margin-top: 3em;
+	padding: 1em;
+	width: 500px;
+	background-color: #EEEEEE;
+	border: 1px dotted #999999;
 }
 
-.addCommentBox TEXTAREA {
-  padding: 4px;
-  width: 500px;
-}
-
-.addCommentBox INPUT {
-  margin-top: 4px;
-}
-
 /* End Comments styles */
 
 /* Begin Reviews styles */
@@ -1467,8 +1401,8 @@
 
 .box_standout {
 	padding: 0.5em 0.8em; 
-	background-color: #F8F8C8;
-	border-bottom: 1px solid #CCCC99;
+	border: 1px dotted #999999;
+	background-color: #FFFFCC;
 }
 
 .box_important {
@@ -1935,7 +1869,7 @@
 .workflow_type_box {
 	border: 1px solid #DDDDDD; 
 	background-color: #FFFFCC; 
-	margin: 0; 
+	margin: 0 0 0.5em 0;
 	padding: 0.4em 0.5em; 
 	font-size: 77%; 
 	color: #990000; 
@@ -1962,30 +1896,34 @@
   line-height: 20px;
 }
 
-.unselected_tag {
-  background-color: #e0e0e0;
-  color: #808080;
-  border-bottom: 1px SOLID #c0c0c0;
-  padding: 2px 8px 2px 8px;
+.unselected_tag_suggestion {
+  border: 1px solid white;
+  padding-left: 4px;
+  padding-right: 4px;
 }
 
-.unselected_tag:hover {
-  background-color: #d0d0d0;
-  color: #808080;
-  border-bottom: 1px SOLID #a0a0a0;
+.unselected_tag_suggestion:hover {
+  border: 1px solid #d0d0f0;
+  background-color: white;
+  padding-left: 4px;
+  padding-right: 4px;
+  color: #000099;
   text-decoration: none;
 }
 
-.tag {
+.selected_tag_suggestion {
+  border: 1px solid #a0a0c0;
   background-color: #d0d0f0;
-  border-bottom: 1px SOLID #a0a0c0;
-  padding: 2px 8px 2px 8px;
+  padding-left: 4px;
+  padding-right: 4px;
 }
 
-.tag:hover {
-  background-color: #c0c0e0;
+.selected_tag_suggestion:hover {
+  border: 1px solid #a0a0c0;
+  background-color: #d0d0f0;
+  padding-left: 4px;
+  padding-right: 4px;
   color: #000099;
-  border-bottom: 1px SOLID #9090b0;
   text-decoration: none;
 }
 
@@ -2006,7 +1944,7 @@
 }
 
 .classification {
-  border: 1px SOLID gray;
+  border: 1px solid gray;
   padding: 3px;
   padding-left: 6px;
   padding-right: 6px;
@@ -2015,8 +1953,8 @@
 
 .quality {
   width: 157px;
-  background: #DDA;
-  border-bottom: 1px solid #BB8;
+  background: #EEA;
+  border: 1px solid #CCCCAA;
   margin: 4px;
   padding: 4px;
   text-align: center;
@@ -2156,7 +2094,7 @@
 }
 
 .pivot .label {
-  width: 92px;
+  width: 90px;
   overflow: hidden;
   display: inline-block;
 }
@@ -2376,94 +2314,111 @@
 	font-size: 85%;
 }
 
-.hTagcloud LI + LI:before {
-  content: "\0000a0"
+.new-session-sign-in {
+  width: 190px;
+  border: 1px solid #CCCCCC;
+  border-radius: 6px 6px 6px 6px;
+  -moz-border-radius: 6px 6px 6px 6px;
+  -webkit-border-bottom-left-radius: 6px;
+  -webkit-border-bottom-right-radius: 6px;
 }
 
-.link_list {
-  padding: 0;
-  margin: 0;
+div.deprecation_event {
+  border: 1px solid #e24a3e;
+  background-color: #ffcccc;
+  padding: 0.5em;
+  border-radius: 3px;
+  margin-bottom: 1em;
 }
 
-.link_list LI {
-	list-style: none;
-	display: inline;
-  padding: 0;
-  margin: 0;
-	white-space: nowrap;
+input[type="radio"], input[type="checkbox"] {
+  vertical-align: top;
 }
 
-.link_list LI + LI:before {
-  content: "\0000a0";
+.resource_list_item {
+  border: 1px solid #ccc;
+  background-color: #F5F5F5;
+  padding: 0.5em;
+  margin-bottom: 0.5em;
+  overflow: auto;
 }
 
-OL.activity-feed {
-  margin: 0;
+.resource_list_item p {
+  font-size: 85%;
 }
 
-.activity-feed LI {
-  list-style: none;
+.resource_list_item p.title {
+  font-size: 100%;
 }
 
-.activity-feed LI + LI {
-  border-top: 1px SOLID #E0E0E0;
+.resource_list_item .avatar_panel {
+  width: 6em;
+  float: left;
+  text-align: center;
 }
-
-DIV.activity IMG.framed  {
-  border: 0;
-  padding: 0;
+.resource_list_item .main_panel {
+  margin-left: 6.5em;
 }
 
-.activity {
-  padding-top: 12px;
-  padding-bottom: 12px;
-}
-
-.activity .avatar-column {
-  width: 64px;
+.resource_list_item .main_panel .preview {
   float: left;
+  margin: 0 0.5em 0.2em 0;
 }
 
-.activity .activity-column {
-  margin-left: 72px;
+.resource_list_item .main_panel .desc {
+  border: 1px dotted #999999;
+  margin: 0.5em 0;
+  padding: 0.4em 0.6em;
+  background-color: #FFFFCC;
+  text-align: left;
+  line-height: 1.3;
+  overflow: hidden;
+  word-wrap: break-word;
 }
 
-.activity .actions {
-  font-size: 8pt;
+.resource_list_item .actions {
+  float: right;
+  text-align: left;
+  border: 1px solid #ccc;
+  background-color: #fff;
+  padding: 0.5em 0.25em 0.25em 0.25em;
+  margin: 0 0 0.5em 0.5em;
+  min-width: 6em;
 }
-
-.activity .date {
-  color: gray;
+.resource_list_item .actions a {
+  display: block;
+  border-bottom: 0px solid #999999;
+  margin-bottom: 0.3em;
+  font-size: 85%;
+  font-weight: normal;
 }
 
-.activity SPAN + SPAN:before {
-  content: " ยท ";
-  color: gray;
+span.owner {
+  font-weight: bold;
 }
 
-.inset-preview {
-  float: left;
-  margin-right: 16px;
-  margin-bottom: 16px;
+div.avatar {
+  text-align:center;
+  padding: 0.2em 0;
+  margin: 0 auto;
 }
 
-.inset-preview IMG {
-  max-width: 200px;
+.resource_list_item  p.standout {
+	font-weight: bold;
+	color: #333333;
+  font-size: 100%;
 }
 
-.workflow-type {
+div.error {
+  width: 500px;
+  border: 2px solid #f44;
+  padding-bottom: 1em;
+  margin: 1em auto;
+  text-align: center;
 }
 
-.metadata-datetime {
-  font-size: 8pt;
+div.error h1 {
+  color: white;
+  background-color: #f44;
+  margin-top: 0;
 }
-
-.new-session-sign-in {
-  width: 190px;
-  border: 1px solid #CCCCCC;
-  border-radius: 6px 6px 6px 6px;
-  -moz-border-radius: 6px 6px 6px 6px;
-  -webkit-border-bottom-left-radius: 6px;
-  -webkit-border-bottom-right-radius: 6px;
-}
-

Property changes: branches/events/script/about


Added: svn:executable

Property changes: branches/events/script/console


Added: svn:executable

Property changes: branches/events/script/destroy


Added: svn:executable

Property changes: branches/events/script/generate


Added: svn:executable

Property changes: branches/events/script/plugin


Added: svn:executable

Property changes: branches/events/script/runner


Added: svn:executable

Property changes: branches/events/script/server


Added: svn:executable

Modified: branches/events/test/fixtures/blob_versions.yml (3490 => 3491)


--- branches/events/test/fixtures/blob_versions.yml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/fixtures/blob_versions.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -72,3 +72,27 @@
   content_type_id: 1
   content_blob_id: 1
 
+group_file_one_v1:
+  id: 7
+  blob_id: 7
+  version: 1
+  revision_comments: some revision comment
+  local_name: file_picture.png
+  title: for protected policy
+  body: some text
+  created_at: 2008-04-22 15:32:01
+  content_type_id: 1
+  content_blob_id: 1
+
+group_file_two_v1:
+  id: 8
+  blob_id: 8
+  version: 1
+  revision_comments: some revision comment
+  local_name: file_picture.png
+  title: for protected policy
+  body: some text
+  created_at: 2008-04-22 15:32:01
+  content_type_id: 1
+  content_blob_id: 1
+

Modified: branches/events/test/fixtures/blobs.yml (3490 => 3491)


--- branches/events/test/fixtures/blobs.yml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/fixtures/blobs.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -78,3 +78,29 @@
   content_type_id: 1
   content_blob_id: 1
 
+group_file_one:
+  id: 7
+  current_version: 1
+  contributor_id: 1
+  contributor_type: User
+  local_name: file_picture.png
+  title: A file with a Group Policy
+  body: some text
+  created_at: 2008-04-22 15:32:01
+  license_id: 2
+  content_type_id: 1
+  content_blob_id: 1
+
+group_file_two:
+  id: 8
+  current_version: 1
+  contributor_id: 1
+  contributor_type: User
+  local_name: file_picture.png
+  title: Another file with a Group Policy
+  body: some text
+  created_at: 2008-04-22 15:32:01
+  license_id: 2
+  content_type_id: 1
+  content_blob_id: 1
+

Deleted: branches/events/test/fixtures/blog_posts.yml (3490 => 3491)


--- branches/events/test/fixtures/blog_posts.yml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/fixtures/blog_posts.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,15 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-one:
-  id: 1
-  blog_id: 1
-  title: MyString
-  body: MyText
-  created_at: 2007-08-16 11:22:32
-  updated_at: 2007-08-16 11:22:32
-two:
-  id: 2
-  blog_id: 1
-  title: MyString
-  body: MyText
-  created_at: 2007-08-16 11:22:32
-  updated_at: 2007-08-16 11:22:32

Deleted: branches/events/test/fixtures/blogs.yml (3490 => 3491)


--- branches/events/test/fixtures/blogs.yml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/fixtures/blogs.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,11 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-one:
-  id: 1
-  contributor_id: 1
-  contributor_type: MyString
-  title: MyString
-two:
-  id: 2
-  contributor_id: 1
-  contributor_type: MyString
-  title: MyString

Modified: branches/events/test/fixtures/content_blobs.yml (3490 => 3491)


--- branches/events/test/fixtures/content_blobs.yml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/fixtures/content_blobs.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -2,7 +2,7 @@
 # or http://www.realityforge.org/articles/2006/04/06/loading-binary-data-into-rails-fixtures
 <%
   def load_blob_data(name)
-    filename = "#{RAILS_ROOT}/test/fixtures/files/#{name}"
+    filename = "#{Rails.root}/test/fixtures/files/#{name}"
     data = ""
     "!binary | #{[data].pack('m').gsub(/\n/,"\n    ")}\n"
   end
@@ -24,3 +24,6 @@
   id: 4
   data: <%= load_blob_data('workflow_branch_choice.xml') %>
 
+component_workflow_blob:
+  id: 5
+  data: <%= load_blob_data('image_to_tiff_migration.t2flow') %>

Modified: branches/events/test/fixtures/contributions.yml (3490 => 3491)


--- branches/events/test/fixtures/contributions.yml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/fixtures/contributions.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -111,11 +111,47 @@
   id: 10
   contributor_id: 1
   contributor_type: User
-  contributable_id: 6
+  contributable_id: 7
   contributable_type: Blob
-  policy_id: 6
+  policy_id: 7
   created_at: 2007-08-07 23:53:46
   updated_at: 2007-08-07 23:53:46
   downloads_count: 1
   viewings_count: 1
 
+contribution_for_group_file_one:
+  id: 11
+  contributor_id: 1
+  contributor_type: User
+  contributable_id: 8
+  contributable_type: Blob
+  policy_id: 7
+  created_at: 2007-08-07 23:53:46
+  updated_at: 2007-08-07 23:53:46
+  downloads_count: 1
+  viewings_count: 1
+
+contribution_for_component_workflow:
+  id: 12
+  contributor_id: 1
+  contributor_type: User
+  contributable_id: 3
+  contributable_type: Workflow
+  policy_id: 9
+  created_at: 2008-08-07 23:53:46
+  updated_at: 2008-08-07 23:53:46
+  downloads_count: 1
+  viewings_count: 1
+
+contribution_for_component_workflow2:
+  id: 13
+  contributor_id: 2
+  contributor_type: User
+  contributable_id: 4
+  contributable_type: Workflow
+  policy_id: 10
+  created_at: 2008-08-07 23:53:46
+  updated_at: 2008-08-07 23:53:46
+  downloads_count: 1
+  viewings_count: 1
+

Copied: branches/events/test/fixtures/files/image_to_tiff_migration.t2flow (from rev 3490, trunk/test/fixtures/files/image_to_tiff_migration.t2flow) (0 => 3491)


--- branches/events/test/fixtures/files/image_to_tiff_migration.t2flow	                        (rev 0)
+++ branches/events/test/fixtures/files/image_to_tiff_migration.t2flow	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,278 @@
+<workflow xmlns="http://taverna.sf.net/2008/xml/t2flow" version="1" producedBy="taverna-2.4.0"><dataflow id="16841f82-e1fe-4527-b7ef-411c4c59493b" role="top"><name>Image_to_tiff_migrat</name><inputPorts><port><name>from_uri</name><depth>0</depth><granularDepth>0</granularDepth><annotations><annotation_chain encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.FreeTextDescription">
+        <text>description</text>
+      </annotationBean>
+      <date>2012-11-16 16:22:56.977 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain><annotation_chain encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.ExampleValue">
+        <text>example</text>
+      </annotationBean>
+      <date>2012-11-16 16:22:43.712 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.SemanticAnnotation">
+        <mimeType>text/rdf+n3</mimeType>
+        <content>[]    &lt;http://scape-project.eu/pc/vocab/profiles#hasPortType&gt;
+              &lt;http://scape-project.eu/pc/vocab/profiles#FromURIPort&gt; .
+</content>
+      </annotationBean>
+      <date>2012-11-19 15:53:49.250 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2></annotations></port><port><name>to_uri</name><depth>0</depth><granularDepth>0</granularDepth><annotations><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.SemanticAnnotation">
+        <mimeType>text/rdf+n3</mimeType>
+        <content>[]    &lt;http://scape-project.eu/pc/vocab/profiles#hasPortType&gt;
+              &lt;http://scape-project.eu/pc/vocab/profiles#ToURIPort&gt; .
+</content>
+      </annotationBean>
+      <date>2012-11-20 12:09:41.928 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2></annotations></port></inputPorts><outputPorts /><processors><processor><name>Tool</name><inputPorts><port><name>to_uri</name><depth>0</depth></port><port><name>from_uri</name><depth>0</depth></port></inputPorts><outputPorts /><annotations><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.SemanticAnnotation">
+        <mimeType>text/rdf+n3</mimeType>
+        <content>[]    &lt;http://scape-project.eu/pc/vocab/profiles#hasDependency&gt;
+              &lt;http://scape-project.eu/pc/vocab/profiles#imagemagick-image2tiff&gt; .
+</content>
+      </annotationBean>
+      <date>2012-11-20 12:17:37.420 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2></annotations><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>external-tool-activity</artifact><version>1.4</version></raven><class>net.sf.taverna.t2.activities.externaltool.ExternalToolActivity</class><inputMap><map from="to_uri" to="to_uri" /><map from="from_uri" to="from_uri" /></inputMap><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean xmlns="">
+  <mechanismType>789663B8-DA91-428A-9F7D-B3F3DA185FD4</mechanismType>
+  <mechanismName>default local</mechanismName>
+  <mechanismXML>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&#xD;
+&lt;localInvocation&gt;&lt;shellPrefix&gt;/bin/sh -c&lt;/shellPrefix&gt;&lt;linkCommand&gt;/bin/ln -s %%PATH_TO_ORIGINAL%% %%TARGET_NAME%%&lt;/linkCommand&gt;&lt;/localInvocation&gt;&#xD;
+</mechanismXML>
+  <externaltoolid>1c6b3cec-667d-4364-8a77-315a3b3c71f8</externaltoolid>
+  <useCaseDescription>
+    <usecaseid />
+    <description />
+    <command>convert %%from_uri%% tiff:%%to_uri%%</command>
+    <preparingTimeoutInSeconds>1200</preparingTimeoutInSeconds>
+    <executionTimeoutInSeconds>1800</executionTimeoutInSeconds>
+    <tags>
+      <string>from_uri</string>
+      <string>to_uri</string>
+    </tags>
+    <REs />
+    <queue__preferred />
+    <queue__deny />
+    <static__inputs />
+    <inputs>
+      <entry>
+        <string>to_uri</string>
+        <de.uni__luebeck.inb.knowarc.usecases.ScriptInputUser>
+          <tag>to_uri</tag>
+          <file>false</file>
+          <tempFile>false</tempFile>
+          <binary>false</binary>
+          <charsetName>MacRoman</charsetName>
+          <forceCopy>false</forceCopy>
+          <list>false</list>
+          <concatenate>false</concatenate>
+          <mime />
+        </de.uni__luebeck.inb.knowarc.usecases.ScriptInputUser>
+      </entry>
+      <entry>
+        <string>from_uri</string>
+        <de.uni__luebeck.inb.knowarc.usecases.ScriptInputUser>
+          <tag>from_uri</tag>
+          <file>false</file>
+          <tempFile>false</tempFile>
+          <binary>false</binary>
+          <charsetName>MacRoman</charsetName>
+          <forceCopy>false</forceCopy>
+          <list>false</list>
+          <concatenate>false</concatenate>
+          <mime />
+        </de.uni__luebeck.inb.knowarc.usecases.ScriptInputUser>
+      </entry>
+    </inputs>
+    <outputs />
+    <includeStdIn>false</includeStdIn>
+    <includeStdOut>true</includeStdOut>
+    <includeStdErr>true</includeStdErr>
+    <validReturnCodes>
+      <int>0</int>
+    </validReturnCodes>
+  </useCaseDescription>
+  <edited>false</edited>
+</net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.4</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+  <maxJobs>1</maxJobs>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.4</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.4</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.4</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
+  <backoffFactor>1.0</backoffFactor>
+  <initialDelay>1000</initialDelay>
+  <maxDelay>5000</maxDelay>
+  <maxRetries>0</maxRetries>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.4</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="to_uri" depth="0" /><port name="from_uri" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor></processors><conditions /><datalinks><datalink><sink type="processor"><processor>Tool</processor><port>to_uri</port></sink><source type="dataflow"><port>to_uri</port></source></datalink><datalink><sink type="processor"><processor>Tool</processor><port>from_uri</port></sink><source type="dataflow"><port>from_uri</port></source></datalink></datalinks><annotations><annotation_chain encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.FreeTextDescription">
+        <text>SCAPE Migration Components that converts any ImageMagick supported image format to TIFF</text>
+      </annotationBean>
+      <date>2012-11-15 13:07:59.763 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+        <identification>fd401dac-c521-4d94-8014-8efeba355d7a</identification>
+      </annotationBean>
+      <date>2012-11-19 15:55:14.145 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+        <identification>22bc577f-9a74-4981-8725-c3b4ac28d88b</identification>
+      </annotationBean>
+      <date>2012-11-20 12:10:07.110 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+        <identification>052219d1-09ed-4c6b-a5a4-2bad004a10ed</identification>
+      </annotationBean>
+      <date>2012-11-19 16:17:25.295 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+        <identification>5abab48b-a3f0-4f14-9894-e824a2fa5966</identification>
+      </annotationBean>
+      <date>2012-11-16 16:39:00.691 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.Author">
+        <text>David Withers</text>
+      </annotationBean>
+      <date>2012-11-15 12:25:42.359 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+        <identification>b5361a0e-6abd-4070-8655-5dd7b4237576</identification>
+      </annotationBean>
+      <date>2012-11-15 13:36:38.115 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+        <identification>2bec9695-c132-4728-988c-c3a03ddcc78d</identification>
+      </annotationBean>
+      <date>2012-11-15 13:08:31.374 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+        <identification>0d60174b-0d75-481d-8b4d-194c6109bc96</identification>
+      </annotationBean>
+      <date>2012-11-20 12:17:54.280 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.SemanticAnnotation">
+        <mimeType>text/rdf+n3</mimeType>
+        <content>[]    &lt;http://scape-project.eu/pc/vocab/profiles#hasMigrationPath&gt;
+              &lt;http://scape-project.eu/pc/vocab/profiles#jpegToTiff&gt; .
+</content>
+      </annotationBean>
+      <date>2012-11-20 12:17:49.904 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+        <identification>16841f82-e1fe-4527-b7ef-411c4c59493b</identification>
+      </annotationBean>
+      <date>2012-11-21 11:00:56.248 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+        <identification>a5aee4f0-01d8-4ae3-96f0-c992b8d40af2</identification>
+      </annotationBean>
+      <date>2012-11-15 13:14:14.243 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+  <annotationAssertions>
+    <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+      <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.DescriptiveTitle">
+        <text>Image to tiff migration action</text>
+      </annotationBean>
+      <date>2012-11-21 11:00:54.84 UTC</date>
+      <creators />
+      <curationEventList />
+    </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+  </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain></annotations></dataflow></workflow>
\ No newline at end of file

Modified: branches/events/test/fixtures/permissions.yml (3490 => 3491)


--- branches/events/test/fixtures/permissions.yml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/fixtures/permissions.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -43,3 +43,13 @@
   created_at: 2008-04-06 14:13:12
   updated_at: 2008-04-06 14:13:12
 
+permission_for_group_policy:
+  id: 5
+  contributor_id: 4
+  contributor_type: Network
+  policy_id: 7
+  download: true
+  edit: true
+  view: true
+  created_at: 2008-04-06 14:13:12
+  updated_at: 2008-04-06 14:13:12
\ No newline at end of file

Modified: branches/events/test/fixtures/pictures.yml (3490 => 3491)


--- branches/events/test/fixtures/pictures.yml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/fixtures/pictures.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -4,7 +4,7 @@
 # or http://www.realityforge.org/articles/2006/04/06/loading-binary-data-into-rails-fixtures
 <%
   def load_blob_data(name)
-    filename = "#{RAILS_ROOT}/test/fixtures/files/#{name}"
+    filename = "#{Rails.root}/test/fixtures/files/#{name}"
     data = ""
     "!binary | #{[data].pack('m').gsub(/\n/,"\n    ")}\n"
   end

Modified: branches/events/test/fixtures/policies.yml (3490 => 3491)


--- branches/events/test/fixtures/policies.yml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/fixtures/policies.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -59,3 +59,42 @@
   created_at: 2007-10-22 18:54:22
   updated_at: 2008-01-09 12:12:12
 
+group_policy:
+  id: 7
+  contributor_id: 4
+  contributor_type: Network
+  name: Group Policy
+  share_mode: 0
+  update_mode: 0
+  created_at: 2007-10-22 18:54:22
+  updated_at: 2008-01-09 12:12:12
+
+unused_group_policy:
+  id: 8
+  contributor_id: 4
+  contributor_type: Network
+  name: Unused Group Policy
+  share_mode: 0
+  update_mode: 0
+  created_at: 2007-10-22 18:54:22
+  updated_at: 2008-01-09 12:12:12
+
+component_workflow_policy:
+  id: 9
+  contributor_id: 1
+  contributor_type: User
+  name: auto
+  share_mode: 0
+  update_mode: 0
+  created_at: 2007-10-22 18:54:22
+  updated_at: 2008-01-09 12:12:12
+
+component_workflow_policy2:
+  id: 10
+  contributor_id: 2
+  contributor_type: User
+  name: auto
+  share_mode: 0
+  update_mode: 0
+  created_at: 2007-10-22 18:54:22
+  updated_at: 2008-01-09 12:12:12
\ No newline at end of file

Copied: branches/events/test/fixtures/semantic_annotations.yml (from rev 3490, trunk/test/fixtures/semantic_annotations.yml) (0 => 3491)


--- branches/events/test/fixtures/semantic_annotations.yml	                        (rev 0)
+++ branches/events/test/fixtures/semantic_annotations.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,36 @@
+has_migration_path:
+  subject_id: 3
+  subject_type: Workflow
+  predicate: http://scape-project.eu/pc/vocab/profiles#hasMigrationPath
+  object: http://scape-project.eu/pc/vocab/profiles#jpegToTiff
+
+has_dependency:
+  subject_id: 1
+  subject_type: WorkflowProcessor
+  predicate: http://scape-project.eu/pc/vocab/profiles#hasDependency
+  object: http://scape-project.eu/pc/vocab/profiles#imagemagick-image2tiff
+
+has_port_type_from:
+  subject_id: 1
+  subject_type: WorkflowPort
+  predicate: http://scape-project.eu/pc/vocab/profiles#hasPortType
+  object: http://scape-project.eu/pc/vocab/profiles#FromURIPort
+
+has_port_type_to:
+  subject_id: 2
+  subject_type: WorkflowPort
+  predicate: http://scape-project.eu/pc/vocab/profiles#hasPortType
+  object: http://scape-project.eu/pc/vocab/profiles#ToURIPort
+
+has_port_type_from2:
+  subject_id: 3
+  subject_type: WorkflowPort
+  predicate: http://scape-project.eu/pc/vocab/profiles#hasPortType
+  object: http://scape-project.eu/pc/vocab/profiles#FromURIPort
+
+second_port_annotation:
+  subject_id: 3
+  subject_type: WorkflowPort
+  predicate: http://scape-project.eu/pc/vocab/profiles#hasFish
+  object: http://scape-project.eu/pc/vocab/profiles#CornishSardine
+

Modified: branches/events/test/fixtures/taverna_enactors.yml (3490 => 3491)


--- branches/events/test/fixtures/taverna_enactors.yml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/fixtures/taverna_enactors.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -7,7 +7,7 @@
   contributor_type: User
   url: http://rpc269.cs.man.ac.uk:8180/remotetaverna/v1/
   username: user
-  crypted_password: password                    # password should be put through an encrypt function before being stored in the DB
+  password: password                    # password should be put through an encrypt function before being stored in the DB
   created_at: 2008-01-06 17:52:45
   updated_at: 2008-01-06 17:52:45
 
@@ -19,6 +19,6 @@
   contributor_type: User
   url: http://rpc269.cs.man.ac.uk:8180/remotetaverna/v1/
   username: user
-  crypted_password: password                    # password should be put through an encrypt function before being stored in the DB
+  password: password                    # password should be put through an encrypt function before being stored in the DB
   created_at: 2008-04-28 23:19:35
   updated_at: 2008-04-28 23:19:35

Copied: branches/events/test/fixtures/workflow_ports.yml (from rev 3490, trunk/test/fixtures/workflow_ports.yml) (0 => 3491)


--- branches/events/test/fixtures/workflow_ports.yml	                        (rev 0)
+++ branches/events/test/fixtures/workflow_ports.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,18 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+from_uri_port:
+  id: 1
+  name: from_uri
+  port_type: input
+  workflow_id: 3
+
+to_uri_port:
+  id: 2
+  name: to_uri
+  port_type: input
+  workflow_id: 3
+
+single_port:
+  id: 3
+  name: from_uri
+  port_type: input
+  workflow_id: 4
\ No newline at end of file

Copied: branches/events/test/fixtures/workflow_processors.yml (from rev 3490, trunk/test/fixtures/workflow_processors.yml) (0 => 3491)


--- branches/events/test/fixtures/workflow_processors.yml	                        (rev 0)
+++ branches/events/test/fixtures/workflow_processors.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,5 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+migration_tool:
+  id: 1
+  name: Tool
+  workflow_id: 3

Modified: branches/events/test/fixtures/workflows.yml (3490 => 3491)


--- branches/events/test/fixtures/workflows.yml	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/fixtures/workflows.yml	2013-04-03 15:44:21 UTC (rev 3491)
@@ -26,3 +26,32 @@
   current_version: 1
   content_type_id: 3
   content_blob_id: 4
+
+component_workflow:
+  id: 3
+  contributor_id: 1
+  contributor_type: User
+  title: Image to TIFF Migration Component
+  unique_name: image_to_tiff
+  body: Component thing with annotations
+  created_at: 2008-04-11 22:19:33
+  updated_at: 2008-05-14 06:45:08
+  license_id: 2
+  current_version: 1
+  content_type_id: 4
+  content_blob_id: 5
+
+component_workflow2:
+  id: 4
+  contributor_id: 2
+  contributor_type: User
+  title: Another Component
+  unique_name: component_workflow
+  body: Second component thing with annotations
+  created_at: 2008-04-11 22:19:33
+  updated_at: 2008-05-14 06:45:08
+  license_id: 2
+  current_version: 1
+  content_type_id: 4
+  content_blob_id: 5
+

Modified: branches/events/test/functional/api_controller_test.rb (3490 => 3491)


--- branches/events/test/functional/api_controller_test.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/functional/api_controller_test.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,7 +1,7 @@
 require File.dirname(__FILE__) + '/../test_helper'
 require 'api_controller'
 require 'xml/libxml'
-require 'lib/rest'
+require 'rest'
 
 include ActionView::Helpers::UrlHelper
 include ActionController::UrlWriter
@@ -236,6 +236,7 @@
         <title>#{title}</title>
         <description>#{description}</description>
         <license-type>#{license_type}</license-type>
+        <filename>test.txt</filename>
         <content-type>#{content_type}</content-type>
         <content>#{content}</content>
       </file>")
@@ -1130,6 +1131,74 @@
     assert_response(:not_found)
   end
 
+  # component querying
+
+  def test_basic_component_query
+    login_as(:john)
+
+    resp = rest_request(:get, 'components', nil, {"input" => {"0" => '"http://scape-project.eu/pc/vocab/profiles#hasPortType http://scape-project.eu/pc/vocab/profiles#FromURIPort"'}})
+
+    assert_response(:success)
+    assert_equal 2, resp.find('//workflow').size
+    assert_equal [3,4], resp.find('//workflow').map {|w| w['uri'].split('?id=').last.to_i}
+  end
+
+  def test_two_annotation_component_query
+    login_as(:john)
+
+    anns = '"http://scape-project.eu/pc/vocab/profiles#hasPortType http://scape-project.eu/pc/vocab/profiles#FromURIPort"' +
+          ',"http://scape-project.eu/pc/vocab/profiles#hasFish http://scape-project.eu/pc/vocab/profiles#CornishSardine"'
+    resp = rest_request(:get, 'components', nil, {"input" => {"0" => anns}})
+
+    assert_response(:success)
+    assert_equal 1, resp.find('//workflow').size
+    assert_equal 4, resp.find('//workflow').first['uri'].split('?id=').last.to_i
+  end
+
+  def test_two_feature_component_query
+    login_as(:john)
+
+    resp = rest_request(:get, 'components', nil, {'input' => {'0' => '"http://scape-project.eu/pc/vocab/profiles#hasPortType http://scape-project.eu/pc/vocab/profiles#FromURIPort"',
+                                                              '1' => '"http://scape-project.eu/pc/vocab/profiles#hasPortType http://scape-project.eu/pc/vocab/profiles#ToURIPort"'}
+                                                 })
+
+    assert_response(:success)
+    assert_equal 1, resp.find('//workflow').size
+    assert_equal 3, resp.find('//workflow').first['uri'].split('?id=').last.to_i
+  end
+
+  def test_verbose_component_query
+    login_as(:john)
+
+    resp = rest_request(:get, 'components', nil, {'input' => {'0' => '"http://scape-project.eu/pc/vocab/profiles#hasPortType http://scape-project.eu/pc/vocab/profiles#FromURIPort"',
+                                                              '1' => '"http://scape-project.eu/pc/vocab/profiles#hasPortType http://scape-project.eu/pc/vocab/profiles#ToURIPort"'},
+                                                  'processor' => {'0' => '"http://scape-project.eu/pc/vocab/profiles#hasDependency http://scape-project.eu/pc/vocab/profiles#imagemagick-image2tiff"'},
+                                                  'annotations' => '"http://scape-project.eu/pc/vocab/profiles#hasMigrationPath http://scape-project.eu/pc/vocab/profiles#jpegToTiff"'
+                                                 })
+
+    assert_response(:success)
+    assert_equal 1, resp.find('//workflow').size
+    assert_equal 3, resp.find('//workflow').first['uri'].split('?id=').last.to_i
+  end
+
+  def test_component_query_with_filters
+    login_as(:john)
+
+    resp = rest_request(:get, 'components', nil, {"input" => {"0" => '"http://scape-project.eu/pc/vocab/profiles#hasPortType http://scape-project.eu/pc/vocab/profiles#FromURIPort"'},
+                                                  "filter" => 'USER_ID("2")'})
+
+    assert_response(:success)
+    assert_equal 1, resp.find('//workflow').size
+    assert_equal 4, resp.find('//workflow').last['uri'].split('?id=').last.to_i
+
+    resp = rest_request(:get, 'components', nil, {"input" => {"0" => '"http://scape-project.eu/pc/vocab/profiles#hasPortType http://scape-project.eu/pc/vocab/profiles#FromURIPort"'},
+                                                  "filter" => 'USER_ID("1")'})
+
+    assert_response(:success)
+    assert_equal 1, resp.find('//workflow').size
+    assert_equal 3, resp.find('//workflow').last['uri'].split('?id=').last.to_i
+  end
+
   private
 
   def rest_request(method, uri, data = "" query = {})

Modified: branches/events/test/functional/blobs_controller_test.rb (3490 => 3491)


--- branches/events/test/functional/blobs_controller_test.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/functional/blobs_controller_test.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -68,4 +68,46 @@
     assert_equal old_count-1, Blob.count   
     assert_redirected_to blobs_path
   end
+
+  def test_should_apply_group_policy
+    login_as(:john)
+    old_policy_id = policies(:john_policy).id
+    assert_difference("Policy.count", -1) do
+      put :update, :id => 1, :blob => { :title => 'Test blob - updated', :body => 'updated test test test' },
+                             :credits_me => 'false',
+                             :credits_users => '',
+                             :credits_groups => '',
+                             :attributions_workflows => '',
+                             :attributions_files => '',
+                             :policy_type => "group",
+                             :group_policy => "7"
+
+      assert_redirected_to blob_path(assigns(:blob))
+      assert_equal 7, assigns(:blob).contribution.policy_id
+      assert_nil Policy.find_by_id(old_policy_id) # Old, custom policy should be deleted
+    end
+  end
+
+  def test_should_apply_custom_policy
+    login_as(:john)
+
+    blob = blobs(:group_file_one)
+
+    assert_difference("Policy.count", 1) do
+      put :update, :id => blob.id, :blob => { :title => 'Updated', :body => 'updated test test test' },
+                                   :credits_me => 'false',
+                                   :credits_users => '',
+                                   :credits_groups => '',
+                                   :attributions_workflows => '',
+                                   :attributions_files => '',
+                                   :policy_type => "custom",
+                                   :sharing => {:class_id => "1"},
+                                   :updating => {:class_id => "1"}
+      assert_not_equal 7, assigns(:blob).contribution.policy_id
+      assert_equal 7, blobs(:group_file_two).contribution.policy_id
+      assert_equal 0, blobs(:group_file_two).contribution.policy.share_mode
+      assert_equal 1, assigns(:blob).contribution.policy.share_mode
+    end
+
+  end
 end

Deleted: branches/events/test/functional/blog_posts_controller_test.rb (3490 => 3491)


--- branches/events/test/functional/blog_posts_controller_test.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/functional/blog_posts_controller_test.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,15 +0,0 @@
-# myExperiment: test/functional/blog_posts_controller_test.rb
-#
-# Copyright (c) 2007 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-require File.dirname(__FILE__) + '/../test_helper'
-require 'blog_posts_controller'
-
-class BlogPostsControllerTest < ActionController::TestCase
-
-  def test_true
-    assert true
-  end
-
-end

Deleted: branches/events/test/functional/blogs_controller_test.rb (3490 => 3491)


--- branches/events/test/functional/blogs_controller_test.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/functional/blogs_controller_test.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,15 +0,0 @@
-# myExperiment: test/functional/blogs_controller_test.rb
-#
-# Copyright (c) 2007 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-require File.dirname(__FILE__) + '/../test_helper'
-require 'blogs_controller'
-
-class BlogsControllerTest < ActionController::TestCase
-
-  def test_true
-    assert true
-  end
-
-end

Modified: branches/events/test/functional/citations_controller_test.rb (3490 => 3491)


--- branches/events/test/functional/citations_controller_test.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/functional/citations_controller_test.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -55,7 +55,6 @@
                                                                :authors => 'John and Jane and jim', 
                                                                :published_at => '2008-08-08' }
 
-    assert "Citation was successfully updated.", flash[:notice]
     assert_response :success
   end
   

Copied: branches/events/test/functional/group_policies_controller_test.rb (from rev 3490, trunk/test/functional/group_policies_controller_test.rb) (0 => 3491)


--- branches/events/test/functional/group_policies_controller_test.rb	                        (rev 0)
+++ branches/events/test/functional/group_policies_controller_test.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1,59 @@
+require File.dirname(__FILE__) + '/../test_helper'
+require 'group_policies_controller'
+
+class GroupPoliciesControllerTest < ActionController::TestCase
+  fixtures :policies, :blobs, :permissions, :networks, :users
+
+  def test_administrators_can_view
+    login_as(:john)
+    get :index, :network_id => networks(:exclusive_network).id
+    assert_response :success
+  end
+
+  def test_non_admins_cannot_view
+    login_as(:jane)
+    get :index, :network_id => networks(:exclusive_network).id
+    assert_response :redirect
+  end
+
+  def test_can_create
+    login_as(:john)
+
+    assert_difference("Policy.count", 1) do
+      post :create, :network_id => networks(:exclusive_network).id,
+                    :name => "New Policy", :share_mode  => 0
+    end
+  end
+
+  def test_can_delete_if_not_used
+    login_as(:john)
+
+    assert_difference("Policy.count", -1) do
+      delete :destroy, :network_id => networks(:exclusive_network).id, :id => policies(:unused_group_policy).id
+      assert_response :redirect
+    end
+  end
+
+  def test_cannot_delete_if_used
+    login_as(:john)
+
+    assert_no_difference("Policy.count") do
+      delete :destroy, :network_id => networks(:exclusive_network).id, :id => policies(:group_policy).id
+      assert_response :redirect
+    end
+  end
+
+  def test_can_update
+    login_as(:john)
+
+    assert_equal 0, policies(:group_policy).share_mode
+
+    put :update, :network_id => networks(:exclusive_network).id, :id => policies(:group_policy).id,
+                 :share_mode  => 2
+
+    assert_response :success
+
+    assert_equal 2, assigns(:policy).share_mode
+  end
+
+end
\ No newline at end of file

Modified: branches/events/test/functional/networks_controller_test.rb (3490 => 3491)


--- branches/events/test/functional/networks_controller_test.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/functional/networks_controller_test.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -26,7 +26,7 @@
     old_count = Network.count
 
     login_as(:john)
-    post :create, :network => { :user_id => '990', :title => 'test network', :unique_name => 'test_network', :new_member_policy => 'open', :description => "..." }
+    post :create, :network => { :title => 'test network', :unique_name => 'test_network', :new_member_policy => 'open', :description => "..." }
 
     assert_equal old_count+1, Network.count    
     assert_redirected_to network_path(assigns(:network))
@@ -47,7 +47,7 @@
   def test_should_update_network
     login_as(:john)
     put :update, :id => 1, 
-                 :network => { :user_id => '990', :title => 'test network', :unique_name => 'update_network', :new_member_policy => 'open', :description => ".?."}
+                 :network => { :title => 'test network', :unique_name => 'update_network', :new_member_policy => 'open', :description => ".?."}
 
     assert_redirected_to network_path(assigns(:network))
   end

Modified: branches/events/test/functional/packs_controller_test.rb (3490 => 3491)


--- branches/events/test/functional/packs_controller_test.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/functional/packs_controller_test.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -39,7 +39,7 @@
     num_packs = Pack.count
 
     login_as(:john)
-    post :create, :pack => { :title => 'my new pack', :description => 'a new pack lalalala' }
+    post :create, :pack => { :title => 'my new pack', :description => 'a new pack lalalala', :license_id => '2' }
 
     assert_response :redirect
     assert_redirected_to(pack_url(assigns(:pack)))
@@ -60,7 +60,8 @@
 
   def test_update
     login_as(:john)
-    post :update, :id => @first_id, :pack => { :title => 'edited pack', :description => 'a new pack' }
+    post :update, :id => @first_id, :pack => { :title => 'edited pack', :description => 'a new pack',
+                                               :license_id => '3' }
 
     assert_response :redirect
     assert_redirected_to :action ="" 'show', :id => @first_id

Modified: branches/events/test/functional/profiles_controller_test.rb (3490 => 3491)


--- branches/events/test/functional/profiles_controller_test.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/functional/profiles_controller_test.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -9,12 +9,6 @@
 class ProfilesControllerTest < ActionController::TestCase
   fixtures :profiles, :users, :pictures, :picture_selections
 
-  def test_should_get_index
-    get :index
-    assert_response :success
-    assert assigns(:profiles)
-  end
-
   # would require a new user as each user is only allowed 1 profile
   def test_should_get_new
     #login_as(:john)

Deleted: branches/events/test/unit/blog_post_test.rb (3490 => 3491)


--- branches/events/test/unit/blog_post_test.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/unit/blog_post_test.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,10 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class BlogPostTest < ActiveSupport::TestCase
-  fixtures :blog_posts
-
-  # Replace this with your real tests.
-  def test_truth
-    assert true
-  end
-end

Deleted: branches/events/test/unit/blog_test.rb (3490 => 3491)


--- branches/events/test/unit/blog_test.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/test/unit/blog_test.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,10 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class BlogTest < ActiveSupport::TestCase
-  fixtures :blogs
-
-  # Replace this with your real tests.
-  def test_truth
-    assert true
-  end
-end

Copied: branches/events/tmp/.gitignore (from rev 3490, trunk/tmp/.gitignore) (0 => 3491)


--- branches/events/tmp/.gitignore	                        (rev 0)
+++ branches/events/tmp/.gitignore	2013-04-03 15:44:21 UTC (rev 3491)
@@ -0,0 +1 @@
+/biocatalogue.yml

Deleted: branches/events/update.sh (3490 => 3491)


--- branches/events/update.sh	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/update.sh	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,25 +0,0 @@
-#!/bin/bash
-
-LOG=log/update.log
-
-echo >> ${LOG} ------------------------------------------------------------
-date >> ${LOG}
-echo >> ${LOG} ------------------------------------------------------------
-echo >> ${LOG}
-
-/etc/init.d/myexperiment stop  | tee -a ${LOG}
-
-echo >> ${LOG}
-
-svn update                     | tee -a ${LOG}
-
-echo >> ${LOG}
-
-rake db:migrate                | tee -a ${LOG}
-
-echo >> ${LOG}
-
-/etc/init.d/myexperiment start | tee -a ${LOG}
-
-echo >> ${LOG}
-

Modified: branches/events/vendor/plugins/oauth/lib/oauth/request_proxy/base.rb (3490 => 3491)


--- branches/events/vendor/plugins/oauth/lib/oauth/request_proxy/base.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/vendor/plugins/oauth/lib/oauth/request_proxy/base.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -37,7 +37,7 @@
 
     def signature_method
       case parameters['oauth_signature_method']
-      when Array: parameters['oauth_signature_method'].first
+      when Array; parameters['oauth_signature_method'].first
       else
         parameters['oauth_signature_method']
       end

Deleted: branches/events/vendor/plugins/oauth/tasks/deployment.rake (3490 => 3491)


--- branches/events/vendor/plugins/oauth/tasks/deployment.rake	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/vendor/plugins/oauth/tasks/deployment.rake	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,34 +0,0 @@
-desc 'Release the website and new gem version'
-task :deploy => [:check_version, :website, :release] do
-  puts "Remember to create SVN tag:"
-  puts "svn copy svn+ssh://address@hidden/var/svn/#{PATH}/trunk " +
-    "svn+ssh://address@hidden/var/svn/#{PATH}/tags/REL-#{VERS} "
-  puts "Suggested comment:"
-  puts "Tagging release #{CHANGES}"
-end
-
-desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
-task :local_deploy => [:website_generate, :install_gem]
-
-task :check_version do
-  unless ENV['VERSION']
-    puts 'Must pass a VERSION=x.y.z release version'
-    exit
-  end
-  unless ENV['VERSION'] == VERS
-    puts "Please update your version.rb to match the release version, currently #{VERS}"
-    exit
-  end
-end
-
-desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
-task :install_gem_no_doc => [:clean, :package] do
-  sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
-end
-
-namespace :manifest do
-  desc 'Recreate Manifest.txt to include ALL files'
-  task :refresh do
-    `rake check_manifest | patch -p0 > Manifest.txt`
-  end
-end
\ No newline at end of file

Deleted: branches/events/vendor/plugins/oauth/tasks/environment.rake (3490 => 3491)


--- branches/events/vendor/plugins/oauth/tasks/environment.rake	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/vendor/plugins/oauth/tasks/environment.rake	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,7 +0,0 @@
-task :ruby_env do
-  RUBY_APP = if RUBY_PLATFORM =~ /java/
-    "jruby"
-  else
-    "ruby"
-  end unless defined? RUBY_APP
-end

Deleted: branches/events/vendor/plugins/oauth/tasks/website.rake (3490 => 3491)


--- branches/events/vendor/plugins/oauth/tasks/website.rake	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/vendor/plugins/oauth/tasks/website.rake	2013-04-03 15:44:21 UTC (rev 3491)
@@ -1,17 +0,0 @@
-desc 'Generate website files'
-task :website_generate => :ruby_env do
-  (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
-    sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
-  end
-end
-
-desc 'Upload website files to rubyforge'
-task :website_upload do
-  host = "address@hidden"
-  remote_dir = "/var/www/gforge-projects/#{PATH}/"
-  local_dir = 'website'
-  sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
-end
-
-desc 'Generate and upload website files'
-task :website => [:website_generate, :website_upload, :publish_docs]

Modified: branches/events/vendor/plugins/validates_email_veracity_of/lib/validates_email_veracity_of.rb (3490 => 3491)


--- branches/events/vendor/plugins/validates_email_veracity_of/lib/validates_email_veracity_of.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/vendor/plugins/validates_email_veracity_of/lib/validates_email_veracity_of.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -75,8 +75,8 @@
       #     default is two.
       def servers_in(record, options = {})
         type = case record.to_s.downcase
-          when 'exchange' : Resolv::DNS::Resource::IN::MX
-          when 'address' : Resolv::DNS::Resource::IN::A
+          when 'exchange' ; Resolv::DNS::Resource::IN::MX
+          when 'address' ; Resolv::DNS::Resource::IN::A
         end
         st = Timeout::timeout(options.fetch(:timeout, 2)) do
           Resolv::DNS.new.getresources(name, type).inject([]) do |servers, s|

Modified: branches/events/vendor/plugins/versioning/lib/versioning.rb (3490 => 3491)


--- branches/events/vendor/plugins/versioning/lib/versioning.rb	2013-03-28 10:13:34 UTC (rev 3490)
+++ branches/events/vendor/plugins/versioning/lib/versioning.rb	2013-04-03 15:44:21 UTC (rev 3491)
@@ -23,7 +23,7 @@
 
       class_eval do
 
-        has_many :versions, :class_name => self.version_class.name
+        has_many :versions, :class_name => self.version_class.name, :dependent => :destroy
 
         def find_version(v)
           match = self.version_class.find(:first, :conditions => ["#{self.versioned_resource_column} = ? AND version = ?", id, v])
@@ -34,7 +34,9 @@
 
         def changed_versioned_attributes
           versioned_attributes.select do |attr|
-            changes[attr.to_s] || (send(attr).respond_to?(:changed) && send(attr).changed?)
+            if respond_to?(attr)
+              changes[attr.to_s] || (send(attr).respond_to?(:changed) && send(attr).changed?)
+            end
           end
         end
 

reply via email to

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