[kronolith] Can't add or edit events in dynamic view Horde webmail 5.2.2, Kronolith 4.2.2
Jan Schneider
jan at horde.org
Thu Oct 30 09:41:35 UTC 2014
Zitat von Eric Van Bocxlaer <evb at ping.be>:
> Citeren Eric Van Bocxlaer <evb at ping.be>:
>
>> Citeren Jan Schneider <jan at horde.org>:
>>
>>> Zitat von Eric Van Bocxlaer <evb at ping.be>:
>>>
>>>> Citeren Jan Schneider <jan at horde.org>:
>>>>
>>>>> Zitat von Eric Van Bocxlaer <evb at ping.be>:
>>>>>
>>>>>>> Zitat von Eric Van Bocxlaer <evb at ping.be>:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> For some time now I can't edit or add events in the dynamic view. No
>>>>>>>> problem in editing or adding in the simple view!
>>>>>>>>
>>>>>>>> So I did some debug in FireBug and the reason is a undefined
>>>>>>>> 'date_format' in the javascript file kronolith.js, function getDate:
>>>>>>>> getDate: function(what) {
>>>>>>>> var dateElm, timeElm, date, time;
>>>>>>>> if (what == 'start') {
>>>>>>>> dateElm = 'kronolithEventStartDate';
>>>>>>>> timeElm = 'kronolithEventStartTime';
>>>>>>>> } else {
>>>>>>>> dateElm = 'kronolithEventEndDate';
>>>>>>>> timeElm = 'kronolithEventEndTime';
>>>>>>>> }
>>>>>>>> date = Date.parseExact($F(dateElm), Kronolith.conf.date_format)
>>>>>>>> || Date.parse($F(dateElm));
>>>>>>>> if (date) {
>>>>>>>> time = Date.parseExact($F(timeElm),
>>>>>>>> Kronolith.conf.time_format);
>>>>>>>> if (!time) {
>>>>>>>> time = Date.parse($F(timeElm));
>>>>>>>> }
>>>>>>>> if (time) {
>>>>>>>> date.setHours(time.getHours());
>>>>>>>> date.setMinutes(time.getMinutes());
>>>>>>>> }
>>>>>>>> }
>>>>>>>> return date;
>>>>>>>> },
>>>>>>>>
>>>>>>>> Kronolith.conf.date_format is for some reason undefined.
>>>>>>>> When I look via FireBug into the object 'Kronolith' I see two child
>>>>>>>> objects 'conf' and 'text'. In the child object 'conf' I see a
>>>>>>>> defined 'time_format', but no 'date_format'.
>>>>>>>> When I define via FireBug a 'date_format', everything is working, I
>>>>>>>> can add and edit events in the dynamic view!
>>>>>>>>
>>>>>>>> I searched but did not (yet) found where the configuration
>>>>>>>> information is read and putted in the 'Kronolith' object?
>>>>>>>> Can someone guid me to find the correct code?
>>>>>>>
>>>>>>> See below, it's probably the same problem, because the date format
>>>>>>> depends on the current locale.
>>>>>>>
>>>>>>>> During my search I verified the global settings of Horde for the
>>>>>>>> date_format, date_format_mini and the time_format. There are all set!
>>>>>>>> Some remark though, when I take these lists I can see entries, but
>>>>>>>> also some empty lines. The filled in lines and the empty lines are
>>>>>>>> corresponding with the enum array in prefs.php.
>>>>>>>> Example date_format list:
>>>>>>>> 09/20/14
>>>>>>>> 2014-09-20
>>>>>>>> 20/09/2014
>>>>>>>> Saturday 20 September 2014
>>>>>>>> Saturday, September 20, 2014
>>>>>>>> Saturday, 20. September 2014
>>>>>>>> Saturday, 20 September 2014
>>>>>>>> empty line
>>>>>>>> empty line
>>>>>>>> empty line
>>>>>>>> empty line
>>>>>>>> empty line
>>>>>>>> Sat 20 Sep 2014
>>>>>>>> Sat 09/20/14
>>>>>>>> Sat 2014-09-20
>>>>>>>> The rest of the lines are empty
>>>>>>>>
>>>>>>>> Why these empty lines and why the weekdays/months are not in dutch?
>>>>>>>> Everything else is translated but not the weekdays and months?
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>
>>>>>>> Some of those entries depend on your current locale. If you don't see
>>>>>>> expected date strings, make sure you have the system locales for your
>>>>>>> current language installed.
>>>>>>>
>>>>>>
>>>>>> I verified the system locale on my server, it was correctly set to
>>>>>> 'Dutch (Belgium)' the same as my selected language when I log in
>>>>>> Horde webmail and the same as the selected language in the horde
>>>>>> global settings.
>>>>>
>>>>> It doesn't matter what you set the locale to, if the locale isn't
>>>>> installed.
>>>>>
>>>>>> I found a file Registry.php, function setLanguage. I added some php
>>>>>> error logging and found that the language
>>>>>> returned from this function is 'nl_BE'.
>>>>>
>>>>> Then this is the preferred language set by your browser, but it's not
>>>>> supported by Horde and maybe not by your system either (see above).
>>>>> I'm not even sure how the language got so far in the code, other than
>>>>> on the login screen, because logging in should only be possible with
>>>>> one of the languages we actually support.
>>>>>
>>>>>> Where can I start to debug this thing?
>>>>>> The server is a windows system running apache24 and horde webmail
>>>>>> installed via pear.
>>>>>
>>>>> Well, that's an important information too. Windows' locale support
>>>>> isn't actually very good, so some date formats may not be available to
>>>>> you at all. And frankly, I haven't tested a recent Horde version on a
>>>>> Windows system in years, so I'm not even sure if it still works.
>>>>>
>>>>
>>>> I'm using without any problem horde on windows now for years.
>>>> Sometimes after an upgrade there is some little problem, but I
>>>> learned to wait and allmost the problem is gone with a next upgrade.
>>>> Sometimes it is blocking and then I use RoundCube as emergency
>>>> system ;-)
>>>> The problem described above is now already for some time in the
>>>> system and upgrades are not fixing the problem.
>>>> So I decided to do some debugging.
>>>>
>>>> There is no problem in the static simple view, it only appears in
>>>> the dynamic view.
>>>> So I don't understand: don't you use 'locales' in the static simple view?
>>>
>>> The difference is we don't use the date format from the preferences in
>>> dynamic view, because we must be able to re-parse the entered dates
>>> from free-text fields. We use the default date format of the current
>>> locale in dynamic view.
>>>
>>>> Can you point me to the code where the object
>>>> 'Kronolith.conf.date_format' in the javascript file Kronolith.js is
>>>> initialized.
>>>> If I know where to debug I can maybe repair the problem apparently
>>>> appearing only on Windows systems and only in the dynamic view.
>>>
>>> kronolith/lib/Ajax.php, Kronolith_Ajax::_addBaseVars().
>>
>> Like said, I'm running horde with apache24 on a windows server.
>> That horde isn't tested under windows should be mentionned on the
>> www.horde.org website so that users are warned!
>>
>> I found two problems under windows causing the above described problems:
>> 1. the php function nl_langinfo is used, but this function isn't
>> implemented on windows platforms
>> 2. the php function setlocale is used, but the locale strings used are
>> not the same on windows platforms
>>
>> For the first problem a workaround exists by simulating the missing
>> function. Paul Kemper did write a 'windows' nl_langinfo function. This
>> function is too long to include here, but I can send it if requested.
>> There was still a bug in his function for the D_FMT locale and
>> strftime parameter '%e'. The latter isn't implemented on windows, so
>> it must be replaced by '%#d'.
>> And because of this the function translateFormat in Datejs.php
>> (C:\php\pear\Horde\Core\Script\Package\Datejs.php) must be adapted for
>> the '%e' translation, no leading space on windows:
>> /**
>> * Translates date format strings from strftime to datejs.
>> *
>> * @param string $format A date format string in strftime syntax.
>> *
>> * @return string The date format string in datejs format.
>> */
>> static public function translateFormat($format)
>> {
>> $from = array('%e', '%-d', '%d', '%a', '%A', '%-m', '%m',
>> '%h', '%b', '%B', '%y', '%Y');
>> $to = array('d', 'd', 'dd', 'ddd', 'dddd', 'M', 'MM', 'MMM',
>> 'MMM', 'MMMM', 'yy', 'yyyy');
>> if (defined('D_FMT')) {
>> $from[] = '%x';
>> $to[] = str_replace($from, $to, Horde_Nls::getLangInfo(D_FMT));
>> }
>> return str_replace($from, $to, $format);
>> }
>>
>> Add the simulated function nl_langinfo as an include in the Nls.php
>> file (C:\php\pear\Horde\Nls.php):
>> include( 'WindowsNl_LangInfo.php' );
>>
>> For the second problem, I first created a new nls.local.php
>> configuration file (C:\Apache24\htdocs\webmail\config\nls.local.php)
>> with the windows locales strings:
>> 'usa_usa' => '‭English (American)',
>> 'uk_uk' => '‭English (British)',
>> 'canadian_can' => '‭English (Canadian)',
>> 'fra_fra' => 'Français',
>> 'nld_nld' => 'Nederlands'
>> And then modified the function setLanguage in Registry.php
>> (C:\php\pear\Horde\Registry.php) to not include 'UTF-8', also not
>> supported on each windows platform.
>> But that didn't work, I'm missing something I think.
>> If I hard code the wanted language 'nld_nld' in the function
>> setLanguage, then it works. Of course the user can't change the
>> language anymore. That's not a problem for me, but as generic
>> solution, this can't be coded like this!
>>
>> With all these changes the agenda is now working in the wanted
>> language, I can now add events, delete and change events.
>> But it is not future proof, the next upgrade of horde will delete the
>> changes and I'm back at the beginning.
>> The key question is, will horde support an installation on windows in
>> the future? For this to happen, the code must be made cross-platform...
>>
>> Regards,
>> Eric
>
> I didn't receive any reaction about above questions.
> Will windows support be added or not?
> If not, it should be mentionned in the documentation to pinpoint
> people, working with window platforms, to the existing problems.
> Regards,
>
>
>
> --
> kronolith mailing list
> Frequently Asked Questions: http://wiki.horde.org/FAQ
> To unsubscribe, mail: kronolith-unsubscribe at lists.horde.org
This takes some time to consider, and I don't even have a working
Windows server system at the moment to test this myself.
Since this only affects the dynamic view though, I wouldn't say that
we don't support Windows. Support may just be limited to the basic and
mobile view.
--
Jan Schneider
The Horde Project
http://www.horde.org/
https://www.facebook.com/hordeproject
More information about the kronolith
mailing list