base-layout.js 2.73 KB
var myLayout;
var change = false;
var notesNotSaved = false;
var lemmaExNotSaved = false;
var frames_operations = [];

$(window).bind('beforeunload', function() {
	  warnings = ""
      if(change)
    	  warnings = warnings + "  - Nie zapisano zmian w schematach składniowych.\n";
	  if(typeof semanticsChanged != "undefined" && semanticsChanged())
    	  warnings = warnings + "  - Nie zapisano zmian w ramach semantycznych.\n";
      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
    });

$(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();
}