pieforms-commit Mailing List for Pieforms (Page 4)
Status: Alpha
Brought to you by:
oracleshinoda
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(73) |
Dec
(83) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(16) |
Feb
(19) |
Mar
(12) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(14) |
Sep
(2) |
Oct
(1) |
Nov
(2) |
Dec
(45) |
2008 |
Jan
(20) |
Feb
(3) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(2) |
May
(1) |
Jun
(5) |
Jul
(1) |
Aug
(2) |
Sep
(1) |
Oct
|
Nov
(7) |
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ora...@us...> - 2007-12-28 04:53:00
|
Revision: 248 http://pieforms.svn.sourceforge.net/pieforms/?rev=248&view=rev Author: oracleshinoda Date: 2007-12-27 20:53:04 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Another foldmarker, more git testing. Modified Paths: -------------- pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2007-12-28 04:48:37 UTC (rev 247) +++ pieforms-php5/trunk/src/pieform.php 2007-12-28 04:53:04 UTC (rev 248) @@ -611,12 +611,12 @@ * @param string The key of the property to return * @return mixed */ - public function get_property($key) { + public function get_property($key) { // {{{ if (array_key_exists($key, $this->data)) { return $this->data[$key]; } return null; - } + } // }}} /** * Returns the form name This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-28 04:48:32
|
Revision: 247 http://pieforms.svn.sourceforge.net/pieforms/?rev=247&view=rev Author: oracleshinoda Date: 2007-12-27 20:48:37 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Added more foldmarkers, testing more git stuff. Modified Paths: -------------- pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2007-12-28 04:23:58 UTC (rev 246) +++ pieforms-php5/trunk/src/pieform.php 2007-12-28 04:48:37 UTC (rev 247) @@ -174,7 +174,7 @@ * * @param array $data The form description hash */ - public function __construct($data) { + public function __construct($data) { // {{{ $GLOBALS['_PIEFORM_REGISTRY'][] = $this; if (!isset($data['name']) || !preg_match('/^[a-z_][a-z0-9_]*$/', $data['name'])) { @@ -601,7 +601,7 @@ $this->json_reply(PIEFORM_ERR, array('message' => $message, 'errors' => $json)); } } - } + } // }}} /** * Returns a generic property. This can be used to retrieve any property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-28 04:23:54
|
Revision: 246 http://pieforms.svn.sourceforge.net/pieforms/?rev=246&view=rev Author: oracleshinoda Date: 2007-12-27 20:23:58 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Moved foldmarkers for process() method. And still testing git stuff, of course! Modified Paths: -------------- pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2007-12-28 04:12:11 UTC (rev 245) +++ pieforms-php5/trunk/src/pieform.php 2007-12-28 04:23:58 UTC (rev 246) @@ -153,7 +153,6 @@ private $submitted = false; // }}} - // {{{ process() /** * Processes the form. Called by the {@link pieform} function. It simply @@ -163,13 +162,11 @@ * @param array $data The form description hash * @return string The HTML representing the form */ - public static function process($data) { + public static function process($data) { // {{{ $form = new Pieform($data); return $form->build(); - } + } // }}} - // }}} - /** * Sets the attributes of the form according to the passed data, performing * validation on the way. If the form is submitted, this checks and processes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-28 04:12:08
|
Revision: 245 http://pieforms.svn.sourceforge.net/pieforms/?rev=245&view=rev Author: oracleshinoda Date: 2007-12-27 20:12:11 -0800 (Thu, 27 Dec 2007) Log Message: ----------- More foldmarkers. And more testing of git stuff! Modified Paths: -------------- pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2007-12-28 04:04:53 UTC (rev 244) +++ pieforms-php5/trunk/src/pieform.php 2007-12-28 04:12:11 UTC (rev 245) @@ -153,6 +153,7 @@ private $submitted = false; // }}} + // {{{ process() /** * Processes the form. Called by the {@link pieform} function. It simply @@ -167,6 +168,8 @@ return $form->build(); } + // }}} + /** * Sets the attributes of the form according to the passed data, performing * validation on the way. If the form is submitted, this checks and processes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-28 04:04:51
|
Revision: 244 http://pieforms.svn.sourceforge.net/pieforms/?rev=244&view=rev Author: oracleshinoda Date: 2007-12-27 20:04:53 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Added some more foldmarkers. Still testing the git stuff. Modified Paths: -------------- pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2007-12-28 03:50:40 UTC (rev 243) +++ pieforms-php5/trunk/src/pieform.php 2007-12-28 04:04:53 UTC (rev 244) @@ -109,8 +109,10 @@ * For more information on how Pieforms works, please see the documentation * at https://eduforge.org/wiki/wiki/mahara/wiki?pagename=FormAPI */ -class Pieform { +class Pieform { // {{{ + // {{{ Fields + /** * Maintains a tab index across all created forms, to make it easy for * people to forget about it and have it just work for all of their forms. @@ -150,6 +152,8 @@ */ private $submitted = false; + // }}} + /** * Processes the form. Called by the {@link pieform} function. It simply * builds the form (processing it if it has been submitted), and returns @@ -1464,7 +1468,7 @@ } } -} +} // }}} /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-28 03:50:35
|
Revision: 243 http://pieforms.svn.sourceforge.net/pieforms/?rev=243&view=rev Author: oracleshinoda Date: 2007-12-27 19:50:40 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Added fold markers for the pieform() function. In reality, I'm just checking to see if my author's map will work. Modified Paths: -------------- pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2007-12-28 00:32:52 UTC (rev 242) +++ pieforms-php5/trunk/src/pieform.php 2007-12-28 03:50:40 UTC (rev 243) @@ -68,7 +68,7 @@ * more information on creating and using forms. * */ -function pieform($data) { +function pieform($data) { // {{{ return Pieform::process($data); // // @todo stuff to do for forms: @@ -83,7 +83,7 @@ // - handle multipage forms? // - handle a tabbed interface type of form? // -} +} // }}} if (!function_exists('json_encode')) { require_once 'JSON/JSON.php'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-28 00:32:49
|
Revision: 242 http://pieforms.svn.sourceforge.net/pieforms/?rev=242&view=rev Author: oracleshinoda Date: 2007-12-27 16:32:52 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Moved Pieforms to the GPL3 license. Very easy, thanks to Francois' script. Also, first commit using git rather than SVN! Modified Paths: -------------- pieforms-php5/trunk/COPYING pieforms-php5/trunk/src/pieform/elements/button.php pieforms-php5/trunk/src/pieform/elements/bytes.php pieforms-php5/trunk/src/pieform/elements/calendar.php pieforms-php5/trunk/src/pieform/elements/cancel.php pieforms-php5/trunk/src/pieform/elements/checkbox.php pieforms-php5/trunk/src/pieform/elements/date.php pieforms-php5/trunk/src/pieform/elements/expiry.php pieforms-php5/trunk/src/pieform/elements/fieldset.php pieforms-php5/trunk/src/pieform/elements/file.php pieforms-php5/trunk/src/pieform/elements/hidden.php pieforms-php5/trunk/src/pieform/elements/html.php pieforms-php5/trunk/src/pieform/elements/image.php pieforms-php5/trunk/src/pieform/elements/password.php pieforms-php5/trunk/src/pieform/elements/radio.php pieforms-php5/trunk/src/pieform/elements/select.php pieforms-php5/trunk/src/pieform/elements/submit.php pieforms-php5/trunk/src/pieform/elements/submitcancel.php pieforms-php5/trunk/src/pieform/elements/text.php pieforms-php5/trunk/src/pieform/elements/textarea.php pieforms-php5/trunk/src/pieform/renderers/div.php pieforms-php5/trunk/src/pieform/renderers/multicolumntable.php pieforms-php5/trunk/src/pieform/renderers/oneline.php pieforms-php5/trunk/src/pieform/renderers/table.php pieforms-php5/trunk/src/pieform/rules/before.php pieforms-php5/trunk/src/pieform/rules/email.php pieforms-php5/trunk/src/pieform/rules/integer.php pieforms-php5/trunk/src/pieform/rules/maxlength.php pieforms-php5/trunk/src/pieform/rules/maxvalue.php pieforms-php5/trunk/src/pieform/rules/minlength.php pieforms-php5/trunk/src/pieform/rules/minvalue.php pieforms-php5/trunk/src/pieform/rules/regex.php pieforms-php5/trunk/src/pieform/rules/required.php pieforms-php5/trunk/src/pieform/rules/validateoptions.php pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/COPYING =================================================================== --- pieforms-php5/trunk/COPYING 2007-12-27 23:45:56 UTC (rev 241) +++ pieforms-php5/trunk/COPYING 2007-12-28 00:32:52 UTC (rev 242) @@ -1,284 +1,626 @@ + GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + Version 3, 29 June 2007 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + The precise terms and conditions for copying, distribution and modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". + TERMS AND CONDITIONS -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. + 0. Definitions. - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. + "This License" refers to version 3 of the GNU General Public License. -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. + A "covered work" means either the unmodified Program or a work based +on the Program. - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. + 1. Source Code. - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. + The Corresponding Source for a work in source code form is that +same work. - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. + 2. Basic Permissions. - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of this License. - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. + 13. Use with the GNU Affero General Public License. -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. + 14. Revised Versions of this License. - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. - NO WARRANTY + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. + 15. Disclaimer of Warranty. - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest @@ -287,15 +629,15 @@ To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least +state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -304,37 +646,31 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. - Also add information on how to contact you by electronic and paper mail. -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. Modified: pieforms-php5/trunk/src/pieform/elements/button.php =================================================================== --- pieforms-php5/trunk/src/pieform/elements/button.php 2007-12-27 23:45:56 UTC (rev 241) +++ pieforms-php5/trunk/src/pieform/elements/button.php 2007-12-28 00:32:52 UTC (rev 242) @@ -1,20 +1,20 @@ <?php /** - * This program is part of Pieforms + * Pieforms: Advanced web forms made easy + * Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @package pieform * @subpackage element Modified: pieforms-php5/trunk/src/pieform/elements/bytes.php =================================================================== --- pieforms-php5/trunk/src/pieform/elements/bytes.php 2007-12-27 23:45:56 UTC (rev 241) +++ pieforms-php5/trunk/src/pieform/elements/bytes.php 2007-12-28 00:32:52 UTC (rev 242) @@ -1,20 +1,20 @@ <?php /** - * This program is part of Pieforms + * Pieforms: Advanced web forms made easy + * Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @package pieform * @subpackage element Modified: pieforms-php5/trunk/src/pieform/elements/calendar.php =================================================================== --- pieforms-php5/trunk/src/pieform/elements/calendar.php 2007-12-27 23:45:56 UTC (rev 241) +++ pieforms-php5/trunk/src/pieform/elements/calendar.php 2007-12-28 00:32:52 UTC (rev 242) @@ -1,20 +1,20 @@ <?php /** - * This program is part of Pieforms + * Pieforms: Advanced web forms made easy + * Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @package pieform * @subpackage element Modified: pieforms-php5/trunk/src/pieform/elements/cancel.php =================================================================== --- pieforms-php5/trunk/src/pieform/elements/cancel.php 2007-12-27 23:45:56 UTC (rev 241) +++ pieforms-php5/trunk/src/pieform/elements/cancel.php 2007-12-28 00:32:52 UTC (rev 242) @@ -1,20 +1,20 @@ <?php /** - * This program is part of Pieforms + * Pieforms: Advanced web forms made easy + * Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) an... [truncated message content] |
From: <ora...@us...> - 2007-12-27 23:45:52
|
Revision: 241 http://pieforms.svn.sourceforge.net/pieforms/?rev=241&view=rev Author: oracleshinoda Date: 2007-12-27 15:45:56 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Templating support. Now, if the 'template' directive is provided, pieforms will use a template for rendering a form, rather than a renderer, allowing full layout control. See the recently committed documentation for more information. Modified Paths: -------------- pieforms-php5/trunk/src/pieform/renderers/div.php pieforms-php5/trunk/src/pieform/renderers/multicolumntable.php pieforms-php5/trunk/src/pieform/renderers/oneline.php pieforms-php5/trunk/src/pieform/renderers/table.php pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform/renderers/div.php =================================================================== --- pieforms-php5/trunk/src/pieform/renderers/div.php 2007-12-27 23:43:59 UTC (rev 240) +++ pieforms-php5/trunk/src/pieform/renderers/div.php 2007-12-27 23:45:56 UTC (rev 241) @@ -27,59 +27,41 @@ /** * Renders form elements inside <div>s. * - * @param Pieform $form The form the element is being rendered for - * @param string $builtelement The element, already built - * @param array $rawelement The element in raw form, for looking up - * information about it. - * @return string The element rendered inside an appropriate - * container. + * @param Pieform $form The form the element is being rendered for + * @param array $element The element to be rendered + * @return string The element rendered inside an appropriate container */ -function pieform_renderer_div(Pieform $form, $builtelement, $rawelement) { +function pieform_renderer_div(Pieform $form, $element) { $formname = $form->get_name(); // Set the class of the enclosing <div> to match that of the element $result = '<div'; - if (isset($rawelement['name'])) { - $result .= ' id="' . $formname . '_' . $rawelement['name'] . '_container"'; + if (isset($element['name'])) { + $result .= ' id="' . $formname . '_' . $element['name'] . '_container"'; } - if ($rawelement['class']) { - $result .= ' class="' . $rawelement['class'] . '"'; + if (!empty($element['class'])) { + $result .= ' class="' . $element['class'] . '"'; } $result .= '>'; - if (isset($rawelement['title']) && $rawelement['title'] !== '' && $rawelement['type'] != 'fieldset') { - if (!empty($rawelement['nolabel'])) { - // Don't bother with a label for the element - $result .= Pieform::hsc($rawelement['title']); - } - else { - $result .= '<label for="' . $formname . '_' . $rawelement['id'] . '">' . Pieform::hsc($rawelement['title']) . '</label>'; - } - if ($form->get_property('requiredmarker') && !empty($rawelement['rules']['required'])) { - $result .= ' <span class="requiredmarker">*</span>'; - } + if (isset($element['labelhtml'])) { + $result .= $element['labelhtml']; } - $result .= $builtelement; + //$result .= $builtelement; + $result .= $element['html']; - // Contextual help - if (!empty($rawelement['help'])) { - $function = $form->get_property('helpcallback'); - if (function_exists($function)) { - $result .= $function($form, $rawelement); - } - else { - $result .= ' <span class="help"><a href="#" title="' . Pieform::hsc($rawelement['help']) . '">?</a></span>'; - } + if (isset($element['helphtml'])) { + $result .= ' ' . $element['helphtml']; } // Description - optional description of the element, or other note that should be visible // on the form itself (without the user having to hover over contextual help - if ((!$form->has_errors() || $form->get_property('showdescriptiononerror')) && !empty($rawelement['description'])) { - $result .= '<div class="description"> ' . Pieform::hsc($rawelement['description']) . "</div>"; + if ((!$form->has_errors() || $form->get_property('showdescriptiononerror')) && !empty($element['description'])) { + $result .= '<div class="description"> ' . Pieform::hsc($element['description']) . "</div>"; } - if (!empty($rawelement['error'])) { - $result .= '<div class="errmsg">' . Pieform::hsc($rawelement['error']) . '</div>'; + if (!empty($element['error'])) { + $result .= '<div class="errmsg">' . Pieform::hsc($element['error']) . '</div>'; } $result .= "</div>\n"; Modified: pieforms-php5/trunk/src/pieform/renderers/multicolumntable.php =================================================================== --- pieforms-php5/trunk/src/pieform/renderers/multicolumntable.php 2007-12-27 23:43:59 UTC (rev 240) +++ pieforms-php5/trunk/src/pieform/renderers/multicolumntable.php 2007-12-27 23:45:56 UTC (rev 241) @@ -33,16 +33,13 @@ * Renders form elements inside a <table>. If elements have the same title, * they will be rendered in the same table row, allowing a grid layout. * - * @param Pieform $form The form the element is being rendered for - * @param string $builtelement The element, already built - * @param array $rawelement The element in raw form, for looking up - * information about it. - * @return string The element rendered inside an appropriate - * container. + * @param Pieform $form The form the element is being rendered for + * @param array $element The element to be rendered + * @return string The element rendered inside an appropriate container */ -function pieform_renderer_multicolumntable(Pieform $form, $builtelement, $rawelement) { +function pieform_renderer_multicolumntable(Pieform $form, $element) { global $formrenderermct; - $formrenderermct->add_element($builtelement, $rawelement); + $formrenderermct->add_element($element['html'], $element); $formrenderermct->set_form($form); } Modified: pieforms-php5/trunk/src/pieform/renderers/oneline.php =================================================================== --- pieforms-php5/trunk/src/pieform/renderers/oneline.php 2007-12-27 23:43:59 UTC (rev 240) +++ pieforms-php5/trunk/src/pieform/renderers/oneline.php 2007-12-27 23:45:56 UTC (rev 241) @@ -35,39 +35,36 @@ /** * Renders form elements all on one line. * - * @param Pieform $form The form the element is being rendered for - * @param string $builtelement The element, already built - * @param array $rawelement The element in raw form, for looking up - * information about it. - * @return string The element rendered inside an appropriate - * container. + * @param Pieform $form The form the element is being rendered for + * @param array $element The element that is being rendered + * @return string The element rendered inside an appropriate container */ -function pieform_renderer_oneline(Pieform $form, $builtelement, $rawelement) { +function pieform_renderer_oneline(Pieform $form, $element) { $formname = $form->get_name(); // Set the class of the enclosing <div> to match that of the element $result = '<span'; - if (isset($rawelement['name'])) { - $result .= ' id="' . $formname . '_' . $rawelement['name'] . '_container"'; + if (isset($element['name'])) { + $result .= ' id="' . $formname . '_' . $element['name'] . '_container"'; } - if ($rawelement['class']) { - $result .= ' class="' . $rawelement['class'] . '"'; + if (!empty($element['class'])) { + $result .= ' class="' . $element['class'] . '"'; } $result .= '>'; - if (isset($rawelement['title']) && $rawelement['title'] !== '' && $rawelement['type'] != 'fieldset') { - if (!empty($rawelement['nolabel'])) { + if (isset($element['title']) && $element['title'] !== '' && $element['type'] != 'fieldset') { + if (!empty($element['nolabel'])) { // Don't bother with a label for the element - $result .= Pieform::hsc($rawelement['title']); + $result .= Pieform::hsc($element['title']); } else { - $result .= '<label for="' . $rawelement['id'] . '">' . Pieform::hsc($rawelement['title']) . '</label>'; + $result .= '<label for="' . $element['id'] . '">' . Pieform::hsc($element['title']) . '</label>'; } - if ($form->get_property('requiredmarker') && !empty($rawelement['rules']['required'])) { + if ($form->get_property('requiredmarker') && !empty($element['rules']['required'])) { $result .= ' <span class="requiredmarker">*</span>'; } } - $result .= $builtelement; + $result .= $element['html']; $result .= "</span>"; return $result; Modified: pieforms-php5/trunk/src/pieform/renderers/table.php =================================================================== --- pieforms-php5/trunk/src/pieform/renderers/table.php 2007-12-27 23:43:59 UTC (rev 240) +++ pieforms-php5/trunk/src/pieform/renderers/table.php 2007-12-27 23:45:56 UTC (rev 241) @@ -27,17 +27,15 @@ /** * Renders form elements inside a <table>. * - * @param Pieform $form The form the element is being rendered for - * @param string $builtelement The element, already built - * @param array $rawelement The element in raw form, for looking up - * information about it. - * @return string The element rendered inside an appropriate - * container. + * @param Pieform $form The form the element is being rendered for + * @param array $element The element to be rendered + * @return string The element rendered inside an appropriate container */ -function pieform_renderer_table(Pieform $form, $builtelement, $rawelement) { +function pieform_renderer_table(Pieform $form, $element) { $formname = $form->get_name(); - if ($rawelement['type'] == 'fieldset') { + if ($element['type'] == 'fieldset') { // Add table tags to the build element, to preserve HTML compliance + $builtelement = $element['html']; if (0 === strpos($builtelement, "\n<fieldset")) { $closelegendpos = strpos($builtelement, '</legend>'); if ($closelegendpos !== false) { @@ -61,53 +59,35 @@ } $result = "\t<tr"; - $result .= ' id="' . $formname . '_' . $rawelement['name'] . '_container"'; + $result .= ' id="' . $formname . '_' . $element['name'] . '_container"'; // Set the class of the enclosing <tr> to match that of the element - if ($rawelement['class']) { - $result .= ' class="' . $rawelement['class'] . '"'; + if (!empty($element['class'])) { + $result .= ' class="' . $element['class'] . '"'; } $result .= ">\n\t\t"; $result .= '<th>'; - if (isset($rawelement['title']) && $rawelement['title'] !== '') { - if (!empty($rawelement['nolabel'])) { - // Don't bother with a label for the element - $result .= Pieform::hsc($rawelement['title']); - } - else { - $result .= '<label for="' . $formname . '_' . $rawelement['id'] . '">' . Pieform::hsc($rawelement['title']) . '</label>'; - } - if ($form->get_property('requiredmarker') && !empty($rawelement['rules']['required'])) { - $result .= ' <span class="requiredmarker">*</span>'; - } + if (isset($element['labelhtml'])) { + $result .= $element['labelhtml']; } $result .= "</th>\n\t\t<td>"; - $result .= $builtelement; - - // Contextual help - if (!empty($rawelement['help'])) { - $function = $form->get_property('helpcallback'); - if (function_exists($function)) { - $result .= $function($form, $rawelement); - } - else { - $result .= ' <span class="help"><a href="#" title="' . Pieform::hsc($rawelement['help']) . '">?</a></span>'; - } + $result .= $element['html']; + if (isset($element['helphtml'])) { + $result .= ' ' . $element['helphtml']; } - $result .= "</td>\n\t</tr>\n"; // Description - optional description of the element, or other note that should be visible // on the form itself (without the user having to hover over contextual help - if ((!$form->has_errors() || $form->get_property('showdescriptiononerror')) && !empty($rawelement['description'])) { + if ((!$form->has_errors() || $form->get_property('showdescriptiononerror')) && !empty($element['description'])) { $result .= "\t<tr>\n\t\t<td colspan=\"2\" class=\"description\">"; - $result .= $rawelement['description']; + $result .= $element['description']; $result .= "</td>\n\t</tr>\n"; } - if (!empty($rawelement['error'])) { + if (!empty($element['error'])) { $result .= "\t<tr>\n\t\t<td colspan=\"2\" class=\"errmsg\">"; - $result .= $rawelement['error']; + $result .= $element['error']; $result .= "</td>\n\t</tr>\n"; } Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2007-12-27 23:43:59 UTC (rev 240) +++ pieforms-php5/trunk/src/pieform.php 2007-12-27 23:45:56 UTC (rev 241) @@ -208,6 +208,12 @@ // The form renderer (see the pieform/renderers directory) 'renderer' => 'table', + // The directory (relative to the include path) to search for templates + 'templatedir' => '', + + // Whether to ignore E_NOTICE messages in templates + 'ignoretemplatenotices' => true, + // Whether to validate the form. Non validated forms have none of the // validate, success or error callbacks called on them 'validate' => true, @@ -393,6 +399,9 @@ } } if ($element['type'] == 'fieldset') { + if ($this->get_property('template')) { + self::info("Your form '$this->name' has a fieldset, but is using a template. Fieldsets make no sense when using templates"); + } $this->include_plugin('element', 'fieldset'); foreach ($element['elements'] as $subname => &$subelement) { // The name can be in the element itself. This is compatibility for the perl version @@ -599,7 +608,10 @@ * @return mixed */ public function get_property($key) { - return $this->data[$key]; + if (array_key_exists($key, $this->data)) { + return $this->data[$key]; + } + return null; } /** @@ -651,64 +663,127 @@ */ public function build($outputformtags=true) { $result = ''; - if ($outputformtags) { - $result = $this->get_form_tag() . "\n"; - } - $this->include_plugin('renderer', $this->data['renderer']); - - // Form header - $function = 'pieform_renderer_' . $this->data['renderer'] . '_header'; - if (function_exists($function)) { - $result .= $function(); + // Builds the HTML each element (see the build_element_html method for + // more information) + foreach ($this->data['elements'] as &$elem) { + if ($elem['type'] == 'fieldset') { + foreach ($elem['elements'] as &$subelem) { + $this->build_element_html($subelem); + } + } + else { + $this->build_element_html($elem); + } } - // Render each element - foreach ($this->data['elements'] as $name => $elem) { - if ($elem['type'] != 'hidden') { - $result .= pieform_render_element($this, $elem); + // If a template is to be used, use it instead of a renderer + if (!empty($this->data['template'])) { + $form_tag = $this->get_form_tag(); + + // $elements is a convenience variable that contains all of the form elements (minus fieldsets and + // hidden elements) + $elements = array(); + foreach ($this->get_elements() as $element) { + if ($element['type'] != 'hidden') { + $elements[$element['name']] = $element; + } } - } - // Form footer - $function = 'pieform_renderer_' . $this->data['renderer'] . '_footer'; - if (function_exists($function)) { - $result .= $function(); - } + // Hidden elements + $this->include_plugin('element', 'hidden'); + $hidden_elements = ''; + foreach ($this->get_elements() as $element) { + if ($element['type'] == 'hidden') { + $hidden_elements .= pieform_element_hidden($this, $element); + } + } + $element = array( + 'type' => 'hidden', + 'name' => 'pieform_' . $this->get_name(), + 'value' => '' + ); + $hidden_elements .= pieform_element_hidden($this, $element); - // Hidden elements - $this->include_plugin('element', 'hidden'); - foreach ($this->get_elements() as $element) { - if ($element['type'] == 'hidden') { - $result .= pieform_element_hidden($element, $this); + ob_start(); + + if ($this->get_property('ignoretemplatenotices')) { + $old_level = error_reporting(E_ALL & ~E_NOTICE); } + + $templatepath = $this->get_property('templatedir'); + $templatepath = ($templatepath && substr($templatepath, -1) != '/') ? $templatepath . '/' : $templatepath; + $templatepath .= $this->get_property('template'); + require($templatepath); + + if ($this->get_property('ignoretemplatenotices')) { + error_reporting($old_level); + } + + $result = ob_get_contents(); + ob_end_clean(); } - $element = array( - 'type' => 'hidden', - 'name' => 'pieform_' . $this->name, - 'value' => '' - ); - $result .= pieform_element_hidden($element, $this); - if ($outputformtags) { - $result .= "</form>\n"; - } + else { + // No template being used - instead use a renderer + if ($outputformtags) { + $result = $this->get_form_tag() . "\n"; + } - if ($this->data['jsform'] || $this->data['presubmitcallback']) { - $result .= '<script type="text/javascript">'; + $this->include_plugin('renderer', $this->data['renderer']); + + // Form header + $function = 'pieform_renderer_' . $this->data['renderer'] . '_header'; + if (function_exists($function)) { + $result .= $function(); + } + + // Render each element + foreach ($this->data['elements'] as $name => $element) { + if ($element['type'] != 'hidden') { + $result .= pieform_render_element($this, $element); + } + } + + // Form footer + $function = 'pieform_renderer_' . $this->data['renderer'] . '_footer'; + if (function_exists($function)) { + $result .= $function(); + } + + // Hidden elements + $this->include_plugin('element', 'hidden'); + foreach ($this->get_elements() as $element) { + if ($element['type'] == 'hidden') { + $result .= pieform_element_hidden($this, $element); + } + } + $element = array( + 'type' => 'hidden', + 'name' => 'pieform_' . $this->name, + 'value' => '' + ); + $result .= pieform_element_hidden($this, $element); if ($outputformtags) { - $result .= "\n" . $this->whichbutton_js(); + $result .= "</form>\n"; } + + if ($this->data['jsform'] || $this->data['presubmitcallback']) { + $result .= '<script type="text/javascript">'; + if ($outputformtags) { + $result .= "\n" . $this->whichbutton_js(); + } + } + if ($this->data['jsform']) { + $result .= $this->submit_js(); + } + else if ($this->data['presubmitcallback'] && $outputformtags) { + $result .= 'connect(\'' . $this->name . '\', \'onsubmit\', ' + . 'function() { ' . $this->data['presubmitcallback'] . "('{$this->name}', {$this->name}_btn); });"; + } + if ($this->data['jsform'] || $this->data['presubmitcallback']) { + $result .= "\n</script>\n"; + } } - if ($this->data['jsform']) { - $result .= $this->submit_js(); - } - else if ($this->data['presubmitcallback'] && $outputformtags) { - $result .= 'connect(\'' . $this->name . '\', \'onsubmit\', ' - . 'function() { ' . $this->data['presubmitcallback'] . "('{$this->name}', {$this->name}_btn); });"; - } - if ($this->data['jsform'] || $this->data['presubmitcallback']) { - $result .= "\n</script>\n"; - } return $result; } @@ -1340,6 +1415,55 @@ } } } + + /** + * Given an element, builds all of the HTML for it - for example, the label + * and the raw HTML of the element itself + * + * The element is passed by reference, and various properties are set + * directly on the element, namely: + * + * * 'html' - The element in its built, HTML form + * * 'labelhtml' - The HTML for the element label + * * 'helphtml' - The HTML for the help icon + * + * @param array &$element The element to build the HTML for + */ + private function build_element_html(&$element) { + // Set ID and class for elements + $element['id'] = $this->make_id($element); + $element['class'] = $this->make_class($element); + + // Build the element html + $function = 'pieform_element_' . $element['type']; + $element['html'] = $function($this, $element); + + // Element title + if (isset($element['title']) && $element['title'] !== '') { + if (!empty($element['nolabel'])) { + // Don't bother with a label for the element + $element['labelhtml'] = self::hsc($element['title']); + } + else { + $element['labelhtml'] = '<label for="' . $this->name . '_' . $element['id'] . '">' . Pieform::hsc($element['title']) . '</label>'; + } + if ($this->get_property('requiredmarker') && !empty($element['rules']['required'])) { + $element['labelhtml'] .= ' <span class="requiredmarker">*</span>'; + } + } + + // Help icon + if (!empty($element['help'])) { + $function = $this->get_property('helpcallback'); + if (function_exists($function)) { + $element['helphtml'] = $function($this, $element); + } + else { + $element['helphtml'] = '<span class="help"><a href="" title="' . Pieform::hsc($element['help']) . '" onclick="return false;">?</a></span>'; + } + } + } + } @@ -1367,22 +1491,23 @@ } // Make sure that the function to render the element type is available - $function = 'pieform_element_' . $element['type']; - $rendererfunction = 'pieform_renderer_' . $form->get_property('renderer'); if (!function_exists($rendererfunction)) { throw new PieformException('No such form renderer function: "' . $rendererfunction . '"'); } - $element['id'] = $form->make_id($element); - $element['class'] = $form->make_class($element); - $builtelement = $function($form, $element); - // Remove the 'autofocus' class, because we only want it on the form input // itself, not the wrapping HTML - $element['class'] = preg_replace('/\s?autofocus/', '', $element['class']); + if (isset($element['class'])) { + $element['class'] = preg_replace('/\s?autofocus/', '', $element['class']); + } - return $rendererfunction($form, $builtelement, $element); + // Render fieldsets now + if ($element['type'] == 'fieldset') { + $element['html'] = pieform_element_fieldset($form, $element); + } + + return $rendererfunction($form, $element); } function pieform_get_headdata() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-27 23:43:54
|
Revision: 240 http://pieforms.svn.sourceforge.net/pieforms/?rev=240&view=rev Author: oracleshinoda Date: 2007-12-27 15:43:59 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Change the function signature to be how elements should be. Wouldn't have had this problem if elements were classes... Modified Paths: -------------- pieforms-php5/trunk/src/pieform/elements/hidden.php Modified: pieforms-php5/trunk/src/pieform/elements/hidden.php =================================================================== --- pieforms-php5/trunk/src/pieform/elements/hidden.php 2007-12-27 23:40:57 UTC (rev 239) +++ pieforms-php5/trunk/src/pieform/elements/hidden.php 2007-12-27 23:43:59 UTC (rev 240) @@ -27,11 +27,11 @@ /** * Renders a hidden element. * + * @param Pieform $form The form to render the element for * @param array $element The element to render - * @param Pieform $form The form to render the element for * @return string The HTML for the element */ -function pieform_element_hidden($element, Pieform $form) { +function pieform_element_hidden(Pieform $form, $element) { if (!isset($element['value'])) { throw new PieformException('The hidden element "' . $element['name'] . '" must have a value set'); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-27 23:40:52
|
Revision: 239 http://pieforms.svn.sourceforge.net/pieforms/?rev=239&view=rev Author: oracleshinoda Date: 2007-12-27 15:40:57 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Added the 'signal' module to the included MochiKit.js file. Updated to be the latest MochiKit as well. Modified Paths: -------------- pieforms-php5/trunk/src/static/core/MochiKit/MochiKit.js Modified: pieforms-php5/trunk/src/static/core/MochiKit/MochiKit.js =================================================================== --- pieforms-php5/trunk/src/static/core/MochiKit/MochiKit.js 2007-12-27 23:40:09 UTC (rev 238) +++ pieforms-php5/trunk/src/static/core/MochiKit/MochiKit.js 2007-12-27 23:40:57 UTC (rev 239) @@ -26,7 +26,7 @@ MochiKit.Base.VERSION="1.4"; MochiKit.Base.NAME="MochiKit.Base"; MochiKit.Base.update=function(_1,_2){ -if(_1===null){ +if(_1===null||_1===undefined){ _1={}; } for(var i=1;i<arguments.length;i++){ @@ -57,12 +57,30 @@ return function(){ return n++; }; -},clone:function(obj){ +},clone:function(_b){ var me=arguments.callee; if(arguments.length==1){ -me.prototype=obj; +me.prototype=_b; return new me(); } +},_deps:function(_d,_e){ +if(!(_d in MochiKit)){ +MochiKit[_d]={}; +} +if(typeof (dojo)!="undefined"){ +dojo.provide("MochiKit."+_d); +} +for(var i=0;i<_e.length;i++){ +if(typeof (dojo)!="undefined"){ +dojo.require("MochiKit."+_e[i]); +} +if(typeof (JSAN)!="undefined"){ +JSAN.use("MochiKit."+_e[i],[]); +} +if(!(_e[i] in MochiKit)){ +throw "MochiKit."+_d+" depends on MochiKit."+_e[i]+"!"; +} +} },_flattenArray:function(res,lst){ for(var i=0;i<lst.length;i++){ var o=lst[i]; @@ -78,21 +96,21 @@ },flattenArguments:function(lst){ var res=[]; var m=MochiKit.Base; -var _15=m.extend(null,arguments); -while(_15.length){ -var o=_15.shift(); +var _18=m.extend(null,arguments); +while(_18.length){ +var o=_18.shift(); if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){ for(var i=o.length-1;i>=0;i--){ -_15.unshift(o[i]); +_18.unshift(o[i]); } }else{ res.push(o); } } return res; -},extend:function(_16,obj,_17){ -if(!_17){ -_17=0; +},extend:function(_1b,obj,_1d){ +if(!_1d){ +_1d=0; } if(obj){ var l=obj.length; @@ -104,74 +122,74 @@ throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); } } -if(!_16){ -_16=[]; +if(!_1b){ +_1b=[]; } -for(var i=_17;i<l;i++){ -_16.push(obj[i]); +for(var i=_1d;i<l;i++){ +_1b.push(obj[i]); } } -return _16; -},updatetree:function(_19,obj){ -if(_19===null){ -_19={}; +return _1b; +},updatetree:function(_20,obj){ +if(_20===null||_20===undefined){ +_20={}; } for(var i=1;i<arguments.length;i++){ var o=arguments[i]; if(typeof (o)!="undefined"&&o!==null){ for(var k in o){ var v=o[k]; -if(typeof (_19[k])=="object"&&typeof (v)=="object"){ -arguments.callee(_19[k],v); +if(typeof (_20[k])=="object"&&typeof (v)=="object"){ +arguments.callee(_20[k],v); }else{ -_19[k]=v; +_20[k]=v; } } } } -return _19; -},setdefault:function(_21,obj){ -if(_21===null){ -_21={}; +return _20; +},setdefault:function(_26,obj){ +if(_26===null||_26===undefined){ +_26={}; } for(var i=1;i<arguments.length;i++){ var o=arguments[i]; for(var k in o){ -if(!(k in _21)){ -_21[k]=o[k]; +if(!(k in _26)){ +_26[k]=o[k]; } } } -return _21; +return _26; },keys:function(obj){ -var _22=[]; -for(var _23 in obj){ -_22.push(_23); +var _2c=[]; +for(var _2d in obj){ +_2c.push(_2d); } -return _22; +return _2c; },values:function(obj){ -var _24=[]; -for(var _25 in obj){ -_24.push(obj[_25]); +var _2f=[]; +for(var _30 in obj){ +_2f.push(obj[_30]); } -return _24; +return _2f; },items:function(obj){ -var _26=[]; +var _32=[]; var e; -for(var _28 in obj){ +for(var _34 in obj){ var v; try{ -v=obj[_28]; +v=obj[_34]; } catch(e){ continue; } -_26.push([_28,v]); +_32.push([_34,v]); } -return _26; -},_newNamedError:function(_29,_30,_31){ -_31.prototype=new MochiKit.Base.NamedError(_29.NAME+"."+_30); -_29[_30]=_31; +return _32; +},_newNamedError:function(_36,_37,_38){ +_38.prototype=new MochiKit.Base.NamedError(_36.NAME+"."+_37); +_36[_37]=_38; },operator:{truth:function(a){ return !!a; },lognot:function(a){ @@ -238,23 +256,23 @@ return a||b; },contains:function(a,b){ return b in a; -}},forwardCall:function(_34){ +}},forwardCall:function(_76){ return function(){ -return this[_34].apply(this,arguments); +return this[_76].apply(this,arguments); }; -},itemgetter:function(_35){ +},itemgetter:function(_77){ return function(arg){ -return arg[_35]; +return arg[_77]; }; },typeMatcher:function(){ -var _37={}; +var _79={}; for(var i=0;i<arguments.length;i++){ var typ=arguments[i]; -_37[typ]=typ; +_79[typ]=typ; } return function(){ for(var i=0;i<arguments.length;i++){ -if(!(typeof (arguments[i]) in _37)){ +if(!(typeof (arguments[i]) in _79)){ return false; } } @@ -289,7 +307,7 @@ for(var i=0;i<arguments.length;i++){ var o=arguments[i]; var typ=typeof (o); -if((typ!="object"&&!(typ=="function"&&typeof (o.item)=="function"))||o===null||typeof (o.length)!="number"||o.nodeType===3){ +if((typ!="object"&&!(typ=="function"&&typeof (o.item)=="function"))||o===null||typeof (o.length)!="number"||o.nodeType===3||o.nodeType===4){ return false; } } @@ -306,17 +324,17 @@ if(fn===null){ return MochiKit.Base.extend(null,arguments,1); } -var _40=[]; +var _8a=[]; for(var i=1;i<arguments.length;i++){ -_40.push(fn(arguments[i])); +_8a.push(fn(arguments[i])); } -return _40; +return _8a; },map:function(fn,lst){ var m=MochiKit.Base; var itr=MochiKit.Iter; -var _42=m.isArrayLike; +var _90=m.isArrayLike; if(arguments.length<=2){ -if(!_42(lst)){ +if(!_90(lst)){ if(itr){ lst=itr.list(lst); if(fn===null){ @@ -329,18 +347,18 @@ if(fn===null){ return m.extend(null,lst); } -var _43=[]; +var _91=[]; for(var i=0;i<lst.length;i++){ -_43.push(fn(lst[i])); +_91.push(fn(lst[i])); } -return _43; +return _91; }else{ if(fn===null){ fn=Array; } -var _44=null; +var _93=null; for(i=1;i<arguments.length;i++){ -if(!_42(arguments[i])){ +if(!_90(arguments[i])){ if(itr){ return itr.list(itr.imap.apply(null,arguments)); }else{ @@ -348,34 +366,34 @@ } } var l=arguments[i].length; -if(_44===null||_44>l){ -_44=l; +if(_93===null||_93>l){ +_93=l; } } -_43=[]; -for(i=0;i<_44;i++){ -var _45=[]; +_91=[]; +for(i=0;i<_93;i++){ +var _95=[]; for(var j=1;j<arguments.length;j++){ -_45.push(arguments[j][i]); +_95.push(arguments[j][i]); } -_43.push(fn.apply(this,_45)); +_91.push(fn.apply(this,_95)); } -return _43; +return _91; } },xfilter:function(fn){ -var _47=[]; +var _98=[]; if(fn===null){ fn=MochiKit.Base.operator.truth; } for(var i=1;i<arguments.length;i++){ var o=arguments[i]; if(fn(o)){ -_47.push(o); +_98.push(o); } } -return _47; -},filter:function(fn,lst,_48){ -var _49=[]; +return _98; +},filter:function(fn,lst,_9d){ +var _9e=[]; var m=MochiKit.Base; if(!m.isArrayLike(lst)){ if(MochiKit.Iter){ @@ -388,59 +406,59 @@ fn=m.operator.truth; } if(typeof (Array.prototype.filter)=="function"){ -return Array.prototype.filter.call(lst,fn,_48); +return Array.prototype.filter.call(lst,fn,_9d); }else{ -if(typeof (_48)=="undefined"||_48===null){ +if(typeof (_9d)=="undefined"||_9d===null){ for(var i=0;i<lst.length;i++){ var o=lst[i]; if(fn(o)){ -_49.push(o); +_9e.push(o); } } }else{ for(i=0;i<lst.length;i++){ o=lst[i]; -if(fn.call(_48,o)){ -_49.push(o); +if(fn.call(_9d,o)){ +_9e.push(o); } } } } -return _49; -},_wrapDumbFunction:function(_50){ +return _9e; +},_wrapDumbFunction:function(_a2){ return function(){ switch(arguments.length){ case 0: -return _50(); +return _a2(); case 1: -return _50(arguments[0]); +return _a2(arguments[0]); case 2: -return _50(arguments[0],arguments[1]); +return _a2(arguments[0],arguments[1]); case 3: -return _50(arguments[0],arguments[1],arguments[2]); +return _a2(arguments[0],arguments[1],arguments[2]); } -var _51=[]; +var _a3=[]; for(var i=0;i<arguments.length;i++){ -_51.push("arguments["+i+"]"); +_a3.push("arguments["+i+"]"); } -return eval("(func("+_51.join(",")+"))"); +return eval("(func("+_a3.join(",")+"))"); }; -},methodcaller:function(_52){ -var _53=MochiKit.Base.extend(null,arguments,1); -if(typeof (_52)=="function"){ +},methodcaller:function(_a5){ +var _a6=MochiKit.Base.extend(null,arguments,1); +if(typeof (_a5)=="function"){ return function(obj){ -return _52.apply(obj,_53); +return _a5.apply(obj,_a6); }; }else{ return function(obj){ -return obj[_52].apply(obj,_53); +return obj[_a5].apply(obj,_a6); }; } -},method:function(_54,_55){ +},method:function(_a9,_aa){ var m=MochiKit.Base; -return m.bind.apply(this,m.extend([_55,_54],arguments,2)); +return m.bind.apply(this,m.extend([_aa,_a9],arguments,2)); },compose:function(f1,f2){ -var _58=[]; +var _ae=[]; var m=MochiKit.Base; if(arguments.length===0){ throw new TypeError("compose() requires at least one argument"); @@ -450,84 +468,84 @@ if(typeof (fn)!="function"){ throw new TypeError(m.repr(fn)+" is not a function"); } -_58.push(fn); +_ae.push(fn); } return function(){ -var _59=arguments; -for(var i=_58.length-1;i>=0;i--){ -_59=[_58[i].apply(this,_59)]; +var _b2=arguments; +for(var i=_ae.length-1;i>=0;i--){ +_b2=[_ae[i].apply(this,_b2)]; } -return _59[0]; +return _b2[0]; }; -},bind:function(_60,_61){ -if(typeof (_60)=="string"){ -_60=_61[_60]; +},bind:function(_b4,_b5){ +if(typeof (_b4)=="string"){ +_b4=_b5[_b4]; } -var _62=_60.im_func; -var _63=_60.im_preargs; -var _64=_60.im_self; +var _b6=_b4.im_func; +var _b7=_b4.im_preargs; +var _b8=_b4.im_self; var m=MochiKit.Base; -if(typeof (_60)=="function"&&typeof (_60.apply)=="undefined"){ -_60=m._wrapDumbFunction(_60); +if(typeof (_b4)=="function"&&typeof (_b4.apply)=="undefined"){ +_b4=m._wrapDumbFunction(_b4); } -if(typeof (_62)!="function"){ -_62=_60; +if(typeof (_b6)!="function"){ +_b6=_b4; } -if(typeof (_61)!="undefined"){ -_64=_61; +if(typeof (_b5)!="undefined"){ +_b8=_b5; } -if(typeof (_63)=="undefined"){ -_63=[]; +if(typeof (_b7)=="undefined"){ +_b7=[]; }else{ -_63=_63.slice(); +_b7=_b7.slice(); } -m.extend(_63,arguments,2); -var _65=function(){ -var _66=arguments; +m.extend(_b7,arguments,2); +var _ba=function(){ +var _bb=arguments; var me=arguments.callee; if(me.im_preargs.length>0){ -_66=m.concat(me.im_preargs,_66); +_bb=m.concat(me.im_preargs,_bb); } -var _61=me.im_self; -if(!_61){ -_61=this; +var _bd=me.im_self; +if(!_bd){ +_bd=this; } -return me.im_func.apply(_61,_66); +return me.im_func.apply(_bd,_bb); }; -_65.im_self=_64; -_65.im_func=_62; -_65.im_preargs=_63; -return _65; -},bindMethods:function(_67){ -var _68=MochiKit.Base.bind; -for(var k in _67){ -var _69=_67[k]; -if(typeof (_69)=="function"){ -_67[k]=_68(_69,_67); +_ba.im_self=_b8; +_ba.im_func=_b6; +_ba.im_preargs=_b7; +return _ba; +},bindMethods:function(_be){ +var _bf=MochiKit.Base.bind; +for(var k in _be){ +var _c1=_be[k]; +if(typeof (_c1)=="function"){ +_be[k]=_bf(_c1,_be); } } -},registerComparator:function(_70,_71,_72,_73){ -MochiKit.Base.comparatorRegistry.register(_70,_71,_72,_73); +},registerComparator:function(_c2,_c3,_c4,_c5){ +MochiKit.Base.comparatorRegistry.register(_c2,_c3,_c4,_c5); },_primitives:{"boolean":true,"string":true,"number":true},compare:function(a,b){ if(a==b){ return 0; } -var _74=(typeof (a)=="undefined"||a===null); -var _75=(typeof (b)=="undefined"||b===null); -if(_74&&_75){ +var _c8=(typeof (a)=="undefined"||a===null); +var _c9=(typeof (b)=="undefined"||b===null); +if(_c8&&_c9){ return 0; }else{ -if(_74){ +if(_c8){ return -1; }else{ -if(_75){ +if(_c9){ return 1; } } } var m=MochiKit.Base; -var _76=m._primitives; -if(!(typeof (a) in _76&&typeof (b) in _76)){ +var _cb=m._primitives; +if(!(typeof (a) in _cb&&typeof (b) in _cb)){ try{ return m.comparatorRegistry.match(a,b); } @@ -544,31 +562,31 @@ return 1; } } -var _77=m.repr; -throw new TypeError(_77(a)+" and "+_77(b)+" can not be compared"); +var _cc=m.repr; +throw new TypeError(_cc(a)+" and "+_cc(b)+" can not be compared"); },compareDateLike:function(a,b){ return MochiKit.Base.compare(a.getTime(),b.getTime()); },compareArrayLike:function(a,b){ -var _78=MochiKit.Base.compare; -var _79=a.length; -var _80=0; -if(_79>b.length){ -_80=1; -_79=b.length; +var _d1=MochiKit.Base.compare; +var _d2=a.length; +var _d3=0; +if(_d2>b.length){ +_d3=1; +_d2=b.length; }else{ -if(_79<b.length){ -_80=-1; +if(_d2<b.length){ +_d3=-1; } } -for(var i=0;i<_79;i++){ -var cmp=_78(a[i],b[i]); +for(var i=0;i<_d2;i++){ +var cmp=_d1(a[i],b[i]); if(cmp){ return cmp; } } -return _80; -},registerRepr:function(_82,_83,_84,_85){ -MochiKit.Base.reprRegistry.register(_82,_83,_84,_85); +return _d3; +},registerRepr:function(_d6,_d7,_d8,_d9){ +MochiKit.Base.reprRegistry.register(_d6,_d7,_d8,_d9); },repr:function(o){ if(typeof (o)=="undefined"){ return "undefined"; @@ -593,19 +611,19 @@ } } try{ -var _86=(o+""); +var _db=(o+""); } catch(e){ return "["+typeof (o)+"]"; } if(typeof (o)=="function"){ -o=_86.replace(/^\s+/,""); -var idx=o.indexOf("{"); +_db=_db.replace(/^\s+/,"").replace(/\s+/g," "); +var idx=_db.indexOf("{"); if(idx!=-1){ -o=o.substr(0,idx)+"{...}"; +_db=_db.substr(0,idx)+"{...}"; } } -return _86; +return _db; },reprArrayLike:function(o){ var m=MochiKit.Base; return "["+m.map(m.repr,o).join(", ")+"]"; @@ -613,13 +631,19 @@ return ("\""+o.replace(/(["\\])/g,"\\$1")+"\"").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r"); },reprNumber:function(o){ return o+""; -},registerJSON:function(_88,_89,_90,_91){ -MochiKit.Base.jsonRegistry.register(_88,_89,_90,_91); +},registerJSON:function(_e1,_e2,_e3,_e4){ +MochiKit.Base.jsonRegistry.register(_e1,_e2,_e3,_e4); },evalJSON:function(){ -return eval("("+arguments[0]+")"); +return eval("("+MochiKit.Base._filterJSON(arguments[0])+")"); +},_filterJSON:function(s){ +var m=s.match(/^\s*\/\*(.*)\*\/\s*$/); +if(m){ +return m[1]; +} +return s; },serializeJSON:function(o){ -var _92=typeof (o); -if(_92=="number"||_92=="boolean"){ +var _e8=typeof (o); +if(_e8=="number"||_e8=="boolean"){ return o+""; }else{ if(o===null){ @@ -627,25 +651,25 @@ } } var m=MochiKit.Base; -var _93=m.reprString; -if(_92=="string"){ -return _93(o); +var _ea=m.reprString; +if(_e8=="string"){ +return _ea(o); } var me=arguments.callee; -var _94; +var _ec; if(typeof (o.__json__)=="function"){ -_94=o.__json__(); -if(o!==_94){ -return me(_94); +_ec=o.__json__(); +if(o!==_ec){ +return me(_ec); } } if(typeof (o.json)=="function"){ -_94=o.json(); -if(o!==_94){ -return me(_94); +_ec=o.json(); +if(o!==_ec){ +return me(_ec); } } -if(_92!="function"&&typeof (o.length)=="number"){ +if(_e8!="function"&&typeof (o.length)=="number"){ var res=[]; for(var i=0;i<o.length;i++){ var val=me(o[i]); @@ -657,9 +681,9 @@ return "["+res.join(", ")+"]"; } try{ -_94=m.jsonRegistry.match(o); -if(o!==_94){ -return me(_94); +_ec=m.jsonRegistry.match(o); +if(o!==_ec){ +return me(_ec); } } catch(e){ @@ -667,20 +691,20 @@ throw e; } } -if(_92=="undefined"){ +if(_e8=="undefined"){ throw new TypeError("undefined can not be serialized as JSON"); } -if(_92=="function"){ +if(_e8=="function"){ return null; } res=[]; for(var k in o){ -var _96; +var _f1; if(typeof (k)=="number"){ -_96="\""+k+"\""; +_f1="\""+k+"\""; }else{ if(typeof (k)=="string"){ -_96=_93(k); +_f1=_ea(k); }else{ continue; } @@ -689,37 +713,37 @@ if(typeof (val)!="string"){ continue; } -res.push(_96+":"+val); +res.push(_f1+":"+val); } return "{"+res.join(", ")+"}"; },objEqual:function(a,b){ return (MochiKit.Base.compare(a,b)===0); -},arrayEqual:function(_97,arr){ -if(_97.length!=arr.length){ +},arrayEqual:function(_f4,arr){ +if(_f4.length!=arr.length){ return false; } -return (MochiKit.Base.compare(_97,arr)===0); +return (MochiKit.Base.compare(_f4,arr)===0); },concat:function(){ -var _99=[]; -var _100=MochiKit.Base.extend; +var _f6=[]; +var _f7=MochiKit.Base.extend; for(var i=0;i<arguments.length;i++){ -_100(_99,arguments[i]); +_f7(_f6,arguments[i]); } -return _99; +return _f6; },keyComparator:function(key){ var m=MochiKit.Base; -var _102=m.compare; +var _fb=m.compare; if(arguments.length==1){ return function(a,b){ -return _102(a[key],b[key]); +return _fb(a[key],b[key]); }; } -var _103=m.extend(null,arguments); +var _fe=m.extend(null,arguments); return function(a,b){ var rval=0; -for(var i=0;(rval===0)&&(i<_103.length);i++){ -var key=_103[i]; -rval=_102(a[key],b[key]); +for(var i=0;(rval===0)&&(i<_fe.length);i++){ +var key=_fe[i]; +rval=_fb(a[key],b[key]); } return rval; }; @@ -731,15 +755,15 @@ },partial:function(func){ var m=MochiKit.Base; return m.bind.apply(this,m.extend([func,undefined],arguments,1)); -},listMinMax:function(_107,lst){ +},listMinMax:function(_10a,lst){ if(lst.length===0){ return null; } var cur=lst[0]; -var _109=MochiKit.Base.compare; +var _10d=MochiKit.Base.compare; for(var i=1;i<lst.length;i++){ var o=lst[i]; -if(_109(o,cur)==_107){ +if(_10d(o,cur)==_10a){ cur=o; } } @@ -748,15 +772,15 @@ return MochiKit.Base.listMinMax(1,arguments); },objMin:function(){ return MochiKit.Base.listMinMax(-1,arguments); -},findIdentical:function(lst,_110,_111,end){ +},findIdentical:function(lst,_111,_112,end){ if(typeof (end)=="undefined"||end===null){ end=lst.length; } -if(typeof (_111)=="undefined"||_111===null){ -_111=0; +if(typeof (_112)=="undefined"||_112===null){ +_112=0; } -for(var i=_111;i<end;i++){ -if(lst[i]===_110){ +for(var i=_112;i<end;i++){ +if(lst[i]===_111){ return i; } } @@ -765,11 +789,11 @@ var sum=0; var m=MochiKit.Base; var args=m.extend(null,arguments); -var _115=args.length; +var _118=args.length; while(args.length){ var o=args.shift(); if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){ -_115+=o.length-1; +_118+=o.length-1; for(var i=o.length-1;i>=0;i--){ sum+=o[i]; } @@ -777,10 +801,10 @@ sum+=o; } } -if(_115<=0){ +if(_118<=0){ throw new TypeError("mean() requires at least one argument"); } -return sum/_115; +return sum/_118; },median:function(){ var data=MochiKit.Base.flattenArguments(arguments); if(data.length===0){ @@ -788,43 +812,43 @@ } data.sort(compare); if(data.length%2==0){ -var _117=data.length/2; -return (data[_117]+data[_117-1])/2; +var _11c=data.length/2; +return (data[_11c]+data[_11c-1])/2; }else{ return data[(data.length-1)/2]; } -},findValue:function(lst,_118,_119,end){ +},findValue:function(lst,_11e,_11f,end){ if(typeof (end)=="undefined"||end===null){ end=lst.length; } -if(typeof (_119)=="undefined"||_119===null){ -_119=0; +if(typeof (_11f)=="undefined"||_11f===null){ +_11f=0; } var cmp=MochiKit.Base.compare; -for(var i=_119;i<end;i++){ -if(cmp(lst[i],_118)===0){ +for(var i=_11f;i<end;i++){ +if(cmp(lst[i],_11e)===0){ return i; } } return -1; -},nodeWalk:function(node,_121){ -var _122=[node]; -var _123=MochiKit.Base.extend; -while(_122.length){ -var res=_121(_122.shift()); +},nodeWalk:function(node,_124){ +var _125=[node]; +var _126=MochiKit.Base.extend; +while(_125.length){ +var res=_124(_125.shift()); if(res){ -_123(_122,res); +_126(_125,res); } } -},nameFunctions:function(_124){ -var base=_124.NAME; +},nameFunctions:function(_128){ +var base=_128.NAME; if(typeof (base)=="undefined"){ base=""; }else{ base=base+"."; } -for(var name in _124){ -var o=_124[name]; +for(var name in _128){ +var o=_128[name]; if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){ try{ o.NAME=base+name; @@ -833,78 +857,79 @@ } } } -},queryString:function(_127,_128){ -if(typeof (MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof (_127)=="string"||(typeof (_127.nodeType)!="undefined"&&_127.nodeType>0))){ -var kv=MochiKit.DOM.formContents(_127); -_127=kv[0]; -_128=kv[1]; +},queryString:function(_12c,_12d){ +if(typeof (MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof (_12c)=="string"||(typeof (_12c.nodeType)!="undefined"&&_12c.nodeType>0))){ +var kv=MochiKit.DOM.formContents(_12c); +_12c=kv[0]; +_12d=kv[1]; }else{ if(arguments.length==1){ -if(typeof (_127.length)=="number"&&_127.length==2){ -return arguments.callee(_127[0],_127[1]); +if(typeof (_12c.length)=="number"&&_12c.length==2){ +return arguments.callee(_12c[0],_12c[1]); } -var o=_127; -_127=[]; -_128=[]; +var o=_12c; +_12c=[]; +_12d=[]; for(var k in o){ var v=o[k]; if(typeof (v)=="function"){ continue; }else{ -if(typeof (v)!="string"&&typeof (v.length)=="number"){ +if(MochiKit.Base.isArrayLike(v)){ for(var i=0;i<v.length;i++){ -_127.push(k); -_128.push(v[i]); +_12c.push(k); +_12d.push(v[i]); } }else{ -_127.push(k); -_128.push(v); +_12c.push(k); +_12d.push(v); } } } } } var rval=[]; -var len=Math.min(_127.length,_128.length); -var _131=MochiKit.Base.urlEncode; +var len=Math.min(_12c.length,_12d.length); +var _135=MochiKit.Base.urlEncode; for(var i=0;i<len;i++){ -v=_128[i]; +v=_12d[i]; if(typeof (v)!="undefined"&&v!==null){ -rval.push(_131(_127[i])+"="+_131(v)); +rval.push(_135(_12c[i])+"="+_135(v)); } } return rval.join("&"); -},parseQueryString:function(_132,_133){ -var qstr=(_132.charAt(0)=="?")?_132.substring(1):_132; -var _135=qstr.replace(/\+/g,"%20").split(/(\&\;|\&\#38\;|\&|\&)/); +},parseQueryString:function(_136,_137){ +var qstr=(_136.charAt(0)=="?")?_136.substring(1):_136; +var _139=qstr.replace(/\+/g,"%20").split(/\&\;|\&\#38\;|\&|\&/); var o={}; -var _136; +var _13b; if(typeof (decodeURIComponent)!="undefined"){ -_136=decodeURIComponent; +_13b=decodeURIComponent; }else{ -_136=unescape; +_13b=unescape; } -if(_133){ -for(var i=0;i<_135.length;i++){ -var pair=_135[i].split("="); -if(pair.length!==2){ +if(_137){ +for(var i=0;i<_139.length;i++){ +var pair=_139[i].split("="); +var name=_13b(pair.shift()); +if(!name){ continue; } -var name=_136(pair[0]); var arr=o[name]; if(!(arr instanceof Array)){ arr=[]; o[name]=arr; } -arr.push(_136(pair[1])); +arr.push(_13b(pair.join("="))); } }else{ -for(i=0;i<_135.length;i++){ -pair=_135[i].split("="); -if(pair.length!==2){ +for(i=0;i<_139.length;i++){ +pair=_139[i].split("="); +var name=pair.shift(); +if(!name){ continue; } -o[_136(pair[0])]=_136(pair[1]); +o[_13b(name)]=_13b(pair.join("=")); } } return o; @@ -912,11 +937,11 @@ MochiKit.Base.AdapterRegistry=function(){ this.pairs=[]; }; -MochiKit.Base.AdapterRegistry.prototype={register:function(name,_138,wrap,_140){ -if(_140){ -this.pairs.unshift([name,_138,wrap]); +MochiKit.Base.AdapterRegistry.prototype={register:function(name,_141,wrap,_143){ +if(_143){ +this.pairs.unshift([name,_141,wrap]); }else{ -this.pairs.push([name,_138,wrap]); +this.pairs.push([name,_141,wrap]); } },match:function(){ for(var i=0;i<this.pairs.length;i++){ @@ -938,13 +963,13 @@ }}; MochiKit.Base.EXPORT=["flattenArray","noop","camelize","counter","clone","extend","update","updatetree","setdefault","keys","values","items","NamedError","operator","forwardCall","itemgetter","typeMatcher","isCallable","isUndefined","isUndefinedOrNull","isNull","isEmpty","isNotEmpty","isArrayLike","isDateLike","xmap","map","xfilter","filter","methodcaller","compose","bind","bindMethods","NotFound","AdapterRegistry","registerComparator","compare","registerRepr","repr","objEqual","arrayEqual","concat","keyComparator","reverseKeyComparator","partial","merge","listMinMax","listMax","listMin","objMax","objMin","nodeWalk","zip","urlEncode","queryString","serializeJSON","registerJSON","evalJSON","parseQueryString","findValue","findIdentical","flattenArguments","method","average","mean","median"]; MochiKit.Base.EXPORT_OK=["nameFunctions","comparatorRegistry","reprRegistry","jsonRegistry","compareDateLike","compareArrayLike","reprArrayLike","reprString","reprNumber"]; -MochiKit.Base._exportSymbols=function(_141,_142){ +MochiKit.Base._exportSymbols=function(_149,_14a){ if(!MochiKit.__export__){ return; } -var all=_142.EXPORT_TAGS[":all"]; +var all=_14a.EXPORT_TAGS[":all"]; for(var i=0;i<all.length;i++){ -_141[all[i]]=_142[all[i]]; +_149[all[i]]=_14a[all[i]]; } }; MochiKit.Base.__new__=function(){ @@ -953,12 +978,12 @@ m.forward=m.forwardCall; m.find=m.findValue; if(typeof (encodeURIComponent)!="undefined"){ -m.urlEncode=function(_144){ -return encodeURIComponent(_144).replace(/\'/g,"%27"); +m.urlEncode=function(_14e){ +return encodeURIComponent(_14e).replace(/\'/g,"%27"); }; }else{ -m.urlEncode=function(_145){ -return escape(_145).replace(/\+/g,"%2B").replace(/\"/g,"%22").rval.replace(/\'/g,"%27"); +m.urlEncode=function(_14f){ +return escape(_14f).replace(/\+/g,"%2B").replace(/\"/g,"%22").rval.replace(/\'/g,"%27"); }; } m.NamedError=function(name){ @@ -998,26 +1023,611 @@ compare=MochiKit.Base.compare; compose=MochiKit.Base.compose; serializeJSON=MochiKit.Base.serializeJSON; +mean=MochiKit.Base.mean; +median=MochiKit.Base.median; } MochiKit.Base._exportSymbols(this,MochiKit.Base); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.DOM"); -dojo.require("MochiKit.Base"); +MochiKit.Base._deps("Iter",["Base"]); +MochiKit.Iter.NAME="MochiKit.Iter"; +MochiKit.Iter.VERSION="1.4"; +MochiKit.Base.update(MochiKit.Iter,{__repr__:function(){ +return "["+this.NAME+" "+this.VERSION+"]"; +},toString:function(){ +return this.__repr__(); +},registerIteratorFactory:function(name,_153,_154,_155){ +MochiKit.Iter.iteratorRegistry.register(name,_153,_154,_155); +},iter:function(_156,_157){ +var self=MochiKit.Iter; +if(arguments.length==2){ +return self.takewhile(function(a){ +return a!=_157; +},_156); } -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Base",[]); +if(typeof (_156.next)=="function"){ +return _156; +}else{ +if(typeof (_156.iter)=="function"){ +return _156.iter(); } +} try{ -if(typeof (MochiKit.Base)=="undefined"){ -throw ""; +return self.iteratorRegistry.match(_156); } +catch(e){ +var m=MochiKit.Base; +if(e==m.NotFound){ +e=new TypeError(typeof (_156)+": "+m.repr(_156)+" is not iterable"); } +throw e; +} +},count:function(n){ +if(!n){ +n=0; +} +var m=MochiKit.Base; +return {repr:function(){ +return "count("+n+")"; +},toString:m.forwardCall("repr"),next:m.counter(n)}; +},cycle:function(p){ +var self=MochiKit.Iter; +var m=MochiKit.Base; +var lst=[]; +var _161=self.iter(p); +return {repr:function(){ +return "cycle(...)"; +},toString:m.forwardCall("repr"),next:function(){ +try{ +var rval=_161.next(); +lst.push(rval); +return rval; +} catch(e){ -throw "MochiKit.DOM depends on MochiKit.Base!"; +if(e!=self.StopIteration){ +throw e; } -if(typeof (MochiKit.DOM)=="undefined"){ -MochiKit.DOM={}; +if(lst.length===0){ +this.next=function(){ +throw self.StopIteration; +}; +}else{ +var i=-1; +this.next=function(){ +i=(i+1)%lst.length; +return lst[i]; +}; } +return this.next(); +} +}}; +},repeat:function(elem,n){ +var m=MochiKit.Base; +if(typeof (n)=="undefined"){ +return {repr:function(){ +return "repeat("+m.repr(elem)+")"; +},toString:m.forwardCall("repr"),next:function(){ +return elem; +}}; +} +return {repr:function(){ +return "repeat("+m.repr(elem)+", "+n+")"; +},toString:m.forwardCall("repr"),next:function(){ +if(n<=0){ +throw MochiKit.Iter.StopIteration; +} +n-=1; +return elem; +}}; +},next:function(_167){ +return _167.next(); +},izip:function(p,q){ +var m=MochiKit.Base; +var self=MochiKit.Iter; +var next=self.next; +var _16d=m.map(self.iter,arguments); +return {repr:function(){ +return "izip(...)"; +},toString:m.forwardCall("repr"),next:function(){ +return m.map(next,_16d); +}}; +},ifilter:function(pred,seq){ +var m=MochiKit.Base; +seq=MochiKit.Iter.iter(seq); +if(pred===null){ +pred=m.operator.truth; +} +return {repr:function(){ +return "ifilter(...)"; +},toString:m.forwardCall("repr"),next:function(){ +while(true){ +var rval=seq.next(); +if(pred(rval)){ +return rval; +} +} +return undefined; +}}; +},ifilterfalse:function(pred,seq){ +var m=MochiKit.Base; +seq=MochiKit.Iter.iter(seq); +if(pred===null){ +pred=m.operator.truth; +} +return {repr:function(){ +return "ifilterfalse(...)"; +},toString:m.forwardCall("repr"),next:function(){ +while(true){ +var rval=seq.next(); +if(!pred(rval)){ +return rval; +} +} +return undefined; +}}; +},islice:function(seq){ +var self=MochiKit.Iter; +var m=MochiKit.Base; +seq=self.iter(seq); +var _179=0; +var stop=0; +var step=1; +var i=-1; +if(arguments.length==2){ +stop=arguments[1]; +}else{ +if(arguments.length==3){ +_179=arguments[1]; +stop=arguments[2]; +}else{ +_179=arguments[1]; +stop=arguments[2]; +step=arguments[3]; +} +} +return {repr:function(){ +return "islice("+["...",_179,stop,step].join(", ")+")"; +},toString:m.forwardCall("repr"),next:function(){ +var rval; +while(i<_179){ +rval=seq.next(); +i++; +} +if(_179>=stop){ +throw self.StopIteration; +} +_179+=step; +return rval; +}}; +},imap:function(fun,p,q){ +var m=MochiKit.Base; +var self=MochiKit.Iter; +var _183=m.map(self.iter,m.extend(null,arguments,1)); +var map=m.map; +var next=self.next; +return {repr:function(){ +return "imap(...)"; +},toString:m.forwardCall("repr"),next:function(){ +return fun.apply(this,map(next,_183)); +}}; +},applymap:function(fun,seq,self){ +seq=MochiKit.Iter.iter(seq); +var m=MochiKit.Base; +return {repr:function(){ +return "applymap(...)"; +},toString:m.forwardCall("repr"),next:function(){ +return fun.apply(self,seq.next()); +}}; +},chain:function(p,q){ +var self=MochiKit.Iter; +var m=MochiKit.Base; +if(arguments.length==1){ +return self.iter(arguments[0]); +} +var _18e=m.map(self.iter,arguments); +return {repr:function(){ +return "chain(...)"; +},toString:m.forwardCall("repr"),next:function(){ +while(_18e.length>1){ +try{ +var _18f=_18e[0].next(); +return _18f; +} +catch(e){ +if(e!=self.StopIteration){ +throw e; +} +_18e.shift(); +var _18f=_18e[0].next(); +return _18f; +} +} +if(_18e.length==1){ +var arg=_18e.shift(); +this.next=m.bind("next",arg); +return this.next(); +} +throw self.StopIteration; +}}; +},takewhile:function(pred,seq){ +var self=MochiKit.Iter; +seq=self.iter(seq); +return {repr:function(){ +return "takewhile(...)"; +},toString:MochiKit.Base.forwardCall("repr"),next:function(){ +var rval=seq.next(); +if(!pred(rval)){ +this.next=function(){ +throw self.StopIteration; +}; +this.next(); +} +return rval; +}}; +},dropwhile:function(pred,seq){ +seq=MochiKit.Iter.iter(seq); +var m=MochiKit.Base; +var bind=m.bind; +return {"repr":function(){ +return "dropwhile(...)"; +},"toString":m.forwardCall("repr"),"next":function(){ +while(true){ +var rval=seq.next(); +if(!pred(rval)){ +break; +} +} +this.next=bind("next",seq); +return rval; +}}; +},_tee:function(_19a,sync,_19c){ +sync.pos[_19a]=-1; +var m=MochiKit.Base; +var _19e=m.listMin; +return {repr:function(){ +return "tee("+_19a+", ...)"; +},toString:m.forwardCall("repr"),next:function(){ +var rval; +var i=sync.pos[_19a]; +if(i==sync.max){ +rval=_19c.next(); +sync.deque.push(rval); +sync.max+=1; +sync.pos[_19a]+=1; +}else{ +rval=sync.deque[i-sync.min]; +sync.pos[_19a]+=1; +if(i==sync.min&&_19e(sync.pos)!=sync.min){ +sync.min+=1; +sync.deque.shift(); +} +} +return rval; +}}; +},tee:function(_1a1,n){ +var rval=[]; +var sync={"pos":[],"deque":[],"max":-1,"min":-1}; +if(arguments.length==1||typeof (n)=="undefined"||n===null){ +n=2; +} +var self=MochiKit.Iter; +_1a1=self.iter(_1a1); +var _tee=self._tee; +for(var i=0;i<n;i++){ +rval.push(_tee(i,sync,_1a1)); +} +return rval; +},list:function(_1a8){ +var rval; +if(_1a8 instanceof Array){ +return _1a8.slice(); +} +if(typeof (_1a8)=="function"&&!(_1a8 instanceof Function)&&typeof (_1a8.length)=="number"){ +rval=[]; +for(var i=0;i<_1a8.length;i++){ +rval.push(_1a8[i]); +} +return rval; +} +var self=MochiKit.Iter; +_1a8=self.iter(_1a8); +var rval=[]; +var _1ac; +try{ +while(true){ +_1ac=_1a8.next(); +rval.push(_1ac); +} +} +catch(e){ +if(e!=self.StopIteration){ +throw e; +} +return rval; +} +return undefined; +},reduce:function(fn,_1ae,_1af){ +var i=0; +var x=_1af; +var self=MochiKit.Iter; +_1ae=self.iter(_1ae); +if(arguments.length<3){ +try{ +x=_1ae.next(); +} +catch(e){ +if(e==self.StopIteration){ +e=new TypeError("reduce() of empty sequence with no initial value"); +} +throw e; +} +i++; +} +try{ +while(true){ +x=fn(x,_1ae.next()); +} +} +catch(e){ +if(e!=self.StopIteration){ +throw e; +} +} +return x; +},range:function(){ +var _1b3=0; +var stop=0; +var step=1; +if(arguments.length==1){ +stop=arguments[0]; +}else{ +if(arguments.length==2){ +_1b3=arguments[0]; +stop=arguments[1]; +}else{ +if(arguments.length==3){ +_1b3=arguments[0]; +stop=arguments[1]; +step=arguments[2]; +}else{ +throw new TypeError("range() takes 1, 2, or 3 arguments!"); +} +} +} +if(step===0){ +throw new TypeError("range() step must not be 0"); +} +return {next:function(){ +if((step>0&&_1b3>=stop)||(step<0&&_1b3<=stop)){ +throw MochiKit.Iter.StopIteration; +} +var rval=_1b3; +_1b3+=step; +return rval; +},repr:function(){ +return "range("+[_1b3,stop,step].join(", ")+")"; +},toString:MochiKit.Base.forwardCall("repr")}; +},sum:function(_1b7,_1b8){ +if(typeof (_1b8)=="undefined"||_1b8===null){ +_1b8=0; +} +var x=_1b8; +var self=MochiKit.Iter; +_1b7=self.iter(_1b7); +try{ +while(true){ +x+=_1b7.next(); +} +} +catch(e){ +if(e!=self.StopIteration){ +throw e; +} +} +return x; +},exhaust:function(_1bb){ +var self=MochiKit.Iter; +_1bb=self.iter(_1bb); +try{ +while(true){ +_1bb.next(); +} +} +catch(e){ +if(e!=self.StopIteration){ +throw e; +} +} +},forEach:function(_1bd,func,self){ +var m=MochiKit.Base; +if(arguments.length>2){ +func=m.bind(func,self); +} +if(m.isArrayLike(_1bd)){ +try{ +for(var i=0;i<_1bd.length;i++){ +func(_1bd[i]); +} +} +catch(e){ +if(e!=MochiKit.Iter.StopIteration){ +throw e; +} +} +}else{ +self=MochiKit.Iter; +self.exhaust(self.imap(func,_1bd)); +} +},every:function(_1c2,func){ +var self=MochiKit.Iter; +try{ +self.ifilterfalse(func,_1c2).next(); +return false; +} +catch(e){ +if(e!=self.StopIteration){ +throw e; +} +return true; +} +},sorted:function(_1c5,cmp){ +var rval=MochiKit.Iter.list(_1c5); +if(arguments.length==1){ +cmp=MochiKit.Base.compare; +} +rval.sort(cmp); +return rval; +},reversed:function(_1c8){ +var rval=MochiKit.Iter.list(_1c8); +rval.reverse(); +return rval; +},some:function(_1ca,func){ +var self=MochiKit.Iter; +try{ +self.ifilter(func,_1ca).next(); +return true; +} +catch(e){ +if(e!=self.StopIteration){ +throw e; +} +return false; +} +},iextend:function(lst,_1ce){ +if(MochiKit.Base.isArrayLike(_1ce)){ +for(var i=0;i<_1ce.length;i++){ +lst.push(_1ce[i]); +} +}else{ +var self=MochiKit.Iter; +_1ce=self.iter(_1ce); +try{ +while(true){ +lst.push(_1ce.next()); +} +} +catch(e){ +if(e!=self.StopIteration){ +throw e; +} +} +} +return lst; +},groupby:function(_1d1,_1d2){ +var m=MochiKit.Base; +var self=MochiKit.Iter; +if(arguments.length<2){ +_1d2=m.operator.identity; +} +_1d1=self.iter(_1d1); +var pk=undefined; +var k=undefined; +var v; +function fetch(){ +v=_1d1.next(); +k=_1d2(v); +} +function eat(){ +var ret=v; +v=undefined; +return ret; +} +var _1d9=true; +var _1da=m.compare; +return {repr:function(){ +return "groupby(...)"; +},next:function(){ +while(_1da(k,pk)===0){ +fetch(); +if(_1d9){ +_1d9=false; +break; +} +} +pk=k; +return [k,{next:function(){ +if(v==undefined){ +fetch(); +} +if(_1da(k,pk)!==0){ +throw self.StopIteration; +} +return eat(); +}}]; +}}; +},groupby_as_array:function(_1db,_1dc){ +var m=MochiKit.Base; +var self=MochiKit.Iter; +if(arguments.length<2){ +_1dc=m.operator.identity; +} +_1db=self.iter(_1db); +var _1df=[]; +var _1e0=true; +var _1e1; +var _1e2=m.compare; +while(true){ +try{ +var _1e3=_1db.next(); +var key=_1dc(_1e3); +} +catch(e){ +if(e==self.StopIteration){ +break; +} +throw e; +} +if(_1e0||_1e2(key,_1e1)!==0){ +var _1e5=[]; +_1df.push([key,_1e5]); +} +_1e5.push(_1e3); +_1e0=false; +_1e1=key; +} +return _1df; +},arrayLikeIter:function(_1e6){ +var i=0; +return {repr:function(){ +return "arrayLikeIter(...)"; +},toString:MochiKit.Base.forwardCall("repr"),next:function(){ +if(i>=_1e6.length){ +throw MochiKit.Iter.StopIteration; +} +return _1e6[i++]; +}}; +},hasIterateNext:function(_1e8){ +return (_1e8&&typeof (_1e8.iterateNext)=="function"); +},iterateNextIter:function(_1e9){ +return {repr:function(){ +return "iterateNextIter(...)"; +},toString:MochiKit.Base.forwardCall("repr"),next:function(){ +var rval=_1e9.iterateNext(); +if(rval===null||rval===undefined){ +throw MochiKit.Iter.StopIteration; +} +return rval; +}}; +}}); +MochiKit.Iter.EXPORT_OK=["iteratorRegistry","arrayLikeIter","hasIterateNext","iterateNextIter"]; +MochiKit.Iter.EXPORT=["StopIteration","registerIteratorFactory","iter","count","cycle","repeat","next","izip","ifilter","ifilterfalse","islice","imap","applymap","chain","takewhile","dropwhile","tee","list","reduce","range","sum","exhaust","forEach","every","sorted","reversed","some","iextend","groupby","groupby_as_array"]; +MochiKit.Iter.__new__=function(){ +var m=MochiKit.Base; +if(typeof (StopIteration)!="undefined"){ +this.StopIteration=StopIteration; +}else{ +this.StopIteration=new m.NamedError("StopIteration"); +} +this.iteratorRegistry=new m.AdapterRegistry(); +this.registerIteratorFactory("arrayLike",m.isArrayLike,this.arrayLikeIter); +this.registerIteratorFactory("iterateNext",this.hasIterateNext,this.iterateNextIter); +this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; +m.nameFunctions(this); +}; +MochiKit.Iter.__new__(); +if(MochiKit.__export__){ +reduce=MochiKit.Iter.reduce; +} +MochiKit.Base._exportSymbols(this,MochiKit.Iter); +MochiKit.Base._deps("DOM",["Base"]); MochiKit.DOM.NAME="MochiKit.DOM"; MochiKit.DOM.VERSION="1.4"; MochiKit.DOM.__repr__=function(){ @@ -1026,9 +1636,9 @@ MochiKit.DOM.toString=function(){ return this.__repr__(); }; -MochiKit.DOM.EXPORT=["removeEmptyTextNodes","formContents","currentWindow","currentDocument","withWindow","withDocument","registerDOMConverter","coerceToDOM","createDOM","createDOMFunc","isChildNode","getNodeAttribute","setNodeAttribute","updateNodeAttributes","appendChildNodes","replaceChildNodes","removeElement","swapDOM","BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","getElement","$","getElementsByTagAndClassName","addToCallStack","addLoadEvent","focusOnLoad","setElementClass","toggleElementClass","addElementClass","removeElementClass","swapElementClass","hasElementClass","escapeHTML","toHTML","emitHTML","scrapeText","isParent","makeClipping","undoClipping","makePositioned","undoPositioned","getFirstElementByTagAndClassName"]; +MochiKit.DOM.EXPORT=["removeEmptyTextNodes","formContents","currentWindow","currentDocument","withWindow","withDocument","registerDOMConverter","coerceToDOM","createDOM","createDOMFunc","isChildNode","getNodeAttribute","removeNodeAttribute","setNodeAttribute","updateNodeAttributes","appendChildNodes","insertSiblingNodesAfter","insertSiblingNodesBefore","replaceChildNodes","removeElement","swapDOM","BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","DL","DT","DD","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","getElement","$","getElementsByTagAndClassName","addToCallStack","addLoadEvent","focusOnLoad","setElementClass","toggleElementClass","addElementClass","removeElementClass","swapElementClass","hasElementClass","escapeHTML","toHTML","emitHTML","scrapeText","isParent","getFirstParentByTagAndClassName","makeClipping","undoClipping","makePositioned","undoPositioned","getFirstElementByTagAndClassName"]; MochiKit.DOM.EXPORT_OK=["domConverters"]; -MochiKit.DOM.DEPRECATED=[["computedStyle","MochiKit.Style.computedStyle","1.4"],["elementDimensions","MochiKit.Style.getElementDimensions","1.4"],["elementPosition","MochiKit.Style.getElementPosition","1.4"],["hideElement","MochiKit.Style.hideElement","1.4"],["setElementDimensions","MochiKit.Style.setElementDimensions","1.4"],["setElementPosition","MochiKit.Style.setElementPosition","1.4"],["setDisplayForElement","MochiKit.Style.setDisplayForElement","1.4"],["setOpacity","MochiKit.Style.setOpacity","1.4"],["showElement","MochiKit.Style.showElement","1.4"],["Coordinates","MochiKit.Style.Coordinates","1.4"],["Dimensions","MochiKit.Style.Dimensions","1.4"]]; +MochiKit.DOM.DEPRECATED=[["computedStyle","MochiKit.Style.getStyle","1.4"],["elementDimensions","MochiKit.Style.getElementDimensions","1.4"],["elementPosition","MochiKit.Style.getElementPosition","1.4"],["hideElement","MochiKit.Style.hideElement","1.4"],["setElementDimensions","MochiKit.Style.setElementDimensions","1.4"],["setElementPosition","MochiKit.Style.setElementPosition","1.4"],["setDisplayForElement","MochiKit.Style.setDisplayForElement","1.4"],["setOpacity","MochiKit.Style.setOpacity","1.4"],["showElement","MochiKit.Style.showElement","1.4"],["Coordinates","MochiKit.Style.Coordinates","1.4"],["Dimensions","MochiKit.Style.Dimensions","1.4"]]; MochiKit.DOM.getViewportDimensions=new Function(""+"if (!MochiKit[\"Style\"]) {"+" throw new Error(\"This function has been deprecated and depends on MochiKit.Style.\");"+"}"+"return MochiKit.Style.getViewportDimensions.apply(this, arguments);"); MochiKit.Base.update(MochiKit.DOM,{currentWindow:function(){ return MochiKit.DOM._window; @@ -1036,8 +1646,8 @@ return MochiKit.DOM._document; },withWindow:function(win,func){ var self=MochiKit.DOM; -var _148=self._document; -var _149=self._win; +var _1ef=self._document; +var _1f0=self._window; var rval; try{ self._window=win; @@ -1045,16 +1655,16 @@ rval=func(); } catch(e){ -self._window=_149; -self._document=_148; +self._window=_1f0; +self._document=_1ef; throw e; } -self._window=_149; -self._document=_148; +self._window=_1f0; +self._document=_1ef; return rval; },formContents:function(elem){ -var _151=[]; -var _152=[]; +var _1f3=[]; +var _1f4=[]; var m=MochiKit.Base; var self=MochiKit.DOM; if(typeof (elem)=="undefined"||elem===null){ @@ -1065,26 +1675,33 @@ m.nodeWalk(elem,function(elem){ var name=elem.name; if(m.isNotEmpty(name)){ -var _153=elem.tagName.toUpperCase(); -if(_153==="INPUT"&&(elem.type=="radio"||elem.type=="checkbox")&&!elem.checked){ +var _1f9=elem.tagName.toUpperCase(); +if(_1f9==="INPUT"&&(elem.type=="radio"||elem.type=="checkbox")&&!elem.checked){ return null; } -if(_153==="SELECT"){ +if(_1f9==="SELECT"){ if(elem.type=="select-one"){ if(elem.selectedIndex>=0){ var opt=elem.options[elem.selectedIndex]; -_151.push(name); -_152.push(opt.value); +var v=opt.value; +if(!v){ +var h=opt.outerHTML; +if(h&&!h.match(/^[^>]+\svalue\s*=/i)){ +v=opt.text; +} +} +_1f3.push(name); +_1f4.push(v); return null; } -_151.push(name); -_152.push(""); +_1f3.push(name); +_1f4.push(""); return null; }else{ var opts=elem.options; if(!opts.length){ -_151.push(name); -_152.push(""); +_1f3.push(name); +_1f4.push(""); return null; } for(var i=0;i<opts.length;i++){ @@ -1092,54 +1709,64 @@ if(!opt.selected){ continue; } -_151.push(name); -_152.push(opt.value); +var v=opt.value; +if(!v){ +var h=opt.outerHTML; +if(h&&!h.match(/^[^>]+\svalue\s*=/i)){ +v=opt.text; } +} +_1f3.push(name); +_1f4.push(v); +} return null; } } -if(_153==="FORM"||_153==="P"||_153==="SPAN"||_153==="DIV"){ +if(_1f9==="FORM"||_1f9==="P"||_1f9==="SPAN"||_1f9==="DIV"){ return elem.childNodes; } -_151.push(name); -_152.push(elem.value||""); +_1f3.push(name); +_1f4.push(elem.value||""); return null; } return elem.childNodes; }); -return [_151,_152]; +return [_1f3,_1f4]; },withDocument:function(doc,func){ var self=MochiKit.DOM; -var _157=self._document; +var _202=self._document; var rval; try{ self._document=doc; rval=func(); } catch(e){ -self._document=_157; +self._document=_202; throw e; } -self._document=_157; +self._document=_202; return rval; -},registerDOMConverter:function(name,_158,wrap,_159){ -MochiKit.DOM.domConverters.register(name,_158,wrap,_159); +},registerDOMConverter:function(name,_205,wrap,_207){ +MochiKit.DOM.domConverters.register(name,_205,wrap,_207); },coerceToDOM:function(node,ctx){ var m=MochiKit.Base; var im=MochiKit.Iter; var self=MochiKit.DOM; if(im){ var iter=im.iter; -var _163=im.repeat; +var _20e=im.repeat; var map=m.map; } -var _165=self.domConverters; -var _166=arguments.callee; -var _167=m.NotFound; +var _210=self.domConverters; +var _211=arguments.callee; +var _212=m.NotFound; while(true){ if(typeof (node)=="undefined"||node===null){ return null; } +if(typeof (node)=="function"&&typeof (node.length)=="number"&&!(node instanceof Function)){ +node=im.list(node); +} if(typeof (node.nodeType)!="undefined"&&node.nodeType>0){ return node; } @@ -1162,49 +1789,54 @@ continue; } if(im){ -var _168=null; +var _213=null; try{ -_168=iter(node); +_213=iter(node); } catch(e){ } -if(_168){ -return map(_166,_168,_163(ctx)); +if(_213){ +return map(_211,_213,_20e(ctx)); } } try{ -node=_165.match(node,ctx); +node=_210.match(node,ctx); continue; } catch(e){ -if(e!=_167){ +if(e!=_212){ throw e; } } return self._document.createTextNode(node.toString()); } return undefined; -},isChildNode:function(node,_169){ +},isChildNode:function(node,_215){ var self=MochiKit.DOM; if(typeof (node)=="string"){ node=self.getElement(node); } -if(typeof (_169)=="string"){ -_169=self.getElement(_169); +if(typeof (_215)=="string"){ +_215=self.getElement(_215); } -if(node===_169){ +if(typeof (node)=="undefined"||node===null||node===self._document){ +return false; +} +do{ +if(node===_215){ return true; } -while(node&&node.tagName.toUpperCase()!="BODY"){ +var _217=node.tagName; node=node.parentNode; -if(node===_169){ -return true; +if(!_217){ +break; } -} +_217=_217.toUpperCase(); +}while(_217!="BODY"&&_217!="HTML"); return false; -},setNodeAttribute:function(node,attr,_171){ +},setNodeAttribute:function(node,attr,_21a){ var o={}; -o[attr]=_171; +o[attr]=_21a; try{ return MochiKit.DOM.updateNodeAttributes(node,o); } @@ -1213,31 +1845,48 @@ return null; },getNodeAttribute:function(node,attr){ var self=MochiKit.DOM; -var _172=self.attributeArray.renames[attr]; +var _21f=self.attributeArray.renames[attr]; node=self.getElement(node); try{ -if(_172){ -return node[_172]; +if(_21f){ +return node[_21f]; } return node.getAttribute(attr); } catch(e){ } return null; -},updateNodeAttributes:function(node,_173){ +},removeNodeAttribute:function(node,attr){ +var self=MochiKit.DOM; +var _223=self.attributeArray.renames[attr]; +node=self.getElement(node); +try{ +if(_223){ +return node[_223]; +} +return node.removeAttribute(attr); +} +catch(e){ +} +return null; +},updateNodeAttributes:function(node,_225){ var elem=node; var self=MochiKit.DOM; if(typeof (node)=="string"){ elem=self.getElement(node); } -if(_173){ -var _174=MochiKit.Base.updatetree; +if(_225){ +var _228=MochiKit.Base.updatetree; if(self.attributeArray.compliant){ -for(var k in _173){ -var v=_173[k]; +for(var k in _225){ +var v=_225[k]; if(typeof (v)=="object"&&typeof (elem[k])=="object"){ -_174(elem[k],v); +if(k=="style"&&MochiKit.Style){ +MochiKit.Style.setStyle(elem,v); }else{ +_228(elem[k],v); +} +}else{ if(k.substring(0,2)=="on"){ if(typeof (v)=="string"){ v=new Function(v); @@ -1249,19 +1898,23 @@ } } }else{ -var _175=self.attributeArray.renames; -for(k in _173){ -v=_173[k]; -var _176=_175[k]; +var _22b=self.attributeArray.renames; +for(var k in _225){ +v=_225[k]; +var _22c=_22b[k]; if(k=="style"&&typeof (v)=="string"){ elem.style.cssText=v; }else{ -if(typeof (_176)=="string"){ -elem[_176]=v; +if(typeof (_22c)=="string"){ +elem[_22c]=v; }else{ if(typeof (elem[k])=="object"&&typeof (v)=="object"){ -_174(elem[k],v); +if(k=="style"&&MochiKit.Style){ +MochiKit.Style.setStyle(elem,v); }else{ +_228(elem[k],v); +} +}else{ if(k.substring(0,2)=="on"){ if(typeof (v)=="string"){ v=new Function(v); @@ -1283,20 +1936,53 @@ if(typeof (node)=="string"){ elem=self.getElement(node); } -var _177=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; -var _178=MochiKit.Base.concat; -while(_177.length){ -var n=_177.shift(); +var _230=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; +var _231=MochiKit.Base.concat; +while(_230.length){ +var n=_230.shift(); if(typeof (n)=="undefined"||n===null){ }else{ if(typeof (n.nodeType)=="number"){ elem.appendChild(n); }else{ -_177=_178(n,_177); +_230=_231(n,_230); } } } return elem; +},insertSiblingNodesBefore:function(node){ +var elem=node; +var self=MochiKit.DOM; +if(typeof (node)=="string"){ +elem=self.getElement(node); +} +var _236=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; +var _237=elem.parentNode; +var _238=MochiKit.Base.concat; +while(_236.length){ +var n=_236.shift(); +if(typeof (n)=="undefined"||n===null){ +}else{ +if(typeof (n.nodeType)=="number"){ +_237.insertBefore(n,elem); +}else{ +_236=_238(n,_236); +} +} +} +return _237; +},insertSiblingNodesAfter:function(node){ +var elem=node; +var self=MochiKit.DOM; +if(typeof (node)=="string"){ +elem=self.getElement(node); +} +var _23d=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; +if(elem.nextSibling){ +return self.insertSiblingNodesBefore(elem.nextSibling,_23d); +}else{ +return self.appendChildNodes(elem.parentNode,_23d); +} },replaceChildNodes:function(node){ var elem=node; var self=MochiKit.DOM; @@ -1304,40 +1990,40 @@ elem=self.getElement(node); arguments[0]=elem; } -var _179; -while((_179=elem.firstChild)){ -elem.removeChild(_179); +var _241; +while((_241=elem.firstChild)){ +elem.removeChild(_241); } if(arguments.length<2){ return elem; }else{ return self.appendChildNodes.apply(this,arguments); } -},createDOM:function(name,_180){ +},createDOM:function(name,_243){ var elem; var self=MochiKit.DOM; var m=MochiKit.Base; -if(typeof (_180)=="string"||typeof (_180)=="number"){ +if(typeof (_243)=="string"||typeof (_243)=="number"){ var args=m.extend([name,null],arguments,1); return arguments.callee.apply(this,args); } if(typeof (name)=="string"){ -var _181=self._xhtml; -if(_180&&!self.attributeArray.compliant){ -var _182=""; -if("name" in _180){ -_182+=" name=\""+self.escapeHTML(_180.name)+"\""; +var _248=self._xhtml; +if(_243&&!self.attributeArray.compliant){ +var _249=""; +if("name" in _243){ +_249+=" name=\""+self.escapeHTML(_243.name)+"\""; } -if(name=="input"&&"type" in _180){ -_182+=" type=\""+self.escapeHTML(_180.type)+"\""; +if(name=="input"&&"type" in _243){ +_249+=" type=\""+self.escapeHTML(_243.type)+"\""; } -if(_182){ -name="<"+name+_182+">"; -_181=false; +if(_249){ +name="<"+name+_249+">"; +_248=false; } } var d=self._document; -if(_181&&d===document){ +if(_248&&d===document){ elem=d.createElementNS("http://www.w3.org/1999/xhtml",name); }else{ elem=d.createElement(name); @@ -1345,8 +2031,8 @@ }else{ elem=name; } -if(_180){ -self.updateNodeAttributes(elem,_180); +if(_243){ +self.updateNodeAttributes(elem,_243); } if(arguments.length<=2){ return elem; @@ -1364,12 +2050,12 @@ },swapDOM:function(dest,src){ var self=MochiKit.DOM; dest=self.getElement(dest); -var _186=dest.parentNode; +var _251=dest.parentNode; if(src){ src=self.getElement(src); -_186.replaceChild(src,dest); +_251.replaceChild(src,dest); }else{ -_186.removeChild(dest); +_251.removeChild(dest); } return src; },getElement:function(id){ @@ -1379,40 +2065,40 @@ }else{ return MochiKit.Base.map(self.getElement,arguments); } -},getElementsByTagAndClassName:function(_188,_189,_190){ +},getElementsByTagAndClassName:function(_254,_255,_256){ var self=MochiKit.DOM; -if(typeof (_188)=="undefined"||_188===null){ -_188="*"; +if(typeof (_254)=="undefined"||_254===null){ +_254="*"; } -if(typeof (_190)=="undefined"||_190===null){ -_190=self._document; +if(typeof (_256)=="undefined"||_256===null){ +_256=self._document; } -_190=self.getElement(_190); -var _191=(_190.getElementsByTagName(_188)||self._document.all); -if(typeof (_189)=="undefined"||_189===null){ -return MochiKit.Base.extend(null,_191); +_256=self.getElement(_256); +var _258=(_256.getElementsByTagName(_254)||self._document.all); +if(typeof (_255)=="undefined"||_255===null){ +return MochiKit.Base.extend(null,_258); } -var _192=[]; -for(var i=0;i<_191.length;i++){ -var _193=_191[i]; -var cls=_193.className; +var _259=[]; +for(var i=0;i<_258.length;i++){ +var _25b=_258[i]; +var cls=_25b.className; if(!cls){ continue; } -var _195=cls.split(" "); -for(var j=0;j<_195.length;j++){ -if(_195[j]==_189){ -_192.push(_193); +var _25d=cls.split(" "); +for(var j=0;j<_25d.length;j++){ +if(_25d[j]==_255){ +_259.push(_25b); break; } } } -return _192; +return _259; },_newCallStack:function(path,once){ var rval=function(){ -var _198=arguments.callee.callStack; -for(var i=0;i<_198.length;i++){ -if(_198[i].apply(this,arguments)===false){ +var _262=arguments.callee.callStack; +for(var i=0;i<_262.length;i++){ +if(_262[i].apply(this,arguments)===false){ break; } } @@ -1426,102 +2112,102 @@ }; rval.callStack=[]; return rval; -},addToCallStack:function(_199,path,func,once){ +},addToCallStack:function(_264,path,func,once){ var self=MochiKit.DOM; -var _200=_199[path]; -var _201=_200; -if(!(typeof (_200)=="function"&&typeof (_200.callStack)=="object"&&_200.callStack!==null)){ -_201=self._newCallStack(path,once); -if(typeof (_200)=="function"){ -_201.callStack.push(_200); +var _269=_264[path]; +var _26a=_269; +if(!(typeof (_269)=="function"&&typeof (_269.callStack)=="object"&&_269.callStack!==null)){ +_26a=self._newCallStack(path,once); +if(typeof (_269)=="function"){ +_26a.callStack.push(_269); } -_199[path]=_201; +_264[path]=_26a; } -_201.callStack.push(func); +_26a.callStack.push(func); },addLoadEvent:function(func){ var self=MochiKit.DOM; self.addToCallStack(self._window,"onload",func,true); -},focusOnLoad:function(_202){ +},focusOnLoad:function(_26d){ var self=MochiKit.DOM; self.addLoadEvent(function(){ -_202=self.getElement(_202); -if(_202){ -_202.focus(); +_26d=self.getElement(_26d); +if(_26d){ +_26d.focus(); } }); -},setElementClass:function(_203,_204){ +},setElementClass:function(_26f,_270){ var self=MochiKit.DOM; -var obj=self.getElement(_203); +var obj=self.getElement(_26f); if(self.attributeArray.compliant){ -obj.setAttribute("class",_204); +obj.setAttribute("class",_270); }else{ -obj.setAttribute("className",_204); +obj.setAttribute("className",_270); } -},toggleElementClass:function(_205){ +},toggleElementClass:function(_273){ var self=MochiKit.DOM; for(var i=1;i<arguments.length;i++){ var obj=self.getElement(arguments[i]); -if(!self.addElementClass(obj,_205)){ -self.removeElementClass(obj,_205); +if(!self.addElementClass(obj,_273)){ +self.removeElementClass(obj,_273); } } -},addElementClass:function(_206,_207){ +},addElementClass:function(_277,_278){ var self=MochiKit.DOM; -var obj=self.getElement(_206); +var obj=self.getElement(_277); var cls=obj.className; if(cls==undefined||cls.length===0){ -self.setElementClass(obj,_207); +self.setElementClass(obj,_278); return true; } -if(cls==_207){ +if(cls==_278){ return false; } -var _208=cls.split(" "); -for(var i=0;i<_208.length;i++){ -if(_208[i]==_207){ +var _27c=cls.split(" "); +for(var i=0;i<_27c.length;i++){ +if(_27c[i]==_278){ return false; } } -self.setElementClass(obj,cls+" "+_207); +self.setElementClass(obj,cls+" "+_278); return true; -},removeElementClass:function(_209,_210){ +},removeElementClass:function(_27e,_27f){ var self=MochiKit.DOM; -var obj=self.getElement(_209); +var obj=self.getElement(_27e); var cls=obj.className; if(cls==undefined||cls.length===0){ return false; } -if(cls==_210){ +if(cls==_27f){ self.setElementClass(obj,""); return true; } -var _211=cls.split(" "); -for(var i=0;i<_211.length;i++){ -if(_211[i]==_210){ -_211.splice(i,1); -self.setElementClass(obj,_211.join(" ")); +var _283=cls.split(" "); +for(var i=0;i<_283.length;i++){ +if(_283[i]==_27f){ +_283.splice(i,1); +self.setElementClass(obj,_283.join(" ")); return true; } } return false; -},swapElementClass:function(_212,_213,_214){ -var obj=MochiKit.DOM.getElement(_212); -var res=MochiKit.DOM.removeElementClass(obj,_213); +},swapElementClass:function(_285,_286,_287){ +var obj=MochiKit.DOM.getElement(_285); +var res=MochiKit.DOM.removeElementClass(obj,_286); if(res){ -MochiKit.DOM.addElementClass(obj,_214); +MochiKit.DOM.addElementClass(obj,_287); } return res; -},hasElementClass:function(_215,_216){ -var obj=MochiKit.DOM.getElement(_215); +},hasElementClass:function(_28a,_28b){ +var obj=MochiKit.DOM.getElement(_28a); var cls=obj.className; if(!cls){ return false; } -var _217=cls.split(" "); +var _28e=cls.split(" "); for(var i=1;i<arguments.length;i++){ var good=false; -for(var j=0;j<_217.length;j++){ -if(_217[j]==arguments[i]){ +for(var j=0;j<_28e.length;j++){ +if(_28e[j]==arguments[i]){ good=true; break; } @@ -1539,49 +2225,49 @@ if(typeof (lst)=="undefined"||lst===null){ lst=[]; } -var _221=[dom]; +var _296=[dom]; var self=MochiKit.DOM; -var _222=self.escapeHTML; -var _223=self.attributeArray; -while(_221.length){ -dom=_221.pop(); +var _298=self.escapeHTML; +var _299=self.attributeArray; +while(_296.length){ +dom=_296.pop(); if(typeof (dom)=="string"){ lst.push(dom); }else{ if(dom.nodeType==1){ lst.push("<"+dom.tagName.toLowerCase()); -var _224=[]; -var _225=_223(dom); -for(var i=0;i<_225.length;i++){ -var a=_225[i]; -_224.push([" ",a.name,"=\"",_222(a.value),"\""]); +var _29a=[]; +var _29b=_299(dom); +for(var i=0;i<_29b.length;i++){ +var a=_29b[i]; +_29a.push([" ",a.name,"=\"",_298(a.value),"\""]); } -_224.sort(); -for(i=0;i<_224.length;i++){ -var _226=_224[i]; -for(var j=0;j<_226.length;j++){ -lst.push(_226[j]); +_29a.sort(); +for(i=0;i<_29a.length;i++){ +var _29e=_29a[i]; +for(var j=0;j<_29e.length;j++){ +lst.push(_29e[j]); } } if(dom.hasChildNodes()){ lst.push(">"); -_221.push("</"+dom.tagName.toLowerCase()+">"); -var _227=dom.childNodes; -for(i=_227.length-1;i>=0;i--){ -_221.push(_227[i]); +_296.push("</"+dom.tagName.toLowerCase()+">"); +var _2a0=dom.childNodes; +for(i=_2a0.length-1;i>=0;i--){ +_296.push(_2a0[i]); } }else{ lst.push("/>"); } }else{ if(dom.nodeType==3){ -lst.push(_222(dom.nodeValue)); +lst.push(_298(dom.nodeValue)); } } } } return lst; -},scrapeText:function(node,_228){ +},scrapeText:function(node,_2a2){ var rval=[]; (function(node){ var cn=node.childNodes; @@ -1590,88 +2276,125 @@ arguments.callee.call(this,cn[i]); } } -var _230=node.nodeValue; -if(typeof (_230)=="string"){ -rval.push(_230); +var _2a7=node.nodeValue; +if(typeof (_2a7)=="string"){ +rval.push(_2a7); } })(MochiKit.DOM.getElement(node)); -if(_228){ +if(_2a2){ return rval; }else{ return rval.join(""); } -},removeEmptyTextNodes:function(_231){ -_231=MochiKit.DOM.getElement(_231); -for(var i=0;i<_231.childNodes.length;i++){ -var node=_231.childNodes[i]; +},removeEmptyTextNodes:function(_2a8){ +_2a8=MochiKit.DOM.getElement(_2a8); +for(var i=0;i<_2a8.childNodes.length;i++){ +var node=_2a8.childNodes[i]; if(node.nodeType==3&&!/\S/.test(node.nodeValue)){ node.parentNode.removeChild(node); } } -},makeClipping:function(_232){ -_232=MochiKit.DOM.getElement(_232); -var _233=_232.style.overflow; -if((MochiKit.Style.getStyle(_232,"overflow")||"visible")!="hidden"){ -_232.style.overflow="hidden"; +},makeClipping:function(_2ab){ +_2ab=MochiKit.DOM.getElement(_2ab); +var _2ac=_2ab.style.overflow; +if((MochiKit.Style.getStyle(_2ab,"overflow")||"visible")!="hidden"){ +_2ab.style.overflow="hidden"; } -return _233; -},undoClipping:function(_234,_235){ -_234=MochiKit.DOM.getElement(_234); -if(!_235){ +return _2ac; +},undoClipping:function(_2ad,_2ae){ +_2ad=MochiKit.DOM.getElement(_2ad); +if(!_2ae){ return; } -_234.style.overflow=_235; -},makePositioned:function(_236){ -_236=MochiKit.DOM.getElement(_236); -var pos=MochiKit.Style.getStyle(_236,"position"); +_2ad.style.overflow=_2ae; +},makePositioned:function(_2af){ +_2af=MochiKit.DOM.getElement(_2af); +var pos=MochiKit.Style.getStyle(_2af,"position"); if(pos=="static"||!pos){ -_236.style.position="relative"; +_2af.style.position="relative"; if(/Opera/.test(navigator.userAgent)){ -_236.style.top=0; -_236.style.left=0; +_2af.style.top=0; +_2af.style.left=0; } } -},undoPositioned:function(_238){ -_238=MochiKit.DOM.getElement(_238); -if(_238.style.position=="relative"){ -_238.style.position=_238.style.top=_238.style.left=_238.style.bottom=_238.style.right=""; +},undoPositioned:function(_2b1){ +_2b1=MochiKit.DOM.getElement(_2b1); +if(_2b1.style.position=="relative"){ +_2b1.style.position=_2b1.style.top=_2b1.style.left=_2b1.style.bottom=_2b1.style.right=""; } -},getFirstElementByTagAndClassName:function(_239,_240,_241){ +},getFirstElementByTagAndClassName:function(_2b2,_2b3,_2b4){ var self=MochiKit.DOM; -if(typeof (_239)=="undefined"||_239===null){ -_239="*"; +if(typeo... [truncated message content] |
From: <ora...@us...> - 2007-12-27 23:40:04
|
Revision: 238 http://pieforms.svn.sourceforge.net/pieforms/?rev=238&view=rev Author: oracleshinoda Date: 2007-12-27 15:40:09 -0800 (Thu, 27 Dec 2007) Log Message: ----------- HTML version of documentation updates. Modified Paths: -------------- pieforms-php5/trunk/doc/html/index.html pieforms-php5/trunk/doc/html/user/concepts.html pieforms-php5/trunk/doc/html/user/configuration.html pieforms-php5/trunk/doc/html/user/elements.html pieforms-php5/trunk/doc/html/user/examples.html pieforms-php5/trunk/doc/html/user/features.html pieforms-php5/trunk/doc/html/user/usage.html Added Paths: ----------- pieforms-php5/trunk/doc/html/user/templates.html Modified: pieforms-php5/trunk/doc/html/index.html =================================================================== --- pieforms-php5/trunk/doc/html/index.html 2007-12-27 23:39:31 UTC (rev 237) +++ pieforms-php5/trunk/doc/html/index.html 2007-12-27 23:40:09 UTC (rev 238) @@ -71,6 +71,8 @@ <li><a class="reference" href="user/elements.html">Elements</a> - General information about elements including a list of elements that come with Pieforms.</li> <li><a class="reference" href="user/renderers.html">Renderers</a></li> +<li><a class="reference" href="user/templates.html">Templates</a> - How templates can help you control the +layout of your forms, when you need extra control</li> <li><a class="reference" href="user/rules.html">Rules</a></li> <li><a class="reference" href="user/i18n.html">i18n</a></li> </ul> @@ -106,6 +108,6 @@ </div> <div id="footer">Pieforms by <a href="http://nigel.mcnie.name/">Nigel McNie</a> and <a href="http://pieforms.sourceforge.net/about#authors">others</a>, -© 2006 Catalyst IT Ltd. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> +© 2006 - 2008 <a href="http://www.catalyst.net.nz/">Catalyst IT Ltd</a>. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> </body> </html> Modified: pieforms-php5/trunk/doc/html/user/concepts.html =================================================================== --- pieforms-php5/trunk/doc/html/user/concepts.html 2007-12-27 23:39:31 UTC (rev 237) +++ pieforms-php5/trunk/doc/html/user/concepts.html 2007-12-27 23:40:09 UTC (rev 238) @@ -28,32 +28,32 @@ <div class="contents topic"> <p class="topic-title first"><a id="contents" name="contents">Contents</a></p> <ul class="simple"> -<li><a class="reference" href="#background" id="id1" name="id1">Background</a></li> -<li><a class="reference" href="#concepts" id="id2" name="id2">Concepts</a><ul> -<li><a class="reference" href="#the-form-definition-hash" id="id3" name="id3">The form definition hash</a></li> -<li><a class="reference" href="#the-pieform-function-call" id="id4" name="id4">The <tt class="docutils literal"><span class="pre">pieform(...)</span></tt> function call</a></li> -<li><a class="reference" href="#the-testform-validate-function" id="id5" name="id5">The <tt class="docutils literal"><span class="pre">testform_validate</span></tt> function</a></li> -<li><a class="reference" href="#the-testform-submit-function" id="id6" name="id6">The <tt class="docutils literal"><span class="pre">testform_submit</span></tt> function</a></li> +<li><a class="reference" href="#background" id="id3" name="id3">Background</a></li> +<li><a class="reference" href="#concepts" id="id4" name="id4">Concepts</a><ul> +<li><a class="reference" href="#the-form-definition-hash" id="id5" name="id5">The form definition hash</a></li> +<li><a class="reference" href="#the-pieform-function-call" id="id6" name="id6">The <tt class="docutils literal"><span class="pre">pieform(...)</span></tt> function call</a></li> +<li><a class="reference" href="#the-testform-validate-function" id="id7" name="id7">The <tt class="docutils literal"><span class="pre">testform_validate</span></tt> function</a></li> +<li><a class="reference" href="#the-testform-submit-function" id="id8" name="id8">The <tt class="docutils literal"><span class="pre">testform_submit</span></tt> function</a></li> </ul> </li> -<li><a class="reference" href="#form-api-terms" id="id7" name="id7">Form API Terms</a><ul> -<li><a class="reference" href="#elements" id="id8" name="id8">Elements</a></li> -<li><a class="reference" href="#rules" id="id9" name="id9">Rules</a></li> -<li><a class="reference" href="#renderers" id="id10" name="id10">Renderers</a></li> +<li><a class="reference" href="#form-api-terms" id="id9" name="id9">Form API Terms</a><ul> +<li><a class="reference" href="#elements" id="id10" name="id10">Elements</a></li> +<li><a class="reference" href="#rules" id="id11" name="id11">Rules</a></li> +<li><a class="reference" href="#renderers" id="id12" name="id12">Renderers</a></li> +<li><a class="reference" href="#templates" id="id13" name="id13">Templates</a></li> </ul> </li> -<li><a class="reference" href="#how-they-fit-together" id="id11" name="id11">How They Fit Together</a></li> -<li><a class="reference" href="#other-features-of-pieforms" id="id12" name="id12">Other Features of Pieforms</a></li> +<li><a class="reference" href="#how-they-fit-together" id="id14" name="id14">How They Fit Together</a></li> +<li><a class="reference" href="#other-features-of-pieforms" id="id15" name="id15">Other Features of Pieforms</a></li> </ul> </div> <p>Pieforms is a development of the <a class="reference" href="http://mahara.org/">Mahara</a> project, that was later split out into its own project on <a class="reference" href="http://pieforms.sourceforge.net/">sourceforge</a>. It provides a unified way to create, validate -and process forms all with a common look and feel, with support for pluggable -elements, renderers and validation rules.</p> +and process forms, with an emphasis on flexibility and extensibility.</p> <p>What does that all mean? That's what this document is for - to describe the overall concepts and ideas behind Pieforms.</p> <div class="section"> -<h1><a class="toc-backref" href="#id1" id="background" name="background">Background</a></h1> +<h1><a class="toc-backref" href="#id3" id="background" name="background">Background</a></h1> <div class="note"> <p class="first admonition-title">Note</p> <p class="last">You can skip this section if you don't care for history lessons :)</p> @@ -84,10 +84,16 @@ that this little subproject had turned into a cool implementation of a form API, that was worth splitting out into its own project. And thus, Pieforms was born. The name was chosen as a tribute to a leaving team member, whose nick on -IRC was 'pie' :)</p> +IRC was 'pie' <a class="footnote-reference" href="#id2" id="id1" name="id1">[1]</a></p> +<table class="docutils footnote" frame="void" id="id2" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody valign="top"> +<tr><td class="label"><a class="fn-backref" href="#id1" name="id2">[1]</a></td><td>Said co-worker has since returned to Catalyst IT :)</td></tr> +</tbody> +</table> </div> <div class="section"> -<h1><a class="toc-backref" href="#id2" id="concepts" name="concepts">Concepts</a></h1> +<h1><a class="toc-backref" href="#id4" id="concepts" name="concepts">Concepts</a></h1> <p>So, what is it that made Pieforms so easy to use and quick to build forms with? It is because from the outset the library was designed to build forms with as little work by the user as possible, instead of following a strict 'OO' @@ -155,23 +161,24 @@ <a href="http://www.php.net/exit"><span style="color:#a1a100;" title="php/php/keyword">exit</span></a><span style="color:#008000;" title="php/php/symbol">;</span> <span style="color:#008000;" title="php/php/symbol">}</span></pre><p>Here is a description of each part.</p> <div class="section"> -<h2><a class="toc-backref" href="#id3" id="the-form-definition-hash" name="the-form-definition-hash">The form definition hash</a></h2> +<h2><a class="toc-backref" href="#id5" id="the-form-definition-hash" name="the-form-definition-hash">The form definition hash</a></h2> <p>This array contains the definition of the form. In this example the form is hard coded, and that would be what you would do most of the time, but there's nothing to stop it from being generated dynamically. The array specifies some metadata for the whole form, like its name, method and action target, and then -a list of elements that are on the form. Evary form must have a name, this name -is used to call the callback functions.</p> +a list of elements that are on the form. Every form must have a name, used to +distinguish it from other forms so Pieforms can tell when the form itself has +been submitted.</p> <p>More information about the form array is available on a <a class="reference" href="usage.html">separate page</a>.</p> </div> <div class="section"> -<h2><a class="toc-backref" href="#id4" id="the-pieform-function-call" name="the-pieform-function-call">The <tt class="docutils literal"><span class="pre">pieform(...)</span></tt> function call</a></h2> +<h2><a class="toc-backref" href="#id6" id="the-pieform-function-call" name="the-pieform-function-call">The <tt class="docutils literal"><span class="pre">pieform(...)</span></tt> function call</a></h2> <p>This call builds the form, validates and submits the form if it has been submitted, and returns the HTML for the form. So in the example above the form is simply <tt class="docutils literal"><span class="pre">echo</span></tt>'d to the browser, but it could easily be put into a <a class="reference" href="http://smarty.php.net/">Smarty</a> template variable or manipulated any way required.</p> </div> <div class="section"> -<h2><a class="toc-backref" href="#id5" id="the-testform-validate-function" name="the-testform-validate-function">The <tt class="docutils literal"><span class="pre">testform_validate</span></tt> function</a></h2> +<h2><a class="toc-backref" href="#id7" id="the-testform-validate-function" name="the-testform-validate-function">The <tt class="docutils literal"><span class="pre">testform_validate</span></tt> function</a></h2> <p>This function is named after the form name, with <tt class="docutils literal"><span class="pre">_validate</span></tt> on the end. It takes the Pieform object and an array of the submitted values, and can perform whatever checks are required that cannot be otherwise handled by the inbuilt @@ -188,7 +195,7 @@ available, and it's easy to write your own.</p> </div> <div class="section"> -<h2><a class="toc-backref" href="#id6" id="the-testform-submit-function" name="the-testform-submit-function">The <tt class="docutils literal"><span class="pre">testform_submit</span></tt> function</a></h2> +<h2><a class="toc-backref" href="#id8" id="the-testform-submit-function" name="the-testform-submit-function">The <tt class="docutils literal"><span class="pre">testform_submit</span></tt> function</a></h2> <p>This function is named after the form name, with <tt class="docutils literal"><span class="pre">_submit</span></tt> on the end. It takes an array of the submitted values that have already been validated successfully according to the validation rules set on the form. From here you @@ -211,10 +218,10 @@ </div> </div> <div class="section"> -<h1><a class="toc-backref" href="#id7" id="form-api-terms" name="form-api-terms">Form API Terms</a></h1> +<h1><a class="toc-backref" href="#id9" id="form-api-terms" name="form-api-terms">Form API Terms</a></h1> <p>Pieforms has several components, a basic description of each is given here.</p> <div class="section"> -<h2><a class="toc-backref" href="#id8" id="elements" name="elements">Elements</a></h2> +<h2><a class="toc-backref" href="#id10" id="elements" name="elements">Elements</a></h2> <p>Pieform <strong>elements</strong> are similar to the widgets you have in normal HTML forms, and in fact all HTML widgets have element implementations in Pieforms. However, Pieforms does not limit you to using just the standard HTML widgets - you can @@ -231,7 +238,7 @@ how to write your own, is available.</p> </div> <div class="section"> -<h2><a class="toc-backref" href="#id9" id="rules" name="rules">Rules</a></h2> +<h2><a class="toc-backref" href="#id11" id="rules" name="rules">Rules</a></h2> <p>Rules are used to validate elements. Given the element's value, they check if the value matches a certain condition. There is a few simple rules implemented, such as <em>required</em>, <em>minlength</em> and <em>maxlength</em> etc., but again like elements @@ -243,7 +250,7 @@ available.</p> </div> <div class="section"> -<h2><a class="toc-backref" href="#id10" id="renderers" name="renderers">Renderers</a></h2> +<h2><a class="toc-backref" href="#id12" id="renderers" name="renderers">Renderers</a></h2> <p>Renderers are used to output the containers that elements are rendered inside. For example, there is a "table" renderer which puts each element inside a table row, and a "div" renderer that puts them inside a <tt class="docutils literal"><span class="pre"><div></span></tt>. Like elements and @@ -257,17 +264,30 @@ <p>If all that was confusing, check out the <a class="reference" href="renderers.html">renderers</a> page for more information.</p> </div> +<div class="section"> +<h2><a class="toc-backref" href="#id13" id="templates" name="templates">Templates</a></h2> +<p>If renderers don't provide the flexibility you require when laying out a form, +you can instead write a template for it. These are simply PHP/HTML template +files, in which you can output the form in any layout you choose.</p> +<p>You might find that one or two renderers satisfy most of your form needs, and +that you write templates for the few forms in your application that you can't +lay out nicely using a renderer.</p> +<p>Combined with the limitless customisability of elements, this grants you the +holy grail - a consistent framework for form building that gives you <strong>complete +control</strong> over how your forms look.</p> +<p>Check out the <a class="reference" href="templates.html">template documentation</a> for more information.</p> </div> +</div> <div class="section"> -<h1><a class="toc-backref" href="#id11" id="how-they-fit-together" name="how-they-fit-together">How They Fit Together</a></h1> +<h1><a class="toc-backref" href="#id14" id="how-they-fit-together" name="how-they-fit-together">How They Fit Together</a></h1> <p>Here are some statements that might help you understand how a form is put together using Pieforms.</p> <p>A <strong>form</strong> is made up of <a class="reference" href="elements.html">elements</a>.</p> <p><strong>Elements</strong> are like standard HTML widgets, except they can be more complicated and comprised of many widgets if necessary.</p> <p>Elements are validated by <a class="reference" href="rules.html">rules</a>.</p> -<p>Each element in a form is rendered inside some boilerplate HTML provided by a -<a class="reference" href="renderers.html">renderer</a>.</p> +<p>When using a renderer, each element in a form is rendered inside some +boilerplate HTML provided by a <a class="reference" href="renderers.html">renderer</a>.</p> <p>When forms are <strong>submitted</strong>, they are <strong>validated</strong> using the <strong>rules</strong> for each <strong>element</strong>. If validation passes, the form <strong>submit callback</strong> is called with the values. If validation fails, the form is redisplayed, with the @@ -275,7 +295,7 @@ <strong>element</strong> next to it.</p> </div> <div class="section"> -<h1><a class="toc-backref" href="#id12" id="other-features-of-pieforms" name="other-features-of-pieforms">Other Features of Pieforms</a></h1> +<h1><a class="toc-backref" href="#id15" id="other-features-of-pieforms" name="other-features-of-pieforms">Other Features of Pieforms</a></h1> <p>As well as customisable elements, renderers and rules, Pieforms has the following features:</p> <ul class="simple"> @@ -284,7 +304,7 @@ available on both pages</li> <li>Support for <strong>cancel buttons</strong> - in effect, submit buttons with no validation applied to them</li> -<li><strong>Auto focus</strong> of fields in a form on page load, including focussing the +<li><strong>Auto focus</strong> of fields in a form on page load, including focusing the first element with an error if the form has failed validation</li> <li><a class="reference" href="usage.html#jsform">JS forms</a> - forms submitted to a hidden iframe with the result returned asynchronously, meaning the form behaves very @@ -297,6 +317,6 @@ </div> <div id="footer">Pieforms by <a href="http://nigel.mcnie.name/">Nigel McNie</a> and <a href="http://pieforms.sourceforge.net/about#authors">others</a>, -© 2006 Catalyst IT Ltd. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> +© 2006 - 2008 <a href="http://www.catalyst.net.nz/">Catalyst IT Ltd</a>. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> </body> </html> Modified: pieforms-php5/trunk/doc/html/user/configuration.html =================================================================== --- pieforms-php5/trunk/doc/html/user/configuration.html 2007-12-27 23:39:31 UTC (rev 237) +++ pieforms-php5/trunk/doc/html/user/configuration.html 2007-12-27 23:40:09 UTC (rev 238) @@ -58,10 +58,11 @@ native JSON extension for PHP, so if you have that extension it is a bonus. PHP 5 >= 5.2 contains the JSON extension built in, so you do not need to worry if you are using a version above that.</li> -<li>The <tt class="docutils literal"><span class="pre">Base</span></tt>, <tt class="docutils literal"><span class="pre">Iter</span></tt>, <tt class="docutils literal"><span class="pre">Style</span></tt>, <tt class="docutils literal"><span class="pre">DOM</span></tt> and <tt class="docutils literal"><span class="pre">Async</span></tt> modules of <a class="reference" href="http://mochikit.com/">MochiKit</a>, greater than version 1.3.1. A packed version of -MochiKit containing just these modules is available for your convenience in the -<tt class="docutils literal"><span class="pre">static/core/MochiKit</span></tt> directory, however you can use your own MochiKit if -you require other modules.</li> +<li>The <tt class="docutils literal"><span class="pre">Base</span></tt>, <tt class="docutils literal"><span class="pre">Iter</span></tt>, <tt class="docutils literal"><span class="pre">Style</span></tt>, <tt class="docutils literal"><span class="pre">DOM</span></tt>, <tt class="docutils literal"><span class="pre">Async</span></tt> and <tt class="docutils literal"><span class="pre">Signal</span></tt> modules +of <a class="reference" href="http://mochikit.com/">MochiKit</a>, greater than version 1.3.1. A packed +version of MochiKit containing just these modules is available for your +convenience in the <tt class="docutils literal"><span class="pre">static/core/MochiKit</span></tt> directory, however you can use +your own MochiKit if you require other modules.</li> </ul> </div> <div class="section"> @@ -138,6 +139,9 @@ <span style="color:#888;font-style:italic;" title="php/php5/single_comment/start">//</span><span style="color:#888;font-style:italic;" title="php/php5/single_comment"> ones.</span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">configdirs</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#33f;" title="php/php5/varstart">$</span><span style="color:#33f;" title="php/php5/var">LIBDIR</span> <span style="color:#008000;" title="php/php5/symbol">.</span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">form/</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#888;font-style:italic;" title="php/php5/single_comment/start">//</span><span style="color:#888;font-style:italic;" title="php/php5/single_comment"> Look in this directory for your custom form templates</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">templatedir</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#33f;" title="php/php5/varstart">$</span><span style="color:#33f;" title="php/php5/var">LIBDIR</span> <span style="color:#008000;" title="php/php5/symbol">.</span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">form/templates/</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#888;font-style:italic;" title="php/php5/single_comment/start">//</span><span style="color:#888;font-style:italic;" title="php/php5/single_comment"> You can add elements that will be in all forms. Here's the prime</span> <span style="color:#888;font-style:italic;" title="php/php5/single_comment/start">//</span><span style="color:#888;font-style:italic;" title="php/php5/single_comment"> example of why you would want to...</span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">elements</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> @@ -193,6 +197,6 @@ </div> <div id="footer">Pieforms by <a href="http://nigel.mcnie.name/">Nigel McNie</a> and <a href="http://pieforms.sourceforge.net/about#authors">others</a>, -© 2006 Catalyst IT Ltd. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> +© 2006 - 2008 <a href="http://www.catalyst.net.nz/">Catalyst IT Ltd</a>. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> </body> </html> Modified: pieforms-php5/trunk/doc/html/user/elements.html =================================================================== --- pieforms-php5/trunk/doc/html/user/elements.html 2007-12-27 23:39:31 UTC (rev 237) +++ pieforms-php5/trunk/doc/html/user/elements.html 2007-12-27 23:40:09 UTC (rev 238) @@ -146,12 +146,21 @@ <li>textarea</li> <li>text</li> </ul> -<p><div id="breadcrumbs"><a href="http://pieforms.sourceforge.net/">Pieforms Home</a> » <a href="../">Documentation Home</a> » <a href="">Pieforms Elements</a></div></p> +<div class="system-message"> +<p class="system-message-title">System Message: ERROR/3 (<tt class="docutils">rst/user/elements.rst</tt>, line 110)</p> +<p>Unknown directive type "TODO".</p> +<pre class="literal-block"> +.. TODO:: Link to docs for the elements, generate the list programatically + +</pre> </div> +<p>Most of these elements correspond to basic HTML elements +<div id="breadcrumbs"><a href="http://pieforms.sourceforge.net/">Pieforms Home</a> » <a href="../">Documentation Home</a> » <a href="">Pieforms Elements</a></div></p> </div> </div> +</div> <div id="footer">Pieforms by <a href="http://nigel.mcnie.name/">Nigel McNie</a> and <a href="http://pieforms.sourceforge.net/about#authors">others</a>, -© 2006 Catalyst IT Ltd. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> +© 2006 - 2008 <a href="http://www.catalyst.net.nz/">Catalyst IT Ltd</a>. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> </body> </html> Modified: pieforms-php5/trunk/doc/html/user/examples.html =================================================================== --- pieforms-php5/trunk/doc/html/user/examples.html 2007-12-27 23:39:31 UTC (rev 237) +++ pieforms-php5/trunk/doc/html/user/examples.html 2007-12-27 23:40:09 UTC (rev 238) @@ -31,6 +31,6 @@ </div> <div id="footer">Pieforms by <a href="http://nigel.mcnie.name/">Nigel McNie</a> and <a href="http://pieforms.sourceforge.net/about#authors">others</a>, -© 2006 Catalyst IT Ltd. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> +© 2006 - 2008 <a href="http://www.catalyst.net.nz/">Catalyst IT Ltd</a>. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> </body> </html> Modified: pieforms-php5/trunk/doc/html/user/features.html =================================================================== --- pieforms-php5/trunk/doc/html/user/features.html 2007-12-27 23:39:31 UTC (rev 237) +++ pieforms-php5/trunk/doc/html/user/features.html 2007-12-27 23:40:09 UTC (rev 238) @@ -30,9 +30,10 @@ <ul class="simple"> <li><a class="reference" href="#simple-to-use-api" id="id1" name="id1">Simple To Use API</a></li> <li><a class="reference" href="#pluggable-and-extensable" id="id2" name="id2">Pluggable and Extensable</a></li> -<li><a class="reference" href="#asynchronous-forms" id="id3" name="id3">Asynchronous Forms</a></li> -<li><a class="reference" href="#full-internationalisation-i18n" id="id4" name="id4">Full Internationalisation (i18n)</a></li> -<li><a class="reference" href="#html-4-01-compliance" id="id5" name="id5">HTML 4.01 Compliance</a></li> +<li><a class="reference" href="#full-layout-control" id="id3" name="id3">Full Layout Control</a></li> +<li><a class="reference" href="#asynchronous-forms" id="id4" name="id4">Asynchronous Forms</a></li> +<li><a class="reference" href="#full-internationalisation-i18n" id="id5" name="id5">Full Internationalisation (i18n)</a></li> +<li><a class="reference" href="#html-4-01-compliance" id="id6" name="id6">HTML 4.01 Compliance</a></li> </ul> </div> <p>This document outlines the major features that Pieforms has, with a brief @@ -75,7 +76,19 @@ be included in the next release for everyone to enjoy.</p> </div> <div class="section"> -<h1><a class="toc-backref" href="#id3" id="asynchronous-forms" name="asynchronous-forms">Asynchronous Forms</a></h1> +<h1><a class="toc-backref" href="#id3" id="full-layout-control" name="full-layout-control">Full Layout Control</a></h1> +<p>Pieforms gives you two options for laying out forms. One - renderers - will +handle most common cases for forms in your application. If a form you are +writing doesn't need any special layout control, a renderer will be perfect. It +will allow you, without any effort, to guarantee that your forms are all layed +out consistently.</p> +<p>However, there comes a time when you need more advanced layout control. +Pieforms provides you the ability to write a template to describe how a form +should be layed out. Templates are simply PHP files with access to the form, so +you can get as fancy as you like with how the form elements are layed out.</p> +</div> +<div class="section"> +<h1><a class="toc-backref" href="#id4" id="asynchronous-forms" name="asynchronous-forms">Asynchronous Forms</a></h1> <p>By simply flipping a switch, you can turn your forms from being standard <tt class="docutils literal"><span class="pre">POST</span></tt> forms into snappy, responsive "Javascript Forms" (or JSForms as Pieforms knows them). Rather than doing a full <tt class="docutils literal"><span class="pre">POST</span></tt> every time the form is @@ -90,16 +103,16 @@ is successfully submitted.</p> </div> <div class="section"> -<h1><a class="toc-backref" href="#id4" id="full-internationalisation-i18n" name="full-internationalisation-i18n">Full Internationalisation (i18n)</a></h1> +<h1><a class="toc-backref" href="#id5" id="full-internationalisation-i18n" name="full-internationalisation-i18n">Full Internationalisation (i18n)</a></h1> <p>Though there is not a lot to translate, Pieforms has i18n support, so the rule messages can be in your native language if you need. Elements also support i18n where required - for example, the calendar element supports different -languages. Although the only supported language at the moment is "en.utf8", it -will take only around 10 minutes to add new languages. Ask on the mailing list -or in the forums!</p> +languages. Currently there are translations for English, German and French, and +creating a new translation will take only around 10 minutes to add new +languages. Ask on the mailing list or in the forums!</p> </div> <div class="section"> -<h1><a class="toc-backref" href="#id5" id="html-4-01-compliance" name="html-4-01-compliance">HTML 4.01 Compliance</a></h1> +<h1><a class="toc-backref" href="#id6" id="html-4-01-compliance" name="html-4-01-compliance">HTML 4.01 Compliance</a></h1> <p>Pieforms generates HTML 4.01 compatible output. It does not support XHTML at the moment, but the author reckons this will only take an hour of work, if you ask nicely :).</p> @@ -112,6 +125,6 @@ </div> <div id="footer">Pieforms by <a href="http://nigel.mcnie.name/">Nigel McNie</a> and <a href="http://pieforms.sourceforge.net/about#authors">others</a>, -© 2006 Catalyst IT Ltd. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> +© 2006 - 2008 <a href="http://www.catalyst.net.nz/">Catalyst IT Ltd</a>. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> </body> </html> Added: pieforms-php5/trunk/doc/html/user/templates.html =================================================================== --- pieforms-php5/trunk/doc/html/user/templates.html (rev 0) +++ pieforms-php5/trunk/doc/html/user/templates.html 2007-12-27 23:40:09 UTC (rev 238) @@ -0,0 +1,310 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns=http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="generator" content="Docutils 0.4.1: http://docutils.sourceforge.net/" /> +<title>Pieforms Elements</title> + +<link rel="stylesheet" type="text/css" href="../style.css" /> +</head> +<body> +<div class="document" id="pieforms-elements"> +<h1 class="title">Pieforms Elements</h1> +<p><div id="breadcrumbs"><a href="http://pieforms.sourceforge.net/">Pieforms Home</a> » <a href="../">Documentation Home</a> » <a href="">Pieforms Templates</a></div></p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field"><th class="field-name">Author:</th><td class="field-body">Nigel McNie</td> +</tr> +<tr class="field"><th class="field-name">Contact:</th><td class="field-body"><a class="reference" href="mailto:nigel@catalyst.net.nz">nigel@catalyst.net.nz</a></td> +</tr> +<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">This document has been placed in the public domain</td> +</tr> +</tbody> +</table> +<div class="contents topic"> +<p class="topic-title first"><a id="contents" name="contents">Contents</a></p> +<ul class="simple"> +<li><a class="reference" href="#overview" id="id1" name="id1">Overview</a></li> +<li><a class="reference" href="#using-templates" id="id2" name="id2">Using Templates</a></li> +<li><a class="reference" href="#an-example-template" id="id3" name="id3">An Example Template</a><ul> +<li><a class="reference" href="#step-1-specify-template-configuration-elements" id="id4" name="id4">Step 1 - Specify Template Configuration Elements</a></li> +<li><a class="reference" href="#step-2-create-the-template" id="id5" name="id5">Step 2 - Create the Template</a></li> +<li><a class="reference" href="#step-3-customise-the-template-to-suit-your-needs" id="id6" name="id6">Step 3 - Customise the template to suit your needs</a></li> +</ul> +</li> +<li><a class="reference" href="#conclusion" id="id7" name="id7">Conclusion</a></li> +</ul> +</div> +<p>This document describes how you can lay out forms very precisely using +templates rather than renderers.</p> +<div class="section"> +<h1><a class="toc-backref" href="#id1" id="overview" name="overview">Overview</a></h1> +<p>Imagine you have a form that you need to lay out quite precisely, compared to a +typical form. Renderers assume that all elements will be layed out in a +consistent manner, which makes them quite limiting in this situation. So +instead, you can write a <strong>template</strong> for your form, that describes exactly how +you want the form layed out.</p> +</div> +<div class="section"> +<h1><a class="toc-backref" href="#id2" id="using-templates" name="using-templates">Using Templates</a></h1> +<p>There are two configuration elements you will be interested in if you are going +to use templates:</p> +<ul class="simple"> +<li>The <tt class="docutils literal"><span class="pre">templatedir</span></tt> specifies in what directory (relative to PHP's include +path) templates will be searched for. You probably want to set this in your +<tt class="docutils literal"><span class="pre">pieform_configure()</span></tt> function, so that you do not have to specify it for +every form.</li> +<li>The <tt class="docutils literal"><span class="pre">template</span></tt> configuration element sets what file is to be used as a +template for this form. Unless you have written a generic template that +applies to many forms in your application, you probably want to set this on +the form itself.</li> +</ul> +<p>Here is an example of setting the <tt class="docutils literal"><span class="pre">templatedir</span></tt> and <tt class="docutils literal"><span class="pre">template</span></tt> +configuration elements on a form:</p> +<pre style="background-color:#ffc;border:1px solid #cc9;"><span style="font-weight:bold;color:#000;" title="php/php5/start"><?php</span> + +<span style="color:#33f;" title="php/php5/varstart">$</span><span style="color:#33f;" title="php/php5/var">form</span> <span style="color:#008000;" title="php/php5/symbol">=</span> <a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">name</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">myform</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">templatedir</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">templates/</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">template</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">myform.php</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">elements</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> + <span style="color:#008000;" title="php/php5/symbol">.</span><span style="color:#008000;" title="php/php5/symbol">.</span><span style="color:#008000;" title="php/php5/symbol">.</span> + <span style="color:#008000;" title="php/php5/symbol">)</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#008000;" title="php/php5/symbol">)</span><span style="color:#008000;" title="php/php5/symbol">,</span> +<span style="color:#008000;" title="php/php5/symbol">)</span><span style="color:#008000;" title="php/php5/symbol">;</span> + +<span style="font-weight:bold;color:#000;" title="php/php5/end">?></span></pre><p>In the above example, the <tt class="docutils literal"><span class="pre">templates/</span></tt> directory relative to PHP's include +path will be searched for the <tt class="docutils literal"><span class="pre">myform.php</span></tt> file.</p> +</div> +<div class="section"> +<h1><a class="toc-backref" href="#id3" id="an-example-template" name="an-example-template">An Example Template</a></h1> +<p>Let us assume that you have been tasked with laying out the blog post form you +created as an example on the <a class="reference" href="usage.html">basic usage</a> page in some +different manner. Feedback from your users suggests that they would like the +"Categories" multiple select to be to the right of the text area, and the +"Publish Date" selector to be to the right of the "Post Title" textbox.</p> +<p>This is not possible with a renderer, but with a template this is quite easy. +We will simply write a template that outputs the elements in the correct +places. Note that the existing form has a fieldset and the new form will not +have one. When you use a template, Pieforms actually <em>ignores</em> fieldsets +(although it keeps the elements inside them). So there is no need to change the +form definition. For your reference, here is the current form definition and a +screenshot of how the form is currently layed out:</p> +<pre style="background-color:#ffc;border:1px solid #cc9;"><span style="font-weight:bold;color:#000;" title="php/php5/start"><?php</span> + +<a href="http://www.php.net/require_once"><span style="color:#a1a100;" title="php/php5/keyword">require_once</span></a><span style="color:#008000;" title="php/php5/symbol">(</span><span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">pieform.php</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">)</span><span style="color:#008000;" title="php/php5/symbol">;</span> + +<a href="http://www.php.net/echo"><span style="color:#a1a100;" title="php/php5/keyword">echo</span></a> <span style="color:#600;font-weight:bold;" title="php/php5/functioncall">pieform</span><span style="color:#008000;" title="php/php5/symbol">(</span><a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">name</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">blogpost</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">method</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">post</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">autofocus</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="font-weight:bold;color:#000;" title="php/php5/constant">true</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">elements</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">title</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">type</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">text</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">title</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">Post Title</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">rules</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">required</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="font-weight:bold;color:#000;" title="php/php5/constant">true</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#008000;" title="php/php5/symbol">)</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#008000;" title="php/php5/symbol">)</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">content</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">type</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">textarea</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">title</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">Content</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">rules</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">required</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="font-weight:bold;color:#000;" title="php/php5/constant">true</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#008000;" title="php/php5/symbol">)</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">resizable</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="font-weight:bold;color:#000;" title="php/php5/constant">true</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#008000;" title="php/php5/symbol">)</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">optional</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">type</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">fieldset</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">legend</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">Advanced Options...</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">collapsible</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="font-weight:bold;color:#000;" title="php/php5/constant">true</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">collapsed</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="font-weight:bold;color:#000;" title="php/php5/constant">true</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">elements</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">categories</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">type</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">select</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">title</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">Categories</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">multiple</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="font-weight:bold;color:#000;" title="php/php5/constant">true</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">size</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#11e;" title="php/php5/num/int">5</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">options</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> + <span style="color:#11e;" title="php/php5/num/int">1</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">Personal</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#11e;" title="php/php5/num/int">2</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">Rants</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#11e;" title="php/php5/num/int">3</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">Politics</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#11e;" title="php/php5/num/int">4</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">Religion</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#11e;" title="php/php5/num/int">5</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">Science</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#11e;" title="php/php5/num/int">6</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">Arts</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#008000;" title="php/php5/symbol">)</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#008000;" title="php/php5/symbol">)</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">publishdate</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <a href="http://www.php.net/array"><span style="color:#a1a100;" title="php/php5/keyword">array</span></a><span style="color:#008000;" title="php/php5/symbol">(</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">type</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">date</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</span> + <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">title</span><span style="color:#f00;" title="php/php5/single_string/end">'</span> <span style="color:#008000;" title="php/php5/symbol">=</span><span style="color:#008000;" title="php/php5/symbol">></span> <span style="color:#f00;" title="php/php5/single_string/start">'</span><span style="color:#f00;" title="php/php5/single_string">Publish Date</span><span style="color:#f00;" title="php/php5/single_string/end">'</span><span style="color:#008000;" title="php/php5/symbol">,</sp... [truncated message content] |
From: <ora...@us...> - 2007-12-27 23:39:27
|
Revision: 237 http://pieforms.svn.sourceforge.net/pieforms/?rev=237&view=rev Author: oracleshinoda Date: 2007-12-27 15:39:31 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Added documentation about templates. Added Paths: ----------- pieforms-php5/trunk/doc/rst/user/templates.rst Added: pieforms-php5/trunk/doc/rst/user/templates.rst =================================================================== --- pieforms-php5/trunk/doc/rst/user/templates.rst (rev 0) +++ pieforms-php5/trunk/doc/rst/user/templates.rst 2007-12-27 23:39:31 UTC (rev 237) @@ -0,0 +1,314 @@ +=================== + Pieforms Elements +=================== +:breadcrumbs:`Documentation Home > Pieforms Templates` + +:Author: Nigel McNie +:Contact: ni...@ca... +:Copyright: This document has been placed in the public domain + +.. contents:: + +This document describes how you can lay out forms very precisely using +templates rather than renderers. + +Overview +======== + +Imagine you have a form that you need to lay out quite precisely, compared to a +typical form. Renderers assume that all elements will be layed out in a +consistent manner, which makes them quite limiting in this situation. So +instead, you can write a **template** for your form, that describes exactly how +you want the form layed out. + +Using Templates +=============== + +There are two configuration elements you will be interested in if you are going +to use templates: + +* The ``templatedir`` specifies in what directory (relative to PHP's include + path) templates will be searched for. You probably want to set this in your + ``pieform_configure()`` function, so that you do not have to specify it for + every form. +* The ``template`` configuration element sets what file is to be used as a + template for this form. Unless you have written a generic template that + applies to many forms in your application, you probably want to set this on + the form itself. + +Here is an example of setting the ``templatedir`` and ``template`` +configuration elements on a form: + +.. highlight:: php/php5 + + <?php + + $form = array( + 'name' => 'myform', + 'templatedir' => 'templates/', + 'template' => 'myform.php', + 'elements' => array( + ... + ), + ), + ); + + ?> + +In the above example, the ``templates/`` directory relative to PHP's include +path will be searched for the ``myform.php`` file. + +An Example Template +=================== + +Let us assume that you have been tasked with laying out the blog post form you +created as an example on the `basic usage <usage.html>`__ page in some +different manner. Feedback from your users suggests that they would like the +"Categories" multiple select to be to the right of the text area, and the +"Publish Date" selector to be to the right of the "Post Title" textbox. + +This is not possible with a renderer, but with a template this is quite easy. +We will simply write a template that outputs the elements in the correct +places. Note that the existing form has a fieldset and the new form will not +have one. When you use a template, Pieforms actually *ignores* fieldsets +(although it keeps the elements inside them). So there is no need to change the +form definition. For your reference, here is the current form definition and a +screenshot of how the form is currently layed out: + +.. highlight:: php/php5 + + <?php + + require_once('pieform.php'); + + echo pieform(array( + 'name' => 'blogpost', + 'method' => 'post', + 'autofocus' => true, + 'elements' => array( + 'title' => array( + 'type' => 'text', + 'title' => 'Post Title', + 'rules' => array( + 'required' => true, + ), + ), + 'content' => array( + 'type' => 'textarea', + 'title' => 'Content', + 'rules' => array( + 'required' => true, + ), + 'resizable' => true, + ), + 'optional' => array( + 'type' => 'fieldset', + 'legend' => 'Advanced Options...', + 'collapsible' => true, + 'collapsed' => true, + 'elements' => array( + 'categories' => array( + 'type' => 'select', + 'title' => 'Categories', + 'multiple' => true, + 'size' => 5, + 'options' => array( + 1 => 'Personal', + 2 => 'Rants', + 3 => 'Politics', + 4 => 'Religion', + 5 => 'Science', + 6 => 'Arts', + ), + ), + 'publishdate' => array( + 'type' => 'date', + 'title' => 'Publish Date', + ), + ), + ), + 'submit' => array( + 'type' => 'submitcancel', + 'value' => array('Enter New Post', 'Cancel'), + 'goto' => $_SERVER['SCRIPT_NAME'], + ), + ) + )); + + function blogpost_validate(Pieform $form, $values) { + if ($values['publishdate'] && $values['publishdate'] < time()) { + $form->set_error('publishdate', 'Sorry, your publish date must be in the future'); + } + } + + function blogpost_submit(Pieform $form, $values) { + echo <<<EOF + <p>Congratulations! New post entered. <a href="">Back to enter another one</a>...</p> + EOF; + exit; + } + + ?> + +.. image:: ../../screenshots/usage-form-4.png + :alt: [The form we will be laying out] + +Step 1 - Specify Template Configuration Elements +------------------------------------------------ + +Add to the form configuration the ``templatedir`` and ``template`` configuration elements as shown: + +.. highlight:: php/php5 + + <?php + + require_once('pieform.php'); + + echo pieform(array( + 'name' => 'blogpost', + 'method' => 'post', + 'autofocus' => true, + 'templatedir' => 'templates/', + 'template' => 'blogpost.php' + ... + +Step 2 - Create the Template +---------------------------- + +When you load the page after adding the template configuration elements, you +will get something like the following: + +.. image:: ../../screenshots/template-missing-boom.png + :alt: [Fatal error: Pieform::require() [function.require]: Failed opening required 'templates/blogpost.php'] + +Pieforms is complaining that it can't find your template. It tells you it was +looking for ``templates/blogpost.php``, which matches the configuration we +provided. + +Create the ``templates/`` directory somewhere relative to PHP's include path, +and create ``blogpost.php`` in it, with the following contents: + +.. highlight:: php/php5 + + <?php + + echo $form_tag; + + foreach ($elements as $name => $element) { + echo '<div>' . $element['labelhtml'] . $element['html'] . ' ' . $element['helphtml']; + if ($element['description']) { + echo '<br><span style="font-size: smaller;">' . $element['description'] . '</span>'; + } + echo '</div>'; + if ($element['error']) { + echo '<div style="background-color: red;">' . $element['error'] . '</div>'; + } + echo "\n"; + } + + echo $hidden_elements; + echo '</form>'; + + ?> + +This will give the following result: + +.. image:: ../../screenshots/form-template-1.png + :alt: [The form, very basically layed out in <div>s] + +.. NOTE:: You will see the PHP notice if your form definition has a fieldset in it. Pieforms is alerting you that fieldsets make no sense when using templates. You can safely ignore the notice, or edit the form definition to remove the fieldset. Of course, you will only see the notice if you have configured PHP to show notices anyway! + +As you can see from the template, there are some variables available to you that you can use: + +* ``$form_tag`` - This contains the <form> tag that Pieforms has generated for + your form. Naturally, it should be echo'd before any of the elements in the + form. +* ``$elements`` - The elements of the form, in an associative array, ordered + the way they were defined. Rather than looping over this, you can just index + the array directly with an element name to get at the data for the element, + which is where much of the templating power comes from. + + Fieldsets and hidden elements are not included in this variable. + + Note that each element has several keys set on it, containing information + that you can use when building the form. Use ``print_r`` or similar to view + them all, but the major ones are: + + * ``labelhtml`` - The HTML for the title of the element, including the + wrapping <label> HTML. + * ``html`` - The HTML for the element itself + * ``helphtml`` - The HTML for the help icon, if ``'help' => true`` was + specified on the element + * ``error`` - The error message, if the element failed validation +* ``$hidden_elements`` - Contains any hidden elements for the form. **Always + output this**, as Pieforms adds at least one hidden element to help it detect + when the form has been submitted. + +Step 3 - Customise the template to suit your needs +-------------------------------------------------- + +10 minutes of playing around and I produced this: + +.. highlight:: php/php5 + + <?php echo $form_tag; ?> + + <table> + <tr> + <th><?php echo $elements['title']['labelhtml']; ?></th> + <td> + <div style="float:right;"> + <?php echo $elements['publishdate']['labelhtml'] . ': ' . $elements['publishdate']['html']; ?> + </div> + <?php echo $elements['title']['html']; + if ($elements['title']['error']) { + echo '<br><div style="color:red;">' . $elements['title']['error'] . '</div>'; + } ?> + </td> + <td></td> + </tr> + <tr> + <th><?php echo $elements['content']['labelhtml']; ?></th> + <td><?php echo $elements['content']['html']; + if ($elements['content']['error']) { + echo '<br><div style="color:red;">' . $elements['content']['error'] . '</div>'; + } ?></td> + <td style="vertical-align: top;"> + <?php echo $elements['categories']['html']; ?> + </td> + </tr> + <tr> + <td></td> + <td><?php echo $elements['submit']['html']; ?></td> + </table> + + <?php + + echo $hidden_elements; + echo '</form>'; + + ?> + +Which renders like this: + +.. image:: ../../screenshots/form-template-2.png + :alt: [The form, layed out as required] + +Now the form is layed out as required. Try submitting the form, and the error +messages for the title and content will be displayed if either one has not been +specified. + +As you can see, it is trivial to achieve any layout you desire now. You could +put all error messages at the top of the form if you want as well as or instead +of putting the messages inline. You can change the order that elements are +output in, or even perform some last minute modifications to the element HTML +itself if you require (although you should try to keep away from doing this if +you can!). + +Conclusion +========== + +Templates give you a powerful way to lay out your forms when you need more +control than what a renderer can provide. + +:breadcrumbs:`Documentation Home > Pieforms Templates` This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-27 23:38:55
|
Revision: 236 http://pieforms.svn.sourceforge.net/pieforms/?rev=236&view=rev Author: oracleshinoda Date: 2007-12-27 15:38:59 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Added a feature - full layout control, thanks to templates. Modified Paths: -------------- pieforms-php5/trunk/doc/rst/user/features.rst Modified: pieforms-php5/trunk/doc/rst/user/features.rst =================================================================== --- pieforms-php5/trunk/doc/rst/user/features.rst 2007-12-27 23:37:48 UTC (rev 235) +++ pieforms-php5/trunk/doc/rst/user/features.rst 2007-12-27 23:38:59 UTC (rev 236) @@ -54,6 +54,20 @@ <http://sourceforge.net/tracker/?group_id=182497&atid=901456>`__, and it could be included in the next release for everyone to enjoy. +Full Layout Control +=================== + +Pieforms gives you two options for laying out forms. One - renderers - will +handle most common cases for forms in your application. If a form you are +writing doesn't need any special layout control, a renderer will be perfect. It +will allow you, without any effort, to guarantee that your forms are all layed +out consistently. + +However, there comes a time when you need more advanced layout control. +Pieforms provides you the ability to write a template to describe how a form +should be layed out. Templates are simply PHP files with access to the form, so +you can get as fancy as you like with how the form elements are layed out. + Asynchronous Forms ================== @@ -77,9 +91,9 @@ Though there is not a lot to translate, Pieforms has i18n support, so the rule messages can be in your native language if you need. Elements also support i18n where required - for example, the calendar element supports different -languages. Although the only supported language at the moment is "en.utf8", it -will take only around 10 minutes to add new languages. Ask on the mailing list -or in the forums! +languages. Currently there are translations for English, German and French, and +creating a new translation will take only around 10 minutes to add new +languages. Ask on the mailing list or in the forums! HTML 4.01 Compliance ==================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-27 23:37:44
|
Revision: 235 http://pieforms.svn.sourceforge.net/pieforms/?rev=235&view=rev Author: oracleshinoda Date: 2007-12-27 15:37:48 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Add the 'signal' module from MochiKit to the instructions. Added an example of using the 'templatedir' directive too. Turns out Pieforms needs the signal module but hasn't had it included in the supplied MochiKit.js file for ever. Modified Paths: -------------- pieforms-php5/trunk/doc/rst/user/configuration.rst Modified: pieforms-php5/trunk/doc/rst/user/configuration.rst =================================================================== --- pieforms-php5/trunk/doc/rst/user/configuration.rst 2007-12-27 23:30:27 UTC (rev 234) +++ pieforms-php5/trunk/doc/rst/user/configuration.rst 2007-12-27 23:37:48 UTC (rev 235) @@ -31,11 +31,11 @@ native JSON extension for PHP, so if you have that extension it is a bonus. PHP 5 >= 5.2 contains the JSON extension built in, so you do not need to worry if you are using a version above that. -* The ``Base``, ``Iter``, ``Style``, ``DOM`` and ``Async`` modules of `MochiKit - <http://mochikit.com/>`__, greater than version 1.3.1. A packed version of - MochiKit containing just these modules is available for your convenience in the - ``static/core/MochiKit`` directory, however you can use your own MochiKit if - you require other modules. +* The ``Base``, ``Iter``, ``Style``, ``DOM``, ``Async`` and ``Signal`` modules + of `MochiKit <http://mochikit.com/>`__, greater than version 1.3.1. A packed + version of MochiKit containing just these modules is available for your + convenience in the ``static/core/MochiKit`` directory, however you can use + your own MochiKit if you require other modules. Installation ============ @@ -120,6 +120,9 @@ // ones. 'configdirs' => $LIBDIR . 'form/', + // Look in this directory for your custom form templates + 'templatedir' => $LIBDIR . 'form/templates/', + // You can add elements that will be in all forms. Here's the prime // example of why you would want to... 'elements' => array( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-27 23:30:24
|
Revision: 234 http://pieforms.svn.sourceforge.net/pieforms/?rev=234&view=rev Author: oracleshinoda Date: 2007-12-27 15:30:27 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Added screenshots to this document (badly needed!). Corrected some mistakes as some elements have changed. Modified Paths: -------------- pieforms-php5/trunk/doc/rst/user/usage.rst Modified: pieforms-php5/trunk/doc/rst/user/usage.rst =================================================================== --- pieforms-php5/trunk/doc/rst/user/usage.rst 2007-12-27 23:26:59 UTC (rev 233) +++ pieforms-php5/trunk/doc/rst/user/usage.rst 2007-12-27 23:30:27 UTC (rev 234) @@ -24,7 +24,9 @@ Your First Pieform ================== -For the sake of argument, let us assume that you are writing a blogging application, and that your current task is to write a form into which new posts will be entered. This form will consist of: +For the sake of argument, let us assume that you are writing a blogging +application, and that your current task is to write a form into which new posts +will be entered. This form will consist of: * A text box, for the subject * A textarea, for the post content @@ -32,14 +34,18 @@ * A date field for choosing the date on which the post will become viewable, defaulting to the current date * A submit and cancel button -Also, for the sake of argument, let us assume that the category selection and date fields are optional and not really used that much, so we will place them in a fieldset and collapse it by default, to make the form seem simpler for general use. +Also, for the sake of argument, let us assume that the category selection and +date fields are optional and not really used that much, so we will place them +in a fieldset and collapse it by default, to make the form seem simpler for +general use. So, given these requirements, let's get started! The Basics ---------- -We shall start with the basic page shell, and build the pieces as required. Here is the most basic shell: +We shall start with the basic page shell, and build the pieces as required. +Here is the most basic shell: .. highlight:: php/php5 @@ -53,9 +59,13 @@ And here is the output you get when running this: -[insert screenshot here of boom] +.. image:: ../../screenshots/no-configuration-boom.png + :alt: [Fatal error: Uncaught exception 'PieformException' with message 'Forms must have a name, and that name must be valid (validity test: could you give a PHP function the name?)'] -Whoops! Pieforms forms **must** have a name. This name is used on the client side to identify the form, and on the server side to provide unique names for the validation/submission callbacks. More on those later, but for now let's add some of the most basic parameters required: +Whoops! Pieforms forms **must** have a name. This name is used on the client +side to identify the form, and on the server side to provide unique names for +the validation/submission callbacks. More on those later, but for now let's add +some of the most basic parameters required: .. highlight:: php/php5 @@ -65,12 +75,13 @@ echo pieform(array( 'name' => 'blogpost', - 'method' => 'post' + 'method' => 'post', )); ?> -[insert screenshot of boom] +.. image:: ../../screenshots/no-elements-boom.png + :alt: [Fatal error: Uncaught exception 'PieformException' with message 'Forms must have a list of elements'] So now the form has a name, and will be sent by POST when submitted. But it has no elements! There's not too much point in having a form that does not have an element, so lets add the title field and submit/cancel buttons. @@ -86,24 +97,26 @@ 'elements' => array( 'title' => array( 'type' => 'text', - 'title' => 'Post Title' + 'title' => 'Post Title', ), 'submit' => array( 'type' => 'submitcancel', - 'value' => array('Enter New Post', 'Cancel') - ) - ) + 'value' => array('Enter New Post', 'Cancel'), + ), + ), )); ?> -[insert screenshot of yay] +.. image:: ../../screenshots/usage-form-1.png + :alt: [Form with text box and submit/cancel buttons] Now we have some concrete progress, at last! We now have a single text box, with a submit and cancel button under it. Compare how much effort it took to add these elements with how you would normally make forms. I hope you are already seeing how quick this is! Now let's try submitting the form: -[insert screenshot of boom] +.. image:: ../../screenshots/no-submithandler-boom.png + :alt: [Fatal error: Uncaught exception 'PieformException' with message 'No function registered to handle form submission for form "test"'] We have not specified the function that gets run when the form is submitted. This function has the name ``[formname]_submit``, and once it is done it should somehow redirect the user to another page (or redirect back to the same page if you wish, but it must be a redirect so that the form state is cleared), or exit the script. For now we will just show a success page: @@ -119,13 +132,13 @@ 'elements' => array( 'title' => array( 'type' => 'text', - 'title' => 'Post Title' + 'title' => 'Post Title', ), 'submit' => array( 'type' => 'submitcancel', - 'value' => array('Enter New Post', 'Cancel') - ) - ) + 'value' => array('Enter New Post', 'Cancel'), + ), + ), )); function blogpost_submit(Pieform $form, $values) { @@ -139,13 +152,15 @@ Please pardon my terrible HTML, this is only an example :). Now, when you submit the form: -[screenshot of success] +.. image:: ../../screenshots/usage-form-submitted.png + :alt: [Congratulations! New post entered. Back to enter another one...] That's much better. Of course, the submit function should have inserted the blog post into the database before displaying this message, but I'll leave that detail as an exercise for the reader. But what about the cancel button? -[screenshot of cancel boom] +.. image:: ../../screenshots/no-cancelhandler-boom.png + :alt: [Fatal error: Uncaught exception 'PieformException' with message 'Cancel element "submit" has no page to go to'] Not so great, luckily Pieforms tells you what you need to do to fix that. While we're at it, let's add the textarea for the post content: @@ -161,18 +176,20 @@ 'elements' => array( 'title' => array( 'type' => 'text', - 'title' => 'Post Title' + 'title' => 'Post Title', ), 'content' => array( - 'type' => 'textarea', - 'title' => 'Content' + 'type' => 'textarea', + 'title' => 'Content', + 'rows' => 10, + 'cols' => 80, ), 'submit' => array( 'type' => 'submitcancel', - 'value' => array('Enter New Post', 'Cancel') - 'goto' => $_SERVER['SCRIPT_NAME'] - ) - ) + 'value' => array('Enter New Post', 'Cancel'), + 'goto' => $_SERVER['SCRIPT_NAME'], + ), + ), )); function blogpost_submit(Pieform $form, $values) { @@ -184,7 +201,8 @@ ?> -[insert screenshot of form] +.. image:: ../../screenshots/usage-form-2.png + :alt: [Form with text box, text area and submit/cancel buttons] You will get the result above both when you view and cancel the form. Of course, your cancel button could redirect elsewhere, or put a message in the session that is displayed on the next page, using the cancel function ``[formname]_cancel_submit`` rather than ``'goto'`` on the element. @@ -202,16 +220,18 @@ 'elements' => array( 'title' => array( 'type' => 'text', - 'title' => 'Post Title' + 'title' => 'Post Title', ), 'content' => array( - 'type' => 'textarea', - 'title' => 'Content' + 'type' => 'textarea', + 'title' => 'Content', + 'rows' => 10, + 'cols' => 80, ), 'optional' => array( 'type' => 'fieldset', - 'title' => 'Advanced Options...', - 'collapsable' => true, + 'legend' => 'Advanced Options...', + 'collapsible' => true, 'collapsed' => true, 'elements' => array( 'categories' => array( @@ -219,26 +239,26 @@ 'title' => 'Categories', 'multiple' => true, 'size' => 5, - 'values' => array( + 'options' => array( 1 => 'Personal', 2 => 'Rants', 3 => 'Politics', 4 => 'Religion', 5 => 'Science', - 6 => 'Arts' - ) + 6 => 'Arts', + ), ), 'publishdate' => array( 'type' => 'date', - 'title' => 'Publish Date' - ) - ) + 'title' => 'Publish Date', + ), + ), ), 'submit' => array( 'type' => 'submitcancel', - 'value' => array('Enter New Post', 'Cancel') - 'goto' => $_SERVER['SCRIPT_NAME'] - ) + 'value' => array('Enter New Post', 'Cancel'), + 'goto' => $_SERVER['SCRIPT_NAME'], + ), ) )); @@ -251,12 +271,39 @@ ?> -[insert screenshot] +.. image:: ../../screenshots/usage-form-3.png + :alt: [Form with text box, text area, collapsed fieldset and submit/cancel buttons] +To make sure that the collapsing works for you, you have to include the +MochiKit library in the page that has the form. Otherwise, you will simply get +a page where the legend is not visible in the fieldset. + +In addition, collapsing works by toggling a class on the fieldset. When you +click on the legend, the class 'collapsed' will be toggled. You can verify this +in firebug or a similar DOM inspection tool, and write your own CSS rules to +make the collapsing work as you expect. Something like this will start you off: + +.. highlight:: css/css + + .collapsed * { + display: none; + } + .collapsed legend, .collapsed legend a { + display: block; + } + + Adding a Touch of Class ----------------------- -Now the whole form is layed out, including the collapsable fieldset. Cool! But we are not finished yet. The form has no rules attached to it (other than a hidden rule on the multiselect box to automatically check that the submitted value is in the array of values), and could be improved with a bit of javascript love. On the rule side, let's make the title and content of the post required and the publish date be later than the current time. For javascript improvement, we can make the textarea resizable and auto focus the title element on page load. +Now the whole form is layed out, including the collapsible fieldset. Cool! But +we are not finished yet. The form has no rules attached to it (other than a +hidden rule on the multiselect box to automatically check that the submitted +value is in the array of values), and could be improved with a bit of +javascript love. On the rule side, let's make the title and content of the post +required and the publish date be later than the current time. For javascript +improvement, we can make the textarea resizable and auto focus the title +element on page load. .. highlight:: php/php5 @@ -272,18 +319,22 @@ 'title' => array( 'type' => 'text', 'title' => 'Post Title', - 'rules' => array('required' => true) + 'rules' => array( + 'required' => true, + ), ), 'content' => array( 'type' => 'textarea', 'title' => 'Content', - 'rules' => array('required' => true), - 'resizable' => true + 'rules' => array( + 'required' => true, + ), + 'resizable' => true, ), 'optional' => array( 'type' => 'fieldset', - 'title' => 'Advanced Options...', - 'collapsable' => true, + 'legend' => 'Advanced Options...', + 'collapsible' => true, 'collapsed' => true, 'elements' => array( 'categories' => array( @@ -291,26 +342,26 @@ 'title' => 'Categories', 'multiple' => true, 'size' => 5, - 'values' => array( + 'options' => array( 1 => 'Personal', 2 => 'Rants', 3 => 'Politics', 4 => 'Religion', 5 => 'Science', - 6 => 'Arts' - ) + 6 => 'Arts', + ), ), 'publishdate' => array( 'type' => 'date', - 'title' => 'Publish Date' - ) - ) + 'title' => 'Publish Date', + ), + ), ), 'submit' => array( 'type' => 'submitcancel', - 'value' => array('Enter New Post', 'Cancel') - 'goto' => $_SERVER['SCRIPT_NAME'] - ) + 'value' => array('Enter New Post', 'Cancel'), + 'goto' => $_SERVER['SCRIPT_NAME'], + ), ) )); @@ -329,17 +380,53 @@ ?> -Not too much added, and pretty much everything we wanted is implemented. The title and content are now required - try submitting the form without them set. There's no easy rule for checking that a value is greater than another just yet, so we added a 'validate' function which sets an error on the form if the publish date is not in the future. It took one line to make the textarea resizable, and just one more to make the title element focus on page load. Note that we specified 'autofocus' to be **true** - this means that the first element in the form will be focussed on page load. You can specify an element by name if you want that particular element to be focussed on page load. +Not too much added, and pretty much everything we wanted is implemented. The +title and content are now required - try submitting the form without them set. +There's no easy rule for checking that a value is greater than another just +yet, so we added a 'validate' function which sets an error on the form if the +publish date is not in the future. It took one line to make the textarea +resizable, and just one more to make the title element focus on page load. Note +that we specified 'autofocus' to be **true** - this means that the first +element in the form will be focussed on page load. You can specify an element +by name if you want that particular element to be focussed on page load. The Finishing Touches --------------------- Programatically, the form is done (except for any actualy logic to save the data somewhere). Now all you need it a bit of CSS magic, and you're done! -[insert CSS code here] +.. highlight:: css/css -[insert screenshot here] + fieldset { + border: 1px solid #888; + font-family: Arial, sans-serif; + } + .collapsed { + border-color: transparent; + border-top: 1px solid #888; + } + .collapsed legend, .collapsed legend a { + display: block; + } + .collapsed * { + display: none; + } + .pieform th { + text-align: right; + font-family: Arial, sans-serif; + vertical-align: top; + padding: .25em .5em .25em 1em; + } + .pieform input, .pieform textarea, .pieform select { + border: 1px solid #888; + } + .pieform input[type="submit"] { + border: 2px outset #ccc; + } +.. image:: ../../screenshots/usage-form-4.png + :alt: [The form, styled with CSS] + From zero to form in very short order - when you get good at writing forms and Pieforms is already integrated into your software, the above form will be very quick indeed to create. Now let's move on to another form, this time one that will have a bit more of an 'AJAX feel'. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-27 23:26:55
|
Revision: 233 http://pieforms.svn.sourceforge.net/pieforms/?rev=233&view=rev Author: oracleshinoda Date: 2007-12-27 15:26:59 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Updated to talk about templates, fixed a few mistakes. Modified Paths: -------------- pieforms-php5/trunk/doc/rst/user/concepts.rst Modified: pieforms-php5/trunk/doc/rst/user/concepts.rst =================================================================== --- pieforms-php5/trunk/doc/rst/user/concepts.rst 2007-12-27 23:25:23 UTC (rev 232) +++ pieforms-php5/trunk/doc/rst/user/concepts.rst 2007-12-27 23:26:59 UTC (rev 233) @@ -11,8 +11,7 @@ Pieforms is a development of the Mahara_ project, that was later split out into its own project on sourceforge_. It provides a unified way to create, validate -and process forms all with a common look and feel, with support for pluggable -elements, renderers and validation rules. +and process forms, with an emphasis on flexibility and extensibility. .. _Mahara: http://mahara.org/ .. _sourceforge: http://pieforms.sourceforge.net/ @@ -58,8 +57,10 @@ that this little subproject had turned into a cool implementation of a form API, that was worth splitting out into its own project. And thus, Pieforms was born. The name was chosen as a tribute to a leaving team member, whose nick on -IRC was 'pie' :) +IRC was 'pie' [#]_ +.. [#] Said co-worker has since returned to Catalyst IT :) + Concepts ======== @@ -142,13 +143,12 @@ hard coded, and that would be what you would do most of the time, but there's nothing to stop it from being generated dynamically. The array specifies some metadata for the whole form, like its name, method and action target, and then -a list of elements that are on the form. Evary form must have a name, this name -is used to call the callback functions. +a list of elements that are on the form. Every form must have a name, used to +distinguish it from other forms so Pieforms can tell when the form itself has +been submitted. -More information about the form array is available on a `separate page`_. +More information about the form array is available on a `separate page <usage.html>`__. -.. _separate page: usage.html - The ``pieform(...)`` function call ********************************** @@ -262,6 +262,23 @@ If all that was confusing, check out the `renderers <renderers.html>`__ page for more information. +Templates +********* + +If renderers don't provide the flexibility you require when laying out a form, +you can instead write a template for it. These are simply PHP/HTML template +files, in which you can output the form in any layout you choose. + +You might find that one or two renderers satisfy most of your form needs, and +that you write templates for the few forms in your application that you can't +lay out nicely using a renderer. + +Combined with the limitless customisability of elements, this grants you the +holy grail - a consistent framework for form building that gives you **complete +control** over how your forms look. + +Check out the `template documentation <templates.html>`__ for more information. + How They Fit Together ===================== @@ -275,8 +292,8 @@ Elements are validated by `rules <rules.html>`__. -Each element in a form is rendered inside some boilerplate HTML provided by a -`renderer <renderers.html>`__. +When using a renderer, each element in a form is rendered inside some +boilerplate HTML provided by a `renderer <renderers.html>`__. When forms are **submitted**, they are **validated** using the **rules** for each **element**. If validation passes, the form **submit callback** is called @@ -295,7 +312,7 @@ available on both pages * Support for **cancel buttons** - in effect, submit buttons with no validation applied to them -* **Auto focus** of fields in a form on page load, including focussing the +* **Auto focus** of fields in a form on page load, including focusing the first element with an error if the form has failed validation * `JS forms <usage.html#jsform>`__ - forms submitted to a hidden iframe with the result returned asynchronously, meaning the form behaves very This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-27 23:25:18
|
Revision: 232 http://pieforms.svn.sourceforge.net/pieforms/?rev=232&view=rev Author: oracleshinoda Date: 2007-12-27 15:25:23 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Added link to templates documentation. Modified Paths: -------------- pieforms-php5/trunk/doc/rst/index.rst Modified: pieforms-php5/trunk/doc/rst/index.rst =================================================================== --- pieforms-php5/trunk/doc/rst/index.rst 2007-12-27 23:23:42 UTC (rev 231) +++ pieforms-php5/trunk/doc/rst/index.rst 2007-12-27 23:25:23 UTC (rev 232) @@ -49,6 +49,8 @@ * `Elements <user/elements.html>`__ - General information about elements including a list of elements that come with Pieforms. * `Renderers <user/renderers.html>`__ +* `Templates <user/templates.html>`__ - How templates can help you control the + layout of your forms, when you need extra control * `Rules <user/rules.html>`__ * `i18n <user/i18n.html>`__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-27 23:23:37
|
Revision: 231 http://pieforms.svn.sourceforge.net/pieforms/?rev=231&view=rev Author: oracleshinoda Date: 2007-12-27 15:23:42 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Updated copyright for 2008, linked to Catalyst's website in footer. Modified Paths: -------------- pieforms-php5/trunk/doc/makedocs.py Modified: pieforms-php5/trunk/doc/makedocs.py =================================================================== --- pieforms-php5/trunk/doc/makedocs.py 2007-12-27 23:22:49 UTC (rev 230) +++ pieforms-php5/trunk/doc/makedocs.py 2007-12-27 23:23:42 UTC (rev 231) @@ -28,7 +28,7 @@ <body> %(html_body)s <div id="footer">Pieforms by <a href="http://nigel.mcnie.name/">Nigel McNie</a> and <a href="http://pieforms.sourceforge.net/about#authors">others</a>, -© 2006 Catalyst IT Ltd. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> +© 2006 - 2008 <a href="http://www.catalyst.net.nz/">Catalyst IT Ltd</a>. Pieforms is released under the <a href="http://gnu.org/licences/gpl.html">GNU GPL</a></div> </body> </html> """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-27 23:22:44
|
Revision: 230 http://pieforms.svn.sourceforge.net/pieforms/?rev=230&view=rev Author: oracleshinoda Date: 2007-12-27 15:22:49 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Added screenshots made for the documentation. Added Paths: ----------- pieforms-php5/trunk/doc/screenshots/ pieforms-php5/trunk/doc/screenshots/form-template-1.png pieforms-php5/trunk/doc/screenshots/form-template-2.png pieforms-php5/trunk/doc/screenshots/no-cancelhandler-boom.png pieforms-php5/trunk/doc/screenshots/no-configuration-boom.png pieforms-php5/trunk/doc/screenshots/no-elements-boom.png pieforms-php5/trunk/doc/screenshots/no-submithandler-boom.png pieforms-php5/trunk/doc/screenshots/template-missing-boom.png pieforms-php5/trunk/doc/screenshots/usage-form-1.png pieforms-php5/trunk/doc/screenshots/usage-form-2.png pieforms-php5/trunk/doc/screenshots/usage-form-3.png pieforms-php5/trunk/doc/screenshots/usage-form-4.png pieforms-php5/trunk/doc/screenshots/usage-form-submitted.png Added: pieforms-php5/trunk/doc/screenshots/form-template-1.png =================================================================== (Binary files differ) Property changes on: pieforms-php5/trunk/doc/screenshots/form-template-1.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pieforms-php5/trunk/doc/screenshots/form-template-2.png =================================================================== (Binary files differ) Property changes on: pieforms-php5/trunk/doc/screenshots/form-template-2.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pieforms-php5/trunk/doc/screenshots/no-cancelhandler-boom.png =================================================================== (Binary files differ) Property changes on: pieforms-php5/trunk/doc/screenshots/no-cancelhandler-boom.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pieforms-php5/trunk/doc/screenshots/no-configuration-boom.png =================================================================== (Binary files differ) Property changes on: pieforms-php5/trunk/doc/screenshots/no-configuration-boom.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pieforms-php5/trunk/doc/screenshots/no-elements-boom.png =================================================================== (Binary files differ) Property changes on: pieforms-php5/trunk/doc/screenshots/no-elements-boom.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pieforms-php5/trunk/doc/screenshots/no-submithandler-boom.png =================================================================== (Binary files differ) Property changes on: pieforms-php5/trunk/doc/screenshots/no-submithandler-boom.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pieforms-php5/trunk/doc/screenshots/template-missing-boom.png =================================================================== (Binary files differ) Property changes on: pieforms-php5/trunk/doc/screenshots/template-missing-boom.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pieforms-php5/trunk/doc/screenshots/usage-form-1.png =================================================================== (Binary files differ) Property changes on: pieforms-php5/trunk/doc/screenshots/usage-form-1.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pieforms-php5/trunk/doc/screenshots/usage-form-2.png =================================================================== (Binary files differ) Property changes on: pieforms-php5/trunk/doc/screenshots/usage-form-2.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pieforms-php5/trunk/doc/screenshots/usage-form-3.png =================================================================== (Binary files differ) Property changes on: pieforms-php5/trunk/doc/screenshots/usage-form-3.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pieforms-php5/trunk/doc/screenshots/usage-form-4.png =================================================================== (Binary files differ) Property changes on: pieforms-php5/trunk/doc/screenshots/usage-form-4.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pieforms-php5/trunk/doc/screenshots/usage-form-submitted.png =================================================================== (Binary files differ) Property changes on: pieforms-php5/trunk/doc/screenshots/usage-form-submitted.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-27 23:21:37
|
Revision: 229 http://pieforms.svn.sourceforge.net/pieforms/?rev=229&view=rev Author: oracleshinoda Date: 2007-12-27 15:21:38 -0800 (Thu, 27 Dec 2007) Log Message: ----------- Updated basic documentation to have 2008 copyright, and reworded to hint at the new templating features. Modified Paths: -------------- pieforms-php5/trunk/CHANGELOG pieforms-php5/trunk/INSTALL pieforms-php5/trunk/README Modified: pieforms-php5/trunk/CHANGELOG =================================================================== --- pieforms-php5/trunk/CHANGELOG 2007-12-16 21:05:42 UTC (rev 228) +++ pieforms-php5/trunk/CHANGELOG 2007-12-27 23:21:38 UTC (rev 229) @@ -1,7 +1,7 @@ - Pieforms - Advanced web forms made easy + Pieforms - Advanced web forms made easy - Nigel McNie - http://nigel.mcnie.name/ - (C) 2006, 2007 Catalyst IT Ltd - http://catalyst.net.nz/ + Nigel McNie - http://nigel.mcnie.name/ + (C) 2006 - 2008 Catalyst IT Ltd - http://catalyst.net.nz/ For a list of changes between versions, please see the sourceforge release notes and changes for the release you have downloaded. This contains both a Modified: pieforms-php5/trunk/INSTALL =================================================================== --- pieforms-php5/trunk/INSTALL 2007-12-16 21:05:42 UTC (rev 228) +++ pieforms-php5/trunk/INSTALL 2007-12-27 23:21:38 UTC (rev 229) @@ -1,7 +1,7 @@ - Pieforms - Advanced web forms made easy + Pieforms - Advanced web forms made easy - Nigel McNie - http://nigel.mcnie.name/ - (C) 2006, 2007 Catalyst IT Ltd - http://catalyst.net.nz/ + Nigel McNie - http://nigel.mcnie.name/ + (C) 2006 - 2008 Catalyst IT Ltd - http://catalyst.net.nz/ Requirements ------------ @@ -14,9 +14,10 @@ the native JSON extension for PHP available. This does not apply if you do not wish to use the JS form submission support. -Pieforms requires the Base, Iter, Style, DOM and Async modules of MochiKit for -AJAX form submission support. A packed version of MochiKit containing just -these modules is available for your convenience in the js/MochiKit directory. +Pieforms requires the Base, Iter, Style, DOM, Async and Signal modules of +MochiKit for AJAX form submission support. A packed version of MochiKit +containing just these modules is available for your convenience in the +js/MochiKit directory. Installation of Pieforms ------------------------ Modified: pieforms-php5/trunk/README =================================================================== --- pieforms-php5/trunk/README 2007-12-16 21:05:42 UTC (rev 228) +++ pieforms-php5/trunk/README 2007-12-27 23:21:38 UTC (rev 229) @@ -1,7 +1,7 @@ - Pieforms - Advanced web forms made easy + Pieforms - Advanced web forms made easy - Nigel McNie - http://nigel.mcnie.name/ - (C) 2006, 2007 Catalyst IT Ltd - http://catalyst.net.nz/ + Nigel McNie - http://nigel.mcnie.name/ + (C) 2006 - 2008 Catalyst IT Ltd - http://catalyst.net.nz/ For installation instructions, please see the INSTALL file in this folder @@ -12,7 +12,7 @@ forms all with a common look and feel. It supports many more types of form controls (elements) than the standard HTML controls, for example date pickers and ajax comboboxes. In addition, each element can have pluggable rules -applied to it, and the elements can be rendered inside custom containers, +applied to it, and the whole form can be layed out as precisely as you like, allowing a lot of flexibility around form output. Pieforms also has a really simple API that makes writing forms very easy. For @@ -33,21 +33,18 @@ a hidden iframe (JS form submission) - validation still works fine, just your forms are submitted a whole lot faster! -Currently, Pieforms is under heavy development, but gains new features and -bugfixes almost every day. While releases will be made regularly, it's -probably best to work off of SVN for now. +Currently, Pieforms is under design and development, and is constantly +improving. While releases will be made regularly, it's probably best to work +off of SVN for now. Requirements ------------ You've downloaded the PHP5 version of Pieforms. With some reasonably minimal -hacking it could be made to work with PHP4 (by making sure that the $form -object is passed around by reference with the & operator, removing some PHP5 -keywords like 'public' and 'private', and changing error handling to not -involve throwing exceptions), I am not going to do the work involved unless I -need it. If you want, you could get it working and provide a patch, which I -would maintain as a separate tree. But in reality, you should think about -moving your project to PHP5. +hacking it could be made to work with PHP4, I am not going to do the work +involved unless I need it. If you want, you could get it working and provide a +patch, which I would maintain as a separate tree. But in reality, you should +think about moving your project to PHP5. License and Copyright --------------------- @@ -55,7 +52,7 @@ Pieforms is licensed under the GNU GPL. For more information, please see the COPYING file that comes with this package. -Pieforms is copyright (C) 2006, 2007 Catalyst IT Ltd. +Pieforms is copyright (C) 2006 - 2008 Catalyst IT Ltd. Pieforms includes parts of MochiKit [1], which is required for the AJAX post functionality. MochiKit is dual licensed under the MIT license or Academic This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-16 21:05:46
|
Revision: 228 http://pieforms.svn.sourceforge.net/pieforms/?rev=228&view=rev Author: oracleshinoda Date: 2007-12-16 13:05:42 -0800 (Sun, 16 Dec 2007) Log Message: ----------- French translation for pieforms. Thanks to Nicolas Martignoni\! Modified Paths: -------------- pieforms-php5/trunk/src/pieform/elements/bytes.php pieforms-php5/trunk/src/pieform/elements/calendar.php pieforms-php5/trunk/src/pieform/elements/date.php pieforms-php5/trunk/src/pieform/elements/expiry.php pieforms-php5/trunk/src/pieform/rules/before.php pieforms-php5/trunk/src/pieform/rules/email.php pieforms-php5/trunk/src/pieform/rules/integer.php pieforms-php5/trunk/src/pieform/rules/maxlength.php pieforms-php5/trunk/src/pieform/rules/maxvalue.php pieforms-php5/trunk/src/pieform/rules/minlength.php pieforms-php5/trunk/src/pieform/rules/minvalue.php pieforms-php5/trunk/src/pieform/rules/regex.php pieforms-php5/trunk/src/pieform/rules/required.php pieforms-php5/trunk/src/pieform/rules/validateoptions.php Modified: pieforms-php5/trunk/src/pieform/elements/bytes.php =================================================================== --- pieforms-php5/trunk/src/pieform/elements/bytes.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/elements/bytes.php 2007-12-16 21:05:42 UTC (rev 228) @@ -133,6 +133,12 @@ 'megabytes' => 'Megabytes', 'invalidvalue' => 'Wert muss eine Zahl sein', ), + 'fr.utf8' => array( + 'bytes' => 'Octets', + 'kilobytes' => 'Kilooctets', + 'megabytes' => 'Mégaoctets', + 'invalidvalue' => 'Valeur doit être un nombre', + ), ); } Modified: pieforms-php5/trunk/src/pieform/elements/calendar.php =================================================================== --- pieforms-php5/trunk/src/pieform/elements/calendar.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/elements/calendar.php 2007-12-16 21:05:42 UTC (rev 228) @@ -158,6 +158,9 @@ 'de.utf8' => array( 'invalidvalue' => 'Datum/Zeit sind falsch festgelegt' ), + 'fr.utf8' => array( + 'invalidvalue' => 'Date/Heure indiquée invalide' + ), ); } Modified: pieforms-php5/trunk/src/pieform/elements/date.php =================================================================== --- pieforms-php5/trunk/src/pieform/elements/date.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/elements/date.php 2007-12-16 21:05:42 UTC (rev 228) @@ -137,6 +137,10 @@ 'or' => 'oder', 'notspecified' => 'Nicht festgelegt' ), + 'fr.utf8' => array( + 'or' => 'ou', + 'notspecified' => 'Non indiqué' + ), ); } Modified: pieforms-php5/trunk/src/pieform/elements/expiry.php =================================================================== --- pieforms-php5/trunk/src/pieform/elements/expiry.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/elements/expiry.php 2007-12-16 21:05:42 UTC (rev 228) @@ -137,7 +137,14 @@ 'months' => 'Monate', 'years' => 'Jahre', 'noenddate' => 'kein Endedatum' - ) + ), + 'fr.utf8' => array( + 'days' => 'Jours', + 'weeks' => 'Semaines', + 'months' => 'Mois', + 'years' => 'Années', + 'noenddate' => 'Pas de date de fin' + ), ); } Modified: pieforms-php5/trunk/src/pieform/rules/before.php =================================================================== --- pieforms-php5/trunk/src/pieform/rules/before.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/rules/before.php 2007-12-16 21:05:42 UTC (rev 228) @@ -51,6 +51,9 @@ 'de.utf8' => array( 'before' => 'Dies kann nicht nach dem Feld "%s" sein' ), + 'fr.utf8' => array( + 'before' => 'Ceci ne peut pas être placé après le champ "%s"' + ), ); } Modified: pieforms-php5/trunk/src/pieform/rules/email.php =================================================================== --- pieforms-php5/trunk/src/pieform/rules/email.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/rules/email.php 2007-12-16 21:05:42 UTC (rev 228) @@ -47,9 +47,12 @@ 'en.utf8' => array( 'email' => 'E-mail address is invalid' ), - 'de.utf8' => array( + 'de.utf8' => array( 'email' => 'Die E-Mail Addresse ist ungültig' ), + 'fr.utf8' => array( + 'email' => 'Cette adresse de courriel n\'est pas valide' + ), ); } Modified: pieforms-php5/trunk/src/pieform/rules/integer.php =================================================================== --- pieforms-php5/trunk/src/pieform/rules/integer.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/rules/integer.php 2007-12-16 21:05:42 UTC (rev 228) @@ -47,6 +47,9 @@ 'de.utf8' => array( 'integer' => 'Das Feld muss eine Zahl sein' ), + 'fr.utf8' => array( + 'integer' => 'Ce champ doit être un nombre entier' + ), ); } Modified: pieforms-php5/trunk/src/pieform/rules/maxlength.php =================================================================== --- pieforms-php5/trunk/src/pieform/rules/maxlength.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/rules/maxlength.php 2007-12-16 21:05:42 UTC (rev 228) @@ -47,6 +47,9 @@ 'de.utf8' => array( 'maxlength' => 'Das Feld darf höchstens %d Zeichen lang sein' ), + 'fr.utf8' => array( + 'maxlength' => 'Ce champ ne peut pas contenir plus de %d signes' + ), ); } Modified: pieforms-php5/trunk/src/pieform/rules/maxvalue.php =================================================================== --- pieforms-php5/trunk/src/pieform/rules/maxvalue.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/rules/maxvalue.php 2007-12-16 21:05:42 UTC (rev 228) @@ -46,7 +46,10 @@ ), 'de.utf8' => array( 'maxvalue' => 'Dieser Wert kann nicht größer als %d sein' - ), + ), + 'fr.utf8' => array( + 'maxvalue' => 'Cette valeur ne peut pas supérieure à %d' + ), ); } Modified: pieforms-php5/trunk/src/pieform/rules/minlength.php =================================================================== --- pieforms-php5/trunk/src/pieform/rules/minlength.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/rules/minlength.php 2007-12-16 21:05:42 UTC (rev 228) @@ -47,6 +47,9 @@ 'de.utf8' => array( 'minlength' => 'Das Feld muss zumindest %d Zeichen lang sein', ), + 'fr.utf8' => array( + 'minlength' => 'Ce champ doit contenir au moins %d caractères', + ), ); } Modified: pieforms-php5/trunk/src/pieform/rules/minvalue.php =================================================================== --- pieforms-php5/trunk/src/pieform/rules/minvalue.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/rules/minvalue.php 2007-12-16 21:05:42 UTC (rev 228) @@ -47,6 +47,9 @@ 'de.utf8' => array( 'minvalue' => 'Dieser Wert kann nicht kleiner als %d sein' ), + 'fr.utf8' => array( + 'minvalue' => 'Cette valeur ne peut pas être inférieure à %d' + ), ); } Modified: pieforms-php5/trunk/src/pieform/rules/regex.php =================================================================== --- pieforms-php5/trunk/src/pieform/rules/regex.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/rules/regex.php 2007-12-16 21:05:42 UTC (rev 228) @@ -45,9 +45,12 @@ 'en.utf8' => array( 'regex' => 'This field is not in valid form' ), - 'de.utf8' => array( + 'de.utf8' => array( 'regex' => 'Das Feld hat keine zulässige Form' ), + 'fr.utf8' => array( + 'regex' => 'Ce champ n\'a pas une forme correcte' + ), ); } Modified: pieforms-php5/trunk/src/pieform/rules/required.php =================================================================== --- pieforms-php5/trunk/src/pieform/rules/required.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/rules/required.php 2007-12-16 21:05:42 UTC (rev 228) @@ -44,9 +44,12 @@ 'en.utf8' => array( 'required' => 'This field is required' ), - 'de.utf8' => array( + 'de.utf8' => array( 'required' => 'Das Feld ist erforderlich' ), + 'fr.utf8' => array( + 'required' => 'Ce champ est obligatoire' + ), ); } Modified: pieforms-php5/trunk/src/pieform/rules/validateoptions.php =================================================================== --- pieforms-php5/trunk/src/pieform/rules/validateoptions.php 2007-12-12 21:40:54 UTC (rev 227) +++ pieforms-php5/trunk/src/pieform/rules/validateoptions.php 2007-12-16 21:05:42 UTC (rev 228) @@ -55,6 +55,9 @@ 'de.utf8' => array( 'validateoptions' => 'Die Option "%s" ist ungültig' ), + 'fr.utf8' => array( + 'validateoptions' => 'Cette option "%s" n\'est pas valide' + ), ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-12 21:40:56
|
Revision: 227 http://pieforms.svn.sourceforge.net/pieforms/?rev=227&view=rev Author: oracleshinoda Date: 2007-12-12 13:40:54 -0800 (Wed, 12 Dec 2007) Log Message: ----------- Apply patch from Mahara to make pieforms handle the case where a language string is asked for in a language we don't have a string for more gracefully. As reported by Nicolas Martignoni Modified Paths: -------------- pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2007-12-08 01:20:39 UTC (rev 226) +++ pieforms-php5/trunk/src/pieform.php 2007-12-12 21:40:54 UTC (rev 227) @@ -1252,7 +1252,10 @@ $function = 'pieform_' . $plugin . '_' . $pluginname . '_i18n'; if (function_exists($function)) { $strings = $function(); - return $strings[$this->data['language']][$key]; + if (isset($strings[$this->data['language']][$key])) { + return $strings[$this->data['language']][$key]; + } + return '[[' . $key . '/' . $this->data['language'] . ']]'; } // We don't recognise this string This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-08 01:21:07
|
Revision: 226 http://pieforms.svn.sourceforge.net/pieforms/?rev=226&view=rev Author: oracleshinoda Date: 2007-12-07 17:20:39 -0800 (Fri, 07 Dec 2007) Log Message: ----------- Make sure that 'collapseifoneoption' is able to be turned off by people using pieforms. Thanks to Richard Mansfield Modified Paths: -------------- pieforms-php5/trunk/src/pieform/elements/select.php Modified: pieforms-php5/trunk/src/pieform/elements/select.php =================================================================== --- pieforms-php5/trunk/src/pieform/elements/select.php 2007-12-04 02:48:29 UTC (rev 225) +++ pieforms-php5/trunk/src/pieform/elements/select.php 2007-12-08 01:20:39 UTC (rev 226) @@ -123,7 +123,9 @@ } function pieform_element_select_set_attributes($element) { - $element['collapseifoneoption'] = true; + if (!isset($element['collapseifoneoption'])) { + $element['collapseifoneoption'] = true; + } $element['rules']['validateoptions'] = true; return $element; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-04 02:48:25
|
Revision: 225 http://pieforms.svn.sourceforge.net/pieforms/?rev=225&view=rev Author: oracleshinoda Date: 2007-12-03 18:48:29 -0800 (Mon, 03 Dec 2007) Log Message: ----------- Added german translation for 'before' rule. Thanks to Heinz. Modified Paths: -------------- pieforms-php5/trunk/src/pieform/rules/before.php Modified: pieforms-php5/trunk/src/pieform/rules/before.php =================================================================== --- pieforms-php5/trunk/src/pieform/rules/before.php 2007-12-03 01:21:40 UTC (rev 224) +++ pieforms-php5/trunk/src/pieform/rules/before.php 2007-12-04 02:48:29 UTC (rev 225) @@ -48,6 +48,9 @@ 'en.utf8' => array( 'before' => 'This can not be after the field "%s"' ), + 'de.utf8' => array( + 'before' => 'Dies kann nicht nach dem Feld "%s" sein' + ), ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2007-12-03 01:21:44
|
Revision: 224 http://pieforms.svn.sourceforge.net/pieforms/?rev=224&view=rev Author: oracleshinoda Date: 2007-12-02 17:21:40 -0800 (Sun, 02 Dec 2007) Log Message: ----------- Added 'before' rule, useful for checking date elements so that one is before another. Added Paths: ----------- pieforms-php5/trunk/src/pieform/rules/before.php Added: pieforms-php5/trunk/src/pieform/rules/before.php =================================================================== --- pieforms-php5/trunk/src/pieform/rules/before.php (rev 0) +++ pieforms-php5/trunk/src/pieform/rules/before.php 2007-12-03 01:21:40 UTC (rev 224) @@ -0,0 +1,54 @@ +<?php +/** + * This program is part of Pieforms + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * @package pieform + * @subpackage rule + * @author Nigel McNie <ni...@ca...> + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL + * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz + * + */ + +/** + * Checks whether the given element's value is less than another element. + * + * Typically useful for dates. + * + * @param Pieform $form The form the rule is being applied to + * @param string $value The value to check + * @param array $element The element to check + * @param string $otherelement The other element to check for + * @return string The error message, if the value is invalid. + */ +function pieform_rule_before(Pieform $form, $value, $element, $otherelement) { + $otherelement = $form->get_element($otherelement); + $othervalue = $form->get_value($otherelement); + if ($value != '' && $othervalue != '' && intval($value) > intval($othervalue)) { + return sprintf($form->i18n('rule', 'before', 'before', $element), $otherelement['title']); + } +} + +function pieform_rule_before_i18n() { + return array( + 'en.utf8' => array( + 'before' => 'This can not be after the field "%s"' + ), + ); +} + +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |