Example #1
0
ERP_output_config_option('priority_feature_options', 'header');
ERP_output_config_option('mail_use_bug_priority', 'boolean');
ERP_output_config_option('mail_bug_priority', 'string_multiline_array');
ERP_output_config_option(NULL, 'empty');
ERP_output_config_option('attachment_feature_options', 'header');
ERP_output_config_option('mail_block_attachments_md5', 'string_multiline');
ERP_output_config_option('mail_block_attachments_logging', 'boolean');
ERP_output_config_option(NULL, 'empty');
ERP_output_config_option('strip_signature_feature_options', 'header');
ERP_output_config_option('mail_strip_signature', 'boolean');
ERP_output_config_option('mail_strip_signature_delim', 'string');
ERP_output_config_option(NULL, 'empty');
ERP_output_config_option('default_texts_options', 'header');
ERP_output_config_option('mail_nosubject', 'string');
ERP_output_config_option('mail_nodescription', 'string');
ERP_output_config_option('mail_removed_reply_text', 'string');
ERP_output_config_option('mail_remove_replies_after', 'string_multiline');
ERP_output_config_option(NULL, 'empty');
ERP_output_config_option('debug_options', 'header');
ERP_output_config_option('mail_debug', 'boolean');
ERP_output_config_option('mail_debug_directory', 'directory_string');
ERP_output_config_option('mail_add_complete_email', 'boolean');
ERP_output_config_option('mail_debug_show_memory_usage', 'boolean');
ERP_output_config_option('update_configuration', 'submit');
?>

</table>
</form>

