Пример #1
0
    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>';
    }
Пример #2
0
    function display($tpl = null)
    {
        FCP_Admin::make_title('COM_FLEXICONTACT_CONFIG_CSS_NAME');
        JToolBarHelper::apply('apply_css');
        JToolBarHelper::save('save_css');
        JToolBarHelper::cancel();
        $css_files = FCP_Admin::get_css_list();
        if ($css_files == false) {
            $app = JFactory::getApplication();
            $app->redirect(LAFC_COMPONENT_LINK . '&task=display', JText::sprintf('COM_FLEXICONTACT_NO_CSS', LAFC_SITE_ASSETS_PATH), 'error');
            return;
        }
        $fail = false;
        $path = LAFC_SITE_ASSETS_PATH . '/';
        $css_file_name = $this->config_data->config_data->css_file;
        // set the css name to be used by the view. Assume that the specified one is ok
        // Check the current CSS file
        if (!file_exists($path . $css_file_name)) {
            $app = JFactory::getApplication();
            $app->enqueueMessage(JText::_('COM_FLEXICONTACT_CSS_MISSING') . ' (' . $path . $css_file_name . ')', 'error');
            FCP_trace::trace("Config_CSS View: " . $path . $css_file_name . " missing");
            $fail = true;
        } else {
            if (!is_readable($path . $css_file_name)) {
                $app = JFactory::getApplication();
                $app->enqueueMessage(JText::_('COM_FLEXICONTACT_CSS_NOT_READABLE') . ' (' . $path . $css_file_name . ')', 'error');
                FCP_trace::trace("Config_CSS View: " . $path . $css_file_name . " not readable");
                $fail = true;
            }
            if (!is_writable($path . $css_file_name)) {
                $app = JFactory::getApplication();
                $app->enqueueMessage(JText::_('COM_FLEXICONTACT_CSS_NOT_WRITEABLE') . ' (' . $path . $css_file_name . ')', 'error');
                FCP_trace::trace("Config_CSS View: " . $path . $css_file_name . " not writeable");
                $fail = true;
            }
        }
        // Do we have a problem with the selected CSS file? If so, try the default
        if ($fail) {
            if ($css_file_name !== LAFC_FRONT_CSS_NAME) {
                $fail = false;
                $css_file_name = LAFC_FRONT_CSS_NAME;
                FCP_trace::trace("-------------------->: Attempting to use default CSS file");
                if (!file_exists($path . $css_file_name)) {
                    FCP_trace::trace("-------------------->: " . $path . $css_file_name . " missing");
                    $fail = true;
                } else {
                    if (!is_readable($path . $css_file_name)) {
                        FCP_trace::trace("-------------------->: " . $path . $css_file_name . " not readable");
                        $fail = true;
                    }
                    if (!is_writable($path . $css_file_name)) {
                        FCP_trace::trace("-------------------->: " . $path . $css_file_name . " not writeable");
                        $fail = true;
                    }
                }
            }
        }
        // If we still have a problem, find the first valid css file in the files list
        if ($fail) {
            foreach ($css_files as $key => $value) {
                $css_file_name = $key;
                $fail = false;
                if (!file_exists($path . $css_file_name)) {
                    $fail = true;
                }
                if (!$fail and !is_readable($path . $css_file_name)) {
                    $fail = true;
                }
                if (!$fail and !is_writable($path . $css_file_name)) {
                    $fail = true;
                }
                if (!$fail) {
                    // Found a functioning css file
                    break;
                }
            }
        }
        // Still got a problem?
        if ($fail) {
            $app = JFactory::getApplication();
            $app->redirect(LAFC_COMPONENT_LINK . '&task=display', JText::sprintf('COM_FLEXICONTACT_NO_VALID_CSS', LAFC_SITE_ASSETS_PATH), 'error');
            return;
        }
        $css_contents = @file_get_contents($path . $css_file_name);
        ?>
	<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_css" />
	
	<?php 
        echo '<table>';
        echo '<tr><td>' . FCP_Common::make_list('css_file_name', $css_file_name, $css_files, 0, 'onchange="submitform( );"') . '</td></tr>';
        echo '<tr><td class="css_file_path">' . JText::_('COM_FLEXICONTACT_CSS_FILE'), ': (' . $path . $css_file_name . ')';
        echo '<tr><td>';
        echo '<textarea name="css_contents" rows="25" cols="125" style="width:auto;">' . $css_contents . '</textarea>';
        echo '</td><td valign="top">';
        echo FCP_Admin::make_info('www.w3schools.com/css', 'http://www.w3schools.com/css/default.asp');
        echo '</td></tr></table>';
        ?>
	</form>
	<?php 
    }