function display($tpl = null) { FCP_Admin::make_title('COM_FLEXICONTACT_CONFIG_GENERAL_NAME', $this->config_data, $this->config_count); JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); // setup the three pre-populate options $options = array(); $options['off'] = JText::_('COM_FLEXICONTACT_V_NO'); $options['username'] = JText::_('COM_FLEXICONTACT_V_AUTOFILL_USERNAME'); $options['name'] = JText::_('COM_FLEXICONTACT_NAME'); $autofill_list = FCP_Common::make_list('autofill', $this->config_data->config_data->autofill, $options, 0, 'style="margin-bottom:0"'); // setup the "copy me" options $copy_options = array(); $copy_options[LAFC_COPYME_NEVER] = JText::_('COM_FLEXICONTACT_COPYME_NEVER'); $copy_options[LAFC_COPYME_CHECKBOX] = JText::_('COM_FLEXICONTACT_COPYME_CHECKBOX'); $copy_options[LAFC_COPYME_ALWAYS] = JText::_('COM_FLEXICONTACT_COPYME_ALWAYS'); // setup the date format list $date_format_list = array(); $date_format_list[1] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT1'); $date_format_list[2] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT2'); $date_format_list[3] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT3'); $date_format_list[4] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT4'); $date_format_list[5] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT5'); $date_format_list[6] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT6'); $date_format_list[7] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT7'); // setup the days list $days_list = FCP_Common::makeDayNames(0); // setup the date picker list require_once LAFC_HELPER_PATH . '/date_pickers.php'; $date_picker_onchange = 'onchange="fcp_date_fields(this.value)"'; $date_picker_list = FCP_date_picker::date_picker_list(); // make the Javascript that hides and enables the date format and start day when the date picker is HTML5 // it is called by the 'domready' function and the 'onchange' function of the date picker list selector $js = "function fcp_date_fields(picker_type) {\n\t\tif (picker_type == '001')\n\t\t\t{\n\t\t\tdocument.getElementById('date_format').selectedIndex = 0;\n\t\t\tdocument.getElementById('date_format').disabled=true;\n\t\t\tdocument.getElementById('start_day').disabled=true;\n\t\t\tdocument.getElementById('start_day').selectedIndex = 1;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tdocument.getElementById('date_format').disabled=false;\n\t\t\tdocument.getElementById('start_day').disabled=false;\n\t\t\t}}"; $document = JFactory::getDocument(); $document->addScriptDeclaration($js); $dom_ready = "\nwindow.addEvent('domready', function() {fcp_date_fields(" . $this->config_data->config_data->date_picker . ");});\n"; $document->addScriptDeclaration($dom_ready); // setup the css files list $css_list = FCP_Admin::get_css_list(); ?> <form action="index.php" method="post" name="adminForm" id="adminForm" > <input type="hidden" name="option" value="<?php echo LAFC_COMPONENT; ?> " /> <input type="hidden" name="controller" value="menu" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="view" value="config_general" /> <?php echo "\n" . '<table class="fc_table">'; // css files selector echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_CSS_FILE') . '</td>'; if ($css_list == false) { echo '<td>' . JText::_('COM_FLEXICONTACT_NO_CSS'); } else { echo '<td>' . FCP_Common::make_list('css_file', $this->config_data->config_data->css_file, $css_list, 0, 'style="margin-bottom:0"'); } echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_CSS_FILE_DESC')) . '</td>'; echo "\n</tr>"; // Send button text echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_SEND_TEXT') . '</td>'; echo '<td><input type="text" size="50" name="send_text" value="' . $this->config_data->config_data->send_text . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_SEND_TEXT_DESC')) . '</td>'; echo "\n</tr>"; // email From (name) echo "\n" . '<tr><td colspan="3"><hr /></td></tr>'; echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_FIELD_FROM_NAME') . '</td>'; echo '<td><input type="text" size="50" name="email_from_name" value="' . $this->config_data->config_data->email_from_name . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_EMAIL_FROM_NAME_DESC')) . '</td>'; echo "\n</tr>"; // email From (address) echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_FIELD_FROM_ADDRESS') . '</td>'; echo '<td><input type="text" size="50" name="email_from" value="' . $this->config_data->config_data->email_from . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_EMAIL_FROM_ADDRESS_DESC')) . '</td>'; echo "\n</tr>"; // email To echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_V_EMAIL_TO') . '</td>'; echo '<td><input type="text" size="50" name="email_to" value="' . $this->config_data->config_data->email_to . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_EMAIL_TO_ADDRESS_DESC')) . '</td>'; echo "\n</tr>"; // email CC echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_V_EMAIL_CC') . '</td>'; echo '<td><input type="text" size="50" name="email_cc" value="' . $this->config_data->config_data->email_cc . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_V_EMAIL_DESC')) . '</td>'; echo "\n</tr>"; // email Bcc echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_V_EMAIL_BCC') . '</td>'; echo '<td><input type="text" size="50" name="email_bcc" value="' . $this->config_data->config_data->email_bcc . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_V_EMAIL_DESC')) . '</td>'; echo "\n</tr>"; echo "\n" . '<tr><td colspan="3"><hr /></td></tr>'; // Date picker echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_DATE_PICKER') . '</td>'; echo '<td>' . FCP_Common::make_list('date_picker', $this->config_data->config_data->date_picker, $date_picker_list, 0, 'style="margin-bottom:0"' . $date_picker_onchange) . '</td>'; echo "\n</tr>"; // Input date format echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_DATE_FORMAT') . '</td>'; echo '<td>' . FCP_Common::make_list('date_format', $this->config_data->config_data->date_format, $date_format_list, 0, 'style="margin-bottom:0"') . '</td>'; echo "\n</tr>"; // Start day of week echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_STARTDAY') . '</td>'; echo '<td>' . FCP_Common::make_list('start_day', $this->config_data->config_data->start_day, $days_list, 0, 'style="margin-bottom:0"') . '</td>'; echo "\n</tr>"; // logging echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_LOGGING') . '</td>'; echo '<td>' . FCP_Common::make_radio('logging', $this->config_data->config_data->logging) . '</td>'; echo "\n</tr>"; // send html, yes/no echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_HTML') . '</td>'; echo '<td>' . FCP_Common::make_radio('email_html', $this->config_data->config_data->email_html) . '</td>'; echo "\n</tr>"; // auto fill echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_V_AUTOFILL') . '</td>'; echo '<td>' . $autofill_list . ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_V_AUTOFILL_DESC')) . '</td>'; echo "\n</tr>"; // send a copy to the user choices echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_CONFIG_USER_EMAIL_NAME') . '</td>'; echo '<td colspan="3">' . FCP_Common::make_list('show_copy', $this->config_data->config_data->show_copy, $copy_options, 0, 'style="margin-bottom:0"') . '</td>'; echo "\n</tr>"; // agreement required echo "\n" . '<tr><td colspan="3"><hr /></td></tr>'; echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_AGREEMENT_REQUIRED') . '<br />' . JText::_('COM_FLEXICONTACT_V_PROMPT') . '</td>'; echo '<td><input type="text" size="40" name="agreement_prompt" value="' . $this->config_data->config_data->agreement_prompt . '" /></td>'; echo "\n</tr>"; echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_NAME') . '</td>'; echo '<td><input type="text" size="40" name="agreement_name" value="' . $this->config_data->config_data->agreement_name . '" /></td>'; echo "\n</tr>"; echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_LINK') . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_AGREEMENT_REQUIRED_DESC')); echo '<td><input type="text" size="60" name="agreement_link" value="' . $this->config_data->config_data->agreement_link . '" /> ' . $info . '</td>'; echo "\n</tr>"; // white list for attachment field type echo "\n" . '<tr><td colspan="3"><hr /></td></tr>'; echo "\n" . "<tr>"; echo ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_ATTACHMENT_WHITE_LIST') . '</td>'; echo ' <td valign="top"><textarea rows="2" cols="50" name="white_list">' . $this->config_data->config_data->white_list . '</textarea>'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_ATTACHMENT_WHITE_LIST_DESC')) . '</td>'; // echo "\n".' <td valign="top">'.$info.'</td>'; echo "\n" . "</tr>"; // max file size for attachment field type echo "\n" . "<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_ATTACHMENT_MAX_SIZE') . '</td>'; echo '<td><input type="text" size="50" name="max_file_size" value="' . $this->config_data->config_data->max_file_size . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_ATTACHMENT_MAX_SIZE_DESC')) . '</td>'; echo "\n" . "</tr>"; echo '</table></form>'; }
static function draw_field($field, $data, $config_data) { $html = ''; $div_id = $field->div_id; $field_id = $field->id; $error_id = $field->error_id; if (!$field->visible) { $html = ''; return $html; } // Tooltip or Info button? $title = ''; $field_class = ''; $info_button = ''; if ($field->tooltip_type == TOOLTIP_TIP) { if (!empty($field->tooltip)) { $title = ' title="' . self::tooltipText($field->tooltip) . '" '; $field_class = ' class="hasTooltip"'; } } else { if (!empty($field->tooltip)) { $info_button = ' ' . self::make_info($field->tooltip); } } // Placeholder if (empty($field->placeholder)) { $placeholder = ''; } else { $placeholder = ' placeholder="' . $field->placeholder . '"'; } switch ($field->field_type) { case LAFC_FIELD_FROM_ADDRESS: case LAFC_FIELD_FROM_NAME: case LAFC_FIELD_SUBJECT: case LAFC_FIELD_TEXT: case LAFC_FIELD_ADVANCED: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_text" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $size = self::size($field->width); $html .= "\n" . '<input type="text" ' . $field_class . $size . ' name="' . $field_id . '" id="' . $field_id . '"' . $placeholder . ' value="' . $data->{$field_id} . '"' . $title . ' />'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_TEXT_NUMERIC: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_text fcp_numeric" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $size = self::size($field->width); $html .= "\n" . '<input type="text" ' . $field_class . $size . ' name="' . $field_id . '" id="' . $field_id . '"' . $placeholder . ' value="' . $data->{$field_id} . '" onkeypress="return numbersOnly(event)"' . $title . ' />'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_TEXTAREA: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_textarea" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $size = self::size($field->width, 'cols'); $html .= "\n" . '<textarea name="' . $field_id . '"' . ' id="' . $field_id . '" ' . $field_class . $title . $placeholder . ' rows="' . $field->height . '"' . $size . '>' . $data->{$field_id} . '</textarea>'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_LIST: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_list" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $list_array = FCP_Common::split_list($field->list_list, $field->delimiter); $list_html = FCP_Common::make_list($field_id, $data->{$field_id}, $list_array['LEFT'], 0, $field_class . $title); $html .= "\n" . $list_html; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_RECIPIENT: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_list" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $list_array = FCP_Common::split_list($field->list_list, ';', $field->delimiter); $list_html = FCP_Common::make_list($field_id, $data->{$field_id}, $list_array['LEFT'], 0, $field_class . $title); $html .= "\n" . $list_html; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_CHECKBOX_L: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_checkbox fcp_checkbox_l" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } if ($data->{$field_id}) { $checked = 'checked = "checked"'; } else { $checked = ''; } $checkbox = '<input type="checkbox" class="fcp_lcb"' . $title . ' name="' . $field_id . '" id="' . $field_id . '" value="1" ' . $checked . '/>'; $html .= "\n" . $checkbox; $html .= self::draw_label($field, 'fcp_lcb', $title); $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_CHECKBOX_R: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_checkbox fcp_checkbox_r" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field, '', $title); if ($data->{$field_id}) { $checked = 'checked = "checked"'; } else { $checked = ''; } $html .= "\n" . '<input type="checkbox" ' . $field_class . $title . ' name="' . $field_id . '" id="' . $field_id . '" value="1" ' . $checked . '/>'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_CHECKBOX_H: if ($field->css_class == '') { $html .= "\n" . '<span class="fcp_checkbox fcp_checkbox_h" id="' . $div_id . '">'; } else { $html .= "\n" . '<span class="fcp_ufield ' . $field->css_class . '" id="' . $div_id . '">'; } if ($data->{$field_id}) { $checked = 'checked = "checked"'; } else { $checked = ''; } $checkbox = '<input type="checkbox" ' . $field_class . ' name="' . $field_id . '" id="' . $field_id . '" value="1" ' . $checked . '/>'; $html .= "\n" . $checkbox; if ($field->mandatory) { $html .= "\n" . '<span class="fcp_mandatory"><span ' . $field_class . '>' . $field->prompt . '</span></span>'; } else { $html .= "\n" . '<span>' . $field->prompt . '</span>'; } $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</span>'; break; case LAFC_FIELD_CHECKBOX_M: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_checkbox fcp_checkbox_m" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field, '', $title); $html .= "\n" . '<div class="fcp_checkbox_inner">'; $list_array = FCP_Common::split_list($field->list_list, $field->delimiter); $html .= self::make_checkbox_list($field_id, $list_array['LEFT'], $title); $html .= "\n" . '</div>'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_FIXED_TEXT: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_fixed_text" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $html .= "\n" . '<span>' . $field->default_value . '</span>'; // note that we do not end the div // because there might be horizontal checkboxes that need to go in it break; case LAFC_FIELD_DATE: require_once LAFC_HELPER_PATH . '/date_pickers.php'; if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_date" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $html .= FCP_date_picker::make_date_field($config_data, $field_id, $data->{$field_id}); $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_FIELDSET_START: if ($field->prompt == '') { $legend = ''; } else { $legend = '<legend>' . $field->prompt . '</legend>'; } $size = self::size($field->width); if ($field->css_class == '') { $html .= "\n" . '<fieldset class="fcp_fieldset"' . $size . '>' . $legend; } else { $html .= "\n" . '<fieldset class="fcp_fieldset ' . $field->css_class . $size . '">' . $legend; } break; case LAFC_FIELD_FIELDSET_END: $html .= "\n" . '</fieldset>'; break; case LAFC_FIELD_RADIO_H: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_radio" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $html .= "\n" . '<div class="fcp_radio_h_inner">'; $list_array = FCP_Common::split_list($field->list_list, ';', $field->delimiter); $html .= self::make_radio_list($field_id, $data->{$field_id}, $list_array['LEFT'], 'fcp_radio_h', $title); $html .= "\n" . '</div>'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_RADIO_V: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_radio" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $html .= "\n" . '<div class="fcp_radio_v_inner">'; $list_array = FCP_Common::split_list($field->list_list, ';', $field->delimiter); $html .= self::make_radio_list($field_id, $data->{$field_id}, $list_array['LEFT'], 'fcp_radio_v', $title); $html .= "\n" . '</div>'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_PASSWORD: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_password" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $size = self::size($field->width); $html .= "\n" . '<input type="password" ' . $field_class . $size . ' name="' . $field_id . '" id="' . $field_id . '"' . $placeholder . ' value="' . $data->{$field_id} . '"' . $title . ' />'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_ATTACHMENT: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_attachment" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $size = self::size($field->width); $html .= "\n" . '<input type="file" ' . $field_class . $size . ' name="' . $field_id . '" id="' . $field_id . '"' . $title . ' />'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; } return $html; }
function display($tpl = null) { FCP_Admin::make_title('COM_FLEXICONTACT_CONFIG_FIELDS_NAME', $this->config_data, $this->config_count); JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); // make the Javascript that hides and enables the fcp_divs for the current field type // it is called by the 'domready' function and the 'onchange' function of the field type list selector $js = self::javascript(); $document = JFactory::getDocument(); $document->addScriptDeclaration($js); $dom_ready = "\nwindow.addEvent('domready', function() {fcp_show_fields(" . $this->field->field_type . ");});\n"; $document->addScriptDeclaration($dom_ready); // make the field type list $field_types = FCP_Admin::make_field_type_list(); $field_type_list = FCP_Common::make_list('field_type', $this->field->field_type, $field_types, 0, 'class="field_type" onchange="fcp_show_fields(this.value)"'); // make the validation type list require_once LAFC_HELPER_PATH . '/date_pickers.php'; $validation_types = FCP_date_picker::validation_type_list(); $validation_type_list = FCP_Common::make_list('validation_type', $this->field->validation_type, $validation_types); // setup the key panel $keypanel = FCP_Admin::make_key_panel($this->config_data->config_data); // draw the form ?> <div style="float:left"> <form action="index.php" method="post" name="adminForm" id="adminForm" > <input type="hidden" name="option" value="<?php echo LAFC_COMPONENT; ?> " /> <input type="hidden" name="controller" value="field" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="view" value="config_field" /> <input type="hidden" name="field_index" value="<?php echo $this->field_index; ?> " /> <?php if (!isset($this->new_flag)) { echo '<input type="hidden" name="new_flag" value="0" />'; } else { echo '<input type="hidden" name="new_flag" value="' . $this->new_flag . '" />'; } echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt"><strong>' . JText::_('COM_FLEXICONTACT_FIELD_TYPE') . '</strong></td>'; echo "\n" . ' <td>' . $field_type_list; echo "\n" . '<img src="' . LAFC_ADMIN_ASSETS_URL . 'blank.gif" id="field_type_img" border="0" style="vertical-align:middle;padding:0 0 3px 15px;" alt="" />'; echo "\n" . "</td></tr>"; echo "\n" . '</table>'; // prompt echo "\n" . '<div class="fcp_div" id="fcp_prompt">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_V_PROMPT') . '</td>'; echo "\n" . ' <td><input type="text" size="40" name="prompt" value="' . $this->field->prompt . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // placeholder echo "\n" . '<div class="fcp_div" id="fcp_placeholder">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_V_PLACEHOLDER') . '</td>'; echo "\n" . ' <td><input type="text" size="40" name="placeholder" value="' . $this->field->placeholder . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // delimeter echo "\n" . '<div class="fcp_div" id="fcp_delim">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td valign="top" class="prompt">' . JText::_('COM_FLEXICONTACT_DELIMITER') . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_DELIMITER_DESC')); echo "\n" . ' <td><input type="text" size="2" name="delimiter" value="' . $this->field->delimiter . '" /> ' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // width echo "\n" . '<div class="fcp_div" id="fcp_width">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_V_WIDTH') . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_WIDTH_DESC')); echo "\n" . ' <td><input type="text" size="6" name="width" value="' . $this->field->width . '" /> ' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // height echo "\n" . '<div class="fcp_div" id="fcp_height">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_V_HEIGHT') . '</td>'; echo "\n" . ' <td><input type="text" size="6" name="height" value="' . $this->field->height . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // default value (text) echo "\n" . '<div class="fcp_div" id="fcp_default">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_DEFAULT') . '</td>'; echo "\n" . ' <td><input type="text" size="80" name="default_value" value="' . $this->field->default_value . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // validation type (date picker only) echo "\n" . '<div class="fcp_div" id="fcp_validation">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_VALIDATION') . '</td>'; echo "\n" . ' <td>' . $validation_type_list . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // default button (radio buttons only) echo "\n" . '<div class="fcp_div" id="fcp_default_button">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_DEFAULT_BUTTON') . '</td>'; echo "\n" . ' <td><input type="text" size="2" name="default_button" value="' . $this->field->default_button . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // fixed text echo "\n" . '<div class="fcp_div" id="fcp_fixed_text">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_FIELD_FIXED_TEXT') . '</td>'; echo "\n" . ' <td><input type="text" size="80" name="fixed_text" value="' . $this->field->default_value . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // list items echo "\n" . '<div class="fcp_div" id="fcp_list">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td valign="top" class="prompt">' . JText::_('COM_FLEXICONTACT_V_LIST_ITEMS') . '</td>'; echo "\n" . ' <td valign="top"><textarea rows="10" cols="80" name="list_list">' . $this->field->list_list . '</textarea>' . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_V_LIST_ITEMS_DESC')); echo "\n" . ' <td valign="top">' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; // echo '<pre>'.htmlentities(print_r(FCP_Common::split_list($this->field->list_list, $this->field->delimiter),true)).'</pre>'; echo "\n" . '</div>'; // radio buttons echo "\n" . '<div class="fcp_div" id="fcp_radio">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td valign="top" class="prompt">' . JText::_('COM_FLEXICONTACT_BUTTON_TEXTS') . '</td>'; echo "\n" . ' <td valign="top"><textarea rows="10" cols="80" name="radio_list">' . $this->field->list_list . '</textarea>' . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_RADIO_LIST_DESC1') . ' :: ' . JText::_('COM_FLEXICONTACT_RADIO_LIST_DESC2') . JText::_('COM_FLEXICONTACT_RADIO_LIST_DESC3')); echo "\n" . ' <td valign="top">' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; // echo '<pre>'.htmlentities(print_r(FCP_Common::split_list($this->field->list_list, ';', $this->field->delimiter),true)).'</pre>'; echo "\n" . '</div>'; // multiple checkboxes echo "\n" . '<div class="fcp_div" id="fcp_checkbox_m">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td valign="top" class="prompt">' . JText::_('COM_FLEXICONTACT_CHECKBOX_TEXTS') . '</td>'; echo "\n" . ' <td valign="top"><textarea rows="10" cols="80" name="checkbox_list">' . $this->field->list_list . '</textarea>' . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_CHECKBOX_LIST_DESC')); echo "\n" . ' <td valign="top">' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; // echo '<pre>'.htmlentities(print_r(FCP_Common::split_list($this->field->list_list, ';', $this->field->delimiter),true)).'</pre>'; echo "\n" . '</div>'; // recipient list echo "\n" . '<div class="fcp_div" id="fcp_recipient">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td valign="top" class="prompt">' . JText::_('COM_FLEXICONTACT_RECIPIENTS') . '</td>'; echo "\n" . ' <td valign="top"><textarea rows="10" cols="80" name="recipient_list">' . $this->field->list_list . '</textarea>' . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_RECIPIENTS_DESC') . " :: Name1, email1@x.com;<br>Name2, email2@y.com;<br>Name3, email3@z.com"); echo "\n" . ' <td valign="top">' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; // echo '<pre>'.htmlentities(print_r(FCP_Common::split_list($this->field->list_list, ';', $this->field->delimiter),true)).'</pre>'; echo "\n" . '</div>'; // mandatory echo "\n" . '<div class="fcp_div" id="fcp_mandatory">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_V_MANDATORY') . '</td>'; echo "\n" . ' <td>' . FCP_Common::make_radio('mandatory', $this->field->mandatory) . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // visible echo "\n" . '<div class="fcp_div" id="fcp_visible">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_VISIBLE') . '</td>'; echo "\n" . ' <td>' . FCP_Common::make_radio('visible', $this->field->visible) . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // advanced validation fields echo "\n" . '<div class="fcp_div" id="fcp_advanced">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_REGEX') . '</td>'; echo "\n" . ' <td><input type="text" size="80" name="regex" value="' . $this->field->regex . '" /></td>'; echo "\n" . "</tr>"; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_SQL_NUMERIC')); echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_SQL_QUERY') . '</td>'; echo "\n" . ' <td><input type="text" size="80" name="sql" value="' . $this->field->sql . '" /> ' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // error message echo "\n" . '<div class="fcp_div" id="fcp_errormsg">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_ERRORMSG') . '</td>'; echo "\n" . ' <td><input type="text" size="80" name="error_msg" value="' . $this->field->error_msg . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // tooltip echo "\n" . '<div class="fcp_div" id="fcp_tooltip">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_TOOLTIP') . '</td>'; echo "\n" . ' <td><textarea rows="3" cols="80" name="tooltip">' . htmlspecialchars($this->field->tooltip) . '</textarea>'; echo "\n" . ' ' . JText::_('COM_FLEXICONTACT_TOOLTIP_TYPE') . ' '; echo "\n" . FCP_Common::make_radio('tooltip_type', $this->field->tooltip_type) . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // CSS Class echo "\n" . '<div class="fcp_div" id="fcp_css_class">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_CSS_CLASS') . '</td>'; echo "\n" . ' <td><input type="text" size="40" name="css_class" value="' . $this->field->css_class . '" /></td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_CSS_CLASS_INFO')); echo "\n" . ' <td valign="top">' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; echo "\n" . '</form>'; echo "\n" . '</div>'; // float:left // Key Panel echo "\n" . '<div class="fcp_div" id="fcp_keypanel_class" style="float:left">'; echo $keypanel; echo "\n" . '</div>'; }
function display($tpl = null) { $order_text = ucfirst(JText::_('JFIELD_ORDERING_LABEL')); $id_text = ucfirst(JText::_('JGLOBAL_FIELD_ID_LABEL')); $yes_text = ucfirst(JText::_('JYES')); $no_text = ucfirst(JText::_('JNO')); FCP_Admin::make_title('COM_FLEXICONTACT_CONFIG_FIELDS_NAME', $this->config_data, $this->config_count); JToolBarHelper::custom('add_default_fields', 'default.png', 'default_f2.png', 'COM_FLEXICONTACT_RESTORE_DEFAULT_FIELDS', false); $num_fields = count($this->config_data->config_data->all_fields); if ($num_fields < LAFC_MAX_FIELDS) { JToolBarHelper::addNew(); } JToolBarHelper::editList(); JToolBarHelper::deleteList(); JToolBarHelper::cancel(); $field_types = FCP_Admin::make_field_type_list(); require_once LAFC_HELPER_PATH . '/date_pickers.php'; $validation_types = FCP_date_picker::validation_type_list(); $pagination = new JPagination($num_fields, 0, 1000); // we don't actually use pagination but we need this for the ordering tools // Joomla 3.0 took away the Javascript checkAll() function. Joomla.checkAll() first appeared in 1.7 $check_all = 'onclick="Joomla.checkAll(this);"'; // draw the form ?> <form action="index.php" method="post" name="adminForm" id="adminForm" > <input type="hidden" name="option" value="<?php echo LAFC_COMPONENT; ?> " /> <input type="hidden" name="controller" value="field" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="view" value="config_field_list" /> <input type="hidden" name="boxchecked" value="0" /> <?php echo '<table>'; echo '<table class="adminlist table table-striped">'; echo '<thead>'; echo ' <th width="1">' . $id_text . '</th>'; echo ' <th width="1"><input type="checkbox" name="toggle" value="" ' . $check_all . ' /></th>'; echo ' <th width="1"></th>'; echo ' <th width="1"></th>'; echo ' <th width="1" nowrap="nowrap">' . $order_text . ' ' . JHTML::_('grid.order', $this->config_data->config_data->all_fields) . '</th>'; echo ' <th nowrap="nowrap" width="20%">' . JText::_('COM_FLEXICONTACT_V_PROMPT') . '</th>'; echo ' <th nowrap="nowrap" width="10%" colspan="2">' . JText::_('COM_FLEXICONTACT_FIELD_TYPE') . '</th>'; echo ' <th nowrap="nowrap" width="5%" >' . JText::_('COM_FLEXICONTACT_V_MANDATORY') . '</th>'; echo ' <th nowrap="nowrap" width="5%" >' . JText::_('COM_FLEXICONTACT_V_WIDTH') . '</th>'; echo ' <th nowrap="nowrap" width="5%" >' . JText::_('COM_FLEXICONTACT_V_HEIGHT') . '</th>'; echo ' <th nowrap="nowrap">' . JText::_('COM_FLEXICONTACT_DETAILS') . '</th>'; echo ' </tr>'; echo '</thead>'; for ($i = 0; $i < $num_fields; $i++) { $field =& $this->config_data->config_data->all_fields[$i]; $field_type_name = $field_types[$field->field_type]; $checked = JHTML::_('grid.id', $i, $i); if ($field->mandatory == 1) { $mandatory = $yes_text; } else { $mandatory = $no_text; } if ($field->visible == 1) { $visible = $yes_text; } else { $visible = $no_text; } $width = ''; $height = ''; $details = ''; switch ($field->field_type) { case LAFC_FIELD_FROM_ADDRESS: $width = $field->width; break; case LAFC_FIELD_FROM_NAME: case LAFC_FIELD_TEXT: case LAFC_FIELD_PASSWORD: case LAFC_FIELD_TEXT_NUMERIC: case LAFC_FIELD_FIELDSET_START: $width = $field->width; if ($field->default_value != '') { $details = JText::_('COM_FLEXICONTACT_DEFAULT') . ': ' . $field->default_value; } break; case LAFC_FIELD_SUBJECT: $width = $field->width; if ($field->default_value != '') { $details = JText::_('COM_FLEXICONTACT_DEFAULT') . ': ' . $field->default_value . ', ' . JText::_('COM_FLEXICONTACT_VISIBLE') . ': ' . $visible; } else { $details = JText::_('COM_FLEXICONTACT_VISIBLE') . ': ' . $visible; } break; case LAFC_FIELD_TEXTAREA: $width = $field->width; $height = $field->height; break; case LAFC_FIELD_LIST: $list_array = FCP_Common::split_list($field->list_list, $field->delimiter); $field_id = sprintf('field%03d', $i); $list_html = FCP_Common::make_list($field_id, 0, $list_array['LEFT']); $details = $list_html; break; case LAFC_FIELD_FIXED_TEXT: $details = $field->default_value; break; case LAFC_FIELD_ADVANCED: $width = $field->width; $details = $field->regex; if (!empty($field->sql)) { if (!empty($details)) { $details .= '<br />'; } $details .= $field->sql; } if ($field->error_msg != '') { $details .= ' [' . $field->error_msg . ']'; } break; case LAFC_FIELD_RECIPIENT: $list_array = FCP_Common::split_list($field->list_list, ';', $field->delimiter); $field_id = sprintf('field%03d', $i); $list_html = FCP_Common::make_list($field_id, 0, $list_array['LEFT']); $details = $list_html; break; case LAFC_FIELD_RADIO_V: case LAFC_FIELD_RADIO_H: $list_array = FCP_Common::split_list($field->list_list, ';', $field->delimiter); $details = implode(", ", $list_array['RIGHT']); break; case LAFC_FIELD_CHECKBOX_M: $list_array = FCP_Common::split_list($field->list_list, $field->delimiter); $details = implode(", ", $list_array['LEFT']); break; case LAFC_FIELD_DATE: $details = $validation_types[$field->validation_type]; } $image = FCP_Admin::get_icon_image($field->field_type); $link = JRoute::_(LAFC_COMPONENT_LINK . '&controller=field&task=edit&cid[]=' . $i); $field_id = sprintf('%02d', $i + 1); echo "\n<tr>"; echo ' <td>' . JHTML::link($link, $field_id) . '</td>'; echo ' <td align="center">' . $checked . '</td>'; echo ' <td>' . $pagination->orderUpIcon($i, true) . '</td>'; echo ' <td>' . $pagination->orderDownIcon($i, true) . '</td>'; echo ' <td><input type="text" name="order[]" size="5" value="' . ($i + 1) . '" class="text_area" style="text-align: center" /></td>'; echo ' <td nowrap="nowrap">' . JHTML::link($link, $field->prompt) . '</td>'; echo ' <td align="center">' . $image . '</td>'; echo ' <td nowrap="nowrap">' . $field_type_name . '</td>'; echo ' <td align="center">' . $mandatory . '</td>'; echo ' <td align="center">' . $width . '</td>'; echo ' <td align="center">' . $height . '</td>'; echo ' <td align="left">' . $details . '</td>'; echo "\n</tr>"; } echo '</table></form>'; }