init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
174
KretaWeb/Scripts/_MasterLayout.js
Normal file
174
KretaWeb/Scripts/_MasterLayout.js
Normal file
|
@ -0,0 +1,174 @@
|
|||
var MasterLayout = (function () {
|
||||
var masterLayout = function () {};
|
||||
|
||||
var layoutModel = null;
|
||||
var poi = {
|
||||
leftSideBarButton: '#layout_leftsidebarButton',
|
||||
leftSideBar: '#layout_slidePanel',
|
||||
organizationName: '#layout_organizationName',
|
||||
organizationName2: '#layout_organizationName2',
|
||||
homeUrl: '#layout_navbar_home',
|
||||
userMenu: '#layout_userMenu',
|
||||
userMenu2: '#layout_userMenu2',
|
||||
userMenuTemplate: '#UserMenuTemplate',
|
||||
sessionTimeCounter: '.usermenu_timer'
|
||||
};
|
||||
|
||||
AjaxHelper.ProgresUrl = UrlHelper.ExtendTime;
|
||||
|
||||
masterLayout.OpenCloseSideBar = function (sender) {
|
||||
toggleSideBar(sender);
|
||||
};
|
||||
|
||||
masterLayout.OpenSideBar = function (sender) {
|
||||
openSideBar(sender);
|
||||
};
|
||||
|
||||
masterLayout.CloseSideBar = function (sender) {
|
||||
closeSideBar(sender);
|
||||
};
|
||||
|
||||
masterLayout.LogOut = function () {
|
||||
logOut();
|
||||
};
|
||||
|
||||
function callBackRedirect(data) {
|
||||
window.location.assign(data.Url);
|
||||
}
|
||||
|
||||
function toggleSideBar(toggleButton) {
|
||||
var sideBar = $(poi.leftSideBar);
|
||||
var visible = sideBar.attr('data-open') === 'true';
|
||||
$(toggleButton).removeClass('right left');
|
||||
if (visible) {
|
||||
$('.sidebar-container').addClass('sidebar-open');
|
||||
$('.content-container').addClass('sidebar-open');
|
||||
$('.sb-elements').css('visibility', 'visible');
|
||||
$(toggleButton).addClass('left');
|
||||
sideBar.attr('data-open', 'false');
|
||||
} else {
|
||||
$('.sidebar-container').removeClass('sidebar-open');
|
||||
$('.content-container').removeClass('sidebar-open');
|
||||
$('.sb-elements').css('visibility', 'hidden');
|
||||
$(toggleButton).addClass('right');
|
||||
sideBar.attr('data-open', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
function openSideBar(toggleButton) {
|
||||
var sideBar = $(poi.leftSideBar);
|
||||
$(toggleButton).removeClass('right left');
|
||||
$('.sidebar-container').addClass('sidebar-open');
|
||||
$('.content-container').addClass('sidebar-open');
|
||||
$('.sb-elements').css('visibility', 'visible');
|
||||
$(toggleButton).addClass('left');
|
||||
sideBar.attr('data-open', 'false');
|
||||
}
|
||||
|
||||
function closeSideBar(toggleButton) {
|
||||
var sideBar = $(poi.leftSideBar);
|
||||
$(toggleButton).removeClass('right left');
|
||||
$('.sidebar-container').removeClass('sidebar-open');
|
||||
$('.content-container').removeClass('sidebar-open');
|
||||
$('.sb-elements').css('visibility', 'hidden');
|
||||
$(toggleButton).addClass('right');
|
||||
sideBar.attr('data-open', 'true');
|
||||
}
|
||||
|
||||
function initLayoutPage(data) {
|
||||
layoutModel = data;
|
||||
$(poi.organizationName).text(layoutModel.OrganizationName);
|
||||
$(poi.organizationName2).text(layoutModel.OrganizationName);
|
||||
$(poi.homeUrl).prop('href', layoutModel.HomePageUrl);
|
||||
$(poi.userMenuTemplate).tmpl(layoutModel.UserMenu).appendTo(poi.userMenu);
|
||||
$(poi.userMenuTemplate).tmpl(layoutModel.UserMenu).appendTo(poi.userMenu2);
|
||||
|
||||
searchPanelGlobalChangeEvent();
|
||||
toggleSideBar($(poi.leftSideBarButton));
|
||||
|
||||
initCountDown();
|
||||
}
|
||||
|
||||
masterLayout.searchWithEnter = false;
|
||||
|
||||
function searchPanelGlobalChangeEvent() {
|
||||
var searchpanel = $('#layout_SearchPanelContainer');
|
||||
if (searchpanel.length < 1) {
|
||||
return;
|
||||
}
|
||||
var gridname = searchpanel.attr('data-gridId');
|
||||
var serchpanelItems = searchpanel.find('input');
|
||||
serchpanelItems.unbind('change.Kreta');
|
||||
serchpanelItems.bind('change.Kreta', function () {
|
||||
if (masterLayout.searchWithEnter) {
|
||||
masterLayout.searchWithEnter = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var offset = $('.content-container').offset();
|
||||
$('#' + gridname).addClass('disabledGrid');
|
||||
var popupNotification = $('#popupNotification').data('kendoNotification');
|
||||
if (popupNotification) {
|
||||
popupNotification.hide();
|
||||
popupNotification.setOptions({
|
||||
position: {
|
||||
top: offset.top,
|
||||
left: offset.left,
|
||||
right: 15
|
||||
},
|
||||
width: $('.content-container').width() + 38
|
||||
});
|
||||
popupNotification.show(Globalization.KeresesFigyelmeztetes, 'warning');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function logOut() {
|
||||
if (GlobalSystemParams.IdpLoginEnabled) {
|
||||
location.href = UrlHelper.LogOutPath;
|
||||
} else {
|
||||
AjaxHelper.DoPost(UrlHelper.LogOutPath, undefined, callBackRedirect);
|
||||
}
|
||||
}
|
||||
|
||||
function initCountDown() {
|
||||
SessionHandler.SetTimeSpanElement($(poi.sessionTimeCounter));
|
||||
SessionHandler.Url(UrlHelper.RemainingTime);
|
||||
SessionHandler.WarnMethod(timeOutWarn);
|
||||
SessionHandler.EndMethod(timeOut);
|
||||
SessionHandler.Start();
|
||||
}
|
||||
|
||||
function timeOutWarn() {
|
||||
if ($('div[name=timeOutWarn]').length > 0) return;
|
||||
KretaWindowHelper.warningWindow(
|
||||
Globalization.Figyelem + '!',
|
||||
Globalization.MunkamenetLejar,
|
||||
refreshTimeOut,
|
||||
'timeOutWarn',
|
||||
null,
|
||||
Globalization.Rendben
|
||||
);
|
||||
}
|
||||
|
||||
function refreshTimeOut() {
|
||||
SessionHandler.Clear();
|
||||
AjaxHelper.DoPost(UrlHelper.ExtendTime, null, function () {
|
||||
SessionHandler.Start();
|
||||
});
|
||||
}
|
||||
|
||||
function timeOut() {
|
||||
logOut();
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
AjaxHelper.DoPost(
|
||||
UrlHelper.GetLayoutInformationPath,
|
||||
{ url: UrlHelper.CurrentControlPath },
|
||||
initLayoutPage
|
||||
);
|
||||
});
|
||||
|
||||
return masterLayout;
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue