source: trunk/www/admin/annotationtypes/list_annotationtypes.jsp @ 5425

Last change on this file since 5425 was 5425, checked in by Nicklas Nordborg, 13 years ago

References #1514: Fix character encoding of jsp files

I hope this fixes most of the issues, including the reporter list filtering in many places. Let's keep an eye open for more issues until it is time to release 2.16

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 21.9 KB
Line 
1<%-- $Id: list_annotationtypes.jsp 5425 2010-09-23 13:30:07Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
4  Copyright (C) 2007 Johan Enell, Nicklas Nordborg, Martin Svensson
5
6  This file is part of BASE - BioArray Software Environment.
7  Available at http://base.thep.lu.se/
8
9  BASE is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License
11  as published by the Free Software Foundation; either version 3
12  of the License, or (at your option) any later version.
13
14  BASE is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  GNU General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with BASE. If not, see <http://www.gnu.org/licenses/>.
21  ------------------------------------------------------------------
22
23  @author Nicklas
24  @version 2.0
25--%>
26<%@ page session="false"
27  import="net.sf.basedb.core.SessionControl"
28  import="net.sf.basedb.core.DbControl"
29  import="net.sf.basedb.core.Item"
30  import="net.sf.basedb.core.AnnotationType"
31  import="net.sf.basedb.core.AnnotationTypeCategory"
32  import="net.sf.basedb.core.Quantity"
33  import="net.sf.basedb.core.ItemQuery"
34  import="net.sf.basedb.core.Include"
35  import="net.sf.basedb.core.Type"
36  import="net.sf.basedb.core.Metadata"
37  import="net.sf.basedb.core.ItemResultIterator"
38  import="net.sf.basedb.core.ItemResultList"
39  import="net.sf.basedb.core.ItemContext"
40  import="net.sf.basedb.core.Nameable"
41  import="net.sf.basedb.core.Permission"
42  import="net.sf.basedb.core.PluginDefinition"
43  import="net.sf.basedb.core.query.Restrictions"
44  import="net.sf.basedb.core.query.Expressions"
45  import="net.sf.basedb.core.query.Orders"
46  import="net.sf.basedb.core.query.Hql"
47  import="net.sf.basedb.core.plugin.GuiContext"
48  import="net.sf.basedb.core.plugin.Plugin"
49  import="net.sf.basedb.util.Enumeration"
50  import="net.sf.basedb.util.ShareableUtil"
51  import="net.sf.basedb.clients.web.Base"
52  import="net.sf.basedb.clients.web.PermissionUtil"
53  import="net.sf.basedb.clients.web.ModeInfo"
54  import="net.sf.basedb.clients.web.util.HTML"
55  import="net.sf.basedb.util.Values"
56  import="net.sf.basedb.util.formatter.Formatter"
57  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
58  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
59  import="net.sf.basedb.clients.web.extensions.JspContext"
60  import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
61  import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
62  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
63  import="java.util.Date"
64  import="java.util.Iterator"
65  import="java.util.List"
66  import="java.util.Map"
67  import="java.util.Set"
68%>
69<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
70<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
71<%@ taglib prefix="m" uri="/WEB-INF/menu.tld" %>
72<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
73<%!
74  private static final Item itemType = Item.ANNOTATIONTYPE;
75  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST);
76 
77  private static final Enumeration<String, String> items = new Enumeration<String, String>();
78  private static Enumeration<String, String> types = new Enumeration<String, String>();
79  static
80  {
81    items.add("", "- none -");
82    for (Item item : Metadata.getAnnotatableItems())
83    {
84      items.add(Integer.toString(item.getValue()), item.toString());
85    }
86    for (Type v : Type.values())
87    {
88      types.add(Integer.toString(v.getValue()), v.toString());
89    }
90  }
91%>
92<%
93final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType);
94final String ID = sc.getId();
95final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType);
96final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
97
98final ModeInfo mode = ModeInfo.get(request.getParameter("mode"));
99final String callback = request.getParameter("callback");
100final String title = mode.generateTitle("annotation type", "annotation types");
101final DbControl dc = sc.newDbControl();
102ItemResultIterator<AnnotationType> annotationTypes = null;
103try
104{
105  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
106  // Query for categories of the current annotation type
107  final ItemQuery<AnnotationTypeCategory> categoryQuery = AnnotationTypeCategory.getQuery();
108  categoryQuery.include(cc.getInclude());
109  categoryQuery.join(Hql.innerJoin("annotationTypes", "atp"));
110  categoryQuery.restrict(Restrictions.eq(Hql.alias("atp"), Expressions.parameter("annotationType")));
111  categoryQuery.order(Orders.asc(Hql.property("name"))); 
112
113  // Get all quantities
114  final ItemQuery<Quantity> quantityQuery = Quantity.getQuery();
115  quantityQuery.order(Orders.asc(Hql.property("name")));
116  quantityQuery.setCacheResult(true);
117
118  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
119  try
120  {
121    final ItemQuery<AnnotationType> query = Base.getConfiguredQuery(cc, true, AnnotationType.getQuery(null), mode);
122    annotationTypes = query.iterate(dc);
123  }
124  catch (Throwable ex)
125  {
126    cc.setMessage(ex.getMessage());
127  }
128  int numListed = 0;
129  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null);
130  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
131  %>
132  <base:page title="<%=title==null ? "Annotation types" : title%>" type="<%=mode.getPageType()%>">
133    <m:menu 
134      id="newAnnotationType"
135      style="display: none;">
136      <%
137      for (Type valueType : Type.values())
138      {
139        %>
140        <m:menuitem 
141          title="<%=valueType.toString()+" annotation type"%>" 
142          onclick="<%="newItem('"+valueType.name()+"')"%>"
143        />
144        <%
145      }
146      %>
147    </m:menu>
148 
149  <base:head scripts="menu.js,table.js" styles="menu.css,table.css">
150    <ext:scripts context="<%=jspContext%>" />
151    <ext:stylesheets context="<%=jspContext%>" />
152    <script language="JavaScript">
153    var submitPage = 'index.jsp';
154    var formId = 'annotationTypes';
155    function newItem(valueType)
156    {
157      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', 0, true, '&value_type='+valueType);
158    }
159    function editItem(itemId)
160    {
161      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true);
162    }
163    function viewItem(itemId)
164    {
165      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false);
166    }
167    function itemOnClick(evt, itemId)
168    {
169      Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected);
170    }
171    function deleteItems()
172    {
173      var frm = document.forms[formId];
174      if (Forms.numChecked(frm) == 0)
175      {
176        alert('Please select at least one item in the list');
177        return;
178      }
179      frm.action = submitPage;
180      frm.cmd.value = 'DeleteItems';
181      frm.submit();
182    }
183    function restoreItems()
184    {
185      var frm = document.forms[formId];
186      if (Forms.numChecked(frm) == 0)
187      {
188        alert('Please select at least one item in the list');
189        return;
190      }
191      frm.action = submitPage;
192      frm.cmd.value = 'RestoreItems';
193      frm.submit();
194    }
195    function deleteItemPermanently(itemId)
196    {
197      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
198    }
199    function setOwner()
200    {
201      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
202    }
203    function shareItem(itemId)
204    {
205      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id='+itemId, 'ShareAnnotationTypes', 600, 400);
206    }
207    function shareItems()
208    {
209      Table.shareItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'ShareItems');
210    }
211    function configureColumns()
212    {
213      Table.configureColumns('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>');
214    }
215    function runPlugin(cmd)
216    {
217      Table.submitToPopup(formId, cmd, 740, 540);
218    }
219    function returnSelected()
220    {
221      Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>);
222      window.close();
223    }
224    function presetOnChange()
225    {
226      Table.presetOnChange('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>');
227    }
228    </script>
229  </base:head>
230 
231  <base:body>
232    <%
233    if (cc.getMessage() != null)
234    {
235      %>
236      <div class="error"><%=cc.getMessage()%></div>
237      <%
238      cc.setMessage(null);
239    }
240    %>
241    <tbl:table 
242      id="annotationTypes" 
243      clazz="itemlist" 
244      columns="<%=cc.getSetting("columns")%>"
245      sortby="<%=cc.getSortProperty()%>" 
246      direction="<%=cc.getSortDirection()%>"
247      title="<%=title%>"
248      action="index.jsp"
249      sc="<%=sc%>"
250      item="<%=itemType%>"
251      >
252      <tbl:hidden 
253        name="mode" 
254        value="<%=mode.getName()%>" 
255      />
256      <tbl:hidden 
257        name="callback" 
258        value="<%=callback%>" 
259        skip="<%=callback == null%>" 
260      />
261      <tbl:columndef 
262        id="name"
263        property="name"
264        datatype="string"
265        title="Name"
266        sortable="true" 
267        filterable="true"
268        exportable="true"
269        show="always" 
270      />
271      <tbl:columndef 
272        id="id"
273        clazz="uniquecol"
274        property="id"
275        datatype="int"
276        title="ID"
277        sortable="true"
278        filterable="true"
279        exportable="true"
280      />
281      <tbl:columndef 
282        id="entryDate"
283        property="entryDate"
284        datatype="date"
285        title="Registered"
286        sortable="true" 
287        filterable="true"
288        exportable="true"
289        formatter="<%=dateFormatter%>"
290      />
291      <tbl:columndef 
292        id="externalId"
293        property="externalId"
294        datatype="string"
295        title="External id"
296        sortable="true" 
297        filterable="true"
298        exportable="true"
299      />
300      <tbl:columndef 
301        id="valueType"
302        property="valueType"
303        datatype="int"
304        enumeration="<%=types%>"
305        title="Value type"
306        sortable="true" 
307        filterable="true"
308        exportable="true"
309      />
310      <%
311      Enumeration<String, String> quantities = new Enumeration<String, String>();
312      quantities.add("", "- none -");
313      for (Quantity q : quantityQuery.list(dc))
314      {
315        quantities.add(Integer.toString(q.getId()), q.getName());
316      }
317      %>
318      <tbl:columndef 
319        id="quantity"
320        property="quantity"
321        sortproperty="quantity.name"
322        exportproperty="quantity.name"
323        datatype="int"
324        enumeration="<%=quantities%>"
325        title="Quantity"
326        sortable="true" 
327        filterable="true"
328        exportable="true"
329      />
330      <tbl:columndef 
331        id="defaultUnit"
332        property="defaultUnit.name"
333        datatype="string"
334        title="Default unit"
335        sortable="true" 
336        filterable="true"
337        exportable="true"
338      />
339      <tbl:columndef 
340        id="requiredForMiame"
341        property="requiredForMiame"
342        datatype="boolean"
343        title="Required for MIAME"
344        sortable="true" 
345        filterable="true"
346        exportable="true"
347      />
348      <tbl:columndef 
349        id="isEnumeration"
350        property="enumeration"
351        datatype="boolean"
352        title="Enumeration"
353        sortable="true" 
354        filterable="true"
355        exportable="true"
356      />
357      <tbl:columndef 
358        id="isProtocolParameter"
359        property="protocolParameter"
360        datatype="boolean"
361        title="Protocol parameter"
362        sortable="true" 
363        filterable="true"
364        exportable="true"
365      />
366      <tbl:columndef 
367        id="multiplicity"
368        property="multiplicity"
369        datatype="int"
370        title="Multiplicity"
371        sortable="true" 
372        filterable="true"
373        exportable="true"
374      />
375      <tbl:columndef 
376        id="defaultValue"
377        property="defaultValue"
378        datatype="string"
379        title="Default value"
380        sortable="true" 
381        filterable="true"
382        exportable="true"
383      />
384      <tbl:columndef 
385        id="itemTypes"
386        property="@itemTypes"
387        datatype="int"
388        enumeration="<%=items%>"
389        title="Item types"
390        sortable="false" 
391        filterable="true"
392        exportable="false"
393      />
394      <tbl:columndef 
395        id="categories"
396        title="Categories"
397        property="&categories(name)"
398        datatype="string"
399        filterable="true"
400        exportable="true"
401      />
402      <tbl:columndef 
403        id="owner"
404        property="owner.name"
405        datatype="string"
406        title="Owner"
407        sortable="true" 
408        filterable="true"
409        exportable="true"
410      />
411      <tbl:columndef 
412        id="description"
413        property="description"
414        datatype="string"
415        title="Description" 
416        sortable="true" 
417        filterable="true" 
418        exportable="true"
419      />
420      <tbl:columndef
421        id="permission"
422        title="Permission"
423      />
424      <tbl:columndef
425        id="sharedTo"
426        title="Shared to"
427        filterable="true"
428        filterproperty="!sharedTo.name"
429        datatype="string"
430      />
431      <tbl:toolbar
432        visible="<%=mode.hasToolbar()%>"
433        >
434        <tbl:button 
435          disabled="<%=createPermission ? false : true%>" 
436          image="<%=createPermission ? "new.gif" : "new_disabled.gif"%>" 
437          onclick="Menu.toggleTopMenu(document.getElementById('newAnnotationType'), event.clientX, event.clientY); event.cancelBubble = true;" 
438          title="New&hellip;" 
439          tooltip="<%=createPermission ? "Create new annotation type" : "You do not have permission to create annotation types"%>" 
440        />
441        <tbl:button 
442          image="delete.gif"
443          onclick="deleteItems()" 
444          title="Delete" 
445          tooltip="Delete the selected items" 
446        />
447        <tbl:button 
448          image="restore.gif"
449          onclick="restoreItems()" 
450          title="Restore" 
451          tooltip="Restore the selected (deleted) items"
452        />
453        <tbl:button 
454          image="share.gif"
455          onclick="shareItems()" 
456          title="Share&hellip;" 
457          tooltip="Share the selected items"
458        />
459        <tbl:button 
460          image="take_ownership.png"
461          onclick="setOwner()" 
462          title="Set owner&hellip;"
463          tooltip="Change owner of the selected items"
464        />
465        <tbl:button 
466          image="columns.gif" 
467          onclick="configureColumns()" 
468          title="Columns&hellip;" 
469          tooltip="Show, hide and re-order columns" 
470        />
471        <tbl:button 
472          image="import.gif" 
473          onclick="runPlugin('ImportItems')" 
474          title="Import&hellip;" 
475          tooltip="Import data" 
476          visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
477        />
478        <tbl:button 
479          image="export.gif" 
480          onclick="runPlugin('ExportItems')" 
481          title="Export&hellip;" 
482          tooltip="Export data" 
483          visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
484        />
485        <tbl:button 
486          image="runplugin.gif" 
487          onclick="runPlugin('RunListPlugin')" 
488          title="Run plugin&hellip;" 
489          tooltip="Run a plugin" 
490          visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
491        />
492        <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
493          wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
494      </tbl:toolbar>
495      <tbl:navigator
496        page="<%=cc.getPage()%>" 
497        rowsperpage="<%=cc.getRowsPerPage()%>" 
498        totalrows="<%=annotationTypes == null ? 0 : annotationTypes.getTotalCount()%>" 
499        visible="<%=mode.hasNavigator()%>"
500      />
501      <tbl:data>
502        <tbl:columns>
503        <tbl:presetselector 
504          clazz="columnheader"
505          colspan="3"
506          onchange="presetOnChange()"
507        />
508        </tbl:columns>
509
510        <tr>
511          <tbl:header 
512            clazz="index"
513            >&nbsp;</tbl:header>
514          <tbl:header 
515            clazz="check" 
516            visible="<%=mode.hasCheck()%>"
517            ><base:icon 
518              image="check_uncheck.gif" 
519              tooltip="Check/uncheck all" 
520              onclick="Forms.checkUncheck(document.forms[formId])" style="align: left;"
521            /></tbl:header>
522          <tbl:header 
523            clazz="check" 
524            visible="<%=mode.hasRadio()%>"
525            >&nbsp;</tbl:header>
526          <tbl:header 
527            clazz="icons" 
528            visible="<%=mode.hasIcons()%>"
529            >&nbsp;</tbl:header>
530          <tbl:propertyfilter />
531        </tr>
532         
533          <tbl:rows>
534          <%
535          int index = cc.getPage()*cc.getRowsPerPage();
536          int selectedItemId = cc.getId();
537         
538          if (annotationTypes != null)
539          {
540            while (annotationTypes.hasNext())
541            {
542              AnnotationType item = annotationTypes.next();
543              int itemId = item.getId();
544              String openSharePopup = "shareItem("+itemId+")";
545              String deletePermanently = "deleteItemPermanently("+itemId+")";
546              boolean deletePermission = item.hasPermission(Permission.DELETE);
547              boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION);
548              boolean writePermission = item.hasPermission(Permission.WRITE);
549              String name = HTML.encodeTags(item.getName());
550              String tooltip = mode.isSelectionMode() ? 
551                  "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : "");
552              index++;
553              numListed++;
554              Set<Item> itemTypes = item.getEnabledItems();
555              %>
556              <tbl:row>
557                <tbl:header 
558                  clazz="index"
559                  ><%=index%></tbl:header>
560                <tbl:header 
561                  clazz="check" 
562                  visible="<%=mode.hasCheck()%>"
563                  ><input 
564                    type="checkbox" 
565                    name="<%=itemId%>" 
566                    value="<%=itemId%>" 
567                    title="<%=name%>" 
568                    <%=cc.getSelected().contains(itemId) ? "checked" : ""%> 
569                  ></tbl:header>
570                <tbl:header 
571                  clazz="check" 
572                  visible="<%=mode.hasRadio()%>"
573                  ><input 
574                    type="radio" 
575                    name="item_id" 
576                    value="<%=itemId%>" 
577                    title="<%=name%>" 
578                    <%=selectedItemId == itemId ? "checked" : ""%>
579                  ></tbl:header>
580                <tbl:header 
581                  clazz="icons" 
582                  visible="<%=mode.hasIcons()%>"
583                  ><base:icon 
584                    image="<%=deletePermission ? "deleted.gif" : "deleted_disabled.gif"%>"
585                    onclick="<%=deletePermission ? deletePermanently : null%>"
586                    tooltip="This item has been scheduled for deletion" 
587                    visible="<%=item.isRemoved()%>"
588                  /><base:icon 
589                    image="<%=sharePermission ? "shared.gif" : "shared_disabled.gif"%>" 
590                    onclick="<%=sharePermission ? openSharePopup : null%>"
591                    tooltip="This item is shared to other users, groups and/or projects" 
592                    visible="<%=item.isShared()%>"
593                  />&nbsp;</tbl:header>
594                <tbl:cell column="name"><div class="link" 
595                  onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)" 
596                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
597                <tbl:cell column="id"><%=item.getId()%></tbl:cell>
598                <tbl:cell column="entryDate" value="<%=item.getEntryDate()%>" />
599                <tbl:cell column="externalId"><%=HTML.encodeTags(item.getExternalId())%></tbl:cell>
600                <tbl:cell column="valueType"><%=item.getValueType()%></tbl:cell>
601                <tbl:cell column="quantity"><base:propertyvalue 
602                    item="<%=item%>" 
603                    property="quantity"
604                    enableEditLink="<%=mode.hasEditLink()%>" 
605                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
606                  /></tbl:cell>
607                <tbl:cell column="defaultUnit"><base:propertyvalue 
608                    item="<%=item%>" 
609                    property="defaultUnit"
610                    enableEditLink="<%=mode.hasEditLink()%>" 
611                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
612                  /></tbl:cell>
613                <tbl:cell column="isEnumeration"><%=item.isEnumeration() ? 
614                  HTML.encodeTags(Values.getString((List)item.getValues(), ", ", true, (Formatter)FormatterFactory.getTypeFormatter(sc, item.getValueType()) )) : 
615                  "<i>- no -</i>"%></tbl:cell>
616                <tbl:cell column="requiredForMiame"><%=item.isRequiredForMiame() ? "yes" : "no"%></tbl:cell>
617                <tbl:cell column="isProtocolParameter"><%=item.isProtocolParameter() ? "yes" : "no"%></tbl:cell>
618                <tbl:cell column="multiplicity"><%=item.getMultiplicity() == 0 ? "<i>- unlimited -</i>" : item.getMultiplicity()%></tbl:cell>
619                <tbl:cell column="defaultValue"><%=HTML.encodeTags(item.getDefaultValue())%></tbl:cell>
620                <tbl:cell column="itemTypes"><%=itemTypes.isEmpty() ? "<i>- none -</i>" : Values.getString(itemTypes, ", ", true)%></tbl:cell>
621                <tbl:cell column="owner"
622                  ><base:propertyvalue 
623                    item="<%=item%>" 
624                    property="owner"
625                    enableEditLink="<%=mode.hasEditLink()%>" 
626                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
627                  /></tbl:cell>
628                <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
629                <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell>
630                <tbl:cell column="categories">
631                  <%
632                  categoryQuery.setParameter("annotationType", itemId, Type.INT);
633                  try
634                  {
635                    String separator = "";
636                    for (AnnotationTypeCategory c : categoryQuery.list(dc))
637                    {
638                      out.write(separator);
639                      if (mode.hasPropertyLink())
640                      {
641                        out.write(Base.getLinkedName(ID, c, false, mode.hasEditLink()));
642                      }
643                      else
644                      {
645                        out.write(HTML.encodeTags(c.getName()));
646                      }
647                      separator = ", ";
648                    }
649                  }
650                  catch (Throwable t)
651                  {
652                    %>
653                    <div class="error"><%=t.getMessage()%></div>
654                    <%
655                  }
656                  %>
657                </tbl:cell>
658                <tbl:cell column="sharedTo">
659                  <%
660                  Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, item).iterator();
661                  while(sharees.hasNext())
662                  {
663                    Nameable n = sharees.next();
664                    if (mode.hasPropertyLink())
665                    {
666                      out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink()));
667                    }
668                    else
669                    {
670                      out.write(HTML.encodeTags(n.getName()));
671                    }
672                    out.write(sharees.hasNext() ? ", " : "");
673                  }
674                  %>
675                </tbl:cell>
676              </tbl:row>
677              <%
678            }
679          }
680          %>
681          </tbl:rows>
682      </tbl:data>
683      <%
684      if (numListed == 0)
685      {
686        %>
687        <tbl:panel><%=annotationTypes == null || annotationTypes.getTotalCount() == 0 ? "No annotation types were found" : "No annotation types on this page. Please select another page!" %></tbl:panel>
688        <%
689      }
690      else
691      {
692        %>
693        <tbl:navigator
694          page="<%=cc.getPage()%>" 
695          rowsperpage="<%=cc.getRowsPerPage()%>" 
696          totalrows="<%=annotationTypes == null ? 0 : annotationTypes.getTotalCount()%>" 
697          visible="<%=mode.hasNavigator()%>"
698          locked="true"
699        />
700        <%
701      }
702      %>
703    </tbl:table>
704    <base:buttongroup align="center" clazz="fixedatbottom">
705      <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" />
706      <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
707      <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" />
708    </base:buttongroup>
709    <br><br><br>
710  </base:body>
711  </base:page>
712  <%
713}
714finally
715{
716  if (annotationTypes != null) annotationTypes.close();
717  if (dc != null) dc.close();
718}
719%>
Note: See TracBrowser for help on using the repository browser.