notification-center.tt 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. [% USE Whostmgr -%]
  2. [% WRAPPER 'master_templates/master.tmpl'
  3. app_key = 'Notification Center'
  4. header = 'Notification Center'
  5. icon = '/addon_plugins/nfcenter.png'
  6. breadcrumburl = '/cgi/addon_notification-center.cgi'
  7. skipbreadcrumb = 0
  8. theme = "bootstrap"
  9. show_upgrade_message = 1
  10. stylesheets = ['/cjt/css/ajaxapp-min.css',
  11. '/templates/common/revised_notices.min.css',
  12. '/templates/packages/common.min.css',
  13. ]
  14. extrastyle = ''
  15. include_legacy_stylesheets = 1
  16. -%]
  17. [% PROCESS '_pkg_hover.tmpl' -%]
  18. [% PROCESS '_ajaxapp_header.tmpl' -%]
  19. <style>
  20. .table tbody tr:hover td, .table tbody tr:hover th, .table tbody tr:focus td, .table tbody tr:focus th {
  21. background-color: inherit !important;
  22. }
  23. </style>
  24. <table id="notificationsTable" class="table table-striped responsive-table" border="1" cellspacing="0" cellpadding="2" >
  25. <thead>
  26. <tr>
  27. <td>[% locale.maketext('Notification') %]</td>
  28. <td>[% locale.maketext('Time Occurred') %]</td>
  29. <td>[% locale.maketext('Show/Hide') %]</td>
  30. </tr>
  31. </thead>
  32. <tbody>
  33. [% FOREACH notification IN data.notifications.keys.sort %]
  34. <tr>
  35. <td>[% data.notifications.$notification.subject %]</td>
  36. <td class="timestamp">[% notification %]</td>
  37. <td><a class="button" href="javascript:toggleContentDisplay('[% notification %]')">Show/Hide</a></td>
  38. </tr>
  39. <tr style="display:none" id="[% notification %]">
  40. <td colspan=3 class="notificationDisplay">
  41. <div style="margin: 0 auto; width: 700px">
  42. [% data.notifications.$notification.html %]
  43. </div>
  44. </td>
  45. </tr>
  46. [% END %]
  47. </tbody>
  48. </table>
  49. <script type="text/javascript">
  50. //Localize all the timestamps on the page
  51. var timestamps = document.querySelectorAll('.timestamp');
  52. for (var i=0; i < timestamps.length; i++) {
  53. var timestamp = timestamps[i].innerText;
  54. var t = new Date(0)
  55. t.setUTCSeconds(timestamp);
  56. timestamps[i].innerText = t.toLocaleDateString() + " " + t.toLocaleTimeString();
  57. }
  58. function toggleContentDisplay(id) {
  59. var dstatus = document.getElementById(id).style.display;
  60. var newstatus = dstatus === '' ? 'none' : ''
  61. document.getElementById(id).style.display = newstatus;
  62. }
  63. </script>
  64. [% PROCESS '_ajaxapp_footer.tmpl' -%]
  65. [% END #wrapper -%]