settings.mustache 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. <%
  2. # Copyright (C) 2011 - present Instructure, Inc.
  3. #
  4. # This file is part of Canvas.
  5. #
  6. # Canvas is free software: you can redistribute it and/or modify it under
  7. # the terms of the GNU Affero General Public License as published by the Free
  8. # Software Foundation, version 3 of the License.
  9. #
  10. # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
  11. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License along
  16. # with this program. If not, see <http://www.gnu.org/licenses/>.
  17. %>
  18. <%
  19. content_for :page_title, join_title(t(:page_title, "Course Details"), @context.name)
  20. css_bundle :course_settings
  21. js_bundle :course_settings
  22. @active_tab = "settings"
  23. can_manage = can_do(@context, @current_user, :manage)
  24. can_manage_courses = can_do(@context.account, @current_user, :manage_courses)
  25. can_rename_course = can_manage_courses || (can_manage && !@context.root_account.settings[:prevent_course_renaming_by_teachers])
  26. can_manage_master_courses = can_manage_courses && can_do(@context.account, @current_user, :manage_master_courses)
  27. has_multiple_sections = @context.course_sections.active.count > 1
  28. can_see_users = can_do(@context, @current_user, :read_roster, :manage_students, :manage_admin_users)
  29. is_master_course = MasterCourses::MasterTemplate.is_master_course?(@context)
  30. %>
  31. <% content_for :right_side do %>
  32. {{> views/settings_sidebar}}
  33. <% end %>
  34. <h1 class="screenreader-only"><%= t 'course_settings_title', "Course Settings" %></h1>
  35. <div id="course_details_tabs" style="display:none;" class="ui-tabs-minimal">
  36. <ul>
  37. <li id="course_details_tab"><a href="#tab-details">{{#t}}Course Details{{/t}}</a></li>
  38. <li id="sections_tab"><a href="#tab-sections">{{#t}}Sections{{/t}}</a></li>
  39. <% if can_do @context, @current_user, :update %>
  40. <li id="navigation_tab"><a href="#tab-navigation">{{#t}}Navigation{{/t}}</a></li>
  41. <% end %>
  42. <% if can_do @context, @current_user, :read_as_admin %>
  43. <li id="external_tools_tab"><a href="#tab-tools" id="tab-tools-link">{{#t}}Apps{{/t}}</a></li>
  44. <% end %>
  45. <% if @publishing_enabled %>
  46. <li id="grade_publishing_tab"><a href="#tab-grade-publishing" id="tab-grade-publishing-link">{{#t}}Grade Syncing{{/t}}</a></li>
  47. <% end %>
  48. <% if @context.root_account.settings[:enable_alerts] && can_do(@context, @current_user, :manage_interaction_alerts) %>
  49. <li id="alerts_tab"><a href="#tab-alerts" id="tab-alerts-link">{{#t}}Alerts{{/t}}</a></li>
  50. <% end %>
  51. <% if can_do @context, @current_user, :manage_feature_flags %>
  52. <li id="feature_flags_tab"><a href="#tab-features" id="tab-features-link">{{#t}}Feature Options{{/t}}</a></li>
  53. <% end %>
  54. </ul>
  55. <div id="tab-details">
  56. <h2>
  57. {{#t}}Course Details{{/t}}
  58. <% if @context.created? || @context.claimed? %>
  59. <span id='course-status' class='published-status unpublished pull-right'>
  60. {{#t}}Course is Unpublished{{/t}}
  61. <i class="icon-unpublished"></i>
  62. </span>
  63. <% else %>
  64. <% if @context.unpublishable? %>
  65. <span data-tooltip title="" id='course-status' class='published-status published pull-right'>
  66. {{#t}}Course is Published{{/t}}
  67. <i class="icon-publish icon-Solid"></i>
  68. </span>
  69. <% else %>
  70. <% unpublish_tooltip = t('tooltips.cannot_unpublish_course', %{You cannot unpublish this course if there are graded student submissions}) %>
  71. <span data-tooltip title="<%= unpublish_tooltip %>" id='course-status' class='published-status published pull-right'>
  72. {{#t}}Course is Published{{/t}}
  73. <i class="icon-publish icon-Solid"></i>
  74. </span>
  75. <% end %>
  76. <% end %>
  77. </h2>
  78. <%= form_tag course_path(@context), :id => "course_reload_form", :method => :put do %>
  79. <%= hidden_field_tag :for_reload, true %>
  80. <%= hidden_field_tag :continue_to, course_settings_url(@context) %>
  81. <% end %>
  82. <% opts = {:id => "course_form", :class => "formtable"} %>
  83. <% opts[:disabled] = 'disabled' unless can_manage %>
  84. <%= form_for @context, :html => opts do |f| %>
  85. <table class="coursesettings">
  86. <% if @context.feature_enabled?(:course_card_images) %>
  87. <tr>
  88. <td class="form-label"><%= f.blabel :image, :en => "Image" %></td>
  89. <td>
  90. <div class="CourseImageSelector__Container"></div>
  91. </td>
  92. </tr>
  93. <% end %>
  94. <tr>
  95. <td class="form-label"><%= f.blabel :name, :course_name, :en => "Name" %></td>
  96. <td class="nobr">
  97. <% if can_rename_course %>
  98. <%= f.text_field :name, :class => "course_form", :maxlength => '255', :style => "width: 150px;" %>
  99. <% else %>
  100. <span id="course_name"><%= @context.name %></span>
  101. <% end %>
  102. </td>
  103. </tr>
  104. <tr>
  105. <td class="form-label nobr"><%= f.blabel :course_code, :en => "Course Code" %></td>
  106. <td class="nobr">
  107. <% if can_rename_course %>
  108. <%= f.text_field :course_code, :maxlength => '255', :style => "width: 100px;" %>
  109. <% else %>
  110. <span id="course_course_code"><%= @context.course_code %></span>
  111. <% end %>
  112. </td>
  113. </tr>
  114. <% if @context.root_account.feature_enabled?(:master_courses) %>
  115. <tr>
  116. <td class="form-label nobr"><%= f.blabel :blueprint_course, :en => "Blueprint Course" %></td>
  117. <td class="nobr">
  118. <% if can_manage_master_courses %>
  119. <div id="blueprint_menu"></div>
  120. <% else %>
  121. <span id="course_blueprint"><%= is_master_course ? t("Yes") : t("No") %></span>
  122. <% end %>
  123. </td>
  124. </tr>
  125. <% end %>
  126. <tr>
  127. <td><%= f.blabel :time_zone, :en => "Time Zone" %></td>
  128. <td>
  129. <% if can_manage %>
  130. <%= f.time_zone_select :time_zone, I18nTimeZone.us_zones, :model => I18nTimeZone %>
  131. <% else %>
  132. <% if name = @context.time_zone.try(:name) %>
  133. <%= I18n.send(:translate, I18nTimeZone[name].keyify, name.dup) %>
  134. <% else %>
  135. {{#t}}None{{/t}}
  136. <% end %>
  137. <% end %>
  138. </td>
  139. <% if @context.sis_source_id && can_do(@context, @current_user, :read_sis) || can_do(@context, @current_user, :manage_sis) %>
  140. </tr><tr>
  141. <td class="form-label"><%= f.blabel :sis_source_id, :en => "SIS ID" %></td>
  142. <td>
  143. <% if can_manage && can_do(@context, @current_user, :manage_sis) %>
  144. <%= f.text_field :sis_source_id, :style => "width: 202px;", :title => t('sis_source_id', "SIS ID"), :value => @context.sis_source_id %>
  145. <% else %>
  146. <span id="course_sis_source_id">
  147. <%= @context.sis_source_id %>
  148. </span>
  149. <% end %>
  150. </td>
  151. <% end %>
  152. <% if @current_user && Account.site_admin.account_users_for(@current_user).present? %>
  153. </tr><tr>
  154. <td class="form-label"><%= f.blabel :root_account, :en => "Root Account" %></td>
  155. <td><%= link_to @context.root_account.name, account_url(@context.root_account.id), :id => "course_root_account" %></td>
  156. <% end %>
  157. </tr><tr>
  158. <td class="form-label"><%= f.blabel :account_id, :en => "Subaccount" %></td>
  159. <td>
  160. <% can_edit_account = false %>
  161. <% if can_manage %>
  162. <% account_chain = @context.account.account_chain.reverse %>
  163. <% account_chain.each do |account| %>
  164. <% if can_do(account, @current_user, :manage_courses) %>
  165. <% if account.root_account? && account.all_accounts.count > Setting.get('course_settings_sub_account_dropdown_limit', '500').to_i %>
  166. <a href="<%= context_url(account, :context_sub_accounts_url, :format => :json, :include_self => "1") %>" id="course_account_id_url" style="display: none;">&nbsp;</a>
  167. <input type="hidden" name="course[account_id]" id="course_account_id" value="<%= @context.account_id %>"/>
  168. <input type="text" name="account[name]" id="course_account_id_lookup" value="<%= @context.account.name %>" style="width: 150px;"/>
  169. <% else %>
  170. <select name="course[account_id]" id="course_account_id">
  171. {{> views/shared/account_options}}
  172. </select>
  173. <% end %>
  174. <% can_edit_account = true %>
  175. <% break %>
  176. <% end %>
  177. <% end %>
  178. <% end %>
  179. <% unless can_edit_account %>
  180. <span id="course_account_id">
  181. <% if can_do(@context.account, @current_user, :read) %>
  182. <%= link_to @context.account.name, account_url(@context.account.id) %>
  183. <% else %>
  184. <%= @context.account.name %>
  185. <% end %>
  186. </span>
  187. <% end %>
  188. </td>
  189. </tr><tr>
  190. <td class="form-label"><%= f.blabel :enrollment_term_id, :en => "Term" %></td>
  191. <td>
  192. <% if can_manage && can_do(@context.account, @current_user, :manage_courses) %>
  193. <select name="course[enrollment_term_id]" id="course_enrollment_term_id">
  194. <% @context.root_account.enrollment_terms.active.sort_by{|t| t.start_at || CanvasSort::First}.each do |term| %>
  195. <option value="<%= term.id %>" <%= 'selected' if term.id == @context.enrollment_term_id %>><%= term.name %></option>
  196. <% end %>
  197. </select>
  198. <% else %>
  199. <span id="course_enrollment_term_id">
  200. <%= @context.enrollment_term.name %>
  201. </span>
  202. <% end %>
  203. </td>
  204. </tr><tr>
  205. <td class="form-label"><%= f.blabel :start_at, :en => "Starts" %></td>
  206. <td class="nobr">
  207. <% if can_manage %>
  208. <%= f.text_field :start_at, :class => "date_entry", :value => datetime_string(@context.start_at, :verbose) %>
  209. <% else %>
  210. <%= datetime_string(@context.start_at, :verbose) %>
  211. <% end %>
  212. </td>
  213. </tr><tr>
  214. <td class="form-label"><%= f.blabel :conclude_at, :en => "Ends" %></td>
  215. <td class="nobr tall-row">
  216. <% if can_manage %>
  217. <div>
  218. <%= f.text_field :conclude_at, :class => "date_entry", :value => datetime_string(@context.conclude_at, :verbose) %>
  219. <i id="course_conclude_at_warning" style="<%= hidden %>" class="date-warning icon-warning" data-tooltip='{"tooltipClass":"popover", "position":"right"}'
  220. data-html-tooltip-title="<div class='popover-title'>{{#t}}Course Ending at Midnight{{/t}}</div><div class='popover-content'><p>
  221. <%= t(:course_conclude_at_warning_message, "The course is currently set to end at midnight,
  222. meaning that the previous day will be the last day this course is active.") %></p></div>">
  223. </i>
  224. <%= f.check_box :restrict_enrollments_to_course_dates %>
  225. <%= f.label :restrict_enrollments_to_course_dates, :en => "Users can only participate in the course between these dates" %>
  226. </div>
  227. <div class="aside palign">
  228. {{#t}}This will override any term availability settings.{{/t}}
  229. </div>
  230. <% else %>
  231. <%= datetime_string(@context.conclude_at, :verbose) %>
  232. <% end %>
  233. </td>
  234. <% unless can_manage %>
  235. </tr><tr>
  236. <td class="form-label"></td>
  237. <td class="nobr">
  238. <%= f.check_box :restrict_enrollments_to_course_dates, :disabled => true %>
  239. <%= f.label :restrict_enrollments_to_course_dates, :en => "Users can only participate in the course between these dates" %>
  240. </td>
  241. <% end %>
  242. <% if available_locales.size > 1 %>
  243. </tr><tr>
  244. <td class="form-label"><%= f.blabel :locale, :language, :en => "Language" %></td>
  245. <td class="tall-row">
  246. <% no_language = t(:no_language_preference, "Not set (user-configurable, defaults to %{language})", :language => available_locales[infer_locale(:context => @context.account)]) %>
  247. <% if can_manage %>
  248. <div>
  249. <%= f.select :locale,
  250. [[no_language, nil]] + available_locales.invert.sort_by { |desc, _| Canvas::ICU.collation_key(desc) },
  251. {:selected => @context.locale}, {:class => 'locale'} %>
  252. {{> views/shared/locale_warning}}
  253. <p> <%= mt :transifex_message, <<-TEXT, :transifex_url => "https://www.transifex.com/instructure/canvas-crowdsource/"
  254. Join the [Canvas Translation Community](%{transifex_url})
  255. TEXT
  256. %>
  257. </p>
  258. </div>
  259. <div class="aside palign">
  260. {{#t}}This will override any user/system language preferences. This is only recommended for foreign language courses{{/t}}
  261. </div>
  262. <% else %>
  263. <%= @context.locale ? available_locales[@context.locale] : no_language %>
  264. <% end %>
  265. </td>
  266. <% end %>
  267. </tr><tr>
  268. <td class="form-label"><%= f.blabel :storage_quota_mb, :storage_quota, :en => "File Storage" %></td>
  269. <td>
  270. <% if can_manage && can_do(@context.account, @current_user, :manage_storage_quotas) %>
  271. <%= f.text_field :storage_quota_mb, :style => "width: 50px;", :title => t('megabytes', "megabytes"), :value => @context.storage_quota_mb %>
  272. <% else %>
  273. <%= @context.storage_quota_mb %>
  274. <% end %>
  275. {{#t}}megabytes{{/t}}
  276. </td>
  277. <% if @context.turnitin_enabled? %>
  278. </tr><tr>
  279. <td class="form-label"><%= f.blabel :turnitin_comments, :en => "Turnitin Comments" %></td>
  280. <td class="nobr">
  281. <span class="aside">{{#t}}these comments will be shown to students when submitting a Turnitin-enabled assignment{{/t}}</span>
  282. <br/>
  283. <%= f.text_area :turnitin_comments, :style => "width: 90%; height: 50px;", :disabled => !can_manage %>
  284. </td>
  285. <% end %>
  286. </tr>
  287. <tr>
  288. <td class="form-label">
  289. <label for="course_grading_scheme"><%= before_label('grading_scheme', %{Grading Scheme}) %></label>
  290. </td>
  291. <td id="course_grading_scheme">
  292. <%= f.check_box :grading_standard_enabled, :class => "grading_standard_checkbox", :disabled => !can_manage %>
  293. <%= f.label :grading_standard_enabled, :en => "Enable course grading scheme" %>
  294. <div class="grading_standard_link" style="margin-left: 20px;">
  295. <a href="#" class="edit_letter_grades_link"><%= @context.grading_standard_enabled? ? t('view_grading_scheme', "view grading scheme") : t('set_grading_scheme', "set grading scheme") %></a>
  296. </div>
  297. </td>
  298. </tr>
  299. <tr>
  300. <td class="form-label"><%= f.label :license, :en => "License" %></td>
  301. <td colspan="3">
  302. <% if can_manage %>
  303. <% cc, non_cc = Course.licenses.map { |id, attrs| [attrs[:readable_license].call, id]}.partition{|n, id| id.start_with?('cc')} %>
  304. <select name="course[license]" id="course_license">
  305. <%= options_for_select(non_cc, @context.license) %>
  306. <%= grouped_options_for_select([[t("Creative Commons Licenses"), cc]], @context.license) %>
  307. </select>
  308. <%= license_help_link %>
  309. <% else %>
  310. <%= @context.readable_license %>
  311. <% end %>
  312. </td>
  313. </tr><tr>
  314. <td class="form-label"><label for="course_visibility"><%= before_label('course_visibility', %{Visibility}) %></label></td>
  315. <td colspan="3" id="course_visibility">
  316. <% if can_manage %>
  317. <span>
  318. <%= f.select :course_visibility, @context.course_visibility_options.map{ |id, attrs| [attrs[:setting], id] }, {}, {"aria-label" => t("Course Visibility Options")} %>
  319. <%= visibility_help_link %>
  320. </span>
  321. <div class="panel-border">
  322. <%= f.check_box :custom_course_visibility %>
  323. <%= f.label :custom_course_visibility, :en => "Customize" %>
  324. <% @context.customize_course_visibility_list.map do |setting, options| %>
  325. <div id="customize_course_visibility">
  326. <%= f.label :syllabus_visibility_option, options[:setting] %>
  327. <%= f.select :syllabus_visibility_option, @context.course_visibility_options.map{ |id, attrs| [attrs[:setting], "#{id}"] }, {}, {:id => options[:setting], "aria-label" => t("Syllabus Visibility Options")} %>
  328. </div>
  329. <% end %>
  330. </div>
  331. <% end %>
  332. <br/>
  333. <div class="public_options">
  334. <%= f.check_box :indexed, :disabled => !can_manage %>
  335. <%= f.label :indexed, :en => "Include this course in the public course index" %>
  336. </div>
  337. <br/>
  338. <div>
  339. <%= f.check_box :restrict_student_past_view, :disabled => !can_manage || @context.account.restrict_student_past_view[:locked] %>
  340. <%= f.label :restrict_student_past_view, :en => "Restrict students from viewing course after end date" %>
  341. </div>
  342. <div>
  343. <%= f.check_box :restrict_student_future_view, :disabled => !can_manage || @context.account.restrict_student_future_view[:locked] %>
  344. <%= f.label :restrict_student_future_view, :en => "Restrict students from viewing course before start date" %>
  345. </div>
  346. </td>
  347. </tr><tr>
  348. <td class="form-label"><label for="course_course_format"><%= before_label('course_format', %{Format}) %></label></td>
  349. <% format_options = [[t('#course.course_format.not_set', 'Not Set'), ''],
  350. [t('#course.course_format.on_campus', "On-Campus"), "on_campus"],
  351. [t('#course.course_format.online', "Online"), "online"],
  352. [t('#course.course_format.blended', "Blended"), "blended"]] %>
  353. <td>
  354. <% if can_manage %>
  355. <%= f.select :course_format, format_options %>
  356. <% else %>
  357. <%= (format_options.detect{|text, key| key == @context.course_format} || format_options.first).first %>
  358. <% end %>
  359. </td>
  360. </tr>
  361. <% if @context.feature_enabled?(:epub_export) && !@context.account.enable_offline_web_export? %>
  362. <tr>
  363. <td class="form-label"><label for="course_epub_export"><%= before_label('course_epub_export', %{Epub Export}) %></label></td>
  364. <td colspan="3" id="epub_export">
  365. <div>
  366. <%= f.check_box :organize_epub_by_content_type, :disabled => !can_manage %>
  367. <%= f.label :organize_epub_by_content_type, t("Organize epub by content type (default is by module).") %>
  368. </div>
  369. </td>
  370. </tr>
  371. <% end %>
  372. <% if @context.account.enable_offline_web_export? %>
  373. <tr>
  374. <td class="form-label"><label for="course_offline_export"><%= before_label('course_offline_export', %{Offline Course}) %></label></td>
  375. <td colspan="3" id="offline_web_export">
  376. <div>
  377. <%= f.check_box :enable_offline_web_export, :disabled => !can_manage %>
  378. <%= f.label :enable_offline_web_export, t("Allow course content to be downloaded and viewed offline") %>
  379. </div>
  380. </td>
  381. </tr>
  382. <% end %>
  383. <tr>
  384. <td class="form-label"><label for="course_public_description"><%= before_label('course_description', %{Description}) %></label></td>
  385. <td colspan="3">
  386. <%= f.text_area :public_description, :style => "height: 100px;", :disabled => !can_manage %>
  387. </td>
  388. </tr><tr>
  389. <td></td>
  390. <td colspan="3">
  391. <span class="self_enrollment_message" style="<%= hidden unless @context.self_enrollment_enabled? %>">
  392. <% if @context.root_account.self_registration? %>
  393. <%= 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 => '<b>\1</b>'
  394. This course has enabled open enrollment. Students can
  395. self-enroll in the course once you share with them this URL:
  396. *%{url}*. Alternatively, they can sign up at *%{url2}* and
  397. use the following join code: *%{code}*
  398. TEXT
  399. %>
  400. <% else %>
  401. <%= t 'course_open_enrollment_without_code', <<-TEXT, :url => enroll_url(@context.self_enrollment_code || '{{ self_enrollment_code }}'), :wrapper => '<b>\1</b>'
  402. This course has enabled open enrollment. Students can
  403. self-enroll in the course once you share with them this URL:
  404. *%{url}*
  405. TEXT
  406. %>
  407. <% end %>
  408. </span>
  409. <a href="#" role="button" class="course_form course_form_more_options_link" style="padding-left: 20px;">{{#t}}more options{{/t}}</a>
  410. <div class="course_form_more_options" style="display: none; padding-left: 20px;">
  411. <% if @context.self_enrollment_allowed? %>
  412. <%= f.check_box :self_enrollment, :class => 'self_enrollment_checkbox', :disabled => !can_manage %>
  413. <label for="course_self_enrollment">
  414. <% if @context.root_account.self_registration? %>
  415. <%= t :self_enrollment, "Let students self-enroll by sharing with them a secret URL or code" %>
  416. <% else %>
  417. <%= t :self_enrollment_without_code, "Let students self-enroll by sharing with them a secret URL" %>
  418. <% end %>
  419. </label><br/>
  420. <div class="open_enrollment_holder" style="display: none;">
  421. <%= f.check_box :open_enrollment, :disabled => !can_manage %>
  422. <%= f.label :open_enrollment, :en => "Add a \"Join this Course\" link to the course home page" %><br/>
  423. </div>
  424. <% end %>
  425. <%= f.check_box :show_announcements_on_home_page, :disabled => !can_manage %>
  426. <%= f.label :show_announcements_on_home_page, :en => "Show recent announcements on Course home page" %><br/>
  427. <%= f.select :home_page_announcement_limit, options_for_select(1..15, @context.home_page_announcement_limit || 3), {}, {:disabled => !can_manage || !@context.show_announcements_on_home_page?, :style => 'width: 75px'} %>
  428. <%= f.label :home_page_announcement_limit, :en => 'Number of announcements shown on the homepage' %><br/>
  429. <%= f.check_box :allow_student_forum_attachments, :disabled => !can_manage %>
  430. <%= f.label :allow_student_forum_attachments, :en => "Let students attach files to discussions" %><br/>
  431. <%= f.check_box :allow_student_discussion_topics, :disabled => !can_manage %>
  432. <%= f.label :allow_student_discussion_topics, :en => "Let students create discussion topics" %><br/>
  433. <%= f.check_box :allow_student_discussion_editing, :disabled => !can_manage %>
  434. <%= f.label :allow_student_discussion_editing, :en => "Let students edit or delete their own discussion posts" %><br/>
  435. <%= f.check_box :allow_student_organized_groups, :disabled => !can_manage %>
  436. <%= f.label :allow_student_organized_groups, :en => "Let students organize their own groups" %><br/>
  437. <%= f.check_box :hide_final_grades, :disabled => !can_manage %>
  438. <%= f.label :hide_final_grades, :en => "Hide totals in student grades summary" %><br/>
  439. <%= f.check_box :hide_distribution_graphs, :disabled => !can_manage %>
  440. <%= f.label :hide_distribution_graphs, :en => "Hide grade distribution graphs from students" %><br/>
  441. <%= f.check_box :lock_all_announcements, :disabled => !can_manage || @context.account.lock_all_announcements[:locked] %>
  442. <%= f.label :lock_all_announcements, :en => 'Disable comments on announcements' %><br />
  443. <%= f.select :default_wiki_editing_roles, [
  444. [t('#course.wiki_permissions.only_teachers', "Only Teachers"), "teachers"],
  445. [t('#course.wiki_permissions.teachers_students', "Teacher and Students"), "teachers,students"],
  446. [t('#course.wiki_permissions.all', "Anyone"), "teachers,students,public"]], {}, :disabled => !can_manage %>
  447. <label for="course_default_wiki_editing_roles">
  448. <%= t(%{can create, rename, and edit course pages by default}) %>
  449. </label><br/>
  450. <div class="changed_default_wiki_editing_roles" style="display: none; padding-left: 20px; font-size: 0.8em;">
  451. <input type="checkbox" name="update_default_pages" id="update_default_pages"/>
  452. <label for="update_default_pages"><%= t 'wiki_editing_roles_change_existing', %{Change pages currently editable by "%{current_setting}" to "%{new_setting}".}, :current_setting => content_tag('span', @context.readable_default_wiki_editing_roles), :new_setting => content_tag('span', nbsp, :class => 'default_wiki_editing_roles_change') %></label>
  453. </div>
  454. </div>
  455. </td>
  456. </tr>
  457. <% if can_manage %>
  458. <tr>
  459. <td colspan="4">
  460. <% if Setting.get('cross_root_account_course_moves', 'false') == 'true' && Account.site_admin.grants_right?(@current_user, :manage_courses) && Account.root_accounts.length > 1 %>
  461. <a href="#" class="move_course_link btn"><i class="icon-arrow-right"></i> {{#t}}Move To Another Account{{/t}}</a>
  462. <% end %>
  463. <span class="course_form">
  464. <div class="form-actions">
  465. <button type="submit" class="btn btn-primary">{{#t}}Update Course Details{{/t}}</button>
  466. </div>
  467. </span>
  468. </td>
  469. </tr>
  470. <% end %>
  471. </table>
  472. <% end %>
  473. </div>
  474. <div id="tab-sections">
  475. <h2 style="margin-top: 10px;">{{#t}}Course Sections{{/t}}</h2>
  476. <ul id="sections">
  477. <% @context.course_sections.active.order(CourseSection.best_unicode_collation_key('name')).each do |section| %>
  478. <li class="section">
  479. <% if can_do section, @current_user, :read %>
  480. <a href="<%= context_url(@context, :context_section_url, section) %>" class="name">
  481. <%= section.display_name %>
  482. </a>
  483. <% else %>
  484. <span class="name">
  485. <%= section.display_name %>
  486. </span>
  487. <% end %>
  488. <span class="users_count">
  489. (
  490. <%= t 'enrollment_count', 'User', :count => section.enrollments.not_fake.where.not(:workflow_state => "rejected").count %><% if section && section.sis_source_id %>,
  491. <%= t 'section_sis_id', 'SIS ID: %{section_sis}', :section_sis => section.sis_source_id %>
  492. <% end %>
  493. )
  494. </span>
  495. <span class="section_links">
  496. <% if can_do(section, @current_user, :update) && !section.defined_by_sis? %>
  497. <a class="Button Button--icon-action edit_section_link"
  498. role="button"
  499. title="{{#t}}Edit Section{{/t}}"
  500. href="<%= context_url(@context, :context_section_url, section) %>">
  501. <i class="icon-edit" aria-hidden="true"></i>
  502. </a>
  503. <% end %>
  504. <% if can_do(section, @current_user, :delete) %>
  505. <% if section.deletable? %>
  506. <a class="Button Button--icon-action delete_section_link"
  507. role="button"
  508. title="{{#t}}Delete Section{{/t}}"
  509. href="<%= context_url(@context, :context_section_url, section) %>">
  510. <i class="icon-end" aria-hidden="true"></i>
  511. <span class="screenreader-only">
  512. <%= t('Delete Section "%{name}"', :name => section.name) %>
  513. </span>
  514. </a>
  515. <% else %>
  516. <a class="Button Button--icon-action cant_delete_section_link"
  517. role="button"
  518. href="#"
  519. title="{{#t}}You can't delete sections that have users enrolled{{/t}}">
  520. <i class="icon-end" aria-hidden="true"></i>
  521. </a>
  522. <% end %>
  523. <% end %>
  524. </span>
  525. <div class="clear"></div>
  526. </li>
  527. <% end %>
  528. <li class="section_blank" style="display: none;">
  529. <a href="<%= context_url(@context, :context_section_url, "{{ id }}") %>" class="name"></a>
  530. <span class="section_links">
  531. <a class="Button Button--icon-action no-hover edit_section_link"
  532. role="button"
  533. href="<%= context_url(@context, :context_section_url, "{{ id }}") %>"
  534. title="{{#t}}Edit Section{{/t}}">
  535. <i class="icon-edit" aria-hidden="true"></i>
  536. <span class="screenreader-only">
  537. <%= t('Edit Section "%{name}"', :name => "%%name%%") %>
  538. </span>
  539. </a>
  540. <a class="Button Button--icon-action delete_section_link"
  541. role="button"
  542. href="<%= context_url(@context, :context_section_url, "{{ id }}") %>"
  543. title="{{#t}}Delete Section{{/t}}"
  544. class="no-hover">
  545. <i class="icon-end" aria-hidden="true"></i>
  546. </a>
  547. </span>
  548. <div class="clear"></div>
  549. </li>
  550. <% if can_do(@context.course_sections.temp_record, @current_user, :create) %>
  551. <li>
  552. <%= form_for :course_section, :url => context_url(@context, :context_sections_url), :html => {:id => "add_section_form", :class => "form-inline", :style => "margin-top: 20px;"} do |f| %>
  553. <h3><%= f.blabel :name, :course_section_name, :en => "Add a New Section" %></h3>
  554. <%= f.text_field :name %>
  555. <button class="btn btn-primary" type="submit" title="{{#t}}Add Section') %>" aria-label="{{#t}}Section{{/t}}</button>
  556. <% end %>
  557. </li>
  558. <% end %>
  559. </ul>
  560. <%= form_for :course_section, :url => "", :html => {:id => "edit_section_form", :method => :put, :style => "display: none;"} do |f| %>
  561. <%= f.text_field :name, :id => "course_section_name_edit", :'aria-label' => t('buttons.edit_section_name', "Edit section name") %>
  562. <% end %>
  563. </div>
  564. <% if can_do @context, @current_user, :update %>
  565. <div id="tab-navigation">
  566. <h2 class="screenreader-only">{{#t}}Course Navigation{{/t}}</h2>
  567. <div class="screenreader-only drag_and_drop_warning" tabindex="0">
  568. <%= t('nav_items_keyboard_drag_and_drop',
  569. 'Warning: For improved accessibility in reordering Course Navigation elements, please use the Move To Dialog option found in the menu.') %>
  570. </div>
  571. <% keyboard_navigation([
  572. {:key => t('keycodes.next_navigation_link', 'Up'), :description => t('keycode_descriptions.next_navigation_link', 'Select next navigation link')},
  573. {:key => t('keycodes.previous_navigation_link', 'Down'), :description => t('keycode_descriptions.previous_navigation_link', 'Select previous navigation link')},
  574. {:key => t('keycodes.toggle_navigation_dragging', 'Space'), :description => t('keycode_descriptions.toggle_navigation_dragging', 'Select link to begin dragging, or drop previously selected link')}
  575. ]) %>
  576. <%= form_tag context_url(@context, :context_update_nav_url), {:id => "nav_form", :title => t('titles.edit_navigation', "Edit Course Navigation") } do %>
  577. <input type="hidden" name="tabs_json" id="tabs_json" value="[]" />
  578. <% tabs = sortable_tabs %>
  579. <p style="margin-bottom: 4px; padding-top: 10px">
  580. {{#t}}Drag and drop items to reorder them in the course navigation.{{/t}}
  581. </p>
  582. <% tabs.each do |tab|
  583. tab[:disabled_message] = [Course::TAB_GRADES, Course::TAB_PEOPLE, 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")
  584. tab[:disabled_message] = t("tab_hidden_if_disabled", "Page disabled, won't appear in navigation") if tab[:external]
  585. end %>
  586. <h3 class="screenreader-only">{{#t}}Enabled Links{{/t}}</h3>
  587. <ul id="nav_enabled_list" class="nav_list connectedSortable">
  588. <% tabs.select {|t| !t[:hidden] }.each do |tab| %>
  589. <li aria-label="<%= tab[:label] %>" class="navitem <%= 'enabled' if tab[:id] != Course::TAB_HOME %> <%= tab[:label].downcase %>"
  590. id="nav_edit_tab_id_<%= tab[:id] %>"
  591. tabindex="0"
  592. >
  593. <%= tab[:label] %>
  594. <div class="admin-links">
  595. <a class="al-trigger al-trigger-gray" role="button" href="#">
  596. <i class="icon-settings"></i>
  597. <i class="icon-mini-arrow-down"></i>
  598. <span class="screenreader-only">
  599. <span class="screenreader-only">
  600. <%= t('Settings for %{tab_label}', { tab_label: tab[:label]}) %>
  601. </span>
  602. </span>
  603. </a>
  604. <ul class="al-options" role="menu" tabindex="0" aria-hidden="true" aria-expanded="false" aria-activedescendant="content-2">
  605. <li role="presentation">
  606. <a href="#" class="icon-x disable_nav_item_link" id="disable_nav_item_link_<%= tab[:id] %>" role="menuitem" title="Disable this item">{{#t}}Disable{{/t}}</a>
  607. </li>
  608. <li role="presentation">
  609. <a href="#" class="icon-updown move_nav_item_link" id="move_nav_item_link_<%= tab[:id] %>" role="menuitem" title="Move this item">{{#t}}Move{{/t}}</a>
  610. </li>
  611. </ul>
  612. </div>
  613. <span class="disabled_message"><%= tab[:disabled_message] %></span>
  614. </li>
  615. <% end %>
  616. </ul>
  617. <h3 class="screenreader-only">{{#t}}Disabled Links{{/t}}</h3>
  618. <ul id="nav_disabled_list" class="nav_list connectedSortable">
  619. <li class="disabled">
  620. {{#t}}Drag items here to hide them from students.{{/t}}
  621. <div style="font-size: 0.8em;">
  622. {{#t}}Disabling most pages will cause students who visit those pages to be redirected to the course home page.{{/t}}
  623. </div>
  624. </li>
  625. <% tabs.select {|t| t[:hidden] }.each do |tab| %>
  626. <li aria-label="<%= tab[:label] %>"
  627. class="navitem enabled"
  628. id="nav_edit_tab_id_<%= tab[:id] %>"
  629. tabindex="0"
  630. >
  631. <%= tab[:label] %>
  632. <div class="admin-links">
  633. <a class="al-trigger al-trigger-gray" role="button" href="#">
  634. <i class="icon-settings"></i>
  635. <i class="icon-mini-arrow-down"></i>
  636. </a>
  637. <ul id="content-2" class="al-options" role="menu" tabindex="0" aria-hidden="true" aria-expanded="false" aria-activedescendant="content-3">
  638. <li role="presentation">
  639. <a href="#" class="icon-plus enable_nav_item_link" id="enable_nav_item_link_<%= tab[:id] %>" role="menuitem" title="Enable this item">{{#t}}Enable{{/t}}</a>
  640. </li>
  641. <li role="presentation">
  642. <a href="#" class="icon-updown move_nav_item_link" id="move_nav_item_link_<%= tab[:id] %>" role="menuitem" title="Move this item">{{#t}}Move{{/t}}</a>
  643. </li>
  644. </ul>
  645. </div>
  646. <span class="disabled_message"><%= tab[:disabled_message] %></span>
  647. </li>
  648. <% end %>
  649. </ul>
  650. <p>
  651. <button type="submit" class="btn btn-primary">{{#t}}Save{{/t}}</button>
  652. </p>
  653. <% end %>
  654. </div>
  655. <% end %>
  656. <% if can_do @context, @current_user, :read_as_admin %>
  657. <div id="tab-tools">
  658. {{> views/external_tools/external_tools}}
  659. </div>
  660. <% end %>
  661. <% if @publishing_enabled %>
  662. <div id="tab-grade-publishing">
  663. <h2>{{#t}}Grade Syncing{{/t}}</h2>
  664. <%= form_tag context_url(@context, :context_publish_to_sis_url), { :id => "publish_to_sis_form", :style => "display: none;" } do %><% end %>
  665. <a href="#" id="publish_grades_link" class="btn disabled">...</a>
  666. <ul id="publish_grades_messages"></ul>
  667. </div>
  668. <% end %>
  669. <% if @context.root_account.settings[:enable_alerts] && can_do(@context, @current_user, :manage_interaction_alerts) %>
  670. <div id="tab-alerts">
  671. <h2>{{#t}}Alerts{{/t}}</h2>
  672. {{> views/alerts/alerts}}
  673. </div>
  674. <% end %>
  675. <% if can_do @context, @current_user, :manage_feature_flags %>
  676. <div id="tab-features"></div>
  677. <% end %>
  678. </div><!-- end course details tab -->
  679. <% if Account.site_admin.grants_right?(@current_user, :manage_courses) %>
  680. <div id="move_course_dialog" style="display: none;">
  681. <h2>{{#t}}Move the course to another root account{{/t}}</h2>
  682. {{#t}}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.{{/t}}
  683. <%= form_for :course, :url => course_url(@context), :html => {:method => :put} do |f| %>
  684. <table class="formtable">
  685. <tr>
  686. <td>
  687. <%= f.blabel :root_account_id, :en => "Root Account" %>
  688. </td>
  689. <td>
  690. <%= f.select :root_account_id, Account.root_accounts.active.order("name DESC").select([:id, :name]).map{|a| [a.name, a.id] }, :selected => @context.root_account_id %>
  691. </td>
  692. </tr>
  693. <tr>
  694. <td colspan="2">
  695. <div class="button-container">
  696. <button type="button" class="btn cancel_button">{{#t}}Cancel{{/t}}</button>
  697. <button type="submit" class="btn btn-primary">{{#t}}Move Course{{/t}}</button>
  698. </div>
  699. </td>
  700. </tr>
  701. </table>
  702. <% end %>
  703. </div>
  704. <% end %>
  705. <div id="edit_letter_grades_form" style="display: none;" data-context_code="<%= @context.asset_string %>">
  706. <%= render partial: "shared/grading_standard", object: @context.grading_standard, locals: {read_only: !can_manage} %>
  707. <a href="<%= context_url(@context, :context_grading_standards_url) %>" style="display: none;" class="create_grading_standard_url">&nbsp;</a>
  708. <a href="<%= context_url(@context, :context_grading_standard_url, "{{ id }}") %>" style="display: none;" id="update_grading_standard_url">&nbsp;</a>
  709. <a href="<%= context_url(@context, :context_url) %>" style="display: none;" id="update_course_url">&nbsp;</a>
  710. </div>