pieforms-commit Mailing List for Pieforms
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
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
20
|
21
|
22
|
23
(1) |
24
|
25
|
26
|
27
(1) |
28
|
From: <ora...@us...> - 2009-02-27 04:27:52
|
Revision: 303 http://pieforms.svn.sourceforge.net/pieforms/?rev=303&view=rev Author: oracleshinoda Date: 2009-02-27 04:27:47 +0000 (Fri, 27 Feb 2009) Log Message: ----------- Generalise the code to detect file elements, so any custom element can declare it needs the form to POST. Thanks to Richard Mansfield Modified Paths: -------------- pieforms-php5/trunk/src/pieform/elements/file.php pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform/elements/file.php =================================================================== --- pieforms-php5/trunk/src/pieform/elements/file.php 2009-02-23 05:17:03 UTC (rev 302) +++ pieforms-php5/trunk/src/pieform/elements/file.php 2009-02-27 04:27:47 UTC (rev 303) @@ -45,4 +45,9 @@ } }/*}}}*/ +function pieform_element_file_set_attributes($element) {/*{{{*/ + $element['needsmultipart'] = true; + return $element; +}/*}}}*/ + ?> Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2009-02-23 05:17:03 UTC (rev 302) +++ pieforms-php5/trunk/src/pieform.php 2009-02-27 04:27:47 UTC (rev 303) @@ -322,15 +322,6 @@ $element['title'] = ''; } - // Force the form method to post if there is a file to upload - if ($element['type'] == 'file') { - $this->fileupload = true; - if ($this->data['method'] == 'get') { - $this->data['method'] = 'post'; - self::info("Your form '$this->name' had the method 'get' and also a file element - it has been converted to 'post'"); - } - } - // This function can be defined by the application using Pieforms, // and applies to all elements of this type $function = 'pieform_element_' . $element['type'] . '_configure'; @@ -350,6 +341,15 @@ $element = $function($element); } + // Force the form method to post if there is a file to upload + if (!empty($element['needsmultipart'])) { + $this->fileupload = true; + if ($this->data['method'] == 'get') { + $this->data['method'] = 'post'; + self::info("Your form '$this->name' had the method 'get' and also a file element - it has been converted to 'post'"); + } + } + // Add the autofocus flag to the element if required if (!$autofocusadded && $this->data['autofocus'] === true && empty($element['nofocus'])) { $element['autofocus'] = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2009-02-23 05:17:09
|
Revision: 302 http://pieforms.svn.sourceforge.net/pieforms/?rev=302&view=rev Author: oracleshinoda Date: 2009-02-23 05:17:03 +0000 (Mon, 23 Feb 2009) Log Message: ----------- Allow recreation of iframe for async submission every time a form is submitted (needed for multiple file uploads) Modified Paths: -------------- pieforms-php5/trunk/src/pieform.php pieforms-php5/trunk/src/static/core/pieforms.js Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2009-01-16 02:18:28 UTC (rev 301) +++ pieforms-php5/trunk/src/pieform.php 2009-02-23 05:17:03 UTC (rev 302) @@ -691,6 +691,8 @@ 'jsErrorCallback' => $this->data['jserrorcallback'], 'globalJsErrorCallback' => $this->data['globaljserrorcallback'], 'postSubmitCallback' => $this->data['postsubmitcallback'], + 'newIframeOnSubmit' => $this->data['newiframeonsubmit'], + 'reloadFormOnReply' => $this->data['reloadformonreply'], )); $result .= "<script type=\"text/javascript\">new Pieform($data);</script>\n"; } @@ -1338,6 +1340,15 @@ // supported in less browsers. Most modern browsers should be fine) 'jsform' => false, + // Whether the form will target a new hidden iframe every time it's + // submitted. + 'newiframeonsubmit' => false, + + // Whether the contents of the form should be reloaded on the page when + // a reply is received from the server. If false, error messages will + // not automatically be displayed inside the form. + 'reloadformonreply' => true, + // The URL where pieforms.js and other related pieforms javascript // files can be accessed. Best specified as an absolute path in // pieform_configure() Modified: pieforms-php5/trunk/src/static/core/pieforms.js =================================================================== --- pieforms-php5/trunk/src/static/core/pieforms.js 2009-01-16 02:18:28 UTC (rev 301) +++ pieforms-php5/trunk/src/static/core/pieforms.js 2009-02-23 05:17:03 UTC (rev 302) @@ -149,8 +149,9 @@ } // Ensure the iframe exists and make sure the form targets it - self.setupIframe(); - $(self.data.name).target = self.data.name + '_iframe'; + // self.data.newIframes = true; + var iframeName = self.setupIframe(); + $(self.data.name).target = iframeName; appendChildNodes(self.data.name, INPUT({ @@ -169,26 +170,28 @@ PieformManager.signal('onreply', self.data.name); - var tmp = DIV(); - tmp.innerHTML = data.replaceHTML; + if (self.data.reloadFormOnReply) { + var tmp = DIV(); + tmp.innerHTML = data.replaceHTML; - // Work out whether the new form tag has the error class on it, for - // updating the form in the document - if (hasElementClass(tmp.childNodes[0], 'error')) { - addElementClass(self.data.name, 'error'); + // Work out whether the new form tag has the error class on it, for + // updating the form in the document + if (hasElementClass(tmp.childNodes[0], 'error')) { + addElementClass(self.data.name, 'error'); + } + else { + removeElementClass(self.data.name, 'error'); + } + + // The first child node is the form tag. We replace the children of + // the current form tag with the new children. This prevents + // javascript references being lost + replaceChildNodes($(self.data.name), tmp.childNodes[0].childNodes); + + self.connectSubmitButtons(); + PieformManager.signal('onload', self.data.name); } - else { - removeElementClass(self.data.name, 'error'); - } - // The first child node is the form tag. We replace the children of - // the current form tag with the new children. This prevents - // javascript references being lost - replaceChildNodes($(self.data.name), tmp.childNodes[0].childNodes); - - self.connectSubmitButtons(); - PieformManager.signal('onload', self.data.name); - if (data.returnCode == 0) { // Call the defined success callback, if there is one if (typeof(self.data.jsSuccessCallback) == 'string' @@ -229,6 +232,13 @@ this.setupIframe = function() {//{{{ var iframeName = self.data.name + '_iframe'; + if (self.data.newIframeOnSubmit) { + if (!self.data.nextIframe) { + self.data.nextIframe = 0; + } + iframeName += '_' + self.data.nextIframe; + self.data.nextIframe++; + } if ($(iframeName)) { self.iframe = $(iframeName); } @@ -240,6 +250,7 @@ }); insertSiblingNodesAfter(self.data.name, self.iframe); } + return iframeName; }//}}} this.connectSubmitButtons = function() {//{{{ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |