Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Add the ability to alterate admin UI messages
As said before, I worked on an experimental plugin to test the flexibility of the upcoming Skin package.
This plugin allow to export a page, form or style on saving.
It is easy to use callback events to add this kind of feature but I can’t find a way to inform the user that the template export failed or succeeded.
Shouldn’t we have a hook to alterate UI messages?
I guess the problem would be to ensure the message is correctly strutured (string or array using the right status), but there should be a way to achieve that… What do you think?
Last edited by NicolasGraph (2017-11-08 12:55:03)
Offline
Re: Add the ability to alterate admin UI messages
Mmmm, interesting.
If we get the callback structure right (and I haven’t forgotten about consistent callbacks) then this could be a good candidate for either appending or amending or replacing the admin messages.
It’s especially more relevant if we start permitting pre- and post- action callbacks, as you might want to abort prior to save and supply a dfifferent type of status message (warning, for example).
Any bright ideas on implementation, anyone? Without offering too much chance of breaking anything?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Add the ability to alterate admin UI messages
I’m testing the client-side announce (introduced for multiple files upload) portability to the whole admin side. One of its benefits would be the possibility to merge multiple categorized messages or to replace the existing ones with a new one. But even now you can send a custom message via pagetop()
function, or am I missing something?
Offline
Re: Add the ability to alterate admin UI messages
Yes, if you’re building an entire admin-side page, you can use pagetop()
but if you’re hooking into a save routine or something more granular in our API (e.g. form.create
) then I think you’re at the mercy of the messages the page itself throws.
Looking forward to trying out the announce changes.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Add the ability to alterate admin UI messages
Can’t you use app_mode=async
and
send_script_response(announce($message));
like we do to update partials?
Offline
Re: Add the ability to alterate admin UI messages
etc wrote #307721:
Can’t you use
app_mode=async
andsend_script_response(announce($message));...
like we do to update partials?
Maybe. Never tried it. Nicolas?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Add the ability to alterate admin UI messages
etc wrote #307721:
Can’t you use
app_mode=async
and
send_script_response(announce($message));...
like we do to update partials?
I will take a look at this and come back if I have questions (I’m not familiar with these functions), or if it work… Thanks.
Offline
Re: Add the ability to alterate admin UI messages
I tried this:
namespace Oui {
class Message
{
public function __construct()
{
register_callback(array($this, 'sendMessage'), 'page_saved');
}
public function sendMessage($event, $step)
{
send_script_response(announce(array('ERROR!', E_ERROR)));
return;
}
}
new Message();
}
but on page saving it shows that:
;
<script>
$(document).ready(function ()
{
$("#messagepane").html("<span class=\"messageflash error\" role=\"alert\" aria-live=\"assertive\"><span class=\"ui-icon ui-icon-alert\"><\/span> ERROR! <a class=\"close\" role=\"button\" title=\"Close\" aria-label=\"Close\" href=\"#close\">×<\/a><\/span>");
});
</script>
<noscript>
<span class="messageflash error" role="alert" aria-live="assertive"><span class="ui-icon ui-icon-alert"></span> ERROR! <a class="close" role="button" title="Close" aria-label="Close" href="#close">×</a></span>
</noscript>;
<!DOCTYPE html>
…
I guess I’m missing something…
Last edited by NicolasGraph (2017-11-09 11:06:16)
Offline
Re: Add the ability to alterate admin UI messages
Try to post to the page saving URL with app_mode=async
parameter.
Offline
Re: Add the ability to alterate admin UI messages
etc wrote #307733:
Try to post to the page saving URL with
app_mode=async
parameter.
I changed the event to page_updated
which, I think, is send in async mode. Shouldn’t It work?
As far as I tried, nothing happens. I mean nothing more than the update.
Offline
Re: Add the ability to alterate admin UI messages
What is the server response, still the same?
Offline
Offline