<?php
	$MabAdmin = MAB('admin');
	$meta = !empty( $data['meta'] ) ? $data['meta'] : array();
	$optinMeta = !empty( $meta['optin'] ) && is_array( $meta['optin'] ) ? $meta['optin'] : array();
?><div id="mab-manual-settings">
	<div class="mab-option-box">
		<p class="mab-notice">This option allows you to use just about any autoresponder service or email list provider with Magic Action Box as long as your service allows you to generate an HTML - not Javascript - code for you to copy and paste on your website. To learn more about this feature, <a href="http://www.magicactionbox.com/how-use-magic-action-box-with-any-email-marketing-service/" target="_blank">watch this video tutorial</a>.</p>
		<h4><label for="mab-optin-manual-code"><?php _e('Opt In Form Code','mab'); ?></label></h4>
		<p>Paste your opt-in form code here. This HTML code is generated by your email service provider for you to place on your website. Make sure this isn't the javascript version, but the full or raw HTML version of the optin form. Then click on the <strong>Process Code</strong> button below.</p>
		<textarea id="mab-optin-manual-code" class="code large-text" name="mab[optin][manual][code]" rows="5"><?php echo isset( $meta['optin']['manual']['code'] ) ? htmlspecialchars($meta['optin']['manual']['code']) : ''; ?></textarea>
		<br />
		<h4><label for="mab-optin-manual-submit-value"><?php _e( 'Text for submit button','mab' ); ?></label></h4>
		<p>You can specify the text for your submit button (ex: "Subscribe" or "Get it now") Leave this blank to use the value specified in the Opt In Form Code you entered above.
		</p>
		<input id="mab-optin-manual-submit-value" type="text" name="mab[optin][manual][submit-value]" value="<?php echo isset( $meta['optin']['manual']['submit-value'] ) ? $meta['optin']['manual']['submit-value'] : ''; ?>" />
		<br>
		<br>
		<h4><?php _e('Use image for submit button', 'mab'); ?></h4>
		<?php
		$submit_image = isset( $meta['optin']['manual']['submit-image'] ) ? $meta['optin']['manual']['submit-image'] : '';
		?>
		<div class="mab-image-select">
			<input id="mab-optin-manual-submit-image" class="mab-image-select-target" type="text" name="mab[optin][manual][submit-image]" value="<?php echo $submit_image; ?>" ><a id="mab-optin-submit-image-upload" class="button mab-image-select-trigger" href="<?php echo admin_url("media-upload.php?post_id=0&amp;type=image&amp;TB_iframe=1"); ?>">Upload image</a>
			<br>
			<img class="mab-image-select-preview" src="<?php echo $submit_image; ?>" alt="" />
		</div>

		<br />
		<a id="mab-process-manual-optin-code" href="#" class="button-secondary">Process Code</a>
		<img id="mab-optin-process-manual-feedback" class="ajax-feedback" src="<?php echo admin_url('images/wpspin_light.gif'); ?>" alt="" />
		<br />
		<br />
		<h4><label for="mab-optin-manual-processed-code"><?php _e('Processed Opt In Form Code','mab'); ?></label></h4>
		<p>This is the resulting code that will be used in your opt in form. It is generated by placing your email service provider's raw HTML code in the text field above and clicking on the Process Code button.</p>
		<textarea id="mab-optin-manual-processed-code" class="code large-text" name="mab[optin][manual][processed]" rows="5"><?php echo isset( $meta['optin']['manual']['processed'] ) ? htmlspecialchars($meta['optin']['manual']['processed']) : ''; ?></textarea>
		
		<?php /*TODO: add the following block later 
		<br />
		<br />
		<h4><?php _e( 'Email Opt In Fields', 'mab' ); ?></h4>
		<p><?php _e('<strong>Note:</strong> The fields that appear depend on the fields that you have set up with your email provider. You may use your email provider\'s opt-in form generator/designer to create the necessary number of fields and paste the generated HTML code into the <em>Opt In Form Code</em> field above. Or, edit the <em>Processed Opt In Form Code</em> itself if you are comfortable editing HTML code.'); ?></p>
		*/ ?>
	</div>

	<div class="mab-option-box">
		<?php echo mab_option_box('button-style', $data); ?>
	</div>

	<div class="mab-option-box">
		<?php echo mab_option_box('submit-autowidth', $data); ?>
	</div>
</div>