database.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. define(['jquery', 'bootstrap', 'backend'], function ($, undefined, Backend) {
  2. var Controller = {
  3. index: function () {
  4. //禁止在操作select元素时关闭dropdown的关闭事件
  5. $("#database").on('click', '.dropdown-menu input, .dropdown-menu label, .dropdown-menu select', function (e) {
  6. e.stopPropagation();
  7. });
  8. //提交时检查是否有删除或清空操作
  9. $("#database").on("submit", "#sqlexecute", function () {
  10. var v = $("#sqlquery").val().toLowerCase();
  11. if ((v.indexOf("delete ") >= 0 || v.indexOf("truncate ") >= 0) && !confirm(__('Are you sure you want to delete or turncate?'))) {
  12. return false;
  13. }
  14. });
  15. //事件按钮操作
  16. $("#database").on("click", "ul#subaction li input", function () {
  17. $("#topaction").val($(this).attr("rel"));
  18. return true;
  19. });
  20. //窗口变更的时候重设结果栏高度
  21. $(window).on("resize", function () {
  22. $("#database .well").height($(window).height() - $("#database #sqlexecute").height() - $("#ribbon").outerHeight() - $(".panel-heading").outerHeight() - 130);
  23. });
  24. $(window).resize();
  25. }
  26. };
  27. return Controller;
  28. });