Welcome to mirror list, hosted at ThFree Co, Russian Federation.

footer_sqledit.js « js « assets - github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fe4b450544d26e14e0c9096cc64f4022fa7ed0a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
$(document).ready(function() {
  if (window.inPopUp) {
    jQuery("table.tabs").prependTo("body");
    jQuery("table.printconnection").prependTo(".sqlform");
  }

  var the_action = $("#the_action").val();

  function get_action_params(from) {
    var action_params = [];
    if (the_action === "sql") {
      action_params = [
        "query=" + encodeURI(window.editor.getValue()),
        "search_path=" +
          (from === "server" ? "public" : encodeURI($("#search_path").val()))
      ];

      if (jQuery("#paginate").is(":checked")) {
        action_params.push("paginate=on");
      }
    } else if (the_action === "find") {
      action_params = [
        "term=" + encodeURI($("#term").val()),
        "filter=" + encodeURI($("#filter").val())
      ];
    }
    return action_params;
  }

  $("#selectserver").on("change", function() {
    console.log("server changed to ", $(this).val());

    var base_location = location.href.split("&")[0],
      next_location = [base_location, "server=" + $(this).val()];

    next_location = next_location.concat(get_action_params("server"));

    location.href = next_location.join("&");
    //console.log('next_location would be',next_location.join('&'));
  });

  $("#selectdb").on("change", function() {
    console.log("database changed to ", $(this).val());

    var base_location = location.href.split("&")[0],
      next_location = [
        base_location,
        "server=" + $("#selectserver").val(),
        "database=" + $(this).val()
      ];

    next_location = next_location.concat(get_action_params("database"));

    location.href = next_location.join("&");
    //console.log('next_location would be',next_location.join('&'));
  });
});