notification-center.tt 2.3 KB

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