<?php 
html_page_bottom(__FILE__);
Example #2
0
function ERP_output_config_option($p_name, $p_type, $p_def_value = NULL, $p_function_name = NULL, $p_function_parameter = NULL)
{
    // $p_def_value has special purposes when it contains certain values. See below
    if ($p_def_value === NULL && !is_blank($p_name) && !in_array($p_type, array('empty', 'header', 'submit'), TRUE)) {
        $t_value = plugin_config_get($p_name);
    } elseif (is_array($p_def_value) && (!in_array($p_type, array('dropdown_multiselect', 'dropdown_multiselect_any', 'custom'), TRUE) || in_array($p_type, array('dropdown_multiselect', 'dropdown_multiselect_any', 'custom'), TRUE) && (count($p_def_value) === 0 || array_values($p_def_value) !== $p_def_value))) {
        $t_value = isset($p_def_value[$p_name]) ? $p_def_value[$p_name] : NULL;
    } else {
        $t_value = $p_def_value;
    }
    // incase we are used from within another plugin, we need to modify its name
    if (plugin_get_current() !== 'EmailReporting') {
        $t_input_name = 'plugin_content[' . plugin_get_current() . '][' . $p_name . ']';
    } else {
        $t_input_name = $p_name;
    }
    $t_input_name = string_attribute($t_input_name);
    if (strcasecmp($t_input_name, 'username') === 0 || strcasecmp($t_input_name, 'password') === 0) {
        trigger_error(plugin_lang_get('input_name_not_allowed'), ERROR);
    }
    $t_function_name = 'ERP_custom_function_' . $p_function_name;
    switch ($p_type) {
        case 'empty':
        case 'header':
            echo '
<tr>
	<td class="form-title" ' . (is_blank($t_value) ? 'width="100%" colspan="3"' : 'width="60%"') . '>
		' . (!is_blank($p_name) ? ($p_type === 'header' ? plugin_lang_get('plugin_title') . ': ' : NULL) . plugin_lang_get($p_name) : '&nbsp;') . '
	</td>';
            if (!is_blank($t_value)) {
                echo '<td class="right" width="40%" colspan="2"><a href="' . plugin_page($t_value) . '">' . plugin_lang_get($t_value) . '</a></td>';
            }
            echo '</tr>';
            break;
        case 'hidden':
            echo '<input type="hidden" name="' . $t_input_name . '" value="' . string_attribute($t_value) . '"/>';
            break;
        case 'radio_buttons':
            echo '<tr ' . helper_alternate_class() . '><td class="center" width="100%" colspan="3">';
            if (function_exists($t_function_name)) {
                $t_function_name($t_input_name, $t_value, $p_function_parameter);
            } else {
                echo '<span class="negative">' . plugin_lang_get('function_not_found', 'EmailReporting') . ': ' . $t_function_name . '</span>';
            }
            echo '</td></tr>';
            break;
        case 'submit':
            echo '<tr><td class="center" width="100%" colspan="3"><input ' . helper_get_tab_index() . ' type="submit" class="button" value="' . plugin_lang_get($p_name) . '" /></td></tr>';
            break;
        case 'boolean':
        case 'directory_string':
        case 'disabled':
        case 'integer':
        case 'string':
        case 'string_multiline':
        case 'string_multiline_array':
        case 'string_password':
        case 'dropdown':
        case 'dropdown_any':
        case 'dropdown_multiselect':
        case 'dropdown_multiselect_any':
            echo '<tr ' . helper_alternate_class() . '><td class="category" width="60%">';
            ERP_print_documentation_link($p_name);
            echo '</td>';
            switch ($p_type) {
                case 'boolean':
                    echo '<td class="center" width="20%"><label><input ' . helper_get_tab_index() . ' type="radio" name="' . $t_input_name . '" value="' . ON . '" ';
                    check_checked((int) $t_value, ON);
                    echo '/>' . lang_get('yes') . '</label></td>';
                    echo '<td class="center" width="20%"><label><input ' . helper_get_tab_index() . ' type="radio" name="' . $t_input_name . '" value="' . OFF . '" ';
                    // NULL can also be interpreted as 0. But in this case NULL means no option chosen
                    if ($t_value !== NULL) {
                        check_checked((int) $t_value, OFF);
                    }
                    echo '/>' . lang_get('no') . '</label></td>';
                    break;
                case 'directory_string':
                    $t_dir = $t_value;
                    if (is_dir($t_dir)) {
                        $t_result_is_dir_color = 'positive';
                        $t_result_is_dir_text = plugin_lang_get('directory_exists', 'EmailReporting');
                        if (is_writable($t_dir)) {
                            $t_result_is_writable_color = 'positive';
                            $t_result_is_writable_text = plugin_lang_get('directory_writable', 'EmailReporting');
                        } else {
                            $t_result_is_writable_color = 'negative';
                            $t_result_is_writable_text = plugin_lang_get('directory_unwritable', 'EmailReporting');
                        }
                    } else {
                        $t_result_is_dir_color = 'negative';
                        $t_result_is_dir_text = plugin_lang_get('directory_unavailable', 'EmailReporting');
                        $t_result_is_writable_color = NULL;
                        $t_result_is_writable_text = NULL;
                    }
                    echo '
	<td class="center" width="20%">
		<input ' . helper_get_tab_index() . ' type="text" size="30" maxlength="200" name="' . $t_input_name . '" value="' . string_attribute($t_dir) . '"/>
	</td>
	<td class="center" width="20%">
		<span class="' . $t_result_is_dir_color . '">' . $t_result_is_dir_text . '</span><br /><span class="' . $t_result_is_writable_color . '">' . $t_result_is_writable_text . '</span>
	</td>';
                    break;
                case 'disabled':
                    echo '<td class="center" width="40%" colspan="2">' . plugin_lang_get('disabled');
                    ERP_output_config_option($t_input_name, 'hidden', $t_value);
                    echo '</td>';
                    break;
                case 'integer':
                case 'string':
                    echo '<td class="center" width="40%" colspan="2"><input ' . helper_get_tab_index() . ' type="text" size="50" maxlength="100" name="' . $t_input_name . '" value="' . string_attribute($t_value) . '"/></td>';
                    break;
                case 'string_multiline':
                case 'string_multiline_array':
                    echo '<td class="center" width="40%" colspan="2"><textarea ' . helper_get_tab_index() . ' cols="40" rows="6" name="' . $t_input_name . '">';
                    if (is_array($t_value)) {
                        if ($p_type === 'string_multiline_array') {
                            $t_string_array = var_export($t_value, TRUE);
                            $t_string_array = array_map('trim', explode("\n", $t_string_array));
                            // remove the array opening and closing character
                            array_shift($t_string_array);
                            array_pop($t_string_array);
                            $t_string_array = implode("\n", $t_string_array);
                        } else {
                            $t_string_array = implode("\n", $t_value);
                        }
                        echo string_textarea($t_string_array);
                    } else {
                        echo string_textarea($t_value);
                    }
                    echo '</textarea></td>';
                    break;
                case 'string_password':
                    echo '<td class="center" width="40%" colspan="2"><input ' . helper_get_tab_index() . ' type="password" size="50" maxlength="50" name="' . $t_input_name . '" value="' . string_attribute(base64_decode($t_value)) . '"/></td>';
                    break;
                case 'dropdown':
                case 'dropdown_any':
                case 'dropdown_multiselect':
                case 'dropdown_multiselect_any':
                    echo '<td class="center" width="40%" colspan="2"><select ' . helper_get_tab_index() . ' name="' . $t_input_name . (in_array($p_type, array('dropdown_multiselect', 'dropdown_multiselect_any'), TRUE) ? '[]" multiple size="6' : NULL) . '">';
                    if (function_exists($t_function_name)) {
                        if (in_array($p_type, array('dropdown_any', 'dropdown_multiselect_any'), TRUE)) {
                            echo '<option value="' . META_FILTER_ANY . '"';
                            check_selected((array) $t_value, META_FILTER_ANY);
                            echo '>[' . lang_get('any') . ']</option>';
                        }
                        $t_function_name($t_value, $p_function_parameter);
                    } else {
                        echo '<option class="negative">' . plugin_lang_get('function_not_found', 'EmailReporting') . ': ' . $t_function_name . '</option>';
                    }
                    echo '</select></td>';
                    break;
                default:
                    echo '<tr><td colspan="3">' . plugin_lang_get('unknown_setting', 'EmailReporting') . $p_name . ' -> level 2</td></tr>';
            }
            echo '</tr>';
            break;
        case 'custom':
            if (function_exists($t_function_name)) {
                $t_function_name($p_name, $t_value, $p_function_parameter);
            } else {
                echo '<option class="negative">' . plugin_lang_get('function_not_found', 'EmailReporting') . ': ' . $t_function_name . '</option>';
            }
            break;
        default:
            echo '<tr><td colspan="3">' . plugin_lang_get('unknown_setting', 'EmailReporting') . $p_name . ' -> level 1</td></tr>';
    }
}
ERP_output_config_option(NULL, 'empty');
ERP_output_config_option('mailbox_settings_issue', 'header');
ERP_output_config_option('project_id', 'dropdown', $t_mailbox, 'print_projects_option_list');
ERP_output_config_option('global_category_id', 'dropdown', $t_mailbox, 'print_global_category_option_list');
//ERP_output_config_option( 'link_rules', 'dropdown_multiselect', $t_mailbox, 'print_descriptions_option_list', $t_rules ); // Should we use this here or from the rules page?
//ERP_output_config_option( 'recorddisabled', 'empty' );
event_signal('EVENT_ERP_OUTPUT_MAILBOX_FIELDS', $f_select_mailbox);
ERP_output_config_option($f_mailbox_action . '_action', 'submit');
?>
</table>
</form>

