function loadAction($form, $actiondata)
    {
        $params = new JParameter($actiondata->params);
        $output = '';
        $mainframe =& JFactory::getApplication();
        $document =& JFactory::getDocument();
        JHTML::_('behavior.mootools');
        $uri =& JFactory::getURI();
        $CF_PATH = $mainframe->isSite() ? JURI::Base() : $uri->root();
        $document->addScript($CF_PATH . 'administrator/components/com_chronoforms/form_actions/auto_javascript_validation/assets/auto_javascript_validation.js');
        $rules = array('required', 'alpha', 'alphanum', 'digit', 'nodigit', 'number', 'email', 'phone', 'phone_inter', 'url', 'image');
        ob_start();
        ?>
			window.addEvent('domready', function() {
				<?php 
        $object_list = array();
        foreach ($rules as $rule) {
            $fields_list = array();
            if (trim($params->get($rule, ''))) {
                $fields_list = explode(',', trim($params->get($rule, '')));
            }
            foreach ($fields_list as $k => $field) {
                $fields_list[$k] = "'" . $field . "'";
            }
            $n_fields_list = implode(',', $fields_list);
            $object_list[] = "'" . $rule . "': [" . $n_fields_list . "]";
        }
        ?>
				new AutoJavascriptValidation('<?php 
        echo $form->form_name;
        ?>
', <?php 
        echo "{" . implode(",", $object_list) . "}";
        ?>
);
			});
		<?php 
        $script = ob_get_clean();
        if ((bool) $form->form_params->get('dynamic_files', 0) === false) {
            $document->addScriptDeclaration("//<![CDATA[" . "\n" . $script . "\n" . "//]]>");
        } else {
            //load the action class
            $form->loadActionHelper('load_js');
            $CfactionLoadJsHelper = new CfactionLoadJsHelper();
            $JSactiondata = new stdClass();
            $JSactiondata->content1 = $script;
            $JSParams = new JParameter('');
            $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0));
            $JSactiondata->params = $JSParams->toString();
            $CfactionLoadJsHelper->load($form, $JSactiondata);
        }
        //load validation files
        $form->loadActionHelper('show_html');
        $CfactionShowHtmlHelper = new CfactionShowHtmlHelper();
        $CfactionShowHtmlHelper->_loadValidationScripts($form);
    }
Exemplo n.º 2
0
    function load($form = null, $actiondata = null)
    {
        $params = new JParameter($actiondata->params);
        $document =& JFactory::getDocument();
        JHTML::_('behavior.mootools');
        $mainframe =& JFactory::getApplication();
        $uri =& JFactory::getURI();
        $CF_PATH = $mainframe->isSite() ? JURI::Base() : $uri->root();
        $document->addStyleSheet($CF_PATH . 'components/com_chronoforms/css/datepicker/datepicker_dashboard.css');
        $document->addScript($CF_PATH . 'components/com_chronoforms/js/datepicker/datepicker.js');
        $con_str = "'." . $params->get('field_class', 'cf_datetime_picker') . "', {pickerClass: '" . $params->get('pickerClass', 'datepicker_dashboard') . "', format: '" . $params->get('format', 'd-m-Y H:i:s') . "', inputOutputFormat: '" . $params->get('inputOutputFormat', 'Y-m-d H:i:s') . "', allowEmpty: " . $params->get('allowEmpty', 'true') . ", timePicker: " . $params->get('timePicker', 'true') . ", timePickerOnly: " . $params->get('timePickerOnly', 'false');
        ob_start();
        eval('?>' . $actiondata->content1);
        $actiondata->content1 = ob_get_clean();
        if (!empty($actiondata->content1)) {
            $con_str .= ", " . $actiondata->content1;
            $con_str .= "}";
        } else {
            $con_str .= "}";
        }
        ob_start();
        ?>
			window.addEvent('load', function() {
				new DatePicker(<?php 
        echo $con_str;
        ?>
);
			});
		<?php 
        $script = ob_get_clean();
        if ((bool) $form->form_params->get('dynamic_files', 0) === false) {
            $document->addScriptDeclaration("//<![CDATA[" . "\n" . $script . "\n" . "//]]>");
        } else {
            //load the action class
            $form->loadActionHelper('load_js');
            $CfactionLoadJsHelper = new CfactionLoadJsHelper();
            $JSactiondata = new stdClass();
            $JSactiondata->content1 = $script;
            $JSParams = new JParameter('');
            $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0));
            $JSactiondata->params = $JSParams->toString();
            $CfactionLoadJsHelper->load($form, $JSactiondata);
        }
    }
