notification-center.tt 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. <table class="table table-striped responsive-table" border="1" cellspacing="0" cellpadding="2" >
  21. <thead>
  22. <tr>
  23. <td>[% locale.maketext('Notification') %]</td>
  24. <td>[% locale.maketext('Time Occurred') %]</td>
  25. <td>[% locale.maketext('Show/Hide') %]</td>
  26. </tr>
  27. </thead>
  28. <tbody>
  29. [% FOREACH notification IN data.notifications.keys.sort %]
  30. <tr>
  31. <td>[% data.notifications.$notification.subject %]</td>
  32. <td class="timestamp">[% notification %]</td>
  33. <td><a class="button" href="javascript:toggleContentDisplay('[% notification %]')">Show/Hide</a></td>
  34. </tr>
  35. <tr style="display:none" id="[% notification %]">
  36. <td colspan=3>
  37. [% data.notifications.$notification.html %]
  38. </td>
  39. </tr>
  40. [% END %]
  41. </tbody>
  42. </table>
  43. <script type="text/javascript">
  44. //Localize all the timestamps on the page
  45. window.onload = function () {
  46. var timestamps = document.querySelectorAll('.timestamp');
  47. for (var i=0; i < timestamps.length; i++) {
  48. var timestamp = timestamps[i].innerText.replace('/','');
  49. var t = new Date(0)
  50. t.setUTCSeconds(timestamp);
  51. timestamps[i].innerText = t.toLocaleDateString() + " " + t.toLocaleTimeString();
  52. }
  53. };
  54. function toggleContentDisplay(id) {
  55. var dstatus = document.getElementById(id).style.display;
  56. var newstatus = dstatus === '' ? 'none' : ''
  57. document.getElementById(id).style.display = newstatus;
  58. }
  59. </script>
  60. [% PROCESS '_ajaxapp_footer.tmpl' -%]
  61. [% END #wrapper -%]