dokufreaks / dokuwiki-plugin-davcal

Add a synchronisable Calendar to DokuWiki
https://www.dokuwiki.org/plugin:davcal
3 stars 3 forks source link

Datepicker is in Cyrillic after upgrade #6

Open m4nu75 opened 2 years ago

m4nu75 commented 2 years ago

Hi all ! after the upgrade to 2022-07-31a "Igor", my datepicker pop up on bureaucracy is in cyrillic. I don't understand how to change it. After many trials i found out that if i disable the davcal plugin datepicker return in english (my local settings). Is there a method to change the datepicker language ? image

Klap-in commented 2 years ago

It includes its own jquery datepicker, while DokuWiki includes also a date picker. So here maybe a conflict exist? https://github.com/dokufreaks/dokuwiki-plugin-davcal/tree/master/datetimepicker-2.4.5

m4nu75 commented 2 years ago

The problem is when i upgrade the plugin to the new version of davcal. image

With the previous version of davcal in 2022-07-31a "Igor" datapicker on bureocracy form works correctly in english.

Klap-in commented 2 years ago

Hmm, quick look in the recent commits, show one with changes of the javascript. The javascript of the datetimepicker is not touch, but of the fullcalender is, and it includes updates of the languages of the fullcalender. https://github.com/dokufreaks/dokuwiki-plugin-davcal/commit/f119cccd39de450e12031812318a7ffbdadd7e5a Might be the interference occurs somewhere there?

A limit set of languages is allowed here: https://github.com/dokufreaks/dokuwiki-plugin-davcal/blob/master/action/jsinfo.php jsinfo array is forwarded to javascript.

m4nu75 commented 2 years ago

I tryed to replace the 3.10.5 with 3.7.0 in the files all.css , print.css and script.js and the datapicker of dokuwiki is in english. Looking in the f119ccc only the moment.js seems different ....

m4nu75 commented 1 year ago

I founded this ....

MomentJS and jQuery UI Datepicker

When you load a FullCalendar language file, it also loads the translations for MomentJS and jQuery UI Datepicker (if the library is already on the page). Just make sure to include the

I think that this is the problem the header of the script.js , indeed if i change in :

/* DOKUWIKI:include_once fullcalendar-3.10.5/moment.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/fullcalendar.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/de.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/en.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/fr.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/nl.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/ru.js */
/* DOKUWIKI:include_once datetimepicker-2.4.5/jquery.datetimepicker.js */
/* DOKUWIKI:include_once jstz.js */

The calendar works correctly in english ... This is only a workaround.

If i put the row with fullcalendar.js before moment.js , the datepicker works in english but the davcal synchronization (client mode) doesn't work ...

stullekovski commented 1 year ago

Hi all ! after the upgrade to 2022-07-31a "Igor", my datepicker pop up on bureaucracy is in cyrillic. I don't understand how to change it. After many trials i found out that if i disable the davcal plugin datepicker return in english (my local settings). Is there a method to change the datepicker language ? image

Hi there, got exact the same issue after installing the Bureaucracy Plugin. The davcal datepicker is fine, but the Bureaucracy is in cyrillic.

Any ideas how to fix it and still have syncing working?

Thanks a lot!

Klap-in commented 1 year ago

I have not enough time to look into this, my guess is that it could also possibly interfere with the datepicker included in DokuWiki (but that is pure guessing).

Who has javascript experience and could investigate this? That would be helpful!

m4nu75 commented 1 year ago

Any ideas how to fix it and still have syncing working?

I've used this workaround to fix it : changed the header in the file dokuwiki/lib/plugins/davcal/script.js

/* DOKUWIKI:include_once fullcalendar-3.10.5/moment.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/fullcalendar.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/de.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/en.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/fr.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/nl.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/ru.js */
/* DOKUWIKI:include_once datetimepicker-2.4.5/jquery.datetimepicker.js */
/* DOKUWIKI:include_once jstz.js */

with this lines

/* DOKUWIKI:include_once fullcalendar-3.10.5/moment.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/fullcalendar.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/de.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/en.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/fr.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/nl.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/ru.js */
/* DOKUWIKI:include_once datetimepicker-2.4.5/jquery.datetimepicker.js */
/* DOKUWIKI:include_once jstz.js */
stullekovski commented 1 year ago

