Piwigo.org

You are not logged in. (Register / Login)

Announcement

#1 2011-12-18 15:43:09

mistic100
Piwigo Team
Location: Avignon (Fr)
Registered: 2008-09-27
Posts: 1440
Website

Unified message management

Hello,

I think we must modify how Piwigo gets and displays messages (infos, errors).
Currently if a page needs to display it adds it to $page['infos'] or $page['errors'], assign it to the template...

But not all pages have the necessary vars and template part, what is a shame for pugins (I've done very bad stuff in Subscribe to Comments ^^)

My idea is to add a unified messages system :
- all messages templates are moved to header.tpl
- when we need to add a message we adds it to $page['infos'] or $page['errors'] (initiliazed in common.inc.php allowing to use array_push without any test) as before
- these array are assigned to the template in page_header.php

What do you think ?

I've also a question about messages : in header.tpl there are $header_msgs and $header_notes, but the display is the same, why two arrays ?

Offline

#2 2011-12-18 16:30:10

mistic100
Piwigo Team
Location: Avignon (Fr)
Registered: 2008-09-27
Posts: 1440
Website

Re: Unified message management

After test, the display is better if messages are in the #content block, so I've put the messages template in a file messages.tpl included in ALL page (even where we don't need messages in the core)

Offline

#3 2011-12-18 19:37:55

flop25
Piwigo Team
Registered: 1970-01-01
Posts: 3369
Website

Re: Unified message management

yep it's much better if it could be a .tpl.

Could we integer also the mysql error in it ? Is there a way to catch them ? Then we would be able to filter the type of message displayed if is_admin or not


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

#4 2011-12-18 22:39:59

mistic100
Piwigo Team
Location: Avignon (Fr)
Registered: 2008-09-27
Posts: 1440
Website

Re: Unified message management

[Bugtracker, bug 2538, fixed] Make a unified messages management

well I didn't think to add fonctionnalities but rewrite the existing one

what the interest of display MySQL errors ? in most cases the engine just said there is a syntax error with an approximative location (very very approximative)
and in thoses cases the corresponding php script crashes with enough info (not less that mysql provides)




ouch I don't understand what I say ! but yeah I don't like MySQL error reporting :)

Last edited by mistic100 (2011-12-18 22:41:04)

Offline

#5 2011-12-18 22:45:10

P@t
Piwigo Team
Location: Nice
Registered: 2007-06-13
Posts: 4091
Website

Re: Unified message management

I also want to add a session variable to save info or error message to be displayed after a redirection.
Maybe this can be done throught a function...

We can also make an easy way to add dynamic message with jQuery (after an ajax request for example...)


P@t

Offline

#6 2011-12-18 22:53:22

plg
Piwigo Team
Location: Paris, France, Europe
Registered: 2002-04-05
Posts: 11713
Website

Re: Unified message management

I've reviewed the patch by mistic100 (and it was commited in [Subversion] r12764), I agree with this changes: it makes the code on gallery side equivalent to admin side, regarding errors/infos display.


Latest blog post on Piwigo.com: Piwigo 2.5 on Piwigo.com (March 7th, 2013)

Offline

#7 2011-12-18 22:53:32

mistic100
Piwigo Team
Location: Avignon (Fr)
Registered: 2008-09-27
Posts: 1440
Website

Re: Unified message management

I've duplicate what is done in admin.php http://piwigo.org/dev/changeset/12764#file2
it reads $_SESSION['page_infos']) and $_SESSION['page_errors']) vars

Offline

Board footer

Powered by FluxBB

About this website · Donate · Contact Piwigo project © 2002-2013