Attached Files |
form_submission_improvements2011_core.patch [^] (14,946 bytes) 2011-01-25 05:13
[Show Content]
Index: core/admin_templates/forms/form_field_edit.tpl
===================================================================
--- core/admin_templates/forms/form_field_edit.tpl (revision 14184)
+++ core/admin_templates/forms/form_field_edit.tpl (working copy)
@@ -64,11 +64,15 @@
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="FieldName" title="la_prompt_FieldName" size="40"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="FieldLabel" title="la_prompt_FieldLabel" size="40"/>
- <inp2:m_RenderElement name="subsection" prefix="formflds" fields="Prompt,ElementType,Validation,ValueList,DefaultValue,Priority,Required,DisplayInGrid,Visibility,EmailCommunicationRole" title="la_tab_AdminUI"/>
+ <inp2:m_RenderElement name="subsection" prefix="formflds" fields="Prompt,ElementType,Validation,UploadExtensions,UploadMaxSize,ValueList,DefaultValue,Priority,Required,DisplayInGrid,Visibility,EmailCommunicationRole" title="la_tab_AdminUI"/>
<!--<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="Heading" title="la_prompt_heading" size="40"/>-->
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="Prompt" title="la_prompt_FieldPrompt" size="40"/>
<inp2:m_RenderElement name="inp_edit_options" prefix="formflds" field="ElementType" title="la_prompt_InputType" has_empty="1"/>
<inp2:m_RenderElement name="inp_edit_options" prefix="formflds" field="Validation" title="la_prompt_validation"/>
+
+ <inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="UploadExtensions" title="la_fld_UploadExtensions" hint_label="la_hint_UploadExtensions" style="width: 200px;"/>
+ <inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="UploadMaxSize" title="la_fld_UploadMaxSize" hint_label="la_hint_UploadMaxSize" style="width: 200px;"/>
+
<inp2:m_RenderElement name="inp_edit_textarea" prefix="formflds" field="ValueList" title="la_prompt_ValueList" allow_html="0" cols="40" rows="5"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="DefaultValue" title="la_prompt_DefaultValue" size="40"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="Priority" title="la_field_Priority" size="10"/>
@@ -88,4 +92,29 @@
</table>
</div>
+<inp2:m_if check="formflds_FieldsVisible" fields="UploadExtensions,UploadMaxSize">
+ <script type="text/javascript">
+ var $field_mask = '<inp2:formflds_InputName field="#FIELD_NAME#" js_escape="1"/>';
+
+ function syncUploadSettings() {
+ if ( $( get_control($field_mask, 'ElementType') ).val() == 'upload' ) {
+ $( get_control($field_mask, 'UploadExtensions', 'row') ).show();
+ $( get_control($field_mask, 'UploadMaxSize', 'row') ).show();
+ }
+ else {
+ $( get_control($field_mask, 'UploadExtensions', 'row') ).hide();
+ $( get_control($field_mask, 'UploadMaxSize', 'row') ).hide();
+ }
+ }
+
+ $(document).ready(
+ function () {
+ $( get_control($field_mask, 'ElementType') ).change(syncUploadSettings);
+ }
+ );
+
+ syncUploadSettings();
+ </script>
+</inp2:m_if>
+
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Index: core/admin_templates/forms/forms_edit.tpl
===================================================================
--- core/admin_templates/forms/forms_edit.tpl (revision 14184)
+++ core/admin_templates/forms/forms_edit.tpl (working copy)
@@ -62,6 +62,7 @@
<inp2:m_RenderElement name="inp_edit_box" prefix="form" field="Title" title="la_fld_Title" size="100"/>
<inp2:m_RenderElement name="inp_edit_checkbox" prefix="form" field="RequireLogin" title="la_fld_RequireLogin" onclick="reflectSecurutyImage();"/>
<inp2:m_RenderElement name="inp_edit_checkbox" prefix="form" field="UseSecurityImage" title="la_fld_UseSecurityImage"/>
+ <inp2:m_RenderElement name="inp_edit_box" prefix="form" field="SubmitNotifyEmail" title="la_fld_SubmitNotifyEmail" hint_label="la_hint_SubmitNotifyEmail"/>
<inp2:m_RenderElement name="inp_edit_textarea" prefix="form" field="Description" title="la_fld_Description" cols="60" rows="5"/>
<inp2:m_RenderElement name="inp_edit_filler"/>
</table>
Index: core/admin_templates/submissions/submission_view.tpl
===================================================================
--- core/admin_templates/submissions/submission_view.tpl (revision 14184)
+++ core/admin_templates/submissions/submission_view.tpl (working copy)
@@ -109,6 +109,15 @@
<inp2:SubmissionTag tag="PredefinedOptions" field="$field" block="form_radio_item" selected="checked"/>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="form_field_upload">
+ <input type="file" name="<inp2:CustomInputName/>" id="<inp2:CustomInputName/>" <inp2:m_param name="field_params" />/>
+ <inp2:m_ifnot check="SubmissionTag" tag='Field' equals_to="" db="db">
+ (<a href="<inp2:SubmissionTag tag='Field' format='full_url'/>" target="_blank"><inp2:SubmissionTag tag="Field"/></a>)
+ </inp2:m_ifnot>
+
+ <input type="hidden" name="<inp2:CustomInputName/>[upload]" id="<inp2:CustomInputName/>[upload]" value="<inp2:SubmissionTag tag='Field'/>"/>
+</inp2:m_DefineElement>
+
<inp2:formsubs_SaveWarning name="grid_save_warning"/>
<inp2:formsubs_ErrorWarning name="form_error_warning"/>
Index: core/admin_templates/submissions/submissions_list.tpl
===================================================================
--- core/admin_templates/submissions/submissions_list.tpl (revision 14184)
+++ core/admin_templates/submissions/submissions_list.tpl (working copy)
@@ -53,6 +53,12 @@
<a href="mailto:<inp2:Field field="$field" />"><inp2:Field field="$field"/></a>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="grid_upload_td">
+ <inp2:m_if check="Field" name="$field" db="db">
+ <a href="<inp2:Field field='$field' format='full_url'/>" target="_blank"><inp2:Field field="$field"/></a>
+ </inp2:m_if>
+</inp2:m_DefineElement>
+
<inp2:m_RenderElement name="grid" PrefixSpecial="formsubs" IdField="FormSubmissionId" grid="Default"/>
<script type="text/javascript">
Grids['formsubs'].SetDependantToolbarButtons( new Array('edit','delete') );
Index: core/install/install_schema.sql
===================================================================
--- core/install/install_schema.sql (revision 14184)
+++ core/install/install_schema.sql (working copy)
@@ -1073,6 +1073,8 @@
DisplayInGrid tinyint(1) NOT NULL DEFAULT '1',
DefaultValue text,
Validation tinyint(4) NOT NULL DEFAULT '0',
+ UploadExtensions varchar(255) NOT NULL DEFAULT '',
+ UploadMaxSize int(11) DEFAULT NULL,
Visibility tinyint(4) NOT NULL DEFAULT '1',
EmailCommunicationRole tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (FormFieldId),
@@ -1152,6 +1154,7 @@
Description text,
RequireLogin tinyint(4) NOT NULL DEFAULT '0',
UseSecurityImage tinyint(4) NOT NULL DEFAULT '0',
+ SubmitNotifyEmail varchar(255) NOT NULL DEFAULT '',
EnableEmailCommunication tinyint(4) NOT NULL DEFAULT '0',
ProcessUnmatchedEmails tinyint(4) NOT NULL DEFAULT '0',
ReplyFromName varchar(255) NOT NULL DEFAULT '',
Index: core/install/upgrades.sql
===================================================================
--- core/install/upgrades.sql (revision 14184)
+++ core/install/upgrades.sql (working copy)
@@ -1998,4 +1998,12 @@
# ===== v 5.1.2-B1 =====
DROP TABLE EmailSubscribers;
DROP TABLE IgnoreKeywords;
-ALTER TABLE PermissionConfig DROP ErrorMessage;
\ No newline at end of file
+ALTER TABLE PermissionConfig DROP ErrorMessage;
+
+# ===== v 5.1.2-B2 =====
+ALTER TABLE Forms
+ ADD SubmitNotifyEmail VARCHAR(255) NOT NULL DEFAULT '' AFTER UseSecurityImage;
+
+ALTER TABLE FormFields
+ ADD UploadExtensions VARCHAR(255) NOT NULL DEFAULT '' AFTER Validation,
+ ADD UploadMaxSize INT NULL AFTER UploadExtensions;
\ No newline at end of file
Index: core/kernel/db/db_tag_processor.php
===================================================================
--- core/kernel/db/db_tag_processor.php (revision 14184)
+++ core/kernel/db/db_tag_processor.php (working copy)
@@ -1939,6 +1939,7 @@
case 'text':
case 'textarea':
+ case 'upload':
$params['field_params'] = $helper->ParseConfigSQL($object->GetDBField($params['value_list_field']));
break;
Index: core/units/forms/form_fields/form_fields_config.php
===================================================================
--- core/units/forms/form_fields/form_fields_config.php (revision 14184)
+++ core/units/forms/form_fields/form_fields_config.php (working copy)
@@ -67,7 +67,7 @@
'Prompt' => Array('type' => 'string', 'default' => null, 'required' => 1),
'ElementType' => Array(
'type' => 'string',
- 'formatter' => 'kOptionsFormatter', 'options' => Array ('text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_SingleCheckbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'label' => 'la_type_label'), 'use_phrases' => 1,
+ 'formatter' => 'kOptionsFormatter', 'options' => Array ('text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_SingleCheckbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'upload' => 'la_type_upload', 'label' => 'la_type_label'), 'use_phrases' => 1,
'required' => 1, 'not_null' => 1, 'default' => '',
),
'ValueList' => Array('type' => 'string','default' => null),
@@ -77,6 +77,8 @@
'DisplayInGrid' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 1),
'DefaultValue' => Array('type' => 'string', 'default' => NULL),
'Validation' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(0 => 'la_None', 1 => 'la_ValidationEmail'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
+ 'UploadExtensions' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
+ 'UploadMaxSize' => Array ('type' => 'int', 'default' => NULL),
'Visibility' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_opt_Everyone', 2 => 'la_opt_GuestsOnly'), 'use_phrases' => 1,
Index: core/units/forms/form_submissions/form_submissions_eh.php
===================================================================
--- core/units/forms/form_submissions/form_submissions_eh.php (revision 14184)
+++ core/units/forms/form_submissions/form_submissions_eh.php (working copy)
@@ -65,6 +65,7 @@
'password' => 'grid_like_filter',
'textarea' => 'grid_like_filter',
'label' => 'grid_like_filter',
+ 'upload' => 'grid_empty_filter',
);
return $mapping[$element_type];
@@ -116,6 +117,10 @@
'filter_block' => $this->_getFilterBlock($options['ElementType'])
);
+ if ($options['ElementType'] == 'upload') {
+ $conf_grids['Default']['Fields']['fld_' . $field_id]['data_block'] = 'grid_upload_td';
+ }
+
if ($options['Validation'] == 1) {
$conf_grids['Default']['Fields']['fld_' . $field_id]['data_block'] = 'grid_email_td';
}
@@ -138,6 +143,19 @@
$field_options['verify_field'] = 'fld_' . $field_id . '_verify';
}
+ if ($options['ElementType'] == 'upload') {
+ $field_options['formatter'] = 'kUploadFormatter';
+ $field_options['upload_dir'] = WRITEBALE_BASE . DIRECTORY_SEPARATOR . 'user_files' . DIRECTORY_SEPARATOR . 'form_submissions';
+
+ if ( $options['UploadMaxSize'] ) {
+ $field_options['max_size'] = $options['UploadMaxSize'];
+ }
+
+ if ( $options['UploadExtensions'] ) {
+ $field_options['file_types'] = '*.' . implode(';*.', explode(',', $options['UploadExtensions']));
+ }
+ }
+
$conf_fields['fld_' . $field_id] = $field_options;
}
@@ -193,7 +211,25 @@
// allows user to view only it's last submission
$this->Application->StoreVar('last_submission_id', $object->GetID());
- $this->Application->EmailEventAdmin('FORM.SUBMITTED');
+ $form_submission_helper =& $this->Application->recallObject('FormSubmissionHelper');
+ /* @var $form_submission_helper FormSubmissionHelper */
+
+ $form =& $form_submission_helper->getForm($object);
+
+ $notify_email = $form->GetDBField('SubmitNotifyEmail');
+
+ if ($notify_email) {
+ $send_params = Array (
+ 'to_name' => $notify_email,
+ 'to_email' => $notify_email,
+ );
+
+ $this->Application->EmailEventAdmin('FORM.SUBMITTED', null, $send_params);
+ }
+ else {
+ $this->Application->EmailEventAdmin('FORM.SUBMITTED');
+ }
+
// $this->Application->EmailEventUser('FORM.SUBMITTED', null, 'to_email' => '');
$event->SetRedirectParam('opener', 's');
@@ -202,7 +238,7 @@
$theme =& $this->Application->recallObject('theme.current');
/* @var $theme kDBItem */
- $template = $this->Application->GetVar('success_template');
+ $template = unhtmlentities( $this->Application->GetVar('success_template') ); // kHTTPQuery do htmlspecialchars on everything
$alias_template = $theme->GetField('TemplateAliases', $template);
$event->redirect = $alias_template ? $alias_template : $template;
Index: core/units/forms/forms/forms_config.php
===================================================================
--- core/units/forms/forms/forms_config.php (revision 14184)
+++ core/units/forms/forms/forms_config.php (working copy)
@@ -146,6 +146,12 @@
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
+ 'SubmitNotifyEmail' => Array (
+ 'type' => 'string', 'max_len' => 255,
+ 'formatter' => 'kFormatter', 'regexp'=>'/^(' . REGEX_EMAIL_USER . '@' . REGEX_EMAIL_DOMAIN . ')$/i',
+ 'sample_value' => 'email@domain.com', 'error_msgs' => Array ('invalid_format' => '!la_invalid_email!'),
+ 'not_null' => 1, 'default' => ''
+ ),
'EnableEmailCommunication' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
@@ -212,6 +218,7 @@
'RequireLogin' => Array ('title' => 'la_col_RequireLogin', 'filter_block' => 'grid_options_filter', 'width' => 80,),
'UseSecurityImage' => Array ('title' => 'la_col_UseSecurityImage', 'filter_block' => 'grid_options_filter', 'width' => 110,),
'EnableEmailCommunication' => Array ('title' => 'la_col_EnableEmailCommunication', 'filter_block' => 'grid_options_filter', 'width' => 120,),
+ 'SubmitNotifyEmail' => Array ('title' => 'la_col_SubmitNotifyEmail', 'filter_block' => 'grid_like_filter'),
),
),
),
form_submission_improvements2011_themes.patch [^] (3,378 bytes) 2011-01-25 05:13
[Show Content]
Index: advanced/platform/designs/form.tpl
===================================================================
--- advanced/platform/designs/form.tpl (revision 14184)
+++ advanced/platform/designs/form.tpl (working copy)
@@ -51,7 +51,7 @@
<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/grey_pix.gif" width="100%" height="1" align="absmiddle" alt="" /><br /><br />
- <form method="post" action="<inp2:m_FormAction m_cat_id="0" m_cat_page="1"/>">
+ <form method="post" action="<inp2:m_FormAction m_cat_id="0" m_cat_page="1"/>" enctype="multipart/form-data">
<table class="form-data fullwidth">
<inp2:formflds_PrintList render_as="form_field" SourcePrefix="formsubs" per_page="-1"/>
Index: advanced/platform/elements/dynamic_forms.elm.tpl
===================================================================
--- advanced/platform/elements/dynamic_forms.elm.tpl (revision 14184)
+++ advanced/platform/elements/dynamic_forms.elm.tpl (working copy)
@@ -34,6 +34,15 @@
<inp2:SubmissionTag tag="PredefinedOptions" field="$field" block="form_radio_item" selected="checked"/>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="form_field_upload">
+ <input type="file" name="<inp2:CustomInputName/>" id="<inp2:CustomInputName/>" <inp2:m_param name="field_params" />/>
+ <inp2:m_ifnot check="SubmissionTag" tag='Field' equals_to="" db="db">
+ (<a href="<inp2:SubmissionTag tag='Field' format='full_url'/>" target="_blank"><inp2:SubmissionTag tag="Field"/></a>)
+ </inp2:m_ifnot>
+
+ <input type="hidden" name="<inp2:CustomInputName/>[upload]" id="<inp2:CustomInputName/>[upload]" value="<inp2:SubmissionTag tag='Field'/>"/>
+</inp2:m_DefineElement>
+
<inp2:m_DefineElement name="form_field">
<tr>
<td class="field-name">
Index: default/designs/form.tpl
===================================================================
--- default/designs/form.tpl (revision 14184)
+++ default/designs/form.tpl (working copy)
@@ -31,7 +31,7 @@
<div class="bg-contacts-up">
<div class="bg-contacts-down">
- <form method="post" action="<inp2:m_Link m_cat_id="0" m_cat_page="1"/>">
+ <form method="post" action="<inp2:m_Link m_cat_id="0" m_cat_page="1"/>" enctype="multipart/form-data">
<inp2:formsubs_PresetFormFields/>
<inp2:m_if check="formsubs_HasError" field="any">
Index: default/elements/dynamic_forms.elm.tpl
===================================================================
--- default/elements/dynamic_forms.elm.tpl (revision 14184)
+++ default/elements/dynamic_forms.elm.tpl (working copy)
@@ -50,6 +50,17 @@
</em>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="form_field_upload">
+<em>
+ <input type="file" name="<inp2:CustomInputName/>" id="<inp2:CustomInputName/>" <inp2:m_param name="field_params" />/>
+ <inp2:m_ifnot check="SubmissionTag" tag='Field' equals_to="" db="db">
+ (<a href="<inp2:SubmissionTag tag='Field' format='full_url'/>" target="_blank"><inp2:SubmissionTag tag="Field"/></a>)
+ </inp2:m_ifnot>
+
+ <input type="hidden" name="<inp2:CustomInputName/>[upload]" id="<inp2:CustomInputName/>[upload]" value="<inp2:SubmissionTag tag='Field'/>"/>
+</em>
+</inp2:m_DefineElement>
+
<inp2:m_DefineElement name="form_field">
<p>
<label for="<inp2:Field name='FieldName'/>" <inp2:m_if check="SubmissionTag" tag="HasError">class="red"</inp2:m_if>>
form_submission_improvements2011_themes_v2-Dmitry.patch [^] (7,496 bytes) 2011-01-28 12:50
[Show Content]
Index: advanced/_install/english.lang
===================================================================
--- advanced/_install/english.lang (revision 14184)
+++ advanced/_install/english.lang (working copy)
@@ -161,6 +161,7 @@
<PHRASE Label="lu_fld_Duration" Module="Core" Type="0">RHVyYXRpb24=</PHRASE>
<PHRASE Label="lu_fld_Email" Module="Core" Type="0">RS1NYWls</PHRASE>
<PHRASE Label="lu_fld_Fax" Module="Core" Type="0">RmF4</PHRASE>
+ <PHRASE Label="lu_fld_File" Module="Core" Type="0">RmlsZQ==</PHRASE>
<PHRASE Label="lu_fld_File1" Module="Core" Type="0">UHJpbWFyeSBGaWxl</PHRASE>
<PHRASE Label="lu_fld_File2" Module="Core" Type="0">Mm5kIEZpbGU=</PHRASE>
<PHRASE Label="lu_fld_File3" Module="Core" Type="0">M3JkIEZpbGU=</PHRASE>
Index: advanced/platform/designs/form.tpl
===================================================================
--- advanced/platform/designs/form.tpl (revision 14184)
+++ advanced/platform/designs/form.tpl (working copy)
@@ -51,7 +51,7 @@
<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/grey_pix.gif" width="100%" height="1" align="absmiddle" alt="" /><br /><br />
- <form method="post" action="<inp2:m_FormAction m_cat_id="0" m_cat_page="1"/>">
+ <form method="post" action="<inp2:m_FormAction m_cat_id="0" m_cat_page="1"/>" enctype="multipart/form-data">
<table class="form-data fullwidth">
<inp2:formflds_PrintList render_as="form_field" SourcePrefix="formsubs" per_page="-1"/>
Index: advanced/platform/elements/dynamic_forms.elm.tpl
===================================================================
--- advanced/platform/elements/dynamic_forms.elm.tpl (revision 14184)
+++ advanced/platform/elements/dynamic_forms.elm.tpl (working copy)
@@ -34,6 +34,16 @@
<inp2:SubmissionTag tag="PredefinedOptions" field="$field" block="form_radio_item" selected="checked"/>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="form_field_upload">
+ <input type="file" name="<inp2:CustomInputName/>" id="<inp2:CustomInputName/>" <inp2:m_param name="field_params" />/>
+ <!--##
+ <inp2:m_ifnot check="SubmissionTag" tag='Field' equals_to="" db="db">
+ (<a href="<inp2:SubmissionTag tag='Field' format='full_url'/>" target="_blank"><inp2:SubmissionTag tag="Field"/></a>)
+ </inp2:m_ifnot>
+ ##-->
+ <input type="hidden" name="<inp2:CustomInputName/>[upload]" id="<inp2:CustomInputName/>[upload]" value="<inp2:SubmissionTag tag='Field'/>"/>
+</inp2:m_DefineElement>
+
<inp2:m_DefineElement name="form_field">
<tr>
<td class="field-name">
Index: default/_install/english.lang
===================================================================
--- default/_install/english.lang (revision 14184)
+++ default/_install/english.lang (working copy)
@@ -7,6 +7,7 @@
<PHRASE Label="lu_fld_Captcha" Module="Core" Type="0">Q2FwdGNoYSBJbWFnZQ==</PHRASE>
<PHRASE Label="lu_fld_Company" Module="Core" Type="0">Q29tcGFueQ==</PHRASE>
<PHRASE Label="lu_fld_Email" Module="Core" Type="0">RS1tYWls</PHRASE>
+ <PHRASE Label="lu_fld_File" Module="Core" Type="0">RmlsZQ==</PHRASE>
<PHRASE Label="lu_fld_Message" Module="Core" Type="0">TWVzc2FnZQ==</PHRASE>
<PHRASE Label="lu_fld_Name" Module="Core" Type="0">TmFtZQ==</PHRASE>
<PHRASE Label="lu_fld_Phone" Module="Core" Type="0">UGhvbmU=</PHRASE>
Index: default/_install/install_data.sql
===================================================================
--- default/_install/install_data.sql (revision 14184)
+++ default/_install/install_data.sql (working copy)
@@ -22,14 +22,14 @@
INSERT INTO PermCache VALUES(DEFAULT, 202, 1, '11');
INSERT INTO PermCache VALUES(DEFAULT, 203, 1, '11');
-INSERT INTO Forms VALUES(1, 'Contact Us', 'Form for contacts', 0, 1, 0, 0, '', '', '', '', '', '', '110', '', '', '', '', '110', '', '');
+INSERT INTO Forms VALUES(1, 'Contact Us', 'Form for contacts', 0, 1, '', 0, 0, '', '', '', '', '', '', '110', '', '', '', '', '110', '', '');
-INSERT INTO FormFields VALUES(1, 1, 0, 'Name', 'lu_fld_Name', NULL, 'la_fld_Name', 'text', NULL, 5, 0, 1, 1, NULL, 0, 1, 1);
-INSERT INTO FormFields VALUES(2, 1, 0, 'Company', 'lu_fld_Company', NULL, 'la_fld_Company', 'text', NULL, 4, 0, 1, 1, NULL, 0, 1, 0);
-INSERT INTO FormFields VALUES(3, 1, 0, 'Email', 'lu_fld_Email', NULL, 'la_fld_Email', 'text', NULL, 3, 0, 1, 1, NULL, 1, 1, 2);
-INSERT INTO FormFields VALUES(4, 1, 0, 'Phone', 'lu_fld_Phone', NULL, 'la_fld_Phone', 'text', NULL, 2, 0, 0, 1, NULL, 0, 1, 0);
-INSERT INTO FormFields VALUES(5, 1, 0, 'Message', 'lu_fld_Message', NULL, 'la_fld_Message', 'textarea', NULL, 0, 0, 1, 0, NULL, 0, 1, 4);
-INSERT INTO FormFields VALUES(6, 1, 0, 'Subject', 'lu_fld_Subject', NULL, 'la_fld_Subject', 'select', '=+-- Please select --||0=+Sales questions||1=+General questions||2=+Billing questions||3=+Support questions', 1, 0, 1, 0, NULL, 0, 1, 3);
+INSERT INTO FormFields VALUES(1, 1, 0, 'Name', 'lu_fld_Name', NULL, 'la_fld_Name', 'text', NULL, 5, 0, 1, 1, NULL, 0, '', NULL, 1, 1);
+INSERT INTO FormFields VALUES(2, 1, 0, 'Company', 'lu_fld_Company', NULL, 'la_fld_Company', 'text', NULL, 4, 0, 1, 1, NULL, 0, '', NULL, 1, 0);
+INSERT INTO FormFields VALUES(3, 1, 0, 'Email', 'lu_fld_Email', NULL, 'la_fld_Email', 'text', NULL, 3, 0, 1, 1, NULL, 1, '', NULL, 1, 2);
+INSERT INTO FormFields VALUES(4, 1, 0, 'Phone', 'lu_fld_Phone', NULL, 'la_fld_Phone', 'text', NULL, 2, 0, 0, 1, NULL, 0, '', NULL, 1, 0);
+INSERT INTO FormFields VALUES(5, 1, 0, 'Message', 'lu_fld_Message', NULL, 'la_fld_Message', 'textarea', NULL, 0, 0, 1, 0, NULL, 0, '', NULL, 1, 4);
+INSERT INTO FormFields VALUES(6, 1, 0, 'Subject', 'lu_fld_Subject', NULL, 'la_fld_Subject', 'select', '=+-- Please select --||0=+Sales questions||1=+General questions||2=+Billing questions||3=+Support questions', 1, 0, 1, 0, NULL, 0, '', NULL, 1, 3);
ALTER TABLE FormSubmissions
ADD COLUMN fld_1 text,
Index: default/designs/form.tpl
===================================================================
--- default/designs/form.tpl (revision 14184)
+++ default/designs/form.tpl (working copy)
@@ -31,7 +31,7 @@
<div class="bg-contacts-up">
<div class="bg-contacts-down">
- <form method="post" action="<inp2:m_Link m_cat_id="0" m_cat_page="1"/>">
+ <form method="post" action="<inp2:m_Link m_cat_id="0" m_cat_page="1"/>" enctype="multipart/form-data">
<inp2:formsubs_PresetFormFields/>
<inp2:m_if check="formsubs_HasError" field="any">
Index: default/elements/dynamic_forms.elm.tpl
===================================================================
--- default/elements/dynamic_forms.elm.tpl (revision 14184)
+++ default/elements/dynamic_forms.elm.tpl (working copy)
@@ -50,6 +50,18 @@
</em>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="form_field_upload">
+<em>
+ <input type="file" name="<inp2:CustomInputName/>" id="<inp2:CustomInputName/>" <inp2:m_param name="field_params" />/>
+ <!--##
+ <inp2:m_ifnot check="SubmissionTag" tag='Field' equals_to="" db="db">
+ (<a href="<inp2:SubmissionTag tag='Field' format='full_url'/>" target="_blank"><inp2:SubmissionTag tag="Field"/></a>)
+ </inp2:m_ifnot>
+ ##-->
+ <input type="hidden" name="<inp2:CustomInputName/>[upload]" id="<inp2:CustomInputName/>[upload]" value="<inp2:SubmissionTag tag='Field'/>"/>
+</em>
+</inp2:m_DefineElement>
+
<inp2:m_DefineElement name="form_field">
<p>
<label for="<inp2:Field name='FieldName'/>" <inp2:m_if check="SubmissionTag" tag="HasError">class="red"</inp2:m_if>>
form_submission_improvements2011_core_v2-Dmitry.patch [^] (22,098 bytes) 2011-01-28 12:54
[Show Content]
Index: admin_templates/forms/form_field_edit.tpl
===================================================================
--- admin_templates/forms/form_field_edit.tpl (revision 14184)
+++ admin_templates/forms/form_field_edit.tpl (working copy)
@@ -64,11 +64,15 @@
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="FieldName" title="la_prompt_FieldName" size="40"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="FieldLabel" title="la_prompt_FieldLabel" size="40"/>
- <inp2:m_RenderElement name="subsection" prefix="formflds" fields="Prompt,ElementType,Validation,ValueList,DefaultValue,Priority,Required,DisplayInGrid,Visibility,EmailCommunicationRole" title="la_tab_AdminUI"/>
+ <inp2:m_RenderElement name="subsection" prefix="formflds" fields="Prompt,ElementType,Validation,UploadExtensions,UploadMaxSize,ValueList,DefaultValue,Priority,Required,DisplayInGrid,Visibility,EmailCommunicationRole" title="la_tab_AdminUI"/>
<!--<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="Heading" title="la_prompt_heading" size="40"/>-->
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="Prompt" title="la_prompt_FieldPrompt" size="40"/>
<inp2:m_RenderElement name="inp_edit_options" prefix="formflds" field="ElementType" title="la_prompt_InputType" has_empty="1"/>
<inp2:m_RenderElement name="inp_edit_options" prefix="formflds" field="Validation" title="la_prompt_validation"/>
+
+ <inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="UploadExtensions" title="la_fld_UploadExtensions" hint_label="la_hint_UploadExtensions" style="width: 200px;"/>
+ <inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="UploadMaxSize" title="la_fld_UploadMaxSize" hint_label="la_hint_UploadMaxSize" style="width: 200px;"/>
+
<inp2:m_RenderElement name="inp_edit_textarea" prefix="formflds" field="ValueList" title="la_prompt_ValueList" allow_html="0" cols="40" rows="5"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="DefaultValue" title="la_prompt_DefaultValue" size="40"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="Priority" title="la_field_Priority" size="10"/>
@@ -88,4 +92,29 @@
</table>
</div>
+<inp2:m_if check="formflds_FieldsVisible" fields="UploadExtensions,UploadMaxSize">
+ <script type="text/javascript">
+ var $field_mask = '<inp2:formflds_InputName field="#FIELD_NAME#" js_escape="1"/>';
+
+ function syncUploadSettings() {
+ if ( $( get_control($field_mask, 'ElementType') ).val() == 'upload' ) {
+ $( get_control($field_mask, 'UploadExtensions', 'row') ).show();
+ $( get_control($field_mask, 'UploadMaxSize', 'row') ).show();
+ }
+ else {
+ $( get_control($field_mask, 'UploadExtensions', 'row') ).hide();
+ $( get_control($field_mask, 'UploadMaxSize', 'row') ).hide();
+ }
+ }
+
+ $(document).ready(
+ function () {
+ $( get_control($field_mask, 'ElementType') ).change(syncUploadSettings);
+ }
+ );
+
+ syncUploadSettings();
+ </script>
+</inp2:m_if>
+
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Index: admin_templates/forms/forms_edit.tpl
===================================================================
--- admin_templates/forms/forms_edit.tpl (revision 14184)
+++ admin_templates/forms/forms_edit.tpl (working copy)
@@ -62,6 +62,7 @@
<inp2:m_RenderElement name="inp_edit_box" prefix="form" field="Title" title="la_fld_Title" size="100"/>
<inp2:m_RenderElement name="inp_edit_checkbox" prefix="form" field="RequireLogin" title="la_fld_RequireLogin" onclick="reflectSecurutyImage();"/>
<inp2:m_RenderElement name="inp_edit_checkbox" prefix="form" field="UseSecurityImage" title="la_fld_UseSecurityImage"/>
+ <inp2:m_RenderElement name="inp_edit_box" prefix="form" field="SubmitNotifyEmail" title="la_fld_SubmitNotifyEmail" hint_label="la_hint_SubmitNotifyEmail"/>
<inp2:m_RenderElement name="inp_edit_textarea" prefix="form" field="Description" title="la_fld_Description" cols="60" rows="5"/>
<inp2:m_RenderElement name="inp_edit_filler"/>
</table>
Index: admin_templates/submissions/submission_view.tpl
===================================================================
--- admin_templates/submissions/submission_view.tpl (revision 14184)
+++ admin_templates/submissions/submission_view.tpl (working copy)
@@ -109,6 +109,15 @@
<inp2:SubmissionTag tag="PredefinedOptions" field="$field" block="form_radio_item" selected="checked"/>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="form_field_upload">
+ <input type="file" name="<inp2:CustomInputName/>" id="<inp2:CustomInputName/>" <inp2:m_param name="field_params" />/>
+ <inp2:m_ifnot check="SubmissionTag" tag='Field' equals_to="" db="db">
+ (<a href="<inp2:SubmissionTag tag='Field' format='full_url'/>" target="_blank"><inp2:SubmissionTag tag="Field"/></a>)
+ </inp2:m_ifnot>
+
+ <input type="hidden" name="<inp2:CustomInputName/>[upload]" id="<inp2:CustomInputName/>[upload]" value="<inp2:SubmissionTag tag='Field'/>"/>
+</inp2:m_DefineElement>
+
<inp2:formsubs_SaveWarning name="grid_save_warning"/>
<inp2:formsubs_ErrorWarning name="form_error_warning"/>
Index: admin_templates/submissions/submissions_list.tpl
===================================================================
--- admin_templates/submissions/submissions_list.tpl (revision 14184)
+++ admin_templates/submissions/submissions_list.tpl (working copy)
@@ -53,6 +53,12 @@
<a href="mailto:<inp2:Field field="$field" />"><inp2:Field field="$field"/></a>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="grid_upload_td">
+ <inp2:m_if check="Field" name="$field" db="db">
+ <a href="<inp2:Field field='$field' format='full_url'/>" target="_blank"><inp2:Field field="$field"/></a>
+ </inp2:m_if>
+</inp2:m_DefineElement>
+
<inp2:m_RenderElement name="grid" PrefixSpecial="formsubs" IdField="FormSubmissionId" grid="Default"/>
<script type="text/javascript">
Grids['formsubs'].SetDependantToolbarButtons( new Array('edit','delete') );
Index: install/english.lang
===================================================================
--- install/english.lang (revision 14184)
+++ install/english.lang (working copy)
@@ -115,6 +115,7 @@
<PHRASE Label="la_col_InheritedFrom" Module="Core" Type="1">SW5oZXJpdGVkIEZyb20=</PHRASE>
<PHRASE Label="la_col_InMenu" Module="Core" Type="1">SW4gTWVudQ==</PHRASE>
<PHRASE Label="la_col_IP" Module="Core" Type="1">SVAgQWRkcmVzcw==</PHRASE>
+ <PHRASE Label="la_col_IPAddress" Module="Core" Type="1">SVAgQWRkcmVzcw==</PHRASE>
<PHRASE Label="la_col_IsPopular" Module="Core" Type="1">UG9wdWxhcg==</PHRASE>
<PHRASE Label="la_col_IsPrimary" Module="Core" Type="1">UHJpbWFyeQ==</PHRASE>
<PHRASE Label="la_col_IsPrimaryLanguage" Module="Core" Type="1">VXNlciBQcmltYXJ5</PHRASE>
@@ -620,6 +621,7 @@
<PHRASE Label="la_fld_ReplyMessageSignature" Module="Core" Type="1">UmVwbHkgTWVzc2FnZSBTaWduYXR1cmU=</PHRASE>
<PHRASE Label="la_fld_ReplyStatus" Module="Core" Type="1">UmVwbGllZA==</PHRASE>
<PHRASE Label="la_fld_Required" Module="Core" Type="1">UmVxdWlyZWQ=</PHRASE>
+ <PHRASE Label="la_fld_RequireLogin" Module="Core" Type="1">UmVxdWlyZSBMb2dpbg==</PHRASE>
<PHRASE Label="la_fld_ReviewText" Module="Core" Type="1">Q29tbWVudA==</PHRASE>
<PHRASE Label="la_fld_RuleType" Module="Core" Type="1">UnVsZSBUeXBl</PHRASE>
<PHRASE Label="la_fld_RunInterval" Module="Core" Type="1">UnVuIEludGVydmFs</PHRASE>
@@ -650,6 +652,7 @@
<PHRASE Label="la_fld_StylesheetId" Module="Core" Type="1">U3R5bGVzaGVldCBJRA==</PHRASE>
<PHRASE Label="la_fld_Subject" Module="Core" Type="1">U3ViamVjdA==</PHRASE>
<PHRASE Label="la_fld_SubmissionTime" Module="Core" Type="1">U3VibWl0dGVkIE9u</PHRASE>
+ <PHRASE Label="la_fld_SubmitNotifyEmail" Module="Core" Type="1">U3VibWlzc2lvbiBOb3RpZmljYXRpb24gRW1haWw=</PHRASE>
<PHRASE Label="la_fld_SuggestedCorrection" Module="Core" Type="1">U3VnZ2VzdGVkIENvcnJlY3Rpb24=</PHRASE>
<PHRASE Label="la_fld_SymLinkCategoryId" Module="Core" Type="1">UG9pbnRzIHRvIFNlY3Rpb24=</PHRASE>
<PHRASE Label="la_fld_TableName" Module="Core" Type="1">VGFibGUgTmFtZSBpbiBEYXRhYmFzZSA=</PHRASE>
@@ -675,6 +678,8 @@
<PHRASE Label="la_fld_Type" Module="Core" Type="1">VHlwZQ==</PHRASE>
<PHRASE Label="la_fld_UnitSystem" Module="Core" Type="1">TWVhc3VyZXMgU3lzdGVt</PHRASE>
<PHRASE Label="la_fld_Upload" Module="Core" Type="1">VXBsb2FkIEZpbGUgRnJvbSBMb2NhbCBQQw==</PHRASE>
+ <PHRASE Label="la_fld_UploadExtensions" Module="Core" Type="1">QWxsb3dlZCBGaWxlIEV4dGVuc2lvbnM=</PHRASE>
+ <PHRASE Label="la_fld_UploadMaxSize" Module="Core" Type="1">TWF4aW11bSBGaWxlIFNpemU=</PHRASE>
<PHRASE Label="la_fld_URL" Module="Core" Type="1">VVJM</PHRASE>
<PHRASE Label="la_fld_UseExternalUrl" Module="Core" Type="1">TGluayB0byBFeHRlcm5hbCBVUkw=</PHRASE>
<PHRASE Label="la_fld_UseMenuIcon" Module="Core" Type="1">VXNlIEN1c3RvbSBNZW51IEljb24=</PHRASE>
@@ -708,6 +713,7 @@
<PHRASE Label="la_hint_PopPort" Module="Core" Type="1">UE9QMyBTZXJ2ZXIgUG9ydC4gRm9yIGV4LiAiMTEwIiBmb3IgcmVndWxhciBjb25uZWN0aW9uLCAiOTk1IiBmb3Igc2VjdXJlIGNvbm5lY3Rpb24u</PHRASE>
<PHRASE Label="la_hint_PopServer" Module="Core" Type="1">UE9QMyBTZXJ2ZXIgQWRkcmVzcy4gRm9yIGV4LiB1c2UgInNzbDovL3BvcC5nbWFpbC5jb20iIGZvciBHbWFpbCwgInBvcC5tYWlsLnlhaG9vLmNvbSIgZm9yIFlhaG9vLg==</PHRASE>
<PHRASE Label="la_hint_SSLUrl" Module="Core" Type="1">aHR0cHM6Ly93d3cuZG9tYWluLmNvbS9wYXRo</PHRASE>
+ <PHRASE Label="la_hint_SubmitNotifyEmail" Module="Core" Type="1">RW1haWwgYWRkcmVzcyB3aGVyZSBub3RpZmljYXRpb24gYWJvdXQgbmV3IHN1Ym1pc3Npb25zIHdpbGwgYmUgc2VuZCB0by4gRGVmYXVsdCBlbWFpbCBhZGRyZXNzIHdpbGwgYmUgdXNlZCBpZiB0aGlzIGZpZWxkIGlzIGxlZnQgYmxhbmsu</PHRASE>
<PHRASE Label="la_hint_SystemToolsCacheKeys" Module="Core" Type="1">Q2FjaGUgS2V5KHMp</PHRASE>
<PHRASE Label="la_hint_SystemToolsClearTemplatesCache" Module="Core" Type="1">PHVsPg0KICA8bGk+RGVsZXRlcyBhbGwgY29tcGlsZWQgdGVtcGxhdGVzIGZyb20gQWRtaW4gQ29uc29sZSBhbmQgRnJvbnQtZW5kIHRoZW1lcy48L2xpPg0KICA8bGk+UmVjb21tZW5kZWQgZm9yIHRoZSBtYWludGVuYW5jZSBwdXJwb3Nlcywgc2luY2UgZG9lcyBub3QgcHJvdmlkZSBhbnkgYWR2YW50YWdlcyBleGNlcHQgZm9yIHRlbXBvcmFyeSBsb3dlcmluZyB1c2FnZSBvZiB0aGUgZGlzayBzcGFjZS4gQWxsIHRlbXBsYXRlcyB3aWxsIGJlIGF1dG9tYXRpY2FsbHkgcmVjb21waWxlZCBhdCB0aGUgdGltZSBvZiB2aXNpdC48L2xpPg0KPC91bD4=</PHRASE>
<PHRASE Label="la_hint_SystemToolsDatabaseCache" Module="Core" Type="1">ZGF0YWJhc2UgY2FjaGU=</PHRASE>
@@ -725,6 +731,8 @@
<PHRASE Label="la_hint_SystemToolsResetParsedCachedData" Module="Core" Type="1">PHVsPg0KICA8bGk+UmVzZXRzIHZhcmlvdXMgY2FjaGVkIHN5c3RlbSBkYXRhIHN1Y2ggYXMgZGVmaW5lZCBQSFAgQ2xhc3NlcyAobWFwcGluZyBiZXR3ZWVuIHRoZSBjbGFzcyBuYW1lIGFuZCBwaHlzaWNhbCBmaWxlbmFtZSBhbmQgbG9jYXRpb24gb2YgdGhlIGNsYXNzKSwgSG9va3MsIEFnZW50cywgQ2FjaGVkIENvbmZpZ3VyYXRpb24gVmFyaWFibGVzLCBSZXBsYWNlbWVudCBUZW1wbGF0ZXMsIFJld3JpdGUgTGlzdGVuZXJzIGFuZCBMb2FkZWQgTW9kdWxlcy4gRGF0YSBpcyByZWFkIGFuZCBjb2xsZWN0ZWQgZnJvbSA8c3Ryb25nPjxpPlVuaXQgQ29uZmlnPC9pPjwvc3Ryb25nPiBmaWxlcyB0aGF0IGFscmVhZHkgYmVlbiBzY2FubmVkIGFuZCBjYWNoZWQgYnkgdGhlIHN5c3RlbS48L2xpPg0KPC91bD4=</PHRASE>
<PHRASE Label="la_hint_SystemToolsResetSMSMenuCache" Module="Core" Type="1">PHVsPg0KICA8bGk+RGVsZXRlcyB0aGUgY2FjaGVkIHZlcnNpb24gb2YgRnJvbnQtZW5kIG1lbnUgKGRpc3BsYXllZCB2aWEgPHN0cm9uZz48aT4mbHQ7aW5wMjpzdF9DYWNoZWRNZW51IC4uLi8mZ3Q7PC9pPjwvc3Ryb25nPiB0YWcpLiBUaGlzIGNhY2hlIGlzIHVwZGF0ZWQgYXV0b21hdGljYWxseSwgd2hlbiB0aGUgd2Vic2l0ZSBzdHJ1Y3R1cmUgb3Igc2VjdGlvbnMgYXJlIGNoYW5nZWQuPC9saT4NCiAgPGxpPlVzZSB0aGlzIG9wdGlvbiBvbmx5IGluIGNhc2UgaWYgZGlzcGxheWVkIG1lbnUgb24gdGhlIEZyb250LWVuZCBkb2Vzbid0IG1hdGNoIHRoZSBtZW51IGRlZmluZWQgaW4gQWRtaW4gQ29uc29sZS48L2xpPg0KPC91bD4=</PHRASE>
<PHRASE Label="la_hint_SystemToolsShowDatabaseTableStructure" Module="Core" Type="1">PHVsPg0KICA8bGk+U2hvd3MgdGhlIHN0cnVjdHVyZSBvZiB0aGUgZGF0YWJhc2UgdGFibGUgbG9hZGluZyBpdCBieSB0aGUgVGFibGUgTmFtZSAodGFibGUgcHJlZml4IGlzIG9wdGlvbmFsKSBvciA8c3Ryb25nPjxpPlVuaXQgQ29uZmlnIFByZWZpeDwvaT48L3N0cm9uZz4gYXNzb2NpYXRlZCB3aXRoIHRoaXMgdGFibGUuPC9saT4NCjwvdWw+</PHRASE>
+ <PHRASE Label="la_hint_UploadExtensions" Module="Core" Type="1">TGlzdCBvZiBGaWxlIEV4dGVuc2lvbnMgYWxsb3dlZCBmb3IgdXBsb2FkIHNlcGFyYXRlZCBieSBjb21tYS4gRXhhbXBsZToganBnLHBuZyxnaWcscGRm</PHRASE>
+ <PHRASE Label="la_hint_UploadMaxSize" Module="Core" Type="1">TWF4aW11bSBmaWxlIHNpemUgKGluIEtieXRlcykgYWxsb3dlZCBmb3IgdGhlIHVwbG9hZC4gRXhhbXBsZTogMSBNQnl0ZSA9IDEwMjQgS0J5dGVzLCAxMCBNQnl0ZXMgPSAxMDI0MCBLQnl0ZXMu</PHRASE>
<PHRASE Label="la_hint_UsingRegularExpression" Module="Core" Type="1">VXNpbmcgUmVndWxhciBFeHByZXNzaW9u</PHRASE>
<PHRASE Label="la_Hot" Module="Core" Type="1">SG90</PHRASE>
<PHRASE Label="la_Html" Module="Core" Type="1">SFRNTA==</PHRASE>
@@ -1524,6 +1532,7 @@
<PHRASE Label="la_type_SingleCheckbox" Module="Core" Type="1">Q2hlY2tib3g=</PHRASE>
<PHRASE Label="la_type_text" Module="Core" Type="1">VGV4dCBmaWVsZA==</PHRASE>
<PHRASE Label="la_type_textarea" Module="Core" Type="1">VGV4dCBhcmVh</PHRASE>
+ <PHRASE Label="la_type_Upload" Module="Core" Type="1">RmlsZSBVcGxvYWQ=</PHRASE>
<PHRASE Label="la_Unchanged" Module="Core" Type="1">VW5jaGFuZ2Vk</PHRASE>
<PHRASE Label="la_Unicode" Module="Core" Type="1">VW5pY29kZQ==</PHRASE>
<PHRASE Label="la_updating_config" Module="Core" Type="1">VXBkYXRpbmcgQ29uZmlndXJhdGlvbg==</PHRASE>
Index: install/install_schema.sql
===================================================================
--- install/install_schema.sql (revision 14184)
+++ install/install_schema.sql (working copy)
@@ -1073,6 +1073,8 @@
DisplayInGrid tinyint(1) NOT NULL DEFAULT '1',
DefaultValue text,
Validation tinyint(4) NOT NULL DEFAULT '0',
+ UploadExtensions varchar(255) NOT NULL DEFAULT '',
+ UploadMaxSize int(11) DEFAULT NULL,
Visibility tinyint(4) NOT NULL DEFAULT '1',
EmailCommunicationRole tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (FormFieldId),
@@ -1152,6 +1154,7 @@
Description text,
RequireLogin tinyint(4) NOT NULL DEFAULT '0',
UseSecurityImage tinyint(4) NOT NULL DEFAULT '0',
+ SubmitNotifyEmail varchar(255) NOT NULL DEFAULT '',
EnableEmailCommunication tinyint(4) NOT NULL DEFAULT '0',
ProcessUnmatchedEmails tinyint(4) NOT NULL DEFAULT '0',
ReplyFromName varchar(255) NOT NULL DEFAULT '',
Index: install/upgrades.sql
===================================================================
--- install/upgrades.sql (revision 14184)
+++ install/upgrades.sql (working copy)
@@ -1998,4 +1998,12 @@
# ===== v 5.1.2-B1 =====
DROP TABLE EmailSubscribers;
DROP TABLE IgnoreKeywords;
-ALTER TABLE PermissionConfig DROP ErrorMessage;
\ No newline at end of file
+ALTER TABLE PermissionConfig DROP ErrorMessage;
+
+# ===== v 5.1.2-B2 =====
+ALTER TABLE Forms
+ ADD SubmitNotifyEmail VARCHAR(255) NOT NULL DEFAULT '' AFTER UseSecurityImage;
+
+ALTER TABLE FormFields
+ ADD UploadExtensions VARCHAR(255) NOT NULL DEFAULT '' AFTER Validation,
+ ADD UploadMaxSize INT NULL AFTER UploadExtensions;
\ No newline at end of file
Index: kernel/db/db_tag_processor.php
===================================================================
--- kernel/db/db_tag_processor.php (revision 14184)
+++ kernel/db/db_tag_processor.php (working copy)
@@ -1939,6 +1939,7 @@
case 'text':
case 'textarea':
+ case 'upload':
$params['field_params'] = $helper->ParseConfigSQL($object->GetDBField($params['value_list_field']));
break;
Index: units/forms/form_fields/form_fields_config.php
===================================================================
--- units/forms/form_fields/form_fields_config.php (revision 14184)
+++ units/forms/form_fields/form_fields_config.php (working copy)
@@ -67,7 +67,7 @@
'Prompt' => Array('type' => 'string', 'default' => null, 'required' => 1),
'ElementType' => Array(
'type' => 'string',
- 'formatter' => 'kOptionsFormatter', 'options' => Array ('text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_SingleCheckbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'label' => 'la_type_label'), 'use_phrases' => 1,
+ 'formatter' => 'kOptionsFormatter', 'options' => Array ('text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_SingleCheckbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'upload' => 'la_type_upload', 'label' => 'la_type_label'), 'use_phrases' => 1,
'required' => 1, 'not_null' => 1, 'default' => '',
),
'ValueList' => Array('type' => 'string','default' => null),
@@ -77,6 +77,8 @@
'DisplayInGrid' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 1),
'DefaultValue' => Array('type' => 'string', 'default' => NULL),
'Validation' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(0 => 'la_None', 1 => 'la_ValidationEmail'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
+ 'UploadExtensions' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
+ 'UploadMaxSize' => Array ('type' => 'int', 'default' => NULL),
'Visibility' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_opt_Everyone', 2 => 'la_opt_GuestsOnly'), 'use_phrases' => 1,
Index: units/forms/form_submissions/form_submissions_eh.php
===================================================================
--- units/forms/form_submissions/form_submissions_eh.php (revision 14184)
+++ units/forms/form_submissions/form_submissions_eh.php (working copy)
@@ -65,6 +65,7 @@
'password' => 'grid_like_filter',
'textarea' => 'grid_like_filter',
'label' => 'grid_like_filter',
+ 'upload' => 'grid_empty_filter',
);
return $mapping[$element_type];
@@ -116,6 +117,10 @@
'filter_block' => $this->_getFilterBlock($options['ElementType'])
);
+ if ($options['ElementType'] == 'upload') {
+ $conf_grids['Default']['Fields']['fld_' . $field_id]['data_block'] = 'grid_upload_td';
+ }
+
if ($options['Validation'] == 1) {
$conf_grids['Default']['Fields']['fld_' . $field_id]['data_block'] = 'grid_email_td';
}
@@ -138,6 +143,19 @@
$field_options['verify_field'] = 'fld_' . $field_id . '_verify';
}
+ if ($options['ElementType'] == 'upload') {
+ $field_options['formatter'] = 'kUploadFormatter';
+ $field_options['upload_dir'] = WRITEBALE_BASE . DIRECTORY_SEPARATOR . 'user_files' . DIRECTORY_SEPARATOR . 'form_submissions';
+
+ if ( $options['UploadMaxSize'] ) {
+ $field_options['max_size'] = $options['UploadMaxSize'] * 1024; // convert Kbytes to bytes
+ }
+
+ if ( $options['UploadExtensions'] ) {
+ $field_options['file_types'] = '*.' . implode(';*.', explode(',', $options['UploadExtensions']));
+ }
+ }
+
$conf_fields['fld_' . $field_id] = $field_options;
}
@@ -193,7 +211,25 @@
// allows user to view only it's last submission
$this->Application->StoreVar('last_submission_id', $object->GetID());
- $this->Application->EmailEventAdmin('FORM.SUBMITTED');
+ $form_submission_helper =& $this->Application->recallObject('FormSubmissionHelper');
+ /* @var $form_submission_helper FormSubmissionHelper */
+
+ $form =& $form_submission_helper->getForm($object);
+
+ $notify_email = $form->GetDBField('SubmitNotifyEmail');
+
+ if ($notify_email) {
+ $send_params = Array (
+ 'to_name' => $notify_email,
+ 'to_email' => $notify_email,
+ );
+
+ $this->Application->EmailEventAdmin('FORM.SUBMITTED', null, $send_params);
+ }
+ else {
+ $this->Application->EmailEventAdmin('FORM.SUBMITTED');
+ }
+
// $this->Application->EmailEventUser('FORM.SUBMITTED', null, 'to_email' => '');
$event->SetRedirectParam('opener', 's');
@@ -202,7 +238,7 @@
$theme =& $this->Application->recallObject('theme.current');
/* @var $theme kDBItem */
- $template = $this->Application->GetVar('success_template');
+ $template = unhtmlentities( $this->Application->GetVar('success_template') ); // kHTTPQuery do htmlspecialchars on everything
$alias_template = $theme->GetField('TemplateAliases', $template);
$event->redirect = $alias_template ? $alias_template : $template;
Index: units/forms/forms/forms_config.php
===================================================================
--- units/forms/forms/forms_config.php (revision 14184)
+++ units/forms/forms/forms_config.php (working copy)
@@ -146,6 +146,12 @@
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
+ 'SubmitNotifyEmail' => Array (
+ 'type' => 'string', 'max_len' => 255,
+ 'formatter' => 'kFormatter', 'regexp'=>'/^(' . REGEX_EMAIL_USER . '@' . REGEX_EMAIL_DOMAIN . ')$/i',
+ 'sample_value' => 'email@domain.com', 'error_msgs' => Array ('invalid_format' => '!la_invalid_email!'),
+ 'not_null' => 1, 'default' => ''
+ ),
'EnableEmailCommunication' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
@@ -212,6 +218,7 @@
'RequireLogin' => Array ('title' => 'la_col_RequireLogin', 'filter_block' => 'grid_options_filter', 'width' => 80,),
'UseSecurityImage' => Array ('title' => 'la_col_UseSecurityImage', 'filter_block' => 'grid_options_filter', 'width' => 110,),
'EnableEmailCommunication' => Array ('title' => 'la_col_EnableEmailCommunication', 'filter_block' => 'grid_options_filter', 'width' => 120,),
+ 'SubmitNotifyEmail' => Array ('title' => 'la_col_SubmitNotifyEmail', 'filter_block' => 'grid_like_filter'),
),
),
),
form_submission_improvements2011_core_v3_520.patch [^] (25,089 bytes) 2011-10-03 11:02
[Show Content]
Index: admin_templates/forms/form_field_edit.tpl
===================================================================
--- admin_templates/forms/form_field_edit.tpl (revision 14590)
+++ admin_templates/forms/form_field_edit.tpl (working copy)
@@ -20,19 +20,19 @@
) );
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
-
+
a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
go_to_id('formflds', '<inp2:formflds_PrevId/>');
}
));
-
+
a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
go_to_id('formflds', '<inp2:formflds_NextId/>');
}
));
a_toolbar.Render();
-
+
<inp2:m_if check="formflds_IsSingle">
a_toolbar.HideButton('prev');
a_toolbar.HideButton('next');
@@ -64,28 +64,57 @@
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="FieldName" title="la_prompt_FieldName" size="40"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="FieldLabel" title="la_prompt_FieldLabel" size="40"/>
- <inp2:m_RenderElement name="subsection" prefix="formflds" fields="Prompt,ElementType,Validation,ValueList,DefaultValue,Priority,Required,DisplayInGrid,Visibility,EmailCommunicationRole" title="la_tab_AdminUI"/>
+ <inp2:m_RenderElement name="subsection" prefix="formflds" fields="Prompt,ElementType,Validation,UploadExtensions,UploadMaxSize,ValueList,DefaultValue,Priority,Required,DisplayInGrid,Visibility,EmailCommunicationRole" title="la_tab_AdminUI"/>
<!--<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="Heading" title="la_prompt_heading" size="40"/>-->
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="Prompt" title="la_prompt_FieldPrompt" size="40"/>
<inp2:m_RenderElement name="inp_edit_options" prefix="formflds" field="ElementType" title="la_prompt_InputType" has_empty="1"/>
<inp2:m_RenderElement name="inp_edit_options" prefix="formflds" field="Validation" title="la_prompt_validation"/>
+
+ <inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="UploadExtensions" style="width: 200px;"/>
+ <inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="UploadMaxSize" style="width: 200px;"/>
+
<inp2:m_RenderElement name="inp_edit_textarea" prefix="formflds" field="ValueList" title="la_prompt_ValueList" allow_html="0" cols="40" rows="5"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="DefaultValue" title="la_prompt_DefaultValue" size="40"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="Priority" title="la_field_Priority" size="10"/>
- <inp2:m_RenderElement name="inp_edit_checkbox" prefix="formflds" field="Required" title="la_fld_Required"/>
- <inp2:m_RenderElement name="inp_edit_checkbox" prefix="formflds" field="DisplayInGrid" title="la_fld_DisplayInGrid"/>
- <inp2:m_RenderElement name="inp_edit_radio" prefix="formflds" field="Visibility" title="la_fld_Visibility"/>
+ <inp2:m_RenderElement name="inp_edit_checkbox" prefix="formflds" field="Required"/>
+ <inp2:m_RenderElement name="inp_edit_checkbox" prefix="formflds" field="DisplayInGrid"/>
+ <inp2:m_RenderElement name="inp_edit_radio" prefix="formflds" field="Visibility"/>
<inp2:m_if check="form_Field" name="EnableEmailCommunication" db="db">
- <inp2:m_RenderElement name="inp_edit_options" prefix="formflds" field="EmailCommunicationRole" title="la_fld_EmailCommunicationRole" has_empty="1"/>
+ <inp2:m_RenderElement name="inp_edit_options" prefix="formflds" field="EmailCommunicationRole" has_empty="1"/>
</inp2:m_if>
<inp2:m_if check="m_IsDebugMode">
- <inp2:m_RenderElement name="inp_edit_checkbox" prefix="formflds" field="IsSystem" title="la_fld_IsSystem"/>
+ <inp2:m_RenderElement name="inp_edit_checkbox" prefix="formflds" field="IsSystem"/>
</inp2:m_if>
<inp2:m_RenderElement name="inp_edit_filler"/>
</table>
</div>
+<inp2:m_if check="formflds_FieldsVisible" fields="UploadExtensions,UploadMaxSize">
+ <script type="text/javascript">
+ var $field_mask = '<inp2:formflds_InputName field="#FIELD_NAME#" js_escape="1"/>';
+
+ function syncUploadSettings() {
+ if ( $( get_control($field_mask, 'ElementType') ).val() == 'upload' ) {
+ $( get_control($field_mask, 'UploadExtensions', 'row') ).show();
+ $( get_control($field_mask, 'UploadMaxSize', 'row') ).show();
+ }
+ else {
+ $( get_control($field_mask, 'UploadExtensions', 'row') ).hide();
+ $( get_control($field_mask, 'UploadMaxSize', 'row') ).hide();
+ }
+ }
+
+ $(document).ready(
+ function () {
+ $( get_control($field_mask, 'ElementType') ).change(syncUploadSettings);
+ }
+ );
+
+ syncUploadSettings();
+ </script>
+</inp2:m_if>
+
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Index: admin_templates/forms/forms_edit.tpl
===================================================================
--- admin_templates/forms/forms_edit.tpl (revision 14590)
+++ admin_templates/forms/forms_edit.tpl (working copy)
@@ -59,10 +59,11 @@
<div id="scroll_container">
<table class="edit-form">
<inp2:m_RenderElement name="inp_id_label" prefix="form" field="FormId" title="la_fld_Id"/>
- <inp2:m_RenderElement name="inp_edit_box" prefix="form" field="Title" title="la_fld_Title" size="100"/>
- <inp2:m_RenderElement name="inp_edit_checkbox" prefix="form" field="RequireLogin" title="la_fld_RequireLogin" onclick="reflectSecurutyImage();"/>
- <inp2:m_RenderElement name="inp_edit_checkbox" prefix="form" field="UseSecurityImage" title="la_fld_UseSecurityImage"/>
- <inp2:m_RenderElement name="inp_edit_textarea" prefix="form" field="Description" title="la_fld_Description" cols="60" rows="5"/>
+ <inp2:m_RenderElement name="inp_edit_box" prefix="form" field="Title" size="100"/>
+ <inp2:m_RenderElement name="inp_edit_checkbox" prefix="form" field="RequireLogin" onclick="reflectSecurutyImage();"/>
+ <inp2:m_RenderElement name="inp_edit_checkbox" prefix="form" field="UseSecurityImage"/>
+ <inp2:m_RenderElement name="inp_edit_box" prefix="form" field="SubmitNotifyEmail"/>
+ <inp2:m_RenderElement name="inp_edit_textarea" prefix="form" field="Description" cols="60" rows="5"/>
<inp2:m_RenderElement name="inp_edit_filler"/>
</table>
</div>
Index: admin_templates/submissions/submission_view.tpl
===================================================================
--- admin_templates/submissions/submission_view.tpl (revision 14590)
+++ admin_templates/submissions/submission_view.tpl (working copy)
@@ -109,6 +109,15 @@
<inp2:SubmissionTag tag="PredefinedOptions" field="$field" block="form_radio_item" selected="checked"/>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="form_field_upload">
+ <input type="file" name="<inp2:CustomInputName/>" id="<inp2:CustomInputName/>" <inp2:m_param name="field_params" />/>
+ <inp2:m_ifnot check="SubmissionTag" tag='Field' equals_to="" db="db">
+ (<a href="<inp2:SubmissionTag tag='Field' format='full_url'/>" target="_blank"><inp2:SubmissionTag tag="Field"/></a>)
+ </inp2:m_ifnot>
+
+ <input type="hidden" name="<inp2:CustomInputName/>[upload]" id="<inp2:CustomInputName/>[upload]" value="<inp2:SubmissionTag tag='Field'/>"/>
+</inp2:m_DefineElement>
+
<inp2:formsubs_SaveWarning name="grid_save_warning"/>
<inp2:formsubs_ErrorWarning name="form_error_warning"/>
Index: admin_templates/submissions/submissions_list.tpl
===================================================================
--- admin_templates/submissions/submissions_list.tpl (revision 14590)
+++ admin_templates/submissions/submissions_list.tpl (working copy)
@@ -53,6 +53,12 @@
<a href="mailto:<inp2:Field field="$field" />"><inp2:Field field="$field"/></a>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="grid_upload_td">
+ <inp2:m_if check="Field" name="$field" db="db">
+ <a href="<inp2:Field field='$field' format='full_url'/>" target="_blank"><inp2:Field field="$field"/></a>
+ </inp2:m_if>
+</inp2:m_DefineElement>
+
<inp2:m_RenderElement name="grid" PrefixSpecial="formsubs" IdField="FormSubmissionId" grid="Default"/>
<script type="text/javascript">
Grids['formsubs'].SetDependantToolbarButtons( new Array('edit','delete') );
Index: install/english.lang
===================================================================
--- install/english.lang (revision 14606)
+++ install/english.lang (working copy)
@@ -563,6 +563,7 @@
<PHRASE Label="la_fld_StopWord" Module="Core" Type="1" Column="U3RvcCBXb3Jk">U3RvcCBXb3Jk</PHRASE>
<PHRASE Label="la_fld_Subject" Module="Core" Type="1" Column="U3ViamVjdA==">U3ViamVjdA==</PHRASE>
<PHRASE Label="la_fld_SubmissionTime" Module="Core" Type="1">U3VibWl0dGVkIE9u</PHRASE>
+ <PHRASE Label="la_fld_SubmitNotifyEmail" Module="Core" Type="1" Hint="RW1haWwgYWRkcmVzcyB3aGVyZSBub3RpZmljYXRpb24gYWJvdXQgbmV3IHN1Ym1pc3Npb25zIHdpbGwgYmUgc2VuZCB0by4gRGVmYXVsdCBlbWFpbCBhZGRyZXNzIHdpbGwgYmUgdXNlZCBpZiB0aGlzIGZpZWxkIGlzIGxlZnQgYmxhbmsu" Column="U3VibWlzc2lvbiBOb3RpZmljYXRpb24gRW1haWw=">U3VibWlzc2lvbiBOb3RpZmljYXRpb24gRW1haWw=</PHRASE>
<PHRASE Label="la_fld_SuggestedCorrection" Module="Core" Type="1" Column="U3VnZ2VzdGVkIENvcnJlY3Rpb24=">U3VnZ2VzdGVkIENvcnJlY3Rpb24=</PHRASE>
<PHRASE Label="la_fld_SymLinkCategoryId" Module="Core" Type="1">UG9pbnRzIHRvIFNlY3Rpb24=</PHRASE>
<PHRASE Label="la_fld_TableName" Module="Core" Type="1">VGFibGUgTmFtZSBpbiBEYXRhYmFzZSA=</PHRASE>
@@ -588,6 +589,8 @@
<PHRASE Label="la_fld_Type" Module="Core" Type="1" Column="VHlwZQ==">VHlwZQ==</PHRASE>
<PHRASE Label="la_fld_UnitSystem" Module="Core" Type="1">TWVhc3VyZXMgU3lzdGVt</PHRASE>
<PHRASE Label="la_fld_Upload" Module="Core" Type="1">VXBsb2FkIEZpbGUgRnJvbSBMb2NhbCBQQw==</PHRASE>
+ <PHRASE Label="la_fld_UploadExtensions" Module="Core" Type="1" Hint="TGlzdCBvZiBGaWxlIEV4dGVuc2lvbnMgYWxsb3dlZCBmb3IgdXBsb2FkIHNlcGFyYXRlZCBieSBjb21tYS4gRXhhbXBsZToganBnLHBuZyxnaWcscGRm">QWxsb3dlZCBGaWxlIEV4dGVuc2lvbnM=</PHRASE>
+ <PHRASE Label="la_fld_UploadMaxSize" Module="Core" Type="1" Hint="TWF4aW11bSBmaWxlIHNpemUgKGluIEtieXRlcykgYWxsb3dlZCBmb3IgdGhlIHVwbG9hZC4gRXhhbXBsZTogMSBNQnl0ZSA9IDEwMjQgS0J5dGVzLCAxMCBNQnl0ZXMgPSAxMDI0MCBLQnl0ZXMu">TWF4aW11bSBGaWxlIFNpemU=</PHRASE>
<PHRASE Label="la_fld_URL" Module="Core" Type="1" Column="VVJM">VVJM</PHRASE>
<PHRASE Label="la_fld_UseExternalUrl" Module="Core" Type="1">TGluayB0byBFeHRlcm5hbCBVUkw=</PHRASE>
<PHRASE Label="la_fld_UseMenuIcon" Module="Core" Type="1">VXNlIEN1c3RvbSBNZW51IEljb24=</PHRASE>
@@ -1435,6 +1438,7 @@
<PHRASE Label="la_type_SingleCheckbox" Module="Core" Type="1">Q2hlY2tib3g=</PHRASE>
<PHRASE Label="la_type_text" Module="Core" Type="1">VGV4dCBmaWVsZA==</PHRASE>
<PHRASE Label="la_type_textarea" Module="Core" Type="1">VGV4dCBhcmVh</PHRASE>
+ <PHRASE Label="la_type_Upload" Module="Core" Type="1">RmlsZSBVcGxvYWQ=</PHRASE>
<PHRASE Label="la_Unchanged" Module="Core" Type="1">VW5jaGFuZ2Vk</PHRASE>
<PHRASE Label="la_Unicode" Module="Core" Type="1">VW5pY29kZQ==</PHRASE>
<PHRASE Label="la_updating_config" Module="Core" Type="1">VXBkYXRpbmcgQ29uZmlndXJhdGlvbg==</PHRASE>
Index: install/install_schema.sql
===================================================================
--- install/install_schema.sql (revision 14605)
+++ install/install_schema.sql (working copy)
@@ -1027,6 +1027,8 @@
DisplayInGrid tinyint(1) NOT NULL DEFAULT '1',
DefaultValue text,
Validation tinyint(4) NOT NULL DEFAULT '0',
+ UploadExtensions varchar(255) NOT NULL DEFAULT '',
+ UploadMaxSize int(11) DEFAULT NULL,
Visibility tinyint(4) NOT NULL DEFAULT '1',
EmailCommunicationRole tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (FormFieldId),
@@ -1106,6 +1108,7 @@
Description text,
RequireLogin tinyint(4) NOT NULL DEFAULT '0',
UseSecurityImage tinyint(4) NOT NULL DEFAULT '0',
+ SubmitNotifyEmail varchar(255) NOT NULL DEFAULT '',
EnableEmailCommunication tinyint(4) NOT NULL DEFAULT '0',
ProcessUnmatchedEmails tinyint(4) NOT NULL DEFAULT '0',
ReplyFromName varchar(255) NOT NULL DEFAULT '',
Index: install/upgrades.sql
===================================================================
--- install/upgrades.sql (revision 14606)
+++ install/upgrades.sql (working copy)
@@ -2122,3 +2122,10 @@
WHERE ModuleOwner = 'In-Portal' AND `Section` = 'in-portal:configure_advanced' AND Heading = 'la_section_SettingsAdmin' AND DisplayOrder > 40.06;
INSERT INTO ConfigurationValues VALUES (DEFAULT, 'StickyGridSelection', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_StickyGridSelection', 'radio', '', '1=la_Yes||0=la_No', 40.07, 0, 0, NULL);
+
+ALTER TABLE Forms
+ ADD SubmitNotifyEmail VARCHAR(255) NOT NULL DEFAULT '' AFTER UseSecurityImage;
+
+ALTER TABLE FormFields
+ ADD UploadExtensions VARCHAR(255) NOT NULL DEFAULT '' AFTER Validation,
+ ADD UploadMaxSize INT NULL AFTER UploadExtensions;
Index: kernel/db/db_tag_processor.php
===================================================================
--- kernel/db/db_tag_processor.php (revision 14596)
+++ kernel/db/db_tag_processor.php (working copy)
@@ -1082,7 +1082,7 @@
if ( $formatter_class == 'kMultiLanguage' ) {
$formatter =& $this->Application->recallObject($formatter_class);
/* @var $formatter kMultiLanguage */
-
+
$field = $formatter->LangFieldName($field);
}
@@ -1109,7 +1109,7 @@
{
$object =& $this->getObject($params);
/* @var $object kDBList */
-
+
$field = $params['field'];
$value = array_key_exists('value', $params) ? $params['value'] : $object->GetDBField($field);
$field_options = $object->GetFieldOptions($field);
@@ -1211,7 +1211,7 @@
}
elseif ( $human_format || $edit_size ) {
$format = $formatter->HumanFormat($format);
-
+
return $edit_size ? strlen($format) : $format;
}
}
@@ -1822,7 +1822,7 @@
$prefixes = array_key_exists('prefixes', $title_info) ? $title_info['prefixes'] : false;
$all_tag_params = array_key_exists('tag_params', $title_info) ? $title_info['tag_params'] : false;
/* @var $prefixes Array */
-
+
if ($prefixes) {
// extract tag_params passed directly to SectionTitle tag for specific prefix
foreach ($params as $tp_name => $tp_value) {
@@ -1930,7 +1930,7 @@
$of_phrase = $this->Application->Phrase('la_of');
return $object->GetRecordsCount() . ' ' . $of_phrase . ' ' . $object->GetRecordsCount(false);
}
-
+
return $object->GetRecordsCount();
break;
}
@@ -2010,6 +2010,7 @@
case 'text':
case 'textarea':
+ case 'upload':
$params['field_params'] = $helper->ParseConfigSQL($object->GetDBField($params['value_list_field']));
break;
@@ -2225,7 +2226,7 @@
if ($formatter_class) {
$formatter =& $this->Application->recallObject($formatter_class);
/* @var $formatter kFormatter */
-
+
$human_format = array_key_exists('human', $params) ? $params['human'] : false;
$edit_size = array_key_exists('edit_size', $params) ? $params['edit_size'] : false;
$sample = array_key_exists('sample', $params) ? $params['sample'] : false;
@@ -2330,7 +2331,7 @@
{
$export_object =& $this->Application->recallObject('CatItemExportHelper');
/* @var $export_object kCatDBItemExportHelper */
-
+
$event = new kEvent($this->getPrefixSpecial().':OnDummy');
$action_method = 'perform'.ucfirst($this->Special);
Index: units/forms/form_fields/form_fields_config.php
===================================================================
--- units/forms/form_fields/form_fields_config.php (revision 14590)
+++ units/forms/form_fields/form_fields_config.php (working copy)
@@ -67,7 +67,7 @@
'Prompt' => Array('type' => 'string', 'default' => null, 'required' => 1),
'ElementType' => Array(
'type' => 'string',
- 'formatter' => 'kOptionsFormatter', 'options' => Array ('text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_SingleCheckbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'label' => 'la_type_label'), 'use_phrases' => 1,
+ 'formatter' => 'kOptionsFormatter', 'options' => Array ('text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_SingleCheckbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'upload' => 'la_type_upload', 'label' => 'la_type_label'), 'use_phrases' => 1,
'required' => 1, 'not_null' => 1, 'default' => '',
),
'ValueList' => Array('type' => 'string','default' => null),
@@ -77,6 +77,8 @@
'DisplayInGrid' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 1),
'DefaultValue' => Array('type' => 'string', 'default' => NULL),
'Validation' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(0 => 'la_None', 1 => 'la_ValidationEmail'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
+ 'UploadExtensions' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
+ 'UploadMaxSize' => Array ('type' => 'int', 'default' => NULL),
'Visibility' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_opt_Everyone', 2 => 'la_opt_GuestsOnly'), 'use_phrases' => 1,
Index: units/forms/form_submissions/form_submissions_eh.php
===================================================================
--- units/forms/form_submissions/form_submissions_eh.php (revision 14590)
+++ units/forms/form_submissions/form_submissions_eh.php (working copy)
@@ -16,7 +16,14 @@
class FormSubmissionsEventHandler extends kDBEventHandler {
- function CheckPermission(&$event)
+ /**
+ * Checks user permission to execute given $event
+ *
+ * @param kEvent $event
+ * @return bool
+ * @access public
+ */
+ public function CheckPermission(&$event)
{
if (!$this->Application->isAdmin) {
if ($event->Name == 'OnCreate') {
@@ -65,6 +72,7 @@
'password' => 'grid_like_filter',
'textarea' => 'grid_like_filter',
'label' => 'grid_like_filter',
+ 'upload' => 'grid_empty_filter',
);
return $mapping[$element_type];
@@ -116,6 +124,10 @@
'filter_block' => $this->_getFilterBlock($options['ElementType'])
);
+ if ($options['ElementType'] == 'upload') {
+ $conf_grids['Default']['Fields']['fld_' . $field_id]['data_block'] = 'grid_upload_td';
+ }
+
if ($options['Validation'] == 1) {
$conf_grids['Default']['Fields']['fld_' . $field_id]['data_block'] = 'grid_email_td';
}
@@ -138,6 +150,19 @@
$field_options['verify_field'] = 'fld_' . $field_id . '_verify';
}
+ if ($options['ElementType'] == 'upload') {
+ $field_options['formatter'] = 'kUploadFormatter';
+ $field_options['upload_dir'] = WRITEBALE_BASE . DIRECTORY_SEPARATOR . 'user_files' . DIRECTORY_SEPARATOR . 'form_submissions';
+
+ if ( $options['UploadMaxSize'] ) {
+ $field_options['max_size'] = $options['UploadMaxSize'] * 1024; // convert Kbytes to bytes
+ }
+
+ if ( $options['UploadExtensions'] ) {
+ $field_options['file_types'] = '*.' . implode(';*.', explode(',', $options['UploadExtensions']));
+ }
+ }
+
$conf_fields['fld_' . $field_id] = $field_options;
}
@@ -145,11 +170,20 @@
$this->Application->setUnitOption($event->Prefix, 'Grids', $conf_grids);
}
- function SetCustomQuery(&$event)
+ /**
+ * Apply any custom changes to list's sql query
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ * @see kDBEventHandler::OnListBuild()
+ */
+ protected function SetCustomQuery(&$event)
{
$object =& $event->getObject();
- $form_id = $this->Application->GetVar('form_id');
- $object->addFilter('form_filter','%1$s.FormId = '.$form_id);
+ /* @var $object kDBList */
+
+ $object->addFilter('form_filter', '%1$s.FormId = ' . (int)$this->Application->GetVar('form_id'));
}
/**
@@ -193,7 +227,25 @@
// allows user to view only it's last submission
$this->Application->StoreVar('last_submission_id', $object->GetID());
- $this->Application->EmailEventAdmin('FORM.SUBMITTED');
+ $form_submission_helper =& $this->Application->recallObject('FormSubmissionHelper');
+ /* @var $form_submission_helper FormSubmissionHelper */
+
+ $form =& $form_submission_helper->getForm($object);
+
+ $notify_email = $form->GetDBField('SubmitNotifyEmail');
+
+ if ($notify_email) {
+ $send_params = Array (
+ 'to_name' => $notify_email,
+ 'to_email' => $notify_email,
+ );
+
+ $this->Application->EmailEventAdmin('FORM.SUBMITTED', null, $send_params);
+ }
+ else {
+ $this->Application->EmailEventAdmin('FORM.SUBMITTED');
+ }
+
// $this->Application->EmailEventUser('FORM.SUBMITTED', null, 'to_email' => '');
$event->SetRedirectParam('opener', 's');
@@ -202,7 +254,7 @@
$theme =& $this->Application->recallObject('theme.current');
/* @var $theme kDBItem */
- $template = $this->Application->GetVar('success_template');
+ $template = kUtil::unhtmlentities( $this->Application->GetVar('success_template') ); // kHTTPQuery do htmlspecialchars on everything
$alias_template = $theme->GetField('TemplateAliases', $template);
$event->redirect = $alias_template ? $alias_template : $template;
@@ -212,8 +264,10 @@
* Processes Captcha code
*
* @param kEvent $event
+ * @return void
+ * @access protected
*/
- function OnBeforeItemCreate(&$event)
+ protected function OnBeforeItemCreate(&$event)
{
parent::OnBeforeItemCreate($event);
@@ -225,7 +279,7 @@
if ( !$object->GetDBField('ReferrerURL') ) {
$referrer = $this->Application->GetVar('original_referrer');
- if (!$referrer) {
+ if ( !$referrer ) {
$base_url = preg_quote($this->Application->BaseURL(), '/');
$referrer = preg_replace('/^' . $base_url . '/', '/', $_SERVER['HTTP_REFERER'], 1);
}
@@ -239,7 +293,7 @@
$form =& $form_submission_helper->getForm($object);
// validate captcha code
- if ($form->GetDBField('UseSecurityImage') && !$this->Application->LoggedIn()) {
+ if ( $form->GetDBField('UseSecurityImage') && !$this->Application->LoggedIn() ) {
$captcha_helper =& $this->Application->recallObject('CaptchaHelper');
/* @var $captcha_helper kCaptchaHelper */
@@ -251,8 +305,10 @@
* Checks, that target submission was selected for merging
*
* @param kEvent $event
+ * @return void
+ * @access protected
*/
- function OnBeforeItemUpdate(&$event)
+ protected function OnBeforeItemUpdate(&$event)
{
parent::OnBeforeItemUpdate($event);
@@ -319,8 +375,10 @@
* Fills merge-to dropdown
*
* @param kEvent $event
+ * @return void
+ * @access protected
*/
- function OnAfterItemLoad(&$event)
+ protected function OnAfterItemLoad(&$event)
{
parent::OnAfterItemLoad($event);
@@ -382,9 +440,7 @@
$options[$submission_id] = $option_title;
}
- $field_options = $object->GetFieldOptions('MergeToSubmission');
- $field_options['options'] = $options;
- $object->SetFieldOptions('MergeToSubmission', $field_options);
+ $object->SetFieldOption('MergeToSubmission', 'options', $options);
}
/**
Index: units/forms/forms/forms_config.php
===================================================================
--- units/forms/forms/forms_config.php (revision 14590)
+++ units/forms/forms/forms_config.php (working copy)
@@ -146,6 +146,12 @@
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
+ 'SubmitNotifyEmail' => Array (
+ 'type' => 'string', 'max_len' => 255,
+ 'formatter' => 'kFormatter', 'regexp'=>'/^(' . REGEX_EMAIL_USER . '@' . REGEX_EMAIL_DOMAIN . ')$/i',
+ 'sample_value' => 'email@domain.com', 'error_msgs' => Array ('invalid_format' => '!la_invalid_email!'),
+ 'not_null' => 1, 'default' => ''
+ ),
'EnableEmailCommunication' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
@@ -212,6 +218,7 @@
'RequireLogin' => Array ('filter_block' => 'grid_options_filter', 'width' => 80,),
'UseSecurityImage' => Array ('filter_block' => 'grid_options_filter', 'width' => 110,),
'EnableEmailCommunication' => Array ('title' => 'la_col_EnableEmailCommunication', 'filter_block' => 'grid_options_filter', 'width' => 120,),
+ 'SubmitNotifyEmail' => Array ('filter_block' => 'grid_like_filter'),
),
),
),
|