Archive for the 'extJS' Category



06
Apr

New Language Statistics Viewer

Today I updated the languate statistics viewer for Tine 2.0. You now can select the versision to see the statistics for.

langstats

After the campaign for new translators, we got new translators for Spanish(en), French(fr), Dutch(nl), Portuguese(pt) and  Traditional Chinese(zh_TW). At the moment, they are working on the translations for our current stable release (Lara). If the translations are finished, we’ll add them to our next service release for that version.

02
Mar

Progress on a Shiny Tine 2.0 Setup

As the Tine 2.0 community keeps growing, also the need for a setup GUI is growing. One the one hand we need to support the ‘non computer freak admins’ which are installing Tine 2.0 and on the other hand we need tools for the growing developers community to install/uninstall their own applications or to only particularly upgrade the system.

So here a little snapshot of current development progress, feel free to leaf you comments.

The installation requirements are not met. It's not possible to continue setup. Maybe we also need some kind of alert "Your server is not capable to run Tine 2.0. Sorry!"

The installation requirements are not met. It's not possible to continue setup. Maybe we also need some kind of alert "Your server is not capable to run Tine 2.0. Sorry!"

Setup checks are passed, but no config file is found. Here we need a little form to support creation of a config.inc.php file.

Setup checks are passed, but no config file is found. Here we need a little form to support creation of a config.inc.php file.

If a config file is present, you need to login into setup (credentials from config.inc.php)

If a config file is present, you need to login into setup (credentials from config.inc.php)

You have a config file and successfully logged in, but something is not working with your config, e.g. SQL or LDAP is down.

You have a config file and successfully logged in, but something is not working with your config, e.g. SQL or LDAP is down.

Application Manager

If all requirements are met, you are ready to run the application manager. This is the place to install / uninstall and upgrade your applications

 

Whats the scope of the setup?

In the setup all things needed to run Tine 2.0 itself should be configured. This is the main database connection on the one hand, and the authentication and account drivers on the other hand. Things like email, voip, langs etc could be configured directly from the admin section in Tine.

03
Feb

working with grids

The last weeks while implementing the timetracker for Tine 2.0 we also developed new concepts for working with the grid view. Here is a little series of screenshots to demonstrate the cool workflow and userinterface we come up with.

filter01

Filter all timesheets from last month whoose timeaccount-numbers start with a certain string.

filter02

Select some Timesheets and mark them as billable too.

filter03

Add a filter to only find billable timesheets and select all 259 Timesheets which got found.

filter03

Now we export all selected timesheets as ODS to write our bill in Open Office

filter05

Finaly we again use mass update to mark all timesheets, found by our filter, as cleared and add in which bill we cleared them.

To avoid double billed timesheets, it would have been a good idea to filter for non cleared timesheets too ;-)

03
Nov

ExtJs Window Handling with Ext.ux.PopupWindow

In ExtJs application windows are created using the Ext.Window. These windows are some kind of a layer above the mainscreen having an nice looking chrome. The Ext.WindowManager keeps track about all windows and brings method to manage the windows. However, as these windows are no real browser windows (aka popups), they have some limitations.

  • Ext.Window’s have a different style than the native operating system windows. This may confuse users, especially those, not familiar with the technical background in web apps.
  • Ext.Window’s can’t be dragged out of the browsers viewport. Users with large or multiple screens will feel limited with those windows.
  • Users don’t want to have an extra window manager inside the normal operating systems window manager. Just look back to the ugly star-office approach, which we all hated.
As a consequence we decided to use native windows in Tine 2.0. However, dealing with native windows in a Javacript application turned out to be a non trivial thing. A new browser window brings a new javascipt context and we needed to find a way to bring our content into the new context. Also we needed to find a way how windows can communicate. The opener.location = opener.location from the good old Web 1.0 times obviously is not adequate any more ;-) . Thinking about offline functionality brought even more complexity to the system. When the Browser is offline, you need to create windows without any help of a server.
Solving this problem was one of the major goals in our current javascript re-factoring period. Finlay we came up with three user extensions to the ExtJS library.
  1. Ext.ux.PopupWindow which goes almost parallel to the Ext.Window
  2. Ext.ux.PopupWindowGroup which goes almost parallel to the Ext.WindowGroup
  3. Ext.ux.WindowFactory which is capable to factor Ext.Windows, Ext.ux.PopupWindows and Ext.air.NativeWindows
