aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/application_controller.rb120
-rw-r--r--app/controllers/general_controller.rb120
-rw-r--r--app/controllers/public_body_controller.rb25
-rw-r--r--app/controllers/request_controller.rb36
-rw-r--r--app/controllers/user_controller.rb16
-rwxr-xr-xapp/helpers/link_to_helper.rb23
-rw-r--r--app/models/info_request.rb3
-rw-r--r--app/models/info_request_event.rb26
-rw-r--r--app/models/public_body.rb2
-rw-r--r--app/models/track_thing.rb26
-rw-r--r--app/views/general/_localised_datepicker.rhtml18
-rw-r--r--app/views/general/advanced_search.rhtml0
-rw-r--r--app/views/general/blog.rhtml2
-rw-r--r--app/views/general/exception_caught.rhtml35
-rw-r--r--app/views/general/search.rhtml201
-rw-r--r--app/views/layouts/default.rhtml5
-rw-r--r--app/views/public_body/list.rhtml11
-rw-r--r--app/views/public_body/show.rhtml10
-rw-r--r--app/views/request/_request_filter_form.rhtml55
-rw-r--r--app/views/request/list.rhtml16
-rw-r--r--app/views/user/_signup.rhtml8
-rw-r--r--config/crontab.ugly2
-rw-r--r--config/general.yml-example9
-rw-r--r--config/routes.rb17
-rw-r--r--doc/CHANGES.md8
-rw-r--r--[-rwxr-xr-x]public/javascripts/jquery-ui.min.js138
-rwxr-xr-xpublic/stylesheets/admin-theme/jquery-ui-1.8.15.custom.css80
-rw-r--r--public/stylesheets/main.css12
-rw-r--r--spec/controllers/general_controller_spec.rb30
-rw-r--r--spec/controllers/public_body_controller_spec.rb35
-rw-r--r--spec/controllers/request_controller_spec.rb34
-rw-r--r--spec/integration/errors_spec.rb61
-rw-r--r--spec/integration/search_request_spec.rb48
-rw-r--r--spec/views/public_body/show.rhtml_spec.rb5
-rw-r--r--spec/views/request/list.rhtml_spec.rb6
-rw-r--r--vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb6
36 files changed, 964 insertions, 285 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 0df3e22da..6d14d0d7a 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -8,6 +8,7 @@
#
# $Id: application.rb,v 1.59 2009-09-17 13:01:56 francis Exp $
+require 'open-uri'
class ApplicationController < ActionController::Base
# Standard headers, footers and navigation for whole site
@@ -101,11 +102,17 @@ class ApplicationController < ActionController::Base
# Make sure expiry time for session is set (before_filters are
# otherwise missed by this override)
session_remember_me
-
+ case exception
+ when ActiveRecord::RecordNotFound, ActionController::UnknownAction, ActionController::RoutingError
+ @status = 404
+ else
+ @status = 500
+ end
# Display user appropriate error message
@exception_backtrace = exception.backtrace.join("\n")
@exception_class = exception.class.to_s
- render :template => "general/exception_caught.rhtml", :status => 404
+ @exception_message = exception.message
+ render :template => "general/exception_caught.rhtml", :status => @status
end
# For development sites.
@@ -349,6 +356,115 @@ class ApplicationController < ActionController::Base
session[:last_body_id] = public_body.id
end
+ def param_exists(item)
+ return params[item] && !params[item].empty?
+ end
+
+ def get_request_variety_from_params
+ query = ""
+ sortby = "newest"
+ varieties = []
+ if params[:request_variety] && !(query =~ /variety:/)
+ if params[:request_variety].include? "sent"
+ varieties -= ['variety:sent', 'variety:followup_sent', 'variety:response', 'variety:comment']
+ varieties << ['variety:sent', 'variety:followup_sent']
+ end
+ if params[:request_variety].include? "response"
+ varieties << ['variety:response']
+ end
+ if params[:request_variety].include? "comment"
+ varieties << ['variety:comment']
+ end
+ end
+ if !varieties.empty?
+ query = " (#{varieties.join(' OR ')})"
+ end
+ return query
+ end
+
+ def get_status_from_params
+ query = ""
+ if params[:latest_status]
+ statuses = []
+ if params[:latest_status].class == String
+ params[:latest_status] = [params[:latest_status]]
+ end
+ if params[:latest_status].include?("recent") || params[:latest_status].include?("all")
+ query += " variety:sent"
+ end
+ if params[:latest_status].include? "successful"
+ statuses << ['latest_status:successful', 'latest_status:partially_successful']
+ end
+ if params[:latest_status].include? "unsuccessful"
+ statuses << ['latest_status:rejected', 'latest_status:not_held']
+ end
+ if params[:latest_status].include? "awaiting"
+ statuses << ['latest_status:waiting_response', 'latest_status:waiting_clarification', 'waiting_classification:true']
+ end
+ if params[:latest_status].include? "internal_review"
+ statuses << ['status:internal_review']
+ end
+ if params[:latest_status].include? "other"
+ statuses << ['latest_status:gone_postal', 'latest_status:error_message', 'latest_status:requires_admin', 'latest_status:user_withdrawn']
+ end
+ if params[:latest_status].include? "gone_postal"
+ statuses << ['latest_status:gone_postal']
+ end
+ if !statuses.empty?
+ query = " (#{statuses.join(' OR ')})"
+ end
+ end
+ return query
+ end
+
+ def get_date_range_from_params
+ query = ""
+ if param_exists(:request_date_after) && !param_exists(:request_date_before)
+ params[:request_date_before] = Time.now.strftime("%d/%m/%Y")
+ query += " #{params[:request_date_after]}..#{params[:request_date_before]}"
+ elsif !param_exists(:request_date_after) && param_exists(:request_date_before)
+ params[:request_date_after] = "01/01/2001"
+ end
+ if param_exists(:request_date_after)
+ query = " #{params[:request_date_after]}..#{params[:request_date_before]}"
+ end
+ return query
+ end
+
+ def get_tags_from_params
+ query = ""
+ tags = []
+ if param_exists(:tags)
+ params[:tags].split().each do |tag|
+ tags << "tag:#{tag}"
+ end
+ end
+ if !tags.empty?
+ query = " (#{tags.join(' OR ')})"
+ end
+ return query
+ end
+
+ def make_query_from_params
+ query = params[:query] || "" if query.nil?
+ query += get_date_range_from_params
+ query += get_request_variety_from_params
+ query += get_status_from_params
+ query += get_tags_from_params
+ return query
+ end
+
+ def country_from_ip
+ gaze = MySociety::Config.get('GAZE_URL', '')
+ default = MySociety::Config.get('ISO_COUNTRY_CODE', '')
+ country = ""
+ if !gaze.empty?
+ country = open("#{gaze}/gaze-rest?f=get_country_from_ip;ip=#{request.remote_ip}").read.strip
+ end
+ country = default if country.empty?
+ return country
+ end
+
# URL generating functions are needed by all controllers (for redirects),
# views (for links) and mailers (for use in emails), so include them into
# all of all.
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 4fa603aab..1ddf3acff 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -45,10 +45,6 @@ class GeneralController < ApplicationController
:joins => :translations)
end
end
- @search_examples = MySociety::Config.get('FRONTPAGE_SEARCH_EXAMPLES', '').split(/\s*;\s*/)
- if @search_examples.empty?
- @search_examples = @popular_bodies.map { |body| body.name }
- end
# Get some successful requests #
begin
query = 'variety:response (status:successful OR status:partially_successful)'
@@ -82,20 +78,34 @@ class GeneralController < ApplicationController
# Just does a redirect from ?query= search to /query
def search_redirect
- @query = params[:query]
+ if params[:advanced].nil?
+ @query, _ = make_query_from_params
+ else
+ @query, _ = params[:query]
+ end
@sortby = params[:sortby]
- @bodies = params[:bodies]
+ path = request.path.split("/")
+ if path.size > 0 && (['newest', 'described', 'relevant'].include?(path[-1]))
+ @sort_postfix = path.pop
+ end
+ if path.size > 0 && (['bodies', 'requests', 'users', 'all'].include?(path[-1]))
+ @variety_postfix = path.pop
+ end
+ @variety_postfix = params[:bodies] if @variety_postfix.nil? && !params[:bodies].nil?
+ @variety_postfix = "all" if @variety_postfix.nil?
+ if @variety_postfix != "users"
+ @common_query = get_tags_from_params
+ end
+ [:latest_status, :request_variety, :request_date_after, :request_date_before, :query, :tags].each do |x|
+ session[x] = params[x]
+ end
if @query.nil? || @query.empty?
@query = nil
@page = 1
+ @advanced = !params[:advanced].nil?
render :action => "search"
else
- if (@bodies == '1') && (@sortby.nil? || @sortby.empty?)
- @postfix = 'bodies'
- else
- @postfix = @sortby
- end
- redirect_to search_url(@query, @postfix)
+ redirect_to search_url(@query, @variety_postfix, @sort_postfix, params[:advanced])
end
end
@@ -103,23 +113,49 @@ class GeneralController < ApplicationController
def search
# XXX Why is this so complicated with arrays and stuff? Look at the route
# in config/routes.rb for comments.
+ if !params[:commit].nil?
+ search_redirect
+ return
+ end
+ [:latest_status, :request_variety, :request_date_after, :request_date_before, :query, :tags].each do |x|
+ params[x] = session[x]
+ end
combined = params[:combined]
@sortby = nil
- @bodies = false # searching from front page, largely for a public authority
+ @bodies = @requests = @users = true
+ if combined.size > 0 && (['advanced'].include?(combined[-1]))
+ combined.pop
+ @advanced = true
+ else
+ @advanced = false
+ end
# XXX currently /described isn't linked to anywhere, just used in RSS and for /list/successful
# This is because it's confusingly different from /newest - but still useful for power users.
- if combined.size > 1 && (['newest', 'described', 'bodies', 'relevant'].include?(combined[-1]))
- @postfix = combined[-1]
- combined = combined[0..-2]
- if @postfix == 'bodies'
+ if combined.size > 0 && (['newest', 'described', 'relevant'].include?(combined[-1]))
+ @sort_postfix = combined.pop
+ @sortby = @sort_postfix
+ end
+
+ if combined.size > 0 && (['bodies', 'requests', 'users', 'all'].include?(combined[-1]))
+ @variety_postfix = combined.pop
+ case @variety_postfix
+ when 'bodies'
@bodies = true
- else
- @sortby = @postfix
+ @requests = false
+ @users = false
+ when 'requests'
+ @bodies = false
+ @requests = true
+ @users = false
+ when 'users'
+ @bodies = false
+ @requests = false
+ @users = true
end
end
@query = combined.join("/")
-
@inputted_sortby = @sortby
+ @common_query = get_tags_from_params
if @sortby.nil?
# Parse query, so can work out if it has prefix terms only - if so then it is a
# structured query which should show newest first, rather than a free text search
@@ -145,21 +181,41 @@ class GeneralController < ApplicationController
if params[:requests_per_page]
requests_per_page = params[:requests_per_page].to_i
end
- @xapian_requests = perform_search([InfoRequestEvent], @query, @sortby, 'request_collapse', requests_per_page)
- @requests_per_page = @per_page
- @xapian_bodies = perform_search([PublicBody], @query, @sortby, nil, 5)
- @bodies_per_page = @per_page
- @xapian_users = perform_search([User], @query, @sortby, nil, 5)
- @users_per_page = @per_page
-
- @this_page_hits = @xapian_requests.results.size + @xapian_bodies.results.size + @xapian_users.results.size
- @total_hits = @xapian_requests.matches_estimated + @xapian_bodies.matches_estimated + @xapian_users.matches_estimated
+ @this_page_hits = @total_hits = @xapian_requests_hits = @xapian_bodies_hits = @xapian_users_hits = 0
+ if @requests
+ @xapian_requests = perform_search([InfoRequestEvent], @query, @sortby, 'request_collapse', requests_per_page)
+ @requests_per_page = @per_page
+ @this_page_hits += @xapian_requests.results.size
+ @xapian_requests_hits = @xapian_requests.results.size
+ @xapian_requests_total_hits = @xapian_requests.matches_estimated
+ @total_hits += @xapian_requests.matches_estimated
+ end
+ if @bodies
+ @xapian_bodies = perform_search([PublicBody], @query, @sortby, nil, 5)
+ @bodies_per_page = @per_page
+ @this_page_hits += @xapian_bodies.results.size
+ @xapian_bodies_hits = @xapian_bodies.results.size
+ @xapian_bodies_total_hits = @xapian_bodies.matches_estimated
+ @total_hits += @xapian_bodies.matches_estimated
+ end
+ if @users
+ @xapian_users = perform_search([User], @query, @sortby, nil, 5)
+ @users_per_page = @per_page
+ @this_page_hits += @xapian_users.results.size
+ @xapian_users_hits = @xapian_users.results.size
+ @xapian_users_total_hits = @xapian_users.matches_estimated
+ @total_hits += @xapian_users.matches_estimated
+ end
# Spelling and highight words are same for all three queries
- @spelling_correction = @xapian_requests.spelling_correction
- @highlight_words = @xapian_requests.words_to_highlight
+ if !@xapian_requests.nil?
+ @highlight_words = @xapian_requests.words_to_highlight
+ if !(@xapian_requests.spelling_correction =~ /[a-z]+:/)
+ @spelling_correction = @xapian_requests.spelling_correction
+ end
+ end
- @track_thing = TrackThing.create_track_for_search_query(@query)
+ @track_thing = TrackThing.create_track_for_search_query(@query, @variety_postfix)
@feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ]
end
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index 05acf4868..ce70e1ab0 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -16,11 +16,10 @@ class PublicBodyController < ApplicationController
redirect_to :url_name => MySociety::Format.simplify_url_part(params[:url_name], 'body'), :status => :moved_permanently
return
end
-
@locale = self.locale_from_params()
PublicBody.with_locale(@locale) do
@public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
- raise "None found" if @public_body.nil? # XXX proper 404
+ raise ActiveRecord::RecordNotFound.new("None found") if @public_body.nil? # XXX proper 404
if @public_body.url_name.nil?
redirect_to :back
return
@@ -39,11 +38,16 @@ class PublicBodyController < ApplicationController
if !referrer.nil? && referrer.match(%r{^#{top_url}search/.*/bodies$})
@searched_to_send_request = true
end
+ @view = params[:view]
+ params[:latest_status] = @view
+ query = make_query_from_params
+ query += " requested_from:#{@public_body.url_name}"
# Use search query for this so can collapse and paginate easily
# XXX really should just use SQL query here rather than Xapian.
+ sortby = "described"
begin
- @xapian_requests = perform_search([InfoRequestEvent], 'requested_from:' + @public_body.url_name, 'newest', 'request_collapse')
+ @xapian_requests = perform_search([InfoRequestEvent], query, sortby, 'request_collapse')
if (@page > 1)
@page_desc = " (page " + @page.to_s + ")"
else
@@ -83,29 +87,30 @@ class PublicBodyController < ApplicationController
def list
long_cache
# XXX move some of these tag SQL queries into has_tag_string.rb
+ @query = "%#{params[:public_body_query].nil? ? "" : params[:public_body_query]}%"
@tag = params[:tag]
@locale = self.locale_from_params()
- locale_condition = 'public_body_translations.locale = ?'
- if @tag.nil?
+ locale_condition = "(upper(public_body_translations.name) LIKE upper(?) OR upper(public_body_translations.notes) LIKE upper (?)) AND public_body_translations.locale = ?"
+ if @tag.nil? or @tag == "all"
@tag = "all"
- conditions = [locale_condition, @locale]
+ conditions = [locale_condition, @query, @query, @locale]
elsif @tag == 'other'
category_list = PublicBodyCategories::CATEGORIES.map{|c| "'"+c+"'"}.join(",")
conditions = [locale_condition + ' AND (select count(*) from has_tag_string_tags where has_tag_string_tags.model_id = public_bodies.id
and has_tag_string_tags.model = \'PublicBody\'
- and has_tag_string_tags.name in (' + category_list + ')) = 0', @locale]
+ and has_tag_string_tags.name in (' + category_list + ')) = 0', @query, @query, @locale]
elsif @tag.size == 1
@tag.upcase!
- conditions = [locale_condition + ' AND public_body_translations.first_letter = ?', @locale, @tag]
+ conditions = [locale_condition + ' AND public_body_translations.first_letter = ?', @query, @query, @locale, @tag]
elsif @tag.include?(":")
name, value = HasTagString::HasTagStringTag.split_tag_into_name_value(@tag)
conditions = [locale_condition + ' AND (select count(*) from has_tag_string_tags where has_tag_string_tags.model_id = public_bodies.id
and has_tag_string_tags.model = \'PublicBody\'
- and has_tag_string_tags.name = ? and has_tag_string_tags.value = ?) > 0', @locale, name, value]
+ and has_tag_string_tags.name = ? and has_tag_string_tags.value = ?) > 0', @query, @query, @locale, name, value]
else
conditions = [locale_condition + ' AND (select count(*) from has_tag_string_tags where has_tag_string_tags.model_id = public_bodies.id
and has_tag_string_tags.model = \'PublicBody\'
- and has_tag_string_tags.name = ?) > 0', @locale, @tag]
+ and has_tag_string_tags.name = ?) > 0', @query, @query, @locale, @tag]
end
if @tag.size == 1
@description = _("beginning with") + " '" + @tag + "'"
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index c1a13273a..a76418e4e 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -37,7 +37,7 @@ class RequestController < ApplicationController
# Look up by new style text names
@info_request = InfoRequest.find_by_url_title(params[:url_title])
if @info_request.nil?
- raise "Request not found"
+ raise ActiveRecord::RecordNotFound.new("Request not found")
end
set_last_request(@info_request)
@@ -129,27 +129,12 @@ class RequestController < ApplicationController
def list
medium_cache
@view = params[:view]
-
- if @view.nil?
- redirect_to request_list_url(:view => 'successful')
- return
- end
-
- if @view == 'recent'
- @title = _("Recently sent Freedom of Information requests")
- query = "variety:sent";
- sortby = "newest"
- @track_thing = TrackThing.create_track_for_all_new_requests
- elsif @view == 'successful'
- @title = _("Recently successful responses")
- query = 'variety:response (status:successful OR status:partially_successful)'
- sortby = "described"
- @track_thing = TrackThing.create_track_for_all_successful_requests
- else
- raise "unknown request list view " + @view.to_s
- end
-
+ params[:latest_status] = @view
+ query = make_query_from_params
+ @title = "View and search requests"
+ sortby = "newest"
@page = get_search_page_from_params if !@page # used in cache case, as perform_search sets @page as side effect
+
behavior_cache :tag => [@view, @page] do
xapian_object = perform_search([InfoRequestEvent], query, sortby, 'request_collapse')
@list_results = xapian_object.results.map { |r| r[:model] }
@@ -158,7 +143,8 @@ class RequestController < ApplicationController
@title = @title + " (page " + @page.to_s + ")" if (@page > 1)
- @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ]
+ # XXX need to reinstate the following; @track_thing had previously been set to "TrackThing.create_track_for_all_new_requests" and "TrackThing.create_track_for_all_successful_requests"
+ # @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ]
# Don't let robots go more than 20 pages in
if @page > 20
@@ -203,7 +189,7 @@ class RequestController < ApplicationController
params[:info_request][:public_body_id] = params[:url_name]
else
public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
- raise "None found" if public_body.nil? # XXX proper 404
+ raise ActiveRecord::RecordNotFound.new("None found") if public_body.nil? # XXX proper 404
params[:info_request][:public_body_id] = public_body.id
end
elsif params[:public_body_id]
@@ -686,10 +672,10 @@ class RequestController < ApplicationController
raise "internal error, pre-auth filter should have caught this" if !@info_request.user_can_view?(authenticated_user)
@attachment = IncomingMessage.get_attachment_by_url_part_number(@incoming_message.get_attachments_for_display, @part_number)
- raise "attachment not found part number " + @part_number.to_s + " incoming_message " + @incoming_message.id.to_s if @attachment.nil?
+ raise ActiveRecord::RecordNotFound.new("attachment not found part number " + @part_number.to_s + " incoming_message " + @incoming_message.id.to_s) if @attachment.nil?
# check filename in URL matches that in database (use a censor rule if you want to change a filename)
- raise "please use same filename as original file has, display: '" + @attachment.display_filename + "' old_display: '" + @attachment.old_display_filename + "' original: '" + @original_filename + "'" if @attachment.display_filename != @original_filename && @attachment.old_display_filename != @original_filename
+ raise ActiveRecord::RecordNotFound.new("please use same filename as original file has, display: '" + @attachment.display_filename + "' old_display: '" + @attachment.old_display_filename + "' original: '" + @original_filename + "'") if @attachment.display_filename != @original_filename && @attachment.old_display_filename != @original_filename
@attachment_url = get_attachment_url(:id => @incoming_message.info_request_id,
:incoming_message_id => @incoming_message.id, :part => @part_number,
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index d3c42c7f1..6916b4456 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -24,7 +24,7 @@ class UserController < ApplicationController
@display_user = User.find(:first, :conditions => [ "url_name = ? and email_confirmed = ?", params[:url_name], true ])
if not @display_user
- raise "user not found, url_name=" + params[:url_name]
+ raise ActiveRecord::RecordNotFound.new("user not found, url_name=" + params[:url_name])
end
@same_name_users = User.find(:all, :conditions => [ "name ilike ? and email_confirmed = ? and id <> ?", @display_user.name, true, @display_user.id ], :order => "created_at")
@@ -71,7 +71,7 @@ class UserController < ApplicationController
# Login form
def signin
work_out_post_redirect
-
+ @request_from_foreign_country = country_from_ip != MySociety::Config.get('ISO_COUNTRY_CODE', 'GB')
# make sure we have cookies
if session.instance_variable_get(:@dbman)
if not session.instance_variable_get(:@dbman).instance_variable_get(:@original)
@@ -118,10 +118,15 @@ class UserController < ApplicationController
# Create new account form
def signup
work_out_post_redirect
-
+ @request_from_foreign_country = country_from_ip != MySociety::Config.get('ISO_COUNTRY_CODE', 'GB')
# Make the user and try to save it
@user_signup = User.new(params[:user_signup])
- if !@user_signup.valid?
+ error = false
+ if @request_from_foreign_country && !verify_recaptcha
+ flash.now[:error] = _("There was an error with the words you entered, please try again.")
+ error = true
+ end
+ if error || !@user_signup.valid?
# Show the form
render :action => 'sign'
else
@@ -133,7 +138,6 @@ class UserController < ApplicationController
# New unconfirmed user
@user_signup.email_confirmed = false
@user_signup.save!
-
send_confirmation_mail @user_signup
return
end
@@ -454,7 +458,7 @@ class UserController < ApplicationController
def get_profile_photo
@display_user = User.find(:first, :conditions => [ "url_name = ? and email_confirmed = ?", params[:url_name], true ])
if !@display_user
- raise "user not found, url_name=" + params[:url_name]
+ raise ActiveRecord::RecordNotFound.new("user not found, url_name=" + params[:url_name])
end
if !@display_user.profile_photo
raise "user has no profile photo, url_name=" + params[:url_name]
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 34354a79b..54b8d69d0 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -79,7 +79,7 @@ module LinkToHelper
link_to(h(public_body.name), main_url(public_body_url(public_body))) + " (" + link_to("admin", public_body_admin_url(public_body)) + ")"
end
def list_public_bodies_default
- list_public_bodies_url(:tag => 'a')
+ list_public_bodies_url(:tag => 'all')
end
# Users
@@ -135,11 +135,10 @@ module LinkToHelper
end
end
- # General pages. postfix is either the sort order, or 'bodies' to show you
- # came from the front page and are looking for public bodies
- def search_url(query, postfix = nil)
+ # General pages.
+ def search_url(query, variety_postfix = nil, sort_postfix = nil, advanced = nil)
+ query = query - ["", nil] if query.kind_of?(Array)
url = search_general_url(:combined => query)
-
# Here we can't escape the slashes, as RFC 2396 doesn't allow slashes
# within a path component. Rails is assuming when generating URLs that
# either there aren't slashes, or we are in a query part where you can
@@ -151,13 +150,19 @@ module LinkToHelper
# http://rails.lighthouseapp.com/projects/8994/tickets/144-patch-bug-in-rails-route-globbing
url = url.gsub("%2F", "/")
- if !postfix.nil? && !postfix.empty?
- url = url + "/" + postfix
+ if !variety_postfix.nil? && !variety_postfix.empty?
+ url = url + "/" + variety_postfix
+ end
+ if !sort_postfix.nil? && !sort_postfix.empty?
+ url = url + "/" + sort_postfix
+ end
+ if !advanced.nil? && (advanced)
+ url = url + "/advanced"
end
return url
end
- def search_link(query, postfix = nil)
- link_to h(query), search_url(query, postfix)
+ def search_link(query, variety_postfix = nil, sort_postfix = nil, advanced = nil)
+ link_to h(query), search_url(query, variety_postfix, sort_postfix, advanced)
end
# Admin pages
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index c667e1499..9b0f1047b 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -451,7 +451,7 @@ public
self.log_event("response", params)
self.save!
end
-
+ self.info_request_events.each { |event| event.xapian_mark_needs_index } # for the "waiting_classification" index
RequestMailer.deliver_new_response(self, incoming_message)
end
@@ -564,6 +564,7 @@ public
def calculate_event_states
curr_state = nil
for event in self.info_request_events.reverse
+ event.xapian_mark_needs_index # we need to reindex all events in order to update their latest_* terms
if curr_state.nil?
if !event.described_state.nil?
curr_state = event.described_state
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 1550a4bf5..4003217b0 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -94,7 +94,7 @@ class InfoRequestEvent < ActiveRecord::Base
[ :created_at_numeric, 1, "created_at", :number ], # for sorting
[ :described_at_numeric, 2, "described_at", :number ], # XXX using :number for lack of :datetime support in Xapian values
[ :request, 3, "request_collapse", :string ],
- [ :request_title_collapse, 4, "request_title_collapse", :string ]
+ [ :request_title_collapse, 4, "request_title_collapse", :string ],
],
:terms => [ [ :calculated_state, 'S', "status" ],
[ :requested_by, 'B', "requested_by" ],
@@ -102,6 +102,9 @@ class InfoRequestEvent < ActiveRecord::Base
[ :commented_by, 'C', "commented_by" ],
[ :request, 'R', "request" ],
[ :variety, 'V', "variety" ],
+ [ :latest_variety, 'K', "latest_variety" ],
+ [ :latest_status, 'L', "latest_status" ],
+ [ :waiting_classification, 'W', "waiting_classification" ],
[ :filetype, 'T', "filetype" ],
[ :tags, 'U', "tag" ]
],
@@ -129,6 +132,27 @@ class InfoRequestEvent < ActiveRecord::Base
def request
self.info_request.url_title
end
+
+ def latest_variety
+ for event in self.info_request.info_request_events.reverse
+ if !event.variety.nil? and !event.variety.empty?
+ return event.variety
+ end
+ end
+ end
+
+ def latest_status
+ for event in self.info_request.info_request_events.reverse
+ if !event.calculated_state.nil? and !event.calculated_state.empty?
+ return event.calculated_state
+ end
+ end
+ end
+
+ def waiting_classification
+ self.info_request.awaiting_description == true ? "yes" : "no"
+ end
+
def request_title_collapse
url_title = self.info_request.url_title
# remove numeric section from the end, use this to group lots
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index c19433704..81149e3c2 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -206,7 +206,7 @@ class PublicBody < ActiveRecord::Base
return self.created_at.strftime("%Y%m%d%H%M%S")
end
def variety
- "authority"
+ return "authority"
end
# if the URL name has changed, then all requested_from: queries
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index 16a0dab87..1cd957549 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -105,9 +105,19 @@ class TrackThing < ActiveRecord::Base
return track_thing
end
- def TrackThing.create_track_for_search_query(query)
+ def TrackThing.create_track_for_search_query(query, variety_postfix = nil)
track_thing = TrackThing.new
track_thing.track_type = 'search_query'
+ if !(query =~ /variety:/)
+ case variety_postfix
+ when "requests"
+ query += " variety:sent"
+ when "users"
+ query += " variety:user"
+ when "authorities"
+ query += " variety:authority"
+ end
+ end
track_thing.track_query = query
return track_thing
end
@@ -203,15 +213,15 @@ class TrackThing < ActiveRecord::Base
@params = {
# Website
:list_description => "'<a href=\"/search/" + CGI.escapeHTML(self.track_query) + "/newest\">" + CGI.escapeHTML(self.track_query) + "</a>' in new requests/responses", # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how
- :verb_on_page => _("Track things matching '{{query}}' by email", :query=>CGI.escapeHTML(self.track_query)),
- :verb_on_page_already => _("You are already tracking things matching '{{query}}' by email", :query=>CGI.escapeHTML(self.track_query)),
+ :verb_on_page => _("Track things matching this search by email"),
+ :verb_on_page_already => _("You are already tracking things matching this search by email"),
# Email
- :title_in_email => _("Requests or responses matching '{{query}}'", :query=>self.track_query),
- :title_in_rss => _("Requests or responses matching '{{query}}'", :query=>self.track_query),
+ :title_in_email => _("Requests or responses matching your saved search"),
+ :title_in_rss => _("Requests or responses matching your saved search"),
# Authentication
- :web => _("To follow requests and responses matching '{{query}}'", :query=>CGI.escapeHTML(self.track_query)),
- :email => _("Then you will be emailed whenever a new request or response matches '{{query}}'.", :query=>CGI.escapeHTML(self.track_query)),
- :email_subject => _("Confirm you want to be emailed about new requests or responses matching '{{query}}'", :query=>self.track_query),
+ :web => _("To follow requests and responses matching your search"),
+ :email => _("Then you will be emailed whenever a new request or response matches your search."),
+ :email_subject => _("Confirm you want to be emailed about new requests or responses matching your search"),
# RSS sorting - XXX hmmm, we don't really know which to use
# here for sorting. Might be a query term (e.g. 'cctv'), in
# which case newest is good, or might be something like
diff --git a/app/views/general/_localised_datepicker.rhtml b/app/views/general/_localised_datepicker.rhtml
new file mode 100644
index 000000000..5fdd63644
--- /dev/null
+++ b/app/views/general/_localised_datepicker.rhtml
@@ -0,0 +1,18 @@
+<script type="text/javascript">
+ $(function() {
+ $(".use-datepicker").datepicker(
+ {closeText: '<%= _("Done") %>',
+ prevText: '<%= _("Prev") %>',
+ nextText: '<%= _("Next") %>',
+ currentText: '<%= _("Today") %>',
+ monthNames: <%= I18n.translate('date.month_names')[1..-1].to_json %>,
+ monthNamesShort: <%= I18n.translate('date.abbr_month_names')[1..-1].to_json %>,
+ dayNames: <%= I18n.translate('date.day_names').to_json %>,
+ dayNamesShort: <%= I18n.translate('date.abbr_day_names').to_json %>,
+ dayNamesMin: <%= I18n.translate('date.abbr_day_names').collect{|x| x[0..0]}.to_json %>,
+ weekHeader: '<%= _("Wk") %>',
+ dateFormat: '<%= I18n.translate('date.formats.default').sub("%Y", "yy").sub("%m", "mm").sub("%d", "dd").gsub("-", "/") %>'}
+ );
+ });
+</script>
+
diff --git a/app/views/general/advanced_search.rhtml b/app/views/general/advanced_search.rhtml
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/app/views/general/advanced_search.rhtml
diff --git a/app/views/general/blog.rhtml b/app/views/general/blog.rhtml
index c9387c24f..f5bd66ebd 100644
--- a/app/views/general/blog.rhtml
+++ b/app/views/general/blog.rhtml
@@ -6,7 +6,7 @@
<% if !@twitter_user.empty? %>
<div id="twitter">
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
-<script>
+<script type="text/javascript">
new TWTR.Widget({
version: 2,
type: 'profile',
diff --git a/app/views/general/exception_caught.rhtml b/app/views/general/exception_caught.rhtml
index ca36b592b..b266b53a1 100644
--- a/app/views/general/exception_caught.rhtml
+++ b/app/views/general/exception_caught.rhtml
@@ -1,17 +1,24 @@
-<h1><%= _("Sorry, we couldn't find that page") %></h1>
+<div id="error-page">
+ <% if @status == 404 %>
+ <h1><%= _("Sorry, we couldn't find that page") %></h1>
-<p><%= _("The page either doesn't exist, or is broken. Things you can try now:")%></p>
+ <p><%= _("The page doesn't exist. Things you can try now:")%></p>
-<ul>
-<li><%= _("Check for mistakes if you typed or copied the address.")%></li>
-<li><%= _("Search the site to find what you were looking for.")%>
- <% form_tag({:controller => "general", :action => "search_redirect"}, {:id => "search_form"}) do %>
- <%= text_field_tag 'query', params[:query], { :size => 30 } %>
- <%= submit_tag _("Search") %>
- <% end %>
-</li>
-<li><%= _('<a href="%s">Contact us</a> to tell us about the problem</li>') % [help_contact_path] %>
-<li><%= _('Go to our <a href="%s">front page</a></li>') % ["/"] %>
-</ul>
+ <ul>
+ <li><%= _("Check for mistakes if you typed or copied the address.")%></li>
+ <li><%= _("Search the site to find what you were looking for.")%>
+ <% form_tag({:controller => "general", :action => "search_redirect"}, {:id => "search_form"}) do %>
+ <%= text_field_tag 'query', params[:query], { :size => 30 } %>
+ <%= submit_tag _("Search") %>
+ <% end %>
+ </li>
+ </ul>
+ <% else %>
+ <h1><%= _("Sorry, there was a problem processing this page") %></h1>
+ <p><%= _('You have found a bug. Please <a href="{{contact_url}}">contact us</a> to tell us about the problem', :contact_url => help_contact_path) %></p>
-<p id="error_technical_details"><%= _("<strong>Technical details:</strong>")%> <%=@exception_class ? @exception_class : _("Unknown")%></p>
+ <% end %>
+ <h2><%= _('Technical details') %></h2>
+ <p><strong><%=@exception_class ? @exception_class : _("Unknown")%></strong></p>
+ <p><strong><%=@exception_message %></strong></p>
+</div>
diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml
index 1d934f65a..15e00b85e 100644
--- a/app/views/general/search.rhtml
+++ b/app/views/general/search.rhtml
@@ -2,73 +2,139 @@
<% if @query.nil? %>
<% @title = _("Search Freedom of Information requests, public authorities and users") %>
- <h1><%=@title%></h1>
<% elsif @total_hits == 0 %>
- <%= _("Nothing found for &#x2018;{{search_terms}}&#x2019;", :search_terms => h(@query)) %>
+ <% @title = _('There were no requests matching your query.') %>
<% else %>
<% @title = _("Results page {{page_number}}", :page_number => @page.to_s) %>
<% end%>
-
<% @include_request_link_in_authority_listing = true %>
-<% if @bodies && (@page == 1 || @xapian_bodies.results.size > 0) %>
- <div id="stepwise_instructions">
- <p><strong><%=_("Next, select the public authority you'd like to make the request from.") %></strong></p>
- <p><% _('Can\'t find it? <a href="%s">Browse all</a> or <a href="%s">ask us to add it</a>.') % [list_public_bodies_default, "#{help_requesting_path}#missing_body"] %></p>
- <p>
- </div>
-<% end %>
+<h1><%=@title%></h1>
-<% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %>
- <p>
- <%= text_field_tag 'query', @query, { :size => 40 } %>
- <%= hidden_field_tag 'sortby', @inputted_sortby %>
- <% if @bodies %>
- <%= hidden_field_tag 'bodies', 1 %>
- <% end %>
- <%= submit_tag _("Search") %>
- <% if not @show_tips %>
- &nbsp;&nbsp;<%= link_to _('Advanced search tips'), search_redirect_path %>
+<%= render :partial => 'localised_datepicker' %>
+
+<% if @advanced %>
+ <p><%= _('To use the advanced search, combine phrases and labels as described in the search tips below.') %></p>
+ <% form_tag(advanced_search_url, :method => "get") do %>
+ <%= label_tag(:query, _("Search for:")) %>
+ <%= text_field_tag(:query, params[:query], { :size => 40 }) %>
+ <%= submit_tag("Search") %>
+ <% end %>
+ <p><%= link_to(_("Simple search"), search_redirect_url) %></p>
+
+<% else %>
+
+<% form_tag(request.url, :method => "get") do %>
+<div id="list-filter">
+ <div id="simple-search-box">
+ <%= label_tag(:query, _("Search for:")) %>
+ <%= text_field_tag(:query, params[:query], { :size => 40 }) %>
+ <%= submit_tag("Search") %>
+ </div>
+
+ <fieldset>
+ <legend>
+ <%= _("Filters:") %>
+ </legend>
+<div id="common-subfilters">
+ <div id="variety-filter">
+ <ul>
+ <% for variety, label in [
+ ["all", _("everything")],
+ ["requests", _("requests")],
+ ["users", _("users")],
+ ["bodies", _("authorities")]]%>
+ <li>
+ <% if @variety_postfix != variety %>
+ <% if variety != "users" %>
+ <%= link_to label, search_url([params[:query], @common_query], variety, @sort_postfix), :method => :get %>
+ <% else %>
+ <%= link_to label, search_url(params[:query], variety, @sort_postfix), :method => :get %>
+ <% end %>
+ <% else %>
+ <%= label %>
<% end %>
- </p>
+ </li>
+ <% end %>
+ </ul>
+ </div>
+
+<% if false %>
+<%-# Commented out for now as tags are of limited use when users can't see them. This will change in the future! -%>
+<% if @variety_postfix != "users" %>
+ <div>
+ <%= label_tag(:query, _("Tags (separated by a space):")) %><%= text_field_tag(:tags, params[:tags], { :size => 20 }) %>
+ <% for tag in InfoRequest.get_tags %>
+ <%= tag.name_and_value %>
+ <% end %>
+ </div>
+<% end %>
+<% end %>
+</div>
+
+<% if @variety_postfix == "requests" %>
+<div id="requests-subfilters">
+ <div>
+ <%= _("Only show:") %> <br />
+ <% [["successful", _("successful requests")],
+ ["unsuccessful", _("unsuccessful requests")],
+ ["awaiting", _("unresolved requests")],
+ ["internal_review", _("internal reviews")]].each_with_index do |item, index|
+
+ status, title = item %>
+ <%= check_box_tag "latest_status[]", status, params[:latest_status].nil? ? false : params[:latest_status].include?(status), :id => "latest_status_#{index}" %>
+ <%= label_tag("latest_status_#{index}", title) %> <br/>
+ <% end %>
+ </div>
+ <div>
+ <%= _("Search for words in:") %> <br/>
+ <% [["sent", _("messages from users")],
+ ["response", _("messages from authorities")],
+ ["comment", _("comments")]].each_with_index do |item, index|
+ variety, title = item %>
+
+ <%= check_box_tag "request_variety[]", variety, params[:request_variety].nil? ? true : params[:request_variety].include?(variety), :id => "request_variety_#{index}" %>
+ <%= label_tag("request_variety_#{index}", title) %> <br/>
+ <% end %>
+ </div>
+ <div>
+ Search between dates:
+ <%= text_field_tag(:request_date_after, params[:request_date_after], {:class => "use-datepicker", :size => 10}) %> -
+ <%= text_field_tag(:request_date_before, params[:request_date_before], {:class => "use-datepicker", :size => 10}) %>
+ </div>
+</div>
<% end %>
+ <%= submit_tag("Filter") %>
+ </fieldset>
+</div>
+<% end %>
+
+<p><%= link_to(_("Advanced search"), advanced_search_url) %></p>
+<% end %>
<% if !@query.nil? %>
<p>
- <%=link_to_unless @sortby == 'relevant', _("Show most relevant results first"), search_url(@query, 'relevant') %>
+ <%=link_to_unless @sortby == 'relevant', _("Show most relevant results first"), search_url(@query, @variety_postfix, 'relevant', @advanced) %>
|
- <%=link_to_unless @sortby == 'newest', _("Newest results first"), search_url(@query, 'newest') %>
+ <%=link_to_unless @sortby == 'newest', _("Newest results first"), search_url(@query, @variety_postfix, 'newest', @advanced) %>
<% if @sortby == 'described' %>
| <%= _('Recently described results first') %>
<% end %>
</p>
<% end %>
-<% if @bodies && !@query.nil? && @xapian_bodies.results.size == 0 && @page == 1 %>
- <h1><%= _('No public authorities found') %></h1>
- <% if @spelling_correction %>
- <p id="did_you_mean"><%= _('Did you mean: {{correction}}',
- :correction => search_link(@spelling_correction, @postfix)) %></p>
- <% end %>
- <p><%= _('<a href="%s">Browse all</a> or <a href="%s">ask us to add one</a>.') % [list_public_bodies_default, help_requesting_path + '#missing_body'] %></p>
-<% end %>
-
-<% if @total_hits == 0 %>
- <h1><%=@title %></h1>
-<% end %>
-
<% if not @query.nil? %>
<% if @spelling_correction %>
- <p id="did_you_mean"><%= _('Did you mean: {{correction}}', :correction => search_link(@spelling_correction, @postfix)) %></p>
+ <p id="did_you_mean"><%= _('Did you mean: {{correction}}', :correction => search_link(@spelling_correction, @variety_postfix, @sort_postfix, @advanced)) %></p>
<% end %>
- <% if (!@bodies || @xapian_requests.results.size == 0) && @track_thing && (@xapian_bodies.results.size > 0 || @xapian_users.results.size > 0 || @total_hits == 0)%>
+ <% if (!@bodies || @xapian_requests_hits == 0) && @track_thing && (@xapian_bodies_hits > 0 || @xapian_users_hits > 0 || @total_hits == 0)%>
<%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %>
<% end %>
- <% if @xapian_bodies.results.size > 0 %>
- <% if @xapian_bodies.results.size == 1 && @page == 1 %>
- <h1><%= _('One public authority matching &#x2018;{{user_search_query}}&#x2019;', :user_search_query => h(@query)) %></h1>
+ <% if @xapian_bodies_hits > 0 %>
+ <% if @xapian_bodies_hits == 1 && @page == 1 %>
+ <h1><%= _('One public authority matching your search', :user_search_query => h(@query)) %></h1>
<% else %>
<h1><%= _('Public authorities {{start_count}} to {{end_count}} of {{total_count}} for {{user_search_query}}', :start_count => ((@page-1)*@bodies_per_page+1).to_s, :end_count => [@page*@bodies_per_page, @xapian_bodies.matches_estimated].min.to_s, :total_count => @xapian_bodies.matches_estimated.to_s, :user_search_query => h(@query)) %></h1>
<% end %>
@@ -80,8 +146,8 @@
<%= will_paginate WillPaginate::Collection.new(@page, @bodies_per_page, @xapian_bodies.matches_estimated) %>
<% end %>
- <% if @xapian_users.results.size > 0 %>
- <% if @xapian_users.results.size == 1 && @page == 1 %>
+ <% if @xapian_users_hits > 0 %>
+ <% if @xapian_users_hits == 1 && @page == 1 %>
<h1><%= _("One person matching &#x2018;{{user_search_query}}&#x2019;", :user_search_query => h(@query)) %></h1>
<% else %>
<h1><%= _("People {{start_count}} to {{end_count}} of {{total_count}} for &#x2018;{{user_search_query}}&#x2019;", :start_count => ((@page-1)*@users_per_page+1).to_s, :end_count => [@page*@users_per_page, @xapian_users.matches_estimated].min.to_s, :total_count => @xapian_users.matches_estimated.to_s, :user_search_query => h(@query)) %></h1>
@@ -94,11 +160,11 @@
<%= will_paginate WillPaginate::Collection.new(@page, @users_per_page, @xapian_users.matches_estimated) %>
<% end %>
- <% if @xapian_requests.results.size > 0 %>
- <% if @xapian_requests.results.size == 1 && @page == 1 %>
- <h1><%= _("One FOI request matching &#x2018;{{user_search_query}}&#x2019;", :user_search_query => h(@query)) %></h1>
+ <% if @xapian_requests_hits > 0 %>
+ <% if @xapian_requests_hits == 1 && @page == 1 %>
+ <h1><%= _("One FOI request matching your search", :user_search_query => h(@query)) %></h1>
<% else %>
- <h1><%= _("FOI requests {{start_count}} to {{end_count}} of {{total_count}} for &#x2018;{{user_search_query}}&#x2019;", :start_count => ((@page-1)*@requests_per_page+1).to_s, :end_count => [@page*@requests_per_page, @xapian_requests.matches_estimated].min.to_s, :total_count => @xapian_requests.matches_estimated.to_s, :user_search_query => h(@query)) %></h1>
+ <h1><%= _("FOI requests {{start_count}} to {{end_count}} of {{total_count}}", :start_count => ((@page-1)*@requests_per_page+1).to_s, :end_count => [@page*@requests_per_page, @xapian_requests.matches_estimated].min.to_s, :total_count => @xapian_requests.matches_estimated.to_s, :user_search_query => h(@query)) %></h1>
<% end %>
<% if @track_thing %>
@@ -117,7 +183,10 @@
<% end %>
<% end %>
-<% if @show_tips %>
+<% if @advanced %>
+
+<div id="advanced-search-tips">
+ <a name="show-tips"></a>
<h2><%= _("Advanced search tips")%></h2>
<ul>
<li><%= _("Enter words that you want to find separated by spaces, e.g. <strong>climbing lane</strong>") %></li>
@@ -139,28 +208,30 @@
<h2 id="statuses"><%= _('Table of statuses') %></h2>
<table class="status_table">
- <tr><td><strong><%=search_link('status:waiting_response')%></strong></td><td><%= _('Waiting for the public authority to reply') %></td></tr>
- <tr><td><strong><%=search_link('status:not_held')%></strong></td><td><%= _('The public authority does not have the information requested') %></td></tr>
- <tr><td><strong><%=search_link('status:rejected')%></strong></td><td><%= _('The request was refused by the public authority') %></td></tr>
- <tr><td><strong><%=search_link('status:partially_successful')%></strong></td><td><%= _('Some of the information requested has been received') %></td></tr>
- <tr><td><strong><%=search_link('status:successful')%></strong></td><td><%= _('All of the information requested has been received') %></td></tr>
- <tr><td><strong><%=search_link('status:waiting_clarification')%></strong></td><td><%= _('The public authority would like part of the request explained') %></td></tr>
- <tr><td><strong><%=search_link('status:gone_postal')%></strong></td><td><%= _('The public authority would like to / has responded by post') %></td></tr>
- <tr><td><strong><%=search_link('status:internal_review')%></strong></td><td><%= _('Waiting for the public authority to complete an internal review of their handling of the request') %></td></tr>
- <tr><td><strong><%=search_link('status:error_message')%></strong></td><td><%= _('Received an error message, such as delivery failure.') %></td></tr>
- <tr><td><strong><%=search_link('status:requires_admin')%></strong></td><td><%= _('A strange reponse, required attention by the {{site_name}} team', :site_name=>site_name) %></td></tr>
- <tr><td><strong><%=search_link('status:user_withdrawn')%></strong></td><td><%= _('The requester has abandoned this request for some reason') %></td></tr>
+ <tr><td><strong><%=search_link('status:waiting_response', nil, nil, true)%></strong></td><td><%= _('Waiting for the public authority to reply') %></td></tr>
+ <tr><td><strong><%=search_link('status:not_held', nil, nil, true)%></strong></td><td><%= _('The public authority does not have the information requested') %></td></tr>
+ <tr><td><strong><%=search_link('status:rejected', nil, nil, true)%></strong></td><td><%= _('The request was refused by the public authority') %></td></tr>
+ <tr><td><strong><%=search_link('status:partially_successful', nil, nil, true)%></strong></td><td><%= _('Some of the information requested has been received') %></td></tr>
+ <tr><td><strong><%=search_link('status:successful', nil, nil, true)%></strong></td><td><%= _('All of the information requested has been received') %></td></tr>
+ <tr><td><strong><%=search_link('status:waiting_clarification', nil, nil, true)%></strong></td><td><%= _('The public authority would like part of the request explained') %></td></tr>
+ <tr><td><strong><%=search_link('status:gone_postal', nil, nil, true)%></strong></td><td><%= _('The public authority would like to / has responded by post') %></td></tr>
+ <tr><td><strong><%=search_link('status:internal_review', nil, nil, true)%></strong></td><td><%= _('Waiting for the public authority to complete an internal review of their handling of the request') %></td></tr>
+ <tr><td><strong><%=search_link('status:error_message', nil, nil, true)%></strong></td><td><%= _('Received an error message, such as delivery failure.') %></td></tr>
+ <tr><td><strong><%=search_link('status:requires_admin', nil, nil, true)%></strong></td><td><%= _('A strange reponse, required attention by the {{site_name}} team', :site_name=>site_name) %></td></tr>
+ <tr><td><strong><%=search_link('status:user_withdrawn', nil, nil, true)%></strong></td><td><%= _('The requester has abandoned this request for some reason') %></td></tr>
</table>
<h2 id="varieties"><%= _('Table of varieties') %></h2>
<table class="status_table">
- <tr><td><strong><%=search_link('variety:sent')%></strong></td><td><%= _('Original request sent') %></td></tr>
- <tr><td><strong><%=search_link('variety:followup_sent')%></strong></td><td><%= _('Follow up message sent by requester') %></td></tr>
- <tr><td><strong><%=search_link('variety:response')%></strong></td><td><%= _('Response from a public authority') %></td></tr>
- <tr><td><strong><%=search_link('variety:comment')%></strong></td><td><%= _('Annotation added to request') %></td></tr>
- <tr><td><strong><%=search_link('variety:authority')%></strong></td><td><%= _('A public authority') %></td></tr>
- <tr><td><strong><%=search_link('variety:user')%></strong></td><td><%= _('A {{site_name}} user', :site_name=>site_name) %></td></tr>
+ <tr><td><strong><%=search_link('variety:sent', nil, nil, true)%></strong></td><td><%= _('Original request sent') %></td></tr>
+ <tr><td><strong><%=search_link('variety:followup_sent', nil, nil, true)%></strong></td><td><%= _('Follow up message sent by requester') %></td></tr>
+ <tr><td><strong><%=search_link('variety:response', nil, nil, true)%></strong></td><td><%= _('Response from a public authority') %></td></tr>
+ <tr><td><strong><%=search_link('variety:comment', nil, nil, true)%></strong></td><td><%= _('Annotation added to request') %></td></tr>
+ <tr><td><strong><%=search_link('variety:authority', nil, nil, true)%></strong></td><td><%= _('A public authority') %></td></tr>
+ <tr><td><strong><%=search_link('variety:user', nil, nil, true)%></strong></td><td><%= _('A {{site_name}} user', :site_name=>site_name) %></td></tr>
</table>
+</div>
+
<% end %>
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml
index 94ec5a956..e1e7a1e19 100644
--- a/app/views/layouts/default.rhtml
+++ b/app/views/layouts/default.rhtml
@@ -15,9 +15,10 @@
<%= site_name %> - <%= _('Make and browse Freedom of Information (FOI) requests') %>
<% end %>
</title>
-
+
<link rel="shortcut icon" href="/favicon.ico">
-
+ <%= javascript_include_tag 'jquery.js', 'jquery-ui.min' %>
+ <%= stylesheet_link_tag 'admin-theme/jquery-ui-1.8.15.custom.css', :rel => 'stylesheet'%>
<%= stylesheet_link_tag 'main', :title => "Main", :rel => "stylesheet" %>
<!--[if LT IE 7]>
<style type="text/css">@import url("/stylesheets/ie6.css");</style>
diff --git a/app/views/public_body/list.rhtml b/app/views/public_body/list.rhtml
index 5d88b1501..c8a89ed3a 100644
--- a/app/views/public_body/list.rhtml
+++ b/app/views/public_body/list.rhtml
@@ -38,14 +38,19 @@
<h1><%=@title%></h1>
+<% form_tag(request.url, :method => "get") do %>
+ <div>
+ <%= label_tag(:public_body_query, _("Search:")) %>
+ <%= text_field_tag(:public_body_query, params[:public_body_query]) %>
+ <%= submit_tag(_("Search")) %>
+ </div>
+<% end %>
+
<p class="subtitle">
<%= @public_bodies.size %> <%= _('in total') %>
(<%= _('<a href="%s">can\'t find the one you want?</a>') % [help_requesting_path + '#missing_body'] %>)
</p>
-<% if @tag.size == 1 %>
- <p><%= render :partial => 'alphabet' %></p>
-<% end %>
<%= render :partial => 'body_listing', :locals => { :public_bodies => @public_bodies } %>
<% if @tag.size == 1 && @public_bodies.size > 0 %>
<p><%= render :partial => 'alphabet' %></p>
diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml
index 36bba8851..1151b9966 100644
--- a/app/views/public_body/show.rhtml
+++ b/app/views/public_body/show.rhtml
@@ -64,7 +64,7 @@
</div>
<% if !@xapian_requests.nil? %>
- <% if @xapian_requests.results.empty? %>
+ <% if @public_body.info_requests.size == 0 %>
<% if @public_body.eir_only? %>
<h2><%= _('Environmental Information Regulations requests made using this site') %></h2>
<p>Nobody has made any Environmental Information Regulations requests to <%=h(@public_body.name)%> using this site yet.</p>
@@ -82,13 +82,19 @@
<%= @page_desc %>
</h2>
+ <%= render :partial => 'request/request_filter_form' %>
+
<% for result in @xapian_requests.results %>
<%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %>
<% end %>
<%= will_paginate WillPaginate::Collection.new(@page, @per_page, @public_body.info_requests.size) %>
- <p> <%= _('Only requests made using {{site_name}} are shown.', :site_name => site_name) %></p>
+ <% if @xapian_requests.results.empty? %>
+ <p><% _('There were no requests matching your query.') %></p>
+ <% else %>
+ <p> <%= _('Only requests made using {{site_name}} are shown.', :site_name => site_name) %></p>
+ <% end %>
<% end %>
<% else %>
diff --git a/app/views/request/_request_filter_form.rhtml b/app/views/request/_request_filter_form.rhtml
new file mode 100644
index 000000000..33b7bfb27
--- /dev/null
+++ b/app/views/request/_request_filter_form.rhtml
@@ -0,0 +1,55 @@
+<%= render :partial => 'general/localised_datepicker' %>
+
+<div id="list-filter">
+ <div class="list-filter-item">
+ Showing:
+ <ul class="request-selector">
+ <% for status, label in [["all", _("all requests")],
+ ["successful", _("successful requests")],
+ ["unsuccessful", _("unsuccessful requests")],
+ ["awaiting", _("unresolved requests")]] %>
+ <li>
+ <% if params[:view] != status %>
+ <% if params[:controller] == "public_body"
+
+ %>
+ <%= link_to label, url_for(:controller => "public_body", :action => "show", :view => status, :url_name => @public_body.url_name) + "?" + request.query_string %>
+ <% else %>
+ <%= link_to label, url_for(:controller => "request", :action => "list", :view => status) + "?" + request.query_string %>
+ <% end %>
+ <% else %>
+ <%= label %>
+ <% end %>
+ </li>
+ <% end %>
+ </ul>
+ </div>
+ <% form_tag(request.path, :method => "get") do %>
+ <div class="list-filter-item">
+ <%= label_tag(:query, _("Search for:")) %>
+ <%= text_field_tag(:query, params[:query]) %>
+ </div>
+<% if false # don't think we want this, but leaving as an example %>
+ <div class="list-filter-item">
+ <%= _("Search for words in:") %> <br/>
+ <% [["sent", _("messages from users")],
+ ["response", _("messages from authorities")],
+ ["comment", _("comments")]].each_with_index do |item, index|
+ variety, title = item %>
+
+ <%= check_box_tag "request_variety[]", variety, params[:request_variety].nil? ? true : params[:request_variety].include?(variety), :id => "request_variety_#{index}" %>
+ <%= label_tag("request_variety_#{index}", title) %> <br/>
+ <% end %>
+ </div>
+<% end %>
+ <div class="list-filter-item">
+ Search between dates:
+ <%= text_field_tag(:request_date_after, params[:request_date_after], {:class => "use-datepicker", :size => 10}) %> -
+ <%= text_field_tag(:request_date_before, params[:request_date_before], {:class => "use-datepicker", :size => 10}) %>
+ </div>
+
+ <div class="list-filter-item">
+ <%= submit_tag("Search") %>
+ </div>
+<% end %>
+</div>
diff --git a/app/views/request/list.rhtml b/app/views/request/list.rhtml
index 04dc0d010..a434566ac 100644
--- a/app/views/request/list.rhtml
+++ b/app/views/request/list.rhtml
@@ -1,19 +1,9 @@
-<div id="list_sidebar">
-<h1><%= _('Show only...')%></h1>
-<ul>
-<% for view, description, target in [
- ['successful', _('Successful responses'), request_list_successful_url(:view => 'successful')],
- ['recent', _('Recently sent requests'), request_list_recent_url(:view => 'recent')]
-] %>
-<li>
- <%= link_to_unless (@view == view), description, target %>
-</li>
-<% end %>
-</ul>
-</div>
+
<h1><%=@title%></h1>
+<%= render :partial => 'request/request_filter_form' %>
+
<% if @track_thing %>
<%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %>
<% end %>
diff --git a/app/views/user/_signup.rhtml b/app/views/user/_signup.rhtml
index 6b0a1f8c7..210643a40 100644
--- a/app/views/user/_signup.rhtml
+++ b/app/views/user/_signup.rhtml
@@ -10,8 +10,8 @@
<%= text_field 'user_signup', 'email', { :size => 20 } %>
</p>
<div class="form_item_note">
- <%= ('We will not reveal your email address to anybody unless you or
- the law tell us to (<a href="%s">_details</a>). ') %[help_privacy_path] %>
+ <%= _('We will not reveal your email address to anybody unless you or
+ the law tell us to (<a href="%s">details</a>). ') %[help_privacy_path] %>
</div>
<p>
@@ -36,6 +36,10 @@
<%= password_field 'user_signup', 'password_confirmation', { :size => 15 } %>
</p>
+ <% if @request_from_foreign_country %>
+ <%= recaptcha_tags %>
+ <% end %>
+
<div class="form_button">
<%= hidden_field_tag 'token', params[:token], { :id => 'signup_token' } %>
<%= submit_tag _('Sign up') %>
diff --git a/config/crontab.ugly b/config/crontab.ugly
index ecd3151ff..5f2fbdb3b 100644
--- a/config/crontab.ugly
+++ b/config/crontab.ugly
@@ -28,7 +28,7 @@ MAILTO=cron-!!(*= $site *)!!@mysociety.org
2 4 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/check-recent-requests-sent.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/check-recent-requests-sent || echo "stalled?"
45 3 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/stop-new-responses-on-old-requests.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/stop-new-responses-on-old-requests || echo "stalled?"
# Only root can restart apache
-31 1 * * * root run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/compact-xapian-database.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/compact-xapian-database production || echo "stalled?"
+31 1 * * * root run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/compact-xapian-database.lock "/data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/compact-xapian-database production" || echo "stalled?"
# Once a day on all servers
diff --git a/config/general.yml-example b/config/general.yml-example
index 5eee675ff..48e8523ef 100644
--- a/config/general.yml-example
+++ b/config/general.yml-example
@@ -12,6 +12,10 @@ SITE_NAME: 'Alaveteli'
# Domain used in URLs generated by scripts (e.g. for going in some emails)
DOMAIN: '127.0.0.1:3000'
+# ISO country code of country currrently deployed in
+# (http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
+ISO_COUNTRY_CODE: GB
+
# These feeds are displayed accordingly on the Alaveteli "blog" page:
BLOG_FEED: 'http://www.mysociety.org/category/projects/whatdotheyknow/feed/'
TWITTER_USERNAME: 'whatdotheyknow'
@@ -27,9 +31,6 @@ REPLY_VERY_LATE_AFTER_DAYS: 40
# We give some types of authority like schools a bit longer than everyone else
SPECIAL_REPLY_VERY_LATE_AFTER_DAYS: 60
-# example searches for the home page, semicolon delimited.
-FRONTPAGE_SEARCH_EXAMPLES: 'Geraldine Quango; Department for Humpadinking'
-
# example public bodies for the home page, semicolon delimited - short_names
FRONTPAGE_PUBLICBODY_EXAMPLES: 'tgq'
@@ -109,3 +110,5 @@ DEBUG_RECORD_MEMORY: false
# be another reason to try this setting.
USE_GHOSTSCRIPT_COMPRESSION: true
+# mySociety's gazeteer service. Shouldn't change.
+GAZE_URL: http://gaze.mysociety.org
diff --git a/config/routes.rb b/config/routes.rb
index c16c10eb9..c067de4e5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -23,7 +23,9 @@ ActionController::Routing::Routes.draw do |map|
# Couldn't find a way to do this in routes which also picked up multiple other slashes
# and dots and other characters that can appear in search query. So we sort it all
# out in the controller.
- general.search_general '/search/*combined', :action => 'search'
+ general.search_general '/search/*combined/all', :action => 'search', :view => 'all'
+ general.search_general '/search/*combined', :action => 'search'
+ general.advanced_search '/advancedsearch', :action => 'search_redirect', :advanced => true
general.random_request '/random', :action => 'random_request'
@@ -32,7 +34,10 @@ ActionController::Routing::Routes.draw do |map|
map.with_options :controller => 'request' do |request|
request.request_list_recent '/list/recent', :action => 'list', :view => 'recent'
+ request.request_list_all '/list/all', :action => 'list', :view => 'all'
request.request_list_successful '/list/successful', :action => 'list', :view => 'successful'
+ request.request_list_unsuccessful '/list/unsuccessful', :action => 'list', :view => 'unsuccessful'
+ request.request_list_awaiting '/list/awaiting', :action => 'list', :view => 'awaiting'
request.request_list '/list', :action => 'list'
request.new_request '/new', :action => 'new'
@@ -81,10 +86,18 @@ ActionController::Routing::Routes.draw do |map|
map.with_options :controller => 'public_body' do |body|
body.list_public_bodies "/body", :action => 'list'
+ body.list_public_bodies_default "/body/list/all", :action => 'list'
body.list_public_bodies "/body/list/:tag", :action => 'list'
body.list_public_bodies_redirect "/local/:tag", :action => 'list_redirect'
body.all_public_bodies_csv "/body/all-authorities.csv", :action => 'list_all_csv'
- body.show_public_body "/body/:url_name.:format", :action => 'show'
+ body.show_public_body "/body/:url_name.:format", :action => 'show', :view => 'all'
+ body.show_public_body_all "/body/:url_name/all", :action => 'show', :view => 'all'
+ body.show_public_body_successful "/body/:url_name/successful", :action => 'show', :view => "successful"
+ body.show_public_body_unsuccessful "/body/:url_name/unsuccessful", :action => 'show', :view => "unsuccessful"
+ body.show_public_body_awaiting "/body/:url_name/awaiting", :action => 'show', :view => "awaiting"
+ body.show_public_body_tag "/body/:url_name/:tag", :action => 'show'
+ body.show_public_body_tag_view "/body/:url_name/:tag/:view", :action => 'show'
+
body.view_public_body_email "/body/:url_name/view_email", :action => 'view_email'
end
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
new file mode 100644
index 000000000..c57e89130
--- /dev/null
+++ b/doc/CHANGES.md
@@ -0,0 +1,8 @@
+# Version 0.3
+
+## Highlighted features
+* New search filters / UI on request page, authorities page, and search page. Upgrades require a rebuild of the Xapian index (`./script/xapian-index-rebuild`). Design isn't beautiful; to be fixed in next release.
+* Introduce reCaptcha for people apparently coming from foreign countries (to combat spam) (requires values for new config variables `ISO_COUNTRY_CODE` and `GAZE_URL`, and existing config variables `RECAPTCHA_PUBLIC_KEY` and `RECAPTCHA_PRIVATE_KEY`)
+* Better admin interface for editing multiple translations of a public body at once
+## Other
+* [Full list of changes on github](https://github.com/sebbacon/alaveteli/issues?milestone=5&state=closed)
diff --git a/public/javascripts/jquery-ui.min.js b/public/javascripts/jquery-ui.min.js
index d9d450a7e..35d983f43 100755..100644
--- a/public/javascripts/jquery-ui.min.js
+++ b/public/javascripts/jquery-ui.min.js
@@ -1,5 +1,5 @@
/*!
- * jQuery UI 1.8.15
+ * jQuery UI 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
@@ -7,7 +7,7 @@
*
* http://docs.jquery.com/UI
*/
-(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.15",
+(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=
this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
@@ -17,7 +17,7 @@ outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=functio
a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&
c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;/*!
- * jQuery UI Widget 1.8.15
+ * jQuery UI Widget 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
@@ -25,47 +25,14 @@ c.ui.isOverAxis(b,e,i)}})}})(jQuery);
*
* http://docs.jquery.com/UI/Widget
*/
-(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
-a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
-e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
-this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
-widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
-enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
-;/*!
- * jQuery UI Mouse 1.8.15
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Mouse
- *
- * Depends:
- * jquery.ui.widget.js
- */
-(function(b){b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent=
-a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,e=a.which==1,f=typeof this.options.cancel=="string"?b(a.target).closest(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=this._mouseStart(a)!==
-false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(d){return c._mouseMove(d)};this._mouseUpDelegate=function(d){return c._mouseUp(d)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return a.originalEvent.mouseHandled=true}},_mouseMove:function(a){if(b.browser.msie&&
-!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
-false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
+(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)try{b(d).triggerHandler("remove")}catch(e){}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(d){}});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=
+function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):
+d;if(e&&d.charAt(0)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=
+b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
+c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*
- * jQuery UI Position 1.8.15
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Position
- */
-(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
-left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
-k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
-m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
-d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
-a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
-g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
-;/*
- * jQuery UI Tabs 1.8.15
+ * jQuery UI Tabs 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
@@ -97,6 +64,89 @@ if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1<this
this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this},
load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c,
"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},
-url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.15"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k<a.anchors.length?k:0)},b);j&&j.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(j){j.clientX&&
+url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.16"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k<a.anchors.length?k:0)},b);j&&j.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(j){j.clientX&&
a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow",h);this.anchors.bind(c.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(c.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);
+;/*
+ * jQuery UI Datepicker 1.8.16
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Datepicker
+ *
+ * Depends:
+ * jquery.ui.core.js
+ */
+(function(d,C){function M(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
+"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
+"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",
+minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false,disabled:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=N(d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function N(a){return a.bind("mouseout",
+function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");b.length&&b.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");if(!(d.datepicker._isDisabledDatepicker(J.inline?a.parent()[0]:J.input[0])||!b.length)){b.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
+b.addClass("ui-state-hover");b.hasClass("ui-datepicker-prev")&&b.addClass("ui-datepicker-prev-hover");b.hasClass("ui-datepicker-next")&&b.addClass("ui-datepicker-next-hover")}})}function H(a,b){d.extend(a,b);for(var c in b)if(b[c]==null||b[c]==C)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.16"}});var B=(new Date).getTime(),J;d.extend(M.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},
+setDefaults:function(a){H(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,
+"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:N(d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",
+function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b);b.settings.disabled&&this._disableDatepicker(a)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c==
+"focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():
+d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,
+b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),true);this._updateDatepicker(b);this._updateAlternate(b);b.settings.disabled&&this._disableDatepicker(a);b.dpDiv.css("display","block")}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=
+1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}H(a.settings,e||{});b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/
+2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=
+d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=
+a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().removeClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,
+"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().addClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==
+a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?
+d.extend({},e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&this._hideDatepicker();var h=this._getDateDatepicker(a,true),i=this._getMinMaxDate(e,"min"),g=this._getMinMaxDate(e,"max");H(e.settings,f);if(i!==null&&f.dateFormat!==C&&f.minDate===C)e.settings.minDate=this._formatDate(e,i);if(g!==null&&f.dateFormat!==C&&f.maxDate===C)e.settings.maxDate=this._formatDate(e,g);this._attachments(d(a),e);this._autoSize(e);this._setDate(e,h);this._updateAlternate(e);
+this._updateDatepicker(e)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");
+b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass+":not(."+d.datepicker._currentClass+")",b.dpDiv);c[0]&&d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]);if(a=d.datepicker._get(b,"onSelect")){c=d.datepicker._formatDate(b);a.apply(b.input?b.input[0]:null,[c,b])}else d.datepicker._hideDatepicker();return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,
+a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=
+a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,
+"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));var c=String.fromCharCode(a.charCode==C?a.keyCode:a.charCode);
+return a.ctrlKey||a.metaKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",
+a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);if(d.datepicker._curInst&&d.datepicker._curInst!=b){d.datepicker._datepickerShowing&&d.datepicker._triggerOnClose(d.datepicker._curInst);d.datepicker._curInst.dpDiv.stop(true,true)}var c=d.datepicker._get(b,"beforeShow");c=c?c.apply(a,[a,b]):{};if(c!==false){H(b.settings,c);b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value=
+"";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);
+c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){var i=b.dpDiv.find("iframe.ui-datepicker-cover");if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.datepicker._datepickerShowing=
+true;d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}}},_updateDatepicker:function(a){this.maxRows=4;var b=d.datepicker._getBorders(a.dpDiv);J=a;a.dpDiv.empty().append(this._generateHTML(a));var c=a.dpDiv.find("iframe.ui-datepicker-cover");c.length&&c.css({left:-b[0],top:-b[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});
+a.dpDiv.find("."+this._dayOverClass+" a").mouseover();b=this._getNumberOfMonths(a);c=b[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");c>1&&a.dpDiv.addClass("ui-datepicker-multi-"+c).css("width",17*c+"em");a.dpDiv[(b[0]!=1||b[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&
+!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var e=a.yearshtml;setTimeout(function(){e===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);e=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),
+h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=
+this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_triggerOnClose:function(a){var b=this._get(a,"onClose");if(b)b.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a])},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);
+this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();d.datepicker._triggerOnClose(b);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},
+_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):
+0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e["selected"+(c=="M"?
+"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);
+this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");
+if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?
+b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()%100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=A+1<a.length&&a.charAt(A+1)==p)&&A++;return p},m=function(p){var D=
+o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"&&D?4:p=="o"?3:2)+"}");p=b.substring(q).match(p);if(!p)throw"Missing number at position "+q;q+=p[0].length;return parseInt(p[0],10)},n=function(p,D,K){p=d.map(o(p)?K:D,function(w,x){return[[x,w]]}).sort(function(w,x){return-(w[1].length-x[1].length)});var E=-1;d.each(p,function(w,x){w=x[1];if(b.substr(q,w.length).toLowerCase()==w.toLowerCase()){E=x[0];q+=w.length;return false}});if(E!=-1)return E+1;else throw"Unknown name at position "+q;},s=
+function(){if(b.charAt(q)!=a.charAt(A))throw"Unexpected literal at position "+q;q++},q=0,A=0;A<a.length;A++)if(k)if(a.charAt(A)=="'"&&!o("'"))k=false;else s();else switch(a.charAt(A)){case "d":l=m("d");break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":j=m("m");break;case "M":j=n("M",i,g);break;case "y":c=m("y");break;case "@":var v=new Date(m("@"));c=v.getFullYear();j=v.getMonth()+1;l=v.getDate();break;case "!":v=new Date((m("!")-this._ticksTo1970)/1E4);c=v.getFullYear();j=v.getMonth()+
+1;l=v.getDate();break;case "'":if(o("'"))s();else k=true;break;default:s()}if(q<b.length)throw"Extra/unparsed characters found in date: "+b.substring(q);if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,j-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=j||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",
+COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:
+null)||this._defaults.monthNames;var i=function(o){(o=k+1<a.length&&a.charAt(k+1)==o)&&k++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},j=function(o,m,n,s){return i(o)?s[m]:n[m]},l="",u=false;if(b)for(var k=0;k<a.length;k++)if(u)if(a.charAt(k)=="'"&&!i("'"))u=false;else l+=a.charAt(k);else switch(a.charAt(k)){case "d":l+=g("d",b.getDate(),2);break;case "D":l+=j("D",b.getDay(),e,f);break;case "o":l+=g("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-
+(new Date(b.getFullYear(),0,0)).getTime())/864E5),3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=j("M",b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+="'";else u=true;break;default:l+=a.charAt(k)}return l},_possibleChars:function(a){for(var b="",c=false,e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=
+0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==C?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);
+var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var e=function(h){var i=new Date;
+i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,j=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,k=u.exec(h);k;){switch(k[2]||"d"){case "d":case "D":g+=parseInt(k[1],10);break;case "w":case "W":g+=parseInt(k[1],10)*7;break;case "m":case "M":l+=parseInt(k[1],10);g=
+Math.min(g,d.datepicker._getDaysInMonth(j,l));break;case "y":case "Y":j+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break}k=u.exec(h)}return new Date(j,l,g)};if(b=(b=b==null||b===""?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):new Date(b.getTime()))&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>
+12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&
+a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?
+new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&n<k?k:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));
+n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+B+".datepicker._adjustDate('#"+a.id+"', -"+j+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>";var s=this._get(a,"nextText");s=!h?s:this.formatDate(s,this._daylightSavingAdjust(new Date(m,
+g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+B+".datepicker._adjustDate('#"+a.id+"', +"+j+", 'M');\" title=\""+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>";j=this._get(a,"currentText");s=this._get(a,"gotoCurrent")&&
+a.currentDay?u:b;j=!h?j:this.formatDate(j,s,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+B+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,s)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+
+B+".datepicker._gotoToday('#"+a.id+"');\">"+j+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");s=this._get(a,"dayNames");this._get(a,"dayNamesShort");var q=this._get(a,"dayNamesMin"),A=this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),D=this._get(a,"showOtherMonths"),K=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var E=this._getDefaultDate(a),w="",x=0;x<i[0];x++){var O=
+"";this.maxRows=4;for(var G=0;G<i[1];G++){var P=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",y="";if(l){y+='<div class="ui-datepicker-group';if(i[1]>1)switch(G){case 0:y+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-1:y+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:y+=" ui-datepicker-group-middle";t="";break}y+='">'}y+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&
+x==0?c?f:n:"")+(/all|right/.test(t)&&x==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,x>0||G>0,A,v)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var z=j?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var r=(t+h)%7;z+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+s[r]+'">'+q[r]+"</span></th>"}y+=z+"</tr></thead><tbody>";z=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,
+z);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;z=Math.ceil((t+z)/7);this.maxRows=z=l?this.maxRows>z?this.maxRows:z:z;r=this._daylightSavingAdjust(new Date(m,g,1-t));for(var Q=0;Q<z;Q++){y+="<tr>";var R=!j?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(r)+"</td>";for(t=0;t<7;t++){var I=p?p.apply(a.input?a.input[0]:null,[r]):[true,""],F=r.getMonth()!=g,L=F&&!K||!I[0]||k&&r<k||o&&r>o;R+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(r.getTime()==
+P.getTime()&&g==a.selectedMonth&&a._keyEvent||E.getTime()==r.getTime()&&E.getTime()==P.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!D?"":" "+I[1]+(r.getTime()==u.getTime()?" "+this._currentClass:"")+(r.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!F||D)&&I[2]?' title="'+I[2]+'"':"")+(L?"":' onclick="DP_jQuery_'+B+".datepicker._selectDay('#"+a.id+"',"+r.getMonth()+","+r.getFullYear()+', this);return false;"')+">"+(F&&!D?"&#xa0;":L?'<span class="ui-state-default">'+
+r.getDate()+"</span>":'<a class="ui-state-default'+(r.getTime()==b.getTime()?" ui-state-highlight":"")+(r.getTime()==u.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+'" href="#">'+r.getDate()+"</a>")+"</td>";r.setDate(r.getDate()+1);r=this._daylightSavingAdjust(r)}y+=R+"</tr>"}g++;if(g>11){g=0;m++}y+="</tbody></table>"+(l?"</div>"+(i[0]>0&&G==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");O+=y}w+=O}w+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':
+"");a._keyEvent=false;return w},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='<div class="ui-datepicker-title">',o="";if(h||!j)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+B+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" >";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&
+(!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(k+=o+(h||!(j&&l)?"&#xa0;":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var s=(new Date).getFullYear();i=function(q){q=q.match(/c[+-].*/)?c+parseInt(q.substring(1),10):q.match(/[+-].*/)?s+parseInt(q,10):parseInt(q,10);return isNaN(q)?s:q};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,
+e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+B+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" >";b<=g;b++)a.yearshtml+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";a.yearshtml+="</select>";k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?"&#xa0;":"")+o;k+="</div>";return k},_adjustInstDate:function(a,b,c){var e=a.drawYear+(c=="Y"?b:0),f=a.drawMonth+
+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");if(b)b.apply(a.input?
+a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);c=this._daylightSavingAdjust(new Date(c,
+e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,
+"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=function(a){if(!this.length)return this;
+if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));return this.each(function(){typeof a==
+"string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new M;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.16";window["DP_jQuery_"+B]=d})(jQuery);
; \ No newline at end of file
diff --git a/public/stylesheets/admin-theme/jquery-ui-1.8.15.custom.css b/public/stylesheets/admin-theme/jquery-ui-1.8.15.custom.css
index 50a77d629..ea0254a2b 100755
--- a/public/stylesheets/admin-theme/jquery-ui-1.8.15.custom.css
+++ b/public/stylesheets/admin-theme/jquery-ui-1.8.15.custom.css
@@ -1,5 +1,5 @@
/*
- * jQuery UI CSS Framework 1.8.15
+ * jQuery UI CSS Framework 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
@@ -42,7 +42,7 @@
/*
- * jQuery UI CSS Framework 1.8.15
+ * jQuery UI CSS Framework 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
@@ -50,13 +50,13 @@
*
* http://docs.jquery.com/UI/Theming/API
*
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=01_flat.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=01_flat.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=01_flat.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=01_flat.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=05_inset_soft.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=01_flat.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=01_flat.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=01_flat.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=01_flat.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=01_flat.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
*/
/* Component containers
----------------------------------*/
-.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
+.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: ; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
@@ -78,7 +78,7 @@
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_flat_55_fbf9ee_40x100.png) 50% 50% repeat-x; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
-.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_inset-soft_95_fef1ec_1x100.png) 50% bottom repeat-x; color: #cd0a0a; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_flat_95_fef1ec_40x100.png) 50% 50% repeat-x; color: #cd0a0a; }
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
@@ -288,7 +288,7 @@
/* Overlays */
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
- * jQuery UI Tabs 1.8.15
+ * jQuery UI Tabs 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
@@ -305,3 +305,71 @@
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
.ui-tabs .ui-tabs-hide { display: none !important; }
+/*
+ * jQuery UI Datepicker 1.8.16
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Datepicker#theming
+ */
+.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+ display: none; /*sorry for IE5*/
+ display/**/: block; /*sorry for IE5*/
+ position: absolute; /*must have*/
+ z-index: -1; /*must have*/
+ filter: mask(); /*must have*/
+ top: -4px; /*must have*/
+ left: -4px; /*must have*/
+ width: 200px; /*must have*/
+ height: 200px; /*must have*/
+} \ No newline at end of file
diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css
index 28b2762ab..fa7157b8a 100644
--- a/public/stylesheets/main.css
+++ b/public/stylesheets/main.css
@@ -1238,4 +1238,14 @@ div.lang {
div#user_locale_switcher {
margin: 5px;
-} \ No newline at end of file
+}
+
+
+div#common-subfilters {
+ float: left;
+ width: 300px;
+}
+
+div#requests-subfilters {
+ margin-left: 300px;
+}
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index 3640a8148..4d7f1831d 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -64,7 +64,7 @@ describe GeneralController, "when searching" do
it "should redirect from search query URL to pretty URL" do
post :search_redirect, :query => "mouse" # query hidden in POST parameters
- response.should redirect_to(:action => 'search', :combined => "mouse") # URL /search/:query
+ response.should redirect_to(:action => 'search', :combined => "mouse", :view => "all") # URL /search/:query/all
end
describe "when using different locale settings" do
@@ -122,6 +122,34 @@ describe GeneralController, "when searching" do
end
+ it "should filter results based on end of URL being 'all'" do
+ get :search, :combined => ['"bob"', "all"]
+ assigns[:xapian_requests].results.size.should == 2
+ assigns[:xapian_users].results.size.should == 1
+ assigns[:xapian_bodies].results.size.should == 0
+ end
+
+ it "should filter results based on end of URL being 'users'" do
+ get :search, :combined => ['"bob"', "users"]
+ assigns[:xapian_requests].should == nil
+ assigns[:xapian_users].results.size.should == 1
+ assigns[:xapian_bodies].should == nil
+ end
+
+ it "should filter results based on end of URL being 'requests'" do
+ get :search, :combined => ['"bob"', "requests"]
+ assigns[:xapian_requests].results.size.should == 2
+ assigns[:xapian_users].should == nil
+ assigns[:xapian_bodies].should == nil
+ end
+
+ it "should filter results based on end of URL being 'bodies'" do
+ get :search, :combined => ['"quango"', "bodies"]
+ assigns[:xapian_requests].should == nil
+ assigns[:xapian_users].should == nil
+ assigns[:xapian_bodies].results.size.should == 1
+ end
+
it "should show help when searching for nothing" do
get :search_redirect, :query => nil
response.should render_template('search')
diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb
index 0050678d2..df3fc10dc 100644
--- a/spec/controllers/public_body_controller_spec.rb
+++ b/spec/controllers/public_body_controller_spec.rb
@@ -7,47 +7,54 @@ describe PublicBodyController, "when showing a body" do
fixtures :public_bodies, :public_body_translations, :public_body_versions
it "should be successful" do
- get :show, :url_name => "dfh"
+ get :show, :url_name => "dfh", :view => 'all'
response.should be_success
end
it "should render with 'show' template" do
- get :show, :url_name => "dfh"
+ get :show, :url_name => "dfh", :view => 'all'
response.should render_template('show')
end
it "should assign the body" do
- get :show, :url_name => "dfh"
+ get :show, :url_name => "dfh", :view => 'all'
assigns[:public_body].should == public_bodies(:humpadink_public_body)
end
+ it "should assign the requests" do
+ get :show, :url_name => "tgq", :view => 'all'
+ assigns[:xapian_requests].results.count.should == 2
+ get :show, :url_name => "tgq", :view => 'successful'
+ assigns[:xapian_requests].results.count.should == 0
+ end
+
it "should assign the body using different locale from that used for url_name" do
PublicBody.with_locale(:es) do
- get :show, {:url_name => "dfh"}
+ get :show, {:url_name => "dfh", :view => 'all'}
assigns[:public_body].notes.should == "Baguette"
end
end
it "should assign the body using same locale as that used in url_name" do
PublicBody.with_locale(:es) do
- get :show, {:url_name => "edfh"}
+ get :show, {:url_name => "edfh", :view => 'all'}
assigns[:public_body].notes.should == "Baguette"
end
end
it "should redirect use to the relevant locale even when url_name is for a different locale" do
ActionController::Routing::Routes.filters.clear
- get :show, {:url_name => "edfh"}
+ get :show, {:url_name => "edfh", :view => 'all'}
response.should redirect_to "http://test.host/body/dfh"
end
it "should redirect to newest name if you use historic name of public body in URL" do
- get :show, :url_name => "hdink"
+ get :show, :url_name => "hdink", :view => 'all'
response.should redirect_to(:controller => 'public_body', :action => 'show', :url_name => "dfh")
end
it "should redirect to lower case name if you use mixed case name in URL" do
- get :show, :url_name => "dFh"
+ get :show, :url_name => "dFh", :view => 'all'
response.should redirect_to(:controller => 'public_body', :action => 'show', :url_name => "dfh")
end
end
@@ -71,6 +78,16 @@ describe PublicBodyController, "when listing bodies" do
assigns[:description].should == "all"
end
+ it "should support simple searching of bodies by title" do
+ get :list, :public_body_query => 'quango'
+ assigns[:public_bodies].should == [ public_bodies(:geraldine_public_body) ]
+ end
+
+ it "should support simple searching of bodies by notes" do
+ get :list, :public_body_query => 'Albatross'
+ assigns[:public_bodies].should == [ public_bodies(:humpadink_public_body) ]
+ end
+
it "should list bodies in alphabetical order with different locale" do
I18n.default_locale = :es
get :list
@@ -128,7 +145,7 @@ describe PublicBodyController, "when showing JSON version for API" do
fixtures :public_bodies, :public_body_translations
it "should be successful" do
- get :show, :url_name => "dfh", :format => "json"
+ get :show, :url_name => "dfh", :format => "json", :view => 'all'
pb = JSON.parse(response.body)
pb.class.to_s.should == 'Hash'
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index f69cf414c..f3084af12 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -1,7 +1,3 @@
-# £2k p/a
-# talk about margins
-#
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'json'
@@ -24,13 +20,29 @@ describe RequestController, "when listing recent requests" do
response.should render_template('list')
end
+ it "should filter requests" do
+ get :list, :view => 'all'
+ assigns[:list_results].size.should == 2
+ get :list, :view => 'successful'
+ assigns[:list_results].size.should == 0
+ end
+
+ it "should filter requests by date" do
+ get :list, :view => 'all', :request_date_before => '13/10/2007'
+ assigns[:list_results].size.should == 1
+ get :list, :view => 'all', :request_date_after => '13/10/2007'
+ assigns[:list_results].size.should == 1
+ get :list, :view => 'all', :request_date_after => '10/10/2007', :request_date_before => '01/01/2010'
+ assigns[:list_results].size.should == 2
+ end
+
it "should assign the first page of results" do
xap_results = mock_model(ActsAsXapian::Search,
:results => (1..25).to_a.map { |m| { :model => m } },
:matches_estimated => 103)
InfoRequest.should_receive(:full_search).
- with([InfoRequestEvent],"variety:sent", "created_at", anything, anything, anything, anything).
+ with([InfoRequestEvent]," variety:sent", "created_at", anything, anything, anything, anything).
and_return(xap_results)
get :list, :view => 'recent'
assigns[:list_results].size.should == 25
@@ -149,7 +161,7 @@ describe RequestController, "when showing one request" do
lambda {
get :get_attachment, :incoming_message_id => ir.incoming_messages[1].id, :id => ir.id, :part => 2,
:file_name => ['http://trying.to.hack']
- }.should raise_error(RuntimeError)
+ }.should raise_error(ActiveRecord::RecordNotFound)
end
it "should censor attachments downloaded as binary" do
@@ -735,18 +747,16 @@ describe RequestController, "when classifying an information request" do
response.should redirect_to(:controller => 'help', :action => 'unhappy', :url_title => @dog_request.url_title)
end
- describe "when using custom statuses from the theme" do
+ it "knows about extended states" do
InfoRequest.send(:require, File.expand_path(File.join(File.dirname(__FILE__), '..', 'models', 'customstates')))
InfoRequest.send(:include, InfoRequestCustomStates)
InfoRequest.class_eval('@@custom_states_loaded = true')
RequestController.send(:require, File.expand_path(File.join(File.dirname(__FILE__), '..', 'models', 'customstates')))
RequestController.send(:include, RequestControllerCustomStates)
RequestController.class_eval('@@custom_states_loaded = true')
- it "knows about extended states" do
- Time.stub!(:now).and_return(Time.utc(2007, 11, 10, 00, 01))
- post_status('deadline_extended')
- flash[:notice].should == 'Authority has requested extension of the deadline.'
- end
+ Time.stub!(:now).and_return(Time.utc(2007, 11, 10, 00, 01))
+ post_status('deadline_extended')
+ flash[:notice].should == 'Authority has requested extension of the deadline.'
end
end
diff --git a/spec/integration/errors_spec.rb b/spec/integration/errors_spec.rb
new file mode 100644
index 000000000..84a44c9c3
--- /dev/null
+++ b/spec/integration/errors_spec.rb
@@ -0,0 +1,61 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+module TestCustomStates
+ def self.included(base)
+ base.extend(ClassMethods)
+ end
+
+ module ClassMethods
+ def theme_extra_states
+ return ['crotchety']
+ end
+ end
+end
+
+
+describe "When rendering errors" do
+
+ fixtures [ :info_requests,
+ :info_request_events,
+ :public_bodies,
+ :public_body_translations,
+ :users,
+ :raw_emails,
+ :outgoing_messages,
+ :incoming_messages,
+ :comments ]
+
+ before(:each) do
+ load_raw_emails_data(raw_emails)
+ ActionController::Base.consider_all_requests_local = false
+ end
+
+ after(:each) do
+ ActionController::Base.consider_all_requests_local = true
+ end
+
+ it "should render a 404 for unrouteable URLs" do
+ get("/frobsnasm")
+ response.code.should == "404"
+ response.body.should include("The page doesn't exist")
+ end
+ it "should render a 404 for users that don't exist" do
+ get("/user/wobsnasm")
+ response.code.should == "404"
+ end
+ it "should render a 404 for bodies that don't exist" do
+ get("/body/wobsnasm")
+ response.code.should == "404"
+ end
+ it "should render a 500 for general errors" do
+ ir = info_requests(:naughty_chicken_request)
+ InfoRequest.send(:include, TestCustomStates)
+ InfoRequest.class_eval('@@custom_states_loaded = true')
+ ir.set_described_state("crotchety")
+ ir.save!
+ InfoRequest.class_eval('@@custom_states_loaded = false')
+ get("/request/#{ir.url_title}")
+ response.code.should == "500"
+ end
+end
+
diff --git a/spec/integration/search_request_spec.rb b/spec/integration/search_request_spec.rb
index 9398519b7..84239f7a3 100644
--- a/spec/integration/search_request_spec.rb
+++ b/spec/integration/search_request_spec.rb
@@ -1,9 +1,57 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "When searching" do
+
+ fixtures [ :info_requests,
+ :info_request_events,
+ :public_bodies,
+ :public_body_translations,
+ :users,
+ :raw_emails,
+ :outgoing_messages,
+ :incoming_messages,
+ :comments ]
+
+ before(:each) do
+ load_raw_emails_data(raw_emails)
+ end
+
it "should not strip quotes from quoted query" do
request_via_redirect("post", "/search", :query => '"mouse stilton"')
response.body.should include("&quot;mouse stilton&quot;")
end
+
+ it "should correctly execute simple search" do
+ request_via_redirect("post", "/search",
+ :query => 'bob'
+ )
+ response.body.should include("One person matching")
+ end
+
+ it "should correctly filter searches for requests" do
+ request_via_redirect("post", "/search/bob/requests")
+ response.body.should_not include("One person matching")
+ response.body.should include("FOI requests 1 to 2 of 2")
+ end
+
+ it "should correctly filter searches for successful requests" do
+ request_via_redirect("post", "/search",
+ :query => "bob",
+ :latest_status => ['successful'])
+ response.body.should include("no requests matching your query")
+ end
+
+ it "should correctly filter searches for comments" do
+ request_via_redirect("post", "/search",
+ :query => "daftest",
+ :request_variety => ['comments'])
+ response.body.should include("One FOI request matching your search")
+
+ request_via_redirect("post", "/search",
+ :query => "daftest",
+ :request_variety => ['response','sent'])
+ response.body.should include("no requests matching your query")
+ end
+
end
diff --git a/spec/views/public_body/show.rhtml_spec.rb b/spec/views/public_body/show.rhtml_spec.rb
index 7793b9b38..f859b0679 100644
--- a/spec/views/public_body/show.rhtml_spec.rb
+++ b/spec/views/public_body/show.rhtml_spec.rb
@@ -1,7 +1,6 @@
require File.dirname(__FILE__) + '/../../spec_helper'
describe "when viewing a body" do
-
before do
@pb = mock_model(PublicBody,
:name => 'Test Quango',
@@ -28,6 +27,8 @@ describe "when viewing a body" do
assigns[:xapian_requests] = @xap
assigns[:page] = 1
assigns[:per_page] = 10
+ # work round a bug in ActionController::TestRequest; allows request.query_string to work in the template
+ request.env["REQUEST_URI"] = ""
end
it "should be successful" do
@@ -51,7 +52,7 @@ describe "when viewing a body" do
end
it "should cope with no results" do
- @xap.stub!(:results).and_return([])
+ @pb.stub!(:info_requests).and_return([])
render "public_body/show"
response.should have_tag("p", /Nobody has made any Freedom of Information requests/m)
end
diff --git a/spec/views/request/list.rhtml_spec.rb b/spec/views/request/list.rhtml_spec.rb
index 578bd5cc8..60a28eec5 100644
--- a/spec/views/request/list.rhtml_spec.rb
+++ b/spec/views/request/list.rhtml_spec.rb
@@ -5,7 +5,8 @@ describe "when listing recent requests" do
before do
assigns[:page] = 1
assigns[:per_page] = 10
-
+ # work round a bug in ActionController::TestRequest; allows request.query_string to work in the template
+ request.env["REQUEST_URI"] = ""
# we're not testing the interlock plugin's cache
template.stub!(:view_cache).and_yield
end
@@ -32,9 +33,7 @@ describe "when listing recent requests" do
it "should be successful" do
assigns[:list_results] = [ make_mock_event, make_mock_event ]
assigns[:matches_estimated] = 2
-
render "request/list"
-
response.should have_tag("div.request_listing")
response.should_not have_tag("p", /No requests of this sort yet/m)
end
@@ -42,7 +41,6 @@ describe "when listing recent requests" do
it "should cope with no results" do
assigns[:list_results] = [ ]
assigns[:matches_estimated] = 0
-
render "request/list"
response.should have_tag("p", /No requests of this sort yet/m)
response.should_not have_tag("div.request_listing")
diff --git a/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb b/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
index 43f0764ca..4671b79da 100644
--- a/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
+++ b/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
@@ -668,8 +668,8 @@ module ActsAsXapian
self.class.to_s + "-" + self.id.to_s
end
- def xapian_value(field, type = nil)
- if self.respond_to?("translations")
+ def xapian_value(field, type = nil, index_translations = false)
+ if index_translations && self.respond_to?("translations")
if type == :date or type == :boolean
value = single_xapian_value(field, type = type)
else
@@ -756,7 +756,7 @@ module ActsAsXapian
for text in self.xapian_options[:texts]
ActsAsXapian.term_generator.increase_termpos # stop phrases spanning different text fields
# XXX the "1" here is a weight that could be varied for a boost function
- ActsAsXapian.term_generator.index_text(xapian_value(text), 1)
+ ActsAsXapian.term_generator.index_text(xapian_value(text, nil, true), 1)
end
end