source: trunk/grails-app/views/assay/show.gsp @ 4

Last change on this file since 4 was 4, checked in by robert@…, 12 years ago

Implemented trash in order to prevent deletion of data

File size: 6.1 KB
Line 
1<html>
2        <head>
3                <meta name="layout" content="main" />
4                <title>Show assay ${assay.name} | Metagenomics | dbNP</title>
5               
6                <link rel="stylesheet" href="<g:resource dir="css" file="showAssay.css" />" type="text/css"/>
7                <link rel="stylesheet" href="<g:resource dir="css" file="fileuploader.new.css" />" type="text/css"/>
8               
9                <g:javascript src="jquery.ui.tabbeddialog.js" />
10                <g:javascript src="assay.show.addFilesDialog.js" />
11                <g:javascript src="assay.show.enterTagsDialog.js" />
12                <g:javascript src="assay.show.runDialogs.js" />
13                <g:javascript src="assay.show.showSampleDialog.js" />
14                <g:javascript src="assay.show.showRunDialog.js" />
15
16                <g:javascript src="fileuploader.new.js" />
17                <g:javascript src="fileuploads.new.js" />
18               
19                <script>
20                        var assayId = ${assay.id};
21                        var numOtherRuns = ${otherRuns.size()};
22
23                        // Create a variable with assay names to check for existing names
24                        var runNames = [];
25                        <g:each in="${assay.runs + otherRuns}" var="run">
26                                runNames[ runNames.length ] = {id: ${run.id}, name: '${run.name}', alreadyAdded: ${ run.assays.contains( assay ) ? 'true' : 'false' }};
27                        </g:each>
28                       
29                        function initializeUploadedFiles( selector ) {
30                                if( selector == undefined )
31                                        selector = "";
32                               
33                                $( selector + ' .uploadedFile').each( function( idx, el ) {
34                                        $(el).html( createFileHTML( $(el).text(), 'getPermanent' ) );
35                                });
36                        }
37
38                        // Initializefiles on load
39                        $(function() { initializeUploadedFiles(); });
40                </script>
41        </head>
42<body>
43        <h1>
44                ${assay.study.name} - ${assay.name}
45        </h1>
46       
47        <label>Study</label>: <a target="_top" href="${ assay.study.viewUrl() }">${assay.study.name}</a><br />
48        <label>Assay</label>: ${assay.name}<br />
49        <label># samples</label>: ${assay.assaySamples?.size()}<br />
50        <label># sequences</label>: ${assay.numSequences()}<br />
51        <label># files</label>: ${assay.numFiles()}<br />
52
53        <!-- Samples -->
54        <h2>Samples</h2>
55        <g:if test="${assay.assaySamples == null || assay.assaySamples.size() == 0}">
56                No samples found in assay.
57                <g:if test="${editable}">
58                        Associate samples with this assay in <a target="_top" href="${ assay.study.viewUrl() }">GSCF</a>.
59                </g:if>
60        </g:if>
61        <g:else>
62                <table class="paginate">
63                        <thead>
64                                <tr>
65                                        <th nowrap>name</th>
66                                        <th nowrap>tag sequence</th>
67                                        <th nowrap># sequences</th>
68                                        <th nowrap>avg quality</th>
69                                        <th nowrap># unique sequences</th>
70                                </tr>
71                        </thead>                       
72                        <tbody>
73                                <% def assaySamples = assay.assaySamples.toList().sort { it.sample.name }; %>
74                                <g:each in="${assaySamples}" var="assaySample">
75                                        <tr>
76                                                <td><a href="#" onClick="showSample(${assaySample.id}); return false;">${assaySample.sample.name}</a></td>
77                                                <td>${assaySample.tagSequence}</td>
78                                                <td>${assaySample.numSequences()}</td>
79                                                <td>
80                                                        <g:if test="${assaySample.averageQuality() > 0.0}">
81                                                                <g:formatNumber number="${assaySample.averageQuality()}" format="0.0" />
82                                                        </g:if>
83                                                        <g:else>
84                                                                -
85                                                        </g:else>
86                                                </td>
87                                                <td>
88                                                        <g:if test="${assaySample.numUniqueSequences > 0}">
89                                                                ${assaySample.numUniqueSequences}
90                                                        </g:if>
91                                                        <g:else>
92                                                                -
93                                                        </g:else>
94                                                </td>
95                                        </tr>
96                                </g:each>
97                        </tbody>
98                </table>
99                <g:if test="${editable}">
100                        <input type="button" value="Edit sample data" onClick="showEnterTagsDialog();">
101                        <input type="button" value="Add sequence files" onClick="showAddFilesDialog();" <g:if test="${assay.runs == null || assay.runs.size() == 0}">disabled="disabled"</g:if>>
102                        <g:render template="enterTagsDialog" model="[assay: assay, sortedAssaySamples: assaySamples]" />
103                        <g:render template="addFilesDialog" model="[assay: assay]" />
104                </g:if>
105                <div id="showSampleDialog" class="dialog"></div>
106        </g:else>       
107
108        <!-- Runs -->
109        <h2>Runs</h2>
110        <g:if test="${assay.runs == null || assay.runs.size() == 0}">
111                No runs found for this assay.
112        </g:if>
113        <g:else>
114                <table class="paginate">
115                        <thead>
116                                <tr>
117                                        <th nowrap>name</th>
118                                        <th nowrap>date</th>
119                                        <th nowrap>supplier</th>
120                                        <th nowrap>machine</th>
121                                        <th nowrap>parameter file</th>
122                                        <th nowrap>other assays</th>
123                                        <th class="nonsortable"></th>
124                                        <th class="nonsortable"></th>
125                                </tr>
126                        </thead>                       
127                        <tbody>
128                                <% def runs = assay.runs.toList().sort { it.name }; %>
129                                <g:each in="${runs}" var="run">
130                                        <tr>
131                                                <td><a href="#" onClick="showRun(${run.id}); return false;">${run.name}</a></td>
132                                                <td><g:formatDate format="dd-MM-yyyy" date="${run.date}"/></td>
133                                                <td>${run.supplier}</td>
134                                                <td>${run.machine}</td>
135                                                <td><g:uploadedFile value="${run.parameterFile}"/></td>
136                                                <td>
137                                                        <g:if test="${run.assays?.size() == 1}">
138                                                                <% /* If only 1 assay is found, then it is the current one */ %>
139                                                                -
140                                                        </g:if>
141                                                        <g:else>
142                                                                <g:each in="${run.assays - assay}" var="otherAssay">
143                                                                        <g:link action="show" id="${otherAssay.id}">${otherAssay.name}</g:link><br />
144                                                                </g:each>
145                                                        </g:else>
146                                                </td>
147                                                <td class="button"><a href="#" onClick="showEditRunDialog( ${run.id}, '${run.name?.encodeAsJavaScript()}', '${run.date ? run.date.format( 'yyyy-mm-dd' ).encodeAsJavaScript() : ''}', '${run.machine?.encodeAsJavaScript()}', '${run.supplier?.encodeAsJavaScript()}', '${run.parameterFile?.encodeAsJavaScript()}' ); return false;"><img src="${fam.icon(name: 'application_edit')}" /></a></td>
148                                                <td class="button">
149                                                        <g:if test="${run.samples(assay.id).size()}">
150                                                                <img src="${fam.icon(name: 'application_delete')}" class="disabled" title="You can't remove this assay because sequences from this assay are coupled to this run." />
151                                                        </g:if>
152                                                        <g:else>
153                                                                <g:link onClick="return confirm( 'Are you sure you want to remove the selected run from this assay?' );" controller="assay" action="removeRun" id="${assay.id}" params="${[run_id: run.id]}" ><img src="${fam.icon(name: 'application_delete')}" /></g:link>
154                                                        </g:else>
155                                                </td>
156                                        </tr>
157                                </g:each>
158                        </tbody>
159                </table>
160        </g:else>
161        <g:if test="${editable}">
162                <input type="button" value="Add run" onClick="showAddRunDialog();">
163                <g:render template="addRunDialog" model="[assay: assay]" />
164                <div id="editRunDialog" class="dialog"></div>
165        </g:if>
166        <div id="showRunDialog" class="dialog"></div>
167</body>
168</html>
Note: See TracBrowser for help on using the repository browser.