Permalink
Browse files

Merge branch 'master' into postgres

Conflicts:
	db/schema.rb
  • Loading branch information...
2 parents 307e87f + 7ed585d commit f5aa75d988120d25ed37ca7946788f75c1fda85b @mlc committed Jun 1, 2010
@@ -12,6 +12,11 @@ class XmlController < ApplicationController
# gah, this method is awful code. no one look at it please. kthxbye.
def index
if request.post?
+ unless params[:xml] && params[:xml].respond_to?(:original_filename)
+ flash[:error] = "You must provide an XML or ZIP file."
+ redirect_to :action => :index and return
+ end
+
havezip = MIME::Types.of(params[:xml].original_filename).any?{|t| t.content_type == "application/zip"}
if havezip
successes = 0
@@ -59,6 +64,9 @@ def index
elsif request.put?
respond_to do |format|
format.xml do
+ unless params[:xml] && !params[:xml].empty?
+ render :xml => "<message severity='error'>no XML provided.</message>" and return
+ end
a = Asset.from_xml(params[:xml])
if a.valid?
a.destroy_existing
@@ -35,6 +35,7 @@ def extension_name_id
end
def extension_name_str
+ return nil if extension_name.nil?
extension_name.description
end
@@ -0,0 +1,42 @@
+authorization do
+ role :guest do
+ # no permissions
+ end
+
+ role :user do
+ includes :guest
+ has_permission_on :assets, :to => [:read]
+ has_permission_on :instantiations, :to => [:read]
+ has_permission_on :users, :to => [:show, :update] do
+ if_attribute :id => is { user.id }
+ end
+ end
+
+ role :admin do
+ includes :user
+ has_permission_on :last_used_ids, :to => :index
+ has_permission_on :assets, :to => :crud
+ has_permission_on :instantiations, :to => [:crud]
+ has_permission_on :users, :to => :crud
+ has_permission_on :users, :to => :make_admin do
+ if_attribute :id => is_not { user.id }
+ end
+ has_permission_on :picklists, :to => :crud
+ PicklistsController::SUBCLASSES.each do |kl|
+ has_permission_on kl.to_sym, :to => :crud
+ end
+ has_permission_on :assets, :to => :multilend
+ has_permission_on :assets, :to => :destroy_found_set
+ has_permission_on :ip_blocks, :to => :crud
+ end
+end
+
+privileges do
+ privilege :read, :includes => [:index, :show]
+ privilege :create, :includes => :new
+ privilege :update, :includes => :edit
+ privilege :borrow, :includes => [:borrowings, :return]
+ privilege :crud, :includes => [:create, :read, :update, :destroy]
+ privilege :merge, :includes => :multiprocess
+ privilege :video, :includes => [:upload_video, :thumbnail, :upload_thumbnail]
+end
@@ -1,9 +0,0 @@
-class AddDeltaIndexColumn < ActiveRecord::Migration
- def self.up
- add_column :assets, :delta, :boolean, :null => false
- end
-
- def self.down
- remove_column :assets, :delta
- end
-end
@@ -0,0 +1,11 @@
+class EssenceTrackIdentifierSourceOptional < ActiveRecord::Migration
+ def self.up
+ change_column(:essence_tracks, :essence_track_type_id, :integer, :null => true)
+ change_column(:essence_tracks, :essence_track_identifier_source_id, :integer, :null => true)
+ end
+
+ def self.down
+ change_column(:essence_tracks, :essence_track_type_id, :integer, :null => false)
+ change_column(:essence_tracks, :essence_track_identifier_source_id, :integer, :null => false)
+ end
+end
View
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20100323173055) do
+ActiveRecord::Schema.define(:version => 20100527194736) do
create_table "annotations", :force => true do |t|
t.integer "instantiation_id"
@@ -182,8 +182,8 @@
t.text "essence_track_frame_rate"
t.text "essence_track_language"
t.text "essence_track_annotation"
- t.integer "essence_track_type_id", :null => false
- t.integer "essence_track_identifier_source_id", :null => false
+ t.integer "essence_track_type_id"
+ t.integer "essence_track_identifier_source_id"
end
add_index "essence_tracks", ["instantiation_id"], :name => "index_essence_tracks_on_instantiation_id"
View
@@ -0,0 +1,41 @@
+= PBCore Repository API
+
+The PBCore Record Repository has an API of sorts, so you can use the repository programmatically.
+
+== Searching
+
+To search, visit http://server/?q=my%20search -- replacing
+<tt>my%20search</tt> with your search query, URL-encoded of
+course. Advanced search syntax is supported.
+
+If you would prefer to have your results returned in Atom format, you
+need change the URL only slightly: visit
+http://server/assets.atom?q=my%20search
+
+=== Available URL parameters
+
+[q] Query string. Advanced syntax permitted. If omitted, all records
+ will be returned.
+
+[page] (One-based) page number of results to return. If omitted,
+ defaults to page 1.
+
+[bydate] If set to <tt>1</tt>, results will be returned showing most
+ recently updated records first; if omitted, defaults to
+ returning the most relevant results first.
+
+The returned results include OpenSearch-compliant metadata; an
+OpenSearch descriptor document is available for use by your
+application or your web browser at /assets/opensearch.xml
+
+== Importing
+
+This documentation needs to be cleaned up a bit, but for now, note:
+
+To add an asset:
+
+ curl -i -H 'Accept: application/xml' -H 'Content-Type: application/xml' -u 'username:password' -T YSTP_000000_Std.xml http://wnet-pbcore/xml
+
+To add an instantiation:
+
+ curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' -u 'username:password' -d @filename.xml http://wnet-pbcore/assets/EXISTING_ASSET_ID/instantiations.xml
View
@@ -1,9 +1,14 @@
= PBCore Repository Installation
-Here is how to install the PBCore Record Repository on a CentOS or
-Debian server. Note: this is technical documentation intended for
-systems administrators already familiar with Linux and Debian or
-CentOS. As with any recipe, read the whole thing before proceeding.
+Here is how to install the PBCore Record Repository on a CentOS,
+Debian, or Ubuntu server. Note: this is technical documentation
+intended for systems administrators already familiar with Linux and
+their distribution of choice. As with any recipe, read the whole thing
+before proceeding.
+
+WARNING: The CentOS instructions here are out-of-date. In the case of
+errors, read the Debian/Ubuntu instructions and adjust the CentOS
+instructions appropriately.
== Install prerequisite software
Our front-end webserver will be nginx
@@ -14,7 +19,7 @@ On CentOS:
service httpd stop
yum remove httpd
-or on Debian:
+or on Debian or Ubuntu:
aptitude remove apache2
(You could also use apache httpd instead, but doing so is a bit tricky
@@ -24,8 +29,8 @@ On CentOS:
rpm -i http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm
yum install nginx git libxml2-devel.x86_64 mysql.x86_64 mysql-server mysql-devel.x86_64 gcc gcc-c++
-On Debian:
- aptitude install nginx git-core libxml2-dev mysql-server libmysqlclient-dev build-essential ruby-full
+On Debian or Ubuntu:
+ aptitude install nginx git-core libxml2-dev mysql-server libmysqlclient-dev libxslt1-dev build-essential ruby-full
Next, on CentOS, you have to install ruby (http://www.ruby-lang.org/)
<b>1.8.6</b> or later. Version 1.8.5, as provided with CentOS 5, is *not*
@@ -35,28 +40,28 @@ as well. If you manage to find some alternate source for suitable RPM
packages, install <tt>ruby ruby-devel ruby-irb ruby-libs ruby-rdoc</tt> and,
optionally, <tt>ruby-docs</tt>
-Current versions of debian ship with a suitable version of Ruby and
-will be taken care of by the +aptitude+ line above.
+Current versions of Debian and Ubuntu ship with suitable versions of
+Ruby and will be taken care of by the +aptitude+ line above.
Only after installing this suitable version of Ruby, install rubygems
(http://www.rubygems.org/) either from its website or by doing <tt>yum
install rubygems</tt> (on CentOS) or <tt>aptitude install
rubygems</tt> (on Debian).
You'll need at least version 1.3 of rubygems, so if you're using
-Debian lenny or earlier, you'll need to get this from backports.
+Debian lenny or earlier, you'll need to get this from
+backports. Current versions of Ubuntu ship with a suitable version, so
+there is no need for any such shenanigans.
Make sure also that you have Java available, for the Solr search
-engine.
-
-TODO: Explain how to get Java.
+engine. On Debian/Ubuntu, you can accomplish this by doing
+<tt>aptitude install openjdk-6-jre-headless</tt>.
And, finally, install some needed ruby packages by doing
gem install -v 2.1.2 rails --no-ri --no-rdoc
gem install -v 0.9.6 rsolr --no-ri --no-rdoc
- gem install chronic libxml-ruby rake rack thin fast_xs --no-ri --no-rdoc
+ gem install chronic libxml-ruby rake rack thin fast_xs whenever sunspot sunspot_rails aws-s3 haml libxslt-ruby grit delayed_job --no-ri --no-rdoc
gem install mysql --no-ri --no-rdoc -- --with-mysql-config=/usr/bin/mysql_config
- gem install whenever sunspot sunspot_rails --source http://gemcutter.org/ --no-ri --no-rdoc
If you're using the Debian-provided rubygems package, then the
binaries for the install gems will not automatically be in your
@@ -68,13 +73,15 @@ binaries for the install gems will not automatically be in your
If you're concerned about security, edit <tt>/etc/my.cnf</tt>, adding the line
bind-address = 127.0.0.1
-to the <tt>[mysqld]</tt> section. Then, on CentOS, start +mysqld+ and make sure
+to the <tt>[mysqld]</tt> section. (On Debian and Ubuntu, the file is
+called <tt>/etc/mysql/my.cnf</tt> and this configuration is already
+the default.) Then, on CentOS, start +mysqld+ and make sure
it stays started:
/etc/init.d/mysqld start
chkconfig mysqld on
-On Debian, +mysqld+ will be automatically started when you install the
-package.
+On Debian and Ubuntu, +mysqld+ will be automatically started when you
+install the package.
Now would be a good time to set a mysql password for the root user if
you've not done so already. Next, create the database we'll be using,
@@ -119,14 +126,15 @@ directory are owned by the +www+ user.
== Install the repository software
On the server, make a directory <tt>/var/www/pbcore</tt> where the
-software will live. We use capistrano (http://www.capify.org/) for
-deployment, so now you will have to do some things on your local
-machine. The following instructions assume your local machine is POSIX
-(GNU/Linux or Mac OS X). It may somehow be possible to do all this on
-Windows, perhaps with cygwin (http://www.cygwin.com/) , but this is
+software will live and set its owner to the +www+ user you created
+above. We use capistrano (http://www.capify.org/) for deployment, so
+now you will have to do some things on your local machine. The
+following instructions assume your local machine is POSIX (GNU/Linux
+or Mac OS X). It may somehow be possible to do all this on Windows,
+perhaps with cygwin (http://www.cygwin.com/) , but this is
untested. If you don't already have them, install ruby, rubygems, and
-git (http://git-scm.com/) . Get capistrano by doing
- sudo gem install capistrano capistrano-ext
+git (http://git-scm.com/) . Get capistrano by doing <tt>sudo gem install
+capistrano capistrano-ext</tt>
Now, grab a copy of the software (again, on your local machine):
git clone git://git.mlcastle.net/pbcore.git pbcore; cd pbcore
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,49 @@
+/*
+ * WNYC theme-specific style rules
+ */
+
+/* colors */
+a { color: #000; }
+a:hover { color: #508bc7; }
+body { background-color: #262626; }
+
+a.secondaryLink:hover { color: #508bc7; }
+
+.topnavLi li a { color: #ccc; }
+.topnavLi li a:hover { color: #508bc7; }
+
+.topnavuserBar { color: #ccc; }
+.topnavuserBar a { color: #ccc; }
+.topnavuserBar a:hover { color: #508bc7; }
+
+.searchSelected { color: #508bc7; }
+
+.contentTopLinks { color: #666; }
+a.contentTopLinks { color: #ccc; }
+a.contentTopLinks:hover { color: #508bc7; }
+
+a.contentLink { color: #508bc7; }
+a.contentLink:hover { color: #508bc7; }
+
+a.footerLink { color: #ccc; }
+a.footerLink:hover { color: #81afdf; }
+
+a#all_asset_link, a#streamable_asset_link { color: #666; }
+a#all_asset_link:hover, a#streamable_asset_link:hover, a#all_asset_link.selected_option, a#streamable_asset_link.selected_option { color: #508bc7; }
+
+/* images */
+.topnavBar { background-image: url(/images/wnyc/template/topnavBg.jpg); }
+.topnavuserBar { background-image: url(/images/wnyc/template/topnavuserBg.jpg); }
+.sidebarTop { background-image: url(/images/wnyc/template/sidebarTop.jpg); }
+.sidebarMiddle { background-image: url(/images/wnyc/template/sidebarBg.jpg); }
+.sidebarSearch { background-image: url(/images/wnyc/template/sidebarBg.jpg); }
+.sidebarBottom { background-image: url(/images/wnyc/template/sidebarBottom.jpg); }
+.contentTop { background-image: url(/images/wnyc/template/contentTop.jpg); }
+.contentMiddle { background-image: url(/images/wnyc/template/contentBg.jpg); }
+.contentDivider { background-image: url(/images/wnyc/template/contentDivider.jpg); }
+.contentBottom { background-image: url(/images/wnyc/template/contentBottom.jpg); }
+.header { background-image: url(/images/wnyc/template/header.jpg); }
+.holder { background-image: url(/images/wnyc/template/bg_color.jpg); }
+
+a#all_asset_link { background-image: url(/images/wnyc/buttons/btnAssets.png); }
+a#streamable_asset_link { background-image: url(/images/wnyc/buttons/btnStreamable.png); }

0 comments on commit f5aa75d

Please sign in to comment.