Patch: Zend_Dojo_View_Helper_Editor

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Patch: Zend_Dojo_View_Helper_Editor

SpiffyJr
There is a LONG standing issue with the Zend view helper using textarea with dijit.Editor. Another issue is when you submit the editor some browsers submit an array (IE/Chrome) and others submit a text string (FF). I've implemented a patch on my local sandbox which seems to have fixed the issue but I wanted to get some input before submitting a bug report (I've never done one before).

See the attached file for more information.

Thanks,

Kyle Spraggs (theman@spiffyjr.me)
http://www.spiffyjr.me

attachment: Editor.php

Kyle S
blogs @ www.spiffyjr.me
github @ www.github.com/spiffyjr
follow @ www.twitter.com/spiffyjr
Reply | Threaded
Open this post in threaded view
|

Re: Patch: Zend_Dojo_View_Helper_Editor

weierophinney
Administrator
-- Kyle Spraggs <[hidden email]> wrote
(on Friday, 13 November 2009, 08:40 AM -0800):
> There is a LONG standing issue with the Zend view helper using textarea with
> dijit.Editor. Another issue is when you submit the editor some browsers
> submit an array (IE/Chrome) and others submit a text string (FF). I've
> implemented a patch on my local sandbox which seems to have fixed the issue
> but I wanted to get some input before submitting a bug report (I've never
> done one before).
>
> See the attached file for more information.

I already have this on my short-list of issues to look at for next
week's bug hunt days -- but thanks for bumping it.

(And yes, there's at least one issue in the tracker regarding it
already.)

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
Reply | Threaded
Open this post in threaded view
|

Re: Patch: Zend_Dojo_View_Helper_Editor

SpiffyJr

weierophinney wrote
I already have this on my short-list of issues to look at for next
week's bug hunt days -- but thanks for bumping it.

(And yes, there's at least one issue in the tracker regarding it
already.)

--
Matthew Weier O'Phinney
Project Lead            | matthew@zend.com
Zend Framework          | http://framework.zend.com/
The original file I posted had a few issues that I recently resolved. Below should have everything needed for anyone wanting a quick fix while waiting for Matthew's official update.  Note: The class now extends Zend_Dojo_View_Helper_Dijit instead of Zend_Dojo_View_Helper_Textarea.

    /**
     * dijit.Editor
     *
     * @param  string $id
     * @param  string $value
     * @param  array $params
     * @param  array $attribs
     * @return string
     */
    public function editor($id, $value = null, $params = array(), $attribs = array())
    {
        $hiddenName = $id;
        if (array_key_exists('id', $attribs)) {
            $hiddenId = $attribs['id'];
        } else {
            $hiddenId = $hiddenName;
        }
        $hiddenId = $this->_normalizeId($hiddenId);

        $dijitName = $this->_normalizeEditorName($hiddenName);
        $divId   = $hiddenId . '-Editor';

        $hiddenAttribs = array(
            'id'    => $hiddenId,
            'name'  => $hiddenName,
            'value' => $value,
            'type'  => 'hidden',
        );
        $attribs['id'] = $divId;
       
        $this->_createGetParentFormFunction();
        $this->_createEditorOnSubmit($hiddenId, $divId);

        $html = '<input' . $this->_htmlAttribs($hiddenAttribs) . $this->getClosingBracket()
              . $this->_createLayoutContainer($divId, $value, $params, $attribs);

        return $html;
    }
Kyle S
blogs @ www.spiffyjr.me
github @ www.github.com/spiffyjr
follow @ www.twitter.com/spiffyjr