Changeset 7311
- Timestamp:
- Mar 21, 2017, 9:09:35 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/ItemSubtypeFileType.java
r6898 r7311 113 113 114 114 /** 115 Get the item subtype types that have been registered for a specific data 116 file type. 117 118 @param fileType An data file type or null to return items for 119 all file types 120 @return A query returning <code>ItemSubtypeFileType</code> items 121 @since 3.11 122 */ 123 public static ItemQuery<ItemSubtypeFileType> getQuery(DataFileType fileType) 124 { 125 ItemQuery<ItemSubtypeFileType> query = 126 new ItemQuery<ItemSubtypeFileType>(ItemSubtypeFileType.class, RUNTIME_FILTER); 127 if (fileType != null) 128 { 129 query.restrictPermanent( 130 Restrictions.eq( 131 Hql.property("dataFileType"), 132 Hql.entity(fileType) 133 ) 134 ); 135 } 136 return query; 137 } 138 139 /** 115 140 Creates a new member item from the given data. 116 141 @param data the data. -
trunk/www/admin/datafiletypes/list_filetypes.jsp
r7269 r7311 33 33 import="net.sf.basedb.core.PlatformVariant" 34 34 import="net.sf.basedb.core.PlatformFileType" 35 import="net.sf.basedb.core.ItemSubtypeFileType" 35 36 import="net.sf.basedb.core.ItemQuery" 36 37 import="net.sf.basedb.core.Include" … … 101 102 platformQuery.restrict(Restrictions.eq(Hql.property("dataFileType"), Expressions.parameter("fileType"))); 102 103 platformQuery.order(Orders.asc(Hql.property("platform.name"))); 104 105 // Query to get the item subtypes a file type is registerd with 106 final ItemQuery<ItemSubtypeFileType> subtypeQuery = ItemSubtypeFileType.getQuery((DataFileType)null); 107 subtypeQuery.include(cc.getInclude()); 108 subtypeQuery.restrict(Restrictions.eq(Hql.property("dataFileType"), Expressions.parameter("fileType"))); 109 subtypeQuery.order(Orders.asc(Hql.property("itemSubtype.name"))); 103 110 104 111 // Get all file types … … 221 228 title="Platforms" 222 229 property="&platforms(platform.name)" 230 datatype="string" 231 filterable="true" 232 /> 233 <tbl:columndef 234 id="subtypes" 235 title="Subtypes" 236 property="&itemSubtypes(itemSubtype.name)" 223 237 datatype="string" 224 238 filterable="true" … … 466 480 %> 467 481 </tbl:cell> 482 <tbl:cell column="subtypes"> 483 <% 484 subtypeQuery.setParameter("fileType", itemId, Type.INT); 485 try 486 { 487 String separator = ""; 488 for (ItemSubtypeFileType st : subtypeQuery.list(dc)) 489 { 490 ItemSubtype s = st.getItemSubtype(); 491 out.write(separator); 492 if (mode.hasPropertyLink()) 493 { 494 out.write(Base.getLinkedName(ID, s, false, mode.hasEditLink())); 495 } 496 else 497 { 498 out.write(HTML.encodeTags(s.getName())); 499 } 500 separator = ", "; 501 } 502 } 503 catch (Throwable t) 504 { 505 %> 506 <div class="error"><%=t.getMessage()%></div> 507 <% 508 } 509 %> 510 </tbl:cell> 468 511 <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> 469 512 <tbl:xt-cells dc="<%=dc%>" item="<%=item%>"> -
trunk/www/admin/datafiletypes/view_filetype.jsp
r6605 r7311 34 34 import="net.sf.basedb.core.PlatformVariant" 35 35 import="net.sf.basedb.core.PlatformFileType" 36 import="net.sf.basedb.core.ItemSubtypeFileType" 37 import="net.sf.basedb.core.ItemSubtype" 36 38 import="net.sf.basedb.core.Include" 37 39 import="net.sf.basedb.core.ItemQuery" … … 296 298 %> 297 299 </base:section> 300 <% 301 ItemQuery<ItemSubtypeFileType> subtypeQuery = ItemSubtypeFileType.getQuery(fileType); 302 subtypeQuery.include(Include.ALL); 303 subtypeQuery.order(Orders.asc(Hql.property("itemSubtype.name"))); 304 ItemResultList<ItemSubtypeFileType> subtypes = subtypeQuery.list(dc); 305 %> 306 <base:section 307 id="subtypes" 308 title="<%="Used by item subtypes (" + subtypes.size() + ")"%>" 309 context="<%=cc%>" 310 > 311 <% 312 if (subtypes.size() == 0) 313 { 314 %> 315 <div class="messagecontainer note"> 316 This file type is not used by any item subtypes 317 (or, you don't have permission to view them). 318 </div> 319 <% 320 } 321 else 322 { 323 %> 324 <tbl:table 325 id="tbl.subtypes" 326 columns="all" 327 > 328 <tbl:columndef 329 id="subtype" 330 title="Item subtype" 331 /> 332 <tbl:columndef 333 id="required" 334 title="Required" 335 /> 336 <tbl:columndef 337 id="multiple" 338 title="Multiple files" 339 /> 340 <tbl:data> 341 <tbl:headers> 342 <tbl:headerrow> 343 <tbl:columnheaders /> 344 </tbl:headerrow> 345 </tbl:headers> 346 <tbl:rows> 347 <% 348 for (ItemSubtypeFileType item : subtypes) 349 { 350 ItemSubtype st = item.getItemSubtype(); 351 %> 352 <tbl:row> 353 <tbl:cell column="subtype"><base:icon 354 image="deleted.png" 355 tooltip="This item has been scheduled for deletion" 356 visible="<%=st.isRemoved()%>" 357 /><%=Base.getLinkedName(ID, st, false, true)%></tbl:cell> 358 <tbl:cell column="required"><%=item.isRequired() ? "yes" : "no"%></tbl:cell> 359 <tbl:cell column="multiple"><%=item.getAllowMultiple() ? "yes" : "no"%></tbl:cell> 360 </tbl:row> 361 <% 362 } 363 %> 364 </tbl:rows> 365 </tbl:data> 366 </tbl:table> 367 <% 368 } 369 %> 370 </base:section> 298 371 <jsp:include page="../../common/anytoany/list_anytoany.jsp"> 299 372 <jsp:param name="ID" value="<%=ID%>" />
Note: See TracChangeset
for help on using the changeset viewer.