function viewDefault() { // set the toolbar buttons $this->setToolbar(); // call the css file $this->callCssFile(); // display the view template parent::display(); }
function setVariables() { parent::setVariables(); if ($this->_task == 'add') { $model = $this->getModel(); $this->color = '#000000'; $this->published = 1; $this->ordering = $model->getNextOrdering(); } if ($this->_task == 'add' or $this->_task == 'edit') { $document = JFactory::getDocument(); $document->addScript(JURI::root() . 'administrator/components/com_aicontactsafe/includes/fcp/201a.js'); } }
function setVariables() { JHtml::_('behavior.framework'); parent::setVariables(); $model = $this->getModel(); if ($this->_task == 'add') { $this->use_message_css = 1; $this->use_captcha = 1; $this->captcha_width = 400; $this->captcha_height = 55; $this->captcha_bgcolor = '#FFFFFF'; $this->captcha_colors = '#FF0000;#00FF00;#0000FF'; $this->always_send_to_email_address = 1; $this->record_message = 1; $this->record_fields = 1; $this->custom_date_format = 'dmy'; $this->custom_date_years_back = 80; $this->custom_date_years_forward = 0; $this->required_field_mark = '*'; $this->required_field_notification = 'Fields marked with %mark% are required.'; $this->display_format = 2; $this->published = 1; $this->contact_info = '<img style="margin-left: 10px; float: right;" alt="articles" src="images/stories/articles.jpg" width="128" height="96" /><div style="width: 150px; float: left;">Algis Info SRL<br />Str. Harmanului Nr.63<br />bl.1A sc.A ap.8<br />Brasov, Romania<br />500232<br /><a target="_blank" href="http://www.algisinfo.com/">www.algisinfo.com</a></div>'; $this->meta_description = ''; $this->meta_keywords = ''; $this->meta_robots = ''; $this->thank_you_message = 'Email sent. Thank you for your message.'; $this->all_fields = 1; } if ($this->_task == 'edit') { $this->getContactInformation($this->id); $this->all_fields = $this->active_fields == 0 ? 1 : 0; } if ($this->_task == 'add' or $this->_task == 'edit') { // generate the buttons alignment combo $align_buttons = array(); // none - no settings are made $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_NONE'); $txtSelect->type = 0; $align_buttons[] = $txtSelect; // to left $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_TO_LEFT'); $txtSelect->type = 1; $align_buttons[] = $txtSelect; // to center $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_TO_CENTER'); $txtSelect->type = 2; $align_buttons[] = $txtSelect; // to right $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_TO_RIGHT'); $txtSelect->type = 3; $align_buttons[] = $txtSelect; // generate the combobox $this->comboAlignButtons = JHTML::_('select.genericlist', $align_buttons, 'align_buttons', 'class="inputbox" size="1"', 'type', 'name', $this->align_buttons, false, false); // generate the CAPTCHA code alignment combo $align_captcha = array(); // none - no settings are made $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_NONE'); $txtSelect->type = 0; $align_captcha[] = $txtSelect; // to left $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_TO_LEFT'); $txtSelect->type = 1; $align_captcha[] = $txtSelect; // to center $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_TO_CENTER'); $txtSelect->type = 2; $align_captcha[] = $txtSelect; // to right $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_TO_RIGHT'); $txtSelect->type = 3; $align_captcha[] = $txtSelect; // generate the combobox $this->comboAlignCaptcha = JHTML::_('select.genericlist', $align_captcha, 'align_captcha', 'class="inputbox" size="1"', 'type', 'name', $this->align_captcha, false, false); // generate the use captcha combo $use_captcha = array(); // Only for unregistered users $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_ONLY_FOR_UNREGISTERED_USERS'); $txtSelect->type = '2'; $use_captcha[] = $txtSelect; // Always $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_ALWAYS'); $txtSelect->type = '1'; $use_captcha[] = $txtSelect; // Never $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_NEVER'); $txtSelect->type = '0'; $use_captcha[] = $txtSelect; // generate the combobox $this->comboUseCaptcha = JHTML::_('select.genericlist', $use_captcha, 'use_captcha', 'class="inputbox" size="1"', 'type', 'name', $this->use_captcha, false, false); // generate the type of captcha combo $captcha_type = array(); // aiContactSafe native $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_AICONTACTSAFE_NATIVE'); $txtSelect->type = '0'; $captcha_type[] = $txtSelect; // the ones generated by Multiple CAPTCHA Engine plugin $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_MULTIPLE_CAPTCHA_ENGINE_PLUGIN'); $txtSelect->type = '1'; $captcha_type[] = $txtSelect; // generate the combobox $this->comboTypeOfCaptcha = JHTML::_('select.genericlist', $captcha_type, 'captcha_type', 'class="inputbox" size="1"', 'type', 'name', $this->captcha_type, false, false); // generate the email_mode combo $email_mode = array(); // plain text $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_PLAIN_TEXT'); $txtSelect->id = '0'; $email_mode[] = $txtSelect; // html $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_HTML'); $txtSelect->id = '1'; $email_mode[] = $txtSelect; // generate the combobox $this->comboEmail_mode = JHTML::_('select.genericlist', $email_mode, 'email_mode', 'class="inputbox" size="1"', 'id', 'name', $this->email_mode, false, false); // generate the custom_date_format $custom_date_format = array(); // dmy $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_DAYMONTHYEAR'); $txtSelect->type = 'dmy'; $custom_date_format[] = $txtSelect; // mdy $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_MONTHDAYYEAR'); $txtSelect->type = 'mdy'; $custom_date_format[] = $txtSelect; // ymd $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_YEARMONTHDAY'); $txtSelect->type = 'ymd'; $custom_date_format[] = $txtSelect; // generate the combobox $this->comboField_custom_date_format = JHTML::_('select.genericlist', $custom_date_format, 'custom_date_format', 'class="inputbox" size="1"', 'type', 'name', $this->custom_date_format, false, false); $this->comboDefaultStatus = $this->selectStatus($this->default_status_id, 'default_status_id', 0); $this->comboReadStatus = $this->selectStatus($this->read_status_id, 'read_status_id', 0); $this->comboReplyStatus = $this->selectStatus($this->reply_status_id, 'reply_status_id', 0); $field_types = array('TX', 'CB', 'RL', 'DT', 'EM', 'EL', 'JC', 'JU', 'SB', 'HD', 'NO'); $this->comboField_name = $this->selectField($this->name_field_id, $field_types, 'name_field_id', 5); $field_types = array('EM', 'EL', 'JC', 'JU', 'SB', 'HE'); $this->comboField_email = $this->selectField($this->email_field_id, $field_types, 'email_field_id', 5); $field_types = array('TX', 'CB', 'RL', 'DT', 'EM', 'EL', 'JC', 'JU', 'SB', 'HD', 'NO'); $this->comboField_subject = $this->selectField($this->subject_field_id, $field_types, 'subject_field_id', 5); $field_types = array('CK'); $this->comboField_send_to_sender = $this->selectFieldSendToSender($this->send_to_sender_field_id, $field_types, 'send_to_sender_field_id'); $this->selected_fields_info = ' <font color="#FF0000">' . JText::_('COM_AICONTACTSAFE_THIS_FIELD_HAS_TO_BE_SELECTED_IN_THE_FIELDS_LIST_BELOW_UNLESS_THE_DEFAULT_VALUE_IS_SELECTED') . '</font>'; $this->select_fields = $model->getFields($this->active_fields, $this->id); } if ($this->_task == 'edit_contact') { $this->setRowData($this->_id); $this->getContactInformation($this->id); // generate the display_format $display_format = array(); // Without contact information $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_WITHOUT_CONTACT_INFORMATION'); $txtSelect->id = 0; $display_format[] = $txtSelect; // Contact information on top $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_CONTACT_INFORMATION_ON_TOP'); $txtSelect->id = 1; $display_format[] = $txtSelect; // Contact information on the right side $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_CONTACT_INFORMATION_ON_THE_RIGHT_SIDE'); $txtSelect->id = 2; $display_format[] = $txtSelect; // Contact information on bottom $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_CONTACT_INFORMATION_ON_BOTTOM'); $txtSelect->id = 3; $display_format[] = $txtSelect; // Contact information on the left side $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_CONTACT_INFORMATION_ON_THE_LEFT_SIDE'); $txtSelect->id = 4; $display_format[] = $txtSelect; // In DIV tags contact information first $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_IN_DIV_TAGS_CONTACT_INFORMATION_FIRST'); $txtSelect->id = 5; $display_format[] = $txtSelect; // In DIV tags contact information last $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_IN_DIV_TAGS_CONTACT_INFORMATION_LAST'); $txtSelect->id = 6; $display_format[] = $txtSelect; // generate the combobox $this->combo_display_format = JHTML::_('select.genericlist', $display_format, 'display_format', 'class="inputbox" size="1"', 'id', 'name', $this->display_format, false, false); } if ($this->_task == 'edit_css') { $this->setRowData($this->_id); // read the profile's css code $this->profile_css_code = $model->readProfileCssFile($this->id); } if ($this->_task == 'edit_email') { $this->setRowData($this->_id); // read the mail template $this->mail_template = $model->readMailTemplate($this->id); } }
function viewDefault($returnAjaxForm = false) { // initialize $returnAjaxForm $this->returnAjaxForm = $returnAjaxForm; $use_ajax = JFactory::getApplication()->input->get('use_ajax', 0, 'INT'); if ($use_ajax) { $this->returnAjaxForm = true; } // add javascript $document = JFactory::getDocument(); if (version_compare(JVERSION, '1.6.0', 'ge')) { $document->addScript(JUri::root(true) . '/media/system/js/core.js'); } else { $document->addScript(JUri::root(true) . '/includes/js/joomla.javascript.js'); } // initialize the template variables $this->setVariables(); // generate the css file name based on the profile $css_file = 'profile_css_' . $this->profile->id . '.css'; // call the css file $this->callCssFile($css_file); // determine to what section to return to $this->setTaskReturn(); if ($returnAjaxForm) { parent::display(); } else { echo '<div class="aiContactSafe" id="aiContactSafe_mainbody_' . $this->profile->id . '">'; parent::display(); echo '</div>'; } // reset the form fields after the form was displayed $model = $this->getModel($this->_sTask, '', $this->_parameters); $model->resetFormFields(); if ($use_ajax) { jexit(); } }
function setVariables() { parent::setVariables(); $model = $this->getModel(); if ($this->_task == 'add') { $this->send_message = 1; $this->field_in_message = 1; $this->published = 1; $this->ordering = $model->getNextOrdering(); } if ($this->_task == 'add' or $this->_task == 'edit') { // generate the field type combo $select_combo = array(); // textbox - TX $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_TEXTBOX'); $txtSelect->type = 'TX'; $select_combo[] = $txtSelect; // checkbox - CK $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_CHECKBOX'); $txtSelect->type = 'CK'; $select_combo[] = $txtSelect; // combobox - CB $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_COMBOBOX'); $txtSelect->type = 'CB'; $select_combo[] = $txtSelect; // editbox - ED $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_EDITBOX'); $txtSelect->type = 'ED'; $select_combo[] = $txtSelect; // checkbox list - CL $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_CHECKBOX_LIST'); $txtSelect->type = 'CL'; $select_combo[] = $txtSelect; // radio list - RL $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_RADIO_LIST'); $txtSelect->type = 'RL'; $select_combo[] = $txtSelect; // date - DT $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_DATE'); $txtSelect->type = 'DT'; $select_combo[] = $txtSelect; // email - EM $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_EMAIL'); $txtSelect->type = 'EM'; $select_combo[] = $txtSelect; // email - EL $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_EMAIL_LIST'); $txtSelect->type = 'EL'; $select_combo[] = $txtSelect; // contact - JC $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_JOOMLA_CONTACTS'); $txtSelect->type = 'JC'; $select_combo[] = $txtSelect; // contact - JU $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_JOOMLA_USERS'); $txtSelect->type = 'JU'; $select_combo[] = $txtSelect; // contact - SB $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_SOBI2_ENTRIES'); $txtSelect->type = 'SB'; $select_combo[] = $txtSelect; // hidden - HD $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_HIDDEN'); $txtSelect->type = 'HD'; $select_combo[] = $txtSelect; // hidden - SP $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_SEPARATOR'); $txtSelect->type = 'SP'; $select_combo[] = $txtSelect; // file - FL $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_FILE'); $txtSelect->type = 'FL'; $select_combo[] = $txtSelect; // file - NO $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_NUMBER'); $txtSelect->type = 'NO'; $select_combo[] = $txtSelect; // file - HE $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_HIDDEN_EMAIL'); $txtSelect->type = 'HE'; $select_combo[] = $txtSelect; if ($model->useUqField()) { // textbox - UQ $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_UNIQUETEXT'); $txtSelect->type = 'UQ'; $select_combo[] = $txtSelect; } if ($model->useCcField()) { // credit card - CC $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_CREDIT_CARD'); $txtSelect->type = 'CC'; $select_combo[] = $txtSelect; } // generate the html tag $this->comboField_type = JHTML::_('select.genericlist', $select_combo, 'field_type', 'class="inputbox" size="1" onchange="checkFieldValues();"', 'type', 'name', $this->field_type, false, false); $script = "\r\n\t\t\t\tfunction checkFieldValues() {\r\n\t\t\t\t\tvar field_type = document.getElementById('field_type').value;\r\n\t\t\t\t\tif (field_type == 'CB' || field_type == 'CL' || field_type == 'RL' || field_type == 'EL' || field_type == 'SB' || field_type == 'HD' || field_type == 'SP' || field_type == 'HE') {\r\n\t\t\t\t\t\tdocument.getElementById('field_values').removeAttribute('disabled');\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tdocument.getElementById('field_values').value = '';\r\n\t\t\t\t\t\tdocument.getElementById('field_values').setAttribute('disabled', true); \r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (field_type == 'EM' || field_type == 'EL' || field_type == 'JC' || field_type == 'JU' || field_type == 'SB' || field_type == 'SB') {\r\n\t\t\t\t\t\tdocument.getElementById('send_message').removeAttribute('disabled');\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tdocument.getElementById('send_message').checked = true;\r\n\t\t\t\t\t\tdocument.getElementById('send_message').setAttribute('disabled', true); \r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfunction copyLabel() {\r\n\t\t\t\t\tvar field_label_message = document.getElementById('field_label_message').value;\r\n\t\t\t\t\tif ( field_label_message.length == 0 && document.getElementById('id').value == 0 ) {\r\n\t\t\t\t\t\tdocument.getElementById('field_label_message').value = document.getElementById('field_label').value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfunction copyParameters() {\r\n\t\t\t\t\tvar label_message_parameters = document.getElementById('label_message_parameters').value;\r\n\t\t\t\t\tif ( label_message_parameters.length == 0 && document.getElementById('id').value == 0 ) {\r\n\t\t\t\t\t\tdocument.getElementById('label_message_parameters').value = document.getElementById('label_parameters').value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}"; $document = JFactory::getDocument(); $document->addScriptDeclaration($script); // generate the field type combo $select_combo = array(); // none $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_NONE'); $txtSelect->type = ''; $select_combo[] = $txtSelect; // Joomla User name $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_JOOMLA_USER_NAME'); $txtSelect->type = 'UN'; $select_combo[] = $txtSelect; // Joomla User email $txtSelect = new stdClass(); $txtSelect->name = JText::_('COM_AICONTACTSAFE_JOOMLA_USER_EMAIL'); $txtSelect->type = 'UE'; $select_combo[] = $txtSelect; // generate the html tag $this->comboAutoFill = JHTML::_('select.genericlist', $select_combo, 'auto_fill', 'class="inputbox" size="1"', 'type', 'name', $this->auto_fill, false, false); } if ($this->_task == 'display') { $countRows = count($this->rows); for ($i = 0; $i < $countRows; $i++) { switch ($this->rows[$i]->field_type) { case 'TX': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_TEXTBOX'); break; case 'CK': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_CHECKBOX'); break; case 'CB': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_COMBOBOX'); break; case 'ED': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_EDITBOX'); break; case 'CL': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_CHECKBOX_LIST'); break; case 'RL': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_RADIO_LIST'); break; case 'DT': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_DATE'); break; case 'EM': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_EMAIL'); break; case 'EL': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_EMAIL_LIST'); break; case 'JC': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_JOOMLA_CONTACTS'); break; case 'JU': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_JOOMLA_USERS'); break; case 'SB': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_SOBI2_ENTRIES'); break; case 'HD': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_HIDDEN'); break; case 'SP': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_SEPARATOR'); break; case 'FL': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_FILE'); break; case 'NO': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_NUMBER'); break; case 'HE': $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_HIDDEN_EMAIL'); break; case 'UQ': if ($model->useUqField()) { $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_UNIQUETEXT'); } break; case 'CC': if ($model->useCcField()) { $this->rows[$i]->field_type_text = JText::_('COM_AICONTACTSAFE_CREDIT_CARD'); } break; } } } }