[Phpmyadmin-devel] Re: Input Transformation System

Kyle Maxwell kyle at efactormedia.com
Thu Nov 18 14:58:01 CET 2004


Hi,
I'd like to work on the solution to this.  Perhaps one of the higher-ups 
would like to give me direction on how best to do this, particularly 
with what additional fields would go in the PMA database, where to put 
the transform scripts, what naming conventions you'd prefer, etc.

If it was up to me, I'd just work within the browser transformation and 
transformation options framework.   I would implement transforms on a 
field-by-field basis, independant of the current mime-type 
considerations. I'd have a folder called transforms, and inside it I'd have:

--- <transform-name>_edit.transform.php ---

function <transform-name>_edit($field_name, $field_value)
{
    echo("...some sort of input field...");
}

--- <transform-name>_validate.transform.php ---

function <transform-name>_validate ($field_name)
{
    $field_value = $_POST[$field_name];

   //Mess with the data some....

    if($valid)
    {
       return $modified_field_value;
    }
    else
    {
       return "PMA_error: " . $error_string;
       //or maybe throw exception
    }
}

--- <transform-name>_browse.transform.php ---

function <transform-name>_browse($field_name, $field_value)
{
    echo("...some representation of the data...");
}

Omitting one of the scripts would cause PMA to fall back on the 
default.  Rather than displaying mime-types in the browser 
transformation dropdown box, I'd put a list of the <transform-name>'s.

Naturally, this is a break from the old way of doing things 
(mime-types).  This will cause frustration for some.  But I think the 
proposed way is simpler and more effective.

-Kyle Maxwell




More information about the Developers mailing list