- Updated FdsSqlOptions to accept an optional ILogger parameter for improved error logging. - Modified FdsMfr and FdsMfrClient classes to pass the logger instance to FdsSqlOptions. - Added detailed error logging in various methods to capture SQL execution issues and file handling errors. - Improved documentation for FdsSqlOptions to clarify logging behavior. - Updated Archive class to log compression errors, enhancing traceability of failures. - Adjusted project configuration to suppress specific warnings related to transitive dependencies. - Added NuGet.config to define package sources for dependency management. - Updated submodule references for OCORE and related projects.
273 lines
11 KiB
JavaScript
273 lines
11 KiB
JavaScript
$ocms.init = function (ev) {
|
||
var mdl = typeof ev === 'string' ? ev : ((ev.data || {}).fn || '');
|
||
if (mdl === '') {
|
||
return;
|
||
} else if (mdl === 'home') {
|
||
$cfr(); $lfr();
|
||
$('#topbar').ocmsmenu([], true);
|
||
$('#activemodule').text($t.ov);
|
||
$fis.ov();
|
||
} else {
|
||
$cfr(); $lfr();
|
||
$('#topbar').ocmsmenu([]);
|
||
$ocms.postXT({
|
||
url: $ocms.url(mdl + '/auth'), success: function (auth) {
|
||
if (typeof $ocms[mdl] === 'undefined') {
|
||
$ocms[mdl] = {};
|
||
}
|
||
$ocms[mdl].auth = auth;
|
||
if (auth.manage > 0) {
|
||
$ocms.getScript({
|
||
module: mdl, script: ['/web/fis', mdl, $ocms.auth.locale || 'de', 'js'].join('.'), css: ['/web/fis', mdl, 'css'].join('.'), condition: typeof $ocms[mdl].init2 !== 'function'
|
||
}, function () { $ocms[mdl].init2(); });
|
||
}
|
||
}, error: function () {
|
||
$('#contentframe').empty();
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
var $fis = { auth: {} };
|
||
$fis.db = function () {
|
||
$('#mainmenu_activemodule').text($t.ov);
|
||
let cf = $(this).empty(), ovf = $$.d({ id: 'dashboard_frame' }).appendTo(cf);
|
||
|
||
$ocms.postXT({
|
||
url: $ocms.url('wdg/my'), success: function (wx) {
|
||
$.each(wx, function (ii, wi) {
|
||
var wf = $$.dc('wdg_frame', ovf, { 'data-wdg': wi }).ldng(1);
|
||
$ocms.wdg.call(wf, { wdg: wi });
|
||
});
|
||
}, loading: ovf
|
||
});
|
||
};
|
||
$fis.ValidateEmail = function (mail) {
|
||
if (/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(mail)) {
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
};
|
||
|
||
$fis.cf = (reset) => {
|
||
let cf = $('#contentframe'); if (bool(reset, false) === true) { cf.empty().rC('hd'); } return cf;
|
||
}
|
||
$fis.lf = (reset) => {
|
||
let lf = $('#listframe'); if (bool(reset, false) === true) { lf.empty().aC('hd').rC('fix'); } return lf;
|
||
};
|
||
$fis.frm_edit = function (resethd) {
|
||
let cf = $fis.cf(false), cf2 = cf.children('.cfrm'), edf = cf.children('.edit_frm');
|
||
if (cf2.length < 1) {
|
||
cf2 = $$.dc('cfrm hd').prependTo(cf);
|
||
} else if (bool(resethd, false) === true) {
|
||
cf2.empty();
|
||
}
|
||
if (edf.length < 1) {
|
||
edf = $$.dc('edit_frm').insertAfter(cf2); //must be before list
|
||
}
|
||
return edf.empty();
|
||
};
|
||
$fis.frm_list = function (resethd, remedit) {
|
||
let cf = $fis.cf(false), cf2 = cf.children('.cfrm'), lf = cf.children('.list_frm');
|
||
if (cf2.length < 1) {
|
||
cf2 = $$.dc('cfrm hd').prependTo(cf);
|
||
} else if (bool(resethd, false) === true) {
|
||
cf2.empty();
|
||
}
|
||
if (bool(remedit, false) === true) {
|
||
cf.children('.edit_frm').remove();
|
||
}
|
||
if (lf.length < 1) {
|
||
lf = $$.dc('list_frm').appendTo(cf); //must be after list
|
||
}
|
||
return lf.empty();
|
||
};
|
||
$fis.lfm = () => {
|
||
let lf = $fis.lf(false) , h = lf.children('.lfrm');
|
||
if (h.length < 1) {
|
||
h = $$.dc('lfrm').prependTo(lf);
|
||
}
|
||
return h;
|
||
};
|
||
$fis.getAuth = (module, force) => {
|
||
return new Promise((resolve, reject) => {
|
||
if ($fis.auth[module] && bool(force, false) === false) {
|
||
resolve($fis.auth[module] || -1);
|
||
} else {
|
||
$ocms.postXT({
|
||
url: $ocms.url('auth'), data: { module: module }, success: (response) => {
|
||
$fis.auth[module] = response.auth || -1;
|
||
resolve($fis.auth[module] || -1);
|
||
}, error: () => {
|
||
reject();
|
||
}
|
||
});
|
||
}
|
||
});
|
||
};
|
||
$fis.prepAuth = (modules) => {
|
||
return new Promise((resolve, reject) => {
|
||
$ocms.postXT({
|
||
url: $ocms.url('auth'), data: { module: modules, array: 1 }, success: (response) => {
|
||
$.extend($fis.auth, response || {});
|
||
}, complete: () => {
|
||
resolve();
|
||
}
|
||
});
|
||
});
|
||
};
|
||
$fis.isAuth = (module, min) => {
|
||
return ($fis.auth[module] || -1) >= (min || 1);
|
||
};
|
||
$fis.resetPass = function (id, fds) {
|
||
if (confirm($t.smsc)) {
|
||
$ocms.postXT({ url: $ocms.url('account/sms'), data: { fn: 'pwc'} });
|
||
$ocms.dlgform($fd.rsp.clone(), {
|
||
title: $t.rsp || '',
|
||
submit: function (e) {
|
||
var c = $(this).ldng(1);
|
||
var qs = $.extend({ loginaccount: $ocms.auth.account || '' }, c.serializeObject(true, { typedvalues: true }));
|
||
if ((qs.npw || '') !== (qs.npwc || '')) {
|
||
c.find('input[name="npw"]:first')[0].setCustomValidity($t.pnm);
|
||
} else {
|
||
$ocms.postXT({
|
||
url: $ocms.url('account/changepassword'), data: qs, success: function (response) {
|
||
alert($t.cps);
|
||
c.trigger('modal_close');
|
||
}, error: function (x) {
|
||
alert($t.rspf[x.getResponseHeader('x-ocms-std')]);
|
||
}, complete: function () {
|
||
c.ldng(0);
|
||
}, timeout: 60000
|
||
});
|
||
}
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
$fis.wdg = function (options) {
|
||
let wf = $(this).empty();
|
||
$ocms.postXT({
|
||
url: $ocms.url('wdg/one'), data: { short_name: options.wdg }, timeout: 90000, success: function (response, textStatus, jqXHR) {
|
||
let wi = options.wdg, wx = response[wi];
|
||
if (!wx) { wf.ldng(0); return; }
|
||
let dbl = $.inArrayRegEx('dblwidth', wx.rendering_options) > -1, tiny = $.inArrayRegEx('tiny', wx.rendering_options) > -1;
|
||
wf.toggleClass('dbl', dbl && !tiny).toggleClass('tny', tiny);
|
||
let whd = $$.dc('wdg_hd', wf, { title: ne(wx.description, $t.wdc) }).toggleClass('dbl', dbl).text(ne(wx.name, options.wdg)).dblclick(function (ev) {
|
||
ev.stopPropagation();
|
||
$fis.wdg.call(wf, { wdg: wi });
|
||
});
|
||
let wct = $$.dc('wdg_cnt', wf).toggleClass('dbl', dbl).hide();
|
||
let bgcolix = $.inArrayRegEx('bgcolor', wx.rendering_options);
|
||
if (bgcolix > -1) { wct.css('backgroundColor', wx.rendering_options[bgcolix].toString().right(':')); }
|
||
switch (wx.type) {
|
||
case 'table':
|
||
var tblset = $$.tblset({}, wct);
|
||
var thr = $$.tr().appendTo(tblset.hd);
|
||
var $cc = $t.wdg[wi.indexOf('wdg_ev_') >= 0 ? 'wdg_ev_' : wi] || {};
|
||
$.each(wx.columns, function (ci, col) {
|
||
var cc = (!$cc[col]) ? col : $cc[col].label;
|
||
var thc = $$.th().text(cc).appendTo(thr);
|
||
});
|
||
$.each(wx.data, function (di, dx) {
|
||
var tdr = $$.tr().appendTo(tblset.bdy);
|
||
$.each(wx.columns, function (ci, col) {
|
||
var tdc = $$.td().appendTo(tdr);
|
||
if (dx[col] instanceof Date || $ocms.isJSONDateString(dx[col]) === true) {
|
||
tdc.text(fdt(dx[col], $t.dateformat));
|
||
} else {
|
||
tdc.rwText(dx[col]);
|
||
}
|
||
});
|
||
//if (dx.person_guid || false) { tdr.addClass('clickable').dblclick($.proxy($fis.i_vmm, tdr, dx.person_guid[1])); }
|
||
});
|
||
if ($.inArray('firstrow_bold', wx.rendering_options) > -1) { thr.nextAll('tr:first').css('font-weight', 'bold'); }
|
||
break;
|
||
case 'ind':
|
||
$$.dc('ind', wct).addClass('sts_' + (wx.data.status || '')).append([$$.dc('ind').text(wx.data.value), $$.lbl(wx.data.label)]);
|
||
break;
|
||
case 'image_url':
|
||
wct.css('background', 'url(\'' + wx.url + '\') no-repeat center center transparent');
|
||
break;
|
||
case 'image_base64':
|
||
wct.css('background', 'url(\'data:image/png;base64,' + wx.image + '\') no-repeat center center transparent');
|
||
break;
|
||
case 'html':
|
||
wct.html(wx.html);
|
||
if ($.inArray('reload_10min', wx.rendering_options) > -1) {
|
||
var ifr = wct.find('iframe');
|
||
setTimeout(function () { ifr.attr('src', function (i, val) { return val; }); }, (10 * 60 * 1000));
|
||
}
|
||
break;
|
||
default:
|
||
|
||
}
|
||
if ($.inArray('reload_30min', wx.rendering_options) > -1 && wx.type !== 'html') {
|
||
setTimeout(function () { $fis.wdg.call(wf, { wdg: wi }); }, (30 * 60 * 1000));
|
||
}
|
||
wct.slideDown(150);
|
||
}, error: function (jqXHR) {
|
||
wf.slideUp(150);
|
||
$fis.failure.call(this, jqXHR);
|
||
}, complete: function () {
|
||
wf.ldng(0);
|
||
}
|
||
});
|
||
};
|
||
$fis.ov = function () {
|
||
//$('#mainmenu_activemodule').text("");
|
||
$fis.lf(true);
|
||
let cf = $('#contentframe').empty(), ovf = $$.d({ id: 'dashboard_frame' }).appendTo(cf);
|
||
$ocms.postXT({
|
||
url: $ocms.url('wdg/my'), success: function (wx) {
|
||
$.each(wx, function (ii, wi) {
|
||
var wf = $$.dc('wdg_frame', ovf, { 'data-wdg': wi }).ldng(1);
|
||
$fis.wdg.call(wf, { wdg: wi });
|
||
});
|
||
}, loading: ovf
|
||
});
|
||
};
|
||
|
||
$fis.notifications = {
|
||
connection: null,
|
||
init: function () {
|
||
if (typeof signalR === 'undefined' || this.connection !== null || !$ocms.auth.useraccount_id) {
|
||
return;
|
||
}
|
||
this.ensureFrame();
|
||
this.connection = new signalR.HubConnectionBuilder()
|
||
.withUrl('/notifications')
|
||
.withAutomaticReconnect()
|
||
.build();
|
||
this.connection.on('notification', (notification) => {
|
||
this.push(notification);
|
||
});
|
||
this.connection.start().catch(() => {
|
||
this.connection = null;
|
||
});
|
||
},
|
||
ensureFrame: function () {
|
||
if ($('#notification_frame').length < 1) {
|
||
$('<div/>', { id: 'notification_frame' }).appendTo($('footer:first').length ? 'footer:first' : 'body');
|
||
}
|
||
},
|
||
push: function (notification) {
|
||
this.ensureFrame();
|
||
notification = notification || {};
|
||
let item = $('<div/>', { class: 'notification_item' })
|
||
.addClass((notification.severity || 'info').toLowerCase())
|
||
.append($('<button/>', { type: 'button', class: 'notification_close', text: '×' }))
|
||
.append($('<div/>', { class: 'notification_title', text: notification.title || 'Info' }))
|
||
.append($('<div/>', { class: 'notification_message', text: notification.message || '' }));
|
||
item.find('.notification_close').on('click', function () {
|
||
item.remove();
|
||
});
|
||
$('#notification_frame').prepend(item);
|
||
setTimeout(function () {
|
||
item.fadeOut(150, function () { item.remove(); });
|
||
}, 9000);
|
||
}
|
||
};
|