6.0.0-alpha10
5/14/25

[#13655] add windows platform support in dynamic calendar view
Summary add windows platform support in dynamic calendar view
Queue Kronolith
Queue Version 4.2.2
Type Bug
State Assigned
Priority 1. Low
Owners Horde Developers (at)
Requester evb (at) ping (dot) be
Created 10/30/2014 (3849 days ago)
Due
Updated 04/11/2016 (3320 days ago)
Assigned 01/22/2016 (3400 days ago)
Resolved
Milestone
Patch No

History
04/11/2016 09:05:11 PM niels (at) schoot (dot) com Comment #3
New Attachment: windows_nl_langinfo.php Download
Reply to this comment
Attached file implements the nl_langinfo() function (All credits to 
Paul Kemper, source: 
http://www.pfz.nl/scripts/324-nl-langinfo-functie-voorop-je-platform/ 
It's in Dutch. I took the most correct (latest) version. )

I included this file in Nls.php (as suggested) so function_exists in 
getLangInfo() is now true and this function now returns something 
useful rather than False. This solves the problem and it's now 
possible to create new calendar items in dynamic view.
01/22/2016 11:16:26 AM Jan Schneider Comment #2
Assigned to Horde DevelopersHorde Developers
State ⇒ Assigned
Reply to this comment
It's time to review a Window install. Haven't used PHP or Horde on 
Windows since ages.
10/30/2014 06:19:10 PM evb (at) ping (dot) be Comment #1
Priority ⇒ 1. Low
Patch ⇒ No
Milestone ⇒
Queue ⇒ Kronolith
Summary ⇒ add windows platform support in dynamic calendar view
Type ⇒ Bug
State ⇒ Unconfirmed
Reply to this comment
The text below is a copy of the mailing traffic:
******************************************************************************
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 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...

Saved Queries