notification-center.tt 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. [%
  2. USE Whostmgr;
  3. WRAPPER 'master_templates/master.tmpl'
  4. app_key = 'Notification Center'
  5. header = locale.maketext('Notification Center')
  6. icon = '/addon_plugins/nfcenter.png'
  7. breadcrumburl = '/cgi/addon_notification-center.cgi'
  8. theme = "bootstrap"
  9. %]
  10. <style>
  11. #contentContainer {
  12. background-color: white;
  13. }
  14. </style>
  15. <table id="notificationsTable" class="table table-striped">
  16. <thead>
  17. <tr>
  18. <td>[% locale.maketext('Notification') %]</td>
  19. <td>[% locale.maketext('Time Occurred') %]</td>
  20. <td>[% locale.maketext('Show/Hide') %]</td>
  21. </tr>
  22. </thead>
  23. <tbody>
  24. [% FOREACH notification IN data.notifications.keys.sort %]
  25. <tr>
  26. <td>[% data.notifications.$notification.subject %]</td>
  27. <td class="timestamp">[% notification %]</td>
  28. <td><a class="button" href="javascript:toggleContentDisplay('[% notification %]')">Show/Hide</a></td>
  29. </tr>
  30. <tr></tr><!--Blank row to ensure table striping works properly-->
  31. <tr style="display:none" id="[% notification %]">
  32. <td colspan=3 style="background-color: white;">
  33. <div style="margin: 0 auto; width: 700px">
  34. [% data.notifications.$notification.html %]
  35. </div>
  36. </td>
  37. </tr>
  38. [% END %]
  39. </tbody>
  40. </table>
  41. <script type="text/javascript">
  42. //Localize all the timestamps on the page
  43. var timestamps = document.querySelectorAll('.timestamp');
  44. for (var i=0; i < timestamps.length; i++) {
  45. var timestamp = timestamps[i].innerText;
  46. var t = new Date(0)
  47. t.setUTCSeconds(timestamp);
  48. timestamps[i].innerText = t.toLocaleDateString() + " " + t.toLocaleTimeString();
  49. }
  50. function toggleContentDisplay(id) {
  51. var dstatus = document.getElementById(id).style.display;
  52. var newstatus = dstatus === '' ? 'none' : ''
  53. document.getElementById(id).style.display = newstatus;
  54. }
  55. </script>
  56. [% END #wrapper -%]