Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Wed, Feb 5, 2:51 AM

in-portal

Index: branches/5.1.x/core/units/form_fields/form_fields_config.php
===================================================================
--- branches/5.1.x/core/units/form_fields/form_fields_config.php (revision 13388)
+++ branches/5.1.x/core/units/form_fields/form_fields_config.php (nonexistent)
@@ -1,102 +0,0 @@
-<?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!');
-
- $config = Array(
- 'Prefix' => 'formflds',
- 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
- 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
- 'EventHandlerClass' => Array('class'=>'kDBEventHandler','file'=>'','build_event'=>'OnBuild'),
- 'TagProcessorClass' => Array('class'=>'FormFieldsTagProcessor','file'=>'form_fields_tp.php'),
- 'AutoLoad' => true,
- 'QueryString' => Array(
- 1 => 'id',
- 2 => 'Page',
- 3 => 'PerPage',
- 4 => 'event',
- ),
-
- 'IDField' => 'FormFieldId',
- 'TitleField' => 'FieldName',
- 'TableName' => TABLE_PREFIX.'FormFields',
- 'ListSQLs' => Array(
- ''=>' SELECT %1$s.* %2$s FROM %1$s',
- ), // key - special, value - list select sql
- 'ItemSQLs' => Array(
- ''=>'SELECT %1$s.* %2$s FROM %1$s',
- ),
-
- 'ForeignKey' => 'FormId',
- 'ParentTableKey' => 'FormId',
- 'ParentPrefix' => 'form',
- 'AutoDelete' => true,
- 'AutoClone' => true,
-
- 'ListSortings' => Array(
- '' => Array(
- 'Sorting' => Array('Name' => 'asc'),
- )
- ),
-
- 'ListSortings' => Array(
- '' => Array(
- 'ForcedSorting' => Array('Priority' => 'desc'),
- 'Sorting' => Array('FieldName' => 'asc'),
- )
- ),
-
- 'Fields' => Array(
- 'FormFieldId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
- 'FormId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
- 'Type' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
- 'FieldName' => Array('type' => 'string', 'not_null' => 1, 'required' => 1, 'default' => ''),
- 'FieldLabel' => Array('type' => 'string', 'required' => 1, 'default' => null),
- 'Heading' => Array('type' => 'string', 'default' => null),
- 'Prompt' => Array('type' => 'string', 'default' => null, 'required' => 1),
- 'ElementType' => Array(
- 'type' => 'string',
- 'formatter' => 'kOptionsFormatter', 'options' => Array ('' => 'la_EmptyValue', '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,
- 'required' => 1, 'not_null' => 1, 'default' => '',
- ),
- 'ValueList' => Array('type' => 'string','default' => null),
- 'Priority' => Array('type' => 'int','not_null' => 1, 'default' => 0),
- 'IsSystem' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
- 'Required' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
- '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),
- ),
-
- 'VirtualFields' => Array(
- 'DirectOptions' => Array('type' => 'string', 'default' => ''),
- ),
-
- 'CalculatedFields' => Array(
- ),
- 'Grids' => Array(
- 'Default' => Array(
- 'Icons' => Array('default'=>'icon16_item.png'),
- 'Fields' => Array(
- 'FormFieldId' => Array( 'title'=>'la_col_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 60 ),
- 'FieldName' => Array( 'title'=>'la_prompt_FieldName', 'filter_block' => 'grid_like_filter', 'width' => 100 ),
- 'FieldLabel' => Array( 'title'=>'la_prompt_FieldLabel', 'data_block' => 'label_grid_data_td', 'filter_block' => 'grid_like_filter', 'width' => 150 ),
- 'Priority' => Array('title' => 'la_prompt_Priority', 'filter_block' => 'grid_range_filter', 'width' => 80 ),
- 'ElementType' => Array('title' => 'la_prompt_ElementType', 'filter_block' => 'grid_options_filter'),
- 'Required' => Array('title' => 'la_prompt_Required', 'filter_block' => 'grid_options_filter'),
- 'DisplayInGrid' => Array('title' => 'la_prompt_DisplayInGrid', 'filter_block' => 'grid_options_filter', 'width' => 150 ),
- ),
- ),
- ),
- );
\ No newline at end of file
Property changes on: branches/5.1.x/core/units/form_fields/form_fields_config.php
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.1.2.1
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Index: branches/5.1.x/core/units/form_fields/form_fields_tp.php
===================================================================
--- branches/5.1.x/core/units/form_fields/form_fields_tp.php (revision 13388)
+++ branches/5.1.x/core/units/form_fields/form_fields_tp.php (nonexistent)
@@ -1,51 +0,0 @@
-<?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 FormFieldsTagProcessor extends kDBTagProcessor{
-
- function CustomInputName($params)
- {
- $object =& $this->getObject($params);
- $source_prefix = $this->Application->Parser->GetParam('SourcePrefix');
-
- $source_tp =& $this->Application->recallTagProcessor($source_prefix);
- $params['name'] = 'fld_'.$object->GetDBField('FormFieldId');
- if (isset($params['verify'])) $params['name'] .= '_verify';
- return $source_tp->InputName($params);
- }
-
- function SubmissionTag($params)
- {
- $object =& $this->getObject($params);
-
- $params['field'] = 'fld_'.$object->GetDBField('FormFieldId');
- $source_prefix = $this->Application->Parser->GetParam('SourcePrefix');
-
- return $this->Application->ProcessParsedTag($source_prefix, $params['tag'], $params);
- }
-
- /**
- * Allows to modify block params & current list record before PrintList parses record
- *
- * @param kDBList $object
- * @param Array $block_params
- */
- function PrepareListElementParams(&$object, &$block_params)
- {
- $object->SetDBField('DirectOptions', false);
- }
-
- }
\ No newline at end of file
Property changes on: branches/5.1.x/core/units/form_fields/form_fields_tp.php
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.1.2.1
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Index: branches/5.1.x/core/units/form_submissions/form_submission_tp.php
===================================================================
--- branches/5.1.x/core/units/form_submissions/form_submission_tp.php (revision 13388)
+++ branches/5.1.x/core/units/form_submissions/form_submission_tp.php (nonexistent)
@@ -1,22 +0,0 @@
-<?php
-
- class FormSubmissionTagProcessor extends kDBTagProcessor {
-
- /**
- * Returns phrase translation by name
- *
- * @param Array $params
- * @return string
- * @access public
- */
- function PhraseFromRequest($params)
- {
- $phrase_name = $this->Application->GetVar($params['name']);
-
- if (array_key_exists('default', $params) && !$phrase_name) {
- $phrase_name = $params['default'];
- }
-
- return $this->Application->Phrase($phrase_name);
- }
- }
Index: branches/5.1.x/core/units/form_submissions/form_submissions_config.php
===================================================================
--- branches/5.1.x/core/units/form_submissions/form_submissions_config.php (revision 13388)
+++ branches/5.1.x/core/units/form_submissions/form_submissions_config.php (nonexistent)
@@ -1,106 +0,0 @@
-<?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!');
-
- $config = Array(
- 'Prefix' => 'formsubs',
- 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
- 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
- 'EventHandlerClass' => Array('class'=>'FormSubmissionsEventHandler','file'=>'form_submissions_eh.php','build_event'=>'OnBuild'),
- 'TagProcessorClass' => Array('class'=>'FormSubmissionTagProcessor', 'file' => 'form_submission_tp.php', 'build_event'=>'OnBuild'),
- 'AutoLoad' => true,
- 'QueryString' => Array(
- 1 => 'id',
- 2 => 'Page',
- 3 => 'PerPage',
- 4 => 'event',
- ),
-
- 'Hooks' => Array(
- Array(
- 'Mode' => hAFTER,
- 'Conditional' => false,
- 'HookToPrefix' => 'formsubs', //self
- 'HookToSpecial' => '*',
- 'HookToEvent' => Array('OnAfterConfigRead'),
- 'DoPrefix' => '',
- 'DoSpecial' => '',
- 'DoEvent' => 'OnBuildFormFields',
- ),
- ),
-
- 'TitlePresets' => Array(
- 'default' => Array( 'new_status_labels' => Array('form'=>'!la_title_Adding_Form!'),
- 'edit_status_labels' => Array('form'=>'!la_title_Editing_Form!'),
- 'new_titlefield' => Array('form'=>''),
- ),
-
- 'formsubs_list' => Array (
- 'prefixes' => Array('form', 'formsubs_List'),
- 'format' => "!la_title_FormSubmissions! '#form_titlefield#'",
- 'toolbar_buttons' => Array ('edit', 'delete', 'dbl-click'),
- ),
-
- 'formsubs_view' => Array(
- 'prefixes' => Array('formsubs'),
- 'format' => "!la_title_ViewingFormSubmission!",
- 'toolbar_buttons' => Array ('cancel', 'prev', 'next'),
- ),
-
- ),
-
- 'PermSection' => Array('main' => 'in-portal:submissions'),
-
- 'IDField' => 'FormSubmissionId',
- /*'TitleField' => 'Name',*/
- 'TableName' => TABLE_PREFIX.'FormSubmissions',
- 'ListSQLs' => Array(
- ''=>' SELECT %1$s.* %2$s FROM %1$s',
- ), // key - special, value - list select sql
- 'ItemSQLs' => Array(
- ''=>'SELECT %1$s.* %2$s FROM %1$s',
- ),
-
- /*'ForeignKey' => 'FormId',
- 'ParentTableKey' => 'FormId',
- 'ParentPrefix' => 'form',
- 'AutoDelete' => true,
- 'AutoClone' => true,*/
-
- 'ListSortings' => Array(
- '' => Array(
- 'Sorting' => Array('SubmissionTime' => 'desc'),
- )
- ),
-
- 'Fields' => Array(
- 'FormSubmissionId' => Array('type' => 'int', 'not_null' => 1,'default' => 0),
- 'FormId' => Array('type' => 'int','not_null' => '1','default' => 0),
- 'SubmissionTime' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
- ),
- 'VirtualFields' => Array(
- ),
- 'CalculatedFields' => Array(
- ),
- 'Grids' => Array(
- 'Default' => Array(
- 'Icons' => Array('default' => 'icon16_item.png'),
- 'Fields' => Array(
- 'FormSubmissionId' => Array( 'title'=>'la_col_Id', 'data_block' => 'grid_checkbox_td', 'sort_field' => 'FormFieldId', 'filter_block' => 'grid_range_filter', 'width' => 60 ),
- 'SubmissionTime' => Array( 'title'=>'la_prompt_SumbissionTime', 'filter_block' => 'grid_date_range_filter', 'width' => 145 ),
- ),
- ),
- ),
- );
\ No newline at end of file
Property changes on: branches/5.1.x/core/units/form_submissions/form_submissions_config.php
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.1.2.1
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Index: branches/5.1.x/core/units/form_submissions/form_submissions_eh.php
===================================================================
--- branches/5.1.x/core/units/form_submissions/form_submissions_eh.php (revision 13388)
+++ branches/5.1.x/core/units/form_submissions/form_submissions_eh.php (nonexistent)
@@ -1,156 +0,0 @@
-<?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) {
- 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
Property changes on: branches/5.1.x/core/units/form_submissions/form_submissions_eh.php
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.1.2.1
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property

Event Timeline