Blame view

static/js/base-layout.js 4.01 KB
Bartłomiej Nitoń authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*
Copyright (c) 2012, Bartłomiej Nitoń
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

var myLayout;
var change = false;
var notesNotSaved = false;
var lemmaExNotSaved = false;
Bartłomiej Nitoń authored
17
var frames_operations = [];
Bartłomiej Nitoń authored
18
Bartłomiej Nitoń authored
19
$(window).bind('beforeunload', function() {
Bartłomiej Nitoń authored
20
21
	  warnings = ""
      if(change)
Bartłomiej Nitoń authored
22
    	  warnings = warnings + "  - Nie zapisano zmian w schematach składniowych.\n";
Bartłomiej Nitoń authored
23
	  if(typeof semanticsChanged != "undefined" && semanticsChanged())
Bartłomiej Nitoń authored
24
    	  warnings = warnings + "  - Nie zapisano zmian w ramach semantycznych.\n";
Bartłomiej Nitoń authored
25
26
27
28
29
30
      if(notesNotSaved)
    	  warnings = warnings + "  - Nie zapisano notatki.\n";
      if(lemmaExNotSaved)
    	  warnings = warnings + "  - Nie zapisano przykładu niedowiązangeo.\n";
      if(warnings)
    	  return "Uwaga:\n" + warnings
Bartłomiej Nitoń authored
31
    });
Bartłomiej Nitoń authored
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

$(function() {
  $('#content').height($(window).height() - $('#main_menu').height() - 20);
  $(window).resize(function() {
    $('#content').height($(window).height() - $('#main_menu').height() - 20);
    $('.lemma-notes-form #id_message_text').width($(window).width() - $('#left').width() - 50);
    if ($.fn.jqGrid) {
      jQuery('#scroll').jqGrid('setGridHeight', $('#left').height() - 25 - $('#search-panel').height());
    }
    resize_splitters();
  });
  if ($.fn.splitter) {
    $('#left').bind('resize', function(e) {
      jQuery("#scroll").jqGrid('setGridWidth', $('#left').width() - 2, true);
      jQuery('#scroll').jqGrid('setGridHeight', $('#left').height() - 25 - $('#search-panel').height());
      $('.lemma-notes-form #id_message_text').width($(window).width() - $('#left').width() - 50);
      resize_splitters();
      e.stopPropagation();
    });
    $('#right').bind('resize', function(e) {
      e.stopPropagation();
    });
    $('#content').splitter({
      type: "v",
      minLeft: 50, 
      sizeLeft: 420,
      resizeToWidth: true,
      outline: true
    });
  }
  createWaitDialog();
});

function ShowProgressAnimation() 
{
  $("#wait-dialog").dialog('open');
} 

function HideProgressAnimation() 
{
  $("#wait-dialog").dialog('close');
} 

function resize_splitters() {
 // schematy
  $('#framesSplit').trigger('resize');
 // podglad hasla
  $('#prevFramesSplit').trigger('resize');
 // semantyka 
  $('#semantics-hsplit').trigger('resize');
}

function createWaitDialog()
{
    $("#wait-dialog").dialog({ autoOpen: false, 
                               modal   : 'true',
                               closeOnEscape: 'false',
                               closeText: '',
                               bgiframe: 'true',
                               resizable: 'false',
                               open: function (event, ui) {
                                   $('#wait-dialog').css('overflow', 'hidden');
                               }});
    $(".ui-dialog-titlebar").hide();
}