notification-center.tt 2.3 KB

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