cancel
Showing results for 
Search instead for 
Did you mean: 

Mootools javascript library and tomahawk components

dhalupa
Champ on-the-rise
Champ on-the-rise
Recently, I had a request to replace DatePicker control with some calendar control that would improve usability when it comes to handling date values. Since Alfresco is built on MyFaces implementation of JSF, logical choice was to use calendar component from tomahawk library . Unfortunately, it did not work due to the fact that page tag is creating a reference to Mootools, a javascript library which, from what I saw, is used for ajax enabled dashlets and document preview feature (anywhere else?). It is clearly stated on Mootools site that it simply does not work (neither it is their intention to make it work) with other javascript libraries namely prototype or dojo which are heavily used in tomahawk. This effectively prevents usage of tomahawk library of components.
After the above mentioned reference was removed, calendar component plugged into property sheet started to work nicely.

I am not a javascript expert, but I wonder how come that Mootools was chosen over scriptaculous web2.0 javascript library which would not prevent usage of tomahawk? is there a chance to revise this decision?

Kind regards,

Denis
14 REPLIES 14

robbiefpi
Champ in-the-making
Champ in-the-making
I don't understand.
When you say that calendar componet works nicely it means that you succeded in inserting it for alfresco dashboard?

dhalupa
Champ on-the-rise
Champ on-the-rise
As I said in above post, after you remove reference to mootols, you can use calendar component from tomahawk which renders client side pop up calendar. I do not see much sense to use it inside of datagrid but you can use it inside of property sheet instead of datepicker component. Only thing you have to do is to write and register component generator which will instantiate and return calendar component. After that you register your component generator with date property in your property sheet config.
Another thing which is possible if you turn mootols off is to use richfaces  library, but it also requires some minor changes in Authenticatication filter. If you are interested I can post here some details..

robbiefpi
Champ in-the-making
Champ in-the-making
If you are interested I can post here some details..

Thanks a lot !

I need for my intranet (my boss ask me  :roll: ) to evaluate alfresco as intranet and document management system

So spaces need to have a calendar with which every user can view calendars and events (possibly).

And naturally (as in the life's programmers)  I have a little bit of time to deploy it…  Smiley Sad  Smiley Sad

Any help it will be appreciated from me
thanks

dhalupa
Champ on-the-rise
Champ on-the-rise
I don't think that we understand each other Smiley Happy I'm talking about calendar control which replaces default Alfresco's datapicker component in poperty sheet and it's only purpose is to enter, or pick, a date value in a more user friendly manner. It has nothing to do with spaces, events and all these things you are interested in

dbaran
Champ in-the-making
Champ in-the-making
Hello dhalupa,

About usage of richfaces library, could you post your changes in Authentication filter?
We have integrated ajax4jsf in our development, and some changes in FacesHelper was required, to avoid prematurely creation of JSF view object. Is it the same changes you talk about?

dhalupa
Champ on-the-rise
Champ on-the-rise
Actually, it is Authentication helper.. I have commented out the part of code which is creating Faces context in order to get UserPreferences bean, before jsf servlet had a chance to create context. I was able to apply such simple fix  since I am not using any of ml features, but I think that the proper fix would be to move that initialization into phase listener where FacesContext reference could be obtained without hacking.


Index: C:/Java/alfresco-svn/HEAD/root/projects/web-client/source/java/org/alfresco/web/app/servlet/AuthenticationHelper.java
===================================================================
— C:/Java/alfresco-svn/HEAD/root/projects/web-client/source/java/org/alfresco/web/app/servlet/AuthenticationHelper.java   (revision 1178)
+++ C:/Java/alfresco-svn/HEAD/root/projects/web-client/source/java/org/alfresco/web/app/servlet/AuthenticationHelper.java   (working copy)
@@ -244,23 +244,24 @@
          I18NUtil.setLocale(Application.getLanguage(req.getSession()));
         
          // setup faces context
-         FacesHelper.getFacesContext(req, res, sc);
-        
-         if (loginBean != null && (loginBean.getUserPreferencesBean() != null))
-         {
-            String contentFilterLanguageStr = loginBean.getUserPreferencesBean().getContentFilterLanguage();
-            if (contentFilterLanguageStr != null)
-            {
-               // Set the locale for the method interceptor for MLText properties
-               I18NUtil.setContentLocale(I18NUtil.parseLocale(contentFilterLanguageStr));
-            }
-            else
-            {
-               // Nothing has been selected, so remove the content filter
-               I18NUtil.setContentLocale(null);
-            }
-         }
-
+         //Commented out by Denis
+//         FacesHelper.getFacesContext(req, res, sc);
+//        
+//         if (loginBean != null && (loginBean.getUserPreferencesBean() != null))
+//         {
+//            String contentFilterLanguageStr = loginBean.getUserPreferencesBean().getContentFilterLanguage();
+//            if (contentFilterLanguageStr != null)
+//            {
+//               // Set the locale for the method interceptor for MLText properties
+//               I18NUtil.setContentLocale(I18NUtil.parseLocale(contentFilterLanguageStr));
+//            }
+//            else
+//            {
+//               // Nothing has been selected, so remove the content filter
+//               I18NUtil.setContentLocale(null);
+//            }
+//         }
+         I18NUtil.setContentLocale(null); //Added
          return AuthenticationStatus.Success;
       }
    }

ebo
Champ in-the-making
Champ in-the-making
How do you turn mootools off?

rivarola
Champ on-the-rise
Champ on-the-rise
You have to modify the PageTag class to remove mootools import.

mikeh
Star Contributor
Star Contributor
..or update your .war file to remove or stub-out the mootools javascript file itself (in scripts/ajax)

Mike