Changeset 7740


Ignore:
Timestamp:
Aug 28, 2019, 2:35:37 PM (2 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #2190: Problems with the "Remember current filter for future re-sync" option when creating an item list

The option is now hidden if there is no active filter.

Location:
branches/3.15-stable/www/views/itemlists
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.15-stable/www/views/itemlists/edit_list.jsp

    r7604 r7740  
    6666  Item memberType = addItems ? Item.valueOf(request.getParameter("memberType")) : null;
    6767  String formId = addItems ? Values.getStringOrNull(request.getParameter("formId")) : null;
    68   String subContext = addItems ? Values.getStringOrNull(request.getParameter("subContext")) : null;
    69 
     68  String subContext = Values.getString(request.getParameter("subContext"), "");
     69 
     70  ItemContext filterContext = addItems && memberType != null ? sc.getCurrentContext(memberType, subContext) : null;
     71  boolean hasSourceFilter = filterContext != null && filterContext.getNumPropertyFilters() > 0;
     72 
    7073  ItemQuery<ItemSubtype> subtypesQuery = null;
    7174  boolean readCurrentSubtype = true;
     
    252255            <input type="radio" name="source" id="sourceAll" value="all" checked
    253256              ><label for="sourceAll">All pages</label><br>
    254               <input type="checkbox" name="syncFilter" id="syncFilter" value="1" checked style="margin-left:2em;"
    255                 ><label for="syncFilter">Remember current filter for future re-sync</label>
     257              <%
     258              if (hasSourceFilter)
     259              {
     260                %>
     261                <input type="checkbox" name="syncFilter" id="syncFilter" value="1" checked style="margin-left:2em;"
     262                  ><label for="syncFilter">Remember current filter for future re-sync</label>
     263                <%
     264              }
     265              %>
    256266          </td>
    257267          <td></td>
  • branches/3.15-stable/www/views/itemlists/index.jsp

    r7605 r7740  
    283283          if ("all".equals(source))
    284284          {
    285             useSyncFilter = Values.getBoolean(request.getParameter("syncFilter"));
     285            useSyncFilter = Values.getBoolean(request.getParameter("syncFilter")) && filterContext.getNumPropertyFilters() > 0;
    286286            query.setFirstResult(0);
    287287            query.setMaxResults(-1);
  • branches/3.15-stable/www/views/itemlists/lists.js

    r7604 r7740  
    265265  {
    266266    var frm = document.forms['list'];
    267     frm.syncFilter.disabled = !Doc.element('sourceAll').checked;
     267    if (frm.syncFilter) frm.syncFilter.disabled = !Doc.element('sourceAll').checked;
    268268  }
    269269 
Note: See TracChangeset for help on using the changeset viewer.