notification-center.tt 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. '/styles/unified_optimized.css',
  14. ]
  15. extrastyle = ''
  16. include_legacy_stylesheets = 1
  17. -%]
  18. [% PROCESS '_pkg_hover.tmpl' -%]
  19. [% PROCESS '_ajaxapp_header.tmpl' -%]
  20. <style>
  21. .table tbody tr:hover td {
  22. background-color: inherit !important;
  23. }
  24. </style>
  25. <table id="notificationsTable" class="table table-striped responsive-table" border="1" cellspacing="0" cellpadding="2" >
  26. <thead>
  27. <tr>
  28. <td>[% locale.maketext('Notification') %]</td>
  29. <td>[% locale.maketext('Time Occurred') %]</td>
  30. <td>[% locale.maketext('Show/Hide') %]</td>
  31. </tr>
  32. </thead>
  33. <tbody>
  34. [% FOREACH notification IN data.notifications.keys.sort %]
  35. <tr>
  36. <td>[% data.notifications.$notification.subject %]</td>
  37. <td class="timestamp">[% notification %]</td>
  38. <td><a class="button" href="javascript:toggleContentDisplay('[% notification %]')">Show/Hide</a></td>
  39. </tr>
  40. <tr style="display:none" id="[% notification %]">
  41. <td colspan=3 class="notificationDisplay">
  42. <div style="margin: 0 auto; width: 700px">
  43. [% data.notifications.$notification.html %]
  44. </div>
  45. </td>
  46. </tr>
  47. [% END %]
  48. </tbody>
  49. </table>
  50. <script type="text/javascript">
  51. //Localize all the timestamps on the page
  52. var timestamps = document.querySelectorAll('.timestamp');
  53. for (var i=0; i < timestamps.length; i++) {
  54. var timestamp = timestamps[i].innerText;
  55. var t = new Date(0)
  56. t.setUTCSeconds(timestamp);
  57. timestamps[i].innerText = t.toLocaleDateString() + " " + t.toLocaleTimeString();
  58. }
  59. function toggleContentDisplay(id) {
  60. var dstatus = document.getElementById(id).style.display;
  61. var newstatus = dstatus === '' ? 'none' : ''
  62. document.getElementById(id).style.display = newstatus;
  63. }
  64. </script>
  65. [% PROCESS '_ajaxapp_footer.tmpl' -%]
  66. [% END #wrapper -%]