Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% extends "base.html" %}
- {% block head %}
- <style>
- body {
- font: 13px verdana, sans-serif;
- }
- select.target {
- width: 80px;
- //font-size: 14px;
- }
- .unit {
- width: 60px;
- }
- </style>
- <script>
- $(document).ready(function() {
- $('.target').change(function() {
- parent = $(this).parents();
- var uneref= $('p.rep .materiau').text(); // formule chimique
- var index = parent.find('td.prop input').val(); // propriete
- var temp = $(this).val();
- $.getJSON("{% url run_DHM %}", {'temperature': temp, 'propriete': index, 'reference': uneref }, function(data) {
- donnees = data['val_T'];
- donnees_min = data['val_min'];
- donnees_max = data['val_max'];
- donnees_ref = data['laval_ref'];
- valeurmoy = data['valmoy'];
- nomfichier = data['laval_ref'];
- document.getElementById('target_ahref').innerHTML = nomfichier
- id = data['id'];
- //alert('id='+id);
- if(temp== '' ) {
- $('.target.pinc-'+ id).empty();
- $('.min.pinc-'+ id).html(donnees_min[0]);
- $('.max.pinc-'+ id).html(donnees_max[0]);
- $('.moy.pinc-'+ id).html(valeurmoy[0]);
- if(donnees != null) {
- $.each(donnees, function(ind, item) {
- $('.target.pinc-'+ id).append('<option value="'+ ind +'">'+ item +'</option>');
- }); // each
- }
- }
- else {
- parent.children("td.min").html(donnees_min[temp]);
- parent.children("td.max").html(donnees_max[temp]);
- parent.children('.moy.pinc-'+ id).html(valeurmoy[temp]);
- }
- // $(this).parent().attr("href", donnees_ref);
- // $(this).parents().find("td.ref")attr("href", donnees_ref);
- // $(this).parent().children("td.ref").attr("href",donnees_ref);
- // $("#target_ahref").attr("href",donnees_ref);
- // parent.children("td.ref").append($(donnees_ref))
- }); // getjson
- }); // change(function()
- $('.target').change();
- }); // document).ready
- </script>
- {% endblock %}
- {% block content %}
- <body bgcolor="F7FBFA">
- {% if object.get_physical_properties %}
- <ul>
- <p class= "rep" ><TT>
- <strong><font size="4" color="black">Material : </font></strong>
- <font size="4" color="red"> <strong><span class="materiau">{{ object }}</span></strong></font>
- </TT></p>
- {% for prop in object.get_physical_properties|slice:":1" %}
- <TT> {{ prop.name.description|linebreaks }}</TT>
- {% endfor %}
- {% for prop in object.get_physical_properties %}
- {% ifchanged prop.nature_unit %} {# test sur le changement de categorie (mecanique, physique...) avec la precedente #}
- <thead>
- <p style=background-color:PowderBlue;> <TT><font size="4" color="black"><strong> {{prop.nature_unit}} </strong></font></TT></p>
- </thead>
- {% for media in object.get_medias %}
- {% ifequal prop.nature_unit media.nature %} {# test l'egalite sur la propriete #}
- <a href="{{ media.source.url }}">{{ media.name }} {{ media.get_format_display }}</a>
- {% endifequal %}
- {% endfor %}
- <form action="/run_DHM/" method="POST">
- <table width="100%" border="1" style="border: 0.5px;" cellspacing="0" cellpadding="0" >
- <thead>
- <tr bgcolor="dddddd">
- <td width="130" style="text-align:center"><TT><strong>Property </strong></TT></td>
- <td width="100" style="text-align:center"><TT><strong>Temperature (°C)</strong></TT></td>
- <td width="60" style="text-align:center"><TT><strong>min value </strong></TT></td>
- <td width="60" style="text-align:center"><TT><strong>max value</strong></TT></td>
- <td width="60" style="text-align:center"><TT><strong>average </strong></TT></td>
- <td width="200" style="text-align:center"><TT><strong>Reference</strong></TT></td>
- </tr>
- </thead>
- <tr>
- <tfoot>
- <p class= "rep3" width="100" style= "display:none;">{{prop.choix}}</p>
- <td class= "prop" width="130" ><TT><INPUT type="text" size="31" value="{{prop.choix}}" id ="driver" name="propriete"/></TT></td>
- <td width="100"><select class="target pinc-{{prop.id}}" name="temperature" id= "temperature" style="background-color:#EFF0E8;">
- <option selected></option>
- </select>
- </td>
- <td class= "min pinc-{{prop.id}}" width="60" ><TT> {{ prop.val1|floatformat:2}}</TT> </td>
- <td class= "max pinc-{{prop.id}}" width="60" ><TT>{{prop.val2|floatformat:2}}</TT> </td>
- <td class= "moy pinc-{{prop.id}}" width="60" ><TT>{{prop.val3|floatformat:2}}</TT> </td>
- <td class="ref" width="200" ><TT><a id="target_ahref" href="{{ STATIC_URL }}medias/{{ prop.title }}"> {{ prop.title }} </a></TT></td>
- </tr>
- </tfoot>
- </table>
- </form>
- {% else %} {# pas de changement de categorie avec la precedente #}
- <form action="/run_DHM/" method="POST">
- <table width="100%" border="1" style="border: 0.5px;" cellspacing="0" cellpadding="0" >
- <tr>
- <tfoot>
- <p class= "rep3" width="100" style= "display:none;">{{prop.choix}}</p>
- <td class= "prop" width="130" ><TT><INPUT type="text" size="31" value="{{prop.choix}}" id ="driver" name="propriete"/></TT></td>
- <td width="100"><select class= "target pinc-{{prop.id}}" name="temperature" id= "temperature" style="background-color:#EFF0E8;">
- <option selected></option>
- </select>
- </td>
- <td class= "min pinc-{{prop.id}}" width="60" ><TT> {{ prop.val1|floatformat:2}}</TT> </td>
- <td class= "max pinc-{{prop.id}}" width="60" ><TT>{{prop.val2|floatformat:2}} </TT> </td>
- <td class= "moy pinc-{{prop.id}}" width="60" ><TT>{{prop.val3|floatformat:2}}</TT> </td>
- <td class="ref" width="200" ><TT><a id="target_ahref" href="{{ STATIC_URL }}medias/{{ prop.title }}"> {{ prop.title }} </a></TT></td>
- </tr>
- </tfoot>
- </table>
- </form>
- {% endifchanged %}
- {% endfor %}
- </ul>
- <a href="javascript:history.go(-1)">back page</a> |
- <a href="{% url edition_media object.pk %}">Editing form testing temperature </a> | <a href="{% url edition object.id %}">Editing general form </a>
- {% else %}
- <font size="3" color="black">aucune donnee materiau...</font>
- <a href="{% url edition object.pk %}">Editing general form </a> | <a href="{% url material_category_root %}">Back</a>
- {#<a href="javascript:history.go(-1)">Back </a>#}
- {% endif %}
- {% endblock %}
Advertisement
Add Comment
Please, Sign In to add comment