You can find the code in the Tine 2.0 svn repository. At the moment we have the following hard coded in our javascript bootstrap:
Tine.WindowFactory = new Ext.ux.WindowFactory({
    windowType: 'Browser'
});
If you change this to:
Tine.WindowFactory = new Ext.ux.WindowFactory({
windowType: 'Ext'
});

you’ll have a version of Tine with Ext.Windows.

     

The Air part is not tested yet, as I struggle with the hard coded ‘eval’ functions in the extjs code which break the security model of Adobe Air.

I’m not shure if we make use of Ext.Window in Tine. It may be a helpful config option for users with old browsers like IE6 which has an very slow javascript engine. When our re-factoring period has finished, we will even be able to create the windows offline.

14
Oct

Dealing with Time-Zones in Javascript

Dealing with date-time information is a complex topic in any language, as the nature of date-time information is complicated itself. One has to cope with time-zones, daylight-saving-times, and time-shifts, along with dozens of different representations.

Dealing with time-zones in particular is difficult in javascipt, as the language has no build in support for time-zone conversions in it’s Date object.

Javascripts Date object only comes with support for Local Time Zone and UTC. The Local Time Zone is defined by the Host Environment of the javascript interpreter as stated in section 15.9 of the ecma-script specification. But there is no method in the Date object to query or set this Local Time Zone.

This makes date-time computations almost impossible with the build in javascript Date object. As a way out, there a tree scenarios:

  1. Try to guess the time zone of the browser. You will find a lot of crap with goolge trying to figure out a time zone by a single time zone offset. I only found a few implementations like discussed here, which try to guess the browser time zone in correctly. The Problem with this approach is, that you would need a huge set of DST data in the client to get reliable results. And even if you know the browsers time zone, you won’t be able to let the user switch time zones, as it’s not possible to set a time zone.
  2. Write your own Date object which is time zone capable. This would presumably be the most elegant way for dealing with date-time information in javascript. However such a class would consume much data and computation time and besides having time to write it, i fear that it would have a notable impact on the applications performance.
  3. Don’t do any date-time computations in javascript. You may guess the browsers time zone to define it, but the definition itself and all date-time computations must be made in a time-zone aware system. This is the approach we chose for Tine 2.0. PHP 5.2 introduced a great time-zone aware Date class which we use for all related computations.

But even after the judgement not to use the javascript date object for date-time computations there are some difficulties to cope with.

When creating Date objects from the common ISO8601 representation like:
var t = new Date('10/14/2008 22:00:00 +05:00');
the date object substracts the GMT+5 and internally stores the number of milliseconds from 1/1/1970 in UTC to that date. This means actually the information ’10/14/2008 22:00:00 in the users time’ gets lost.
t.toString(), wich is a alias for t.toLocalString() returns:
Tue Oct 14 2008 19:00:00 GMT+0200 (CEST)
in my browser and t.toUTCString() returns:
Tue, 14 Oct 2008 17:00:00 GMT
which is correct, but not what the the protocol communication in the user time zone expects!

To really use the javascript date object as a simple value store, you must make sure to cut the time zone indicator before parsing the date.
new Date('10/14/2008 22:00:00').toString();
returns:
Tue Oct 14 2008 22:00:00 GMT+0200 (CEST)
At least the values are correct. Before sending, or at least on server side you need to cut the offset and time zone of course, as they are obviously crap in this scenario.

Taking all this into account, it’s possible to circumvent the problematic aspects of the javascript date object (we haven’t talked about its DST implementation ;-) ) and to deliver a multi time zone capable javascript application.

08
Oct

Multi Time-Zone Fix for Ext.form.DateField

When testing the multi time-zone capabilities of Tine 2.0 I came across an interesting problem with the Ext.form.DateField.

