{% load staticfiles %}
<thead><tr><th></th><th>Name --{% static "images/" + p.id_forge %}.jpg--</th><th>Description</th></tr></thead>
<tbody>
{% for p in projects %}
<tr>
<td class="" valign="center">
<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 }}">
<img src="{% static "images/add.jpg" %}" />
</a>
<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/>
</td>
<td class="" valign="center">{{ p.name }}</td>
<td class="truncateIt">{{ p.description }}</td>
</tr>
{% endfor %}
<script type="text/javascript">
$("a#project_instance_info").click(function(){
$.post("{% url 'OSProjectForgeFromResultList_detail' %}",
{
csrfmiddlewaretoken: '{{ csrf_token }}',
id_forge: $(this).attr("id_forge"),
identifier_in_forge: $(this).attr("identifier_in_forge")
},
function(data) {
var popup=window.open('','name','height=400,width=500');
popup.document.write('<PRE>');
popup.document.write(data);
popup.document.write('</PRE>');
}
);
});
var clicked_item = null
$("a#project_instance").click(function(){
clicked_item = $(this);
if(typeof id_selected_instance === 'undefined')
$.post("{% url 'OSProjectForge_add' %}",
{
csrfmiddlewaretoken: '{{ csrf_token }}',
id_selected_instance: -1,
analysis_id: clicked_item.attr("analysis_id"),
id_forge: clicked_item.attr("id_forge"),
datasource_id: clicked_item.attr("datasource_id"),
identifier_in_forge: clicked_item.attr("identifier_in_forge"),
project_name: clicked_item.attr("name")
},
function(data) {
location.reload(true);
}
);
else
$( "#popup_osp_choice" ).dialog( "open" );
});
</script>
<div id="popup_osp_choice" title="Where to add the project">
</div>
<script type="text/javascript">
$( "#popup_osp_choice" ).dialog({
autoOpen: false, height: 300, width: 300, modal: true,
buttons: {
"Add to selected tab": function() {
$.post("{% url 'OSProjectForge_add' %}",
{
csrfmiddlewaretoken: '{{ csrf_token }}',
id_selected_instance: id_selected_instance,
analysis_id: clicked_item.attr("analysis_id"),
id_forge: clicked_item.attr("id_forge"),
datasource_id: clicked_item.attr("datasource_id"),
identifier_in_forge: clicked_item.attr("identifier_in_forge"),
project_name: clicked_item.attr("name")
},
function(data) {
location.reload(true);
}
);
$( this ).dialog( "close" );
},
"Add to new tab": function() {
$.post("{% url 'OSProjectForge_add' %}",
{
csrfmiddlewaretoken: '{{ csrf_token }}',
id_selected_instance: -1,
analysis_id: clicked_item.attr("analysis_id"),
id_forge: clicked_item.attr("id_forge"),
datasource_id: clicked_item.attr("datasource_id"),
identifier_in_forge: clicked_item.attr("identifier_in_forge"),
project_name: clicked_item.attr("name")
},
function(data) {
location.reload(true);
}
);
$( this ).dialog( "close" );
}
},
close: function() {
}
});
</script>