Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
Updated eForm to 1.4.5
Browse files Browse the repository at this point in the history
- Updated language files
- Added &attachmentField parameter
- Added &attachmentPath parameter
  • Loading branch information
Jako committed Feb 14, 2014
1 parent 14f45bf commit 8d511a4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
4 changes: 4 additions & 0 deletions assets/snippets/eform/docs/eform.htm
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ <h2>Installation</h2>
</li>
<li><strong>&amp;snipFolder</strong> <span class="new">(new in 1.4.4)</span> (Optional)<br />
For those that want to keep different versions of eForm active. You can now save all of eForm's files in a different directory and set the &amp;snipFolder accordingly. You can for instance save version 1.4.4 in the 'assets/snippets/eform/1.4.4' folder and set <code>&amp;snipFolder=`eform/1.4.4`</code>. The value of &amp;snipFolder is added to the basic snippets folder 'assets/snippets/'.It should not include a closing slash (/)!</li>
<li><strong>&amp;attachmentField</strong> <span class="new">(new in 1.4.5)</span> (Optional)<br />
The name of the form field that contains a comma separated list of filenames located in &amp;attachmentFolder that are attached to the mail sent to the &amp;to address. Usefull if you want to create/set attachments in event functions.
<li><strong>&amp;attachmentFolder</strong> <span class="new">(new in 1.4.5)</span> (Optional)<br />
The folder (relative to the MODX basepath) that contains the files specified by &amp;attachmentField. It should not include a closing slash (/)!</li>
</ul>


Expand Down
6 changes: 6 additions & 0 deletions assets/snippets/eform/docs/eform_history.htm
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@
</ul>
</div>
<div class="qe_level_1"><h2>Version History</h2>
<h3>Version 1.4.5</h3>
<ul>
<li>Updated language files.</li>
<li>Added &amp;attachmentField parameter.</li>
<li>Added &amp;attachmentPath parameter.</li>
</ul>
<h3>Version 1.4.4.9</h3>
<ul>
<li>Updated language files.</li>
Expand Down
17 changes: 14 additions & 3 deletions assets/snippets/eform/eform.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
# eForm 1.4.4.9 - Electronic Form Snippet
# eForm 1.4.5 - Electronic Form Snippet
# Original created by: Raymond Irving 15-Dec-2004.
# Extended by: Jelle Jager (TobyL) September 2006
# -----------------------------------------------------
Expand Down Expand Up @@ -54,7 +54,7 @@ function eForm($modx,$params) {

extract($params,EXTR_SKIP); // extract params into variables

$fileVersion = '1.4.4';
$fileVersion = '1.4.5';
$version = isset($version)?$version:'prior to 1.4.2';

#include default language file
Expand Down Expand Up @@ -321,7 +321,7 @@ function eForm($modx,$params) {

#set validation message
if (count($rMsg) > 0) {
$rMsg = "<span class=\"requiredlist\"><span>" . implode(" </span><span>",$rMsg) . " </span></span>";
$rMsg = "<span class=\"requiredlist\"><span>" . implode("</span><span>",$rMsg) . "</span></span>";
$tmp = str_replace("{fields}", $rMsg, $_lang['ef_required_message']);
} else {
$tmp = "";
Expand Down Expand Up @@ -459,6 +459,17 @@ function eForm($modx,$params) {
$from = ($from)? formMerge($from,$fields):"";
$fromname = ($from)? formMerge($fromname,$fields):"";

# added in 1.4.5 - Use a field for attachments
if ($attachmentField != '' && isset($fields[$attachmentField]) && !empty($fields[$attachmentField])) {
$attachmentPath = realpath(MODX_BASE_PATH . $attachmentPath) . '/';
$filenames = explode(',', $fields[$attachmentField]);
foreach ($filenames as $filename) {
if (file_exists($attachmentPath . $filename)) {
$attachments[count($attachments)] = $attachmentPath . $filename;
}
}
}

$to = formMerge($to,$fields);
if(empty($to) || !strpos($to,'@')) $nomail=1;

Expand Down
6 changes: 4 additions & 2 deletions assets/snippets/eform/snippet.eform.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
if(!defined('MODX_BASE_PATH')){die('What are you doing? Get out of here!');}
# eForm 1.4.4.9 - Electronic Form Snippet
# eForm 1.4.5 - Electronic Form Snippet
# Original created by Raymond Irving 15-Dec-2004.
# Version 1.3+ extended by Jelle Jager (TobyL) September 2006
# -----------------------------------------------------
Expand Down Expand Up @@ -85,7 +85,9 @@
'invalidClass' => isset($invalidClass)?$invalidClass:"invalid",
'runSnippet' => ( isset($runSnippet) && !is_numeric($runSnippet) )?$runSnippet:'',
'autoSenderName' => isset($autoSenderName)?$autoSenderName:'',
'version' => '1.4.4'
'attachmentField' => isset($attachmentField)?$attachmentField:'',
'attachmentPath' => isset($attachmentPath)?$attachmentPath:'',
'version' => '1.4.5'
);

// pixelchutes PHx workaround
Expand Down
2 changes: 1 addition & 1 deletion install/assets/snippets/eform.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Robust form parser/processor with validation, multiple sending options, chunk/page support for forms and reports, and file uploads
*
* @category snippet
* @version 1.4.4.9
* @version 1.4.5
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
* @internal @properties
* @internal @modx_category Forms
Expand Down

0 comments on commit 8d511a4

Please sign in to comment.