changeset 195:172b8d25c1ae live

Merge from branch "feature_64"
author Chris Cannam
date Mon, 07 Feb 2011 13:47:47 +0000
parents 6d10c3b6fe17 (current diff) d1713ab10813 (diff)
children 2eaccf99a7b0 5da98461a9f6 5d8c3fe4e7e2
files app/helpers/application_helper.rb app/models/issue.rb config/locales/en-GB.yml config/locales/en.yml public/themes/soundsoftware/stylesheets/application.css
diffstat 25 files changed, 463 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/app/controllers/account_controller.rb	Wed Feb 02 11:44:48 2011 +0000
+++ b/app/controllers/account_controller.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -108,7 +108,9 @@
 
         # associates the 2 objects
         @user.ssamr_user_detail = @ssamr_user_details
+        @selected_institution_id = params[:ssamr_user_details][:institution_id].to_i
 
+        
         case Setting.self_registration
         when '1'
           register_by_email_activation(@user)
--- a/app/controllers/my_controller.rb	Wed Feb 02 11:44:48 2011 +0000
+++ b/app/controllers/my_controller.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -52,11 +52,40 @@
   def account
     @user = User.current
     @pref = @user.pref
+    @ssamr_user_details = @user.ssamr_user_detail
+    
+    
+    if @user.ssamr_user_detail == nil
+       @selected_institution_id = nil
+     else
+       @selected_institution_id = @ssamr_user_details.institution_id.to_i
+     end    
+    
     if request.post?
       @user.attributes = params[:user]
       @user.mail_notification = params[:notification_option] || 'only_my_events'
       @user.pref.attributes = params[:pref]
       @user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
+
+      if @user.ssamr_user_detail == nil
+        @ssamr_user_details = SsamrUserDetail.new()
+        @user.ssamr_user_detail = @ssamr_user_details
+      else
+        @ssamr_user_details = @user.ssamr_user_detail
+      end
+
+      if params[:ssamr_user_details].nil? or params[:ssamr_user_details].empty?
+        @ssamr_user_details.description = @user.ssamr_user_detail.description
+        @ssamr_user_details.institution_id = @user.ssamr_user_detail.institution_id
+        @institution_type = @ssamr_user_details.institution_type
+        @other_institution = @ssamr_user_details.other_institution
+      else
+        @ssamr_user_details.description = params[:ssamr_user_details][:description]
+        @ssamr_user_details.institution_id = params[:ssamr_user_details][:institution_id]
+        @ssamr_user_details.institution_type = params[:ssamr_user_details][:institution_type]
+        @ssamr_user_details.other_institution = params[:ssamr_user_details][:other_institution]
+      end
+                  
       if @user.save
         @user.pref.save
         @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : [])
--- a/app/controllers/users_controller.rb	Wed Feb 02 11:44:48 2011 +0000
+++ b/app/controllers/users_controller.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -54,6 +54,15 @@
 
     if @user.ssamr_user_detail != nil
       @description = @user.ssamr_user_detail.description
+      
+      if @user.ssamr_user_detail.institution_type != nil
+        # institution_type is true for listed institutions
+        if (@user.ssamr_user_detail.institution_type)
+          @institution_name = Institution.find(@user.ssamr_user_detail.institution_id).name
+        else
+          @institution_name = @user.ssamr_user_detail.other_institution
+        end
+      end
     end
     
     # show projects based on current user visibility
@@ -82,7 +91,6 @@
     @auth_sources = AuthSource.find(:all)
 
     @ssamr_user_details = SsamrUserDetail.new
-    
   end
   
   verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
@@ -132,6 +140,12 @@
     
     @ssamr_user_details = @user.ssamr_user_detail
     
+    if @user.ssamr_user_detail == nil
+      @selected_institution_id = nil
+    else
+      @selected_institution_id = @user.ssamr_user_detail.institution_id.to_i    
+    end
+    
     @auth_sources = AuthSource.find(:all)
     @membership ||= Member.new
   end
@@ -163,13 +177,18 @@
     else
       @ssamr_user_details = @user.ssamr_user_detail
     end
