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/view_filetype.jsp

    r6605 r7311  
    3434  import="net.sf.basedb.core.PlatformVariant"
    3535  import="net.sf.basedb.core.PlatformFileType"
     36  import="net.sf.basedb.core.ItemSubtypeFileType"
     37  import="net.sf.basedb.core.ItemSubtype"
    3638  import="net.sf.basedb.core.Include"
    3739  import="net.sf.basedb.core.ItemQuery"
     
    296298        %>
    297299      </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>
    298371      <jsp:include page="../../common/anytoany/list_anytoany.jsp">
    299372        <jsp:param name="ID" value="<%=ID%>" />
Note: See TracChangeset for help on using the changeset viewer.