Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F848291
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Apr 20, 2:46 AM
Size
9 KB
Mime Type
text/x-diff
Expires
Tue, Apr 22, 2:46 AM (16 h, 59 m)
Engine
blob
Format
Raw Data
Handle
603014
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/5.0.x/themes/default/_install/theme.xml
===================================================================
--- branches/5.0.x/themes/default/_install/theme.xml (revision 12875)
+++ branches/5.0.x/themes/default/_install/theme.xml (revision 12876)
@@ -1,3 +1,5 @@
<theme>
<default_design>designs/general</default_design>
+ <form_design>designs/form</form_design>
+ <form_thankyou>thankyou</form_thankyou>
</theme>
\ No newline at end of file
Index: branches/5.0.x/themes/default/designs/form.tpl
===================================================================
--- branches/5.0.x/themes/default/designs/form.tpl (revision 12875)
+++ branches/5.0.x/themes/default/designs/form.tpl (revision 12876)
@@ -1,74 +1,78 @@
<!--##
<NAME>Online Form - Section Template</NAME>
<DESC>Online Form</DESC>
<SECTION>Pages</SECTION>
##-->
<inp2:m_include template="elements/dynamic_forms.elm"/>
<!--## DEFINE MAIN CONTENT ELEMENT ##-->
<inp2:m_DefineElement name="content">
<inp2:m_RenderElement design="content_box">
<inp2:m_Capture to_var="header">
<inp2:st_PageInfo type="title"/>
</inp2:m_Capture>
<inp2:st_ContentBlock num="1"/>
<div class="contacts-block">
<div class="address">
<h4><inp2:m_Phrase label="lu_title_Address"/>:</h4>
<inp2:st_ContentBlock num="2"/>
</div>
<div class="contacts-form">
<h4><inp2:m_Phrase label="lu_title_RequestInformation"/></h4>
<p class="note">
<inp2:st_ContentBlock num="3"/>
</p>
<div class="bg-contacts">
<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"/>">
+ <inp2:formsubs_PresetFormFields/>
+
<inp2:m_if check="formsubs_HasError" field="any">
<p class="red"><inp2:m_RenderElement name="error_message" /></p>
</inp2:m_if>
<inp2:formflds_PrintList render_as="form_field" SourcePrefix="formsubs" per_page="-1"/>
<p class="button">
<input type="reset" name="reset" value="<inp2:m_Phrase label='lu_btn_Reset' no_editing='1'/>" />
<input type="submit" name="events[formsubs][OnCreate]" value="<inp2:m_Phrase label='lu_btn_Send' no_editing='1'/>" class="submit"/>
<input type="hidden" name="<inp2:formsubs_InputName field="FormId"/>" value="<inp2:m_Get var="form_id"/>"/>
<input type="hidden" name="form_id" value="<inp2:m_Get var="form_id"/>"/>
<input type="hidden" name="success_template" value="<inp2:st_Field name="FormSubmittedTemplate"/>"/>
</p>
</form>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<script type="text/javascript">
- $(document).ready(function() {
- $('div.text').addClass('contacts');
- });
+ $(document).ready(
+ function() {
+ $('div.text').addClass('contacts');
+ }
+ );
</script>
</inp2:m_RenderElement>
</inp2:m_DefineElement>
<!--## /DEFINE MAIN CONTENT ELEMENT ##-->
<!--## INCLUDE MAIN DESIGN TEMPLATE ##-->
<inp2:m_include template="designs/default_design.des" page_class="inner"/>
<!--## /INCLUDE MAIN DESIGN TEMPLATE ##-->
\ No newline at end of file
Index: branches/5.0.x/themes/advanced/_install/theme.xml
===================================================================
--- branches/5.0.x/themes/advanced/_install/theme.xml (revision 12875)
+++ branches/5.0.x/themes/advanced/_install/theme.xml (revision 12876)
@@ -1,3 +1,5 @@
<theme>
<default_design>platform/designs/general</default_design>
+ <form_design>platform/designs/form</form_design>
+ <form_thankyou>platform/thankyou</form_thankyou>
</theme>
\ No newline at end of file
Index: branches/5.0.x/themes/simple/_install/theme.xml
===================================================================
--- branches/5.0.x/themes/simple/_install/theme.xml (revision 12875)
+++ branches/5.0.x/themes/simple/_install/theme.xml (revision 12876)
@@ -1,3 +1,5 @@
<theme>
<default_design>designs/general</default_design>
+ <form_design>designs/form</form_design>
+ <form_thankyou>thankyou</form_thankyou>
</theme>
\ No newline at end of file
Index: branches/5.0.x/core/units/form_submissions/form_submissions_eh.php
===================================================================
--- branches/5.0.x/core/units/form_submissions/form_submissions_eh.php (revision 12875)
+++ branches/5.0.x/core/units/form_submissions/form_submissions_eh.php (revision 12876)
@@ -1,142 +1,156 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class FormSubmissionsEventHandler extends kDBEventHandler {
function CheckPermission(&$event)
{
if (!$this->Application->isAdmin) {
if ($event->Name == 'OnCreate') {
// anybody can submit forms on front
return true;
}
}
return parent::CheckPermission($event);
}
function mapPermissions()
{
parent::mapPermissions();
$permissions = Array(
'OnEdit' => Array('self' => 'view', 'subitem' => 'view'),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Returns filter block based on field element type
*
* @param string $element_type
* @return string
*/
function _getFilterBlock($element_type)
{
$mapping = Array (
'text' => 'grid_like_filter',
'select' => 'grid_options_filter',
'radio' => 'grid_options_filter',
'checkbox' => 'grid_options_filter',
'password' => 'grid_like_filter',
'textarea' => 'grid_like_filter',
'label' => 'grid_like_filter',
);
return $mapping[$element_type];
}
function OnBuildFormFields(&$event)
{
$form_id = $this->Application->GetVar('form_id');
if (!$form_id) return ;
$conf_fields = $this->Application->getUnitOption($event->Prefix, 'Fields');
$conf_grids = $this->Application->getUnitOption($event->Prefix, 'Grids');
$helper =& $this->Application->recallObject('InpCustomFieldsHelper');
$sql = 'SELECT *
FROM ' . TABLE_PREFIX . 'FormFields
WHERE FormId = ' . (int)$form_id . '
ORDER BY Priority DESC';
$fields = $this->Conn->Query($sql, 'FormFieldId');
foreach ($fields as $field_id => $options) {
$conf_fields['fld_'.$field_id] = Array('type'=>'string', 'default'=>$options['DefaultValue']);
if ($options['Required']) {
$conf_fields['fld_'.$field_id]['required'] = 1;
}
if ($options['Validation'] == 1) {
$conf_fields['fld_'.$field_id]['formatter'] = 'kFormatter';
$conf_fields['fld_'.$field_id]['regexp'] = '/^(' . REGEX_EMAIL_USER . '@' . REGEX_EMAIL_DOMAIN . ')$/i';
}
if ($options['DisplayInGrid']) {
$title = $options['Prompt'];
if (substr($title, 0,1) == '+') {
$this->Application->Phrases->AddCachedPhrase('form_col_title'.$field_id, substr($title,1));
$title = 'form_col_title'.$field_id;
}
$conf_grids['Default']['Fields']['fld_'.$field_id] = Array('title'=>$title, 'no_special' => 1, 'nl2br' => 1, 'first_chars' => 200, 'filter_block' => $this->_getFilterBlock($options['ElementType']));
if ($options['Validation'] == 1)
{
$conf_grids['Default']['Fields']['fld_'.$field_id]['data_block'] = 'grid_email_td';
}
}
if ($options['ElementType'] == 'radio' || $options['ElementType'] == 'select') {
$conf_fields['fld_'.$field_id]['options'] = $helper->GetValuesHash( $options['ValueList'] );
$conf_fields['fld_'.$field_id]['formatter'] = 'kOptionsFormatter';
}
if ($options['ElementType'] == 'password') {
$conf_fields['fld_'.$field_id]['formatter'] = 'kPasswordFormatter';
$conf_fields['fld_'.$field_id]['encryption_method'] = 'plain';
$conf_fields['fld_'.$field_id]['verify_field'] = 'fld_'.$field_id.'_verify';
}
}
$this->Application->setUnitOption($event->Prefix, 'Fields', $conf_fields);
$this->Application->setUnitOption($event->Prefix, 'Grids', $conf_grids);
}
function SetCustomQuery(&$event)
{
$object =& $event->getObject();
$form_id = $this->Application->GetVar('form_id');
$object->addFilter('form_filter','%1$s.FormId = '.$form_id);
}
function getPassedID(&$event)
{
if (!$this->Application->isAdminUser) {
// no way to see other user's form submission by giving it's ID directly in url
return 0;
}
return parent::getPassedID($event);
}
+ /**
+ * Creates new form submission from Front-End
+ *
+ * @param kEvent $event
+ */
function OnCreate(&$event)
{
parent::OnCreate($event);
- if ($event->status == erSUCCESS) {
- $this->Application->EmailEventAdmin('FORM.SUBMITTED');
- //$this->Application->EmailEventUser('FORM.SUBMITTED', null, 'to_email' = )
-
- $event->redirect_params['opener'] = 's';
- $event->redirect_params['m_cat_id'] = 0;
- $event->redirect = $this->Application->GetVar('success_template');
+ if ($event->status != erSUCCESS) {
+ return ;
}
+
+ $this->Application->EmailEventAdmin('FORM.SUBMITTED');
+// $this->Application->EmailEventUser('FORM.SUBMITTED', null, 'to_email' => '');
+
+ $event->SetRedirectParam('opener', 's');
+ $event->SetRedirectParam('m_cat_id', 0);
+
+ $theme =& $this->Application->recallObject('theme.current');
+ /* @var $theme kDBItem */
+
+ $template = $this->Application->GetVar('success_template');
+ $alias_template = $theme->GetField('TemplateAliases', $template);
+
+ $event->redirect = $alias_template ? $alias_template : $template;
}
}
\ No newline at end of file
Event Timeline
Log In to Comment