-
-
+    
     if params[:ssamr_user_details].nil? or params[:ssamr_user_details].empty?
       @ssamr_user_details.description = @user.ssamr_user_detail.description
+      @ssamr_user_details.institution_id = @user.ssamr_user_detail.institution_id
+      @ssamr_user_details.other_institution = @user.ssamr_user_detail.other_institution
+      @ssamr_user_details.institution_type = @user.ssamr_user_detail.institution_type
+
     else
       @ssamr_user_details.description = params[:ssamr_user_details][:description]
-      @ssamr_user_details.save!
+      @ssamr_user_details.institution_id = params[:ssamr_user_details][:institution_id]
+      @ssamr_user_details.other_institution = params[:ssamr_user_details][:other_institution]
+      @ssamr_user_details.institution_type = params[:ssamr_user_details][:institution_type]
     end
 
     if @user.save
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/models/institution.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -0,0 +1,2 @@
+class Institution < ActiveRecord::Base
+end
--- a/app/models/ssamr_user_detail.rb	Wed Feb 02 11:44:48 2011 +0000
+++ b/app/models/ssamr_user_detail.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -2,4 +2,13 @@
   belongs_to :user
 
   validates_presence_of :description
+
+  validate :check_institution
+
+  def check_institution()
+    errors.add(:institution_id, "Please insert an institution") if
+      institution_id.blank? and other_institution.blank?
+  end
+
+
 end
--- a/app/models/user.rb	Wed Feb 02 11:44:48 2011 +0000
+++ b/app/models/user.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -79,6 +79,8 @@
   validates_length_of :mail, :maximum => 60, :allow_nil => true
   validates_confirmation_of :password, :allow_nil => true
 
+  validates_acceptance_of :terms_and_conditions, :on => :create, :message => :must_accept_terms_and_conditions
+
   def before_create
     self.mail_notification = Setting.default_notification_option if self.mail_notification.blank?
     true
--- a/app/views/account/register.rhtml	Wed Feb 02 11:44:48 2011 +0000
+++ b/app/views/account/register.rhtml	Mon Feb 07 13:47:47 2011 +0000
@@ -1,3 +1,6 @@
+<%= javascript_include_tag "ssamr_institutions" %>
+<%= javascript_include_tag "ssamr_registration" %>
+
 <h2><%=l(:label_register)%> <%=link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %></h2>
 
 <% form_tag({:action => 'register'}, :class => "tabular") do %>
@@ -34,17 +37,21 @@
 	
 		<% fields_for :ssamr_user_details, :builder => TabularFormBuilder, :lang => current_language do |ssamr_user_detail| %>	
 			<p>
+                          <%= ssamr_user_detail.text_area :description, :rows => 3, :cols => 40, :required => true, :class => 'wiki-edit' %>                          
+                          <em> <%=l(:text_user_ssamr_description_info)%></em>
+                        </p>
 
-                          <%= ssamr_user_detail.text_area :description, :rows => 3, :cols => 40, :required => true, :class => 'wiki-edit' %>
-                          <%= wikitoolbar_for 'ssamr_user_details_description' %>
+                        <p><label for="institution"><%=l("field_ssamr_user_detail.institution")%> <span class="required">*</span></label>
+							<%= ssamr_user_detail.radio_button :institution_type, true %>
+                          	<%= ssamr_user_detail.collection_select(:institution_id, Institution.find(:all, :order => "institutions.order"), :id, :name,  {:selected => @selected_institution_id, :prompt => true}).gsub('&amp;', '&')  %>
+						</p>
 
-                          <em> <%=l(:text_user_ssamr_description_info)%></em>
+                        <p>
+                          <%= ssamr_user_detail.radio_button :institution_type, false %> Other:
+                          <%= ssamr_user_detail.text_field(:other_institution) %>
                         </p>
                 <% end %>
           
-
-
-
 <% if Setting.openid? %>
 <p><label for="user_identity_url"><%=l(:field_identity_url)%></label>
 <%= text_field 'user', 'identity_url'  %></p>
@@ -56,5 +63,9 @@
 <!--[eoform:user]-->
 </div>
 
