<p class="clear">
    <?php
    if (!empty($messages)):
        foreach ($messages as $message):
            ?><div class="updated"><p><?php echo $message; ?></p></div><?php
    endforeach;
endif;
    ?>
<style type="text/css">
    #cm-answers-settings-form table {border-spacing:0;}
    #cm-answers-settings-form tr td, #cm-answers-settings-form tr th {padding:10px; border-bottom: solid 1px #ccc;}
</style>
<?php
// check permalink settings 
if (get_option('permalink_structure') == '') {
      echo '<span style="color:red">Your WordPress Permalinks needs to be set to allow plugin to work correctly. Please Go to <a href="'.admin_url().'options-permalink.php" target="new">Settings->Permalinks</a> to set Permalinks to Post Name.</span><br><br>';
}

?>

<?php include 'sharebox.phtml'; ?>

<h3>Upgrade to Pro</h3>
<table>
	<tr>
    <td style="min-width:200px;"><strong>Pro Version</strong></td>
 	<td style="min-width:200px;"><p><strong><a href="http://answers.cminds.com/" target="_blank">Upgrade</a></p></td>
    <td bgcolor="#CCFFCC"> Professional version of CM Answers which gives the admin better tools to customize the Answers system behavior, adding login support from social networks, adding shortcodes and support for categories and a lot more</td>
	</tr>
	</table>
 
