notification-center.tt 2.1 KB

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