Switch to unified view

a b/OSSEval/OSProject/templates/OSProject/search_results.html
1
                {% load staticfiles %}
2
                <thead><tr><th></th><th>Name  --{% static "images/" + p.id_forge %}.jpg--</th><th>Description</th></tr></thead>
3
                <tbody>
4
                {% for p in projects %}
5
                  <tr>
6
                    <td class="" valign="center">
7
                      <a id="project_instance" analysis_id="{{ analysis_id }}" id_forge="{{ p.id_forge }}" datasource_id="{{ p.datasource_id }}" identifier_in_forge="{{ p.id }}" name="{{ p.name }}">
8
                        <img src="{% static "images/add.jpg" %}" />
9
                      </a>
10
                      &nbsp;
11
                      <a id="project_instance_info" id_forge="{{ p.id_forge }}" identifier_in_forge="{{ p.id }}"><img src="{% static "images/" %}{{ p.id_forge }}.jpg" /></a><br/>&nbsp;
12
                    </td>
13
                    <td class="" valign="center">{{ p.name  }}</td>
14
                    <td class="truncateIt">{{ p.description }}</td>
15
                  </tr>
16
                {% endfor %}
17
18
                  <script type="text/javascript">
19
                  $("a#project_instance_info").click(function(){ 
20
                                                                $.post("{% url 'OSProjectForgeFromResultList_detail' %}",
21
                                                                   {
22
                                                                     csrfmiddlewaretoken: '{{ csrf_token }}', 
23
                                                                     id_forge: $(this).attr("id_forge"),
24
                                                                     identifier_in_forge: $(this).attr("identifier_in_forge")
25
                                                                   },
26
                                                                   function(data) {
27
                                                                     var popup=window.open('','name','height=400,width=500');
28
                                                                     popup.document.write('<PRE>');
29
                                                                     popup.document.write(data);
30
                                                                     popup.document.write('</PRE>');
31
                                                                   }
32
                                                                );
33
                                                          });
34
                  var clicked_item = null
35
                  $("a#project_instance").click(function(){ 
36
                                                            clicked_item = $(this); 
37
                                                            if(typeof id_selected_instance === 'undefined')
38
                                                                $.post("{% url 'OSProjectForge_add' %}",
39
                                                                   {
40
                                                                     csrfmiddlewaretoken: '{{ csrf_token }}', 
41
                                                                     id_selected_instance: -1,
42
                                                                     analysis_id: clicked_item.attr("analysis_id"),
43
                                                                     id_forge: clicked_item.attr("id_forge"),
44
                                                                     datasource_id: clicked_item.attr("datasource_id"),
45
                                                                     identifier_in_forge: clicked_item.attr("identifier_in_forge"),
46
                                                                     project_name: clicked_item.attr("name")
47
                                                                   },
48
                                                                   function(data) {
49
                                                                     location.reload(true);
50
                                                                   }
51
                                                                );
52
                                                            else
53
                                                                $( "#popup_osp_choice" ).dialog( "open" ); 
54
                                                          });
55
                  </script>
56
57
                  <div id="popup_osp_choice" title="Where to add the project">
58
                  </div>
59
60
                  
61
                  <script type="text/javascript">
62
                  $( "#popup_osp_choice" ).dialog({
63
                    autoOpen: false, height: 300, width: 300, modal: true,
64
                    buttons: {
65
                      "Add to selected tab": function() {
66
                        $.post("{% url 'OSProjectForge_add' %}",
67
                           {
68
                             csrfmiddlewaretoken: '{{ csrf_token }}', 
69
                             id_selected_instance: id_selected_instance,
70
                             analysis_id: clicked_item.attr("analysis_id"),
71
                             id_forge: clicked_item.attr("id_forge"),
72
                             datasource_id: clicked_item.attr("datasource_id"),
73
                             identifier_in_forge: clicked_item.attr("identifier_in_forge"),
74
                             project_name: clicked_item.attr("name")
75
                           },
76
                           function(data) {
77
                             location.reload(true);
78
                           }
79
                        );
80
                        $( this ).dialog( "close" );
81
                      },
82
                      "Add to new tab": function() {
83
                        $.post("{% url 'OSProjectForge_add' %}",
84
                           {
85
                             csrfmiddlewaretoken: '{{ csrf_token }}', 
86
                             id_selected_instance: -1,
87
                             analysis_id: clicked_item.attr("analysis_id"),
88
                             id_forge: clicked_item.attr("id_forge"),
89
                             datasource_id: clicked_item.attr("datasource_id"),
90
                             identifier_in_forge: clicked_item.attr("identifier_in_forge"),
91
                             project_name: clicked_item.attr("name")
92
                           },
93
                           function(data) {
94
                             location.reload(true);
95
                           }
96
                        );
97
                        $( this ).dialog( "close" );
98
                      }
99
                    },
100
                    close: function() {
101
                    }
102
                  });
103
                  </script>
104