June 2006


The highligh point of this weekly report is that I became a dojo committer: several bug fixes and enhancement to the dojo code base which are useful for the Enhanced Editor have been merged into the svn, which include:

  • fixed ticket #1018: Multiple Editor2 instances do not work properly in Firefox (svn r4498)
  • Added additional utility functions for manipulating selections: dojo.html.selection (svn r4499)
  • Added support for using the functions in dojo.dom and dojo.html with different window and document objects, allowing the functions to work in frames, etc. (svn r4522)
  • fixed ticket #956: make dojo.body(): document.body doesn’t work for XHTML, and dojo.html.body causes circular dependencies (svn r4525, r4526 and r4543)
  • fixed ticket #1034: move iframeContentWindow/ContentDocument out of dojo.io and 2 more APIs for dojo.html (svn r4531)
  • fixed ticket #1035: Support for Embedded iframes in PopupMenu2 (svn r4536, r4538, r4540 and r4538)
In addition, one other related ticket was fixed:
  • fixed ticket #1017: Make ComboBox autocompletion work for asian languages (svn r4508 and r4510)
My plan for the following week includes:
  • fix ticket #931: Editor2: undo doesn’t work (IE), and related ActiveX issue in IE
  • fix ticket #1037: combobox open outside of pane
  • start to implement ticket #1046: Remove hardcoded event handlers in the Editor2 and Editor2Toolbar to make them extensible
  • fix ticket #1042: FormatBlock of Editor2 in ActiveX mode does not work (may be delayed for later consideration)
After discussion with Alex and Paul separately, and taking account of other feedbacks, the new toolbar in the enhanced editor will be template based for speed concerns. In addition, more native dojo widget will be used in the new toolbar.

After about 10 patches I submitted merged into dojo svn trunk by other dojo developers, yesterday I successfully obtained my committer privilege. Alex and Bill both reminded me that when committing a patch from others, I shall make sure that the author has already filed a CLA with dojo foundation

I have to check out dojo svn from a different address to have write access:

svn co svn+ssh://liucougar@svn.dojotoolkit.org/var/src/dojo/trunk dojo

Finally, I can commit to dojo svn myself :). As suggested, I will consult the first two or so Editor2 related modifications with Paul before committing. I am also going to solve ticket #1037 and Bill would review it.

When planning for how to improve the Editor2 widget, I noted several concerns about the current implementation:

  • Editor2Toolbar hard-codes all the available command buttons and the event handlers for them. This is particularly an issue if we want to make it extensible. In addition, context menu is also planned, so the event handlers should not be incorporated in the Editor2Toolbar widget.
  • Another Editor2Toolbar widget related concerns is that, the layout is given in a template file, which again hard codes the event handlers.
  • Widget Editor2 also suffers from the same issue. In addition, it checks all available command states in updateToolbar() which is not necessary when only a portion of them is actually used in a toolbar.

The following is my plan to tackle them:

  • In Editor2, introduce a new variable to hold the current focused instance of Editor2 (such as dojo.widget.html._CurrentEditor2Instance) which is set when focuses in a Editor and unset when blurs
  • Introduce a command class (EditorCommand), which capsulates the information about a command: state (disabled/highlight on/highlight off), how to execute the command. The class for the built-in commands is something like this: (this principle is borrowed from FCKeditor)
    var dojo.widget.html.Editor2NamedCommand = function( commandName )
    {
            this.Name = commandName ;
    }
    
    dojo.widget.html.Editor2NamedCommand.prototype.Execute = function()
    {
            dojo.widget.html._CurrentEditor2Instance.execCommand( this.Name ) ;
    }
    
    dojo.widget.html.Editor2NamedCommand.prototype.GetState = function()
    {
            return dojo.widget.html._CurrentEditor2Instance.queryCommandState( this.Name ) ;
    }
  • Rewrite Editor2 to make use of EditorCommand
  • Rewrite Editor2Toolbar so that it makes use of EditorCommand as well. There are two possibilities to do this:
    • use template support as it is, so if the users want to customize the toolbar he have to modify the html template
    • generate the toolbar pragmatically (as in FCKeditor): toolbar can be configed in an option of an array of strings specifying which buttons to use and the layout, rather then in the html template. This is not as flexible as template files, however I do not think most users are interested to modify the more complex template file instead of an simple option in the editor. As it is done in FCKeditor, theme is also possible in this manner: the theme has to comply with a specified format.
