source: trunk/grails-app/views/trash/index.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: 4.4 KB
Line 
1<html>
2<head>
3        <meta name="layout" content="main" />
4        <title>View trashcan | Metagenomics | dbNP</title>
5        <g:javascript src="trash.js" />
6</head>
7<body>
8        <h1>List of assays in the trashcan</h1>
9        <g:if test="${studies.size() == 0}">
10                <p>Currently the trashcan is empty.</p>
11        </g:if>
12        <g:else>
13                <table class="paginate">
14                        <thead>
15                                <tr>
16                                        <th>Type</th>
17                                        <th>Name</th>
18                                        <th># samples</th>
19                                        <th># sequences</th>
20                                        <th>Tag sequence</th>
21                                        <th>Oligo number</th>
22                                        <th>Files</th>
23                                        <th class="nonsortable"></th>
24                                        <th class="nonsortable"></th>
25                                </tr>
26                        </thead>
27                        <tbody>
28                                <g:each in="${trashStudies}" var="study">
29                                        <g:if test="${study.assays != null && study.assays.size() > 0}">
30                                                <g:each in="${study.assays}" var="assay">
31                                                        <tr>
32                                                                <td>Assay</td>
33                                                                <td>
34                                                                ${assay.name}
35                                                                </td>
36                                                                <td>
37                                                                ${assay.assaySamples?.size()}
38                                                                </td>
39                                                                <td>
40                                                                ${assay.numSequences()}
41                                                                </td>
42                                                                <td>-</td>
43                                                                <td>-</td>
44                                                                <td>
45                                                                ${assay.numFiles()}
46                                                                </td>
47                                                                <td align="center"><a href="#" onClick="restAssay('${assay.id}'); return false;" title="Restore assay"><img src="${fam.icon(name:'arrow_redo')}" alt="Restore assay"></a></td>
48                                                                <td align="center"><g:link action="deleteAssay" id="${assay.id}" onClick="return confirm( 'Are you sure you want to delete this assay and all its data forever?' );" title="Delete assay forever"><img src="${fam.icon(name:'delete')}" alt="Delete assay forever"></g:link></td>
49                                                        </tr>
50                                                        <% def assaysamples =  assay.assaySamples.sort { a, b -> a.sample.name <=> b.sample.name } %>
51                                                        <g:each in="${assaysamples}" var="assaysample">
52                                                                <tr>
53                                                                        <td>Sample</td>
54                                                                        <td>
55                                                                        ${assaysample.sample.name}
56                                                                        </td>
57                                                                        <td></td>
58                                                                        <td>
59                                                                        ${assaysample.numSequences()}
60                                                                        </td>
61                                                                        <td>
62                                                                        ${assaysample.tagSequence}
63                                                                        </td>
64                                                                        <td>
65                                                                        ${assaysample.oligoNumber}
66                                                                        </td>
67                                                                        <td>
68                                                                                <g:each in="${assaysample.sequenceData}" var="data">
69                                                                                        <g:uploadedFile value="${data.sequenceFile}" />,
70                                                                                        <g:uploadedFile value="${data.qualityFile}" />,
71                                                                                </g:each>
72                                                                        </td>
73                                                                        <td align="center"><a href="#" onClick="restSample(${assaysample.id}); return false;" title="Restore sample"><img src="${fam.icon(name:'arrow_redo')}" alt="Restore sample"></a></td>
74                                                                        <td align="center"><g:link action="deleteSample" id="${assaysample.id}" onClick="return confirm( 'Are you sure you want to delete this sample and all its data forever?' );" title="Delete sample forever"><img src="${fam.icon(name:'delete')}" alt="Delete sample forever"></g:link></td>
75                                                                </tr>
76                                                        </g:each>
77                                                </g:each>
78                                        </g:if>
79                                </g:each>
80                        </tbody>
81                </table>
82       
83                <div id="restoreAssayDialog" class="dialog">
84                        <g:form name="restoreAssay" action="restoreAssay">
85                                <p>
86                                        You can restore the data of this assay. Please choose which existing assay this data belongs to. The
87                                        system will try to match the names of the samples in the trashcan with the samples in the assay you choose.
88                                </p>
89                                <select name="restoreTo">
90                                        <g:each in="${studies}" var="study">
91                                                <g:if test="${study.assays != null && study.assays.size() > 0}">
92                                                        <g:each in="${study.assays}" var="assay">
93                                                                <g:if test="${assay.assaySamples != null && assay.assaySamples.size() > 0}">
94                                                                        <option value="${assay.id}">${study.name} - ${assay.name}</option>
95                                                                </g:if>
96                                                        </g:each>
97                                                </g:if>
98                                        </g:each>
99                                </select>
100                        </g:form>
101                </div>
102                <div id="restoreSampleDialog" class="dialog">
103                        <g:form name="restoreSample" action="restoreSample">
104                        <p>
105                                You can restore the data of this sample. Please choose which existing sample this data belongs to.
106                        </p>
107                        <select name="restoreTo">
108                                <g:each in="${studies}" var="study">
109                                        <g:if test="${study.assays != null && study.assays.size() > 0}">
110                                                <g:each in="${study.assays}" var="assay">
111                                                        <g:if test="${assay.assaySamples != null && assay.assaySamples.size() > 0}">
112                                                                <optgroup label="${study.name.encodeAsHTML()} - ${assay.name?.encodeAsHTML()}">
113                                                                        <g:each in="${assay.assaySamples}" var="assaysample">
114                                                                                <option value="${assaysample.id}">${assaysample.sample.name}</option>
115                                                                        </g:each>
116                                                                </optgroup>
117                                                        </g:if>
118                                                </g:each>
119                                        </g:if>
120                                </g:each>
121                        </select>
122                        </g:form>
123                </div>
124        </g:else>
125</body>
126</html>
Note: See TracBrowser for help on using the repository browser.