+<%= check_box :user, :terms_and_conditions %> <%= l(:accept_terms_and_conditions) %> <%= link_to("Terms and Conditions", "https://code.soundsoftware.ac.uk/projects/soundsoftware-site/wiki/TandCs", {:target => "_blank"}) %>.
+<br />
+<br />
+
 <%= submit_tag l(:button_submit) %>
 <% end %>
--- a/app/views/my/account.rhtml	Wed Feb 02 11:44:48 2011 +0000
+++ b/app/views/my/account.rhtml	Mon Feb 07 13:47:47 2011 +0000
@@ -1,3 +1,5 @@
+<%= javascript_include_tag "ssamr_institutions" %>
+
 <div class="contextual">
 <%= link_to(l(:button_change_password), :action => 'password') if @user.change_password_allowed? %>
 <%= call_hook(:view_my_account_contextual, :user => @user)%>
@@ -9,6 +11,8 @@
                           :builder => TabularFormBuilder, 
                           :lang => current_language,
                           :html => { :id => 'my_account_form' } do |f| %>
+
+
 <div class="splitcontentleft">
 <h3><%=l(:label_information_plural)%></h3>
 <div class="box tabular">
@@ -23,9 +27,35 @@
 <% @user.custom_field_values.select(&:editable?).each do |value| %>
 	<p><%= custom_field_tag_with_label :user, value %></p>
 <% end %>
+
 <%= call_hook(:view_my_account, :user => @user, :form => f) %>
 </div>
 
+<h3><%=l(:label_ssamr_details)%></h3>
+<div class="box tabular">
+    <% fields_for :ssamr_user_details, :builder => TabularFormBuilder, :lang => current_language do |ssamr_user_detail| %>
+       <p>
+         <%= ssamr_user_detail.text_area :description, :rows => 3, :cols => 25, :required => true, :class => 'wiki-edit' %>
+       </p>
+
+
+            <p><label for="institution"><%=l("field_ssamr_user_detail.institution")%> <span class="required">*</span></label>
+			<nobr>
+              <%= ssamr_user_detail.radio_button :institution_type, true %>
+              <%= ssamr_user_detail.collection_select(:institution_id, Institution.find(:all, :order => "institutions.order"), :id, :name, {:selected => @selected_institution_id, :prompt => true} ).gsub('&amp;', '&') %>
+            </nobr>
+			</p>
+
+            <p>
+				<nobr>
+               		<%= ssamr_user_detail.radio_button :institution_type, false %> Other:
+               		<%= ssamr_user_detail.text_field :other_institution, :size => 19 %>
+            	</nobr>
+            </p>
+    <% end %>
+</div>
+
+
 <%= submit_tag l(:button_save) %>
 </div>
 
@@ -43,6 +73,14 @@
 </div>
 <% end %>
 
+
+
+
+
+
+
+
+
 <% content_for :sidebar do %>
 <%= render :partial => 'sidebar' %>
 <% end %>
--- a/app/views/users/_form.rhtml	Wed Feb 02 11:44:48 2011 +0000
+++ b/app/views/users/_form.rhtml	Mon Feb 07 13:47:47 2011 +0000
@@ -1,3 +1,6 @@
+<%= javascript_include_tag "ssamr_institutions" %>
+
+
 <%= error_messages_for 'user' %>
 
 <!--[form:user]-->
@@ -23,12 +26,25 @@
 	<h3><%=l(:label_ssamr_details)%></h3>
           <% fields_for :ssamr_user_details, :builder => TabularFormBuilder, :lang => current_language do |ssamr_user_detail| %>
             <p>
-              <%= ssamr_user_detail.text_area :description, :rows => 3, :cols => 40, :required => true, :class => 'wiki-edit'  %>
-              <%= wikitoolbar_for 'ssamr_user_details_description' %>
-              <br />
-              <em> <%=l(:text_user_ssamr_description_info)%></em>
+              <%= ssamr_user_detail.text_area :description, :rows => 3, :cols => 40, :required => true, :class => 'wiki-edit'  %>                            
             </p>
