PageRenderTime 40ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/tardis/tardis_portal/templates/tardis_portal/mobile/view_experiment.html

https://github.com/grischa/mytardis-mrtardis
HTML | 374 lines | 261 code | 83 blank | 30 comment | 0 complexity | e41b6f2019dbbf19dd4ef39a25933cf3 MD5 | raw file
  1. <!--
  2. Copyright (c) 2010, Monash e-Research Centre
  3. (Monash University, Australia)
  4. Copyright (c) 2010, VeRSI Consortium
  5. (Victorian eResearch Strategic Initiative, Australia)
  6. All rights reserved.
  7. Redistribution and use in source and binary forms, with or without
  8. modification, are permitted provided that the following conditions are met:
  9. * Redistributions of source code must retain the above copyright
  10. notice, this list of conditions and the following disclaimer.
  11. * Redistributions in binary form must reproduce the above copyright
  12. notice, this list of conditions and the following disclaimer in the
  13. documentation and/or other materials provided with the distribution.
  14. * Neither the name of the VeRSI, the VeRSI Consortium members, nor the
  15. names of its contributors may be used to endorse or promote products
  16. derived from this software without specific prior written permission.
  17. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
  18. EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
  21. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. -->
  28. {% extends "mobile/portal_template.html" %}
  29. {% load basiccomparisonfilters %}
  30. {% load parametertypecheck %}
  31. {% block script %}
  32. <script type="text/javascript">
  33. $(document).ready(function(e) {
  34. $('.filterform').live('submit', function(e) {
  35. e.preventDefault();
  36. filterbox = $(this).find('.filename_search');
  37. dataset_id = filterbox.siblings('.dataset_id').val();
  38. filterbox.parents('.datafile_list').load("/ajax/datafile_list/" + dataset_id + "/?filename=" + filterbox.val(), function(){
  39. $(document).ready(function(){
  40. // datafile metadata
  41. $(".datafile_info_toggle").unbind('click');
  42. $(document).find('.datafile_info_toggle').text("Show Metadata");
  43. $(document).find('.datafile_info').hide();
  44. $(document).find('.datafile_info_toggle').toggle(function(){
  45. $(this).text("Hide Metadata");
  46. var href = $(this).attr("href");
  47. $(this).next().show();
  48. //if($(this).next().text().replace(/^\s+|\s+$/g,'') == "")
  49. //{
  50. $(this).next().html(loadingHTML);
  51. //}
  52. $(this).next().load(href);
  53. },function(){
  54. $(this).text("Show Metadata");
  55. $(this).next().hide();
  56. });
  57. });
  58. });
  59. });
  60. // show hide various metadata divs
  61. $('#datasets').find('.dataset_info').end().find('h2').click(function() {
  62. $(this).next().toggle();
  63. });
  64. $('.dataset_info').find('.datafile_list').hide().end().find('.datafile_list_toggle').click(function(e) {
  65. e.preventDefault();
  66. $(this).next().toggle();
  67. });
  68. $('.pagelink').live('click', function( event ){
  69. var href = $(this).attr("href");
  70. html = $(this).html();
  71. $(this).html(html + " " + loadingHTML);
  72. $(this).parents('.datafile_list').load(href, function(){
  73. $(document).ready(function(){
  74. // datafile metadata
  75. $(".datafile_info_toggle").unbind('click');
  76. $(document).find('.datafile_info_toggle').text("Show Metadata");
  77. $(document).find('.datafile_info').hide();
  78. $(document).find('.datafile_info_toggle').toggle(function(){
  79. $(this).text("Hide Metadata");
  80. var href = $(this).attr("href");
  81. $(this).next().show();
  82. //if($(this).next().text().replace(/^\s+|\s+$/g,'') == "")
  83. //{
  84. $(this).next().html(loadingHTML);
  85. //}
  86. $(this).next().load(href);
  87. },function(){
  88. $(this).text("Show Metadata");
  89. $(this).next().hide();
  90. });
  91. $(".dataset_selector_all").unbind('click');
  92. $(".dataset_selector_none").unbind('click');
  93. // file selectors
  94. $(document).find('.dataset_selector_all').click(function() {
  95. $(this).parent().find('.datafile_checkbox').attr("checked", "checked");
  96. });
  97. $(document).find('.dataset_selector_none').click(function() {
  98. $(this).parent().find('.datafile_checkbox').removeAttr("checked");
  99. });
  100. });
  101. //$(this).html(html);
  102. })
  103. return false;
  104. });
  105. // default text set
  106. $(".dataset_metadata_toggle").text("Show Dataset Metadata");
  107. var loadingHTML = "<img src='/site_media/images/ajax-loader.gif'/>";
  108. // metadata text / ajax toggle
  109. // dataset md
  110. $(".dataset_metadata_toggle").toggle(function(){
  111. $(this).text("Hide Dataset Metadata");
  112. var href= $(this).attr("href");
  113. $(href).show();
  114. },function(){
  115. $(this).text("Show Dataset Metadata");
  116. var href= $(this).attr("href");
  117. $(href).hide();
  118. });
  119. // datafile list
  120. $(".datafile_list_toggle").toggle(function(e){
  121. $(this).text("Hide Data Files");
  122. var href = $(this).attr("href");
  123. $(this).next().html(loadingHTML + "<br/>");
  124. var datafile_info_container = $(this).next();
  125. // add initialisation for new datafile handlers as callback once ajax has loaded
  126. // damn I love jQuery
  127. $(this).next().load(href,function(e){
  128. $(document).ready(function(e){
  129. var datafile_info_selectors =
  130. datafile_info_container.find('.datafile_info').hide().end().find('.datafile_info_toggle');
  131. datafile_info_selectors.text("Show Metadata");
  132. // datafile metadata
  133. datafile_info_selectors.toggle(function(){
  134. $(this).text("Hide Metadata");
  135. var href = $(this).attr("href");
  136. //if($(this).next().text().replace(/^\s+|\s+$/g,'') == "")
  137. //{
  138. $(this).next().html(loadingHTML);
  139. //}
  140. $(this).next().load(href);
  141. },function(){
  142. $(this).text("Show Metadata");
  143. });
  144. datafile_info_selectors.click(function() {
  145. $(this).next().toggle();
  146. });
  147. // file selectors
  148. datafile_info_container.find('.dataset_selector_all').click(function() {
  149. $(this).parent().find('.datafile_checkbox').attr("checked", "checked");
  150. });
  151. datafile_info_container.find('.dataset_selector_none').click(function() {
  152. $(this).parent().find('.datafile_checkbox').removeAttr("checked");
  153. });
  154. });
  155. });
  156. },function(e){
  157. $(this).text("Show Data Files");
  158. });
  159. });
  160. </script>
  161. {% endblock %}
  162. {% block content %}
  163. <div class="post">
  164. <span class="graytitle">{{experiment.title}}</span>
  165. <ul class="pageitem">
  166. <li class="textbox">
  167. <div class="demo">
  168. <div id="tabs">
  169. <div id="tabs-1">
  170. <p>
  171. <span class="header">Authors</span>
  172. {% for author in authors %}
  173. {{ author.author.name }}{% if not forloop.last %},{% endif %}
  174. {% endfor %}
  175. </p>
  176. <p>
  177. <span class="header">Abstract</span>
  178. <div class="abstract">
  179. {{ experiment.description|safe }}
  180. </div>
  181. </p>
  182. {% if experiment.handle %}
  183. <p>
  184. <strong>Persistent Handle:</strong>
  185. <a href="{{ handle }}/{{ experiment.handle }}">{{ experiment.handle }}</a><br/>
  186. </p>
  187. {% endif %}
  188. <p>
  189. <span class="header">Institution</span>
  190. {{experiment.institution_name}}<br/>
  191. </p>
  192. <p>
  193. <div class="dataset_extrainfo">
  194. {% if experiment.experimentparameterset_set.count %}
  195. <strong>Experiment Metadata: </strong><a class="dataset_metadata_toggle" href="#dataset_metadata_{{forloop.counter}}">[Hide]</a>
  196. <div class="dataset_metadata" id="dataset_metadata_{{forloop.counter}}">
  197. <ul>
  198. {% for parameterset in experiment.experimentparameterset_set.all %}
  199. <p><strong><em>Schema: {{parameterset.schema}}</strong></em></p>
  200. {% for parameter in parameterset.experimentparameter_set.all %}
  201. <li><strong>{{ parameter.name.full_name }}: </strong>
  202. {% if parameter.name.is_numeric %}
  203. {{ parameter.numerical_value }} {{ parameter.name.units }}
  204. {% else %}
  205. {{ parameter.string_value|eparametertypecheck:parameter.id|safe }}
  206. {% endif %}
  207. </li>
  208. {% endfor %}
  209. <br/><br/>
  210. {% endfor %}
  211. </ul>
  212. </div>
  213. </div>
  214. {% endif %}
  215. </p>
  216. <p>
  217. <span class="header">Dataset Information</span>
  218. <div>
  219. <!-- <strong>Dataset Metadata: </strong> -->
  220. <div class="dataset_information">
  221. <ul>
  222. <li><strong>Datasets:</strong> {{experiment.dataset_set.all.count}}</li>
  223. <li><strong>Files:</strong> {{datafiles.count}}</li>
  224. <li><strong>Size:</strong> {{size|filesizeformat}}</li>
  225. </ul>
  226. </div>
  227. </div>
  228. </p>
  229. <p>
  230. <span class="header">Experiment Last Updated</span>
  231. {{ experiment.update_time|date:"jS F Y H:i" }}<br/>
  232. </p>
  233. <p align="right">
  234. {% if owners %}
  235. <br/>
  236. <span class="header">Experiment Administrators</span>
  237. {% for owner in owners %}
  238. {{ owner.username }} {% if owner.email %}(<a href="mailto:{{owner.email}}">{{ owner.email}}</a>{% endif %}){% if not forloop.last %}<br/>{% endif %}
  239. {% endfor %}
  240. {% endif %}
  241. </p>
  242. </div>
  243. <div id="tabs-2">
  244. <br/>
  245. <input type="hidden" name="expid" value="{{experiment.id}}">
  246. <div id="datasets">
  247. {% for dataset in experiment.dataset_set.all %}
  248. <span class="header" style="color: black;">
  249. <strong>Dataset {{ forloop.counter }}</strong>
  250. </span>
  251. <div class="dataset_info">
  252. <div class="dataset_description">
  253. <span class="header">Dataset Description</span>{{ dataset.description|safe }}
  254. </div>
  255. <br/>
  256. <div class="dataset_extrainfo">
  257. {% if dataset.datasetparameterset_set.count %}
  258. <strong>Dataset Metadata: </strong><a class="dataset_metadata_toggle" href="#dataset_metadata_{{forloop.counter}}">[Hide]</a>
  259. <div class="dataset_metadata" id="dataset_metadata_{{forloop.counter}}">
  260. <ul>
  261. {% for parameterset in dataset.datasetparameterset_set.all %}
  262. <p><strong><em>Schema: {{parameterset.schema}}</strong></em></p>
  263. {% for parameter in parameterset.datasetparameter_set.all %}
  264. <li><strong>{{ parameter.name.full_name }}: </strong>
  265. {% if parameter.name.is_numeric %}
  266. {{ parameter.numerical_value }} {{ parameter.name.units }}
  267. {% else %}
  268. {{ parameter.string_value|dsparametertypecheck:parameter.id|safe }}
  269. {% endif %}
  270. </li>
  271. {% endfor %}
  272. <br/><br/>
  273. {% endfor %}
  274. </ul>
  275. </div>
  276. {% endif %}
  277. <div>
  278. <a class="button datafile_list_toggle" href="/ajax/datafile_list/{{ dataset.id }}">Show Data Files</a>
  279. <ul class="datafile_list">
  280. </ul>
  281. </div>
  282. </div>
  283. </div>
  284. {% endfor %}
  285. </div>
  286. </li>
  287. </ul>
  288. </div>
  289. {% endblock %}