コード例 #1
0
    function view()
    {
        global $ff_mospath, $ff_mossite, $database, $my;
        global $ff_config, $ff_version, $ff_comsite, $ff_otherparams;
        $is_mobile_type = '';
        if (trim($this->formrow->template_code_processed) == 'QuickMode') {
            if (isset($_GET['non_mobile']) && JRequest::getBool('non_mobile', 0)) {
                JFactory::getSession()->clear('com_breezingforms.mobile');
            } else {
                if (isset($_GET['mobile']) && JRequest::getBool('mobile', 0)) {
                    JFactory::getSession()->set('com_breezingforms.mobile', true);
                }
            }
            require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/Zend/Json/Decoder.php';
            require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/Zend/Json/Encoder.php';
            require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/crosstec/functions/helpers.php';
            $dataObject = Zend_Json::decode(base64_decode($this->formrow->template_code));
            $rootMdata = $dataObject['properties'];
            $is_device = false;
            $useragent = $_SERVER['HTTP_USER_AGENT'];
            if (JRequest::getVar('ff_applic', '') != 'mod_facileforms' && JRequest::getInt('ff_frame', 0) != 1 && bf_is_mobile()) {
                $is_device = true;
                $this->isMobile = isset($rootMdata['mobileEnabled']) && isset($rootMdata['forceMobile']) && $rootMdata['mobileEnabled'] && $rootMdata['forceMobile'] ? true : (isset($rootMdata['mobileEnabled']) && isset($rootMdata['forceMobile']) && $rootMdata['mobileEnabled'] && JFactory::getSession()->get('com_breezingforms.mobile', false) ? true : false);
            } else {
                $this->isMobile = false;
                if (isset($rootMdata['themebootstrapThemeEngine']) && $rootMdata['themebootstrapThemeEngine'] == 'bootstrap') {
                    $this->legacy_wrap = false;
                }
            }
            if ($is_device && isset($rootMdata['mobileEnabled']) && isset($rootMdata['forceMobile']) && $rootMdata['mobileEnabled'] && !$rootMdata['forceMobile']) {
                $is_mobile_type = 'choose';
            }
            if (!$this->isMobile || $this->isMobile && JRequest::getVar('ff_task', '') == 'submit') {
                // nothing
            } else {
                // transforming recaptcha into captcha due to compatibility on mobiles
                if ($this->isMobile) {
                    for ($i = 0; $i < $this->rowcount; $i++) {
                        $row = $this->rows[$i];
                        if ($row->type == "ReCaptcha") {
                            $this->rows[$i]->type = 'Captcha';
                            break;
                        }
                    }
                    ob_end_clean();
                    ob_start();
                    require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/crosstec/classes/BFQuickModeMobile.php';
                    $quickMode = new BFQuickModeMobile($this);
                    if (isset($rootMdata['mobileEnabled']) && isset($rootMdata['forceMobile']) && $rootMdata['mobileEnabled'] && $rootMdata['forceMobile']) {
                        $quickMode->forceMobileUrl = isset($rootMdata['forceMobileUrl']) ? $rootMdata['forceMobileUrl'] : 'index.php';
                    }
                }
            }
        }
        // CONTENTBUILDER BEGIN
        $cbResult = $this->cbCheckPermissions();
        $cbForm = $cbResult['form'];
        $cbRecord = $cbResult['record'];
        $cbFrontend = $cbResult['frontend'];
        $cbFull = $cbResult['full'];
        // CONTENTBUILDER END
        $database = JFactory::getDBO();
        $mainframe = JFactory::getApplication();
        if (!$this->okrun) {
            return;
        }
        set_error_handler('_ff_errorHandler');
        ob_start();
        echo $this->header();
        $this->queryCols = array();
        $this->queryRows = array();
        if ($this->runmode == _FF_RUNMODE_PREVIEW) {
            echo '<script type="text/javascript" src="' . JURI::root() . 'administrator/components/com_breezingforms/libraries/wz_dragdrop/wz_dragdrop.js"></script>';
        }
        if (trim($this->formrow->template_code_processed) == 'QuickMode' && $this->legacy_wrap) {
            echo '<table style="display:none;width:100%;" border="" id="bfReCaptchaWrap"><tr><td><div id="bfReCaptchaDiv"></div></td></tr></table>';
        }
        echo '<div id="ff_formdiv' . $this->form . '"';
        echo ' class="bfFormDiv' . ($this->formrow->class1 != '' ? ' ' . $this->getClassName($this->formrow->class1) : '') . '"';
        if ($this->legacy_wrap) {
            echo '><div class="bfPage-tl"><div class="bfPage-tr"><div class="bfPage-t"></div></div></div><div class="bfPage-l"><div class="bfPage-r"><div class="bfPage-m bfClearfix">' . nl();
        } else {
            echo '>';
        }
        $this->status = JRequest::getCmd('ff_status', '');
        $this->message = JRequest::getVar('ff_message', '');
        // handle Before Form piece
        $code = '';
        switch ($this->formrow->piece1cond) {
            case 1:
                // library
                $database->setQuery('select name, code from #__facileforms_pieces ' . 'where id=' . $this->formrow->piece1id . ' and published=1 ');
                $rows = $database->loadObjectList();
                if (count($rows)) {
                    echo $this->execPiece($rows[0]->code, BFText::_('COM_BREEZINGFORMS_PROCESS_BFPIECE') . " " . $rows[0]->name, 'p', $this->formrow->piece1id, null);
                }
                break;
            case 2:
                // custom code
                echo $this->execPiece($this->formrow->piece1code, BFText::_('COM_BREEZINGFORMS_PROCESS_BFPIECEC'), 'f', $this->form, 2);
                break;
            default:
                break;
        }
        // switch
        if ($this->bury()) {
            return;
        }
        $cntFiles = 0;
        $fileExtensionsCheck = 'function checkFileExtensions(){';
        for ($i = 0; $i < $this->rowcount; $i++) {
            $row = $this->rows[$i];
            if ($row->type == 'File Upload' && trim($this->formrow->template_code) != '') {
                if (trim($row->data2) != '') {
                    $exts = explode(',', $row->data2);
                    $extsCount = count($exts);
                    $fileExtensionsCheck .= 'var ff_elem' . $row->id . 'Exts = false;';
                    for ($x = 0; $x < $extsCount; $x++) {
                        $fileExtensionsCheck .= '
							if(!ff_elem' . $row->id . 'Exts && document.getElementById("ff_elem' . $row->id . '").value.toLowerCase().lastIndexOf(".' . strtolower(trim($exts[$x])) . '") != -1){
								ff_elem' . $row->id . 'Exts = true;
							}else if(!ff_elem' . $row->id . 'Exts && document.getElementById("ff_elem' . $row->id . '").value == ""){
								ff_elem' . $row->id . 'Exts = true;
							}';
                    }
                    $fileExtensionsCheck .= '
					if(!ff_elem' . $row->id . 'Exts){
						if(typeof bfUseErrorAlerts == "undefined"){
							alert("' . addslashes(BFText::_('COM_BREEZINGFORMS_FILE_EXTENSION_NOT_ALLOWED')) . '");
						} else {
							bfShowErrors("' . addslashes(BFText::_('COM_BREEZINGFORMS_FILE_EXTENSION_NOT_ALLOWED')) . '");
						}
						if(ff_currentpage != ' . $row->page . ')ff_switchpage(' . $row->page . ');
                                                if(document.getElementById("bfSubmitButton")){
                                                    document.getElementById("bfSubmitButton").disabled = false;
                                                }
						return false;
					}
					';
                    $cntFiles++;
                }
            }
        }
        $fileExtensionsCheck .= '
			return true;
		}
		';
        $capFunc = 'function bfCheckCaptcha(){if(checkFileExtensions())ff_submitForm2();}';
        for ($i = 0; $i < $this->rowcount; $i++) {
            $row = $this->rows[$i];
            if ($row->type == "Captcha") {
                $capFunc = '

				function bfAjaxObject101() {
					this.createRequestObject = function() {
						try {
							var ro = new XMLHttpRequest();
						}
						catch (e) {
							var ro = new ActiveXObject("Microsoft.XMLHTTP");
						}
						return ro;
					}
					this.sndReq = function(action, url, data) {
						if (action.toUpperCase() == "POST") {
							this.http.open(action,url,true);
							this.http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
							this.http.onreadystatechange = this.handleResponse;
							this.http.send(data);
						}
						else {
							this.http.open(action,url + "?" + data,true);
							this.http.onreadystatechange = this.handleResponse;
							this.http.send(null);
						}
					}
					this.handleResponse = function() {
						if ( me.http.readyState == 4) {
							if (typeof me.funcDone == "function") { me.funcDone();}
							var rawdata = me.http.responseText.split("|");
							for ( var i = 0; i < rawdata.length; i++ ) {
								var item = (rawdata[i]).split("=>");
								if (item[0] != "") {
									if (item[1].substr(0,3) == "%V%" ) {
										document.getElementById(item[0]).value = item[1].substring(3);
									}
									else {
										if(item[1] == "true"){
                                                                                    if(typeof bfDoFlashUpload != \'undefined\'){
                                                                                        bfDoFlashUpload();
                                                                                    } else {
									   		ff_submitForm2();
                                                                                    }
									   } else {
                                                                                if(typeof JQuery != "undefined" && JQuery("#bfSubmitMessage"))
									        {
                                                                                    JQuery("#bfSubmitMessage").css("visibility","hidden");
									        }
                                                                                if(typeof bfUseErrorAlerts == "undefined"){
                                                                                    alert("' . addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')) . '");
									        } else {
                                                                                   if(typeof inlineErrorElements != "undefined"){
                                                                                     inlineErrorElements.push(["bfCaptchaEntry","' . addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')) . '"]);
                                                                                   }
									           bfShowErrors("' . addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')) . '");
									        }
											document.getElementById(\'ff_capimgValue\').src = \'' . JURI::root(true) . (JFactory::getApplication()->isAdmin() ? '/administrator' : '') . '/components/com_breezingforms/images/captcha/securimage_show.php?bfMathRandom=\' + Math.random();
											document.getElementById(\'bfCaptchaEntry\').value = "";
											if(ff_currentpage != ' . $row->page . ')ff_switchpage(' . $row->page . ');
											document.getElementById(\'bfCaptchaEntry\').focus();
                                                                                        if(document.getElementById("bfSubmitButton")){
                                                                                            document.getElementById("bfSubmitButton").disabled = false;
                                                                                        }
										}
                                                                                
									}
								}
							}
						}
						if ((me.http.readyState == 1) && (typeof me.funcWait == "function")) { me.funcWait(); }
					}
					var me = this;
					this.http = this.createRequestObject();

					var funcWait = null;
					var funcDone = null;
				}

				function bfCheckCaptcha(){
					if(checkFileExtensions()){
                                               var ao = new bfAjaxObject101();
                                               ao.sndReq("get","' . JURI::root(true) . (JFactory::getApplication()->isAdmin() ? '/administrator/' : (BFJoomlaConfig::get('config.sef') && !BFJoomlaConfig::get('config.sef_rewrite') ? '/index.php/' : '/') . (JRequest::getCmd('lang', '') && BFJoomlaConfig::get('config.sef') ? JRequest::getCmd('lang', '') . (BFJoomlaConfig::get('config.sef_rewrite') ? '/index.php' : '/') : 'index.php')) . '?lang=' . JRequest::getCmd('lang', '') . '&raw=true&option=com_breezingforms&checkCaptcha=true&Itemid=0&tmpl=component&value="+document.getElementById("bfCaptchaEntry").value,"");
					}
				}';
                break;
            } else {
                if ($row->type == "ReCaptcha") {
                    $capFunc = 'var bfReCaptchaLoaded = true;
                                    function bfCheckCaptcha(){
					if(checkFileExtensions()){
                                                function bfValidateCaptcha()
                                                {
                                                    challengeField = JQuery("input#recaptcha_challenge_field").val();
                                                    responseField = JQuery("input#recaptcha_response_field").val();
                                                    var html = JQuery.ajax({
                                                    type: "POST",
                                                    url: "' . JURI::root(true) . (JFactory::getApplication()->isAdmin() ? '/administrator/' : (BFJoomlaConfig::get('config.sef') && !BFJoomlaConfig::get('config.sef_rewrite') ? '/index.php/' : '/') . (JRequest::getCmd('lang', '') && BFJoomlaConfig::get('config.sef') ? JRequest::getCmd('lang', '') . (BFJoomlaConfig::get('config.sef_rewrite') ? '/index.php' : '/') : 'index.php')) . '?lang=' . JRequest::getCmd('lang', '') . '&raw=true&option=com_breezingforms&bfReCaptcha=true&form=' . $this->form . '&Itemid=0&tmpl=component",
                                                    data: "recaptcha_challenge_field=" + challengeField + "&recaptcha_response_field=" + responseField,
                                                    async: false
                                                    }).responseText;

                                                    if (html.replace(/^\\s+|\\s+$/, "") == "success")
                                                    {
                                                        if(typeof bfDoFlashUpload != \'undefined\'){
                                                            bfDoFlashUpload();
                                                        } else {
                                                            ff_submitForm2();
                                                        }
                                                    }
                                                    else
                                                    {
                                                            if(typeof bfUseErrorAlerts == "undefined"){
                                                                    alert("' . addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')) . '");
                                                            } else {
                                                                if(typeof inlineErrorElements != "undefined"){
                                                                    inlineErrorElements.push(["bfReCaptchaEntry","' . addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')) . '"]);
                                                                }
                                                                bfShowErrors("' . addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')) . '");
                                                            }

                                                            if(ff_currentpage != ' . $row->page . ')ff_switchpage(' . $row->page . ');
                                                            Recaptcha.focus_response_field();

                                                            Recaptcha.reload();
                                                            
                                                            if(document.getElementById("bfSubmitButton")){
                                                                document.getElementById("bfSubmitButton").disabled = false;
                                                            }
                                                    }
                                                }

                                                bfValidateCaptcha();

					}
				}';
                }
            }
        }
        echo '<script type="text/javascript">' . nl() . '<!--' . nl() . '' . nl() . $fileExtensionsCheck . $capFunc;
        // create library list
        $library = array();
        $this->loadBuiltins($library);
        $this->loadScripts($library);
        // start linking
        $linked = array();
        if ($this->status == '') {
            $code = "onload = function()" . nl() . "{" . nl() . "    ff_initialize('formentry');" . nl() . "    ff_initialize('pageentry');" . nl();
            if ($this->formrow->heightmode) {
                $code .= "    ff_resizepage(" . $this->formrow->heightmode . ", " . $this->formrow->height . ");" . nl();
            }
            if ($this->showgrid) {
                $code .= "    ff_showgrid();" . nl();
            }
            $code .= "    if (ff_processor && ff_processor.traceBuffer) ff_traceWindow();" . nl() . "} // onload";
            $this->linkcode('onload', $library, $linked, $code);
        } else {
            $funcname = "";
            switch ($this->formrow->script2cond) {
                case 1:
                    $database->setQuery("select name from #__facileforms_scripts " . "where id=" . $this->formrow->script2id . " and published=1 ");
                    $funcname = $database->loadResult();
                    break;
                case 2:
                    $funcname = "ff_" . $this->formrow->name . "_submitted";
                    break;
                default:
                    break;
            }
            // switch
            if ($funcname != '' || $this->formrow->heightmode || $this->showgrid) {
                $code = "onload = function()" . nl() . "{" . nl();
                if ($this->formrow->heightmode) {
                    $code .= "    ff_resizepage(" . $this->formrow->heightmode . ", " . $this->formrow->height . ");" . nl();
                }
                if ($this->showgrid) {
                    $code .= "    ff_showgrid();" . nl();
                }
                if ($funcname != '') {
                    $code .= "    " . $funcname . "(" . $this->status . ",\"" . str_replace("\n", '', str_replace("\r", '', stripcslashes($this->message))) . "\");" . nl();
                }
                $code .= "} // onload";
                $this->linkcode('onload', $library, $linked, $code);
            }
            // if
        }
        // if
        if ($this->bury()) {
            return;
        }
        // add form scripts
        $this->addFunction($this->formrow->script1cond, $this->formrow->script1id, 'ff_' . $this->formrow->name . '_init', $this->formrow->script1code, $library, $linked, 'f', $this->form, 1);
        if ($this->bury()) {
            return;
        }
        $this->addFunction($this->formrow->script2cond, $this->formrow->script2id, 'ff_' . $this->formrow->name . '_submitted', $this->formrow->script2code, $library, $linked, 'f', $this->form, 1);
        if ($this->bury()) {
            return;
        }
        // all element scripts & static text/HTML
        $icons = 0;
        $tooltips = 0;
        $qcheckboxes = 0;
        $qcode = '';
        for ($i = 0; $i < $this->rowcount; $i++) {
            $row =& $this->rows[$i];
            $this->draggableDivIds[] = 'ff_div' . $row->id;
            if ($row->type == "Icon") {
                $icons++;
            }
            if ($row->type == "Tooltip") {
                $tooltips++;
            }
            if ($row->type == "Query List") {
                if ($row->flag2) {
                    $qcheckboxes++;
                }
                // load column definitions
                $this->queryCols['ff_' . $row->id] = array();
                $cols =& $this->queryCols['ff_' . $row->id];
                if ($this->trim($row->data3)) {
                    $cls = explode("\n", $row->data3);
                    for ($c = 0; $c < count($cls); $c++) {
                        if ($cls[$c] != '') {
                            $col = '';
                            // instead of unset
                            $col = new facileFormsQuerycols();
                            $col->unpack($cls[$c]);
                            $this->compileQueryCol($row, $col);
                            $cols[] = $col;
                        }
                        // if
                    }
                    // for
                }
                // if
                $colcnt = count($cols);
                $checkbox = 0;
                if ($row->flag2) {
                    $checkbox = $row->flag2;
                }
                $header = 0;
                if ($row->flag1) {
                    $header = 1;
                }
                // get pagenav
                $pagenav = 1;
                $settings = explode("\n", $row->data1);
                if (count($settings) > 8 && $this->trim($settings[8])) {
                    $pagenav = $settings[8];
                }
                // export the javascript parameters
                $qcode .= nl() . 'ff_queryCurrPage[' . $row->id . '] = 1;' . nl() . 'ff_queryPageSize[' . $row->id . '] = ' . $row->height . ';' . nl() . 'ff_queryCheckbox[' . $row->id . '] = ' . $checkbox . ';' . nl() . 'ff_queryHeader[' . $row->id . '] = ' . $header . ';' . nl() . 'ff_queryPagenav[' . $row->id . '] = ' . $pagenav . ';' . nl() . 'ff_queryCols[' . $row->id . '] = [';
                for ($c = 0; $c < $colcnt; $c++) {
                    if ($cols[$c]->thspan > 0) {
                        $qcode .= '1';
                    } else {
                        $qcode .= '0';
                    }
                    if ($c < $colcnt - 1) {
                        $qcode .= ',';
                    }
                }
                // for
                $qcode .= '];' . nl();
                // execute the query and export it to javascript
                $this->queryRows['ff_' . $row->id] = array();
                $this->execQuery($row, $this->queryRows['ff_' . $row->id], $cols);
                $qcode .= 'ff_queryRows[' . $row->id . '] = ' . $this->expJsValue($this->queryRows['ff_' . $row->id]) . ';' . nl();
                unset($cols);
                if ($this->bury()) {
                    return;
                }
            }
            // if
            $this->addFunction($row->script1cond, $row->script1id, 'ff_' . $row->name . '_init', $row->script1code, $library, $linked, 'e', $row->id, 1);
            if ($this->bury()) {
                unset($row);
                return;
            }
            $this->addFunction($row->script2cond, $row->script2id, 'ff_' . $row->name . '_action', $row->script2code, $library, $linked, 'e', $row->id, 1);
            if ($this->bury()) {
                unset($row);
                return;
            }
            $this->addFunction($row->script3cond, $row->script3id, 'ff_' . $row->name . '_validate', $row->script3code, $library, $linked, 'e', $row->id, 1);
            if ($this->bury()) {
                ob_end_clean();
                return;
            }
            if ($row->type == 'Static Text/HTML') {
                $this->linkcode('#scanonly', $library, $linked, $row->data1);
            }
            unset($row);
            if ($this->bury()) {
                return;
            }
        }
        // for
        if ($icons > 0) {
            $this->linkcode('ff_hideIconBorder', $library, $linked, 'function ff_hideIconBorder(element)' . nl() . '{' . nl() . '    element.style.border = "none";' . nl() . '} // ff_hideIconBorder');
            if ($this->bury()) {
                return;
            }
            $this->linkcode('ff_dispIconBorder', $library, $linked, 'function ff_dispIconBorder(element)' . nl() . '{' . nl() . '    element.style.border = "1px outset";' . nl() . '} // ff_dispIconBorder');
            if ($this->bury()) {
                return;
            }
        }
        // if
        if ($qcode != '') {
            $library[] = array('ff_queryCurrPage', 'var ff_queryCurrPage = new Array();');
            $library[] = array('ff_queryPageSize', 'var ff_queryPageSize = new Array();');
            $library[] = array('ff_queryCols', 'var ff_queryCols = new Array();');
            $library[] = array('ff_queryCheckbox', 'var ff_queryCheckbox = new Array();');
            $library[] = array('ff_queryHeader', 'var ff_queryHeader = new Array();');
            $library[] = array('ff_queryPagenav', 'var ff_queryPagenav = new Array();');
            $library[] = array('ff_queryRows', 'var ff_queryRows = new Array();' . nl() . $qcode);
            $library[] = array('ff_selectAllQueryRows', 'function ff_selectAllQueryRows(id,checked)' . nl() . '{' . nl() . '    if (!ff_queryCheckbox[id]) return;' . nl() . '    var cnt = ff_queryRows[id].length;' . nl() . '    var pagesize = ff_queryPageSize[id];' . nl() . '    if (pagesize > 0) {' . nl() . '        lastpage = parseInt((cnt+pagesize-1)/pagesize);' . nl() . '        if (lastpage == 1)' . nl() . '           pagesize = cnt;' . nl() . '        else {' . nl() . '            var currpage = ff_queryCurrPage[id];' . nl() . '            var p;' . nl() . '            for (p = 1; p < currpage; p++) cnt -= pagesize;' . nl() . '            if (cnt > pagesize) cnt = pagesize;' . nl() . '        } // if' . nl() . '    } // if' . nl() . '    var curr;' . nl() . '    for (curr = 0; curr < cnt; curr++)' . nl() . '        document.getElementById(\'ff_cb\'+id+\'_\'+curr).checked = checked;' . nl() . '    for (curr = cnt; curr < pagesize; curr++)' . nl() . '        document.getElementById(\'ff_cb\'+id+\'_\'+curr).checked = false;' . nl() . '    if (ff_queryCheckbox[id]==1)' . nl() . '        document.getElementById(\'ff_cb\'+id).checked = checked;' . nl() . '} // ff_selectAllQueryRows');
            $code = 'function ff_dispQueryPage(id,page)' . nl() . '{' . nl() . '    var forced = false;' . nl() . '    if (arguments.length>2) forced = arguments[2];' . nl() . '    var qrows = ff_queryRows[id];' . nl() . '    var cnt = qrows.length;' . nl() . '    var currpage = ff_queryCurrPage[id];' . nl() . '    var pagesize = ff_queryPageSize[id];' . nl() . '    var pagenav = ff_queryPagenav[id];' . nl() . '    var lastpage = 1;' . nl() . '    if (pagesize > 0) {' . nl() . '        lastpage = parseInt((cnt+pagesize-1)/pagesize);' . nl() . '        if (lastpage == 1) pagesize = cnt;' . nl() . '    } // if' . nl() . '    if (page < 1) page = 1;' . nl() . '    if (page > lastpage) page = lastpage;' . nl() . '    if (!forced && page == currpage) return;' . nl() . '    var p, c;' . nl() . '    for (p = 1; p < page; p++) cnt -= pagesize;' . nl() . '    if (cnt > pagesize) cnt = pagesize;' . nl() . '    var start = (page-1) * pagesize;' . nl() . '    var rows = document.getElementById(\'ff_elem\'+id).rows;' . nl() . '    var cols = ff_queryCols[id];' . nl() . '    var checkbox = ff_queryCheckbox[id];' . nl() . '    var header = ff_queryHeader[id];' . nl() . '    for (p = 0; p < cnt; p++) {' . nl() . '        var qrow = qrows[start+p];' . nl() . '        var row = rows[header+p];' . nl() . '        var cc = 0;' . nl() . '        for (c = 0; c < cols.length; c++)' . nl() . '            if (cols[c]) {' . nl() . '                if (c==0 && checkbox>0) {' . nl() . '                    document.getElementById(\'ff_cb\'+id+\'_\'+p).value = qrow[c];' . nl() . '                    cc++;' . nl() . '                } else' . nl() . '                    row.cells[cc++].innerHTML = qrow[c];' . nl() . '            } // if' . nl() . '        row.style.display = \'\';' . nl() . '    } // for' . nl() . '    for (p = cnt; p < pagesize; p++) {' . nl() . '        var row = rows[p+header];' . nl() . '        row.style.display = \'none\';' . nl() . '    } // for' . nl() . '    if (pagenav > 0 && pagesize > 0) {' . nl() . '        var navi = \'\';' . nl() . '        if (pagenav<=4) {' . nl() . '            if (page>1) navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',1);">\';' . nl() . '            navi += \'&lt;&lt;\';' . nl() . '            if (pagenav<=2) navi += \' ' . BFText::_('COM_BREEZINGFORMS_PROCESS_PAGESTART') . '\';' . nl() . '            if (page>1) navi += \'<\\/a>\';' . nl() . '            navi += \' \';' . nl() . '            if (page>1) navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',\'+(page-1)+\');">\';' . nl() . '            navi += \'&lt;\';' . nl() . '            if (pagenav<=2) navi += \' ' . BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEPREV') . '\';' . nl() . '            if (page>1) navi += \'<\\/a>\';' . nl() . '            navi += \' \';' . nl() . '        } // if' . nl() . '        if (pagenav % 2) {' . nl() . '            for (p = 1; p <= lastpage; p++)' . nl() . '                if (p == page) ' . nl() . '                    navi += p+\' \';' . nl() . '                else' . nl() . '                    navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',\'+p+\');">\'+p+\'<\\/a> \';' . nl() . '        } // if' . nl() . '        if (pagenav<=4) {' . nl() . '            if (page<lastpage) navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',\'+(page+1)+\');">\';' . nl() . '            if (pagenav<=2) navi += \'' . BFText::_('COM_BREEZINGFORMS_PROCESS_PAGENEXT') . ' \';' . nl() . '            navi += \'&gt;\';' . nl() . '            if (page<lastpage) navi += \'<\\/a>\';' . nl() . '            navi += \' \';' . nl() . '            if (page<lastpage) navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',\'+lastpage+\');">\';' . nl() . '            if (pagenav<=2) navi += \'' . BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEEND') . ' \';' . nl() . '            navi += \'&gt;&gt;\';' . nl() . '            if (page<lastpage) navi += \'<\\/a>\';' . nl() . '        } // if' . nl() . '        rows[header+pagesize].cells[0].innerHTML = navi;' . nl() . '    } // if' . nl() . '    ff_queryCurrPage[id] = page;' . nl();
            if ($qcheckboxes) {
                $code .= '    if (checkbox) ff_selectAllQueryRows(id, false);' . nl();
            }
            if ($this->formrow->heightmode > 0) {
                $code .= '    ff_resizepage(' . $this->formrow->heightmode . ', ' . $this->formrow->height . ');' . nl();
            }
            if ($this->inframe) {
                $code .= '    parent.window.scrollTo(0,0);' . nl();
            }
            $code .= '    window.scrollTo(0,0);' . nl() . '} // ff_dispQueryPage';
            $this->linkcode('ff_dispQueryPage', $library, $linked, $code);
            if ($this->bury()) {
                return;
            }
        }
        // if
        echo '//-->' . nl() . '</script>' . nl();
        if ($icons > 0) {
            echo '<script language="JavaScript" src="' . $ff_mossite . '/components/com_breezingforms/libraries/js/joomla.javascript.js" type="text/javascript"></script>' . nl();
        }
        if ($tooltips > 0) {
            echo '<script language="Javascript" src="' . $ff_mossite . '/components/com_breezingforms/libraries/js/overlib_mini.js" type="text/javascript"></script>' . nl();
            if ($this->inframe) {
                echo '<div id="overDiv" style="position:absolute;visibility:hidden;z-index:1000;"></div>' . nl();
            }
        }
        // if
        if (!$this->inline) {
            $url = $this->inframe ? $ff_mossite . '/index.php?format=html&tmpl=component' : ($this->runmode == _FF_RUNMODE_FRONTEND ? JURI::getInstance()->toString() : 'index.php?format=html' . (JRequest::getCmd('tmpl', '') ? '&tmpl=' . JRequest::getCmd('tmpl', '') : JURI::getInstance()->toString()));
            $params = ' action="' . $url . '"' . ' method="post"' . ' name="' . $this->form_id . '"' . ' id="' . $this->form_id . '"' . ' enctype="multipart/form-data"';
            if ($this->formrow->class2 != '') {
                $params .= ' class="' . $this->getClassName($this->formrow->class2) . '"';
            }
            echo '<form data-ajax="false" ' . $params . ' accept-charset="utf-8" onsubmit="return false;" class="bfQuickMode">' . nl();
        }
        // if
        $js = '';
        $cbJs = '';
        if ($this->editable && $cbRecord === null) {
            $db = JFactory::getDBO();
            $db->setQuery("Select id, form From #__facileforms_records Where form = " . $db->Quote($this->form) . " And user_id = " . $db->Quote(JFactory::getUser()->get('id', -1)) . " And user_id <> 0 And archived = 0 Order By id Desc Limit 1");
            $recordsResult = $db->loadObjectList();
            if (count($recordsResult) != 0) {
                $db->setQuery("Select * From #__facileforms_subrecords Where record = " . $recordsResult[0]->id . "");
                $recordEntries = $db->loadObjectList();
                $js = '';
                foreach ($recordEntries as $recordEntry) {
                    switch ($recordEntry->type) {
                        case 'Textarea':
                        case 'Text':
                        case 'Hidden Input':
                        case 'Calendar':
                            $js .= 'if(typeof JQuery != "undefined"){JQuery("[name=\\"ff_nm_' . $recordEntry->name . '[]\\"]").val("' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($recordEntry->value))) . '");}else{';
                            $js .= 'if(document.getElementById("ff_elem' . $recordEntry->element . '"))document.getElementById("ff_elem' . $recordEntry->element . '").value="' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($recordEntry->value))) . '";' . "\n";
                            $js .= '}';
                            break;
                        case 'Checkbox':
                            if (!empty($recordEntry->value)) {
                                $js .= 'if(document.getElementById("ff_elem' . $recordEntry->element . '"))document.getElementById("ff_elem' . $recordEntry->element . '").checked = true;' . "\n";
                            }
                            break;
                        case 'Checkbox Group':
                            $js .= '
							for(var i = 0;i < document.ff_form' . $this->form . '.elements.length;i++){
								if(document.ff_form' . $this->form . '.elements[i].type == "checkbox" && document.ff_form' . $this->form . '.elements[i].name == "ff_nm_' . $recordEntry->name . '[]" && document.ff_form' . $this->form . '.elements[i].value == "' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($recordEntry->value))) . '"){
									document.ff_form' . $this->form . '.elements[i].checked = true;
								}
							}' . "\n";
                            break;
                        case 'Radio Button':
                        case 'Radio Group':
                            $js .= '
							for(var i = 0;i < document.ff_form' . $this->form . '.elements.length;i++){
								if(document.ff_form' . $this->form . '.elements[i].type == "radio" && document.ff_form' . $this->form . '.elements[i].name == "ff_nm_' . $recordEntry->name . '[]" && document.ff_form' . $this->form . '.elements[i].value == "' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($recordEntry->value))) . '"){
									document.ff_form' . $this->form . '.elements[i].checked = true;
								}
							}' . "\n";
                            break;
                        case 'Select List':
                            $js .= 'for(var i = 0; i < document.getElementById("ff_elem' . $recordEntry->element . '").options.length; i++){
								if(document.getElementById("ff_elem' . $recordEntry->element . '").options[i].value == "' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($recordEntry->value))) . '"){
									document.getElementById("ff_elem' . $recordEntry->element . '").options[i].selected = true;
								}
							}' . "\n";
                            break;
                    }
                }
                echo '
				<script type="text/javascript">
                                <!--' . nl() . '
                                function bfLoadEditable(){
                                    ' . $js . '
                                    // legacy seccode removal
                                    for(var i = 0;i < document.ff_form' . $this->form . '.elements.length;i++){
                                            if(document.ff_form' . $this->form . '.elements[i].name == "ff_nm_seccode[]"){
                                                    document.ff_form' . $this->form . '.elements[i].value = "";
                                            }
                                    }
                                }
                                ' . nl() . '//-->
				</script>
				' . nl();
            }
        }
        // CONTENTBUILDER BEGIN
        if ($cbRecord !== null) {
            require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php';
            $cbNonEditableFields = contentbuilder::getListNonEditableElements($cbResult['data']['id']);
            $cbFlashUploadValidationOverride = '';
            foreach ($cbRecord as $cbEntry) {
                if (!in_array($cbEntry->recElementId, $cbNonEditableFields)) {
                    switch ($cbEntry->recType) {
                        case 'File Upload':
                            if (trim($this->formrow->template_code_processed) == 'QuickMode') {
                                if ($cbFlashUploadValidationOverride == '') {
                                    $cbJs .= '
                                            function ff_flashupload_not_empty(element, message)
                                            {
                                                if(typeof bfSummarizers == "undefined") { alert("Flash upload validation only available in QuickMode!"); return ""}
                                                if(JQuery("#bfFlashFileQueue"+element.id.split("ff_elem")[1]).html() != "" || cbFlashElemCnt[element.id] != 0 ) return "";
                                                if (message=="") message = "Please enter "+element.name+".\\n";
                                                ff_validationFocus(element.name);
                                                return message;
                                            }
                                            ';
                                }
                                require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'contentbuilder_helpers.php';
                                $cbOut = '';
                                $cbFiles = explode("\n", str_replace("\r", "", $cbEntry->recValue));
                                $i = 0;
                                $cnt = count($cbFiles);
                                $cbJs .= '
                                    cbFlashElemCnt["ff_elem' . $cbEntry->recElementId . '"] = ' . $cnt . ';
                                ';
                                $cbDeac = '';
                                foreach ($cbFiles as $cbFile) {
                                    if (trim($cbFile)) {
                                        $cbOut .= '<div><input type=\\"checkbox\\" onchange=\\"bfCheckUploadValidation(\'ff_elem' . $cbEntry->recElementId . '\', this, \'ff_nm_' . $cbEntry->recName . '[]\')\\" value=\\"1\\" name=\\"cb_delete_' . $cbEntry->recElementId . '[' . $i . ']\\" id=\\"cb_delete_' . $cbEntry->recElementId . '_' . $i . '\\"/> <label style=\\"margin-left: 5px; float: none !important; display: inline !important;\\" for=\\"cb_delete_' . $cbEntry->recElementId . '_' . $i . '\\">' . addslashes(basename(contentbuilder_wordwrap($cbFile, 150, "<br>", true))) . '</label></div>';
                                        if ($cbDeac == '') {
                                            $cbDeac = 'bfDeactivateField["ff_nm_' . $cbEntry->recName . '[]"]=true;' . nl();
                                        }
                                        $i++;
                                    }
                                }
                                $js .= $cbDeac;
                                $js .= '
                                                    if (document.createTextNode){
                                                        if(!document.getElementById("bfFlashFileQueue' . $cbEntry->recElementId . '")){
                                                           var mydiv = document.createElement("div");
                                                           mydiv.innerHTML = "<br/>' . $cbOut . '";
                                                           JQuery("#ff_elem' . $cbEntry->recElementId . '_files").append(mydiv);
                                                        } else {
                                                           var mydiv = document.createElement("div");
                                                           mydiv.innerHTML = "' . $cbOut . '";
                                                           mydiv.innerHTML = "<br/>" + mydiv.innerHTML;
                                                           JQuery("#bfFlashFileQueue' . $cbEntry->recElementId . '").after(mydiv);
                                                        }
                                                    }' . nl();
                            }
                            break;
                        case 'Textarea':
                        case 'Text':
                        case 'Hidden Input':
                        case 'Calendar':
                            $js .= 'if(typeof JQuery != "undefined"){';
                            $js .= 'JQuery("[name=\\"ff_nm_' . $cbEntry->recName . '[]\\"]").val("' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($cbEntry->recValue))) . '")';
                            $js .= '}else{if(document.getElementById("ff_elem' . $cbEntry->recElementId . '"))document.getElementById("ff_elem' . $cbEntry->recElementId . '").value="' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($cbEntry->recValue))) . '";}' . nl();
                            break;
                        case 'Checkbox':
                        case 'Checkbox Group':
                            $cbValues = explode(',', $cbEntry->recValue);
                            foreach ($cbValues as $cbValue) {
                                $cbValue = trim($cbValue);
                                $js .= '
                                                for(var i = 0;i < document.ff_form' . $this->form . '.elements.length;i++){
                                                        if(document.ff_form' . $this->form . '.elements[i].type == "checkbox" && document.ff_form' . $this->form . '.elements[i].name == "ff_nm_' . $cbEntry->recName . '[]" && document.ff_form' . $this->form . '.elements[i].value == "' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($cbValue))) . '"){
                                                                document.ff_form' . $this->form . '.elements[i].checked = true;
                                                        }
                                                }' . nl();
                            }
                            break;
                        case 'Radio Button':
                        case 'Radio Group':
                            $cbValues = explode(',', $cbEntry->recValue);
                            foreach ($cbValues as $cbValue) {
                                $cbValue = trim($cbValue);
                                $js .= '
                                                for(var i = 0;i < document.ff_form' . $this->form . '.elements.length;i++){
                                                        if(document.ff_form' . $this->form . '.elements[i].type == "radio" && document.ff_form' . $this->form . '.elements[i].name == "ff_nm_' . $cbEntry->recName . '[]" && document.ff_form' . $this->form . '.elements[i].value == "' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($cbValue))) . '"){
                                                                document.ff_form' . $this->form . '.elements[i].checked = true;
                                                        }
                                                }' . nl();
                            }
                            break;
                        case 'Select List':
                            $cbValues = explode(',', $cbEntry->recValue);
                            foreach ($cbValues as $cbValue) {
                                $cbValue = trim($cbValue);
                                $js .= 'for(var i = 0; i < document.getElementById("ff_elem' . $cbEntry->recElementId . '").options.length; i++){
                                                        if(document.getElementById("ff_elem' . $cbEntry->recElementId . '").options[i].value == "' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($cbValue))) . '"){
                                                                document.getElementById("ff_elem' . $cbEntry->recElementId . '").options[i].selected = true;
                                                        }
                                                }' . nl();
                            }
                            break;
                    }
                }
            }
            echo '
                    <script type="text/javascript">
                    <!--' . nl() . '
                    var cbFlashElemCnt = new Array();
                    function bfCheckUploadValidation(id, obj, deactivatable){
                        if(obj.checked){
                            cbFlashElemCnt[id]--;
                        }else{
                            cbFlashElemCnt[id]++;
                        }
                        if(cbFlashElemCnt[id] == 0){
                            bfDeactivateField[deactivatable]=false;
                        }else{
                            bfDeactivateField[deactivatable]=true;
                        }
                    }
                    ' . $cbJs . '
                    function bfLoadContentBuilderEditable(){
                        ' . $js . '
                        // legacy seccode removal
                        for(var i = 0;i < document.ff_form' . $this->form . '.elements.length;i++){
                                if(document.ff_form' . $this->form . '.elements[i].name == "ff_nm_seccode[]"){
                                        document.ff_form' . $this->form . '.elements[i].value = "";
                                }
                        }
                    }
                    ' . nl() . '//-->
                    </script>
                    ' . nl();
        }
        $cbNonEditableFields = array();
        if ($cbForm !== null) {
            require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php';
            $cbNonEditableFields = contentbuilder::getListNonEditableElements($cbResult['data']['id']);
            if (count($cbNonEditableFields)) {
                JFactory::getDocument()->addScriptDeclaration('<!--' . nl() . 'var bfDeactivateField = new Array();' . nl() . '//-->');
                echo '<script type="text/javascript">' . nl();
                echo '<!--' . nl();
                echo 'function bfDisableContentBuilderFields(){' . nl();
            }
            foreach ($cbNonEditableFields as $cbNonEditableField) {
                echo 'if(typeof document.getElementById("ff_elem' . $cbNonEditableField . '").disabled != "undefined"){' . nl();
                echo 'bfCbName = document.getElementById("ff_elem' . $cbNonEditableField . '").name;' . nl();
                echo 'if(typeof document.getElementsByName != "undefined"){' . nl();
                echo 'bfCbElements = document.getElementsByName(bfCbName);' . nl();
                echo 'for(var i = 0; i < bfCbElements.length; i++){' . nl();
                echo 'if(typeof bfCbElements[i].disabled != "undefined"){' . nl();
                echo 'bfCbElements[i].disabled = true;' . nl();
                echo '}' . nl();
                echo 'bfDeactivateField[bfCbName]=true;' . nl();
                echo 'if(typeof JQuery != "undefined"){ JQuery("#bfElemWrap' . $cbNonEditableField . '").css("display", "none"); }' . nl();
                echo '}' . nl();
                echo '}else{' . nl();
                echo 'document.getElementById("ff_elem' . $cbNonEditableField . '").disabled = true;' . nl();
                echo 'bfDeactivateField[bfCbName]=true;' . nl();
                echo 'if(typeof JQuery != "undefined"){ JQuery("#bfElemWrap' . $cbNonEditableField . '").css("display", "none"); }' . nl();
                echo '}' . nl();
                echo '}' . nl();
            }
            if (count($cbNonEditableFields)) {
                echo '}' . nl();
                echo '//-->' . nl();
                echo '</script>' . nl();
            }
        }
        // CONTENTBUILDER END
        if (trim($this->formrow->template_code_processed) == '') {
            for ($i = 0; $i < $this->rowcount; $i++) {
                $row =& $this->rows[$i];
                if (!is_numeric($row->width)) {
                    $row->width = 0;
                }
                if (!is_numeric($row->height)) {
                    $row->height = 0;
                }
                if ($row->type != 'Query List') {
                    $data1 = $this->replaceCode($row->data1, "data1 of {$row->name}", 'e', $row->id, 0);
                    if ($this->bury()) {
                        return;
                    }
                    $data2 = $this->replaceCode($row->data2, "data2 of {$row->name}", 'e', $row->id, 0);
                    if ($this->bury()) {
                        return;
                    }
                    $data3 = $this->replaceCode($row->data3, "data3 of {$row->name}", 'e', $row->id, 0);
                    if ($this->bury()) {
                        return;
                    }
                }
                // if
                $attribs = 'position:absolute;z-index:' . $i . ';';
                if ($row->posx >= 0) {
                    $attribs .= 'left:' . $row->posx;
                } else {
                    $attribs .= 'right:' . -$row->posx;
                }
                if ($row->posxmode) {
                    $attribs .= '%;';
                } else {
                    $attribs .= 'px;';
                }
                if ($row->posy >= 0) {
                    $attribs .= 'top:' . $row->posy;
                } else {
                    $attribs .= 'bottom:' . -$row->posy;
                }
                if ($row->posymode) {
                    $attribs .= '%;';
                } else {
                    $attribs .= 'px;';
                }
                $class1 = '';
                $class2 = '';
                if ($row->type == 'Select List') {
                    if ($row->class1 != '') {
                        $class1 = ' class="' . $this->getClassName($row->class1) . '"';
                    }
                    if ($row->class2 != '') {
                        $class2 = ' class="' . $this->getClassName($row->class2) . ' chzn-done"';
                    } else {
                        $class2 = ' class="chzn-done"';
                    }
                } else {
                    if ($row->class1 != '') {
                        $class1 = ' class="' . $this->getClassName($row->class1) . '"';
                    }
                    if ($row->class2 != '') {
                        $class2 = ' class="' . $this->getClassName($row->class2) . '"';
                    }
                }
                switch ($row->type) {
                    case 'Static Text/HTML':
                    case 'Rectangle':
                    case 'Image':
                        if ($row->height > 0) {
                            $attribs .= 'height:' . $row->height;
                            if ($row->heightmode) {
                                $attribs .= '%;';
                            } else {
                                $attribs .= 'px;';
                            }
                        }
                        // if
                    // if
                    case 'Query List':
                        if ($row->width > 0) {
                            $attribs .= 'width:' . $row->width;
                            if ($row->widthmode) {
                                $attribs .= '%;';
                            } else {
                                $attribs .= 'px;';
                            }
                        }
                        // if
                    // if
                    default:
                        break;
                }
                // switch
                if ($row->page != $this->page) {
                    $attribs .= 'visibility:hidden;';
                }
                switch ($row->type) {
                    case 'Static Text/HTML':
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . $data1 . '</div>' . nl();
                        break;
                    case 'Rectangle':
                        if ($data1 != '') {
                            $attribs .= 'border:' . $data1 . ';';
                        }
                        if ($data2 != '') {
                            $attribs .= 'background-color:' . $data2 . ';';
                        }
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="font-size:0px;' . $attribs . '"' . $class1 . '></div>' . nl();
                        break;
                    case 'Image':
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc();
                        $attribs = '';
                        if ($row->width > 0) {
                            $attribs .= 'width="' . $row->width . '" ';
                        }
                        if ($row->height > 0) {
                            $attribs .= 'height="' . $row->height . '" ';
                        }
                        echo indentc(2) . '<img id="ff_elem' . $row->id . '" src="' . $data1 . '"  alt="' . $data2 . '" border="0" ' . $attribs . $class2 . '/>' . nlc();
                        echo indentc(1) . '</div>' . nl();
                        break;
                    case 'Tooltip':
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '" onMouseOver="return overlib(\'' . expstring($data2) . '\',CAPTION,\'' . $row->title . '\',BELOW,RIGHT);" onMouseOut="return nd();"' . $class1 . '>' . nlc();
                        switch ($row->flag1) {
                            case 0:
                                $url = $ff_mossite . '/components/com_breezingforms/images/tooltip.png';
                                break;
                            case 1:
                                $url = $ff_mossite . '/components/com_breezingforms/images/warning.png';
                                break;
                            default:
                                $url = $data1;
                        }
                        // switch
                        echo indentc(2) . '<img src="' . $url . '" alt="" border="0"' . $class2 . '/>' . nlc();
                        echo indentc(1) . '</div>' . nl();
                        break;
                    case 'Hidden Input':
                        echo indentc(1) . '<input id="ff_elem' . $row->id . '" type="hidden" name="ff_nm_' . $row->name . '[]" value="' . $data1 . '" />' . nl();
                        break;
                    case 'Checkbox':
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc();
                        $attribs = '';
                        if ($row->flag1) {
                            $attribs .= ' checked="checked"';
                        }
                        if ($row->flag2) {
                            $attribs .= ' disabled="disabled"';
                        }
                        $attribs .= $this->script2clause($row);
                        echo indentc(2) . '<input id="ff_elem' . $row->id . '" type="checkbox" name="ff_nm_' . $row->name . '[]" value="' . $data1 . '"' . $attribs . $class2 . '/><label id="ff_lbl' . $row->id . '" for="ff_elem' . $row->id . '"> ' . $data2 . '</label>' . nlc();
                        echo indentc(1) . '</div>' . nl();
                        break;
                    case 'Radio Button':
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc();
                        $attribs = '';
                        if ($row->flag1) {
                            $attribs .= ' checked="checked"';
                        }
                        if ($row->flag2) {
                            $attribs .= ' disabled="disabled"';
                        }
                        $attribs .= $this->script2clause($row);
                        echo indentc(2) . '<input id="ff_elem' . $row->id . '" type="radio" name="ff_nm_' . $row->name . '[]" value="' . $data1 . '"' . $attribs . $class2 . '/><label id="ff_lbl' . $row->id . '" for="ff_elem' . $row->id . '"> ' . $data2 . '</label>' . nlc();
                        echo indentc(1) . '</div>' . nl();
                        break;
                    case 'Regular Button':
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc();
                        $attribs = '';
                        if ($row->flag2) {
                            $attribs .= ' disabled="disabled"';
                        }
                        $attribs .= $this->script2clause($row);
                        echo indentc(2) . '<input id="ff_elem' . $row->id . '" type="button" name="ff_nm_' . $row->name . '" value="' . $data2 . '"' . $attribs . $class2 . '/>' . nlc();
                        echo indentc(1) . '</div>' . nl();
                        break;
                    case 'Graphic Button':
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc();
                        $attribs = '';
                        if ($row->flag2) {
                            $attribs .= ' disabled="disabled"';
                        }
                        $attribs .= $this->script2clause($row);
                        echo indentc(2) . '<button id="ff_elem' . $row->id . '" type="button" name="ff_nm_' . $row->name . '" value="' . $data2 . '"' . $attribs . $class2 . '>' . nlc();
                        $attribs = '';
                        if ($row->width > 0) {
                            $attribs .= 'width="' . $row->width . '" ';
                        }
                        if ($row->height > 0) {
                            $attribs .= 'height="' . $row->height . '" ';
                        }
                        switch ($row->flag1) {
                            case 0:
                                // none
                                echo indentc(3) . '<table cellpadding="0" cellspacing="6" border="0">' . nlc();
                                echo indentc(4) . '<tr><td>' . nlc();
                                echo indentc(5) . '<img id="ff_img' . $row->id . '" src="' . $data1 . '"  alt="' . $data2 . '" border="0" ' . $attribs . '/>' . nlc();
                                echo indentc(4) . '</td></tr>' . nlc();
                                echo indentc(3) . '</table>' . nlc();
                                break;
                            case 1:
                                // below
                                echo indentc(3) . '<table cellpadding="0" cellspacing="6" border="0">' . nlc();
                                echo indentc(4) . '<tr><td nowrap style="text-align:center">' . nlc();
                                echo indentc(5) . '<img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" ' . $attribs . '/><br/>' . nlc();
                                echo indentc(5) . $data2 . nlc();
                                echo indentc(4) . '</td></tr>' . nlc();
                                echo indentc(3) . '</table>' . nlc();
                                break;
                            case 2:
                                // above
                                echo indentc(3) . '<table cellpadding="0" cellspacing="6" border="0">' . nlc();
                                echo indentc(4) . '<tr><td nowrap style="text-align:center">' . nlc();
                                echo indentc(5) . $data2 . '<br/>' . nlc();
                                echo indentc(5) . '<img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" ' . $attribs . '/>' . nlc();
                                echo indentc(4) . '</td></tr>' . nlc();
                                echo indentc(3) . '</table>.nlc()';
                                break;
                            case 3:
                                // left
                                echo indentc(3) . '<table cellpadding="0" cellspacing="6" border="0">' . nlc();
                                echo indentc(4) . '<tr>' . nlc();
                                echo indentc(5) . '<td>' . $data2 . '</td>' . nlc();
                                echo indentc(5) . '<td><img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" ' . $attribs . '/></td>' . nlc();
                                echo indentc(4) . '</tr>' . nlc();
                                echo indentc(3) . '</table>' . nlc();
                                break;
                            default:
                                // assume right
                                echo indentc(3) . '<table cellpadding="0" cellspacing="6" border="0">' . nlc();
                                echo indentc(4) . '<tr>' . nlc();
                                echo indentc(5) . '<td><img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" ' . $attribs . '/></td>' . nlc();
                                echo indentc(5) . '<td>' . $data2 . '</td>' . nlc();
                                echo indentc(4) . '</tr>' . nlc();
                                echo indentc(3) . '</table>' . nlc();
                                break;
                        }
                        // switch
                        echo indentc(2) . '</button>' . nlc();
                        echo indentc(1) . '</div>' . nl();
                        break;
                    case 'Icon':
                        if ($row->flag2) {
                            echo indentc(1) . '<div id="ff_div' . $row->id . '" onmouseout="ff_hideIconBorder(this);" onmouseover="ff_dispIconBorder(this);" style="padding:3px;' . $attribs . '"' . $class1 . '>' . nlc();
                        } else {
                            echo indentc(1) . '<div id="ff_div' . $row->id . '"  style="' . $attribs . '"' . $class1 . '>' . nlc();
                        }
                        $swap = '';
                        if ($data3 != '') {
                            $swap = 'onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage(\'ff_img' . $row->id . '\',\'\',\'' . $data3 . '\',1);" ';
                        }
                        $swap .= $this->script2clause($row);
                        $attribs = '';
                        if ($row->width > 0) {
                            $attribs .= 'width="' . $row->width . '" ';
                        }
                        if ($row->height > 0) {
                            $attribs .= 'height="' . $row->height . '" ';
                        }
                        switch ($row->flag1) {
                            case 0:
                                // none
                                echo indentc(2) . '<span id="ff_elem' . $row->id . '" ' . $swap . '>' . nlc();
                                echo indentc(3) . '<img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" align="middle" ' . $attribs . $class2 . '/>' . nlc();
                                echo indentc(2) . '</span>' . nlc();
                                break;
                            case 1:
                                // below
                                echo indentc(2) . '<table id="ff_elem' . $row->id . '" cellpadding="1" cellspacing="0" border="0" ' . $swap . '>' . nlc();
                                echo indentc(3) . '<tr><td style="text-align:center;"><img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" align="middle" ' . $attribs . $class2 . '/></td></tr>' . nlc();
                                echo indentc(3) . '<tr><td style="text-align:center;">' . $data2 . '</td></tr>' . nlc();
                                echo indentc(2) . '</table>' . nlc();
                                break;
                            case 2:
                                // above
                                echo indentc(2) . '<table id="ff_elem' . $row->id . '" cellpadding="2" cellspacing="0" border="0" ' . $swap . '>' . nlc();
                                echo indentc(3) . '<tr><td style="text-align:center;">' . $data2 . '</td></tr>' . nlc();
                                echo indentc(3) . '<tr><td style="text-align:center;"><img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" align="middle" ' . $attribs . $class2 . '/></td></tr>' . nlc();
                                echo indentc(2) . '</table>' . nlc();
                                break;
                            case 3:
                                // left
                                echo indentc(2) . '<span id="ff_elem' . $row->id . '" ' . $swap . ' style="vertical-align:middle;">' . nlc();
                                echo indentc(3) . $data2 . ' &nbsp;<img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" align="middle" ' . $attribs . $class2 . '/>' . nlc();
                                echo indentc(2) . '</span>' . nlc();
                                break;
                            default:
                                // assume right
                                echo indentc(2) . '<span id="ff_elem' . $row->id . '" ' . $swap . ' style="vertical-align:middle;">' . nlc();
                                echo indentc(3) . '<img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" align="middle" ' . $attribs . $class2 . '/>&nbsp; ' . $data2 . nlc();
                                echo indentc(2) . '</span>' . nlc();
                                break;
                        }
                        // switch
                        echo indentc(1) . '</div>' . nl();
                        break;
                    case 'Select List':
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc();
                        $attribs = '';
                        $styles = '';
                        if ($row->width > 0) {
                            $styles .= 'width:' . $row->width . 'px;';
                        }
                        if ($row->height > 0) {
                            $styles .= 'height:' . $row->height . 'px;';
                        }
                        if ($row->flag1) {
                            $attribs .= ' multiple="multiple"';
                        }
                        if ($row->flag2) {
                            $attribs .= ' disabled="disabled"';
                        }
                        $attribs .= $this->script2clause($row);
                        if ($data1 != '') {
                            $attribs .= ' size="' . $data1 . '"';
                        }
                        if ($styles != '') {
                            $attribs .= ' style="' . $styles . '"';
                        }
                        echo indentc(2) . '<select id="ff_elem' . $row->id . '" name="ff_nm_' . $row->name . '[]" ' . $attribs . $class2 . '>' . nlc();
                        $options = explode('\\n', preg_replace('/([\\r\\n])/s', '\\n', $data2));
                        $cnt = count($options);
                        for ($o = 0; $o < $cnt; $o++) {
                            $opt = explode(";", $options[$o]);
                            $selected = '';
                            switch (count($opt)) {
                                case 0:
                                    break;
                                case 1:
                                    if ($this->trim($opt[0])) {
                                        $selected = '0';
                                        $value = $text = $opt[0];
                                    }
                                    // if
                                    break;
                                case 2:
                                    $selected = $opt[0];
                                    $value = $text = $opt[1];
                                    break;
                                default:
                                    $selected = $opt[0];
                                    $text = $opt[1];
                                    $value = $opt[2];
                            }
                            // switch
                            if ($this->trim($selected)) {
                                $attribs = '';
                                if ($this->trim($value)) {
                                    if ($value == '""' || $value == "''") {
                                        $value = '';
                                    }
                                    $attribs .= ' value="' . htmlspecialchars($value, ENT_QUOTES) . '"';
                                }
                                // if
                                if ($selected == 1) {
                                    $attribs .= ' selected="selected"';
                                }
                                echo indentc(3) . '<option' . $attribs . '>' . htmlspecialchars(trim($text), ENT_QUOTES) . '</option>' . nlc();
                            }
                            // if
                        }
                        // for
                        echo indentc(2) . '</select>' . nlc();
                        echo indentc(1) . '</div>' . nl();
                        break;
                    case 'Text':
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc();
                        $attribs = '';
                        if ($row->width > 0) {
                            if ($row->widthmode > 0) {
                                $attribs .= ' style="width:' . $row->width . 'px;"';
                            } else {
                                $attribs .= ' size="' . $row->width . '"';
                            }
                        }
                        // if
                        if ($row->height > 0) {
                            $attribs .= ' maxlength="' . $row->height . '"';
                        }
                        if ($row->flag1) {
                            $attribs .= ' type="password"';
                        } else {
                            $attribs .= ' type="text"';
                        }
                        switch ($row->flag2) {
                            case 1:
                                $attribs .= ' disabled="disabled"';
                                break;
                            case 2:
                                $attribs .= ' readonly="readonly"';
                                break;
                            default:
                                break;
                        }
                        // switch
                        $attribs .= $this->script2clause($row);
                        echo indentc(2) . '<input id="ff_elem' . $row->id . '"' . $attribs . ' name="ff_nm_' . $row->name . '[]" value="' . $data1 . '"' . $class2 . '/>' . nlc();
                        echo indentc(1) . '</div>' . nl();
                        break;
                    case 'Textarea':
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc();
                        $attribs = '';
                        $styles = '';
                        switch ($row->flag2) {
                            case 1:
                                $attribs .= ' disabled="disabled"';
                                break;
                            case 2:
                                $attribs .= ' readonly="readonly"';
                                break;
                            default:
                                break;
                        }
                        // switch
                        if ($row->width > 0) {
                            if ($row->widthmode > 0) {
                                $styles .= 'width:' . $row->width . 'px;';
                            } else {
                                $attribs .= ' cols="' . $row->width . '"';
                            }
                        }
                        // if
                        if ($row->height > 0) {
                            if ($row->heightmode > 0) {
                                $styles .= 'height:' . $row->height . 'px;';
                            } else {
                                $height = $row->height;
                                if ($height > 1 && stristr($this->browser, 'mozilla')) {
                                    $height--;
                                }
                                $attribs .= ' rows="' . $height . '"';
                            }
                            // if
                        }
                        // if
                        if ($styles != '') {
                            $attribs .= ' style="' . $styles . '"';
                        }
                        $attribs .= $this->script2clause($row);
                        echo indentc(2) . '<textarea id="ff_elem' . $row->id . '" name="ff_nm_' . $row->name . '[]"' . $attribs . $class2 . '>' . $data1 . '</textarea>' . nlc();
                        echo indentc(1) . '</div>' . nl();
                        break;
                    case 'File Upload':
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc();
                        $attribs = '';
                        if ($row->width > 0) {
                            $attribs .= ' size="' . $row->width . '"';
                        }
                        if ($row->height > 0) {
                            $attribs .= ' maxlength="' . $row->height . '"';
                        }
                        if ($row->flag2) {
                            $attribs .= ' disabled="disabled"';
                        }
                        if ($row->data2 != '') {
                            $attribs .= ' accept="' . $data2 . '"';
                        }
                        $attribs .= $this->script2clause($row);
                        echo indentc(2) . '<input id="ff_elem' . $row->id . '"' . $attribs . ' type="file" name="ff_nm_' . $row->name . '[]"' . $class2 . '/>' . nlc();
                        echo indentc(1) . '</div>' . nl();
                        break;
                    case 'Captcha':
                        if (JFactory::getApplication()->isSite()) {
                            $captcha_url = JURI::root(true) . '/components/com_breezingforms/images/captcha/securimage_show.php';
                        } else {
                            $captcha_url = JURI::root(true) . '/administrator/components/com_breezingforms/images/captcha/securimage_show.php';
                        }
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc();
                        $attribs = '';
                        if ($row->width > 0) {
                            $attribs .= 'width:' . $row->width . 'px;';
                        }
                        if ($row->height > 0) {
                            $attribs .= 'height:' . $row->height . 'px;';
                        }
                        echo '<img id="ff_capimgValue" class="ff_capimg" src="' . $captcha_url . '"/>';
                        echo '<br/>';
                        echo '<input type="text" style="' . $attribs . '" name="bfCaptchaEntry" id="bfCaptchaEntry" />';
                        //echo '<br/>';
                        echo '<a href="#" onclick="document.getElementById(\'bfCaptchaEntry\').value=\'\';document.getElementById(\'bfCaptchaEntry\').focus();document.getElementById(\'ff_capimgValue\').src = \'' . $captcha_url . '?bfCaptcha=true&bfMathRandom=\' + Math.random(); return false"><img src="' . JURI::root() . 'components/com_breezingforms/images/captcha/refresh-captcha.png" border="0" /></a>';
                        echo indentc(1) . '</div>' . nl();
                        break;
                    case 'Query List':
                        echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc();
                        // unpack settings
                        $settings = explode("\n", $row->data1);
                        $scnt = count($settings);
                        for ($s = 0; $s < $scnt; $s++) {
                            $this->trim($settings[$s]);
                        }
                        $trhclass = '';
                        $tr1class = '';
                        $tr2class = '';
                        $trfclass = '';
                        $tdfclass = '';
                        $pagenav = 1;
                        $attribs = '';
                        if ($scnt > 0 && $settings[0] != '') {
                            $attribs .= ' border="' . $settings[0] . '"';
                        }
                        if ($scnt > 1 && $settings[1] != '') {
                            $attribs .= ' cellspacing="' . $settings[1] . '"';
                        }
                        if ($scnt > 2 && $settings[2] != '') {
                            $attribs .= ' cellpadding="' . $settings[2] . '"';
                        }
                        if ($scnt > 3 && $settings[3] != '') {
                            $trhclass = ' class="' . $this->getClassName($settings[3]) . '"';
                        }
                        if ($scnt > 4 && $settings[4] != '') {
                            $tr1class = ' class="' . $this->getClassName($settings[4]) . '"';
                        }
                        if ($scnt > 5 && $settings[5] != '') {
                            $tr2class = ' class="' . $this->getClassName($settings[5]) . '"';
                        }
                        if ($scnt > 6 && $settings[6] != '') {
                            $trfclass = ' class="' . $this->getClassName($settings[6]) . '"';
                        }
                        if ($scnt > 7 && $settings[7] != '') {
                            $tdfclass = ' class="' . $this->getClassName($settings[7]) . '"';
                        }
                        if ($scnt > 8 && $settings[8] != '') {
                            $pagenav = $settings[8];
                        }
                        if ($row->width > 0) {
                            $attribs .= ' width="100%"';
                        }
                        // display 1st page of table
                        echo indentc(2) . '<table id="ff_elem' . $row->id . '"' . $attribs . $class2 . '>' . nl();
                        $cols =& $this->queryCols['ff_' . $row->id];
                        $colcnt = count($cols);
                        // display header
                        if ($row->flag1) {
                            echo indentc(3) . '<tr' . $trhclass . '>' . nlc();
                            $skip = 0;
                            for ($c = 0; $c < $colcnt; $c++) {
                                if ($skip > 0) {
                                    $skip--;
                                } else {
                                    $col =& $cols[$c];
                                    if ($col->thspan > 0) {
                                        $attribs = '';
                                        $style = '';
                                        switch ($col->thalign) {
                                            case 1:
                                                $style .= 'text-align:left;';
                                                break;
                                            case 2:
                                                $style .= 'text-align:center;';
                                                break;
                                            case 3:
                                                $style .= 'text-align:right;';
                                                break;
                                            case 4:
                                                $style .= 'text-align:justify;';
                                                break;
                                            default:
                                        }
                                        // switch
                                        switch ($col->thvalign) {
                                            case 1:
                                                $attribs .= ' valign="top"';
                                                break;
                                            case 2:
                                                $attribs .= ' valign="middle"';
                                                break;
                                            case 3:
                                                $attribs .= ' valign="bottom"';
                                                break;
                                            case 4:
                                                $attribs .= ' valign="baseline"';
                                                break;
                                            default:
                                        }
                                        // switch
                                        if ($col->thwrap == 1) {
                                            $attribs .= ' nowrap="nowrap"';
                                        }
                                        if ($col->thspan > 1) {
                                            $attribs .= ' colspan="' . $col->thspan . '"';
                                            $skip = $col->thspan - 1;
                                        }
                                        // if
                                        if ($col->class1 != '') {
                                            $attribs .= ' class="' . $this->getClassName($col->class1) . '"';
                                        }
                                        if (intval($col->width) > 0 && !$skip) {
                                            $style .= 'width:' . $col->width;
                                            if ($col->widthmd) {
                                                $style .= '%;';
                                            } else {
                                                $style .= 'px;';
                                            }
                                        }
                                        // if
                                        if ($style != '') {
                                            $attribs .= ' style="' . $style . '"';
                                        }
                                        if ($c == 0 && $row->flag2 > 0) {
                                            if ($row->flag2 == 1) {
                                                echo indentc(4) . '<th' . $attribs . '><input type="checkbox" id="ff_cb' . $row->id . '" onclick="ff_selectAllQueryRows(' . $row->id . ',this.checked);" /></th>' . nlc();
                                            } else {
                                                echo indentc(4) . '<th' . $attribs . '></th>' . nlc();
                                            }
                                        } else {
                                            echo indentc(4) . '<th' . $attribs . '>' . $this->replaceCode($col->title, BFText::_('COM_BREEZINGFORMS_PROCESS_QTITLEOF') . " {$row->name}::{$col->name}", 'e', $row->id, 2) . '</th>' . nlc();
                                        }
                                    }
                                    // if
                                    unset($col);
                                }
                            }
                            // if
                            echo indentc(3) . '</tr>' . nl();
                        }
                        // if
                        // display data rows
                        $qrows =& $this->queryRows['ff_' . $row->id];
                        $qcnt = count($qrows);
                        $k = 1;
                        if ($row->height > 0 && $qcnt > $row->height) {
                            $qcnt = $row->height;
                        }
                        for ($q = 0; $q < $qcnt; $q++) {
                            $qrow =& $qrows[$q];
                            if ($k == 1) {
                                $cl = $tr1class;
                            } else {
                                $cl = $tr2class;
                            }
                            echo indentc(3) . '<tr' . $cl . '>' . nlc();
                            $skip = 0;
                            for ($c = 0; $c < $colcnt; $c++) {
                                $col =& $cols[$c];
                                if ($col->thspan > 0) {
                                    $attribs = '';
                                    $style = '';
                                    switch ($col->align) {
                                        case 1:
                                            $style .= 'text-align:left;';
                                            break;
                                        case 2:
                                            $style .= 'text-align:center;';
                                            break;
                                        case 3:
                                            $style .= 'text-align:right;';
                                            break;
                                        case 4:
                                            $style .= 'text-align:justify;';
                                            break;
                                        default:
                                    }
                                    // switch
                                    switch ($col->valign) {
                                        case 1:
                                            $attribs .= ' valign="top"';
                                            break;
                                        case 2:
                                            $attribs .= ' valign="middle"';
                                            break;
                                        case 3:
                                            $attribs .= ' valign="bottom"';
                                            break;
                                        case 4:
                                            $attribs .= ' valign="baseline"';
                                            break;
                                        default:
                                    }
                                    // switch
                                    if ($col->wrap == 1) {
                                        $attribs .= ' nowrap="nowrap"';
                                    }
                                    if ($k == 1) {
                                        $cl = $col->class2;
                                    } else {
                                        $cl = $col->class3;
                                    }
                                    if ($cl != '') {
                                        $attribs .= ' class="' . $this->getClassName($cl) . '"';
                                    }
                                    if (!$skip && $col->thspan > 1) {
                                        $skip = $col->thspan;
                                    }
                                    if ($skip && $q == 0) {
                                        if (intval($col->width) > 0) {
                                            $style .= 'width:' . $col->width;
                                            if ($col->widthmd) {
                                                $style .= '%;';
                                            } else {
                                                $style .= 'px;';
                                            }
                                        }
                                    }
                                    // if
                                    if ($skip > 0) {
                                        $skip--;
                                    }
                                    if ($style != '') {
                                        $attribs .= ' style="' . $style . '"';
                                    }
                                    if ($c == 0 && $row->flag2 > 0) {
                                        if ($row->flag2 == 1) {
                                            echo indentc(4) . '<td' . $attribs . '><input type="checkbox" id="ff_cb' . $row->id . '_' . $q . '" value="' . $qrow[$c] . '"  name="ff_nm_' . $row->name . '[]"/></td>' . nlc();
                                        } else {
                                            echo indentc(4) . '<td' . $attribs . '><input type="radio" id="ff_cb' . $row->id . '_' . $q . '" value="' . $qrow[$c] . '"  name="ff_nm_' . $row->name . '[]"/></td>' . nlc();
                                        }
                                    } else {
                                        echo indentc(4) . '<td' . $attribs . '>' . $qrow[$c] . '</td>' . nlc();
                                    }
                                }
                                // if
                                unset($col);
                                if ($this->dying) {
                                    break;
                                }
                            }
                            // for
                            echo indentc(3) . '</tr>' . nl();
                            $k = 3 - $k;
                            unset($qrow);
                            if ($this->dying) {
                                break;
                            }
                        }
                        // for
                        if ($this->bury()) {
                            return;
                        }
                        // display footer
                        if ($row->height > 0 && $pagenav > 0) {
                            $span = 0;
                            for ($c = 0; $c < $colcnt; $c++) {
                                if ($cols[$c]->thspan > 0) {
                                    $span++;
                                }
                            }
                            $pages = intval((count($qrows) + $row->height - 1) / $row->height);
                            echo indentc(3) . '<tr' . $trfclass . '>' . nlc();
                            echo indentc(4) . '<td colspan="' . $span . '"' . $tdfclass . '>' . nlc();
                            if ($pages > 1) {
                                echo indentc(5);
                                if ($pagenav <= 4) {
                                    echo '&lt;&lt; ';
                                }
                                if ($pagenav <= 2) {
                                    echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGESTART') . ' ';
                                }
                                if ($pagenav <= 4) {
                                    echo '&lt; ';
                                }
                                if ($pagenav <= 2) {
                                    echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEPREV') . ' ';
                                }
                                echo nlc();
                                if ($pagenav % 2) {
                                    echo indentc(5);
                                    echo '1 ';
                                    for ($p = 2; $p <= $pages; $p++) {
                                        echo indentc(5) . '<a href="javascript:ff_dispQueryPage(' . $row->id . ',' . $p . ');">' . $p . '</a> ' . nlc();
                                    }
                                    echo nlc();
                                }
                                // if
                                if ($pagenav <= 4) {
                                    echo indentc(5) . '<a href="javascript:ff_dispQueryPage(' . $row->id . ',2);">';
                                    if ($pagenav <= 2) {
                                        echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGENEXT') . ' ';
                                    }
                                    echo '&gt;</a> ' . nlc();
                                    echo indentc(5) . '<a href="javascript:ff_dispQueryPage(' . $row->id . ',' . $pages . ');">';
                                    if ($pagenav <= 2) {
                                        echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEEND') . ' ';
                                    }
                                    echo '&gt;&gt;</a>' . nlc();
                                }
                                // if
                            }
                            // if
                            echo indentc(4) . '</td>' . nlc();
                            echo indentc(3) . '</tr>' . nl();
                        }
                        // if
                        // table end
                        echo indentc(2) . '</table>' . nlc();
                        echo indentc(1) . '</div>' . nl();
                        unset($qrows);
                        unset($cols);
                        break;
                    default:
                        break;
                }
                // switch
                unset($row);
            }
            // for
        } else {
            if (trim($this->formrow->template_code_processed) == 'QuickMode') {
                if ($this->isMobile) {
                    // nothing
                } else {
                    if (isset($rootMdata['themebootstrapThemeEngine']) && $rootMdata['themebootstrapThemeEngine'] == 'bootstrap') {
                        require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/crosstec/classes/BFQuickModeBootstrap.php';
                        $quickMode = new BFQuickModeBootstrap($this);
                        $this->quickmode = $quickMode;
                    } else {
                        require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/crosstec/classes/BFQuickMode.php';
                        $quickMode = new BFQuickMode($this);
                        $this->quickmode = $quickMode;
                    }
                }
                if ($is_mobile_type == 'choose') {
                    $return_url = JURI::getInstance()->toString();
                    $return_url = strstr($return_url, '?non_mobile=1') !== false ? str_replace('?non_mobile=1', '', $return_url) : str_replace('&non_mobile=1', '', $return_url);
                    $return_url = $return_url . (strstr($return_url, '?') !== false ? '&' : '?') . 'mobile=1';
                    echo '<div style="display: block; text-align: center;"><button class="ff_elem btn btn-primary" onclick="location.href=\'' . $return_url . '\';"><span>' . JText::_('COM_BREEZINGFORMS_MOBILE_VERSION') . '</span></button></div><div></div>';
                }
                $quickMode->render();
            } else {
                // case if forms done with the easy mode
                // always load calendar
                JHTML::_('behavior.calendar');
                echo '
			<style type="text/css">
			ul.droppableArea, ul.droppableArea li { background-image: none; list-style: none; }
			li.ff_listItem { width: auto; list-style: none; }
			li.ff_listItem .ff_div { width: auto; float: left; }
			.ff_label { outline: none; }
			.ff_elem { float: left; }
			.ff_dragBox { display: none; }
			</style>
			' . nl();
                echo $this->formrow->template_code_processed;
                $visPages = '';
                $pagesSize = isset($this->formrow->pages) ? intval($this->formrow->pages) : 1;
                for ($pageCnt = 1; $pageCnt <= $pagesSize; $pageCnt++) {
                    $visPages .= 'if(document.getElementById("bfPage' . $pageCnt . '"))document.getElementById("bfPage' . $pageCnt . '").style.display = "none";';
                }
                echo '<script type="text/javascript">
                              <!--
				' . $visPages . ';
				if(document.getElementById("bfPage' . $this->page . '"))document.getElementById("bfPage' . $this->page . '").style.display = "";
                              //-->
                              </script>' . nl();
            }
        }
        if ($this->editable) {
            echo '<script type="text/javascript"><!--' . nl() . 'if(typeof bfLoadEditable != "undefined") { bfLoadEditable(); }' . nl() . '//--></script>' . nl();
        }
        if ($cbRecord !== null) {
            echo '<script type="text/javascript"><!--' . nl() . 'bfLoadContentBuilderEditable();' . nl() . '//--></script>' . nl();
        }
        if ($cbForm !== null && count($cbNonEditableFields)) {
            echo '<script type="text/javascript"><!--' . nl() . 'bfDisableContentBuilderFields();' . nl() . '//--></script>' . nl();
        }
        // CONTENTBUILDER
        // writing hidden input for groups. helps on recording updates, otherwise no value would be transferred.
        // the "cbGroupMark" won't be stored.
        if ($cbForm !== null) {
            for ($i = 0; $i < $this->rowcount; $i++) {
                $row = $this->rows[$i];
                switch ($row->type) {
                    case 'Checkbox':
                    case 'Checkbox Group':
                    case 'Radio Button':
                    case 'Radio Group':
                    case 'Select List':
                        // temporary removed until further clarification if needed or not as this will interfere with javasripts on group elements (loosing their type)
                        //echo '<input type="hidden" name="ff_nm_' . $row->name . '[]" value="cbGroupMark"/>' . nl();
                        break;
                }
            }
        }
        $paymentMethod = '';
        for ($i = 0; $i < $this->rowcount; $i++) {
            $row = $this->rows[$i];
            if ($row->type == "PayPal" || $row->type == "Sofortueberweisung") {
                echo indentc(1) . '<input type="hidden" name="ff_payment_method" id="bfPaymentMethod" value=""/>' . nl();
                break;
            }
        }
        switch ($this->runmode) {
            case _FF_RUNMODE_FRONTEND:
                echo indentc(1) . '<input type="hidden" name="ff_contentid" value="' . JRequest::getInt('ff_contentid', 0) . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_applic" value="' . JRequest::getWord('ff_applic', '') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_module_id" value="' . JRequest::getInt('ff_module_id', 0) . '"/>' . nl();
                echo indentc(1) . '<input type="hidden" name="ff_form" value="' . htmlentities($this->form, ENT_QUOTES, 'UTF-8') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_task" value="submit"/>' . nl();
                if ($this->target > 1) {
                    echo indentc(1) . '<input type="hidden" name="ff_target" value="' . htmlentities($this->target, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                }
                if ($this->inframe) {
                    echo indentc(1) . '<input type="hidden" name="ff_frame" value="1"/>' . nl();
                }
                if ($this->border) {
                    echo indentc(1) . '<input type="hidden" name="ff_border" value="1"/>' . nl();
                }
                if ($this->page != 1) {
                    echo indentc(1) . '<input type="hidden" name="ff_page" value="' . htmlentities($this->page, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                }
                if ($this->align != 1) {
                    echo indentc(1) . '<input type="hidden" name="ff_align" value="' . htmlentities($this->align, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                }
                if ($this->top != 0) {
                    echo indentc(1) . '<input type="hidden" name="ff_top" value="' . htmlentities($this->top, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                }
                reset($ff_otherparams);
                while (list($prop, $val) = each($ff_otherparams)) {
                    echo indentc(1) . '<input type="hidden" name="' . htmlentities($prop, ENT_QUOTES, 'UTF-8') . '" value="' . htmlentities(urlencode($val), ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                }
                if (isset($_REQUEST['cb_form_id']) && isset($_REQUEST['cb_record_id'])) {
                    echo '<input type="hidden" name="cb_form_id" value="' . JRequest::getInt('cb_form_id', 0) . '"/>' . nl();
                    echo '<input type="hidden" name="cb_record_id" value="' . JRequest::getInt('cb_record_id', 0) . '"/>' . nl();
                    echo '<input type="hidden" name="return" value="' . htmlentities(JRequest::getVar('return', ''), ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                }
                if (JRequest::getVar('tmpl') == 'component') {
                    echo '<input type="hidden" name="tmpl" value="component"/>' . nl();
                }
                echo '</form>' . nl();
                break;
            case _FF_RUNMODE_BACKEND:
                echo indentc(1) . '<input type="hidden" name="option" value="com_breezingforms"/>' . nl() . indentc(1) . '<input type="hidden" name="act" value="run"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_form" value="' . htmlentities($this->form, ENT_QUOTES, 'UTF-8') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_task" value="submit"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_contentid" value="' . JRequest::getInt('ff_contentid', 0) . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_applic" value="' . JRequest::getWord('ff_applic', '') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_module_id" value="' . JRequest::getInt('ff_module_id', 0) . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_runmode" value="' . htmlentities($this->runmode, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                if ($this->target > 1) {
                    echo indentc(1) . '<input type="hidden" name="ff_target" value="' . htmlentities($this->target, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                }
                if ($this->inframe) {
                    echo indentc(1) . '<input type="hidden" name="ff_frame" value="1"/>' . nl();
                }
                if ($this->border) {
                    echo indentc(1) . '<input type="hidden" name="ff_border" value="1"/>' . nl();
                }
                if ($this->page != 1) {
                    echo indentc(1) . '<input type="hidden" name="ff_page" value="' . htmlentities($this->page, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                }
                if ($this->align != 1) {
                    echo indentc(1) . '<input type="hidden" name="ff_align" value="' . htmlentities($this->align, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                }
                if ($this->top != 0) {
                    echo indentc(1) . '<input type="hidden" name="ff_top" value="' . htmlentities($this->top, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                }
                if (isset($_REQUEST['cb_form_id']) && isset($_REQUEST['cb_record_id'])) {
                    echo '<input type="hidden" name="cb_form_id" value="' . JRequest::getInt('cb_form_id', 0) . '"/>' . nl();
                    echo '<input type="hidden" name="cb_record_id" value="' . JRequest::getInt('cb_record_id', 0) . '"/>' . nl();
                    echo '<input type="hidden" name="return" value="' . htmlentities(JRequest::getVar('return', ''), ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                }
                //echo '<input type="hidden" name="tmpl" value="' . JRequest::getCmd('tmpl', '') . '"/>' . nl();
                if (JRequest::getVar('tmpl') == 'component') {
                    echo '<input type="hidden" name="tmpl" value="component"/>' . nl();
                }
                echo '</form>' . nl();
                break;
            default:
                // _FF_RUNMODE_PREVIEW:
                if ($this->inframe) {
                    echo indentc(1) . '<input type="hidden" name="option" value="com_breezingforms"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_frame" value="1"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_form" value="' . htmlentities($this->form, ENT_QUOTES, 'UTF-8') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_task" value="submit"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_contentid" value="' . JRequest::getInt('ff_contentid', 0) . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_applic" value="' . JRequest::getWord('ff_applic', '') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_module_id" value="' . JRequest::getInt('ff_module_id', 0) . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_runmode" value="' . htmlentities($this->runmode, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    if ($this->page != 1) {
                        echo indentc(1) . '<input type="hidden" name="ff_page" value="' . htmlentities($this->page, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    }
                    if (isset($_REQUEST['cb_form_id']) && isset($_REQUEST['cb_record_id'])) {
                        echo '<input type="hidden" name="cb_form_id" value="' . JRequest::getInt('cb_form_id', 0) . '"/>' . nl();
                        echo '<input type="hidden" name="cb_record_id" value="' . JRequest::getInt('cb_record_id', 0) . '"/>' . nl();
                        echo '<input type="hidden" name="return" value="' . htmlentities(JRequest::getVar('return', ''), ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    }
                    if (JRequest::getVar('tmpl') == 'component') {
                        echo '<input type="hidden" name="tmpl" value="component"/>' . nl();
                    }
                    echo '</form>' . nl();
                }
                // if
        }
        // if
        // handle After Form piece
        $code = '';
        switch ($this->formrow->piece2cond) {
            case 1:
                // library
                $database->setQuery("select name, code from #__facileforms_pieces " . "where id=" . $this->formrow->piece2id . " and published=1 ");
                $rows = $database->loadObjectList();
                if (count($rows)) {
                    echo $this->execPiece($rows[0]->code, BFText::_('COM_BREEZINGFORMS_PROCESS_AFPIECE') . " " . $rows[0]->name, 'p', $this->formrow->piece2id, null);
                }
                break;
            case 2:
                // custom code
                echo $this->execPiece($this->formrow->piece2code, BFText::_('COM_BREEZINGFORMS_PROCESS_AFPIECEC'), 'f', $this->form, 2);
                break;
            default:
                break;
        }
        // switch
        if ($this->bury()) {
            return;
        }
        if ($this->legacy_wrap) {
            echo '</div></div></div><div class="bfPage-bl"><div class="bfPage-br"><div class="bfPage-b"></div></div></div></div><!-- form end -->' . nl();
        } else {
            echo '</div><!-- form end -->' . nl();
        }
        if ($this->traceMode & _FF_TRACEMODE_DIRECT) {
            $this->dumpTrace();
            ob_end_flush();
            echo '</pre>';
        } else {
            ob_end_flush();
            $this->dumpTrace();
        }
        // if
        restore_error_handler();
        if (trim($this->formrow->template_code_processed) == 'QuickMode' && $this->isMobile) {
            $contents = ob_get_contents();
            $ob = 0;
            while (ob_get_level() > 0 && $ob <= 32) {
                ob_end_clean();
                $ob++;
            }
            echo '<!DOCTYPE html> 
<html> 
<head> 
<title>' . JFactory::getDocument()->getTitle() . '</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">';
            echo $quickMode->headers();
            echo $quickMode->fetchHead(JFactory::getDocument()->getHeadData());
            echo '</head>' . "\n";
            echo '<body>' . "\n";
            echo $contents;
            echo '
</body>' . "\n" . '</html>';
            exit;
        }
    }
コード例 #2
0
    public function process(&$dataObject, $parent = null, $parentPage = null, $index = 0, $childrenLength = 0)
    {
        if (isset($dataObject['attributes']) && isset($dataObject['properties'])) {
            $options = array('type' => 'normal', 'displayType' => 'breaks');
            if ($parent != null && $parent['type'] == 'section') {
                $options['type'] = $parent['bfType'];
                $options['displayType'] = $parent['displayType'];
            }
            $class = ' class="bfBlock"';
            $wrapper = 'bfWrapperBlock';
            if ($options['displayType'] == 'inline') {
                $class = ' class="bfInline"';
                $wrapper = 'bfWrapperInline';
            }
            $mdata = $dataObject['properties'];
            if ($mdata['type'] == 'page') {
                $parentPage = $mdata;
                if ($parentPage['pageNumber'] > 1) {
                    echo '</div><!-- bfPage end -->' . "\n";
                    // closing previous pages
                }
                $display = ' style="display:none;"';
                if (JRequest::getInt('ff_form_submitted', 0) == 0 && JRequest::getInt('ff_page', 1) == $parentPage['pageNumber']) {
                    $display = '';
                } else {
                    if (JRequest::getInt('ff_form_submitted', 0) == 1 && $this->rootMdata['lastPageThankYou'] && $parentPage['pageNumber'] == count($this->dataObject['children'])) {
                        $display = '';
                    } else {
                        if (JRequest::getInt('ff_form_submitted', 0) == 1 && false == $this->rootMdata['lastPageThankYou'] && $parentPage['pageNumber'] == 1) {
                            $display = '';
                        }
                    }
                }
                echo '<div id="bfPage' . $parentPage['pageNumber'] . '" class="bfPage"' . $display . '>' . "\n";
                // opening current page
                /* translatables */
                if (isset($mdata['pageIntro_translation' . $this->language_tag]) && $mdata['pageIntro_translation' . $this->language_tag] != '') {
                    $mdata['pageIntro'] = $mdata['pageIntro_translation' . $this->language_tag];
                }
                /* translatables end */
                if (trim($mdata['pageIntro']) != '') {
                    echo '<div class="bfPageIntro">' . "\n";
                    $regex = '/{loadposition\\s+(.*?)}/i';
                    $introtext = $mdata['pageIntro'];
                    preg_match_all($regex, $introtext, $matches, PREG_SET_ORDER);
                    jimport('joomla.version');
                    $version = new JVersion();
                    if ($matches && version_compare($version->getShortVersion(), '1.6', '>=')) {
                        $document = JFactory::getDocument();
                        $renderer = $document->loadRenderer('modules');
                        $options = array('style' => 'xhtml');
                        foreach ($matches as $match) {
                            $matcheslist = explode(',', $match[1]);
                            $position = trim($matcheslist[0]);
                            $output = $renderer->render($position, $options, null);
                            $introtext = preg_replace("|{$match['0']}|", addcslashes($output, '\\'), $introtext, 1);
                        }
                    }
                    echo $introtext . "\n";
                    echo '</div><div style="padding-bottom: 10px;"></div>' . "\n";
                }
                if (!$this->useErrorAlerts) {
                    echo '<span class="bfErrorMessage" style="color: red; display:none;"></span>' . "\n";
                }
            } else {
                if ($mdata['type'] == 'section') {
                    if (isset($dataObject['properties']['name']) && isset($mdata['off']) && $mdata['off']) {
                        echo '<script type="text/javascript"><!--' . "\n" . 'bfDeactivateSection.push("' . $dataObject['properties']['name'] . '");' . "\n" . '//--></script>' . "\n";
                    }
                    /* translatables */
                    if (isset($mdata['title_translation' . $this->language_tag]) && $mdata['title_translation' . $this->language_tag] != '') {
                        $mdata['title'] = $mdata['title_translation' . $this->language_tag];
                    }
                    /* translatables end */
                    if ($mdata['bfType'] == 'section') {
                        echo '<div data-theme="b" data-role="collapsible-set"' . (isset($mdata['off']) && $mdata['off'] ? ' style="display:none" ' : '') . (isset($dataObject['properties']['name']) && $dataObject['properties']['name'] != "" ? ' id="' . $dataObject['properties']['name'] . '"' : '') . '><div data-role="collapsible" data-collapsed="false">' . "\n";
                        if (trim($mdata['title']) != '') {
                            echo '<h3>' . htmlentities(trim($mdata['title']), ENT_QUOTES, 'UTF-8') . '</h3>' . "\n";
                        }
                    } else {
                        if ($mdata['bfType'] == 'normal') {
                            if (isset($dataObject['properties']['name']) && $dataObject['properties']['name'] != '') {
                                echo '<div ' . (isset($mdata['off']) && $mdata['off'] ? 'style="display:none" ' : '') . 'class="bfNoSection"' . (isset($dataObject['properties']['name']) && $dataObject['properties']['name'] != "" ? ' id="' . $dataObject['properties']['name'] . '"' : '') . '>' . "\n";
                            }
                        }
                    }
                    /* translatables */
                    if (isset($mdata['description_translation' . $this->language_tag]) && $mdata['description_translation' . $this->language_tag] != '') {
                        $mdata['description'] = $mdata['description_translation' . $this->language_tag];
                    }
                    /* translatables end */
                    if (trim($mdata['description']) != '') {
                        echo '<div>' . "\n";
                        $regex = '/{loadposition\\s+(.*?)}/i';
                        $introtext = $mdata['description'];
                        preg_match_all($regex, $introtext, $matches, PREG_SET_ORDER);
                        jimport('joomla.version');
                        $version = new JVersion();
                        if ($matches && version_compare($version->getShortVersion(), '1.6', '>=')) {
                            $document = JFactory::getDocument();
                            $renderer = $document->loadRenderer('modules');
                            $options = array('style' => 'xhtml');
                            foreach ($matches as $match) {
                                $matcheslist = explode(',', $match[1]);
                                $position = trim($matcheslist[0]);
                                $output = $renderer->render($position, $options, null);
                                $introtext = preg_replace("|{$match['0']}|", addcslashes($output, '\\'), $introtext, 1);
                            }
                        }
                        echo $introtext . "\n";
                        echo '</div><div style="padding-bottom: 10px;"></div>' . "\n";
                    }
                } else {
                    if ($mdata['type'] == 'element') {
                        //echo '<div class="bfElemWrap"'.(isset($mdata['off']) && $mdata['off'] ? ' style="display:none" ' : '').'>';
                        // if labels left
                        if (true) {
                            echo '<div' . (isset($mdata['off']) && $mdata['off'] ? ' style="display:none" ' : '') . ' id="fieldcontain' . $mdata['bfName'] . '" class="bfElemWrap" data-role="fieldcontain">';
                        }
                        $onclick = '';
                        if ($mdata['actionClick'] == 1) {
                            $onclick = 'onclick="' . $mdata['actionFunctionName'] . '(this,\'click\');" ';
                        }
                        $onblur = '';
                        if ($mdata['actionBlur'] == 1) {
                            $onblur = 'onblur="' . $mdata['actionFunctionName'] . '(this,\'blur\');" ';
                        }
                        $onchange = '';
                        if ($mdata['actionChange'] == 1) {
                            $onchange = 'onchange="' . $mdata['actionFunctionName'] . '(this,\'change\');" ';
                        }
                        $onfocus = '';
                        if ($mdata['actionFocus'] == 1) {
                            $onfocus = 'onfocus="' . $mdata['actionFunctionName'] . '(this,\'focus\');" ';
                        }
                        $onselect = '';
                        if (isset($mdata['actionSelect']) && $mdata['actionSelect'] == 1) {
                            $onselect = 'onselect="' . $mdata['actionFunctionName'] . '(this,\'select\');" ';
                        }
                        $legend = '';
                        if (!$mdata['hideLabel'] && $mdata['bfType'] != 'bfPayPal' && $mdata['bfType'] != 'bfSofortueberweisung') {
                            $maxlengthCounter = '';
                            if ($mdata['bfType'] == 'bfTextarea' && isset($mdata['maxlength']) && $mdata['maxlength'] > 0 && isset($mdata['showMaxlengthCounter']) && $mdata['showMaxlengthCounter']) {
                                $maxlengthCounter = ' <span class=***bfMaxLengthCounter*** id=***bfMaxLengthCounter' . $mdata['dbId'] . '***>(' . $mdata['maxlength'] . ' ' . BFText::_('COM_BREEZINGFORMS_CHARS_LEFT') . ')</span>';
                            }
                            $for = '';
                            if ($mdata['bfType'] == 'bfTextfield' || $mdata['bfType'] == 'bfTextarea' || $mdata['bfType'] == 'bfCheckbox' || $mdata['bfType'] == 'bfCheckboxGroup' || $mdata['bfType'] == 'bfCalendar' || $mdata['bfType'] == 'bfCalendarReponsive' || $mdata['bfType'] == 'bfSelect' || $mdata['bfType'] == 'bfRadioGroup' || $mdata['bfType'] == 'bfFile' && (!isset($mdata['flashUploader']) && !isset($mdata['html5']) || isset($mdata['flashUploader']) && !$mdata['flashUploader'] && (isset($mdata['html5']) && !$mdata['html5']))) {
                                $for = 'for="ff_elem' . $mdata['dbId'] . '"';
                            }
                            if ($mdata['bfType'] == 'bfCaptcha' || $mdata['bfType'] == 'bfReCaptcha') {
                                $for = 'for="bfCaptchaEntry"';
                                if (JFactory::getApplication()->isSite()) {
                                    $captcha_url = JURI::root(true) . '/components/com_breezingforms/images/captcha/securimage_show.php';
                                } else {
                                    $captcha_url = JURI::root(true) . '/administrator/components/com_breezingforms/images/captcha/securimage_show.php';
                                }
                                echo '<div align="center"><img alt="" border="0" width="230" id="ff_capimgValue" class="ff_capimg" src="' . $captcha_url . '"/></div><br/>' . "\n";
                            }
                            //else if($mdata['bfType'] == 'bfReCaptcha'){
                            //    $for = 'for="recaptcha_response_field"';
                            //}
                            $req = '';
                            if ($mdata['required']) {
                                $req = '<span class="bfRequired"> * </span>' . "\n";
                            }
                            /* translatables */
                            if (isset($mdata['label_translation' . $this->language_tag]) && $mdata['label_translation' . $this->language_tag] != '') {
                                $mdata['label'] = $mdata['label_translation' . $this->language_tag];
                            }
                            /* translatables end */
                            $labelText = trim($mdata['label']) . $req . str_replace("***", "\"", $maxlengthCounter);
                            if (true && ($mdata['bfType'] == 'bfCheckboxGroup' || $mdata['bfType'] == 'bfRadioGroup')) {
                                $legend = '<legend id="bfLabel' . $mdata['dbId'] . '">' . str_replace("***", "\"", $labelText) . '</legend>' . "\n";
                            } else {
                                if ($mdata['bfType'] == 'bfSummarize') {
                                    $legend = $labelText;
                                } else {
                                    echo '<label id="bfLabel' . $mdata['dbId'] . '" ' . $for . '>' . str_replace("***", "\"", $labelText) . '</label>' . "\n";
                                }
                            }
                        }
                        $readonly = '';
                        if ($mdata['readonly']) {
                            $readonly = 'readonly="readonly" ';
                        }
                        $tabIndex = '';
                        if ($mdata['tabIndex'] != -1 && is_numeric($mdata['tabIndex'])) {
                            $tabIndex = 'tabindex="' . intval($mdata['tabIndex']) . '" ';
                        }
                        for ($i = 0; $i < $this->p->rowcount; $i++) {
                            $row = $this->p->rows[$i];
                            if ($mdata['bfName'] == $row->name) {
                                if ((isset($mdata['value']) || isset($mdata['list']) || isset($mdata['group'])) && ($mdata['bfType'] == 'bfTextfield' || $mdata['bfType'] == 'bfTextarea' || $mdata['bfType'] == 'bfCheckbox' || $mdata['bfType'] == 'bfCheckboxGroup' || $mdata['bfType'] == 'bfSubmitButton' || $mdata['bfType'] == 'bfHidden' || $mdata['bfType'] == 'bfCalendar' || $mdata['bfType'] == 'bfCalendarResponsive' || $mdata['bfType'] == 'bfSelect' || $mdata['bfType'] == 'bfRadioGroup')) {
                                    if ($mdata['bfType'] == 'bfSelect') {
                                        $mdata['list'] = $this->p->replaceCode($row->data2, "data2 of " . $mdata['bfName'], 'e', $mdata['dbId'], 0);
                                    } else {
                                        if ($mdata['bfType'] == 'bfCheckboxGroup' || $mdata['bfType'] == 'bfRadioGroup') {
                                            $mdata['group'] = $this->p->replaceCode($row->data2, "data2 of " . $mdata['bfName'], 'e', $mdata['dbId'], 0);
                                        } else {
                                            $mdata['value'] = $this->p->replaceCode($row->data1, "data1 of " . $mdata['bfName'], 'e', $mdata['dbId'], 0);
                                        }
                                    }
                                }
                                if (isset($mdata['checked']) && $mdata['bfType'] == 'bfCheckbox') {
                                    $mdata['checked'] = $row->flag1 == 1 ? true : false;
                                }
                                break;
                            }
                        }
                        $flashUploader = '';
                        switch ($mdata['bfType']) {
                            case 'bfTextfield':
                                $type = 'text';
                                if ($mdata['password']) {
                                    $type = 'password';
                                }
                                $maxlength = '';
                                if (is_numeric($mdata['maxLength'])) {
                                    $maxlength = 'maxlength="' . intval($mdata['maxLength']) . '" ';
                                }
                                /* translatables */
                                if (isset($mdata['value_translation' . $this->language_tag]) && $mdata['value_translation' . $this->language_tag] != '') {
                                    $mdata['value'] = $mdata['value_translation' . $this->language_tag];
                                }
                                if (isset($mdata['placeholder_translation' . $this->language_tag]) && $mdata['placeholder_translation' . $this->language_tag] != '') {
                                    $mdata['placeholder'] = $mdata['placeholder_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                echo '<input ' . (isset($mdata['placeholder']) && $mdata['placeholder'] ? 'placeholder="' . htmlentities($mdata['placeholder'], ENT_QUOTES, 'UTF-8') . '" ' : '') . 'class="ff_elem" ' . $tabIndex . $maxlength . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="' . $type . '" name="ff_nm_' . $mdata['bfName'] . '[]" value="' . htmlentities(trim($mdata['value']), ENT_QUOTES, 'UTF-8') . '" id="ff_elem' . $mdata['dbId'] . '"/>' . "\n";
                                if ($mdata['mailbackAsSender']) {
                                    echo '<input type="hidden" name="mailbackSender[' . $mdata['bfName'] . ']" value="true"/>' . "\n";
                                }
                                break;
                            case 'bfTextarea':
                                $width = '';
                                if ($mdata['width'] != '') {
                                    $width = 'width:' . htmlentities(strip_tags($mdata['width'])) . ' !important; min-width:' . htmlentities(strip_tags($mdata['width'])) . ' !important;';
                                }
                                $height = '';
                                if ($mdata['height'] != '') {
                                    $height = 'height:' . htmlentities(strip_tags($mdata['height'])) . ';';
                                }
                                $size = '';
                                if ($height != '' || $width != '') {
                                    $size = 'style="' . $width . $height . '" ';
                                }
                                $onkeyup = '';
                                if (isset($mdata['maxlength']) && $mdata['maxlength'] > 0) {
                                    $onkeyup = 'onkeyup="bfCheckMaxlength(' . intval($mdata['dbId']) . ', ' . intval($mdata['maxlength']) . ', ' . (isset($mdata['showMaxlengthCounter']) && $mdata['showMaxlengthCounter'] ? 'true' : 'false') . ')" ';
                                }
                                /* translatables */
                                if (isset($mdata['placeholder_translation' . $this->language_tag]) && $mdata['placeholder_translation' . $this->language_tag] != '') {
                                    $mdata['placeholder'] = $mdata['placeholder_translation' . $this->language_tag];
                                }
                                if (isset($mdata['value_translation' . $this->language_tag]) && $mdata['placeholder_translation' . $this->language_tag] != '') {
                                    $mdata['value'] = $mdata['value_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                echo '<textarea ' . (isset($mdata['placeholder']) && $mdata['placeholder'] ? 'placeholder="' . htmlentities($mdata['placeholder'], ENT_QUOTES, 'UTF-8') . '" ' : '') . 'cols="20" rows="5" class="ff_elem" ' . $onkeyup . $size . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '">' . htmlentities(trim($mdata['value']), ENT_QUOTES, 'UTF-8') . '</textarea>' . "\n";
                                break;
                            case 'bfRadioGroup':
                                /* translatables */
                                if (isset($mdata['group_translation' . $this->language_tag]) && $mdata['group_translation' . $this->language_tag] != '') {
                                    $mdata['group'] = $mdata['group_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                if ($mdata['group'] != '') {
                                    $mdata['group'] = str_replace("\r", '', $mdata['group']);
                                    $gEx = explode("\n", $mdata['group']);
                                    $lines = count($gEx);
                                    $wrapOpen = '<div data-role="fieldcontain">' . "\n" . '<fieldset ' . ($lines <= 3 ? 'data-type="horizontal" ' : '') . 'data-role="controlgroup">' . $legend . "\n";
                                    $wrapClose = '</fieldset>' . "\n" . '</div>' . "\n";
                                    echo $wrapOpen;
                                    for ($i = 0; $i < $lines; $i++) {
                                        $idExt = $i != 0 ? '_' . $i : '';
                                        $iEx = explode(";", $gEx[$i]);
                                        $iCnt = count($iEx);
                                        if ($iCnt == 3) {
                                            $lblRight = '<label class="bfGroupLabel" id="bfGroupLabel' . $mdata['dbId'] . $idExt . '" for="ff_elem' . $mdata['dbId'] . $idExt . '">' . trim($iEx[1]) . '</label>';
                                            echo '<input ' . ($iEx[0] == 1 ? 'checked="checked" ' : '') . ' class="ff_elem" ' . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="radio" name="ff_nm_' . $mdata['bfName'] . '[]" value="' . htmlentities(trim($iEx[2]), ENT_QUOTES, 'UTF-8') . '" id="ff_elem' . $mdata['dbId'] . $idExt . '"/>' . $lblRight . "\n";
                                        }
                                    }
                                    echo $wrapClose;
                                }
                                break;
                            case 'bfCheckboxGroup':
                                /* translatables */
                                if (isset($mdata['group_translation' . $this->language_tag]) && $mdata['group_translation' . $this->language_tag] != '') {
                                    $mdata['group'] = $mdata['group_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                if ($mdata['group'] != '') {
                                    $mdata['group'] = str_replace("\r", '', $mdata['group']);
                                    $gEx = explode("\n", $mdata['group']);
                                    $lines = count($gEx);
                                    $wrapOpen = '<div data-role="fieldcontain">' . "\n" . '<fieldset data-role="controlgroup">' . $legend . "\n";
                                    $wrapClose = '</fieldset>' . "\n" . '</div>' . "\n";
                                    echo $wrapOpen;
                                    for ($i = 0; $i < $lines; $i++) {
                                        $idExt = $i != 0 ? '_' . $i : '';
                                        $iEx = explode(";", $gEx[$i]);
                                        $iCnt = count($iEx);
                                        if ($iCnt == 3) {
                                            $lbl = '<label class="bfGroupLabel" id="bfGroupLabel' . $mdata['dbId'] . $idExt . '" for="ff_elem' . $mdata['dbId'] . $idExt . '">' . trim($iEx[1]) . '</label>';
                                            echo '<input ' . ($iEx[0] == 1 ? 'checked="checked" ' : '') . ' class="ff_elem" ' . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="checkbox" name="ff_nm_' . $mdata['bfName'] . '[]" value="' . htmlentities(trim($iEx[2]), ENT_QUOTES, 'UTF-8') . '" id="ff_elem' . $mdata['dbId'] . $idExt . '"/>' . $lbl . "\n";
                                        }
                                    }
                                    echo $wrapClose;
                                }
                                break;
                            case 'bfCheckbox':
                                echo '<input class="ff_elem" ' . ($mdata['checked'] ? 'checked="checked" ' : '') . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="checkbox" name="ff_nm_' . $mdata['bfName'] . '[]" value="' . htmlentities(trim($mdata['value']), ENT_QUOTES, 'UTF-8') . '" id="ff_elem' . $mdata['dbId'] . '"/>' . "\n";
                                if ($mdata['mailbackAccept']) {
                                    echo '<input type="hidden" class="ff_elem" name="mailbackConnectWith[' . $mdata['mailbackConnectWith'] . ']" value="true_' . $mdata['bfName'] . '"/>' . "\n";
                                }
                                break;
                            case 'bfSelect':
                                /* translatables */
                                if (isset($mdata['list_translation' . $this->language_tag]) && $mdata['list_translation' . $this->language_tag] != '') {
                                    $mdata['list'] = $mdata['list_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                if ($mdata['list'] != '') {
                                    $mdata['list'] = str_replace("\r", '', $mdata['list']);
                                    $gEx = explode("\n", $mdata['list']);
                                    $lines = count($gEx);
                                    // data-native-menu="false"
                                    echo '<select class="ff_elem" ' . ($mdata['multiple'] ? 'multiple="multiple" data-native-menu="false" ' : '') . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '">' . "\n";
                                    for ($i = 0; $i < $lines; $i++) {
                                        $iEx = explode(";", $gEx[$i]);
                                        $iCnt = count($iEx);
                                        if ($iCnt == 3) {
                                            echo '<option ' . ($iEx[0] == 1 ? 'selected="selected" ' : '') . 'value="' . htmlentities(trim($iEx[2]), ENT_QUOTES, 'UTF-8') . '">' . htmlentities(trim($iEx[1]), ENT_QUOTES, 'UTF-8') . '</option>' . "\n";
                                        }
                                    }
                                    echo '</select>' . "\n";
                                }
                                break;
                            case 'bfFile':
                                if (isset($mdata['flashUploader']) && $mdata['flashUploader'] || isset($mdata['html5']) && $mdata['html5']) {
                                    $base = explode('/', JURI::base());
                                    if (isset($base[count($base) - 2]) && $base[count($base) - 2] == 'administrator') {
                                        unset($base[count($base) - 2]);
                                        $base = array_merge($base);
                                    }
                                    $base = implode('/', $base);
                                    echo '<input type="hidden" id="flashUpload' . $mdata['bfName'] . '" name="flashUpload' . $mdata['bfName'] . '" value="bfFlashFileQueue' . $mdata['dbId'] . '"/>' . "\n";
                                    $this->hasFlashUpload = true;
                                    //allowedFileExtensions
                                    $allowedExts = explode(',', $mdata['allowedFileExtensions']);
                                    $allowedExtsCnt = count($allowedExts);
                                    for ($i = 0; $i < $allowedExtsCnt; $i++) {
                                        $allowedExts[$i] = $allowedExts[$i];
                                    }
                                    $exts = '';
                                    if ($allowedExtsCnt != 0) {
                                        $exts = implode(',', $allowedExts);
                                    }
                                    $bytes = isset($mdata['flashUploaderBytes']) && is_numeric($mdata['flashUploaderBytes']) && $mdata['flashUploaderBytes'] > 0 ? "max_file_size : '" . intval($mdata['flashUploaderBytes']) . "'," : '';
                                    $flashUploader = "\n                                                        <span id=\"bfUploadContainer" . $mdata['dbId'] . "\">\n\t\t\t\t\t\t\t<img style=\"cursor: pointer;\" id=\"bfPickFiles" . $mdata['dbId'] . "\" src=\"" . $this->uploadImagePath . "\" border=\"0\" width=\"" . (isset($mdata['flashUploaderWidth']) && is_numeric($mdata['flashUploaderWidth']) && $mdata['flashUploaderWidth'] > 0 ? intval($mdata['flashUploaderWidth']) : '64') . "\" height=\"" . (isset($mdata['flashUploaderHeight']) && is_numeric($mdata['flashUploaderHeight']) && $mdata['flashUploaderHeight'] > 0 ? intval($mdata['flashUploaderHeight']) : '64') . "\"/>\n                                                        </span>\n                                                        <span id=\"bfUploader" . $mdata['bfName'] . "\"></span>\n                                                        <div class=\"bfFlashFileQueueClass\" id=\"bfFlashFileQueue" . $mdata['dbId'] . "\"></div>\n                                                        <script type=\"text/javascript\">\n                                                        <!--\n\t\t\t\t\t\t\tbfFlashUploaders.push('ff_elem" . $mdata['dbId'] . "');\n                                                        var bfFlashFileQueue" . $mdata['dbId'] . " = {};\n                                                        function bfUploadImageThumb(file) {\n                                                                var img;\n                                                                img = new o.Image;\n                                                                img.onload = function() {\n                                                                        img.embed(JQuery('#' + file.id+'thumb').get(0), { \n                                                                                width: 100, \n                                                                                height: 60, \n                                                                                crop: true,\n                                                                                swf_url: mOxie.resolveUrl('" . $base . "components/com_breezingforms/libraries/jquery/plupload/Moxie.swf')\n                                                                        });\n                                                                };\n\n                                                                img.onembedded = function() {\n                                                                        img.destroy();\n                                                                };\n\n                                                                img.onerror = function() {\n                                                                        \n                                                                };\n                                                                \n                                                                img.load(file.getSource());\n                                                                \n                                                        }\n                                                        JQuery(document).ready(\n                                                            function() {\n                                                                var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/i) ? true : false );\n                                                                var uploader = new plupload.Uploader({\n                                                                        multi_selection: " . (isset($mdata['flashUploaderMulti']) && $mdata['flashUploaderMulti'] ? 'true' : 'false') . ",\n                                                                        unique_names: iOS,\n                                                                        chunk_size: '100kb',\n                                                                        runtimes : '" . (isset($mdata['html5']) && $mdata['html5'] ? 'html5,' : '') . (isset($mdata['flashUploader']) && $mdata['flashUploader'] ? 'flash,' : '') . "html4',\n                                                                        browse_button : 'bfPickFiles" . $mdata['dbId'] . "',\n                                                                        container: 'bfUploadContainer" . $mdata['dbId'] . "',\n                                                                        file_data_name: 'Filedata',\n                                                                        multipart_params: { form: " . $this->p->form . ", itemName : '" . $mdata['bfName'] . "', bfFlashUploadTicket: '" . $this->flashUploadTicket . "', option: 'com_breezingforms', format: 'html', flashUpload: 'true', Itemid: 0 },\n                                                                        " . $bytes . "\n                                                                        url : '" . $base . (BFJoomlaConfig::get('config.sef') && !BFJoomlaConfig::get('config.sef_rewrite') ? 'index.php/' : '') . (JRequest::getCmd('lang', '') && BFJoomlaConfig::get('config.sef') ? JRequest::getCmd('lang', '') . (BFJoomlaConfig::get('config.sef_rewrite') ? 'index.php' : '') : 'index.php') . "',\n                                                                        flash_swf_url : '" . $base . "components/com_breezingforms/libraries/jquery/plupload/Moxie.swf',\n                                                                        filters : [\n                                                                                {title : '" . addslashes(BFText::_('COM_BREEZINGFORMS_CHOOSE_FILE')) . "', extensions : '" . $exts . "'}\n                                                                        ]\n                                                                });\n                                                                uploader.bind('FilesAdded', function(up, files) {\n                                                                        for (var i in files) {\n                                                                                if(typeof files[i].id != 'undefined' && files[i].id != null){\n                                                                                    var fsize = '';\n                                                                                    if(typeof files[i].size != 'undefined'){\n                                                                                        fsize = '(' + plupload.formatSize(files[i].size) + ') ';\n                                                                                    }\n                                                                                    JQuery('#bfFileQueue').append( '<div id=\"' + files[i].id + 'queue\">' + (iOS ? '' : files[i].name) + ' '+fsize+'<b></b></div>' );\n                                                                                }\n                                                                        }\n                                                                        for (var i in files) {\n                                                                            if(typeof files[i].id != 'undefined' && files[i].id != null){\n                                                                                var error = false;\n                                                                                var fsize = '';\n                                                                                if(typeof files[i].size != 'undefined'){\n                                                                                    fsize = '(' + plupload.formatSize(files[i].size) + ') ';\n                                                                                }\n                                                                                JQuery('#bfFlashFileQueue" . $mdata['dbId'] . "').append('<div class=\"bfFileQueueItem\" id=\"' + files[i].id + 'queueitem\"><div id=\"' + files[i].id + 'thumb\"></div><div id=\"' + files[i].id + '\"><img id=\"' + files[i].id + 'cancel\" src=\"" . $this->cancelImagePath . "\" style=\"cursor: pointer; padding-right: 10px;\" border=\"0\"/>' + (iOS ? '' : files[i].name) + ' ' + fsize + '<b id=\"' + files[i].id + 'msg\" style=\"color:red;\"></b></div></div>');\n                                                                                var file_ = files[i];\n                                                                                var uploader_ = uploader;\n                                                                                var bfUploaders_ = bfUploaders;\n                                                                                JQuery('#' + files[i].id + 'cancel').click( \n                                                                                    function(){\n                                                                                        for( var i = 0; i < bfUploaders_.length; i++ ){\n                                                                                            bfUploaders_[i].stop();\n                                                                                        }\n                                                                                        var id_ = this.id.split('cancel');\n                                                                                        id_ = id_[0];\n                                                                                        uploader_.removeFileById(id_);\n                                                                                        JQuery('#'+id_+'queue').remove();\n                                                                                        JQuery('#'+id_+'queueitem').remove();\n                                                                                        bfFlashUploadersLength--;\n                                                                                        for( var i = 0; i < bfUploaders_.length; i++ ){\n                                                                                            bfUploaders_[i].start();\n                                                                                        }\n                                                                                    } \n                                                                                );\n                                                                                var thebytes = " . (isset($mdata['flashUploaderBytes']) && is_numeric($mdata['flashUploaderBytes']) && $mdata['flashUploaderBytes'] > 0 ? intval($mdata['flashUploaderBytes']) : '0') . ";\n                                                                                if(thebytes > 0 && typeof files[i].size != 'undefined' && files[i].size > thebytes){\n                                                                                     alert(' " . addslashes(BFText::_('COM_BREEZINGFORMS_FLASH_UPLOADER_TOO_LARGE')) . "');\n                                                                                     error = true;\n                                                                                }\n                                                                                var ext = files[i].name.split('.').pop().toLowerCase();\n                                                                                var exts = '" . strtolower($exts) . "'.split(',');\n                                                                                var found = 0;\n                                                                                for (var x in exts){\n                                                                                    if(exts[x] == ext){\n                                                                                        found++;\n                                                                                    }\n                                                                                }\n                                                                                if(found == 0){\n                                                                                    alert( ' " . addslashes(BFText::_('COM_BREEZINGFORMS_FILE_EXTENSION_NOT_ALLOWED')) . "' );\n                                                                                    error = true;\n                                                                                }\n                                                                                if(error){\n                                                                                    JQuery('#'+files[i].id+'queue').remove();\n                                                                                    JQuery('#'+files[i].id+'queueitem').remove();\n                                                                                }else{\n                                                                                    bfFlashUploadersLength++;\n                                                                                }\n                                                                                bfUploadImageThumb(files[i]);\n                                                                            }\n                                                                        }\n                                                                });\n                                                                uploader.bind('UploadProgress', function(up, file) {\n                                                                    if(typeof JQuery('#'+file.id+'queue').get(0) != 'undefined'){\n                                                                        JQuery('#'+file.id+'queue').get(0).getElementsByTagName('b')[0].innerHTML = file.percent + '% <div style=\"height: 5px;width: ' + (file.percent*1.5) + 'px;background-color: #9de24f;\"></div>';\n                                                                    }\n                                                                });\n                                                                uploader.bind('FileUploaded', function(up, file, response) {\n                                                                    if(response.response!=''){\n                                                                        if(response.response !== null){\n                                                                            alert(response.response);\n                                                                        }\n                                                                    }\n                                                                    JQuery('#'+file.id+'queue').remove();\n                                                                });\n                                                                uploader.init();\n                                                                bfUploaders.push(uploader);\n                                                            });\n\t\t\t\t\t\t\t//-->\n                                                        </script>\n\t\t\t\t\t\t\t";
                                    // on mobiles, file uploads are forced not to be mandatory, since we cannot determin safely for all handsets if they are even allowed
                                    echo '<script type="text/javascript"><!--' . "\n" . 'var bfIsValidMobile = ( navigator.userAgent.match(/(iPad|iPhone|iPod|Android)/i) ? true : false )' . "\n" . 'if(!bfIsValidMobile){bfDeactivateField["ff_nm_' . $mdata['bfName'] . '[]"]=true;}' . "\n" . '//--></script>' . "\n";
                                    echo '<input class="ff_elem" ' . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="hidden" name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '"/>' . "\n";
                                } else {
                                    echo '<input class="ff_elem" ' . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="file" name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '"/>' . "\n";
                                }
                                if ($mdata['attachToAdminMail']) {
                                    echo '<input type="hidden" name="attachToAdminMail[' . $mdata['bfName'] . ']" value="true"/>' . "\n";
                                }
                                if ($mdata['attachToUserMail']) {
                                    echo '<input type="hidden" name="attachToUserMail[' . $mdata['bfName'] . ']" value="true"/>' . "\n";
                                }
                                break;
                                // on mobiles, file uploads are forced not to be mandatory, since we cannot determin safely for all handsets if they are even allowed
                                echo '<script type="text/javascript"><!--' . "\n" . 'bfDeactivateField["ff_nm_' . $mdata['bfName'] . '[]"]=true;' . "\n" . '//--></script>' . "\n";
                                break;
                            case 'bfSubmitButton':
                                /* translatables */
                                if (isset($mdata['src_translation' . $this->language_tag]) && $mdata['src_translation' . $this->language_tag] != '') {
                                    $mdata['src'] = $mdata['src_translation' . $this->language_tag];
                                }
                                if (isset($mdata['value_translation' . $this->language_tag]) && $mdata['value_translation' . $this->language_tag] != '') {
                                    $mdata['value'] = $mdata['value_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                $value = '';
                                $type = 'submit';
                                $src = '';
                                if ($mdata['src'] != '') {
                                    $type = 'image';
                                    $src = 'src="' . $mdata['src'] . '" ';
                                }
                                if ($mdata['value'] != '') {
                                    $value = 'value="' . htmlentities(trim($mdata['value']), ENT_QUOTES, 'UTF-8') . '" ';
                                }
                                if ($mdata['actionClick'] == 1) {
                                    $onclick = 'onclick="populateSummarizers();if(document.getElementById(\'bfPaymentMethod\')){document.getElementById(\'bfPaymentMethod\').value=\'\';};' . $mdata['actionFunctionName'] . '(this,\'click\');return false;" ';
                                } else {
                                    $onclick = 'onclick="populateSummarizers();if(document.getElementById(\'bfPaymentMethod\')){document.getElementById(\'bfPaymentMethod\').value=\'\';};return false;" ';
                                }
                                if ($src == '') {
                                    echo '<button data-theme="e" class="ff_elem" ' . $value . $src . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="' . $type . '" name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '"><span>' . $mdata['value'] . '</span></button>' . "\n";
                                } else {
                                    echo '<input class="ff_elem" ' . $value . $src . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="' . $type . '" name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '" value="' . $mdata['value'] . '"/>' . "\n";
                                }
                                break;
                            case 'bfHidden':
                                echo '<input class="ff_elem" type="hidden" name="ff_nm_' . $mdata['bfName'] . '[]" value="' . htmlentities(trim($mdata['value']), ENT_QUOTES, 'UTF-8') . '" id="ff_elem' . $mdata['dbId'] . '"/>' . "\n";
                                break;
                            case 'bfSummarize':
                                /* translatables */
                                if (isset($mdata['emptyMessage_translation' . $this->language_tag]) && $mdata['emptyMessage_translation' . $this->language_tag] != '') {
                                    $mdata['emptyMessage'] = $mdata['emptyMessage_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                echo '<div class="ui-grid-a">
                                                            <div class="ui-block-a"><strong>' . $legend . '</strong></div>
                                                            <div class="ui-block-b ff_elem bfSummarize" id="ff_elem' . $mdata['dbId'] . '"></div>
                                                    </div>';
                                echo '<script type="text/javascript"><!--' . "\n" . 'bfRegisterSummarize("ff_elem' . $mdata['dbId'] . '", "' . $mdata['connectWith'] . '", "' . $mdata['connectType'] . '", "' . addslashes($mdata['emptyMessage']) . '", ' . ($mdata['hideIfEmpty'] ? 'true' : 'false') . ')' . "\n" . '//--></script>';
                                if (trim($mdata['fieldCalc']) != '') {
                                    echo '<script type="text/javascript">
                                                        <!--
							function bfFieldCalcff_elem' . $mdata['dbId'] . '(value){
								if(!isNaN(value)){
									value = Number(value);
								}
								' . $mdata['fieldCalc'] . '
								return value;
							}
                                                        //-->
							</script>';
                                }
                                break;
                                // recaptcha doesn't currently play well with jquery mobile
                            // recaptcha doesn't currently play well with jquery mobile
                            case 'bfReCaptcha':
                            case 'bfCaptcha':
                                echo '<input autocomplete="off" class="ff_elem" type="text" name="bfCaptchaEntry" id="bfCaptchaEntry" />' . "\n";
                                echo '<button data-role="button" data-icon="refresh" data-inline="true" data-iconpos="notext" data-theme="e" id="bfCaptchaReload" onclick="document.getElementById(\'bfCaptchaEntry\').value=\'\';document.getElementById(\'bfCaptchaEntry\').focus();document.getElementById(\'ff_capimgValue\').src = \'' . $captcha_url . '?bfMathRandom=\' + Math.random(); return false"><span>Reload Captcha</span></button>';
                                break;
                            case 'bfCalendar':
                                /* translatables */
                                if (isset($mdata['value_translation' . $this->language_tag]) && $mdata['value_translation' . $this->language_tag] != '') {
                                    $mdata['value'] = $mdata['value_translation' . $this->language_tag];
                                }
                                if (isset($mdata['format_translation' . $this->language_tag]) && $mdata['format_translation' . $this->language_tag] != '') {
                                    $mdata['format'] = $mdata['format_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                JHTML::_('behavior.calendar');
                                $exploded = explode('::', trim($mdata['value']));
                                $left = '';
                                $right = '';
                                if (count($exploded) == 2) {
                                    $left = trim($exploded[0]);
                                    $right = trim($exploded[1]);
                                } else {
                                    $right = trim($exploded[0]);
                                }
                                echo '<input autocomplete="off" class="ff_elem" type="text" name="ff_nm_' . $mdata['bfName'] . '[]"  id="ff_elem' . $mdata['dbId'] . '" value="' . htmlentities($left, ENT_QUOTES, 'UTF-8') . '"/>' . "\n";
                                echo '<label for="ff_elem' . $mdata['dbId'] . '_calendarButton"></label>';
                                echo '<button data-theme="e" id="ff_elem' . $mdata['dbId'] . '_calendarButton" type="submit" class="bfCalendar" value="' . htmlentities($right, ENT_QUOTES, 'UTF-8') . '"><span>' . htmlentities($right, ENT_QUOTES, 'UTF-8') . '</span></button>' . "\n";
                                echo '<script type="text/javascript">
                                                <!--
                                                JQuery(document).bind("pageinit", function() {
                                                Calendar.setup({
                                                        inputField     :    "ff_elem' . $mdata['dbId'] . '",
                                                        ifFormat       :    "' . $mdata['format'] . '",
                                                        button         :    "ff_elem' . $mdata['dbId'] . '_calendarButton",
                                                        align          :    "Bl",
                                                        singleClick    :    true
                                                    });
                                                });
                                                //-->
                                                </script>' . "\n";
                                break;
                            case 'bfCalendarResponsive':
                                /* translatables */
                                if (isset($mdata['value_translation' . $this->language_tag]) && $mdata['value_translation' . $this->language_tag] != '') {
                                    $mdata['value'] = $mdata['value_translation' . $this->language_tag];
                                }
                                if (isset($mdata['format_translation' . $this->language_tag]) && $mdata['format_translation' . $this->language_tag] != '') {
                                    $mdata['format'] = $mdata['format_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                $exploded = explode('::', trim($mdata['value']));
                                $left = '';
                                $right = '';
                                if (count($exploded) == 2) {
                                    $left = trim($exploded[0]);
                                    $right = trim($exploded[1]);
                                } else {
                                    $right = trim($exploded[0]);
                                }
                                echo '<input autocomplete="off" class="ff_elem" type="text" name="ff_nm_' . $mdata['bfName'] . '[]"  id="ff_elem' . $mdata['dbId'] . '" value="' . htmlentities($left, ENT_QUOTES, 'UTF-8') . '"/>' . "\n";
                                echo '<label for="ff_elem' . $mdata['dbId'] . '_calendarButton"></label>';
                                echo '<button data-theme="e" id="ff_elem' . $mdata['dbId'] . '_calendarButton" type="submit" class="bfCalendar" value="' . htmlentities($right, ENT_QUOTES, 'UTF-8') . '"><span>' . htmlentities($right, ENT_QUOTES, 'UTF-8') . '</span></button>' . "\n";
                                echo '<script type="text/javascript">
                                                <!--
                                                JQuery(document).ready(function () {
                                                    JQuery("#ff_elem' . $mdata['dbId'] . '_calendarButton").pickadate({
                                                        format: "' . $mdata['format'] . '", 
                                                        selectYears: true, 
                                                        selectMonths: true,
                                                        editable: true,
                                                        firstDay: 1,
                                                        onSet: function() {
                                                            JQuery("#ff_elem' . $mdata['dbId'] . '").val(this.get("value"));
                                                        }
                                                    });
                                                });
                                                //-->
                                                </script>' . "\n";
                                $this->hasResponsiveDatePicker = true;
                                break;
                            case 'bfPayPal':
                                /* translatables */
                                if (isset($mdata['image_translation' . $this->language_tag]) && $mdata['image_translation' . $this->language_tag] != '') {
                                    $mdata['image'] = $mdata['image_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                $value = '';
                                $type = 'submit';
                                $src = '';
                                if ($mdata['image'] != '') {
                                    $type = 'image';
                                    $src = 'src="' . $mdata['image'] . '" ';
                                } else {
                                    $value = 'value="PayPal" ';
                                }
                                if ($mdata['actionClick'] == 1) {
                                    $onclick = 'onclick="document.getElementById(\'bfPaymentMethod\').value=\'PayPal\';' . $mdata['actionFunctionName'] . '(this,\'click\');" ';
                                } else {
                                    $onclick = 'onclick="document.getElementById(\'bfPaymentMethod\').value=\'PayPal\';" ';
                                }
                                echo '<div align="center"><input data-role="none" class="ff_elem" ' . $value . $src . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="' . $type . '" name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '"/></div>' . "\n";
                                break;
                            case 'bfSofortueberweisung':
                                /* translatables */
                                if (isset($mdata['image_translation' . $this->language_tag]) && $mdata['image_translation' . $this->language_tag] != '') {
                                    $mdata['image'] = $mdata['image_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                $value = '';
                                $type = 'submit';
                                $src = '';
                                if ($mdata['image'] != '') {
                                    $type = 'image';
                                    $src = 'src="' . $mdata['image'] . '" ';
                                } else {
                                    $value = 'value="Sofortueberweisung" ';
                                }
                                if ($mdata['actionClick'] == 1) {
                                    $onclick = 'onclick="document.getElementById(\'bfPaymentMethod\').value=\'Sofortueberweisung\';' . $mdata['actionFunctionName'] . '(this,\'click\');" ';
                                } else {
                                    $onclick = 'onclick="document.getElementById(\'bfPaymentMethod\').value=\'Sofortueberweisung\';" ';
                                }
                                echo '<div align="center"><input data-role="none" class="ff_elem" ' . $value . $src . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="' . $type . '" name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '"/></div>' . "\n";
                                break;
                        }
                        /* translatables */
                        if (isset($mdata['hint_translation' . $this->language_tag]) && $mdata['hint_translation' . $this->language_tag] != '') {
                            $mdata['hint'] = $mdata['hint_translation' . $this->language_tag];
                        }
                        /* translatables end */
                        if (trim($mdata['hint']) != '') {
                            $labid = uniqid();
                            echo '<div><button data-theme="e" onclick="JQuery(\'.tooltip\').hide(\'fast\');JQuery(\'#' . $labid . '_tip\').show(\'fast\');" data-role="button" data-icon="info" data-inline="true" data-iconpos="notext" id="' . $labid . '">' . trim($mdata['hint']) . '</button><span id="' . $labid . '_tip" class="tooltip">' . trim($mdata['hint']) . '</span></div>';
                        }
                        if (isset($mdata['bfName']) && isset($mdata['off']) && $mdata['off']) {
                            echo '<script type="text/javascript"><!--' . "\n" . 'bfDeactivateField["ff_nm_' . $mdata['bfName'] . '[]"]=true;' . "\n" . '//--></script>' . "\n";
                        }
                        if ($mdata['bfType'] == 'bfFile') {
                            echo '<span id="ff_elem' . $mdata['dbId'] . '_files"></span>';
                        }
                        echo $flashUploader;
                        // if labels left
                        if (true) {
                            echo '</div>';
                        }
                        //echo '</div>';
                    }
                }
            }
        }
        /**
         * Paging and wrapping of inline element containers
         */
        if (isset($dataObject['children']) && count($dataObject['children']) != 0) {
            $childrenAmount = count($dataObject['children']);
            for ($i = 0; $i < $childrenAmount; $i++) {
                $this->process($dataObject['children'][$i], $mdata, $parentPage, $i, $childrenAmount);
            }
        }
        if (isset($dataObject['properties']) && $dataObject['properties']['type'] == 'section' && $dataObject['properties']['bfType'] == 'section') {
            echo '</div></div>' . "\n";
        } else {
            if (isset($dataObject['properties']) && $dataObject['properties']['type'] == 'section' && $dataObject['properties']['bfType'] == 'normal') {
                if (isset($dataObject['properties']['name']) && $dataObject['properties']['name'] != '') {
                    echo '</div>' . "\n";
                }
            } else {
                if (isset($dataObject['properties']) && $dataObject['properties']['type'] == 'page') {
                    $isLastPage = false;
                    if ($this->rootMdata['lastPageThankYou'] && $dataObject['properties']['pageNumber'] == count($this->dataObject['children']) && count($this->dataObject['children']) > 1) {
                        $isLastPage = true;
                    }
                    if (!$isLastPage) {
                        $last = 0;
                        if ($this->rootMdata['lastPageThankYou']) {
                            $last = 1;
                        }
                        if ($this->rootMdata['pagingInclude'] && $dataObject['properties']['pageNumber'] > 1) {
                            /* translatables */
                            if (isset($this->rootMdata['pagingPrevLabel_translation' . $this->language_tag]) && $this->rootMdata['pagingPrevLabel_translation' . $this->language_tag] != '') {
                                $this->rootMdata['pagingPrevLabel'] = $this->rootMdata['pagingPrevLabel_translation' . $this->language_tag];
                            }
                            /* translatables end */
                            echo '<button data-theme="e" class="bfPrevButton" type="submit" onclick="ff_validate_prevpage(this, \'click\');populateSummarizers();if(typeof bfRefreshAll != \'undefined\'){bfRefreshAll();}" value="' . htmlentities(trim($this->rootMdata['pagingPrevLabel']), ENT_QUOTES, 'UTF-8') . '"><span>' . htmlentities(trim($this->rootMdata['pagingPrevLabel']), ENT_QUOTES, 'UTF-8') . '</span></button>' . "\n";
                        }
                        if ($this->rootMdata['pagingInclude'] && $dataObject['properties']['pageNumber'] < count($this->dataObject['children']) - $last) {
                            /* translatables */
                            if (isset($this->rootMdata['pagingNextLabel_translation' . $this->language_tag]) && $this->rootMdata['pagingNextLabel_translation' . $this->language_tag] != '') {
                                $this->rootMdata['pagingNextLabel'] = $this->rootMdata['pagingNextLabel_translation' . $this->language_tag];
                            }
                            /* translatables end */
                            echo '<button data-theme="e" class="bfNextButton" type="submit" onclick="ff_validate_nextpage(this, \'click\');populateSummarizers();if(typeof bfRefreshAll != \'undefined\'){bfRefreshAll();}" value="' . htmlentities(trim($this->rootMdata['pagingNextLabel']), ENT_QUOTES, 'UTF-8') . '"><span>' . htmlentities(trim($this->rootMdata['pagingNextLabel']), ENT_QUOTES, 'UTF-8') . '</span></button>' . "\n";
                        }
                        if ($this->rootMdata['cancelInclude'] && $dataObject['properties']['pageNumber'] + 1 > count($this->dataObject['children']) - $last) {
                            /* translatables */
                            if (isset($this->rootMdata['cancelLabel_translation' . $this->language_tag]) && $this->rootMdata['cancelLabel_translation' . $this->language_tag] != '') {
                                $this->rootMdata['cancelLabel'] = $this->rootMdata['cancelLabel_translation' . $this->language_tag];
                            }
                            /* translatables end */
                            echo '<button data-theme="e" class="bfCancelButton" type="submit" onclick="ff_resetForm(this, \'click\');"  value="' . htmlentities(trim($this->rootMdata['cancelLabel']), ENT_QUOTES, 'UTF-8') . '"><span>' . htmlentities(trim($this->rootMdata['cancelLabel']), ENT_QUOTES, 'UTF-8') . '</span></button>' . "\n";
                        }
                        $callSubmit = 'ff_validate_submit(this, \'click\')';
                        if ($this->hasFlashUpload) {
                            $callSubmit = 'if(typeof bfAjaxObject101 == \'undefined\' && typeof bfReCaptchaLoaded == \'undefined\'){bfDoFlashUpload()}else{ff_validate_submit(this, \'click\')}';
                        }
                        if ($this->rootMdata['submitInclude'] && $dataObject['properties']['pageNumber'] + 1 > count($this->dataObject['children']) - $last) {
                            /* translatables */
                            if (isset($this->rootMdata['submitLabel_translation' . $this->language_tag]) && $this->rootMdata['submitLabel_translation' . $this->language_tag] != '') {
                                $this->rootMdata['submitLabel'] = $this->rootMdata['submitLabel_translation' . $this->language_tag];
                            }
                            /* translatables end */
                            echo '<button data-theme="b" id="bfSubmitButton" class="bfSubmitButton" type="submit" onclick="if(document.getElementById(\'bfPaymentMethod\')){document.getElementById(\'bfPaymentMethod\').value=\'\';};' . $callSubmit . ';" value="' . htmlentities(trim($this->rootMdata['submitLabel']), ENT_QUOTES, 'UTF-8') . '"><span>' . htmlentities(trim($this->rootMdata['submitLabel']), ENT_QUOTES, 'UTF-8') . '</span></button>' . "\n";
                        }
                    }
                }
            }
        }
    }
コード例 #3
0
    public function process(&$dataObject, $parent = null, $parentPage = null, $index = 0, $childrenLength = 0, $parentFull = null)
    {
        if (isset($dataObject['attributes']) && isset($dataObject['properties'])) {
            $options = array('type' => 'normal', 'displayType' => 'breaks');
            if ($parent != null && $parent['type'] == 'section') {
                $options['type'] = $parent['bfType'];
                $options['displayType'] = $parent['displayType'];
            }
            $parentInline = false;
            $class = ' class="' . $this->fadingClass . '"';
            if ($options['displayType'] == 'inline') {
                $class = ' class="' . $this->fadingClass . '"';
                $parentInline = true;
            }
            //determine non-elements and reduce them from the children total to determine the right span sizes
            $reduce = 0;
            $parentFullChildrenLength = 0;
            if ($parentFull != null && isset($parentFull['children'])) {
                $parentFullChildrenLength = count($parentFull['children']);
                foreach ($parentFull['children'] as $child) {
                    if (!isset($child['properties']) || isset($child['properties']) && isset($child['properties']['bfType']) && $child['properties']['bfType'] == 'bfHidden' || isset($child['properties']) && $child['properties']['type'] != 'element' && $child['properties']['type'] != 'section') {
                        $reduce++;
                    }
                    //if(isset($child['properties']) && isset($child['properties']['off']) && $child['properties']['off'] && $child['properties']['type'] == 'section'){
                    //    $reduce++;
                    //}
                }
            }
            $span = '';
            if ($parentFullChildrenLength - $reduce > 0 && $parentInline) {
                switch (12 / ($parentFullChildrenLength - $reduce)) {
                    case 6:
                        $span = ' span6';
                        break;
                    case 4:
                        $span = ' span4';
                        break;
                    case 3:
                        $span = ' span3';
                        break;
                    case 2.4:
                        $span = ' span2';
                        break;
                    case 2:
                        $span = ' span2';
                        break;
                }
            }
            $mdata = $dataObject['properties'];
            if ($mdata['type'] == 'page') {
                $parentPage = $mdata;
                if ($parentPage['pageNumber'] > 1) {
                    echo '</div><!-- bfPage end -->' . "\n";
                    // closing previous pages
                }
                $display = ' style="display:none;"';
                if (JRequest::getInt('ff_form_submitted', 0) == 0 && JRequest::getInt('ff_page', 1) == $parentPage['pageNumber']) {
                    $display = '';
                } else {
                    if (JRequest::getInt('ff_form_submitted', 0) == 1 && $this->rootMdata['lastPageThankYou'] && $parentPage['pageNumber'] == count($this->dataObject['children'])) {
                        $display = '';
                    } else {
                        if (JRequest::getInt('ff_form_submitted', 0) == 1 && false == $this->rootMdata['lastPageThankYou'] && $parentPage['pageNumber'] == 1) {
                            $display = '';
                        }
                    }
                }
                echo '<div id="bfPage' . $parentPage['pageNumber'] . '" class="bfPage"' . $display . '>' . "\n";
                // opening current page
                /* translatables */
                if (isset($mdata['pageIntro_translation' . $this->language_tag]) && $mdata['pageIntro_translation' . $this->language_tag] != '') {
                    $mdata['pageIntro'] = $mdata['pageIntro_translation' . $this->language_tag];
                }
                /* translatables end */
                if (trim($mdata['pageIntro']) != '') {
                    echo '<div class="' . (isset($this->rootMdata['themebootstrapUseHeroUnit']) && $this->rootMdata['themebootstrapUseHeroUnit'] ? 'hero-unit' : '') . $this->fadingClass . '">' . "\n";
                    $regex = '/{loadposition\\s+(.*?)}/i';
                    $introtext = $mdata['pageIntro'];
                    preg_match_all($regex, $introtext, $matches, PREG_SET_ORDER);
                    jimport('joomla.version');
                    $version = new JVersion();
                    if ($matches && version_compare($version->getShortVersion(), '1.6', '>=')) {
                        $document = JFactory::getDocument();
                        $renderer = $document->loadRenderer('modules');
                        $options = array('style' => 'xhtml');
                        foreach ($matches as $match) {
                            $matcheslist = explode(',', $match[1]);
                            $position = trim($matcheslist[0]);
                            $output = $renderer->render($position, $options, null);
                            $introtext = preg_replace("|{$match['0']}|", addcslashes($output, '\\'), $introtext, 1);
                        }
                    }
                    echo $introtext . "\n";
                    echo '</div>' . "\n";
                }
                if (!$this->useErrorAlerts) {
                    echo '<div class="bfErrorMessage alert alert-error" style="display:none"></div>' . "\n";
                }
            } else {
                if ($mdata['type'] == 'section') {
                    if (isset($dataObject['properties']['name']) && isset($mdata['off']) && $mdata['off']) {
                        echo '<script type="text/javascript"><!--' . "\n" . 'bfDeactivateSection.push("' . $dataObject['properties']['name'] . '");' . "\n" . '//--></script>' . "\n";
                    }
                    /* translatables */
                    if (isset($mdata['title_translation' . $this->language_tag]) && $mdata['title_translation' . $this->language_tag] != '') {
                        $mdata['title'] = $mdata['title_translation' . $this->language_tag];
                    }
                    /* translatables end */
                    if ($mdata['bfType'] == 'section') {
                        echo '<fieldset' . (isset($mdata['off']) && $mdata['off'] ? ' style="display:none" ' : '') . '' . (isset($mdata['off']) && $mdata['off'] ? '' : ' class="' . $span . ' ' . $this->fadingClass . '"') . (isset($dataObject['properties']['name']) && $dataObject['properties']['name'] != "" ? ' id="' . $dataObject['properties']['name'] . '"' : '') . '>' . "\n";
                        if (trim($mdata['title']) != '') {
                            echo '<legend>' . htmlentities(trim($mdata['title']), ENT_QUOTES, 'UTF-8') . '</legend>' . "\n";
                        }
                        echo '<div class="row-fluid"><i style="display:none;"></i>';
                    } else {
                        if ($mdata['bfType'] == 'normal') {
                            if (isset($dataObject['properties']['name']) && $dataObject['properties']['name'] != '') {
                                echo '<section ' . (isset($mdata['off']) && $mdata['off'] ? 'style="display:none" ' : ' class="' . $span . ' ' . $this->fadingClass . '"') . (isset($dataObject['properties']['name']) && $dataObject['properties']['name'] != "" ? ' id="' . $dataObject['properties']['name'] . '"' : '') . '>' . "\n";
                                echo '<div class="row-fluid"><i style="display:none;"></i>';
                            }
                        }
                    }
                    /* translatables */
                    if (isset($mdata['description_translation' . $this->language_tag]) && $mdata['description_translation' . $this->language_tag] != '') {
                        $mdata['description'] = $mdata['description_translation' . $this->language_tag];
                    }
                    /* translatables end */
                    if (trim($mdata['description']) != '') {
                        echo '<div class="bfSectionDescription' . (isset($this->rootMdata['themebootstrapUseWell']) && $this->rootMdata['themebootstrapUseWell'] ? ' well well-small' : '') . '">' . "\n";
                        $regex = '/{loadposition\\s+(.*?)}/i';
                        $introtext = $mdata['description'];
                        preg_match_all($regex, $introtext, $matches, PREG_SET_ORDER);
                        jimport('joomla.version');
                        $version = new JVersion();
                        if ($matches && version_compare($version->getShortVersion(), '1.6', '>=')) {
                            $document = JFactory::getDocument();
                            $renderer = $document->loadRenderer('modules');
                            $options = array('style' => 'xhtml');
                            foreach ($matches as $match) {
                                $matcheslist = explode(',', $match[1]);
                                $position = trim($matcheslist[0]);
                                $output = $renderer->render($position, $options, null);
                                $introtext = preg_replace("|{$match['0']}|", addcslashes($output, '\\'), $introtext, 1);
                            }
                        }
                        echo $introtext . "\n";
                        echo '</div>' . "\n";
                    }
                } else {
                    if ($mdata['type'] == 'element') {
                        $onclick = '';
                        if ($mdata['actionClick'] == 1) {
                            $onclick = 'onclick="' . $mdata['actionFunctionName'] . '(this,\'click\');" ';
                        }
                        $onblur = '';
                        if ($mdata['actionBlur'] == 1) {
                            $onblur = 'onblur="' . $mdata['actionFunctionName'] . '(this,\'blur\');" ';
                        }
                        $onchange = '';
                        if ($mdata['actionChange'] == 1) {
                            $onchange = 'onchange="' . $mdata['actionFunctionName'] . '(this,\'change\');" ';
                        }
                        $onfocus = '';
                        if ($mdata['actionFocus'] == 1) {
                            $onfocus = 'onfocus="' . $mdata['actionFunctionName'] . '(this,\'focus\');" ';
                        }
                        $onselect = '';
                        if (isset($mdata['actionSelect']) && $mdata['actionSelect'] == 1) {
                            $onselect = 'onselect="' . $mdata['actionFunctionName'] . '(this,\'select\');" ';
                        }
                        if ($mdata['bfType'] != 'bfHidden') {
                            echo '<div ' . (isset($mdata['off']) && $mdata['off'] ? 'style="display:none" ' : '') . 'class="bfElemWrap control-group' . $span . (isset($mdata['off']) && $mdata['off'] ? '' : $this->fadingClass) . '" id="bfElemWrap' . $mdata['dbId'] . '">' . "\n";
                        }
                        $label = '';
                        if (!$mdata['hideLabel']) {
                            $maxlengthCounter = '';
                            if ($mdata['bfType'] == 'bfTextarea' && isset($mdata['maxlength']) && $mdata['maxlength'] > 0 && isset($mdata['showMaxlengthCounter']) && $mdata['showMaxlengthCounter']) {
                                $maxlengthCounter = ' <span class=***bfMaxLengthCounter*** id=***bfMaxLengthCounter' . $mdata['dbId'] . '***>(' . $mdata['maxlength'] . ' ' . BFText::_('COM_BREEZINGFORMS_CHARS_LEFT') . ')</span>';
                            }
                            /* translatables */
                            if (isset($mdata['label_translation' . $this->language_tag]) && $mdata['label_translation' . $this->language_tag] != '') {
                                $mdata['label'] = $mdata['label_translation' . $this->language_tag];
                            }
                            if (isset($mdata['hint_translation' . $this->language_tag]) && $mdata['hint_translation' . $this->language_tag] != '') {
                                $mdata['hint'] = $mdata['hint_translation' . $this->language_tag];
                            }
                            /* translatables end */
                            $tipOpen = '';
                            $tipClose = '';
                            $labelText = trim($mdata['label']) . str_replace("***", "\"", $maxlengthCounter);
                            if (trim($mdata['hint']) != '') {
                                jimport('joomla.version');
                                $version = new JVersion();
                                if (version_compare($version->getShortVersion(), '3.0', '<') || version_compare($version->getShortVersion(), '3.0', '>=') && isset($this->rootMdata['joomlaHint']) && $this->rootMdata['joomlaHint']) {
                                    JHTML::_('behavior.tooltip');
                                    $content = trim($mdata['hint']);
                                    $tipOpen = '<span title="' . addslashes(trim($mdata['label'])) . '::' . str_replace(array("\n", "\r"), array("", ""), htmlentities($content, ENT_QUOTES, 'UTF-8')) . '" class="editlinktip hasTip">';
                                    $tipClose = '</span>';
                                } else {
                                    $content = trim($mdata['hint']);
                                    // compat
                                    $explodeHint = explode('<<<style', trim($mdata['hint']));
                                    if (count($explodeHint) > 1 && trim($explodeHint[0]) != '') {
                                        $content = trim($explodeHint[1]);
                                    }
                                    $tipOpen = '<span class="hasTooltip" title="' . JHtml::tooltipText($content) . '">';
                                    $tipClose = '</span>';
                                }
                            }
                            if ($tipOpen) {
                                $tipOpen = $tipOpen . '<i class="icon-question-sign">&nbsp;</i> ';
                            }
                            $for = '';
                            if ($mdata['bfType'] == 'bfTextfield' || $mdata['bfType'] == 'bfTextarea' || $mdata['bfType'] == 'bfCheckbox' || $mdata['bfType'] == 'bfCheckboxGroup' || $mdata['bfType'] == 'bfCalendar' || $mdata['bfType'] == 'bfCalendarResponsive' || $mdata['bfType'] == 'bfSelect' || $mdata['bfType'] == 'bfRadioGroup' || $mdata['bfType'] == 'bfFile' && (!isset($mdata['flashUploader']) && !isset($mdata['html5']) || isset($mdata['flashUploader']) && !$mdata['flashUploader'] && (isset($mdata['html5']) && !$mdata['html5']))) {
                                $for = 'for="ff_elem' . $mdata['dbId'] . '"';
                            }
                            if ($mdata['bfType'] == 'bfCaptcha') {
                                $for = 'for="bfCaptchaEntry"';
                            } else {
                                if ($mdata['bfType'] == 'bfReCaptcha') {
                                    $for = 'for="recaptcha_response_field"';
                                }
                            }
                            $required = '';
                            if ($mdata['required']) {
                                $required = ' <i class="icon-asterisk"></i> ' . "\n";
                            }
                            $label = '<label class="control-label' . (isset($this->rootMdata['themebootstrapLabelTop']) && $this->rootMdata['themebootstrapLabelTop'] ? ' bfLabelBlock' : '') . '" id="bfLabel' . $mdata['dbId'] . '" ' . $for . '>' . $tipOpen . str_replace("***", "\"", $labelText) . $tipClose . $required . '</label>' . "\n";
                        }
                        $readonly = '';
                        if ($mdata['readonly']) {
                            $readonly = 'readonly="readonly" ';
                        }
                        $tabIndex = '';
                        if ($mdata['tabIndex'] != -1 && is_numeric($mdata['tabIndex'])) {
                            $tabIndex = 'tabindex="' . intval($mdata['tabIndex']) . '" ';
                        }
                        for ($i = 0; $i < $this->p->rowcount; $i++) {
                            $row = $this->p->rows[$i];
                            if ($mdata['bfName'] == $row->name) {
                                if ((isset($mdata['value']) || isset($mdata['list']) || isset($mdata['group'])) && ($mdata['bfType'] == 'bfTextfield' || $mdata['bfType'] == 'bfTextarea' || $mdata['bfType'] == 'bfCheckbox' || $mdata['bfType'] == 'bfCheckboxGroup' || $mdata['bfType'] == 'bfSubmitButton' || $mdata['bfType'] == 'bfHidden' || $mdata['bfType'] == 'bfCalendar' || $mdata['bfType'] == 'bfCalendarResponsive' || $mdata['bfType'] == 'bfSelect' || $mdata['bfType'] == 'bfRadioGroup')) {
                                    if ($mdata['bfType'] == 'bfSelect') {
                                        $mdata['list'] = $this->p->replaceCode($row->data2, "data2 of " . $mdata['bfName'], 'e', $mdata['dbId'], 0);
                                    } else {
                                        if ($mdata['bfType'] == 'bfCheckboxGroup' || $mdata['bfType'] == 'bfRadioGroup') {
                                            $mdata['group'] = $this->p->replaceCode($row->data2, "data2 of " . $mdata['bfName'], 'e', $mdata['dbId'], 0);
                                        } else {
                                            $mdata['value'] = $this->p->replaceCode($row->data1, "data1 of " . $mdata['bfName'], 'e', $mdata['dbId'], 0);
                                        }
                                    }
                                }
                                if (isset($mdata['checked']) && $mdata['bfType'] == 'bfCheckbox') {
                                    $mdata['checked'] = $row->flag1 == 1 ? true : false;
                                }
                                break;
                            }
                        }
                        switch ($mdata['bfType']) {
                            case 'bfTextfield':
                                $type = 'text';
                                if ($mdata['password']) {
                                    $type = 'password';
                                }
                                $maxlength = '';
                                if (is_numeric($mdata['maxLength'])) {
                                    $maxlength = 'maxlength="' . intval($mdata['maxLength']) . '" ';
                                }
                                $size = '';
                                if ($mdata['size'] != '') {
                                    $size = 'style="width:' . htmlentities(strip_tags($mdata['size'])) . ' !important; min-width:' . htmlentities(strip_tags($mdata['size'])) . ' !important;" ';
                                }
                                /* translatables */
                                if (isset($mdata['value_translation' . $this->language_tag]) && $mdata['value_translation' . $this->language_tag] != '') {
                                    $mdata['value'] = $mdata['value_translation' . $this->language_tag];
                                }
                                if (isset($mdata['placeholder_translation' . $this->language_tag]) && $mdata['placeholder_translation' . $this->language_tag] != '') {
                                    $mdata['placeholder'] = $mdata['placeholder_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                echo '<div class="controls form-inline">';
                                echo $label;
                                echo '<input ' . (isset($mdata['placeholder']) && $mdata['placeholder'] ? 'placeholder="' . htmlentities($mdata['placeholder'], ENT_QUOTES, 'UTF-8') . '" ' : '') . 'class="ff_elem inputbox" ' . $size . $tabIndex . $maxlength . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="' . $type . '" name="ff_nm_' . $mdata['bfName'] . '[]" value="' . htmlentities(trim($mdata['value']), ENT_QUOTES, 'UTF-8') . '" id="ff_elem' . $mdata['dbId'] . '"/>' . "\n";
                                echo '</div>';
                                if ($mdata['mailbackAsSender']) {
                                    echo '<input type="hidden" name="mailbackSender[' . $mdata['bfName'] . ']" value="true"/>' . "\n";
                                }
                                break;
                            case 'bfTextarea':
                                $width = '';
                                if ($mdata['width'] != '') {
                                    $width = 'width:' . htmlentities(strip_tags($mdata['width'])) . ' !important; min-width:' . htmlentities(strip_tags($mdata['width'])) . ' !important;';
                                }
                                $height = '';
                                if ($mdata['height'] != '') {
                                    $height = 'height:' . htmlentities(strip_tags($mdata['height'])) . ';';
                                }
                                $size = '';
                                if ($height != '' || $width != '') {
                                    $size = 'style="' . $width . $height . '" ';
                                }
                                $onkeyup = '';
                                if (isset($mdata['maxlength']) && $mdata['maxlength'] > 0) {
                                    $onkeyup = 'onkeyup="bfCheckMaxlength(' . intval($mdata['dbId']) . ', ' . intval($mdata['maxlength']) . ', ' . (isset($mdata['showMaxlengthCounter']) && $mdata['showMaxlengthCounter'] ? 'true' : 'false') . ')" ';
                                }
                                /* translatables */
                                if (isset($mdata['placeholder_translation' . $this->language_tag]) && $mdata['placeholder_translation' . $this->language_tag] != '') {
                                    $mdata['placeholder'] = $mdata['placeholder_translation' . $this->language_tag];
                                }
                                if (isset($mdata['value_translation' . $this->language_tag]) && $mdata['placeholder_translation' . $this->language_tag] != '') {
                                    $mdata['value'] = $mdata['value_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                echo '<div class="controls form-inline">';
                                echo $label;
                                if (isset($mdata['is_html']) && $mdata['is_html']) {
                                    echo '<div style="display: inline-block; vertical-align: top; width: ' . strip_tags($mdata['width']) . ';">';
                                    JImport('joomla.html.editor');
                                    $editor = JFactory::getEditor();
                                    $this->htmltextareas[] = 'ff_nm_' . $mdata['bfName'] . '[]';
                                    echo $editor->display('ff_nm_' . $mdata['bfName'] . '[]', htmlentities(trim($mdata['value']), ENT_QUOTES, 'UTF-8'), strip_tags($mdata['width']), strip_tags($mdata['height']), '75', '20');
                                    echo '</div>';
                                    echo '<style type="text/css">.toggle-editor{display: none;}</style>';
                                } else {
                                    echo '<textarea ' . (isset($mdata['placeholder']) && $mdata['placeholder'] ? 'placeholder="' . htmlentities($mdata['placeholder'], ENT_QUOTES, 'UTF-8') . '" ' : '') . 'cols="20" rows="5" class="ff_elem inputbox" ' . $onkeyup . $size . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '">' . htmlentities(trim($mdata['value']), ENT_QUOTES, 'UTF-8') . '</textarea>' . "\n";
                                }
                                echo '</div>';
                                break;
                            case 'bfRadioGroup':
                                /* translatables */
                                if (isset($mdata['group_translation' . $this->language_tag]) && $mdata['group_translation' . $this->language_tag] != '') {
                                    $mdata['group'] = $mdata['group_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                if ($mdata['group'] != '') {
                                    echo '<div class="controls form-inline">';
                                    echo $label;
                                    if ($mdata['wrap']) {
                                        echo '<div style="display: inline-block; vertical-align: top;">';
                                    }
                                    $mdata['group'] = str_replace("\r", '', $mdata['group']);
                                    $gEx = explode("\n", $mdata['group']);
                                    $lines = count($gEx);
                                    for ($i = 0; $i < $lines; $i++) {
                                        $idExt = $i != 0 ? '_' . $i : '';
                                        $iEx = explode(";", $gEx[$i]);
                                        $iCnt = count($iEx);
                                        if ($iCnt == 3) {
                                            echo '<label ' . ($mdata['wrap'] ? 'style="display: block;" ' : 'style="vertical-align: baseline;" ') . 'class="radio' . (!$mdata['wrap'] ? ' inline ' : '') . '" id="bfGroupLabel' . $mdata['dbId'] . $idExt . '" for="ff_elem' . $mdata['dbId'] . $idExt . '">';
                                            echo '<input ' . ($iEx[0] == 1 ? 'checked="checked" ' : '') . ' class="ff_elem" ' . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . ($readonly ? ' disabled="disabled" ' : '') . 'type="radio" name="ff_nm_' . $mdata['bfName'] . '[]" value="' . htmlentities(trim($iEx[2]), ENT_QUOTES, 'UTF-8') . '" id="ff_elem' . $mdata['dbId'] . $idExt . '"/>' . "\n";
                                            echo trim($iEx[1]) . '</label>' . ($i + 1 < $lines && $mdata['wrap'] ? '<div style="clear:both;"></div>' : '');
                                        }
                                    }
                                    if ($mdata['wrap']) {
                                        echo '</div>';
                                    }
                                    echo '</div>';
                                }
                                break;
                            case 'bfCheckboxGroup':
                                /* translatables */
                                if (isset($mdata['group_translation' . $this->language_tag]) && $mdata['group_translation' . $this->language_tag] != '') {
                                    $mdata['group'] = $mdata['group_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                if ($mdata['group'] != '') {
                                    echo '<div class="controls form-inline">';
                                    echo $label;
                                    if ($mdata['wrap']) {
                                        echo '<div style="display: inline-block; vertical-align: top;">';
                                    }
                                    $mdata['group'] = str_replace("\r", '', $mdata['group']);
                                    $gEx = explode("\n", $mdata['group']);
                                    $lines = count($gEx);
                                    for ($i = 0; $i < $lines; $i++) {
                                        $idExt = $i != 0 ? '_' . $i : '';
                                        $iEx = explode(";", $gEx[$i]);
                                        $iCnt = count($iEx);
                                        if ($iCnt == 3) {
                                            echo '<label ' . ($mdata['wrap'] ? 'style="display: block;" ' : 'style="vertical-align: baseline;" ') . 'class="checkbox' . (!$mdata['wrap'] ? ' inline ' : '') . '" id="bfGroupLabel' . $mdata['dbId'] . $idExt . '">';
                                            echo '<input ' . ($iEx[0] == 1 ? 'checked="checked" ' : '') . ' class="ff_elem" ' . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . ($readonly ? ' disabled="disabled" ' : '') . 'type="checkbox" name="ff_nm_' . $mdata['bfName'] . '[]" value="' . htmlentities(trim($iEx[2]), ENT_QUOTES, 'UTF-8') . '" id="ff_elem' . $mdata['dbId'] . $idExt . '"/>' . "\n";
                                            echo trim($iEx[1]) . '</label>' . ($i + 1 < $lines && $mdata['wrap'] ? '<div style="clear:both;"></div>' : '');
                                        }
                                    }
                                    if ($mdata['wrap']) {
                                        echo '</div>';
                                    }
                                    echo '</div>';
                                }
                                break;
                            case 'bfCheckbox':
                                echo '<div class="controls form-inline">';
                                echo $label;
                                echo '<input style="vertical-align: baseline;" class="ff_elem" ' . ($mdata['checked'] ? 'checked="checked" ' : '') . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . ($readonly ? ' disabled="disabled" ' : '') . 'type="checkbox" name="ff_nm_' . $mdata['bfName'] . '[]" value="' . htmlentities(trim($mdata['value']), ENT_QUOTES, 'UTF-8') . '" id="ff_elem' . $mdata['dbId'] . '"/>' . "\n";
                                echo '</div>';
                                if ($mdata['mailbackAccept']) {
                                    echo '<input type="hidden" class="ff_elem" name="mailbackConnectWith[' . $mdata['mailbackConnectWith'] . ']" value="true_' . $mdata['bfName'] . '"/>' . "\n";
                                }
                                break;
                            case 'bfSelect':
                                /* translatables */
                                if (isset($mdata['list_translation' . $this->language_tag]) && $mdata['list_translation' . $this->language_tag] != '') {
                                    $mdata['list'] = $mdata['list_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                if ($mdata['list'] != '') {
                                    $width = '';
                                    if (isset($mdata['width']) && $mdata['width'] != '') {
                                        $width = 'width:' . htmlentities(strip_tags($mdata['width'])) . ' !important; min-width:' . htmlentities(strip_tags($mdata['width'])) . ' !important;';
                                    }
                                    $height = '';
                                    if (isset($mdata['height']) && $mdata['height'] != '') {
                                        $height = 'height:' . htmlentities(strip_tags($mdata['height'])) . ';';
                                    }
                                    $size = '';
                                    if ($height != '' || $width != '') {
                                        $size = 'style="' . $width . $height . '" ';
                                    }
                                    $mdata['list'] = str_replace("\r", '', $mdata['list']);
                                    $gEx = explode("\n", $mdata['list']);
                                    $lines = count($gEx);
                                    echo '<div class="controls form-inline">';
                                    echo $label;
                                    echo '<select class="ff_elem chzn-done" ' . $size . ($mdata['multiple'] ? 'multiple="multiple" ' : '') . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '">' . "\n";
                                    for ($i = 0; $i < $lines; $i++) {
                                        $iEx = explode(";", $gEx[$i]);
                                        $iCnt = count($iEx);
                                        if ($iCnt == 3) {
                                            echo '<option ' . ($iEx[0] == 1 ? 'selected="selected" ' : '') . 'value="' . htmlentities(trim($iEx[2]), ENT_QUOTES, 'UTF-8') . '">' . htmlentities(trim($iEx[1]), ENT_QUOTES, 'UTF-8') . '</option>' . "\n";
                                        }
                                    }
                                    echo '</select>' . "\n";
                                    echo '</div>';
                                }
                                break;
                            case 'bfFile':
                                echo '<div class="controls form-inline">';
                                echo $label;
                                if (isset($mdata['flashUploader']) && $mdata['flashUploader'] || isset($mdata['html5']) && $mdata['html5']) {
                                    $base = explode('/', JURI::base());
                                    if (isset($base[count($base) - 2]) && $base[count($base) - 2] == 'administrator') {
                                        unset($base[count($base) - 2]);
                                        $base = array_merge($base);
                                    }
                                    $base = implode('/', $base);
                                    echo '<input type="hidden" id="flashUpload' . $mdata['bfName'] . '" name="flashUpload' . $mdata['bfName'] . '" value="bfFlashFileQueue' . $mdata['dbId'] . '"/>' . "\n";
                                    $this->hasFlashUpload = true;
                                    //allowedFileExtensions
                                    $allowedExts = explode(',', $mdata['allowedFileExtensions']);
                                    $allowedExtsCnt = count($allowedExts);
                                    for ($i = 0; $i < $allowedExtsCnt; $i++) {
                                        $allowedExts[$i] = $allowedExts[$i];
                                    }
                                    $exts = '';
                                    if ($allowedExtsCnt != 0) {
                                        $exts = implode(',', $allowedExts);
                                    }
                                    $bytes = isset($mdata['flashUploaderBytes']) && is_numeric($mdata['flashUploaderBytes']) && $mdata['flashUploaderBytes'] > 0 ? "max_file_size : '" . intval($mdata['flashUploaderBytes']) . "'," : '';
                                    echo "\n                                                        <span id=\"bfUploadContainer" . $mdata['dbId'] . "\">\n                                                            <button type=\"button\" class=\"btn bfUploadButton button\" id=\"bfPickFiles" . $mdata['dbId'] . "\"><i class=\"icon-upload\"></i></button>\n\t\t\t\t\t\t\t</span>\n                                                        <span id=\"bfUploader" . $mdata['bfName'] . "\"></span>\n                                                        <div class=\"bfFlashFileQueueClass\" id=\"bfFlashFileQueue" . $mdata['dbId'] . "\"></div>\n                                                        <script type=\"text/javascript\">\n                                                        <!--\n\t\t\t\t\t\t\tbfFlashUploaders.push('ff_elem" . $mdata['dbId'] . "');\n                                                        var bfFlashFileQueue" . $mdata['dbId'] . " = {};\n                                                        function bfUploadImageThumb(file) {\n                                                                var img;\n                                                                img = new o.Image;\n                                                                img.onload = function() {\n                                                                        img.embed(JQuery('#' + file.id+'thumb').get(0), { \n                                                                                width: 100, \n                                                                                height: 60, \n                                                                                crop: true,\n                                                                                swf_url: mOxie.resolveUrl('" . $base . "components/com_breezingforms/libraries/jquery/plupload/Moxie.swf')\n                                                                        });\n                                                                };\n\n                                                                img.onembedded = function() {\n                                                                        img.destroy();\n                                                                };\n\n                                                                img.onerror = function() {\n                                                                        \n                                                                };\n                                                                \n                                                                img.load(file.getSource());\n                                                                \n                                                        }\n                                                        JQuery(document).ready(\n                                                            function() {\n                                                                var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/i) ? true : false );\n                                                                var uploader = new plupload.Uploader({\n                                                                        multi_selection: " . (isset($mdata['flashUploaderMulti']) && $mdata['flashUploaderMulti'] ? 'true' : 'false') . ",\n                                                                        unique_names: iOS,\n                                                                        chunk_size: '100kb',\n                                                                        runtimes : '" . (isset($mdata['html5']) && $mdata['html5'] ? 'html5,' : '') . (isset($mdata['flashUploader']) && $mdata['flashUploader'] ? 'flash,' : '') . "html4',\n                                                                        browse_button : 'bfPickFiles" . $mdata['dbId'] . "',\n                                                                        container: 'bfUploadContainer" . $mdata['dbId'] . "',\n                                                                        file_data_name: 'Filedata',\n                                                                        multipart_params: { form: " . $this->p->form . ", itemName : '" . $mdata['bfName'] . "', bfFlashUploadTicket: '" . $this->flashUploadTicket . "', option: 'com_breezingforms', format: 'html', flashUpload: 'true', Itemid: 0 },\n                                                                        " . $bytes . "\n                                                                        url : '" . $base . (BFJoomlaConfig::get('config.sef') && !BFJoomlaConfig::get('config.sef_rewrite') ? 'index.php/' : '') . (JRequest::getCmd('lang', '') && BFJoomlaConfig::get('config.sef') ? JRequest::getCmd('lang', '') . (BFJoomlaConfig::get('config.sef_rewrite') ? 'index.php' : '') : 'index.php') . "',\n                                                                        flash_swf_url : '" . $base . "components/com_breezingforms/libraries/jquery/plupload/Moxie.swf',\n                                                                        filters : [\n                                                                                {title : '" . addslashes(BFText::_('COM_BREEZINGFORMS_CHOOSE_FILE')) . "', extensions : '" . $exts . "'}\n                                                                        ]\n                                                                });\n                                                                uploader.bind('FilesAdded', function(up, files) {\n                                                                        for (var i in files) {\n                                                                                if(typeof files[i].id != 'undefined' && files[i].id != null){\n                                                                                    var fsize = '';\n                                                                                    if(typeof files[i].size != 'undefined'){\n                                                                                        fsize = '(' + plupload.formatSize(files[i].size) + ') ';\n                                                                                    }\n                                                                                    JQuery('#bfFileQueue').append( '<div id=\"' + files[i].id + 'queue\">' + (iOS ? '' : files[i].name) + ' '+fsize+'<b></b></div>' );\n                                                                                }\n                                                                        }\n                                                                        for (var i in files) {\n                                                                            if(typeof files[i].id != 'undefined' && files[i].id != null){\n                                                                                var error = false;\n                                                                                var fsize = '';\n                                                                                if(typeof files[i].size != 'undefined'){\n                                                                                    fsize = '(' + plupload.formatSize(files[i].size) + ') ';\n                                                                                }\n                                                                                JQuery('#bfFlashFileQueue" . $mdata['dbId'] . "').append('<div class=\"bfFileQueueItem\" id=\"' + files[i].id + 'queueitem\"><div id=\"' + files[i].id + 'thumb\"></div><div id=\"' + files[i].id + '\"><img id=\"' + files[i].id + 'cancel\" src=\"" . $this->cancelImagePath . "\" style=\"cursor: pointer; padding-right: 10px;\" />' + (iOS ? '' : files[i].name ? files[i].name.substring(0,12) : '') + ' ' + fsize + '<b id=\"' + files[i].id + 'msg\" style=\"color:red;\"></b></div></div>');\n                                                                                var file_ = files[i];\n                                                                                var uploader_ = uploader;\n                                                                                var bfUploaders_ = bfUploaders;\n                                                                                JQuery('#' + files[i].id + 'cancel').click( \n                                                                                    function(){\n                                                                                        for( var i = 0; i < bfUploaders_.length; i++ ){\n                                                                                            bfUploaders_[i].stop();\n                                                                                        }\n                                                                                        var id_ = this.id.split('cancel');\n                                                                                        id_ = id_[0];\n                                                                                        uploader_.removeFileById(id_);\n                                                                                        JQuery('#'+id_+'queue').remove();\n                                                                                        JQuery('#'+id_+'queueitem').remove();\n                                                                                        bfFlashUploadersLength--;\n                                                                                        for( var i = 0; i < bfUploaders_.length; i++ ){\n                                                                                            bfUploaders_[i].start();\n                                                                                        }\n                                                                                    } \n                                                                                );\n                                                                                var thebytes = " . (isset($mdata['flashUploaderBytes']) && is_numeric($mdata['flashUploaderBytes']) && $mdata['flashUploaderBytes'] > 0 ? intval($mdata['flashUploaderBytes']) : '0') . ";\n                                                                                if(thebytes > 0 && typeof files[i].size != 'undefined' && files[i].size > thebytes){\n                                                                                     alert(' " . addslashes(BFText::_('COM_BREEZINGFORMS_FLASH_UPLOADER_TOO_LARGE')) . "');\n                                                                                     error = true;\n                                                                                }\n                                                                                var ext = files[i].name.split('.').pop().toLowerCase();\n                                                                                var exts = '" . strtolower($exts) . "'.split(',');\n                                                                                var found = 0;\n                                                                                for (var x in exts){\n                                                                                    if(exts[x] == ext){\n                                                                                        found++;\n                                                                                    }\n                                                                                }\n                                                                                if(found == 0){\n                                                                                    alert( ' " . addslashes(BFText::_('COM_BREEZINGFORMS_FILE_EXTENSION_NOT_ALLOWED')) . "' );\n                                                                                    error = true;\n                                                                                }\n                                                                                if(error){\n                                                                                    JQuery('#'+files[i].id+'queue').remove();\n                                                                                    JQuery('#'+files[i].id+'queueitem').remove();\n                                                                                }else{\n                                                                                    bfFlashUploadersLength++;\n                                                                                }\n                                                                                bfUploadImageThumb(files[i]);\n                                                                            }\n                                                                        }\n                                                                });\n                                                                uploader.bind('UploadProgress', function(up, file) {\n                                                                    if(typeof JQuery('#'+file.id+'queue').get(0) != 'undefined'){\n                                                                        JQuery('#'+file.id+'queue').get(0).getElementsByTagName('b')[0].innerHTML = file.percent + '% <div style=\"height: 5px;width: ' + (file.percent*1.5) + 'px;background-color: #9de24f;\"></div>';\n                                                                    }\n                                                                });\n                                                                uploader.bind('FileUploaded', function(up, file, response) {\n                                                                    if(response.response!=''){\n                                                                        if(response.response !== null){\n                                                                            alert(response.response);\n                                                                        }\n                                                                    }\n                                                                    JQuery('#'+file.id+'queue').remove();\n                                                                });\n                                                                uploader.init();\n                                                                bfUploaders.push(uploader);\n                                                            });\n\t\t\t\t\t\t\t//-->\n                                                        </script>\n\t\t\t\t\t\t\t";
                                    echo '<input class="ff_elem" ' . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="hidden" name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '"/>' . "\n";
                                } else {
                                    echo '<input class="ff_elem" ' . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="file" name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '"/>' . "\n";
                                }
                                if ($mdata['attachToAdminMail']) {
                                    echo '<input type="hidden" name="attachToAdminMail[' . $mdata['bfName'] . ']" value="true"/>' . "\n";
                                }
                                if ($mdata['attachToUserMail']) {
                                    echo '<input type="hidden" name="attachToUserMail[' . $mdata['bfName'] . ']" value="true"/>' . "\n";
                                }
                                echo '</div>';
                                break;
                            case 'bfSubmitButton':
                                /* translatables */
                                if (isset($mdata['src_translation' . $this->language_tag]) && $mdata['src_translation' . $this->language_tag] != '') {
                                    $mdata['src'] = $mdata['src_translation' . $this->language_tag];
                                }
                                if (isset($mdata['value_translation' . $this->language_tag]) && $mdata['value_translation' . $this->language_tag] != '') {
                                    $mdata['value'] = $mdata['value_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                echo '<div class="controls form-inline">';
                                echo $label;
                                $value = '';
                                $type = 'submit';
                                $src = '';
                                if ($mdata['src'] != '') {
                                    $type = 'image';
                                    $src = 'src="' . $mdata['src'] . '" ';
                                }
                                if ($mdata['value'] != '') {
                                    $value = 'value="' . htmlentities(trim($mdata['value']), ENT_QUOTES, 'UTF-8') . '" ';
                                }
                                if ($mdata['actionClick'] == 1) {
                                    $onclick = 'onclick="if(typeof bf_htmltextareainit != \'undefined\'){ bf_htmltextareainit() }populateSummarizers();if(document.getElementById(\'bfPaymentMethod\')){document.getElementById(\'bfPaymentMethod\').value=\'\';};' . $mdata['actionFunctionName'] . '(this,\'click\');return false;" ';
                                } else {
                                    $onclick = 'onclick="if(typeof bf_htmltextareainit != \'undefined\'){ bf_htmltextareainit() }populateSummarizers();if(document.getElementById(\'bfPaymentMethod\')){document.getElementById(\'bfPaymentMethod\').value=\'\';};return false;" ';
                                }
                                if ($src == '') {
                                    echo '<button type="button" class="ff_elem btn button" ' . $value . $src . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="' . $type . '" name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '">' . $mdata['value'] . '</button>' . "\n";
                                } else {
                                    echo '<input type="button" class="ff_elem" ' . $value . $src . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="' . $type . '" alt="" name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '" value="' . $mdata['value'] . '"/>' . "\n";
                                }
                                echo '</div>';
                                break;
                            case 'bfHidden':
                                echo '<input class="ff_elem" type="hidden" name="ff_nm_' . $mdata['bfName'] . '[]" value="' . htmlentities(trim($mdata['value']), ENT_QUOTES, 'UTF-8') . '" id="ff_elem' . $mdata['dbId'] . '"/>' . "\n";
                                break;
                            case 'bfSummarize':
                                /* translatables */
                                if (isset($mdata['emptyMessage_translation' . $this->language_tag]) && $mdata['emptyMessage_translation' . $this->language_tag] != '') {
                                    $mdata['emptyMessage'] = $mdata['emptyMessage_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                echo '<div class="controls form-inline">';
                                echo $label;
                                echo '<div style="display: inline-block; vertical-align: top;" class="ff_elem bfSummarize" id="ff_elem' . $mdata['dbId'] . '"></div>' . "\n";
                                echo '<script type="text/javascript"><!--' . "\n" . 'bfRegisterSummarize("ff_elem' . $mdata['dbId'] . '", "' . $mdata['connectWith'] . '", "' . $mdata['connectType'] . '", "' . addslashes($mdata['emptyMessage']) . '", ' . ($mdata['hideIfEmpty'] ? 'true' : 'false') . ')' . "\n" . '//--></script>';
                                if (trim($mdata['fieldCalc']) != '') {
                                    echo '<script type="text/javascript">
                                                        <!--
							function bfFieldCalcff_elem' . $mdata['dbId'] . '(value){
								if(!isNaN(value)){
									value = Number(value);
								}
								' . $mdata['fieldCalc'] . '
								return value;
							}
                                                        //-->
							</script>';
                                }
                                echo '</div>';
                                break;
                            case 'bfReCaptcha':
                                echo '<div class="controls form-inline well well-small">';
                                echo $label;
                                if (isset($mdata['pubkey']) && $mdata['pubkey'] != '') {
                                    $http = 'http';
                                    if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') {
                                        $http .= 's';
                                    }
                                    $lang = JRequest::getVar('lang', '');
                                    if ($lang != '') {
                                        $lang = ',lang: "' . addslashes($lang) . '"';
                                    }
                                    JFactory::getDocument()->addScript($http . '://www.google.com/recaptcha/api/js/recaptcha.js');
                                    echo '<div class="bfReCaptchaDiv" id="recaptcha_widget" style="display: inline-block !important;">

                                                        <div class="control-group">
                                                            
                                                            <div class="controls">
                                                                <span id="recaptcha_image" class="thumbnail"></span>
                                                            </div>
                                                        </div>

                                                       <div class="control-group">

                                                          <div class="controls">
                                                                  <input type="text" id="recaptcha_response_field" name="recaptcha_response_field" class="input-recaptcha" />
                                                                  <button type="button" class="btn button" onclick="Recaptcha.reload()"><i class="icon-refresh"></i></button>
                                                                  <button type="button" class="btn recaptcha_only_if_image button" onclick="Recaptcha.switch_type(\'audio\')"><i title="Get an audio CAPTCHA" class="icon-play"></i></button>
                                                                  <button type="button" class="btn recaptcha_only_if_audio button" onclick="Recaptcha.switch_type(\'image\')"><i title="Get an image CAPTCHA" class="icon-picture"></i></button>
                                                                  <button type="button" class="btn button" onclick="Recaptcha.showhelp()"><i class="icon-question-sign"></i></button>
                                                          </div>
                                                    </div>

                                                </div>
                                                <script type="text/javascript">
                                                <!--
                                                Recaptcha.create("' . $mdata['pubkey'] . '",
                                                    "bfReCaptchaDiv", {
                                                    theme: "custom",
                                                    custom_theme_widget: "recaptcha_widget"
                                                    ' . $lang . '
                                                    }
                                                );
                                                -->
                                                </script>' . "\n";
                                } else {
                                    echo '<span class="bfCaptcha">' . "\n";
                                    echo 'WARNING: No public key given for ReCaptcha element!';
                                    echo '</span>' . "\n";
                                }
                                echo '</div>';
                                break;
                            case 'bfCaptcha':
                                echo '<div class="controls form-inline">';
                                echo $label;
                                if (JFactory::getApplication()->isSite()) {
                                    $captcha_url = JURI::root(true) . '/components/com_breezingforms/images/captcha/securimage_show.php';
                                } else {
                                    $captcha_url = JURI::root(true) . '/administrator/components/com_breezingforms/images/captcha/securimage_show.php';
                                }
                                echo '<div style="display: inline-block;">';
                                echo '<img alt="" ' . (isset($mdata['width']) && intval($mdata['width']) > 0 ? ' style="width: ' . intval($mdata['width']) . 'px !important;min-width: ' . intval($mdata['width']) . 'px !important;max-width: ' . intval($mdata['width']) . 'px !important;"' : 'style="width: 230px !important;min-width: 230px !important;max-width: 230px !important;"') . ' id="ff_capimgValue" class="ff_capimg img-polaroid" src="' . $captcha_url . '"/>' . "\n";
                                echo '<br/>';
                                echo '<br/>';
                                echo '<div class="input-append">';
                                echo '<input ' . (isset($mdata['width']) && intval($mdata['width']) > 0 ? ' style="width:' . (intval($mdata['width']) - 45) . 'px !important;min-width:' . (intval($mdata['width']) - 45) . 'px !important;max-width:' . (intval($mdata['width']) - 45) . 'px !important;"' : ' style="width: 185px !important;min-width: 185px !important;max-width: 185px !important;"') . ' autocomplete="off" class="ff_elem bfCaptchaField" type="text" name="bfCaptchaEntry" id="bfCaptchaEntry" />' . "\n";
                                echo '<button type="button" class="ff_elem btn button" onclick="document.getElementById(\'bfCaptchaEntry\').value=\'\';document.getElementById(\'bfCaptchaEntry\').focus();document.getElementById(\'ff_capimgValue\').src = \'' . $captcha_url . '?bfMathRandom=\' + Math.random(); return false"><i class="icon-refresh"></i></button>' . "\n";
                                echo '</div>';
                                echo '</div>';
                                echo '</div>';
                                break;
                            case 'bfCalendar':
                                /* translatables */
                                if (isset($mdata['value_translation' . $this->language_tag]) && $mdata['value_translation' . $this->language_tag] != '') {
                                    $mdata['value'] = $mdata['value_translation' . $this->language_tag];
                                }
                                if (isset($mdata['format_translation' . $this->language_tag]) && $mdata['format_translation' . $this->language_tag] != '') {
                                    $mdata['format'] = $mdata['format_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                echo '<div class="controls form-inline">';
                                echo $label;
                                JHTML::_('behavior.calendar');
                                $size = '';
                                if ($mdata['size'] != '') {
                                    $size = 'style="width:' . htmlentities(strip_tags($mdata['size'])) . '" ';
                                }
                                $exploded = explode('::', trim($mdata['value']));
                                $left = '';
                                $right = '';
                                if (count($exploded) == 2) {
                                    $left = trim($exploded[0]);
                                    $right = trim($exploded[1]);
                                } else {
                                    $right = trim($exploded[0]);
                                }
                                echo '<div class="input-append">' . "\n";
                                echo '<input autocomplete="off" class="ff_elem" ' . $size . 'type="text" name="ff_nm_' . $mdata['bfName'] . '[]"  id="ff_elem' . $mdata['dbId'] . '" value="' . htmlentities($left, ENT_QUOTES, 'UTF-8') . '"/>' . "\n";
                                echo '<button type="button" id="ff_elem' . $mdata['dbId'] . '_calendarButton" type="submit" class="bfCalendar btn button" value="' . htmlentities($right, ENT_QUOTES, 'UTF-8') . '"><span><i class="icon-calendar"></i>' . htmlentities($right == '...' ? '' : $right, ENT_QUOTES, 'UTF-8') . '</span></button>' . "\n";
                                echo '</div>' . "\n";
                                echo '<script type="text/javascript">
                                                <!--
                                                Calendar.setup({
                                                        inputField     :    "ff_elem' . $mdata['dbId'] . '",
                                                        ifFormat       :    "' . $mdata['format'] . '",
                                                        button         :    "ff_elem' . $mdata['dbId'] . '_calendarButton",
                                                        align          :    "Bl",
                                                        singleClick    :    true
                                                    });
                                                //-->
                                                </script>' . "\n";
                                echo '</div>';
                                break;
                            case 'bfCalendarResponsive':
                                /* translatables */
                                if (isset($mdata['value_translation' . $this->language_tag]) && $mdata['value_translation' . $this->language_tag] != '') {
                                    $mdata['value'] = $mdata['value_translation' . $this->language_tag];
                                }
                                if (isset($mdata['format_translation' . $this->language_tag]) && $mdata['format_translation' . $this->language_tag] != '') {
                                    $mdata['format'] = $mdata['format_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                echo '<div class="controls form-inline">';
                                echo $label;
                                $size = '';
                                if ($mdata['size'] != '') {
                                    $size = 'style="width:' . htmlentities(strip_tags($mdata['size'])) . '" ';
                                }
                                $exploded = explode('::', trim($mdata['value']));
                                $left = '';
                                $right = '';
                                if (count($exploded) == 2) {
                                    $left = trim($exploded[0]);
                                    $right = trim($exploded[1]);
                                } else {
                                    $right = trim($exploded[0]);
                                }
                                echo '<div class="input-append">' . "\n";
                                echo '<input autocomplete="off" class="ff_elem" ' . $size . 'type="text" name="ff_nm_' . $mdata['bfName'] . '[]"  id="ff_elem' . $mdata['dbId'] . '" value="' . htmlentities($left, ENT_QUOTES, 'UTF-8') . '"/>' . "\n";
                                echo '<button type="button" id="ff_elem' . $mdata['dbId'] . '_calendarButton" type="submit" class="bfCalendar btn button" value="' . htmlentities($right, ENT_QUOTES, 'UTF-8') . '"><span><i class="icon-calendar"></i>' . htmlentities($right == '...' ? '' : $right, ENT_QUOTES, 'UTF-8') . '</span></button>' . "\n";
                                echo '</div>' . "\n";
                                $container = '';
                                if (!$this->hasResponsiveDatePicker) {
                                    $container = 'JQuery("body").append("<div class=\\"bfCalendarResponsiveContainer\\" style=\\"display:block;position:absolute;left:-9999px;\\"></div>");';
                                }
                                echo '<script type="text/javascript">
                                                <!--
                                                JQuery(document).ready(function () {
                                                    ' . $container . '
                                                    JQuery("#ff_elem' . $mdata['dbId'] . '_calendarButton").pickadate({
                                                        format: "' . $mdata['format'] . '", 
                                                        selectYears: true, 
                                                        selectMonths: true,
                                                        editable: true,
                                                        firstDay: 1,
                                                        container: ".bfCalendarResponsiveContainer",
                                                        onSet: function() {
                                                            JQuery("#ff_elem' . $mdata['dbId'] . '").val(this.get("value"));
                                                        }
                                                    });
                                                });
                                                //-->
                                                </script>' . "\n";
                                $this->hasResponsiveDatePicker = true;
                                echo '</div>';
                                break;
                            case 'bfPayPal':
                                /* translatables */
                                if (isset($mdata['image_translation' . $this->language_tag]) && $mdata['image_translation' . $this->language_tag] != '') {
                                    $mdata['image'] = $mdata['image_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                echo '<div class="controls form-inline">';
                                echo $label;
                                $value = '';
                                $type = 'submit';
                                $src = '';
                                if ($mdata['image'] != '') {
                                    $type = 'image';
                                    $src = 'src="' . $mdata['image'] . '" alt="PayPal" ';
                                } else {
                                    $value = 'value="PayPal" ';
                                }
                                if ($mdata['actionClick'] == 1) {
                                    $onclick = 'onclick="document.getElementById(\'bfPaymentMethod\').value=\'PayPal\';' . $mdata['actionFunctionName'] . '(this,\'click\');" ';
                                } else {
                                    $onclick = 'onclick="document.getElementById(\'bfPaymentMethod\').value=\'PayPal\';" ';
                                }
                                echo '<input class="ff_elem" ' . $value . $src . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="' . $type . '" name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '"/>' . "\n";
                                echo '</div>';
                                break;
                            case 'bfSofortueberweisung':
                                /* translatables */
                                if (isset($mdata['image_translation' . $this->language_tag]) && $mdata['image_translation' . $this->language_tag] != '') {
                                    $mdata['image'] = $mdata['image_translation' . $this->language_tag];
                                }
                                /* translatables end */
                                echo '<div class="controls form-inline">';
                                echo $label;
                                $value = '';
                                $type = 'submit';
                                $src = '';
                                if ($mdata['image'] != '') {
                                    $type = 'image';
                                    $src = 'src="' . $mdata['image'] . '" alt="Sofort.com" ';
                                } else {
                                    $value = 'value="Sofortueberweisung" ';
                                }
                                if ($mdata['actionClick'] == 1) {
                                    $onclick = 'onclick="document.getElementById(\'bfPaymentMethod\').value=\'Sofortueberweisung\';' . $mdata['actionFunctionName'] . '(this,\'click\');" ';
                                } else {
                                    $onclick = 'onclick="document.getElementById(\'bfPaymentMethod\').value=\'Sofortueberweisung\';" ';
                                }
                                echo '<input class="ff_elem" ' . $value . $src . $tabIndex . $onclick . $onblur . $onchange . $onfocus . $onselect . $readonly . 'type="' . $type . '" name="ff_nm_' . $mdata['bfName'] . '[]" id="ff_elem' . $mdata['dbId'] . '"/>' . "\n";
                                echo '</div>';
                                break;
                        }
                        if (isset($mdata['bfName']) && isset($mdata['off']) && $mdata['off']) {
                            echo '<script type="text/javascript"><!--' . "\n" . 'bfDeactivateField["ff_nm_' . $mdata['bfName'] . '[]"]=true;' . "\n" . '//--></script>' . "\n";
                        }
                        if ($mdata['bfType'] == 'bfFile') {
                            echo '<span id="ff_elem' . $mdata['dbId'] . '_files"></span>';
                        }
                        if ($mdata['bfType'] != 'bfHidden') {
                            echo '</div>' . "\n";
                        }
                    }
                }
            }
        }
        /**
         * Paging and wrapping of inline element containers
         */
        if (isset($dataObject['properties']) && $dataObject['properties']['type'] == 'section' && $dataObject['properties']['displayType'] == 'inline') {
            echo '<div class="bfClearfix">' . "\n";
        }
        if (isset($dataObject['children']) && count($dataObject['children']) != 0) {
            $childrenAmount = count($dataObject['children']);
            for ($i = 0; $i < $childrenAmount; $i++) {
                $this->process($dataObject['children'][$i], $mdata, $parentPage, $i, $childrenAmount, $dataObject);
            }
        }
        if (isset($dataObject['properties']) && $dataObject['properties']['type'] == 'section' && $dataObject['properties']['displayType'] == 'inline') {
            echo '</div>' . "\n";
        }
        if (isset($dataObject['properties']) && $dataObject['properties']['type'] == 'section' && $dataObject['properties']['bfType'] == 'section') {
            echo '</div>';
            // row-fluid
            echo '</fieldset>' . "\n";
        } else {
            if (isset($dataObject['properties']) && $dataObject['properties']['type'] == 'section' && $dataObject['properties']['bfType'] == 'normal') {
                if (isset($dataObject['properties']['name']) && $dataObject['properties']['name'] != '') {
                    echo '</div>';
                    // row-fluid
                    echo '</section>' . "\n";
                }
            } else {
                if (isset($dataObject['properties']) && $dataObject['properties']['type'] == 'page') {
                    $isLastPage = false;
                    if ($this->rootMdata['lastPageThankYou'] && $dataObject['properties']['pageNumber'] == count($this->dataObject['children']) && count($this->dataObject['children']) > 1) {
                        $isLastPage = true;
                    }
                    if (!$isLastPage) {
                        $last = 0;
                        if ($this->rootMdata['lastPageThankYou']) {
                            $last = 1;
                        }
                        echo '<div class="bfClearfix"></div>';
                        echo '<div class="form-actions">';
                        if ($this->rootMdata['pagingInclude'] && $dataObject['properties']['pageNumber'] > 1) {
                            /* translatables */
                            if (isset($this->rootMdata['pagingPrevLabel_translation' . $this->language_tag]) && $this->rootMdata['pagingPrevLabel_translation' . $this->language_tag] != '') {
                                $this->rootMdata['pagingPrevLabel'] = $this->rootMdata['pagingPrevLabel_translation' . $this->language_tag];
                            }
                            /* translatables end */
                            echo '<button type="button" class="bfPrevButton btn btn-primary pull-left button' . $this->fadingClass . '" type="submit" onclick="ff_validate_prevpage(this, \'click\');populateSummarizers();if(typeof bfRefreshAll != \'undefined\'){bfRefreshAll();}" value="' . htmlentities(trim($this->rootMdata['pagingPrevLabel']), ENT_QUOTES, 'UTF-8') . '"><span>' . htmlentities(trim($this->rootMdata['pagingPrevLabel']), ENT_QUOTES, 'UTF-8') . '</span></button>' . "\n";
                        }
                        if ($this->rootMdata['pagingInclude'] && $dataObject['properties']['pageNumber'] < count($this->dataObject['children']) - $last) {
                            /* translatables */
                            if (isset($this->rootMdata['pagingNextLabel_translation' . $this->language_tag]) && $this->rootMdata['pagingNextLabel_translation' . $this->language_tag] != '') {
                                $this->rootMdata['pagingNextLabel'] = $this->rootMdata['pagingNextLabel_translation' . $this->language_tag];
                            }
                            /* translatables end */
                            echo '<button type="button" class="bfNextButton btn btn-primary pull-right button' . $this->fadingClass . '" type="submit" onclick="ff_validate_nextpage(this, \'click\');populateSummarizers();if(typeof bfRefreshAll != \'undefined\'){bfRefreshAll();}" value="' . htmlentities(trim($this->rootMdata['pagingNextLabel']), ENT_QUOTES, 'UTF-8') . '"><span>' . htmlentities(trim($this->rootMdata['pagingNextLabel']), ENT_QUOTES, 'UTF-8') . '</span></button>' . "\n";
                        }
                        if ($this->rootMdata['cancelInclude'] && $dataObject['properties']['pageNumber'] + 1 > count($this->dataObject['children']) - $last) {
                            /* translatables */
                            if (isset($this->rootMdata['cancelLabel_translation' . $this->language_tag]) && $this->rootMdata['cancelLabel_translation' . $this->language_tag] != '') {
                                $this->rootMdata['cancelLabel'] = $this->rootMdata['cancelLabel_translation' . $this->language_tag];
                            }
                            /* translatables end */
                            echo '<button type="button" class="bfCancelButton btn btn-secondary pull-right button' . $this->fadingClass . '" type="submit" onclick="ff_resetForm(this, \'click\');"  value="' . htmlentities(trim($this->rootMdata['cancelLabel']), ENT_QUOTES, 'UTF-8') . '"><span>' . htmlentities(trim($this->rootMdata['cancelLabel']), ENT_QUOTES, 'UTF-8') . '</span></button>' . "\n";
                        }
                        $callSubmit = 'ff_validate_submit(this, \'click\')';
                        if ($this->hasFlashUpload) {
                            $callSubmit = 'if(typeof bfAjaxObject101 == \'undefined\' && typeof bfReCaptchaLoaded == \'undefined\'){bfDoFlashUpload()}else{ff_validate_submit(this, \'click\')}';
                        }
                        if ($this->rootMdata['submitInclude'] && $dataObject['properties']['pageNumber'] + 1 > count($this->dataObject['children']) - $last) {
                            /* translatables */
                            if (isset($this->rootMdata['submitLabel_translation' . $this->language_tag]) && $this->rootMdata['submitLabel_translation' . $this->language_tag] != '') {
                                $this->rootMdata['submitLabel'] = $this->rootMdata['submitLabel_translation' . $this->language_tag];
                            }
                            /* translatables end */
                            echo '<button type="button" id="bfSubmitButton" class="bfSubmitButton btn btn-primary pull-right button' . $this->fadingClass . '" type="submit" onclick="this.disabled=true;if(typeof bf_htmltextareainit != \'undefined\'){ bf_htmltextareainit() }if(document.getElementById(\'bfPaymentMethod\')){document.getElementById(\'bfPaymentMethod\').value=\'\';};' . $callSubmit . ';" value="' . htmlentities(trim($this->rootMdata['submitLabel']), ENT_QUOTES, 'UTF-8') . '"><span>' . htmlentities(trim($this->rootMdata['submitLabel']), ENT_QUOTES, 'UTF-8') . '</span></button>' . "\n";
                        }
                        echo '</div>';
                    }
                }
            }
        }
    }
コード例 #4
0
        JFactory::getDBO()->setQuery("ALTER TABLE `#__facileforms_forms` ADD `tags_content_default_publishup` VARCHAR( 255 ) NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `tags_content_default_featured` ");
        JFactory::getDBO()->query();
    }
    if (!isset($tables[BFJoomlaConfig::get('dbprefix') . 'facileforms_forms']['tags_content_default_publishdown'])) {
        JFactory::getDBO()->setQuery("ALTER TABLE `#__facileforms_forms` ADD `tags_content_default_publishdown` VARCHAR( 255 ) NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `tags_content_default_publishup` ");
        JFactory::getDBO()->query();
    }
    if (!isset($tables[BFJoomlaConfig::get('dbprefix') . 'facileforms_forms']['tags_form'])) {
        JFactory::getDBO()->setQuery("ALTER TABLE `#__facileforms_forms` ADD `tags_form` text NOT NULL AFTER `tags_content_default_publishdown` ");
        JFactory::getDBO()->query();
    }
    if (!isset($tables[BFJoomlaConfig::get('dbprefix') . 'facileforms_forms']['autoheight'])) {
        JFactory::getDBO()->setQuery("ALTER TABLE `#__facileforms_forms` ADD `autoheight` TINYINT( 1 ) NOT NULL DEFAULT 0 AFTER `tags_form` ");
        JFactory::getDBO()->query();
    }
    if (!isset($tables[BFJoomlaConfig::get('dbprefix') . 'facileforms_forms']['filter_state'])) {
        JFactory::getDBO()->setQuery("ALTER TABLE `#__facileforms_forms` ADD `filter_state` TEXT NOT NULL");
        JFactory::getDBO()->query();
    }
}
if (version_compare($version->getShortVersion(), '3.1', '>=')) {
    JFactory::getDbo()->setQuery("Select type_id From #__content_types Where type_alias = 'com_breezingforms.form'");
    $tag_typeid = JFactory::getDbo()->loadResult();
    if (!$tag_typeid) {
        $contenttype['type_id'] = 0;
        $contenttype['type_title'] = 'BreezingForms';
        $contenttype['type_alias'] = 'com_breezingforms.form';
        $contenttype['table'] = '';
        $contenttype['rules'] = '';
        $contenttype['router'] = 'BreezingformsHelperRoute::getFormRoute';
        $contenttype['field_mappings'] = '';