Changeset 6703


Ignore:
Timestamp:
Feb 2, 2015, 10:52:20 AM (8 years ago)
Author:
Nicklas Nordborg
Message:

References #1912: Add more filter rows in list pages

Implemented on files, file servers, permission templates, projects, messages, jobs and session list pages.

Location:
trunk/www
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/filemanager/files/list_files.jsp

    r6610 r6703  
    4747  import="net.sf.basedb.core.Quantity"
    4848  import="net.sf.basedb.core.Unit"
     49  import="net.sf.basedb.core.query.Restriction"
    4950  import="net.sf.basedb.core.query.Restrictions"
    5051  import="net.sf.basedb.core.query.Expressions"
     
    7273  import="java.util.Iterator"
    7374  import="java.util.Map"
     75  import="java.util.List"
     76  import="java.util.ArrayList"
    7477  import="java.util.Date"
    7578%>
     
    130133  }
    131134  boolean hasDirFilter = false;
    132   // Add 'name', 'description' and other common filters to directory query
    133   PropertyFilter filter = cc.getPropertyFilter("name");
    134   if (filter != null)
     135  List<Restriction> allDirRestrictions = new ArrayList<Restriction>();
     136  for (int filterRow = 0; filterRow < cc.getFilterRows(); filterRow++)
    135137  {
    136     directoryQuery.restrict(filter.getRestriction(dc, directoryQuery));
    137     hasDirFilter = true;
     138    List<Restriction> rowFilter = new ArrayList<Restriction>();
     139    // Add 'name', 'description' and other common filters to directory query
     140    PropertyFilter filter = cc.getPropertyFilter("name", filterRow);
     141    if (filter != null)
     142    {
     143      rowFilter.add(filter.getRestriction(dc, directoryQuery));
     144    }
     145    filter = cc.getPropertyFilter("description", filterRow);
     146    if (filter != null)
     147    {
     148      rowFilter.add(filter.getRestriction(dc, directoryQuery));
     149    }
     150    filter = cc.getPropertyFilter("compressed", filterRow);
     151    if (filter != null)
     152    {
     153      rowFilter.add(Restrictions.eq(Hql.property("autoCompress"), Expressions.parameter("ac"+filterRow)));
     154      directoryQuery.setParameter("ac"+filterRow, filter.getValueAsObject(), Type.BOOLEAN);
     155    }
     156    filter = cc.getPropertyFilter("!sharedTo.name", filterRow);
     157    if (filter != null)
     158    {
     159      rowFilter.add(filter.getRestriction(dc, directoryQuery));
     160    }
     161    filter = cc.getPropertyFilter("directory.name", filterRow);
     162    if (filter != null)
     163    {
     164      filter = new PropertyFilter("parent.name", filter.getOperator(), filter.getValue(), filter.getValueType());
     165      rowFilter.add(filter.getRestriction(dc, directoryQuery));
     166    }
     167    filter = cc.getPropertyFilter("owner.name", filterRow);
     168    if (filter != null)
     169    {
     170      rowFilter.add(filter.getRestriction(dc, directoryQuery));
     171    }
     172    if (rowFilter.size() > 0)
     173    {
     174      allDirRestrictions.add(Restrictions.nullSafeAnd(rowFilter));
     175    }
    138176  }
    139   filter = cc.getPropertyFilter("description");
    140   if (filter != null)
     177  if (allDirRestrictions.size() > 0)
    141178  {
    142     directoryQuery.restrict(filter.getRestriction(dc, directoryQuery));
    143     hasDirFilter = true;
    144   }
    145   filter = cc.getPropertyFilter("compressed");
    146   if (filter != null)
    147   {
    148     directoryQuery.restrict(Restrictions.eq(Hql.property("autoCompress"), Expressions.parameter("autoCompress")));
    149     directoryQuery.setParameter("autoCompress", filter.getValueAsObject(), Type.BOOLEAN);
    150     hasDirFilter = true;
    151   }
    152   filter = cc.getPropertyFilter("!sharedTo.name");
    153   if (filter != null)
    154   {
    155     directoryQuery.restrict(filter.getRestriction(dc, directoryQuery));
    156     hasDirFilter = true;
    157   }
    158   filter = cc.getPropertyFilter("directory.name");
    159   if (filter != null)
    160   {
    161     filter = new PropertyFilter("parent.name", filter.getOperator(), filter.getValue(), filter.getValueType());
    162     directoryQuery.restrict(filter.getRestriction(dc, directoryQuery));
    163     hasDirFilter = true;
    164   }
    165   filter = cc.getPropertyFilter("owner.name");
    166   if (filter != null)
    167   {
    168     directoryQuery.restrict(filter.getRestriction(dc, directoryQuery));
     179    directoryQuery.restrict(Restrictions.nullSafeOr(allDirRestrictions));
    169180    hasDirFilter = true;
    170181  }
     
    301312      item="<%=itemType%>"
    302313      subcontext="<%=subcontext%>"
     314      filterrows="<%=cc.getFilterRows()%>"
    303315      subclass="fulltable"
    304316      >
     
    658670            <tbl:columnheaders />
    659671          </tbl:headerrow>
    660           <tbl:headerrow>
    661             <tbl:header subclass="index" />
    662             <tbl:header
    663               subclass="check"
    664               visible="<%=mode.hasCheck()%>"
    665               ><base:icon
    666                 id="check.uncheck"
    667                 image="check_uncheck.png"
    668                 tooltip="Check/uncheck all"
    669                  
    670               /></tbl:header>
    671             <tbl:header
    672               subclass="check"
    673               visible="<%=mode.hasRadio()%>"
    674               />
    675             <tbl:header
    676               subclass="icons"
    677               visible="<%=mode.hasIcons()%>"
    678               />
    679             <tbl:propertyfilter />
    680           </tbl:headerrow>
     672          <%
     673          int numFilters = cc.getNumPropertyFilters();
     674          int numRows = cc.getFilterRows();
     675          for (int filterNo = 0; filterNo < numRows; filterNo++)
     676          {
     677            boolean lastRow = filterNo == numRows-1;
     678            %>
     679            <tbl:headerrow>
     680              <tbl:header subclass="index" />
     681              <tbl:header
     682                subclass="check"
     683                visible="<%=mode.hasCheck()%>"
     684                ><base:icon
     685                  id="check.uncheck"
     686                  image="check_uncheck.png"
     687                  tooltip="Check/uncheck all"
     688                  visible="<%=lastRow%>"
     689                /></tbl:header>
     690              <tbl:header
     691                subclass="check"
     692                visible="<%=mode.hasRadio()%>"
     693                />
     694              <tbl:header
     695                subclass="icons"
     696                visible="<%=mode.hasIcons()%>"
     697                >
     698                <base:icon
     699                  subclass="link table-filter-row-action"
     700                  image="add.png"
     701                  tooltip="Add extra filter row"
     702                  visible="<%=lastRow%>"
     703                /><base:icon
     704                  subclass="link table-filter-row-action"
     705                  image="remove.png"
     706                  tooltip="Remove this filter row"
     707                  visible="<%=numRows > 1 || numFilters > 0 %>"
     708                  data-remove-row="<%=filterNo%>"
     709                />
     710              </tbl:header>
     711              <tbl:propertyfilter row="<%=filterNo%>" />
     712            </tbl:headerrow>
     713            <%
     714          }
     715          %>
    681716        </tbl:headers>
    682717        <tbl:rows>
  • trunk/www/filemanager/fileservers/list_fileservers.jsp

    r6604 r6703  
    112112      sc="<%=sc%>"
    113113      item="<%=itemType%>"
     114      filterrows="<%=cc.getFilterRows()%>"
    114115      subclass="fulltable"
    115116      >
     
    316317            <tbl:columnheaders />
    317318          </tbl:headerrow>
    318           <tbl:headerrow>
    319             <tbl:header subclass="index" />
    320             <tbl:header
    321               subclass="check"
    322               visible="<%=mode.hasCheck()%>"
    323               ><base:icon
    324                 id="check.uncheck"
    325                 image="check_uncheck.png"
    326                 tooltip="Check/uncheck all"
    327                  
    328               /></tbl:header>
    329             <tbl:header
    330               subclass="check"
    331               visible="<%=mode.hasRadio()%>"
    332               />
    333             <tbl:header
    334               subclass="icons"
    335               visible="<%=mode.hasIcons()%>"
    336               />
    337             <tbl:propertyfilter />
    338           </tbl:headerrow>
     319          <%
     320          int numFilters = cc.getNumPropertyFilters();
     321          int numRows = cc.getFilterRows();
     322          for (int filterNo = 0; filterNo < numRows; filterNo++)
     323          {
     324            boolean lastRow = filterNo == numRows-1;
     325            %>
     326            <tbl:headerrow>
     327              <tbl:header subclass="index" />
     328              <tbl:header
     329                subclass="check"
     330                visible="<%=mode.hasCheck()%>"
     331                ><base:icon
     332                  id="check.uncheck"
     333                  image="check_uncheck.png"
     334                  tooltip="Check/uncheck all"
     335                  visible="<%=lastRow%>"
     336                /></tbl:header>
     337              <tbl:header
     338                subclass="check"
     339                visible="<%=mode.hasRadio()%>"
     340                />
     341              <tbl:header
     342                subclass="icons"
     343                visible="<%=mode.hasIcons()%>"
     344                >
     345                <base:icon
     346                  subclass="link table-filter-row-action"
     347                  image="add.png"
     348                  tooltip="Add extra filter row"
     349                  visible="<%=lastRow%>"
     350                /><base:icon
     351                  subclass="link table-filter-row-action"
     352                  image="remove.png"
     353                  tooltip="Remove this filter row"
     354                  visible="<%=numRows > 1 || numFilters > 0 %>"
     355                  data-remove-row="<%=filterNo%>"
     356                />
     357              </tbl:header>
     358              <tbl:propertyfilter row="<%=filterNo%>" />
     359            </tbl:headerrow>
     360            <%
     361          }
     362          %>
    339363        </tbl:headers>
    340364        <tbl:rows>
  • trunk/www/my_base/messages/list_messages.jsp

    r6604 r6703  
    116116      sc="<%=sc%>"
    117117      item="<%=itemType%>"
     118      filterrows="<%=cc.getFilterRows()%>"
    118119      subclass="fulltable"
    119120      >
     
    265266            <tbl:columnheaders />
    266267          </tbl:headerrow>
    267           <tbl:headerrow>
    268             <tbl:header subclass="index" />
    269             <tbl:header
    270               subclass="check"
    271               visible="<%=mode.hasCheck()%>"
    272               ><base:icon
    273                 id="check.uncheck"
    274                 image="check_uncheck.png"
    275                 tooltip="Check/uncheck all"
    276                  
    277               /></tbl:header>
    278             <tbl:header
    279               subclass="check"
    280               visible="<%=mode.hasRadio()%>"
    281               />
    282             <tbl:header
    283               subclass="icons"
    284               visible="<%=mode.hasIcons()%>"
    285               />
    286             <tbl:propertyfilter />
    287           </tbl:headerrow>
     268          <%
     269          int numFilters = cc.getNumPropertyFilters();
     270          int numRows = cc.getFilterRows();
     271          for (int filterNo = 0; filterNo < numRows; filterNo++)
     272          {
     273            boolean lastRow = filterNo == numRows-1;
     274            %>
     275            <tbl:headerrow>
     276              <tbl:header subclass="index" />
     277              <tbl:header
     278                subclass="check"
     279                visible="<%=mode.hasCheck()%>"
     280                ><base:icon
     281                  id="check.uncheck"
     282                  image="check_uncheck.png"
     283                  tooltip="Check/uncheck all"
     284                  visible="<%=lastRow%>"
     285                /></tbl:header>
     286              <tbl:header
     287                subclass="check"
     288                visible="<%=mode.hasRadio()%>"
     289                />
     290              <tbl:header
     291                subclass="icons"
     292                visible="<%=mode.hasIcons()%>"
     293                >
     294                <base:icon
     295                  subclass="link table-filter-row-action"
     296                  image="add.png"
     297                  tooltip="Add extra filter row"
     298                  visible="<%=lastRow%>"
     299                /><base:icon
     300                  subclass="link table-filter-row-action"
     301                  image="remove.png"
     302                  tooltip="Remove this filter row"
     303                  visible="<%=numRows > 1 || numFilters > 0 %>"
     304                  data-remove-row="<%=filterNo%>"
     305                />
     306              </tbl:header>
     307              <tbl:propertyfilter row="<%=filterNo%>" />
     308            </tbl:headerrow>
     309            <%
     310          }
     311          %>
    288312        </tbl:headers>
    289313        <tbl:rows>
  • trunk/www/my_base/projects/list_projects.jsp

    r6604 r6703  
    112112      sc="<%=sc%>"
    113113      item="<%=itemType%>"
     114      filterrows="<%=cc.getFilterRows()%>"
    114115      subclass="fulltable"
    115116      >
     
    273274            <tbl:columnheaders />
    274275          </tbl:headerrow>
    275           <tbl:headerrow>
    276             <tbl:header subclass="index" />
    277             <tbl:header
    278               subclass="check"
    279               visible="<%=mode.hasCheck()%>"
    280               ><base:icon
    281                 id="check.uncheck"
    282                 image="check_uncheck.png"
    283                 tooltip="Check/uncheck all"
    284                  
    285               /></tbl:header>
    286             <tbl:header
    287               subclass="check"
    288               visible="<%=mode.hasRadio()%>"
    289               />
    290             <tbl:header
    291               subclass="icons"
    292               visible="<%=mode.hasIcons()%>"
    293               />
    294             <tbl:propertyfilter />
    295           </tbl:headerrow>
     276          <%
     277          int numFilters = cc.getNumPropertyFilters();
     278          int numRows = cc.getFilterRows();
     279          for (int filterNo = 0; filterNo < numRows; filterNo++)
     280          {
     281            boolean lastRow = filterNo == numRows-1;
     282            %>
     283            <tbl:headerrow>
     284              <tbl:header subclass="index" />
     285              <tbl:header
     286                subclass="check"
     287                visible="<%=mode.hasCheck()%>"
     288                ><base:icon
     289                  id="check.uncheck"
     290                  image="check_uncheck.png"
     291                  tooltip="Check/uncheck all"
     292                  visible="<%=lastRow%>"
     293                /></tbl:header>
     294              <tbl:header
     295                subclass="check"
     296                visible="<%=mode.hasRadio()%>"
     297                />
     298              <tbl:header
     299                subclass="icons"
     300                visible="<%=mode.hasIcons()%>"
     301                >
     302                <base:icon
     303                  subclass="link table-filter-row-action"
     304                  image="add.png"
     305                  tooltip="Add extra filter row"
     306                  visible="<%=lastRow%>"
     307                /><base:icon
     308                  subclass="link table-filter-row-action"
     309                  image="remove.png"
     310                  tooltip="Remove this filter row"
     311                  visible="<%=numRows > 1 || numFilters > 0 %>"
     312                  data-remove-row="<%=filterNo%>"
     313                />
     314              </tbl:header>
     315              <tbl:propertyfilter row="<%=filterNo%>" />
     316            </tbl:headerrow>
     317            <%
     318          }
     319          %>
    296320        </tbl:headers>
    297321        <tbl:rows>
  • trunk/www/views/jobs/list_jobs.jsp

    r6604 r6703  
    150150      sc="<%=sc%>"
    151151      item="<%=itemType%>"
     152      filterrows="<%=cc.getFilterRows()%>"
    152153      subclass="fulltable"
    153154      >
     
    481482            <tbl:columnheaders />
    482483          </tbl:headerrow>
    483           <tbl:headerrow>
    484             <tbl:header subclass="index" />
    485             <tbl:header
    486               subclass="check"
    487               visible="<%=mode.hasCheck()%>"
    488               ><base:icon
    489                 id="check.uncheck"
    490                 image="check_uncheck.png"
    491                 tooltip="Check/uncheck all"
    492                  
    493               /></tbl:header>
    494             <tbl:header
    495               subclass="check"
    496               visible="<%=mode.hasRadio()%>"
    497               />
    498             <tbl:header
    499               subclass="icons"
    500               visible="<%=mode.hasIcons()%>"
    501               />
    502             <tbl:propertyfilter />
    503           </tbl:headerrow>
     484          <%
     485          int numFilters = cc.getNumPropertyFilters();
     486          int numRows = cc.getFilterRows();
     487          for (int filterNo = 0; filterNo < numRows; filterNo++)
     488          {
     489            boolean lastRow = filterNo == numRows-1;
     490            %>
     491            <tbl:headerrow>
     492              <tbl:header subclass="index" />
     493              <tbl:header
     494                subclass="check"
     495                visible="<%=mode.hasCheck()%>"
     496                ><base:icon
     497                  id="check.uncheck"
     498                  image="check_uncheck.png"
     499                  tooltip="Check/uncheck all"
     500                  visible="<%=lastRow%>"
     501                /></tbl:header>
     502              <tbl:header
     503                subclass="check"
     504                visible="<%=mode.hasRadio()%>"
     505                />
     506              <tbl:header
     507                subclass="icons"
     508                visible="<%=mode.hasIcons()%>"
     509                >
     510                <base:icon
     511                  subclass="link table-filter-row-action"
     512                  image="add.png"
     513                  tooltip="Add extra filter row"
     514                  visible="<%=lastRow%>"
     515                /><base:icon
     516                  subclass="link table-filter-row-action"
     517                  image="remove.png"
     518                  tooltip="Remove this filter row"
     519                  visible="<%=numRows > 1 || numFilters > 0 %>"
     520                  data-remove-row="<%=filterNo%>"
     521                />
     522              </tbl:header>
     523              <tbl:propertyfilter row="<%=filterNo%>" />
     524            </tbl:headerrow>
     525            <%
     526          }
     527          %>
    504528        </tbl:headers>
    505529        <tbl:rows>
  • trunk/www/views/permissiontemplates/list_templates.jsp

    r6604 r6703  
    110110      sc="<%=sc%>"
    111111      item="<%=itemType%>"
     112      filterrows="<%=cc.getFilterRows()%>"
    112113      subclass="fulltable"
    113114      >
     
    260261            <tbl:columnheaders />
    261262          </tbl:headerrow>
    262           <tbl:headerrow>
    263             <tbl:header subclass="index" />
    264             <tbl:header
    265               subclass="check"
    266               visible="<%=mode.hasCheck()%>"
    267               ><base:icon
    268                 id="check.uncheck"
    269                 image="check_uncheck.png"
    270                 tooltip="Check/uncheck all"
    271                  
    272               /></tbl:header>
    273             <tbl:header
    274               subclass="check"
    275               visible="<%=mode.hasRadio()%>"
    276               />
    277             <tbl:header
    278               subclass="icons"
    279               visible="<%=mode.hasIcons()%>"
    280               />
    281             <tbl:propertyfilter />
    282           </tbl:headerrow>
     263          <%
     264          int numFilters = cc.getNumPropertyFilters();
     265          int numRows = cc.getFilterRows();
     266          for (int filterNo = 0; filterNo < numRows; filterNo++)
     267          {
     268            boolean lastRow = filterNo == numRows-1;
     269            %>
     270            <tbl:headerrow>
     271              <tbl:header subclass="index" />
     272              <tbl:header
     273                subclass="check"
     274                visible="<%=mode.hasCheck()%>"
     275                ><base:icon
     276                  id="check.uncheck"
     277                  image="check_uncheck.png"
     278                  tooltip="Check/uncheck all"
     279                  visible="<%=lastRow%>"
     280                /></tbl:header>
     281              <tbl:header
     282                subclass="check"
     283                visible="<%=mode.hasRadio()%>"
     284                />
     285              <tbl:header
     286                subclass="icons"
     287                visible="<%=mode.hasIcons()%>"
     288                >
     289                <base:icon
     290                  subclass="link table-filter-row-action"
     291                  image="add.png"
     292                  tooltip="Add extra filter row"
     293                  visible="<%=lastRow%>"
     294                /><base:icon
     295                  subclass="link table-filter-row-action"
     296                  image="remove.png"
     297                  tooltip="Remove this filter row"
     298                  visible="<%=numRows > 1 || numFilters > 0 %>"
     299                  data-remove-row="<%=filterNo%>"
     300                />
     301              </tbl:header>
     302              <tbl:propertyfilter row="<%=filterNo%>" />
     303            </tbl:headerrow>
     304            <%
     305          }
     306          %>
    283307        </tbl:headers>
    284308        <tbl:rows>
  • trunk/www/views/sessions/list_sessions.jsp

    r6604 r6703  
    117117      sc="<%=sc%>"
    118118      item="<%=itemType%>"
     119      filterrows="<%=cc.getFilterRows()%>"
    119120      subclass="fulltable"
    120121      >
     
    258259            <tbl:columnheaders />
    259260          </tbl:headerrow>
    260           <tbl:headerrow>
    261             <tbl:header subclass="index" />
    262             <tbl:header
    263               subclass="check"
    264               visible="<%=mode.hasCheck()%>"
    265               ><base:icon
    266                 id="check.uncheck"
    267                 image="check_uncheck.png"
    268                 tooltip="Check/uncheck all"
    269                  
    270               /></tbl:header>
    271             <tbl:header
    272               subclass="check"
    273               visible="<%=mode.hasRadio()%>"
    274               />
    275             <tbl:header
    276               subclass="icons"
    277               visible="<%=mode.hasIcons()%>"
    278               />
    279             <tbl:propertyfilter />
    280           </tbl:headerrow>
     261          <%
     262          int numFilters = cc.getNumPropertyFilters();
     263          int numRows = cc.getFilterRows();
     264          for (int filterNo = 0; filterNo < numRows; filterNo++)
     265          {
     266            boolean lastRow = filterNo == numRows-1;
     267            %>
     268            <tbl:headerrow>
     269              <tbl:header subclass="index" />
     270              <tbl:header
     271                subclass="check"
     272                visible="<%=mode.hasCheck()%>"
     273                ><base:icon
     274                  id="check.uncheck"
     275                  image="check_uncheck.png"
     276                  tooltip="Check/uncheck all"
     277                  visible="<%=lastRow%>"
     278                /></tbl:header>
     279              <tbl:header
     280                subclass="check"
     281                visible="<%=mode.hasRadio()%>"
     282                />
     283              <tbl:header
     284                subclass="icons"
     285                visible="<%=mode.hasIcons()%>"
     286                >
     287                <base:icon
     288                  subclass="link table-filter-row-action"
     289                  image="add.png"
     290                  tooltip="Add extra filter row"
     291                  visible="<%=lastRow%>"
     292                /><base:icon
     293                  subclass="link table-filter-row-action"
     294                  image="remove.png"
     295                  tooltip="Remove this filter row"
     296                  visible="<%=numRows > 1 || numFilters > 0 %>"
     297                  data-remove-row="<%=filterNo%>"
     298                />
     299              </tbl:header>
     300              <tbl:propertyfilter row="<%=filterNo%>" />
     301            </tbl:headerrow>
     302            <%
     303          }
     304          %>
    281305        </tbl:headers>
    282306        <tbl:rows>
Note: See TracChangeset for help on using the changeset viewer.