Changeset 2947


Ignore:
Timestamp:
Nov 23, 2006, 6:04:13 PM (16 years ago)
Author:
Martin Svensson
Message:

References #334 Default settings are listed on project's view page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/my_base/projects/view_project.jsp

    r2918 r2947  
    2727<%@ page
    2828  import="net.sf.basedb.core.SessionControl"
     29  import="net.sf.basedb.core.BasicItem"
     30  import="net.sf.basedb.core.Nameable"
    2931  import="net.sf.basedb.core.DbControl"
    3032  import="net.sf.basedb.core.SystemItems"
     
    4244  import="net.sf.basedb.core.plugin.Plugin"
    4345  import="net.sf.basedb.core.query.Orders"
     46  import="net.sf.basedb.core.RawDataType"
    4447  import="net.sf.basedb.core.query.Hql"
    4548  import="net.sf.basedb.clients.web.Base"
     
    292295        </tbl:data>
    293296      </tbl:table>
     297     
     298      <h4 class="docked">Defaults</h4>     
     299      <tbl:table
     300        id="defaults"
     301        clazz="itemlist"
     302        columns="all"
     303      >
     304      <tbl:columndef
     305        id="setting"
     306        title="Setting"
     307      />
     308      <tbl:columndef
     309        id="value"
     310        title="Value"
     311      />
     312      <tbl:data>
     313        <tbl:columns />
     314          <tbl:rows>     
     315          <%   
     316          // Check each Default if it has any value
     317          for (Project.Default d : Project.Default.values())
     318          {
     319            boolean readDefaultValue = true;
     320            String defaultName = d.getShortName();
     321            String value = "";
     322            if (d.getItemType() != null)
     323            {
     324              BasicItem item = null;
     325              try
     326              {
     327                item = project.getDefaultItem(dc, d);
     328                if (item != null)
     329                {
     330                  value = item instanceof Nameable ? Base.getLinkedName(ID, (Nameable)item, false, true) : item.toString();
     331                }
     332              }
     333              catch (PermissionDeniedException ex)
     334              {
     335                readDefaultValue = false;
     336                value = "<i>- denied -</i>";
     337              }             
     338            }
     339            else if (d.equals(Project.Default.RAW_DATA_TYPE))
     340            {
     341              RawDataType rdt = project.getDefaultRawDataType();
     342              value = rdt != null ? rdt.getName() : "";
     343            }
     344            if (value.length() > 0)
     345            {
     346              %>
     347              <tbl:row>
     348                <tbl:cell column="setting"><%=defaultName%></tbl:cell>
     349                <tbl:cell column="value"><%=value%></tbl:cell>
     350              </tbl:row>
     351              <%
     352            }
     353          }
     354          %>
     355          </tbl:rows>
     356        </tbl:data>
     357      </tbl:table>     
    294358    </div>
    295359      </t:tab>
Note: See TracChangeset for help on using the changeset viewer.