P4A 3 massive commit, cleaning is started

Let’s start highlighting the most important parts of this huge commit:

  • P4A system messages were introduced, now from everywhere in your application you can simply do p4a::singleton()->message(“this is a message”) and your text will be printed to the user with a nice floating panel that will disappear after a few seconds. Now you won’t have to instance P4A_Message anymore and you won’t have the scrolling effect hat P4A_Message has, your mask will remain in the same exact position and the messages will scroll down and disappear. This new feature allows you to output multiple messages, not only one, they’re managed as a queue and they also work during an ajax call.
  • numbers/date formatting issue is finally over. Using P4A < 3 was very hard to create a custom formatter for numers and dates, now when P4A_Field is going to execute a format (or normalize) operation, the onFormat (or onNormalize) event is fired. When you want to do custom formatting/normalization simply intercept the new events and, within your interceptor method, return the formatted or normalized values.
  • P4A now autodetecs the number of decimals from database and uses it within the formatting/normalizing routines by default
  • cleaning is started, some methods/classes/files were dropped or renamed, we need to provide the best API possible, thus we’ve to clean out some old things are give anything the right name to let coders understand everything the easy way

And now the complete changelog for this commit:

– P4A_DB::setSelect() was removed
– P4A_DB_Source and P4A_Data_Source were php5ized
– P4A_DB_Source::__sleep() was turned into __wakeup()
– P4A_Data_Field::setSchema() and getSchema() methods were added
– P4A_DB_Source::getFieldName() now returns “schema.table.field” and can accept “schema.table.field” as a param
– P4A_DB::getLikeOperator() and setLikeOperator() methods were dropped, they were not flexible enough to handle all DB insensitive “like” syntax
– P4A_DB::getCaseInsensitiveLikeSQL() method was added
– P4A_Field::setFormat(), unsetFormat(), cleanNewValue() methods were removed
– P4A_Object::actionHandler() methods now supports unlimited params instead of only one
– P4A_Field now triggers onFormat and onNormalize events you can intercept to do custom format/normalize (your method must return the formatted/normalized value)
– P4A_Field::unformat() method was renamed to normalize()
– P4A_Field::getUnformattedNewValue() was renamed to getNormalizedNewValue()
– P4A_Data_Field::setNumOfDecimals() and getNumOfDecimals() methods were added
– P4A_Field::createDataField() methods now automatically calls P4A_Data_Field::setNumOfDecimals() setting the number of decimals detected from the DB structure
– P4A_I18N::format() method now has a third param “num_of_decimals”, used only if type is float or decimal
– P4A_Field::format() method now uses the P4A_Data_Field->getNumOfDecimals() to automatically format numbers the most coherent way
– P4A::message() method was added, you can use it to print out messages to users without having to instance any P4A_Message
– P4A::getMessages() method was added to read and clean the messages queue
– P4A::getMessages() method is now used to print out messages to users in a nice way
– P4A_Field::setFormatted() and unsetFormatted() methods were removed, now you can use only isFormatted(true/false)
– P4A_Field::getStringValue() method was removed
– P4A_Standard_Toolbar strange behaviour that automatically disables some buttons one certain conditions was removed
– P4A_Standard_Toolbar was renamed to P4A_Full_Toolbar
– P4A_AUTO_MAXLENGTH constant was removed because its feauture was troubleful
– P4A_Field::getAutoMaxLength() method was removed
– include.php file content was moved to p4a.php and include.php file was removed
– config.php file was renamed to constants.php, config makes users think they can change it but it should never be modified

My TODO list is changing so fast that I’m not goin’ to post it now, anyway we all know the most important tasks… :)
See you very soon!

4 thoughts on “P4A 3 massive commit, cleaning is started

  1. Martin

    your p4a framework is the best i ever use to build web apps.
    where will we see the first beta release of p4a 3?

  2. Fabrizio Balliano Post author

    @Martin: thank you very much! I think we could release a preview in 2 months but I think that a final release could not be out before 4 months. All depends on ohw much work I’ll have to handle in the next weeks :-)

  3. BES

    P4A system messages sound great! Something I look forward to, as I want to inform logged in users when the system is shutting down for maintenance, upgrades, etc.

  4. Fabrizio Balliano Post author

    @BES: system messages are messages you can output from anywhere in your app, but not tied to the underlying operating system, check 2.99 release to check out what system messages are (look at products_catalogue, it uses system messages on the login screeen, they’re the fading alert you’ll see)

Leave a Reply

Your email address will not be published. Required fields are marked *