Changeset 5065


Ignore:
Timestamp:
Aug 19, 2009, 2:42:25 PM (14 years ago)
Author:
Nicklas Nordborg
Message:

References #108: Logging the change history of an item

  • Added "Change history" tab to file and formula view pages
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/data/FileData.java

    r4889 r5065  
    3838public class FileData
    3939  extends CommonData
    40   implements DiskConsumableData
     40  implements DiskConsumableData, LoggableData
    4141{
    4242  /*
  • trunk/src/core/net/sf/basedb/core/data/FormulaData.java

    r4917 r5065  
    3939public class FormulaData
    4040  extends CommonData
    41   implements RegisteredData
     41  implements RegisteredData, LoggableData
    4242{
    4343
  • trunk/www/filemanager/files/view_file.jsp

    r5045 r5065  
    4444  import="net.sf.basedb.core.Project"
    4545  import="net.sf.basedb.clients.web.Base"
     46  import="net.sf.basedb.clients.web.ChangeHistoryUtil"
    4647  import="net.sf.basedb.clients.web.PermissionUtil"
    4748  import="net.sf.basedb.clients.web.util.HTML"
     
    7374final int itemId = cc.getId();
    7475final float scale = Base.getScale(sc);
     76final String tab = Values.getString(request.getParameter("tab"), "properties");
    7577final DbControl dc = sc.newDbControl();
    7678try
     
    102104  %>
    103105  <base:page type="popup" title="<%=title%>">
    104   <base:head scripts="table.js" styles="table.css,toolbar.css">
     106  <base:head scripts="table.js,tabcontrol.js" styles="table.css,toolbar.css,headertabcontrol.css">
    105107    <ext:scripts context="<%=jspContext%>" />
    106108    <ext:stylesheets context="<%=jspContext%>" />
     
    168170      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=EditFileData&item_id=<%=itemId%>', 'EditFileData', 900, 700);
    169171    }
     172    function switchTab(tabControlId, tabId)
     173    {
     174      if (TabControl.isActive(tabControlId, tabId)) return;
     175      if (tabId == 'history' && tabId != '<%=tab%>')
     176      {
     177        location.href = 'index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id=<%=itemId%>&tab='+tabId;
     178      }
     179      else
     180      {
     181        TabControl.setActiveTab(tabControlId, tabId);
     182      }
     183    }
    170184    </script>
    171185  </base:head>
    172186  <base:body>
     187    <t:tabcontrol id="main" active="<%=tab%>" switch="switchTab" remember="false">
     188    <t:tab id="properties" title="Properties">
    173189    <tbl:toolbar
    174190      >
     
    528544      }
    529545      %>
    530 
    531 
    532546    </div>
    533547    </form>
    534 
     548  </t:tab>
     549    <t:tab id="history" title="Change history"
     550      tooltip="Displays a log of all modifications made to this item"
     551      visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>">
     552      <%
     553      if ("history".equals(tab))
     554      {
     555        %>
     556        <jsp:include page="../../common/history/frameset.jsp">
     557          <jsp:param name="source_type" value="<%=itemType.name()%>" />
     558          <jsp:param name="source_id" value="<%=itemId%>" />
     559          <jsp:param name="ID" value="<%=ID%>" />
     560        </jsp:include>
     561        <%
     562      }
     563      %>
     564    </t:tab>
     565    </t:tabcontrol>
    535566  </base:body>
    536567  </base:page>
  • trunk/www/views/formulas/view_formula.jsp

    r5045 r5065  
    4545  import="net.sf.basedb.util.Values"
    4646  import="net.sf.basedb.clients.web.Base"
     47  import="net.sf.basedb.clients.web.ChangeHistoryUtil"
    4748  import="net.sf.basedb.clients.web.PermissionUtil"
    4849  import="net.sf.basedb.clients.web.util.HTML"
     
    7475final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
    7576final int itemId = cc.getId();
     77final String tab = Values.getString(request.getParameter("tab"), "properties");
    7678final float scale = Base.getScale(sc);
    7779final DbControl dc = sc.newDbControl();
     
    139141      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540);
    140142    }
     143    function switchTab(tabControlId, tabId)
     144    {
     145      if (TabControl.isActive(tabControlId, tabId)) return;
     146      if (tabId == 'history' && tabId != '<%=tab%>')
     147      {
     148        location.href = 'index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id=<%=itemId%>&tab='+tabId;
     149      }
     150      else
     151      {
     152        TabControl.setActiveTab(tabControlId, tabId);
     153      }
     154    }
    141155    </script>
    142156  </base:head>
     
    148162    </p:path>
    149163   
    150     <t:tabcontrol id="main" active="properties">
     164    <t:tabcontrol id="main" active="<%=tab%>" switch="switchTab" remember="false">
    151165    <t:tab id="properties" title="Properties">
    152166    <tbl:toolbar
     
    427441    </div>
    428442    </t:tab>
     443    <t:tab id="history" title="Change history"
     444      tooltip="Displays a log of all modifications made to this item"
     445      visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>">
     446      <%
     447      if ("history".equals(tab))
     448      {
     449        %>
     450        <jsp:include page="../../common/history/frameset.jsp">
     451          <jsp:param name="source_type" value="<%=itemType.name()%>" />
     452          <jsp:param name="source_id" value="<%=itemId%>" />
     453          <jsp:param name="ID" value="<%=ID%>" />
     454        </jsp:include>
     455        <%
     456      }
     457      %>
     458    </t:tab>
    429459    </t:tabcontrol>
    430460
Note: See TracChangeset for help on using the changeset viewer.