Projet

Général

Profil

Révision 560c3060

Ajouté par Julien Enselme il y a plus de 8 ans

Update ctools 1.7 -> 1.9

Voir les différences:

drupal7/sites/all/modules/ctools/bulk_export/bulk_export.info
6 6
version = CTOOLS_MODULE_VERSION
7 7

  
8 8

  
9
; Information added by Drupal.org packaging script on 2015-03-18
10
version = "7.x-1.7"
9
; Information added by Drupal.org packaging script on 2015-08-19
10
version = "7.x-1.9"
11 11
core = "7.x"
12 12
project = "ctools"
13
datestamp = "1426696183"
13
datestamp = "1440020680"
14 14

  
drupal7/sites/all/modules/ctools/ctools.info
9 9
files[] = includes/stylizer.inc
10 10
files[] = tests/css_cache.test
11 11

  
12
; Information added by Drupal.org packaging script on 2015-03-18
13
version = "7.x-1.7"
12
; Information added by Drupal.org packaging script on 2015-08-19
13
version = "7.x-1.9"
14 14
core = "7.x"
15 15
project = "ctools"
16
datestamp = "1426696183"
16
datestamp = "1440020680"
17 17

  
drupal7/sites/all/modules/ctools/ctools.module
23 23
 *   ; Requires CTools v7.x-1.4 or newer.
24 24
 *   dependencies[] = ctools (>=1.4)
25 25
 */
26
define('CTOOLS_MODULE_VERSION', '7.x-1.7');
26
define('CTOOLS_MODULE_VERSION', '7.x-1.9');
27 27

  
28 28
/**
29 29
 * Test the CTools API version.
......
617 617
  return _ctools_registry_files_alter($files, $indexed_modules);
618 618
}
619 619

  
620
// -----------------------------------------------------------------------
621
// FAPI hooks that must be in the .module file.
622

  
623
/**
624
 * Alter the comment form to get a little more control over it.
625
 */
626
function ctools_form_comment_form_alter(&$form, &$form_state) {
627
  if (!empty($form_state['ctools comment alter'])) {
628
    // Force the form to post back to wherever we are.
629
    $form['#action'] = url($_GET['q'], array('fragment' => 'comment-form'));
630
    if (empty($form['#submit'])) {
631
      $form['#submit'] = array('comment_form_submit');
632
    }
633
    $form['#submit'][] = 'ctools_node_comment_form_submit';
634
  }
635
}
636

  
637
function ctools_node_comment_form_submit(&$form, &$form_state) {
638
  $form_state['redirect'][0] = $_GET['q'];
639
}
640

  
620 641
// -----------------------------------------------------------------------
621 642
// CTools hook implementations.
622 643

  
......
1018 1039
    }
1019 1040
  }
1020 1041
}
1042

  
1043
/**
1044
 * Implements hook_field_create_field().
1045
 */
1046
function ctools_field_create_field($field) {
1047
  ctools_flush_field_caches();
1048
}
1049

  
1050
/**
1051
 * Implements hook_field_create_instance().
1052
 */
1053
function ctools_field_create_instance($instance) {
1054
  ctools_flush_field_caches();
1055
}
1056
/**
1057
 * Implements hook_field_delete_field().
1058
 */
1059
function ctools_field_delete_field($field) {
1060
  ctools_flush_field_caches();
1061
}
1062
/**
1063
 * Implements hook_field_delete_instance().
1064
 */
1065
function ctools_field_delete_instance($instance) {
1066
  ctools_flush_field_caches();
1067
}
1068
/**
1069
 * Implements hook_field_update_field().
1070
 */
1071
function ctools_field_update_field($field, $prior_field, $has_data) {
1072
  ctools_flush_field_caches();
1073
}
1074

  
1075
/**
1076
 * Implements hook_field_update_instance().
1077
 */
1078
function ctools_field_update_instance($instance, $prior_instance) {
1079
  ctools_flush_field_caches();
1080
}
1081

  
1082
/**
1083
 * Clear field related caches.
1084
 */
1085
function ctools_flush_field_caches() {
1086
  // Clear caches of 'Entity field' content type plugin.
1087
  cache_clear_all('ctools_entity_field_content_type_content_types', 'cache');
1088
}
drupal7/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.info
5 5
version = CTOOLS_MODULE_VERSION
6 6
dependencies[] = ctools
7 7

  
8
; Information added by Drupal.org packaging script on 2015-03-18
9
version = "7.x-1.7"
8
; Information added by Drupal.org packaging script on 2015-08-19
9
version = "7.x-1.9"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1426696183"
12
datestamp = "1440020680"
13 13

  
drupal7/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.info
5 5
dependencies[] = ctools
6 6
core = 7.x
7 7

  
8
; Information added by Drupal.org packaging script on 2015-03-18
9
version = "7.x-1.7"
8
; Information added by Drupal.org packaging script on 2015-08-19
9
version = "7.x-1.9"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1426696183"
12
datestamp = "1440020680"
13 13

  
drupal7/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.module
524 524
}
525 525

  
526 526
/**
527
 * Handle the 'finish' click on teh add/edit pane form wizard.
527
 * Handle the 'finish' click on the add/edit pane form wizard.
528 528
 *
529 529
 * All we need to do is set a flag so the return can handle adding
530 530
 * the pane.
drupal7/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.info
5 5
version = CTOOLS_MODULE_VERSION
6 6
dependencies[] = ctools
7 7

  
8
; Information added by Drupal.org packaging script on 2015-03-18
9
version = "7.x-1.7"
8
; Information added by Drupal.org packaging script on 2015-08-19
9
version = "7.x-1.9"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1426696183"
12
datestamp = "1440020680"
13 13

  
drupal7/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.info
8 8
dependencies[] = advanced_help
9 9
core = 7.x
10 10

  
11
; Information added by Drupal.org packaging script on 2015-03-18
12
version = "7.x-1.7"
11
; Information added by Drupal.org packaging script on 2015-08-19
12
version = "7.x-1.9"
13 13
core = "7.x"
14 14
project = "ctools"
15
datestamp = "1426696183"
15
datestamp = "1440020680"
16 16

  
drupal7/sites/all/modules/ctools/includes/content.inc
341 341
    return FALSE;
342 342
  }
343 343

  
344
  if ($function = ctools_plugin_get_function($subtype, 'check editable')) {
344
  $function = FALSE;
345
  
346
  if (!empty($subtype['check editable'])) {
347
    $function = ctools_plugin_get_function($subtype, 'check editable');
348
  }
349
  elseif (!empty($type['check editable'])) {
350
    $function = ctools_plugin_get_function($type, 'check editable');
351
  }
352

  
353
  if ($function) {
345 354
    return $function($type, $subtype, $conf);
346 355
  }
347 356

  
drupal7/sites/all/modules/ctools/includes/context-admin.inc
736 736
    '#default_value' => $conf['keyword'],
737 737
  );
738 738

  
739
  if ($type_info['key'] == 'requiredcontexts') {
740
    $form['optional'] = array(
741
      '#type' => 'checkbox',
742
      '#title' => t('Context is optional'),
743
      '#default_value' => !empty($form_state['conf']['optional']),
744
      '#description' => t('This context need not be present for the component to function.'),
745
    );
746
  }
747

  
739 748
  $form['#submit'][] = 'ctools_edit_context_form_defaults_submit';
740 749

  
741 750
  return $form;
......
752 761
    $form_state['conf']['default'] = $form_state['values']['default'];
753 762
    $form_state['conf']['title'] = $form_state['values']['title'];
754 763
  }
764
  if ($form_state['type info']['key'] == 'requiredcontexts') {
765
    $form_state['conf']['optional'] = $form_state['values']['optional'];
766
  }
755 767

  
756 768
  $form_state['conf']['identifier'] = $form_state['values']['identifier'];
757 769
  $form_state['conf']['keyword'] = $form_state['values']['keyword'];
drupal7/sites/all/modules/ctools/includes/context.inc
216 216
    $context = new ctools_context('any');
217 217
    $context->title      = t('No context');
218 218
    $context->identifier = t('No context');
219
    $contexts = array_merge(array('empty' => $context), $contexts);
219
    $contexts['empty'] = $context;
220 220
  }
221 221

  
222 222
  function filter($contexts) {
......
1505 1505
      return TRUE;
1506 1506
    }
1507 1507
    else if (!$pass && $settings['logic'] == 'and') {
1508
      // Fail if 'and' and htis rule failed.
1508
      // Fail if 'and' and this rule failed.
1509 1509
      return FALSE;
1510 1510
    }
1511 1511
  }
drupal7/sites/all/modules/ctools/includes/css.inc
172 172
  // @todo Is this slow? Does it matter if it is?
173 173
  $filename = $path . '/' . md5($css) . '.css';
174 174

  
175
  // This will do renames if the file already exists, ensuring we don't
176
  // accidentally overwrite other files who share the same md5. Yes this
177
  // is a very miniscule chance but it's safe.
178
  $filename = file_unmanaged_save_data($css, $filename);
175
  // Generally md5 is considered unique enough to sign file downloads.
176
  // So this replaces already existing files based on the assumption that two
177
  // files with the same hash are identical content wise.
178
  // If we rename, the cache folder can potentially fill up with thousands of
179
  // files with the same content.
180
  $filename = file_unmanaged_save_data($css, $filename, FILE_EXISTS_REPLACE);
179 181

  
180 182
  return $filename;
181 183
}
drupal7/sites/all/modules/ctools/includes/jump-menu.inc
51 51
    'hide' => TRUE,
52 52
  );
53 53

  
54
  ctools_add_js('jump-menu');
54
  $form['#attached']['js'][] = ctools_attach_js('jump-menu');
55 55

  
56 56
  if (!empty($options['choose'])) {
57 57
    $select = array('' => $options['choose']) + $select;
drupal7/sites/all/modules/ctools/includes/math-expr.inc
271 271
            } elseif (in_array($op, $ops) and !$expecting_op) {
272 272
                return $this->trigger("unexpected operator '$op'");
273 273
            } else { // I don't even want to know what you did to get here
274
                return $this->trigger("an unexpected error occured");
274
                return $this->trigger("an unexpected error occurred");
275 275
            }
276 276
            if ($index == strlen($expr)) {
277 277
                if (in_array($op, $ops)) { // did we end with an operator? bad.
drupal7/sites/all/modules/ctools/includes/modal.inc
66 66
  drupal_add_library('system', 'jquery.form');
67 67
  drupal_add_library('system', 'drupal.progress');
68 68
  drupal_add_library('system', 'drupal.ajax');
69
  drupal_add_library('system', 'ui');
69 70
  ctools_add_js('modal');
70 71

  
71 72
  ctools_add_css('modal');
drupal7/sites/all/modules/ctools/includes/plugins.inc
79 79
      }
80 80

  
81 81
      // Only process if version is between minimum and current, inclusive.
82
      if (version_compare($version, $minimum_version, '>=') && version_compare($version, $current_version, '<=')) {
82
      if (($version == $minimum_version) || ($version == $current_version)
83
        || (version_compare($version, $minimum_version, '>=')
84
        && version_compare($version, $current_version, '<='))) {
83 85
        if (!isset($info['path'])) {
84 86
          $info['path'] = drupal_get_path('module', $module);
85 87
        }
......
110 112
    }
111 113

  
112 114
    // Allow other modules to hook in.
113
    drupal_alter($hook, $cache[$owner][$api]);
115
    drupal_alter($hook, $cache[$owner][$api], $owner, $api);
114 116
  }
115 117

  
116 118
  return $cache[$owner][$api];
......
213 215
 */
