%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see .
%>
<%
provide :page_title, join_title(t(:page_title, "Course Details"), @context.name)
css_bundle :course_settings
js_bundle :course_settings
set_active_tab "settings"
can_manage = can_do(@context, @current_user, :manage)
can_manage_courses = can_do(@context.account, @current_user, :manage_courses)
can_rename_course = can_manage_courses || (can_manage && !@context.root_account.settings[:prevent_course_renaming_by_teachers])
can_manage_master_courses = can_manage_courses && can_do(@context.account, @current_user, :manage_master_courses)
has_multiple_sections = @context.course_sections.active.count > 1
can_see_users = can_do(@context, @current_user, :read_roster, :manage_students, :manage_admin_users)
is_master_course = MasterCourses::MasterTemplate.is_master_course?(@context)
blueprint_subscription = @context.master_course_subscriptions.active.first
master_course = blueprint_subscription&.master_template&.course
%>
<% provide :right_side do %>
<%= render :partial => 'settings_sidebar', :locals => { :blueprint_subscription => blueprint_subscription } %>
<% end %>
<%= t 'course_settings_title', "Course Settings" %>
<% if can_manage && can_do(@context.account, @current_user, :manage_courses) %>
<% else %>
<%= @context.enrollment_term.name %>
<% end %>
<%= t "Changing course dates may override term availability settings and placement in the Courses page and Dashboard. Please confirm term dates before modifying course dates." %>
<% warning_message = t(:course_conclude_at_warning_message, "The course is currently set to end at midnight, meaning that the previous day will be the last day this course is active.") %>
<%= f.text_field :conclude_at, :class => "date_entry", :value => datetime_string(@context.conclude_at, :verbose) %>
<%= warning_message %>
">
<%= warning_message %>
<%= f.check_box :restrict_enrollments_to_course_dates, "aria-describedby" => 'users-can-only-participate-description' %>
<%= f.label :restrict_enrollments_to_course_dates, :en => "Students can only participate in the course between these dates" %>
<%= t "When selected, the course is in a read-only state outside these dates." %>
<% else %>
<%= datetime_string(@context.conclude_at, :verbose) %>
<% end %>
<% unless can_manage %>
<%= f.check_box :restrict_enrollments_to_course_dates, :disabled => true %>
<%= f.label :restrict_enrollments_to_course_dates, :en => "Students can only participate in the course between these dates" %>
<% end %>
<%= f.check_box :restrict_student_past_view, :disabled => !can_manage || @context.account.restrict_student_past_view[:locked] %>
<%= f.label :restrict_student_past_view, :en => "Restrict students from viewing this course after end date" %>
<%= f.check_box :restrict_student_future_view, :disabled => !can_manage || @context.account.restrict_student_future_view[:locked] %>
<%= f.label :restrict_student_future_view, :en => "Restrict students from viewing this course before start date" %>
<%= t "When selected, the course is inaccessible outside course dates. If the course dates are blank, these start and end dates apply to the term dates." %>
<%= t('language_overrides_preferences', "This will override any user/system language preferences. This is only recommended for foreign language courses") %>
<%= t('turnitin', %{these comments will be shown to students when submitting a Turnitin-enabled assignment}) %>
<%= f.text_area :turnitin_comments, :style => "width: 90%; height: 50px;", :disabled => !can_manage %>
<% end %>
<% if @context.root_account.feature_enabled?(:filter_speed_grader_by_student_group) %>
<%= f.check_box :usage_rights_required, :disabled => !can_manage || @context.account.usage_rights_required[:locked] %>
<%= f.label :usage_rights_required, t('Copyright and license information must be provided for files before they are published.') %>
<%= f.check_box :indexed %>
<%= f.label :indexed, :en => "Include this course in the public course index" %>
<% else %>
<%= @context.course_visibility == 'course' ?
t('If you need to make your course public please contact your administrator/support.') :
t('Contact your administrator if you need to change course visibility.') %>
<% if @context.feature_enabled?(:epub_export) && !@context.account.enable_offline_web_export? %>
<%= f.check_box :organize_epub_by_content_type, :disabled => !can_manage %>
<%= f.label :organize_epub_by_content_type, t("Organize epub by content type (default is by module).") %>
<% end %>
<% if @context.account.enable_offline_web_export? %>
<%= f.check_box :enable_offline_web_export, :disabled => !can_manage %>
<%= f.label :enable_offline_web_export, t("Allow course content to be downloaded and viewed offline") %>
<% if @context.root_account.self_registration? %>
<%= t 'course_open_enrollment', <<-TEXT, :url => enroll_url(@context.self_enrollment_code || '{{ self_enrollment_code }}'), :url2 => register_url, :code => @context.self_enrollment_code || '{{ self_enrollment_code }}', :wrapper => '\1'
This course has enabled open enrollment. Students can
self-enroll in the course once you share with them this URL:
*%{url}*. Alternatively, they can sign up at *%{url2}* and
use the following join code: *%{code}*
TEXT
%>
<% else %>
<%= t 'course_open_enrollment_without_code', <<-TEXT, :url => enroll_url(@context.self_enrollment_code || '{{ self_enrollment_code }}'), :wrapper => '\1'
This course has enabled open enrollment. Students can
self-enroll in the course once you share with them this URL:
*%{url}*
TEXT
%>
<% end %>
<%= t('links.more_options', %{more options}) %>
<%= f.check_box :open_enrollment, :disabled => !can_manage %>
<%= f.label :open_enrollment, :en => "Add a \"Join this Course\" link to the course home page" %>
<% end %>
<%= f.check_box :show_announcements_on_home_page, :disabled => !can_manage %>
<%= f.label :show_announcements_on_home_page, :en => "Show recent announcements on Course home page" %>
<%= f.check_box :allow_student_discussion_editing, :disabled => !can_manage %>
<%= f.label :allow_student_discussion_editing, :en => "Let students edit or delete their own discussion posts" %>
<%= f.check_box :allow_student_organized_groups, :disabled => !can_manage %>
<%= f.label :allow_student_organized_groups, :en => "Let students organize their own groups" %>
<%= t('nav_items_keyboard_drag_and_drop',
'Warning: For improved accessibility in reordering Course Navigation elements, please use the Move To Dialog option found in the menu.') %>
<%= t('help.edit_navigation', %{Drag and drop items to reorder them in the course navigation.}) %>
<% tabs.each do |tab|
tab[:disabled_message] = [Course::TAB_GRADES, Course::TAB_DISCUSSIONS].include?(tab[:id]) ? t('tab_cant_disable', "This page can't be disabled, only hidden") : t('tab_disabled', "Page disabled, will redirect to course home page")
tab[:disabled_message] = t("tab_hidden_if_disabled", "Page disabled, won't appear in navigation") if tab[:external]
end %>
<%= t('Enabled Links') %>
<% tabs.select {|t| !t[:hidden] }.each do |tab| %>
<%= tab[:label] %>
<% if tab[:id] != Course::TAB_HOME %>
<%= form_tag context_url(@context, :context_publish_to_sis_url), { :id => "publish_to_sis_form", :style => "display: none;" } do %><% end %>
...
<% end %>
<% if @context.root_account.settings[:enable_alerts] && can_do(@context, @current_user, :manage_interaction_alerts) %>
<%= t(:alerts_title, "Alerts") %>
<%= render :partial => 'alerts/alerts' %>
<% end %>
<% if can_do @context, @current_user, :view_feature_flags %>
<% end %>
<% if Account.site_admin.grants_right?(@current_user, :manage_courses) %>
<%= t('headings.move_course', %{Move the course to another root account}) %>
<%= t('deatils.move_course', %{Select a new root account for this course. After you move the course you'll want to specify a new department for the course as well.}) %>
<%= form_for :course, :url => course_url(@context), :html => {:method => :put} do |f| %>