Sha256: e783d45b4d396741badebf74dc12d529060a84cb363c68d4c06c6bc0de5825a4

Contents?: true

Size: 1.56 KB

Versions: 12

Compression:

Stored size: 1.56 KB

Contents

require 'mediashelf/active_fedora_helper'

module Cul::Scv::Hydra::Controllers::Helpers::HydraAssetsHelperBehavior
  include MediaShelf::ActiveFedoraHelper

  def link_to_create_asset(link_label, content_type, container_id=nil)
    opts = {:action => 'new', :controller => "#{content_type}s", :content_type => content_type}
    opts[:container_id] = container_id unless container_id.nil?
    if current_user
      link_to link_label, opts, :class=>"create_asset"
    else      
      link_to link_label, {:action => 'new', :controller => 'user_sessions', :redirect_params => opts}, :class=>"create_asset"
    end
  end

  def get_file_asset_description(document)
    obj = load_af_instance_from_solr(document)
    if obj.nil? || obj.file_objects.empty?
      return ""
    else
       fobj = Resource.load_instance_from_solr(obj.file_objects.first.pid)
       fad = ""
       unless fobj.nil?
         unless fobj.datastreams["descMetadata"].nil?
           fad = short_description(fobj.datastreams["descMetadata"].get_values("description").first)
         else
           fad = short_description(fobj.datastreams["DC"].get_values("description").first)
         end
       end
       fad
    end
  end

  def apply_depositor_metadata(user, is_public=false)
    if self.is_a? ActiveFedora::Base 
      rights_md = self.datastreams['rightsMetadata']
      if rights_md
        rights_md.permissions({"person"=>user}, "edit")
        rights_md.permissions({"person"=>user}, "read")
        if is_public
          rights_md.permissions({"group"=>"public"}, "read")
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cul_scv_hydra-0.6.4 lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
cul_scv_hydra-0.6.3 lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
cul_scv_hydra-0.6.2 lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
cul_scv_hydra-0.6.1 lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
cul_scv_hydra-0.6.0 lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
cul_scv_hydra-0.5.1 lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
cul_scv_hydra-0.5.0 lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
cul_scv_hydra-0.4.3 lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
cul_scv_hydra-0.4.2 lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
cul_scv_hydra-0.4.1 lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
cul_scv_hydra-0.4.0 lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
cul_scv_hydra-0.3.0 lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb