AAAAcfaction_iframe_request.php000066600000003136151375004150012146 0ustar00params); $document = JFactory::getDocument(); JHTML::_('behavior.mootools'); $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $cf_url = $uri->root(); $cf_url .= 'administrator/components/com_chronoforms/form_actions/iframe_request/'; $document->addScript($cf_url.'iFrameFormRequest.js'); //create the JS function ob_start(); ?> //form_name; ?> = new iFrameFormRequest('chronoform_form_name; ?>',{ onRequest: function(){ get('onrequest_fn'))) > 0){ echo trim($params->get('onrequest_fn')).";"; } ?> }, onComplete: function(response){ get('response_element_id'))) > 0): ?> document.id('get('response_element_id')); ?>').set('html',response); get('onsuccess_fn'))) > 0){ echo trim($params->get('onsuccess_fn')).";"; } ?> } }); }); //]]> addScriptDeclaration($script); } } ?>index.html000066600000000035151375004150006544 0ustar00 cfaction_iframe_request.ctp000066600000000212151375004150012135 0ustar00loadAction($form, $actiondata); ?>iframe_request.php000066600000001550151375004150010276 0ustar00 'redirect', 'title' => 'Redirect/Remote Submit'); var $details = array('title' => 'iFrame Request', 'tooltip' => 'Submit the form using a hidden iFrame, similar to AJAX and supports file uploading.'); function load($clear){ if($clear){ $action_params = array( 'enabled' => 0, 'response_element_id' => '', 'onrequest_fn' => '', 'onsuccess_fn' => '', ); } return array('action_params' => $action_params); } function run($form, $actiondata){ } } ?>iframe_request.ctp000066600000006266151375004150010306 0ustar00
iFrame Request
Header(array('settings' => 'Settings', 'advanced' => 'Advanced', 'help' => 'Help'), 'iframe_request_config_{n}'); ?> tabStart('settings'); ?> input('action_iframe_request_{n}_enabled_config', array('type' => 'select', 'label' => 'Enabel iFrame Request', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Enable the form to be submitted using a hidden iFrame.')); ?> input('action_iframe_request_{n}_response_element_id_config', array('type' => 'text', 'label' => "Response Element ID", 'class' => 'medium_input', 'smalldesc' => "The id of the element which will be loaded with the response string when the request is completed with success.")); ?> tabEnd(); ?> tabStart('advanced'); ?> input('action_iframe_request_{n}_onrequest_fn_config', array('type' => 'text', 'label' => "On Request Function name", 'class' => 'medium_input', 'smalldesc' => "A JS function name to run when the request is sent, please add the 2 brackets at the end, e.g: myfn()")); ?> input('action_iframe_request_{n}_onsuccess_fn_config', array('type' => 'text', 'label' => "On Success Function name", 'class' => 'medium_input', 'smalldesc' => "A JS function name to run when the request is completed successfully, please add the 2 brackets at the end, e.g: myfn()")); ?> tabEnd(); ?> tabStart('help'); ?>

tabEnd(); ?>
iFrameFormRequest.js000066600000003505151375004150010512 0ustar00/* --- description: This class gives you a method to upload files 'the ajax way' license: MIT-style authors: - Arian Stolwijk requires: [Class, Options, Events, Element, Element.Event, Element.Style] provides: [Element.iFrameFormRequest, iFrameFormRequest] ... */ /** * @author Arian Stolwijk * Idea taken from http://www.webtoolkit.info/ajax-file-upload.html */ var iFrameFormRequest = new Class({ Implements: [Options, Events], options: { /* onRequest: function(){}, onComplete: function(data){}, onFailure: function(){}, */ eventName: 'submit' }, initialize: function(form, options){ this.setOptions(options); var frameId = this.frameId = String.uniqueID(); var loading = false; this.form = document.id(form); this.formEvent = function(){ loading = true; this.fireEvent('request'); }.bind(this); this.iframe = new IFrame({ name: frameId, styles: { display: 'none' }, src: 'about:blank', events: { load: function(){ if (loading){ var doc = this.iframe.contentWindow.document; if (doc && doc.location.href != 'about:blank'){ this.fireEvent('complete', doc.body.innerHTML); } else { this.fireEvent('failure'); } loading = false; } }.bind(this) } }).inject(document.body); this.attach(); }, send: function(){ this.form.submit(); }, attach: function(){ this.target = this.form.get('target'); this.form.set('target', this.frameId) .addEvent(this.options.eventName, this.formEvent); }, detach: function(){ this.form.set('target', this.target) .removeEvent(this.options.eventName, this.formEvent); }, toElement: function(){ return this.iframe; } }); Element.implement('iFrameFormRequest', function(options){ this.store('iFrameFormRequest', new iFrameFormRequest(this, options)); return this; }); .htaccess000066600000000177151375004150006354 0ustar00 Order allow,deny Deny from all