[geeklog-devel] Controls in GL2

Tony Bibbs tony at tonybibbs.com
Tue Dec 21 16:14:02 EST 2004


Oh yeah (short memory).  Anyway, here's the flexy snippet to populate a 
drop down:

$this->getDropDown('getAllCloudCover', 'HlHunt->cloudCoverId', ''
            , $this->hunt->getCloudCoverId(),'lovId', 'shortName');

That's a function on one of the base views I wrote which gets translated 
to this:

protected function getDropDown($dropDownName, $htmlFieldName, $queryArgs 
= '' , $setValue = ''
        , $idAttribute = '', $displayAttribute = '')
    {
        $resultArray = array();
        $dao = DAOFactory::getDAO();
        if (is_array($queryArgs) AND (count($queryArgs) > 0)) {
            $objArray = $dao->find($dropDownName, $queryArgs);
        } else {
            $objArray = $dao->find($dropDownName);
        }
        $idGetMethod = 'get' . ucwords($idAttribute);
        $displayGetMethod = 'get' . ucwords($displayAttribute);
        foreach ($objArray as $curObj) {
            $resultArray[$curObj->$idGetMethod()] = 
$curObj->$displayGetMethod();
        }
        $this->flexyElements[$htmlFieldName] = new 
HTML_Template_Flexy_Element;
        $this->flexyElements[$htmlFieldName]->setOptions($resultArray);
        if (!empty($setValue)) {
            $this->flexyElements[$htmlFieldName]->setValue($setValue);
        }
    }

Here's the actual field in the flexy template:

<select name="HlHunt->cloudCoverId" tabindex="30"></select>

Seems like a lot of code but since it all gets compiled by flexy, its 
quite fast.

--Tony

Blaine Lang wrote:

>Tony wrote:
>  
>
>>I have an example of this one or more of the views in the sample code that 
>>you and Dirk are yet to get working
>>    
>>
>(sorry, shameless dig).
>
>Are you referring to the Hunting Log?
>Both Dirk and I got that running after you released the version that had 
>better control over the Paths.
>We both replied to the list on this - I still had the Windows issue with a ; 
>instead of a : in the include_path.
>
>Those forms were pretty basic (by design I know).
>
>Blaine
>----- Original Message ----- 
>From: "Tony Bibbs" <tony at tonybibbs.com>
>To: <geeklog-devel at lists.geeklog.net>
>Sent: Tuesday, December 21, 2004 3:22 PM
>Subject: Re: [geeklog-devel] Controls in GL2
>
>
>Blaine Lang wrote:
>
>  
>
>>Tony,
>>
>>I personally am using more JS all the time for form validation and if GL2 
>>is
>>going to be positioned for corporate use as well then JS support is more
>>then likely well supported in their browsers. We can also look to consider
>>looking at IE7 https://sourceforge.net/projects/ie7/
>>
>>
>>    
>>
>Inserting client-side JS for validation shouldn't be a problem.  I was
>more concerned with JS in controls (i.e. drop down calendar)
>
>  
>
>>I like the idea of having re-usable functions for generating listboxes for
>>example. There is always a lot of common code to generate the HTML for the
>>list.
>>
>>
>>    
>>
>Flexy includes most if not all the functions for generating standard
>HTML controls.  I'm more after customized versions of controls (date
>control, time control, editor controls, etc)
>
>  
>
>>Date fields as well with a drop down calendar are nice - I use that often
>>now.
>>
>>
>>    
>>
>Yeah, I agree, this is more the type of scenario I was getting at.
>
>  
>
>>The other idea is to implement PEAR::HTML_QuickForm.
>>
>>We would just need to allow developers to fully extend the elements easily
>>
>>    
>>
>Actually Flexy used QuickForm for a while and then got rid of it.  Quick
>form was more for implementing entire forms via PHP code and wasn't
>really intended or use in template engines.  Flexy allows you to stub
>out, for example, your list box in the template and the code that
>generates it is in the view.  I have an example of this one or more of
>the views in the sample code that you and Dirk are yet to get working
>(sorry, shameless dig).
>
>--Tony
>
>_______________________________________________
>geeklog-devel mailing list
>geeklog-devel at lists.geeklog.net
>http://lists.geeklog.net/listinfo/geeklog-devel 
>
>_______________________________________________
>geeklog-devel mailing list
>geeklog-devel at lists.geeklog.net
>http://lists.geeklog.net/listinfo/geeklog-devel
>  
>




More information about the geeklog-devel mailing list