From bfc41003b4521635f548ed97edbe21526641e87b Mon Sep 17 00:00:00 2001 From: Prashant Solanki Date: Sat, 18 Oct 2014 20:29:24 -0400 Subject: [PATCH] Fixing bugs to get it working on my systems --- app/models/controller_action.rb | 8 + app/models/menu_item.rb | 4 + app/models/permission.rb | 4 + app/models/role.rb | 5 + app/models/site_controller.rb | 3 + app/models/system_settings.rb | 2 +- db/migrate/017_create_assignments.rb | 4 +- .../022_create_review_of_review_mappings.rb | 2 +- db/migrate/023_create_survey_responses.rb | 33 ++-- db/migrate/029_create_participants.rb | 2 +- db/migrate/044_menu_update_users.rb | 4 +- db/migrate/045_menu_update_impersonate.rb | 4 +- db/migrate/046_menu_update_import_file.rb | 2 +- db/migrate/047_menu_update_review_mapping.rb | 2 +- db/migrate/048_menu_update_grades.rb | 2 +- db/migrate/053_create_nodes.rb | 4 +- db/migrate/060_menu_update_tree_display.rb | 6 +- db/migrate/069_move_files.rb | 6 +- db/migrate/073_remove_missing_controllers.rb | 18 +- db/migrate/076_update_menus.rb | 5 +- .../085_update_controllers_teammate_review.rb | 3 +- db/migrate/104_update_rubric_types.rb | 3 +- .../108_create_questionnaire_folder_nodes.rb | 8 +- db/migrate/121_create_suggestions.rb | 2 +- db/migrate/122_create_suggestion_comments.rb | 2 +- db/migrate/129_menu_update_leaderboard.rb | 3 +- ...20141223_update_menu_impersonate_revert.rb | 3 +- ...7013927_add_bookmarkrating_folder_nodes.rb | 6 +- .../20131124173014_create_team_roles.rb | 2 +- .../20131124173146_create_team_rolesets.rb | 2 +- ...131124173225_create_teamrole_assignment.rb | 4 +- ...24180730_create_team_role_questionnaire.rb | 4 +- ...0131124180940_create_team_rolesets_maps.rb | 4 +- ...124181007_create_participant_team_roles.rb | 4 +- db/schema.rb | 157 +++++++++--------- db/seeds.rb | 36 ++-- 36 files changed, 208 insertions(+), 155 deletions(-) diff --git a/app/models/controller_action.rb b/app/models/controller_action.rb index a1d5901f5ed..87b9145e415 100644 --- a/app/models/controller_action.rb +++ b/app/models/controller_action.rb @@ -11,6 +11,14 @@ class ControllerAction < ActiveRecord::Base joins('left outer join site_controllers on site_controller_id = site_controllers.id'). order('site_controllers.name, name') } + + def self.find_all_by_site_controller_id (id) + ControllerAction.where(site_controller_id: id) + end + + def self.find_or_create_by_name (params) + ControllerAction.find_or_create_by(name: params) + end def controller @controller ||= SiteController.find(self.site_controller_id) diff --git a/app/models/menu_item.rb b/app/models/menu_item.rb index fdd95936468..554675a889e 100644 --- a/app/models/menu_item.rb +++ b/app/models/menu_item.rb @@ -5,6 +5,10 @@ class MenuItem < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name + def self.find_or_create_by_name (params) + MenuItem.find_or_create_by(name: params) + end + def delete children = MenuItem.where(['parent_id = ?',self.id]) children.each {|child| child.delete } diff --git a/app/models/permission.rb b/app/models/permission.rb index eda2ec65bae..c5409055658 100644 --- a/app/models/permission.rb +++ b/app/models/permission.rb @@ -22,6 +22,10 @@ def Permission.find_all_for_role(role) return find_for_role(roles) end + def self.find_or_create_by_name (params) + Permission.find_or_create_by(name: params) + end + # Find Permissions that are not already associated with the given # Role ID. diff --git a/app/models/role.rb b/app/models/role.rb index 364ee7d8087..bde19f2cf5d 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -11,6 +11,11 @@ class Role < ActiveRecord::Base attr_reader :student,:ta,:instructor,:administrator,:superadministrator + def self.find_or_create_by_name (params) + Role.find_or_create_by(name: params) + end + + def self.student @@student_role ||= find_by_name 'Student' end diff --git a/app/models/site_controller.rb b/app/models/site_controller.rb index 487fe4a176c..2750a6c3df8 100644 --- a/app/models/site_controller.rb +++ b/app/models/site_controller.rb @@ -12,6 +12,9 @@ def actions @actions ||= controller_actions.order(:name) end + def self.find_or_create_by_name (params) + SiteController.find_or_create_by(name: params) + end def self.classes classes = Hash.new diff --git a/app/models/system_settings.rb b/app/models/system_settings.rb index 56d09e22bab..3b5767552b2 100644 --- a/app/models/system_settings.rb +++ b/app/models/system_settings.rb @@ -1,5 +1,5 @@ class SystemSettings < ActiveRecord::Base - set_table_name 'system_settings' + self.table_name 'system_settings' attr_accessor :public_role, :default_markup_style attr_accessor :site_default_page, :not_found_page, :permission_denied_page, diff --git a/db/migrate/017_create_assignments.rb b/db/migrate/017_create_assignments.rb index d3b5f7a332a..08ca00a0381 100644 --- a/db/migrate/017_create_assignments.rb +++ b/db/migrate/017_create_assignments.rb @@ -5,7 +5,7 @@ def self.up t.column "updated_at", :datetime t.column "name", :string t.column "directory_path", :string - t.column "submitter_count", :integer, :limit => 10, :default => 0, :null => false + t.column "submitter_count", :integer, :limit => 8, :default => 0, :null => false t.column "course_id", :integer, :default => 0, :null => false t.column "instructor_id", :integer, :default => 0, :null => false t.column "private", :boolean, :default => false, :null => false @@ -21,7 +21,7 @@ def self.up t.column "team_assignment", :boolean t.column "wiki_type_id", :integer t.column "require_signup", :boolean - t.column "num_reviewers", :integer, :limit => 10, :default => 0, :null => false + t.column "num_reviewers", :integer, :limit => 8, :default => 0, :null => false t.column "spec_location", :text end diff --git a/db/migrate/022_create_review_of_review_mappings.rb b/db/migrate/022_create_review_of_review_mappings.rb index 57eac071b46..18fda65357f 100644 --- a/db/migrate/022_create_review_of_review_mappings.rb +++ b/db/migrate/022_create_review_of_review_mappings.rb @@ -4,7 +4,7 @@ def self.up t.column "review_mapping_id", :integer t.column "review_reviewer_id", :integer t.column "review_id", :integer - t.column "assignment_id", :integer, :limit => 10 + t.column "assignment_id", :integer, :limit => 8 end add_index "review_of_review_mappings", ["review_id"], :name => "fk_review_of_review_mapping_reviews" diff --git a/db/migrate/023_create_survey_responses.rb b/db/migrate/023_create_survey_responses.rb index 9ef0642a958..785065341b6 100644 --- a/db/migrate/023_create_survey_responses.rb +++ b/db/migrate/023_create_survey_responses.rb @@ -1,31 +1,32 @@ class CreateSurveyResponses < ActiveRecord::Migration def self.up create_table "survey_responses", :force => true do |t| - t.column "score", :integer, :limit => 10 + t.column "score", :integer, :limit => 8 t.column "comments", :text - t.column "assignment_id", :integer, :limit => 10, :default => 0, :null => false - t.column "question_id", :integer, :limit => 10, :default => 0, :null => false - t.column "survey_id", :integer, :limit => 10, :default => 0, :null => false + t.references :assignment, :null =>false, :default => 0 +# t.column "assignment_id", :integer, :limit => 10, :default => 0, :null => false + t.column "question_id", :integer, :limit => 8, :default => 0, :null => false + t.column "survey_id", :integer, :limit => 8, :default => 0, :null => false t.column "email", :string end - add_index "survey_responses", ["assignment_id"], :name => "fk_survey_assignments" +# add_index "survey_responses", ["assignment_id"], :name => "fk_survey_assignments" - execute "alter table survey_responses - add constraint fk_survey_assignments - foreign key (assignment_id) references assignments(id)" +# execute "alter table survey_responses +# add constraint fk_survey_assignments +# foreign key (assignment_id) references assignments(id)" - add_index "survey_responses", ["question_id"], :name => "fk_survey_questions" +# add_index "survey_responses", ["question_id"], :name => "fk_survey_questions" - execute "alter table survey_responses - add constraint fk_survey_questions - foreign key (question_id) references questions(id)" +# execute "alter table survey_responses +# add constraint fk_survey_questions +# foreign key (question_id) references questions(id)" - add_index "survey_responses", ["survey_id"], :name => "fk_survey_questionnaires" +# add_index "survey_responses", ["survey_id"], :name => "fk_survey_questionnaires" - execute "alter table survey_responses - add constraint fk_survey_questionnaires - foreign key (survey_id) references questionnaires(id)" +# execute "alter table survey_responses +# add constraint fk_survey_questionnaires +# foreign key (survey_id) references questionnaires(id)" end diff --git a/db/migrate/029_create_participants.rb b/db/migrate/029_create_participants.rb index f71c8e86152..05db8dbfc7a 100644 --- a/db/migrate/029_create_participants.rb +++ b/db/migrate/029_create_participants.rb @@ -9,7 +9,7 @@ def self.up t.column "submitted_at", :datetime t.column "topic", :string t.column "permission_granted", :boolean - t.column "penalty_accumulated", :integer, :limit => 10, :default => 0, :null => false + t.column "penalty_accumulated", :integer, :limit => 8, :default => 0, :null => false t.column "submitted_hyperlink", :string, :limit => 500 end diff --git a/db/migrate/044_menu_update_users.rb b/db/migrate/044_menu_update_users.rb index de5bbab930a..02a8dd6b3c3 100644 --- a/db/migrate/044_menu_update_users.rb +++ b/db/migrate/044_menu_update_users.rb @@ -4,7 +4,7 @@ def self.up if permission != nil site_controller = SiteController.find_by_name('users') if site_controller != nil - action = ControllerAction.find(:first, :conditions => ['site_controller_id = ? and name = ?',site_controller.id,'list']) + action = ControllerAction.where(:site_controller_id=>site_controller.id, :name=>'list').first if action != nil action.permission_id = permission.id action.save @@ -27,7 +27,7 @@ def self.up def self.down site_controller = SiteController.find_by_name('users') if site_controller != nil - action = ControllerAction.find(:first, :conditions => ['site_controller_id = ? and name = ?',site_controller.id,'list']) + action = ControllerAction.where(:site_controller_id=>site_controller.id, :name=>'list').first if action != nil action.permission_id = nil action.save diff --git a/db/migrate/045_menu_update_impersonate.rb b/db/migrate/045_menu_update_impersonate.rb index dc8ec708847..393a7b978d7 100644 --- a/db/migrate/045_menu_update_impersonate.rb +++ b/db/migrate/045_menu_update_impersonate.rb @@ -6,12 +6,12 @@ def self.up if site_controller == nil site_controller = SiteController.create(:name => 'impersonate', :permission_id => permission1.id, :builtin => 0) end - action = ControllerAction.find(:first, :conditions => ['name = "start" and site_controller_id = ?',site_controller.id]) + action = ControllerAction.where(:site_controller_id=>site_controller.id, :name=>'start').first if action == nil action = ControllerAction.create(:name => 'start', :site_controller_id => site_controller.id) end - action2 = ControllerAction.find(:first, :conditions => ['name = "restore" and site_controller_id = ?',site_controller.id]) + action2 = ControllerAction.where(:site_controller_id=>site_controller.id, :name=>'restore').first if action2 == nil action2 = ControllerAction.create(:name => 'restore', :site_controller_id => site_controller.id, :permission_id => permission2.id) end diff --git a/db/migrate/046_menu_update_import_file.rb b/db/migrate/046_menu_update_import_file.rb index 98b02d165fe..1b0f1c74fd4 100644 --- a/db/migrate/046_menu_update_import_file.rb +++ b/db/migrate/046_menu_update_import_file.rb @@ -1,7 +1,7 @@ class MenuUpdateImportFile < ActiveRecord::Migration def self.up permission1 = Permission.find_by_name('administer assignments') - site_controller = SiteController.find_or_create_by_name('import_file') + site_controller = SiteController.find_or_create_by(name: 'import_file') site_controller.permission_id = permission1.id site_controller.builtin = 0 site_controller.save diff --git a/db/migrate/047_menu_update_review_mapping.rb b/db/migrate/047_menu_update_review_mapping.rb index ccd83576b6c..ac0d679605f 100644 --- a/db/migrate/047_menu_update_review_mapping.rb +++ b/db/migrate/047_menu_update_review_mapping.rb @@ -2,7 +2,7 @@ class MenuUpdateReviewMapping < ActiveRecord::Migration def self.up permission1 = Permission.find_by_name('administer assignments'); menuParent = MenuItem.find_by_label('Assignment Creation') - site_controller = SiteController.find_or_create_by_name('review_mapping') + site_controller = SiteController.find_or_create_by(name: 'review_mapping') site_controller.permission_id = permission1.id site_controller.builtin = 0 site_controller.save diff --git a/db/migrate/048_menu_update_grades.rb b/db/migrate/048_menu_update_grades.rb index 0c63baeb7c0..a04ebdc0833 100644 --- a/db/migrate/048_menu_update_grades.rb +++ b/db/migrate/048_menu_update_grades.rb @@ -1,7 +1,7 @@ class MenuUpdateGrades < ActiveRecord::Migration def self.up permission1 = Permission.find_by_name('administer assignments') - site_controller = SiteController.find_or_create_by_name('grades') + site_controller = SiteController.find_or_create_by(name: 'grades') site_controller.permission_id = permission1.id site_controller.builtin = 0 site_controller.save diff --git a/db/migrate/053_create_nodes.rb b/db/migrate/053_create_nodes.rb index eb48f70e257..762c046dddc 100644 --- a/db/migrate/053_create_nodes.rb +++ b/db/migrate/053_create_nodes.rb @@ -3,7 +3,9 @@ def self.up create_table :nodes do |t| t.column :parent_id, :integer t.column :node_object_id, :integer - t.column :type, :string + t.column :type, :string + t.integer :lft + t.integer :rgt end end diff --git a/db/migrate/060_menu_update_tree_display.rb b/db/migrate/060_menu_update_tree_display.rb index a266961e167..40b7123bd95 100644 --- a/db/migrate/060_menu_update_tree_display.rb +++ b/db/migrate/060_menu_update_tree_display.rb @@ -21,7 +21,8 @@ def self.up site_controller = SiteController.find_or_create_by_name('survey_deployment') site_controller.permission_id = permission1.id site_controller.save - action = ControllerAction.find(:first, :conditions => ['site_controller_id = ? and name = ?',site_controller.id,'list']) + #action = ControllerAction.find(:first, :conditions => ['site_controller_id = ? and name = ?',site_controller.id,'list']) + action = ControllerAction.where(site_controller_id: site_controller.id, name: 'list').first if action == nil action = ControllerAction.create(:name => 'list', :site_controller_id => site_controller.id) end @@ -30,7 +31,8 @@ def self.up site_controller = SiteController.find_or_create_by_name('statistics') site_controller.permission_id = permission1.id site_controller.save - action = ControllerAction.find(:first, :conditions => ['site_controller_id = ? and name = ?',site_controller.id,'list_surveys']) + #action = ControllerAction.find(:first, :conditions => ['site_controller_id = ? and name = ?',site_controller.id,'list_surveys']) + action = ControllerAction.where(site_controller_id: site_controller.id, name: 'list_surveys').first if action == nil action = ControllerAction.create(:name => 'list_surveys', :site_controller_id => site_controller.id) end diff --git a/db/migrate/069_move_files.rb b/db/migrate/069_move_files.rb index e788ebefef3..64d26f218d6 100644 --- a/db/migrate/069_move_files.rb +++ b/db/migrate/069_move_files.rb @@ -1,6 +1,7 @@ class MoveFiles < ActiveRecord::Migration def self.up - courses = Course.find(:all, :conditions => ['not instructor_id is null']) + #courses = Course.find(:all, :conditions => ['not instructor_id is null']) + courses = Course.where.not('instructor_id = null') courses.each{ | course | @@ -35,7 +36,8 @@ def self.up FileHelper.create_directory(course) } - assignments = Assignment.find(:all, :conditions => ['wiki_type_id = 1 and not instructor_id is null']) + #assignments = Assignment.find(:all, :conditions => ['wiki_type_id = 1 and not instructor_id is null']) + assignments = Assignment.where('wiki_type_id = 1 and instructor_id != null') assignments.each{ | assignment | directories = Assignment.find_all_by_directory_path(assignment.directory_path) diff --git a/db/migrate/073_remove_missing_controllers.rb b/db/migrate/073_remove_missing_controllers.rb index af9446044f1..bfb91d1eb87 100644 --- a/db/migrate/073_remove_missing_controllers.rb +++ b/db/migrate/073_remove_missing_controllers.rb @@ -2,9 +2,11 @@ class RemoveMissingControllers < ActiveRecord::Migration def self.up controller = SiteController.find_by_name('courses_users') if controller - ControllerAction.find_all_by_site_controller_id(controller.id).each{ + #ControllerAction.find_all_by_site_controller_id(controller.id).each{ + ControllerAction.where(site_controller_id: controller.id).each{ | action | - MenuItem.find_all_by_controller_action_id(action.id).each{ + #MenuItem.find_all_by_controller_action_id(action.id).each{ + MenuItem.where(controller_action_id: action.id).each{ |item| item.destroy } @@ -15,9 +17,11 @@ def self.up controller = SiteController.find_by_name('publishing') if controller - ControllerAction.find_all_by_site_controller_id(controller.id).each{ + #ControllerAction.find_all_by_site_controller_id(controller.id).each{ + ControllerAction.where(site_controller_id: controller.id).each{ | action | - MenuItem.find_all_by_controller_action_id(action.id).each{ + #MenuItem.find_all_by_controller_action_id(action.id).each{ + MenuItem.where(controller_action_id: action.id).each{ |item| item.destroy } @@ -28,9 +32,11 @@ def self.up controller = SiteController.find_by_name('submission') if controller - ControllerAction.find_all_by_site_controller_id(controller.id).each{ + #ControllerAction.find_all_by_site_controller_id(controller.id).each{ + ControllerAction.where(site_controller_id: controller.id).each{ | action | - MenuItem.find_all_by_controller_action_id(action.id).each{ + #MenuItem.find_all_by_controller_action_id(action.id).each{ + MenuItem.where(controller_action_id: action.id).each{ |item| item.destroy } diff --git a/db/migrate/076_update_menus.rb b/db/migrate/076_update_menus.rb index 5bb133f79a7..d0c5c8fbd78 100644 --- a/db/migrate/076_update_menus.rb +++ b/db/migrate/076_update_menus.rb @@ -38,7 +38,8 @@ def self.up assignments_action.site_controller_id = site_controller.id assignments_action.save - MenuItem.find(:all, :conditions => ['parent_id is null and seq >= 3']).each{ + #MenuItem.find(:all, :conditions => ['parent_id is null and seq >= 3']).each{ + MenuItem.where('parent_id = null and seq >= 3').each{ |item| item.seq += 1 item.save @@ -75,7 +76,7 @@ def self.up admin_item = MenuItem.find_by_label('Administration') admin_item.controller_action_id = nil content_page = ContentPage.find_by_name('site_admin') - content_page.permission_id = Permission.find_by_name('administer goldberg') + content_page.permission_id = Permission.find_by_name('administer goldberg').id content_page.save admin_item.content_page_id = content_page.id admin_item.save diff --git a/db/migrate/085_update_controllers_teammate_review.rb b/db/migrate/085_update_controllers_teammate_review.rb index 7ce52f74167..4e8ec3c532a 100644 --- a/db/migrate/085_update_controllers_teammate_review.rb +++ b/db/migrate/085_update_controllers_teammate_review.rb @@ -15,7 +15,8 @@ def self.up action = ControllerAction.create(:site_controller_id => controller.id, :name => 'goto_teammate_reviews') item = MenuItem.find_by_name('manage/questionnaires') - maxseq = MenuItem.find_all_by_parent_id(item.id).length + #maxseq = MenuItem.find_all_by_parent_id(item.id).length + maxseq = MenuItem.where(parent_id: item.id).length MenuItem.create(:name => 'manage/questionnaires/teammate reviews', :label => 'Teammate Review', :parent_id => item.id, :seq => maxseq+1, :controller_action_id => action.id) Role.rebuild_cache diff --git a/db/migrate/104_update_rubric_types.rb b/db/migrate/104_update_rubric_types.rb index f9b0793aefc..96921cea8f2 100644 --- a/db/migrate/104_update_rubric_types.rb +++ b/db/migrate/104_update_rubric_types.rb @@ -2,7 +2,8 @@ class UpdateRubricTypes < ActiveRecord::Migration def self.up metareview_type = ActiveRecord::Base.connection.select_one("select * from `questionnaire_types` where name = 'Metareview'") pnode = QuestionnaireTypeNode.find_by_node_object_id(metareview_type["id"]) - questionnaires = Questionnaire.find(:all, :conditions => ['id in (6,16,43,91)']) + #questionnaires = Questionnaire.find(:all, :conditions => ['id in (6,16,43,91)']) + questionnaires = Questionnaire.where('id in (6,16,43,91)') questionnaires.each{ | questionnaire | questionnaire.type_id = metareview_type["id"] diff --git a/db/migrate/108_create_questionnaire_folder_nodes.rb b/db/migrate/108_create_questionnaire_folder_nodes.rb index 2b87490dcda..a4c987a4421 100644 --- a/db/migrate/108_create_questionnaire_folder_nodes.rb +++ b/db/migrate/108_create_questionnaire_folder_nodes.rb @@ -1,8 +1,9 @@ class CreateQuestionnaireFolderNodes < ActiveRecord::Migration def self.up - add_column :tree_folders, :parent_id, :integer, :null => true + #add_column :tree_folders, :parent_id, :integer, :null => true - Node.find(:all, :conditions => ['type in ("QuestionnaireTypeNode","QuestionnaireNode")']).each{ + #Node.find(:all, :conditions => ['type in ("QuestionnaireTypeNode","QuestionnaireNode")']).each{ + Node.where('type in ("QuestionnaireTypeNode","QuestionnaireNode")').each{ | node | node.destroy } @@ -66,7 +67,8 @@ def self.up QuestionnaireNode.create(:parent_id => pfNode.id, :node_object_id => questionnaire.id) } - folders = TreeFolder.find_all_by_child_type('QuestionnaireNode') + #folders = TreeFolder.find_all_by_child_type('QuestionnaireNode') + folders = TreeFolder.where(child_type: 'QuestionnaireNode') folders.each { | folder | folder.update_attribute("parent_id",parent.id) diff --git a/db/migrate/121_create_suggestions.rb b/db/migrate/121_create_suggestions.rb index 1f81fc9ddee..9c9fc7a6066 100644 --- a/db/migrate/121_create_suggestions.rb +++ b/db/migrate/121_create_suggestions.rb @@ -1,7 +1,7 @@ class CreateSuggestions < ActiveRecord::Migration def self.up create_table :suggestions do |t| - t.column :id, :int + #t.column :id, :int t.column :assignment_id, :int t.column :title, :string t.column :description, :string, :limit=>750 diff --git a/db/migrate/122_create_suggestion_comments.rb b/db/migrate/122_create_suggestion_comments.rb index 99634bab05f..291c9ec0356 100644 --- a/db/migrate/122_create_suggestion_comments.rb +++ b/db/migrate/122_create_suggestion_comments.rb @@ -1,7 +1,7 @@ class CreateSuggestionComments < ActiveRecord::Migration def self.up create_table :suggestion_comments do |t| - t.column :id, :int + #t.column :id, :int t.column :comments, :text t.column :commenter, :string t.column :vote, :string diff --git a/db/migrate/129_menu_update_leaderboard.rb b/db/migrate/129_menu_update_leaderboard.rb index 7b50c8db125..7847b5586af 100644 --- a/db/migrate/129_menu_update_leaderboard.rb +++ b/db/migrate/129_menu_update_leaderboard.rb @@ -10,7 +10,8 @@ def self.up site_controller = SiteController.create(:name => 'leaderboard', :permission_id => permission1.id, :builtin => 0) end # is there an index action for leaderboard? - action = ControllerAction.find(:first, :conditions => ['name = "index" and site_controller_id = ?',site_controller.id]) + #action = ControllerAction.find(:first, :conditions => ['name = "index" and site_controller_id = ?',site_controller.id]) + action = ControllerAction.where('name = "index" and site_controller_id = ?',site_controller.id).first # if not, create an index action for leaderboard if action == nil action = ControllerAction.create(:name => 'index', :site_controller_id => site_controller.id) diff --git a/db/migrate/20100920141223_update_menu_impersonate_revert.rb b/db/migrate/20100920141223_update_menu_impersonate_revert.rb index d0a85531385..6d9b5e32775 100644 --- a/db/migrate/20100920141223_update_menu_impersonate_revert.rb +++ b/db/migrate/20100920141223_update_menu_impersonate_revert.rb @@ -3,7 +3,8 @@ def self.up permission = Permission.find_by_name("do assignments") site_controller = SiteController.find_by_name("impersonate") - action = ControllerAction.find(:first, :conditions => ['name = "restore" and site_controller_id = ?',site_controller.id]) + #action = ControllerAction.find(:first, :conditions => ['name = "restore" and site_controller_id = ?',site_controller.id]) + action = ControllerAction.where('name = "restore" and site_controller_id = ?',site_controller.id).first action.name = "impersonate" action.permission_id = permission.id action.save diff --git a/db/migrate/20121127013927_add_bookmarkrating_folder_nodes.rb b/db/migrate/20121127013927_add_bookmarkrating_folder_nodes.rb index 050980d23f2..6b3c33d4529 100644 --- a/db/migrate/20121127013927_add_bookmarkrating_folder_nodes.rb +++ b/db/migrate/20121127013927_add_bookmarkrating_folder_nodes.rb @@ -1,7 +1,8 @@ class AddBookmarkratingFolderNodes < ActiveRecord::Migration def self.up - Node.find(:all, :conditions => ['type in ("QuestionnaireTypeNode","QuestionnaireNode")']).each{ + #Node.find(:all, :conditions => ['type in ("QuestionnaireTypeNode","QuestionnaireNode")']).each{ + Node.where('type in ("QuestionnaireTypeNode","QuestionnaireNode")').each{ | node | node.destroy } @@ -19,7 +20,8 @@ def self.up - folders = TreeFolder.find_all_by_child_type('QuestionnaireNode') + #folders = TreeFolder.find_all_by_child_type('QuestionnaireNode') + folders = TreeFolder.where(child_type: 'QuestionnaireNode') folders.each { | folder | folder.update_attribute("parent_id",parent.id) diff --git a/db/migrate/20131124173014_create_team_roles.rb b/db/migrate/20131124173014_create_team_roles.rb index b5a780020f7..c317fe498bf 100644 --- a/db/migrate/20131124173014_create_team_roles.rb +++ b/db/migrate/20131124173014_create_team_roles.rb @@ -1,7 +1,7 @@ class CreateTeamRoles < ActiveRecord::Migration def self.up create_table "team_roles", :force => true do |t| - t.integer "id" + #t.integer "id" t.string "role_names" t.integer "questionnaire_id" end diff --git a/db/migrate/20131124173146_create_team_rolesets.rb b/db/migrate/20131124173146_create_team_rolesets.rb index 17f380dd125..bcc9dd5e0a5 100644 --- a/db/migrate/20131124173146_create_team_rolesets.rb +++ b/db/migrate/20131124173146_create_team_rolesets.rb @@ -1,7 +1,7 @@ class CreateTeamRolesets < ActiveRecord::Migration def self.up create_table "team_rolesets", :force => true do |t| - t.integer "id" + #t.integer "id" t.string "roleset_name" end end diff --git a/db/migrate/20131124173225_create_teamrole_assignment.rb b/db/migrate/20131124173225_create_teamrole_assignment.rb index fec9a1d24ab..65ed3e65de0 100644 --- a/db/migrate/20131124173225_create_teamrole_assignment.rb +++ b/db/migrate/20131124173225_create_teamrole_assignment.rb @@ -1,7 +1,7 @@ class CreateTeamroleAssignment < ActiveRecord::Migration def self.up create_table "teamrole_assignment", :force => true do |t| - t.integer "id" + #t.integer "id" t.integer "team_roleset_id" t.integer "assignment_id" end @@ -21,4 +21,4 @@ def self.down DROP FOREIGN KEY `fk_teamrole_assignment_assignments`" drop_table :teamrole_assignment end -end \ No newline at end of file +end diff --git a/db/migrate/20131124180730_create_team_role_questionnaire.rb b/db/migrate/20131124180730_create_team_role_questionnaire.rb index 854e6ee3549..2b39fc1c4eb 100644 --- a/db/migrate/20131124180730_create_team_role_questionnaire.rb +++ b/db/migrate/20131124180730_create_team_role_questionnaire.rb @@ -1,7 +1,7 @@ class CreateTeamRoleQuestionnaire < ActiveRecord::Migration def self.up create_table "team_role_questionnaire", :force => true do |t| - t.integer :id + #t.integer :id t.integer :team_roles_id t.integer :questionnaire_id t.timestamps @@ -22,4 +22,4 @@ def self.down DROP FOREIGN KEY fk_questionnaire_id" drop_table :team_role_questionnaire end -end \ No newline at end of file +end diff --git a/db/migrate/20131124180940_create_team_rolesets_maps.rb b/db/migrate/20131124180940_create_team_rolesets_maps.rb index 5b8087132ed..21540fd7110 100644 --- a/db/migrate/20131124180940_create_team_rolesets_maps.rb +++ b/db/migrate/20131124180940_create_team_rolesets_maps.rb @@ -1,7 +1,7 @@ class CreateTeamRolesetsMaps < ActiveRecord::Migration def self.up create_table :team_rolesets_maps do |t| - t.integer :id + #t.integer :id t.integer :team_rolesets_id t.integer :team_role_id t.timestamps @@ -21,4 +21,4 @@ def self.down DROP FOREIGN KEY fk_team_role_id" drop_table :team_rolesets_maps end -end \ No newline at end of file +end diff --git a/db/migrate/20131124181007_create_participant_team_roles.rb b/db/migrate/20131124181007_create_participant_team_roles.rb index 414af4e1882..0668bd5e8ca 100644 --- a/db/migrate/20131124181007_create_participant_team_roles.rb +++ b/db/migrate/20131124181007_create_participant_team_roles.rb @@ -1,7 +1,7 @@ class CreateParticipantTeamRoles < ActiveRecord::Migration def self.up create_table :participant_team_roles do |t| - t.integer :id + #t.integer :id t.integer :role_assignment_id t.integer :participant_id t.timestamps @@ -21,4 +21,4 @@ def self.down DROP FOREIGN KEY fk_participant_id" drop_table :participant_team_roles end -end \ No newline at end of file +end diff --git a/db/schema.rb b/db/schema.rb index c200b260bc7..cc1c1cbcce3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -19,7 +19,6 @@ t.integer "user_id" t.integer "notification_limit", default: 15, null: false t.integer "questionnaire_weight", default: 0, null: false - t.integer "used_in_round" end add_index "assignment_questionnaires", ["assignment_id"], name: "fk_aq_assignments_id", using: :btree @@ -31,43 +30,44 @@ t.datetime "updated_at" t.string "name" t.string "directory_path" - t.integer "submitter_count", default: 0, null: false - t.integer "course_id", default: 0 - t.integer "instructor_id", default: 0 - t.boolean "private", default: false, null: false - t.integer "num_reviews", default: 0, null: false - t.integer "num_review_of_reviews", default: 0, null: false - t.integer "num_review_of_reviewers", default: 0, null: false + t.integer "submitter_count", limit: 8, default: 0, null: false + t.integer "course_id", default: 0 + t.integer "instructor_id", default: 0 + t.boolean "private", default: false, null: false + t.integer "num_reviews", default: 0, null: false + t.integer "num_review_of_reviews", default: 0, null: false + t.integer "num_review_of_reviewers", default: 0, null: false t.integer "review_questionnaire_id" t.integer "review_of_review_questionnaire_id" - t.integer "teammate_review_questionnaire_id" t.boolean "reviews_visible_to_all" - t.integer "wiki_type_id", default: 0, null: false + t.boolean "team_assignment" + t.integer "wiki_type_id" t.boolean "require_signup" - t.integer "num_reviewers", default: 0, null: false + t.integer "num_reviewers", limit: 8, default: 0, null: false t.text "spec_location" t.integer "author_feedback_questionnaire_id" - t.integer "max_team_size", default: 0, null: false + t.integer "teammate_review_questionnaire_id" + t.integer "max_team_size", default: 0, null: false t.boolean "staggered_deadline" t.boolean "allow_suggestions" t.integer "days_between_submissions" t.string "review_assignment_strategy" t.integer "max_reviews_per_submission" - t.integer "review_topic_threshold", default: 0 + t.integer "review_topic_threshold", default: 0 + t.boolean "copy_flag", default: false + t.integer "rounds_of_reviews", default: 1 + t.boolean "microtask", default: false t.boolean "availability_flag" - t.boolean "copy_flag", default: false - t.integer "rounds_of_reviews", default: 1 - t.boolean "microtask", default: false - t.integer "selfreview_questionnaire_id" - t.integer "managerreview_questionnaire_id" - t.integer "readerreview_questionnaire_id" t.boolean "require_quiz" - t.integer "num_quiz_questions", default: 0, null: false + t.integer "num_quiz_questions", default: 0, null: false t.boolean "is_coding_assignment" t.boolean "is_intelligent" - t.boolean "calculate_penalty", default: false, null: false + t.integer "selfreview_questionnaire_id" + t.integer "managerreview_questionnaire_id" + t.integer "readerreview_questionnaire_id" + t.boolean "calculate_penalty", default: false, null: false t.integer "late_policy_id" - t.boolean "is_penalty_calculated", default: false, null: false + t.boolean "is_penalty_calculated", default: false, null: false end add_index "assignments", ["course_id"], name: "fk_assignments_courses", using: :btree @@ -173,9 +173,9 @@ end create_table "comments", force: true do |t| - t.integer "participant_id", default: 0, null: false - t.boolean "private", default: false, null: false - t.text "comment", null: false + t.integer "participant_id", null: false + t.boolean "private", null: false + t.text "comment", null: false end create_table "content_pages", force: true do |t| @@ -251,18 +251,16 @@ t.boolean "flag", default: false t.integer "threshold", default: 1 t.integer "delayed_job_id" - t.string "deadline_name" - t.string "description_url" t.integer "quiz_allowed_id" end add_index "due_dates", ["assignment_id"], name: "fk_due_dates_assignments", using: :btree add_index "due_dates", ["deadline_type_id"], name: "fk_deadline_type_due_date", using: :btree - add_index "due_dates", ["rereview_allowed_id"], name: "fk_due_date_rereview_allowed", using: :btree - add_index "due_dates", ["resubmission_allowed_id"], name: "fk_due_date_resubmission_allowed", using: :btree - add_index "due_dates", ["review_allowed_id"], name: "fk_due_date_review_allowed", using: :btree - add_index "due_dates", ["review_of_review_allowed_id"], name: "fk_due_date_review_of_review_allowed", using: :btree - add_index "due_dates", ["submission_allowed_id"], name: "fk_due_date_submission_allowed", using: :btree + add_index "due_dates", ["rereview_allowed_id"], name: "idx_rereview_allowed", using: :btree + add_index "due_dates", ["resubmission_allowed_id"], name: "idx_resubmission_allowed", using: :btree + add_index "due_dates", ["review_allowed_id"], name: "idx_review_allowed", using: :btree + add_index "due_dates", ["review_of_review_allowed_id"], name: "idx_review_of_review_allowed", using: :btree + add_index "due_dates", ["submission_allowed_id"], name: "idx_submission_allowed", using: :btree create_table "institutions", force: true do |t| t.string "name", default: "", null: false @@ -293,17 +291,15 @@ end create_table "late_policies", force: true do |t| - t.integer "penalty_period_in_minutes" - t.float "penalty_per_unit", limit: 24 - t.boolean "expressed_as_percentage" - t.integer "max_penalty", default: 0, null: false - t.string "penalty_unit", null: false - t.integer "times_used", default: 0, null: false - t.integer "instructor_id", null: false - t.string "policy_name", null: false + t.float "penalty_per_unit", limit: 24 + t.integer "max_penalty", default: 0, null: false + t.string "penalty_unit", null: false + t.integer "times_used", default: 0, null: false + t.integer "instructor_id", null: false + t.string "policy_name", null: false end - add_index "late_policies", ["penalty_period_in_minutes"], name: "penalty_period_length_unit", using: :btree + add_index "late_policies", ["instructor_id"], name: "fk_instructor_id", using: :btree create_table "leaderboards", force: true do |t| t.integer "questionnaire_type_id" @@ -332,6 +328,8 @@ t.integer "parent_id" t.integer "node_object_id" t.string "type" + t.integer "lft" + t.integer "rgt" end create_table "participant_score_views", id: false, force: true do |t| @@ -342,7 +340,7 @@ t.integer "max_question_score" t.integer "team_id", default: 0, null: false t.integer "participant_id" - t.integer "assignment_id" + t.integer "assignment_id", default: 0, null: false end create_table "participant_team_roles", force: true do |t| @@ -356,15 +354,15 @@ add_index "participant_team_roles", ["role_assignment_id"], name: "fk_role_assignment_id", using: :btree create_table "participants", force: true do |t| - t.boolean "submit_allowed", default: true - t.boolean "review_allowed", default: true + t.boolean "submit_allowed", default: true + t.boolean "review_allowed", default: true t.integer "user_id" t.integer "parent_id" t.integer "directory_num" t.datetime "submitted_at" t.boolean "permission_granted" - t.integer "penalty_accumulated", default: 0, null: false - t.text "submitted_hyperlinks" + t.integer "penalty_accumulated", limit: 8, default: 0, null: false + t.string "submitted_hyperlinks", limit: 500 t.float "grade", limit: 24 t.string "type" t.string "handle" @@ -394,9 +392,9 @@ add_index "question_advices", ["question_id"], name: "fk_question_question_advices", using: :btree create_table "question_types", force: true do |t| - t.string "q_type", default: "", null: false + t.string "q_type", null: false t.string "parameters" - t.integer "question_id", default: 1, null: false + t.integer "question_id", default: 1, null: false end add_index "question_types", ["question_id"], name: "fk_question_type_question", using: :btree @@ -412,8 +410,8 @@ t.integer "default_num_choices" t.string "type" t.string "display_type" - t.text "instruction_loc" t.string "section" + t.text "instruction_loc" end create_table "questions", force: true do |t| @@ -432,12 +430,11 @@ end create_table "response_maps", force: true do |t| - t.integer "reviewed_object_id", default: 0, null: false - t.integer "reviewer_id", default: 0, null: false - t.integer "reviewee_id", default: 0, null: false - t.string "type", default: "", null: false + t.integer "reviewed_object_id", null: false + t.integer "reviewer_id", null: false + t.integer "reviewee_id", null: false + t.string "type", null: false t.boolean "notification_accepted", default: false - t.integer "round" t.datetime "created_at" t.datetime "updated_at" end @@ -445,11 +442,10 @@ add_index "response_maps", ["reviewer_id"], name: "fk_response_map_reviewer", using: :btree create_table "responses", force: true do |t| - t.integer "map_id", default: 0, null: false - t.text "additional_comment" + t.integer "map_id", null: false + t.string "additional_comment" t.datetime "created_at" t.datetime "updated_at" - t.integer "version_num" end add_index "responses", ["map_id"], name: "fk_response_response_map", using: :btree @@ -502,16 +498,16 @@ add_index "roles_permissions", ["role_id"], name: "fk_roles_permission_role_id", using: :btree create_table "score_caches", force: true do |t| - t.integer "reviewee_id" + t.integer "reviewee_id", default: 0, null: false t.float "score", limit: 24, default: 0.0, null: false t.string "range", default: "" - t.string "object_type", default: "", null: false + t.string "object_type", null: false end create_table "score_views", id: false, force: true do |t| t.integer "question_weight" t.integer "q_id", default: 0 - t.string "q_type", default: "" + t.string "q_type" t.string "q_parameters" t.integer "q_question_id", default: 1 t.integer "q1_id", default: 0 @@ -530,14 +526,14 @@ t.integer "ques_id", default: 0, null: false t.integer "ques_questionnaire_id" t.integer "s_id", default: 0 - t.integer "s_question_id", default: 0 + t.integer "s_question_id" t.integer "s_score" t.text "s_comments" t.integer "s_response_id" end create_table "scores", force: true do |t| - t.integer "question_id", default: 0, null: false + t.integer "question_id", null: false t.integer "score" t.text "comments" t.integer "response_id" @@ -547,7 +543,7 @@ add_index "scores", ["response_id"], name: "fk_score_response", using: :btree create_table "sessions", force: true do |t| - t.string "session_id", default: "", null: false + t.string "session_id", null: false t.text "data", limit: 16777215 t.datetime "created_at" t.datetime "updated_at" @@ -558,8 +554,8 @@ create_table "sign_up_topics", force: true do |t| t.text "topic_name", null: false - t.integer "assignment_id", default: 0, null: false - t.integer "max_choosers", default: 0, null: false + t.integer "assignment_id", null: false + t.integer "max_choosers", null: false t.text "category" t.string "topic_identifier", limit: 10 t.integer "micropayment", default: 0 @@ -569,9 +565,9 @@ add_index "sign_up_topics", ["assignment_id"], name: "fk_sign_up_categories_sign_up_topics", using: :btree create_table "signed_up_users", force: true do |t| - t.integer "topic_id", default: 0, null: false - t.integer "creator_id", default: 0, null: false - t.boolean "is_waitlisted", default: false, null: false + t.integer "topic_id", null: false + t.integer "creator_id", null: false + t.boolean "is_waitlisted", null: false t.integer "preference_priority_number" end @@ -596,7 +592,7 @@ create_table "suggestions", force: true do |t| t.integer "assignment_id" t.string "title" - t.text "description" + t.string "description", limit: 750 t.string "status" t.string "unityID" t.string "signup_preference" @@ -608,7 +604,6 @@ t.datetime "end_date" t.integer "num_of_students" t.datetime "last_reminder" - t.integer "course_id", default: 0, null: false end create_table "survey_participants", force: true do |t| @@ -617,11 +612,11 @@ end create_table "survey_responses", force: true do |t| - t.integer "score" + t.integer "score", limit: 8 t.text "comments" - t.integer "assignment_id", default: 0, null: false - t.integer "question_id", default: 0, null: false - t.integer "survey_id", default: 0, null: false + t.integer "assignment_id", default: 0, null: false + t.integer "question_id", limit: 8, default: 0, null: false + t.integer "survey_id", limit: 8, default: 0, null: false t.string "email" t.integer "survey_deployment_id" end @@ -699,7 +694,7 @@ create_table "teams", force: true do |t| t.string "name" - t.integer "parent_id" + t.integer "parent_id", default: 0, null: false t.string "type" t.text "comments_for_advertisement" t.boolean "advertise_for_partner" @@ -726,8 +721,6 @@ t.integer "round" end - add_index "topic_deadlines", ["deadline_type_id"], name: "fk_deadline_type_topic_deadlines", using: :btree - add_index "topic_deadlines", ["late_policy_id"], name: "fk_topic_deadlines_late_policies", using: :btree add_index "topic_deadlines", ["rereview_allowed_id"], name: "idx_rereview_allowed", using: :btree add_index "topic_deadlines", ["resubmission_allowed_id"], name: "idx_resubmission_allowed", using: :btree add_index "topic_deadlines", ["review_allowed_id"], name: "idx_review_allowed", using: :btree @@ -736,8 +729,8 @@ add_index "topic_deadlines", ["topic_id"], name: "fk_topic_deadlines_topics", using: :btree create_table "topic_dependencies", force: true do |t| - t.integer "topic_id", default: 0, null: false - t.string "dependent_on", default: "", null: false + t.integer "topic_id", null: false + t.string "dependent_on", null: false end create_table "tree_folders", force: true do |t| @@ -759,15 +752,15 @@ t.boolean "email_on_review" t.boolean "email_on_submission" t.boolean "email_on_review_of_review" - t.boolean "is_new_user", default: true, null: false - t.integer "master_permission_granted", limit: 1, default: 0 + t.boolean "is_new_user", default: true + t.boolean "master_permission_granted" t.string "handle" t.boolean "leaderboard_privacy", default: false + t.boolean "copy_of_emails", default: false t.text "digital_certificate" t.string "persistence_token" t.string "timezonepref" t.text "public_key" - t.boolean "copy_of_emails", default: false end add_index "users", ["role_id"], name: "fk_user_role_id", using: :btree diff --git a/db/seeds.rb b/db/seeds.rb index 83d9aeba0ce..c633b6b351b 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -12,11 +12,13 @@ Permission.create(:name => 'do assignments') Permission.create(:name => 'administer instructors') Permission.create(:name => 'administer courses') +puts 'permissions' ###### markup_styles MarkupStyle.create(:name => 'Textile') MarkupStyle.create(:name => 'Markdown') +puts 'markup' ###### site_controllers SiteController.create(:name => 'content_pages', :builtin => true, :permission_id => Permission.find_by_name('administer goldberg').id) SiteController.create(:name => 'controller_actions', :builtin => true, :permission_id => Permission.find_by_name('administer goldberg').id) @@ -68,6 +70,7 @@ SiteController.create(:name => 'advertise_for_partner', :builtin => false, :permission_id => Permission.find_by_name('do assignments').id) SiteController.create(:name => 'join_team_requests', :builtin => false, :permission_id => Permission.find_by_name('do assignments').id) +puts 'SiteController' ###### content_pages ContentPage.create(:title => 'Home Page', :name => 'home', :markup_style_id => MarkupStyle.find_by_name('Textile').id, :permission_id => Permission.find_by_name('public pages - view').id, :content => "

Welcome to Expertiza

The Expertiza project is a system for using peer review to create reusable learning objects. Students do different assignments; then peer review selects the best work in each category, and assembles it to create a single unit.

", @@ -94,6 +97,7 @@ :content => "h1. Credits and License\n\nGoldberg contains original material and third-party material from various sources.\n\nAll original material is (p) Public Domain, No Rights Reserved. Goldberg comes with no warranty whatsoever.\n\nThe copyright for any third party material remains with the original author, and the material is distributed here under the original terms. \n\nMaterial has been selected from sources with licensing terms and conditions that allow use and redistribution for both personal and business purposes. These licences include public domain, BSD-style licences, and Creative Commons licences (but *not* Creative Commons Non-Commercial).\n\nIf you are an author and you believe your copyrighted material has been included in Goldberg in breach of your licensing terms and conditions, please contact Dave Nelson (urbanus at 240gl dot org).\n\n\nh2. Layouts\n\nGoldberg comes with a choice of layouts, adapted from various sources.\n\nh3. The Default\n\nThe default layout is a modified version of Andreas09 by Anreas Viklund. Andreas09 is distributed under free/unlicensed terms, with an informal request that credit be given to the original author. The original template can be obtained from \"Open Source Web Design\":http://www.oswd.org/design/preview/id/2493/.\n\nAuthor''s website: \"andreasviklund.com\":http://andreasviklund.com/.\n\n\nh3. \"Earth Wind and Fire\"\n\nOriginally designed by Brett Hillesheim (brett7481 at msn dot com) and distributed under free terms (from the MadSeason website: \"Every template we create is completely open source, meaning you can take it and do whatever you want with it\"). The original template can be obtained from \"Open Source Web Design\":http://www.oswd.org/design/preview/id/2453/.\n\nAuthor''s website: \"www.madseason.co.uk\":http://www.madseason.co.uk/.\n\n\nh3. \"Snooker\"\n\n\"Snooker\" is an original design and is therefore Public Domain. It incorporates dynamic two-column layout techniques described on the \"A List Apart\":http://alistapart.com/articles/negativemargins website.\n\n\nh3. \"Spoiled Brat\"\n\nOriginally designed by \"Rayk Web Design\":http://www.raykdesign.net/ and distributed under the terms of the \"Creative Commons Attribution Share Alike\":http://creativecommons.org/licenses/by-sa/2.5/legalcode licence. The original template can be obtained from \"Open Web Design\":http://www.openwebdesign.org/viewdesign.phtml?id=2894/.\n\nAuthor''s website: \"www.csstinderbox.com\":http://www.csstinderbox.com/.\n\n\nh2. Other Features\n\nGoldberg also contains some miscellaneous code and techniques from other sources.\n\nh3. Suckerfish Menus\n\nThe three templates \"Earth Wind and Fire\", \"Snooker\" and \"Spoiled Brat\" have all been configured to use Suckerfish menus. This technique of using a combination of CSS and Javascript to implement dynamic menus was first described by \"A List Apart\":http://www.alistapart.com/articles/dropdowns/. Goldberg''s implementation also incorporates techniques described by \"HTMLDog\":http://www.htmldog.com/articles/suckerfish/dropdowns/.\n\nh3. Tabbed Panels\n\nGoldberg''s implementation of tabbed panels was adapted from \n\"InternetConnection\":http://support.internetconnection.net/CODE_LIBRARY/Javascript_Show_Hide.shtml.\n", :content_cache => "

Credits and Licence

\n\n\n

Goldberg contains original material and third party material from various sources.

\n\n\n

All original material is (p) Public Domain, No Rights Reserved. Goldberg comes with no warranty whatsoever.

\n\n\n

The copyright for any third party material remains with the original author, and the material is distributed here under the original terms.

\n\n\n

Material has been selected from sources with licensing terms and conditions that allow use and redistribution for both personal and business purposes. These licences include public domain, BSD-style licences, and Creative Commons licences (but not Creative Commons Non-Commercial).

\n\n\n

If you are an author and you believe your copyrighted material has been included in Goldberg in breach of your licensing terms and conditions, please contact Dave Nelson (urbanus at 240gl dot org).

\n\n\n

Layouts

\n\n\n

Goldberg comes with a choice of layouts, adapted from various sources.

\n\n\n

The Default

\n\n\n

The default layout is a modified version of Andreas09 by Anreas Viklund. Andreas09 is distributed under free/unlicensed terms, with an informal request that credit be given to the original author. The original template can be obtained from Open Source Web Design.

\n\n\n

Author’s website: andreasviklund.com.

\n\n\n

“Earth Wind and Fire”

\n\n\n

Originally designed by Brett Hillesheim (brett7481 at msn dot com) and distributed under free terms (from the MadSeason website: “Every template we create is completely open source, meaning you can take it and do whatever you want with it”). The original template can be obtained from Open Source Web Design.

