diff --git a/compile_server/app/static/editors.js b/compile_server/app/static/editors.js
deleted file mode 100644
index ad5c996..0000000
--- a/compile_server/app/static/editors.js
+++ /dev/null
@@ -1,496 +0,0 @@
-// Log an error message in the output area
-function output_error(output_area, message) {
- var div = $('
')
- div.text(message)
- div.appendTo(output_area)
-}
-
-// Reset the buttons on the editors to the "enabled" state
-// Reset the count of lines already read to 0
-function reset(container, editors){
- editors.buttons.forEach(function(b){b.disabled = false;})
- container.already_read = 0;
-}
-
-// Process the result of a check
-// editors: the editors to decorate
-// output_area: the div where the messages should go
-// status: the exit status
-// message: any message coming back from the application
-// TODO: make use of message
-function process_check_output(container, editors, output_area, output, status, completed, message) {
- // Process the lines
-
- var read_lines = 0
-
- output.forEach(function (l) {
- read_lines++
-
- // Look for lines that contain an error message
- var error_found = false;
- var match_found = l.match(/^([a-zA-Z._0-9-]+):(\d+):(\d+):(.+)$/)
- if (match_found) {
- if (match_found[4].indexOf(" info:") == 0) {
- var klass = "output_msg_info";
- }
- else {
- var klass = "output_msg"
- error_found = true;
- }
- }
- else {
- var klass = "output_line";
- }
-
- // Print the line in the output area
- var div = $('
')
- div.text(l)
- div.appendTo(output_area)
-
- if (match_found != null) {
- if (error_found) {
- output_area.error_count++
- }
-
- // Lines that contain a sloc are clickable:
- div.on('click', function (x) {
- // find the corresponding editor
- var basename = match_found[1]
- editors.forEach(function (e) {
- if (e.basename == basename) {
- // Switch to the tab that contains the editor
-
- // TODO: this is in the case of bootstrap only
- // $("#" + e.unique_id + "-tab").tab('show')
-
- // Jump to the corresponding line
- e.gotoLine(parseInt(match_found[2]),
- // looks like column numbers are indexed from 0
- parseInt(match_found[3] - 1),
- true)
- e.focus()
- }
- })
- })
- }
- })
-
- // Congratulations!
- if (completed) {
- reset(container, editors);
-
- if (status != 0) {
- output_error(output_area, "exit status: " + status)
- } else if (output_area.error_count == 0) {
- var div = $('
')
- div.text("Success!")
- div.appendTo(output_area)
- } else if (output_area.error_count == 1) {
- var div = $('
')
- div.text("One error.")
- div.appendTo(output_area)
- } else {
- var div = $('
');
- editordiv.appendTo(div);
- div.appendTo(content);
-
- // ACE editors...
- var editor = ace.edit(resource.basename + the_id + '_editor');
- editor.session.setMode("ace/mode/ada");
-
- // ... and their contents
- editor.setValue(resource.contents);
- editor.setShowPrintMargin(false);
- editor.gotoLine(1);
- editor.initial_contents = resource.contents;
- editor.basename = resource.basename;
- editor.unique_id = the_id;
-
- editor.setOptions({
- "highlightActiveLine": false,
- });
-
- // check if we are overriding db content with inline content
- if (container.attr("inline")) {
- $(container).children(".resource").each(function () {
- if ($(this).attr("region")) {
- region = $(this).attr("region");
-
- // search editor content for region "region"
- beginregion = editor.find("-- #region " + region);
- endregion = editor.find("-- #endregion " + region);
-
- newRange = beginregion.clone();
- newRange.end.row = endregion.end.row;
- newRange.end.column = endregion.end.column;
-
- textReplace = $(this).text().replace(/^\s|\s+$/g, '');
-
- editor.getSession().getDocument().replace(newRange, textReplace);
- $(this).text('');
- }
- else {
- // No region: replace the whole editor
- editor.initial_contents = $(this).text();
- editor.setValue($(this).text());
- $(this).text('');
- }
- })
- }
-
- // search for remaining region marks and remove
- editor.replaceAll("", {
- needle: "-- #region (.*)\n",
- regExp: true
- });
- editor.replaceAll("", {
- needle: "-- #endregion (.*)\n",
- regExp: true
- });
-
- // check if container is readonly
- if (container.attr("readonly")) {
- // remove all read only tags in the editor
- editor.replaceAll("", {
- needle: "-- (begin|end) readonly",
- regExp: true
- });
-
- editor.setOption("readOnly", true);
- }
-
- // Inline? set the editor to use exactly the vertical space it needs
- if (is_inline){
- editor.setOptions({
- maxLines: editor.session.getLength()
- })
- }
-
- // place the cursor at 1,1
- editor.selection.moveTo(0, 0);
-
- // clear undo stack to avoid undoing everything we just did
- editor.getSession().getUndoManager().reset();
-
- return editor;
-}
-
-// Fills a
with an editable representation of an example.
-// container: the
in question
-// example_name: the name of the example to load
-
-var unique_id = 0
-
-function fill_editor_from_contents(container, example_name, example_server,
- resources, main) {
-
- is_inline = container.attr("inline")
-
- // First create the tabs
-
- if (!is_inline){
- var ul = $('
')
- ul.appendTo(container);
-
- var counter = 0;
-
- resources.forEach(function (resource) {
- counter++;
- var the_id = "tab_" + container.attr("the_id") + "-" + counter
-
- var li = $('
').appendTo(ul);
- $('' +
- resource.basename + '').appendTo(li)
- })
- }
-
- // Then fill the contents of the tabs
-
- var content = $('
')
- content.appendTo(container);
-
- counter = 0;
-
- var editors = []
-
- resources.forEach(function (resource) {
- counter++;
- editor = create_editor(resource, container, content, editors, counter)
- // Append the editor to the list of editors
- editors.push(editor)
- })
-
- var row = $('
')
- row.appendTo(container)
-
- // create the buttons
-
- var buttons_div = $('
')
- buttons_div.appendTo(row)
-
- var output_div = $('
')
- output_div.appendTo(row)
-
- var output_area = $('
')
- output_area.appendTo(output_div)
-
- editors.buttons = []
-
- if (container.attr("prove_button") || container.attr("run_button")){
- var reset_button = $('