Skip to content

Commit

Permalink
updated to 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbaseman committed Oct 15, 2016
1 parent 029f036 commit d22622c
Show file tree
Hide file tree
Showing 92 changed files with 735 additions and 708 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ MODULE VERSION HISTORY
======================

------------------------------------------------------------------------------------------------------------------------
*** 1.3.0 (Martin Hecht: 15-Oct-2016) ***
add icons for import/export (thanks to norbert and noname8)
correct icon in ajax drag&drop helper
use IDKEY in move-up and move-down links
use IDKEY in ajax helpers
fix typo in delete_field.php
bugfixes in move-up and move-down noscript fallback
bugfixes in ajax helpers
switch to div-layout by default (thanks to florian for insisting)
hand over submissions between the pages of a multi form page
deny access to following pages unless the previous page has been submitted
some clean up in the style files and added classes for help in div-layout
update documentation and update standard forms, update style file of docu
added French and Italian language support in pear uploader

*** 1.2.3 (Martin Hecht: 20-Aug-2016) ***
fix query for position in upgrade script, thanks to norhei for reporting
fix drag and drop in ajax helper, thanks to florian for reporting
Expand Down
116 changes: 33 additions & 83 deletions RELEASE_NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,102 +1,52 @@
Release Notes for mpForm 1.2.0
Release Notes for mpForm 1.3.x

New Features
------------

In the backend of the module you can import and export the whole form
(including all fields and settings) as xml file. The submissions and
results tables however are not exported. This mechanism can also be
used to install the standard forms which is available together with
the documentation (sse below).

There is a new wizard now, which allows to populate html code sections
such that div-sections are shown or hidden, depending on the current
selection of another form element of your choice. They are called
conditionally displayed blocks. They are not really a field type
but you can easily populate a html code block with sophisticated
code, which you can distribute later across several html sections
in order to show/hide whole parts of the form.
General Changes
---------------
By default switched to a div-based layout. All pages created with earlier versions
of course keep their layout as it is (by default it was a table based layout in the past)

Hidden fields are now available for inserting data into the form
submission which is hidden to the user - this can be useful for handing
over data between different pages of multi page forms.
The style file has been cleaned up and a few new definitions have been added
for the help popup dialog in div-based layout. Remember to copy the default style
files manually (or merge the changes into your local modifications) in order to
pick up the improved style settings.

Italian language support has been added and the language support in the
Ajax helpers has been improved.
New Features
------------
In multi page forms the access to following pages is denied to all following pages
unless the previous page has been submitted successfully

Feature Enhancements
Feature Improvements
--------------------
In multi page forms submissions are handed over between the individual pages so that
the last page can send confirmation mails about all the submissions of the current page
and now also all previous pages. The data is stored in the session indexed by the
submission id and could in principle be used in the private functions as well.

The switch to enable/disable fields is available to all field types now,
including html code and headings.

In the past the results tables often were a source of trouble. In this
version of mpform their structure is always kept up to date. If you happen
to change the suffix for the results table in the settings, add or copy
fields the table is created or the column is inserted if needed.
The {HELP} placeholder works not only in table based layouts, but in general now.

Additionally, if you wish not to make use of the results tables at all,
you can disable them completely by setting the suffix to the string
"DISABLED".
French and Italian language support did not cover the error messages in the pear
file uploader tool. These missing language files have been added now.

For html code fields there is a new switch which allows to specify where
the code shall be used: In the form on the web page, in the html code
for the site owner, and/or the html code for the user confirmation.

In html code sections normal html comments can be inserted which are
shown in the output as well, but as a new feature, if the inner part
of the html comment is additionally commented out with php comments,
it is suppressed in the output: <!--/* vanishing comment */-->

API Changes
-----------

The private functions take more arguments now, because the mpform
module does not make use of global variables anymore. Of course, the
usual globals like the database object and the superglobals like the
session are available. For details see the private.default.php.
The examples are more detailed now and better commented.
Security Enhancements
---------------------

IDKEYs were not used throughout the module. In fact they were only used when
Javascript and therefore Ajax was disabled. Now the Ajax-Helpers also use IDKEYs.
Also the Noscript-fallbacks for moving fields up and down use IDKEYs now.

Documentation
-------------

The documentation has been updated and included in the module (I hope
that the forum lets me upload the file - if it is too large, I'll
make it available as a separate zip archive).
The feature changes described here are also reflected in the documentation.
The standard forms have also been updated and are based on div-layout now.

Bug fixes
---------
In the 1.2.x releases the icons for import/export for these buttons have been missing.
Now they are included in the module package.

The results tables are correctly removed now, when a mpform section is
removed. In the past unused results tables were kept in the database
after removing the forms until one eventually uninstalls the module.
This change also implies that you should make a backup of the submissions
when you remove the form. The results table is of course kept in the case
when multiple forms write to the same results table.


General Changes
---------------

