notification-center.tt 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. <div style="margin: 0 auto;">
  38. [% data.notifications.$notification.html %]
  39. </div>
  40. </td>
  41. </tr>
  42. [% END %]
  43. </tbody>
  44. </table>
  45. <script type="text/javascript">
  46. //Localize all the timestamps on the page
  47. window.onload = function () {
  48. var timestamps = document.querySelectorAll('.timestamp');
  49. for (var i=0; i < timestamps.length; i++) {
  50. var timestamp = timestamps[i].innerText.replace('/','');
  51. var t = new Date(0)
  52. t.setUTCSeconds(timestamp);
  53. timestamps[i].innerText = t.toLocaleDateString() + " " + t.toLocaleTimeString();
  54. }
  55. };
  56. function toggleContentDisplay(id) {
  57. var dstatus = document.getElementById(id).style.display;
  58. var newstatus = dstatus === '' ? 'none' : ''
  59. document.getElementById(id).style.display = newstatus;
  60. }
  61. </script>
  62. [% PROCESS '_ajaxapp_footer.tmpl' -%]
  63. [% END #wrapper -%]