Ignore:
Timestamp:
Mar 21, 2017, 9:09:35 AM (6 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #2066: Display item subtypes that are referencing a data file type

Also added a column in the list page.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/admin/datafiletypes/list_filetypes.jsp

    r7269 r7311  
    3333  import="net.sf.basedb.core.PlatformVariant"
    3434  import="net.sf.basedb.core.PlatformFileType"
     35  import="net.sf.basedb.core.ItemSubtypeFileType"
    3536  import="net.sf.basedb.core.ItemQuery"
    3637  import="net.sf.basedb.core.Include"
     
    101102  platformQuery.restrict(Restrictions.eq(Hql.property("dataFileType"), Expressions.parameter("fileType")));
    102103  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")));
    103110 
    104111  // Get all file types
     
    221228        title="Platforms"
    222229        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)"
    223237        datatype="string"
    224238        filterable="true"
     
    466480                  %>
    467481                </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>
    468511                <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
    469512                <tbl:xt-cells dc="<%=dc%>" item="<%=item%>">
Note: See TracChangeset for help on using the changeset viewer.