Promised a long time ago and finally finished: The module works in sql
strict mode now.
The ajax drag&drop helper did use a wrong url for a icon in one of the message boxes.
It has been corrected now.

In general the code has been reworked a lot. Long lines have been wrapped
and properly indented for better readability of the code and to assist
users when they try to identify a bug. It is not a complete rewrite of the
code but nearly. Module specific global variables are not used anmore.
A few other minor fixes in Ajax-Helpers, and their Noscript-fallbacks.

Old code for WB 2.7 has been removed and code for backwards compatibility
to versions of WB 2.8 earlier than 2.8.3 have been made consistent throughout
the whole code. IDKEY and FTAN are two examples. These features are only
used when the core supports them. In general it is not recommended to
run old versions without such security features. But anyhow, in the previous
versions of mpform, there were checks which allowed to run without them,
but not in all parts of the module.

When sending http headers to redirect the user to another page, there is
an additional check now, if the headers have already been sent. If so,
an alternative redirection link is presented to the user. This can help
when other modules/snippets interfere with the way how the content is
buffered or sent to the user.
9 changes: 9 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

/*
* todo list for upcoming releases:
* ================================
*
* currently, this list is empty, but if you find bugs or if you would like to
* propose a new feature which you consider useful, do not hesitate to contact me.
*
*/
34 changes: 12 additions & 22 deletions add.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
*
* @category page
* @module mpform
* @version 1.2.3
* @version 1.3.0
* @authors Frank Heyne, NorHei(heimsath.org), Christian M. Stefan (Stefek), Martin Hecht (mrbaseman) and others
* @copyright (c) 2009 - 2016, Website Baker Org. e.V.
* @url http://forum.websitebaker.org/index.php/topic,28496.0.html
* @url https://github.com/WebsiteBaker-modules/mpform
* @url https://forum.wbce.org/viewtopic.php?id=661
* @license GNU General Public License
* @platform 2.8.x
* @requirements probably php >= 5.3 ?
Expand Down Expand Up @@ -41,35 +42,24 @@
$setting = $query_content->fetchRow();

// set default values
$header = '<table class="mpform-maintable"'
. ' cellpadding=\"2\"'
. ' cellspacing=\"0\"'
. ' border=\"0\">';
$field_loop = '<tr class="{CLASSES}">'
. '<td class=\"'.MPFORM_CLASS_PREFIX.'title\">'
$header = '';
$field_loop = '<div class="questionbox {CLASSES} '.MPFORM_CLASS_PREFIX.'title\">'
. '{TITLE}{REQUIRED}:'
. '</td>'
. '<td class="'.MPFORM_CLASS_PREFIX.'help">'
. '<div class="'.MPFORM_CLASS_PREFIX.'help">'
. '{HELP}'
. '</td>'
. '<td class="'.MPFORM_CLASS_PREFIX.'field">'
. '</div>'
. '</div>'
. '<div class="answerbox '.MPFORM_CLASS_PREFIX.'field">'
. '{FIELD}{ERRORTEXT}'
. '</td>'
. '</tr>';
$footer = '<tr>'
. '<td>'
. '</td>'
. '<td>'
. '</td>'
. '<td>'
. '</div>'
. '<div class="newline"></div>';
$footer = '<div class="submitbox">'
. '<input'
. ' type=\"submit\"'
. ' name=\"submit\"'
. ' class=\"'.MPFORM_CLASS_PREFIX.'submit\"'
. ' value=\"'.$LANG['backend']['TXT_SUBMIT'].'\" />'
. '</td>'
. '</tr>'
. '</table>';
. '</div>';
$heading_html = "<h3>{HEADING}</h3>";
$short_html = "<b>{TITLE}:</b> {DATA}<br />";
$long_html = "<b>{TITLE}:</b><br />{DATA}<br /><br />";
Expand Down
3 changes: 2 additions & 1 deletion add_field.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
*
* @category page
* @module mpform
* @version 1.2.3
* @version 1.3.0
* @authors Frank Heyne, NorHei(heimsath.org), Christian M. Stefan (Stefek), Martin Hecht (mrbaseman) and others
* @copyright (c) 2009 - 2016, Website Baker Org. e.V.
* @url http://forum.websitebaker.org/index.php/topic,28496.0.html
* @url https://github.com/WebsiteBaker-modules/mpform
* @url https://forum.wbce.org/viewtopic.php?id=661
* @license GNU General Public License
* @platform 2.8.x
* @requirements probably php >= 5.3 ?
Expand Down
20 changes: 10 additions & 10 deletions ajax/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
*
* @category page
* @module mpform
* @version 1.2.3
* @version 1.3.0
* @authors Frank Heyne, NorHei(heimsath.org), Christian M. Stefan (Stefek), Martin Hecht (mrbaseman) and others
* @copyright (c) 2009 - 2016, Website Baker Org. e.V.
* @url http://forum.websitebaker.org/index.php/topic,28496.0.html
* @url https://github.com/WebsiteBaker-modules/mpform
* @url https://forum.wbce.org/viewtopic.php?id=661
* @license GNU General Public License
* @platform 2.8.x
* @requirements probably php >= 5.3 ?
Expand Down Expand Up @@ -53,11 +54,16 @@
$sDbColumn = $_POST['DB_COLUMN'];
$iRecordID = $_POST['iRecordID'];
$sModuleDIR = $_POST['MODULE'];


