Re: DB_DataObject_FormBuilder questions
| From: | Ken Restivo | Date: | Fri, 31 Dec 2004 23:46:10 +0000 |
| Subject: | Re: DB_DataObject_FormBuilder questions | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16547@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Fri, Dec 31, 2004 at 02:13:29PM -0800, Justin Patrin wrote:
>
> I solved this problem by adding a config var to the DO which says what
> user groups can edit which fields, then freezing fields the user can't
> edit in postGenerateForm. Yes, this required messing about on DB_DO,
> but, as Markus said, this is out of scope for FB. FB is meant to make
> and process a form, no more. Adding permissions to it would be a huge
> step. If you want to make a new package which extends FB that adds
> permissions, that would be great. ;-)
>
I'm porting over a rather large application that used my own clunky, homegrown, non-OOP
application framework, to instead use FB. So far it's going well.
My ugly old way of specifying fields was as such:
$enhancement_hour_fields = array(
"family_id" => array (
// perms are group, user
perms => array (ACCESS_VIEW, ACCESS_VIEW),
display => "Co-Op Family",
table => "parents" ,
linktable => "families",
linkfield => "name",
callback => "popupUtil"
),
"enhancement_project_id" => array (
required => 1,
display => "Project",
table => "enhancement_hours",
linktable => "enhancement_projects" ,
linkfield => "project_name",
uniqueness => array ('project_name', 'project_description'),
crosscallback => 'enhancement_project_callbacks',
callback => "popupUtil"
),
"hours" => array (
required => 1,
size => 10,
table => "enhancement_hours" ,
display => "Hours Worked"
),
"work_date" => array (
required => 1,
table => "enhancement_hours" ,
type => "date" ,
display => "Date Worked (MM/DD/YYYY)"
),
"school_year" => array (
required => 1,
table => "enhancement_hours" ,
type => "schoolyear" ,
callback => "schoolYearPopup",
def => findSchoolYear(),
display => "School Year (YYYY-YYYY)"
),
"parent_id" => array (
// perms are group, user
required => 1,
perms => array (ACCESS_ADD, ACCESS_VIEW),
display => "Parent",
table => "enhancement_hours" ,
linktable => "parents",
uniqueness => array ('last_name', 'first_name'),
showall => 3,
linkfield => "last_name",
callback => "popupUtil",
joins => array( // outer array, can have more as in callbacks
array('kids', 'family_id',
array('enrollment', 'kid_id'))) ,
school_year => array( 'def' => findSchoolYear(),
'table' => 'enrollment'),
),
"enhancement_hour_id" => array (
table => "enhancement_hours" ,
savealways => 1,
perms => array (ACCESS_NONE, ACCESS_NONE)
)
);
Now FB makes most of this nasty stuff redundant. I'll tack my permissions system onto FB and
then I'll be rid of my old system. But things that I really, really like, and really miss in
FB, is that all the vital parameters for a given field are in one place. Made it easy to copy/paste,
or to make changes. Oh well.
- -ken
- --
- ---------------
The world's most affordable web hosting.
http://www.nearlyfreespeech.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFB1eTCe8HF+6xeOIcRAqxbAKD+r24QeX0Uzi40xEg8behAEJceEgCgkC1g
1CP8RvVr44+o2nM3jlZ/q+U=
=Z7Xb
-----END PGP SIGNATURE-----