Further plan includes introducing an Action command which wraps the apperance and shortcuts for a command.

I have been really busy lately, so I hadn’t noticed that FCKeditor 2.3 finaly was released a week ago until yesterday.

It seems it is now the time for a new release of SJSD which supports the latest FCKeditor: The svn trunk of SJSD supports 2.3 already, but no public release yet. I will try to make a release if I can find some time to sort it out.

In addition, a new patched EditMonkey would be nice as well, but as I haven’t ported the FCKeditor plugin for wordpress to FCKeditor 2.3 yet, it requires much more time, which I probably won’t do until some time later when I am not so occupied.

Just noticed Alice’s blog about " life is tricky". I do not know why but the " Trial and error" method come across my mind after I read it. Quote from the wiki page:

Trial and error has a number of features:
  • solution-oriented: trial and error makes no attempt to discover why a solution works, merely that it is a solution.
  • problem-specific: trial and error makes no attempt to generalise a solution to other problems.
  • non-optimal: trial and error is an attempt to find a solution, not all solutions, and not the best solution.
  • needs little knowledge: trial and error can proceed where there is little or no knowledge of the subject.
(more…)

I promised someone in IRC one month ago to release a new version of skim soon. However I only managed to release it yesterday. Sorry for the delay. Please find the
news in SCIM website.

One of my friends asked me to help install movie players in his computer so he can watch movies. The computer is his company’s, and some limitation is imposed. The most annoying one is that the property of local network connection is disabled! I never thought this is possible under windows XP. Anyway, as I need to copy some files over, so I have to setup the connection between my laptop and his. The workaround is to set my IP address to something in the same C sub net as his computer, such as 169.254.220.235.

(more…)

In order to implement advanced features/missing features of the proposed enhanced Editor widget, the core of the dojo packages need to be extended. One of the most fundamental one is the impossibility of using dojo from another window/document except the window which loads it.

In MochiKit the concept of " context " is introduced. It provides 4 APIs to handle context (see the table below).

Signature Description
withWindow(win, func) Execute function func in the context of window win (and with document win.document)
withDocument(doc, …) Execute function func in the context of document doc
currentWindow() Retrieve the current window in use
currentDocument() Retrieve the current document in use

For example, creating DOM nodes in a child window in MochiKit is like this:

withWindow(child, function () {
    var doc = currentDocument();
    appendChildNodes(doc.body, H1(null, "This is in the child!"));
});

Paul suggested to borrow this API to dojo, so we can do something like this:

dojo.html.withWindow(child, function () {
    var doc = dojo.html.currentDocument();
    var h1 = doc.createElement('H1');
    h1.appendChild(doc.createTextElement('This is in the child!'));
    dojo.html.body().appendChild(h1);
}); 

Alex consider this would lead to "error- prone usage". I agree with that. However, as I need this functionality for the Editor, so we have to come up a better idea or stick with this syntax.

Yesterday, I finally received the "Google Analytics Invitation Code" from google. Google Analytics "tells you everything you want to know about how your visitors found you and how they interact with your site. You’ll be able to focus your marketing resources on campaigns and initiatives that deliver ROI, and improve your site to convert more visitors." However it is "invitation only" due to high demand. I applied several days ago and was surprised to receive it so soon.

Anyway I set it up for SCIM web site and this blog.

Today, when I looked at the analytics report in the admin interface, I was quite shocked by the features Google Analytics provides: besides the normal statstics available in open source web log stats analyzer, such as awstats, it can also show where your visitors come from in a world map (as the one you can see in the right column of this blog, but more powerful and completely free). One of another cool features is to show your page with a image associated to each internal link to indicate how many times it is clicked.

Although the intended primary use case of Google Analytics is to track and improve google adword performance for customs, google provides it free of charge to normal users as well. Thanks go to google, again ;)