// Check if user has enough rights to do this:
require_once(WB_PATH.'/framework/class.admin.php');
$admin = new admin('Modules', 'module_view', FALSE, FALSE);
if(!is_numeric($iRecordID)) {
if(method_exists( $admin, 'checkIDKEY' ))
$iRecordID = $admin->checkIDKEY($iRecordID,-1,'key',true);
else $iRecordID = -1;
}

// Check if user has enough rights to do this:
if (!($admin->is_authenticated() && $admin->get_permission($sModuleDIR, 'module')))
{
$aJsonRespond['message'] = 'You\'re not allowed to make changes to this Module: '.$sModuleDIR;
Expand Down Expand Up @@ -101,13 +107,7 @@
case 'delete_record':
// Check the Parameters
if(isset($_POST['action']) && $_POST['action'] == 'delete') {

if(!is_numeric($iRecordID)) {
if(method_exists( $admin, 'checkIDKEY' ))
$iRecordID = $admin->checkIDKEY($iRecordID);
else $iRecordID = -1;
}


$query = "DELETE FROM `".$sDbRecordTable."` WHERE `".$sDbColumn."` = '".$iRecordID."' LIMIT 1";
$database->query($query);
if($database->is_error())
Expand Down
1 change: 1 addition & 0 deletions ajax/ajaxChangeFormFieldStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
oElement.attr("src", ICONS +"/"+ action +".gif");
oElement.attr("title", LANG[json_respond.message]);
oElement.animate({opacity: 1});
window.location.reload();
} else {
alert(json_respond.message);
}
Expand Down
11 changes: 7 additions & 4 deletions ajax/ajaxDeleteRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,22 @@
var oRecord = $("tr#" + aOpts.DB_COLUMN +'_'+ iRecordID);

if (confirm(LANG.SURE_DELETE_RECORD)) {
// pregenerate the data string
var sDataString = 'purpose=delete_record&action=delete&DB_RECORD_TABLE='+aOpts.DB_RECORD_TABLE+'&DB_COLUMN='+aOpts.DB_COLUMN+'&MODULE='+aOpts.MODULE+'&iRecordID='+iRecordID+'&iSectionID=' + iSectionID;

$.ajax({
url: MODULE_URL +"/ajax/ajax.php",
type: "POST",
dataType: 'json',
data: sDataString,
data: 'purpose=delete_record&action=delete'
+'&DB_RECORD_TABLE='+aOpts.DB_RECORD_TABLE
+'&DB_COLUMN='+aOpts.DB_COLUMN
+'&MODULE='+aOpts.MODULE
+'&iRecordID='+iRecordID
+'&iSectionID='+iSectionID,
success: function(json_respond) {
if(json_respond.success == true) {
//row.fadeOut('slow');
oRecord.fadeOut(1200);
// alert(json_respond.message + ' ' + sDataString); // debug
window.location.reload();
} else {
alert(json_respond.message);
}
Expand Down
9 changes: 5 additions & 4 deletions ajax/ajax_dragdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ if(jQuery().sortable){
jQuery(function() {
jQuery('.dragdrop_item').addClass('dragdrop_handle');
jQuery(".dragdrop_form .move_position a").remove();
//var sDataString = jQuery(this).sortable("serialize") + '&action=updatePosition';

jQuery(".dragdrop_form tbody").sortable({
appendTo: 'body',
Expand All @@ -40,17 +39,19 @@ if(jQuery().sortable){
jQuery.ajax({
type: 'POST',
url: MODULE_URL +'/ajax/ajax_dragdrop.php',
data: jQuery(this).sortable("serialize") + '&action=updatePosition',
data: jQuery(this).sortable("serialize", {
expression: /(.+)[:=](.+)/
}) + '&action=updatePosition',
dataType: 'json',
success: function(json_respond){
//alert(json_respond.message +' '+sDataString);
if( json_respond.success != true ) {
alert(json_respond.message);
}
var INFO_BOX = jQuery("#" + RESULTS_CONTAINER);
INFO_BOX.html('<img id="reload_img" src="'+ ICONS +'/' + json_respond.icon +'" alt="" />').fadeIn("slow");
jQuery("#reload_img").fadeOut(2300);

// due to expiring IDKEYs we have to refresh the page
window.location.reload();
}
});
}
Expand Down
Loading

0 comments on commit d22622c

Please sign in to comment.