Tuesday, August 18, 2009

Ext JS and the magic designer or .... not

I was just reading this on ExtJS blog and I particulary disliked the part about the designer ....

Constructing your interfaces in code will be a thing of the past. We are releasing a Designer Preview that will allow you to experiment with the designer interface and to explore how configs affect your layout. Soon, you will be able to build your application components using base Ext components and Certified User Extensions.

Code generation is currently not available. Our intentions are to charge a fee for this service and to enable our community to create and sell their creations on our marketplace. Our goals are lofty. We want to be the iTunes of Web App Development.

I really love ExtJS and have been using extensively at work since the version 2.x. I must say I was really disappointed when I read the part about having the designer been available for a "fee". I was waiting for that designer for a long time and seems it would never happen.

ExtJS is pretty well documented but is still not easily accessible to new programmer, I would have loved giving that tool to my boss, for him to make interface so we can design interfaces easily, the whole RAD designer would have give a century of advance to ExtJS on Dojo/JQuery.

I am not really surprised about that move, few month after the whole License crisis .... but I must say the Ext Team really wants to make money and starting to piss me off even if I really like what they are doing.

My last comment would be, I am not sure who gonna sell/buy already made interfaces on an ExtJS component store. ExtJS normally require only few hours to build your own component .... so kind of weird business plan ...

Anyway let's see how the community like to pay to publish interfaces ....

Sunday, June 28, 2009

highlight not validated fields with a decorator

I started using the Zend Framework few weeks ago, finally finished my first project using it at work last week. I am quiet happy with the framework and really enjoyed coding this application, I have made bunch of class that I found missing in the framework.

One of them was to be able to add a specific class when some fields in a form doesn't validate, I use to highlight fields when the user forgot to input them in my previous projects.

He wasn't so easy to code that decorator because in the framework decorator doesn't seem to be able to add some attributes to the field. Normal decorators can append of prepend some content but not change options of the fields. Here the hack I have been doing to achieve my goal.

require_once 'Zend/Form/Decorator/Abstract.php';
* This decorator add a decorator which add a custom class to the input
* @author olivier

class Trust_Form_Decorator_ClassErrors extends Zend_Form_Decorator_Abstract{

 public function render($content)
     $element = $this->getElement();
     if(!$element instanceof Zend_Form_Element_Password &&
        !$element instanceof Zend_Form_Element_Text &&
        !$element instanceof Zend_Form_Element_Textarea &&
        !$element instanceof Trust_Form_Element_Telephone ){
         return $content;   
     $view    = $element->getView();
     if (null === $view) {
         return $content;
     $attribs   = $element->getAttribs();
     $errors = $element->getMessages();
     if (empty($errors)) {
         return $content;

         $errorClass = $this->getOption('class');
     } else {
         $errorClass = 'customError';
     if($element instanceof Zend_Form_Element_Password ||
        $element instanceof Zend_Form_Element_Text ||
        $element instanceof Trust_Form_Element_Telephone ){
            $tag = 'input';
     } else {
         $tag = 'textarea';
         $content = preg_replace('/<'.$tag.'([^>]*)class="[^"]*"([^>]*)>/', '<'.$tag.' class="' . $errorClass . ' ' . $attribs['class'] . '"$1 $2>', $content);
     } else {
         $content = preg_replace('/<'.$tag.'([^>]*)([^>]*)>/', '<'.$tag.' class="' . $errorClass .'"$1>', $content);
     return $content;

This code add a class "customError" (or any name you specified in option) to the field if it didn't validate

Monday, November 24, 2008

introduction ....

Let's say the hello world of the blog is always the post to present yourself and tell everyone what you think you are going to do with this blog .... So since I am not original at all, I will start by introducing myself.
So I am Vanessa, I am a French 20 years old hot chick, 1'70, 90 cup D and I am looking desperately for a man!
The last line was an attempt of SEO .... just to get some page view. No without joking, I am a French male of 27 years old. I live and work in Japan since 2,5 years. I am a system administrator, nothing really funny but I enjoy it. I am also doing some web development, mainly some PHP/MYSQL. I won't talk about my work in this blog since I am not working for google or IBM making the new genuis piece of software. My company is an usual company with usual IT needs so I don't make huge systems only Content Mananagement things ... Some of you might wonder why I am not blogging in French after all wouldn't be more easy? The quick answer is my written french is really poor so I feel more confident about my English. I know that's a bit weird. Last but not least, what all this blog is about ???? Basically, my geeky comments like gaming/programming/OS/bullshit and the more interesting part for non geeky my comment about Japan and how my life is down here. I hope you are going to love it! maybe!