-          <% end %>          
+
+            <p><label for="institution"><%=l("field_ssamr_user_detail.institution")%> <span class="required">*</span></label>
+			 <nobr>
+              <%= ssamr_user_detail.radio_button :institution_type, true %>
+              <%= ssamr_user_detail.collection_select(:institution_id, Institution.find(:all, :order => "institutions.order"), :id, :name, {:selected => @selected_institution_id, :prompt => true} ).gsub('&amp;', '&')  %>
+             </nobr>
+			</p>
+
+
+
+            <p>
+				<nobr>
+               <%= ssamr_user_detail.radio_button :institution_type, false %> Other:
+               <%= ssamr_user_detail.text_field :other_institution %>
+				</nobr>
+            </p>
+          <% end %>
 </div>
 
 
--- a/app/views/users/show.rhtml	Wed Feb 02 11:44:48 2011 +0000
+++ b/app/views/users/show.rhtml	Mon Feb 07 13:47:47 2011 +0000
@@ -23,6 +23,9 @@
 <h3><%=l(:label_ssamr_description)%></h3>
 <%= textilizable @description %>
 
+<h3><%=l(:label_ssamr_institution)%></h3>
+<%= h @institution_name %>
+
 
 <% unless @memberships.empty? %>
 <h3><%=l(:label_project_plural)%></h3>
--- a/config/locales/en-GB.yml	Wed Feb 02 11:44:48 2011 +0000
+++ b/config/locales/en-GB.yml	Mon Feb 07 13:47:47 2011 +0000
@@ -123,6 +123,7 @@
         not_same_project: "doesn't belong to the same project"
         circular_dependency: "This relation would create a circular dependency"
         cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks"
+        must_accept_terms_and_conditions: "You must accept the Terms and Conditions"        
 
   actionview_instancetag_blank_option: Please select
   
@@ -199,6 +200,10 @@
 
   field_ssamr_user_detail:
     description: User Description
+    institution: Institution
+
+  field_other_institution: ''
+
   field_name: Name
   field_description: Description
   field_summary: Summary
@@ -413,9 +418,11 @@
   
   label_tipoftheday: Tip of the day
   label_notifications: Important Message
+  field_terms_and_conditions: 'Terms and Conditions:'
+  accept_terms_and_conditions: 'I have read and agree with the '
   label_ssamr_description: Research description
   label_ssamr_details: Other Details
-  
+  label_ssamr_institution: Institution
   label_user: User
   label_user_plural: Users
   label_user_new: New user
@@ -423,8 +430,6 @@
   label_project: Project
   label_project_new: New project
   label_project_plural: Projects
-  label_my_project_plural: My Projects
-  label_other_project_plural: "Everyone Else's Projects"
   label_x_projects:
     zero:  no projects
     one:   1 project
@@ -704,7 +709,7 @@
   label_week: Week
   label_date_from: From
   label_date_to: To
-  label_language_based: "Based on user's language"
+  label_language_based: Based on user's language
   label_sort_by: "Sort by {{value}}"
   label_send_test_email: Send a test email
   label_feeds_access_key: RSS access key
@@ -846,7 +851,7 @@
   text_project_homepage_info: 'Link to an external project page.'
   text_project_name_info: "This will be the name of your project throughout this site.<br /> You can change your project's name at any time, in the project's settings."
   text_project_visibility_info: "If your project is not public, it will only be visible to users that you have added as project members."
-  text_user_ssamr_description_info: 'Please describe your current research or development interests, within the fields of audio and music.<br/>This information is publicly visible in your profile and you can edit it at any time.<br/>It may also be used to establish eligibility for your initial registration.'
+  text_user_ssamr_description_info: 'Please describe your current research or development interests, within the fields of audio and music.<br/>This information is publicly visible in your profile and you can edit it at any time.'
   text_issue_parent_issue_info: 'If this is a subtask, please insert its parent task number or write the main task name.'
   text_caracters_maximum: "{{count}} characters maximum."
   text_caracters_minimum: "Must be at least {{count}} characters long."
