notification-center.tt 2.2 KB

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