The basic form handling in Extjs in like this.

  1. Render the from (e.g. the contact edit dialog).
  2. Get a Ext.data.Record (e.g. representing a contact).
  3. Update the form with the record data: All form properties having a corresponding property in the record will be set/updated.
  4. The user does his changes in the form (e.g. updating the name).
  5. Update the record from the form values: All record properties having a corresponding property in the form will be updated with the form data.

The last step always copies all the form values into the record, regardless of which properties actually got changes by the user. Normally this is no problem, as the value only changes if the user relay did changes. But the implementation of the DateField has a problem in a multi time-zone environment.

Imagine I myself update my birthday in my contact record. This is 1979/06/05. In fact this means by birthday was from 1979/06/05 00:00:00 to 1979/06/05 23:59:59 in the time-zone Europe/Berlin.

So what Tine 2.0 stores in its database is: 1979/06/04 22:00:00 UTC cause Europe/Berlin is UTC+2 when daylight saving time is active. This means in UTC my birthday was from 1979/06/04 22:00:00 to 1979/06/05 21:59:59.

Unfortunately the Ext.dateField has no clue about time-zones or time-shifts. It just deals with dates, e.g. (Y-m-d).

So when my contact record gets updated from someone living in UTC time-zone, the DateField gets filled with 1979/06/04 22:00:00 (step 3). When user changes something and saves changes (step 4) it just return 1979/06/04 (step 5) even though the user didn’t actually change my birthday.

As result, the Tine 2.0 server sees a change in the birthday property from

1979/06/04 22:00:00 UTC to 1979/06/05 00:00:00 UTC which is obviously wrong, as this is not my correct birthday!

As a quick fix for the Ext.form.DateField we now preserve the time when the user does not change the date field. This is the fix I added to our Ext fixes code. Note, you need to include this after the Extjs library, but before your application code.

  1. /**
  2.  * fix timezone handling for date picker
  3.  *
  4.  * The getValue function always returns 00:00:00 as time. So if a form
  5.  * got filled with a date like 2008-10-01T21:00:00 the form returns
  6.  * 2008-10-01T00:00:00 although the user did not change the fieled.
  7.  *
  8.  * In a multi timezone context this is fatal! When a user in a certain
  9.  * timezone set a date (just a date and no time information), this
  10.  * means in his timezone the time range from 2008-10-01T00:00:00
  11.  * to 2008-10-01T23:59:59. _BUT_ for an other user sitting in a
  12.  * different timezone it means e.g. the time range from
  13.  * 2008-10-01T02:00:00 to 2008-10-02T21:59:59.
  14.  *
  15.  * So on the one hand we need to make shure, that the date picker
  16.  * only returns changed datetime information when the user did a
  17.  * change.
  18.  */
  19.  
  20. /**
  21.  * @private
  22.  */
  23. Ext.form.DateField.prototype.setValue = function(date){
  24.     // preserv original datetime information
  25.     this.fullDateTime = date;
  26.     Ext.form.DateField.superclass.setValue.call(this,
  27.     this.formatDate(this.parseDate(date)));
  28. };
  29.  
  30. /**
  31.  * @private
  32.  */
  33.     Ext.form.DateField.prototype.getValue = function(){
  34.     //var value = this.parseDate(Ext.form.DateField.superclass.getValue.call(this));
  35.  
  36.     // return the value that was set (has time information when unchanged in client)
  37.     // and not just the date part!
  38.     value =  this.fullDateTime;
  39.     return value || "";
  40. };
28
Aug

Spacegallery Implementation in ExtJS

Yesterday I had a short discussion with a colleague of our front-end/website team. We had a look a gallery implementation made in JQuery.  He wanted to have a similar animation like the rezise/move/fadeout animation when an image gets clicked in this gallery.

The question was how hard it would be to implement such an animation. My short answer was: “I guess this is about 5 lines of code”. Well, I have never worked with JQuery and animation in general, and after looking into the code I realized, that JQuery seems to differ conceptually a lot from ExtJS.