Hi, I've seen and tried it. After the embedded calendar disappears. No workaround for me. Sadly. Our "workaroud" is now to type the date as a "text" inside the textbox of bureaucracy.

Chris75forumname commented 1 year ago

I had the same issue. And it comes as no suprise, all this plugin and jQuery mess, specially with datepicker, just cannot be relied on. This mess is not the fault of any one individual plugin! It's a general issue with the plugin environment. As we see in this thread it effects many plugins and pops up here and there. Plus, at least in the case of datepicker, also browsers will interfer. And I cannot present my users with 10 different datepickers!

I fixed this whole mess by explicitely declaring the datepicker object and with it all the options of datepicker in all effected plugins in the respective JS files of those plugins (copy&paste). Finally, I managed to establish my custom styled datepicker accross all plugins (bureaucracy, struct, booking) for a consistent user experience. This was alot of work. (Too much to post it here, but that's the idea.) I am aware it is kind of a workaround. But I feel save now!

Take home messages:

  1. If you want something in code in a certain way, you have to explicitely declare it.
  2. System integration is a separate milestone.
  3. The more complex the system gets and the more dependencies you add, the less resilient (and predictable) this system becomes.

(PS: Initially, I had tried out davcal and ended up using yearbox and minical. And I didn't notice, at the time, where this bug came from. It was just very persistent. I should have deactivated plugins, to tackle this. But, I didn't. That's why I had to take the hard way to solve this problem for me.)

Klap-in commented 1 year ago

Valid point.

Please note that this plugin is in need of a maintainer. This repository is recently created to enable others to submit easier improvements for this plugin. Because it needs significant improvement, it is marked as discontinued.

Maybe a wider use of the input with type date or datetime in DokuWiki and it’s plugins could improve the scattered set of datetime fields? E.g. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date

Chris75forumname commented 1 year ago

Well, this will also look different in different browsers. The jQuery datepicker, if declared explicitely, looks identical in all browsers.

DokuWiki is very much in need of a set of working calendars for different applications. I programmed one booking calendar for the booking plugin, one full year wallpaper calendar from yearbox, one monthly leave calendar with navigation and input form from yearbox, and I enhanced minical for room reservation. So this was alot of work, to make DokuWiki usable as an intranet. All of this was only halfbaked available.

Klap-in commented 1 year ago

How did you declare the jQuery date picker? Or could you propose it with a pull request?

Chris75forumname commented 1 year ago

As an example, in most major plugins, datepicker is declared very bare, like so: https://codesearch.dokuwiki.org/xref/plugin/bureaucracy/script/datepicker.js

This leaves too much room for unwanted cross-talk. What I did was specify all properties that I need, like so in EVERY plugin:

 jQuery("input[name='date']").datepicker({
     dateFormat:'dd.mm.yy',                                        // 01.01.2001
     changeYear: false,
     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'],
     dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
     dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
     dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
     showOn: 'button',
     buttonImageOnly: false,
     beforeShow: function(input, inst) {                           // https://stackoverflow.com/questions/662220/
        var calendar = inst.dpDiv;
        setTimeout(function () {
           calendar.position({
              my: 'left bottom',
              at: 'left top',
              collision: 'none',
              of: input
           });
           jQuery("#ui-datepicker-div").css('transform', 'translate( -40px, -6px )');
        }, 0);
     },
  }).next('button');

So, however this could be implemented in the code, I don't know, but leaving it to quincidence is just not a solution, as we saw earlier.

Chris75forumname commented 1 year ago

https://github.com/dokufreaks/dokuwiki-plugin-davcal/issues/6#issuecomment-1290707326 by m4nu75

I dug a bit deeper into this, and I found that davcal loads some locale for datepicker as stated above in the following file:

https://codesearch.dokuwiki.org/xref/plugin/davcal/script.js

The last loaded locale is kept, which is ru. If you change that to ja and reset your browser cache in your browser's settings, you get japanese per default.

However, you can move your langage to the end of the list or just delete all other locale language calls, except the one for your language, which you keep. And your language will now be used for davcal and bureaucracy alike.

So to make the point clear: this is actually, where the language setting is overwritten, causing this bug in bureaucracy!