--- a/config/locales/en.yml	Wed Feb 02 11:44:48 2011 +0000
+++ b/config/locales/en.yml	Mon Feb 07 13:47:47 2011 +0000
@@ -86,7 +86,6 @@
           gb: "GB"
           tb: "TB"
 
-        
 # Used in array.to_sentence.
   support:
     array:
@@ -120,6 +119,7 @@
         not_same_project: "doesn't belong to the same project"
         circular_dependency: "This relation would create a circular dependency"
         cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks"
+        must_accept_terms_and_conditions: "You must accept the Terms and Conditions"
 
   actionview_instancetag_blank_option: Please select
   
@@ -203,6 +203,10 @@
 
   field_ssamr_user_detail:
     description: User Description
+    institution: Institution
+
+  field_other_institution: ''
+
   field_name: Name
   field_description: Description
   field_summary: Summary
@@ -304,6 +308,8 @@
   
   setting_tipoftheday_text: Tip of the Day
   setting_notifications_text: Notifications
+  field_terms_and_conditions: 'Terms and Conditions:'
+  accept_terms_and_conditions: 'I have read and agree with the '
   label_ssamr_description: Research description
   setting_app_title: Application title
   setting_app_subtitle: Application subtitle
@@ -427,9 +433,9 @@
   project_module_boards: Boards
   project_module_calendar: Calendar
   project_module_gantt: Gantt
-  
   label_tipoftheday: Tip of the day
   label_ssamr_details: Other Details
+  label_ssamr_institution: Institution
   label_user: User
   label_user_plural: Users
   label_user_new: New user
@@ -438,7 +444,7 @@
   label_project_new: New project
   label_project_plural: Projects
   label_my_project_plural: My Projects
-  label_other_project_plural: "Everyone Else's Projects"
+  label_other_project_plural: Other Projects
   label_x_projects:
     zero:  no projects
     one:   1 project
@@ -872,7 +878,7 @@
   text_project_name_info: "This will be the name of your project throughout this site.<br /> You can change your project's name at any time, in the project's settings."
   text_project_visibility_info: "If your project is not public, it will only be visible to users that you have added as project members."
   text_project_homepage_info: 'Link to an external project page.'