Exemplo n.º 3
0
    function _loadToolTip($form)
    {
        $mainframe =& JFactory::getApplication();
        $uri =& JFactory::getURI();
        $document =& JFactory::getDocument();
        JHTML::_('behavior.mootools');
        $CF_PATH = $mainframe->isSite() ? JURI::Base() : $uri->root();
        echo '<link href="' . $CF_PATH . 'components/com_chronoforms/css/tooltip.css" rel="stylesheet" type="text/css" />';
        //JHTML::_('behavior.tooltip', '.tooltipimg');
        ob_start();
        ?>
			window.addEvent('domready', function(){
				//create the tooltips
				var tipz = new Tips($$('div.tooltipimg'),{
					className: 'tooltipbox',
					fixed: true,
					hideDelay: 0,
					showDelay: 0
				});
			});
		<?php 
        $script = ob_get_clean();
        if ((bool) $form->form_params->get('dynamic_files', 0) === false) {
            $document->addScriptDeclaration("//<![CDATA[" . "\n" . $script . "\n" . "//]]>");
        } else {
            //load the action class
            $form->loadActionHelper('load_js');
            $CfactionLoadJsHelper = new CfactionLoadJsHelper();
            $JSactiondata = new stdClass();
            $JSactiondata->content1 = $script;
            $JSParams = new JParameter('');
            $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0));
            $JSactiondata->params = $JSParams->toString();
            $CfactionLoadJsHelper->load($form, $JSactiondata);
        }
    }
    function load($form = null, $actiondata = null)
    {
        $params = new JParameter($actiondata->params);
        $document =& JFactory::getDocument();
        JHTML::_('behavior.mootools');
        $mainframe =& JFactory::getApplication();
        $uri =& JFactory::getURI();
        //check picker types
        $jversion = new JVersion();
        $script = "";
        if ($jversion->RELEASE > 1.5 && $form->form_params->get('datepicker_type', 0) == 1) {
            $cf_url = $uri->root();
            $cf_url .= 'components/com_chronoforms/js/datepicker_moo/';
            // you can change the uncommented line here to change the style
            $datepicker_style = $params->get('pickerClass', 'datepicker_dashboard');
            $document->addStyleSheet($cf_url . $datepicker_style . '/' . $datepicker_style . '.css');
            $document->addScript($cf_url . 'Locale.en-US.DatePicker.js');
            $document->addScript($cf_url . 'Picker.js');
            $document->addScript($cf_url . 'Picker.Attach.js');
            $document->addScript($cf_url . 'Picker.Date.js');
            if ((bool) $params->get('pickOnly', 0) === false) {
                $pickOnly = 'false';
            } else {
                $pickOnly = "'" . $params->get('pickOnly', 0) . "'";
            }
            $con_str = "\$\$('." . $params->get('field_class', 'cf_datetime_picker') . "'), {pickerClass: '" . $params->get('pickerClass', 'datepicker_dashboard') . "', format: '" . $params->get('format', 'd-m-Y H:i:s') . "', allowEmpty: " . $params->get('allowEmpty', 'true') . ", timePicker: " . $params->get('timePicker', 'true') . ", pickOnly: " . $pickOnly . "";
            $pickerClass = "Picker.Date";
            ob_start();
            eval('?>' . $actiondata->content1);
            $actiondata->content1 = ob_get_clean();
            if (!empty($actiondata->content1)) {
                $con_str .= ", " . $actiondata->content1;
                $con_str .= "}";
            } else {
                $con_str .= "}";
            }
            ob_start();
            ?>
				window.addEvent('load', function() {
					new <?php 
            echo $pickerClass;
            ?>
(<?php 
            echo $con_str;
            ?>
);
				});
			<?php 
            $script = ob_get_clean();
        }
        if ((bool) $form->form_params->get('dynamic_files', 0) === false) {
            $document->addScriptDeclaration("//<![CDATA[" . "\n" . $script . "\n" . "//]]>");
        } else {
            //load the action class
            $form->loadActionHelper('load_js');
            $CfactionLoadJsHelper = new CfactionLoadJsHelper();
            $JSactiondata = new stdClass();
            $JSactiondata->content1 = $script;
            $JSParams = new JParameter('');
            $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0));
            $JSactiondata->params = $JSParams->toString();
            $CfactionLoadJsHelper->load($form, $JSactiondata);
        }
    }
    function load($form = null, $actiondata = null)
    {
        $mainframe =& JFactory::getApplication();
        $params = new JParameter($actiondata->params);
        $output = '';
        $document =& JFactory::getDocument();
        //load some files
        //mootools
        JHTML::_('behavior.mootools');
        //load form css files
        $uri =& JFactory::getURI();
        $CF_PATH = $mainframe->isSite() ? JURI::Base() : $uri->root();
        //$document->addStyleSheet($CF_PATH.'administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/Autocompleter.css');
        $document->addScript($CF_PATH . 'administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/Autocompleter.js');
        $document->addScript($CF_PATH . 'administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/Autocompleter.Local.js');
        $document->addScript($CF_PATH . 'administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/Autocompleter.Request.js');
        $document->addScript($CF_PATH . 'administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/Observer.js');
        //load the CSS
        ob_start();
        ?>
		ul.autocompleter-choices { margin:0; position:absolute; width:339px; padding:0; list-style:none; z-index:50; background:#3b5998; border:1px solid #3b5998; top:0;}
		ul.autocompleter-choices li { margin:0; list-style:none; padding:0px 10px; cursor:pointer; font-weight:normal; white-space:nowrap; color:#fff; font-size:11px; }
		ul.autocompleter-choices li:hover { background:#eceff5; color:#3b5998; }
		.search-working { background:url(/administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/indicator_blue_small.gif) 200px 7px no-repeat; }
		<?php 
        $script = ob_get_clean();
        $document->addStyleDeclaration($script);
        //load the JS
        ob_start();
        ?>
		window.addEvent('domready', function() {
			new Autocompleter.Request.JSON('<?php 
        echo $params->get('field_id', '');
        ?>
', 'index.php?option=com_chronoforms&chronoform=<?php 
        echo $form->form_details->name;
        ?>
&event=<?php 
        echo $params->get('ajax_event', '');
        ?>
', {
				'postVar': '<?php 
        echo $params->get('field_name', '');
        ?>
',
				minLength: <?php 
        echo $params->get('minLength', 3);
        ?>
,
				maxChoices: <?php 
        echo $params->get('maxChoices', 10);
        ?>
,
				autoSubmit: false,
				cache: <?php 
        echo $params->get('results_cache', 'true');
        ?>
,
				delay: <?php 
        echo $params->get('ajax_delay', 300);
        ?>
,
				onRequest: function() {
					$('<?php 
        echo $params->get('field_id', '');
        ?>
').setStyles({
						'background-image':'url(<?php 
        echo $CF_PATH;
        ?>
administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/indicator_blue_small.gif)',
						'background-position':'350px 7px',
						'background-repeat':'no-repeat'
					});
				},
				onComplete: function() {
					$('<?php 
        echo $params->get('field_id', '');
        ?>
').setStyle('background','');
				}
			});
		});
		<?php 
        $script = ob_get_clean();
        if ((bool) $form->form_params->get('dynamic_files', 0) === false) {
            $document->addScriptDeclaration("//<![CDATA[" . "\n" . $script . "\n" . "//]]>");
        } else {
            //load the action class
            $form->loadActionHelper('load_js');
            $CfactionLoadJsHelper = new CfactionLoadJsHelper();
            $JSactiondata = new stdClass();
            $JSactiondata->content1 = $script;
            $JSParams = new JParameter('');
            $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0));
            $JSactiondata->params = $JSParams->toString();
            $CfactionLoadJsHelper->load($form, $JSactiondata);
        }
    }
