» Agavi Tip: Checking Validation Results
Agavi Tip: Checking Validation Results
Normally when an input validator fails you’ll just want to show the form again and let FormPopulationFilter do its magic (you do know you can it have re-populate the form and inject error messages into the form, don’t you?-). But occasionally you want to decide the next move based on what validator failed. With Agavi 1.0 getting validation incidents of a named validator is this simple:
public function handleError(AgaviRequestDataHolder $rd)
{
$vm = $this->container->getValidationManager();
if (count($vm->getReport()->getValidatorResult('my_special_validator')->getIncidents())) {
return 'CriticalError';
}
else {
return 'Error';
}
}
Note: that AgaviValidationValidatorResult was missing from the core autoload.xml in 1.0 Beta 6. This has been fixed in the SVN If you aren’t using the bleeding edge version add the following line to your
config/autoload.xml.
<autoload name="AgaviValidationValidatorResult">%core.agavi_dir%/validator/AgaviValidationValidatorResult.class.php</autoload>
Agavi Debug Tools now supports Propel query logging (both FirePHP and HTML output). Just configure Propel to use DebugPDO and AdtFilter to use AdtPropelDataSource. Nothing else required.
» Agavi 1.0.0 Beta 6
Agavi 1.0.0 Beta 6 - Even More Secure
Default: Strict Validation ALWAYS
Agavi has a very special input validation system which, by default, will not let your application use any unvalidated input data. And this doesn’t mean only POST or GET parameters in HTTP world but also cookies and headers. Remember, those too are user input and must be considered insecure.
This strict validation mode has been the default setting for production environment for quite some time already but after Agavi was blamed for somebody’s poor input validation it was made default for development environments too. It had already been discussed earlier because different defaults for different environments was sometimes confusing and caused applications to break when moved to production.
Production-ready Exception Templates
Because people seem to be too lazy to configure exception templates for production use a new set of default templates was added to Agavi 1.0.0 Beta 6.
Download Agavi: http://www.agavi.org/download
Thanks to Harald “digitarald” Kirschner ADT’s FirePHP output is now 174% nicer. And a few bugs was fixed too. Check out ADT at http://adt.projectbin.org/.
» Kübler-Ross Model
Five Steps to Agile Development
- Denial
- Anger
- Bargaining
- Depression
- Acceptance
Elisabeth Kübler-Ross’ Five Stages of Grief describes how people handle grief and tragedy, especially when diagnosed with a terminal illness. Apparently these also apply to agile development and user experience practice :D
Originally blogged/linked by http://agileweb.org/.
» Happy Birthday to Me
28 (0x1c) years today.
» How to Enable Syntax Highlighting in Tumblr
How to Enable Syntax Highlighting in Tumblr
It’s alwasy nicer to read code snippets with a proper syntax highlighting but unfortunately Tumblr, although used by many code monkeys, doesn’t support this. It is however pretty simple to add syntax highlighting to Tumblr. All you need is a Javascript library (you have several to choose from) and a bit of Tumblr template editing. You of course also need a web host for these additional Javascript and CSS files.
Prerequisites
- Web host for a few additional Javascript and CSS files. You cannot upload files to Tumblr.
- Custom Tumblr template. You need to add a few lines of HTML code into your template.
SHJS - Syntax Highlighting in JavaScript
From all the alternatives Google found for me my choice was SHJS. It seemed simple enough.
1. Install SHJS
Just upload the SHJS files to your web host.
2. Edit Your Template
SHJS requires one main Javascript file plus one for each syntax you want to use. In the example only PHP syntax is loaded. You also need to load a CSS file. And the final thing to add is the onload call to body.
<head>
...
<script type="text/javascript"
src="http://mydomain.tld/blog_resources/sh_main.js"></script>
<script type="text/javascript"
src="http://mydomain.tld/blog_resources/lang/sh_php.js"></script>
<link type="text/css" rel="stylesheet"
href="http://mydomain.tld/blog_resources/css/sh_nedit.css">
</head>
<body onload="sh_highlightDocument();">
3. Start Showing off Your Mad Coding Skilz
SHJS automatically parses code wrapped inside <pre>. Use special class identifiers to tell it what syntax highlighting to use. Refer to SHJS documentation for available syntaxes/class names.
<pre class="sh_php">
$foo = new MyClass('string', array(123, 456));
</pre>
» ADT Agavi Debug Tools
I’ve released a first public version of a debug toolbar for Agavi. It supports traditional HTML output but you can also use it with FirePHP - extremely helpful when developing AJAX stuff with Agavi. Check it out at http://adt.projectbin.org/.
» Hans explains what is wrong with PHP
(via wombert)
I just had to reblog this for two reasons - I wanted to learn how rebloging works with Tumblr AND BECAUSE HE IS SO RIGHT…
» http://www.camilla.fi/
Just finished upgrading my wife’s site. The site is of course built with Agavi :) English translation is almost ready but we decided to release the site without it for now.
