From: Jakub A. <jak...@se...> - 2003-03-08 19:46:13
|
Mitra, I have enhanced the comments in post2shtml.php3 and in anonym.xml, now it will be hopefully better comprehensible. Jakub -----Original Message----- From: apc...@li... [mailto:apc...@li...] On Behalf Of Mitra Sent: Thursday, March 06, 2003 11:25 PM To: Jakub Adamek; apc...@so... Subject: RE: [Apc-aa-coders] Forms and error handling At 10:32 PM +0100 6/3/03, Jakub Adamek wrote: Mitra, ad 3: I can not find the bug with StoreItem. Could you help me? Everything is working fine for me. I have commented the rows in again. Please could you try to comment out individual functions in event_handler.php3 (like AuthUpdateReaders etc.) so that I know which function caused troubles? Or could you give me some access to some pages? Ok - I will look into this deeper, I think I still have a form that will generate the problem if I uncomment those lines. ad 4: This was a new bug. Thanks for finding it. Fixed. ad 5: I have created an example in doc/script/show_result.php3 Thanks - that script is useful, ad 6: I will try to make the FAQ consistent with doc/anonym ad 8: I am not sure what was your problem. The wizard creates the code for a .shtml page. Of course the code is created by a PHP script. I changed a bit the documentation in doc/anonym to clarify this point. Where is this SHTML page created? When I run the wizard I get a PHP3 page, I choose the slice, SliceAdmin / Anon Form Wiz ; change the URL; Click Show Form and I get a screen anonym_wizard.php3 with NO SHTML that I can find. This is the code for the PHP3 page, not for the SHTML page? I hope doc/script/show_result.php3 will help you with the results page. I don't know why you need to create an anonymous form otherwise than with a .shtml page. Because the anonymous form is on "site" i.e. created with modules/site, the only .shtml is a page containing<!--#include site.php3?....-->, so I take the PHP generated and put it into the site module, the URL on success is just '?i=10' meaning to go to item 10, which would be the thankyou page, and then "i=11" for failure, but I can't figure out what to put into the failure page. I can't put a SHTML include there, or PHP, all I can really put there is something inside {....} and have stringexpand.php3 expand it. I COULD put an {include} here if I could figure out what to put inside it, but it would make much more sense to do it directly with a {...} IF I COULD FIGURE OUT HOW THE RESULT IS STORED. I think the SSI includes do most resemble the readfile() PHP function. You only need to pass the post2sthml_id parameter to the PHP scripts called by readfile(). Sorry, I don't understand what you mean here at all, could you give an example. How do I get this post2shtml_id parameter? I'm assuming it is generated by filler.php3 somehow? Is it appended to the err_url? Can I make a suggestion ..... When really complex stuff like this isbuilt, could you generate some ARCHITECTURE documentation, as well as the docs like anonym.html AND an example. Things that are obvious to the coder, just aren't obvious to someone else looking at it. For example in this case ..... we need to know. ...(this is just an example, I KNOW that I don't have it right, because I don't understand how this is working) 1: insert_fnc_xxx generate errors like $GLOBALS[err][headline........] = "This string is too long" 2: filler.php3 martials these and stores them in its own $err[validate] (NOTE THIS IS REUSE OF THE GLOBAL, THIS NEW $err HAS A DIFFERENT STRUCTURE FROM THE $err filled by insert_fnc_xxxx 3: The result is stored somewhere ... 4: The id parameter is passed back ... how? 4: fillform.php3 gets this parameter from the URL which is the id field of the xxxx table and so on ..... This documentation can be quite brief, but its crucial to being able to debug. Without something like this, its impossible to trace a bug back and know which step is doing it wrong, and there is a real danger that one coder will go in and "FIX" something which isn't a bug, and therefore break something else. - Mitra -----Original Message----- From: apc...@li... [mailto:apc...@li...] On Behalf Of Mitra Sent: Thursday, March 06, 2003 1:17 PM To: hon...@ec...; apc...@so... Subject: [Apc-aa-coders] Forms and error handling Hi Honza thanks for the Yahoo chat, at least I think we are getting closer to solving some of this mess. As I see it, we have at least 6 sets of bugs to deal with So there are at least x bugs 1: The insert_fnc_fil etc functions don't always set $err[xxx] but either return a value, or set $err (string) etc 2: Some validate functions return an error, even if there is not one - for example if you try and post an anonymous form NOT containing a publish date, to a slice where Publish_date is marked as required&show then it will generate an error, rather than using the default 3: StoreItem crashes when it calls the event code when running off an anonymous form I've commented that call out in the CVS version until someone (Jakub?) fixes the bug. 4: filler.php3 ALWAYS calls the err_url because $err is ALWAYS an array even if it contains just "success". This was probably never spotted since the wizard uses the same URL for both. I'm going to assume that the array is correct, and the code is wrong, since anonym.html mentions "success". 5: Insufficient documentation on how to create an error page that will display the error. See http://aa.ecn.cz/apc-aa-dev/doc/anonym.html. for some docs, but even after reading these I'm having difficulty figuring out how to build a simple page (to go in err_url) that displays the error from the $err array and prompts the user to fix the problem - its even harder since what I really want is to set err_url to "mysite.shtml?i=99" since this is all driven by the "site" module, so I have to understand what is happening in order to modify it to do what I need. 6: The Documentation there is i.e. anonym.html isn't linked into either doc/index.html or the FAQ, so in effect it doesn't exist! PLEASE PLEASE LINK ALL DOCUMENTATION SO SOMEONE CAN FIND IT AGAIN 7: The FAQ is inconsistent with anonym.html, i.e. http://apc-aa.sourceforge.net/faq/#anonymous still says to cut and paste from "Add Item" instead of using the wizard. 8: anonym.html says "This wizard creates a complete form with the SSI include of fillform.php3 necessary to edit items. The resulting form differs depending on whether Anonymous editing is allowed or not." That is not what it appears to do - it outputs a PHP form, with no SSI. This might sound trivial, but we lost at least a day or more of work trying to figure it out (without seeing anonym.htm) and then looking for why it didn't work properly. I'm going to start fixing some of these bugs tomorrow, so please say something if I'm missing something - especially with items 1,2 or 4 I'd appreciate some help with figuring out how to do the results page, ideally within a "site" i.e. from within PHP3, with no access to SHTML. I've introduced the concept of a current item in the site, (you can see this in site_bayfm.php3) using this might be the best mechanism to get at the posted data, but I'm not sure about that? - Mitra -- Mitra Technology Consulting - www.mitra.biz - mi...@mi... 02-6684-8096 or 0414-648-0722 Life is a Mystery to be Lived, not a Problem to be Solved -- Mitra Technology Consulting - www.mitra.biz - mi...@mi... 02-6684-8096 or 0414-648-0722 Life is a Mystery to be Lived, not a Problem to be Solved |