5878 |
17 Nov 11 |
nicklas |
1 |
<%-- $Id $ |
5878 |
17 Nov 11 |
nicklas |
2 |
------------------------------------------------------------------ |
5878 |
17 Nov 11 |
nicklas |
Copyright (C) 2011 Nicklas Nordborg |
5878 |
17 Nov 11 |
nicklas |
4 |
|
5878 |
17 Nov 11 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
5878 |
17 Nov 11 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
5878 |
17 Nov 11 |
nicklas |
7 |
|
5878 |
17 Nov 11 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
5878 |
17 Nov 11 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
5878 |
17 Nov 11 |
nicklas |
10 |
as published by the Free Software Foundation; either version 3 |
5878 |
17 Nov 11 |
nicklas |
11 |
of the License, or (at your option) any later version. |
5878 |
17 Nov 11 |
nicklas |
12 |
|
5878 |
17 Nov 11 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
5878 |
17 Nov 11 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
5878 |
17 Nov 11 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5878 |
17 Nov 11 |
nicklas |
16 |
GNU General Public License for more details. |
5878 |
17 Nov 11 |
nicklas |
17 |
|
5878 |
17 Nov 11 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
5878 |
17 Nov 11 |
nicklas |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
5878 |
17 Nov 11 |
nicklas |
20 |
------------------------------------------------------------------ |
5878 |
17 Nov 11 |
nicklas |
21 |
|
5878 |
17 Nov 11 |
nicklas |
22 |
--%> |
5878 |
17 Nov 11 |
nicklas |
23 |
<%@ page pageEncoding="UTF-8" session="false" |
5878 |
17 Nov 11 |
nicklas |
24 |
import="net.sf.basedb.core.SessionControl" |
5878 |
17 Nov 11 |
nicklas |
25 |
import="net.sf.basedb.core.DbControl" |
5878 |
17 Nov 11 |
nicklas |
26 |
import="net.sf.basedb.core.Item" |
5878 |
17 Nov 11 |
nicklas |
27 |
import="net.sf.basedb.core.ItemContext" |
5878 |
17 Nov 11 |
nicklas |
28 |
import="net.sf.basedb.core.Permission" |
5878 |
17 Nov 11 |
nicklas |
29 |
import="net.sf.basedb.core.Experiment" |
5886 |
23 Nov 11 |
nicklas |
30 |
import="net.sf.basedb.core.VirtualDb" |
5886 |
23 Nov 11 |
nicklas |
31 |
import="net.sf.basedb.core.VirtualTable" |
5878 |
17 Nov 11 |
nicklas |
32 |
import="net.sf.basedb.core.ReporterCloneTemplate" |
5878 |
17 Nov 11 |
nicklas |
33 |
import="net.sf.basedb.core.ItemQuery" |
5878 |
17 Nov 11 |
nicklas |
34 |
import="net.sf.basedb.core.ItemResultList" |
5878 |
17 Nov 11 |
nicklas |
35 |
import="net.sf.basedb.core.Include" |
5878 |
17 Nov 11 |
nicklas |
36 |
import="net.sf.basedb.core.Type" |
5878 |
17 Nov 11 |
nicklas |
37 |
import="net.sf.basedb.core.query.Restrictions" |
5878 |
17 Nov 11 |
nicklas |
38 |
import="net.sf.basedb.core.query.Expressions" |
5878 |
17 Nov 11 |
nicklas |
39 |
import="net.sf.basedb.core.query.Orders" |
5878 |
17 Nov 11 |
nicklas |
40 |
import="net.sf.basedb.core.query.Hql" |
5878 |
17 Nov 11 |
nicklas |
41 |
import="net.sf.basedb.core.PermissionDeniedException" |
5878 |
17 Nov 11 |
nicklas |
42 |
import="net.sf.basedb.core.BaseException" |
5878 |
17 Nov 11 |
nicklas |
43 |
import="net.sf.basedb.core.Project" |
5878 |
17 Nov 11 |
nicklas |
44 |
import="net.sf.basedb.clients.web.Base" |
5878 |
17 Nov 11 |
nicklas |
45 |
import="net.sf.basedb.clients.web.WebException" |
5878 |
17 Nov 11 |
nicklas |
46 |
import="net.sf.basedb.clients.web.util.HTML" |
5878 |
17 Nov 11 |
nicklas |
47 |
import="net.sf.basedb.util.Values" |
5878 |
17 Nov 11 |
nicklas |
48 |
import="net.sf.basedb.util.Enumeration" |
5878 |
17 Nov 11 |
nicklas |
49 |
import="net.sf.basedb.core.plugin.GuiContext" |
5878 |
17 Nov 11 |
nicklas |
50 |
import="java.util.Arrays" |
5878 |
17 Nov 11 |
nicklas |
51 |
import="java.util.Date" |
5878 |
17 Nov 11 |
nicklas |
52 |
import="java.util.List" |
5878 |
17 Nov 11 |
nicklas |
53 |
%> |
5878 |
17 Nov 11 |
nicklas |
54 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
5878 |
17 Nov 11 |
nicklas |
55 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
5878 |
17 Nov 11 |
nicklas |
56 |
<% |
5878 |
17 Nov 11 |
nicklas |
57 |
final Item itemType = Item.EXPERIMENT; |
5878 |
17 Nov 11 |
nicklas |
58 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
5878 |
17 Nov 11 |
nicklas |
59 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
5878 |
17 Nov 11 |
nicklas |
60 |
final int itemId = cc.getId(); |
5878 |
17 Nov 11 |
nicklas |
61 |
final String ID = sc.getId(); |
5878 |
17 Nov 11 |
nicklas |
62 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
63 |
final DbControl dc = sc.newDbControl(":Clone reporters"); |
5878 |
17 Nov 11 |
nicklas |
64 |
try |
5878 |
17 Nov 11 |
nicklas |
65 |
{ |
5878 |
17 Nov 11 |
nicklas |
66 |
String title = "Clone reporters"; |
5878 |
17 Nov 11 |
nicklas |
67 |
Experiment experiment = Experiment.getById(dc, itemId); |
5878 |
17 Nov 11 |
nicklas |
68 |
experiment.checkPermission(Permission.WRITE); |
5886 |
23 Nov 11 |
nicklas |
69 |
VirtualDb virtualDb = experiment.getVirtualDb(); |
5886 |
23 Nov 11 |
nicklas |
70 |
boolean canCloneFromRaw = experiment.getRawDataType().isStoredInDb(); |
5886 |
23 Nov 11 |
nicklas |
71 |
boolean canCloneFromVirtual = virtualDb.hasTable(VirtualTable.POSITION); |
5878 |
17 Nov 11 |
nicklas |
72 |
|
5886 |
23 Nov 11 |
nicklas |
73 |
if (!canCloneFromRaw && !canCloneFromVirtual) |
5886 |
23 Nov 11 |
nicklas |
74 |
{ |
5886 |
23 Nov 11 |
nicklas |
75 |
throw new BaseException("Can't clone reporters for experiment since it has no raw data or analyzed data"); |
5886 |
23 Nov 11 |
nicklas |
76 |
} |
5886 |
23 Nov 11 |
nicklas |
77 |
|
7605 |
26 Feb 19 |
nicklas |
78 |
List<ReporterCloneTemplate> recentTemplates = cc.getRecent(dc, Item.REPORTERCLONETEMPLATE); |
5878 |
17 Nov 11 |
nicklas |
79 |
%> |
5878 |
17 Nov 11 |
nicklas |
80 |
<base:page type="popup" title="<%=title%>"> |
6315 |
06 Sep 13 |
nicklas |
81 |
<base:head scripts="~clone_reporters.js" /> |
6315 |
06 Sep 13 |
nicklas |
82 |
<base:body> |
5923 |
11 Jan 12 |
nicklas |
83 |
<h1><%=title%> <base:help helpid="experiment.clonereporters" /></h1> |
6162 |
10 Oct 12 |
nicklas |
84 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="clone"> |
5878 |
17 Nov 11 |
nicklas |
85 |
<input type="hidden" name="cmd" value="CloneReporters"> |
5878 |
17 Nov 11 |
nicklas |
86 |
<input type="hidden" name="item_id" value="<%=itemId %>"> |
5878 |
17 Nov 11 |
nicklas |
87 |
|
5923 |
11 Jan 12 |
nicklas |
88 |
<div class="content bottomborder"> |
5923 |
11 Jan 12 |
nicklas |
89 |
<table class="fullform input100"> |
5878 |
17 Nov 11 |
nicklas |
90 |
<tr> |
5923 |
11 Jan 12 |
nicklas |
91 |
<th>Clone template</th> |
5878 |
17 Nov 11 |
nicklas |
92 |
<td> |
5878 |
17 Nov 11 |
nicklas |
93 |
<base:select |
5878 |
17 Nov 11 |
nicklas |
94 |
id="reporterclonetemplate_id" |
5878 |
17 Nov 11 |
nicklas |
95 |
clazz="selectionlist" |
5886 |
23 Nov 11 |
nicklas |
96 |
required="false" |
5878 |
17 Nov 11 |
nicklas |
97 |
current="<%=null%>" |
5878 |
17 Nov 11 |
nicklas |
98 |
denied="<%=false%>" |
5878 |
17 Nov 11 |
nicklas |
99 |
recent="<%=recentTemplates%>" |
5878 |
17 Nov 11 |
nicklas |
100 |
newitem="<%=false%>" |
5886 |
23 Nov 11 |
nicklas |
101 |
unselectedtext="- all properties -" |
5878 |
17 Nov 11 |
nicklas |
102 |
/> |
5878 |
17 Nov 11 |
nicklas |
103 |
</td> |
5923 |
11 Jan 12 |
nicklas |
104 |
<td></td> |
5878 |
17 Nov 11 |
nicklas |
105 |
</tr> |
5886 |
23 Nov 11 |
nicklas |
106 |
<tr> |
5923 |
11 Jan 12 |
nicklas |
107 |
<th>Clone source</th> |
5886 |
23 Nov 11 |
nicklas |
108 |
<td> |
5886 |
23 Nov 11 |
nicklas |
109 |
<select name="cloneSource"> |
5886 |
23 Nov 11 |
nicklas |
110 |
<% |
5886 |
23 Nov 11 |
nicklas |
111 |
if (canCloneFromRaw && canCloneFromVirtual) |
5886 |
23 Nov 11 |
nicklas |
112 |
{ |
5886 |
23 Nov 11 |
nicklas |
113 |
%> |
5886 |
23 Nov 11 |
nicklas |
114 |
<option value="AUTO">Auto |
5886 |
23 Nov 11 |
nicklas |
115 |
<% |
5886 |
23 Nov 11 |
nicklas |
116 |
} |
5886 |
23 Nov 11 |
nicklas |
117 |
if (canCloneFromVirtual) |
5886 |
23 Nov 11 |
nicklas |
118 |
{ |
5886 |
23 Nov 11 |
nicklas |
119 |
%> |
5886 |
23 Nov 11 |
nicklas |
120 |
<option value="VIRTUAL">Analyzed data |
5886 |
23 Nov 11 |
nicklas |
121 |
<% |
5886 |
23 Nov 11 |
nicklas |
122 |
} |
5886 |
23 Nov 11 |
nicklas |
123 |
if (canCloneFromRaw) |
5886 |
23 Nov 11 |
nicklas |
124 |
{ |
5886 |
23 Nov 11 |
nicklas |
125 |
%> |
5886 |
23 Nov 11 |
nicklas |
126 |
<option value="RAW">Raw data |
5886 |
23 Nov 11 |
nicklas |
127 |
<% |
5886 |
23 Nov 11 |
nicklas |
128 |
} |
5886 |
23 Nov 11 |
nicklas |
129 |
%> |
5886 |
23 Nov 11 |
nicklas |
130 |
</select> |
5886 |
23 Nov 11 |
nicklas |
131 |
</td> |
5923 |
11 Jan 12 |
nicklas |
132 |
<td></td> |
5886 |
23 Nov 11 |
nicklas |
133 |
</tr> |
5923 |
11 Jan 12 |
nicklas |
134 |
<tr class="dynamic"> |
5923 |
11 Jan 12 |
nicklas |
135 |
<th>Description</th> |
5923 |
11 Jan 12 |
nicklas |
136 |
<td> |
6217 |
14 Dec 12 |
nicklas |
137 |
<textarea class="text" rows="6" name="description" id="description" |
5878 |
17 Nov 11 |
nicklas |
138 |
><%=HTML.encodeTags(experiment == null ? cc.getPropertyValue("description") : experiment.getDescription())%></textarea> |
5878 |
17 Nov 11 |
nicklas |
139 |
</td> |
5923 |
11 Jan 12 |
nicklas |
140 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
141 |
<base:zoom textarea="description" title="Description" /> |
5923 |
11 Jan 12 |
nicklas |
142 |
</td> |
5878 |
17 Nov 11 |
nicklas |
143 |
</tr> |
5878 |
17 Nov 11 |
nicklas |
144 |
</table> |
5923 |
11 Jan 12 |
nicklas |
145 |
</div> |
5923 |
11 Jan 12 |
nicklas |
146 |
</form> |
5923 |
11 Jan 12 |
nicklas |
147 |
<base:buttongroup subclass="dialogbuttons"> |
6315 |
06 Sep 13 |
nicklas |
148 |
<base:button id="btnSave" title="Next" /> |
6315 |
06 Sep 13 |
nicklas |
149 |
<base:button id="close" title="Cancel" /> |
5923 |
11 Jan 12 |
nicklas |
150 |
</base:buttongroup> |
5878 |
17 Nov 11 |
nicklas |
151 |
|
5878 |
17 Nov 11 |
nicklas |
152 |
</base:body> |
5878 |
17 Nov 11 |
nicklas |
153 |
</base:page> |
5878 |
17 Nov 11 |
nicklas |
154 |
<% |
5878 |
17 Nov 11 |
nicklas |
155 |
} |
5878 |
17 Nov 11 |
nicklas |
156 |
finally |
5878 |
17 Nov 11 |
nicklas |
157 |
{ |
5878 |
17 Nov 11 |
nicklas |
158 |
if (dc != null) dc.close(); |
5878 |
17 Nov 11 |
nicklas |
159 |
} |
5878 |
17 Nov 11 |
nicklas |
160 |
%> |