footer.inc.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. if ($_SESSION['mailcow_cc_role'] == "admin"):
  3. ?>
  4. <div id="RestartSOGo" class="modal fade" role="dialog">
  5. <div class="modal-dialog">
  6. <div class="modal-content">
  7. <div class="modal-header">
  8. <button type="button" class="close" data-dismiss="modal">&times;</button>
  9. <h4 class="modal-title">Restart SOGo</h4>
  10. </div>
  11. <div class="modal-body">
  12. <p>Some tasks, e.g. adding a domain, require you to restart SOGo to catch changes made in the mailcow UI.</p>
  13. <hr />
  14. <button class="btn btn-md btn-primary" id="triggerRestartSogo">Restart SOGo</button>
  15. <br /><br />
  16. <div id="statusTriggerRestartSogo"></div>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. <?php
  22. endif;
  23. ?>
  24. <script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>
  25. <script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.min.js"></script>
  26. <script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/7.0.2/bootstrap-slider.min.js"></script>
  27. <script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.9.4/js/bootstrap-select.js"></script>
  28. <script>
  29. // Select language and reopen active URL without POST
  30. function setLang(sel) {
  31. $.post( "<?=$_SERVER['REQUEST_URI'];?>", {lang: sel} );
  32. window.location.href = window.location.pathname + window.location.search;
  33. }
  34. $(document).ready(function() {
  35. // Hide alerts after n seconds
  36. $("#alert-fade").fadeTo(7000, 500).slideUp(500, function(){
  37. $("#alert-fade").alert('close');
  38. });
  39. // Remember last navigation pill
  40. (function () {
  41. 'use strict';
  42. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  43. var id = $(this).parents('[role="tablist"]').attr('id');
  44. var key = 'lastTag';
  45. if (id) {
  46. key += ':' + id;
  47. }
  48. localStorage.setItem(key, $(e.target).attr('href'));
  49. });
  50. $('[role="tablist"]').each(function (idx, elem) {
  51. var id = $(elem).attr('id');
  52. var key = 'lastTag';
  53. if (id) {
  54. key += ':' + id;
  55. }
  56. var lastTab = localStorage.getItem(key);
  57. if (lastTab) {
  58. $('[href="' + lastTab + '"]').tab('show');
  59. }
  60. });
  61. })();
  62. // Disable submit after submitting form
  63. $('form').submit(function() {
  64. if ($('form button[type="submit"]').data('submitted') == '1') {
  65. return false;
  66. } else {
  67. $(this).find('button[type="submit"]').first().text('<?=$lang['footer']['loading'];?>');
  68. $('form button[type="submit"]').attr('data-submitted', '1');
  69. function disableF5(e) { if ((e.which || e.keyCode) == 116 || (e.which || e.keyCode) == 82) e.preventDefault(); };
  70. $(document).on("keydown", disableF5);
  71. }
  72. });
  73. // IE fix to hide scrollbars when table body is empty
  74. $('tbody').filter(function (index) {
  75. return $(this).children().length < 1;
  76. }).remove();
  77. // Init Bootstrap Selectpicker
  78. $('select').selectpicker();
  79. // Trigger SOGo restart
  80. $('#triggerRestartSogo').click(function(){
  81. $(this).prop("disabled",true);
  82. $('#statusTriggerRestartSogo').text('Stopping SOGo workers, this may take a while... ');
  83. $.ajax({
  84. method: 'get',
  85. url: 'call_sogo_ctrl.php',
  86. data: {
  87. 'ajax': true,
  88. 'ACTION': 'stop'
  89. },
  90. success: function(data) {
  91. $('#statusTriggerRestartSogo').append(data);
  92. $('#statusTriggerRestartSogo').append('<br />Starting SOGo... ');
  93. $.ajax({
  94. method: 'get',
  95. url: 'call_sogo_ctrl.php',
  96. data: {
  97. 'ajax': true,
  98. 'ACTION': 'start'
  99. },
  100. success: function(data) {
  101. $('#statusTriggerRestartSogo').append(data);
  102. }
  103. });
  104. }
  105. });
  106. });
  107. });
  108. </script>
  109. <?php
  110. if (isset($_SESSION['return'])):
  111. ?>
  112. <div class="container">
  113. <div style="position:fixed;bottom:8px;right:25px;min-width:300px;max-width:350px;z-index:2000">
  114. <div <?=($_SESSION['return']['type'] == 'danger') ? null : 'id="alert-fade"'?> class="alert alert-<?=$_SESSION['return']['type'];?>" role="alert">
  115. <a href="#" class="close" data-dismiss="alert"> &times;</a>
  116. <?=htmlspecialchars($_SESSION['return']['msg']);?>
  117. </div>
  118. </div>
  119. </div>
  120. <?php
  121. unset($_SESSION['return']);
  122. endif;
  123. ?>
  124. </body>
  125. </html>
  126. <?php $stmt = null; $pdo = null; ?>