suggestion for list plugin php

lke

New Member
Hi,

the php plugin for lists is a nice possibility todo something with button click.
With $statusMsg i can set the result text, but not really error messages.
My idea is: Remove the else tree in function "public function process_result($c)" at plugins/fabrik_list/php/php.php

So it is possible to use JFactory::getApplication->enqueueMessage('Message') to
generate positive or JError::raiseWarning(100,'Warnung') instead $statusMsg in php code to generate negativ messages.

Greets

Lars
 
Trouble is, list plugins are handled via AJAX, so the user wouldn't see any enqueued messages or warnings until the next page load. Which is why we use an error msg, which gets returned to the JS and popped up as an alert.

-- hugh
 
Ok, in my case the the php code was started at button press which makes automatic a page reload. So I have no problem with this solution :)

Another question:
The php plugin rendered a button at row. Give it a possibility to show the button at row depends on php code? Semilar the caneditrow plugin?
A want create buttons with additional functions but not for everyone. So when i can enter php code, which returned if a button was visible or not, I can make buttons only visible for usergroups or something.
 
I tried adding that functionality for someone else recently, can't remember the exact details, but it turned out to be not so easy, and would require some not entirely trivial surgery on the code.

It's one of those things I'd like to do, but would need someone to step up and fund it.

Re your original request, if you want to test out your suggestion and make sure that it a) works in both AJAX and non AJAX mode, and b) doesn't break backward compatibility (so it doesn't affect people already using $statusMsg in either AJAX or non AJAX mode), and let me know the result ...

-- hugh
 
Hi,

i make some tests for my sugestion:

The original code from plugins/fabrik_lists/php/php.php line 154:

PHP:
public function process_result($c)
        {
                if (isset($this->msg))
                {
                        return $this->msg;
                }
                else
                {
                        $params = $this->getParams();
                        $msg = $params->get('table_php_msg', FText::_('PLG_LIST_PHP_CODE_RUN'));
                        return $msg;
                }
        }

my idea (remove else tree):

PHP:
public function process_result($c)
        {
                if (isset($this->msg))
                {
                        return $this->msg;
                }
}

Result:
No default Message 'Code run' when $statusMsg not set.

Tests:
With ajaxify on:
$statusMsg set: Message would be show as popup​
$statusMsg not set: No Message (Code run) or something​
With ajaxify off:
$statusMsg set: Message would be show as enqueue Message in joomla​
$statusMsg not set: No Message (Code run) or something​
consequence of code remove:

Everyone which use $statusMsg have no changes or must change everything. People that not use $statusMsg doesn't get a default Message but all people have the possibility to generate Messages in different colors over the JFactory::getApplication()->enqueueMessage('Your Message', 'type') command in php-code.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top