www/admin/quotatypes/edit_quotatype.jsp

Code
Comments
Other
Rev Date Author Line
553 11 May 05 nicklas 1 <%-- $Id$
553 11 May 05 nicklas 2   ------------------------------------------------------------------
3675 16 Aug 07 jari 3   Copyright (C) 2005 Nicklas Nordborg
5425 23 Sep 10 nicklas 4   Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
553 11 May 05 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/
553 11 May 05 nicklas 8
553 11 May 05 nicklas 9   BASE is free software; you can redistribute it and/or
553 11 May 05 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
553 11 May 05 nicklas 12   of the License, or (at your option) any later version.
553 11 May 05 nicklas 13
553 11 May 05 nicklas 14   BASE is distributed in the hope that it will be useful,
553 11 May 05 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
553 11 May 05 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
553 11 May 05 nicklas 17   GNU General Public License for more details.
553 11 May 05 nicklas 18
553 11 May 05 nicklas 19   You should have received a copy of the GNU General Public License
4510 11 Sep 08 jari 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
553 11 May 05 nicklas 21   ------------------------------------------------------------------
553 11 May 05 nicklas 22
553 11 May 05 nicklas 23
553 11 May 05 nicklas 24   @author Nicklas
553 11 May 05 nicklas 25   @version 2.0
553 11 May 05 nicklas 26 --%>
5426 24 Sep 10 nicklas 27 <%@ page pageEncoding="UTF-8" session="false"
553 11 May 05 nicklas 28   import="net.sf.basedb.core.SessionControl"
553 11 May 05 nicklas 29   import="net.sf.basedb.core.DbControl"
553 11 May 05 nicklas 30   import="net.sf.basedb.core.Item"
2011 17 Feb 06 nicklas 31   import="net.sf.basedb.core.ItemContext"
553 11 May 05 nicklas 32   import="net.sf.basedb.core.Permission"
553 11 May 05 nicklas 33   import="net.sf.basedb.core.QuotaType"
553 11 May 05 nicklas 34   import="net.sf.basedb.core.PermissionDeniedException"
553 11 May 05 nicklas 35   import="net.sf.basedb.clients.web.Base"
553 11 May 05 nicklas 36   import="net.sf.basedb.clients.web.util.HTML"
2753 20 Oct 06 nicklas 37   import="net.sf.basedb.util.Values"
5510 19 Nov 10 nicklas 38   import="net.sf.basedb.core.plugin.GuiContext"
5510 19 Nov 10 nicklas 39   import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
5510 19 Nov 10 nicklas 40   import="net.sf.basedb.clients.web.extensions.JspContext"
5510 19 Nov 10 nicklas 41   import="net.sf.basedb.clients.web.extensions.edit.EditUtil"
7604 25 Feb 19 nicklas 42   import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction"
5510 19 Nov 10 nicklas 43   import="net.sf.basedb.util.extensions.ExtensionsInvoker"
553 11 May 05 nicklas 44 %>
553 11 May 05 nicklas 45 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
553 11 May 05 nicklas 46 <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
6149 25 Sep 12 nicklas 47 <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
553 11 May 05 nicklas 48 <%
2011 17 Feb 06 nicklas 49 final Item itemType = Item.QUOTATYPE;
553 11 May 05 nicklas 50 final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
2011 17 Feb 06 nicklas 51 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
2011 17 Feb 06 nicklas 52 final int itemId = cc.getId();
553 11 May 05 nicklas 53 final String ID = sc.getId();
553 11 May 05 nicklas 54 final float scale = Base.getScale(sc);
7954 12 May 21 nicklas 55 final DbControl dc = sc.newDbControl(":Edit "+itemType);
553 11 May 05 nicklas 56 try
553 11 May 05 nicklas 57 {
553 11 May 05 nicklas 58   String title = null;
553 11 May 05 nicklas 59   QuotaType quotaType = null;
2011 17 Feb 06 nicklas 60
2011 17 Feb 06 nicklas 61   if (itemId == 0)
553 11 May 05 nicklas 62   {
2011 17 Feb 06 nicklas 63     throw new PermissionDeniedException(Permission.CREATE, itemType.toString());
553 11 May 05 nicklas 64   }
553 11 May 05 nicklas 65   else
553 11 May 05 nicklas 66   {
2011 17 Feb 06 nicklas 67     quotaType = QuotaType.getById(dc, itemId);
6305 09 Aug 13 nicklas 68     quotaType.checkPermission(Permission.WRITE);
2011 17 Feb 06 nicklas 69     cc.setObject("item", quotaType);
553 11 May 05 nicklas 70     title = "Edit quota type -- " + HTML.encodeTags(quotaType.getName());
553 11 May 05 nicklas 71   }
2011 17 Feb 06 nicklas 72   
5510 19 Nov 10 nicklas 73   JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), quotaType);
7604 25 Feb 19 nicklas 74   ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext);
553 11 May 05 nicklas 75   %>
6305 09 Aug 13 nicklas 76   <base:page type="popup" title="<%=title%>" id="edit-page">
6305 09 Aug 13 nicklas 77   <base:head scripts="tabcontrol-2.js,~quotatypes.js" styles="tabcontrol.css">
5510 19 Nov 10 nicklas 78     <ext:scripts context="<%=jspContext%>" />
5510 19 Nov 10 nicklas 79     <ext:stylesheets context="<%=jspContext%>" />
553 11 May 05 nicklas 80   </base:head>
6399 24 Jan 14 nicklas 81   <base:body>
5922 11 Jan 12 nicklas 82     <h1><%=title%> <base:help tabcontrol="settings" /></h1>
6162 10 Oct 12 nicklas 83     <form action="index.jsp?ID=<%=ID%>" method="post" name="quotaType">
2011 17 Feb 06 nicklas 84     <input type="hidden" name="cmd" value="UpdateItem">
2011 17 Feb 06 nicklas 85
5922 11 Jan 12 nicklas 86     <t:tabcontrol id="settings"
5922 11 Jan 12 nicklas 87       subclass="content dialogtabcontrol"
5510 19 Nov 10 nicklas 88       position="bottom" remember="<%=quotaType != null%>"
5510 19 Nov 10 nicklas 89       extensions="<%=invoker%>">
6305 09 Aug 13 nicklas 90     <t:tab id="info" title="Quota type" helpid="quotatype.edit">
5922 11 Jan 12 nicklas 91       <table class="fullform input100 smaller">
553 11 May 05 nicklas 92       <tr>
5922 11 Jan 12 nicklas 93         <th>Name</th>
6305 09 Aug 13 nicklas 94         <td><input class="text required auto-init" data-auto-init="<%=quotaType == null ? "focus-select" : "focus" %>" 
6305 09 Aug 13 nicklas 95           type="text" name="name" 
2011 17 Feb 06 nicklas 96           value="<%=HTML.encodeTags(quotaType == null ? Values.getString(cc.getPropertyValue("name"), "New quota type") : quotaType.getName())%>" 
5922 11 Jan 12 nicklas 97           maxlength="<%=QuotaType.MAX_NAME_LENGTH%>"></td>
5922 11 Jan 12 nicklas 98         <td></td>
553 11 May 05 nicklas 99       </tr>
5922 11 Jan 12 nicklas 100       <tr class="dynamic">
5922 11 Jan 12 nicklas 101         <th>Description</th>
5922 11 Jan 12 nicklas 102         <td>
6217 14 Dec 12 nicklas 103           <textarea class="text" rows="6" name="description" id="description"
2011 17 Feb 06 nicklas 104             ><%=HTML.encodeTags(quotaType == null ? cc.getPropertyValue("description") : quotaType.getDescription())%></textarea>
553 11 May 05 nicklas 105         </td>
5922 11 Jan 12 nicklas 106         <td style="width: 20px;">
6215 13 Dec 12 nicklas 107           <base:zoom textarea="description" title="Description" />
5922 11 Jan 12 nicklas 108         </td>
553 11 May 05 nicklas 109       </tr>
553 11 May 05 nicklas 110       </table>
553 11 May 05 nicklas 111     </t:tab>
553 11 May 05 nicklas 112     </t:tabcontrol>
5922 11 Jan 12 nicklas 113     </form>
5922 11 Jan 12 nicklas 114     
5922 11 Jan 12 nicklas 115     <div class="legend">
5946 03 Feb 12 nicklas 116       <base:icon image="required.png" />= required information
5922 11 Jan 12 nicklas 117     </div>
2011 17 Feb 06 nicklas 118
5922 11 Jan 12 nicklas 119     <base:buttongroup subclass="dialogbuttons">
6305 09 Aug 13 nicklas 120       <base:button id="btnSave" title="Save" />
6305 09 Aug 13 nicklas 121       <base:button id="close" title="Cancel" />
5922 11 Jan 12 nicklas 122     </base:buttongroup>
553 11 May 05 nicklas 123   </base:body>
553 11 May 05 nicklas 124   </base:page>
553 11 May 05 nicklas 125   <%
553 11 May 05 nicklas 126 }
553 11 May 05 nicklas 127 finally
553 11 May 05 nicklas 128 {
553 11 May 05 nicklas 129   if (dc != null) dc.close();
553 11 May 05 nicklas 130 }
553 11 May 05 nicklas 131 %>