214 216
function ctools_get_plugins($module, $type, $id = NULL) {
215 217
  // Store local caches of plugins and plugin info so we don't have to do full
216
  // lookups everytime.
218
  // lookups every time.
217 219
  static $drupal_static_fast;
218 220
  if (!isset($drupal_static_fast)) {
219 221
    $drupal_static_fast['plugins'] = &drupal_static('ctools_plugins', array());
drupal7/sites/all/modules/ctools/includes/stylizer.inc
500 500
    $palette[$luminosity_input]['green'] = $green;
501 501
    $palette[$luminosity_input]['blue'] = $blue;
502 502

  
503
    // Now we complete the palette, first we'll do it tothe black, and then to
503
    // Now we complete the palette, first we'll do it to the black, and then to
504 504
    // the white.
505 505

  
506 506
    // From input to black
drupal7/sites/all/modules/ctools/includes/uuid.inc
25 25
 * Generates an universally unique identifier using the PECL extension.
26 26
 */
27 27
function _ctools_uuid_generate_pecl() {
28
  return uuid_create(UUID_TYPE_DEFAULT);
28
  $uuid_type = UUID_TYPE_DEFAULT;
29
  return uuid_create($uuid_type);
29 30
}
30 31

  
31 32
/**
drupal7/sites/all/modules/ctools/js/modal.js
48 48
      modalOptions: {
49 49
        opacity: .55,
50 50
        background: '#fff'
51
      }
51
      },
52
      modalClass: 'default'
52 53
    };
53 54

  
54 55
    var settings = {};
......
97 98
    resize();
98 99

  
99 100
    $('span.modal-title', Drupal.CTools.Modal.modal).html(Drupal.CTools.Modal.currentSettings.loadingText);
100
    Drupal.CTools.Modal.modalContent(Drupal.CTools.Modal.modal, settings.modalOptions, settings.animation, settings.animationSpeed);
101
    $('#modalContent .modal-content').html(Drupal.theme(settings.throbberTheme));
101
    Drupal.CTools.Modal.modalContent(Drupal.CTools.Modal.modal, settings.modalOptions, settings.animation, settings.animationSpeed, settings.modalClass);
102
    $('#modalContent .modal-content').html(Drupal.theme(settings.throbberTheme)).addClass('ctools-modal-loading');
102 103

  
103 104
    // Position autocomplete results based on the scroll position of the modal.
104 105
    $('#modalContent .modal-content').delegate('input.form-autocomplete', 'keyup', function() {
......
299 300
    // Attach behaviors within a modal dialog.
300 301
    var settings = response.settings || ajax.settings || Drupal.settings;
301 302
    Drupal.attachBehaviors('#modalContent', settings);
303

  
304
    if ($('#modal-content').hasClass('ctools-modal-loading')) {
305
      $('#modal-content').removeClass('ctools-modal-loading');
306
    }
307
    else {
308
      // If the modal was already shown, and we are simply replacing its
309
      // content, then focus on the first focusable element in the modal.
310
      // (When first showing the modal, focus will be placed on the close
311
      // button by the show() function called above.)
312
      $('#modal-content :focusable:first').focus();
313
    }
302 314
  }
303 315

  
304 316
  /**
......
349 361
   * @param css obj of css attributes
350 362
   * @param animation (fadeIn, slideDown, show)
351 363
   * @param speed (valid animation speeds slow, medium, fast or # in ms)
364
   * @param modalClass class added to div#modalContent
352 365
   */
353
  Drupal.CTools.Modal.modalContent = function(content, css, animation, speed) {
366
  Drupal.CTools.Modal.modalContent = function(content, css, animation, speed, modalClass) {
354 367
    // If our animation isn't set, make it just show/pop
355 368
    if (!animation) {
356 369
      animation = 'show';
......
402 415
    if( docHeight < winHeight ) docHeight = winHeight;
403 416

  
404 417
    // Create our divs
405
    $('body').append('<div id="modalBackdrop" style="z-index: 1000; display: none;"></div><div id="modalContent" style="z-index: 1001; position: absolute;">' + $(content).html() + '</div>');
418
    $('body').append('<div id="modalBackdrop" class="backdrop-' + modalClass + '" style="z-index: 1000; display: none;"></div><div id="modalContent" class="modal-' + modalClass + '" style="z-index: 1001; position: absolute;">' + $(content).html() + '</div>');
419

  
420
    // Get a list of the tabbable elements in the modal content.
421
    var getTabbableElements = function () {
422
      var tabbableElements = $('#modalContent :tabbable'),
423
          radioButtons = tabbableElements.filter('input[type="radio"]');
424

  
425
      // The list of tabbable elements from jQuery is *almost* right. The
426
      // exception is with groups of radio buttons. The list from jQuery will
427
      // include all radio buttons, when in fact, only the selected radio button
428
      // is tabbable, and if no radio buttons in a group are selected, then only
429
      // the first is tabbable.
430
      if (radioButtons.length > 0) {
431
        // First, build up an index of which groups have an item selected or not.
432
        var anySelected = {};
433
        radioButtons.each(function () {
434
          var name = this.name;
435

  
436
          if (typeof anySelected[name] === 'undefined') {
437
            anySelected[name] = radioButtons.filter('input[name="' + name + '"]:checked').length !== 0;
438
          }
439
        });
440

  
441
        // Next filter out the radio buttons that aren't really tabbable.
442
        var found = {};
443
        tabbableElements = tabbableElements.filter(function () {
444
          var keep = true;
445

  
446
          if (this.type == 'radio') {
447
            if (anySelected[this.name]) {
448
              // Only keep the selected one.
449
              keep = this.checked;
450
            }
451
            else {
452
              // Only keep the first one.
453
              if (found[this.name]) {
454
                keep = false;
455
              }
456
              found[this.name] = true;
457
            }
458
          }
406 459

  
407
    // Keyboard and focus event handler ensures focus stays on modal elements only
460
          return keep;
461
        });
462
      }
463

  
464
      return tabbableElements.get();
465
    };
466

  
467
    // Keyboard and focus event handler ensures only modal elements gain focus.
408 468
    modalEventHandler = function( event ) {
409 469
      target = null;
410 470
      if ( event ) { //Mozilla
......
428 488
        return true;
429 489
      }
430 490
      else {
431
        $('#modalContent').focus();
491
        getTabbableElements()[0].focus();
432 492
      }
433 493

  
434 494
      event.preventDefault();
......
436 496
    $('body').bind( 'focus', modalEventHandler );
437 497
    $('body').bind( 'keypress', modalEventHandler );
438 498

  
499
    // Keypress handler Ensures you can only TAB to elements within the modal.
500
    // Based on the psuedo-code from WAI-ARIA 1.0 Authoring Practices section
501
    // 3.3.1 "Trapping Focus".
502
    modalTabTrapHandler = function (evt) {
503
      // We only care about the TAB key.
504
      if (evt.which != 9) {
505
        return true;
506
      }
507

  
508
      var tabbableElements = getTabbableElements(),
509
          firstTabbableElement = tabbableElements[0],
510
          lastTabbableElement = tabbableElements[tabbableElements.length - 1],
511
          singleTabbableElement = firstTabbableElement == lastTabbableElement,
512
          node = evt.target;
513

  
514
      // If this is the first element and the user wants to go backwards, then
515
      // jump to the last element.
516
      if (node == firstTabbableElement && evt.shiftKey) {
517
        if (!singleTabbableElement) {
518
          lastTabbableElement.focus();
519
        }
520
        return false;
521
      }
522
      // If this is the last element and the user wants to go forwards, then
523
      // jump to the first element.
524
      else if (node == lastTabbableElement && !evt.shiftKey) {
525
        if (!singleTabbableElement) {
526
          firstTabbableElement.focus();
527
        }
528
        return false;
529
      }
530
      // If this element isn't in the dialog at all, then jump to the first
531
      // or last element to get the user into the game.
532
      else if ($.inArray(node, tabbableElements) == -1) {
533
        // Make sure the node isn't in another modal (ie. WYSIWYG modal).
534
        var parents = $(node).parents().get();
535
        for (var i = 0; i < parents.length; ++i) {
536
          var position = $(parents[i]).css('position');
537
          if (position == 'absolute' || position == 'fixed') {
538
            return true;
539
          }
540
        }
541

  
542
        if (evt.shiftKey) {
543
          lastTabbableElement.focus();
544
        }
545
        else {
546
          firstTabbableElement.focus();
547
        }
548
      }
549
    };
550
    $('body').bind('keydown', modalTabTrapHandler);
551

  
439 552
    // Create our content div, get the dimensions, and hide it
440 553
    var modalContent = $('#modalContent').css('top','-1000px');
441 554
    var mdcTop = wt + ( winHeight / 2 ) - (  modalContent.outerHeight() / 2);
......
457 570

  
458 571
    $(document).bind('keydown', modalEventEscapeCloseHandler);
459 572

  
573
    // Per WAI-ARIA 1.0 Authoring Practices, initial focus should be on the
574
    // close button, but we should save the original focus to restore it after
575
    // the dialog is closed.
576
    var oldFocus = document.activeElement;
577
    $('.close').focus();
578

  
460 579
    // Close the open modal content and backdrop
461 580
    function close() {
462 581
      // Unbind the events
463 582
      $(window).unbind('resize',  modalContentResize);
464 583
      $('body').unbind( 'focus', modalEventHandler);
465 584
      $('body').unbind( 'keypress', modalEventHandler );
585
      $('body').unbind( 'keydown', modalTabTrapHandler );
466 586
      $('.close').unbind('click', modalContentClose);
467 587
      $('body').unbind('keypress', modalEventEscapeCloseHandler);
468 588
      $(document).trigger('CToolsDetachBehaviors', $('#modalContent'));
......
478 598
      // Remove the content
479 599
      $('#modalContent').remove();
480 600
      $('#modalBackdrop').remove();
601

  
602
      // Restore focus to where it was before opening the dialog
603
      $(oldFocus).focus();
481 604
    };
482 605

  
483
    // Move and resize the modalBackdrop and modalContent on resize of the window
484
     modalContentResize = function(){
606
    // Move and resize the modalBackdrop and modalContent on window resize.
607
    modalContentResize = function(){
485 608

  
486
      // position code lifted from http://www.quirksmode.org/viewport/compatibility.html
609
      // Reset the backdrop height/width to get accurate document size.
610
      $('#modalBackdrop').css('height', '').css('width', '');
611

  
612
      // Position code lifted from:
613
      // http://www.quirksmode.org/viewport/compatibility.html
487 614
      if (self.pageYOffset) { // all except Explorer
488 615
      var wt = self.pageYOffset;
489 616
      } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
......
509 636
      modalContent.css('top', mdcTop + 'px').css('left', mdcLeft + 'px').show();
510 637
    };
511 638
    $(window).bind('resize', modalContentResize);
512

  
513
    $('#modalContent').focus();
514 639
  };
515 640

  
516 641
  /**
......
533 658
    $(window).unbind('resize', modalContentResize);
534 659
    $('body').unbind('focus', modalEventHandler);
535 660
    $('body').unbind('keypress', modalEventHandler);
661
    $('body').unbind( 'keydown', modalTabTrapHandler );
536 662
    $('.close').unbind('click', modalContentClose);
663
    $('body').unbind('keypress', modalEventEscapeCloseHandler);
537 664
    $(document).trigger('CToolsDetachBehaviors', $('#modalContent'));
538 665

  
539 666
    // jQuery magic loop through the instances and run the animations or removal.
drupal7/sites/all/modules/ctools/js/states-show.js
1
/**
2
 * @file
3
 * Custom state for handling visibility
4
 */
5

  
6
/**
7
 * Add a new state to Drupal #states. We use this to toggle element-invisible
8
 * to show/hidden #states elements. This allows elements to be visible to
9
 * screen readers.
10
 *
11
 * To use:
12
 * $form['my_form_field'] = array(
13
 *   ..
14
 *   // Only show this field if 'some_other_field' is checked.
15
 *   '#states => array(
16
 *     'show' => array(
17
 *       'some-other-field' => array('checked' => TRUE),
18
 *     ),
19
 *   ),
20
 *   ..
21
 *   // Required to load the 'show' state handler.
22
 *   '#attached' => array(
23
 *     'js' => array(ctools_attach_js('states-show')),
24
 *   ),
25
 * );
26
 */
27

  
28
(function ($) {
29
  'use strict';
30

  
31
  Drupal.states.State.aliases.hidden = '!show';
32

  
33
  // Show/hide form items by toggling the 'element-invisible' class. This is a
34
  // more accessible option than the core 'visible' state.
35
  $(document).bind('state:show', function(e) {
36
    if (e.trigger) {
37
      var element = $(e.target).closest('.form-item, .form-submit, .form-wrapper');
38
      element.toggle(e.value);
39
      e.value === true ? element.removeClass('element-invisible') : element.addClass('element-invisible');
40
    }
41
  });
42

  
43
})(jQuery);
drupal7/sites/all/modules/ctools/page_manager/page_manager.info
5 5
package = Chaos tool suite
6 6
version = CTOOLS_MODULE_VERSION
7 7

  
8
; Information added by Drupal.org packaging script on 2015-03-18
9
version = "7.x-1.7"
8
; Information added by Drupal.org packaging script on 2015-08-19
9
version = "7.x-1.9"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1426696183"
12
datestamp = "1440020680"
13 13

  
drupal7/sites/all/modules/ctools/page_manager/page_manager.module
440 440
 */
441 441
function page_manager_handler_get_name($task_name, $handlers, $handler) {
442 442
  $base = str_replace('-', '_', $task_name);
443
  $name = '';
444

  
443 445
  // Optional machine name.
444 446
  if (!empty($handler->conf['name'])) {
445 447
    $name = $base . '__' . $handler->conf['name'];
448
    if (count(ctools_export_load_object('page_manager_handlers', 'names', array($name)))) {
449
      $name = '';
450
    }
446 451
  }
447 452

  
448
  // If no machine name was provided, generate a unique name.
449
  else {
453
  // If no machine name was provided or the name is in use, generate a unique name.
454
  if (empty($name)) {
450 455
    $base .= '__' . $handler->handler;
451 456

  
452 457
    // Use the ctools uuid generator to generate a unique id.
......
472 477

  
473 478
  if ($title) {
474 479
    $handler->conf['title'] = $title;
480
    $handler->conf['name'] = trim(preg_replace('/[^a-z0-9_]+/', '-', strtolower($title)), '-');
481
  }
482
  else {
483
    $handler->conf['name'] = '';
475 484
  }
476 485

  
477 486
  $name = page_manager_handler_get_name($page->task_name, $page->handlers, $handler);
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/node_edit.inc
108 108
 * Callback to handle the process of adding a node.
109 109
 *
110 110
 * This creates a basic $node and passes that off to page_manager_node_edit().
111
 * It is modeled after Drupal's node_add() function.
111
 * It is modelled after Drupal's node_add() function.
112 112
 *
113 113
 * Unlike node_add() we do not need to check node_access because that was
114 114
 * already checked by the menu system.
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/node_view.inc
78 78
 * node view, which is node_page_view().
79 79
 */
80 80
function page_manager_node_view_page($node) {
81
  // Prep the node to be displayed so all of the regular hooks are triggered.
82
  // Also save the output for later, in case it is needed.
83
  $default_output = node_page_view($node);
84

  
85 81
  // Load my task plugin
86 82
  $task = page_manager_get_task('node_view');
87 83

  
......
107 103
    }
108 104
  }
109 105

  
106
  // Prepare the node to be displayed so all of the regular hooks are triggered.
107
  $default_output = node_page_view($node);
108

  
110 109
  // Otherwise, fall back to the default output generated by node_page_view().
111 110
  return $default_output;
112 111
}
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/page.admin.inc
61 61
    }
62 62

  
63 63
    $path             = array();
64
    $page_arguments   = array($subtask_id);
64
    $page_arguments   = array((string) $subtask_id);
65 65
    $access_arguments = array($subtask->access);
66 66
    $load_arguments   = array($subtask_id, '%index', '%map');
67 67

  
......
566 566
  if (strpos($path, '%') === FALSE) {
567 567
    $alias = db_query('SELECT alias, source FROM {url_alias} WHERE alias = :path', array(':path' => $path))->fetchObject();
568 568
    if ($alias) {
569
      form_error($form['path'], t('That path is currently assigned to be an alias for @alias. This system cannot override existing aliases.', array('@alias' => $alias->src)));
569
      form_error($form['path'], t('That path is currently assigned to be an alias for @alias. This system cannot override existing aliases.', array('@alias' => $alias->source)));
570 570
    }
571 571
  }
572 572
  else {
drupal7/sites/all/modules/ctools/plugins/content_types/comment/comment_created.inc
1
<?php
2

  
3
/**
4
 * Plugins are described by creating a $plugin array which will be used
5
 * by the system that includes this file.
6
 */
7
$plugin = array(
8
  'single' => TRUE,
9
  'title' => t('Comment created date'),
10
  'icon' => 'icon_comment.png',
11
  'description' => t('The date the referenced comment was created.'),
12
  'required context' => new ctools_context_required(t('Comment'), 'entity:comment'),
13
  'category' => t('Comment'),
14
  'defaults' => array(
15
    'format' => 'small',
16
  ),
17
);
18

  
19
/**
20
 * Render the custom content type.
21
 */
22
function ctools_comment_created_content_type_render($subtype, $conf, $panel_args, $context) {
23
  if (empty($context) || empty($context->data)) {
24
    return;
25
  }
26

  
27
  // Get a shortcut to the comment.
28
  $comment = $context->data;
29

  
30
  // Build the content type block.
31
  $block = new stdClass();
32
  $block->module  = 'comment_created';
33
  $block->title   = t('Created date');
34
  $block->content = format_date($comment->created, $conf['format']);
35
  $block->delta   = $comment->cid;
36

  
37
  return $block;
38
}
39

  
40
/**
41
 * Returns an edit form for custom type settings.
42
 */
43
function ctools_comment_created_content_type_edit_form($form, &$form_state) {
44
  $conf = $form_state['conf'];
45
  $date_types = array();
46

  
47
  foreach (system_get_date_types() as $date_type => $definition) {
48
    $date_types[$date_type] = format_date(REQUEST_TIME, $date_type);
49
  }
50
  $form['format'] = array(
51
    '#title' => t('Date format'),
52
    '#type' => 'select',
53
    '#options' => $date_types,
54
    '#default_value' => $conf['format'],
55
  );
56
  return $form;
57
}
58

  
59
/**
60
 * Submit handler for the custom type settings form.
61
 */
62
function ctools_comment_created_content_type_edit_form_submit($form, &$form_state) {
63
  // Copy everything from our defaults.
64
  foreach (array_keys($form_state['plugin']['defaults']) as $key) {
65
    $form_state['conf'][$key] = $form_state['values'][$key];
66
  }
67
}
68

  
69
/**
70
 * Returns the administrative title for a type.
71
 */
72
function ctools_comment_created_content_type_admin_title($subtype, $conf, $context) {
73
  return t('"@s" created date', array('@s' => $context->identifier));
74
}
drupal7/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc
34 34
    return $types;
35 35
  }
36 36

  
37
  $cache_key = 'ctools_entity_field_content_type_content_types';
38
  if ($cache = cache_get($cache_key)) {
39
    $types = $cache->data;
40
    if (!empty($types)) {
41
      return $types;
42
    }
43
  }
44

  
37 45
  // This will hold all the individual field content types.
38 46
  $context_types = array();
39 47
  $entities = entity_get_info();
......
82 90
    unset($context_types[$key]['types']);
83 91
  }
84 92

  
93
  cache_set($cache_key, $types);
94

  
85 95
  return $types;
86 96
}
87 97

  
drupal7/sites/all/modules/ctools/plugins/content_types/form/entity_form_field.inc
57 57
    }
58 58
  }
59 59

  
60
  if (module_exists('field_group')) {
61
    foreach ($entities as $entity_type => $entity) {
62
      foreach ($entity['bundles'] as $type => $bundle) {
63
        if ($group_info = field_group_info_groups($entity_type, $type, "form")) {
64
          foreach ($group_info as $group_name => $group) {
65
            if (!isset($types[$entity_type . ':' . $group_name])) {
66
              $types[$entity_type . ':' . $group_name] = array(
67
                'category' => t('Form'),
68
                'icon' => 'icon_field.png',
69
                'title' => t('Group form: @widget_label', array('@widget_label' => $group->label)),
70
                'description' => t('Field group on the referenced entity.'),
71
              );
72
            }
73
            $content_types[$entity_type . ':' . $group_name]['types'][$type] = $bundle['label'];
74
          }
75
      }
76
      }
77
    }
78
  }
79

  
60 80
  // Create the required context for each field related to the bundle types.
61 81
  foreach ($types as $key => $field_content_type) {
62 82
    list($entity_type, $field_name) = explode(':', $key, 2);
......
85 105
  $ids = entity_extract_ids($entity_type, $entity);
86 106
  $field = field_info_instance($entity_type, $field_name, $ids[2]);
87 107

  
88
  // Do not render if the entity type does not have this field.
89
  if (empty($field)) {
108
  // Check for field groups.
109
  if (empty($field) && module_exists('field_group')) {
110
    $groups = field_group_info_groups($entity_type, $entity->type, "form");
111
    $group = !empty($groups[$field_name]) ? $groups[$field_name] : NULL;
112
  }
113

  
114
  // Do not render if the entity type does not have this field or group.
115
  if (empty($field) && empty($group)) {
90 116
    return;
91 117
  }
92
  $block = new stdClass();
93 118

  
119
  $block = new stdClass();
94 120
  if (isset($context->form)) {
95 121
    $block->content = array();
96
    $block->content[$field_name] = $context->form[$field_name];
97
    unset($context->form[$field_name]);
122
    if (!empty($field)) {
123
      $block->content[$field_name] = $context->form[$field_name];
124
      unset($context->form[$field_name]);
125
    }
126
    else {
127
      // Pre-render the form to populate field groups.
128
      if (isset($context->form['#pre_render'])) {
129
        foreach ($context->form['#pre_render'] as $function) {
130
          if (function_exists($function)) {
131
            $context->form = $function($context->form);
132
          }
133
        }
134
        unset($context->form['#pre_render']);
135
      }
136

  
137
      $block->content[$field_name] = $context->form[$field_name];
138
      unset($context->form[$field_name]);
139
    }
98 140
  }
99 141
  else {
100 142
    $block->content = t('Entity info.');
drupal7/sites/all/modules/ctools/plugins/content_types/node_context/node_comment_form.inc
77 77
  }
78 78
}
79 79

  
80
/**
81
 * Alter the comment form to get a little more control over it.
82
 */
83
function ctools_form_comment_form_alter(&$form, &$form_state) {
84
  if (!empty($form_state['ctools comment alter'])) {
85
    // Force the form to post back to wherever we are.
86
    $form['#action'] = url($_GET['q'], array('fragment' => 'comment-form'));
87
    if (empty($form['#submit'])) {
88
      $form['#submit'] = array('comment_form_submit');
89
    }
90
    $form['#submit'][] = 'ctools_node_comment_form_submit';
91
  }
92
}
93

  
94
function ctools_node_comment_form_submit(&$form, &$form_state) {
95
  $form_state['redirect'][0] = $_GET['q'];
96
}
drupal7/sites/all/modules/ctools/plugins/content_types/page/page_title.inc
29 29
 * Outputs the page title of the current page.
30 30
 */
31 31
function ctools_page_title_content_type_render($subtype, $conf, $panel_args) {
32
  if (!drupal_get_title()) {
33
    return;
34
  }
32 35
  // TODO: This should have a setting or something for the markup.
33 36
  if (empty($conf['markup'])) {
34 37
    $conf['markup'] = 'h1';
drupal7/sites/all/modules/ctools/plugins/content_types/term_context/term_description.inc
18 18
  $block = new stdClass();
19 19
  $block->module = 'node_type';
20 20

  
21
  $block->title = $term->name;
22
  if ($term) {
21
  if (!empty($term)) {
22
    $block->title = $term->name;
23 23
    $block->content = check_markup($term->description, $term->format, '', TRUE);
24 24
    $block->delta = $term->tid;
25 25

  
......
33 33
    }
34 34
  }
35 35
  else {
36
    $block->title = '';
36 37
    $block->content = t('Term description goes here.');
37 38
    $block->delta = 'unknown';
38 39
  }
drupal7/sites/all/modules/ctools/plugins/contexts/user.inc
43 43
    if ($data['type'] == 'current') {
44 44
      global $user;
45 45
      $data = user_load($user->uid);
46
      $data->logged_in_user = TRUE;
46
      if (user_is_logged_in()) {
47
        $data->logged_in_user = TRUE;
48
      }
47 49
    }
48 50
    else {
49 51
      $data = user_load($data['uid']);
drupal7/sites/all/modules/ctools/plugins/contexts/user_edit_form.inc
34 34
  $category = !empty($conf['category']) ? $conf['category'] : FALSE;
35 35
  unset($conf['category']);
36 36

  
37
  // If no category was specified, use the default 'account'.
38
  if (!$category) {
39
    $category = 'account';
40
  }
37 41
  // Return previously created contexts, per category.
38 42
  static $created = array();
39 43
  if (!empty($created[$category])) {
40 44
    return $created[$category];
41 45
  }
42
  // If no category was specified, use the default 'account'.
43
  if (!$category) {
44
    $category = 'account';
45
  }
46 46

  
47 47
  $context = new ctools_context(array('form', 'user_edit', 'user_form', 'user_edit_form', 'user', 'entity:user'));
48 48
  // Store this context for later.
drupal7/sites/all/modules/ctools/plugins/export_ui/ctools_export_ui.class.php
724 724
      // Export the handler, which is a fantastic way to clean database IDs out of it.
725 725
      $export = ctools_export_crud_export($this->plugin['schema'], $original);
726 726
      $item = ctools_export_crud_import($this->plugin['schema'], $export);
727
      $item->{$this->plugin['export']['key']} = 'clone_of_' . $item->{$this->plugin['export']['key']};
727

  
728
      if (!empty($input[$this->plugin['export']['key']])) {
729
        $item->{$this->plugin['export']['key']} = $input[$this->plugin['export']['key']];
730
      }
731
      else {
732
        $item->{$this->plugin['export']['key']} = 'clone_of_' . $item->{$this->plugin['export']['key']};
733
      }
728 734
    }
729 735

  
730 736
    // Tabs and breadcrumb disappearing, this helps alleviate through cheating.
drupal7/sites/all/modules/ctools/plugins/relationships/entity_from_field.inc
185 185
        $loaded_to_entity = array_shift($loaded_to_entity);
186 186

  
187 187
        // Pass current user account and entity type to access callback.
188
        if (function_exists($to_entity_info['access callback']) && !call_user_func($to_entity_info['access callback'], 'view', $loaded_to_entity, $account, $to_entity)) {
188
        if (isset($to_entity_info['access callback']) && function_exists($to_entity_info['access callback']) && !call_user_func($to_entity_info['access callback'], 'view', $loaded_to_entity)) {
189 189
          return ctools_context_create_empty('entity:' . $to_entity, NULL);
190 190
        }
191 191
        else {
drupal7/sites/all/modules/ctools/stylizer/stylizer.info
6 6
dependencies[] = ctools
7 7
dependencies[] = color
8 8

  
9
; Information added by Drupal.org packaging script on 2015-03-18
10
version = "7.x-1.7"
9
; Information added by Drupal.org packaging script on 2015-08-19
10
version = "7.x-1.9"
11 11
core = "7.x"
12 12
project = "ctools"
13
datestamp = "1426696183"
13
datestamp = "1440020680"
14 14

  
drupal7/sites/all/modules/ctools/term_depth/term_depth.info
5 5
package = Chaos tool suite
6 6
version = CTOOLS_MODULE_VERSION
7 7

  
8
; Information added by Drupal.org packaging script on 2015-03-18
9
version = "7.x-1.7"
8
; Information added by Drupal.org packaging script on 2015-08-19
9
version = "7.x-1.9"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1426696183"
12
datestamp = "1440020680"
13 13

  
drupal7/sites/all/modules/ctools/tests/ctools_export_test/ctools_export_test.info
8 8

  
9 9
files[] = ctools_export.test
10 10

  
11
; Information added by Drupal.org packaging script on 2015-03-18
12
version = "7.x-1.7"
11
; Information added by Drupal.org packaging script on 2015-08-19
12
version = "7.x-1.9"
13 13
core = "7.x"
14 14
project = "ctools"
15
datestamp = "1426696183"
15
datestamp = "1440020680"
16 16

  
drupal7/sites/all/modules/ctools/tests/ctools_plugin_test.info
12 12
files[] = math_expression_stack.test
13 13
hidden = TRUE
14 14

  
15
; Information added by Drupal.org packaging script on 2015-03-18
16
version = "7.x-1.7"
15
; Information added by Drupal.org packaging script on 2015-08-19
16
version = "7.x-1.9"
17 17
core = "7.x"
18 18
project = "ctools"
19
datestamp = "1426696183"
19
datestamp = "1440020680"
20 20

  
drupal7/sites/all/modules/ctools/tests/plugins/cached/ctoolsCachedPluginArray.class.php
1 1
<?php
2 2
/**
3 3
 * @file
4
 * A cached plugin object that tests inheritence including.
4
 * A cached plugin object that tests inheritance including.
5 5
 */
6 6

  
7 7
class ctoolsCachedPluginArray {}
drupal7/sites/all/modules/ctools/tests/plugins/cached/ctoolsCachedPluginArray2.class.php
1 1
<?php
2 2
/**
3 3
 * @file
4
 * A cached plugin object that tests inheritence including.
4
 * A cached plugin object that tests inheritance including.
5 5
 */
6 6

  
7 7
class ctoolsCachedPluginArray2 extends ctoolsCachedPluginArray {}
drupal7/sites/all/modules/ctools/tests/plugins/not_cached/ctoolsNotCachedPluginArray.class.php
1 1
<?php
2 2
/**
3 3
 * @file
4
 * A cached plugin object that tests inheritence including.
4
 * A cached plugin object that tests inheritance including.
5 5
 */
6 6

  
7 7
class ctoolsNotCachedPluginArray extends ctoolsNotCachedPluginArray2 {}
drupal7/sites/all/modules/ctools/views_content/views_content.info
10 10
files[] = plugins/views/views_content_plugin_display_panel_pane.inc
11 11
files[] = plugins/views/views_content_plugin_style_ctools_context.inc
12 12

  
13
; Information added by Drupal.org packaging script on 2015-03-18
14
version = "7.x-1.7"
13
; Information added by Drupal.org packaging script on 2015-08-19
14
version = "7.x-1.9"
15 15
core = "7.x"
16 16
project = "ctools"
17
datestamp = "1426696183"
17
datestamp = "1440020680"
18 18

  

Formats disponibles : Unified diff