www/my_base/projects/items/list_items.jsp

Code
Comments
Other
Rev Date Author Line
2218 05 May 06 nicklas 1 <%-- $Id$
2218 05 May 06 nicklas 2   ------------------------------------------------------------------
5425 23 Sep 10 nicklas 3   Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
3675 16 Aug 07 jari 4   Copyright (C) 2007 Johan Enell, Martin Svensson
2218 05 May 06 nicklas 5
2304 22 May 06 jari 6   This file is part of BASE - BioArray Software Environment.
2304 22 May 06 jari 7   Available at http://base.thep.lu.se/
2218 05 May 06 nicklas 8
2218 05 May 06 nicklas 9   BASE is free software; you can redistribute it and/or
2218 05 May 06 nicklas 10   modify it under the terms of the GNU General Public License
4476 05 Sep 08 jari 11   as published by the Free Software Foundation; either version 3
2218 05 May 06 nicklas 12   of the License, or (at your option) any later version.
2218 05 May 06 nicklas 13
2218 05 May 06 nicklas 14   BASE is distributed in the hope that it will be useful,
2218 05 May 06 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
2218 05 May 06 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2218 05 May 06 nicklas 17   GNU General Public License for more details.
2218 05 May 06 nicklas 18
2218 05 May 06 nicklas 19   You should have received a copy of the GNU General Public License
4511 11 Sep 08 jari 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
2218 05 May 06 nicklas 21   ------------------------------------------------------------------
2218 05 May 06 nicklas 22
2218 05 May 06 nicklas 23   @author Nicklas
2218 05 May 06 nicklas 24   @version 2.0
2218 05 May 06 nicklas 25 --%>
5426 24 Sep 10 nicklas 26 <%@ page pageEncoding="UTF-8" session="false"
2218 05 May 06 nicklas 27   import="net.sf.basedb.core.SessionControl"
2218 05 May 06 nicklas 28   import="net.sf.basedb.core.DbControl"
2218 05 May 06 nicklas 29   import="net.sf.basedb.core.Trashcan"
2218 05 May 06 nicklas 30   import="net.sf.basedb.core.Item"
2218 05 May 06 nicklas 31   import="net.sf.basedb.core.ItemContext"
2218 05 May 06 nicklas 32   import="net.sf.basedb.core.Permission"
2218 05 May 06 nicklas 33   import="net.sf.basedb.core.Project"
2218 05 May 06 nicklas 34   import="net.sf.basedb.core.BasicItem"
2218 05 May 06 nicklas 35   import="net.sf.basedb.core.Shareable"
3552 06 Jul 07 martin 36   import="net.sf.basedb.core.SharedItem"
2218 05 May 06 nicklas 37   import="net.sf.basedb.core.Nameable"
2218 05 May 06 nicklas 38   import="net.sf.basedb.core.Removable"
2218 05 May 06 nicklas 39   import="net.sf.basedb.core.File"
2218 05 May 06 nicklas 40   import="net.sf.basedb.core.Directory"
2218 05 May 06 nicklas 41   import="net.sf.basedb.core.Metadata"
7034 04 Dec 15 nicklas 42   import="net.sf.basedb.core.Subtypable"
5167 28 Oct 09 nicklas 43   import="net.sf.basedb.core.PropertyFilter"
2218 05 May 06 nicklas 44   import="net.sf.basedb.core.query.ResultList"
5167 28 Oct 09 nicklas 45   import="net.sf.basedb.core.query.Restriction"
5168 29 Oct 09 nicklas 46   import="net.sf.basedb.core.query.Restrictions"
7032 03 Dec 15 nicklas 47   import="net.sf.basedb.core.query.ReturnClassFilter"
2218 05 May 06 nicklas 48   import="net.sf.basedb.util.Enumeration"
3552 06 Jul 07 martin 49   import="net.sf.basedb.util.ShareableUtil"
2218 05 May 06 nicklas 50   import="net.sf.basedb.clients.web.Base"
3552 06 Jul 07 martin 51   import="net.sf.basedb.clients.web.ModeInfo"
2403 21 Jun 06 martin 52   import="net.sf.basedb.clients.web.PermissionUtil"
2218 05 May 06 nicklas 53   import="net.sf.basedb.clients.web.util.HTML"
2753 20 Oct 06 nicklas 54   import="net.sf.basedb.util.Values"
4887 06 Apr 09 nicklas 55   import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
4887 06 Apr 09 nicklas 56   import="net.sf.basedb.clients.web.extensions.JspContext"
4887 06 Apr 09 nicklas 57   import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
7604 25 Feb 19 nicklas 58   import="net.sf.basedb.clients.web.extensions.toolbar.ButtonAction" 
4887 06 Apr 09 nicklas 59   import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
7604 25 Feb 19 nicklas 60   import="net.sf.basedb.clients.web.extensions.list.ListColumnAction"
6040 30 Mar 12 nicklas 61   import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil"
4887 06 Apr 09 nicklas 62   import="net.sf.basedb.util.extensions.ExtensionsInvoker"
4347 18 Jun 08 nicklas 63   import="java.util.Set"
4347 18 Jun 08 nicklas 64   import="java.util.HashSet"
3552 06 Jul 07 martin 65   import="java.util.Iterator"
2218 05 May 06 nicklas 66 %>
2218 05 May 06 nicklas 67 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
2218 05 May 06 nicklas 68 <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
2218 05 May 06 nicklas 69 <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
2218 05 May 06 nicklas 70 <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
4887 06 Apr 09 nicklas 71 <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
2218 05 May 06 nicklas 72 <%!
2218 05 May 06 nicklas 73   private static final Item itemType = Item.PROJECT;
2218 05 May 06 nicklas 74   private static final String subContext = "items";
2218 05 May 06 nicklas 75
2218 05 May 06 nicklas 76   private static final Enumeration<String, String> itemTypes = new Enumeration<String, String>();
2218 05 May 06 nicklas 77   static
2218 05 May 06 nicklas 78   {
2218 05 May 06 nicklas 79     for (Item item : Metadata.getShareableItems())
2218 05 May 06 nicklas 80     {
2218 05 May 06 nicklas 81       itemTypes.add(item.name(), item.toString());
2218 05 May 06 nicklas 82     }
2218 05 May 06 nicklas 83   }
2218 05 May 06 nicklas 84 %>
2218 05 May 06 nicklas 85 <%
2218 05 May 06 nicklas 86 final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
2218 05 May 06 nicklas 87 final String ID = sc.getId();
2218 05 May 06 nicklas 88 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subContext, null, null);
2218 05 May 06 nicklas 89 final int projectId = Values.getInt(request.getParameter("project_id"));
3501 15 Jun 07 enell 90 final int activeProjectId = sc.getActiveProjectId();
7954 12 May 21 nicklas 91 final DbControl dc = sc.newDbControl(":List items in project");
3552 06 Jul 07 martin 92 final ModeInfo mode = ModeInfo.get(request.getParameter("mode"));
2218 05 May 06 nicklas 93 ResultList<Shareable> items = null;
2218 05 May 06 nicklas 94 try
2218 05 May 06 nicklas 95 {
2218 05 May 06 nicklas 96   String filterItem = cc.getPropertyValue("type");
2218 05 May 06 nicklas 97   Project project = Project.getById(dc, projectId);
2218 05 May 06 nicklas 98   try
2218 05 May 06 nicklas 99   {
4347 18 Jun 08 nicklas 100     Set<Item> itemTypes = null; 
4347 18 Jun 08 nicklas 101     if (filterItem != null)
4347 18 Jun 08 nicklas 102     {
4347 18 Jun 08 nicklas 103       itemTypes = new HashSet<Item>();
4347 18 Jun 08 nicklas 104       for (String name : filterItem.split("\\|"))
4347 18 Jun 08 nicklas 105       {
4347 18 Jun 08 nicklas 106         itemTypes.add(Item.valueOf(name));
4347 18 Jun 08 nicklas 107       }
4347 18 Jun 08 nicklas 108     }
7034 04 Dec 15 nicklas 109     
7032 03 Dec 15 nicklas 110     Restriction id = cc.getFilterRestriction("id", dc, null);
5168 29 Oct 09 nicklas 111     Restriction sharedTo = cc.getFilterRestriction("!sharedTo.name", dc, null);
5168 29 Oct 09 nicklas 112     Restriction owner = cc.getFilterRestriction("owner.name", dc, null);
7032 03 Dec 15 nicklas 113     Restriction name = Restrictions.conditionalRestriction(new ReturnClassFilter(Nameable.class),
7034 04 Dec 15 nicklas 114       cc.getFilterRestriction("name", dc, null), null, true);
7032 03 Dec 15 nicklas 115     Restriction description = Restrictions.conditionalRestriction(new ReturnClassFilter(Nameable.class),
7034 04 Dec 15 nicklas 116       cc.getFilterRestriction("description", dc, null), null, true);
7034 04 Dec 15 nicklas 117     Restriction subtype = Restrictions.conditionalRestriction(new ReturnClassFilter(Subtypable.class),
7034 04 Dec 15 nicklas 118       cc.getFilterRestriction("itemSubtype.name", dc, null), null, true);
7034 04 Dec 15 nicklas 119     
7034 04 Dec 15 nicklas 120     Restriction restriction = Restrictions.nullSafeAnd(sharedTo, owner, name, description, subtype, id);
4347 18 Jun 08 nicklas 121     items = project.getItems(itemTypes, 
3501 15 Jun 07 enell 122       cc.getPage() * cc.getRowsPerPage(), cc.getRowsPerPage(), cc.getItemPermission(),
5168 29 Oct 09 nicklas 123       cc.getInclude(), restriction);
2218 05 May 06 nicklas 124   }
2218 05 May 06 nicklas 125   catch (Throwable t)
2218 05 May 06 nicklas 126   {
2218 05 May 06 nicklas 127     cc.setMessage(t.getMessage());
2218 05 May 06 nicklas 128   }
2218 05 May 06 nicklas 129   int numListed = 0;
4887 06 Apr 09 nicklas 130   JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, null, project);
7605 26 Feb 19 nicklas 131   ExtensionsInvoker<ButtonAction> invoker = ExtensionsControl.useExtensions(jspContext,  
4887 06 Apr 09 nicklas 132       "net.sf.basedb.clients.web.toolbar.list.all", 
4887 06 Apr 09 nicklas 133       "net.sf.basedb.clients.web.toolbar.list.projectitems");
7605 26 Feb 19 nicklas 134   ExtensionsInvoker<ListColumnAction<BasicItem, ?>> columnsInvoker = ExtensionsControl.useExtensions(jspContext, 
6040 30 Mar 12 nicklas 135       "net.sf.basedb.clients.web.listcolumn.projectitems");
2218 05 May 06 nicklas 136   %>
6307 15 Aug 13 nicklas 137   <base:page id="list-page">
6307 15 Aug 13 nicklas 138   <base:head scripts="table.js,tabcontrol-2.js,~items.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">
4887 06 Apr 09 nicklas 139     <ext:scripts context="<%=jspContext%>" />
4887 06 Apr 09 nicklas 140     <ext:stylesheets context="<%=jspContext%>" />
2218 05 May 06 nicklas 141   </base:head>
2218 05 May 06 nicklas 142   
2218 05 May 06 nicklas 143   <base:body>
5952 10 Feb 12 nicklas 144     <p:path><p:pathelement 
5952 10 Feb 12 nicklas 145       title="Projects" href="<%="../index.jsp?ID="+ID%>" 
5952 10 Feb 12 nicklas 146       /><p:pathelement title="<%=HTML.encodeTags(project.getName())%>" 
5952 10 Feb 12 nicklas 147       /></p:path>
6307 15 Aug 13 nicklas 148     <div id="page-data" data-project-id="<%=projectId%>"></div>
2218 05 May 06 nicklas 149
5952 10 Feb 12 nicklas 150     <t:tabcontrol 
5952 10 Feb 12 nicklas 151       id="main" 
5952 10 Feb 12 nicklas 152       subclass="mastertabcontrol content"
6307 15 Aug 13 nicklas 153       active="items">
2218 05 May 06 nicklas 154     <t:tab id="properties" title="Properties" />
2218 05 May 06 nicklas 155     
2218 05 May 06 nicklas 156     <t:tab id="items" title="Items">
2218 05 May 06 nicklas 157     <tbl:table 
2218 05 May 06 nicklas 158       id="items" 
2218 05 May 06 nicklas 159       columns="<%=cc.getSetting("columns")%>"
2218 05 May 06 nicklas 160       action="index.jsp"
2218 05 May 06 nicklas 161       sc="<%=sc%>"
2218 05 May 06 nicklas 162       item="<%=itemType%>"
2218 05 May 06 nicklas 163       subcontext="<%=subContext%>"
5952 10 Feb 12 nicklas 164       subclass="fulltable"
7851 14 Oct 20 nicklas 165       data-no-linkeditem-columns="1"
7982 14 Jun 21 nicklas 166       stickyheaders="<%=cc.getSetting("columns.sticky", "name")%>"
2218 05 May 06 nicklas 167       >
2218 05 May 06 nicklas 168       <tbl:hidden
2218 05 May 06 nicklas 169         name="project_id"
2218 05 May 06 nicklas 170         value="<%=Integer.toString(projectId)%>"
2218 05 May 06 nicklas 171       />
2218 05 May 06 nicklas 172       <tbl:columndef
2218 05 May 06 nicklas 173         id="type"
2218 05 May 06 nicklas 174         property="type"
2218 05 May 06 nicklas 175         datatype="string"
2218 05 May 06 nicklas 176         title="Item type"
2218 05 May 06 nicklas 177         enumeration="<%=itemTypes%>"
2218 05 May 06 nicklas 178         filterable="true"
2218 05 May 06 nicklas 179         show="always"
2218 05 May 06 nicklas 180       />
2218 05 May 06 nicklas 181       <tbl:columndef 
2218 05 May 06 nicklas 182         id="name"
2218 05 May 06 nicklas 183         title="Name"
2218 05 May 06 nicklas 184         show="always" 
5168 29 Oct 09 nicklas 185         filterable="true"
5168 29 Oct 09 nicklas 186         filterproperty="name"
5168 29 Oct 09 nicklas 187         datatype="string"
2218 05 May 06 nicklas 188       />
7034 04 Dec 15 nicklas 189       <tbl:columndef
7034 04 Dec 15 nicklas 190         id="itemSubtype"
7034 04 Dec 15 nicklas 191         property="itemSubtype.name"
7034 04 Dec 15 nicklas 192         datatype="string"
7034 04 Dec 15 nicklas 193         title="Subtype"
7034 04 Dec 15 nicklas 194         filterable="true"
7034 04 Dec 15 nicklas 195       />
2218 05 May 06 nicklas 196       <tbl:columndef 
4332 12 Jun 08 martin 197         id="id"
4332 12 Jun 08 martin 198         property="id"
4332 12 Jun 08 martin 199         datatype="int"
4332 12 Jun 08 martin 200         title="ID"
4332 12 Jun 08 martin 201         filterable="true"
4332 12 Jun 08 martin 202       />
4332 12 Jun 08 martin 203       <tbl:columndef 
2218 05 May 06 nicklas 204         id="owner"
2218 05 May 06 nicklas 205         title="Owner"
5168 29 Oct 09 nicklas 206         property="owner.name"
5168 29 Oct 09 nicklas 207         datatype="string"
5168 29 Oct 09 nicklas 208         filterable="true"
2218 05 May 06 nicklas 209       />
2218 05 May 06 nicklas 210       <tbl:columndef 
2218 05 May 06 nicklas 211         id="description"
2218 05 May 06 nicklas 212         title="Description"
5168 29 Oct 09 nicklas 213         property="description"
5168 29 Oct 09 nicklas 214         filterable="true"
5168 29 Oct 09 nicklas 215         datatype="string"
2218 05 May 06 nicklas 216       />
2403 21 Jun 06 martin 217       <tbl:columndef
2403 21 Jun 06 martin 218         id="permission"
2403 21 Jun 06 martin 219         title="Permission"
2403 21 Jun 06 martin 220       />
5167 28 Oct 09 nicklas 221       <tbl:columndef
3552 06 Jul 07 martin 222         id="sharedTo"
3552 06 Jul 07 martin 223         title="Shared to"
5167 28 Oct 09 nicklas 224         filterable="true"
5167 28 Oct 09 nicklas 225         filterproperty="!sharedTo.name"
5167 28 Oct 09 nicklas 226         datatype="string"
3552 06 Jul 07 martin 227       />
6040 30 Mar 12 nicklas 228       <tbl:columndef 
6040 30 Mar 12 nicklas 229         id="xt-columns" 
6040 30 Mar 12 nicklas 230         extensions="<%=columnsInvoker%>" 
6040 30 Mar 12 nicklas 231         jspcontext="<%=jspContext%>" 
6040 30 Mar 12 nicklas 232       />
6604 18 Nov 14 nicklas 233       <div class="panelgroup bg-filled-50 bottomborder">
7034 04 Dec 15 nicklas 234         <tbl:toolbar subclass="bottomborder">
5952 10 Feb 12 nicklas 235           <tbl:button 
6307 15 Aug 13 nicklas 236             id="btnDeleteItems"
5952 10 Feb 12 nicklas 237             image="delete.png"
5952 10 Feb 12 nicklas 238             title="Delete" 
5952 10 Feb 12 nicklas 239             tooltip="Delete the selected items" 
5952 10 Feb 12 nicklas 240           />
5952 10 Feb 12 nicklas 241           <tbl:button 
6307 15 Aug 13 nicklas 242             id="btnRestoreItems"
5952 10 Feb 12 nicklas 243             image="restore.png"
5952 10 Feb 12 nicklas 244             title="Restore" 
5952 10 Feb 12 nicklas 245             tooltip="Restore the selected items"
5952 10 Feb 12 nicklas 246           />
5952 10 Feb 12 nicklas 247           <tbl:button 
6307 15 Aug 13 nicklas 248             id="btnShareItems"
5952 10 Feb 12 nicklas 249             image="share.png"
5952 10 Feb 12 nicklas 250             title="Share&hellip;" 
5952 10 Feb 12 nicklas 251             tooltip="Share the selected items"
5952 10 Feb 12 nicklas 252           />
5952 10 Feb 12 nicklas 253           <tbl:button 
6307 15 Aug 13 nicklas 254             id="btnSetOwner"
5952 10 Feb 12 nicklas 255             image="take_ownership.png"
5952 10 Feb 12 nicklas 256             title="Set owner&hellip;"
5952 10 Feb 12 nicklas 257             tooltip="Change owner of the selected items"
5952 10 Feb 12 nicklas 258           />
5952 10 Feb 12 nicklas 259           <tbl:button 
6307 15 Aug 13 nicklas 260             id="btnColumns"
5952 10 Feb 12 nicklas 261             image="columns.png" 
5952 10 Feb 12 nicklas 262             title="Columns&hellip;" 
5952 10 Feb 12 nicklas 263             tooltip="Show, hide and re-order columns" 
5952 10 Feb 12 nicklas 264           />
5952 10 Feb 12 nicklas 265           <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
7604 25 Feb 19 nicklas 266             wrapper="<%=new PrefixSuffixRenderer<ButtonAction>(jspContext, "<td>", "</td>") %>"/>
5952 10 Feb 12 nicklas 267         </tbl:toolbar>
3501 15 Jun 07 enell 268         <tbl:panel>
5952 10 Feb 12 nicklas 269           <tbl:presetselector 
5952 10 Feb 12 nicklas 270             disablesharedto="true"
5952 10 Feb 12 nicklas 271             disableothers="<%=projectId != activeProjectId%>"
5952 10 Feb 12 nicklas 272           />
5952 10 Feb 12 nicklas 273           <tbl:navigator
5952 10 Feb 12 nicklas 274             page="<%=cc.getPage()%>" 
5952 10 Feb 12 nicklas 275             rowsperpage="<%=cc.getRowsPerPage()%>" 
5952 10 Feb 12 nicklas 276             totalrows="<%=items == null ? 0 : items.getTotalCount()%>"
5952 10 Feb 12 nicklas 277           />
3501 15 Jun 07 enell 278         </tbl:panel>
5952 10 Feb 12 nicklas 279       </div>
2218 05 May 06 nicklas 280       <tbl:data>
5948 08 Feb 12 nicklas 281         <tbl:headers>
5948 08 Feb 12 nicklas 282           <tbl:headerrow>
7943 04 May 21 nicklas 283             <tbl:header clazz="row-index bg-filled-100" />
5948 08 Feb 12 nicklas 284             <tbl:columnheaders />
5948 08 Feb 12 nicklas 285           </tbl:headerrow>
5948 08 Feb 12 nicklas 286           <tbl:headerrow>
7943 04 May 21 nicklas 287             <tbl:header subclass="row-index bg-filled-100">
7943 04 May 21 nicklas 288               <div class="index-<%=mode.getName()%>">
7943 04 May 21 nicklas 289                 <div class="index"></div>
7943 04 May 21 nicklas 290                 <div class="check">
7943 04 May 21 nicklas 291                   <base:icon 
7943 04 May 21 nicklas 292                     subclass="link table-check"
7943 04 May 21 nicklas 293                     image="check_uncheck.png" 
7943 04 May 21 nicklas 294                     tooltip="Toggle all (use CTRL, ALT or SHIFT to check/uncheck)" 
7943 04 May 21 nicklas 295                   />
7943 04 May 21 nicklas 296                 </div>
7943 04 May 21 nicklas 297                 <div class="icons">
7943 04 May 21 nicklas 298                 </div>
7943 04 May 21 nicklas 299               </div>
7943 04 May 21 nicklas 300             </tbl:header>
5948 08 Feb 12 nicklas 301             <tbl:propertyfilter />
5948 08 Feb 12 nicklas 302           </tbl:headerrow>
7913 22 Feb 21 nicklas 303           <tbl:columnsubtitles />
5948 08 Feb 12 nicklas 304         </tbl:headers>
5948 08 Feb 12 nicklas 305         <tbl:rows>
2218 05 May 06 nicklas 306           <%
5952 10 Feb 12 nicklas 307           if (projectId != activeProjectId)
5952 10 Feb 12 nicklas 308           {
5952 10 Feb 12 nicklas 309             %>
6604 18 Nov 14 nicklas 310             <tbl:panel subclass="bg-filled-50">
6311 23 Aug 13 nicklas 311               <div class="messagecontainer error" style="cursor: pointer;"
5952 10 Feb 12 nicklas 312                 title="Click to make this project the active project">
5952 10 Feb 12 nicklas 313               This project is not the active project. The list can't display items 
5952 10 Feb 12 nicklas 314               that are owned by other members of the project.
5952 10 Feb 12 nicklas 315               </div>
5952 10 Feb 12 nicklas 316             </tbl:panel>
5952 10 Feb 12 nicklas 317             <%
5952 10 Feb 12 nicklas 318           }
5952 10 Feb 12 nicklas 319           if (cc.getMessage() != null)
5952 10 Feb 12 nicklas 320           {
5952 10 Feb 12 nicklas 321             %>
6604 18 Nov 14 nicklas 322             <tbl:panel subclass="bg-filled-50">
5952 10 Feb 12 nicklas 323               <div class="messagecontainer error"><%=cc.getMessage()%></div>
5952 10 Feb 12 nicklas 324             </tbl:panel>
5952 10 Feb 12 nicklas 325             <%
5952 10 Feb 12 nicklas 326             cc.setMessage(null);
5952 10 Feb 12 nicklas 327           }
2218 05 May 06 nicklas 328           int index = cc.getPage()*cc.getRowsPerPage();
2218 05 May 06 nicklas 329           if (items != null)
2218 05 May 06 nicklas 330           {
2218 05 May 06 nicklas 331             for (Shareable item : items)
2218 05 May 06 nicklas 332             {
2218 05 May 06 nicklas 333               BasicItem basicItem = (BasicItem)item;
2218 05 May 06 nicklas 334               int itemId = item.getId();
2218 05 May 06 nicklas 335               boolean removed = item instanceof Removable && ((Removable)item).isRemoved();
4003 26 Nov 07 nicklas 336               boolean deletePermission = item.hasPermission(Permission.DELETE);
2218 05 May 06 nicklas 337               String name = "";
2218 05 May 06 nicklas 338               String description = "";
2218 05 May 06 nicklas 339               if (item instanceof File)
2218 05 May 06 nicklas 340               {
2218 05 May 06 nicklas 341                 File file = (File)item;
2218 05 May 06 nicklas 342                 name = file.getPath().toString();
2218 05 May 06 nicklas 343                 description = file.getDescription();
2218 05 May 06 nicklas 344               }
2218 05 May 06 nicklas 345               else if (item instanceof Directory)
2218 05 May 06 nicklas 346               {
2218 05 May 06 nicklas 347                 Directory dir = (Directory)item;
2218 05 May 06 nicklas 348                 name = dir.getPath().toString();
2218 05 May 06 nicklas 349                 description = dir.getDescription();
2218 05 May 06 nicklas 350               }
2218 05 May 06 nicklas 351               else if (item instanceof Nameable)
2218 05 May 06 nicklas 352               {
2218 05 May 06 nicklas 353                 Nameable nameable = (Nameable)item;
2218 05 May 06 nicklas 354                 name = nameable.getName();
2218 05 May 06 nicklas 355                 description = nameable.getDescription();
2218 05 May 06 nicklas 356               }
2218 05 May 06 nicklas 357               else
2218 05 May 06 nicklas 358               {
2218 05 May 06 nicklas 359                 name = item.toString();
2218 05 May 06 nicklas 360               }
2218 05 May 06 nicklas 361               String link = Base.getLink(ID, HTML.encodeTags(name), item.getType(), itemId, true);
2218 05 May 06 nicklas 362               index++;
2218 05 May 06 nicklas 363               numListed++;
2218 05 May 06 nicklas 364               %>
2218 05 May 06 nicklas 365               <tbl:row>
7943 04 May 21 nicklas 366                 <tbl:header clazz="row-index bg-filled-100">
7943 04 May 21 nicklas 367                   <div class="index-<%=mode.getName()%>">
7943 04 May 21 nicklas 368                     <div class="index <%=index>999?"index-smaller":""%>"><%=index%></div>
7943 04 May 21 nicklas 369                     <div class="check">
7943 04 May 21 nicklas 370                       <base:input
7943 04 May 21 nicklas 371                         type="checkbox" 
7943 04 May 21 nicklas 372                         name="<%="item:"+item.getType().name()%>" 
7943 04 May 21 nicklas 373                         value="<%=itemId%>" 
7943 04 May 21 nicklas 374                         title="<%=name%>" 
7943 04 May 21 nicklas 375                       />
7943 04 May 21 nicklas 376                     </div>
7943 04 May 21 nicklas 377                     <div class="icons">
7943 04 May 21 nicklas 378                       <base:icon 
7943 04 May 21 nicklas 379                         image="deleted.png"
7943 04 May 21 nicklas 380                         id="<%="delete."+itemId %>"
7943 04 May 21 nicklas 381                         subclass="<%=deletePermission ? "table-delete-item" : "disabled" %>"
7943 04 May 21 nicklas 382                         data-item-type="<%=item.getType().name() %>"
7943 04 May 21 nicklas 383                         data-item-id="<%=itemId%>"
7943 04 May 21 nicklas 384                         tooltip="This item has been scheduled for deletion" 
7943 04 May 21 nicklas 385                         visible="<%=removed%>"
7943 04 May 21 nicklas 386                       />
7943 04 May 21 nicklas 387                     </div>
7943 04 May 21 nicklas 388                   </div>
7943 04 May 21 nicklas 389                 </tbl:header>
2218 05 May 06 nicklas 390                 <tbl:cell column="type"><%=item.getType()%></tbl:cell>
2218 05 May 06 nicklas 391                 <tbl:cell column="name"><%=link%></tbl:cell>
4332 12 Jun 08 martin 392                 <tbl:cell column="id"><%=item.getId()%></tbl:cell>
2425 26 Jun 06 nicklas 393                 <tbl:cell column="owner"><base:propertyvalue item="<%=item%>" property="owner" /></tbl:cell>
2218 05 May 06 nicklas 394                 <tbl:cell column="description"><%=HTML.encodeTags(description)%></tbl:cell>
2425 26 Jun 06 nicklas 395                 <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell>
7034 04 Dec 15 nicklas 396                 <tbl:cell column="itemSubtype"><%
7034 04 Dec 15 nicklas 397                 if (item instanceof Subtypable)
7034 04 Dec 15 nicklas 398                 {
7034 04 Dec 15 nicklas 399                   %><base:propertyvalue item="<%=item%>" property="itemSubtype" /><%
7034 04 Dec 15 nicklas 400                 }
7034 04 Dec 15 nicklas 401                 %></tbl:cell>
3552 06 Jul 07 martin 402                 <tbl:cell column="sharedTo">
3552 06 Jul 07 martin 403                   <%
3552 06 Jul 07 martin 404                   if (item instanceof SharedItem)
3552 06 Jul 07 martin 405                   {
3552 06 Jul 07 martin 406                     Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, (SharedItem)item).iterator();
3552 06 Jul 07 martin 407                     while(sharees.hasNext())
3552 06 Jul 07 martin 408                     {
3552 06 Jul 07 martin 409                       Nameable n = sharees.next();
3552 06 Jul 07 martin 410                       if (mode.hasPropertyLink())
3552 06 Jul 07 martin 411                       {
3552 06 Jul 07 martin 412                         out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink()));
3552 06 Jul 07 martin 413                       }
3552 06 Jul 07 martin 414                       else
3552 06 Jul 07 martin 415                       {
3552 06 Jul 07 martin 416                         out.write(HTML.encodeTags(n.getName()));
3552 06 Jul 07 martin 417                       }
3552 06 Jul 07 martin 418                       out.write(sharees.hasNext() ? ", " : "");
3552 06 Jul 07 martin 419                     }
3552 06 Jul 07 martin 420                   }
3552 06 Jul 07 martin 421                   %>
3552 06 Jul 07 martin 422                 </tbl:cell>
6040 30 Mar 12 nicklas 423                 <tbl:xt-cells dc="<%=dc%>" item="<%=item%>">
6040 30 Mar 12 nicklas 424                   <tbl:cell column="xt-columns" />
6040 30 Mar 12 nicklas 425                 </tbl:xt-cells>
2218 05 May 06 nicklas 426               </tbl:row>
2218 05 May 06 nicklas 427               <%
2218 05 May 06 nicklas 428               }
2218 05 May 06 nicklas 429             }
5952 10 Feb 12 nicklas 430           if (numListed == 0)
5952 10 Feb 12 nicklas 431           {
5952 10 Feb 12 nicklas 432             %>
6604 18 Nov 14 nicklas 433             <tbl:panel subclass="bg-filled-50">
5952 10 Feb 12 nicklas 434               <div class="messagecontainer note">
5952 10 Feb 12 nicklas 435               <%=items == null || items.size() == 0 ? "No items were found" : "No items on this page. Please select another page!" %>
5952 10 Feb 12 nicklas 436               </div>
5952 10 Feb 12 nicklas 437             </tbl:panel>
5952 10 Feb 12 nicklas 438             <%
5952 10 Feb 12 nicklas 439           }
2218 05 May 06 nicklas 440           %>
5952 10 Feb 12 nicklas 441         </tbl:rows>
2218 05 May 06 nicklas 442       </tbl:data>
2218 05 May 06 nicklas 443     </tbl:table>
2218 05 May 06 nicklas 444     </t:tab>
2218 05 May 06 nicklas 445     </t:tabcontrol>
2218 05 May 06 nicklas 446   </base:body>
2218 05 May 06 nicklas 447   </base:page>
2218 05 May 06 nicklas 448   <%
2218 05 May 06 nicklas 449 }
2218 05 May 06 nicklas 450 finally
2218 05 May 06 nicklas 451 {
2218 05 May 06 nicklas 452   if (dc != null) dc.close();
2218 05 May 06 nicklas 453 }
3675 16 Aug 07 jari 454 %>