Changeset 5069
- Timestamp:
- Nov 1, 2018, 8:37:13 AM (5 years ago)
- Location:
- extensions/net.sf.basedb.meludi/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.meludi/trunk/resources/personal/ffpe_section_order_form.js
r5061 r5069 16 16 // Step 2 17 17 Buttons.addClickHandler('downloadformbatch2', istat.downloadFormBatch2); 18 Buttons.addClickHandler('downloadffpesectionlabelfile', istat.downloadFfpeSectionLabelFile); 19 Buttons.addClickHandler('downloadheglasslabelfile', istat.downloadHeGlassLabelFile); 18 20 19 21 // Navigation … … 135 137 Doc.hide('gonext'); 136 138 Doc.show('downloadformbatch2'); 139 Doc.show('downloadffpesectionlabelfile'); 140 Doc.show('downloadheglasslabelfile'); 137 141 138 142 Doc.show('step-2'); … … 159 163 url += '&nofFfpeBlocks='+encodeURIComponent(nofFfpeBlocks); 160 164 window.open(url); 165 } 166 167 istat.downloadFfpeSectionLabelFile = function() 168 { 169 var frm = document.forms['meludi']; 170 var ffpeBlockList = istat.getSelectedItemsList(); 171 var preview = false; 172 173 var url = '../LabelGeneration.servlet?ID=' + App.getSessionId(); 174 url += '&cmd=GetFfpeSectionLabelFile'; 175 url += '&ffpeblocklist='+encodeURIComponent(JSON.stringify(ffpeBlockList)); 176 url += '&preview=' + preview; 177 178 if (preview) 179 { 180 Doc.hide('previewWrapper'); 181 url += '&preview=1'; 182 183 Wizard.showLoadingAnimation('Working...'); 184 Doc.hide('navigation'); 185 Wizard.asyncJsonRequest(url, istat.onPreviewLoaded); 186 } 187 else 188 { 189 window.location = url; 190 } 191 } 192 193 istat.downloadHeGlassLabelFile = function() 194 { 195 var frm = document.forms['meludi']; 196 var ffpeBlockList = istat.getSelectedItemsList(); 197 var preview = false; 198 199 var url = '../LabelGeneration.servlet?ID=' + App.getSessionId(); 200 url += '&cmd=GetHeGlassLabelFile'; 201 url += '&ffpeblocklist='+encodeURIComponent(JSON.stringify(ffpeBlockList)); 202 url += '&preview=' + preview; 203 204 if (preview) 205 { 206 Doc.hide('previewWrapper'); 207 url += '&preview=1'; 208 209 Wizard.showLoadingAnimation('Working...'); 210 Doc.hide('navigation'); 211 Wizard.asyncJsonRequest(url, istat.onPreviewLoaded); 212 } 213 else 214 { 215 window.location = url; 216 } 161 217 } 162 218 -
extensions/net.sf.basedb.meludi/trunk/resources/personal/ffpe_section_order_form.jsp
r5048 r5069 137 137 <td><base:button id="gonext" title="Next" image="<%=home+"/images/gonext.png"%>" /></td> 138 138 <td><base:button id="gorestart" title="Restart" image="<%=home+"/images/goback.png"%>" /></td> 139 <td><base:button id="downloadformbatch2" title="Download form batch file 2" image="<%=home+"/images/download.png"%>" /></td> 139 <td><base:button id="downloadformbatch2" title="Download FFPE section order form" image="<%=home+"/images/download.png"%>" /></td> 140 <td><base:button id="downloadffpesectionlabelfile" title="Download FFPE section labels file" image="<%=home+"/images/download.png"%>" /></td> 141 <td><base:button id="downloadheglasslabelfile" title="Download HE glass labels file" image="<%=home+"/images/download.png"%>" /></td> 140 142 </tr> 141 143 </table> -
extensions/net.sf.basedb.meludi/trunk/src/net/sf/basedb/meludi/servlet/LabelGenerationServlet.java
r4876 r5069 3 3 import java.io.FileWriter; 4 4 import java.io.IOException; 5 import java.util.ArrayList; 5 6 import java.util.Date; 6 7 import java.util.HashMap; 8 import java.util.List; 7 9 import java.util.Set; 8 10 … … 21 23 import net.sf.basedb.meludi.JsonUtil; 22 24 import net.sf.basedb.meludi.Meludi; 25 import net.sf.basedb.meludi.dao.Annotationtype; 26 import net.sf.basedb.meludi.dao.FfpeBlock; 23 27 import net.sf.basedb.meludi.dao.Subtype; 24 28 import net.sf.basedb.util.Values; 25 29 import net.sf.basedb.util.error.ThrowableUtil; 26 30 31 import org.json.simple.JSONArray; 27 32 import org.json.simple.JSONObject; 33 import org.json.simple.parser.JSONParser; 28 34 29 35 public class LabelGenerationServlet … … 186 192 } 187 193 } 194 else if ("GetFfpeSectionLabelFile".equals(cmd)) 195 { 196 dc = sc.newDbControl(); 197 int activeProjectId = sc.getActiveProjectId(); 198 Project project = Project.getById(dc, activeProjectId); 199 String sampleItemPrefix = Meludi.fetchSampleItemPrefix(activeProjectId); 200 String bloodItemPrefix = Meludi.fetchBloodItemPrefix(activeProjectId); 201 boolean bloodAndSampleItemPrefixesDiffer = Meludi.bloodAndSampleItemPrefixesDiffer(activeProjectId); 202 String firstPart = ""; 203 String secondPart = ""; 204 205 boolean preview = Values.getBoolean(req.getParameter("preview"), true); 206 String jsonFfpeBlockListStr = Values.getString(req.getParameter("ffpeblocklist"), ""); 207 //System.out.println("LabelGenerationServlet::doGet(): cmd = \"" + cmd + "\" jsonFfpeBlockListStr = " + jsonFfpeBlockListStr); 208 // Get list of extract source item names 209 List<String> ffpeBlockIdList = new ArrayList<String>(); 210 JSONArray jsonItems = (JSONArray)new JSONParser().parse(jsonFfpeBlockListStr); 211 //System.out.println("LabelGenerationServlet::doGet(): cmd = \"" + cmd + "\" jsonItems = " + jsonItems); 212 213 // Generate label file contents 214 Integer sampleItemNumDigits = Meludi.fetchSampleItemNumDigits(sc.getActiveProjectId()); 215 String separator = ""; 216 217 for (int i = 0; i < jsonItems.size(); ++i) 218 { 219 JSONObject jsonItem = (JSONObject)jsonItems.get(i); 220 String itemName = (String)jsonItem.get("name"); 221 ffpeBlockIdList.add(itemName); 222 firstPart += separator + itemName + ".s"; 223 separator = "\n"; 224 } 225 String labelString = "LABEL\n" + firstPart + secondPart; 226 227 // Send labels in a file to the client. 228 resp.setHeader("Content-Disposition", "attachment; filename=FFPE_section_labels.csv"); 229 resp.setContentType("text/plain"); 230 ServletOutputStream os = resp.getOutputStream(); 231 os.print(labelString); 232 os.flush(); 233 os.close(); 234 } 235 else if ("GetHeGlassLabelFile".equals(cmd)) 236 { 237 dc = sc.newDbControl(); 238 int activeProjectId = sc.getActiveProjectId(); 239 Project project = Project.getById(dc, activeProjectId); 240 String sampleItemPrefix = Meludi.fetchSampleItemPrefix(activeProjectId); 241 String bloodItemPrefix = Meludi.fetchBloodItemPrefix(activeProjectId); 242 boolean bloodAndSampleItemPrefixesDiffer = Meludi.bloodAndSampleItemPrefixesDiffer(activeProjectId); 243 String firstPart = ""; 244 String secondPart = ""; 245 246 boolean preview = Values.getBoolean(req.getParameter("preview"), true); 247 String jsonFfpeBlockListStr = Values.getString(req.getParameter("ffpeblocklist"), ""); 248 //System.out.println("LabelGenerationServlet::doGet(): cmd = \"" + cmd + "\" jsonFfpeBlockListStr = " + jsonFfpeBlockListStr); 249 // Get list of extract source item names 250 List<String> ffpeBlockIdList = new ArrayList<String>(); 251 JSONArray jsonItems = (JSONArray)new JSONParser().parse(jsonFfpeBlockListStr); 252 //System.out.println("LabelGenerationServlet::doGet(): cmd = \"" + cmd + "\" jsonItems = " + jsonItems); 253 254 // Generate label file contents 255 Integer sampleItemNumDigits = Meludi.fetchSampleItemNumDigits(sc.getActiveProjectId()); 256 String separator = ""; 257 258 for (int i = 0; i < jsonItems.size(); ++i) 259 { 260 JSONObject jsonItem = (JSONObject)jsonItems.get(i); 261 String itemName = (String)jsonItem.get("name"); 262 ffpeBlockIdList.add(itemName); 263 firstPart += separator + itemName + ".he-F"; 264 separator = "\n"; 265 firstPart += separator + itemName + ".he-E"; 266 } 267 String labelString = "LABEL\n" + firstPart + secondPart; 268 269 // Send labels in a file to the client. 270 resp.setHeader("Content-Disposition", "attachment; filename=HE_glass_labels.csv"); 271 resp.setContentType("text/plain"); 272 ServletOutputStream os = resp.getOutputStream(); 273 os.print(labelString); 274 os.flush(); 275 os.close(); 276 } 188 277 } 189 278 catch (Throwable t)
Note: See TracChangeset
for help on using the changeset viewer.