diff --git a/api/js/jsapi/egw_calendar.js b/api/js/jsapi/egw_calendar.js index a1ba88267a..5a211f2379 100644 --- a/api/js/jsapi/egw_calendar.js +++ b/api/js/jsapi/egw_calendar.js @@ -9,48 +9,19 @@ * @author Ralf Becker */ -/*egw:uses - jquery.jquery-ui-timepicker-addon; - - egw_core; - egw_preferences; -// egw_jquery; - egw_css; -*/ - -import "../jquery/jquery.noconflict.js"; -//import "../jquery/jquery-ui-timepicker-addon.js"; import './egw_core.js'; /** * Date and timepicker * * @augments Class - * @param {string} _app application name object is instanciated for - * @param {object} _wnd window object is instanciated for + * @param {string} _app application name object is instanced for + * @param {object} _wnd window object is instanced for */ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) { "use strict"; - // translate only once - var calendar_translated = false,timepicker_translated = false; - - function calendarPreferences(_egw) - { - // Date format in jQuery UI date format - var dateformat = dateTimeFormat(_egw.preference("dateformat") || "Y-m-d"); - - // First day of the week - var first_day = {"Monday": 1, "Sunday": 0, "Saturday": 6}; - var first_day_pref = _egw.preference("weekdaystarts","calendar"); - - return { - 'dateFormat': dateformat, - 'firstDay': first_day_pref ? first_day[first_day_pref] : 0 - }; - }; - /** * transform PHP date/time-format to jQuery date/time-format * @@ -69,175 +40,6 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) .replace('s', 'ss'); } - function timePreferences(_egw) - { - return { - // timepicker does NOT work with spaces in timeformat - "timeFormat": egw.preference("timeformat") == 12 ? "h:mmtt" : "HH:mm", - "ampm": (egw.preference("timeformat") == "12"), - "hourGrid": 4, - "minuteGrid": 10 - }; - }; - - function setupCalendar(_egw, _input, _time, _callback, _context) - { - if (!calendar_translated) - { - // Set template's icon for date popup - could probably use jquery-ui icons - _egw.css(".et2_date input.hasDatepicker:enabled:hover", "background-image: url(" + egw().image('datepopup') + ")"); - - translateCalendar(); - calendar_translated = true; - } - if (!timepicker_translated) - { - translateTimepicker(); - timepicker_translated = true; - } - var prefs = calendarPreferences(_egw); - - var params = { - dateFormat: prefs.dateFormat, - firstDay: prefs.firstDay, - - autoSize: true, - showButtonPanel: true, // Today, Done buttons - showOtherMonths: true, - selectOtherMonths: true, - showWeek: true, // Week numbers - changeMonth: true, // Month selectbox - changeYear: true // Year selectbox - }; - - // Get the preferences - if(_time) - { - params = jQuery.extend(params, timePreferences(_egw)); - _wnd.jQuery(_input).datetimepicker(params); - } - else - { - _wnd.jQuery(_input).datepicker(params); - } -/* - onClose: function(date_text, picker) { - // Only update if there's a change - "" if no date selected - if(date_text != "") self.set_value(new Date( - picker.selectedYear, - picker.selectedMonth, - picker.selectedDay, - self.input_hours ? self.input_hours.val() : 0, - self.input_minutes ? self.input_minutes.val() : 0, - 0,0 - )); - }, - }); - -*/ - }; - - /** - * Set up an input to have a time selection popup - * - * @param {egw} _egw egw object to use - * @param {(node|string)} _input input field to use - */ - function setupTime(_egw, _input) - { - if (!timepicker_translated) - { - translateTimepicker(); - timepicker_translated = true; - } - _wnd.jQuery(_input).timepicker(timePreferences(_egw)); - } - - /** - * Translate, and set as default values - * - */ - function translateCalendar() - { - var translate_fields = { - // These ones are simple strings - "nextText": false, - "currentText": false, - "prevText": false, - "closeText": false, - "weekHeader": false, - - // These ones are arrays. - // Integers are length. If lang() has no short translation, just trim full - "dayNames": false, - "dayNamesShort":3, - "dayNamesMin": 2, - "monthNames": false, - "monthNamesShort": 3 - }; - var regional = {}; - var full = []; - for(var i in translate_fields) - { - var trans = _wnd.jQuery.datepicker._defaults[i]; - if(typeof trans === 'string') - { - trans = egw().lang(trans); - } - else - { - for(var key in trans) { - if(translate_fields[i] === false) - { - trans[key] = egw().lang(trans[key]); - } - else - { - if (trans.hasOwnProperty(key)) trans[key] = full[key].substr(0,translate_fields[i]); - } - } - // Keep the full one for missing short ones - if(translate_fields[i] === false) full = trans; - } - regional[i] = trans; - } - - // Set some non-lang defaults too -/* - var prefs = calendarPreferences(egw()); - for(var i in prefs) - { - regional[i] = prefs[i]; - } -*/ - - _wnd.jQuery.datepicker.setDefaults(regional); - }; - - function translateTimepicker() - { - var translate_fields = { - // These ones are simple strings - "timeOnlyTitle": false, - "timeText": false, - "hourText": false, - "minuteText": false, - "currentText": false, - "closeText": false - }; - var regional = {}; - for(var i in translate_fields) - { - var trans = _wnd.jQuery.timepicker._defaults[i]; - if(typeof trans === 'string') - { - trans = egw().lang(trans); - } - regional[i] = trans; - } - _wnd.jQuery.timepicker.setDefaults(regional); - }; - return { /** * setup a calendar / date-selection @@ -251,7 +53,7 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) */ calendar: function(_input, _time, _callback, _context) { - setupCalendar(this, _input, _time, _callback, _context); + alert('jQueryUI datepicker is no longer supported!'); }, /** * setup a time-selection @@ -263,7 +65,7 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) */ time: function(_input, _callback, _context) { - setupTime(this, _input); + alert('jQueryUI datepicker is no longer supported!'); }, /** * transform PHP date/time-format to jQuery date/time-format @@ -301,4 +103,4 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) return d; } }; -}); +}); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index af1bc66482..d1add695bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,6 @@ "@lion/select": "^0.15.0", "@lion/textarea": "^0.14.0", "@shoelace-style/shoelace": "^2.0.0-beta.73", - "jquery-ui-timepicker-addon": "^1.6.3", "lit-flatpickr": "^0.3.0", "sortablejs": "^1.14.0" }, @@ -40,8 +39,6 @@ "@web/test-runner-playwright": "^0.8.8", "grunt": "^1.3.0", "grunt-contrib-cssmin": "^2.2.1", - "grunt-newer": "^0.5.4", - "grunt-terser": "^1.0.0", "rimraf": "^3.0.2", "rollup": "^2.52.2", "rollup-plugin-terser": "^7.0.2", @@ -3321,30 +3318,6 @@ "node": ">=10" } }, - "node_modules/grunt-newer": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/grunt-newer/-/grunt-newer-0.5.4.tgz", - "integrity": "sha1-HZDR3ynhVTRnbHPIXUR150VtNQo=", - "dev": true, - "engines": { - "node": ">= 0.8.0" - }, - "peerDependencies": { - "grunt": "~0.4.1" - } - }, - "node_modules/grunt-terser": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/grunt-terser/-/grunt-terser-1.0.0.tgz", - "integrity": "sha512-8MfNU3cVP4UWZLlIjJMUpk3NWIEmaD+CwewhDpUTiPaS49EkBiSWCmGAihqWxBKbiOC3KePPXMmB/yiaVNqW2w==", - "dev": true, - "dependencies": { - "terser": "^4.3.9" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/gzip-size": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-3.0.0.tgz", @@ -3891,14 +3864,6 @@ "jquery": ">=1.8.0 <4.0.0" } }, - "node_modules/jquery-ui-timepicker-addon": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/jquery-ui-timepicker-addon/-/jquery-ui-timepicker-addon-1.6.3.tgz", - "integrity": "sha1-gDfDmwtjAoLdCzfditf8XhFjN38=", - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -8707,22 +8672,6 @@ "which": "~2.0.2" } }, - "grunt-newer": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/grunt-newer/-/grunt-newer-0.5.4.tgz", - "integrity": "sha1-HZDR3ynhVTRnbHPIXUR150VtNQo=", - "dev": true, - "requires": {} - }, - "grunt-terser": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/grunt-terser/-/grunt-terser-1.0.0.tgz", - "integrity": "sha512-8MfNU3cVP4UWZLlIjJMUpk3NWIEmaD+CwewhDpUTiPaS49EkBiSWCmGAihqWxBKbiOC3KePPXMmB/yiaVNqW2w==", - "dev": true, - "requires": { - "terser": "^4.3.9" - } - }, "gzip-size": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-3.0.0.tgz", @@ -9126,11 +9075,6 @@ "jquery": ">=1.8.0 <4.0.0" } }, - "jquery-ui-timepicker-addon": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/jquery-ui-timepicker-addon/-/jquery-ui-timepicker-addon-1.6.3.tgz", - "integrity": "sha1-gDfDmwtjAoLdCzfditf8XhFjN38=" - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", diff --git a/package.json b/package.json index 99234c3567..bd498af326 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,6 @@ "@web/test-runner-playwright": "^0.8.8", "grunt": "^1.3.0", "grunt-contrib-cssmin": "^2.2.1", - "grunt-newer": "^0.5.4", - "grunt-terser": "^1.0.0", "rimraf": "^3.0.2", "rollup": "^2.52.2", "rollup-plugin-terser": "^7.0.2", @@ -65,7 +63,6 @@ "@lion/select": "^0.15.0", "@lion/textarea": "^0.14.0", "@shoelace-style/shoelace": "^2.0.0-beta.73", - "jquery-ui-timepicker-addon": "^1.6.3", "lit-flatpickr": "^0.3.0", "sortablejs": "^1.14.0" },