<form method="post" enctype="multipart/form-data" id="cm-answers-settings-form">
    <h3><?php _e('General Settings', 'cm-answers'); ?>:</h3>
    <p><?php _e('You can add "My Questions" and "My Answers" profile views per user anywhere on the site by using shortcodes: [cma-my-questions] and [cma-my-answers]', 'cm-answers'); ?></p>
    <p><?php _e('Link to questions frontend list', 'cm-answers'); ?>: <a href="<?php echo get_post_type_archive_link('cma_thread'); ?>" target="_blank"><?php echo get_post_type_archive_link('cma_thread'); ?></a></p>
    <table>
        <tr valign="top">
                   <th scope="row" valign="middle" align="left" ><?php _e('Questions listing title', 'cm-answers'); ?>:</th>
                   <td ><input type="text" name="questions_title" value="<?php echo esc_attr($questions_title); ?>" placeholder="<?php _e('Questions listing title', 'cm-answers'); ?>"/></td>
                   <td></td>
               </tr>
         <tr valign="top">
            <th scope="row" valign="top" align="left" ><?php _e('Enable ratings for answers', 'cm-answers'); ?>:</th>
            <td ><input type="radio" name="ratings" id="ratings_0" value="0" <?php if (!$ratings)
        echo 'checked="checked"'; ?>/><label for="ratings_0"> <?php _e('No', 'cm-answers'); ?></label> &nbsp; <input type="radio" name="ratings" id="ratings_1" value="1" <?php if ($ratings)
        echo 'checked="checked"'; ?>/><label for="ratings_1"> <?php _e('Yes', 'cm-answers'); ?></label></td>
            <td><?php _e('If enabled, users will be able to rate answers', 'cm-answers'); ?></td>
        </tr>
                        <tr valign="top">
            <th scope="row" valign="top" align="left" ><?php _e('Enable negative ratings', 'cm-answers'); ?>:</th>
            <td ><input type="radio" name="negative_ratings" id="negative_ratings_0" value="0" <?php if (!$negativeRatings)
        echo 'checked="checked"'; ?>/><label for="negative_ratings_0"> <?php _e('No', 'cm-answers'); ?></label> &nbsp; <input type="radio" name="negative_ratings" id="negative_ratings_1" value="1" <?php if ($negativeRatings)
        echo 'checked="checked"'; ?>/><label for="negative_ratings_1"> <?php _e('Yes', 'cm-answers'); ?></label></td>
            <td><?php _e('If enabled, users will be able to give "thumbs down" for an answer. If previous settings is disabled, this will be ignored.', 'cm-answers'); ?></td>
        </tr>
        <tr valign="top">
            <th scope="row" valign="top" align="left" ><?php _e('On questions list in "votes" box show', 'cm-answers'); ?>:</th>
            <td ><input type="radio" name="votes_mode" id="votes_mode_<?php echo CMA_AnswerThread::VOTES_MODE_COUNT; ?>" value="<?php echo CMA_AnswerThread::VOTES_MODE_COUNT; ?>" <?php if ($votesMode == CMA_AnswerThread::VOTES_MODE_COUNT)
        echo 'checked="checked"'; ?>/><label for="votes_mode_<?php echo CMA_AnswerThread::VOTES_MODE_COUNT; ?>"> <?php _e('Total number of votes of its answers', 'cm-answers'); ?></label><br /><br />
                <input type="radio" name="votes_mode" id="votes_mode_<?php echo CMA_AnswerThread::VOTES_MODE_HIGHEST; ?>" value="<?php echo CMA_AnswerThread::VOTES_MODE_HIGHEST; ?>" <?php if ($votesMode == CMA_AnswerThread::VOTES_MODE_HIGHEST)
        echo 'checked="checked"'; ?>/><label for="votes_mode_<?php echo CMA_AnswerThread::VOTES_MODE_HIGHEST; ?>"> <?php _e('Rating of the best answer', 'cm-answers'); ?></label></td>
            <td><?php _e('If ratings are disabled, this setting will be ignored.', 'cm-answers'); ?></td>
        </tr>
               
        <tr valign="top">
            <th scope="row" valign="middle" align="left" ><?php _e('Auto-approve new questions', 'cm-answers'); ?>:</th>
            <td ><input type="radio" name="questions_auto_approve" id="questions_auto_approve_0" value="0" <?php if (!$questionAutoApproved)
        echo 'checked="checked"'; ?>/><label for="questions_auto_approve_0"> <?php _e('No', 'cm-answers'); ?></label> &nbsp; <input type="radio" name="questions_auto_approve" id="questions_auto_approve_1" value="1" <?php if ($questionAutoApproved)
        echo 'checked="checked"'; ?>/><label for="questions_auto_approve_1"> <?php _e('Yes', 'cm-answers'); ?></label></td>
            <td></td>
        </tr>
        <tr valign="top">
            <th scope="row" valign="middle" align="left" ><?php _e('Auto-approve answers', 'cm-answers'); ?>:</th>
            <td ><input type="radio" name="answers_auto_approve" id="answers_auto_approve_0" value="0" <?php if (!$answerAutoApproved)
        echo 'checked="checked"'; ?>/><label for="answers_auto_approve_0"> <?php _e('No', 'cm-answers'); ?></label> &nbsp; <input type="radio" name="answers_auto_approve" id="answers_auto_approve_1" value="1" <?php if ($answerAutoApproved)
        echo 'checked="checked"'; ?>/><label for="answers_auto_approve_1"> <?php _e('Yes', 'cm-answers'); ?></label></td>
            <td></td>
        </tr>
        <tr valign="top">
                    <th scope="row" valign="middle" align="left" >Enable sidebar:</th>
                    <td ><input type="radio" name="sidebar_enable" id="sidebar_enable_0" value="0" <?php if (!$sidebarEnable)
                                        echo 'checked="checked"';
    ?>/><label for="sidebar_enable_0"> No</label> &nbsp; <input type="radio" name="sidebar_enable" id="sidebar_enable_1" value="1" <?php if ($sidebarEnable)
                                        echo 'checked="checked"';
    ?>/><label for="sidebar_enable_1"> Yes</label></td>
                    <td>Enable separate sidebar for CM Answers pages</td>
                </tr>
                <tr valign="top">
                    <th scope="row" valign="middle" align="left">Set sidebar max width (in px):</th>
                    <td><input type="number" name="sidebar_max_width" value="<?php echo esc_attr($sidebarMaxWidth); ?>" /></td>
                    <td>Set maximum width of sidebar or leave 0 to auto-adjust</td>
                </tr>
        <tr valign="top">
            <th scope="row" valign="middle" align="left" ><?php _e('Add "Answers" to WP Nav Menu', 'cm-answers'); ?>:</th>
            <td ><input type="radio" name="add_menu" id="add_menu_0" value="0" <?php if (!$addMenu)
        echo 'checked="checked"'; ?>/><label for="add_menu_0"> <?php _e('No', 'cm-answers'); ?></label> &nbsp; <input type="radio" name="add_menu" id="add_menu_1" value="1" <?php if ($addMenu)
        echo 'checked="checked"'; ?>/><label for="add_menu_1"> <?php _e('Yes', 'cm-answers', 'cm-answers'); ?></label></td>
            <td><?php _e('You need to have "wp_nav_menu" trigger in your template', 'cm-answers'); ?></td>
        </tr>
    </table>
        <h3><?php _e('Notifications', 'cm-answers'); ?>:</h3>
        <table>
         <tr valign="top">
            <th scope="row" valign="middle" align="left" ><?php _e('Notify about new questions', 'cm-answers'); ?>:</th>
            <td ><input type="text" size="60" name="notification_new_questions" value="<?php echo esc_attr($notificationNewQuestions); ?>" placeholder="<?php _e('Example', 'cm-answers'); ?>: email@address.com, name@otheraddress.com"/></td>
            <td><?php _e('Separate e-mail addresses by commas or leave empty to disable.', 'cm-answers'); ?></td>
        </tr>
        <tr valign="top">
            <th scope="row" valign="middle" align="left" ><?php _e('New question notification title', 'cm-answers'); ?>:</th>
            <td ><input type="text" size="60" name="new_question_notification_title" value="<?php echo esc_attr($newQuestionNotificationTitle); ?>" /></td>
            <td></td>
        </tr>
        <tr valign="top">
            <th scope="row" valign="top" align="left" ><?php _e('New question notification content', 'cm-answers'); ?>:</th>
            <td ><textarea cols="60" rows="5" name="new_question_notification_content"><?php echo $newQuestionNotificationContent; ?></textarea></td>
            <td><em>[blogname]</em> - <?php _e('Name of the site', 'cm-answers'); ?><br />
                <em>[author]</em> - <?php _e('Author of the question', 'cm-answers'); ?><br />
                <em>[question_title]</em> - <?php _e('Title of the question', 'cm-answers'); ?><br />
                <em>[question_status]</em> - <?php _e('Approval status of the question (pending, approved)', 'cm-answers'); ?><br />
                <em>[question_link]</em> - <?php _e('Link to the new question', 'cm-answers'); ?></td>
        </tr>
        <tr valign="top">
            <th scope="row" valign="middle" align="left" ><?php _e('New answer notification title', 'cm-answers'); ?>:</th>
            <td ><input type="text" size="60" name="notification_title" value="<?php echo esc_attr($notificationTitle); ?>" /></td>
            <td></td>
        </tr>
        <tr valign="top">
            <th scope="row" valign="top" align="left" ><?php _e('New answer notification content', 'cm-answers'); ?>:</th>
            <td ><textarea cols="60" rows="5" name="notification_content"><?php echo $notificationContent; ?></textarea></td>
            <td><em>[blogname]</em> - <?php _e('Name of the site', 'cm-answers'); ?><br />
                <em>[question_title]</em> - <?php _e('Title of the question', 'cm-answers'); ?><br />
                <em>[comment_link]</em> - <?php _e('Link to the new answer', 'cm-answers'); ?></td>
        </tr>
    </table>

    <input type="submit" class="button" value="<?php _e('Update', 'cm-answers', 'cm-answers'); ?>" />
</form>
</p>