function insert_content_template_edit_help_box($post) { if (is_object($post) && isset($post->post_type) && $post->post_type == 'view-template') { global $WPV_settings; $wpv_list_of_types = array(); $first_p = ''; $show_help = get_option('wpv_content_template_show_help'); $post_types = get_post_types(array('public' => true), 'objects'); $taxonomies = get_taxonomies('', 'objects'); $exclude_tax_slugs = array(); $exclude_tax_slugs = apply_filters('wpv_admin_exclude_tax_slugs', $exclude_tax_slugs); foreach ($post_types as $post_type) { $type = $post_type->name; if (isset($WPV_settings['views_template_for_' . $type]) && $WPV_settings['views_template_for_' . $type] == $post->ID) { $wpv_list_of_types[] = __('Single ', 'wpv-views') . $post_type->label; } if (isset($WPV_settings['views_template_archive_for_' . $type]) && $WPV_settings['views_template_archive_for_' . $type] == $post->ID) { $wpv_list_of_types[] = __('Archive ', 'wpv-views') . $post_type->label; } } foreach ($taxonomies as $category_slug => $category) { if (in_array($category_slug, $exclude_tax_slugs) || !$category->show_ui) { continue; } $type = $category->name; if (isset($WPV_settings['views_template_loop_' . $type]) && $WPV_settings['views_template_loop_' . $type] == $post->ID) { $wpv_list_of_types[] = $category->label; } } $wpv_list_of_types = implode(', ', $wpv_list_of_types); $wpv_list_of_types = preg_replace("/\\, /", ' and ', $wpv_list_of_types, -1); if ($wpv_list_of_types != '') { $wpv_list_of_types .= '.'; $first_p = sprintf(__('This Content Template will replace the content of %s', 'wpv-views'), $wpv_list_of_types); } else { $first_p = __('This Content Template will replace the content of the elements you assign it to.', 'wpv-views'); } if ($show_help == 1) { $hidden = 'false'; } else { $hidden = 'true'; } $data_def = array('text' => '<p>' . $first_p . '</p><p>' . __('It starts empty and you should add fields to it. To add fields, click on the V icon below.', 'wpv-views') . WPV_MESSAGE_SPACE_CHAR . __('You can add HTML and CSS to style the fields and design the page template.', 'wpv-views') . '</p>', 'close' => 'true', 'hidden' => $hidden, 'classname' => 'js-wpv-content-template-edit-help-box'); wpv_toolset_help_box($data_def); } }
/** * ToolSet Help Box for Views * Pagination hint when activating pagination and no pagination shortcodes in HTML * * @return echo the help boxes for the pagination flow */ function wpv_get_view_pagination_hint_data() { $pagination = array('text' => '<p>' . __('This View uses pagination, but pagination controls are still not inserted into the filter HTML section.', 'wpv-views') . WPV_MESSAGE_SPACE_CHAR . __('Would you like to insert them now?', 'wpv-views') . '</p><p>' . ' <button class="button-primary js-wpv-open-pagination-hint-popup">' . __('Automatically insert pagination controls', 'wpv-views') . '</button> <button class="button-secondary js-wpv-close-pagination-hint">' . __('No - I will add pagination controls manually', 'wpv-views') . '</button></p>', 'close' => 'false', 'classname' => 'js-wpv-pagination-hint-message js-wpv-pagination-hint-message-for-paged'); wpv_toolset_help_box($pagination); $slider = array('text' => '<p>' . __('This View uses AJAX pagination to implement a slider.', 'wpv-views') . WPV_MESSAGE_SPACE_CHAR . __('However, pagination controls are still not inserted into the filter HTML section.', 'wpv-views') . WPV_MESSAGE_SPACE_CHAR . __('Would you like to insert them now?', 'wpv-views') . '</p><p>' . '<button class="button-primary js-wpv-open-pagination-hint-popup">' . __('Automatically insert pagination controls', 'wpv-views') . '</button> <button class="button-secondary js-wpv-close-pagination-hint">' . __('No - I will add pagination controls manually', 'wpv-views') . '</button></p>', 'close' => 'false', 'classname' => 'js-wpv-pagination-hint-message js-wpv-pagination-hint-message-for-rollover'); wpv_toolset_help_box($slider); }
function add_view_layout_template($view_settings, $view_layout_settings, $view_id) { global $views_edit_help; wp_nonce_field('wpv-ct-inline-edit', 'wpv-ct-inline-edit'); $templates = array(); $valid_templates = array(); $first_time = get_post_meta($view_id, '_wpv_first_time_load', true); if (isset($view_layout_settings['included_ct_ids'])) { $templates = explode(',', $view_layout_settings['included_ct_ids']); $valid_templates = $templates; } $template_list = ''; if (count($templates) > 0) { $attached_templates = count($templates); for ($i = 0; $i < $attached_templates; $i++) { if (is_numeric($templates[$i])) { $template_post = get_post($templates[$i]); if (is_object($template_post)) { $template_list .= wpv_list_view_ct_item($template_post, $templates[$i], $view_id); } else { unset($valid_templates[$i]); // remove Templates that might have been deleted or are missing } } else { unset($valid_templates[$i]); // remove Templates that might have been deleted or are missing } } if (count($templates) != count($valid_templates)) { $view_layout_settings['included_ct_ids'] = implode(',', $valid_templates); update_post_meta($view_id, '_wpv_layout_settings', $view_layout_settings); } } ?> <script type="application/javascript"> var wpv_view_ct_msg1 = '<?php echo esc_js(__('Content Template was successfully assigned to view.', 'wpv-views')); ?> '; var wpv_view_ct_msg2 = '<?php echo esc_js(__('This Content Template already assigned to this view.', 'wpv-views')); ?> '; var wpv_view_ct_msg3 = '<?php echo esc_js(__('Content Template was successfully unassigned from view.', 'wpv-views')); ?> '; var wpv_view_ct_msg4 = '<?php echo esc_js(__('Content Template was successfully updated.', 'wpv-views')); ?> '; var wpv_view_ct_msg5 = '<?php echo esc_js(__('Views', 'wpv-views')); ?> '; var wpv_view_ct_msg6 = '<?php echo esc_js(__('No Content Templates assigned to this view', 'wpv-views')); ?> '; var wpv_view_ct_msg7 = '<?php echo esc_js(__('There are no Content Templates for this View. You can add a Content Template using the Content Template button in the Layout editor tool bar.', 'wpv-views')); ?> '; var wpv_view_ct_msg8 = '<?php echo esc_js(__('A Content Template with that name already exists. Please use another name.', 'wpv-views')); ?> '; </script> <div id="attached-content-templates" class="wpv-settings-templates wpv-setting-container wpv-setting-container-horizontal wpv-settings-layout-markup"<?php echo empty($template_list) ? ' style="display:none;"' : ''; ?> > <div class="wpv-settings-header"> <h3><?php _e('Templates for this View', 'wpv-views'); ?> <i class="icon-question-sign js-display-tooltip" data-header="<?php echo $views_edit_help['templates_for_view']['title']; ?> " data-content="<?php echo $views_edit_help['templates_for_view']['content']; ?> "></i> </h3> </div> <?php if ($first_time == 'on') { $data = wpv_get_view_ct_slider_introduction_data(); wpv_toolset_help_box($data); } ?> <div class="js-wpv-content-template-view-list wpv-content-template-view-list wpv-setting"> <ul> <?php echo $template_list; ?> </ul> <div class="js-wpv-content-template-section-errors"></div> </div> </div> <?php }
function add_view_layout_extra($view_settings, $view_layout_settings, $view_id) { global $views_edit_help; $hide = ''; if (isset($view_settings['sections-show-hide']) && isset($view_settings['sections-show-hide']['layout-extra']) && 'off' == $view_settings['sections-show-hide']['layout-extra']) { $hide = ' hidden'; } ?> <div class="wpv-setting-container wpv-setting-container-horizontal wpv-settings-layout-markup js-wpv-settings-layout-extra<?php echo $hide; ?> "> <div class="wpv-settings-header"> <h3> <?php _e('Layout HTML/CSS/JS', 'wpv-views'); ?> <i class="icon-question-sign js-display-tooltip" data-header="<?php echo $views_edit_help['layout_html_css_js']['title']; ?> " data-content="<?php echo $views_edit_help['layout_html_css_js']['content']; ?> "></i> </h3> </div> <?php $data = wpv_get_view_layout_wizard_hint_data(); wpv_toolset_help_box($data); $data = wpv_get_view_content_template_hint_data(); wpv_toolset_help_box($data); ?> <div class="wpv-setting" data> <div class="js-code-editor code-editor layout-html-editor" data-name="layout-html-editor"> <div class="code-editor-toolbar js-code-editor-toolbar"> <ul class="js-wpv-layout-edit-toolbar"> <li> <button class="button-secondary js-code-editor-toolbar-button js-open-meta-html-wizard"> <i class="icon-th"></i> <span class="button-label"><?php _e('Layout wizard', 'wpv-views'); ?> </span> </button> </li> <li class="wpv-vicon-codemirror-button"> <?php wpv_add_v_icon_to_codemirror('wpv_layout_meta_html_content'); ?> </li> <li> <?php // TODO Review CRED button, produces orphan li if CRED not activated //CREED BUTTON wpv_add_cred_to_codemirror('wpv_layout_meta_html_content'); ?> </li> <li> <button class="button-secondary js-code-editor-toolbar-button js-wpv-ct-assign-to-view" data-id="<?php echo $view_id; ?> "> <i class="icon-plus"></i> <span class="button-label"><?php _e('Content Template', 'wpv-views'); ?> </span> </button> </li> <li> <button class="button-secondary js-code-editor-toolbar-button js-wpv-media-manager" data-id="<?php echo $view_id; ?> " data-content="wpv_layout_meta_html_content"> <i class="icon-picture"></i> <span class="button-label"><?php _e('Media', 'wpv-views'); ?> </span> </button> </li> </ul> </div> <textarea cols="30" rows="10" id="wpv_layout_meta_html_content" name="_wpv_layout_settings[layout_meta_html]"><?php echo isset($view_layout_settings['layout_meta_html']) ? $view_layout_settings['layout_meta_html'] : ''; ?> </textarea> </div> <?php $layout_extra_css = isset($view_settings['layout_meta_html_css']) ? $view_settings['layout_meta_html_css'] : ''; if (empty($layout_extra_css)) { $aux_class = ' code-editor-textarea-empty'; } else { $aux_class = ' code-editor-textarea-full'; } ?> <p class="js-wpv-layout-css-editor-old-place"> <input type="hidden" name="_wpv_settings[layout_meta_html_state][css]" id="wpv_layout_meta_html_extra_css_state" value="<?php echo isset($view_settings['layout_meta_html_state']['css']) ? $view_settings['layout_meta_html_state']['css'] : 'off'; ?> " /> <button class="button-secondary js-code-editor-button layout-css-editor-button<?php echo $aux_class; ?> " data-target="layout-css-editor" data-state="closed" data-closed="<?php echo htmlentities(__('Open CSS editor', 'wpv-views'), ENT_QUOTES); ?> " data-opened="<?php echo htmlentities(__('Close CSS editor', 'wpv-views'), ENT_QUOTES); ?> "> <?php _e('Open CSS editor', 'wpv-views'); ?> </button> </p> <div class="js-code-editor code-editor layout-css-editor closed" data-name="layout-css-editor"> <div class="code-editor-toolbar js-code-editor-toolbar"> <ul> <li> <button class="button-secondary js-code-editor-toolbar-button js-wpv-media-manager" data-id="<?php echo $view_id; ?> " data-content="wpv_layout_meta_html_css"> <i class="icon-picture"></i> <span class="button-label"><?php _e('Media', 'wpv-views'); ?> </span> </button> </li> </ul> </div> <textarea cols="30" rows="10" id="wpv_layout_meta_html_css" name="_wpv_settings[layout_meta_html_css]"><?php echo $layout_extra_css; ?> </textarea> </div> <?php $layout_extra_js = isset($view_settings['layout_meta_html_js']) ? $view_settings['layout_meta_html_js'] : ''; if (empty($layout_extra_js)) { $aux_class = ' code-editor-textarea-empty'; } else { $aux_class = ' code-editor-textarea-full'; } ?> <p class="js-wpv-layout-js-editor-old-place"> <input type="hidden" name="_wpv_settings[layout_meta_html_state][js]" id="wpv_layout_meta_html_extra_js_state" value="<?php echo isset($view_settings['layout_meta_html_state']['js']) ? $view_settings['layout_meta_html_state']['js'] : 'off'; ?> " /> <button class="button-secondary js-code-editor-button layout-js-code-editor-button<?php echo $aux_class; ?> " data-target="layout-js-editor" data-state="closed" data-closed="<?php echo htmlentities(__('Open JS editor', 'wpv-views'), ENT_QUOTES); ?> " data-opened="<?php echo htmlentities(__('Close JS editor', 'wpv-views'), ENT_QUOTES); ?> "> <?php _e('Open JS editor', 'wpv-views'); ?> </button> </p> <div class="js-code-editor code-editor layout-js-editor closed" data-name="layout-js-editor"> <div class="code-editor-toolbar js-code-editor-toolbar"> <ul> <li> <button class="button-secondary js-code-editor-toolbar-button js-wpv-media-manager" data-id="<?php echo $view_id; ?> " data-content="wpv_layout_meta_html_js"> <i class="icon-picture"></i> <span class="button-label"><?php _e('Media', 'wpv-views'); ?> </span> </button> </li> </ul> </div> <textarea cols="30" rows="10" id="wpv_layout_meta_html_js" name="_wpv_settings[layout_meta_html_js]"><?php echo $layout_extra_js; ?> </textarea> </div> <p class="update-button-wrap"> <button data-success="<?php echo htmlentities(__('Data updated', 'wpv-views'), ENT_QUOTES); ?> " data-unsaved="<?php echo htmlentities(__('Data not saved', 'wpv-views'), ENT_QUOTES); ?> " data-nonce="<?php echo wp_create_nonce('wpv_view_layout_extra_nonce'); ?> " class="js-wpv-layout-extra-update button-secondary" disabled="disabled"> <?php _e('Update', 'wpv-views'); ?> </button> </p> </div> </div> <?php }
function wpv_insert_form_workflow_help_boxes($post) { $excluded_post_type_slugs = array(); $excluded_post_type_slugs = apply_filters('wpv_admin_exclude_post_type_slugs', $excluded_post_type_slugs); if (!in_array($post->post_type, $excluded_post_type_slugs)) { $has_view = false; $has_orig = false; $has_orig_completed = false; $has_completed = false; $has_orig_type = ''; $orig_title = ''; $orig_content = ''; $view_name = '<strong class="js-wpv-insert-view-form-results-helper-name"></strong>'; $view_shortcode = '<code class="js-wpv-insert-view-form-results-helper-shortcode"></code>'; $view_classname = ''; //----- // Preparation //----- if (isset($_GET['completeview']) && !empty($_GET['completeview'])) { global $wpdb; $view_id = $_GET['completeview']; $title = $wpdb->get_var($wpdb->prepare("SELECT post_title FROM {$wpdb->posts} \n\t\t\t\t\tWHERE ID = %d \n\t\t\t\t\tLIMIT 1", $view_id)); if ($title !== NULL) { $has_view = true; $view_name = '<strong class="js-wpv-insert-view-form-results-helper-name">' . $title . '</strong>'; $view_shortcode = '<code class="js-wpv-insert-view-form-results-helper-shortcode">[wpv-view name="' . $title . '"]</code>'; $view_classname = ' js-wpv-insert-form-workflow-help-box-for-' . $view_id; $view_classname_after = ' js-wpv-insert-form-workflow-help-box-for-after-' . $view_id; if (strpos($post->post_content, '[wpv-view name="' . $title) !== false) { $has_completed = true; } if (isset($_GET['origid']) && !empty($_GET['origid']) && $_GET['origid'] != '0') { $orig_id = $_GET['origid']; if ($orig_id == 'widget' || $orig_id == 'layout') { $has_orig = true; $has_orig_type = $orig_id; } else { $orig_data_array = $wpdb->get_results($wpdb->prepare("SELECT post_title, post_content FROM {$wpdb->posts} \n\t\t\t\t\t\t\t\tWHERE ID = %d \n\t\t\t\t\t\t\t\tLIMIT 1", $orig_id)); if (!empty($orig_data_array)) { $has_orig = true; $has_orig_type = 'post'; $orig_data = $orig_data_array[0]; $orig_title = $orig_data->post_title; $orig_content = $orig_data->post_content; if (strpos($orig_content, '[wpv-form-view name="' . $title) !== false) { $has_orig_completed = true; } } } } } } //----- // Execution //----- if (!$has_view) { // Add the basic help box for the SELF case, hidden $data_def = array('text' => '<h2>' . __('Complete the parametric search setup by inserting the results', 'wpv-views') . '</h2>' . '<p>' . sprintf(__('This page should display the results of the parametric search provided by the View <strong>%s</strong>.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . sprintf(__('You can copy and paste this shortcode wherever you want to display the results: %s', 'wpv-views'), $view_shortcode) . '</p>' . '<p>' . sprintf(__('Also, you can click in the <strong>Views</strong> button and select <strong>%s</strong> in the <em>View</em> section.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . __('Then, select the option to display just the results for the parametric search.', 'wpv-views') . '</p>', 'close' => 'true', 'hidden' => 'true', 'classname' => 'js-wpv-insert-form-workflow-help-box'); wpv_toolset_help_box($data_def); } else { // There is a $_GET['completeview'] attribute, and it matches an existing View if ($has_orig) { // There is also a $_GET['origid'] attribute switch ($has_orig_type) { case 'post': // Has View data and orig data, so show everything if ($has_completed) { if ($has_orig_completed) { // Target has shortcode, and orig has shortcode $data = array('text' => '<h2>' . __('Parametric search setup completed!', 'wpv-views') . '</h2>' . '<p>' . sprintf(__('You have finished the setup of the parametric search provided by the View <strong>%s</strong>.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . sprintf(__('The form will appear on the page <strong>%s</strong> and the results will be shown in this page.', 'wpv-views'), $orig_title) . '</p>' . '<p><a href="#" class="button button-small button-primary-toolset js-wpv-insert-form-workflow-help-box-close">' . __('Close', 'wpv-views') . '</a></p>', 'close' => 'true', 'hidden' => 'false', 'classname' => 'js-wpv-insert-form-workflow-help-box' . $view_classname); wpv_toolset_help_box($data); } else { // Target has shortcode, but orig lacks shortcode $data = array('text' => '<h2>' . sprintf(__('Don\'t forget to insert the parametric search box into %s', 'wpv-views'), $orig_title) . '</h2>' . '<p>' . sprintf(__('You are almost done with this parametric search provided by the View <strong>%s</strong>.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . __('This page already has all it needs to display the results.', 'wpv-views') . WPV_MESSAGE_SPACE_CHAR . sprintf(__('Remember to get back to the other tab in your browser and insert the search View into <strong>%s</strong>.', 'wpv-views'), $orig_title) . '</p>' . '<p><a href="#" class="button button-small button-primary-toolset js-wpv-insert-form-workflow-help-box-close">' . __('Close', 'wpv-views') . '</a></p>', 'close' => 'true', 'hidden' => 'false', 'classname' => 'js-wpv-insert-form-workflow-help-box' . $view_classname); wpv_toolset_help_box($data); } } else { $data = array('text' => '<h2>' . __('Complete the parametric search setup by inserting the results', 'wpv-views') . '</h2>' . '<p>' . sprintf(__('This page should display the results of the parametric search provided by the View <strong>%s</strong>.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . sprintf(__('You can copy and paste this shortcode wherever you want to display the results: %s', 'wpv-views'), $view_shortcode) . '</p>' . '<p>' . sprintf(__('Also, you can click in the <strong>Views</strong> button and select <strong>%s</strong> in the <em>View</em> section.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . __('Then, select the option to display just the results for the parametric search.', 'wpv-views') . '</p>', 'close' => 'true', 'hidden' => 'false', 'classname' => 'js-wpv-insert-form-workflow-help-box' . $view_classname); wpv_toolset_help_box($data); if ($has_orig_completed) { // After inserting the shortcode, we can call it complete! $data_after = array('text' => '<h2>' . __('Parametric search setup completed!', 'wpv-views') . '</h2>' . '<p>' . sprintf(__('You have finished the setup of the parametric search provided by the View <strong>%s</strong>.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . sprintf(__('The form will appear on the page <strong>%s</strong> and the results will be shown in this page.', 'wpv-views'), $orig_title) . '</p>' . '<p><a href="#" class="button button-small button-primary-toolset js-wpv-insert-form-workflow-help-box-close">' . __('Close', 'wpv-views') . '</a></p>', 'close' => 'true', 'hidden' => 'true', 'classname' => 'js-wpv-insert-form-workflow-help-box-after' . $view_classname_after); wpv_toolset_help_box($data_after); } else { // After inserting, origin is lacking shortcode $data_after = array('text' => '<h2>' . sprintf(__('Don\'t forget to insert the parametric search box into %s', 'wpv-views'), $orig_title) . '</h2>' . '<p>' . sprintf(__('You are almost done with this parametric search provided by the View <strong>%s</strong>.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . __('This page already has all it needs to display the results.', 'wpv-views') . WPV_MESSAGE_SPACE_CHAR . sprintf(__('Remember to get back to the other tab in your browser and insert the search View into <strong>%s</strong>.', 'wpv-views'), $orig_title) . '</p>' . '<p><a href="#" class="button button-small button-primary-toolset js-wpv-insert-form-workflow-help-box-close">' . __('Close', 'wpv-views') . '</a></p>', 'close' => 'true', 'hidden' => 'true', 'classname' => 'js-wpv-insert-form-workflow-help-box-after' . $view_classname_after); wpv_toolset_help_box($data_after); } } break; case 'widget': case 'layout': if ($has_orig_type == 'widget') { $orig_label = __('widget', 'wpv-views'); } else { if ($has_orig_type == 'layout') { $orig_label = __('layout', 'wpv-views'); } } // Has View data and orig data from widget, so show everything if ($has_completed) { $data = array('text' => '<h2>' . __('Parametric search setup completed!', 'wpv-views') . '</h2>' . '<p>' . sprintf(__('This page will display the results of the parametric search provided by the View <strong>%s</strong> used in a %s.', 'wpv-views'), $view_name, $orig_label) . '</p>' . '<p>' . sprintf(__('Remember to get back to the other tab in your browser and save the %s settings.', 'wpv-views'), $orig_label) . '</p>' . '<p><a href="#" class="button button-small button-primary-toolset js-wpv-insert-form-workflow-help-box-close">' . __('Close', 'wpv-views') . '</a></p>', 'close' => 'true', 'hidden' => 'false', 'classname' => 'js-wpv-insert-form-workflow-help-box' . $view_classname); } else { $data = array('text' => '<h2>' . __('Complete the parametric search setup by inserting the results', 'wpv-views') . '</h2>' . '<p>' . sprintf(__('This page should display the results of the parametric search provided by the View <strong>%s</strong> used in a %s.', 'wpv-views'), $view_name, $orig_label) . WPV_MESSAGE_SPACE_CHAR . sprintf(__('You can copy and paste this shortcode wherever you want to display the results: %s', 'wpv-views'), $view_shortcode) . '</p>' . '<p>' . sprintf(__('Also, you can click in the <strong>Views</strong> button and select <strong>%s</strong> in the <em>View</em> section.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . __('Then, select the option to display just the results for the parametric search.', 'wpv-views') . '</p>', 'close' => 'true', 'hidden' => 'false', 'classname' => 'js-wpv-insert-form-workflow-help-box' . $view_classname); $data_after = array('text' => '<h2>' . __('Parametric search setup completed!', 'wpv-views') . '</h2>' . '<p>' . sprintf(__('This page will display the results of the parametric search provided by the View <strong>%s</strong> used in a %s.', 'wpv-views'), $view_name, $orig_label) . '</p>' . '<p>' . sprintf(__('Remember to get back to the other tab in your browser and save the %s settings.', 'wpv-views'), $orig_label) . '</p>' . '<p><a href="#" class="button button-small button-primary-toolset js-wpv-insert-form-workflow-help-box-close">' . __('Close', 'wpv-views') . '</a></p>', 'close' => 'true', 'hidden' => 'true', 'classname' => 'js-wpv-insert-form-workflow-help-box-after' . $view_classname_after); wpv_toolset_help_box($data_after); } wpv_toolset_help_box($data); break; default: break; } // We also need to add basic help box, for maybe future SELF cases, hidden $data_def = array('text' => '<h2>' . __('Complete the parametric search setup by inserting the results', 'wpv-views') . '</h2>' . '<p>' . sprintf(__('This page should display the results of the parametric search provided by the View <strong>%s</strong>.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . sprintf(__('You can copy and paste this shortcode wherever you want to display the results: %s', 'wpv-views'), $view_shortcode) . '</p>' . '<p>' . sprintf(__('Also, you can click in the <strong>Views</strong> button and select <strong>%s</strong> in the <em>View</em> section.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . __('Then, select the option to display just the results for the parametric search.', 'wpv-views') . '</p>', 'close' => 'true', 'hidden' => 'true', 'classname' => 'js-wpv-insert-form-workflow-help-box'); wpv_toolset_help_box($data_def); } else { // There is no valid $_GET['origid'] attribute // We check whether the current page has the shortcode already inserted or not if ($has_completed) { // It has View data, no orig data and is completed $data_already_inserted = array('text' => '<h2>' . __('Parametric search setup completed!', 'wpv-views') . '</h2>' . '<p>' . sprintf(__('You have finished the setup of the parametric search provided by the View <strong>%s</strong>.', 'wpv-views'), $view_name) . '</p>' . '<p><a href="#" class="button button-small button-primary-toolset js-wpv-insert-form-workflow-help-box-close">' . __('Close', 'wpv-views') . '</a></p>', 'close' => 'true', 'hidden' => 'false', 'classname' => 'js-wpv-insert-form-workflow-help-box-completed'); wpv_toolset_help_box($data_already_inserted); // We also add the basic help box for SELF, hidden $data_def = array('text' => '<h2>' . __('Complete the parametric search setup by inserting the results', 'wpv-views') . '</h2>' . '<p>' . sprintf(__('This page should display the results of the parametric search provided by the View <strong>%s</strong>.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . sprintf(__('You can copy and paste this shortcode wherever you want to display the results: %s', 'wpv-views'), $view_shortcode) . '</p>' . '<p>' . sprintf(__('Also, you can click in the <strong>Views</strong> button and select <strong>%s</strong> in the <em>View</em> section.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . __('Then, select the option to display just the results for the parametric search.', 'wpv-views') . '</p>', 'close' => 'true', 'hidden' => 'true', 'classname' => 'js-wpv-insert-form-workflow-help-box'); wpv_toolset_help_box($data_def); } else { // It has View data, no orig data and is not completed // So we display the basic help box with View data $data = array('text' => '<h2>' . __('Complete the parametric search setup by inserting the results', 'wpv-views') . '</h2>' . '<p>' . sprintf(__('This page should display the results of the parametric search provided by the View <strong>%s</strong>.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . sprintf(__('You can copy and paste this shortcode wherever you want to display the results: %s', 'wpv-views'), $view_shortcode) . '</p>' . '<p>' . sprintf(__('Also, you can click in the <strong>Views</strong> button and select <strong>%s</strong> in the <em>View</em> section.', 'wpv-views'), $view_name) . WPV_MESSAGE_SPACE_CHAR . __('Then, select the option to display just the results for the parametric search.', 'wpv-views') . '</p>', 'close' => 'true', 'hidden' => 'false', 'classname' => 'js-wpv-insert-form-workflow-help-box' . $view_classname); wpv_toolset_help_box($data); } } } } }
/** * View edit screen */ function views_redesign_html() { global $WP_Views, $post; if (isset($_GET['view_id']) && is_numeric($_GET['view_id'])) { do_action('views_edit_screen'); $view_id = (int) $_GET['view_id']; $view = get_post($view_id); if (null == $view) { wpv_die_toolset_alert_error(__('You attempted to edit a View that doesn’t exist. Perhaps it was deleted?', 'wpv-views')); } elseif ('view' != $view->post_type) { wpv_die_toolset_alert_error(__('You attempted to edit a View that doesn’t exist. Perhaps it was deleted?', 'wpv-views')); } else { $view_settings = get_post_meta($_GET['view_id'], '_wpv_settings', true); /** * wpv_view_settings * * Internal filter to set some View settings that will overwrite the ones existing in the _wpv_settings postmeta * Only used to set default values that need to be there on the returned array, but may not be there for legacy reasons * Use wpv_filter_override_view_settings to override View settings - like on the Theme Frameworks integration * * @param $view_settings (array) Unserialized array of the _wpv_settings postmeta * @param $view_id (integer) The View ID * * @return $view_settings (array) The View settings * * @since unknown */ $view_settings = apply_filters('wpv_view_settings', $view_settings, $view_id); $view_layout_settings = get_post_meta($_GET['view_id'], '_wpv_layout_settings', true); /** * wpv_view_layout_settings * * Internal filter to set some View layout settings that will overwrite the ones existing in the _wpv_layout_settings postmeta * Only used to set default values that need to be there on the returned array,, but may not be there for legacy reasons * Use wpv_filter_override_view_layout_settings to override View layout settings * * @param $view_layout_settings (array) Unserialized array of the _wpv_layout_settings postmeta * @param $view_id (integer) The View ID * * @return $view_layout_settings (array) The View layout settings * * @since 1.8.0 */ $view_layout_settings = apply_filters('wpv_view_layout_settings', $view_layout_settings, $view_id); if (isset($view_settings['view-query-mode']) && 'normal' == $view_settings['view-query-mode']) { $post = $view; if (get_post_status($view_id) == 'trash') { wpv_die_toolset_alert_error(__('You can’t edit this View because it is in the Trash. Please restore it and try again.', 'wpv-views')); } } else { wpv_die_toolset_alert_error(__('You attempted to edit a View that doesn’t exist. Perhaps it was deleted?', 'wpv-views')); } } } else { wpv_die_toolset_alert_error(__('You attempted to edit a View that doesn’t exist. Perhaps it was deleted?', 'wpv-views')); } ?> <?php /** * Screen Options tab */ ?> <div id="screen-meta-dup" class="metabox-prefs js-screen-meta-dup hidden"> <div id="screen-options-wrap" aria-label="<?php echo esc_attr(__('Screen Options Tab')); ?> " class="wpv-screen-options js-wpv-show-hide-container" data-dpsneedsfilter="<?php echo esc_attr(__('The parametric search settings section has unsaved changes, so you can not hide it', 'wpv-views')); ?> " data-pagneedsfilter="<?php echo esc_attr(__('Pagination requires the Filter HTML section to be visible.', 'wpv-views')); ?> " data-unclickable="<?php echo esc_attr(__('This section has unsaved changes, so you can not hide it', 'wpv-views')); ?> "> <h5><?php _e('Show on screen', 'wpv-views'); ?> </h5> <p> <small><?php echo __('Note that those Screen Options are set per View.', 'wpv-views'); ?> </small> </p> <?php $sections = array(); $sections = apply_filters('wpv_sections_query_show_hide', $sections); if (!empty($sections)) { ?> <div class="wpv-show-hide-section wpv-show-hide-section-query js-wpv-show-hide-section" data-metasection="wpv-query-section"> <h6><?php _e('Query section', 'wpv-views'); ?> </h6> <span class="js-wpv-screen-pref"> <?php if (isset($view_settings['metasections-hep-show-hide']) && isset($view_settings['metasections-hep-show-hide']['wpv-query-help'])) { $state = $view_settings['metasections-hep-show-hide']['wpv-query-help']; } else { $state = 'on'; } ?> <label for="wpv-show-hide-query-help"> <input type="checkbox" id="wpv-show-hide-query-help" data-metasection="query" class="js-wpv-show-hide-help js-wpv-show-hide-query-help" <?php checked('on', $state); ?> autocomplete="off" /> <?php echo __('Display Query section help', 'wpv-views'); ?> </label> <input name="wpv-query-help" type="hidden" class="js-wpv-show-hide-help-value js-wpv-show-hide-query-help-value" value="<?php echo esc_attr($state); ?> " autocomplete="off" /> </span> <?php foreach ($sections as $key => $values) { if (isset($view_settings['sections-show-hide']) && isset($view_settings['sections-show-hide'][$key])) { $values['state'] = $view_settings['sections-show-hide'][$key]; } else { $values['state'] = 'on'; } ?> <span class="js-wpv-screen-pref"> <label for="wpv-show-hide-<?php echo esc_attr($key); ?> "> <input data-section="<?php echo esc_attr($key); ?> " type="checkbox" id="wpv-show-hide-<?php echo esc_attr($key); ?> " class="js-wpv-show-hide js-wpv-show-hide-<?php echo esc_attr($key); ?> " <?php checked('on', $values['state']); ?> autocomplete="off" /> <?php echo $values['name']; ?> </label> <input data-section="<?php echo esc_attr($key); ?> " name="<?php echo esc_attr($key); ?> " class="js-wpv-show-hide-value" type="hidden" value="<?php echo esc_attr($values['state']); ?> " autocomplete="off" /> </span> <?php } ?> </div> <?php } ?> <?php $sections = array(); $sections = apply_filters('wpv_sections_filter_show_hide', $sections); if (!empty($sections)) { ?> <div class="wpv-show-hide-section wpv-show-hide-section-filter js-wpv-show-hide-section" data-metasection="wpv-filter-section"> <h6><?php _e('Filter section', 'wpv-views'); ?> </h6> <span class="js-wpv-screen-pref"> <?php if (isset($view_settings['metasections-hep-show-hide']) && isset($view_settings['metasections-hep-show-hide']['wpv-filter-help'])) { $state = $view_settings['metasections-hep-show-hide']['wpv-filter-help']; } else { $state = 'on'; } ?> <label for="wpv-show-hide-filter-help"> <input type="checkbox" id="wpv-show-hide-filter-help" data-metasection="filter" class="js-wpv-show-hide-help js-wpv-show-hide-filter-help" <?php checked('on', $state); ?> autocomplete="off" /> <?php echo __('Display Filter section help', 'wpv-views'); ?> </label> <input name="wpv-filter-help" type="hidden" class="js-wpv-show-hide-help-value js-wpv-show-hide-filter-help-value" value="<?php echo esc_attr($state); ?> " autocomplete="off" /> </span> <?php foreach ($sections as $key => $values) { if (isset($view_settings['sections-show-hide']) && isset($view_settings['sections-show-hide'][$key])) { $values['state'] = $view_settings['sections-show-hide'][$key]; } else { $values['state'] = 'on'; } ?> <span class="js-wpv-screen-pref"> <label for="wpv-show-hide-<?php echo esc_attr($key); ?> "> <input data-section="<?php echo esc_attr($key); ?> " type="checkbox" id="wpv-show-hide-<?php echo esc_attr($key); ?> " class="js-wpv-show-hide js-wpv-show-hide-<?php echo esc_attr($key); ?> " <?php checked('on', $values['state']); ?> autocomplete="off" /> <?php echo $values['name']; ?> </label> <input data-section="<?php echo esc_attr($key); ?> " name="<?php echo esc_attr($key); ?> " class="js-wpv-show-hide-value" type="hidden" value="<?php echo esc_attr($values['state']); ?> " autocomplete="off" /> </span> <?php } ?> </div> <?php } ?> <?php $sections = array(); $sections = apply_filters('wpv_sections_layout_show_hide', $sections); $js = isset($view_layout_settings['additional_js']) ? strval($view_layout_settings['additional_js']) : ''; if ('' == $js && isset($sections['layout-settings-extra-js'])) { unset($sections['layout-settings-extra-js']); } if (!empty($sections)) { ?> <div class="wpv-show-hide-section wpv-show-hide-section-layout js-wpv-show-hide-section" data-metasection="wpv-layout-section"> <h6><?php _e('Loop Output section', 'wpv-views'); ?> </h6> <span class="js-wpv-screen-pref"> <?php if (isset($view_settings['metasections-hep-show-hide']) && isset($view_settings['metasections-hep-show-hide']['wpv-layout-help'])) { $state = $view_settings['metasections-hep-show-hide']['wpv-layout-help']; } else { $state = 'on'; } ?> <label for="wpv-show-hide-layout-help"> <input type="checkbox" id="wpv-show-hide-layout-help" data-metasection="layout" class="js-wpv-show-hide-help js-wpv-show-hide-layout-help" <?php checked('on', $state); ?> autocomplete="off" /> <?php echo __('Display help for the Loop Output section', 'wpv-views'); ?> </label> <input name="wpv-layout-help" type="hidden" class="js-wpv-show-hide-help-value js-wpv-show-hide-layout-help-value" value="<?php echo esc_attr($state); ?> " autocomplete="off" /> </span> <?php foreach ($sections as $key => $values) { if (isset($view_settings['sections-show-hide']) && isset($view_settings['sections-show-hide'][$key])) { $values['state'] = $view_settings['sections-show-hide'][$key]; } else { $values['state'] = 'on'; } ?> <span class="js-wpv-screen-pref"> <label for="wpv-show-hide-<?php echo esc_attr($key); ?> "> <input data-section="<?php echo esc_attr($key); ?> " type="checkbox" id="wpv-show-hide-<?php echo esc_attr($key); ?> " class="js-wpv-show-hide js-wpv-show-hide-<?php echo esc_attr($key); ?> " <?php checked('on', $values['state']); ?> autocomplete="off" /> <?php echo $values['name']; ?> </label> <input data-section="<?php echo esc_attr($key); ?> " name="<?php echo esc_attr($key); ?> " class="js-wpv-show-hide-value" type="hidden" value="<?php echo esc_attr($values['state']); ?> " autocomplete="off" /> </span> <?php } ?> </div> <?php } ?> <?php if (!isset($view_settings['view_purpose']) || $view_settings['view_purpose'] == 'bootstrap-grid') { $view_settings['view_purpose'] = 'full'; } ?> <p> <label for="wpv-view-purpose"><?php echo __('View purpose', 'wpv-views'); ?> </label> <select id="wpv-view-purpose" class="js-view-purpose" autocomplete="off"> <?php $purpose_options = array('all' => __('Display all results', 'wpv-views'), 'pagination' => __('Display the results with pagination', 'wpv-views'), 'slider' => __('Display the results as a slider', 'wpv-views'), 'parametric' => __('Display the results as a parametric search', 'wpv-views'), 'full' => __('Full custom display mode', 'wwpv-views')); foreach ($purpose_options as $opt => $opt_name) { ?> <option id="wpv-settings-query-type-posts" <?php selected($view_settings['view_purpose'], $opt); ?> value="<?php echo esc_attr($opt); ?> "><?php echo $opt_name; ?> </option> <?php } ?> </select> <input type="hidden" data-nonce="<?php echo wp_create_nonce('wpv_view_show_hide_nonce'); ?> " class="js-wpv-show-hide-update" autocomplete="off" /> </p> <div class="js-wpv-toolset-messages"></div> </div> </div> <div id="screen-meta-links-dup" class="js-screen-meta-links-dup"> <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle"> <a id="show-settings-link" class="show-settings" aria-expanded="false" aria-controls="screen-options-wrap" href="#screen-options-wrap"><?php _e('Screen Options'); ?> </a> </div> </div> <?php /** * Actual View edit page */ ?> <div class="wrap toolset-views"> <input id="post_ID" class="js-post_ID" type="hidden" value="<?php echo esc_attr($view_id); ?> " data-nonce="<?php echo wp_create_nonce('wpv_view_edit_general_nonce'); ?> " /> <input id="toolset-edit-data" type="hidden" value="<?php echo esc_attr($view_id); ?> " data-plugin="views" /> <div id="icon-edit" class="icon32 icon32-posts-post"><br></div> <h2><?php echo __('Edit View', 'wpv-views'); ?> </h2> <?php if (isset($_GET['in-iframe-for-layout'])) { $in_iframe = 'yes'; } else { $in_iframe = ''; } $user_id = get_current_user_id(); ?> <input type="hidden" class="js-wpv-display-in-iframe" value="<?php echo esc_attr($in_iframe); ?> " /> <div id="js-wpv-general-actions-bar" class="wpv-settings-save-all wpv-general-actions-bar wpv-setting-container js-wpv-no-lock js-wpv-general-actions-bar"> <p class="update-button-wrap js-wpv-update-button-wrap"> <button class="button-secondary button button-large js-wpv-view-save-all" disabled="disabled" data-success="<?php echo esc_attr(__('View saved', 'wpv-views')); ?> " data-unsaved="<?php echo esc_attr(__('View not saved', 'wpv-views')); ?> "> <?php _e('Save all sections at once', 'wpv-views'); ?> </button> </p> <span class="wpv-message-container js-wpv-message-container"></span> </div> <input type="hidden" name="_wpv_settings[view-query-mode]" value="normal" /> <div class="wpv-title-section"> <div class="wpv-setting-container wpv-settings-title-and-desc js-wpv-settings-title-and-desc js-wpv-no-lock"> <div class="wpv-settings-header"> <h3> <?php _e('Title and Description', 'wpv-views'); $section_help_pointer = WPV_Admin_Messages::edit_section_help_pointer('title_and_description'); ?> <i class="icon-question-sign js-display-tooltip" data-header="<?php echo esc_attr($section_help_pointer['title']); ?> " data-content="<?php echo esc_attr($section_help_pointer['content']); ?> "> </i> </h3> </div> <div class="wpv-setting"> <div id="titlediv"> <div id="titlewrap" class="js-wpv-titlewrap"> <label class="screen-reader-text js-title-reader" id="title-prompt-text" for="title"><?php _e('Enter title here', 'wp-views'); ?> </label> <input id="title" class="js-title" type="text" name="post_title" size="30" value="<?php echo esc_attr(get_the_title($view_id)); ?> " id="title" autocomplete="off"> </div> </div> <div id="edit-slug-box" class="js-wpv-slug-container"> <label for="wpv-slug"><?php _e('Slug of this View', 'wpv-views'); ?> <input id="wpv-slug" class="js-wpv-slug" type="text" value="<?php echo esc_attr($view->post_name); ?> " /> <span class="js-wpv-inline-trash"> • <button class="button-secondary js-wpv-change-view-status" data-statusto="trash" data-success="<?php echo esc_attr(__('View moved to trash', 'wpv-views')); ?> " data-unsaved="<?php echo esc_attr(__('View not moved to trash', 'wpv-views')); ?> " data-redirect="<?php echo admin_url('admin.php?page=views'); ?> " data-nonce="<?php echo wp_create_nonce('wpv_view_change_status'); ?> "> <i class="icon-trash"></i> <?php _e('Move to trash', 'wpv-views'); ?> </button> </span> </div> <?php $view_description = get_post_meta($_GET['view_id'], '_wpv_description', true); ?> <p<?php echo isset($view_description) && !empty($view_description) ? ' class="hidden"' : ''; ?> > <button class="js-wpv-description-toggle button-secondary" ><?php _e('Add description', 'wpv-views'); ?> </button> </p> <div class="js-wpv-description-container wpv-description-container<?php echo isset($view_description) && !empty($view_description) ? '' : ' hidden'; ?> "> <p> <label for="wpv-description"><?php _e('Describe this View', 'wpv-views'); ?> </label> </p> <p> <textarea id="wpv-description" class="js-wpv-description" name="_wpv_settings[view_description]" cols="72" rows="4"><?php echo isset($view_description) ? esc_html($view_description) : ''; ?> </textarea> </p> </div> <p class="update-button-wrap js-wpv-update-button-wrap"> <span class="js-wpv-message-container"></span> <button data-success="<?php echo esc_attr(__('Title and description updated', 'wpv-views')); ?> " data-unsaved="<?php echo esc_attr(__('Title and description not saved', 'wpv-views')); ?> " data-nonce="<?php echo wp_create_nonce('wpv_view_title_description_nonce'); ?> " class="js-wpv-title-description-update button-secondary" disabled="disabled"><?php _e('Update', 'wpv-views'); ?> </button> </p> </div> </div> </div> <!-- .wpv-title-section --> <div class="wpv-query-section"> <?php wpv_get_view_introduction_data(); ?> <h3 class="wpv-section-title"><?php _e('The Query section determines what content the View loads from the database', 'wpv-views'); ?> </h3> <?php do_action('view-editor-section-query', $view_settings, $view_id, $user_id); ?> </div> <?php /* * Query type (content selection) - Priority 10 * Query options - Priority 20 * Ordering - Priority 30 * Limit and offset - Priority 40 * Filters - Priority 50 */ ?> <div class="wpv-filter-section"> <h3 class="wpv-section-title"><?php _e('The Filter section lets you set up pagination and parametric search, which let visitors control the View query', 'wpv-views'); ?> </h3> <?php wpv_get_view_filter_introduction_data(); ?> <?php do_action('view-editor-section-filter', $view_settings, $view_id, $user_id); ?> </div> <?php /* * Pagination TODO review this. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/161787682/comments - Priority 50 * Filters Meta HTML/CSS/JS TODO review this. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/161787682/comments - Priority 80 */ ?> <div class="wpv-layout-section"> <h3 class="wpv-section-title"><?php _e('The Loop Output section styles the View output on the page.', 'wpv-views'); ?> </h3> <?php $data = wpv_get_view_layout_introduction_data(); wpv_toolset_help_box($data); ?> <?php do_action('view-editor-section-layout', $view_settings, $view_layout_settings, $view_id, $user_id); ?> <?php do_action('view-editor-section-extra', $view_settings, $view_id, $user_id); ?> </div> <?php $display_help = isset($_GET['in-iframe-for-layout']) && $_GET['in-iframe-for-layout'] == 1 ? false : true; if ($display_help === true) { ?> <div class="wpv-help-section"> <?php wpv_display_view_howto_help_box(); ?> </div> <?php } ?> <script type="text/javascript"> jQuery( function( $ ) { jQuery('li.current a').attr('href',jQuery('li.current a').attr('href')+'&view_id=<?php echo esc_attr($view_id); ?> '); }); </script> <?php /* * Output (layout) type - TODO review this https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/162512599/comments - Priority 10 - To remove * Output fields TODO this has been reviewed and may be used as training - Priority 20 - To remove * Layout templates TODO insert here the new Content Templates editor. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/161787695/comments - Priority 20 - To review * Layout Meta HTML/CSS/JS TODO this has been reviewed and needs some changes. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/161787640/comments - Priority 40 * Aditional Javascript files TODO move to its own file - Priority 50 * Extra sections: * 1. Complete output (the_content) * 2. Module manager TODO needs to be added */ ?> </div> <?php /** * view-editor-section-hidden * * Show hidden container for dialogs, pointers and messages that need to be taken by ColorBox from an existing HTML element * * @param $view_settings * @param $view_laqyout_settings * @param $view_id * @param $user_id * * @note that you can use the .popup-window-container classname to hide the containers added here * * @since 1.7 */ do_action('view-editor-section-hidden', $view_settings, $view_layout_settings, $view_id, $user_id); if (!class_exists('_WP_Editors')) { require ABSPATH . WPINC . '/class-wp-editor.php'; } _WP_Editors::wp_link_dialog(); }
/** * WordPress Archives edit screen */ function views_archive_redesign_html() { global $WP_Views, $post, $views_edit_help; if (isset($_GET['view_id']) && is_numeric($_GET['view_id'])) { do_action('views_edit_screen'); $view_id = (int) $_GET['view_id']; $view = get_post($view_id); if (null == $view) { wp_die('<div class="wpv-setting-container"><p class="toolset-alert toolset-alert-error">' . __('You attempted to edit a WordPress Archive that doesn’t exist. Perhaps it was deleted?', 'wpv-views') . '</p></div>'); } elseif ('view' != $view->post_type) { wp_die('<div class="wpv-setting-container"><p class="toolset-alert toolset-alert-error">' . __('You attempted to edit a WordPress Archive that doesn’t exist. Perhaps it was deleted?', 'wpv-views') . '</p></div>'); } else { $view_settings = get_post_meta($_GET['view_id'], '_wpv_settings', true); $view_layout_settings = get_post_meta($_GET['view_id'], '_wpv_layout_settings', true); if (!is_array($view_layout_settings)) { $view_layout_settings = array(); } if (isset($view_settings['view-query-mode']) && 'archive' == $view_settings['view-query-mode']) { $post = $view; if (get_post_status($view_id) == 'trash') { wp_die('<div class="wpv-setting-container"><p class="toolset-alert toolset-alert-error">' . __('You can’t edit this WordPress Archive because it is in the Trash. Please restore it and try again.', 'wpv-views') . '</p></div>'); } } else { wp_die('<div class="wpv-setting-container"><p class="toolset-alert toolset-alert-error">' . __('You attempted to edit a WordPress Archive that doesn’t exist. Perhaps it was deleted?', 'wpv-views') . '</p></div>'); } } } else { wp_die('<div class="wpv-setting-container"><p class="toolset-alert toolset-alert-error">' . __('You attempted to edit a WordPress Archive that doesn’t exist. Perhaps it was deleted?', 'wpv-views') . '</p></div>'); } ?> <div id="screen-meta-dup" class="metabox-prefs js-screen-meta-dup hidden"> <div id="screen-options-wrap" aria-label="<?php echo htmlentities(__('Screen Options Tab'), ENT_QUOTES); ?> " class="wpv-screen-options js-wpv-show-hide-container" data-pagneedsfilter="<?php echo htmlentities(__('Pagination requires the Filter HTML section to be visible.', 'wpv-views'), ENT_QUOTES); ?> " data-unclickable="<?php echo htmlentities(__('This section has unsaved changes, so you can not hide it', 'wpv-views'), ENT_QUOTES); ?> "> <h5><?php _e('Show on screen', 'wpv-views'); ?> </h5> <?php $sections = array(); $sections = apply_filters('wpv_sections_archive_loop_show_hide', $sections); if (!empty($sections)) { ?> <div class="wpv-show-hide-section wpv-show-hide-section-query js-wpv-show-hide-section" data-metasection="wpv-query-section"> <h6><?php _e('Loop section', 'wpv-views'); ?> </h6> <span class="js-wpv-screen-pref"> <?php if (isset($view_settings['metasections-hep-show-hide']) && isset($view_settings['metasections-hep-show-hide']['wpv-query-help'])) { $state = $view_settings['metasections-hep-show-hide']['wpv-query-help']; } else { $state = 'on'; } ?> <label for="wpv-show-hide-query-help"><input type="checkbox" id="wpv-show-hide-query-help" data-metasection="query" class="js-wpv-show-hide-help js-wpv-show-hide-query-help"<?php if ('on' == $state) { echo ' checked="checked"'; } ?> /><?php echo __('Display Query section help', 'wpv-views'); ?> </label> <input name="wpv-query-help" type="hidden" class="js-wpv-show-hide-help-value js-wpv-show-hide-query-help-value" value="<?php echo $state; ?> " /> </span> <?php foreach ($sections as $key => $values) { if (isset($view_settings['sections-show-hide']) && isset($view_settings['sections-show-hide'][$key])) { $values['state'] = $view_settings['sections-show-hide'][$key]; } else { $values['state'] = 'on'; } ?> <span class="js-wpv-screen-pref"> <label for="wpv-show-hide-<?php echo $key; ?> "><input data-section="<?php echo $key; ?> " type="checkbox" id="wpv-show-hide-<?php echo $key; ?> " class="js-wpv-show-hide js-wpv-show-hide-<?php echo $key; ?> "<?php if ('on' == $values['state']) { echo ' checked="checked"'; } ?> /><?php echo $values['name']; ?> </label> <input data-section="<?php echo $key; ?> " name="<?php echo $key; ?> " class="js-wpv-show-hide-value" type="hidden" value="<?php echo $values['state']; ?> " /> </span> <?php } ?> </div> <?php } ?> <?php $sections = array(); $sections = apply_filters('wpv_sections_layout_show_hide', $sections); $js = isset($view_layout_settings['additional_js']) ? strval($view_layout_settings['additional_js']) : ''; if ('' == $js && isset($sections['layout-settings-extra-js'])) { unset($sections['layout-settings-extra-js']); } if (!empty($sections)) { ?> <div class="wpv-show-hide-section wpv-show-hide-section-layout js-wpv-show-hide-section" data-metasection="wpv-layout-section"> <h6><?php _e('Layout section', 'wpv-views'); ?> </h6> <span class="js-wpv-screen-pref"> <?php if (isset($view_settings['metasections-hep-show-hide']) && isset($view_settings['metasections-hep-show-hide']['wpv-layout-help'])) { $state = $view_settings['metasections-hep-show-hide']['wpv-layout-help']; } else { $state = 'on'; } ?> <label for="wpv-show-hide-layout-help"><input type="checkbox" id="wpv-show-hide-layout-help" data-metasection="layout" class="js-wpv-show-hide-help js-wpv-show-hide-layout-help"<?php if ('on' == $state) { echo ' checked="checked"'; } ?> /><?php echo __('Display Layout section help', 'wpv-views'); ?> </label> <input name="wpv-layout-help" type="hidden" class="js-wpv-show-hide-help-value js-wpv-show-hide-layout-help-value" value="<?php echo $state; ?> " /> </span> <?php foreach ($sections as $key => $values) { if (isset($view_settings['sections-show-hide']) && isset($view_settings['sections-show-hide'][$key])) { $values['state'] = $view_settings['sections-show-hide'][$key]; } else { $values['state'] = 'on'; } ?> <span class="js-wpv-screen-pref"> <label for="wpv-show-hide-<?php echo $key; ?> "><input data-section="<?php echo $key; ?> " type="checkbox" id="wpv-show-hide-<?php echo $key; ?> " class="js-wpv-show-hide js-wpv-show-hide-<?php echo $key; ?> "<?php if ('on' == $values['state']) { echo ' checked="checked"'; } ?> /><?php echo $values['name']; ?> </label> <input data-section="<?php echo $key; ?> " name="<?php echo $key; ?> " class="js-wpv-show-hide-value" type="hidden" value="<?php echo $values['state']; ?> " /> </span> <?php } ?> </div> <?php } ?> <p> <button data-success="<?php echo htmlentities(__('Saved', 'wpv-views'), ENT_QUOTES); ?> " data-unsaved="<?php echo htmlentities(__('Not saved', 'wpv-views'), ENT_QUOTES); ?> " data-nonce="<?php echo wp_create_nonce('wpv_view_show_hide_nonce'); ?> " class="js-wpv-show-hide-update button-secondary"><?php echo __('Save', 'wpv-views'); ?> </button> </p> </div> </div> <div id="screen-meta-links-dup" class="js-screen-meta-links-dup"> <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle"> <a id="show-settings-link" class="show-settings" aria-expanded="false" aria-controls="screen-options-wrap" href="#screen-options-wrap">Screen Options</a> </div> </div> <?php /** * Actual WordPress Archive edit page * * NOTE * $views_edit_help is localized and escaped in wpv-section-descriptions.php */ ?> <div class="wrap toolset-views"> <input id="post_ID" class="js-post_ID" type="hidden" value="<?php echo $view_id; ?> " /> <div id="icon-edit" class="icon32 icon32-posts-post"><br></div> <h2><?php echo __('Edit WordPress Archive', 'wpv-views'); ?> </h2> <div class="wpv-save-all wpv-setting-container"> <div class="wpv-setting"> <p class="update-button-wrap"> <button class="button-secondary button button-large js-wpv-view-save-all" disabled="disabled" data-success="<?php echo htmlentities(__('View saved', 'wpv-views'), ENT_QUOTES); ?> " data-unsaved="<?php echo htmlentities(__('View not saved', 'wpv-views'), ENT_QUOTES); ?> "><?php _e('Save all sections at once', 'wpv-views'); ?> </button> </p> </div> </div> <input type="hidden" name="_wpv_settings[view-query-mode]" value="normal" /> <div class="wpv-setting-container wpv-settings-title-and-desc"> <div class="wpv-settings-header"> <h3> <?php _e('Title and description', 'wpv-views'); ?> <i class="icon-question-sign js-display-tooltip" data-header="<?php echo $views_edit_help['title_and_description']['title']; ?> " data-content="<?php echo $views_edit_help['title_and_description']['content']; ?> "></i> </h3> </div> <div class="wpv-setting"> <div id="titlediv"> <div id="titlewrap"> <label class="screen-reader-text js-title-reader" id="title-prompt-text" for="title"><?php _e('Enter title here', 'wp-views'); ?> </label> <input id="title" class="js-title" type="text" name="post_title" size="30" value="<?php echo get_the_title($view_id); ?> " id="title" autocomplete="off"> </div> </div> <div id="edit-slug-box" class="js-wpv-slug-container"> <label for="wpv-slug"><?php _e('Slug of this WordPress Archive', 'wpv-views'); ?> <input id="wpv-slug" class="js-wpv-slug" type="text" value="<?php echo esc_attr($view->post_name); ?> " /> • <button class="button-secondary js-wpv-change-view-status icon-trash" data-statusto="trash" data-success="<?php echo htmlentities(__('View moved to trash', 'wpv-views'), ENT_QUOTES); ?> " data-unsaved="<?php echo htmlentities(__('View not moved to trash', 'wpv-views'), ENT_QUOTES); ?> " data-redirect="<?php echo admin_url('admin.php?page=view-archives'); ?> " data-nonce="<?php echo wp_create_nonce('wpv_view_change_status'); ?> "> <?php _e('Move to trash', 'wpv-views'); ?> </button> </div> <?php $view_description = get_post_meta($_GET['view_id'], '_wpv_description', true); ?> <p<?php echo isset($view_description) && !empty($view_description) ? ' class="hidden"' : ''; ?> > <button class="js-wpv-description-toggle button-secondary" ><?php _e('Add description', 'wpv-views'); ?> </button> </p> <div class="js-wpv-description-container wpv-description-container<?php echo isset($view_description) && !empty($view_description) ? '' : ' hidden'; ?> "> <p> <label for="wpv-description"><?php _e('Describe this View', 'wpv-views'); ?> </label> </p> <p> <textarea id="wpv-description" class="js-wpv-description" name="_wpv_settings[view_description]" cols="72" rows="4"><?php echo isset($view_description) ? esc_html($view_description) : ''; ?> </textarea> </p> </div> <p class="update-button-wrap"> <button data-success="<?php echo htmlentities(__('Title and description updated', 'wpv-views'), ENT_QUOTES); ?> " data-unsaved="<?php echo htmlentities(__('Title and description not saved', 'wpv-views'), ENT_QUOTES); ?> " data-nonce="<?php echo wp_create_nonce('wpv_view_title_description_nonce'); ?> " class="js-wpv-title-description-update button-secondary" disabled="disabled"><?php _e('Update', 'wpv-views'); ?> </button> </p> </div> </div> <div class="wpv-query-section"> <h3 class="wpv-section-title"><?php _e('The loop section determines which listing page to customize', 'wpv-views'); ?> </h3> <?php do_action('view-editor-section-archive-loop', $view_settings, $view_id); ?> </div> <?php /* * Loop selection - Priority 10 */ ?> <div class="wpv-layout-section"> <h3 class="wpv-section-title"><?php _e('The layout section styles the WordPress Archive output on the page.', 'wpv-views'); ?> </h3> <?php $data = wpv_get_view_layout_introduction_data(); wpv_toolset_help_box($data); ?> <?php do_action('view-editor-section-layout', $view_settings, $view_layout_settings, $view_id); ?> <?php do_action('view-editor-section-extra', $view_settings, $view_id); ?> <div class="wpv-save-all wpv-setting-container"> <div class="wpv-setting"> <p class="update-button-wrap"> <button class="button-secondary button button-large js-wpv-view-save-all" disabled="disabled" data-success="<?php echo htmlentities(__('View saved', 'wpv-views'), ENT_QUOTES); ?> " data-unsaved="<?php echo htmlentities(__('View not saved', 'wpv-views'), ENT_QUOTES); ?> "><?php _e('Save all sections at once', 'wpv-views'); ?> </button> </p> </div> </div> </div> <?php /* * Output (layout) type - TODO review this https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/162512599/comments - Priority 10 - To remove * Output fields TODO this has been reviewed and may be used as training - Priority 20 - To remove * Layout templates TODO insert here the new Content Templates editor. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/161787695/comments - Priority 20 - To review * Layout Meta HTML/CSS/JS TODO this has been reviewed and needs some changes. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/161787640/comments - Priority 40 * Aditional Javascript files TODO move to its own file - Priority 50 * Extra sections: * 1. Complete output (the_content) * 2. Module manager TODO needs to be added */ ?> </div> <?php }
function add_view_pagination($view_settings, $view_id) { //TODO review that default values are set before we display any of this global $views_edit_help; $rollover_effects = array('fade' => __('Fade', 'wpv-views'), 'slideleft' => __('Slide Left', 'wpv-views'), 'slideright' => __('Slide Right', 'wpv-views'), 'slideup' => __('Slide Up', 'wpv-views'), 'slidedown' => __('Slide Down', 'wpv-views')); $ajax_effects = array('fade' => __('Fade', 'wpv-views'), 'fadefast' => __('Fade fast', 'wpv-views'), 'fadeslow' => __('Fade slow', 'wpv-views'), 'slideh' => __('Slide horizontally', 'wpv-views'), 'slidev' => __('Slide vertically', 'wpv-views')); $hide = ''; if (isset($view_settings['sections-show-hide']) && isset($view_settings['sections-show-hide']['pagination']) && 'off' == $view_settings['sections-show-hide']['pagination']) { $hide = ' hidden'; } ?> <div class="wpv-setting-container wpv-settings-pagination js-wpv-settings-pagination<?php echo $hide; ?> "> <div class="wpv-settings-header"> <h3> <?php _e('Pagination and Sliders settings', 'wpv-views'); ?> <i class="icon-question-sign js-display-tooltip" data-header="<?php echo $views_edit_help['pagination_and_sliders_settings']['title']; ?> " data-content="<?php echo $views_edit_help['pagination_and_sliders_settings']['content']; ?> "></i> </h3> </div> <div class="wpv-setting"> <form class="js-pagination-settings-form"> <?php if (!isset($view_settings['pagination'][0])) { $view_settings['pagination'][0] = 'disable'; } if (!isset($view_settings['pagination']['mode'])) { $view_settings['pagination']['mode'] = 'none'; } ?> <input type="hidden" class="js-pagination-zero" name="pagination[]" value="<?php echo $view_settings['pagination'][0]; ?> " /> <ul> <li> <p> <?php $checked = $view_settings['pagination'][0] == 'disable' ? ' checked="checked"' : ''; ?> <input type="radio" id="wpv-settings-no-pagination" name="pagination[mode]" value="none"<?php echo $checked; ?> /> <label for="wpv-settings-no-pagination"><strong><?php _e('No pagination', 'wpv-views'); ?> </strong> - <?php _e('All query results will display.', 'wpv-views'); ?> </label> </p> </li> <li> <p> <?php $checked = $view_settings['pagination'][0] == 'enable' && $view_settings['pagination']['mode'] == 'paged' ? ' checked="checked"' : ''; ?> <input type="radio" id="wpv-settings-manual-pagination" name="pagination[mode]" value="paged"<?php echo $checked; ?> /> <label for="wpv-settings-manual-pagination"><strong><?php _e('Pagination enabled with manual transition', 'wpv-views'); ?> </strong> - <?php _e('The query results will display in pages, which visitors will switch.', 'wpv-views'); ?> </label> </p> </li> <li> <p> <?php $checked = $view_settings['pagination']['mode'] == 'rollover' ? ' checked="checked"' : ''; ?> <input type="radio" id="wpv-settings-ajax-pagination" name="pagination[mode]" value="rollover"<?php echo $checked; ?> /> <label for="wpv-settings-ajax-pagination"><strong><?php _e('Pagination enabled with automatic transition', 'wpv-views'); ?> </strong> - <?php _e('The query results will display in pages, which will switch automatically (good for sliders).', 'wpv-views'); ?> </label> </p> </li> </ul> <div class="wpv-pagination-options-box"> <h3 class="wpv-pagination-paged"><?php _e('Options for manual pagination', 'wpv-views'); ?> </h3> <ul class="wpv-pagination-paged"> <li> <label><?php _e('Number of items per page:', 'wpv-views'); ?> </label> <select name="posts_per_page"> <?php if (!isset($view_settings['posts_per_page'])) { $view_settings['posts_per_page'] = '10'; } ?> <?php for ($i = 1; $i < 50; $i++) { $selected = $view_settings['posts_per_page'] == (string) $i ? ' selected="selected"' : ''; echo '<option value="' . $i . '"' . $selected . '>' . $i . '</option>'; } ?> </select> </li> <li> <?php $checked = isset($view_settings['ajax_pagination'][0]) && $view_settings['ajax_pagination'][0] == 'disable' ? ' checked="checked"' : ''; ?> <input type="radio" id="wpv-settings-ajax-pagination-disabled" value="disable" name="ajax_pagination[]"<?php echo $checked; ?> /> <label for="wpv-settings-ajax-pagination-disabled"><?php _e('Pagination updates the entire page', 'wpv-views'); ?> </label> </li> <li> <?php $checked = isset($view_settings['ajax_pagination'][0]) && $view_settings['ajax_pagination'][0] == 'enable' ? ' checked="checked"' : ''; ?> <input type="radio" id="wpv-settings-ajax-pagination-enabled" value="enable" name="ajax_pagination[]"<?php echo $checked; ?> /> <label for="wpv-settings-ajax-pagination-enabled"><?php _e('Pagination updates only the view (use AJAX)', 'wpv-views'); ?> </label> </li> </ul> <ul class="wpv-pagination-paged-ajax"> <li> <p> <label><?php _e('Transition effect:', 'wpv-views'); ?> </label> <select name="ajax_pagination[style]"> <?php if (!isset($view_settings['ajax_pagination']['style'])) { $view_settings['ajax_pagination']['style'] = 'fade'; } ?> <option value="fade"<?php if ($view_settings['ajax_pagination']['style'] == 'fade' || $view_settings['ajax_pagination']['style'] == 'fadefast' || $view_settings['ajax_pagination']['style'] == 'fadeslow') { echo ' selected="selected"'; } ?> ><?php _e('Fade', 'wpv-views'); ?> </option> <option value="slideh"<?php if ($view_settings['ajax_pagination']['style'] == 'slideh') { echo ' selected="selected"'; } ?> ><?php _e('Slide horizontally', 'wpv-views'); ?> </option> <option value="slidev"<?php if ($view_settings['ajax_pagination']['style'] == 'slidev') { echo ' selected="selected"'; } ?> ><?php _e('Slide vertically', 'wpv-views'); ?> </option> </select> <label> <?php _e('with duration', 'wpv-views'); ?> <?php if (!isset($view_settings['ajax_pagination']['duration'])) { $view_settings['ajax_pagination']['duration'] = 500; } if ($view_settings['ajax_pagination']['style'] == 'fadefast') { $view_settings['ajax_pagination']['duration'] = 1; } if ($view_settings['ajax_pagination']['style'] == 'fadeslow') { $view_settings['ajax_pagination']['duration'] = 1500; } ?> <input type="text" class="transition-duration" name="ajax_pagination[duration]" value="<?php echo $view_settings['ajax_pagination']['duration']; ?> " size="5"> </label> <?php _e('miliseconds', 'wpv-views'); ?> <span class="duration-error" style="color:red;display:none;">← <?php _e('Please add a numeric value', 'wpv-views'); ?> </span> </p> <p> <button class="js-pagination-advanced button-secondary" type="button" data-closed="<?php _e('Advanced options', 'wpv-views'); ?> " data-opened="<?php _e('Close advanced options', 'wpv-views'); ?> " data-section="ajax_pagination" data-state="closed"><?php _e('Advanced options', 'wpv-views'); ?> </button> </p> </li> <li class="wpv-pagination-advanced"> <?php $checked = isset($view_settings['pagination']['preload_images']) && $view_settings['pagination']['preload_images'] ? ' checked="checked"' : ''; ?> <label> <input type="checkbox" name="pagination[preload_images]" value="1"<?php echo $checked; ?> /> <?php _e('Preload images before transition', 'wpv-views'); ?> </label> </li> </ul> <h3 class="wpv-pagination-rollover"><?php _e('Options for automatic pagination', 'wpv-views'); ?> </h3> <ul class="wpv-pagination-rollover"> <li> <label for="rollover[posts_per_page]"><?php _e('Number of items per page:', 'wpv-views'); ?> </label> <select name="rollover[posts_per_page]"> <?php if (!isset($view_settings['rollover']['posts_per_page'])) { $view_settings['rollover']['posts_per_page'] = '10'; } ?> <?php for ($i = 1; $i < 50; $i++) { $selected = $view_settings['rollover']['posts_per_page'] == (string) $i ? ' selected="selected"' : ''; echo '<option value="' . $i . '"' . $selected . '>' . $i . '</option>'; } ?> </select> </li> <li> <label><?php _e('Show each page for:', 'wpv-views'); ?> </label> <select name="rollover[speed]"> <?php if (!isset($view_settings['rollover']['speed'])) { $view_settings['rollover']['speed'] = '5'; } ?> <?php for ($i = 1; $i < 20; $i++) { $selected = $view_settings['rollover']['speed'] == (string) $i ? ' selected="selected"' : ''; echo '<option value="' . $i . '"' . $selected . '>' . $i . '</option>'; } ?> </select> <?php _e('seconds', 'wpv-views'); ?> </li> <li> <label><?php _e('Transition effect:', 'wpv-views'); ?> </label> <select name="rollover[effect]"> <?php if (!isset($view_settings['rollover']['effect'])) { $view_settings['rollover']['effect'] = 'fade'; } foreach ($rollover_effects as $i => $title) { $selected = $view_settings['rollover']['effect'] == (string) $i ? ' selected="selected"' : ''; echo '<option value="' . $i . '"' . $selected . '>' . $title . '</option>'; } ?> </select> <label><?php _e('with duration', 'wpv-views'); ?> </label> <?php if (!isset($view_settings['rollover']['duration'])) { $view_settings['rollover']['duration'] = 500; } ?> <input type="text" class="transition-duration" name="rollover[duration]" value="<?php echo $view_settings['rollover']['duration']; ?> " size="5"> <?php _e('miliseconds', 'wpv-views'); ?> <span class="duration-error" style="color:red;display:none;"><?php _e(' <- Please add a numeric value', 'wpv-views'); ?> </span> <p> <button class="js-pagination-advanced button-secondary" type="button" data-closed="<?php _e('Advanced options', 'wpv-views'); ?> " data-opened="<?php _e('Close advanced options', 'wpv-views'); ?> " data-section="rollover" data-state="closed"><?php _e('Advanced options', 'wpv-views'); ?> </button> </p> </li> <li class="wpv-pagination-advanced"> <?php $checked = isset($view_settings['rollover']['preload_images']) && $view_settings['rollover']['preload_images'] ? ' checked="checked"' : ''; ?> <label> <input type="checkbox" name="rollover[preload_images]" value="1"<?php echo $checked; ?> /> <?php _e('Preload images before transition', 'wpv-views'); ?> </label> </li> </ul> <ul class="wpv-pagination-paged wpv-pagination-rollover wpv-pagination-shared wpv-pagination-advanced"> <li> <?php $checked = isset($view_settings['pagination']['cache_pages']) && $view_settings['pagination']['cache_pages'] ? ' checked="checked"' : ''; ?> <p> <label> <input type="checkbox" name="pagination[cache_pages]" value="1"<?php echo $checked; ?> /> <?php _e('Cache pages', 'wpv-views'); ?> </label> </p> </li> <li> <?php $checked = isset($view_settings['pagination']['preload_pages']) && $view_settings['pagination']['preload_pages'] ? ' checked="checked"' : ''; ?> <p> <label> <input type="checkbox" name="pagination[preload_pages]" value="1"<?php echo $checked; ?> /> <?php _e('Pre-load the next and previous pages - avoids loading delays when users move between pages', 'wpv-views'); ?> </label> </p> <p> <label><?php _e('Pages to pre-load: ', 'wpv-views'); ?> </label> <select name="pagination[pre_reach]"> <?php if (!isset($view_settings['pagination']['pre_reach'])) { $view_settings['pagination']['pre_reach'] = 1; } for ($i = 1; $i < 20; $i++) { $selected = $view_settings['pagination']['pre_reach'] == $i ? ' selected="selected"' : ''; echo '<option value="' . $i . '"' . $selected . '>' . $i . '</option>'; } ?> </select> </p> </li> <li> <h4><?php _e('Spinners', 'wpv-views'); ?> </h4> <?php $checked = isset($view_settings['pagination']['spinner']) && $view_settings['pagination']['spinner'] == 'default' ? ' checked="checked"' : ''; ?> <p> <label> <input type="radio" name="pagination[spinner]" value="default"<?php echo $checked; ?> /> <?php _e('Spinner graphics from Views', 'wpv-views'); ?> </label> </p> <ul id="wpv-spinner-default" class="wpv-spinner-selection"> <?php if (isset($view_settings['pagination']['spinner_image'])) { $spinner_image = $view_settings['pagination']['spinner_image']; } else { $spinner_image = ''; } foreach (glob(WPV_PATH_EMBEDDED . "/res/img/ajax-loader*") as $file) { $filename = WPV_URL_EMBEDDED . '/res/img/' . basename($file); $filename2 = WPV_URL . '/res/img/' . basename($file); ?> <li> <label> <input type="radio" name="pagination[spinner_image]" value="<?php echo $filename; ?> "<?php if ($spinner_image == $filename || $spinner_image == $filename2) { echo ' checked="checked"'; } ?> /> <img style="background-color: #FFFFFF;" src="<?php echo $filename; ?> " title="<?php echo $filename; ?> " /> </label> </li> <?php } ?> </ul> <?php $checked = isset($view_settings['pagination']['spinner']) && $view_settings['pagination']['spinner'] == 'uploaded' ? ' checked="checked"' : ''; ?> <p> <label> <input type="radio" name="pagination[spinner]" value="uploaded"<?php echo $checked; ?> /> <?php _e('My custom spinner graphics', 'wpv-views'); ?> </label> </p> <p id="wpv-spinner-uploaded" class="wpv-spinner-selection"> <input id="wpv-pagination-spinner-image" class="js-wpv-pagination-spinner-image" type="textfield" name="pagination[spinner_image_uploaded]" value="<?php echo isset($view_settings['pagination']['spinner_image_uploaded']) ? $view_settings['pagination']['spinner_image_uploaded'] : ''; ?> " /> <button class="button-secondary js-code-editor-toolbar-button js-wpv-media-manager" data-content="wpv-pagination-spinner-image" data-id="<?php echo $view_id; ?> "><?php _e('Upload Image', 'wpv-views'); ?> </button> <?php if (isset($view_settings['pagination']['spinner_image_uploaded'])) { ?> <img id="wpv-pagination-spinner-image-preview" class="js-wpv-pagination-spinner-image-preview" src="<?php echo $view_settings['pagination']['spinner_image_uploaded']; ?> " height="16" /> <?php } ?> </p> <?php $checked = isset($view_settings['pagination']['spinner']) && $view_settings['pagination']['spinner'] == 'no' ? ' checked="checked"' : ''; ?> <p> <label> <input type="radio" name="pagination[spinner]" value="no"<?php echo $checked; ?> /> <?php _e('No spinner graphics', 'wpv-views'); ?> </label> </p> </li> <li> <h4><?php _e('Callback function', 'wpv-views'); ?> </h4> <p><?php _e('The following javascript function will be executed after the pagination transition has been completed:', 'wpv-views'); ?> <input id="wpv-pagination-callback-next" class="js-wpv-pagination-callback-next" type="textfield" name="pagination[callback_next]" value="<?php echo isset($view_settings['pagination']['callback_next']) ? $view_settings['pagination']['callback_next'] : ''; ?> " /></p> </li> </ul> </div> <!-- .ggwpv-pagination-options-box --> </form> <p class="update-button-wrap"> <button data-success="<?php echo htmlentities(__('Pagination settings updated', 'wpv-views'), ENT_QUOTES); ?> " data-unsaved="<?php echo htmlentities(__('Pagination settings not saved', 'wpv-views'), ENT_QUOTES); ?> " data-nonce="<?php echo wp_create_nonce('wpv_view_pagination_nonce'); ?> " class="js-wpv-pagination-update button-secondary" disabled="disabled"><?php _e('Update', 'wpv-views'); ?> </button> </p> </div> <?php wpv_get_view_pagination_hint_data(); $data = wpv_get_view_pagination_hint_result_data(); wpv_toolset_help_box($data); ?> </div> <div class="popup-window-container"> <!-- Use this element as a container for all popup windows. This element is hidden. --> <div class="wpv-dialog wpv-dialog-pagination-wizard js-pagination-form-dialog"> <div class="wpv-dialog-header"> <h2><?php _e('Would you like to insert transition controls for the pagination?', 'wpv-views'); ?> </h2> <i class="icon-remove js-dialog-close"></i> </div> <div class="wpv-dialog-sidebar filter-preview"> <?php include 'wpv-section-pagination-popup-preview.php'; ?> <?php // TODO @Juan. I don't know is it a correct way of including re-usable parts of code. ?> </div> <div class="wpv-dialog-content"> <h3><?php _e('Pagination controls', 'wpv-views'); ?> </h3> <p> <input type="radio" name="pagination_control" id="pagination-include-page-num" value="page_num" data-target="current-page-number" /> <label for="pagination-include-page-num"><?php _e('Current page number', 'wpv-views'); ?> </label> </p> <p> <input type="radio" name="pagination_control" id="pagination-include-page-total" value="page_total" data-target="total-pages" /> <label for="pagination-include-page-total"><?php _e('Number of pages', 'wpv-views'); ?> </label> </p> <p> <input type="radio" name="pagination_control" id="pagination-include-page-selector" value="page_selector" data-target="page-selector"/> <label for="pagination-include-page-selector"><?php _e('Page selector using', 'wpv-views'); ?> </label> <select name="pagination_controls_type" id="pagination-controls-type" class="js-pagination-control-type"> <option value="drop_down"><?php _e('dropdown', 'wpv-views'); ?> </option> <option value="link"><?php _e('links', 'wpv-views'); ?> </option> </select> </p> <p> <input type="radio" name="pagination_control" id="pagination-include-controls" value="page_controls" data-target="next-previous-controls" /> <label for="pagination-include-controls"><?php _e('Next and previous page controls', 'wpv-views'); ?> </label> </p> <h3><?php _e('Pagination display', 'wpv-views'); ?> </h3> <p> <input type="checkbox" name="pagination_display" id="pagination-include-wrapper" /> <label for="pagination-include-wrapper"><?php _e('Don\'t show pagination controls if there is only one page', 'wpv-views'); ?> </label> </p> </div> <div class="wpv-dialog-footer"> <button class="button js-dialog-close"><?php _e('Cancel', 'wpv-views'); ?> </button> <button class="button button-primary js-insert-pagination"><?php _e('Insert pagination', 'wpv-views'); ?> </button> </div> </div> <!-- .wpv-dialog-pagination-wizard --> <div class="wpv-dialog wpv-dialog-pagination-wizard js-pagination-form-hint"> <div class="wpv-dialog-header"> <h2><?php _e('What pagination controls would you like to insert?', 'wpv-views'); ?> </h2> <i class="icon-remove js-dialog-close"></i> </div> <div class="wpv-dialog-sidebar filter-preview"> <?php include 'wpv-section-pagination-popup-preview.php'; ?> </div> <div class="wpv-dialog-content"> <p> <input type="checkbox" checked="checked" id="pagination-include-page-num-hint" name="pagination-include-page-num" class="js-pagination-control-hint" value="page_num" data-target="current-page-number" /> <label for="pagination-include-page-num-hint"><?php _e('Current page number', 'wpv-views'); ?> </label> </p> <p> <input type="checkbox" checked="checked" id="pagination-include-page-total-hint" name="pagination-include-page-total" class="js-pagination-control-hint" value="page_total" data-target="total-pages" /> <label for="pagination-include-page-total-hint"><?php _e('Number of pages', 'wpv-views'); ?> </label> </p> <p> <input type="checkbox" checked="checked" id="pagination-include-page-selector-hint" name="pagination-include-page-selector" class="js-pagination-control-hint" value="page_selector" data-target="page-selector" /> <label for="pagination-include-page-selector-hint"><?php _e('Page selector using', 'wpv-views'); ?> </label> <select name="pagination_controls_type_hint" id="pagination-controls-type-hint" class="js-pagination-control-hint-type"> <option value="drop_down"><?php _e('dropdown', 'wpv-views'); ?> </option> <option value="link"><?php _e('links', 'wpv-views'); ?> </option> </select> </p> <p> <input type="checkbox" checked="checked" id="pagination-include-controls-hint" name="pagination-include-controls" class="js-pagination-control-hint" value="page_controls" data-target="next-previous-controls" /> <label for="pagination-include-controls-hint"><?php _e('Next and previous page controls', 'wpv-views'); ?> </label> </p> </div> <div class="wpv-dialog-footer"> <button class="button js-dialog-close"><?php _e('Cancel', 'wpv-views'); ?> </button> <button class="button button-primary js-insert-pagination-from-hint" data-content="wpv_filter_meta_html_content"><?php _e('Insert pagination', 'wpv-views'); ?> </button> </div> </div> <!-- wpv-dialog-pagination-wizard --> </div> <?php }