Switch to unified view

a/OSSEval/analysis/templates/analysis/analysis_report.html b/OSSEval/analysis/templates/analysis/analysis_report.html
1
{% extends "base.html" %}
2
{% load staticfiles %}
1
{% load staticfiles %}
3
{% block content %}
2
{% load custom_tags %}
4
                        {% include "analysis/analysis_tabs.html" %} 
3
<!DOCTYPE html>
5
                        
4
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
6
                        <div id="run">
5
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->
7
                            <!-- TODO: create custom template tag to make it work for a generic number of page levels
6
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->
8
                                 https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags      -->
7
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
9
                            <ul>
8
<!--[if (gt IE 9)|!(IE)]>--><html class=" js canvas canvastext" lang="en"><!--<![endif]-->
9
    <head>
10
        <meta content="text/html; charset=UTF-8" http-equiv="content-type">
11
        <title>opensourceprojects.eu - Open Source Evaluation: "{{ analysis.graph }}"</title>
12
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js"></script>
13
        <script type="text/javascript" src="{% static "js/osseval.js" %}"></script>
14
    </head>
15
    <body class="wiki-Home" id="forge">
16
        <header id="site-header">
17
            <div class="wrapper">
18
                <a id="header-logo" title="opensourceprojects.eu logo" href="https://opensourceprojects.eu/"><img src="{% static "images/logo.png" %}"></a>
19
            </div>
20
        </header>
21
        <h1>"{{ analysis.name }}" created on {{ analysis.created }} by {{ analysis.user_login }}</h1>
22
        <fieldset><legend><h3>Summary</h3></legend>
23
            <p>{% autoescape off %}{{ analysis.comment }}{% endautoescape %}</p>
24
            <table>
25
              <tr><td width='60%'>{% autoescape off %}{{ analysis.methodology_version.radar_chart }}{% endautoescape %}</td>
26
                  <td width='40%'>{% autoescape off %}{{ analysis.methodology_version.bar_chart }}{% endautoescape %}</td></tr>
27
              <tr><td colspan='2'>
28
                <script type="text/javascript" src="//www.google.com/trends/embed.js?q=eucalyptus,+OpenNebula,+OpenStack&content=1&cid=TIMESERIES_GRAPH_0&export=5&w=500&h=330"></script>
29
              </td></tr>
30
            </table>
31
        </fieldset>
32
        
10
                            {% for p in methodology_version.page_set.all %}
33
        {% for p in analysis.methodology_version.page_set.all %}
11
                                <li><a href="#page{{ p.id }}">{{ p.name }}</a></li>
34
        <fieldset><legend><h3>{{ p.name }}</h3></legend>
35
            <fieldset><legend><h2>Graphs</h2></legend>
36
                <table><tr>
37
                  <td width='60%'>{% autoescape off %}{{ p.radar_chart }}{% endautoescape %}</td>
38
                  <td width='40%'>{% autoescape off %}{{ p.bar_chart }}{% endautoescape %}</td>
39
                </tr></table>
40
            </fieldset>
41
            {% for p1 in p.page_set.all %}
42
            <fieldset><legend><h2>{{ p1.name }}</h2></legend>
43
                <table width='100%'>
44
                  <tr>
45
                    <td width='{{ td_width }}%'></td>
46
                    {% for instance in analysis.instance_set.all %}
47
                    <td width='{{ td_width }}%'>{% instance_score_page instance.id p1.id %}</strong></td>
12
                            {% endfor %}
48
                    {% endfor %}
13
                            </ul>
49
                  </tr>
14
                            {% for p in methodology_version.page_set.all %}
15
                                <div id="page{{ p.id }}">
16
                                    <ul>
17
                                      {% for p1 in p.page_set.all %}
18
                                        <li><a href="#page{{ p1.id }}">{{ p1.name }}</a></li>
19
                                      {% endfor %}
20
                                    </ul>
21
                                    {% for p1 in p.page_set.all %}
22
                                        <div id="page{{ p1.id }}"><form>
23
                                        {% for q in p1.question_set.all %}
