<commit_before>/*========================================================================

   This file is part of the GOsa project -  http://gosa-project.org

   Copyright:
      (C) 2010-2017 GONICUS GmbH, Germany, http://www.gonicus.de

   License:
      LGPL-2.1: http://www.gnu.org/licenses/lgpl-2.1.html

   See the LICENSE file in the project's top-level directory for details.

======================================================================== */

/* ************************************************************************

#asset(gosa/*)

************************************************************************ */

qx.Class.define("gosa.view.Search", {
  extend : qx.ui.tabview.Page,
  type: "singleton",

  construct : function()
  {
    this._sq = [];
    var barWidth = 200;

    // Default search parameters
    this.__default_selection = this.__selection = {
        'fallback': true,
        'secondary': "enabled",
        'category': "all",
        'mod-time': "all"
    };
    this._categories = {};
    var d = new Date();
    this.__now = d.getTime() / 1000 + d.getTimezoneOffset() * 60;

    // Call super class and configure ourselfs
    this.base(arguments, "", "@Ligature/search");
    this.getChildControl("button").getChildControl("label").exclude();
    this.setLayout(new qx.ui.layout.VBox(5));

    // Create search field / button
    var searchHeader = this._searchHeader = new qx.ui.container.Composite();
    var searchLayout = new qx.ui.layout.HBox(10);
    searchHeader.setLayout(searchLayout);

    var sf = this.searchField = new qx.ui.form.TextField('');
    sf.setPlaceholder(this.tr("Please enter your search..."));
    this.addListener("resize", function() {
      var newWidth = parseInt(this.getBounds().width / 2);
      sf.setWidth(newWidth);
      searchHeader.setUserBounds(0, 35, this.getBounds().width, 34);

      if (this._alreadyVisible && this._delta) {
        this._delta = parseInt(this.getBounds().height / 3)
        qx.bom.element.Animation.animate(this._searchHeader.getContentElement().getDomElement(), {
          duration: 0, keep: 100, keyFrames: { 0: { "translate": ["0px", "0px"] }, 100: { "translate" : ["0px", this._delta + "px"]}}
        });
      }
    }, this);
    searchHeader.add(sf);

    searchHeader.addListenerOnce("appear", function() {
      this._alreadyVisible = true;
      this._delta = parseInt(this.getBounds().height / 3)
      qx.bom.element.Animation.animate(this._searchHeader.getContentElement().getDomElement(), {
        duration: 0, keep: 100, keyFrames: { 0: { "translate": ["0px", "0px"] }, 100: { "translate" : ["0px", this._delta + "px"]}}
      });
    }, this);

    var sb = new qx.ui.form.Button(this.tr("Search"));
    sb.setAppearance("button-primary");
    searchHeader.add(sb);

    searchLayout.setAlignX("center");

    this.add(searchHeader);

    this._spinner = new gosa.ui.Throbber();
    this._spinner.exclude();
    this._spinner.setMarginTop(200);
    this.add(this._spinner, {flex: 1});

    // Create search info (hidden)
    this.searchInfo = new qx.ui.container.Composite(new qx.ui.layout.HBox(10));
    this.searchInfo.hide();
    this.searchInfo.setMarginTop(70);
    this.searchInfo.setPadding(20);<commit_msg>obey user bounds top setting when calculating the position delta<commit_after>/*========================================================================

   This file is part of the GOsa project -  http://gosa-project.org

   Copyright:
      (C) 2010-2017 GONICUS GmbH, Germany, http://www.gonicus.de

   License:
      LGPL-2.1: http://www.gnu.org/licenses/lgpl-2.1.html

   See the LICENSE file in the project's top-level directory for details.

======================================================================== */

/* ************************************************************************

#asset(gosa/*)

************************************************************************ */

qx.Class.define("gosa.view.Search", {
  extend : qx.ui.tabview.Page,
  type: "singleton",

  construct : function()
  {
    this._sq = [];
    var barWidth = 200;

    // Default search parameters
    this.__default_selection = this.__selection = {
        'fallback': true,
        'secondary': "enabled",
        'category': "all",
        'mod-time': "all"
    };
    this._categories = {};
    var d = new Date();
    this.__now = d.getTime() / 1000 + d.getTimezoneOffset() * 60;

    // Call super class and configure ourselfs
    this.base(arguments, "", "@Ligature/search");
    this.getChildControl("button").getChildControl("label").exclude();
    this.setLayout(new qx.ui.layout.VBox(5));

    // Create search field / button
    var searchHeader = this._searchHeader = new qx.ui.container.Composite();
    var searchLayout = new qx.ui.layout.HBox(10);
    searchHeader.setLayout(searchLayout);

    var sf = this.searchField = new qx.ui.form.TextField('');
    sf.setPlaceholder(this.tr("Please enter your search..."));
    this.addListener("resize", function() {
      var newWidth = parseInt(this.getBounds().width / 2);
      sf.setWidth(newWidth);
      searchHeader.setUserBounds(0, 35, this.getBounds().width, 34);

      if (this._alreadyVisible && this._delta) {
        this._delta = parseInt(this.getBounds().height / 3) - 35;
        qx.bom.element.Animation.animate(this._searchHeader.getContentElement().getDomElement(), {
          duration: 0, keep: 100, keyFrames: { 0: { "translate": ["0px", "0px"] }, 100: { "translate" : ["0px", this._delta + "px"]}}
        });
      }
    }, this);
    searchHeader.add(sf);

    searchHeader.addListenerOnce("appear", function() {
      this._alreadyVisible = true;
      this._delta = parseInt(this.getBounds().height / 3) - 35;
      qx.bom.element.Animation.animate(this._searchHeader.getContentElement().getDomElement(), {
        duration: 0, keep: 100, keyFrames: { 0: { "translate": ["0px", "0px"] }, 100: { "translate" : ["0px", this._delta + "px"]}}
      });
    }, this);

    var sb = new qx.ui.form.Button(this.tr("Search"));
    sb.setAppearance("button-primary");
    searchHeader.add(sb);

    searchLayout.setAlignX("center");

    this.add(searchHeader);

    this._spinner = new gosa.ui.Throbber();
    this._spinner.exclude();
    this._spinner.setMarginTop(200);
    this.add(this._spinner, {flex: 1});

    // Create search info (hidden)
    this.searchInfo = new qx.ui.container.Composite(new qx.ui.layout.HBox(10));
    this.searchInfo.hide();
    this.searchInfo.setMarginTop(70);
    this.searchInfo.setPadding(20);
{'fraction_non_alphanumeric': 0.23896103896103896, 'fraction_numerical': 0.020168067226890758, 'mean_word_length': 3.440976933514247, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1887224', 'n_tokens_mistral': 2110, 'n_tokens_neox': 1946, 'n_words': 378}