<br />

<form action="<?php 
echo plugin_page($t_this_page);
?>
" method="post">
<table align="center" class="width50 nowrap" cellspacing="1">
<?php 
ERP_output_config_option('mailboxes', 'header', 'manage_config');
ERP_output_config_option('mailbox_action', 'radio_buttons', $f_mailbox_action, 'print_mailbox_action_radio_buttons', $GLOBALS['t_mailboxes']);
ERP_output_config_option('select_mailbox', 'dropdown', $f_select_mailbox, 'print_descriptions_option_list', $GLOBALS['t_mailboxes']);
ERP_output_config_option('recorddisabled', 'empty');
ERP_output_config_option('select_mailbox', 'submit');
?>
</table>
<form>

<?php 
html_page_bottom(__FILE__);
Example #4
0
ERP_output_config_option('act_issue_category', 'dropdown_any', $t_rule, 'print_global_category_option_list');
ERP_output_config_option('act_issue_tag', 'dropdown_multiselect', $t_rule, 'print_tag_attach_option_list');
ERP_output_config_option('act_issue_custom_field', 'custom', $t_rule, 'print_custom_fields');
ERP_output_config_option(NULL, 'empty');
ERP_output_config_option('rule_exceptions', 'header');
ERP_output_config_option('excep_issue_summary', 'string', $t_rule);
ERP_output_config_option('excep_issue_description', 'string', $t_rule);
ERP_output_config_option($f_rule_action . '_action', 'submit');
?>
</table>
</form>

<br />

<form action="<?php 
echo plugin_page($t_this_page);
?>
" method="post">
<table align="center" class="width50 nowrap" cellspacing="1">
<?php 
ERP_output_config_option('rules', 'header', 'manage_mailbox');
ERP_output_config_option('rule_action', 'radio_buttons', $f_rule_action, 'print_rule_action_radio_buttons', $t_rules);
ERP_output_config_option('select_rule', 'dropdown', $f_select_rule, 'print_descriptions_option_list', $t_rules);
ERP_output_config_option('recorddisabled', 'empty');
ERP_output_config_option('select_rule', 'submit');
?>
</table>
<form>

<?php 
html_page_bottom(__FILE__);