Topic: Graphical submit buttons with pnForm
ntward
avatar
Freshman
Freshman
Posts: 37

Posted:
29.Jan 2007 - 04:48

For GUI consistency I'm sure people will want to use those nice new graphical buttons in their .8 modules.
Here is a plugin that should do the trick.
Note: Although it works for my purposes, it may contain bugs. It is basically a munge of the pnRender plugins function.pnbutton.php and function.pnformbutton.php

Code removed, see later posts.

I hope that someone else finds this useful.
Cheers



edited by: ntward, Feb 21, 2007 - 10:08 AM
AmmoDump

Team Member
Team Member
Posts: 3024

Posted:
29.Jan 2007 - 06:04

Nice. You should package it and release it in the 'plugins' section.

--
David Pahl
Zikula Support Team
ntward
avatar
Freshman
Freshman
Posts: 37

Posted:
29.Jan 2007 - 18:41

Ah, I hadn't seen the plugins section. Oops.

Okay, we'll see.

Cheers
JørnWildt
avatar
Helper
Helper
Posts: 245

Posted:
7.Feb 2007 - 13:40

Please note that pnForms already contains a pnFormImageButton icon_cool
ntward
avatar
Freshman
Freshman
Posts: 37

Posted:
9.Feb 2007 - 17:41

So it does, the SVN version I was using at the time didn't. However, their style isn't consistent with the other graphical buttons.

Does pnForms have anything similar to the selector_category plugin? I've made something similar but...



edited by: ntward, Feb 10, 2007 - 01:42 PM
JørnWildt
avatar
Helper
Helper
Posts: 245

Posted:
10.Feb 2007 - 22:28

Quote

Does pnForms have anything similar to the selector_category plugin? I've made something similar but...


No, unfortunately not, it should have although.
ntward
avatar
Freshman
Freshman
Posts: 37

Posted:
21.Feb 2007 - 15:07

Should I put it in the feature requests?

As the above code was shocking, the following is simpler:
Just replae the line

Code

$result = "<input type=\"image\" name=\"$fullName\" title=\"$text\" alt=\"$text\" value=\"$text\" src=\"$imageUrl\"$onclickHtml{$attributes}/>";

with

Code

$result = "<button type=\"$type\" name=\"$fullName\" title=\"$text\" $onclickHtml{$attributes}><img src=\"$imageUrl\" alt=\"$text\" /></button>";


and replace the function decode() with

Code

return $result;
    }


    function decode(&$render)
    {
        $fullName = $this->id . '_' . $this->commandName;

        if (isset($_POST[$fullName]))
        {
            $args = array('commandName' => $this->commandName,
                          'commandArgument' => $this->commandArgument);
            if (!empty($this->onCommand))
                if ($render->pnFormRaiseEvent($this->onCommand, $args) === false)
                    return false;
        }

        return true;
    }
}

Although this won't give you click coords. Perhaps this could also be included as a seperate plugin?

pnForms is really good, thank a lot!
JørnWildt
avatar
Helper
Helper
Posts: 245

Posted:
21.Feb 2007 - 20:03

As you say yourself then you won't get click coords - which can be important for someone. So I would say you should add it as a feature request - then we can make a specialized plugin or parameterize the original pnFormButton. I think the pnFormImageButton should stay as it is.
ntward
avatar
Freshman
Freshman
Posts: 37

Posted:
22.Feb 2007 - 17:37

Hi Jørn,
Have added the category selector to the feature requests. The image button was a bit of a wild goose chase really - I've finally got CSS to work so that they look the same - I had previously been thrown by one of the comments in the plugin. Anyway, it's all sorted icon_smile
bones12
avatar
Freshman
Freshman
Posts: 3

Posted:
20.Jun 2007 - 18:00

hi, @Jørn is there a progress in work with the pnformplugin for categories?? Our CalendarModule need it very much.

mfg bones
JørnWildt
avatar
Helper
Helper
Posts: 245

Posted:
21.Jun 2007 - 01:30

No progress so far (but if you keep popping up with a reminder I probably will fix it ... some day) icon_smile
bones12
avatar
Freshman
Freshman
Posts: 3

Posted:
21.Jun 2007 - 02:12

Jorn, first a big fat please, second a reason. We are working on a calendar for PN. Take a look http://www.firmennetz-usedom.de here. And third all ohter Developer would also have a thank you for you.
Is it bad english?? Do you understand me?? icon_biggrin icon_biggrin
JørnWildt
avatar
Helper
Helper
Posts: 245

Posted:
21.Jun 2007 - 17:03

@bones12: sorry, I have to prioritize my time, I just don't have 48 hours a day. So right now it's Mediashare and PN .8 core *bugfixes*
bones12
avatar
Freshman
Freshman
Posts: 3

Posted:
21.Jun 2007 - 17:48

ok thanks, i make a popup reminder in 4 weeks icon_cool

mfg bones