Changeset 5048


Ignore:
Timestamp:
Aug 17, 2009, 9:25:22 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

References #108: Logging the change history of an item

  • Added list and view pages for the change history
  • The biosource view page is used as a prototype
  • Made it possible to disable the "Change history" with setting in base.config
Location:
trunk
Files:
7 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/config/dist/base.config

    r5038 r5048  
    147147# changelog.factory = net.sf.basedb.core.log.db.DbLogManagerFactory
    148148
     149# If the "Change history" tab should be visible in the web interface
     150# or not. It is hidden by default.
     151# changelog.show-in-web = false
     152
    149153# ===============
    150154# General section
  • trunk/src/clients/web/net/sf/basedb/clients/web/extensions/toolbar/ToolbarUtil.java

    r4887 r5048  
    7676      Item.MIMETYPE, Item.REPORTERTYPE, Item.EXTRAVALUETYPE,
    7777      Item.ANNOTATIONTYPE, Item.ANNOTATIONTYPECATEGORY, Item.QUANTITY, Item.UNIT,
    78       Item.SESSION, Item.JOB, Item.MESSAGE, Item.PROJECT, Item.FILE
     78      Item.SESSION, Item.JOB, Item.MESSAGE, Item.PROJECT, Item.FILE,
     79      Item.CHANGEHISTORY
    7980    };
    8081
  • trunk/src/core/net/sf/basedb/core/ChangeHistory.java

    r5039 r5048  
    463463  public Integer getJobId()
    464464  {
    465     return getData().getChangeHistory().getPluginId();
     465    return getData().getChangeHistory().getJobId();
    466466  }
    467467 
  • trunk/src/core/net/sf/basedb/core/data/ChangeHistoryData.java

    r5038 r5048  
    3232  objects.
    3333  <p>
    34   NOTE! All references to other items are stored as integer values
    35   only, because we don't want the log to block deletion of items.
     34  NOTE! All references to other items are controlled by regular integer
     35  values because we don't want foreign keys from the log tables to block
     36  deletion of items. A duplicate mapping using many-to-one with a formula
     37  attribute is used since we really need the LEFT JOIN functionality in the
     38  web interface and the association is also useful for data export which
     39  uses metadata to access the properties. The formula mapping is not
     40  supported by XDoclet so we have to do this in the
     41  hibernate-properties.ChangeHistoryData.xml file.
     42  <p>
    3643  Missing items are handled by the core layer at runtime.
    3744  References in the log to missing items may optionally be deleted by a
    3845  cleanup thread from time to time.
     46  <p>
     47 
    3948 
    4049  @author Nicklas
     
    8089  }
    8190
     91  private UserData user;
     92  UserData getUser()
     93  {
     94    return user;
     95  }
     96  void setUser(UserData user)
     97  {
     98    this.user = user;
     99  }
     100 
    82101  private int sessionId;
    83102  /**
     
    95114  }
    96115
     116  private SessionData session;
     117  SessionData getSession()
     118  {
     119    return session;
     120  }
     121  void setSession(SessionData session)
     122  {
     123    this.session = session;
     124  }
     125 
    97126  private Integer clientId;
    98127  /**
     
    110139  }
    111140
     141  private ClientData client;
     142  ClientData getClient()
     143  {
     144    return client;
     145  }
     146  void setClient(ClientData client)
     147  {
     148    this.client = client;
     149  }
     150
     151 
    112152  private Integer projectId;
    113153  /**
     
    125165  }
    126166 
     167  private ProjectData project;
     168  ProjectData getProject()
     169  {
     170    return project;
     171  }
     172  void setProject(ProjectData project)
     173  {
     174    this.project = project;
     175  }
     176 
    127177  private Integer pluginId;
    128178  /**
     
    140190  }
    141191
     192  private PluginDefinitionData plugin;
     193  PluginDefinitionData getPlugin()
     194  {
     195    return plugin;
     196  }
     197  void setPlugin(PluginDefinitionData plugin)
     198  {
     199    this.plugin = plugin;
     200  }
     201 
    142202  private Integer jobId;
    143203  /**
     
    154214    this.jobId = jobId;
    155215  }
    156 
     216 
     217  private JobData job;
     218  JobData getJob()
     219  {
     220    return job;
     221  }
     222  void setJob(JobData job)
     223  {
     224    this.job = job;
     225  }
     226 
    157227  private Set<ChangeHistoryDetailData> details;
    158228  /**
  • trunk/www/biomaterials/biosources/view_biosource.jsp

    r5044 r5048  
    4949  import="net.sf.basedb.core.SharedItem"
    5050  import="net.sf.basedb.clients.web.Base"
     51  import="net.sf.basedb.clients.web.ChangeHistoryUtil"
    5152  import="net.sf.basedb.clients.web.PermissionUtil"
    5253  import="net.sf.basedb.clients.web.util.HTML"
     
    152153    {
    153154      if (TabControl.isActive(tabControlId, tabId)) return;
    154       if (tabId == 'overview' && tabId != '<%=tab%>')
     155      if ((tabId == 'overview' || tabId == 'history') && tabId != '<%=tab%>')
    155156      {
    156157        location.href = 'index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id=<%=itemId%>&tab='+tabId;
     
    486487        %>
    487488      </t:tab>     
     489      <t:tab id="history" title="Change history"
     490        tooltip="Displays a log of all modifications made to this item"
     491        visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>">
     492        <%
     493        if ("history".equals(tab))
     494        {
     495          %>
     496          <jsp:include page="../../common/history/frameset.jsp">
     497            <jsp:param name="source_type" value="<%=itemType.name()%>" />
     498            <jsp:param name="source_id" value="<%=itemId%>" />
     499            <jsp:param name="ID" value="<%=ID%>" />
     500          </jsp:include>
     501          <%
     502        }
     503        %>
     504      </t:tab>     
    488505      </t:tabcontrol>
    489506
  • trunk/www/include/scripts/main.js

    r4938 r5048  
    474474    this.controllers['QUANTITY'] = { url:'admin/quantities/index.jsp', width:600, height:480 };
    475475    this.controllers['UNIT'] = { url:'admin/quantities/units/index.jsp', width:600, height:480 };
     476    this.controllers['CHANGEHISTORY'] = { url:'common/history/index.jsp', width:600, height:480, edit:false, popup:true };
    476477  }
    477478 
Note: See TracChangeset for help on using the changeset viewer.