Exemplo n.º 6
0
    function load($form = null, $actiondata = null)
    {
        $params = new JParameter($actiondata->params);
        $document = JFactory::getDocument();
        JHTML::_('behavior.mootools');
        $mainframe = JFactory::getApplication();
        $uri = JFactory::getURI();
        $dynamic_values = array();
        if (!empty($actiondata->content1)) {
            $config = trim($actiondata->content1);
            $values = explode("\n", $config);
            foreach ($values as $line) {
                $line_data = explode(":", trim($line));
                $source_value = $line_data[0];
                $target_data = $line_data[1];
                $target_options = explode(",", $target_data);
                foreach ($target_options as $target_option) {
                    $target_option_data = explode("=", $target_option);
                    $target_option_value = $target_option_data[0];
                    $dynamic_values[$source_value][$target_option_value] = $target_option_title = trim($target_option_data[1]);
                }
            }
        }
        $source_id = $params->get('source_dropdown_id', '');
        $target_id = $params->get('target_dropdown_id', '');
        if ((bool) $params->get('enable_ajax', 0) === true && empty($dynamic_values) || empty($source_id) || empty($target_id)) {
            return false;
        }
        ob_start();
        ?>
			window.addEvent('load', function() {
				$('<?php 
        echo $source_id;
        ?>
').addEvent('change', function(){
					<?php 
        if ((bool) $params->get('enable_ajax', 0) === false) {
            ?>
						<?php 
            foreach ($dynamic_values as $k => $dynamic_value) {
                ?>
							if($('<?php 
                echo $source_id;
                ?>
').get('value') == '<?php 
                echo $k;
                ?>
'){
								$('<?php 
                echo $target_id;
                ?>
').empty();
								<?php 
                foreach ($dynamic_value as $option_value => $option_title) {
                    ?>
									new Element('option', {'value': '<?php 
                    echo $option_value;
                    ?>
', 'text': '<?php 
                    echo $option_title;
                    ?>
'}).inject($('<?php 
                    echo $target_id;
                    ?>
'));
								<?php 
                }
                ?>
								$('<?php 
                echo $target_id;
                ?>
').fireEvent('change');
							}
						<?php 
            }
            ?>
					<?php 
        } else {
            ?>
						var load_req = new Request({
							url: 'index.php?option=com_chronoforms&chronoform=<?php 
            echo $form->form_name;
            ?>
&event=<?php 
            echo $params->get('ajax_event_name', '');
            ?>
',
							method: 'get',
							onRequest: function(){
								$('<?php 
            echo $target_id;
            ?>
').empty();
								new Element('option', {'value': '', 'text': 'Loading...'}).inject($('<?php 
            echo $target_id;
            ?>
'));
							},
							onSuccess: function(responseText){
								$('<?php 
            echo $target_id;
            ?>
').empty();
								var response_data = responseText.trim().split("\n");
								response_data.each(function(line){
									var line_data = line.split("=");
									new Element('option', {'value': line_data[0], 'text': line_data[1]}).inject($('<?php 
            echo $target_id;
            ?>
'));
								});
								$('<?php 
            echo $target_id;
            ?>
').fireEvent('change');
							},
							onFailure: function(){
								$('<?php 
            echo $target_id;
            ?>
').empty();
								new Element('option', {'value': '', 'text': 'Loading failed.'}).inject($('<?php 
            echo $target_id;
            ?>
'));
							}
						});
						load_req.send($('<?php 
            echo $source_id;
            ?>
').get('name')+'='+$('<?php 
            echo $source_id;
            ?>
').get('value'));
					<?php 
        }
        ?>
				});
			});
		<?php 
        $script = ob_get_clean();
        if ((bool) $form->form_params->get('dynamic_files', 0) === false) {
            $document->addScriptDeclaration("//<![CDATA[" . "\n" . $script . "\n" . "//]]>");
        } else {
            //load the action class
            $form->loadActionHelper('load_js');
            $CfactionLoadJsHelper = new CfactionLoadJsHelper();
            $JSactiondata = new stdClass();
            $JSactiondata->content1 = $script;
            $JSParams = new JParameter('');
            $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0));
            $JSactiondata->params = $JSParams->toString();
            $CfactionLoadJsHelper->load($form, $JSactiondata);
        }
    }
Exemplo n.º 7
0
<?php

/**
* CHRONOFORMS version 4.0
* Copyright (c) 2006 - 2011 Chrono_Man, ChronoEngine.com. All rights reserved.
* Author: Chrono_Man (ChronoEngine.com)
* @license		GNU/GPL
* Visit http://www.ChronoEngine.com for regular updates and information.
**/
/* Load the J! Framework */
define('_JEXEC', 1);
define('JPATH_BASE', realpath(dirname(__FILE__) . '/../../..'));
define('DS', DIRECTORY_SEPARATOR);
defined('_JEXEC') or die('Restricted access');
require_once JPATH_BASE . DS . 'includes' . DS . 'defines.php';
require_once JPATH_BASE . DS . 'includes' . DS . 'framework.php';
$mainframe = JFactory::getApplication('site');
$get = JRequest::get('get', JREQUEST_ALLOWRAW);
//load the action class
$action = 'load_js';
$actionFile = JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_chronoforms" . DS . 'form_actions' . DS . $action . DS . 'cfaction_' . $action . '.php';
if (file_exists($actionFile)) {
    require_once $actionFile;
}
$CfactionLoadJsHelper = new CfactionLoadJsHelper();
$output = $CfactionLoadJsHelper->secure_unserialize($get['code']);
//output the code
echo $output;