notification-center.tt 2.2 KB

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