<commit_before><!DOCTYPE html>
{% load staticfiles %}
<html lang="en">
<head>
	{{ header }}
	<script type="text/javascript" src="{% static "js/get_csrf_token.js"%}"></script>
	<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
</head>
<!-- onload="prettyPrint()" -->
<body >
	{{navbar }}
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class="row-fluid">
					{{menu}}
						<div class="span10">
							<legend>Set an exercise</legend>
							<script>
							$(document).ready(function () {
								$('label.tree-toggler').click(function () {
									$(this).parent().children('ul.tree').toggle(300);
								});
									$('#selection-text').hide();
									$('#submit-btn').attr('disabled', 'disabled');
								});
							</script>
							<div class="span5">
								<label>Choose exercise</label>
								<div class="well" style=" padding: 8px 0;">
									{% for chapter in assignment_book.get_chapters %}
										<ul class="nav nav-list">
										<li><label class="tree-toggler nav-header" id="{{ chapter.get_name }}">{{ chapter.get_name }}</label>
											<ul class="nav nav-list tree">
											{% for assignment in chapter.get_assignments %}
												<li><a id="{{ chapter.get_name }}-{{ assignment.get_id }}"> {{ assignment.get_name }}</a></li>
											{% endfor %}
											</ul>
										</ul>
									{% endfor %}
								</div>
								<a href="#" id="view_spec"><label><i class="glyphicon glyphicon-eye-open"></i>View specification</label></a>
								<i id="question">Question</i>
								<div id="question_text"></div> 
								<br>
								<div id="specification_window">
									<a href="#edit_modal" role="button" data-toggle="modal" class="glyphicon glyphicon-pencil pull-right">Edit</a>
									<pre id="specification_window_text"> <!-- class="prettyprint" -->
										<code></code>
									</pre>
								</div>
								<div id="temp_change"><i></i></div>
							</div>
							<div class="span5">
								<label>Choose class</label>
								<div class="well" style=" padding: 8px 0;">
									<div style="">
										{% for year in teaching_hierarchy.get_teaching_years %}
											<ul class="nav nav-list">
												<li><label class="tree-toggler nav-header">Year {{ year.name }}</label>
												<ul class="nav nav-list tree">
												{% for cls in year.get_teaching_classes %}
													<li><a id="year-{{ year.get_name }}-class-{{ cls.get_id }}">{{cls.get_name}}</a></li>
												{% endfor %}
												</ul>
											</li>
											</ul>
										{% endfor %}
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class ="span2"></div>
				<div class="span10">
					<div id="selection-text"></div>
					<br>
					<form>
						{% csrf_token %}
						<button onclick="submit_ex(); return false;" class="btn" id="submit-btn">Send</button>
					</form>
				</div>
			</div>
		</div>
	</div>
 
	<div id="edit_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			<h3 id="myModalLabel">Edit exercise</h3>
		</div>
		<div class="modal-body">
			<i>Question</i>
			<br>
			<textarea id="question_editor" class="field span4" rows="1"></textarea>
			<br>
			<br>
			<textarea id="code_editor" class="field span4" rows="3"></textarea>
		</div>
		<div class="modal-footer">
			<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
			<div class="dropdown btn-group">
			    <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
			        Choose class <span class="caret"></span>
			    </a>
			    <ul class="dropdown-menu">
			        {% for year in teaching_hierarchy.get_teaching_years %}
						{% for cls in year.get_teaching_classes %}
							<li id="year-{{ year.get_name }}-class-{{ cls.get_id }}">
								{{ year.name }} - {{ cls.get_name }}
							</li>
						{% endfor %}
					{% endfor %}
			    </ul>
			</div>
			<button id="send_edited" class="btn btn-primary">Send</button>
		</div>
	</div>

	<script>
	var exercise = "", group = "", spec_question = "", spec_code = "";
	var text = $('#selection-text');
	var exercises = {}, exercisesDivs = {}, groups = {}, groupsDivs = {};
	var hlE = false, hlG = false;
	var idE = 0, idG = 0;

	$("#specification_window").hide();
	$("#view_spec").hide();
	$("#question").hide();
	$("#question_text").hide();

	{% for year in teaching_hierarchy.get_teaching_years %}
		{% for cls in year.get_teaching_classes %}
			groupsDivs["{{cls.get_id}}"] = "year-{{ year.get_name }}-class-{{ cls.get_id }}";
			groups["{{cls.get_id}}"] = "{{ year.get_name }}{{ cls.get_name }}";
		{% endfor %}
	{% endfor %}

	{% for chapter in assignment_book.get_chapters %}
		{% for assignment in chapter.get_assignments %}
			exercises["{{ assignment.get_id }}"] = "{{ assignment.get_name }}";<commit_msg>temp edit and sending exercise frontend<commit_after><!DOCTYPE html>
{% load staticfiles %}
<html lang="en">
<head>
	{{ header }}
	<script type="text/javascript" src="{% static "js/get_csrf_token.js"%}"></script>
	<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
</head>
<!-- onload="prettyPrint()" -->
<body >
	{{navbar }}
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class="row-fluid">
					{{menu}}
						<div class="span10">
							<legend>Set an exercise</legend>
							<script>
							$(document).ready(function () {
								$('label.tree-toggler').click(function () {
									$(this).parent().children('ul.tree').toggle(300);
								});
									$('#selection-text').hide();
									$('#submit-btn').attr('disabled', 'disabled');
								});
							</script>
							<div class="span5">
								<label>Choose exercise</label>
								<div class="well" style=" padding: 8px 0;">
									{% for chapter in assignment_book.get_chapters %}
										<ul class="nav nav-list">
										<li><label class="tree-toggler nav-header" id="{{ chapter.get_name }}">{{ chapter.get_name }}</label>
											<ul class="nav nav-list tree">
											{% for assignment in chapter.get_assignments %}
												<li><a id="{{ chapter.get_name }}-{{ assignment.get_id }}"> {{ assignment.get_name }}</a></li>
											{% endfor %}
											</ul>
										</ul>
									{% endfor %}
								</div>
								<a href="#" id="view_spec"><label><i class="glyphicon glyphicon-eye-open"></i>View specification</label></a>
								<i id="question">Question</i>
								<div id="question_text"></div> 
								<br>
								<div id="specification_window">
									<a href="#edit_modal" role="button" data-toggle="modal" class="glyphicon glyphicon-pencil pull-right">Edit</a>
									<pre id="specification_window_text"> <!-- class="prettyprint" -->
										<code></code>
									</pre>
								</div>
								<div id="temp_change"><i></i></div>
							</div>
							<div class="span5">
								<label>Choose class</label>
								<div class="well" style=" padding: 8px 0;">
									<div style="">
										{% for year in teaching_hierarchy.get_teaching_years %}
											<ul class="nav nav-list">
												<li><label class="tree-toggler nav-header">Year {{ year.name }}</label>
												<ul class="nav nav-list tree">
												{% for cls in year.get_teaching_classes %}
													<li><a id="year-{{ year.get_name }}-class-{{ cls.get_id }}">{{cls.get_name}}</a></li>
												{% endfor %}
												</ul>
											</li>
											</ul>
										{% endfor %}
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class ="span2"></div>
				<div class="span10">
					<div id="selection-text"></div>
					<br>
					<form>
						{% csrf_token %}
						<button onclick="submit_ex(); return false;" class="btn" id="submit-btn">Send</button>
					</form>
				</div>
			</div>
		</div>
	</div>
 
	<div id="edit_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			<h3 id="myModalLabel">Edit exercise</h3>
		</div>
		<div class="modal-body">
			<i>Question</i>
			<br>
			<textarea id="question_editor" class="field span4" rows="1"></textarea>
			<br>
			<br>
			<textarea id="code_editor" class="field span4" rows="3"></textarea>
		</div>
		<div class="modal-footer">
			<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
			<div class="dropdown btn-group">
			    <a id="dropdown" class="btn dropdown-toggle" data-toggle="dropdown" href="#">
			        Choose class <span class="caret"></span>
			    </a>
			    <ul id="classes" class="dropdown-menu">
			        {% for year in teaching_hierarchy.get_teaching_years %}
						{% for cls in year.get_teaching_classes %}
							<li>
								<a style="cursor:pointer" id="year-{{ year.get_name }}-class-{{ cls.get_id }}">
									{{ year.name }} - {{ cls.get_name }}
								</a>
							</li>
						{% endfor %}
					{% endfor %}
			    </ul>
			</div>
			<button id="send_edited" class="btn btn-primary">Send</button>
		</div>
	</div>

	<script>
	var exercise = "", group = "", spec_question = "", spec_code = "";
	var text = $('#selection-text');
	var exercises = {}, exercisesDivs = {}, groups = {}, groupsDivs = {};
	var hlE = false, hlG = false;
	var idE = 0, idG = 0;

	$("#specification_window").hide();
	$("#view_spec").hide();
	$("#question").hide();
	$("#question_text").hide();

	$("#classes li a").click(function () {
		$("#dropdown").html($(this).text()+' <span class="caret"></span>');
	});

	$("#send_edited").click(function() {
		var class_to_send = $("#dropdown").text();
		var question = $("#question_editor").val();
		var code = $("#code_editor").val();
		$("#edit_modal").modal('hide');
		$("#temp_change").text("Exercise " + question + " was sent to " + class_to_send + ".");
		/* server sends new exercise to students */
	});

	{% for year in teaching_hierarchy.get_teaching_years %}
		{% for cls in year.get_teaching_classes %}
			groupsDivs["{{cls.get_id}}"] = "year-{{ year.get_name }}-class-{{ cls.get_id }}";
			groups["{{cls.get_id}}"] = "{{ year.get_name }}{{ cls.get_name }}";
		{% endfor %}
	{% endfor %}

	{% for chapter in assignment_book.get_chapters %}
		{% for assignment in chapter.get_assignments %}
			exercises["{{ assignment.get_id }}"] = "{{ assignment.get_name }}";
{'fraction_non_alphanumeric': 0.20923587427412665, 'fraction_numerical': 0.004977417273481427, 'mean_word_length': 2.7844436693407744, 'pattern_counts': {'":': 0, '<': 285, '<?xml version=': 0, '>': 285, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1065782', 'n_tokens_mistral': 4957, 'n_tokens_neox': 3597, 'n_words': 705}