\n\n\n

Author’s website: www.madseason.co.uk.

\n\n\n

“Snooker”

\n\n\n

“Snooker” is an original design and is therefore Public Domain. It incorporates dynamic two-column layout techniques described on the A List Apart website.

\n\n\n

“Spoiled Brat”

\n\n\n

Originally designed by Rayk Web Design and distributed under the terms of the Creative Commons Attribution Share Alike licence. The original template can be obtained from Open Web Design.

\n\n\n

Author’s website: www.csstinderbox.com.

\n\n\n

Other Features

\n\n\n

Goldberg also contains some miscellaneous code and techniques from other sources.

\n\n\n

Suckerfish Menus

\n\n\n

The three templates “Earth Wind and Fire”, “Snooker” and “Spoiled Brat” have all been configured to use Suckerfish menus. This technique of using a combination of CSS and Javascript to implement dynamic menus was first described by A List Apart. Goldberg’s implementation also incorporates techniques described by HTMLDog.

\n\n\n

Tabbed Panels

\n\n\n

Goldberg’s implementation of tabbed panels was adapted from \nInternetConnection.

") +puts 'ContentPage' ###### controller_actions ControllerAction.create(:site_controller_id => SiteController.find_by_name('content_pages').id, :name => 'view_default', :permission_id => Permission.find_by_name('public pages - view').id, :url_to_use => '') ControllerAction.create(:site_controller_id => SiteController.find_by_name('content_pages').id, :name => 'view', :permission_id => Permission.find_by_name('public pages - view').id, :url_to_use => '') @@ -180,6 +184,7 @@ ControllerAction.create(:site_controller_id => SiteController.find_by_name('join_team_requests').id, :name => 'show', :permission_id => Permission.find_by_name('do assignments').id, :url_to_use => '') ControllerAction.create(:site_controller_id => SiteController.find_by_name('join_team_requests').id, :name => 'update', :permission_id => Permission.find_by_name('do assignments').id, :url_to_use => '') +puts 'ControllerAction' ###### menu_items MenuItem.create(:parent_id => nil, :name => 'home', :label => 'Home', :seq => 1, :content_page_id => ContentPage.find_by_name('home').id, :controller_action_id => nil) @@ -250,6 +255,7 @@ MenuItem.create(:parent_id => MenuItem.find_by_name('show').id, :name => 'show/instructors', :label => 'Instructors', :seq => 4, :content_page_id => nil, :controller_action_id => ControllerAction.where(site_controller_id: SiteController.find_by_name('admin').id, name: 'list_instructors').first.id) +puts 'MenuItem' ###### roles Role.create(:name => 'Student', :parent_id => nil) Role.create(:name => 'Teaching Assistant', :parent_id => Role.find_by_name('Student').id) @@ -257,6 +263,7 @@ Role.create(:name => 'Administrator', :parent_id => Role.find_by_name('Instructor').id) Role.create(:name => 'Super-Administrator', :parent_id => Role.find_by_name('Administrator').id) +puts 'Role' ###### roles_permissions RolesPermission.create(:role_id => Role.find_by_name('Student').id, :permission_id => Permission.find_by_name('public pages - view').id) RolesPermission.create(:role_id => Role.find_by_name('Student').id, :permission_id => Permission.find_by_name('public actions - execute').id) @@ -268,19 +275,21 @@ RolesPermission.create(:role_id => Role.find_by_name('Super-Administrator').id, :permission_id => Permission.find_by_name('administer assignments').id) RolesPermission.create(:role_id => Role.find_by_name('Super-Administrator').id, :permission_id => Permission.find_by_name('administer instructors').id) +puts 'RolesPermission' ###### system_settings -SystemSettings.create(:site_name => 'Expertiza', - :site_subtitle => 'Reusable learning objects through peer review', - :footer_message => 'Expertiza', - :public_role_id => Role.find_by_name('Student').id, - :session_timeout => 7200, - :default_markup_style_id => MarkupStyle.find_by_name('Textile').id, - :site_default_page_id => ContentPage.find_by_name('home').id, - :not_found_page_id => ContentPage.find_by_name('notfound').id, - :permission_denied_page_id => ContentPage.find_by_name('denied').id, - :session_expired_page_id => ContentPage.find_by_name('expired').id, - :menu_depth => 3) +# SystemSettings.create(:site_name => 'Expertiza', +# :site_subtitle => 'Reusable learning objects through peer review', +# :footer_message => 'Expertiza', +# :public_role_id => Role.find_by_name('Student').id, +# :session_timeout => 7200, +# :default_markup_style_id => MarkupStyle.find_by_name('Textile').id, +# :site_default_page_id => ContentPage.find_by_name('home').id, +# :not_found_page_id => ContentPage.find_by_name('notfound').id, +# :permission_denied_page_id => ContentPage.find_by_name('denied').id, +# :session_expired_page_id => ContentPage.find_by_name('expired').id, +# :menu_depth => 3) +puts 'SystemSettings' ###### users # Default administrator puts "Find or create admin user with password 'admin'" @@ -299,6 +308,7 @@ tu.save! +puts 'Users' ########################################################################### # Display tables ########################################################################### @@ -314,6 +324,7 @@ TreeFolder.create(:name => 'Global Survey', :child_type => 'QuestionnaireNode') TreeFolder.create(:name => 'Course Evaluation', :child_type => 'QuestionnaireNode') +puts 'TreeFolder' ###### nodes n1 = Node.create!(:parent_id => nil, :node_object_id => TreeFolder.find_by_name('Questionnaires').id) Node.create(:parent_id => nil, :node_object_id => TreeFolder.find_by_name('Courses').id) @@ -332,6 +343,7 @@ n.save end +puts 'Node' ###### extra stuff # Rebuild the role cache. Role.rebuild_cache @@ -352,5 +364,7 @@ DeadlineRight.create(:name => 'Late') DeadlineRight.create(:name => 'OK') +puts 'Deadline' ###### WikiType WikiType.create(:name => 'No') +puts 'WikiType'