-  text_user_ssamr_description_info: 'Please describe your current research or development interests, within the fields of audio and music.<br/>This information is publicly visible in your profile and you can edit it at any time.<br/>It may also be used to establish eligibility for your initial registration.'
+  text_user_ssamr_description_info: 'Please describe your current research or development interests, within the fields of audio and music.<br/>This information is publicly visible in your profile and you can edit it at any time.'
   text_issue_parent_issue_info: 'If this is a subtask, please insert its parent task number or write the main task name.'
   text_caracters_maximum: "{{count}} characters maximum."
   text_caracters_minimum: "Must be at least {{count}} characters long."
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/console/db/seeds.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -0,0 +1,9 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#   
+#   cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
+#   Major.create(:name => 'Daley', :city => cities.first)
+
+puts "this is a test"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/migrate/20101216140621_create_institutions.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -0,0 +1,13 @@
+class CreateInstitutions < ActiveRecord::Migration
+  def self.up
+    create_table :institutions do |t|
+      t.string :name
+
+      t.timestamps
+    end
+  end
+
+  def self.down
+    drop_table :institutions
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/migrate/20101216145813_fix_university_name_in_ssamr_details_table.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -0,0 +1,10 @@
+class FixUniversityNameInSsamrDetailsTable < ActiveRecord::Migration
+  def self.up
+    rename_column :ssamr_user_details, :university, :institution_id
+  end
+
+  def self.down
+    # there's no need to rollback the name of this column
+    # because it was not used previously
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/migrate/20110126153504_add_other_institution_column_to_ssamr_user_details.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -0,0 +1,9 @@
+class AddOtherInstitutionColumnToSsamrUserDetails < ActiveRecord::Migration
+  def self.up
+    add_column :ssamr_user_details, :other_institution, :string
+  end
+
+  def self.down
+    remove_column :ssamr_user_details, :other_institution
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/migrate/20110127161758_add_institution_type_column_to_ssamr_user_details.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -0,0 +1,9 @@
+class AddInstitutionTypeColumnToSsamrUserDetails < ActiveRecord::Migration
+  def self.up
+     add_column :ssamr_user_details, :institution_type, :boolean
+  end
+
+  def self.down
+    remove_column :ssamr_user_details, :institution_type
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/migrate/20110202170156_add_order_column_to_institutions.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -0,0 +1,9 @@
+class AddOrderColumnToInstitutions < ActiveRecord::Migration
+  def self.up
+       add_column :institutions, :order, :integer
+  end
+
+  def self.down
+      remove_column :institutions, :order
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/seed_data/institutions.txt	Mon Feb 07 13:47:47 2011 +0000
@@ -0,0 +1,141 @@
+University of Aberdeen|1
+University of Abertay Dundee |2
+Aberystwyth University|3
+Anglia Ruskin University|4
+University of the Arts London|5
+Aston University|6
+Bangor University|7
+University of Bath|8
+Bath Spa University|9
+University of Bedfordshire|10
+Birkbeck, University of London|11
+University of Birmingham|12
+Birmingham City University|13
+Birmingham Conservatoire|14
+University Centre at Blackburn College|15
+University of Bolton|16
+Bournemouth University|17
+University of Bradford|18
+University of Brighton|19
+University of Bristol|20
+Brunel University|21
+University of Buckingham|22
+Buckinghamshire New University|23
+University of Cambridge|24
+Institute of Cancer Research, University of London|25
+Canterbury Christ Church University|26
+Cardiff University|27
+University of Central Lancashire|28
+Central School of Speech and Drama, University of London|29
+University of Chester|30
+University of Chichester|31
+City University London|32
+Courtauld Institute of Art|33
+Coventry University|34
+Cranfield University|35
+University for the Creative Arts|36
+University of Cumbria|37
+De Montfort University|38
+University of Derby|39
+University of Dundee|40
+Durham University|41
+University of East Anglia|42
+University of East London|43
+Edge Hill University|44
+University of Edinburgh|45
+Edinburgh Napier University|46
+Institute of Education, University of London|47
+University of Essex|48
+University of Exeter|49
+University of Glamorgan|50
+University of Glasgow|51
+Glasgow Caledonian University|52
+University of Gloucestershire|53
+Goldsmiths, University of London|54
+University of Greenwich|55
+Glynd&#373;r University|56
+Heriot-Watt University|57
+University of Hertfordshire|58
+Heythrop College|59
+University of Huddersfield|60
+University of Hull|61
+Hull York Medical School|62
+Imperial College London|63
+Keele University|64
+University of Kent|65
+King's College London|66
+Kingston University|67
+Lancaster University|68
+University of Leeds|69
+Leeds Metropolitan University|70
+University of Leicester|71
+University of Lincoln|72
+University of Liverpool|73
+Liverpool Hope University|74
+Liverpool John Moores University|75
+London Business School|76
+London College of Music|77
+London Metropolitan University|78
+London School of Economics and Political Science|79
+London School of Hygiene and Tropical Medicine|80
+London South Bank University|81
+Loughborough University|82
+University of Manchester|83
+Manchester Metropolitan University|84
+Middlesex University|85
+Newcastle University|86
+University of Northampton|87
+Northumbria University|88
+University of Nottingham|89
+Nottingham Trent University|90
+The Open University|91
+University of Oxford|92
+Oxford Brookes University|93
+Peninsula College of Medicine and Dentistry|94
+University of Plymouth|95
+University of Portsmouth|96
+Queen's University Belfast|97
+Queen Margaret University|98
+Queen Mary, University of London|99
+University of Reading|100
+The Robert Gordon University, Aberdeen|101
+Roehampton University|102
+Royal Academy of Music|103
+Royal College of Art|104
+Royal Holloway, University of London|105
+Royal Veterinary College|106
+University of St Andrews|107
+St George's, University of London|108
+University of Salford|109
+School of Advanced Study, University of London|110
+School of Oriental and African Studies|111
+School of Pharmacy, University of London|112
+University of Sheffield|113
+Sheffield Hallam University|114
+University of Southampton|115
+Southampton Solent University|116
+Staffordshire University|117
+University of Stirling|118
+University of Strathclyde|119
+University of Sunderland|120
+University of Surrey|121
+University of Sussex|122
+Swansea Metropolitan University|123
+Swansea University|124
+University of Teesside|125
+Thames Valley University|126
+University of Ulster|127
+University College London|128
+University of Wales|129
+University of Wales Institute, Cardiff|130
+University of Wales, Newport|131
+University of Wales, Trinity Saint David|132
+University of Warwick|133
+University of Westminster|134
+University of the West of England|135
+University of the West of Scotland|136
+University of Winchester|137
+University of Wolverhampton|138
+University of Worcester|139
+University of York|140
+York St John University|141
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/seeds.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -0,0 +1,27 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#   
+#   cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
+#   Major.create(:name => 'Daley', :city => cities.first)
+
+def truncate_table(table_name)
+  quoted = connection.quote_table_name(table_name)
+  connection.execute("TRUNCATE #{quoted}")
+end
+
+def connection
+  ActiveRecord::Base.connection
+end
+
+truncate_table('institutions')
+
+open("db/seed_data/institutions.txt") do |institutions|
+  institutions.read.each_line do |institution|
+    inst=institution.split('|')
+    
+    
+    Institution.create(:name => inst[0].chomp, :order => inst[1].chomp)
+  end
+end
\ No newline at end of file
--- a/public/javascripts/application.js	Wed Feb 02 11:44:48 2011 +0000
+++ b/public/javascripts/application.js	Mon Feb 07 13:47:47 2011 +0000
@@ -239,3 +239,7 @@
 }
 
 Event.observe(window, 'load', hideOnLoad);
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public/javascripts/ssamr_institutions.js	Mon Feb 07 13:47:47 2011 +0000
@@ -0,0 +1,32 @@
+
+
+/* SSAMR specific functions */
+
+/* institution related functions */
+Event.observe(window, 'load',
+  function() {
+	$('ssamr_user_details_institution_type_true').observe('click', function(e, el) {
+	    $('ssamr_user_details_other_institution').disable();
+		$('ssamr_user_details_institution_id').enable();
+	});
+
+	$('ssamr_user_details_institution_type_false').observe('click', function(e, el) {
+	    $('ssamr_user_details_other_institution').enable();
+		$('ssamr_user_details_institution_id').disable();
+	});
+        
+    if($('ssamr_user_details_institution_type_true').checked)
+        $('ssamr_user_details_other_institution').disable();
+    else if($('ssamr_user_details_institution_type_false').checked)
+        $('ssamr_user_details_institution_id').disable();
+	else {
+		$('ssamr_user_details_other_institution').disable();
+	  	$('ssamr_user_details_institution_id').enable();
+	  	$('ssamr_user_details_institution_type_true').checked = true;
+	  	$('ssamr_user_details_institution_type_false').checked = false;
+	}
+}
+);
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public/javascripts/ssamr_registration.js	Mon Feb 07 13:47:47 2011 +0000
@@ -0,0 +1,19 @@
+
+
+/* SSAMR specific functions */
+
+/* institution related functions */
+Event.observe(window, 'load',
+  function() {
+		
+		if(!$('ssamr_user_details_institution_type_true').checked && $('ssamr_user_details_institution_type_true').checked){
+  			$('ssamr_user_details_other_institution').disable();
+  			$('ssamr_user_details_institution_id').enable();
+  			$('ssamr_user_details_institution_type_true').checked = true;
+  			$('ssamr_user_details_institution_type_false').checked = false;
+		}
+	}
+);
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/fixtures/institutions.yml	Mon Feb 07 13:47:47 2011 +0000
@@ -0,0 +1,7 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+one:
+  name: MyString
+
+two:
+  name: MyString
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/unit/institution_test.rb	Mon Feb 07 13:47:47 2011 +0000
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class InstitutionTest < ActiveSupport::TestCase
+  # Replace this with your real tests.
+  test "the truth" do
+    assert true
+  end
+end