From: Hugues B. <hbe...@gy...> - 2003-04-02 20:54:33
|
hi On Wed, 2003-04-02 at 22:16, jim kraai wrote: > you might be missing timing if you don't somehow lock the record from the time > the user requests it for editing to the time where the user submits the udpated > record > > if not, any changes that come in via some third party while the user is editing > the record will be lost You're right, here is the way I am doing it in the triggers. (I have a field 'locktime' and and field 'lockIP' which are hidden) [in my hacky "pre" trigger] - testing if date("U")-locktime > 600 OR lockIP == host adress if true : -updating lockIP with host address -updating locktime' with current date("U") -return true ("go on, it's OK") else return false and go back to the view mode( With error prompt). [in 'before' update trigger] (prevent bad use of Back Browser Button - testing if date("U")-locktime > 600 OR lockIP == host adress if true go on else return false. (Same rules should be apply to delete before trigger) [in 'after' update trigger] (release the lock) cleaning lockIP cleaning locktime. Thanks for your feedback Hugues > > > --- Hugues Bernard <hbe...@gy...> wrote: > > Hi, > > > > Playing with triggers, it seems to me that one case is missing. > > > > Let me explain : > > > > Currently, before_update_triggers are called just before sending data to > > the database. > > It means that a user may have edited the record before the call. > > > > The user won't be able to _commit_ the changes, but there is no way to > > forbid record edition with current triggers. > > > > I have tables with lot of fields and want to avoid the user doing his > > stuff and then be notified (after clicking on the change or apply > > button) that he can't, and that he'll have to try again later. > > > > So, I added a [trigger][update][pre] = something.inc > > and hack a bit the display_record function in order to include this file > > _before_ the Change View. > > > > A simple (but very useful, I think) use-case is to be able to prevent > > the user to edit a record that is (for example) locked by another (using > > extra time and IP fields in the table). > > > > Sorry for bad english. I hope you'll understand what I mean. > > > > Do you want a patch and sample use ? > > Or am I missing something ? > > > > Hugues > > > > > > -- > > Hugues Bernard <hbe...@gy...> > > gynov.org > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: ValueWeb: > > Dedicated Hosting for just $79/mo with 500 GB of bandwidth! > > No other company gives more support or power for your dedicated server > > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ > > _______________________________________________ > > Phpmyedit-discuss mailing list > > Php...@li... > > https://lists.sourceforge.net/lists/listinfo/phpmyedit-discuss > > > __________________________________________________ > Do you Yahoo!? > Yahoo! Tax Center - File online, calculators, forms, and more > http://tax.yahoo.com > > > ------------------------------------------------------- > This SF.net email is sponsored by: ValueWeb: > Dedicated Hosting for just $79/mo with 500 GB of bandwidth! > No other company gives more support or power for your dedicated server > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ > _______________________________________________ > Phpmyedit-discuss mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpmyedit-discuss -- Hugues Bernard <hbe...@gy...> gynov.org |