<%
# 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 <http://www.gnu.org/licenses/>.
%>

<div id="find_question_dialog" style="display: none;">
  <a href="<%= context_url(@context, :context_question_banks_url, :include_bookmarked => '1', :inherited => '1') %>" class="find_question_banks_url" style="display: none;">&nbsp;</a>
  <a href="/<%= @quiz.context_url_prefix %>/question_banks/{{ question_bank_id }}/questions?inherited=1" class="question_bank_questions_url" style="display: none;">&nbsp;</a>
  <a href="<%= context_url(@context, :context_quiz_quiz_questions_url, @quiz.id) %>" class="add_questions_url" style="display: none;">&nbsp;</a>
  <div style="float: <%= direction('right') %>; padding-<%= direction('right') %>: 5px; line-height: 2.5em;">
    <a href="<%= context_url(@context, :context_question_banks_url) %>"><%= t('links.view_question_banks', "View Course Question Banks") %></a>
  </div>
  <div class="clear"></div>
  <div class="message" style="display: none;"></div>
  <% css_bundle("side_tabs_table") %>
  <table class="side_tabs_table" style="width: 100%;">
    <tr>
      <td class="left">
        <ul class="side_tabs bank_list">
          <li class="bank blank" style="display: none;">
            <a href="#">
              <span class="title"><%= t('headers.bank_name', "Bank Name") %></span>
              <span class="id" style="display: none;">&nbsp;</span>
            </a>
            <div class="sub_content">
              <%= t(:bank_description, "%{bank_name}, %{n} questions",
                    :bank_name => raw('<span class="cached_context_short_name">&nbsp;</span>'),
                    :n => raw('<span class="assessment_question_count">&nbsp;</span>')) %>
            </div>
          </li>
        </ul>
      </td>
      <td class="right">
        <div class="side_tabs_content">
          <div class="question_message"></div>
          <div class="question_list_holder" style="display: none;">
            <a href="#" class="select_all_link"><%= t('links.select_all_banks', "Select All") %></a> |
            <a href="#" class="clear_all_link"><%= t('links.clear_all_banks', "Clear All") %></a>
            <ul class="question_list unstyled_list">
              <li class="found_question blank" style="display: none;">
                <input type="checkbox"/>
                <label class="question_name"></label>
                <div class="already_added_message"><%= t(:already_added, "this question is already on the quiz") %></div>
                <div class="question_text"></div>
              </li>
            </ul>
            <a href="#" class="page_link"><%= t('links.more_questions', "more questions") %></a>
            <div class="button-container quiz_group_select_holder">
              <label for="quiz_group_select"><%= before_label(:add_questions_to_group, "Add questions to the question group") %></label>
              <select class="quiz_group_select" id="quiz_group_select">
                <option value="none"><%= t('options.no_group', "[ No Group ]") %></option>
                <option class="bottom" value="new"><%= t('options.new_group', "[ New Group ]") %></option>
              </select>
            </div>
            <div class="button-container" style="margin-bottom: 5px;">
              <button type="button" class="btn submit_button"><%= t('buttons.add_questions', "Add Questions") %></button>
              <button type="button" class="btn btn button-secondary cancel_button"><%= t('#buttons.cancel', "Cancel") %></button>
            </div>
          </div>
        </div>
      </td>
    </tr>
  </table>
</div>
<div id="find_bank_dialog" style="display: none;">
  <a href="<%= context_url(@context, :context_question_banks_url, :include_bookmarked => '1', :inherited => '1') %>" class="find_question_banks_url" style="display: none;">&nbsp;</a>
  <div style="float: <%= direction('right') %>; padding-<%= direction('right') %>: 5px; line-height: 2.5em;">
    <a href="<%= context_url(@context, :context_question_banks_url) %>"><%= t('links.view_question_banks', "View Course Question Banks") %></a>
  </div>
  <div class="clear"></div>
  <div class="message" style="display: none;"></div>
  <div class="find_banks">
    <%= t(:select_a_question_bank, "Select a question bank from the list below to link it to the this quiz as a question group.") %>
    <ul class="side_tabs bank_list unstyled_list">
      <li class="bank blank" style="display: none;" tabIndex="0" role="button">
        <div class="title"><%= t('headers.bank_name', "Bank Name") %></div>
        <span class="id" style="display: none;">&nbsp;</span>
        <div class="sub_content">
          <%= t(:bank_description, "%{bank_name}, %{n} questions",
                :bank_name => raw('<span class="cached_context_short_name">&nbsp;</span>'),
                :n => raw('<span class="assessment_question_count">&nbsp;</span>')) %>
        </div>
      </li>
    </ul>
    <div class="button-container" style="margin-bottom: 5px;">
      <button type="button" class="btn submit_button"><%= t('buttons.select_bank', "Select Bank") %></button>
      <button type="button" class="btn btn button-secondary cancel_button"><%= t('#buttons.cancel', "Cancel") %></button>
    </div>
  </div>
</div>
<div id="add_question_group_dialog" style="display: none;" title="<%= t('titles.add_new_question_group', "Add a New Question Group") %>">
  <h2><%= t('titles.add_new_question_group', "Add a New Question Group") %></h2>
  <a href="<%= context_url(@context, :context_quiz_quiz_groups_url, @quiz.id) %>" class="add_question_group_url" style="display: none;">&nbsp;</a>
  <table class="formtable">
    <tr>
      <td><label for="found_question_group_name"><%= before_label(:group_name, "Group Name") %></label></td>
      <td><input id="found_question_group_name" type="text" name="quiz_group[name]" /></td>
    </tr><tr>
      <td><label for="found_question_group_pick"><%= before_label(:group_pick_count, "Pick") %></label></td>
      <td>
        <%= t(:group_pick_count, "%{pick_count} questions", :pick_count => raw('<input id="found_question_group_pick" type="text" style="width: 50px;" name="quiz_group[pick_count]" />')) %><br/>
        <span style="font-size: 0.8em;">(<%= t('hints.group_pick_count', "%{pick_count} selected so far", :pick_count => raw('<span class="questions_count">&nbsp;</span>')) %>)</span>
      </td>
    </tr><tr>
      <td><label for="found_question_group_points"><%= before_label(:group_points, "Points") %></label></td>
      <td><%= t(:group_points, "%{points} per question", :points => raw('<input id="found_question_group_points" type="text" style="width: 50px;" class="float_value" name="quiz_group[question_points]" />')) %></td>
    </tr><tr>
      <td colspan="2">
        <div class="button-container">
          <button type="button" class="btn submit_button"><%= t('buttons.create_group', "Create Group") %></button>
          <button type="button" class="btn btn button-secondary cancel_button"><%= t('#buttons.cancel', "Cancel") %></button>
        </div>
      </td>
    </tr>
  </table>
</div>