However a few weeks ago I roughly scanned the docs of Ext.Fx. This is a small but very powerful Effect class in ExtJS. Many people think, ExtJS is ‘just’ suited for Web-Apps with a look similar to the Tine 2.0 look. But this is not the whole truth. ExtJS is also a general purpose JS Library with also comes with great animation and effects support.

As you can see bellow, I couldn’t resist to implement a spacegallery using ExtJS. The code for all animations, not only the animation of the top Image, is just 4 Lines of code:

onImageClick: function(e, dom) {
this.imageEls[0].shift(this.fadeOutPerspectiveData);
for(var n=1; n this.imageEls[n].shift(this.perspectiveData[n-1]);
}
this.cycleStack();
},

Ok, it's a matter of interpretation if you count the single "}" line :-) .

26
Aug

First Translations for Tine 2.0

After the german translations of Tine, which are provided by the core developers team, now the first contributed translations are integrated.

We are quite glad that we already have translators for russian, bulgarian, french, italian, polish and simplified chinese even before we started to ask actively for translations.

Specially I’d like to thank Ilya Yurkovetskiy, for the russian translation and the help to locate areas where the plural forms in the templates needed to be improved.

Unlike English and German, the Russian language has 3 plural forms. The first for e.g. 1, the second for e.g. 2 and the third for e.g. 5 items of a thing.

Also the cyrillic letters help to identify strings not in the translation system yet.

I set up a language statistics page here, to track the state of each translation. After Release of the next milestone we will start a call for translations.

22
Aug

Version 0.4 of jsdoc-tk-ext

Finally, after Tine 2.0′s Milestone 2 is released, I found some time to upgrade the jsdoc-tk-ext package which now comes in version 0.4.

Thanks to contributions from the ExtJS-Forums documentation of Ext.ux classes is greatly improved. Moreover I spend some time to ease invocation of the toolkit.

The Tine 2.0 JS API Documentation got generated with a simple:
~/jsdoc$ java -jar jsrun.jar app/main.js -H='Tine 2.0 JS API Documentation' -r  ../tine20

Changes in Detail:

  • make it running with windows (thanks Sierk)
  • include return comments (thanks Sierk)
  • allow to use shortcuts for @cfg in ExtJS doc style (thanks duralabh)
  • allow to specify config options for undefined properties (thanks duralabh)
  • allow to use new config format for properties and config (thanks duralabh)
  • use exjs logo (requested by jack slocum)
  • allow to document classes which are defined into global namespace (thanks SamuraiJack1)
  • set ext template as default 
  • include a copy of extjs
  • remove dumper dependencies
  • make headline configurable
  • some code cleanup
10
May

Usability Of The Country Picker UI Element

While working on the country picker widget for Tine 2.0 I got remembered on a long discussion with a customer about the country picker in the traditional web application address book they where running.

The country selection user interface element there was a normal combo-box with 238 countries in it. If you want to select a country you have to search this alphabetical sorted list yourself. This is a quite annoying task for people working the whole day with the address book.

So they thought, it would be a tremendous amendment to make the country field a normal text field where the user just types in the country e.g. ‘Germany’. In normal operation most users only deal with only a few countries and do not need to have counties like ‘Saint Vincent and the Grenadines’.

This approach has two problems. First, If the country is a free text field, you will have typos in the data e.g. ‘Gremany’. You will miss such entries when you filter you addresses by the country ‘Germany’. Secondly, this only works if the company operates in one language, cause French employees would write ‘Allemagne’ in the field.

The worse situation is caused by limitations of an old fashioned web application. It could be solved nowadays by using up to date web techniques. Below is the current country selection we use in Tine 2.0. It’s a combination of a text field, a combo-box and a search field:

  • You could only select well defined values
  • You can perform a live search / type ahead
  • You can use it like a traditional combo-box
  • You can use the ENTER key to select, no mice input needed (please notice the fluent work flow: after pressing ENTER you can directly perform a new search)
  • You can use the COURSER keys to navigate in the results


BTW: After we noticed, that the old web address book (guess which) stores localised country names in the database, we switched the country selection to a text field as the data are messed up in any case.