6.0.0-alpha10
▾
Tasks
New Task
Search
Photos
Wiki
▾
Tickets
New Ticket
Search
dev.horde.org
Toggle Alerts Log
Help
5/15/25
H
istory
A
ttachments
C
omment
W
atch
Download
Comment on [#13655] add windows platform support in dynamic calendar view
*
Your Email Address
*
Spam protection
Enter the letters below:
.___.\ /.___ .. , _/ >< [__ | \./ ./__./ \| \__| |
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... >
Attachment
Watch this ticket
N
ew Ticket
M
y Tickets
S
earch
Q
uery Builder
R
eports
Saved Queries
Open Bugs
Bugs waiting for Feedback
Open Bugs in Releases
Open Enhancements
Enhancements waiting for Feedback
Bugs with Patches
Enhancements with Patches
Release Showstoppers
Stalled Tickets
New Tickets
Horde 5 Showstoppers