Changeset 3800
- Timestamp:
- Sep 28, 2007, 1:47:54 PM (16 years ago)
- Location:
- branches/filedb
- Files:
-
- 1 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/filedb/src/clients/web/net/sf/basedb/clients/web/PermissionUtil.java
r3679 r3800 145 145 Item.BIOASSAYSET, Item.BIOASSAY, Item.TRANSFORMATION, Item.EXTRAVALUE, 146 146 Item.VIRTUALDB, Item.DATACUBE, Item.DATACUBELAYER, Item.DATACUBECOLUMN, Item.DATACUBEFILTER, 147 Item.DATACUBEEXTRAVALUE 147 Item.DATACUBEEXTRAVALUE, 148 Item.FILESET, Item.FILESETMEMBER, 149 Item.PLATFORMVARIANT, Item.PLATFORMFILETYPE 148 150 ); 149 151 … … 169 171 Item.PROTOCOL, Item.PROTOCOLTYPE, Item.HARDWARE, Item.HARDWARETYPE, Item.SOFTWARE, Item.SOFTWARETYPE, 170 172 Item.ANNOTATIONTYPE, Item.ANNOTATIONTYPECATEGORY, Item.FILETYPE, Item.MIMETYPE, Item.REPORTER, 171 Item.REPORTERLIST, Item.REPORTERTYPE, Item.EXTRAVALUETYPE 173 Item.REPORTERLIST, Item.REPORTERTYPE, Item.EXTRAVALUETYPE, 174 Item.PLATFORM, Item.DATAFILETYPE 172 175 }) 173 176 ); -
branches/filedb/src/core/net/sf/basedb/core/FileSetMember.java
r3793 r3800 25 25 26 26 import net.sf.basedb.core.data.FileSetMemberData; 27 import net.sf.basedb.core.query.EntityQuery; 27 28 import net.sf.basedb.core.query.Hql; 28 29 import net.sf.basedb.core.query.Restrictions; … … 45 46 */ 46 47 public static final Item TYPE = Item.FILESETMEMBER; 48 49 /** 50 This filter gives everybody read permission to file set members. 51 */ 52 private static final QueryRuntimeFilter RUNTIME_FILTER = new QueryRuntimeFilterImpl(); 47 53 48 54 … … 91 97 { 92 98 if (fileSet == null) throw new InvalidUseOfNullException("fileSet"); 93 ItemQuery<FileSetMember> query = new ItemQuery<FileSetMember>(FileSetMember.class );99 ItemQuery<FileSetMember> query = new ItemQuery<FileSetMember>(FileSetMember.class, RUNTIME_FILTER); 94 100 query.restrictPermanent( 95 101 Restrictions.eq( … … 163 169 } 164 170 171 private static class QueryRuntimeFilterImpl 172 implements QueryRuntimeFilter 173 { 174 public void enableFilters(QueryRuntimeFilterManager manager, EntityQuery query, DbControl dc) 175 { 176 // Do not add any filters. 177 } 178 } 165 179 } -
branches/filedb/src/core/net/sf/basedb/core/Install.java
r3797 r3800 329 329 // Platforms, platform variants, platform file types 330 330 createRoleKey(Item.PLATFORM, "Platforms", "Gives access to platforms", guests_use_administrators_all); 331 createRoleKey(Item.PLATFORMVARIANT, "Platform variants", "Gives access to platform variants", guests_use_administrators_all);332 331 createRoleKey(Item.DATAFILETYPE, "Data file types", "Gives access to data file types", guests_use_administrators_all); 333 332 -
branches/filedb/src/core/net/sf/basedb/core/Item.java
r3793 r3800 501 501 The item is a {@link Platform} 502 502 */ 503 PLATFORM(350, "Platform", "plf", Platform.class, PlatformData.class, null,503 PLATFORM(350, "Platform", "plf", Platform.class, PlatformData.class, DefinedPermissions.basic, 504 504 970), 505 505 … … 531 531 The item is a {@link DataFileType} 532 532 */ 533 DATAFILETYPE(355, "Data file type", "dft", DataFileType.class, DataFileTypeData.class, null,533 DATAFILETYPE(355, "Data file type", "dft", DataFileType.class, DataFileTypeData.class, DefinedPermissions.basic, 534 534 980) 535 535 -
branches/filedb/src/core/net/sf/basedb/core/Platform.java
r3797 r3800 426 426 /** 427 427 Add a file type to this platform/variant. If the file type has 428 already been registered this method does nothing. 428 already been registered this method can be used to change the 429 <code>required</code> flag. 430 429 431 @param type The file type 430 432 @param required If a file of this type is required or not … … 445 447 getData().getFileTypes().put(index, platformFileType.getData()); 446 448 getDbControl().saveItemIf(this, platformFileType, false); 449 } 450 else 451 { 452 PlatformFileTypeData pfData = getData().getFileTypes().get(index); 453 pfData.setRequired(required); 447 454 } 448 455 } … … 468 475 if (getData().getFileTypes().containsKey(index)) 469 476 { 470 PlatformFileTypeData pfData = getData().getFileTypes().remove( type.getData());477 PlatformFileTypeData pfData = getData().getFileTypes().remove(index); 471 478 if (pfData != null) 472 479 { -
branches/filedb/src/core/net/sf/basedb/core/PlatformFileType.java
r3793 r3800 38 38 */ 39 39 public class PlatformFileType 40 extends Basic Item<PlatformFileTypeData>40 extends BasicChildItem<PlatformFileTypeData> 41 41 { 42 42 … … 48 48 public static final Item TYPE = Item.PLATFORMFILETYPE; 49 49 50 50 /** 51 This filter will only return items if the logged in user has 52 generic read permission to platforms. 53 */ 54 private static final QueryRuntimeFilter RUNTIME_FILTER = 55 new QueryRuntimeFilterFactory.ChildFilter(TYPE, Item.PLATFORM); 56 51 57 static PlatformFileType getNew(DbControl dc, Platform platform, PlatformVariant variant, 52 58 DataFileType fileType, boolean required) … … 95 101 PlatformVariant variant, boolean restrict) 96 102 { 97 ItemQuery<PlatformFileType> query = new ItemQuery<PlatformFileType>(PlatformFileType.class); 103 ItemQuery<PlatformFileType> query = 104 new ItemQuery<PlatformFileType>(PlatformFileType.class, RUNTIME_FILTER); 98 105 if (platform == null && variant != null) platform = variant.getPlatform(); 99 106 if (platform != null) … … 156 163 // ------------------------------------------- 157 164 165 /* 166 From the BasicChildItem class 167 ------------------------------------------- 168 */ 169 @Override 170 Item getParentType() 171 { 172 return Item.PLATFORM; 173 } 174 // ------------------------------------------- 175 176 177 158 178 /** 159 179 Get the platform. -
branches/filedb/src/core/net/sf/basedb/core/PlatformVariant.java
r3799 r3800 36 36 */ 37 37 public class PlatformVariant 38 extends Basic Item<PlatformVariantData>38 extends BasicChildItem<PlatformVariantData> 39 39 implements Nameable, Removable 40 40 { … … 46 46 */ 47 47 public static final Item TYPE = Item.PLATFORMVARIANT; 48 49 /** 50 This filter will only return items if the logged in user has 51 generic read permission to platforms. 52 */ 53 private static final QueryRuntimeFilter RUNTIME_FILTER = 54 new QueryRuntimeFilterFactory.ChildFilter(TYPE, Item.PLATFORM); 55 48 56 49 57 /** … … 162 170 163 171 /** 164 Get a query configured to retrieve <code>Platform </code> items.172 Get a query configured to retrieve <code>PlatformVariant</code> items. 165 173 @return An {@link ItemQuery} object 166 174 */ … … 168 176 throws BaseException 169 177 { 170 return new ItemQuery<PlatformVariant>(PlatformVariant.class );178 return new ItemQuery<PlatformVariant>(PlatformVariant.class, RUNTIME_FILTER); 171 179 } 172 180 … … 231 239 // ------------------------------------------- 232 240 /* 233 From the BasicItem class234 -------------------------------------------241 From the BasicItem class 242 ------------------------------------------- 235 243 */ 236 244 /** … … 301 309 } 302 310 // ------------------------------------------- 311 /* 312 From the BasicChildItem class 313 ------------------------------------------- 314 */ 315 @Override 316 Item getParentType() 317 { 318 return Item.PLATFORM; 319 } 320 // ------------------------------------------- 303 321 304 322 /** -
branches/filedb/www/admin/datafiletypes/edit_filetype.jsp
r3798 r3800 170 170 %> 171 171 <tr> 172 <td class="prompt"> SystemID</td>172 <td class="prompt">External ID</td> 173 173 <td><input <%=unchangeableClazz%> type="text" name="externalId" 174 174 value="<%=HTML.encodeTags(cc.getPropertyValue("externalId"))%>" -
branches/filedb/www/admin/datafiletypes/view_filetype.jsp
r3798 r3800 263 263 <tbl:row> 264 264 <tbl:cell column="platform"><%=Base.getLinkedName(ID, p, false, true)%></tbl:cell> 265 <tbl:cell column="variant"><%= Base.getLinkedName(ID, v, false, true)%></tbl:cell>265 <tbl:cell column="variant"><%=v == null ? "<i>- all -</i>" : Base.getLinkedName(ID, v, false, true)%></tbl:cell> 266 266 <tbl:cell column="required"><%=item.isRequired() ? "yes" : "no"%></tbl:cell> 267 267 </tbl:row> -
branches/filedb/www/admin/platforms/edit_platform.jsp
r3799 r3800 34 34 import="net.sf.basedb.core.Permission" 35 35 import="net.sf.basedb.core.Platform" 36 import="net.sf.basedb.core.PlatformFileType" 37 import="net.sf.basedb.core.DataFileType" 36 38 import="net.sf.basedb.core.RawDataType" 37 39 import="net.sf.basedb.core.RawDataTypes" 40 import="net.sf.basedb.core.ItemQuery" 41 import="net.sf.basedb.core.ItemResultList" 42 import="net.sf.basedb.core.query.Orders" 43 import="net.sf.basedb.core.query.Hql" 38 44 import="net.sf.basedb.core.PermissionDeniedException" 39 45 import="net.sf.basedb.clients.web.Base" … … 56 62 Platform platform = null; 57 63 boolean isFileOnly = false; 58 64 ItemQuery<PlatformFileType> fileTypeQuery = null; 59 65 if (itemId == 0) 60 66 { … … 69 75 cc.setObject("item", platform); 70 76 title = "Edit platform -- " + HTML.encodeTags(platform.getName()); 77 platform.checkPermission(Permission.WRITE); 78 fileTypeQuery = platform.getFileTypes(null, true); 79 fileTypeQuery.order(Orders.asc(Hql.property("dataFileType.name"))); 71 80 } 72 if (platform != null) 73 { 74 platform.checkPermission(Permission.WRITE); 75 } 76 81 77 82 final String clazz = "class=\"text\""; 78 83 final String requiredClazz = "class=\"text required\""; … … 81 86 82 87 <base:page type="popup" title="<%=title%>"> 83 <base:head scripts="tabcontrol.js " styles="tabcontrol.css">88 <base:head scripts="tabcontrol.js,linkitems.js" styles="tabcontrol.css"> 84 89 <script language="JavaScript"> 85 90 // Validate the "Platform" tab … … 127 132 if (TabControl.validateActiveTab('settings')) 128 133 { 134 frm.modifiedFileTypes.value = Link.exportModified(frm, 'F', true).join(','); 135 frm.removedFileTypes.value = Link.getActionIds(-1, 'F').join(','); 129 136 frm.submit(); 130 137 } … … 140 147 frm.name.focus(); 141 148 frm.name.select(); 149 fileOnlyOnClick(); 142 150 <% 143 151 } 144 152 %> 145 fileOnlyOnClick();153 initFileTypes(); 146 154 } 147 155 function fileOnlyOnClick() … … 153 161 Main.addOrRemoveClass(frm.rawdatatype, 'required', !frm.rawdatatype.disabled); 154 162 Main.addOrRemoveClass(frm.channels, 'required', !frm.channels.disabled); 163 } 164 function initFileTypes() 165 { 166 var fileTypes = document.forms['platform'].fileTypes; 167 <% 168 if (fileTypeQuery != null) 169 { 170 ItemResultList<PlatformFileType> fileTypes = fileTypeQuery.list(dc); 171 for (PlatformFileType ft : fileTypes) 172 { 173 DataFileType dft = ft.getDataFileType(); 174 boolean required = ft.isRequired(); 175 %> 176 Link.addNewItem(fileTypes, new Item('F', <%=dft.getId()%>, '<%=HTML.javaScriptEncode(dft.getName())%> <%=required ? "[×]" : "[-]"%>', '<%=required ? "1" : "0"%>')); 177 <% 178 } 179 } 180 %> 181 } 182 function addFileTypesOnClick() 183 { 184 var frm = document.forms['platform']; 185 Main.openPopup('../datafiletypes/index.jsp?ID=<%=ID%>&mode=selectmultiple&callback=addFileTypeCallback', 'AddFileTypes', 1000, 700); 186 } 187 function addFileTypeCallback(fileTypeId, name) 188 { 189 var item = Link.getItem('F', fileTypeId); 190 var frm = document.forms['platform']; 191 var required = frm.required.checked; 192 if (!item) item = new Item('F', fileTypeId, name+(required ? '[×]' : '[-]'), required ? '1' : '0', ''); 193 Link.addItem(frm.fileTypes, item); 194 } 195 function removeOnClick() 196 { 197 Link.removeSelected(document.forms['platform'].fileTypes); 198 } 199 function fileTypesOnChange() 200 { 201 var frm = document.forms['platform']; 202 var item = frm.fileTypes[frm.fileTypes.selectedIndex].item; 203 if (item && item.id) 204 { 205 frm.required.checked = item.value != '0'; 206 } 207 else 208 { 209 frm.required.checked = false; 210 } 211 } 212 function requiredOnClick() 213 { 214 var frm = document.forms['platform']; 215 var required = frm.required.checked; 216 for (var i = 0; i < frm.fileTypes.length; i++) // > 217 { 218 var option = frm.fileTypes[i]; 219 if (option.selected && option.item.id) 220 { 221 option.item.value = required ? '1' : '0'; 222 var text = option.text.replace(/\[.*\]/, '['+(required ? '×' : '-') +']'); 223 option.text = text; 224 } 225 } 155 226 } 156 227 </script> … … 244 315 </div> 245 316 </t:tab> 317 318 <t:tab id="fileTypes" title="Data file types" 319 tooltip="Associate this platform with date file types" 320 helpid="platform.edit.filetypes" 321 > 322 <table > 323 <tr valign="top"> 324 <td> 325 <b>Data file types</b><br> 326 <select name="fileTypes" size="10" multiple style="width: 20em;" 327 onchange="fileTypesOnChange()"> 328 </select> <br> 329 × = Required 330 <input type="checkbox" name="required" value="1" onchange="requiredOnClick()"> 331 <input type="hidden" name="modifiedFileTypes" value=""> 332 <input type="hidden" name="removedFileTypes" value=""> 333 </td> 334 <td> 335 <br> 336 <table width="150"> 337 <tr><td width="150"><base:button 338 onclick="addFileTypesOnClick()" 339 title="Add data file types…" 340 tooltip="Add more data file types to this platform" 341 /></td></tr> 342 <tr><td width="150"><base:button 343 onclick="removeOnClick()" 344 title="Remove" 345 tooltip="Remove the selected data file types" 346 /></td></tr> 347 </table> 348 </td> 349 </tr> 350 </table> 351 </t:tab> 352 246 353 </t:tabcontrol> 247 354 -
branches/filedb/www/admin/platforms/index.jsp
r3798 r3800 1 <%@page import="net.sf.basedb.core.PlatformFileType"%> 1 2 <%-- $Id$ 2 3 ------------------------------------------------------------------ … … 31 32 import="net.sf.basedb.core.Include" 32 33 import="net.sf.basedb.core.Platform" 34 import="net.sf.basedb.core.DataFileType" 33 35 import="net.sf.basedb.core.RawDataType" 34 36 import="net.sf.basedb.core.RawDataTypes" … … 152 154 platform.setName(Values.getStringOrNull(request.getParameter("name"))); 153 155 platform.setDescription(Values.getStringOrNull(request.getParameter("description"))); 156 157 // Data file types 158 String[] modifiedFileTypes = Values.getString(request.getParameter("modifiedFileTypes")).split(","); 159 for (int i = 0; i < modifiedFileTypes.length; ++i) 160 { 161 int ftId = Values.getInt(modifiedFileTypes[i], -1); 162 if (ftId != -1) 163 { 164 DataFileType dft = DataFileType.getById(dc, ftId); 165 boolean required = Values.getBoolean(request.getParameter("F"+ftId)); 166 platform.addFileType(dft, required, null); 167 } 168 } 169 String[] removedFileTypes = Values.getString(request.getParameter("removedFileTypes")).split(","); 170 for (int i = 0; i < removedFileTypes.length; ++i) 171 { 172 int ftId = Values.getInt(removedFileTypes[i], -1); 173 if (ftId != -1) 174 { 175 DataFileType dft = DataFileType.getById(dc, ftId); 176 platform.removeFileType(dft, null); 177 } 178 } 179 154 180 dc.commit(); 155 181 cc.removeObject("item"); -
branches/filedb/www/admin/platforms/variants/edit_variant.jsp
r3799 r3800 35 35 import="net.sf.basedb.core.Platform" 36 36 import="net.sf.basedb.core.PlatformVariant" 37 import="net.sf.basedb.core.PlatformFileType" 38 import="net.sf.basedb.core.DataFileType" 37 39 import="net.sf.basedb.core.RawDataType" 38 40 import="net.sf.basedb.core.RawDataTypes" 39 41 import="net.sf.basedb.core.PermissionDeniedException" 42 import="net.sf.basedb.core.ItemQuery" 43 import="net.sf.basedb.core.ItemResultList" 44 import="net.sf.basedb.core.query.Orders" 45 import="net.sf.basedb.core.query.Hql" 40 46 import="net.sf.basedb.clients.web.Base" 41 47 import="net.sf.basedb.clients.web.util.HTML" … … 59 65 PlatformVariant variant = null; 60 66 boolean isFileOnly = false; 61 67 ItemQuery<PlatformFileType> fileTypeQuery = null; 68 62 69 if (itemId == 0) 63 70 { … … 76 83 title = "Edit platform variant -- " + HTML.encodeTags(variant.getName()); 77 84 variant.checkPermission(Permission.WRITE); 85 fileTypeQuery = platform.getFileTypes(variant, true); 86 fileTypeQuery.order(Orders.asc(Hql.property("dataFileType.name"))); 78 87 } 79 88 … … 84 93 85 94 <base:page type="popup" title="<%=title%>"> 86 <base:head scripts="tabcontrol.js " styles="tabcontrol.css">95 <base:head scripts="tabcontrol.js,linkitems.js" styles="tabcontrol.css"> 87 96 <script language="JavaScript"> 88 97 // Validate the "Variant" tab … … 130 139 if (TabControl.validateActiveTab('settings')) 131 140 { 141 frm.modifiedFileTypes.value = Link.exportModified(frm, 'F', true).join(','); 142 frm.removedFileTypes.value = Link.getActionIds(-1, 'F').join(','); 132 143 frm.submit(); 133 144 } … … 143 154 frm.name.focus(); 144 155 frm.name.select(); 156 fileOnlyOnClick(); 145 157 <% 146 158 } 147 159 %> 148 fileOnlyOnClick();160 initFileTypes(); 149 161 } 150 162 function fileOnlyOnClick() … … 156 168 Main.addOrRemoveClass(frm.rawdatatype, 'required', !frm.rawdatatype.disabled); 157 169 Main.addOrRemoveClass(frm.channels, 'required', !frm.channels.disabled); 170 } 171 function initFileTypes() 172 { 173 var fileTypes = document.forms['variant'].fileTypes; 174 <% 175 if (fileTypeQuery != null) 176 { 177 ItemResultList<PlatformFileType> fileTypes = fileTypeQuery.list(dc); 178 for (PlatformFileType ft : fileTypes) 179 { 180 DataFileType dft = ft.getDataFileType(); 181 boolean required = ft.isRequired(); 182 %> 183 Link.addNewItem(fileTypes, new Item('F', <%=dft.getId()%>, '<%=HTML.javaScriptEncode(dft.getName())%> <%=required ? "[×]" : "[-]"%>', '<%=required ? "1" : "0"%>')); 184 <% 185 } 186 } 187 %> 188 } 189 function addFileTypesOnClick() 190 { 191 var frm = document.forms['variant']; 192 Main.openPopup('../../datafiletypes/index.jsp?ID=<%=ID%>&mode=selectmultiple&callback=addFileTypeCallback', 'AddFileTypes', 1000, 700); 193 } 194 function addFileTypeCallback(fileTypeId, name) 195 { 196 var item = Link.getItem('F', fileTypeId); 197 var frm = document.forms['variant']; 198 var required = frm.required.checked; 199 if (!item) item = new Item('F', fileTypeId, name+(required ? '[×]' : '[-]'), required ? '1' : '0', ''); 200 Link.addItem(frm.fileTypes, item); 201 } 202 function removeOnClick() 203 { 204 Link.removeSelected(document.forms['variant'].fileTypes); 205 } 206 function fileTypesOnChange() 207 { 208 var frm = document.forms['variant']; 209 var item = frm.fileTypes[frm.fileTypes.selectedIndex].item; 210 if (item && item.id) 211 { 212 frm.required.checked = item.value != '0'; 213 } 214 else 215 { 216 frm.required.checked = false; 217 } 218 } 219 function requiredOnClick() 220 { 221 var frm = document.forms['variant']; 222 var required = frm.required.checked; 223 for (var i = 0; i < frm.fileTypes.length; i++) // > 224 { 225 var option = frm.fileTypes[i]; 226 if (option.selected && option.item.id) 227 { 228 option.item.value = required ? '1' : '0'; 229 var text = option.text.replace(/\[.*\]/, '['+(required ? '×' : '-') +']'); 230 option.text = text; 231 } 232 } 158 233 } 159 234 </script> … … 249 324 </div> 250 325 </t:tab> 326 <t:tab id="fileTypes" title="Data file types" 327 tooltip="Associate this platform variant with date file types" 328 helpid="platformvariant.edit.filetypes" 329 > 330 <table > 331 <tr valign="top"> 332 <td> 333 <b>Data file types</b><br> 334 <select name="fileTypes" size="10" multiple style="width: 20em;" 335 onchange="fileTypesOnChange()"> 336 </select> <br> 337 × = Required 338 <input type="checkbox" name="required" value="1" onchange="requiredOnClick()"> 339 <input type="hidden" name="modifiedFileTypes" value=""> 340 <input type="hidden" name="removedFileTypes" value=""> 341 </td> 342 <td> 343 <br> 344 <table width="150"> 345 <tr><td width="150"><base:button 346 onclick="addFileTypesOnClick()" 347 title="Add data file types…" 348 tooltip="Add more data file types to this platform variant" 349 /></td></tr> 350 <tr><td width="150"><base:button 351 onclick="removeOnClick()" 352 title="Remove" 353 tooltip="Remove the selected data file types" 354 /></td></tr> 355 </table> 356 </td> 357 </tr> 358 </table> 359 </t:tab> 251 360 </t:tabcontrol> 252 361 -
branches/filedb/www/admin/platforms/variants/index.jsp
r3799 r3800 32 32 import="net.sf.basedb.core.Platform" 33 33 import="net.sf.basedb.core.PlatformVariant" 34 import="net.sf.basedb.core.DataFileType" 34 35 import="net.sf.basedb.core.RawDataType" 35 36 import="net.sf.basedb.core.RawDataTypes" … … 119 120 { 120 121 // Display the edit page for a new item (should be opened in a popup) 121 if (!sc.hasPermission(Permission.CREATE, itemType))122 {123 throw new PermissionDeniedException(Permission.CREATE, itemType.toString());124 }125 122 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 126 123 cc.setId(0); … … 133 130 dc = sc.newDbControl(); 134 131 PlatformVariant variant = (PlatformVariant)cc.getObject("item"); 132 Platform platform = null; 135 133 if (variant == null) 136 134 { 137 Platformplatform = Platform.getById(dc, platformId);135 platform = Platform.getById(dc, platformId); 138 136 boolean fileOnly = Values.getBoolean(request.getParameter("fileOnly")); 139 137 String externalId = Values.getStringOrNull(request.getParameter("externalId")); … … 153 151 { 154 152 dc.reattachItem(variant); 153 platform = Platform.getById(dc, variant.getPlatform().getId()); 155 154 message = "Platform variant updated"; 156 155 } 157 156 variant.setName(Values.getStringOrNull(request.getParameter("name"))); 158 157 variant.setDescription(Values.getStringOrNull(request.getParameter("description"))); 158 159 // Data file types 160 String[] modifiedFileTypes = Values.getString(request.getParameter("modifiedFileTypes")).split(","); 161 for (int i = 0; i < modifiedFileTypes.length; ++i) 162 { 163 int ftId = Values.getInt(modifiedFileTypes[i], -1); 164 if (ftId != -1) 165 { 166 DataFileType dft = DataFileType.getById(dc, ftId); 167 boolean required = Values.getBoolean(request.getParameter("F"+ftId)); 168 platform.addFileType(dft, required, variant); 169 } 170 } 171 String[] removedFileTypes = Values.getString(request.getParameter("removedFileTypes")).split(","); 172 for (int i = 0; i < removedFileTypes.length; ++i) 173 { 174 int ftId = Values.getInt(removedFileTypes[i], -1); 175 if (ftId != -1) 176 { 177 DataFileType dft = DataFileType.getById(dc, ftId); 178 platform.removeFileType(dft, variant); 179 } 180 } 181 159 182 dc.commit(); 160 183 cc.removeObject("item"); -
branches/filedb/www/admin/platforms/variants/view_variant.jsp
r3799 r3800 34 34 import="net.sf.basedb.core.Platform" 35 35 import="net.sf.basedb.core.PlatformVariant" 36 import="net.sf.basedb.core.PlatformFileType" 37 import="net.sf.basedb.core.DataFileType" 36 38 import="net.sf.basedb.core.RawDataType" 37 39 import="net.sf.basedb.core.PermissionDeniedException" 38 40 import="net.sf.basedb.core.PluginDefinition" 41 import="net.sf.basedb.core.ItemQuery" 42 import="net.sf.basedb.core.ItemResultList" 43 import="net.sf.basedb.core.query.Orders" 44 import="net.sf.basedb.core.query.Hql" 39 45 import="net.sf.basedb.core.plugin.GuiContext" 40 46 import="net.sf.basedb.core.plugin.Plugin" … … 218 224 </t:tabcontrol> 219 225 226 <% 227 ItemQuery<PlatformFileType> fileTypeQuery = platform.getFileTypes(variant, false); 228 fileTypeQuery.join(Hql.leftJoin("variant", "var")); 229 fileTypeQuery.order(Orders.asc(Hql.property("var", "name"))); 230 fileTypeQuery.order(Orders.asc(Hql.property("dataFileType.name"))); 231 ItemResultList<PlatformFileType> fileTypes = fileTypeQuery.list(dc); 232 233 if (fileTypes.size() == 0) 234 { 235 %> 236 <h4>Data file types</h4> 237 This platform variant has no associated data file types (or, you don't have permission to view them). 238 <% 239 } 240 else 241 { 242 %> 243 <h4 class="docked">Data file types</h4> 244 <tbl:table 245 id="fileTypes" 246 clazz="itemlist" 247 columns="all" 248 > 249 <tbl:columndef 250 id="variant" 251 title="Variant" 252 /> 253 <tbl:columndef 254 id="name" 255 title="Name" 256 /> 257 <tbl:columndef 258 id="required" 259 title="Required" 260 /> 261 <tbl:columndef 262 id="genericType" 263 title="Generic type" 264 /> 265 <tbl:columndef 266 id="description" 267 title="Description" 268 /> 269 <tbl:data> 270 <tbl:columns> 271 </tbl:columns> 272 <tbl:rows> 273 <% 274 for (PlatformFileType fileType : fileTypes) 275 { 276 DataFileType dft = fileType.getDataFileType(); 277 PlatformVariant thisVariant = fileType.getVariant(); 278 %> 279 <tbl:row> 280 <tbl:cell column="variant"><%=thisVariant == null ? "<i>- all -</i>" : Base.getLinkedName(ID, thisVariant, false, true)%></tbl:cell> 281 <tbl:cell column="name"><%=Base.getLinkedName(ID, dft, false, true)%></tbl:cell> 282 <tbl:cell column="required"><%=fileType.isRequired() ? "yes" : "no"%></tbl:cell> 283 <tbl:cell column="genericType"><base:propertyvalue item="<%=dft%>" property="genericType" /></tbl:cell> 284 <tbl:cell column="description"><%=HTML.niceFormat(dft.getDescription())%></tbl:cell> 285 </tbl:row> 286 <% 287 } 288 %> 289 </tbl:rows> 290 </tbl:data> 291 </tbl:table> 292 <% 293 } 294 %> 295 220 296 </base:body> 221 297 </base:page> -
branches/filedb/www/admin/platforms/view_platform.jsp
r3799 r3800 34 34 import="net.sf.basedb.core.Platform" 35 35 import="net.sf.basedb.core.PlatformVariant" 36 import="net.sf.basedb.core.DataFileType" 36 37 import="net.sf.basedb.core.RawDataType" 37 38 import="net.sf.basedb.core.ItemQuery" … … 78 79 %> 79 80 80 <base:page title="<%=title%>"> 81 <base:head scripts="tabcontrol.js" styles="toolbar.css,headertabcontrol.css,path.css"> 81 <%@page import="net.sf.basedb.core.PlatformFileType"%> 82 <base:page title="<%=title%>"> 83 <base:head scripts="tabcontrol.js" styles="toolbar.css,headertabcontrol.css,path.css,table.css"> 82 84 <script language="JavaScript"> 83 85 function editItem() … … 158 160 title="New variant…" 159 161 tooltip="Create a new variant of this platform" 160 visible="<%= sc.hasPermission(Permission.CREATE, Item.PLATFORMVARIANT)%>"162 visible="<%=writePermission%>" 161 163 /> 162 164 <tbl:button … … 247 249 </t:tabcontrol> 248 250 251 <% 252 ItemQuery<PlatformFileType> fileTypeQuery = platform.getFileTypes(null, false); 253 fileTypeQuery.join(Hql.leftJoin("variant", "var")); 254 fileTypeQuery.order(Orders.asc(Hql.property("var", "name"))); 255 fileTypeQuery.order(Orders.asc(Hql.property("dataFileType.name"))); 256 ItemResultList<PlatformFileType> fileTypes = fileTypeQuery.list(dc); 257 258 if (fileTypes.size() == 0) 259 { 260 %> 261 <h4>Data file types</h4> 262 This platform has no associated data file types (or, you don't have permission to view them). 263 <% 264 } 265 else 266 { 267 %> 268 <h4 class="docked">Data file types</h4> 269 <tbl:table 270 id="fileTypes" 271 clazz="itemlist" 272 columns="all" 273 > 274 <tbl:columndef 275 id="variant" 276 title="Variant" 277 /> 278 <tbl:columndef 279 id="name" 280 title="Name" 281 /> 282 <tbl:columndef 283 id="required" 284 title="Required" 285 /> 286 <tbl:columndef 287 id="genericType" 288 title="Generic type" 289 /> 290 <tbl:columndef 291 id="description" 292 title="Description" 293 /> 294 <tbl:data> 295 <tbl:columns> 296 </tbl:columns> 297 <tbl:rows> 298 <% 299 for (PlatformFileType fileType : fileTypes) 300 { 301 DataFileType dft = fileType.getDataFileType(); 302 PlatformVariant variant = fileType.getVariant(); 303 %> 304 <tbl:row> 305 <tbl:cell column="variant"><%=variant == null ? "<i>- all -</i>" : Base.getLinkedName(ID, variant, false, true)%></tbl:cell> 306 <tbl:cell column="name"><%=Base.getLinkedName(ID, dft, false, true)%></tbl:cell> 307 <tbl:cell column="required"><%=fileType.isRequired() ? "yes" : "no"%></tbl:cell> 308 <tbl:cell column="genericType"><base:propertyvalue item="<%=dft%>" property="genericType" /></tbl:cell> 309 <tbl:cell column="description"><%=HTML.niceFormat(dft.getDescription())%></tbl:cell> 310 </tbl:row> 311 <% 312 } 313 %> 314 </tbl:rows> 315 </tbl:data> 316 </tbl:table> 317 <% 318 } 319 %> 249 320 250 321 </base:body>
Note: See TracChangeset
for help on using the changeset viewer.