"use strict"; function gerParseFloat(x) { return parseFloat(x.replace(/,/, '.')); } function gerParseMoney(x, round) { return x.toFixed(round || 2).toString().replace(/\./, ','); } function str_pad(input, pad_length, pad_string) { var pad = Array(pad_length + 1).join(pad_string || ''); var ret = pad.substring(0, pad.length - input.toString().length) + input; return ret; } function updateSumme(a, b, f, netto, ust, brutto) { var a_ = document.getElementById(a), b_ = document.getElementById(b), $f_ = $('#'+f), netto_ = document.getElementById(netto), ust_ = document.getElementById(ust), brutto_ = document.getElementById(brutto); netto_.value = (a_.value * b_.value).toFixed(2); if (f && ust && brutto){ ust_.value = (netto_.value * ($f_.find('option:selected').data('f')-1)).toFixed(2); brutto_.value = (netto_.value * $f_.find('option:selected').data('f')).toFixed(2); } } function updateDatum(datum, tage, faellig_am) { var datumListe = document.getElementById(datum).value.split(/\./); var faelligIn = parseInt(document.getElementById(tage).value); var faelligAm = new Date(); faelligAm.setFullYear(parseInt(datumListe[2])); faelligAm.setMonth(parseInt(datumListe[1] - 1)); faelligAm.setDate(parseInt(datumListe[0]) + faelligIn); document.getElementById(faellig_am).value = str_pad(faelligAm.getDate(), 2, 0) + '.' + str_pad(faelligAm.getMonth() + 1, 2, 0) + '.' + faelligAm.getFullYear(); } function saveModulContent() { var elemente = document.querySelectorAll('.damx-inline-content'); var $form = document.createElement('form'); var $body = document.getElementsByTagName('body')[0]; $form.action = window.location.href; $form.method = 'post'; for (var i = 0; i < elemente.length; i++) { var $element = elemente[i]; var mod_id = $element.getAttribute('data-mod-id'); var content_id = $element.getAttribute('data-content-id'); var content_name = $element.getAttribute('data-content-name'); var content_type = $element.getAttribute('data-content-type'); var content; if ('inner' == content_type) content = $element.innerHTML; else if ('value' == content_type) content = $element.value; else content = ''; var $input = document.createElement('input'); $input.name = 'f_modul['+mod_id+']['+content_id+']['+content_name+']'; $input.value = content; $input.type = 'hidden'; $form.appendChild($input); } if (elemente.length) { var $request_token = document.createElement('input'); $request_token.name = window.REQUEST_TOKEN_NAME; $request_token.value = window.REQUEST_TOKEN; $request_token.type = 'hidden'; $form.appendChild( $request_token ); $body.appendChild($form); $form.submit(); } } function post(_task, _id, _goto, _action, _data) { var $form = $('
'); var options = {'f_id': _id, 'goto': _goto, 'task': _task}; options[window.REQUEST_TOKEN_NAME] = window.REQUEST_TOKEN; var _formdata = $.extend({}, options, _data || {}); for(var _k in _formdata) { $form.append(''); } $form.appendTo('body').submit(); } function get(_url, _data) { var _t = []; for(var _k in _data) { _t.push(_k+'='+_data[_k]); } var _u = _t.join('&'); _t = _url + ( _u.length ? '?'+_u : ''); window.location.href = _t; } $('[data-toggle="tooltip"]').tooltip({animation: false}); $('[data-toggle="tooltip"]').on('shown.bs.tooltip', function () { $('.tooltip').addClass('dx-shown'); }).on('hidden.bs.tooltip', function () { $('.tooltip').removeClass('dx-shown'); }); bootbox.addLocale('damx', {OK: 'Ok', CANCEL: 'Abbrechen', CONFIRM: 'Bestätigen'}); bootbox.setLocale('damx'); window.damxConfirm = function(title_, message_, callback_) { bootbox.confirm({title: title_, message: message_, callback: function(ok) { if (ok) callback_(); }, backdrop: true}); } window.damxAlert = function (title_, message_, callback_) { bootbox.alert({title: title_, message: message_, callback: function(ok) { if (ok) callback_(); }, backdrop: true}); } function uniqid(a = "", b = false) { const c = Date.now()/1000; let d = c.toString(16).split(".").join(""); while(d.length < 14) d += "0"; let e = ""; if(b){ e = "."; e += Math.round(Math.random()*100000000); } return a + d + e; } /* class Database{ setData(data) { this.data_ = data; } get(id) { for(var i = 0; i < this.data_.length; i++){ if (this.data_[i].value == id){ return this.data_[i]; } } } getAll() { return this.data_; } } */ function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } } function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var Database = /*#__PURE__*/ function () { function Database() { _classCallCheck(this, Database); } _createClass(Database, [{ key: "setData", value: function setData(data) { this.data_ = data; } }, { key: "get", value: function get(id) { for (var i = 0; i < this.data_.length; i++) { if (this.data_[i].value == id) { return this.data_[i]; } } } }, { key: "del", value: function del(id) { for (var i = 0; i < this.data_.length; i++) { if (this.data_[i].value == id) { return this.data_.splice(i, 1); } } } }, { key: "add", value: function add(data) { var id = uniqid(); data.value = id; this.data_.push(data); return id; } }, { key: "update", value: function update(id, data) { for (var i = 0; i < this.data_.length; i++) { if (this.data_[i].value == id) { //return this.data_[i] = {...this.data_[i], ...data}; $.extend(this.data_[i], data); return this.data_[i]; } } } }, { key: "getAll", value: function getAll() { return this.data_; } }]); return Database; }(); var datepicker_options = { beforeShow: function() { if (!$('#ui-datepicker-div').hasClass('ll-skin-melon')) { $('#ui-datepicker-div').addClass('ll-skin-melon'); } setTimeout(function(){ $('#ui-datepicker-div').css('z-index', 999); }, 1); }, firstDay: 1, dateFormat: 'dd.mm.yy', currentText: 'heute', closeText: 'abbrechen', dayNames: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], dayNamesShort: ['Son', 'Mon', 'Die', 'Mit', 'Don', 'Fre', 'Sam'], monthNames: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], monthNamesShort: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'], } function CK() { $.getJSON('/api/?nav=seite&task=liste', function(data1) { CKEDITOR.pageList = data1; $.getJSON('/api/?nav=dateien&task=liste', function(data2) { CKEDITOR.downloadList = data2; CK_init(); }); }); } function CK_init() { if (typeof(CKEDITOR) !== "undefined") { var elemente = document.querySelectorAll('.damx-inline-content'); var elemente2 = document.querySelectorAll('.damx-cke'); var elemente3 = document.querySelectorAll('.damx-cke-full'); var config = { skin: 'damx', allowedContent: true, clipboard_defaultContentType: 'text/plain', cmslinkList: CKEDITOR.pageList, downloadList: CKEDITOR.downloadList, //customConfig: '/assets/ckeditor/config.js', customConfig: '/custom/ckeditor/config.js', //customConfig: false, enterMode: CKEDITOR.ENTER_P, entities: false, //extraPlugins: 'undo,sourcedialog,imagebrowser,htmlbuttons,link,save,html5video,widget,widgetselection,clipboard,lineutils', plugins: 'dialogui,dialog,a11yhelp,about,basicstyles,bidi,blockquote,notification,button,toolbar,clipboard,panelbutton,panel,floatpanel,colorbutton,colordialog,menu,contextmenu,copyformatting,dialogadvtab,div,elementspath,enterkey,entities,popup,filetools,filebrowser,find,fakeobjects,flash,floatingspace,listblock,richcombo,font,format,forms,horizontalrule,htmlwriter,iframe,image,imagebrowser,indent,indentblock,indentlist,justify,menubutton,language,link,list,liststyle,magicline,maximize,newpage,pagebreak,xml,ajax,pastetools,pastefromword,pastetext,preview,print,removeformat,resize,scayt,selectall,showblocks,showborders,smiley,sourcearea,sourcedialog,specialchar,stylescombo,tab,table,tabletools,templates,undo,wsc,wysiwygarea,lineutils,widgetselection,widget', extraPlugins: 'save,html5video', imageBrowser_listUrl: '/api/?nav=dateien&type=image', htmlEncodeOutput: false, fillEmptyBlocks: false, tabSpaces: 0, htmlbuttons: [ { name: 'Test', icon: 'save.png', html: '

TEST!!

', title: 'Das ist der HTML-Test-Button' } ], //defaultLanguage: 'de', language: 'de', //removePlugins: 'link', stylesSet: [ { name: 'Textabsatz', element: 'p' , attributes: {}}, { name: 'Einleitungstext', element: 'p' , attributes: {'class': 'intro'}}, { name: 'Überschrift 1 (h1)', element: 'h1', attributes: {}}, { name: 'Überschrift 2 (h2)', element: 'h2', attributes: {}}, { name: 'Überschrift 3 (h3)', element: 'h3', attributes: {}}, { name: 'Überschrift 4 (h4)', element: 'h4', attributes: {}} ], toolbar_damx: [ [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo', 'Image', 'Html5video', '-', 'Sourcedialog', '-', 'Save', '-', 'Back' ], '/', [ 'Bold', 'Italic', 'Underline', '-', 'RemoveFormat' ], [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], [ 'Link', 'Unlink', 'Anchor' ], '/', [ 'Styles', '-' ], ], toolbar_backend: [ [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo', 'Image', 'Html5video', '-', 'Sourcedialog', '-', 'Back' ], [ 'Bold', 'Italic', 'Underline', '-', 'RemoveFormat' ], [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], [ 'Link', 'Unlink', 'Anchor' ], [ 'Styles', '-' ], ], toolbar: 'damx', //toolbar: [['Save']], }; for (var i = 0; i < elemente.length; i++) { CKEDITOR.inline(elemente[i], config); } config.toolbar = 'backend'; for (var i = 0; i < elemente2.length; i++) { CKEDITOR.replace(elemente2[i], config); } config.toolbar = 'full'; for (var i = 0; i < elemente3.length; i++) { CKEDITOR.replace(elemente3[i], config); } } } window.onload = function () { if (typeof(CKEDITOR) !== "undefined") CK() };