50
                  {% for q in p1.question_set.all %}
24
                                            <label>{{ q.text }}:</label> <span id="msgq{{ q.id }}"></span><br>
51
                  <tr>
25
                                            {% for c in q.choice_set.all %}
52
                    <td width='{{ td_width }}%'>{{ q.text }}</td>
26
                                                 <label><input type="radio" class="radioquestion" name="radioquestion{{ q.id }}" question_id="{{ q.id }}" id="question{{ q.id }}_{{ c.order }}" value="{{ c.order }}" /> {{ c.text }}</label><br>
53
                    {% for instance in analysis.instance_set.all %}
27
                                            {% endfor %}
54
                    <td width='{{ td_width }}%'>{% instance_score_question instance.id q.id %}</td>
28
                                            <label>Notes": </label><input class="questionnotes" id="notes{{ q.id }}" question_id="{{ q.id }}" type="text" size="80" id="questionnotes{{ q.id }}" value=" " /><br>
29
                                            <div id="MetadataInfo{{ q.id }}"><img src="{% static "images/wait1.gif" %}"/></div><hr>
30
                                        {% endfor %}
31
                                        </form></div>
32
                                    {% endfor %}
33
                                </div>
34
                                <script type="text/javascript">
35
                                    $('div#page{{ p.id }}').tabs();
36
                                </script>
37
                            {% endfor %}
55
                    {% endfor %}
38
                            <script type="text/javascript">
39
                                //f cannot be moved to osseval.js as we have csrf_token
40
                                var save_answer_success = function(data, textStatus, jqXHR) { $('span#msgq'+data.question_id).show('slow');$('span#msgq'+data.question_id).html('Saved').css("color","green").delay(3000).fadeOut(); }
41
                                var save_answer_error = function(data, textStatus, jqXHR) { $('span#msgq'+data.question_id).show('slow');$('span#msgq'+data.question_id).html('Error: ' + data.response).css("color","green").delay(6000).fadeOut(); }
42
                                var f=function() {
43
                                  $.ajax({
44
                                    async: true, type: 'POST',
45
                                    url: 'save_answer',
46
                                    dataType: 'json',
47
                                    success: save_answer_success,
48
                                    error: save_answer_error,
49
                                    data: {csrfmiddlewaretoken: '{{ csrf_token }}', question_id  : $(this).attr('question_id'), id_selected_instance: id_selected_instance, value: $(this).val(), notes: $('input#notes'+$(this).attr('question_id')).val() }
50
                                  });
51
                                }
52
                                $('input.radioquestion').bind('click', f);
53
                                var timeout;
54
                                $('input.questionnotes').bind('input', function () {
55
                                    clearTimeout(timeout);
56
                                    var self = this;
57
                                    timeout = setTimeout(function () {
58
                                    question_id = $(self).attr('question_id');
59
                                    $.ajax({
60
                                      async: true, type: 'POST',
61
                                      url: 'save_answer',
62
                                      dataType: 'json',
63
                                      success: save_answer_success,
64
                                      error: save_answer_error,
65
                                      data: {csrfmiddlewaretoken: '{{ csrf_token }}', question_id: question_id, id_selected_instance: id_selected_instance, value: $('input:radio[name=radioquestion'+question_id+']:checked').val(), notes: $(self).val() }
66
                                    });
67
                                  }, 1500);
68
                                });
69
                            </script>
70
                        </div>
56
                  </tr>
71
                        <script type="text/javascript">
57
                  {% endfor %}
72
                            $('div#run').tabs();
58
                </table>
73
                            updateAnswers(id_selected_instance);
59
            </fieldset>
74
                            updateMetadata(id_selected_instance);
60
            {% endfor %}
75
                        </script>
61
        </fieldset>
76
{% endblock %}
62
        {% endfor %}
77
{% block left_menu %}
63
78
                {% include "analysis/analysis_left_menu.html" %}
64
    </body>
79
                <script type="text/javascript">$("#analysis_questions").addClass("active");</script>
65
</html>
80
{% endblock %}