Exemplo n.º 1
0
    public static function forms_page($form_id)
    {
        global $wpdb;
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        $update_result = '';
        if (rgpost('operation') == 'trash') {
            check_admin_referer('gforms_trash_form', 'gforms_trash_form');
            GFFormsModel::trash_form($form_id);
            ?>
			<script type="text/javascript">
				jQuery(document).ready(
					function () {
						document.location.href = '?page=gf_edit_forms';
					}
				);
			</script>
			<?php 
            exit;
        } else {
            if (!rgempty('gform_meta')) {
                check_admin_referer("gforms_update_form_{$form_id}", 'gforms_update_form');
                $update_result = self::save_form_info($form_id, rgpost('gform_meta', false));
            }
        }
        require_once GFCommon::get_base_path() . '/currency.php';
        wp_print_styles(array('thickbox'));
        /* @var GF_Field_Address $gf_address_field  */
        $gf_address_field = GF_Fields::get('address');
        ?>

		<link rel="stylesheet" href="<?php 
        echo GFCommon::get_base_url();
        ?>
/css/admin.css?ver=<?php 
        echo GFCommon::$version;
        ?>
" type="text/css" />

		<script type="text/javascript">
			<?php 
        GFCommon::gf_global();
        ?>
			<?php 
        GFCommon::gf_vars();
        ?>
		</script>

		<script type="text/javascript">

			function has_entry(fieldNumber) {
				var submitted_fields = [<?php 
        echo RGFormsModel::get_submitted_fields($form_id);
        ?>
];
				for (var i = 0; i < submitted_fields.length; i++) {
					if (submitted_fields[i] == fieldNumber)
						return true;
				}
				return false;
			}

			function InsertPostImageVariable(element_id, callback) {
				var variable = jQuery('#' + element_id + '_image_size_select').attr("variable");
				var size = jQuery('#' + element_id + '_image_size_select').val();
				if (size) {
					variable = "{" + variable + ":" + size + "}";
					InsertVariable(element_id, callback, variable);
					jQuery('#' + element_id + '_image_size_select').hide();
					jQuery('#' + element_id + '_image_size_select')[0].selectedIndex = 0;
				}
			}

			function InsertPostContentVariable(element_id, callback) {
				var variable = jQuery('#' + element_id + '_variable_select').val();
				var regex = /{([^{]*?: *(\d+\.?\d*).*?)}/;
				matches = regex.exec(variable);
				if (!matches) {
					InsertVariable(element_id, callback);
					return;
				}

				variable = matches[1];
				field_id = matches[2];

				for (var i = 0; i < form["fields"].length; i++) {
					if (form["fields"][i]["id"] == field_id) {
						if (form["fields"][i]["type"] == "post_image") {
							jQuery('#' + element_id + '_image_size_select').attr("variable", variable);
							jQuery('#' + element_id + '_image_size_select').show();
							return;
						}
					}
				}

				InsertVariable(element_id, callback);
			}


			function IsValidFormula(formula) {
				if (formula == '')
					return true;
				var patt = /{([^}]+)}/i,
					exprPatt = /^[0-9 -/*\(\)]+$/i,
					expr = formula.replace(/(\r\n|\n|\r)/gm, ''),
					match;
				while (match = patt.exec(expr)) {
					expr = expr.replace(match[0], 1);
				}
				if (exprPatt.test(expr)) {
					try {
						var r = eval(expr);
						return !isNaN(parseFloat(r)) && isFinite(r);
					} catch (e) {
						return false;
					}
				} else {
					return false;
				}
			}
		</script>

		<?php 
        $form = !rgempty('meta', $update_result) ? rgar($update_result, 'meta') : GFFormsModel::get_form_meta($form_id);
        if (!isset($form['fields']) || !is_array($form['fields'])) {
            $form['fields'] = array();
        }
        $form = apply_filters('gform_admin_pre_render_' . $form_id, apply_filters('gform_admin_pre_render', $form));
        if (isset($form['id'])) {
            echo "<script type=\"text/javascript\">var form = " . json_encode($form) . ';</script>';
        } else {
            echo "<script type=\"text/javascript\">var form = new Form();</script>";
        }
        ?>

		<?php 
        echo GFCommon::get_remote_message();
        ?>
		<div class="wrap gforms_edit_form <?php 
        echo GFCommon::get_browser_class();
        ?>
">
		<?php 
        if (empty($form_id)) {
            ?>
			<h2 class="gf_admin_page_title"><?php 
            _e('New Form', 'gravityforms');
            ?>
</h2>
		<?php 
        } else {
            ?>
			<h2 class="gf_admin_page_title">
				<span><?php 
            _e('Form Editor', 'gravityforms');
            ?>
</span><span class="gf_admin_page_subtitle"><span class="gf_admin_page_formid">ID: <?php 
            echo absint($form['id']);
            ?>
</span><span class="gf_admin_page_formname"><?php 
            _e('Form Name', 'gravityforms');
            ?>
: <?php 
            echo esc_html($form['title']);
            ?>
</span></span>
			</h2>
		<?php 
        }
        ?>

		<?php 
        RGForms::top_toolbar();
        ?>

		<?php 
        switch (rgar($update_result, 'status')) {
            case 'invalid_json':
                ?>
				<div class="error_base gform_editor_status" id="after_update_error_dialog">
					<?php 
                _e('There was an error while saving your form.', 'gravityforms');
                ?>
					<?php 
                printf(__('Please %scontact our support team%s.', 'gravityforms'), '<a href="http://www.gravityhelp.com">', '</a>');
                ?>
				</div>
				<?php 
                break;
            case 'duplicate_title':
                ?>
				<div class="error_base gform_editor_status" id="after_update_error_dialog">
					<?php 
                _e('The form title you have entered is already taken. Please enter a unique form title.', 'gravityforms');
                ?>
				</div>
				<?php 
                break;
            default:
                if (!empty($update_result)) {
                    ?>
					<div class="updated_base gform_editor_status" id="after_update_dialog">
						<strong><?php 
                    _e('Form updated successfully.', 'gravityforms');
                    ?>
</strong>
					</div>
				<?php 
                }
                break;
        }
        ?>

		<?php 
        // link to the google webfont library
        ?>
		<style type="text/css">
			@import url('//fonts.googleapis.com/css?family=Shadows+Into+Light+Two');
		</style>

		<form method="post" id="form_trash">
			<?php 
        wp_nonce_field('gforms_trash_form', 'gforms_trash_form');
        ?>
			<input type="hidden" value="trash" name="operation" />
		</form>

		<table width="100%">
		<tr>
		<td class="pad_top" valign="top">
		<?php 
        $has_pages = GFCommon::has_pages($form);
        ?>
		<div id="gform_pagination" class="selectable gform_settings_container" style="display:<?php 
        echo $has_pages ? 'block' : 'none';
        ?>
;">
			<div class="settings_control_container">
				<a href="javascript:void(0);" class="form_edit_icon edit_icon_collapsed" title="<?php 
        _e('click to edit page options', 'gravityforms');
        ?>
"><i class='fa fa-caret-down fa-lg'></i></a>
			</div>


			<div class="gf-pagebreak-first gf-pagebreak-container">
				<div class="gf-pagebreak-text-before"><?php 
        _e('begin form', 'gravityforms');
        ?>
</div>
				<div class="gf-pagebreak-text-main"><span><?php 
        _e('START PAGING', 'gravityforms');
        ?>
</span></div>
				<div class="gf-pagebreak-text-after"><?php 
        _e('top of the first page', 'gravityforms');
        ?>
</div>
			</div>

			<div id="pagination_settings" style="display: none;">
				<ul>
					<li style="width:100px; padding:0px;">
						<a href="#gform_pagination_settings_tab_1"><?php 
        _e('Properties', 'gravityforms');
        ?>
</a></li>
					<li style="width:100px; padding:0px;">
						<a href="#gform_pagination_settings_tab_2"><?php 
        _e('Advanced', 'gravityforms');
        ?>
</a></li>
				</ul>

				<div id="gform_pagination_settings_tab_1">
					<ul class="gforms_form_settings">
						<li>
							<label for="pagination_type_container">
								<?php 
        _e('Progress Indicator', 'gravityforms');
        ?>
								<?php 
        gform_tooltip('form_progress_indicator');
        ?>
							</label>

							<div id="pagination_type_container" class="pagination_container">
								<input type="radio" id="pagination_type_percentage" name="pagination_type" value="percentage" onclick='InitPaginationOptions();' />
								<label for="pagination_type_percentage" class="inline">
									<?php 
        _e('Progress Bar', 'gravityforms');
        ?>
								</label>
								&nbsp;&nbsp;
								<input type="radio" id="pagination_type_steps" name="pagination_type" value="steps" onclick='InitPaginationOptions();' />
								<label for="pagination_type_steps" class="inline">
									<?php 
        _e('Steps', 'gravityforms');
        ?>
								</label>
								&nbsp;&nbsp;
								<input type="radio" id="pagination_type_none" name="pagination_type" value="none" onclick='InitPaginationOptions();' />
								<label for="pagination_type_none" class="inline">
									<?php 
        _e('None', 'gravityforms');
        ?>
								</label>
							</div>
						</li>

						<li id="percentage_style_setting">

							<div class="percentage_style_setting" style="float:left; z-index: 99;">
								<label for="percentage_style" style="display:block;">
									<?php 
        _e('Style', 'gravityforms');
        ?>
									<?php 
        gform_tooltip('form_percentage_style');
        ?>
								</label>
								<select id="percentage_style" onchange="TogglePercentageStyle();">
									<option value="blue">  <?php 
        _e('Blue', 'gravityforms');
        ?>
  </option>
									<option value="gray">  <?php 
        _e('Gray', 'gravityforms');
        ?>
  </option>
									<option value="green">  <?php 
        _e('Green', 'gravityforms');
        ?>
  </option>
									<option value="orange">  <?php 
        _e('Orange', 'gravityforms');
        ?>
  </option>
									<option value="red">  <?php 
        _e('Red', 'gravityforms');
        ?>
  </option>
									<option value="custom">  <?php 
        _e('Custom', 'gravityforms');
        ?>
  </option>
								</select>
							</div>

							<div class="percentage_custom_container" style="float:left; padding-left:20px;">
								<label for="percentage_background_color" style="display:block;">
									<?php 
        _e('Text Color', 'gravityforms');
        ?>
								</label>
								<?php 
        self::color_picker('percentage_style_custom_color', '');
        ?>
							</div>

							<div class="percentage_custom_container" style="float:left; padding-left:20px;">
								<label for="percentage_background_bgcolor" style="display:block;">
									<?php 
        _e('Background Color', 'gravityforms');
        ?>
								</label>
								<?php 
        self::color_picker('percentage_style_custom_bgcolor', '');
        ?>
							</div>
						</li>
						<li id="page_names_setting">
							<label for="page_names_container">
								<?php 
        _e('Page Names', 'gravityforms');
        ?>
								<?php 
        gform_tooltip('form_page_names');
        ?>
							</label>

							<div id="page_names_container" style="margin-top:5px;">
								<!-- Populated dynamically from js.php -->
							</div>
						</li>
						<li id="percentage_confirmation_display_setting">
							<div class="percentage_confirmation_display_setting">
								<input type="checkbox" id="percentage_confirmation_display" onclick="TogglePercentageConfirmationText()">
								<label for="percentage_confirmation_display" class="inline">
									<?php 
        _e('Display completed progress bar on confirmation', 'gravityforms');
        ?>
									<?php 
        gform_tooltip('form_percentage_confirmation_display');
        ?>
								</label>
							</div>
						</li>
						<li id="percentage_confirmation_page_name_setting">
							<div class="percentage_confirmation_page_name_setting">
								<label for="percentage_confirmation_page_name" style="display:block;">
									<?php 
        _e('Completion Text', 'gravityforms');
        ?>
 <?php 
        gform_tooltip('percentage_confirmation_page_name');
        ?>
								</label>
								<input type="text" id="percentage_confirmation_page_name" class="fieldwidth-3" />
							</div>
						</li>
					</ul>
				</div>

				<div id="gform_pagination_settings_tab_2">
					<ul class="gforms_form_settings">
						<li>
							<label for="first_page_css_class" style="display:block;">
								<?php 
        _e('CSS Class Name', 'gravityforms');
        ?>
								<?php 
        gform_tooltip('form_field_css_class');
        ?>
							</label>
							<input type="text" id="first_page_css_class" size="30" />
						</li>
					</ul>
				</div>
			</div>
		</div>

		<ul id="gform_fields" class="<?php 
        echo GFCommon::get_ul_classes($form);
        ?>
" style="position: relative;">

			<?php 
        if (empty($form['fields'])) {
            ?>

				<?php 
            // link to the google webfont library
            ?>
				<style type="text/css">
					@import url('//fonts.googleapis.com/css?family=Shadows+Into+Light+Two');
				</style>
				<li id="no-fields">

					<div class="newform_notice"><?php 
            _e("This form doesn't have any fields yet. Follow the steps below to get started.", 'gravityforms');
            ?>
						<span></span></div>

					<?php 
            // first step
            ?>

					<h4 class="gf_nofield_header gf_nofield_1">1. <?php 
            _e('Select A Field Type', 'gravityforms');
            ?>
</h4>

					<p><?php 
            _e('Start by seleting a field type from the nifty floating panels on the right.', 'gravityforms');
            ?>
</p>

					<div id="gf_nofield_1_instructions">
						<span class="gf_nofield_1_instructions_heading gf_tips"><?php 
            _e('Start Over There', 'gravityforms');
            ?>
</span>
						<span class="gf_nofield_1_instructions_copy gf_tips"><?php 
            _e('Pick a field.. any field. Don\'t be shy.', 'gravityforms');
            ?>
</span>
					</div>

					<?php 
            // second step
            ?>

					<h4 class="gf_nofield_header gf_nofield_2">2. <?php 
            _e('Click to Add A Field', 'gravityforms');
            ?>
</h4>

					<p><?php 
            _e('Once you&#39;ve found the field type you want, click to add it to the form editor here on the left side of your screen.', 'gravityforms');
            ?>
</p>

					<div id="gf_nofield_2_instructions">
						<span class="gf_nofield_2_instructions_copy gf_tips"><?php 
            _e('Now your new field magically appears over here.', 'gravityforms');
            ?>
</span>
					</div>

					<?php 
            // third step
            ?>

					<h4 class="gf_nofield_header gf_nofield_3">3. <?php 
            _e('Edit Field Options', 'gravityforms');
            ?>
</h4>

					<p><?php 
            _e('Click on the edit link to configure the various field options', 'gravityforms');
            ?>
</p>

					<div id="gf_nofield_3_instructions">
						<span class="gf_nofield_3_instructions_copy_top gf_tips"><?php 
            _e('Preview your changes up here.', 'gravityforms');
            ?>
</span>
						<span class="gf_nofield_3_instructions_copy_mid gf_tips"><?php 
            _e('Edit the field options. Go ahead.. go crazy.', 'gravityforms');
            ?>
</span>
						<span class="gf_nofield_3_instructions_copy_bottom gf_tips"><?php 
            _e('If you get stuck, mouseover the tool tips for a little help.', 'gravityforms');
            ?>
</span>
					</div>

					<?php 
            // fourth step
            ?>

					<h4 class="gf_nofield_header gf_nofield_4">4. <?php 
            _e('Drag to Arrange Fields', 'gravityforms');
            ?>
</h4>

					<p><?php 
            _e('Drag the fields to arrange them the way you prefer', 'gravityforms');
            ?>
</p>

					<div id="gf_nofield_4_instructions">
						<span class="gf_nofield_4_instructions_copy_top gf_tips"><?php 
            _e('Grab here with your cursor.', 'gravityforms');
            ?>
</span>
						<span class="gf_nofield_4_instructions_copy_bottom gf_tips"><?php 
            _e('Drag up or down to arrange your fields.', 'gravityforms');
            ?>
</span>
					</div>

					<?php 
            // fifth step
            ?>

					<h4 class="gf_nofield_header gf_nofield_5">5. <?php 
            _e('Save Your Form', 'gravityforms');
            ?>
</h4>

					<p><?php 
            _e('Once you&#39;re happy with your form, remember to click on the &quot;update form&quot; button to save all your hard work.', 'gravityforms');
            ?>
</p>

					<div id="gf_nofield_5_instructions">
						<span class="gf_nofield_5_instructions_heading gf_tips"><?php 
            _e('Save Your New Form', 'gravityforms');
            ?>
</span>
						<span class="gf_nofield_5_instructions_copy gf_tips"><?php 
            _e('You\'re done. That\'s it.', 'gravityforms');
            ?>
</span>
					</div>

				</li>
			<?php 
        }
        ?>

			<?php 
        if (is_array(rgar($form, 'fields'))) {
            require_once GFCommon::get_base_path() . '/form_display.php';
            foreach ($form['fields'] as $field) {
                echo GFFormDisplay::get_field($field, '', true, $form);
            }
        }
        ?>
		</ul>

		<div id="gform_last_page_settings" class="selectable gform_settings_container" style="display:<?php 
        echo $has_pages ? 'block' : 'none';
        ?>
;">
			<div class="settings_control_container">
				<a href="javascript:void(0);" class="form_edit_icon edit_icon_collapsed" title="<?php 
        _e('Edit Last Page', 'gravityforms');
        ?>
"><i class='fa fa-caret-down fa-lg'></i></a>
			</div>

			<div class="gf-pagebreak-end gf-pagebreak-container">
				<div class="gf-pagebreak-text-before"><?php 
        _e('end of last page', 'gravityforms');
        ?>
</div>
				<div class="gf-pagebreak-text-main"><span><?php 
        _e('END PAGING', 'gravityforms');
        ?>
</span></div>
				<div class="gf-pagebreak-text-after"><?php 
        _e('end of form', 'gravityforms');
        ?>
</div>
			</div>


			<div id="last_page_settings" style="display:none;">
				<ul>
					<li style="width:100px; padding:0px;">
						<a href="#gform_last_page_settings_tab_1"><?php 
        _e('Properties', 'gravityforms');
        ?>
</a></li>
				</ul>
				<div id="gform_last_page_settings_tab_1">
					<ul class="gforms_form_settings">
						<li>
							<label for="last_page_button_container">
								<?php 
        _e('Previous Button', 'gravityforms');
        ?>
								<?php 
        gform_tooltip('form_field_last_page_button');
        ?>
							</label>

							<div class="last_page_button_options" id="last_page_button_container">
								<input type="radio" id="last_page_button_text" name="last_page_button" value="text" onclick="TogglePageButton('last_page');" />
								<label for="last_page_button_text" class="inline">
									<?php 
        _e('Default', 'gravityforms');
        ?>
									<?php 
        gform_tooltip('previous_button_text');
        ?>
								</label>
								&nbsp;&nbsp;
								<input type="radio" id="last_page_button_image" name="last_page_button" value="image" onclick="TogglePageButton('last_page');" />
								<label for="last_page_button_image" class="inline">
									<?php 
        _e('Image', 'gravityforms');
        ?>
									<?php 
        gform_tooltip('previous_button_image');
        ?>
								</label>

								<div id="last_page_button_text_container" style="margin-top:5px;">
									<label for="last_page_button_text_input" class="inline">
										<?php 
        _e('Text:', 'gravityforms');
        ?>
									</label>
									<input type="text" id="last_page_button_text_input" class="input_size_b" size="40" />
								</div>

								<div id="last_page_button_image_container" style="margin-top:5px;">
									<label for="last_page_button_image_url" class="inline">
										<?php 
        _e('Image Path:', 'gravityforms');
        ?>
									</label>
									<input type="text" id="last_page_button_image_url" size="45" />
								</div>
							</div>
						</li>
					</ul>
				</div>
			</div>
		</div>

		<div>

			<div id="after_insert_dialog" style="display:none;">
				<h3><?php 
        _e('You have successfully saved your form!', 'gravityforms');
        ?>
</h3>

				<p><?php 
        _e('What would you like to do next?', 'gravityforms');
        ?>
</p>

				<div class="new-form-option">
					<a title="<?php 
        _e('Preview this form', 'gravityforms');
        ?>
" id="preview_form_link" href="<?php 
        echo trailingslashit(site_url());
        ?>
?gf_page=preview&id={formid}" target="_blank"><?php 
        _e('Preview this Form', 'gravityforms');
        ?>
</a>
				</div>

				<?php 
        if (GFCommon::current_user_can_any('gravityforms_edit_forms')) {
            ?>
					<div class="new-form-option">
						<a title="<?php 
            _e('Setup email notifications for this form', 'gravityforms');
            ?>
" id="notification_form_link" href="#"><?php 
            _e('Setup Email Notifications for this Form', 'gravityforms');
            ?>
</a>
					</div>
				<?php 
        }
        ?>

				<div class="new-form-option">
					<a title="<?php 
        _e('Continue editing this form', 'gravityforms');
        ?>
" id="edit_form_link" href="#"><?php 
        _e('Continue Editing this Form', 'gravityforms');
        ?>
</a>
				</div>

				<div class="new-form-option">
					<a title="<?php 
        _e('I am done. Take me back to form list', 'gravityforms');
        ?>
" href="?page=gf_edit_forms"><?php 
        _e('Return to Form List', 'gravityforms');
        ?>
</a>
				</div>

			</div>


		</div>
		<div id="field_settings" style="display: none;">
		<ul>
			<li style="width:100px; padding:0px;">
				<a href="#gform_tab_1"><?php 
        _e('General', 'gravityforms');
        ?>
</a>
            </li>
            <li style="width:100px; padding:0px; ">
                <a href="#gform_tab_3"><?php 
        _e('Appearance', 'gravityforms');
        ?>
</a>
            </li>
			<li style="width:100px; padding:0px; ">
                <a href="#gform_tab_2"><?php 
        _e('Advanced', 'gravityforms');
        ?>
</a>
			</li>
		</ul>
		<div id="gform_tab_1">
		<ul>
		<?php 
        do_action('gform_field_standard_settings', 0, $form_id);
        ?>
		<li class="label_setting field_setting">
			<label for="field_label">
				<?php 
        _e('Field Label', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_label');
        ?>
				<?php 
        gform_tooltip('form_field_label_html');
        ?>
			</label>
			<input type="text" id="field_label" class="fieldwidth-3" size="35" />
		</li>
        <?php 
        do_action('gform_field_standard_settings', 10, $form_id);
        ?>
		<li class="description_setting field_setting">
			<label for="field_description">
				<?php 
        _e('Description', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_description');
        ?>
			</label>
			<textarea id="field_description" class="fieldwidth-3 fieldheight-2"></textarea>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 20, $form_id);
        ?>
        <li class="product_field_setting field_setting">
			<label for="product_field">
				<?php 
        _e('Product Field Mapping', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_product');
        ?>
			</label>
			<select id="product_field" onchange="SetFieldProperty('productField', jQuery(this).val());">
				<!-- will be populated when field is selected (js.php) -->
			</select>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 25, $form_id);
        ?>
		<li class="product_field_type_setting field_setting">
			<label for="product_field_type">
				<?php 
        _e('Field Type', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_type');
        ?>
			</label>
			<select id="product_field_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeProductType(jQuery('#product_field_type').val());});">
				<option value="singleproduct"><?php 
        _e('Single Product', 'gravityforms');
        ?>
</option>
				<option value="select"><?php 
        _e('Drop Down', 'gravityforms');
        ?>
</option>
				<option value="radio"><?php 
        _e('Radio Buttons', 'gravityforms');
        ?>
</option>
				<option value="price"><?php 
        _e('User Defined Price', 'gravityforms');
        ?>
</option>
				<option value="hiddenproduct"><?php 
        _e('Hidden', 'gravityforms');
        ?>
</option>
				<option value="calculation"><?php 
        _e('Calculation', 'gravityforms');
        ?>
</option>
			</select>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 37, $form_id);
        ?>
		<li class="shipping_field_type_setting field_setting">
			<label for="shipping_field_type">
				<?php 
        _e('Field Type', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_type');
        ?>
			</label>
			<select id="shipping_field_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeShippingType(jQuery('#shipping_field_type').val());});">
				<option value="singleshipping"><?php 
        _e('Single Method', 'gravityforms');
        ?>
</option>
				<option value="select"><?php 
        _e('Drop Down', 'gravityforms');
        ?>
</option>
				<option value="radio"><?php 
        _e('Radio Buttons', 'gravityforms');
        ?>
</option>
			</select>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 50, $form_id);
        ?>
		<li class="base_price_setting field_setting">
			<label for="field_base_price">
				<?php 
        _e('Price', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_base_price');
        ?>
			</label>
			<input type="text" id="field_base_price" onchange="SetBasePrice(this.value)" />
		</li>
		<?php 
        do_action('gform_field_standard_settings', 75, $form_id);
        ?>
		<li class="disable_quantity_setting field_setting">
			<input type="checkbox" name="field_disable_quantity" id="field_disable_quantity" onclick="SetDisableQuantity(jQuery(this).is(':checked'));" />
			<label for="field_disable_quantity" class="inline">
				<?php 
        _e('Disable quantity field', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_disable_quantity');
        ?>
			</label>

		</li>
		<?php 
        do_action('gform_field_standard_settings', 100, $form_id);
        ?>
		<li class="option_field_type_setting field_setting">
			<label for="option_field_type">
				<?php 
        _e('Field Type', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_type');
        ?>
			</label>
			<select id="option_field_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeInputType(jQuery('#option_field_type').val());});">
				<option value="select"><?php 
        _e('Drop Down', 'gravityforms');
        ?>
</option>
				<option value="checkbox"><?php 
        _e('Checkboxes', 'gravityforms');
        ?>
</option>
				<option value="radio"><?php 
        _e('Radio Buttons', 'gravityforms');
        ?>
</option>
			</select>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 125, $form_id);
        ?>
		<li class="donation_field_type_setting field_setting">
			<label for="donation_field_type">
				<?php 
        _e('Field Type', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_type');
        ?>
			</label>
			<select id="donation_field_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeDonationType(jQuery('#donation_field_type').val());});">
				<option value="select"><?php 
        _e('Drop Down', 'gravityforms');
        ?>
</option>
				<option value="donation"><?php 
        _e('User Defined Price', 'gravityforms');
        ?>
</option>
				<option value="radio"><?php 
        _e('Radio Buttons', 'gravityforms');
        ?>
</option>
			</select>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 150, $form_id);
        ?>
		<li class="quantity_field_type_setting field_setting">
			<label for="quantity_field_type">
				<?php 
        _e('Field Type', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_type');
        ?>
			</label>
			<select id="quantity_field_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeInputType(jQuery('#quantity_field_type').val());});">
				<option value="number"><?php 
        _e('Number', 'gravityforms');
        ?>
</option>
				<option value="select"><?php 
        _e('Drop Down', 'gravityforms');
        ?>
</option>
				<option value="hidden"><?php 
        _e('Hidden', 'gravityforms');
        ?>
</option>
			</select>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 200, $form_id);
        ?>
		<li class="content_setting field_setting">
			<label for="field_content">
				<?php 
        _e('Content', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_content');
        ?>
			</label>
			<textarea id="field_content" class="fieldwidth-3 fieldheight-1 merge-tag-support mt-position-right mt-prepopulate"></textarea>

		</li>

		<?php 
        do_action('gform_field_standard_settings', 225, $form_id);
        ?>
		<li class="next_button_setting field_setting">
			<label for="next_button_container">
				<?php 
        _e('Next Button', 'gravityforms');
        ?>
			</label>

			<div class="next_button_options" id="next_button_container">
				<input type="radio" id="next_button_text" name="next_button" value="text" onclick="TogglePageButton('next'); SetPageButton('next');" />
				<label for="next_button_text" class="inline">
					<?php 
        _e('Default', 'gravityforms');
        ?>
					<?php 
        gform_tooltip('next_button_text');
        ?>
				</label>
				&nbsp;&nbsp;
				<input type="radio" id="next_button_image" name="next_button" value="image" onclick="TogglePageButton('next'); SetPageButton('next');" />
				<label for="next_button_image" class="inline">
					<?php 
        _e('Image', 'gravityforms');
        ?>
					<?php 
        gform_tooltip('next_button_image');
        ?>
				</label>

				<div id="next_button_text_container" style="margin-top:5px;">
					<label for="next_button_text_input" class="inline">
						<?php 
        _e('Text:', 'gravityforms');
        ?>
					</label>
					<input type="text" id="next_button_text_input" class="input_size_b" size="40" />
				</div>

				<div id="next_button_image_container" style="margin-top:5px;">
					<label for="next_button_image_url" class="inline">
						<?php 
        _e('Image Path:', 'gravityforms');
        ?>
					</label>
					<input type="text" id="next_button_image_url" size="45" />
				</div>
			</div>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 237, $form_id);
        ?>
		<li class="previous_button_setting field_setting">
			<label for="previous_button_container">
				<?php 
        _e('Previous Button', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_previous_button');
        ?>
			</label>

			<div class="previous_button_options" id="previous_button_container">
				<input type="radio" id="previous_button_text" name="previous_button" value="text" onclick="TogglePageButton('previous'); SetPageButton('previous');" />
				<label for="previous_button_text" class="inline">
					<?php 
        _e('Default', 'gravityforms');
        ?>
					<?php 
        gform_tooltip('previous_button_text');
        ?>
				</label>
				&nbsp;&nbsp;
				<input type="radio" id="previous_button_image" name="previous_button" value="image" onclick="TogglePageButton('previous'); SetPageButton('previous');" />
				<label for="previous_button_image" class="inline">
					<?php 
        _e('Image', 'gravityforms');
        ?>
					<?php 
        gform_tooltip('previous_button_image');
        ?>
				</label>

				<div id="previous_button_text_container" style="margin-top:5px;">
					<label for="previous_button_text_input" class="inline">
						<?php 
        _e('Text:', 'gravityforms');
        ?>
					</label>
					<input type="text" id="previous_button_text_input" class="input_size_b" size="40" />
				</div>

				<div id="previous_button_image_container" style="margin-top:5px;">
					<label for="previous_button_image_url" class="inline">
						<?php 
        _e('Image Path:', 'gravityforms');
        ?>
					</label>
					<input type="text" id="previous_button_image_url" size="45" />
				</div>
			</div>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 250, $form_id);
        ?>
		<li class="disable_margins_setting field_setting">
			<input type="checkbox" id="field_margins" onclick="SetFieldProperty('disableMargins', this.checked);" />
			<label for="field_disable_margins" class="inline">
				<?php 
        _e('Disable default margins', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_disable_margins');
        ?>
			</label><br />
		</li>
		<?php 
        do_action('gform_field_standard_settings', 300, $form_id);
        ?>
		<li class="post_custom_field_type_setting field_setting">
			<label for="post_custom_field_type">
				<?php 
        _e('Field Type', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_type');
        ?>
			</label>
			<select id="post_custom_field_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeInputType(jQuery('#post_custom_field_type').val());});">
				<optgroup class="option_header" label="<?php 
        _e('Standard Fields', 'gravityforms');
        ?>
">
					<option value="text"><?php 
        _e('Single line text', 'gravityforms');
        ?>
</option>
					<option value="textarea"><?php 
        _e('Paragraph Text', 'gravityforms');
        ?>
</option>
					<option value="select"><?php 
        _e('Drop Down', 'gravityforms');
        ?>
</option>
					<option value="multiselect"><?php 
        _e('Multi Select', 'gravityforms');
        ?>
</option>
					<option value="number"><?php 
        _e('Number', 'gravityforms');
        ?>
</option>
					<option value="checkbox"><?php 
        _e('Checkboxes', 'gravityforms');
        ?>
</option>
					<option value="radio"><?php 
        _e('Radio Buttons', 'gravityforms');
        ?>
</option>
					<option value="hidden"><?php 
        _e('Hidden', 'gravityforms');
        ?>
</option>
				</optgroup>
				<optgroup class="option_header" label="<?php 
        _e('Advanced Fields', 'gravityforms');
        ?>
">
					<option value="date"><?php 
        _e('Date', 'gravityforms');
        ?>
</option>
					<option value="time"><?php 
        _e('Time', 'gravityforms');
        ?>
</option>
					<option value="phone"><?php 
        _e('Phone', 'gravityforms');
        ?>
</option>
					<option value="website"><?php 
        _e('Website', 'gravityforms');
        ?>
</option>
					<option value="email"><?php 
        _e('Email', 'gravityforms');
        ?>
</option>
					<option value="fileupload"><?php 
        _e('File Upload', 'gravityforms');
        ?>
</option>
					<option value="list"><?php 
        _e('List', 'gravityforms');
        ?>
</option>
				</optgroup>
			</select>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 350, $form_id);
        ?>
		<li class="post_tag_type_setting field_setting">
			<label for="post_tag_type">
				<?php 
        _e('Field Type', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_type');
        ?>
			</label>
			<select id="post_tag_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeInputType(jQuery('#post_tag_type').val());});">
				<option value="text"><?php 
        _e('Single line text', 'gravityforms');
        ?>
</option>
				<option value="select"><?php 
        _e('Drop Down', 'gravityforms');
        ?>
</option>
				<option value="multiselect"><?php 
        _e('Multi Select', 'gravityforms');
        ?>
</option>
				<option value="checkbox"><?php 
        _e('Checkboxes', 'gravityforms');
        ?>
</option>
				<option value="radio"><?php 
        _e('Radio Buttons', 'gravityforms');
        ?>
</option>
			</select>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 400, $form_id);
        ?>
		<?php 
        if (class_exists('ReallySimpleCaptcha')) {
            ?>
			<li class="captcha_type_setting field_setting">
				<label for="field_captcha_type">
					<?php 
            _e('Type', 'gravityforms');
            ?>
					<?php 
            gform_tooltip('form_field_captcha_type');
            ?>
				</label>
				<select id="field_captcha_type" onchange="StartChangeCaptchaType(jQuery(this).val())">
					<option value="captcha"><?php 
            _e('reCAPTCHA', 'gravityforms');
            ?>
</option>
					<option value="simple_captcha"><?php 
            _e('Really Simple CAPTCHA', 'gravityforms');
            ?>
</option>
					<option value="math"><?php 
            _e('Math Challenge', 'gravityforms');
            ?>
</option>
				</select>
			</li>
			<?php 
            do_action('gform_field_standard_settings', 450, $form_id);
            ?>
			<li class="captcha_size_setting field_setting">
				<label for="field_captcha_size">
					<?php 
            _e('Size', 'gravityforms');
            ?>
				</label>
				<select id="field_captcha_size" onchange="SetCaptchaSize(jQuery(this).val());">
					<option value="small"><?php 
            _e('Small', 'gravityforms');
            ?>
</option>
					<option value="medium"><?php 
            _e('Medium', 'gravityforms');
            ?>
</option>
					<option value="large"><?php 
            _e('Large', 'gravityforms');
            ?>
</option>
				</select>
			</li>
			<?php 
            do_action('gform_field_standard_settings', 500, $form_id);
            ?>
			<li class="captcha_fg_setting field_setting">
				<label for="field_captcha_fg">
					<?php 
            _e('Font Color', 'gravityforms');
            ?>
				</label>
				<?php 
            self::color_picker('field_captcha_fg', 'SetCaptchaFontColor');
            ?>
			</li>
			<?php 
            do_action('gform_field_standard_settings', 550, $form_id);
            ?>
			<li class="captcha_bg_setting field_setting">
				<label for="field_captcha_bg">
					<?php 
            _e('Background Color', 'gravityforms');
            ?>
				</label>
				<?php 
            self::color_picker('field_captcha_bg', 'SetCaptchaBackgroundColor');
            ?>
			</li>
		<?php 
        }
        do_action('gform_field_standard_settings', 600, $form_id);
        ?>
		<li class="captcha_theme_setting field_setting">
			<label for="field_captcha_theme">
				<?php 
        _e('Theme', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_recaptcha_theme');
        ?>
			</label>
			<select id="field_captcha_theme" onchange="SetCaptchaTheme(this.value, '<?php 
        echo GFCommon::get_base_url();
        ?>
/images/captcha_' + this.value + '.jpg')">
				<option value="red"><?php 
        _e('Red', 'gravityforms');
        ?>
</option>
				<option value="white"><?php 
        _e('White', 'gravityforms');
        ?>
</option>
				<option value="blackglass"><?php 
        _e('Black Glass', 'gravityforms');
        ?>
</option>
				<option value="clean"><?php 
        _e('Clean', 'gravityforms');
        ?>
</option>
			</select>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 650, $form_id);
        ?>
		<li class="post_custom_field_setting field_setting">
			<label for="field_custom_field_name">
				<?php 
        _e('Custom Field Name', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_custom_field_name');
        ?>
			</label>

			<div style="width:100px; float:left;">
				<input type="radio" name="field_custom" id="field_custom_existing" size="10" onclick="ToggleCustomField();" />
				<label for="field_custom_existing" class="inline">
					<?php 
        _e('Existing', 'gravityforms');
        ?>
				</label>
			</div>
			<div style="width:100px; float:left;">
				<input type="radio" name="field_custom" id="field_custom_new" size="10" onclick="ToggleCustomField();" />
				<label for="field_custom_new" class="inline">
					<?php 
        _e('New', 'gravityforms');
        ?>
				</label>
			</div>
			<div class="clear">
				<input type="text" id="field_custom_field_name_text" size="35" />
				<select id="field_custom_field_name_select" onchange="SetFieldProperty('postCustomFieldName', jQuery(this).val());">
					<option value=""><?php 
        _e('Select an existing custom field', 'gravityforms');
        ?>
</option>
					<?php 
        $custom_field_names = RGFormsModel::get_custom_field_names();
        foreach ($custom_field_names as $name) {
            ?>
						<option value="<?php 
            echo $name;
            ?>
"><?php 
            echo $name;
            ?>
</option>
					<?php 
        }
        ?>
				</select>
			</div>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 700, $form_id);
        ?>
		<li class="post_status_setting field_setting">
			<label for="field_post_status">
				<?php 
        _e('Post Status', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_post_status');
        ?>
			</label>
			<select id="field_post_status" name="field_post_status">
				<?php 
        $post_stati = apply_filters('gform_post_status_options', array('draft' => 'Draft', 'pending' => 'Pending Review', 'publish' => 'Published'));
        foreach ($post_stati as $value => $label) {
            ?>
					<option value="<?php 
            echo esc_attr($value);
            ?>
"><?php 
            echo esc_html($label);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 750, $form_id);
        ?>
		<li class="post_author_setting field_setting">
			<label for="field_post_author">
				<?php 
        _e('Default Post Author', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_post_author');
        ?>
			</label>
			<?php 
        $args = array('name' => 'field_post_author');
        $args = apply_filters('gform_author_dropdown_args_' . rgar($form, 'id'), apply_filters('gform_author_dropdown_args', $args));
        wp_dropdown_users($args);
        ?>
			<div>
				<input type="checkbox" id="gfield_current_user_as_author" />
				<label for="gfield_current_user_as_author" class="inline"><?php 
        _e('Use logged in user as author', 'gravityforms');
        ?>
 <?php 
        gform_tooltip('form_field_current_user_as_author');
        ?>
</label>
			</div>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 775, $form_id);
        ?>

		<?php 
        if (current_theme_supports('post-formats')) {
            ?>

			<li class="post_format_setting field_setting">
				<label for="field_post_format">
					<?php 
            _e('Post Format', 'gravityforms');
            ?>
					<?php 
            gform_tooltip('form_field_post_format');
            ?>
				</label>

				<?php 
            $post_formats = get_theme_support('post-formats');
            $post_formats_dropdown = '<option value="0">Standard</option>';
            foreach ($post_formats[0] as $post_format) {
                $post_format_val = esc_attr($post_format);
                $post_format_text = esc_html($post_format);
                $post_formats_dropdown .= "<option value='{$post_format_val}'>" . ucfirst($post_format_text) . '</option>';
            }
            echo '<select name="field_post_format" id="field_post_format">' . $post_formats_dropdown . '</select>';
            ?>

			</li>

		<?php 
        }
        // if theme supports post formats
        ?>

		<?php 
        do_action('gform_field_standard_settings', 800, $form_id);
        ?>

		<li class="post_category_setting field_setting">
			<label for="field_post_category">
				<?php 
        _e('Post Category', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_post_category');
        ?>
			</label>
			<?php 
        wp_dropdown_categories(array('selected' => get_option('default_category'), 'hide_empty' => 0, 'id' => 'field_post_category', 'name' => 'field_post_category', 'orderby' => 'name', 'selected' => 'field_post_category', 'hierarchical' => true));
        ?>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 825, $form_id);
        ?>

		<li class="post_category_field_type_setting field_setting">
			<label for="post_category_field_type">
				<?php 
        _e('Field Type', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_type');
        ?>
			</label>
			<select id="post_category_field_type" onchange="jQuery('#field_settings').slideUp(function(){StartChangeInputType( jQuery('#post_category_field_type').val() );});">
				<option value="select"><?php 
        _e('Drop Down', 'gravityforms');
        ?>
</option>
				<option value="checkbox"><?php 
        _e('Checkboxes', 'gravityforms');
        ?>
</option>
				<option value="radio"><?php 
        _e('Radio Buttons', 'gravityforms');
        ?>
</option>
				<option value="multiselect"><?php 
        _e('Multi Select', 'gravityforms');
        ?>
</option>
			</select>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 850, $form_id);
        ?>
		<li class="post_category_checkbox_setting field_setting">
			<label for="field_post_category">
				<?php 
        _e('Category', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_post_category_selection');
        ?>
			</label>

			<input type="radio" id="gfield_category_all" name="gfield_category" value="all" onclick="ToggleCategory();" />
			<label for="gfield_category_all" class="inline">
				<?php 
        _e('All Categories', 'gravityforms');
        ?>

			</label>
			&nbsp;&nbsp;
			<input type="radio" id="gfield_category_select" name="gfield_category" value="select" onclick="ToggleCategory();" />
			<label for="form_button_image" class="inline">
				<?php 
        _e('Select Categories', 'gravityforms');
        ?>
			</label>

			<div id="gfield_settings_category_container">
				<table cellpadding="0" cellspacing="5">
					<?php 
        $categories = get_categories(array('hide_empty' => 0));
        $count = 0;
        $category_rows = '';
        self::_cat_rows($categories, $count, $category_rows);
        echo $category_rows;
        ?>
				</table>
			</div>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 875, $form_id);
        ?>
		<li class="post_category_initial_item_setting field_setting">
			<input type="checkbox" id="gfield_post_category_initial_item_enabled" onclick="TogglePostCategoryInitialItem(); SetCategoryInitialItem();" />
			<label for="gfield_post_category_initial_item_enabled" class="inline">
				<?php 
        _e('Display placeholder', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_post_category_initial_item');
        ?>
			</label>
		</li>
		<li id="gfield_post_category_initial_item_container">
			<label for="field_post_category_initial_item">
				<?php 
        _e('Placeholder Label', 'gravityforms');
        ?>
			</label>
			<input type="text" id="field_post_category_initial_item" onchange="SetCategoryInitialItem();" class="fieldwidth-3" size="35" />
		</li>
		<?php 
        do_action('gform_field_standard_settings', 900, $form_id);
        ?>
		<li class="post_content_template_setting field_setting">
			<input type="checkbox" id="gfield_post_content_enabled" onclick="TogglePostContentTemplate();" />
			<label for="gfield_post_content_enabled" class="inline">
				<?php 
        _e('Create content template', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_post_content_template_enable');
        ?>
			</label>

			<div id="gfield_post_content_container">
				<div>
					<?php 
        GFCommon::insert_post_content_variables($form['fields'], 'field_post_content_template', '', 25);
        ?>
				</div>
				<textarea id="field_post_content_template" class="fieldwidth-3 fieldheight-1"></textarea>
			</div>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 950, $form_id);
        ?>
		<li class="post_title_template_setting field_setting">
			<input type="checkbox" id="gfield_post_title_enabled" onclick="TogglePostTitleTemplate();" />
			<label for="gfield_post_title_enabled" class="inline">
				<?php 
        _e('Create content template', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_post_title_template_enable');
        ?>
			</label>

			<div id="gfield_post_title_container">
				<input type="text" id="field_post_title_template" class="fieldwidth-3 merge-tag-support mt-position-right mt-hide_all_fields mt-exclude-post_image-fileupload" />
			</div>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 975, $form_id);
        ?>
		<li class="customfield_content_template_setting field_setting">
			<input type="checkbox" id="gfield_customfield_content_enabled" onclick="ToggleCustomFieldTemplate(); SetCustomFieldTemplate();" />
			<label for="gfield_customfield_content_enabled" class="inline">
				<?php 
        _e('Create content template', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_customfield_content_template_enable');
        ?>
			</label>

			<div id="gfield_customfield_content_container">
				<div>
					<?php 
        GFCommon::insert_post_content_variables($form['fields'], 'field_customfield_content_template', 'SetCustomFieldTemplate', 25);
        ?>
				</div>
				<textarea id="field_customfield_content_template" class="fieldwidth-3 fieldheight-1"></textarea>
			</div>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 1000, $form_id);
        ?>
		<li class="post_image_setting field_setting">
			<label><?php 
        _e('Image Metadata', 'gravityforms');
        ?>
 <?php 
        gform_tooltip('form_field_image_meta');
        ?>
</label>
			<input type="checkbox" id="gfield_display_title" onclick="SetPostImageMeta();" />
			<label for="gfield_display_title" class="inline">
				<?php 
        _e('Title', 'gravityforms');
        ?>
			</label>
			<br />
			<input type="checkbox" id="gfield_display_caption" onclick="SetPostImageMeta();" />
			<label for="gfield_display_caption" class="inline">
				<?php 
        _e('Caption', 'gravityforms');
        ?>
			</label>
			<br />
			<input type="checkbox" id="gfield_display_description" onclick="SetPostImageMeta();" />
			<label for="gfield_display_description" class="inline">
				<?php 
        _e('Description', 'gravityforms');
        ?>
			</label>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 1025, $form_id);
        ?>

		<li class="post_image_featured_image field_setting">
			<input type="checkbox" id="gfield_featured_image" onclick="SetFeaturedImage();" />
			<label for="gfield_featured_image" class="inline"><?php 
        _e('Set as Featured Image', 'gravityforms');
        ?>
 <?php 
        gform_tooltip('form_field_featured_image');
        ?>
</label>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 1050, $form_id);
        ?>
		<li class="address_setting field_setting">
			<?php 
        $addressTypes = $gf_address_field->get_address_types(rgar($form, 'id'));
        ?>
			<label for="field_address_type">
				<?php 
        _e('Address Type', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_address_type');
        ?>
			</label>
			<select id="field_address_type" onchange="ChangeAddressType();">
				<?php 
        foreach ($addressTypes as $key => $addressType) {
            ?>
					<option value="<?php 
            echo esc_attr($key);
            ?>
"><?php 
            echo esc_html($addressType['label']);
            ?>
</option>
				<?php 
        }
        ?>
			</select>

			<div class="custom_inputs_sub_setting gfield_sub_setting">
				<label for="field_address_fields" class="inline">
					<?php 
        _e('Address Fields', 'gravityforms');
        ?>
					<?php 
        gform_tooltip('form_field_address_fields');
        ?>
				</label>

				<div id="field_address_fields_container" style="padding-top:10px;">
					<!-- content dynamically created from js.php -->
				</div>
			</div>

			<?php 
        foreach ($addressTypes as $key => $addressType) {
            $state_label = isset($addressType['state_label']) ? esc_attr($addressType['state_label']) : __('State', 'gravityforms');
            ?>
				<div id="address_type_container_<?php 
            echo esc_attr($key);
            ?>
" class="gfield_sub_setting gfield_address_type_container">
					<input type="hidden" id="field_address_country_<?php 
            echo esc_attr($key);
            ?>
" value="<?php 
            echo isset($addressType['country']) ? esc_attr($addressType['country']) : '';
            ?>
" />
					<input type="hidden" id="field_address_zip_label_<?php 
            echo esc_attr($key);
            ?>
" value="<?php 
            echo isset($addressType['zip_label']) ? esc_attr($addressType['zip_label']) : __('Postal Code', 'gravityforms');
            ?>
" />
					<input type="hidden" id="field_address_state_label_<?php 
            echo esc_attr($key);
            ?>
" value="<?php 
            echo $state_label;
            ?>
" />
					<input type="hidden" id="field_address_has_states_<?php 
            echo esc_attr($key);
            ?>
" value="<?php 
            echo is_array(rgget('states', $addressType)) ? '1' : '';
            ?>
" />

					<?php 
            if (isset($addressType['states']) && is_array($addressType['states'])) {
                ?>
						<label for="field_address_default_state_<?php 
                echo esc_attr($key);
                ?>
">
							<?php 
                echo sprintf(__('Default %s', 'gravityforms'), $state_label);
                ?>
							<?php 
                gform_tooltip("form_field_address_default_state_{$key}");
                ?>
						</label>

						<select id="field_address_default_state_<?php 
                echo esc_attr($key);
                ?>
" class="field_address_default_state" onchange="SetAddressProperties();">
							<?php 
                echo $gf_address_field->get_state_dropdown($addressType['states']);
                ?>
						</select>
					<?php 
            }
            ?>

					<?php 
            if (!isset($addressType['country'])) {
                ?>
						<label for="field_address_default_country_<?php 
                echo $key;
                ?>
">
							<?php 
                _e('Default Country', 'gravityforms');
                ?>
							<?php 
                gform_tooltip('form_field_address_default_country');
                ?>
						</label>
						<select id="field_address_default_country_<?php 
                echo $key;
                ?>
" class="field_address_default_country" onchange="SetAddressProperties();">
							<?php 
                echo $gf_address_field->get_country_dropdown();
                ?>
						</select>

					<?php 
            }
            ?>
				</div>
			<?php 
        }
        ?>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 1100, $form_id);
        ?>
		<li class="name_format_setting field_setting">
			<label for="field_name_format">
				<?php 
        _e('Name Format', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_name_format');
        ?>
			</label>
			<select id="field_name_format" onchange="StartChangeNameFormat(jQuery(this).val());">
				<option value="extended"><?php 
        _e('Extended', 'gravityforms');
        ?>
</option>
				<option value="advanced"><?php 
        _e('Advanced', 'gravityforms');
        ?>
</option>
			</select>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 1125, $form_id);
        ?>
		<li class="name_setting field_setting">
			<div class="custom_inputs_setting gfield_sub_setting">
				<label for="field_name_fields" class="inline">
					<?php 
        _e('Name Fields', 'gravityforms');
        ?>
					<?php 
        gform_tooltip('form_field_name_fields');
        ?>
				</label>

				<div id="field_name_fields_container" style="padding-top:10px;">
					<!-- content dynamically created from js.php -->
				</div>
			</div>

		</li>
		<?php 
        do_action('gform_field_standard_settings', 1150, $form_id);
        ?>
		<li class="date_input_type_setting field_setting">
			<label for="field_date_input_type">
				<?php 
        _e('Date Input Type', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_date_input_type');
        ?>
			</label>
			<select id="field_date_input_type" onchange="SetDateInputType(jQuery(this).val());">
				<option value="datefield"><?php 
        _e('Date Field', 'gravityforms');
        ?>
</option>
				<option value="datepicker"><?php 
        _e('Date Picker', 'gravityforms');
        ?>
</option>
				<option value="datedropdown"><?php 
        _e('Date Drop Down', 'gravityforms');
        ?>
</option>
			</select>

			<div id="date_picker_container">

				<input type="radio" id="gsetting_icon_none" name="gsetting_icon" value="none" onclick="SetCalendarIconType(this.value);" />
				<label for="gsetting_icon_none" class="inline">
					<?php 
        _e('No Icon', 'gravityforms');
        ?>
				</label>
				&nbsp;&nbsp;
				<input type="radio" id="gsetting_icon_calendar" name="gsetting_icon" value="calendar" onclick="SetCalendarIconType(this.value);" />
				<label for="gsetting_icon_calendar" class="inline">
					<?php 
        _e('Calendar Icon', 'gravityforms');
        ?>
				</label>
				&nbsp;&nbsp;
				<input type="radio" id="gsetting_icon_custom" name="gsetting_icon" value="custom" onclick="SetCalendarIconType(this.value);" />
				<label for="gsetting_icon_custom" class="inline">
					<?php 
        _e('Custom Icon', 'gravityforms');
        ?>
				</label>

				<div id="gfield_icon_url_container">
					<label for="gfield_calendar_icon_url" class="inline">
						<?php 
        _e('Image Path: ', 'gravityforms');
        ?>
					</label>
					<input type="text" id="gfield_calendar_icon_url" size="45" />

					<div class="instruction"><?php 
        _e('Preview this form to see your custom icon.', 'gravityforms');
        ?>
</div>
				</div>
			</div>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 1200, $form_id);
        ?>
		<li class="date_format_setting field_setting">
			<label for="field_date_format">
				<?php 
        _e('Date Format', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_date_format');
        ?>
			</label>
			<select id="field_date_format" onchange="SetDateFormat(jQuery(this).val());">
				<option value="mdy">mm/dd/yyyy</option>
				<option value="dmy">dd/mm/yyyy</option>
				<option value="dmy_dash">dd-mm-yyyy</option>
				<option value="dmy_dot">dd.mm.yyyy</option>
				<option value="ymd_slash">yyyy/mm/dd</option>
				<option value="ymd_dash">yyyy-mm-dd</option>
				<option value="ymd_dot">yyyy.mm.dd</option>
			</select>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 1225, $form_id);
        ?>
		<li class="customize_inputs_setting field_setting">
			<label for="field_enable_customize_inputs" class="inline">
				<?php 
        _e('Customize Fields', 'gravityforms');
        ?>
			</label>
			<?php 
        gform_tooltip('form_field_customize_inputs');
        ?>
			<div id="field_customize_inputs_container" style="padding-top:10px;">
				<!-- content dynamically created from js.php -->
			</div>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 1250, $form_id);
        ?>
		<li class="file_extensions_setting field_setting">
			<label for="field_file_extension">
				<?php 
        _e('Allowed file extensions', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_fileupload_allowed_extensions');
        ?>
			</label>
			<input type="text" id="field_file_extension" size="40" />

			<div>
				<small><?php 
        _e('Separated with commas (i.e. jpg, gif, png, pdf)', 'gravityforms');
        ?>
</small>
			</div>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 1260, $form_id);
        ?>
		<li class="multiple_files_setting field_setting">
			<input type="checkbox" id="field_multiple_files" onclick="ToggleMultiFile();" />
			<label for="field_multiple_files" class="inline">
				<?php 
        _e('Enable Multi-File Upload', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_multiple_files');
        ?>
			</label>

			<div id="gform_multiple_files_options">
				<br />

				<div>
					<label for="field_max_files">
						<?php 
        _e('Maximum Number of Files', 'gravityforms');
        ?>
						<?php 
        gform_tooltip('form_field_max_files');
        ?>
					</label>
					<input type="text" id="field_max_files" size="10" />
				</div>
				<br />

			</div>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 1267, $form_id);
        ?>
		<li class="file_size_setting field_setting">
			<label for="field_max_file_size">
				<?php 
        _e('Maximum File Size', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_max_file_size');
        ?>
			</label>
			<input type="text" id="field_max_file_size" size="10" placeholder="<?php 
        $max_upload_size = wp_max_upload_size() / 1048576;
        echo $max_upload_size;
        ?>
MB" />

			<div>
				<small><?php 
        echo __(sprintf('Maximum allowed on this server: %sMB', $max_upload_size), 'gravityforms');
        ?>
</small>
			</div>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 1275, $form_id);
        ?>
		<li class="columns_setting field_setting">

			<input type="checkbox" id="field_columns_enabled" onclick="SetFieldProperty('enableColumns', this.checked); ToggleColumns();" />
			<label for="field_columns_enabled" class="inline"><?php 
        _e('Enable multiple columns', 'gravityforms');
        gform_tooltip('form_field_columns');
        ?>
</label>
			<br />

			<div id="gfield_settings_columns_container">
				<ul id="field_columns"></ul>
			</div>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 1287, $form_id);
        ?>
		<li class="maxrows_setting field_setting">
			<label for="field_maxrows">
				<?php 
        _e('Maximum Rows', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_maxrows');
        ?>
			</label>
			<input type="text" id="field_maxrows" />
		</li>

		<?php 
        do_action('gform_field_standard_settings', 1300, $form_id);
        ?>

		<li class="time_format_setting field_setting">
			<label for="field_time_format">
				<?php 
        _e('Time Format', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_time_format');
        ?>
			</label>
			<select id="field_time_format" onchange="SetTimeFormat(this.value);">
				<option value="12"><?php 
        _e('12 hour', 'gravityforms');
        ?>
</option>
				<option value="24"><?php 
        _e('24 hour', 'gravityforms');
        ?>
</option>
			</select>

		</li>
		<?php 
        do_action('gform_field_standard_settings', 1325, $form_id);
        ?>

		<li class="phone_format_setting field_setting">
			<label for="field_phone_format">
				<?php 
        _e('Phone Format', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_phone_format');
        ?>
			</label>
			<select id="field_phone_format" onchange="SetFieldPhoneFormat(jQuery(this).val());">
				<option value="standard">(###) ###-####</option>
				<option value="international"><?php 
        _e('International', 'gravityforms');
        ?>
</option>
			</select>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 1350, $form_id);
        ?>
		<li class="choices_setting field_setting">

			<div style="float:right;">
				<input type="checkbox" id="field_choice_values_enabled" onclick="SetFieldProperty('enableChoiceValue', this.checked); ToggleChoiceValue(); SetFieldChoices();" />
				<label for="field_choice_values_enabled" class="inline gfield_value_label"><?php 
        _e('show values', 'gravityforms');
        ?>
</label>
			</div>

			<?php 
        echo apply_filters('gform_choices_setting_title', __('Choices', 'gravityforms'));
        ?>
			<?php 
        gform_tooltip('form_field_choices');
        ?>
			<br />

			<div id="gfield_settings_choices_container">
				<label class="gfield_choice_header_label"><?php 
        _e('Label', 'gravityforms');
        ?>
</label><label class="gfield_choice_header_value"><?php 
        _e('Value', 'gravityforms');
        ?>
</label><label class="gfield_choice_header_price"><?php 
        _e('Price', 'gravityforms');
        ?>
</label>
				<ul id="field_choices"></ul>
			</div>

			<?php 
        $window_title = __('Bulk Add / Predefined Choices', 'gravityforms');
        ?>
			<input type='button' value='<?php 
        echo esc_attr($window_title);
        ?>
' onclick="tb_show('<?php 
        echo esc_js($window_title);
        ?>
', '#TB_inline?height=500&amp;width=600&amp;inlineId=gfield_bulk_add', '');" class="button" />

			<div id="gfield_bulk_add" style="display:none;">
				<div>
					<?php 
        $predefined_choices = array(__('Countries', 'gravityforms') => $gf_address_field->get_countries(), __('U.S. States', 'gravityforms') => $gf_address_field->get_us_states(), __('Canadian Province/Territory', 'gravityforms') => $gf_address_field->get_canadian_provinces(), __('Continents', 'gravityforms') => array(__('Africa', 'gravityforms'), __('Antarctica', 'gravityforms'), __('Asia', 'gravityforms'), __('Australia', 'gravityforms'), __('Europe', 'gravityforms'), __('North America', 'gravityforms'), __('South America', 'gravityforms')), __('Gender', 'gravityforms') => array(__('Male', 'gravityforms'), __('Female', 'gravityforms'), __('Prefer Not to Answer', 'gravityforms')), __('Age', 'gravityforms') => array(__('Under 18', 'gravityforms'), __('18-24', 'gravityforms'), __('25-34', 'gravityforms'), __('35-44', 'gravityforms'), __('45-54', 'gravityforms'), __('55-64', 'gravityforms'), __('65 or Above', 'gravityforms'), __('Prefer Not to Answer', 'gravityforms')), __('Marital Status', 'gravityforms') => array(__('Single', 'gravityforms'), __('Married', 'gravityforms'), __('Divorced', 'gravityforms'), __('Widowed', 'gravityforms')), __('Employment', 'gravityforms') => array(__('Employed Full-Time', 'gravityforms'), __('Employed Part-Time', 'gravityforms'), __('Self-employed', 'gravityforms'), __('Not employed but looking for work', 'gravityforms'), __('Not employed and not looking for work', 'gravityforms'), __('Homemaker', 'gravityforms'), __('Retired', 'gravityforms'), __('Student', 'gravityforms'), __('Prefer Not to Answer', 'gravityforms')), __('Job Type', 'gravityforms') => array(__('Full-Time', 'gravityforms'), __('Part-Time', 'gravityforms'), __('Per Diem', 'gravityforms'), __('Employee', 'gravityforms'), __('Temporary', 'gravityforms'), __('Contract', 'gravityforms'), __('Intern', 'gravityforms'), __('Seasonal', 'gravityforms')), __('Industry', 'gravityforms') => array(__('Accounting/Finance', 'gravityforms'), __('Advertising/Public Relations', 'gravityforms'), __('Aerospace/Aviation', 'gravityforms'), __('Arts/Entertainment/Publishing', 'gravityforms'), __('Automotive', 'gravityforms'), __('Banking/Mortgage', 'gravityforms'), __('Business Development', 'gravityforms'), __('Business Opportunity', 'gravityforms'), __('Clerical/Administrative', 'gravityforms'), __('Construction/Facilities', 'gravityforms'), __('Consumer Goods', 'gravityforms'), __('Customer Service', 'gravityforms'), __('Education/Training', 'gravityforms'), __('Energy/Utilities', 'gravityforms'), __('Engineering', 'gravityforms'), __('Government/Military', 'gravityforms'), __('Green', 'gravityforms'), __('Healthcare', 'gravityforms'), __('Hospitality/Travel', 'gravityforms'), __('Human Resources', 'gravityforms'), __('Installation/Maintenance', 'gravityforms'), __('Insurance', 'gravityforms'), __('Internet', 'gravityforms'), __('Job Search Aids', 'gravityforms'), __('Law Enforcement/Security', 'gravityforms'), __('Legal', 'gravityforms'), __('Management/Executive', 'gravityforms'), __('Manufacturing/Operations', 'gravityforms'), __('Marketing', 'gravityforms'), __('Non-Profit/Volunteer', 'gravityforms'), __('Pharmaceutical/Biotech', 'gravityforms'), __('Professional Services', 'gravityforms'), __('QA/Quality Control', 'gravityforms'), __('Real Estate', 'gravityforms'), __('Restaurant/Food Service', 'gravityforms'), __('Retail', 'gravityforms'), __('Sales', 'gravityforms'), __('Science/Research', 'gravityforms'), __('Skilled Labor', 'gravityforms'), __('Technology', 'gravityforms'), __('Telecommunications', 'gravityforms'), __('Transportation/Logistics', 'gravityforms'), __('Other', 'gravityforms')), __('Income', 'gravityforms') => array(__('Under $20,000', 'gravityforms'), __('$20,000 - $30,000', 'gravityforms'), __('$30,000 - $40,000', 'gravityforms'), __('$40,000 - $50,000', 'gravityforms'), __('$50,000 - $75,000', 'gravityforms'), __('$75,000 - $100,000', 'gravityforms'), __('$100,000 - $150,000', 'gravityforms'), __('$150,000 or more', 'gravityforms'), __('Prefer Not to Answer', 'gravityforms')), __('Education', 'gravityforms') => array(__('High School', 'gravityforms'), __('Associate Degree', 'gravityforms'), __("Bachelor's Degree", 'gravityforms'), __('Graduate of Professional Degree', 'gravityforms'), __('Some College', 'gravityforms'), __('Other', 'gravityforms'), __('Prefer Not to Answer', 'gravityforms')), __('Days of the Week', 'gravityforms') => array(__('Sunday', 'gravityforms'), __('Monday', 'gravityforms'), __('Tuesday', 'gravityforms'), __('Wednesday', 'gravityforms'), __('Thursday', 'gravityforms'), __('Friday', 'gravityforms'), __('Saturday', 'gravityforms')), __('Months of the Year', 'gravityforms') => array(__('January', 'gravityforms'), __('February', 'gravityforms'), __('March', 'gravityforms'), __('April', 'gravityforms'), __('May', 'gravityforms'), __('June', 'gravityforms'), __('July', 'gravityforms'), __('August', 'gravityforms'), __('September', 'gravityforms'), __('October', 'gravityforms'), __('November', 'gravityforms'), __('December', 'gravityforms')), __('How Often', 'gravityforms') => array(__('Everyday', 'gravityforms'), __('Once a week', 'gravityforms'), __('2 to 3 times a week', 'gravityforms'), __('Once a month', 'gravityforms'), __(' 2 to 3 times a month', 'gravityforms'), __('Less than once a month', 'gravityforms')), __('How Long', 'gravityforms') => array(__('Less than a month', 'gravityforms'), __('1-6 months', 'gravityforms'), __('1-3 years', 'gravityforms'), __('Over 3 Years', 'gravityforms'), __('Never used', 'gravityforms')), __('Satisfaction', 'gravityforms') => array(__('Very Satisfied', 'gravityforms'), __('Satisfied', 'gravityforms'), __('Neutral', 'gravityforms'), __('Unsatisfied', 'gravityforms'), __('Very Unsatisfied', 'gravityforms')), __('Importance', 'gravityforms') => array(__('Very Important', 'gravityforms'), __('Important', 'gravityforms'), __('Somewhat Important', 'gravityforms'), __('Not Important', 'gravityforms')), __('Agreement', 'gravityforms') => array(__('Strongly Agree', 'gravityforms'), __('Agree', 'gravityforms'), __('Disagree', 'gravityforms'), __('Strongly Disagree', 'gravityforms')), __('Comparison', 'gravityforms') => array(__('Much Better', 'gravityforms'), __('Somewhat Better', 'gravityforms'), __('About the Same', 'gravityforms'), __('Somewhat Worse', 'gravityforms'), __('Much Worse', 'gravityforms')), __('Would You', 'gravityforms') => array(__('Definitely', 'gravityforms'), __('Probably', 'gravityforms'), __('Not Sure', 'gravityforms'), __('Probably Not', 'gravityforms'), __('Definitely Not', 'gravityforms')), __('Size', 'gravityforms') => array(__('Extra Small', 'gravityforms'), __('Small', 'gravityforms'), __('Medium', 'gravityforms'), __('Large', 'gravityforms'), __('Extra Large', 'gravityforms')));
        $predefined_choices = apply_filters('gform_predefined_choices_' . rgar($form, 'id'), apply_filters('gform_predefined_choices', $predefined_choices));
        $custom_choices = RGFormsModel::get_custom_choices();
        ?>

					<div class="panel-instructions"><?php 
        _e('Select a category and customize the predefined choices or paste your own list to bulk add choices.', 'gravityforms');
        ?>
</div>

					<div class="bulk-left-panel">
						<ul id="bulk_items">
							<?php 
        foreach (array_keys($predefined_choices) as $name) {
            $key = str_replace("'", "\\'", $name);
            ?>
							<li>
								<a href="javascript:void(0);" onclick="SelectPredefinedChoice('<?php 
            echo $key;
            ?>
');"
								   class="bulk-choice"><?php 
            echo $name;
            ?>
</a>
							<?php 
        }
        ?>
						</ul>
					</div>
					<div class="bulk-arrow-mid"></div>
					<textarea id="gfield_bulk_add_input"></textarea>
					<br style="clear:both;" />

					<div class="panel-buttons" style="">
						<input type="button" onclick="InsertBulkChoices(jQuery('#gfield_bulk_add_input').val().split('\n')); tb_remove();" class="button-primary" value="<?php 
        _e('Insert Choices', 'gravityforms');
        ?>
" />&nbsp;
						<input type="button" onclick="tb_remove();" class="button" value="<?php 
        _e('Cancel', 'gravityforms');
        ?>
" />
					</div>

					<div class="panel-custom" style="">
						<a href="javascript:void(0);" onclick="LoadCustomChoicesPanel(true, 'slow');" id="bulk_save_as"><?php 
        _e('Save as new custom choice', 'gravityforms');
        ?>
</a>

						<div id="bulk_custom_edit" style="display:none;">
							<?php 
        _e('Save as', 'gravityforms');
        ?>
							<input type="text" id="custom_choice_name" value="<?php 
        _e('Enter name', 'gravityforms');
        ?>
" onfocus="if(this.value == '<?php 
        _e('enter name', 'gravityforms');
        ?>
') this.value='';">&nbsp;&nbsp;
							<a href="javascript:void(0);" onclick="SaveCustomChoices();" class="button" id="bulk_save_button"><?php 
        _e('Save', 'gravityforms');
        ?>
</a>&nbsp;
							<a href="javascript:void(0);" onclick="CloseCustomChoicesPanel('slow');" id="bulk_cancel_link"><?php 
        _e('Cancel', 'gravityforms');
        ?>
</a>
							<a href="javascript:void(0);" onclick="DeleteCustomChoice();" id="bulk_delete_link"><?php 
        _e('Delete', 'gravityforms');
        ?>
</a>
						</div>
						<div id="bulk_custom_message" class="alert_yellow" style="display:none; margin-top:8px; padding: 8px;">
							<!--Message will be added via javascript-->
						</div>
					</div>

					<script type="text/javascript">
						var gform_selected_custom_choice = '';
						var gform_custom_choices = <?php 
        echo GFCommon::json_encode($custom_choices);
        ?>
;
						var gform_predefined_choices = <?php 
        echo GFCommon::json_encode($predefined_choices);
        ?>
;
					</script>

				</div>
			</div>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 1362, $form_id);
        ?>

		<li class="other_choice_setting field_setting">

			<input type="checkbox" id="field_other_choice" onclick="var value = jQuery(this).is(':checked'); SetFieldProperty('enableOtherChoice', value); UpdateFieldChoices(GetInputType(field));" />
			<label for="field_other_choice" class="inline">
				<?php 
        _e('Enable "other" choice', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_other_choice');
        ?>
			</label>

		</li>

		<?php 
        do_action('gform_field_standard_settings', 1368, $form_id);
        ?>

		<li class="email_confirm_setting field_setting">
			<input type="checkbox" id="gfield_email_confirm_enabled" onclick="SetEmailConfirmation(this.checked);" />
			<label for="gfield_email_confirm_enabled" class="inline">
				<?php 
        _e('Enable Email Confirmation', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_email_confirm_enable');
        ?>
			</label>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 1375, $form_id);
        ?>
		<li class="password_strength_setting field_setting">
			<input type="checkbox" id="gfield_password_strength_enabled" onclick="TogglePasswordStrength(); SetPasswordStrength(this.checked);" />
			<label for="gfield_password_strength_enabled" class="inline">
				<?php 
        _e('Enable Password Strength', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_password_strength_enable');
        ?>
			</label>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 1387, $form_id);
        ?>

		<li id="gfield_min_strength_container">
			<label for="gfield_min_strength">
				<?php 
        _e('Minimum Strength', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_password_strength_enable');
        ?>
			</label>
			<select id="gfield_min_strength" onchange="SetFieldProperty('minPasswordStrength', jQuery(this).val());">
				<option value=""><?php 
        _e('None', 'gravityforms');
        ?>
</option>
				<option value="short"><?php 
        _e('Short', 'gravityforms');
        ?>
</option>
				<option value="bad"><?php 
        _e('Bad', 'gravityforms');
        ?>
</option>
				<option value="good"><?php 
        _e('Good', 'gravityforms');
        ?>
</option>
				<option value="strong"><?php 
        _e('Strong', 'gravityforms');
        ?>
</option>
			</select>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 1400, $form_id);
        ?>

		<li class="number_format_setting field_setting">
			<label for="field_number_format">
				<?php 
        _e('Number Format', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_number_format');
        ?>
			</label>
			<select id="field_number_format" onchange="SetFieldProperty('numberFormat', this.value);jQuery('.field_calculation_rounding').toggle(this.value != 'currency');">
				<option value="decimal_dot">9,999.99</option>
				<option value="decimal_comma">9.999,99</option>
				<option value="currency"><?php 
        _e('Currency', 'gravityforms');
        ?>
</option>
			</select>

		</li>

		<?php 
        do_action('gform_field_standard_settings', 1415, $form_id);
        ?>

		<li class="sub_labels_setting field_setting">
			<label for="field_sub_labels">
				<?php 
        _e('Sub-Labels', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_sub_labels');
        ?>
			</label>

			<div id="field_sub_labels_container">
				<!-- content dynamically created from js.php -->
			</div>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 1425, $form_id);
        ?>



		<?php 
        do_action('gform_field_standard_settings', 1430, $form_id);
        ?>
		<li class="credit_card_setting field_setting">
			<label>
				<?php 
        _e('Supported Credit Cards', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_credit_cards');
        ?>
			</label>
			<ul>
				<?php 
        $cards = GFCommon::get_card_types();
        foreach ($cards as $card) {
            ?>

					<li>
						<input type="checkbox" id="field_credit_card_<?php 
            echo esc_attr($card['slug']);
            ?>
" value="<?php 
            echo esc_attr($card['slug']);
            ?>
" onclick="SetCardType(this, this.value);" />
						<label for="field_credit_card_<?php 
            echo esc_attr($card['slug']);
            ?>
" class="inline"><?php 
            echo esc_html($card['name']);
            ?>
</label>
					</li>

				<?php 
        }
        ?>
			</ul>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 1435, $form_id);
        ?>
		<li class="credit_card_style_setting field_setting">
			<label for="credit_card_style">
				<?php 
        _e('Card Icon Style', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_card_style');
        ?>
			</label>
			<select id="credit_card_style" onchange="SetFieldProperty('creditCardStyle', this.value);">
				<option value="style1"><?php 
        _e('Standard', 'gravityforms');
        ?>
</option>
				<option value="style2"><?php 
        _e('3D', 'gravityforms');
        ?>
</option>
			</select>
		</li>

		<?php 
        do_action('gform_field_standard_settings', 1440, $form_id);
        ?>

		<li class="input_mask_setting field_setting">

			<input type="checkbox" id="field_input_mask" onclick="ToggleInputMask();" />
			<label for="field_input_mask" class="inline">
				<?php 
        _e('Input Mask', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_mask');
        ?>
			</label><br />

			<div id="gform_input_mask">

				<br />

				<div style="width:100px; float:left;">
					<input type="radio" name="field_mask_option" id="field_mask_standard" size="10" onclick="ToggleInputMaskOptions();" />
					<label for="field_mask_standard" class="inline">
						<?php 
        _e('Standard', 'gravityforms');
        ?>
					</label>
				</div>
				<div style="width:100px; float:left;">
					<input type="radio" name="field_mask_option" id="field_mask_custom" size="10" onclick="ToggleInputMaskOptions();" />
					<label for="field_mask_custom" class="inline">
						<?php 
        _e('Custom', 'gravityforms');
        ?>
					</label>
				</div>

				<div class="clear"></div>

				<input type="text" id="field_mask_text" size="35" />

				<p class="mask_text_description" style="margin:5px 0 0;">
					<?php 
        _e('Enter a custom mask', 'gravityforms');
        ?>
.
					<a href="javascript:void(0);" onclick="tb_show('<?php 
        _e('Custom Mask Instructions', 'gravityforms');
        ?>
', '#TB_inline?width=350&amp;inlineId=custom_mask_instructions', '');"><?php 
        _e('Help', 'gravityforms');
        ?>
</a>
				</p>

				<div id="custom_mask_instructions" style="display:none;">
					<div class="custom_mask_instructions">

						<h4><?php 
        _e('Usage', 'gravityforms');
        ?>
</h4>
						<ul class="description-list">
							<li><?php 
        _e("Use a <em>'9'</em> to indicate a numerical character.", 'gravityforms');
        ?>
</li>
							<li><?php 
        _e("Use a lower case <em>'a'</em> to indicate an alphabetical character.", 'gravityforms');
        ?>
</li>
							<li><?php 
        _e("Use an asterick <em>'*'</em> to indicate any alphanumeric character.", 'gravityforms');
        ?>
</li>
							<li><?php 
        _e("Use a question mark <em>'?'</em> to indicate optional characters. <em>Note:</em> All characters after the question mark will be optional.", 'gravityforms');
        ?>
</li>
							<li><?php 
        _e('All other characters are literal values and will be displayed automatically.', 'gravityforms');
        ?>
</li>
						</ul>

						<h4><?php 
        _e('Examples', 'gravityforms');
        ?>
</h4>
						<ul class="examples-list">
							<li>
								<h5><?php 
        _e('Date', 'gravityforms');
        ?>
</h5>
								<span class="label"><?php 
        _e('Mask', 'gravityforms');
        ?>
</span> <code>99/99/9999</code><br />
								<span class="label"><?php 
        _e('Valid Input', 'gravityforms');
        ?>
</span>
								<code>10/21/2011</code>
							</li>
							<li>
								<h5><?php 
        _e('Social Security Number', 'gravityforms');
        ?>
</h5>
								<span class="label"><?php 
        _e('Mask', 'gravityforms');
        ?>
</span>
								<code>999-99-9999</code><br />
								<span class="label"><?php 
        _e('Valid Input', 'gravityforms');
        ?>
</span>
								<code>987-65-4329</code>
							</li>
							<li>
								<h5><?php 
        _e('Course Code', 'gravityforms');
        ?>
</h5>
								<span class="label"><?php 
        _e('Mask', 'gravityforms');
        ?>
</span>
								<code>aaa 999</code><br />
								<span class="label"><?php 
        _e('Valid Input', 'gravityforms');
        ?>
</span>
								<code>BIO 101</code>
							</li>
							<li>
								<h5><?php 
        _e('License Key', 'gravityforms');
        ?>
</h5>
								<span class="label"><?php 
        _e('Mask', 'gravityforms');
        ?>
</span>
								<code>***-***-***</code><br />
								<span class="label"><?php 
        _e('Valid Input', 'gravityforms');
        ?>
</span>
								<code>a9a-f0c-28Q</code>
							</li>
							<li>
								<h5><?php 
        _e('Zip Code w/ Optional Plus Four', 'gravityforms');
        ?>
</h5>
								<span class="label"><?php 
        _e('Mask', 'gravityforms');
        ?>
</span>
								<code>99999?-9999</code><br />
								<span class="label"><?php 
        _e('Valid Input', 'gravityforms');
        ?>
</span>
								<code>23462</code> or <code>23462-4062</code>
							</li>
						</ul>

					</div>
				</div>

				<select id="field_mask_select" onchange="SetFieldProperty('inputMaskValue', jQuery(this).val());">
					<option value=""><?php 
        _e('Select a Mask', 'gravityforms');
        ?>
</option>
					<?php 
        $masks = RGFormsModel::get_input_masks();
        foreach ($masks as $mask_name => $mask_value) {
            ?>
						<option value="<?php 
            echo esc_attr($mask_value);
            ?>
"><?php 
            echo esc_html($mask_name);
            ?>
</option>
					<?php 
        }
        ?>
				</select>

			</div>

		</li>

		<?php 
        do_action('gform_field_standard_settings', 1450, $form_id);
        ?>

		<li class="maxlen_setting field_setting">
			<label for="field_maxlen">
				<?php 
        _e('Maximum Characters', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_maxlength');
        ?>
			</label>
			<input type="text" id="field_maxlen" /></input>
		</li>
		<?php 
        do_action('gform_field_standard_settings', 1500, $form_id);
        ?>

		<li class="range_setting field_setting">
			<div style="clear:both;"><?php 
        _e('Range', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_number_range');
        ?>
			</div>
			<div style="width:90px; float:left;">
				<input type="text" id="field_range_min" size="10" />
				<label for="field_range_min">
					<?php 
        _e('Min', 'gravityforms');
        ?>
				</label>
			</div>
			<div style="width:90px; float:left;">
				<input type="text" id="field_range_max" size="10" />
				<label for="field_range_max">
					<?php 
        _e('Max', 'gravityforms');
        ?>
				</label>

			</div>
			<br class="clear" />
		</li>

		<?php 
        do_action('gform_field_standard_settings', 1550, $form_id);
        ?>

		<li class="calculation_setting field_setting">

			<div class="field_enable_calculation">
				<input type="checkbox" id="field_enable_calculation" onclick="ToggleCalculationOptions(this.checked, field);" />
				<label for="field_enable_calculation" class="inline">
					<?php 
        _e('Enable Calculation', 'gravityforms');
        ?>
					<?php 
        gform_tooltip('form_field_enable_calculation');
        ?>
				</label>
			</div>

			<div id="calculation_options" style="display:none;margin-top:10px;">

				<label for="field_calculation_formula">
					<?php 
        _e('Formula', 'gravityforms');
        ?>
					<?php 
        gform_tooltip('form_field_calculation_formula');
        ?>
				</label>

				<div>
					<?php 
        GFCommon::insert_calculation_variables($form['fields'], 'field_calculation_formula', '', 'FormulaContentCallback', 40);
        ?>
					<div class="gf_calculation_buttons">
						<?php 
        foreach (array('+', '-', '/', '*', '(', ')', '.') as $button) {
            ?>
							<input type="button" value="<?php 
            echo in_array($button, array('.')) ? $button : " {$button} ";
            ?>
" onclick="InsertVariable('field_calculation_formula', 'FormulaContentCallback', this.value);" />
						<?php 
        }
        ?>
					</div>
				</div>
				<textarea id="field_calculation_formula" class="fieldwidth-3 fieldheight-2"></textarea>
				<br />
				<a href="javascript:void(0)" onclick="var field = GetSelectedField(); alert(IsValidFormula(field.calculationFormula) ? '<?php 
        _e('The formula appears to be valid.', 'gravityforms');
        ?>
' : '<?php 
        _e('There appears to be a problem with the formula.', 'gravityforms');
        ?>
');"><?php 
        _e('Validate Formula', 'gravityforms');
        ?>
</a>

				<div class="field_calculation_rounding">
					<label for="field_calculation_rounding" style="margin-top:10px;">
						<?php 
        _e('Rounding', 'gravityforms');
        ?>
						<?php 
        gform_tooltip('form_field_calculation_rounding');
        ?>
					</label>
					<select id="field_calculation_rounding" onchange="SetFieldProperty('calculationRounding', this.value);">
						<option value="0">0</option>
						<option value="1">1</option>
						<option value="2">2</option>
						<option value="3">3</option>
						<option value="4">4</option>
						<option value="norounding">Do not round</option>
					</select>
				</div>

			</div>

			<br class="clear" />

		</li>

		<?php 
        do_action('gform_field_standard_settings', 1600, $form_id);
        ?>

		<li class="rules_setting field_setting">
			<?php 
        _e('Rules', 'gravityforms');
        ?>
<br />
			<input type="checkbox" id="field_required" onclick="SetFieldRequired(this.checked);" />
			<label for="field_required" class="inline">
				<?php 
        _e('Required', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_required');
        ?>
			</label><br />

			<div class="duplicate_setting field_setting">
				<input type="checkbox" id="field_no_duplicates" onclick="SetFieldProperty('noDuplicates', this.checked);" />
				<label for="field_no_duplicates" class="inline">
					<?php 
        _e('No Duplicates', 'gravityforms');
        ?>
					<?php 
        gform_tooltip('form_field_no_duplicate');
        ?>
				</label>
			</div>
		</li>

		<?php 
        do_action('gform_field_standard_settings', -1, $form_id);
        ?>
		</ul>
		</div>
		<div id="gform_tab_3">
            <ul>
				<?php 
        do_action('gform_field_appearance_settings', 0, $form_id);
        ?>
                <li class="placeholder_setting field_setting">
                    <label for="field_placeholder">
                        <?php 
        _e('Placeholder', 'gravityforms');
        ?>
                        <?php 
        gform_tooltip('form_field_placeholder');
        ?>
                    </label>
                    <input type="text" id="field_placeholder" class="field_placeholder fieldwidth-2 merge-tag-support mt-position-right mt-prepopulate" />
                </li>
				<?php 
        do_action('gform_field_appearance_settings', 20, $form_id);
        ?>
				<li class="placeholder_textarea_setting field_setting">
					<label for="field_placeholder_textarea">
						<?php 
        _e('Placeholder', 'gravityforms');
        ?>
						<?php 
        gform_tooltip('form_field_placeholder');
        ?>
					</label>
					<textarea id="field_placeholder_textarea" class="field_placeholder fieldwidth-3 merge-tag-support mt-position-right mt-prepopulate"></textarea>
				</li>
				<?php 
        do_action('gform_field_appearance_settings', 50, $form_id);
        ?>

                <li class="input_placeholders_setting field_setting">
                    <label>
                        <?php 
        _e('Placeholders', 'gravityforms');
        ?>
                        <?php 
        gform_tooltip('form_field_input_placeholders');
        ?>
                    </label>

                    <div id="field_input_placeholders_container">
                        <!-- content dynamically created from js.php -->
                    </div>
                </li>

				<?php 
        do_action('gform_field_appearance_settings', 100, $form_id);
        $label_placement_form_setting = rgar($form, 'labelPlacement');
        switch ($label_placement_form_setting) {
            case 'left_label':
                $label_placement_form_setting_label = __('Left aligned', 'gravityforms');
                break;
            case 'right_label':
                $label_placement_form_setting_label = __('Right aligned', 'gravityforms');
                break;
            case 'top_label':
            default:
                $label_placement_form_setting_label = __('Top aligned', 'gravityforms');
        }
        $enable_label_visiblity_settings = apply_filters('gform_enable_field_label_visibility_settings', false);
        $description_placement_form_setting = rgar($form, 'descriptionPlacement');
        $description_placement_form_setting_label = $description_placement_form_setting == 'above' ? $description_placement_form_setting_label = __('Above inputs', 'gravityforms') : ($description_placement_form_setting_label = __('Below inputs', 'gravityforms'));
        ?>
				<li class="label_placement_setting field_setting">
					<?php 
        if ($enable_label_visiblity_settings) {
            ?>
					<label for="field_label_placement">
						<?php 
            _e('Field Label Visibility', 'gravityforms');
            ?>
						<?php 
            gform_tooltip('form_field_label_placement');
            ?>
					</label>
					<select id="field_label_placement" onchange="SetFieldLabelPlacement(jQuery(this).val());">
						<option value=""><?php 
            printf(__('Visible (%s)', 'gravityforms'), esc_html($label_placement_form_setting_label));
            ?>
</option>
						<option value="hidden_label"><?php 
            _e('Hidden', 'gravityforms');
            ?>
</option>
					</select>
					<?php 
        }
        ?>
					<div id="field_description_placement_container" style="display:none; padding-top:10px;">
						<label for="field_description_placement">
							<?php 
        _e('Description Placement', 'gravityforms');
        ?>
							<?php 
        gform_tooltip('form_field_description_placement');
        ?>
						</label>
						<select id="field_description_placement"
						        onchange="SetFieldDescriptionPlacement(jQuery(this).val());">
							<option
								value=""><?php 
        printf(__('Use Form Setting (%s)', 'gravityforms'), esc_html($description_placement_form_setting_label));
        ?>
</option>
							<option value="below"><?php 
        _e('Below inputs', 'gravityforms');
        ?>
</option>
							<option value="above"><?php 
        _e('Above inputs', 'gravityforms');
        ?>
</option>
						</select>
					</div>
				</li>
				<?php 
        do_action('gform_field_appearance_settings', 150, $form_id);
        $sub_label_placement_form_setting = rgar($form, 'subLabelPlacement');
        $sub_label_placement_form_setting_label = $sub_label_placement_form_setting == 'above' ? $sub_label_placement_form_setting_label = __('Above inputs', 'gravityforms') : ($sub_label_placement_form_setting_label = __('Below inputs', 'gravityforms'));
        ?>
				<li class="sub_label_placement_setting field_setting">
					<label for="field_sub_label_placement">
						<?php 
        _e('Sub-Label Placement', 'gravityforms');
        ?>
						<?php 
        gform_tooltip('form_field_sub_label_placement');
        ?>
					</label>
					<select id="field_sub_label_placement"
					        onchange="SetFieldSubLabelPlacement(jQuery(this).val());">
						<option
							value=""><?php 
        printf(__('Use Form Setting (%s)', 'gravityforms'), esc_html($sub_label_placement_form_setting_label));
        ?>
</option>
						<option value="below"><?php 
        _e('Below inputs', 'gravityforms');
        ?>
</option>
						<option value="above"><?php 
        _e('Above inputs', 'gravityforms');
        ?>
</option>
						<?php 
        if ($enable_label_visiblity_settings) {
            ?>
						<option value="hidden_label"><?php 
            _e('Hidden', 'gravityforms');
            ?>
</option>
						<?php 
        }
        ?>

					</select>
				</li>

				<?php 
        do_action('gform_field_appearance_settings', 200, $form_id);
        ?>

				<li class="error_message_setting field_setting">
                    <label for="field_error_message">
                        <?php 
        _e('Custom Validation Message', 'gravityforms');
        ?>
                        <?php 
        gform_tooltip('form_field_validation_message');
        ?>
                    </label>
                    <input type="text" id="field_error_message" class="fieldwidth-2" />
                </li>

				<?php 
        do_action('gform_field_appearance_settings', 250, $form_id);
        ?>

                <li class="css_class_setting field_setting">
                    <label for="field_css_class">
                        <?php 
        _e('Custom CSS Class', 'gravityforms');
        ?>
                        <?php 
        gform_tooltip('form_field_css_class');
        ?>
                    </label>
                    <input type="text" id="field_css_class" size="30" />
                </li>

                <?php 
        do_action('gform_field_appearance_settings', 300, $form_id);
        ?>

				<li class="enable_enhanced_ui_setting field_setting">
                    <input type="checkbox" id="gfield_enable_enhanced_ui" onclick="SetFieldProperty('enableEnhancedUI', jQuery(this).is(':checked') ? 1 : 0);" />
                    <label for="gfield_enable_enhanced_ui" class="inline">
                        <?php 
        _e('Enable enhanced user interface', 'gravityforms');
        ?>
                        <?php 
        gform_tooltip('form_field_enable_enhanced_ui');
        ?>
                    </label>
                </li>

				<?php 
        do_action('gform_field_appearance_settings', 400, $form_id);
        ?>

				<li class="size_setting field_setting">
					<label for="field_size">
						<?php 
        _e('Field Size', 'gravityforms');
        ?>
						<?php 
        gform_tooltip('form_field_size');
        ?>
					</label>
					<select id="field_size" onchange="SetFieldSize(jQuery(this).val());">
						<option value="small"><?php 
        _e('Small', 'gravityforms');
        ?>
</option>
						<option value="medium"><?php 
        _e('Medium', 'gravityforms');
        ?>
</option>
						<option value="large"><?php 
        _e('Large', 'gravityforms');
        ?>
</option>
					</select>
				</li>
            </ul>
        </div>

        <div id="gform_tab_2">
		<ul>
		<?php 
        do_action('gform_field_advanced_settings', 0, $form_id);
        ?>
		<li class="admin_label_setting field_setting">
			<label for="field_admin_label">
				<?php 
        _e('Admin Field Label', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_admin_label');
        ?>
			</label>
			<input type="text" id="field_admin_label" size="35" />
		</li>
        <?php 
        do_action('gform_field_advanced_settings', 25, $form_id);
        do_action('gform_field_advanced_settings', 35, $form_id);
        do_action('gform_field_advanced_settings', 50, $form_id);
        do_action('gform_field_advanced_settings', 100, $form_id);
        do_action('gform_field_advanced_settings', 125, $form_id);
        ?>
		<li class="default_value_setting field_setting">
			<label for="field_default_value">
				<?php 
        _e('Default Value', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_default_value');
        ?>
			</label>
			<input type="text" id="field_default_value" class="field_default_value fieldwidth-2 merge-tag-support mt-position-right mt-prepopulate" />
		</li>
		<?php 
        do_action('gform_field_advanced_settings', 150, $form_id);
        ?>
		<li class="default_value_textarea_setting field_setting">
			<label for="field_default_value_textarea">
				<?php 
        _e('Default Value', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_default_value');
        ?>
			</label>
			<textarea id="field_default_value_textarea" class="field_default_value fieldwidth-3 merge-tag-support mt-position-right mt-prepopulate"></textarea>
		</li>
		<?php 
        do_action('gform_field_advanced_settings', 155, $form_id);
        ?>
		<li class="name_prefix_choices_setting field_setting" style="display:none;">
			<?php 
        _e('Prefix Choices', 'gravityforms');
        ?>
		<?php 
        gform_tooltip('form_field_name_prefix_choices');
        ?>
		<br />

		<div id="gfield_settings_prefix_input_choices_container" class="gfield_settings_input_choices_container">
			<label class="gfield_choice_header_label"><?php 
        _e('Label', 'gravityforms');
        ?>
</label><label class="gfield_choice_header_value"><?php 
        _e('Value', 'gravityforms');
        ?>
</label>
			<ul id="field_prefix_choices" class="field_input_choices">
				<!-- content dynamically created from js.php -->
			</ul>
		</div>
		</li>
		<?php 
        do_action('gform_field_advanced_settings', 175, $form_id);
        ?>
		<li class="default_input_values_setting field_setting">
			<label>
				<?php 
        _e('Default Values', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_default_input_values');
        ?>
			</label>

			<div id="field_default_input_values_container">
				<!-- content dynamically created from js.php -->
			</div>
		</li>
		<?php 
        do_action('gform_field_advanced_settings', 185, $form_id);
        ?>

		<li class="copy_values_option field_setting">
			<input type="checkbox" id="field_enable_copy_values_option" />
			<label for="field_enable_copy_values_option" class="inline">
				<?php 
        _e('Display option to use the values submitted in different field', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_enable_copy_values_option');
        ?>
			</label>

			<div id="field_copy_values_disabled" style="display:none;padding-top: 10px;">
	            <span class="instruction" style="margin-left:0">
	                <?php 
        _e('To activate this option, please add a field to be used as the source.', 'gravityforms');
        ?>
					<?php 
        gform_tooltip('form_field_enable_copy_values_disabled');
        ?>
	            </span>
			</div>
			<div id="field_copy_values_container" style="display:none;" class="gfield_sub_setting">
				<label for="field_copy_values_option_label">
					<?php 
        _e('Option Label', 'gravityforms');
        ?>
					<?php 
        gform_tooltip('form_field_copy_values_option_label');
        ?>
				</label>
				<input id="field_copy_values_option_label" type="text" class="fieldwidth-2" />
				<label for="field_copy_values_option_field" style="padding-top: 10px;">
					<?php 
        _e('Source Field', 'gravityforms');
        ?>
					<?php 
        gform_tooltip('form_field_copy_values_option_field');
        ?>
				</label>
				<select id="field_copy_values_option_field">
					<!-- content dynamically created  -->
				</select>

				<div style="padding-top: 10px;">
					<input type="checkbox" id="field_copy_values_option_default" />
					<label for="field_copy_values_option_default" class="inline">
						<?php 
        _e('Activated by default', 'gravityforms');
        ?>
						<?php 
        gform_tooltip('form_field_copy_values_option_default');
        ?>
					</label>
				</div>
			</div>
		</li>

		<?php 
        do_action('gform_field_advanced_settings', 200, $form_id);
        do_action('gform_field_advanced_settings', 225, $form_id);
        ?>

		<li class="credit_card_icon_style_setting field_setting">
			<label>
				<?php 
        _e('Credit Card Icon Style', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_credit_card_icon_style');
        ?>
			</label>
			<ul>
				<?php 
        $cards = GFCommon::get_card_types();
        foreach ($cards as $card) {
            ?>
					<li>
						<input type="checkbox" id="field_credit_card_<?php 
            echo esc_attr($card['slug']);
            ?>
" value="<?php 
            echo esc_attr($card['slug']);
            ?>
" onclick="SetCardType(this, this.value);" />
						<label for="field_credit_card_<?php 
            echo esc_attr($card['slug']);
            ?>
" class="inline"><?php 
            echo esc_html($card['name']);
            ?>
</label>
					</li>

				<?php 
        }
        ?>
			</ul>
		</li>

		<?php 
        do_action('gform_field_advanced_settings', 250, $form_id);
        ?>
		<li class="captcha_language_setting field_setting">
			<label for="field_captcha_language">
				<?php 
        _e('Language', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_recaptcha_language');
        ?>
			</label>
			<select id="field_captcha_language" onchange="SetFieldProperty('captchaLanguage', this.value);">
				<option value="en"><?php 
        _e('English', 'gravityforms');
        ?>
</option>
				<option value="nl"><?php 
        _e('Dutch', 'gravityforms');
        ?>
</option>
				<option value="fr"><?php 
        _e('French', 'gravityforms');
        ?>
</option>
				<option value="de"><?php 
        _e('German', 'gravityforms');
        ?>
</option>
				<option value="pt"><?php 
        _e('Portuguese', 'gravityforms');
        ?>
</option>
				<option value="ru"><?php 
        _e('Russian', 'gravityforms');
        ?>
</option>
				<option value="es"><?php 
        _e('Spanish', 'gravityforms');
        ?>
</option>
				<option value="tr"><?php 
        _e('Turkish', 'gravityforms');
        ?>
</option>
			</select>
		</li>
		<?php 
        do_action('gform_field_advanced_settings', 300, $form_id);
        do_action('gform_field_advanced_settings', 325, $form_id);
        ?>
		<li class="add_icon_url_setting field_setting">
			<label for="field_add_icon_url">
				<?php 
        _e('Add Icon URL', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_add_icon_url');
        ?>
			</label>
			<input type="text" id="field_add_icon_url" class="fieldwidth-2" />
		</li>
		<?php 
        do_action('gform_field_advanced_settings', 337, $form_id);
        ?>
		<li class="delete_icon_url_setting field_setting">
			<label for="field_delete_icon_url">
				<?php 
        _e('Delete Icon URL', 'gravityforms');
        ?>
				<?php 
        gform_tooltip('form_field_delete_icon_url');
        ?>
			</label>
			<input type="text" id="field_delete_icon_url" class="fieldwidth-2" />
		</li>
		<?php 
        do_action('gform_field_advanced_settings', 350, $form_id);
        ?>
		<li class="password_field_setting field_setting">
			<input type="checkbox" id="field_password" onclick="SetPasswordProperty(this.checked);" />
			<label for="field_password" class="inline"><?php 
        _e('Enable Password Input', 'gravityforms');
        gform_tooltip('form_field_password');
        ?>
</label>
		</li>

		<?php 
        do_action('gform_field_advanced_settings', 375, $form_id);
        ?>
		<li class="force_ssl_field_setting field_setting">
			<input type="checkbox" id="field_force_ssl" onclick="SetFieldProperty('forceSSL', this.checked);" />
			<label for="field_force_ssl" class="inline"><?php 
        _e('Force SSL', 'gravityforms');
        gform_tooltip('form_field_force_ssl');
        ?>
</label>
		</li>

		<?php 
        do_action('gform_field_advanced_settings', 400, $form_id);
        ?>
		<li class="visibility_setting field_setting">
			<label><?php 
        _e('Visibility', 'gravityforms');
        ?>
 <?php 
        gform_tooltip('form_field_visibility');
        ?>
</label>

			<div>
				<input type="radio" name="field_visibility" id="field_visibility_everyone" size="10" onclick="SetFieldAdminOnly(!this.checked);" />
				<label for="field_visibility_everyone" class="inline">
					<?php 
        _e('Everyone', 'gravityforms');
        ?>
				</label>
				&nbsp;&nbsp;
				<input type="radio" name="field_visibility" id="field_visibility_admin" size="10" onclick="SetFieldAdminOnly(this.checked);" />
				<label for="field_visibility_admin" class="inline">
					<?php 
        _e('Admin Only', 'gravityforms');
        ?>
				</label>
			</div>
			<br class="clear" />
		</li>
		<?php 
        do_action('gform_field_advanced_settings', 450, $form_id);
        ?>
		<li class="prepopulate_field_setting field_setting">
			<input type="checkbox" id="field_prepopulate" onclick="SetFieldProperty('allowsPrepopulate', this.checked); ToggleInputName()" />
			<label for="field_prepopulate" class="inline"><?php 
        _e('Allow field to be populated dynamically', 'gravityforms');
        ?>
 <?php 
        gform_tooltip('form_field_prepopulate');
        ?>
</label>
			<br />

			<div id="field_input_name_container" style="display:none; padding-top:10px;">
				<!-- content dynamically created from js.php -->
			</div>
		</li>
		<?php 
        do_action('gform_field_advanced_settings', 500, $form_id);
        ?>
		<li class="conditional_logic_field_setting field_setting">
			<input type="checkbox" id="field_conditional_logic" onclick="SetFieldProperty('conditionalLogic', this.checked ? new ConditionalLogic() : null); ToggleConditionalLogic(false, 'field');" />
			<label for="field_conditional_logic" class="inline"><?php 
        _e('Enable Conditional Logic', 'gravityforms');
        ?>
 <?php 
        gform_tooltip('form_field_conditional_logic');
        ?>
</label>
			<br />

			<div id="field_conditional_logic_container" style="display:none; padding-top:10px;">
				<!-- content dynamically created from js.php -->
			</div>
		</li>

		<?php 
        do_action('gform_field_advanced_settings', 525, $form_id);
        ?>
		<li class="conditional_logic_page_setting field_setting">
			<input type="checkbox" id="page_conditional_logic" onclick="SetFieldProperty('conditionalLogic', this.checked ? new ConditionalLogic() : null); ToggleConditionalLogic(false, 'page');" />
			<label for="page_conditional_logic" class="inline"><?php 
        _e('Enable Page Conditional Logic', 'gravityforms');
        ?>
 <?php 
        gform_tooltip('form_page_conditional_logic');
        ?>
</label>
			<br />

			<div id="page_conditional_logic_container" style="display:none; padding-top:10px;">
				<!-- content dynamically created from js.php -->
			</div>
		</li>

		<?php 
        do_action('gform_field_advanced_settings', 550, $form_id);
        ?>
		<li class="conditional_logic_nextbutton_setting field_setting">
			<input type="checkbox" id="next_button_conditional_logic" onclick="SetNextButtonConditionalLogic(this.checked); ToggleConditionalLogic(false, 'next_button');" />
			<label for="next_button_conditional_logic" class="inline"><?php 
        _e('Enable Next Button Conditional Logic', 'gravityforms');
        ?>
 <?php 
        gform_tooltip('form_nextbutton_conditional_logic');
        ?>
</label>
			<br />

			<div id="next_button_conditional_logic_container" style="display:none; padding-top:10px;">
				<!-- content dynamically created from js.php -->
			</div>
		</li>

		<?php 
        do_action('gform_field_advanced_settings', -1, $form_id);
        ?>
		</ul>
		</div>


        </div>
		</td>
		<td valign="top" align="right">
			<div id="add_fields">
				<div id="floatMenu">

					<!-- begin add button boxes -->
					<ul id="sidebarmenu1" class="menu collapsible expandfirst">

						<?php 
        $standard_fields = array(array('class' => 'button', 'data-type' => 'text', 'value' => GFCommon::get_field_type_title('text')), array('class' => 'button', 'data-type' => 'textarea', 'value' => GFCommon::get_field_type_title('textarea')), array('class' => 'button', 'data-type' => 'select', 'value' => GFCommon::get_field_type_title('select')), array('class' => 'button', 'data-type' => 'multiselect', 'value' => GFCommon::get_field_type_title('multiselect')), array('class' => 'button', 'data-type' => 'number', 'value' => GFCommon::get_field_type_title('number')), array('class' => 'button', 'data-type' => 'checkbox', 'value' => GFCommon::get_field_type_title('checkbox')), array('class' => 'button', 'data-type' => 'radio', 'value' => GFCommon::get_field_type_title('radio')), array('class' => 'button', 'data-type' => 'hidden', 'value' => GFCommon::get_field_type_title('hidden')), array('class' => 'button', 'data-type' => 'html', 'value' => GFCommon::get_field_type_title('html')), array('class' => 'button', 'data-type' => 'section', 'value' => GFCommon::get_field_type_title('section')), array('class' => 'button', 'data-type' => 'page', 'value' => GFCommon::get_field_type_title('page')));
        $advanced_fields = array(array('class' => 'button', 'data-type' => 'name', 'value' => GFCommon::get_field_type_title('name')), array('class' => 'button', 'data-type' => 'date', 'value' => GFCommon::get_field_type_title('date')), array('class' => 'button', 'data-type' => 'time', 'value' => GFCommon::get_field_type_title('time')), array('class' => 'button', 'data-type' => 'phone', 'value' => GFCommon::get_field_type_title('phone')), array('class' => 'button', 'data-type' => 'address', 'value' => GFCommon::get_field_type_title('address')), array('class' => 'button', 'data-type' => 'website', 'value' => GFCommon::get_field_type_title('website')), array('class' => 'button', 'data-type' => 'email', 'value' => GFCommon::get_field_type_title('email')));
        if (apply_filters('gform_enable_password_field', false)) {
            $advanced_fields[] = array('class' => 'button', 'data-type' => 'password', 'value' => GFCommon::get_field_type_title('password'));
        }
        $advanced_fields[] = array('class' => 'button', 'data-type' => 'fileupload', 'value' => GFCommon::get_field_type_title('fileupload'));
        $advanced_fields[] = array('class' => 'button', 'data-type' => 'captcha', 'value' => GFCommon::get_field_type_title('captcha'));
        $advanced_fields[] = array('class' => 'button', 'data-type' => 'list', 'value' => GFCommon::get_field_type_title('list'));
        $post_fields = array(array('class' => 'button', 'data-type' => 'post_title', 'value' => GFCommon::get_field_type_title('post_title')), array('class' => 'button', 'data-type' => 'post_content', 'value' => GFCommon::get_field_type_title('post_content')), array('class' => 'button', 'data-type' => 'post_excerpt', 'value' => GFCommon::get_field_type_title('post_excerpt')), array('class' => 'button', 'data-type' => 'post_tags', 'value' => GFCommon::get_field_type_title('post_tags')), array('class' => 'button', 'data-type' => 'post_category', 'value' => GFCommon::get_field_type_title('post_category')), array('class' => 'button', 'data-type' => 'post_image', 'value' => GFCommon::get_field_type_title('post_image')), array('class' => 'button', 'data-type' => 'post_custom_field', 'value' => GFCommon::get_field_type_title('post_custom_field')));
        $pricing_fields = array(array('class' => 'button', 'data-type' => 'product', 'value' => GFCommon::get_field_type_title('product')), array('class' => 'button', 'data-type' => 'quantity', 'value' => GFCommon::get_field_type_title('quantity')), array('class' => 'button', 'data-type' => 'option', 'value' => GFCommon::get_field_type_title('option')), array('class' => 'button', 'data-type' => 'shipping', 'value' => GFCommon::get_field_type_title('shipping')), array('class' => 'button', 'data-type' => 'total', 'value' => GFCommon::get_field_type_title('total')));
        if (apply_filters('gform_enable_credit_card_field', false)) {
            $pricing_fields[] = array('class' => 'button', 'data-type' => 'creditcard', 'value' => GFCommon::get_field_type_title('creditcard'));
        }
        $field_groups = array(array('name' => 'standard_fields', 'label' => __('Standard Fields', 'gravityforms'), 'fields' => $standard_fields, 'tooltip_class' => 'tooltip_bottomleft'), array('name' => 'advanced_fields', 'label' => __('Advanced Fields', 'gravityforms'), 'fields' => $advanced_fields), array('name' => 'post_fields', 'label' => __('Post Fields', 'gravityforms'), 'fields' => $post_fields));
        $field_groups[] = array('name' => 'pricing_fields', 'label' => __('Pricing Fields', 'gravityforms'), 'fields' => $pricing_fields);
        foreach (GF_Fields::get_all() as $gf_field) {
            $field_groups = $gf_field->add_button($field_groups);
        }
        $field_groups = apply_filters('gform_add_field_buttons', $field_groups);
        foreach ($field_groups as $group) {
            $tooltip_class = empty($group['tooltip_class']) ? 'tooltip_left' : $group['tooltip_class'];
            ?>
							<li id="add_<?php 
            echo esc_attr($group['name']);
            ?>
" class="add_field_button_container">
								<div class="button-title-link <?php 
            echo $group['name'] == 'standard_fields' ? 'gf_button_title_active' : '';
            ?>
">
									<div class="add-buttons-title"><?php 
            echo esc_html($group['label']);
            ?>
 <?php 
            gform_tooltip("form_{$group['name']}", $tooltip_class);
            ?>
</div>
								</div>
								<ul>
									<li class="add-buttons">
										<ol class="field_type">
											<?php 
            self::display_buttons($group['fields']);
            ?>
										</ol>
									</li>
								</ul>
							</li>
						<?php 
        }
        ?>
					</ul>
					<br style="clear:both;" />
					<!--end add button boxes -->

					<?php 
        if (GFCommon::current_user_can_any('gravityforms_delete_forms')) {
            $trash_link = '<a class="submitdelete" title="' . __('Move this form to the trash', 'gravityforms') . '" onclick="if(confirm(\'' . __("Would you like to move this form to the trash? \\'Cancel\\' to stop. \\'OK\\' to continue", 'gravityforms') . '\')){ gf_vars.isFormTrash = true; jQuery(\'#form_trash\')[0].submit();} else{return false;}">' . __('Move to Trash', 'gravityforms') . '</a>';
            $trash_link = apply_filters('gform_form_delete_link', $trash_link);
            // deprecated
            echo apply_filters('gform_form_trash_link', $trash_link);
        }
        $button_text = rgar($form, 'id') > 0 ? __('Update Form', 'gravityforms') : __('Save Form', 'gravityforms');
        $isNew = rgar($form, 'id') > 0 ? 0 : 1;
        $save_button = '<input type="button" class="button button-large button-primary update-form" value="' . $button_text . '" onclick="SaveForm(' . $isNew . ');" />';
        $save_button = apply_filters('gform_save_form_button', $save_button);
        echo $save_button;
        ?>

					<span id="please_wait_container" style="display:none;"><i class='gficon-gravityforms-spinner-icon gficon-spin'></i></span>

					<div class="updated_base" id="after_update_dialog" style="display:none;">
						<strong><?php 
        _e('Form updated successfully.', 'gravityforms');
        ?>
							&nbsp;<a title="<?php 
        _e('Preview this form', 'gravityforms');
        ?>
" href="<?php 
        echo trailingslashit(site_url());
        ?>
?gf_page=preview&id=<?php 
        echo absint(rgar($form, 'id'));
        ?>
" target="_blank"><?php 
        _e('Preview', 'gravityforms');
        ?>
</a></strong>
					</div>
					<div class="error_base" id="after_update_error_dialog" style="padding:10px 10px 16px 10px; display:none;">
						<?php 
        _e('There was an error while saving your form.', 'gravityforms');
        ?>
						<?php 
        printf(__('Please %scontact our support team%s.', 'gravityforms'), '<a href="http://www.gravityhelp.com">', '</a>');
        ?>
					</div>

					<!-- this field allows us to force onblur events for field setting inputs that are otherwise not triggered
                                    when closing the field settings UI -->
					<input type="text" id="gform_force_focus" style="position:absolute;left:-9999em;" />

					<form method="post" id="gform_update">
						<?php 
        wp_nonce_field("gforms_update_form_{$form_id}", 'gforms_update_form');
        ?>
						<input type="hidden" id="gform_meta" name="gform_meta" />
					</form>

				</div>
			</div>
		</td>
		</tr>
		</table>

		</div>

		<!-- // including form setting hooks as a temporary fix to prevent issues where users using the "gform_before_update" hook are expecting
            form settings to be included on the form editor page -->
		<div style="display:none;">
			<!--form settings-->
			<?php 
        do_action('gform_properties_settings', 100, $form_id);
        ?>
			<?php 
        do_action('gform_properties_settings', 200, $form_id);
        ?>
			<?php 
        do_action('gform_properties_settings', 300, $form_id);
        ?>
			<?php 
        do_action('gform_properties_settings', 400, $form_id);
        ?>
			<?php 
        do_action('gform_properties_settings', 500, $form_id);
        ?>

			<!--advanced settings-->
			<?php 
        do_action('gform_advanced_settings', 100, $form_id);
        ?>
			<?php 
        do_action('gform_advanced_settings', 200, $form_id);
        ?>
			<?php 
        do_action('gform_advanced_settings', 300, $form_id);
        ?>
			<?php 
        do_action('gform_advanced_settings', 400, $form_id);
        ?>
			<?php 
        do_action('gform_advanced_settings', 500, $form_id);
        ?>
			<?php 
        do_action('gform_advanced_settings', 600, $form_id);
        ?>
			<?php 
        do_action('gform_advanced_settings', 700, $form_id);
        ?>
			<?php 
        do_action('gform_advanced_settings', 800, $form_id);
        ?>
		</div>

		<?php 
        self::inline_scripts($form);
        require_once GFCommon::get_base_path() . '/js.php';
    }
Exemplo n.º 2
0
        public function results_page($form_id, $page_title, $gf_page, $gf_view)
        {
            if (empty($form_id)) {
                $forms = RGFormsModel::get_forms();
                if (!empty($forms)) {
                    $form_id = $forms[0]->id;
                }
            }
            $form = GFFormsModel::get_form_meta($form_id);
            $form = gf_apply_filters(array('gform_form_pre_results', $form_id), $form);
            // set up filter vars
            $start_date = rgget('start');
            $end_date = rgget('end');
            $all_fields = $form['fields'];
            $filter_settings = GFCommon::get_field_filter_settings($form);
            $filter_settings = apply_filters('gform_filters_pre_results', $filter_settings, $form);
            $filter_settings = array_values($filter_settings);
            // reset the numeric keys in case some filters have been unset
            $filter_fields = rgget('f');
            $filter_operators = rgget('o');
            $filter_values = rgget('v');
            $filters = array();
            $init_vars = array();
            if (!empty($filter_fields)) {
                $init_vars['mode'] = rgget('mode');
                foreach ($filter_fields as $i => $filter_field) {
                    $filters[$i]['field'] = $filter_field;
                    $filters[$i]['operator'] = $filter_operators[$i];
                    $filters[$i]['value'] = $filter_values[$i];
                }
                $init_vars['filters'] = $filters;
            }
            ?>
			<script type="text/javascript">
				var gresultsFields = <?php 
            echo json_encode($all_fields);
            ?>
;
				var gresultsFilterSettings = <?php 
            echo json_encode($filter_settings);
            ?>
;
				var gresultsInitVars = <?php 
            echo json_encode($init_vars);
            ?>
;

				<?php 
            GFCommon::gf_global();
            ?>
				<?php 
            GFCommon::gf_vars();
            ?>
			</script>

			<link rel="stylesheet"
			      href="<?php 
            echo GFCommon::get_base_url();
            ?>
/css/admin.css?ver=<?php 
            echo GFCommon::$version;
            ?>
"
			      type="text/css"/>
			<div class="wrap gforms_edit_form <?php 
            echo GFCommon::get_browser_class();
            ?>
">

				<h2 class="gf_admin_page_title">
					<span><?php 
            echo empty($form_id) ? $page_title : $page_title . ' : ' . esc_html($form['title']);
            ?>
</span><span
						class="gf_admin_page_subtitle"><span
							class="gf_admin_page_formid">ID: <?php 
            echo $form['id'];
            ?>
</span><span
							class="gf_admin_page_formname"><?php 
            esc_html_e('Form Name', 'gravityforms');
            ?>
							: <?php 
            echo $form['title'];
            ?>
</span></span>
				</h2>
				<?php 
            RGForms::top_toolbar();
            ?>
				<?php 
            if (false === empty($all_fields)) {
                ?>

					<div id="poststuff" class="metabox-holder has-right-sidebar">
						<div id="side-info-column" class="inner-sidebar">
							<div id="gresults-results-filter" class="postbox">
								<h3 style="cursor: default;"><?php 
                echo $this->_search_title;
                ?>
</h3>

								<div id="gresults-results-filter-content">
									<form id="gresults-results-filter-form" action="" method="GET">
										<input type="hidden" id="gresults-page-slug" name="page"
										       value="<?php 
                echo esc_attr($gf_page);
                ?>
">
										<input type="hidden" id="gresults-view-slug" name="view"
										       value="<?php 
                echo esc_attr($gf_view);
                ?>
">
										<input type="hidden" id="gresults-form-id" name="id"
										       value="<?php 
                echo esc_attr($form_id);
                ?>
">

										<?php 
                $filter_ui = array('fields' => array('label' => esc_attr__('Filters', 'gravityforms'), 'tooltip' => 'gresults_filters', 'markup' => '<div id="gresults-results-field-filters-container">
																<!-- placeholder populated by js -->
															 </div>'), 'date_range' => array('label' => esc_attr__('Date Range', 'gravityforms'), 'tooltip' => 'gresults_date_range', 'markup' => '<div style="width:90px; float:left; ">
																	<label
																		for="gresults-results-filter-date-start">' . esc_html__('Start', 'gravityforms') . '</label>
																	<input type="text" id="gresults-results-filter-date-start" name="start"
																		   style="width:80px"
																		   class="gresults-datepicker"
																		   value="' . $start_date . '"/>
																</div>
																<div style="width:90px; float:left; ">
																	<label
																		for="gresults-results-filter-date-end">' . esc_html__('End', 'gravityforms') . '</label>
																	<input type="text" id="gresults-results-filter-date-end" name="end"
																		   style="width:80px"
																		   class="gresults-datepicker"
																		   value="' . $end_date . '"/>
																</div>'));
                $filter_ui = apply_filters('gform_filter_ui', $filter_ui, $form_id, $page_title, $gf_page, $gf_view);
                foreach ($filter_ui as $name => $filter) {
                    ?>
											<div class='gresults-results-filter-section-label'>
												<?php 
                    echo $filter['label'];
                    ?>
												&nbsp;<?php 
                    gform_tooltip(rgar($filter, 'tooltip'), 'tooltip_bottomleft');
                    ?>
											</div>
											<?php 
                    echo $filter['markup'];
                }
                ?>

										<br style="clear:both"/>

										<div id="gresults-results-filter-buttons">
											<input type="submit" id="gresults-results-filter-submit-button"
											       class="button button-primary button-large"
											       value="<?php 
                esc_attr_e('Apply filters', 'gravityforms');
                ?>
">
											<input type="button" id="gresults-results-filter-clear-button"
											       class="button button-secondary button-large"
											       value="<?php 
                esc_attr_e('Clear', 'gravityforms');
                ?>
"
											       onclick="gresults.clearFilterForm();">

											<div class="gresults-filter-loading"
											     style="display:none; float:right; margin-top:5px;">
												<i class='gficon-gravityforms-spinner-icon gficon-spin'></i> <?php 
                esc_html_e('Loading', 'gravityforms');
                ?>
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
					<div class="gresults-filter-loading" style="display:none;margin:0 5px 10px 0;">
						<i class='gficon-gravityforms-spinner-icon gficon-spin'></i>&nbsp;
						<a href="javascript:void(0);"
						   onclick="javascript:gresultsAjaxRequest.abort()"><?php 
                esc_html_e('Cancel', 'gravityforms');
                ?>
</a>
					</div>

					<div id="gresults-results-wrapper">
						<div id="gresults-results">&nbsp;
						</div>
					</div>

				<?php 
            } else {
                _e('This form does not have any fields that can be used for results', 'gravityforms');
            }
            ?>
			</div>


		<?php 
        }
Exemplo n.º 3
0
        public function results_page($form_id, $page_title, $gf_page, $gf_view)
        {
            if (empty($form_id)) {
                $forms = RGFormsModel::get_forms();
                if (!empty($forms)) {
                    $form_id = $forms[0]->id;
                }
            }
            $form = GFFormsModel::get_form_meta($form_id);
            $form = apply_filters("gform_form_pre_results_{$form_id}", apply_filters("gform_form_pre_results", $form));
            // set up filter vars
            $start_date = rgget("start");
            $end_date = rgget("end");
            $all_fields = $form["fields"];
            $filter_settings = GFCommon::get_field_filter_settings($form);
            $filter_settings = apply_filters("gform_filters_pre_results", $filter_settings, $form);
            $filter_settings = array_values($filter_settings);
            // reset the numeric keys in case some filters have been unset
            $filter_fields = rgget("f");
            $filter_operators = rgget("o");
            $filter_values = rgget("v");
            $filters = array();
            $init_vars = array();
            if (!empty($filter_fields)) {
                $init_vars["mode"] = rgget("mode");
                foreach ($filter_fields as $i => $filter_field) {
                    $filters[$i]["field"] = $filter_field;
                    $filters[$i]["operator"] = $filter_operators[$i];
                    $filters[$i]["value"] = $filter_values[$i];
                }
                $init_vars["filters"] = $filters;
            }
            ?>
            <script type="text/javascript">
                var gresultsFields = <?php 
            echo json_encode($all_fields);
            ?>
;
                var gresultsFilterSettings = <?php 
            echo json_encode($filter_settings);
            ?>
;
                var gresultsInitVars = <?php 
            echo json_encode($init_vars);
            ?>
;

                <?php 
            GFCommon::gf_global();
            ?>
                <?php 
            GFCommon::gf_vars();
            ?>
            </script>

            <link rel="stylesheet"
                  href="<?php 
            echo GFCommon::get_base_url();
            ?>
/css/admin.css?ver=<?php 
            echo GFCommon::$version;
            ?>
"
                  type="text/css"/>
            <div class="wrap gforms_edit_form <?php 
            echo GFCommon::get_browser_class();
            ?>
">

                <div class="icon32" id="gravity-entry-icon"><br></div>

                <h2><?php 
            echo empty($form_id) ? $page_title : $page_title . " : " . esc_html($form["title"]);
            ?>
</h2>

                <?php 
            RGForms::top_toolbar();
            ?>
                <?php 
            if (false === empty($all_fields)) {
                ?>

                    <div id="poststuff" class="metabox-holder has-right-sidebar">
                        <div id="side-info-column" class="inner-sidebar">
                            <div id="gresults-results-filter" class="postbox">
                                <h3 style="cursor: default;"><?php 
                echo $this->_search_title;
                ?>
</h3>

                                <div id="gresults-results-filter-content">
                                    <form id="gresults-results-filter-form" action="" method="GET">
                                        <input type="hidden" id="gresults-page-slug" name="page"
                                               value="<?php 
                echo esc_attr($gf_page);
                ?>
">
                                        <input type="hidden" id="gresults-view-slug" name="view"
                                               value="<?php 
                echo esc_attr($gf_view);
                ?>
">
                                        <input type="hidden" id="gresults-form-id" name="id"
                                               value="<?php 
                echo esc_attr($form_id);
                ?>
">

                                        <?php 
                $filter_ui = array("fields" => array("label" => __("Filters", "gravityforms"), "tooltip" => "gresults_filters", "markup" => '<div id="gresults-results-field-filters-container">
                                                                                <!-- placeholder populated by js -->
                                                                             </div>'), "date_range" => array("label" => __("Date Range", "gravityforms"), "tooltip" => "gresults_date_range", "markup" => '<div style="width:90px; float:left; ">

                                                                                    <label
                                                                                        for="gresults-results-filter-date-start">' . __("Start", "gravityforms") . '</label>
                                                                                    <input type="text" id="gresults-results-filter-date-start" name="start"
                                                                                           style="width:80px"
                                                                                           class="gresults-datepicker"
                                                                                           value="' . $start_date . '"/>
                                                                                </div>
                                                                                <div style="width:90px; float:left; ">
                                                                                    <label
                                                                                        for="gresults-results-filter-date-end">' . __("End", "gravityforms") . '</label>
                                                                                    <input type="text" id="gresults-results-filter-date-end" name="end"
                                                                                           style="width:80px"
                                                                                           class="gresults-datepicker"
                                                                                           value="' . $end_date . '"/>
                                                                                </div>'));
                $filter_ui = apply_filters("gform_filter_ui", $filter_ui, $form_id, $page_title, $gf_page, $gf_view);
                foreach ($filter_ui as $name => $filter) {
                    ?>
                                            <div class='gresults-results-filter-section-label'>
                                                <?php 
                    echo $filter["label"];
                    ?>
                                                &nbsp;<?php 
                    gform_tooltip(rgar($filter, "tooltip"), "tooltip_bottomleft");
                    ?>
                                            </div>
                                            <?php 
                    echo $filter["markup"];
                }
                ?>

                                        <br style="clear:both"/>

                                        <div id="gresults-results-filter-buttons">
                                            <input type="submit" id="gresults-results-filter-submit-button"
                                                   class="button button-primary button-large" value="<?php 
                _e('Apply filters', 'gravityforms');
                ?>
">
                                            <input type="button" id="gresults-results-filter-clear-button"
                                                   class="button button-secondary button-large" value="<?php 
                _e('Clear', 'gravityforms');
                ?>
"
                                                   onclick="gresults.clearFilterForm();">

                                            <div class="gresults-filter-loading"
                                                 style="display:none; float:right; margin-top:5px;">
                                                <img
                                                    src="<?php 
                echo GFCommon::get_base_url();
                ?>
/images/spinner.gif"
                                                    alt="loading..."/>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="gresults-filter-loading" style="display:none;margin:0 5px 10px 0;">
                        <img style="vertical-align:middle;"
                             src="<?php 
                echo GFCommon::get_base_url();
                ?>
/images/spinner.gif"
                             alt="loading..."/>&nbsp;
                        <a href="javascript:void(0);" onclick="javascript:gresultsAjaxRequest.abort()">Cancel</a>
                    </div>

                    <div id="gresults-results-wrapper">
                        <div id="gresults-results">&nbsp;
                        </div>
                    </div>

                <?php 
            } else {
                _e("This form does not have any fields that can be used for results", "gravityforms");
            }
            ?>
            </div>


        <?php 
        }
Exemplo n.º 4
0
    public static function export_lead_page()
    {
        if (!GFCommon::current_user_can_any('gravityforms_export_entries')) {
            wp_die('You do not have permission to access this page');
        }
        self::page_header(__('Export Entries', 'gravityforms'));
        ?>

		<script type="text/javascript">

			var gfSpinner;

			<?php 
        GFCommon::gf_global();
        ?>
			<?php 
        GFCommon::gf_vars();
        ?>

			function SelectExportForm(formId) {

				if (!formId)
					return;

				gfSpinner = new gfAjaxSpinner(jQuery('select#export_form'), gf_vars.baseUrl + '/images/spinner.gif', 'position: relative; top: 2px; left: 5px;');

				var mysack = new sack("<?php 
        echo admin_url('admin-ajax.php');
        ?>
");
				mysack.execute = 1;
				mysack.method = 'POST';
				mysack.setVar("action", "rg_select_export_form");
				mysack.setVar("rg_select_export_form", "<?php 
        echo wp_create_nonce('rg_select_export_form');
        ?>
");
				mysack.setVar("form_id", formId);
				mysack.onError = function () {
					alert(<?php 
        echo json_encode(__('Ajax error while selecting a form', 'gravityforms'));
        ?>
)
				};
				mysack.runAJAX();

				return true;
			}

			function EndSelectExportForm(aryFields, filterSettings) {

				gfSpinner.destroy();

				if (aryFields.length == 0) {
					jQuery("#export_field_container, #export_date_container, #export_submit_container").hide()
					return;
				}

				var fieldList = "<li><input id='select_all' type='checkbox' onclick=\"jQuery('.gform_export_field').attr('checked', this.checked); jQuery('#gform_export_check_all').html(this.checked ? '<strong><?php 
        echo esc_js(__('Deselect All', 'gravityforms'));
        ?>
</strong>' : '<strong><?php 
        echo esc_js(__('Select All', 'gravityforms'));
        ?>
</strong>'); \"> <label id='gform_export_check_all' for='select_all'><strong><?php 
        esc_html_e('Select All', 'gravityforms');
        ?>
</strong></label></li>";
				for (var i = 0; i < aryFields.length; i++) {
					fieldList += "<li><input type='checkbox' id='export_field_" + i + "' name='export_field[]' value='" + aryFields[i][0] + "' class='gform_export_field'> <label for='export_field_" + i + "'>" + aryFields[i][1] + "</label></li>";
				}
				jQuery("#export_field_list").html(fieldList);
				jQuery("#export_date_start, #export_date_end").datepicker({dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true});

				jQuery("#export_field_container, #export_filter_container, #export_date_container, #export_submit_container").hide().show();

				gf_vars.filterAndAny = <?php 
        echo json_encode(esc_html__('Export entries if {0} of the following match:', 'gravityforms'));
        ?>
;
				jQuery("#export_filters").gfFilterUI(filterSettings);
			}
			jQuery(document).ready(function () {
				jQuery("#gform_export").submit(function () {
					if (jQuery(".gform_export_field:checked").length == 0) {
						alert(<?php 
        echo json_encode(__('Please select the fields to be exported', 'gravityforms'));
        ?>
);
						return false;
					}
				});
			});


		</script>

		<p class="textleft"><?php 
        esc_html_e('Select a form below to export entries. Once you have selected a form you may select the fields you would like to export and then define optional filters for field values and the date range. When you click the download button below, Gravity Forms will create a CSV file for you to save to your computer.', 'gravityforms');
        ?>
</p>
		<div class="hr-divider"></div>
		<form id="gform_export" method="post" style="margin-top:10px;">
			<?php 
        echo wp_nonce_field('rg_start_export', 'rg_start_export_nonce');
        ?>
			<table class="form-table">
				<tr valign="top">

					<th scope="row">
						<label for="export_form"><?php 
        esc_html_e('Select A Form', 'gravityforms');
        ?>
</label> <?php 
        gform_tooltip('export_select_form');
        ?>
					</th>
					<td>

						<select id="export_form" name="export_form" onchange="SelectExportForm(jQuery(this).val());">
							<option value=""><?php 
        esc_html_e('Select a form', 'gravityforms');
        ?>
</option>
							<?php 
        $forms = RGFormsModel::get_forms(null, 'title');
        foreach ($forms as $form) {
            ?>
								<option value="<?php 
            echo absint($form->id);
            ?>
"><?php 
            echo esc_html($form->title);
            ?>
</option>
							<?php 
        }
        ?>
						</select>

					</td>
				</tr>
				<tr id="export_field_container" valign="top" style="display: none;">
					<th scope="row">
						<label for="export_fields"><?php 
        esc_html_e('Select Fields', 'gravityforms');
        ?>
</label> <?php 
        gform_tooltip('export_select_fields');
        ?>
					</th>
					<td>
						<ul id="export_field_list">
						</ul>
					</td>
				</tr>
				<tr id="export_filter_container" valign="top" style="display: none;">
					<th scope="row">
						<label><?php 
        esc_html_e('Conditional Logic', 'gravityforms');
        ?>
</label> <?php 
        gform_tooltip('export_conditional_logic');
        ?>
					</th>
					<td>
						<div id="export_filters">
							<!--placeholder-->
						</div>

					</td>
				</tr>
				<tr id="export_date_container" valign="top" style="display: none;">
					<th scope="row">
						<label for="export_date"><?php 
        esc_html_e('Select Date Range', 'gravityforms');
        ?>
</label> <?php 
        gform_tooltip('export_date_range');
        ?>
					</th>
					<td>
						<div>
                            <span style="width:150px; float:left; ">
                                <input type="text" id="export_date_start" name="export_date_start" style="width:90%" />
                                <strong><label for="export_date_start" style="display:block;"><?php 
        esc_html_e('Start', 'gravityforms');
        ?>
</label></strong>
                            </span>

                            <span style="width:150px; float:left;">
                                <input type="text" id="export_date_end" name="export_date_end" style="width:90%" />
                                <strong><label for="export_date_end" style="display:block;"><?php 
        esc_html_e('End', 'gravityforms');
        ?>
</label></strong>
                            </span>

							<div style="clear: both;"></div>
							<?php 
        esc_html_e('Date Range is optional, if no date range is selected all entries will be exported.', 'gravityforms');
        ?>
						</div>
					</td>
				</tr>
			</table>
			<ul>
				<li id="export_submit_container" style="display:none; clear:both;">
					<br /><br />
					<input type="submit" name="export_lead" value="<?php 
        esc_attr_e('Download Export File', 'gravityforms');
        ?>
" class="button button-large button-primary" />
                    <span id="please_wait_container" style="display:none; margin-left:15px;">
                        <i class='gficon-gravityforms-spinner-icon gficon-spin'></i> <?php 
        esc_html_e('Exporting entries. Please wait...', 'gravityforms');
        ?>
                    </span>

					<iframe id="export_frame" width="1" height="1" src="about:blank"></iframe>
				</li>
			</ul>
		</form>

		<?php 
        self::page_footer();
    }
 /**
  * Generate the script tags necessary for the Gravity Forms Merge Tag picker to work.
  *
  * @param  mixed      $curr_form Form ID
  * @return null|string     Merge tags html; NULL if $curr_form isn't defined.
  */
 public static function render_merge_tags_scripts($curr_form)
 {
     if (empty($curr_form)) {
         return NULL;
     }
     $form = gravityview_get_form($curr_form);
     $get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL;
     if (isset($form['id'])) {
         $form_script = 'var form = ' . GFCommon::json_encode($form) . ';';
         // The `gf_vars()` method needs a $_GET[id] variable set with the form ID.
         $_GET['id'] = $form['id'];
     } else {
         $form_script = 'var form = new Form();';
     }
     $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>';
     // Restore previous $_GET setting
     $_GET['id'] = $get_id_backup;
     return $output;
 }
    public function feed_list_page($form = null)
    {
        $action = $this->get_bulk_action();
        if ($action) {
            check_admin_referer('feed_list', 'feed_list');
            $this->process_bulk_action($action);
        }
        $single_action = rgpost('single_action');
        if (!empty($single_action)) {
            check_admin_referer('feed_list', 'feed_list');
            $this->process_single_action($single_action);
        }
        ?>

		<h3><span><?php 
        echo $this->feed_list_title();
        ?>
</span></h3>
		<form id="gform-settings" action="" method="post">
			<?php 
        $feed_list = $this->get_feed_table($form);
        $feed_list->prepare_items();
        $feed_list->display();
        ?>

			<!--Needed to save state after bulk operations-->
			<input type="hidden" value="gf_edit_forms" name="page">
			<input type="hidden" value="settings" name="view">
			<input type="hidden" value="<?php 
        echo $this->_slug;
        ?>
" name="subview">
			<input type="hidden" value="<?php 
        echo rgar($form, 'id');
        ?>
" name="id">
			<input id="single_action" type="hidden" value="" name="single_action">
			<input id="single_action_argument" type="hidden" value="" name="single_action_argument">
			<?php 
        wp_nonce_field('feed_list', 'feed_list');
        ?>
		</form>

		<script type="text/javascript">
			<?php 
        GFCommon::gf_vars();
        ?>
		</script>

	<?php 
    }
    public function feed_list_page($form = null)
    {
        $action = $this->get_bulk_action();
        if ($action) {
            check_admin_referer("feed_list", "feed_list");
            $this->process_bulk_action($action);
        }
        $single_action = rgpost("single_action");
        if (!empty($single_action)) {
            check_admin_referer("feed_list", "feed_list");
            $this->process_single_action($single_action);
        }
        $columns = $this->feed_list_columns();
        $column_value_callback = array($this, "get_column_value");
        $feeds = $this->get_feeds(rgar($form, "id"));
        $bulk_actions = $this->get_bulk_actions();
        $action_links = $this->get_action_links();
        ?>
        <h3><span><?php 
        echo $this->feed_list_title();
        ?>
</span></h3>
        <?php 
        $feed_list = new GFAddOnFeedsTable($feeds, $this->_slug, $columns, $bulk_actions, $action_links, $column_value_callback);
        $feed_list->prepare_items();
        $feed_list->display();
        ?>
        <!--Needed to save state after bulk operations-->
        <input type="hidden" value="gf_edit_forms" name="page">
        <input type="hidden" value="settings" name="view">
        <input type="hidden" value="<?php 
        echo $this->_slug;
        ?>
" name="subview">
        <input type="hidden" value="<?php 
        echo rgar($form, "id");
        ?>
" name="id">
        <input id="single_action" type="hidden" value="" name="single_action">
        <input id="single_action_argument" type="hidden" value="" name="single_action_argument">
        <?php 
        wp_nonce_field("feed_list", "feed_list");
        ?>

        <script type="text/javascript">
            <?php 
        GFCommon::gf_vars();
        ?>
        </script>
        <?php 
    }
Exemplo n.º 8
0
    public static function confirmations_edit_page($form_id, $confirmation_id)
    {
        $form = apply_filters("gform_admin_pre_render_{$form_id}", apply_filters("gform_admin_pre_render", GFFormsModel::get_form_meta($form_id)));
        $confirmation = self::handle_confirmation_edit_submission(rgar($form["confirmations"], $confirmation_id), $form);
        $confirmation_ui_settings = self::get_confirmation_ui_settings($confirmation);
        self::page_header(__('Confirmations', 'gravityforms'));
        ?>

        <script type="text/javascript">

            <?php 
        GFCommon::gf_vars();
        ?>

            var confirmation = <?php 
        echo $confirmation ? json_encode($confirmation) : 'new ConfirmationObj()';
        ?>
;
            var form = <?php 
        echo json_encode($form);
        ?>
;

            jQuery(document).ready(function($){

                SetConfirmationConditionalLogic();
                <?php 
        if (!rgar($confirmation, 'isDefault')) {
            ?>
			    ToggleConditionalLogic(true, 'confirmation');
                <?php 
        }
        ?>
                ToggleConfirmation();

		    });

        </script>

        <style type="text/css">
            #confirmation_action_type { display: none; }
        </style>

        <div id="confirmation-editor">

            <form id="confirmation_edit_form" method="post">

                <table class="form-table gforms_form_settings">
                    <?php 
        array_map(array(__CLASS__, 'output'), $confirmation_ui_settings);
        ?>
                </table>

                <?php 
        //DEPRECATED SINCE 1.7 - use gform_confirmation_ui_settings instead
        do_action("gform_confirmation_settings", 100, $form_id);
        do_action("gform_confirmation_settings", 200, $form_id);
        ?>

                <input type="hidden" id="confirmation_id" name="confirmation_id" value="<?php 
        echo $confirmation_id;
        ?>
" />
                <input type="hidden" id="form_id" name="form_id" value="<?php 
        echo $form_id;
        ?>
" />
                <input type="hidden" id="is_default" name="is_default" value="<?php 
        echo rgget("isDefault", $confirmation);
        ?>
" />
                <input type="hidden" id="conditional_logic" name="conditional_logic" value='<?php 
        echo json_encode(rgget('conditionalLogic', $confirmation));
        ?>
' />

                <p class="submit">
                    <input type="submit" name="save" value="<?php 
        _e('Save Confirmation', 'gravityforms');
        ?>
" onclick="StashConditionalLogic(event);" class="button-primary">
                </p>

                <?php 
        wp_nonce_field('gform_confirmation_edit', 'gform_confirmation_edit');
        ?>

            </form>

        </div> <!-- / confirmation-editor -->

        <?php 
        self::page_footer();
    }
Exemplo n.º 9
0
    public static function notification_edit_page($form_id, $notification_id)
    {
        if (!rgempty("gform_notification_id")) {
            $notification_id = rgpost("gform_notification_id");
        }
        $form = RGFormsModel::get_form_meta($form_id);
        $notification = !$notification_id ? array() : self::get_notification($form, $notification_id);
        // added second condition to account for new notifications with errors as notification ID will
        // be available in $_POST but the notification has not actually been saved yet
        $is_new_notification = empty($notification_id) || empty($notification);
        $is_valid = true;
        $is_update = false;
        if (rgpost("save")) {
            check_admin_referer('gforms_save_notification', 'gforms_save_notification');
            $is_update = true;
            if ($is_new_notification) {
                $notification_id = uniqid();
                $notification["id"] = $notification_id;
            }
            $notification["name"] = rgpost("gform_notification_name");
            $notification["event"] = rgpost("gform_notification_event");
            $notification["to"] = rgpost("gform_notification_to_type") == "field" ? rgpost("gform_notification_to_field") : rgpost("gform_notification_to_email");
            $notification["toType"] = rgpost("gform_notification_to_type");
            $notification["bcc"] = rgpost("gform_notification_bcc");
            $notification["subject"] = rgpost("gform_notification_subject");
            $notification["message"] = rgpost("gform_notification_message");
            $notification["from"] = rgpost("gform_notification_from");
            $notification["fromName"] = rgpost("gform_notification_from_name");
            $notification["replyTo"] = rgpost("gform_notification_reply_to");
            $notification["routing"] = !rgempty("gform_routing_meta") ? GFCommon::json_decode(rgpost("gform_routing_meta"), true) : null;
            $notification["conditionalLogic"] = !rgempty("gform_conditional_logic_meta") ? GFCommon::json_decode(rgpost("gform_conditional_logic_meta"), true) : null;
            $notification["disableAutoformat"] = rgpost("gform_notification_disable_autoformat");
            $notification = apply_filters('gform_pre_notification_save', apply_filters("gform_pre_notification_save{$form['id']}", $notification, $form), $form);
            //validating input...
            $is_valid = self::validate_notification();
            if ($is_valid) {
                //input valid, updating...
                //emptying notification email if it is supposed to be disabled
                if ($_POST["gform_notification_to_type"] == "routing") {
                    $notification["to"] = "";
                } else {
                    $notification["routing"] = null;
                }
                $form["notifications"][$notification_id] = $notification;
                RGFormsModel::save_form_notifications($form_id, $form['notifications']);
            }
        }
        if ($is_update && $is_valid) {
            GFCommon::add_message(sprintf(__('Notification saved successfully. %sBack to notifications.%s', 'gravityforms'), '<a href="' . remove_query_arg('nid') . '">', '</a>'));
        } else {
            if ($is_update && !$is_valid) {
                GFCommon::add_error_message(__('Notification could not be updated. Please enter all required information below.', 'gravityforms'));
            }
        }
        // moved page header loading here so the admin messages can be set upon saving and available for the header to print out
        GFFormSettings::page_header(__('Notifications', 'gravityforms'));
        $notification_ui_settings = self::get_notification_ui_settings($notification);
        ?>
        <link rel="stylesheet" href="<?php 
        echo GFCommon::get_base_url();
        ?>
/css/admin.css?ver=<?php 
        echo GFCommon::$version;
        ?>
" />

        <script type="text/javascript">
        <?php 
        GFCommon::gf_vars();
        ?>

        var gform_has_unsaved_changes = false;
        jQuery(document).ready(function(){

            jQuery("#entry_form input, #entry_form textarea, #entry_form select").change(function(){
                gform_has_unsaved_changes = true;
            });

            window.onbeforeunload = function(){
                if (gform_has_unsaved_changes){
                    return "You have unsaved changes.";
                }
            }

            ToggleConditionalLogic(true, 'notification');

            if(jQuery(document).on){
                jQuery(document).on('change', '.gfield_routing_value_dropdown', function(){
                        SetRoutingValueDropDown(jQuery(this));
                    });
            }
            else{
                jQuery('.gfield_routing_value_dropdown').live('change', function(){
                    SetRoutingValueDropDown(jQuery(this));
                });
            }
        });

        <?php 
        if (empty($form["notifications"])) {
            $form["notifications"] = array();
        }
        ?>

        var form = <?php 
        echo GFCommon::json_encode($form);
        ?>
;
        var current_notification = <?php 
        echo GFCommon::json_encode($notification);
        ?>
;

        function SetRoutingValueDropDown(element){
            //parsing ID to get routing Index
            var index = element.attr("id").replace("routing_value_", "");
            SetRouting(index);
        }

        /*
        REMOVE:
        function InsertVariable(element_id, callback, variable){
                if(!variable)
                    variable = jQuery('#' + element_id + '_variable_select').val();

                var messageElement = jQuery("#" + element_id);

                if(document.selection) {
                    // Go the IE way
                    messageElement[0].focus();
                    document.selection.createRange().text=variable;
                }
                else if(messageElement[0].selectionStart) {
                    // Go the Gecko way
                    obj = messageElement[0]
                    obj.value = obj.value.substr(0, obj.selectionStart) + variable + obj.value.substr(obj.selectionEnd, obj.value.length);
                }
                else {
                    messageElement.val(variable + messageElement.val());
                }

                jQuery('#' + element_id + '_variable_select')[0].selectedIndex = 0;


                if(callback && window[callback]){
                    window[callback].call(null, element_id, variable);
                }
        }*/

        function CreateRouting(routings){
            var str = "";
            for(var i=0; i< routings.length; i++){

                var isSelected = routings[i].operator == "is" ? "selected='selected'" :"";
                var isNotSelected = routings[i].operator == "isnot" ? "selected='selected'" :"";
                var greaterThanSelected = routings[i].operator == ">" ? "selected='selected'" :"";
                var lessThanSelected = routings[i].operator == "<" ? "selected='selected'" :"";
                var containsSelected = routings[i].operator == "contains" ? "selected='selected'" :"";
                var startsWithSelected = routings[i].operator == "starts_with" ? "selected='selected'" :"";
                var endsWithSelected = routings[i].operator == "ends_with" ? "selected='selected'" :"";
                var email = routings[i]["email"] ? routings[i]["email"] : '';

                str += "<div style='width:99%'><?php 
        _e("Send to", "gravityforms");
        ?>
 <input type='text' id='routing_email_" + i +"' value='" + email + "' onkeyup='SetRouting(" + i + ");'/>";
                str += " <?php 
        _e("if", "gravityforms");
        ?>
 " + GetRoutingFields(i, routings[i].fieldId);
                str += "<select id='routing_operator_" + i + "' onchange='SetRouting(" + i + ");' class='gform_routing_operator'>";
                str += "<option value='is' " + isSelected + "><?php 
        _e("is", "gravityforms");
        ?>
</option>";
                str += "<option value='isnot' " + isNotSelected + "><?php 
        _e("is not", "gravityforms");
        ?>
</option>";
                str += "<option value='>' " + greaterThanSelected + "><?php 
        _e("greater than", "gravityforms");
        ?>
</option>";
                str += "<option value='<' " + lessThanSelected + "><?php 
        _e("less than", "gravityforms");
        ?>
</option>";
                str += "<option value='contains' " + containsSelected + "><?php 
        _e("contains", "gravityforms");
        ?>
</option>";
                str += "<option value='starts_with' " + startsWithSelected + "><?php 
        _e("starts with", "gravityforms");
        ?>
</option>";
                str += "<option value='ends_with' " + endsWithSelected + "><?php 
        _e("ends with", "gravityforms");
        ?>
</option>";
                str += "</select>";
                str += GetRoutingValues(i, routings[i].fieldId, routings[i].value);
                str += "<img src='<?php 
        echo GFCommon::get_base_url();
        ?>
/images/add.png' class='add_field_choice' title='add another rule' alt='add another rule' style='cursor:pointer; margin:0 3px;' onclick=\"InsertRouting(" + (i+1) + ");\" />";
                if(routings.length > 1 )
                    str += "<img src='<?php 
        echo GFCommon::get_base_url();
        ?>
/images/remove.png' title='remove this rule' alt='remove this rule' class='delete_field_choice' style='cursor:pointer;' onclick=\"DeleteRouting(" + i + ");\" /></li>";

                str += "</div>";
            }

            jQuery("#gform_notification_to_routing_rules").html(str);
        }

        function GetRoutingValues(index, fieldId, selectedValue){
            str = GetFieldValues(index, fieldId, selectedValue, 16);

            return str;
        }

        function GetRoutingFields(index, selectedItem){
            var str = "<select id='routing_field_id_" + index + "' class='gfield_routing_select' onchange='jQuery(\"#routing_value_" + index + "\").replaceWith(GetRoutingValues(" + index + ", jQuery(this).val())); SetRouting(" + index + "); '>";
            str += GetSelectableFields(selectedItem, 16);
            str += "</select>";

            return str;
        }

        //---------------------- generic ---------------
        function GetSelectableFields(selectedFieldId, labelMaxCharacters){
            var str = "";
            var inputType;
            for(var i=0; i<form.fields.length; i++){
                inputType = form.fields[i].inputType ? form.fields[i].inputType : form.fields[i].type;
                //see if this field type can be used for conditionals
                if (IsNotificationConditionalLogicField(form.fields[i])) {
                    var selected = form.fields[i].id == selectedFieldId ? "selected='selected'" : "";
                    str += "<option value='" + form.fields[i].id + "' " + selected + ">" + form.fields[i].label + "</option>";
                }
            }
            return str;
        }

        function IsNotificationConditionalLogicField(field){
        	//this function is a duplicate of IsConditionalLogicField from form_editor.js
		    inputType = field.inputType ? field.inputType : field.type;
		    var supported_fields = ["checkbox", "radio", "select", "text", "website", "textarea", "email", "hidden", "number", "phone", "multiselect", "post_title",
		                            "post_tags", "post_custom_field", "post_content", "post_excerpt"];

		    var index = jQuery.inArray(inputType, supported_fields);

		    return index >= 0;
		}

        function GetFirstSelectableField(){
            var inputType;
            for(var i=0; i<form.fields.length; i++){
                inputType = form.fields[i].inputType ? form.fields[i].inputType : form.fields[i].type;
                if (IsNotificationConditionalLogicField(form.fields[i])){
                    return form.fields[i].id;
				}
            }

            return 0;
        }

        function TruncateMiddle(text, maxCharacters){
            if(!text)
                return "";

            if(text.length <= maxCharacters)
                return text;
            var middle = parseInt(maxCharacters / 2);
            return text.substr(0, middle) + "..." + text.substr(text.length - middle, middle);

        }

        function GetFieldValues(index, fieldId, selectedValue, labelMaxCharacters){
            if(!fieldId)
                fieldId = GetFirstSelectableField();

            if(!fieldId)
                return "";

            var str = "";
            var field = GetFieldById(fieldId);
            var isAnySelected = false;

            if(!field)
        		return "";

            if(field["type"] == "post_category" && field["displayAllCategories"]){
            	var dropdown_id = "routing_value_" + index;
		        var dropdown = jQuery('#' + dropdown_id + ".gfield_category_dropdown");

		        //don't load category drop down if it already exists (to avoid unecessary ajax requests)
		        if(dropdown.length > 0){

		            var options = dropdown.html();
		            options = options.replace("value=\"" + selectedValue + "\"", "value=\"" + selectedValue + "\" selected=\"selected\"");
		            str = "<select id='" + dropdown_id + "' class='gfield_routing_select gfield_category_dropdown gfield_routing_value_dropdown'>" + options + "</select>";
		        }
		        else{
		            //loading categories via AJAX
		            jQuery.post(ajaxurl,{   action:"gf_get_notification_post_categories",
		                                    ruleIndex: index,
		                                    selectedValue: selectedValue},
		                                function(dropdown_string){
		                                    if(dropdown_string){
		                                        jQuery('#gfield_ajax_placeholder_' + index).replaceWith(dropdown_string.trim());
		                                    }
		                                }
		                        );

		            //will be replaced by real drop down during the ajax callback
		            str = "<select id='gfield_ajax_placeholder_" + index + "' class='gfield_routing_select'><option><?php 
        _e("Loading...", "gravityforms");
        ?>
</option></select>";
		        }
			}
            else if(field.choices){
            	//create a drop down for fields that have choices (i.e. drop down, radio, checkboxes, etc...)
	            str = "<select class='gfield_routing_select gfield_routing_value_dropdown' id='routing_value_" + index + "'>";
	            for(var i=0; i<field.choices.length; i++){
	                var choiceValue = field.choices[i].value ? field.choices[i].value : field.choices[i].text;
	                var isSelected = choiceValue == selectedValue;
	                var selected = isSelected ? "selected='selected'" : "";
	                if(isSelected)
	                    isAnySelected = true;

	                str += "<option value='" + choiceValue.replace(/'/g, "&#039;") + "' " + selected + ">" + field.choices[i].text + "</option>";
	            }

	            if(!isAnySelected && selectedValue){
	                str += "<option value='" + selectedValue.replace(/'/g, "&#039;") + "' selected='selected'>" + selectedValue + "</option>";
	            }
	            str += "</select>";
			}
			else
			{
			    selectedValue = selectedValue ? selectedValue.replace(/'/g, "&#039;") : "";
			    //create a text field for fields that don't have choices (i.e text, textarea, number, email, etc...)
			    str = "<input type='text' placeholder='<?php 
        _e("Enter value", "gravityforms");
        ?>
' class='gfield_routing_select' id='routing_value_" + index + "' value='" + selectedValue.replace(/'/g, "&#039;") + "' onchange='SetRouting(" + index + ");' onkeyup='SetRouting(" + index + ");'>";
			}
            return str;
        }

        function GetFieldById(fieldId){
            for(var i=0; i<form.fields.length; i++){
                if(form.fields[i].id == fieldId)
                    return form.fields[i];
            }
            return null;
        }
        //---------------------------------------------------------------------------------

        function InsertRouting(index){
            var routings = current_notification.routing;
            routings.splice(index, 0, new ConditionalRule());

            CreateRouting(routings);
            SetRouting(index);
        }

        function SetRouting(ruleIndex){
            if(!current_notification.routing && ruleIndex == 0)
                current_notification.routing = [new ConditionalRule()];

            current_notification.routing[ruleIndex]["email"] = jQuery("#routing_email_" + ruleIndex).val();
            current_notification.routing[ruleIndex]["fieldId"] = jQuery("#routing_field_id_" + ruleIndex).val();
            current_notification.routing[ruleIndex]["operator"] = jQuery("#routing_operator_" + ruleIndex).val();
            current_notification.routing[ruleIndex]["value"] =jQuery("#routing_value_" + ruleIndex).val();

            var json = jQuery.toJSON(current_notification.routing);
            jQuery('#gform_routing_meta').val(json);
        }

        function DeleteRouting(ruleIndex){
            current_notification.routing.splice(ruleIndex, 1);
            CreateRouting(current_notification.routing);
        }

        function SetConditionalLogic(isChecked){
            current_notification.conditionalLogic = isChecked ? new ConditionalLogic() : null;
        }

        function SaveJSMeta(){
            jQuery('#gform_routing_meta').val(jQuery.toJSON(current_notification.routing));
            jQuery('#gform_conditional_logic_meta').val(jQuery.toJSON(current_notification.conditionalLogic));
        }

        </script>

        <form method="post" id="gform_notification_form" onsubmit="gform_has_unsaved_changes = false; SaveJSMeta();">

            <?php 
        wp_nonce_field('gforms_save_notification', 'gforms_save_notification');
        ?>
            <input type="hidden" id="gform_routing_meta" name="gform_routing_meta" />
            <input type="hidden" id="gform_conditional_logic_meta" name="gform_conditional_logic_meta" />
            <input type="hidden" id="gform_notification_id" name="gform_notification_id" value="<?php 
        echo $notification_id;
        ?>
" />

            <table class="form-table gform_nofification_edit">
                <?php 
        array_map(array('GFFormSettings', 'output'), $notification_ui_settings);
        ?>
            </table>

            <p class="submit">
                <?php 
        $button_label = $is_new_notification ? __("Save Notification", "gravityforms") : __("Update Notification", "gravityforms");
        $notification_button = '<input class="button-primary" type="submit" value="' . $button_label . '" name="save"/>';
        echo apply_filters("gform_save_notification_button", $notification_button);
        ?>
            </p>
        </form>

        <?php 
    }
Exemplo n.º 10
0
    public static function export_lead_page()
    {
        self::page_header(__('Export Entries'));
        ?>

        <script type="text/javascript">

            var gfSpinner;

            <?php 
        GFCommon::gf_global();
        ?>
            <?php 
        GFCommon::gf_vars();
        ?>

            function SelectExportForm(formId){

                if(!formId)
                    return;

                gfSpinner = new gfAjaxSpinner(jQuery('select#export_form'), gf_vars.baseUrl + '/images/spinner.gif', 'position: relative; top: 2px; left: 5px;');

                var mysack = new sack("<?php 
        echo admin_url("admin-ajax.php");
        ?>
" );
                mysack.execute = 1;
                mysack.method = 'POST';
                mysack.setVar( "action", "rg_select_export_form" );
                mysack.setVar( "rg_select_export_form", "<?php 
        echo wp_create_nonce("rg_select_export_form");
        ?>
" );
                mysack.setVar( "form_id", formId);
                mysack.onError = function() { alert('<?php 
        echo esc_js(__("Ajax error while selecting a form", "gravityforms"));
        ?>
' )};
                mysack.runAJAX();

                return true;
            }

            function EndSelectExportForm(aryFields){

                gfSpinner.destroy();

                if(aryFields.length == 0)
                {
                    jQuery("#export_field_container, #export_date_container, #export_submit_container").hide()
                    return;
                }

                var fieldList = "<li><input id='select_all' type='checkbox' onclick=\"jQuery('.gform_export_field').attr('checked', this.checked); jQuery('#gform_export_check_all').html(this.checked ? '<strong><?php 
        _e("Deselect All", "gravityforms");
        ?>
</strong>' : '<strong><?php 
        _e("Select All", "gravityforms");
        ?>
</strong>'); \"> <label id='gform_export_check_all' for='select_all'><strong><?php 
        _e("Select All", "gravityforms");
        ?>
</strong></label></li>";
                for(var i=0; i<aryFields.length; i++){
                    fieldList += "<li><input type='checkbox' id='export_field_" + i + "' name='export_field[]' value='" + aryFields[i][0] + "' class='gform_export_field'> <label for='export_field_" + i + "'>" + aryFields[i][1] + "</label></li>";
                }
                jQuery("#export_field_list").html(fieldList);
                jQuery("#export_date_start, #export_date_end").datepicker({dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true});

                jQuery("#export_field_container, #export_date_container, #export_submit_container").hide().show();
            }
        </script>

        <p class="textleft"><?php 
        _e("Select a form below to export entries. Once you have selected a form you may select the fields you would like to export and an optional date range. When you click the download button below, Gravity Forms will create a CSV file for you to save to your computer.", "gravityforms");
        ?>
</p>
        <div class="hr-divider"></div>
        <form method="post" style="margin-top:10px;">
            <?php 
        echo wp_nonce_field("rg_start_export", "rg_start_export_nonce");
        ?>
            <table class="form-table">
              <tr valign="top">

                   <th scope="row"><label for="export_form"><?php 
        _e("Select A Form", "gravityforms");
        ?>
</label> <?php 
        gform_tooltip("export_select_form");
        ?>
</th>
                    <td>

                      <select id="export_form" name="export_form" onchange="SelectExportForm(jQuery(this).val());">
                        <option value=""><?php 
        _e("Select a form", "gravityforms");
        ?>
</option>
                        <?php 
        $forms = RGFormsModel::get_forms(null, "title");
        foreach ($forms as $form) {
            ?>
                            <option value="<?php 
            echo absint($form->id);
            ?>
"><?php 
            echo esc_html($form->title);
            ?>
</option>
                            <?php 
        }
        ?>
                    </select>

                    </td>
                </tr>
              <tr id="export_field_container" valign="top" style="display: none;">
                   <th scope="row"><label for="export_fields"><?php 
        _e("Select Fields", "gravityforms");
        ?>
</label> <?php 
        gform_tooltip("export_select_fields");
        ?>
</th>
                    <td>
                        <ul id="export_field_list">
                        </ul>
                    </td>
               </tr>
              <tr id="export_date_container" valign="top" style="display: none;">
                   <th scope="row"><label for="export_date"><?php 
        _e("Select Date Range", "gravityforms");
        ?>
</label> <?php 
        gform_tooltip("export_date_range");
        ?>
</th>
                    <td>
                        <div>
                            <span style="width:150px; float:left; ">
                                <input type="text" id="export_date_start" name="export_date_start" style="width:90%"/>
                                <strong><label for="export_date_start" style="display:block;"><?php 
        _e("Start", "gravityforms");
        ?>
</label></strong>
                            </span>

                            <span style="width:150px; float:left;">
                                <input type="text" id="export_date_end" name="export_date_end" style="width:90%"/>
                                <strong><label for="export_date_end" style="display:block;"><?php 
        _e("End", "gravityforms");
        ?>
</label></strong>
                            </span>
                            <div style="clear: both;"></div>
                            <?php 
        _e("Date Range is optional, if no date range is selected all entries will be exported.", "gravityforms");
        ?>
                        </div>
                    </td>
               </tr>
            </table>
            <ul>
                <li id="export_submit_container" style="display:none; clear:both;">
                    <br/><br/>
                    <input type="submit" name="export_lead" value="<?php 
        _e("Download Export File", "gravityforms");
        ?>
" class="button button-large button-primary"/>
                    <span id="please_wait_container" style="display:none; margin-left:15px;">
                        <img src="<?php 
        echo GFCommon::get_base_url();
        ?>
/images/loading.gif"> <?php 
        _e("Exporting entries. Please wait...", "gravityforms");
        ?>
                    </span>

                    <iframe id="export_frame" width="1" height="1" src="about:blank"></iframe>
                </li>
            </ul>
        </form>

        <?php 
        self::page_footer(__('Export Entries'));
    }
        $js_form = gf_apply_filters(array('gform_admin_pre_render', $form_id), $js_form);
    }
    ?>

							<?php 
}
?>
						</select>

						<?php 
if (isset($js_form)) {
    $_GET['id'] = $form_id;
    printf('<script type="text/javascript">
									var form = %s;
									%s
								</script>', json_encode($js_form), GFCommon::gf_vars(false));
}
?>

					</td>
				</tr>
				<tr>
					<th scope="row">
						<label for="_pronamic_pay_gf_config_id">
							<?php 
esc_html_e('Configuration', 'pronamic_ideal');
?>
						</label>

						<span class="dashicons dashicons-editor-help pronamic-pay-tip" data-tip="<?php 
esc_attr_e('Gateway configuration, created via <strong>iDEAL » Configurations</strong>.', 'pronamic_ideal');
Exemplo n.º 12
0
    public static function leads_page($form_id)
    {
        global $wpdb;
        //quit if version of wp is not supported
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        echo GFCommon::get_remote_message();
        $faire = isset($_GET['faire']) ? $_GET['faire'] : '';
        $action = RGForms::post('action');
        $filter = rgget('filter');
        $search = stripslashes(rgget('s'));
        $page_index = empty($_GET['paged']) ? 0 : intval($_GET['paged']) - 1;
        $star = $filter == 'star' ? 1 : null;
        $read = $filter == 'unread' ? 0 : null;
        $status = in_array($filter, array('trash', 'spam')) ? $filter : 'active';
        $form = RGFormsModel::get_form_meta($form_id);
        $choices = array();
        foreach ($form['fields'] as $key => $entry) {
            if ($entry['displayAllCategories'] == true) {
                //build choices array
                $args = array('type' => 'post', 'orderby' => 'name', 'order' => 'ASC', 'taxonomy' => 'category');
                $categories = get_categories($args);
                foreach ($categories as $category) {
                    $choices[] = array("text" => $category->name, "value" => $category->name . ':' . $category->cat_ID);
                    //$inputs[] = array("label" => $category->name, "id" => "3.".$x); // replace the 3 in "3." with your field ID.
                }
                $form['fields'][$key]['choices'] = $choices;
            }
        }
        $search_criteria['status'] = $status;
        if ($star) {
            $search_criteria['field_filters'][] = array('key' => 'is_starred', 'value' => (bool) $star);
        }
        if (!is_null($read)) {
            $search_criteria['field_filters'][] = array('key' => 'is_read', 'value' => (bool) $read);
        }
        $search_field_id = rgget('field_id');
        $search_operator = rgget('operator');
        /*logic to allow multiple filters to be set */
        if (isset($_GET['filterField']) && is_array($_GET['filterField'])) {
            foreach ($_GET['filterField'] as $key => $value) {
                $filterValues = explode("|", $value);
                $key = $filterValues[0];
                $search_operFF = $filterValues[1];
                $val = $filterValues[2];
                //let's check if an entry ID was entered in the 'All form fields' filter
                if ($key == 0 && is_numeric($val)) {
                    $entry = GFAPI::get_entry($val);
                    if (is_array($entry)) {
                        $key = 'entry_id';
                        $search_operFF = 'is';
                    }
                }
                $filter_operator = empty($search_operFF) ? 'is' : $search_operFF;
                $field = GFFormsModel::get_field($form, $key);
                if ($field) {
                    $input_type = GFFormsModel::get_input_type($field);
                    if ($field->type == 'product' && in_array($input_type, array('radio', 'select'))) {
                        $filter_operator = 'contains';
                    }
                }
                $search_criteria['field_filters'][] = array('key' => $key, 'operator' => $filter_operator, 'value' => $val);
            }
        }
        //var_dump($search_criteria['field_filters']);
        /*
        		if ( isset( $_GET['field_id'] ) && $_GET['field_id'] !== '' ) {
        			$key            = $search_field_id;
        			$val            = stripslashes( rgget( 's' ) );
        			$strpos_row_key = strpos( $search_field_id, '|' );
        			if ( $strpos_row_key !== false ) { //multi-row likert
        				$key_array = explode( '|', $search_field_id );
        				$key       = $key_array[0];
        				$val       = $key_array[1] . ':' . $val;
        			}
        			if ( 'entry_id' == $key ) {
        				$key = 'id';
        			}
        			$filter_operator = empty( $search_operator ) ? 'is' : $search_operator;
        
        			$field = GFFormsModel::get_field( $form, $key );
        			if ( $field ) {
        				$input_type = GFFormsModel::get_input_type( $field );
        				if ( $field->type == 'product' && in_array( $input_type, array( 'radio', 'select' ) ) ) {
        					$filter_operator = 'contains';
        				}
        			}
        		}*/
        $update_message = '';
        switch ($action) {
            case 'delete':
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $lead_id = $_POST['action_argument'];
                if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                    RGFormsModel::delete_lead($lead_id);
                    $update_message = __('Entry deleted.', 'gravityforms');
                } else {
                    $update_message = __("You don't have adequate permission to delete entries.", 'gravityforms');
                }
                break;
            case 'bulk':
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $bulk_action = !empty($_POST['bulk_action']) ? $_POST['bulk_action'] : $_POST['bulk_action2'];
                $select_all = rgpost('all_entries');
                $leads = empty($select_all) ? $_POST['lead'] : GFFormsModel::search_lead_ids($form_id, $search_criteria);
                $entry_count = count($leads) > 1 ? sprintf(__('%d entries', 'gravityforms'), count($leads)) : __('1 entry', 'gravityforms');
                switch ($bulk_action) {
                    case 'delete':
                        if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                            RGFormsModel::delete_leads($leads);
                            $update_message = sprintf(__('%s deleted.', 'gravityforms'), $entry_count);
                        } else {
                            $update_message = __("You don't have adequate permission to delete entries.", 'gravityforms');
                        }
                        break;
                    case 'trash':
                        RGFormsModel::update_leads_property($leads, 'status', 'trash');
                        $update_message = sprintf(__('%s moved to Trash.', 'gravityforms'), $entry_count);
                        break;
                    case 'restore':
                        RGFormsModel::update_leads_property($leads, 'status', 'active');
                        $update_message = sprintf(__('%s restored from the Trash.', 'gravityforms'), $entry_count);
                        break;
                    case 'unspam':
                        RGFormsModel::update_leads_property($leads, 'status', 'active');
                        $update_message = sprintf(__('%s restored from the spam.', 'gravityforms'), $entry_count);
                        break;
                    case 'spam':
                        RGFormsModel::update_leads_property($leads, 'status', 'spam');
                        $update_message = sprintf(__('%s marked as spam.', 'gravityforms'), $entry_count);
                        break;
                    case 'mark_read':
                        RGFormsModel::update_leads_property($leads, 'is_read', 1);
                        $update_message = sprintf(__('%s marked as read.', 'gravityforms'), $entry_count);
                        break;
                    case 'mark_unread':
                        RGFormsModel::update_leads_property($leads, 'is_read', 0);
                        $update_message = sprintf(__('%s marked as unread.', 'gravityforms'), $entry_count);
                        break;
                    case 'add_star':
                        RGFormsModel::update_leads_property($leads, 'is_starred', 1);
                        $update_message = sprintf(__('%s starred.', 'gravityforms'), $entry_count);
                        break;
                    case 'remove_star':
                        RGFormsModel::update_leads_property($leads, 'is_starred', 0);
                        $update_message = sprintf(__('%s unstarred.', 'gravityforms'), $entry_count);
                        break;
                }
                break;
            case 'change_columns':
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $columns = GFCommon::json_decode(stripslashes($_POST['grid_columns']), true);
                RGFormsModel::update_grid_column_meta($form_id, $columns);
                break;
        }
        if (rgpost('button_delete_permanently')) {
            if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                RGFormsModel::delete_leads_by_form($form_id, $filter);
            }
        }
        $sort_field = empty($_GET['sort']) ? 0 : $_GET['sort'];
        $sort_direction = empty($_GET['dir']) ? 'DESC' : $_GET['dir'];
        $sort_field_meta = RGFormsModel::get_field($form, $sort_field);
        $is_numeric = $sort_field_meta['type'] == 'number';
        $page_size = 50;
        //apply_filters( 'gform_entry_page_size', apply_filters( "gform_entry_page_size_{$form_id}", 20, $form_id ), $form_id );
        $first_item_index = $page_index * $page_size;
        if (!empty($sort_field)) {
            $sorting = array('key' => $_GET['sort'], 'direction' => $sort_direction, 'is_numeric' => $is_numeric);
        } else {
            $sorting = array();
        }
        $paging = array('offset' => $first_item_index, 'page_size' => $page_size);
        $total_count = 0;
        $form_ids = $form_id;
        global $wpdb;
        if ($faire != '') {
            $form_id = 9;
            //let's get the form id's for this faire
            $sql = "select * from wp_mf_faire where faire='" . $faire . "'";
            $Fresults = $wpdb->get_results($sql);
            if (!empty($Fresults)) {
                $form_ids = explode(',', $Fresults[0]->form_ids);
            } else {
                $form_ids = 99999999;
            }
        }
        $leads = GFAPI::get_entries($form_ids, $search_criteria, $sorting, $paging, $total_count);
        /* filter results based on star rating */
        $summary = RGFormsModel::get_form_counts($form_ids);
        $active_lead_count = $summary['total'];
        $unread_count = $summary['unread'];
        $starred_count = $summary['starred'];
        $spam_count = $summary['spam'];
        $trash_count = $summary['trash'];
        $columns = RGFormsModel::get_grid_columns($form_id, true);
        /* build filterField array for link */
        $outputVar = '';
        if (isset($_GET['filterField'])) {
            foreach ($_GET['filterField'] as $newValue) {
                $outputVar .= '&filterField[]=' . $newValue;
            }
        }
        if (isset($faire) && $faire != '') {
            $outputVar .= '&faire=' . $faire;
        }
        //$search_qs                  = empty( $search ) ? '' : '&s=' . urlencode( $search );
        $sort_qs = empty($sort_field) ? '' : "&sort={$sort_field}";
        $dir_qs = empty($sort_field) ? '' : "&dir={$sort_direction}";
        $star_qs = $star !== null ? "&star={$star}" : '';
        $read_qs = $read !== null ? "&read={$read}" : '';
        $filter_qs = $filter != '' ? '&filter=' . $filter : '';
        //$search_field_id_qs         = ! isset( $_GET['field_id'] ) ? '' : "&field_id=$search_field_id";
        //$search_operator_urlencoded = urlencode( $search_operator );
        //$search_operator_qs         = empty( $search_operator_urlencoded ) ? '' : "&operator=$search_operator_urlencoded";
        $display_total = ceil($total_count / $page_size);
        $page_links = paginate_links(array('base' => admin_url('admin.php') . "?page=mf_entries&view=entries&id={$form_id}&%_%" . $outputVar . $sort_qs . $dir_qs . $star_qs . $read_qs . $filter_qs, 'format' => 'paged=%#%', 'prev_text' => __('&laquo;', 'gravityforms'), 'next_text' => __('&raquo;', 'gravityforms'), 'total' => $display_total, 'current' => $page_index + 1, 'show_all' => false));
        wp_print_styles(array('thickbox'));
        $field_filters = GFCommon::get_field_filter_settings($form);
        //MF-295 - Request from Kate to move these filters to the top
        /* Entry ID(entry_id), Status(303), Flags(304), and Location(302) to the top */
        $topFields = array('entry_id', 302, 304, 303);
        $newFilter = $field_filters;
        //find the array key for the top filter fields
        foreach ($field_filters as $fieldKey => $field) {
            if (in_array($field['key'], $topFields)) {
                $topFieldsData[] = $field;
                //unset these keys
                unset($newFilter[$fieldKey]);
            }
        }
        //recreate the array with the top filter fields at the top
        $field_filters = array_merge($topFieldsData, $newFilter);
        $init_field_id = empty($search_field_id) ? 0 : $search_field_id;
        $init_field_operator = empty($search_operator) ? 'contains' : $search_operator;
        $init_filter_vars = array('mode' => 'off', 'filters' => array(array('field' => $init_field_id, 'operator' => $init_field_operator, 'value' => $search)));
        ?>

		<script type="text/javascript">
                   
                var get_params = function(search_string) {

                        var parse = function(params, pairs) {
                            var pair = pairs[0];
                            var parts = pair.split('=');
                            var key   = decodeURIComponent(parts[0]);
                            var value = decodeURIComponent(parts.slice(1).join('='));
                            //is key an array?
                            if(key.indexOf('[') > -1){
                                //yes, remove the [x] part
                                var newparts = key.split('[');
                                key   = decodeURIComponent(newparts[0]);
                            }
                            
                            // Handle multiple parameters of the same name
                              if (typeof params[key] === "undefined") {
                                params[key] = value;
                              } else {
                                params[key] = [].concat(params[key], value);
                              }
                                                                                                                                
                          return pairs.length == 1 ? params : parse(params, pairs.slice(1))
                        }

                        // Get rid of leading ?
                        return search_string.length == 0 ? {} : parse({}, search_string.substr(1).split('&'));
                      }
                var params = get_params(location.search);  
               
                <?php 
        GFCommon::gf_global();
        ?>
			<?php 
        GFCommon::gf_vars();
        ?>
		var messageTimeout = false,
			gformFieldFilters = <?php 
        echo json_encode($field_filters);
        ?>
,
			gformInitFilter = <?php 
        echo json_encode($init_filter_vars);
        ?>

				function ChangeColumns(columns) {
					jQuery("#action").val("change_columns");
					jQuery("#grid_columns").val(jQuery.toJSON(columns));
					tb_remove();
					jQuery("#lead_form")[0].submit();
				}

		function Search(sort_field_id, sort_direction, form_id, search, star, read, filter, field_id, operator) {
			var faire = "&faire="+jQuery('#faire').val();
			var star_qs = star == "" ? "" : "&star=" + star;
			var read_qs = read == "" ? "" : "&read=" + read;
			var filter_qs = filter == "" ? "" : "&filter=" + filter;
                        
                        //add to filter array
                        var filterField="";              
                        //first, check if there are other filters set in the url
                        // if there are, be sure to include them   
                        if(params['filterField'] != undefined){                                                                   
                            if(jQuery.isArray(params['filterField'])){
                                //if the paramater filterField is an array, loop thru all to add
                                var arrayLength = params['filterField'].length;
                                for (var i = 0; i < arrayLength; i++) {

                                    filterField =filterField+"&filterField[]="+params['filterField'][i];

                                }    
                            }else{
                                //if not an array, just add the field                            
                                    filterField = filterField+"&filterField[]="+params['filterField'];                            
                            }
                        }
                        
                        
                        if(search!=""){
                            filterField = filterField + "&filterField[]="+encodeURIComponent(field_id+"|"+operator+"|"+ search);                            
                        }
                        
                        /*
                        var search_qs = search == "" ? "" : "&s=" + encodeURIComponent(search);
			var field_id_qs = field_id == "" ? "" : "&field_id=" + field_id;
			var operator_qs = operator == "" ? "" : "&operator=" + operator;
                           */
			var location = "?page=mf_entries&view=entries&id=" + form_id + "&sort=" + sort_field_id + "&dir=" + sort_direction + filterField + star_qs + read_qs + filter_qs + faire;
			document.location = location;
		}
                                
		function ToggleStar(img, lead_id, filter) {
			var is_starred = img.src.indexOf("star1.png") >= 0
			if (is_starred)
				img.src = img.src.replace("star1.png", "star0.png");
			else
				img.src = img.src.replace("star0.png", "star1.png");

			jQuery("#lead_row_" + lead_id).toggleClass("lead_starred");
			//if viewing the starred entries, hide the row and adjust the paging counts
			if (filter == "star") {
				var title = jQuery("#lead_row_" + lead_id);
				title.css("display", 'none');
				UpdatePagingCounts(1);
			}

			UpdateCount("star_count", is_starred ? -1 : 1);

			UpdateLeadProperty(lead_id, "is_starred", is_starred ? 0 : 1);
		}

		function ToggleRead(lead_id, filter) {
			var title = jQuery("#lead_row_" + lead_id);
			marking_read = title.hasClass("lead_unread");

			jQuery("#mark_read_" + lead_id).css("display", marking_read ? "none" : "inline");
			jQuery("#mark_unread_" + lead_id).css("display", marking_read ? "inline" : "none");
			jQuery("#is_unread_" + lead_id).css("display", marking_read ? "inline" : "none");
			title.toggleClass("lead_unread");
			//if viewing the unread entries, hide the row and adjust the paging counts
			if (filter == "unread") {
				title.css("display", "none");
				UpdatePagingCounts(1);
			}

			UpdateCount("unread_count", marking_read ? -1 : 1);
			UpdateLeadProperty(lead_id, "is_read", marking_read ? 1 : 0);
		}

		function UpdateLeadProperty(lead_id, name, value) {
			var mysack = new sack("<?php 
        echo admin_url('admin-ajax.php');
        ?>
");
			mysack.execute = 1;
			mysack.method = 'POST';
			mysack.setVar("action", "rg_update_lead_property");
			mysack.setVar("rg_update_lead_property", "<?php 
        echo wp_create_nonce('rg_update_lead_property');
        ?>
");
			mysack.setVar("lead_id", lead_id);
			mysack.setVar("name", name);
			mysack.setVar("value", value);
			mysack.onError = function () {
				alert('<?php 
        echo esc_js(__('Ajax error while setting lead property', 'gravityforms'));
        ?>
')
			};
			mysack.runAJAX();

			return true;
		}

		function UpdateCount(element_id, change) {
			var element = jQuery("#" + element_id);
			var count = parseInt(element.html()) + change
			element.html(count + "");
		}

		function UpdatePagingCounts(change) {
			//update paging header/footer Displaying # - # of #, use counts from header, no need to use footer since they are the same, just update footer paging with header info
			var paging_range_max_header = jQuery("#paging_range_max_header");
			var paging_range_max_footer = jQuery("#paging_range_max_footer");
			var range_change_max = parseInt(paging_range_max_header.html()) - change;
			var paging_total_header = jQuery("#paging_total_header");
			var paging_total_footer = jQuery("#paging_total_footer");
			var total_change = parseInt(paging_total_header.html()) - change;
			var paging_range_min_header = jQuery("#paging_range_min_header");
			var paging_range_min_footer = jQuery("#paging_range_min_footer");
			//if min and max are the same, this is the last entry item on the page, clear out the displaying # - # of # text
			if (parseInt(paging_range_min_header.html()) == parseInt(paging_range_max_header.html())) {
				var paging_header = jQuery("#paging_header");
				paging_header.html("");
				var paging_footer = jQuery("#paging_footer");
				paging_footer.html("");
			}
			else {
				paging_range_max_header.html(range_change_max + "");
				paging_range_max_footer.html(range_change_max + "");
				paging_total_header.html(total_change + "");
				paging_total_footer.html(total_change + "");
			}
			gformVars.countAllEntries = gformVars.countAllEntries - change;
			setSelectAllText();
		}

		function DeleteLead(lead_id) {
			jQuery("#action").val("delete");
			jQuery("#action_argument").val(lead_id);
			jQuery("#lead_form")[0].submit();
			return true;
		}

		function handleBulkApply(actionElement) {

			var action = jQuery("#" + actionElement).val();
			var defaultModalOptions = '';
			var leadIds = getLeadIds();

			if (leadIds.length == 0) {
				alert('<?php 
        _e('Please select at least one entry.', 'gravityforms');
        ?>
');
				return false;
			}

			switch (action) {

				case 'resend_notifications':
					resetResendNotificationsUI();
					tb_show('<?php 
        _e('Resend Notifications', 'gravityforms');
        ?>
', '#TB_inline?width=350&amp;inlineId=notifications_modal_container', '');
					return false;
					break;

				case 'print':
					resetPrintUI();
					tb_show('<?php 
        _e('Print Entries', 'gravityforms');
        ?>
', '#TB_inline?width=350&amp;height=250&amp;inlineId=print_modal_container', '');
					return false;
					break;

				default:
					jQuery('#action').val('bulk');
			}

		}

		function getLeadIds() {
			var all = jQuery("#all_entries").val();
			//compare string, the boolean isn't correct, even when casting to a boolean the 0 is set to true
			if (all == "1")
				return 0;

			var leads = jQuery(".check-column input[name='lead[]']:checked");
			var leadIds = new Array();

			jQuery(leads).each(function (i) {
				leadIds[i] = jQuery(leads[i]).val();
			});

			return leadIds;
		}

		function BulkResendNotifications() {


			var selectedNotifications = new Array();
			jQuery(".gform_notifications:checked").each(function () {
				selectedNotifications.push(jQuery(this).val());
			});
			var leadIds = getLeadIds();

			var sendTo = jQuery('#notification_override_email').val();

			if (selectedNotifications.length <= 0) {
				displayMessage("<?php 
        _e('You must select at least one type of notification to resend.', 'gravityforms');
        ?>
", "error", "#notifications_container");
				return;
			}

			jQuery('#please_wait_container').fadeIn();

			jQuery.post(ajaxurl, {
					action                 : "gf_resend_notifications",
					gf_resend_notifications: '<?php 
        echo wp_create_nonce('gf_resend_notifications');
        ?>
',
					notifications          : jQuery.toJSON(selectedNotifications),
					sendTo                 : sendTo,
					leadIds                : leadIds,
					filter                 : '<?php 
        echo esc_attr(rgget('filter'));
        ?>
',
					search                 : '<?php 
        echo esc_attr(rgget('s'));
        ?>
',
					operator               : '<?php 
        echo esc_attr(rgget('operator'));
        ?>
',
					fieldId                : '<?php 
        echo esc_attr(rgget('field_id'));
        ?>
',
					formId                 : '<?php 
        echo $form['id'];
        ?>
'
				},
				function (response) {

					jQuery('#please_wait_container').hide();

					if (response) {
						displayMessage(response, 'error', '#notifications_container');
					} else {
						var message = '<?php 
        _e('Notifications for %s were resent successfully.', 'gravityforms');
        ?>
';
						var c = leadIds == 0 ? gformVars.countAllEntries : leadIds.length;
						displayMessage(message.replace('%s', c + ' ' + getPlural(c, '<?php 
        _e('entry', 'gravityforms');
        ?>
', '<?php 
        _e('entries', 'gravityforms');
        ?>
')), "updated", "#lead_form");
						closeModal(true);
					}

				}
			);

		}

		function resetResendNotificationsUI() {

			jQuery('#notification_admin, #notification_user').attr('checked', false);
			jQuery('#notifications_container .message, #notifications_override_settings').hide();

		}

		function BulkPrint() {

			var leadIds = getLeadIds();
			if (leadIds != 0)
				leadIds = leadIds.join(',');
			var leadsQS = '&lid=' + leadIds;
			var notesQS = jQuery('#gform_print_notes').is(':checked') ? '&notes=1' : '';
			var pageBreakQS = jQuery('#gform_print_page_break').is(':checked') ? '&page_break=1' : '';
			var filterQS = '&filter=<?php 
        echo esc_attr(rgget('filter'));
        ?>
';
			var searchQS = '&s=<?php 
        echo esc_attr(rgget('s'));
        ?>
';
			var searchFieldIdQS = '&field_id=<?php 
        echo esc_attr(rgget('field_id'));
        ?>
';
			var searchOperatorQS = '&operator=<?php 
        echo esc_attr(rgget('operator'));
        ?>
';

			var url = '<?php 
        echo trailingslashit(site_url());
        ?>
?gf_page=print-entry&fid=<?php 
        echo $form['id'];
        ?>
' + leadsQS + notesQS + pageBreakQS + filterQS + searchQS + searchFieldIdQS + searchOperatorQS;
			window.open(url, 'printwindow');

			closeModal(true);
			hideMessage('#lead_form', false);
		}

		function resetPrintUI() {

			jQuery('#print_options input[type="checkbox"]').attr('checked', false);

		}

		function displayMessage(message, messageClass, container) {

			hideMessage(container, true);

			var messageBox = jQuery('<div class="message ' + messageClass + '" style="display:none;"><p>' + message + '</p></div>');
			jQuery(messageBox).prependTo(container).slideDown();

			if (messageClass == 'updated')
				messageTimeout = setTimeout(function () {
					hideMessage(container, false);
				}, 10000);

		}

		function hideMessage(container, messageQueued) {

			if (messageTimeout)
				clearTimeout(messageTimeout);

			var messageBox = jQuery(container).find('.message');

			if (messageQueued)
				jQuery(messageBox).remove();
			else
				jQuery(messageBox).slideUp(function () {
					jQuery(this).remove();
				});

		}

		function closeModal(isSuccess) {

			if (isSuccess)
				jQuery('.check-column input[type="checkbox"]').attr('checked', false);

			tb_remove();

		}

		function getPlural(count, singular, plural) {
			return count > 1 ? plural : singular;
		}

		function toggleNotificationOverride(isInit) {

			if (isInit)
				jQuery('#notification_override_email').val('');

			if (jQuery(".gform_notifications:checked").length > 0) {
				jQuery('#notifications_override_settings').slideDown();
			} else {
				jQuery('#notifications_override_settings').slideUp(function () {
					jQuery('#notification_override_email').val('');
				});
			}

		}

		// Select All

		var gformStrings = {
			"allEntriesOnPageAreSelected": "<?php 
        printf(__('All %s{0}%s entries on this page are selected.', 'gravityforms'), '<strong>', '</strong>');
        ?>
",
			"selectAll"                  : "<?php 
        printf(__('Select all %s{0}%s entries.', 'gravityforms'), '<strong>', '</strong>');
        ?>
",
			"allEntriesSelected"         : "<?php 
        printf(__('All %s{0}%s entries have been selected.', 'gravityforms'), '<strong>', '</strong>');
        ?>
",
			"clearSelection"             : "<?php 
        _e('Clear selection', 'gravityforms');
        ?>
"
		}

		var gformVars = {
			"countAllEntries": <?php 
        echo intval($total_count);
        ?>
,
			"perPage"        : <?php 
        echo intval($page_size);
        ?>
		}

		function setSelectAllText() {
			var tr = getSelectAllText();
			jQuery("#gform-select-all-message td").html(tr);
		}

		function getSelectAllText() {
			var count;
			count = jQuery("#gf_entry_list tr:visible:not('#gform-select-all-message')").length;
			return gformStrings.allEntriesOnPageAreSelected.format(count) + " <a href='javascript:void(0)' onclick='selectAllEntriesOnAllPages();'>" + gformStrings.selectAll.format(gformVars.countAllEntries) + "</a>";
		}

		function getSelectAllTr() {
			var t = getSelectAllText();
			var colspan = jQuery("#gf_entry_list").find("tr:first td").length + 1;
			return "<tr id='gform-select-all-message' style='display:none;background-color:lightyellow;text-align:center;'><td colspan='{0}'>{1}</td></tr>".format(colspan, t);
		}
		function toggleSelectAll(visible) {
			if (gformVars.countAllEntries <= gformVars.perPage) {
				jQuery('#gform-select-all-message').hide();
				return;
			}

			if (visible)
				setSelectAllText();
			jQuery('#gform-select-all-message').toggle(visible);
		}


		function clearSelectAllEntries() {
			jQuery(".check-column input[type=checkbox]").prop('checked', false);
			clearSelectAllMessage();
		}

		function clearSelectAllMessage() {
			jQuery("#all_entries").val("0");
			jQuery("#gform-select-all-message").hide();
			jQuery("#gform-select-all-message td").html('');
		}

		function selectAllEntriesOnAllPages() {
			var trHtmlClearSelection;
			trHtmlClearSelection = gformStrings.allEntriesSelected.format(gformVars.countAllEntries) + " <a href='javascript:void(0);' onclick='clearSelectAllEntries();'>" + gformStrings.clearSelection + "</a>";
			jQuery("#all_entries").val("1");
			jQuery("#gform-select-all-message td").html(trHtmlClearSelection);
		}

		function initSelectAllEntries() {

			if (gformVars.countAllEntries > gformVars.perPage) {
				var tr = getSelectAllTr();
				jQuery("#gf_entry_list").prepend(tr);
				jQuery(".headercb").click(function () {
					toggleSelectAll(jQuery(this).prop('checked'));
				});
				jQuery("#gf_entry_list .check-column input[type=checkbox]").click(function () {
					clearSelectAllMessage();
				})
			}
		}

		String.prototype.format = function () {
			var args = arguments;
			return this.replace(/{(\d+)}/g, function (match, number) {
				return typeof args[number] != 'undefined' ? args[number] : match;
			});
		};

		// end Select All

		jQuery(document).ready(function () {


			var action = '<?php 
        echo $action;
        ?>
';
			var message = '<?php 
        echo $update_message;
        ?>
';
			if (action && message)
				displayMessage(message, 'updated', '#lead_form');

			var list = jQuery("#gf_entry_list").wpList({ alt: '<?php 
        echo esc_js(__('Entry List', 'gravityforms'));
        ?>
'});
			list.bind('wpListDelEnd', function (e, s, list) {

				var currentStatus = "<?php 
        echo $filter == 'trash' || $filter == 'spam' ? $filter : 'active';
        ?>
";
				var filter = "<?php 
        echo $filter;
        ?>
";
				var movingTo = "active";
				if (s.data.status == "trash")
					movingTo = "trash";
				else if (s.data.status == "spam")
					movingTo = "spam";
				else if (s.data.status == "delete")
					movingTo = "delete";

				var id = s.data.entry;
				var title = jQuery("#lead_row_" + id);
				var isUnread = title.hasClass("lead_unread");
				var isStarred = title.hasClass("lead_starred");

				if (movingTo != "delete") {
					//Updating All count
					var allCount = currentStatus == "active" ? -1 : 1;
					UpdateCount("all_count", allCount);

					//Updating Unread count
					if (isUnread) {
						var unreadCount = currentStatus == "active" ? -1 : 1;
						UpdateCount("unread_count", unreadCount);
					}

					//Updating Starred count
					if (isStarred) {
						var starCount = currentStatus == "active" ? -1 : 1;
						UpdateCount("star_count", starCount);
					}
				}

				//Updating Spam count
				if (currentStatus == "spam" || movingTo == "spam") {
					var spamCount = movingTo == "spam" ? 1 : -1;
					UpdateCount("spam_count", spamCount);
					//adjust paging counts
					if (filter == "spam") {
						UpdatePagingCounts(1);
					}
					else {
						UpdatePagingCounts(spamCount);
					}
				}

				//Updating trash count
				if (currentStatus == "trash" || movingTo == "trash") {
					var trashCount = movingTo == "trash" ? 1 : -1;
					UpdateCount("trash_count", trashCount);
					//adjust paging counts
					if (filter == "trash") {
						UpdatePagingCounts(1);
					}
					else {
						UpdatePagingCounts(trashCount);
					}
				}

			});

			initSelectAllEntries();

			jQuery('#entry_filters').gfFilterUI(gformFieldFilters, gformInitFilter, false);                        
			jQuery("#entry_filters").on("keypress", ".gform-filter-value", (function (event) {
				if (event.keyCode == 13) {
					Search('<?php 
        echo $sort_field;
        ?>
', '<?php 
        echo $sort_direction;
        ?>
', <?php 
        echo $form_id;
        ?>
, jQuery('.gform-filter-value').val(), '<?php 
        echo $star;
        ?>
', '<?php 
        echo $read;
        ?>
', '<?php 
        echo $filter;
        ?>
', jQuery('.gform-filter-field').val(), jQuery('.gform-filter-operator').val());
					event.preventDefault();
				}
			}));
		});


		</script>
		<link rel="stylesheet" href="<?php 
        echo GFCommon::get_base_url();
        ?>
/css/admin.css" type="text/css" />
		<style>
			/*#TB_window { height: 400px !important; }
			#TB_ajaxContent[style] { height: 370px !important; }*/
			.lead_unread a, .lead_unread td {
				font-weight: bold;
			}

			.lead_spam_trash a, .lead_spam_trash td {
				font-weight: normal;
			}

			.row-actions a {
				font-weight: normal;
			}

			.entry_nowrap {
				overflow: hidden;
				white-space: nowrap;
			}

			.message {
				margin: 15px 0 0 !important;
			}

			.gform-filter-operator {
				width: 100px
			}
		</style>


		<div class="wrap <?php 
        echo GFCommon::get_browser_class();
        ?>
">
		<h2 class="gf_admin_page_title">
                    <span><?php 
        _e('Entries', 'gravityforms');
        ?>
</span>
                    <span class="gf_admin_page_subtitle">
                        <?php 
        if ($faire == '') {
            ?>
                        <span class="gf_admin_page_formid">ID: <?php 
            echo $form['id'];
            ?>
</span>
                        <span class="gf_admin_page_formname"><?php 
            _e('Form Name', 'gravityforms');
            ?>
: <?php 
            echo $form['title'];
            ?>
</span>
                        <?php 
        } else {
            ?>
                            <span class="gf_admin_page_formid">Faire: <?php 
            echo $faire;
            ?>
</span>
                        <?php 
        }
        ?>
    
                <?php 
        if (isset($_GET['filterField'])) {
            ?>
                          
                            <?php 
            foreach ($_GET['filterField'] as $key => $value) {
                $strpos_row_key = strpos($value, '|');
                if ($strpos_row_key !== false) {
                    //multi-field filter
                    $filterValues = explode("|", $value);
                    if ($filterValues[0] == 'entry_id') {
                        $fieldName = 'Entry ID';
                    } elseif (is_numeric($filterValues[0]) && $filterValues[0] == 0) {
                        $fieldName = 'Any Form Field';
                    } else {
                        $field = GFFormsModel::get_field($form, $filterValues[0]);
                        if ($field) {
                            $fieldName = isset($field['adminLabel']) && $field['adminLabel'] != '' ? $field['adminLabel'] : $field['label'];
                        } else {
                            $fieldName = $filterValues[0];
                        }
                    }
                    $newArray = $_GET['filterField'];
                    $newOutput = '';
                    unset($newArray[$key]);
                    foreach ($newArray as $newValue) {
                        $newOutput .= '&filterField[]=' . $newValue;
                    }
                    //get admin title for the field.
                    $newURL = "?page=mf_entries&view=entries&id=" . $form_id;
                    $newURL .= $sort_field != '' ? "&sort=" . $sort_field : '';
                    $newURL .= $sort_direction != ' ' ? "&dir=" . $sort_direction : '';
                    $newURL .= $star != '' ? "&star=" . $star : '';
                    $newURL .= $read != '' ? "&read=" . $read : '';
                    $newURL .= $filter != '' ? "&filter=" . $filter : '';
                    $newURL .= $faire != '' ? "&faire=" . $faire : '';
                    $newURL .= $newOutput;
                    echo '<span class="gf_admin_page_formname">' . $fieldName . ($filterValues[1] != 'is' ? ' (' . $filterValues[1] . ') ' : '') . ': ' . $filterValues[2];
                    echo ' <a style="color:red" href="javascript:document.location = \'' . $newURL . '\';">X</a></span>';
                }
            }
            ?>
                            
        <?php 
        }
        ?>
    
                                            </span>
		</h2>
		<?php 
        echo self::return_navigation();
        ?>
                    <?php 
        RGForms::top_toolbar();
        ?>
                
		<form id="lead_form" method="post">
		
                <?php 
        wp_nonce_field('gforms_entry_list', 'gforms_entry_list');
        ?>

		<input type="hidden" value="" name="grid_columns" id="grid_columns" />
		<input type="hidden" value="" name="action" id="action" />
		<input type="hidden" value="" name="action_argument" id="action_argument" />
		<input type="hidden" value="" name="all_entries" id="all_entries" />
                <input type="hidden" value="<?php 
        echo $faire;
        ?>
" name="faire" id="faire" />
                
		<?php 
        //only display these links if we are looking at the homepage slider form
        if ($form_id == 24) {
            ?>
                <ul class="subsubsub">
			<li>
				<a class="<?php 
            echo empty($filter) ? 'current' : '';
            ?>
" href="?page=mf_entries&view=entries&id=<?php 
            echo $form_id;
            ?>
"><?php 
            _ex('All', 'Entry List', 'gravityforms');
            ?>
					<span class="count">(<span id="all_count"><?php 
            echo $active_lead_count;
            ?>
</span>)</span></a> |
			</li>
			<li>
				<a class="<?php 
            echo $read !== null ? 'current' : '';
            ?>
" href="?page=mf_entries&view=entries&id=<?php 
            echo $form_id;
            ?>
&filter=unread"><?php 
            _ex('Unread', 'Entry List', 'gravityforms');
            ?>
					<span class="count">(<span id="unread_count"><?php 
            echo $unread_count;
            ?>
</span>)</span></a> |
			</li>
			<li>
				<a class="<?php 
            echo $star !== null ? 'current' : '';
            ?>
" href="?page=mf_entries&view=entries&id=<?php 
            echo $form_id;
            ?>
&filter=star"><?php 
            _ex('Starred', 'Entry List', 'gravityforms');
            ?>
					<span class="count">(<span id="star_count"><?php 
            echo $starred_count;
            ?>
</span>)</span></a> |
			</li>
			<?php 
            if (GFCommon::spam_enabled($form_id)) {
                ?>
				<li>
					<a class="<?php 
                echo $filter == 'spam' ? 'current' : '';
                ?>
" href="?page=mf_entries&view=entries&id=<?php 
                echo $form_id;
                ?>
&filter=spam"><?php 
                _e('Spam', 'gravityforms');
                ?>
						<span class="count">(<span id="spam_count"><?php 
                echo $spam_count;
                ?>
</span>)</span></a> |
				</li>
			<?php 
            }
            ?>
			<li>
				<a class="<?php 
            echo $filter == 'trash' ? 'current' : '';
            ?>
" href="?page=mf_entries&view=entries&id=<?php 
            echo $form_id;
            ?>
&filter=trash"><?php 
            _e('Trash', 'gravityforms');
            ?>
					<span class="count">(<span id="trash_count"><?php 
            echo $trash_count;
            ?>
</span>)</span></a></li>
		</ul>
                <?php 
        }
        ?>
                
                
		<div style="margin-top:12px;float:right;">			
                        <div style="float:right">
                            <a style="float:right;" class="button" id="lead_search_button" href="javascript:Search('<?php 
        echo $sort_field;
        ?>
', '<?php 
        echo $sort_direction;
        ?>
', <?php 
        echo $form_id;
        ?>
, jQuery('.gform-filter-value').val(), '<?php 
        echo $star;
        ?>
', '<?php 
        echo $read;
        ?>
', '<?php 
        echo $filter;
        ?>
', jQuery('.gform-filter-field').val(), jQuery('.gform-filter-operator').val());"><?php 
        _e('Add Filter', 'gravityforms');
        ?>
</a>
                            <div id="entry_filters"></div>
                        </div>                        
		</div>
		<div class="tablenav">

			<div class="alignleft actions" style="padding:8px 0 7px 0;">
				<label class="hidden" for="bulk_action"> <?php 
        _e('Bulk action', 'gravityforms');
        ?>
</label>
				<select name="bulk_action" id="bulk_action">
					<option value=''><?php 
        _e(' Bulk action ', 'gravityforms');
        ?>
</option>
					<?php 
        switch ($filter) {
            case 'trash':
                ?>
							<option value='restore'><?php 
                _e('Restore', 'gravityforms');
                ?>
</option>
							<?php 
                if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                    ?>
								<option value='delete'><?php 
                    _e('Delete Permanently', 'gravityforms');
                    ?>
</option>
							<?php 
                }
                break;
            case 'spam':
                ?>
							<option value='unspam'><?php 
                _e('Not Spam', 'gravityforms');
                ?>
</option>
							<?php 
                if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                    ?>
								<option value='delete'><?php 
                    _e('Delete Permanently', 'gravityforms');
                    ?>
</option>
							<?php 
                }
                break;
            default:
                ?>
								<option value='mark_read'><?php 
                _e('Mark as Read', 'gravityforms');
                ?>
</option>
								<option value='mark_unread'><?php 
                _e('Mark as Unread', 'gravityforms');
                ?>
</option>
								<option value='add_star'><?php 
                _e('Add Star', 'gravityforms');
                ?>
</option>
								<option value='remove_star'><?php 
                _e('Remove Star', 'gravityforms');
                ?>
</option>
								<option value='resend_notifications'><?php 
                _e('Resend Notifications', 'gravityforms');
                ?>
</option>
								<option value='print'><?php 
                _e('Print', 'gravityforms');
                ?>
</option>

							<?php 
                if (GFCommon::spam_enabled($form_id)) {
                    ?>
								<option value='spam'><?php 
                    _e('Spam', 'gravityforms');
                    ?>
</option>
							<?php 
                }
                if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                    ?>
								<option value='trash'><?php 
                    _e('Trash', 'gravityforms');
                    ?>
</option>
							<?php 
                }
        }
        ?>
				</select>
				<?php 
        $apply_button = '<input type="submit" class="button" value="' . __('Apply', 'gravityforms') . '" onclick="return handleBulkApply(\'bulk_action\');" />';
        echo apply_filters('gform_entry_apply_button', $apply_button);
        if (in_array($filter, array('trash', 'spam'))) {
            $message = $filter == 'trash' ? __("WARNING! This operation cannot be undone. Empty trash? \\'Ok\\' to empty trash. \\'Cancel\\' to abort.", 'gravityforms') : __("WARNING! This operation cannot be undone. Permanently delete all spam? \\'Ok\\' to delete. \\'Cancel\\' to abort.", 'gravityforms');
            $button_label = $filter == 'trash' ? __('Empty Trash', 'gravityforms') : __('Delete All Spam', 'gravityforms');
            ?>
					<input type="submit" class="button" name="button_delete_permanently" value="<?php 
            echo $button_label;
            ?>
" onclick="return confirm('<?php 
            echo esc_attr($message);
            ?>
');" />
				<?php 
        }
        ?>
				<div id="notifications_modal_container" style="display:none;">
					<div id="notifications_container">

						<div id="post_tag" class="tagsdiv">
							<div id="resend_notifications_options">

								<?php 
        $notifications = GFCommon::get_notifications('resend_notifications', $form);
        if (!is_array($notifications) || count($form['notifications']) <= 0) {
            ?>
									<p class="description"><?php 
            _e('You cannot resend notifications for these entries because this form does not currently have any notifications configured.', 'gravityforms');
            ?>
</p>

									<a href="<?php 
            echo admin_url("admin.php?page=gf_edit_forms&view=settings&subview=notification&id={$form['id']}");
            ?>
" class="button"><?php 
            _e('Configure Notifications', 'gravityforms');
            ?>
</a>
								<?php 
        } else {
            ?>
									<p class="description"><?php 
            _e('Specify which notifications you would like to resend for the selected entries.', 'gravityforms');
            ?>
</p>
									<?php 
            foreach ($notifications as $notification) {
                ?>
										<input type="checkbox" class="gform_notifications" value="<?php 
                echo $notification['id'];
                ?>
" id="notification_<?php 
                echo $notification['id'];
                ?>
" onclick="toggleNotificationOverride();" />
										<label for="notification_<?php 
                echo $notification['id'];
                ?>
"><?php 
                echo $notification['name'];
                ?>
</label>
										<br /><br />
									<?php 
            }
            ?>
									<div id="notifications_override_settings" style="display:none;">

										<p class="description" style="padding-top:0; margin-top:0;">You may override the default notification settings
											by entering a comma delimited list of emails to which the selected notifications should be sent.</p>
										<label for="notification_override_email"><?php 
            _e('Send To', 'gravityforms');
            ?>
 <?php 
            gform_tooltip('notification_override_email');
            ?>
</label><br />
										<input type="text" name="notification_override_email" id="notification_override_email" style="width:99%;" /><br /><br />

									</div>

									<input type="button" name="notification_resend" id="notification_resend" value="<?php 
            _e('Resend Notifications', 'gravityforms');
            ?>
" class="button" style="" onclick="BulkResendNotifications();" />
									<span id="please_wait_container" style="display:none; margin-left: 5px;">
                                                <i class='gficon-gravityforms-spinner-icon gficon-spin'></i> <?php 
            _e('Resending...', 'gravityforms');
            ?>
                                            </span>
								<?php 
        }
        ?>

							</div>

							<div id="resend_notifications_close" style="display:none;margin:10px 0 0;">
								<input type="button" name="resend_notifications_close_button" value="<?php 
        _e('Close Window', 'gravityforms');
        ?>
" class="button" style="" onclick="closeModal(true);" />
							</div>

						</div>

					</div>
				</div>
				<!-- / Resend Notifications -->

				<div id="print_modal_container" style="display:none;">
					<div id="print_container">

						<div class="tagsdiv">
							<div id="print_options">

								<p class="description"><?php 
        _e('Print all of the selected entries at once.', 'gravityforms');
        ?>
</p>

								<?php 
        if (GFCommon::current_user_can_any('gravityforms_view_entry_notes')) {
            ?>
									<input type="checkbox" name="gform_print_notes" value="print_notes" checked="checked" id="gform_print_notes" />
									<label for="gform_print_notes"><?php 
            _e('Include notes', 'gravityforms');
            ?>
</label>
									<br /><br />
								<?php 
        }
        ?>

								<input type="checkbox" name="gform_print_page_break" value="print_notes" checked="checked" id="gform_print_page_break" />
								<label for="gform_print_page_break"><?php 
        _e('Add page break between entries', 'gravityforms');
        ?>
</label>
								<br /><br />

								<input type="button" value="<?php 
        _e('Print', 'gravityforms');
        ?>
" class="button" onclick="BulkPrint();" />

							</div>
						</div>

					</div>
				</div>
				<!-- / Print -->

			</div>

			<?php 
        echo self::display_paging_links('header', $page_links, $first_item_index, $page_size, $total_count);
        ?>

			<div class="clear"></div>
		</div>

		<table class="widefat fixed" cellspacing="0">
		<thead>
		<tr>
			<th scope="col" id="cb" class="manage-column column-cb check-column">
				<input type="checkbox" class="headercb" /></th>
			<?php 
        if (!in_array($filter, array('spam', 'trash'))) {
            ?>
				<th scope="col" id="cb" class="manage-column column-cb check-column">&nbsp;</th>
			<?php 
        }
        foreach ($columns as $field_id => $field_info) {
            $dir = $field_id == 0 ? 'DESC' : 'ASC';
            //default every field so ascending sorting except date_created (id=0)
            if ($field_id == $sort_field) {
                //reverting direction if clicking on the currently sorted field
                $dir = $sort_direction == 'ASC' ? 'DESC' : 'ASC';
            }
            if ($field_id == 'source_url') {
                $field_info['label'] = 'Form Type';
            }
            ?>
				<th scope="col" class="manage-column entry_nowrap" onclick="Search('<?php 
            echo $field_id;
            ?>
', '<?php 
            echo $dir;
            ?>
', <?php 
            echo $form_id;
            ?>
, '<?php 
            echo $search;
            ?>
', '<?php 
            echo $star;
            ?>
', '<?php 
            echo $read;
            ?>
', '<?php 
            echo $filter;
            ?>
', '<?php 
            echo $search_field_id;
            ?>
', '<?php 
            echo $search_operator;
            ?>
');" style="cursor:pointer;"><?php 
            echo esc_html($field_info['label']);
            ?>
</th>
			<?php 
        }
        ?>
			<th scope="col" align="right" width="50">
				<a title="<?php 
        _e('click to select columns to display', 'gravityforms');
        ?>
" href="<?php 
        echo trailingslashit(site_url(null, 'admin'));
        ?>
?gf_page=select_columns&id=<?php 
        echo $form_id;
        ?>
&TB_iframe=true&height=365&width=600" class="thickbox entries_edit_icon"><i class="fa fa-cog"></i></a>
			</th>
		</tr>
		</thead>
		<tfoot>
		<tr>
			<th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox" /></th>
			<?php 
        if (!in_array($filter, array('spam', 'trash'))) {
            ?>
				<th scope="col" id="cb" class="manage-column column-cb check-column">&nbsp;</th>
			<?php 
        }
        foreach ($columns as $field_id => $field_info) {
            $dir = $field_id == 0 ? 'DESC' : 'ASC';
            //default every field so ascending sorting except date_created (id=0)
            if ($field_id == $sort_field) {
                //reverting direction if clicking on the currently sorted field
                $dir = $sort_direction == 'ASC' ? 'DESC' : 'ASC';
            }
            ?>
				<th scope="col" class="manage-column entry_nowrap" onclick="Search('<?php 
            echo $field_id;
            ?>
', '<?php 
            echo $dir;
            ?>
', <?php 
            echo $form_id;
            ?>
, '<?php 
            echo $search;
            ?>
', '<?php 
            echo $star;
            ?>
', '<?php 
            echo $read;
            ?>
', '<?php 
            echo $filter;
            ?>
');" style="cursor:pointer;"><?php 
            echo esc_html($field_info['label']);
            ?>
</th>
			<?php 
        }
        ?>
			<th scope="col" style="width:15px;">
				<a title="<?php 
        _e('click to select columns to display', 'gravityforms');
        ?>
" href="<?php 
        echo trailingslashit(site_url());
        ?>
?gf_page=select_columns&id=<?php 
        echo $form_id;
        ?>
&TB_iframe=true&height=365&width=600" class="thickbox entries_edit_icon"><i class=fa-cog"></i></a>
			</th>
		</tr>
		</tfoot>
		<tbody data-wp-lists="list:gf_entry" class="user-list" id="gf_entry_list">
		<?php 
        if (sizeof($leads) > 0) {
            $field_ids = array_keys($columns);
            $gf_entry_locking = new GFEntryLocking();
            $alternate_row = false;
            foreach ($leads as $position => $lead) {
                $position = $page_size * $page_index + $position;
                ?>
				<tr id="lead_row_<?php 
                echo $lead['id'];
                ?>
" class='author-self status-inherit <?php 
                echo $lead['is_read'] ? '' : 'lead_unread';
                ?>
 <?php 
                echo $lead['is_starred'] ? 'lead_starred' : '';
                ?>
 <?php 
                echo in_array($filter, array('trash', 'spam')) ? 'lead_spam_trash' : '';
                ?>
 <?php 
                $gf_entry_locking->list_row_class($lead['id']);
                ?>
 <?php 
                echo ($alternate_row = !$alternate_row) ? 'alternate' : '';
                ?>
' valign="top" data-id="<?php 
                echo esc_attr($lead['id']);
                ?>
">
				<th scope="row" class="check-column">
					<input type="checkbox" name="lead[]" value="<?php 
                echo $lead['id'];
                ?>
" />
					<?php 
                $gf_entry_locking->lock_indicator();
                ?>
				</th>
				<?php 
                if (!in_array($filter, array('spam', 'trash'))) {
                    ?>
					<td>
						<img id="star_image_<?php 
                    echo $lead['id'];
                    ?>
" src="<?php 
                    echo GFCommon::get_base_url();
                    ?>
/images/star<?php 
                    echo intval($lead['is_starred']);
                    ?>
.png" onclick="ToggleStar(this, <?php 
                    echo $lead['id'] . ",'" . $filter . "'";
                    ?>
);" />
					</td>
				<?php 
                }
                $is_first_column = true;
                $nowrap_class = 'entry_nowrap';
                foreach ($field_ids as $field_id) {
                    $field = RGFormsModel::get_field($form, $field_id);
                    $value = rgar($lead, $field_id);
                    if (!empty($field) && $field->type == 'post_category') {
                        $value = GFCommon::prepare_post_category_value($value, $field, 'entry_list');
                    }
                    //filtering lead value
                    $value = apply_filters('gform_get_field_value', $value, $lead, $field);
                    $input_type = !empty($columns[$field_id]['inputType']) ? $columns[$field_id]['inputType'] : $columns[$field_id]['type'];
                    switch ($input_type) {
                        case 'website':
                            if ($field !== null) {
                                $value = $field->get_value_entry_list($value, $lead, $field_id, $columns, $form);
                                $value = "<a href='" . esc_attr($value) . "' target='_blank' alt='" . esc_attr($value) . "' title='" . esc_attr($value) . "'>" . esc_attr(GFCommon::truncate_url($value)) . '</a>';
                            } else {
                                $value = esc_html($value);
                            }
                            break;
                        case 'source_url':
                            $value = "<a href='" . esc_attr($lead['source_url']) . "' target='_blank' alt='" . esc_attr($lead['source_url']) . "' title='" . esc_attr($lead['source_url']) . "'>.../" . esc_attr(GFCommon::truncate_url($lead['source_url'])) . '</a>';
                            break;
                        case 'date_created':
                        case 'payment_date':
                            $value = GFCommon::format_date($value, false);
                            break;
                        case 'payment_amount':
                            $value = GFCommon::to_money($value, $lead['currency']);
                            break;
                        case 'created_by':
                            if (!empty($value)) {
                                $userdata = get_userdata($value);
                                if (!empty($userdata)) {
                                    $value = $userdata->user_login;
                                }
                            }
                            break;
                        default:
                            if ($field !== null) {
                                $value = $field->get_value_entry_list($value, $lead, $field_id, $columns, $form);
                            } else {
                                $value = esc_html($value);
                            }
                    }
                    $value = apply_filters('gform_entries_field_value', $value, $form_id, $field_id, $lead);
                    /* ^ maybe move to function */
                    $query_string = "mf_entries&view=mfentry&id={$form_id}&lid={$lead['id']}{$outputVar}{$sort_qs}{$dir_qs}{$filter_qs}{$outputVar}&paged=" . ($page_index + 1);
                    if ($is_first_column) {
                        ?>
						<td class="column-title">
							<a href="admin.php?page=mf_entries&view=mfentry&id=<?php 
                        echo $form_id;
                        ?>
&lid=<?php 
                        echo $lead['id'] . $outputVar . $sort_qs . $dir_qs . $filter_qs;
                        ?>
&paged=<?php 
                        echo $page_index + 1;
                        ?>
&pos=<?php 
                        echo $position;
                        ?>
&field_id=<?php 
                        echo $search_field_id;
                        ?>
&operator=<?php 
                        echo $search_operator;
                        ?>
"><?php 
                        echo $value;
                        ?>
</a>

							<?php 
                        $gf_entry_locking->lock_info($lead['id']);
                        ?>

							<div class="row-actions">
								<?php 
                        switch ($filter) {
                            case 'trash':
                                ?>
										<span class="edit">
                                                            <a title="<?php 
                                _e('View this entry', 'gravityforms');
                                ?>
" href="admin.php?page=mf_entries&view=mfentry&id=<?php 
                                echo $form_id;
                                ?>
&lid=<?php 
                                echo $lead['id'] . $outputVar . $sort_qs . $dir_qs . $filter_qs;
                                ?>
&paged=<?php 
                                echo $page_index + 1;
                                ?>
&pos=<?php 
                                echo $position;
                                ?>
"><?php 
                                _e('View', 'gravityforms');
                                ?>
</a>
                                                            |
                                                        </span>

										<span class="edit">
                                                            <a data-wp-lists='delete:gf_entry_list:lead_row_<?php 
                                echo $lead['id'];
                                ?>
::status=active&entry=<?php 
                                echo $lead['id'];
                                ?>
' title="<?php 
                                echo _e('Restore this entry', 'gravityforms');
                                ?>
" href="<?php 
                                echo wp_nonce_url('?page=mf_entries', 'gf_delete_entry');
                                ?>
"><?php 
                                _e('Restore', 'gravityforms');
                                ?>
</a>
											<?php 
                                echo GFCommon::current_user_can_any('gravityforms_delete_entries') ? '|' : '';
                                ?>
                                                        </span>

										<?php 
                                if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                                    ?>
											<span class="delete">
                                                                <?php 
                                    $delete_link = '<a data-wp-lists="delete:gf_entry_list:lead_row_' . $lead['id'] . '::status=delete&entry=' . $lead['id'] . '" title="' . __('Delete this entry permanently', 'gravityforms') . '"  href="' . wp_nonce_url('?page=mf_entries', 'gf_delete_entry') . '">' . __('Delete Permanently', 'gravityforms') . '</a>';
                                    echo apply_filters('gform_delete_entry_link', $delete_link);
                                    ?>
                                                            </span>
										<?php 
                                }
                                break;
                            case 'spam':
                                ?>
										<span class="edit">
                                                            <a title="<?php 
                                _e('View this entry', 'gravityforms');
                                ?>
" href="admin.php?page=mf_entries&view=mfentry&id=<?php 
                                echo $form_id;
                                ?>
&lid=<?php 
                                echo $lead['id'] . $sort_qs . $dir_qs . $filter_qs;
                                ?>
&paged=<?php 
                                echo $page_index + 1;
                                ?>
&pos=<?php 
                                echo $position;
                                ?>
"><?php 
                                _e('View', 'gravityforms');
                                ?>
</a>
                                                            |
                                                        </span>

										<span class="unspam">
                                                            <a data-wp-lists='delete:gf_entry_list:lead_row_<?php 
                                echo $lead['id'];
                                ?>
::status=unspam&entry=<?php 
                                echo $lead['id'];
                                ?>
' title="<?php 
                                echo _e('Mark this entry as not spam', 'gravityforms');
                                ?>
" href="<?php 
                                echo wp_nonce_url('?page=mf_entries', 'gf_delete_entry');
                                ?>
"><?php 
                                _e('Not Spam', 'gravityforms');
                                ?>
</a>
											<?php 
                                echo GFCommon::current_user_can_any('gravityforms_delete_entries') ? '|' : '';
                                ?>
                                                        </span>

										<?php 
                                if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                                    ?>
											<span class="delete">
                                                                <?php 
                                    $delete_link = '<a data-wp-lists="delete:gf_entry_list:lead_row_' . $lead['id'] . '::status=delete&entry=' . $lead['id'] . '" title="' . __('Delete this entry permanently', 'gravityforms') . '"  href="' . wp_nonce_url('?page=mf_entries', 'gf_delete_entry') . '">' . __('Delete Permanently', 'gravityforms') . '</a>';
                                    echo apply_filters('gform_delete_entry_link', $delete_link);
                                    ?>
                                                            </span>
										<?php 
                                }
                                break;
                            default:
                                ?>
											<span class="edit">
                                                            <a title="<?php 
                                _e('View this entry', 'gravityforms');
                                ?>
" href="admin.php?page=mf_entries&view=mfentry&id=<?php 
                                echo $form_id;
                                ?>
&lid=<?php 
                                echo $lead['id'] . $outputVar . $sort_qs . $dir_qs . $filter_qs;
                                ?>
&paged=<?php 
                                echo $page_index + 1;
                                ?>
&pos=<?php 
                                echo $position;
                                ?>
"><?php 
                                _e('View', 'gravityforms');
                                ?>
</a>
                                                            |
                                                        </span>
											<span class="edit">
                                                            <a id="mark_read_<?php 
                                echo $lead['id'];
                                ?>
" title="Mark this entry as read" href="javascript:ToggleRead(<?php 
                                echo $lead['id'] . ",'" . $filter . "'";
                                ?>
);" style="display:<?php 
                                echo $lead['is_read'] ? 'none' : 'inline';
                                ?>
;"><?php 
                                _e('Mark read', 'gravityforms');
                                ?>
</a><a id="mark_unread_<?php 
                                echo $lead['id'];
                                ?>
" title="<?php 
                                _e('Mark this entry as unread', 'gravityforms');
                                ?>
" href="javascript:ToggleRead(<?php 
                                echo $lead['id'] . ",'" . $filter . "'";
                                ?>
);" style="display:<?php 
                                echo $lead['is_read'] ? 'inline' : 'none';
                                ?>
;"><?php 
                                _e('Mark unread', 'gravityforms');
                                ?>
</a>
												<?php 
                                echo GFCommon::current_user_can_any('gravityforms_delete_entries') || GFCommon::akismet_enabled($form_id) ? '|' : '';
                                ?>
                                                        </span>
										<?php 
                                if (GFCommon::spam_enabled($form_id)) {
                                    ?>
											<span class="spam">
                                                                <a data-wp-lists='delete:gf_entry_list:lead_row_<?php 
                                    echo $lead['id'];
                                    ?>
::status=spam&entry=<?php 
                                    echo $lead['id'];
                                    ?>
' title="<?php 
                                    _e('Mark this entry as spam', 'gravityforms');
                                    ?>
" href="<?php 
                                    echo wp_nonce_url('?page=mf_entries', 'gf_delete_entry');
                                    ?>
"><?php 
                                    _e('Spam', 'gravityforms');
                                    ?>
</a>
												<?php 
                                    echo GFCommon::current_user_can_any('gravityforms_delete_entries') ? '|' : '';
                                    ?>
                                                            </span>

										<?php 
                                }
                                if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                                    ?>
											<span class="trash">
                                                                <a data-wp-lists='delete:gf_entry_list:lead_row_<?php 
                                    echo $lead['id'];
                                    ?>
::status=trash&entry=<?php 
                                    echo $lead['id'];
                                    ?>
' title="<?php 
                                    _e('Move this entry to the trash', 'gravityforms');
                                    ?>
" href="<?php 
                                    echo wp_nonce_url('?page=mf_entries', 'gf_delete_entry');
                                    ?>
"><?php 
                                    _e('Trash', 'gravityforms');
                                    ?>
</a>
                                                            </span>
										<?php 
                                }
                                break;
                        }
                        ?>
                                                                <span class="edit">
                                                                    | <a title="<?php 
                        _e('Edit this entry', 'gravityview');
                        ?>
" href="admin.php?page=mf_entries&view=mfentry&screen_mode=edit&id=<?php 
                        echo $form_id;
                        ?>
&lid=<?php 
                        echo $lead['id'] . $outputVar . $sort_qs . $dir_qs . $filter_qs;
                        ?>
&paged=<?php 
                        echo $page_index + 1;
                        ?>
&pos=<?php 
                        echo $position;
                        ?>
"><?php 
                        _e('Edit', 'gravityforms');
                        ?>
</a>                                                                    
                                                                </span>
                                                                <?php 
                        //do_action( 'gform_entries_first_column_actions', $form_id, $field_id, $value, $lead, $query_string );
                        ?>

							</div>
							<?php 
                        do_action('gform_entries_first_column', $form_id, $field_id, $value, $lead, $query_string);
                        ?>
						</td>
					<?php 
                    } else {
                        ?>
						<td class="<?php 
                        echo $field_id != 'source_url' && $field_id != 16 ? $nowrap_class : '';
                        ?>
">                                                                                                      							
                                                        <?php 
                        echo apply_filters('gform_entries_column_filter', $value, $form_id, $field_id, $lead, $query_string);
                        ?>
&nbsp;							
                                                        <?php 
                        do_action('gform_entries_column', $form_id, $field_id, $value, $lead, $query_string);
                        ?>
						</td>
					<?php 
                    }
                    $is_first_column = false;
                }
                ?>
				<td>&nbsp;</td>
				</tr>
			<?php 
            }
        } else {
            $column_count = sizeof($columns) + 3;
            switch ($filter) {
                case 'unread':
                    $message = isset($_GET['field_id']) ? __('This form does not have any unread entries matching the search criteria.', 'gravityforms') : __('This form does not have any unread entries.', 'gravityforms');
                    break;
                case 'star':
                    $message = isset($_GET['field_id']) ? __('This form does not have any starred entries matching the search criteria.', 'gravityforms') : __('This form does not have any starred entries.', 'gravityforms');
                    break;
                case 'spam':
                    $message = __('This form does not have any spam.', 'gravityforms');
                    $column_count = sizeof($columns) + 2;
                    break;
                case 'trash':
                    $message = isset($_GET['field_id']) ? __('This form does not have any entries in the trash matching the search criteria.', 'gravityforms') : __('This form does not have any entries in the trash.', 'gravityforms');
                    $column_count = sizeof($columns) + 2;
                    break;
                default:
                    $message = isset($_GET['field_id']) ? __('This form does not have any entries matching the search criteria.', 'gravityforms') : __('This form does not have any entries yet.', 'gravityforms');
            }
            ?>
			<tr>
				<td colspan="<?php 
            echo $column_count;
            ?>
" style="padding:20px;"><?php 
            echo $message;
            ?>
</td>
			</tr>
		<?php 
        }
        ?>
		</tbody>
		</table>

		<div class="clear"></div>

		<div class="tablenav">

			<div class="alignleft actions" style="padding:8px 0 7px 0;">
				<label class="hidden" for="bulk_action2"> <?php 
        _e('Bulk action', 'gravityforms');
        ?>
</label>
				<select name="bulk_action2" id="bulk_action2">
					<option value=''><?php 
        _e(' Bulk action ', 'gravityforms');
        ?>
</option>
					<?php 
        switch ($filter) {
            case 'trash':
                ?>
							<option value='restore'><?php 
                _e('Restore', 'gravityforms');
                ?>
</option>
							<?php 
                if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                    ?>
								<option value='delete'><?php 
                    _e('Delete Permanently', 'gravityforms');
                    ?>
</option>
							<?php 
                }
                break;
            case 'spam':
                ?>
							<option value='unspam'><?php 
                _e('Not Spam', 'gravityforms');
                ?>
</option>
							<?php 
                if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                    ?>
								<option value='delete'><?php 
                    _e('Delete Permanently', 'gravityforms');
                    ?>
</option>
							<?php 
                }
                break;
            default:
                ?>
								<option value='mark_read'><?php 
                _e('Mark as Read', 'gravityforms');
                ?>
</option>
								<option value='mark_unread'><?php 
                _e('Mark as Unread', 'gravityforms');
                ?>
</option>
								<option value='add_star'><?php 
                _e('Add Star', 'gravityforms');
                ?>
</option>
								<option value='remove_star'><?php 
                _e('Remove Star', 'gravityforms');
                ?>
</option>
								<option value='resend_notifications'><?php 
                _e('Resend Notifications', 'gravityforms');
                ?>
</option>
								<option value='print'><?php 
                _e('Print Entries', 'gravityforms');
                ?>
</option>
							<?php 
                if (GFCommon::spam_enabled($form_id)) {
                    ?>
								<option value='spam'><?php 
                    _e('Spam', 'gravityforms');
                    ?>
</option>
							<?php 
                }
                if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                    ?>
								<option value='trash'><?php 
                    _e('Move to Trash', 'gravityforms');
                    ?>
</option>
							<?php 
                }
        }
        ?>
				</select>
				<?php 
        $apply_button = '<input type="submit" class="button" value="' . __('Apply', 'gravityforms') . '" onclick="return handleBulkApply(\'bulk_action2\');" />';
        echo apply_filters('gform_entry_apply_button', $apply_button);
        ?>
			</div>

			<?php 
        echo self::display_paging_links('footer', $page_links, $first_item_index, $page_size, $total_count);
        ?>

			<div class="clear"></div>
		</div>

		</form>
		</div>
	<?php 
    }
Exemplo n.º 13
0
    public static function form_list_page()
    {
        global $wpdb;
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        echo GFCommon::get_remote_message();
        $action = RGForms::post("action");
        $bulk_action = RGForms::post("bulk_action");
        $bulk_action = !empty($bulk_action) ? $bulk_action : RGForms::post("bulk_action2");
        if ($action == "delete") {
            check_admin_referer('gforms_update_forms', 'gforms_update_forms');
            $form_id = RGForms::post("action_argument");
            RGFormsModel::delete_form($form_id);
            $message = __('Form deleted.', 'gravityforms');
        } else {
            if ($action == "duplicate") {
                check_admin_referer('gforms_update_forms', 'gforms_update_forms');
                $form_id = RGForms::post("action_argument");
                RGFormsModel::duplicate_form($form_id);
                $message = __('Form duplicated.', 'gravityforms');
            }
        }
        if ($bulk_action) {
            check_admin_referer('gforms_update_forms', 'gforms_update_forms');
            $form_ids = is_array(rgpost('form')) ? rgpost('form') : array();
            $form_count = count($form_ids);
            switch ($bulk_action) {
                case 'delete':
                    RGFormsModel::delete_forms($form_ids);
                    $message = _n('%s form deleted.', '%s forms deleted.', $form_count, 'gravityforms');
                    break;
                case 'reset_views':
                    foreach ($form_ids as $form_id) {
                        RGFormsModel::delete_views($form_id);
                    }
                    $message = _n('Views for %s form have been reset.', 'Views for %s forms have been reset.', $form_count, 'gravityforms');
                    break;
                case 'delete_entries':
                    foreach ($form_ids as $form_id) {
                        RGFormsModel::delete_leads_by_form($form_id);
                    }
                    $message = _n('Entries for %s form have been deleted.', 'Entries for %s forms have been deleted.', $form_count, 'gravityforms');
                    break;
                case 'activate':
                    foreach ($form_ids as $form_id) {
                        RGFormsModel::update_form_active($form_id, 1);
                    }
                    $message = _n('%s form has been marked as active.', '%s forms have been marked as active.', $form_count, 'gravityforms');
                    break;
                case 'deactivate':
                    foreach ($form_ids as $form_id) {
                        RGFormsModel::update_form_active($form_id, 0);
                    }
                    $message = _n('%s form has been marked as inactive.', '%s forms have been marked as inactive.', $form_count, 'gravityforms');
                    break;
            }
            if (isset($message)) {
                $message = sprintf($message, $form_count);
            }
        }
        $active = RGForms::get("active") == "" ? null : RGForms::get("active");
        $forms = RGFormsModel::get_forms($active, "title");
        $form_count = RGFormsModel::get_form_count();
        // - new form modal - //
        wp_print_styles(array('thickbox'));
        ?>

        <script type="text/javascript" src="<?php 
        echo GFCommon::get_base_url() . '/js/form_admin.js';
        ?>
"></script>
        <script type="text/javascript">

            <?php 
        GFCommon::gf_vars();
        ?>

            jQuery(document).ready(function($) {

                <?php 
        if (rgget('page') == 'gf_new_form') {
            ?>
                loadNewFormModal();
                <?php 
        }
        ?>

                $('.gf_form_action_has_submenu').hover(function(){
                    var l = jQuery(this).offset().left;
                    jQuery(this).find('.gf_submenu')
                        .toggle()
                        .offset({ left: l });
                }, function(){
                    jQuery(this).find('.gf_submenu').hide();
                });


            });

            function loadNewFormModal() {
                resetNewFormModal();
                tb_show('<?php 
        _e('Create a New Form', 'gravityforms');
        ?>
', '#TB_inline?width=375&amp;inlineId=gf_new_form_modal');
                jQuery('#new_form_title').focus();
                return false;
            }

            function saveNewForm() {

                var createButton = jQuery('#save_new_form');
                var spinner = new gfAjaxSpinner(createButton, gf_vars.baseUrl + '/images/spinner.gif');

                // clear error message
                jQuery('#gf_new_form_error_message').html('');

                var origVal = createButton.val();
                createButton.val('<?php 
        _e('Creating Form...', 'gravityforms');
        ?>
');

                var form = {
                    title: jQuery('#new_form_title').val(),
                    description: jQuery('#new_form_description').val()
                }

                jQuery.post(ajaxurl, {
                    form: form,
                    action: 'gf_save_new_form',
                    gf_save_new_form: '<?php 
        echo wp_create_nonce('gf_save_new_form');
        ?>
'
                }, function(response){

                    spinner.destroy();

                    var respData = jQuery.parseJSON(response);

                    if(respData['error']) {
                        // adding class later otherwise WP moves box up to the top of the page
                        jQuery('#gf_new_form_error_message').html( respData.error );
                        addInputErrorIcon( '#new_form_title' );
                        createButton.val(origVal);
                    } else {
                        location.href = respData.redirect;
                        createButton.val('<?php 
        _e('Saved! Redirecting...', 'gravityforms');
        ?>
');
                    }

                });

            }

            function resetNewFormModal() {
                jQuery('#new_form_title').val('');
                jQuery('#new_form_description').val('');
                jQuery('#gf_new_form_error_message').html('');
                removeInputErrorIcons( '.gf_new_form_modal_container' );
            }

            function addInputErrorIcon( elem ) {
                var elem = jQuery(elem);
                elem.before( '<span class="gf_input_error_icon"></span>');
            }

            function removeInputErrorIcons( elem ) {
                var elem = jQuery(elem);
                elem.find('span.gf_input_error_icon').remove();
            }

        </script>

        <style type="text/css">
        body #TB_window { margin-top: -145px !important; }
        body #TB_ajaxContent { height: 290px !important; overflow: hidden; }
        .gf_new_form_modal_container { padding: 30px; }
        .gf_new_form_modal_container .setting-row { margin: 0 0 10px; }
        .gf_new_form_modal_container .setting-row label { line-height: 24px; }
        .gf_new_form_modal_container .setting-row input,
        .gf_new_form_modal_container .setting-row textarea { display: block; width: 100%; }
        .gf_new_form_modal_container .setting-row textarea { height: 110px; }
        .gf_new_form_modal_container .submit-row { margin-top: 18px; }
        .gf_new_form_modal_container #gf_new_form_error_message { margin: 0 0 18px 5px !important; color: #BC0B0B; }
        .gf_new_form_modal_container img.gfspinner{ position: relative; top: 5px; left: 5px; }
        </style>

        <div id="gf_new_form_modal" style="display:none;">
            <div class="gf_new_form_modal_container">

                <div class="setting-row">
                    <label for="new_form_title"><?php 
        _e('Form Title', 'gravityforms');
        ?>
<span class="gfield_required">*</span></label><br />
                    <input type="text" class="regular-text" value="" id="new_form_title" tabindex="9000">
                </div>

                <div class="setting-row">
                    <label for="new_form_description"><?php 
        _e('Form Description', 'gravityforms');
        ?>
</label><br />
                    <textarea class="regular-text" id="new_form_description" tabindex="9001"></textarea>
                </div>

                <div class="submit-row">
                    <?php 
        echo apply_filters("gform_new_form_button", '<input id="save_new_form" type="button" class="button button-large button-primary" value="' . __('Create Form', 'gravityforms') . '" onclick="saveNewForm();" tabindex="9002" />');
        ?>
                    <div id="gf_new_form_error_message" style="display:inline-block;"></div>
                </div>

            </div>
        </div>

        <?php 
        // - end of new form modal - //
        ?>

        <script text="text/javascript">
            function DeleteForm(form_id){
                jQuery("#action_argument").val(form_id);
                jQuery("#action").val("delete");
                jQuery("#forms_form")[0].submit();
            }

            function DuplicateForm(form_id){
                jQuery("#action_argument").val(form_id);
                jQuery("#action").val("duplicate");
                jQuery("#forms_form")[0].submit();
            }

            function ToggleActive(img, form_id){
                var is_active = img.src.indexOf("active1.png") >=0
                if(is_active){
                    img.src = img.src.replace("active1.png", "active0.png");
                    jQuery(img).attr('title','<?php 
        _e("Inactive", "gravityforms");
        ?>
').attr('alt', '<?php 
        _e("Inactive", "gravityforms");
        ?>
');
                }
                else{
                    img.src = img.src.replace("active0.png", "active1.png");
                    jQuery(img).attr('title','<?php 
        _e("Active", "gravityforms");
        ?>
').attr('alt', '<?php 
        _e("Active", "gravityforms");
        ?>
');
                }

                UpdateCount("active_count", is_active ? -1 : 1);
                UpdateCount("inactive_count", is_active ? 1 : -1);

                var mysack = new sack("<?php 
        echo admin_url("admin-ajax.php");
        ?>
" );
                mysack.execute = 1;
                mysack.method = 'POST';
                mysack.setVar( "action", "rg_update_form_active" );
                mysack.setVar( "rg_update_form_active", "<?php 
        echo wp_create_nonce("rg_update_form_active");
        ?>
" );
                mysack.setVar( "form_id", form_id);
                mysack.setVar( "is_active", is_active ? 0 : 1);
                mysack.onError = function() { alert('<?php 
        echo esc_js(__("Ajax error while update form", "gravityforms"));
        ?>
' )};
                mysack.runAJAX();

                return true;
            }
            function UpdateCount(element_id, change){
                var element = jQuery("#" + element_id);
                var count = parseInt(element.html()) + change
                element.html(count + "");
            }

            function gfConfirmBulkAction(element_id){
                var element = "#" + element_id;
                if(jQuery(element).val() == 'delete')
                    return confirm('<?php 
        echo __("WARNING: You are about to delete this form and ALL entries associated with it. ", "gravityforms") . __("\\'Cancel\\' to stop, \\'OK\\' to delete.", "gravityforms");
        ?>
');
                else if(jQuery(element).val() == 'reset_views')
                    return confirm('<?php 
        echo __("Are you sure you would like to reset the Views for the selected forms? ", "gravityforms") . __("\\'Cancel\\' to stop, \\'OK\\' to reset.", "gravityforms");
        ?>
');
                else if(jQuery(element).val() == 'delete_entries')
                    return confirm('<?php 
        echo __("WARNING: You are about to delete ALL entries associated with the selected forms. ", "gravityforms") . __("\\'Cancel\\' to stop, \\'OK\\' to delete.", "gravityforms");
        ?>
');

                return true;
            }
        </script>

        <link rel="stylesheet" href="<?php 
        echo GFCommon::get_base_url();
        ?>
/css/admin.css" />
        <div class="wrap">

            <div class="icon32" id="gravity-edit-icon"><br></div>
            <h2>
                <?php 
        _e("Forms", "gravityforms");
        ?>
                <a class="button add-new-h2" href="" onclick="return loadNewFormModal();"><?php 
        _e("Add New", "gravityforms");
        ?>
</a>
            </h2>

            <?php 
        if (isset($message)) {
            ?>
            <div class="updated below-h2" id="message"><p><?php 
            echo $message;
            ?>
</p></div>
            <?php 
        }
        ?>

            <form id="forms_form" method="post">
                <?php 
        wp_nonce_field('gforms_update_forms', 'gforms_update_forms');
        ?>
                <input type="hidden" id="action" name="action"/>
                <input type="hidden" id="action_argument" name="action_argument"/>

                <ul class="subsubsub">
                    <li><a class="<?php 
        echo $active === null ? "current" : "";
        ?>
" href="?page=gf_edit_forms"><?php 
        _e("All", "gravityforms");
        ?>
 <span class="count">(<span id="all_count"><?php 
        echo $form_count["total"];
        ?>
</span>)</span></a> | </li>
                    <li><a class="<?php 
        echo $active == "1" ? "current" : "";
        ?>
" href="?page=gf_edit_forms&active=1"><?php 
        _e("Active", "gravityforms");
        ?>
 <span class="count">(<span id="active_count"><?php 
        echo $form_count["active"];
        ?>
</span>)</span></a> | </li>
                    <li><a class="<?php 
        echo $active == "0" ? "current" : "";
        ?>
" href="?page=gf_edit_forms&active=0"><?php 
        _e("Inactive", "gravityforms");
        ?>
 <span class="count">(<span id="inactive_count"><?php 
        echo $form_count["inactive"];
        ?>
</span>)</span></a></li>
                </ul>

                <?php 
        if (GFCommon::current_user_can_any("gravityforms_delete_forms")) {
            ?>
                    <div class="tablenav">
                        <div class="alignleft actions" style="padding:8px 0 7px 0;">

                            <label class="hidden" for="bulk_action"><?php 
            _e("Bulk action", "gravityforms");
            ?>
</label>
                            <select name="bulk_action" id="bulk_action">
                                <option value=''> <?php 
            _e("Bulk action", "gravityforms");
            ?>
 </option>
                                <option value='delete'><?php 
            _e("Delete", "gravityforms");
            ?>
</option>
                                <option value='activate'><?php 
            _e("Mark as Active", "gravityforms");
            ?>
</option>
                                <option value='deactivate'><?php 
            _e("Mark as Inactive", "gravityforms");
            ?>
</option>
                                <option value='reset_views'><?php 
            _e("Reset Views", "gravityforms");
            ?>
</option>
                                <option value='delete_entries'><?php 
            _e("Delete Entries", "gravityforms");
            ?>
</option>
                            </select>
                            <?php 
            $apply_button = '<input type="submit" class="button" value="' . __("Apply", "gravityforms") . '" onclick="return gfConfirmBulkAction(\'bulk_action\');"/>';
            echo apply_filters("gform_form_apply_button", $apply_button);
            ?>

                            <br class="clear" />

                        </div>
                    </div>
                <?php 
        }
        ?>

                <table class="widefat fixed" cellspacing="0">
                    <thead>
                        <tr>
                            <?php 
        if (GFCommon::current_user_can_any("gravityforms_delete_forms")) {
            ?>
                                <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox" name="form_bulk_check_all" onclick="jQuery('.gform_list_checkbox').attr('checked', this.checked);" /></th>
                            <?php 
        }
        ?>
                            <th scope="col" id="active" class="manage-column column-cb check-column"></th>
                            <th scope="col" id="id" class="manage-column" style="width:50px;"><?php 
        _e("Id", "gravityforms");
        ?>
</th>
                            <th width="360" scope="col" id="title" class="manage-column column-title"><?php 
        _e("Title", "gravityforms");
        ?>
</th>
                            <th scope="col" id="author" class="manage-column column-author" style=""><?php 
        _e("Views", "gravityforms");
        ?>
</th>
                            <th scope="col" id="template" class="manage-column" style=""><?php 
        _e("Entries", "gravityforms");
        ?>
</th>
                            <th scope="col" id="template" class="manage-column" style=""><?php 
        _e("Conversion", "gravityforms");
        ?>
 <?php 
        gform_tooltip("entries_conversion", "tooltip_left");
        ?>
 </th>
                        </tr>
                    </thead>

                    <tfoot>
                        <tr>
                            <?php 
        if (GFCommon::current_user_can_any("gravityforms_delete_forms")) {
            ?>
                                <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox" name="form_bulk_check_all" onclick="jQuery('.gform_list_checkbox').attr('checked', this.checked);" /></th>
                            <?php 
        }
        ?>
                            <th scope="col" id="active" class="manage-column column-cb check-column"></th>
                            <th scope="col" id="id" class="manage-column"><?php 
        _e("Id", "gravityforms");
        ?>
</th>
                            <th width="350" scope="col" id="title" class="manage-column column-title"><?php 
        _e("Title", "gravityforms");
        ?>
</th>
                            <th scope="col" id="author" class="manage-column column-author" style=""><?php 
        _e("Views", "gravityforms");
        ?>
</th>
                            <th scope="col" id="template" class="manage-column" style=""><?php 
        _e("Entries", "gravityforms");
        ?>
</th>
                            <th scope="col" id="template" class="manage-column" style=""><?php 
        _e("Conversion", "gravityforms");
        ?>
</th>
                        </tr>
                    </tfoot>

                    <tbody class="list:user user-list">
                        <?php 
        if (sizeof($forms) > 0) {
            foreach ($forms as $form) {
                $conversion = "0%";
                if ($form->view_count > 0) {
                    $conversion = number_format($form->lead_count / $form->view_count, 3) * 100 . "%";
                }
                ?>
                                <tr class='author-self status-inherit' valign="top">
                                    <?php 
                if (GFCommon::current_user_can_any("gravityforms_delete_forms")) {
                    ?>
                                        <th scope="row" class="check-column"><input type="checkbox" name="form[]" value="<?php 
                    echo $form->id;
                    ?>
" class="gform_list_checkbox"/></th>
                                    <?php 
                }
                ?>

                                    <td><img src="<?php 
                echo GFCommon::get_base_url();
                ?>
/images/active<?php 
                echo intval($form->is_active);
                ?>
.png" style="cursor: pointer;" alt="<?php 
                echo $form->is_active ? __("Active", "gravityforms") : __("Inactive", "gravityforms");
                ?>
" title="<?php 
                echo $form->is_active ? __("Active", "gravityforms") : __("Inactive", "gravityforms");
                ?>
" onclick="ToggleActive(this, <?php 
                echo $form->id;
                ?>
); " /></td>
                                    <td class="column-id"><?php 
                echo $form->id;
                ?>
</td>
                                    <td class="column-title">
                                        <strong><a class="row-title" href="admin.php?page=gf_edit_forms&id=<?php 
                echo $form->id;
                ?>
" title="<?php 
                _e("Edit", "gravityforms");
                ?>
"><?php 
                echo $form->title;
                ?>
</a></strong>
                                        <div class="row-actions">

                                            <?php 
                require_once GFCommon::get_base_path() . '/form_settings.php';
                $form_actions = GFForms::get_toolbar_menu_items($form->id, true);
                $form_actions['duplicate'] = array('label' => __("Duplicate", "gravityforms"), 'title' => __("Duplicate this form", "gravityforms"), 'url' => 'javascript:DuplicateForm(' . $form->id . ');', 'capabilities' => "gravityforms_create_form", 'priority' => 600);
                $form_actions['delete'] = array('label' => __("Delete", "gravityforms"), 'title' => __("Delete", "gravityforms"), 'url' => 'javascript: if(confirm("' . __("WARNING: You are about to delete this form and ALL entries associated with it. ", "gravityforms") . __('\\"Cancel\\" to stop, \\"OK\\" to delete.', "gravityforms") . '")){ DeleteForm(' . $form->id . ');}', 'capabilities' => "gravityforms_delete_forms", 'priority' => 500);
                $form_actions = apply_filters("gform_form_actions", $form_actions, $form->id);
                echo GFForms::format_toolbar_menu_items($form_actions, true);
                ?>

                                        </div>
                                    </td>
                                    <td class="column-date"><strong><?php 
                echo $form->view_count;
                ?>
</strong></td>
                                    <td class="column-date">
                                        <strong>
                                            <?php 
                if ($form->lead_count > 0) {
                    ?>
                                                <a href="<?php 
                    echo admin_url("admin.php?page=gf_entries&view=entries&id={$form->id}");
                    ?>
"><?php 
                    echo $form->lead_count;
                    ?>
</a>
                                            <?php 
                } else {
                    echo $form->lead_count;
                }
                ?>
                                        </strong>
                                    </td>
                                    <td class="column-date"><?php 
                echo $conversion;
                ?>
</td>
                                </tr>
                                <?php 
            }
        } else {
            ?>
                            <tr>
                                <td colspan="6" style="padding:20px;">
                                    <?php 
            echo sprintf(__("You don't have any forms. Let's go %screate one%s!", "gravityforms"), '<a href="admin.php?page=gf_new_form">', "</a>");
            ?>
                                </td>
                            </tr>
                            <?php 
        }
        ?>
                    </tbody>
                </table>
                <div class="tablenav">
                    <div class="alignleft actions" style="padding:8px 0 7px 0;">
                        <?php 
        if (GFCommon::current_user_can_any("gravityforms_delete_forms")) {
            ?>
                            <label class="hidden" for="bulk_action2"><?php 
            _e("Bulk action", "gravityforms");
            ?>
</label>
                            <select name="bulk_action2" id="bulk_action2">
                                <option value=''> <?php 
            _e("Bulk action", "gravityforms");
            ?>
 </option>
                                <option value='delete'><?php 
            _e("Delete", "gravityforms");
            ?>
</option>
                                <option value='activate'><?php 
            _e("Mark as Active", "gravityforms");
            ?>
</option>
                                <option value='deactivate'><?php 
            _e("Mark as Inactive", "gravityforms");
            ?>
</option>
                                <option value='reset_views'><?php 
            _e("Reset Views", "gravityforms");
            ?>
</option>
                                <option value='delete_entries'><?php 
            _e("Delete Entries", "gravityforms");
            ?>
</option>
                            </select>
                            <?php 
            $apply_button = '<input type="submit" class="button" value="' . __("Apply", "gravityforms") . '" onclick="return gfConfirmBulkAction(\'bulk_action2\');"/>';
            echo apply_filters("gform_form_apply_button", $apply_button);
        }
        ?>
                        <br class="clear" />
                    </div>
                </div>
            </form>
        </div>
        <?php 
    }