Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

digitized flag for mpr, showing generations in show view

  • Loading branch information...
commit 22c900e60df7f56a667b7b877f13c0a48709f66e 1 parent 912c260
@Bringo Bringo authored
View
13 app/models/asset.rb
@@ -258,6 +258,9 @@ def self.import_xml(stream_or_string, fn = "input")
count += 1
Asset.transaction do
asset = Asset.from_xml(doc)
+
+ asset.autogenerate_identifier if (PBCore.config["auto_id_import"].present? && PBCore.config["auto_id_import"] == true)
+
if asset.valid?
# If the imported record contains a UUID, attempt to find the
# existing record and delete it.
@@ -278,6 +281,16 @@ def self.import_xml(stream_or_string, fn = "input")
end
end
+ def autogenerate_identifier
+ if PBCore.config["auto_id"].present?
+ identifier_source = IdentifierSource.find_or_create_by_name(PBCore.config["auto_id"])
+ identifier = self.identifiers.detect { |i| i.identifier_source_id == identifier_source.id }
+ unless identifier
+ self.identifiers << Identifier.new(:identifier_source => identifier_source, :identifier => (identifier_source.next_sequence).to_s)
+ end
+ end
+ end
+
def destroy_existing
# Only do this with new records
return nil unless new_record?
View
6 app/views/assets/show.haml
@@ -49,14 +49,15 @@
= link_to_if(permitted_to?(:borrowings, instantiation), "[on loan]", borrowings_asset_instantiation_url(@asset, instantiation), :class => :borrowednote)
- elsif permitted_to?(:borrowings, instantiation)
= link_to "(borrow)", borrowings_asset_instantiation_url(@asset, instantiation)
-
+
%dl
+ = render :partial => "field_one", :locals => { :key => "Digitized", :value => instantiation.digitized? ? "Yes" : "No" } if PBCore.config["instantiation_digitized_flag"].present? and PBCore.config["instantiation_digitized_flag"] == true
= render :partial => "field_array", :locals => {:objs => instantiation.format_ids, :field => "Format ID", :key => :format_identifier_source, :value => :format_identifier, :searchkey => :identifier, :searchvalue => :format_identifier}
= render :partial => "field_array", :locals => {:objs => instantiation.instantiation_dates, :field => "Date", :key => :instantiation_date_type, :value => :date }
= render :partial => "field_one", :locals => {:key => "Format", :value => instantiation.format, :field => :name }
= render :partial => "field_one", :locals => {:key => "Format Location", :value => instantiation.format_location } unless instantiation.online? && !permitted_to?(:watch_video, @asset)
= render :partial => "field_one", :locals => {:key => "Media Type", :value => instantiation.instantiation_media_type, :field => :name }
- -#= render :partial => "field_one", :locals => {:key => "Generations", :value => instantiation.instantiation_generation, :field => :name }
+ = render :partial => "field_array", :locals => {:objs => instantiation.instantiation_generations, :field => "Generation", :value => :name }
= render :partial => "field_one", :locals => {:key => "File Size", :value => instantiation.pretty_file_size }
= render :partial => "field_one", :locals => {:key => "Time Start", :value => instantiation.format_time_start }
= render :partial => "field_one", :locals => {:key => "Duration", :value => instantiation.format_duration }
@@ -66,7 +67,6 @@
= render :partial => "field_one", :locals => {:key => "Channel Configuration", :value => instantiation.format_channel_configuration }
= render :partial => "field_one", :locals => {:key => "Language", :value => instantiation.language }
= render :partial => "field_one", :locals => {:key => "Alternative Modes", :value => instantiation.alternative_modes }
- -#= render :partial => "field_array", :locals => {:objs => instantiation.date_availables, :field => "Date Available", :value => :to_s }
= render :partial => "field_array", :locals => {:objs => instantiation.annotations, :field => "Annotation", :value => :annotation, :key => :annotation_type }
- if instantiation.essence_tracks.any?
View
4 app/views/instantiations/_form.html.erb
@@ -28,6 +28,10 @@
<h3>Instantiation Information</h3>
<% form.inputs do %>
+ <% if PBCore.config["instantiation_digitized_flag"].present? and PBCore.config["instantiation_digitized_flag"] == true %>
+ <%= form.input :digitized, :required => false %>
+ <% end %>
+
<%= form.input :instantiation_media_type, :collection => InstantiationMediaType.visible, :label => "Media Type", :required => false %>
<%= form.input :format_name, :as => :pbcore_instantiation_format,
:collection => [["Physical", "FormatPhysical"], ["Digital", "FormatDigital"]],
2  config/deploy
@@ -1 +1 @@
-Subproject commit b57eec574b22fd65f5b4ea0da031ab40e881b3ca
+Subproject commit 279aba82fb32d0e4824f480523d7be0c493b8952
View
9 db/migrate/20120116210456_instantiation_digitized_flag.rb
@@ -0,0 +1,9 @@
+class InstantiationDigitizedFlag < ActiveRecord::Migration
+ def self.up
+ add_column :instantiations, :digitized, :boolean, :default => false
+ end
+
+ def self.down
+ remove_column :instantiations, :digitized
+ end
+end
View
99 db/schema.rb
@@ -9,11 +9,11 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120112162341) do
+ActiveRecord::Schema.define(:version => 20120116210456) do
create_table "annotations", :force => true do |t|
t.integer "container_id"
- t.text "annotation", :limit => 16777215
+ t.text "annotation", :limit => 2147483647
t.text "annotation_type"
t.text "ref"
t.string "container_type"
@@ -107,7 +107,7 @@
create_table "contributors", :force => true do |t|
t.integer "asset_id"
- t.text "contributor", :limit => 16777215, :null => false
+ t.text "contributor", :limit => 2147483647, :null => false
t.integer "contributor_role_id"
t.datetime "created_at"
t.datetime "updated_at"
@@ -127,8 +127,8 @@
create_table "coverages", :force => true do |t|
t.integer "asset_id"
- t.text "coverage", :limit => 16777215, :null => false
- t.string "coverage_type", :null => false
+ t.text "coverage", :limit => 2147483647, :null => false
+ t.string "coverage_type", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "creator_id"
@@ -152,7 +152,7 @@
create_table "creators", :force => true do |t|
t.integer "asset_id"
- t.text "creator", :limit => 16777215, :null => false
+ t.text "creator", :limit => 2147483647, :null => false
t.integer "creator_role_id"
t.datetime "created_at"
t.datetime "updated_at"
@@ -170,10 +170,10 @@
add_index "creators", ["asset_id"], :name => "index_creators_on_asset_id"
create_table "delayed_jobs", :force => true do |t|
- t.integer "priority", :default => 0
- t.integer "attempts", :default => 0
- t.text "handler", :limit => 16777215
- t.text "last_error", :limit => 16777215
+ t.integer "priority", :default => 0
+ t.integer "attempts", :default => 0
+ t.text "handler", :limit => 2147483647
+ t.text "last_error", :limit => 2147483647
t.datetime "run_at"
t.datetime "locked_at"
t.datetime "failed_at"
@@ -191,7 +191,7 @@
create_table "descriptions", :force => true do |t|
t.integer "asset_id"
- t.text "description", :limit => 16777215, :null => false
+ t.text "description", :limit => 2147483647, :null => false
t.integer "description_type_id"
t.datetime "created_at"
t.datetime "updated_at"
@@ -234,18 +234,18 @@
create_table "essence_tracks", :force => true do |t|
t.integer "instantiation_id"
- t.text "standard", :limit => 16777215
- t.text "encoding", :limit => 16777215
- t.text "data_rate", :limit => 16777215
- t.text "time_start", :limit => 16777215
- t.text "duration", :limit => 16777215
- t.text "bit_depth", :limit => 16777215
- t.text "sampling_rate", :limit => 16777215
- t.text "frame_size", :limit => 16777215
- t.text "aspect_ratio", :limit => 16777215
- t.text "frame_rate", :limit => 16777215
- t.text "language", :limit => 16777215
- t.text "annotation", :limit => 16777215
+ t.text "standard", :limit => 2147483647
+ t.text "encoding", :limit => 2147483647
+ t.text "data_rate", :limit => 2147483647
+ t.text "time_start", :limit => 2147483647
+ t.text "duration", :limit => 2147483647
+ t.text "bit_depth", :limit => 2147483647
+ t.text "sampling_rate", :limit => 2147483647
+ t.text "frame_size", :limit => 2147483647
+ t.text "aspect_ratio", :limit => 2147483647
+ t.text "frame_rate", :limit => 2147483647
+ t.text "language", :limit => 2147483647
+ t.text "annotation", :limit => 2147483647
t.integer "essence_track_type_id"
t.string "playback_speed"
t.string "playback_speed_units_of_measure"
@@ -266,8 +266,8 @@
create_table "extension_names", :force => true do |t|
t.string "extension_key"
t.string "extension_authority"
- t.text "description", :limit => 16777215
- t.boolean "visible", :default => false, :null => false
+ t.text "description", :limit => 2147483647
+ t.boolean "visible", :default => false, :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "creator_id"
@@ -278,8 +278,8 @@
create_table "extensions", :force => true do |t|
t.integer "asset_id"
- t.text "extension", :limit => 16777215
- t.text "extension_authority_used", :limit => 16777215
+ t.text "extension", :limit => 2147483647
+ t.text "extension_authority_used", :limit => 2147483647
end
add_index "extensions", ["asset_id"], :name => "index_extensions_on_asset_id"
@@ -313,9 +313,9 @@
add_index "formats", ["type", "name"], :name => "index_formats_on_type_and_name"
create_table "genres", :force => true do |t|
- t.text "name", :limit => 16777215, :null => false
- t.text "genre_authority_used", :limit => 16777215
- t.boolean "visible", :default => false, :null => false
+ t.text "name", :limit => 2147483647, :null => false
+ t.text "genre_authority_used", :limit => 2147483647
+ t.boolean "visible", :default => false, :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "creator_id"
@@ -324,13 +324,13 @@
end
create_table "identifier_sources", :force => true do |t|
- t.text "name", :limit => 16777215, :null => false
+ t.text "name", :limit => 2147483647, :null => false
t.datetime "created_at"
t.datetime "updated_at"
- t.boolean "visible", :default => false, :null => false
- t.boolean "show_in_index", :default => true, :null => false
+ t.boolean "visible", :default => false, :null => false
+ t.boolean "show_in_index", :default => true, :null => false
t.string "regex"
- t.boolean "auto_merge", :default => false, :null => false
+ t.boolean "auto_merge", :default => false, :null => false
t.integer "creator_id"
t.integer "updater_id"
t.integer "sequence"
@@ -425,20 +425,20 @@
create_table "instantiations", :force => true do |t|
t.integer "asset_id"
t.integer "format_id"
- t.text "format_location", :limit => 16777215, :null => false
+ t.text "format_location", :limit => 2147483647, :null => false
t.integer "instantiation_media_type_id"
t.string "format_file_size"
t.string "format_time_start"
t.string "format_duration"
t.string "format_data_rate"
t.integer "instantiation_color_id"
- t.text "format_tracks", :limit => 16777215
- t.text "format_channel_configuration", :limit => 16777215
+ t.text "format_tracks", :limit => 2147483647
+ t.text "format_channel_configuration", :limit => 2147483647
t.string "language"
- t.text "alternative_modes", :limit => 16777215
+ t.text "alternative_modes", :limit => 2147483647
t.datetime "created_at"
t.datetime "updated_at"
- t.string "uuid", :limit => 36, :null => false
+ t.string "uuid", :limit => 36, :null => false
t.string "template_name"
t.integer "creator_id"
t.integer "updater_id"
@@ -450,6 +450,7 @@
t.text "standard"
t.text "standard_source"
t.text "standard_ref"
+ t.boolean "digitized", :default => false
end
add_index "instantiations", ["asset_id"], :name => "index_instantiations_on_asset_id"
@@ -457,8 +458,8 @@
add_index "instantiations", ["uuid"], :name => "index_instantiations_on_uuid", :unique => true
create_table "ip_blocks", :force => true do |t|
- t.string "name", :null => false
- t.text "ranges", :limit => 16777215
+ t.string "name", :null => false
+ t.text "ranges", :limit => 2147483647
end
add_index "ip_blocks", ["name"], :name => "index_ip_blocks_on_name", :unique => true
@@ -480,7 +481,7 @@
create_table "publishers", :force => true do |t|
t.integer "asset_id"
- t.text "publisher", :limit => 16777215, :null => false
+ t.text "publisher", :limit => 2147483647, :null => false
t.integer "publisher_role_id"
t.datetime "created_at"
t.datetime "updated_at"
@@ -498,8 +499,8 @@
add_index "publishers", ["asset_id"], :name => "index_publishers_on_asset_id"
create_table "relation_types", :force => true do |t|
- t.text "name", :limit => 16777215, :null => false
- t.boolean "visible", :default => false, :null => false
+ t.text "name", :limit => 2147483647, :null => false
+ t.boolean "visible", :default => false, :null => false
t.text "ref"
end
@@ -521,7 +522,7 @@
create_table "rights_summaries", :force => true do |t|
t.integer "asset_id"
- t.text "rights_summary", :limit => 16777215, :null => false
+ t.text "rights_summary", :limit => 2147483647, :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "creator_id"
@@ -533,9 +534,9 @@
add_index "rights_summaries", ["asset_id"], :name => "index_rights_summaries_on_asset_id"
create_table "subjects", :force => true do |t|
- t.text "subject", :limit => 16777215, :null => false
- t.text "subject_authority", :limit => 16777215
- t.boolean "visible", :default => false, :null => false
+ t.text "subject", :limit => 2147483647, :null => false
+ t.text "subject_authority", :limit => 2147483647
+ t.boolean "visible", :default => false, :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "creator_id"
@@ -557,7 +558,7 @@
create_table "titles", :force => true do |t|
t.integer "asset_id"
- t.text "title", :limit => 16777215, :null => false
+ t.text "title", :limit => 2147483647, :null => false
t.integer "title_type_id"
t.datetime "created_at"
t.datetime "updated_at"
Please sign in to comment.
Something went wrong with that request. Please try again.