updated contrib modules
This commit is contained in:
@@ -18,14 +18,15 @@ function views_ajax() {
|
||||
if (isset($_REQUEST['view_name']) && isset($_REQUEST['view_display_id'])) {
|
||||
$name = $_REQUEST['view_name'];
|
||||
$display_id = $_REQUEST['view_display_id'];
|
||||
$args = isset($_REQUEST['view_args']) && $_REQUEST['view_args'] !== '' ? explode('/', $_REQUEST['view_args']) : array();
|
||||
$path = isset($_REQUEST['view_path']) ? rawurldecode($_REQUEST['view_path']) : NULL;
|
||||
$args = isset($_REQUEST['view_args']) && $_REQUEST['view_args'] !== '' ? explode('/', htmlspecialchars_decode($_REQUEST['view_args'], ENT_QUOTES)) : array();
|
||||
$path = isset($_REQUEST['view_path']) ? htmlspecialchars_decode($_REQUEST['view_path'], ENT_QUOTES) : NULL;
|
||||
$dom_id = isset($_REQUEST['view_dom_id']) ? preg_replace('/[^a-zA-Z0-9_-]+/', '-', $_REQUEST['view_dom_id']) : NULL;
|
||||
$pager_element = isset($_REQUEST['pager_element']) ? intval($_REQUEST['pager_element']) : NULL;
|
||||
|
||||
$commands = array();
|
||||
|
||||
// Remove all of this stuff from $_GET so it doesn't end up in pagers and tablesort URLs.
|
||||
// Remove all of this stuff from $_GET so it doesn't end up in pagers and
|
||||
// tablesort URLs.
|
||||
foreach (array('view_name', 'view_display_id', 'view_args', 'view_path', 'view_dom_id', 'pager_element', 'view_base_path', 'ajax_html_ids', 'ajax_page_state') as $key) {
|
||||
if (isset($_GET[$key])) {
|
||||
unset($_GET[$key]);
|
||||
@@ -46,11 +47,11 @@ function views_ajax() {
|
||||
$_GET['q'] = $path;
|
||||
}
|
||||
|
||||
// If page parameter is in the $_POST exclude it from $_GET,
|
||||
// otherwise support views_ajax requests using $_GET.
|
||||
// If page parameter is in the $_POST exclude it from $_GET, otherwise
|
||||
// support views_ajax requests using $_GET.
|
||||
$exclude = isset($_POST['page']) ? array('page') : array();
|
||||
// Add all $_POST data to $_GET as many things,
|
||||
// such as tablesorts, exposed filters and paging assume $_GET.
|
||||
// Add all $_POST data to $_GET as many things, such as tablesorts,
|
||||
// exposed filters and paging assume $_GET.
|
||||
$_GET = $_POST + drupal_get_query_parameters($_GET, $exclude);
|
||||
|
||||
// Overwrite the destination.
|
||||
@@ -71,7 +72,8 @@ function views_ajax() {
|
||||
// Reuse the same DOM id so it matches that in Drupal.settings.
|
||||
$view->dom_id = $dom_id;
|
||||
|
||||
$commands[] = ajax_command_replace('.view-dom-id-' . $dom_id, $view->preview($display_id, $args));
|
||||
// Always return HTML with the same DOM ID that was sent by the browser.
|
||||
$commands[] = ajax_command_replace('.view-dom-id-' . $dom_id, preg_replace('/view-dom-id-[a-zA-Z0-9_-]+/', 'view-dom-id-' . $view->dom_id, $view->preview($display_id, $args), 1));
|
||||
}
|
||||
drupal_alter('views_ajax_data', $commands, $view);
|
||||
return array('#type' => 'ajax', '#commands' => $commands);
|
||||
@@ -81,14 +83,14 @@ function views_ajax() {
|
||||
/**
|
||||
* Creates a Drupal AJAX 'viewsSetForm' command.
|
||||
*
|
||||
* @param $output
|
||||
* @param string $output
|
||||
* The form to display in the modal.
|
||||
* @param $title
|
||||
* @param string $title
|
||||
* The title.
|
||||
* @param $url
|
||||
* @param string $url
|
||||
* An optional URL.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_set_form($output, $title, $url = NULL) {
|
||||
@@ -106,7 +108,7 @@ function views_ajax_command_set_form($output, $title, $url = NULL) {
|
||||
/**
|
||||
* Creates a Drupal AJAX 'viewsDismissForm' command.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_dismiss_form() {
|
||||
@@ -119,8 +121,8 @@ function views_ajax_command_dismiss_form() {
|
||||
/**
|
||||
* Creates a Drupal AJAX 'viewsHilite' command.
|
||||
*
|
||||
* @param $selector
|
||||
* The selector to highlight
|
||||
* @param string $selector
|
||||
* The selector to highlight.
|
||||
*
|
||||
* @return
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
@@ -135,14 +137,14 @@ function views_ajax_command_hilite($selector) {
|
||||
/**
|
||||
* Creates a Drupal AJAX 'addTab' command.
|
||||
*
|
||||
* @param $id
|
||||
* @param string $id
|
||||
* The DOM ID.
|
||||
* @param $title
|
||||
* @param string $title
|
||||
* The title.
|
||||
* @param $body
|
||||
* @param string $body
|
||||
* The body.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_add_tab($id, $title, $body) {
|
||||
@@ -158,7 +160,7 @@ function views_ajax_command_add_tab($id, $title, $body) {
|
||||
/**
|
||||
* Scroll to top of the current view.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_scroll_top($selector) {
|
||||
@@ -175,7 +177,7 @@ function views_ajax_command_scroll_top($selector) {
|
||||
* @param bool $changed
|
||||
* Whether of not the view has changed.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_show_buttons($changed) {
|
||||
@@ -189,7 +191,7 @@ function views_ajax_command_show_buttons($changed) {
|
||||
/**
|
||||
* Trigger the Views live preview.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_trigger_preview() {
|
||||
@@ -202,7 +204,7 @@ function views_ajax_command_trigger_preview() {
|
||||
/**
|
||||
* Replace the page title.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_command_replace_title($title) {
|
||||
@@ -216,6 +218,12 @@ function views_ajax_command_replace_title($title) {
|
||||
|
||||
/**
|
||||
* Return an AJAX error.
|
||||
*
|
||||
* @param string $message
|
||||
* The message to display.
|
||||
*
|
||||
* @return array
|
||||
* An array suitable for use with the ajax_render() function.
|
||||
*/
|
||||
function views_ajax_error($message) {
|
||||
$commands = array();
|
||||
@@ -225,6 +233,7 @@ function views_ajax_error($message) {
|
||||
|
||||
/**
|
||||
* Wrapper around drupal_build_form to handle some AJAX stuff automatically.
|
||||
*
|
||||
* This makes some assumptions about the client.
|
||||
*/
|
||||
function views_ajax_form_wrapper($form_id, &$form_state) {
|
||||
@@ -243,15 +252,15 @@ function views_ajax_form_wrapper($form_id, &$form_state) {
|
||||
$form = drupal_build_form($form_id, $form_state);
|
||||
$output = drupal_render($form);
|
||||
|
||||
// These forms have the title built in, so set the title here:
|
||||
// These forms have the title built in, so set the title here.
|
||||
if (empty($form_state['ajax']) && !empty($form_state['title'])) {
|
||||
drupal_set_title($form_state['title']);
|
||||
drupal_add_css(drupal_get_path('module', 'views_ui') . '/css/views-admin.css');
|
||||
}
|
||||
|
||||
if (!empty($form_state['ajax']) && (empty($form_state['executed']) || !empty($form_state['rerender']))) {
|
||||
// If the form didn't execute and we're using ajax, build up a
|
||||
// Ajax command list to execute.
|
||||
// If the form didn't execute and we're using ajax, build up a AJAX command
|
||||
// list to execute.
|
||||
$commands = array();
|
||||
|
||||
$display = '';
|
||||
@@ -279,7 +288,7 @@ function views_ajax_form_wrapper($form_id, &$form_state) {
|
||||
return $commands;
|
||||
}
|
||||
|
||||
// These forms have the title built in, so set the title here:
|
||||
// These forms have the title built in, so set the title here.
|
||||
if (empty($form_state['ajax']) && !empty($form_state['title'])) {
|
||||
drupal_set_title($form_state['title']);
|
||||
}
|
||||
@@ -289,13 +298,14 @@ function views_ajax_form_wrapper($form_id, &$form_state) {
|
||||
|
||||
|
||||
/**
|
||||
* Page callback for views user autocomplete
|
||||
* Page callback for views user autocomplete.
|
||||
*/
|
||||
function views_ajax_autocomplete_user($string = '') {
|
||||
// The user enters a comma-separated list of user name. We only autocomplete the last name.
|
||||
// The user enters a comma-separated list of user name. We only autocomplete
|
||||
// the last name.
|
||||
$array = drupal_explode_tags($string);
|
||||
|
||||
// Fetch last name
|
||||
// Fetch last name.
|
||||
$last_string = trim(array_pop($array));
|
||||
$matches = array();
|
||||
if ($last_string != '') {
|
||||
@@ -328,16 +338,16 @@ function views_ajax_autocomplete_user($string = '') {
|
||||
/**
|
||||
* Page callback for views taxonomy autocomplete.
|
||||
*
|
||||
* @param $vid
|
||||
* @param int $vid
|
||||
* The vocabulary id of the tags which should be returned.
|
||||
*
|
||||
* @param $tags_typed
|
||||
* @param string $tags_typed
|
||||
* The typed string of the user.
|
||||
*
|
||||
* @see taxonomy_autocomplete()
|
||||
*/
|
||||
function views_ajax_autocomplete_taxonomy($vid, $tags_typed = '') {
|
||||
// The user enters a comma-separated list of tags. We only autocomplete the last tag.
|
||||
// The user enters a comma-separated list of tags. We only autocomplete the
|
||||
// last tag.
|
||||
$tags_typed = drupal_explode_tags($tags_typed);
|
||||
$tag_last = drupal_strtolower(array_pop($tags_typed));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user