Projet

Général

Profil

Révision 08475715

Ajouté par Assos Assos il y a plus de 7 ans

Weekly update of contrib modules

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 2016-08-17
10
version = "7.x-1.10"
9
; Information added by Drupal.org packaging script on 2016-10-16
10
version = "7.x-1.11"
11 11
core = "7.x"
12 12
project = "ctools"
13
datestamp = "1471454104"
13
datestamp = "1476581654"
14 14

  
drupal7/sites/all/modules/ctools/css/modal-rtl.css
1
div.ctools-modal-content {
2
  text-align: right;
3
}
4

  
5
div.ctools-modal-content .modal-header {
6
  background-color: #2385c2;
7
  padding: 0 1em 0 .25em;
8
}
9

  
10
div.ctools-modal-content a.close {
11
  color: white;
12
  float: left;
13
}
14

  
15
/** modal forms CSS **/
16
div.ctools-modal-content .form-item label {
17
  float: right;
18
}
19

  
20
div.ctools-modal-content .form-item .description {
21
  clear: right;
22
}
23

  
24
div.ctools-modal-content .form-item .description .tips {
25
  margin-left: 0;
26
  margin-right: 2em;
27
}
28

  
29
div.ctools-modal-content fieldset,
30
div.ctools-modal-content .form-radios,
31
div.ctools-modal-content .form-checkboxes {
32
  clear: right;
33
}
34

  
35
div.ctools-modal-content .resizable-textarea {
36
  margin-left: 5em;
37
  margin-right: 15em;
38
}
39

  
40
div.ctools-modal-content .container-inline .form-item {
41
  margin-right: 0;
42
  margin-left: 2em;
43
}
44

  
45
div.ctools-modal-content label.hidden-options {
46
  background-position: left;
47
  padding-right: 0;
48
  padding-left: 12px;
49
}
50

  
51
div.ctools-modal-content label.expanded-options {
52
  background-position: left;
53
  padding-right: 0;
54
  padding-left: 16px;
55
}
56

  
57
div.ctools-modal-content .dependent-options {
58
  padding-left: 0;
59
  padding-right: 30px;
60
}
drupal7/sites/all/modules/ctools/ctools.info
8 8
files[] = includes/stylizer.inc
9 9
files[] = tests/css_cache.test
10 10

  
11
; Information added by Drupal.org packaging script on 2016-08-17
12
version = "7.x-1.10"
11
; Information added by Drupal.org packaging script on 2016-10-16
12
version = "7.x-1.11"
13 13
core = "7.x"
14 14
project = "ctools"
15
datestamp = "1471454104"
15
datestamp = "1476581654"
16 16

  
drupal7/sites/all/modules/ctools/ctools.module
9 9
 * must be implemented in the module file.
10 10
 */
11 11

  
12
define('CTOOLS_API_VERSION', '2.0.8');
12
define('CTOOLS_API_VERSION', '2.0.9');
13 13

  
14 14
/**
15 15
 * The current working ctools version.
......
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.10');
26
define('CTOOLS_MODULE_VERSION', '7.x-1.11');
27 27

  
28 28
/**
29 29
 * Test the CTools API version.
......
760 760

  
761 761
  // Update the classes within the attributes array to match the classes array
762 762
  if (isset($variables['attributes_array']['class'])) {
763
    $variables['attributes_array']['class'] = $variables['classes_array'];
763
    $variables['attributes_array']['class'] = array_unique(array_merge($variables['classes_array'], $variables['attributes_array']['class']));
764 764
    $variables['attributes'] = $variables['attributes_array'] ? drupal_attributes($variables['attributes_array']) : '';
765 765
  }
766 766

  
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 2016-08-17
9
version = "7.x-1.10"
8
; Information added by Drupal.org packaging script on 2016-10-16
9
version = "7.x-1.11"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1471454104"
12
datestamp = "1476581654"
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 2016-08-17
9
version = "7.x-1.10"
8
; Information added by Drupal.org packaging script on 2016-10-16
9
version = "7.x-1.11"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1471454104"
12
datestamp = "1476581654"
13 13

  
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 2016-08-17
9
version = "7.x-1.10"
8
; Information added by Drupal.org packaging script on 2016-10-16
9
version = "7.x-1.11"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1471454104"
12
datestamp = "1476581654"
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 2016-08-17
12
version = "7.x-1.10"
11
; Information added by Drupal.org packaging script on 2016-10-16
12
version = "7.x-1.11"
13 13
core = "7.x"
14 14
project = "ctools"
15
datestamp = "1471454104"
15
datestamp = "1476581654"
16 16

  
drupal7/sites/all/modules/ctools/includes/export.inc
902 902
  $output = $indent . '$' . $identifier . ' = new ' . get_class($object) . "();\n";
903 903

  
904 904
  if ($schema['export']['can disable']) {
905
    $output .= $indent . '$' . $identifier . '->disabled = FALSE; /* Edit this to true to make a default ' . $identifier . ' disabled initially */' . "\n";
905
    $disabled = !isset($object->disabled) || $object->disabled != TRUE ? 'FALSE' : 'TRUE';
906
    $output .= $indent . '$' . $identifier . '->disabled = ' . $disabled . '; /* Edit this to true to make a default ' . $identifier . ' disabled initially */' . "\n";
906 907
  }
907 908
  if (!empty($schema['export']['api']['current_version'])) {
908 909
    $output .= $indent . '$' . $identifier . '->api_version = ' . $schema['export']['api']['current_version'] . ";\n";
drupal7/sites/all/modules/ctools/js/auto-submit.js
36 36
  attach: function(context) {
37 37
    // 'this' references the form element
38 38
    function triggerSubmit (e) {
39
      var $this = $(this);
40
      if (!$this.hasClass('ctools-ajaxing')) {
41
        $this.find('.ctools-auto-submit-click').click();
39
      if ($.contains(document.body, this)) {
40
        var $this = $(this);
41
        if (!$this.hasClass('ctools-ajaxing')) {
42
          $this.find('.ctools-auto-submit-click').click();
43
        }
42 44
      }
43 45
    }
44 46

  
drupal7/sites/all/modules/ctools/page_manager/page_manager.admin.inc
1547 1547

  
1548 1548
  $form['handlers'] = array('#tree' => TRUE);
1549 1549

  
1550
  // Get the number of variants to be displayed in order to set the delta
1551
  // to the proper value.  This fixes problems in previous versions with sorting
1552
  // large numbers of variants.
1553
  $delta = count($page->handler_info)/2 + 1;
1554

  
1550 1555
  foreach ($page->handler_info as $id => $info) {
1551 1556
    if ($info['changed'] & PAGE_MANAGER_CHANGED_DELETED) {
1552 1557
      continue;
......
1572 1577
    $form['handlers'][$id]['weight'] = array(
1573 1578
      '#type' => 'weight',
1574 1579
      '#default_value' => $info['weight'],
1575
      '#delta' => 30,
1580
      '#delta' => $delta,
1576 1581
    );
1577 1582
  }
1578 1583

  
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 2016-08-17
9
version = "7.x-1.10"
8
; Information added by Drupal.org packaging script on 2016-10-16
9
version = "7.x-1.11"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1471454104"
12
datestamp = "1476581654"
13 13

  
drupal7/sites/all/modules/ctools/page_manager/plugins/task_handlers/http_response.inc
3 3
/**
4 4
 * @file
5 5
 *
6
 * This is the task handler plugin to handle generating 403, 404 and 301 response codes.
6
 * This is the task handler plugin to handle generating 403, 404, 301 and 302
7
 * response codes.
7 8
 */
8 9

  
9 10
// Plugin definition
......
108 109
    403 => t('403 Access denied'),
109 110
    404 => t('404 Page not found'),
110 111
    410 => t('410 Gone'),
111
    301 => t('301 Redirect'),
112
    301 => t('301 Permanent redirect'),
113
    302 => t('302 Temporary redirect'),
112 114
  );
113 115
}
114 116

  
......
256 258
    '#type' => 'textfield',
257 259
    '#title' => t('Redirect destination'),
258 260
    '#default_value' => $conf['destination'],
259
    '#dependency' => array('edit-code' => array(301)),
261
    '#dependency' => array('edit-code' => array(301, 302)),
260 262
    '#description' => t('Enter the path to redirect to. You may use keyword substitutions from contexts. You can use external urls (http://www.example.com/foo) or internal urls (node/1).'),
261 263
  );
262 264

  
......
313 315
  }
314 316

  
315 317
  $info['response code'] = $handler->conf['code'];
316
  if ($info['response code'] == 301) {
318
  if ($info['response code'] == 301 || $info['response code'] == 302) {
317 319
    $path = ctools_context_keyword_substitute($handler->conf['destination'], array(), $contexts);
318 320
    $url = parse_url($path);
319 321
    if (isset($url['query'])) {
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/page.admin.inc
698 698
    '#title' => t('Title'),
699 699
    '#type' => 'textfield',
700 700
    '#default_value' => $menu['title'],
701
    '#description' => t('If set to normal or tab, enter the text to use for the menu item.'),
701
    '#description' => t('If set to normal or tab, enter the text to use for the menu item. Renaming the menu item using the Drupal menu system (admin/structure/menu) will override this, even if it is renamed again here.'),
702 702
    '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab', 'action')),
703 703
  );
704 704

  
drupal7/sites/all/modules/ctools/plugins/access/query_string_exists.inc
1
<?php
2

  
3
/**
4
 * @file
5
 * Plugin for controlling access based on the existence of a query string.
6
 */
7

  
8
$plugin = array(
9
  'title' => t('Query string exists'),
10
  'description' => t('Control access by whether or not a query string exists.'),
11
  'callback' => 'ctools_query_string_exists_ctools_access_check',
12
  'settings form' => 'ctools_query_string_exists_ctools_access_settings',
13
  'summary' => 'ctools_query_string_exists_ctools_access_summary',
14
  'defaults' => array('key' => ''),
15
);
16

  
17
/**
18
 * Settings form.
19
 */
20
function ctools_query_string_exists_ctools_access_settings($form, &$form_state, $config) {
21
  $form['settings']['key'] = array(
22
    '#title' => t('Query string key'),
23
    '#description' => t('Enter the key of the query string.'),
24
    '#type' => 'textfield',
25
    '#required' => TRUE,
26
    '#default_value' => $config['key']
27
  );
28

  
29
  return $form;
30
}
31

  
32
/**
33
 * Check for access.
34
 */
35
function ctools_query_string_exists_ctools_access_check($config, $context) {
36
  return isset($_GET[$config['key']]);
37
}
38

  
39
/**
40
 * Provide a summary description.
41
 */
42
function ctools_query_string_exists_ctools_access_summary($config, $context) {
43
  return t('@identifier exists', array('@identifier' => $config['key']));
44
}
drupal7/sites/all/modules/ctools/plugins/contexts/query_string.inc
1
<?php
2

  
3
/**
4
 * @file query_string.inc
5
 * Context plugin that can extract arbitrary values from the query string.
6
 */
7

  
8
/**
9
 * $plugin array which will be used by the system that includes this file.
10
 */
11
$plugin = array(
12
  'title' => t('Query string value'),
13
  'description' => t('A context that extracts a value from the query string.'),
14
  'context' => 'ctools_context_query_string_create_query_string',
15
  'context name' => 'query_string',
16
  'keyword' => 'query_string',
17
  'edit form' => 'ctools_context_query_string_settings_form',
18
  'convert list' => array(
19
    'raw' => t('Raw string'),
20
    'html_safe' => t('HTML-safe string'),
21
  ),
22
  'convert' => 'ctools_context_query_string_convert',
23
);
24

  
25
/**
26
 * Create a context from manual configuration.
27
 */
28
function ctools_context_query_string_create_query_string($empty, $data = NULL, $conf = FALSE) {
29
  $context = new ctools_context('query_string');
30
  $context->plugin = 'query_string';
31

  
32
  if ($empty) {
33
    return $context;
34
  }
35

  
36
  if ($conf) {
37
    if (!empty($_GET[$data['key']])) {
38
      $context->data = $_GET[$data['key']];
39
    }
40
    else {
41
      $context->data = $data['fallback_value'];
42
    }
43
  }
44
  return $context;
45
}
46

  
47
/**
48
 * Form builder; settings for the context.
49
 */
50
function ctools_context_query_string_settings_form($form, &$form_state) {
51
  $form['key'] = array(
52
    '#title' => t('Query string key'),
53
    '#description' => t('Enter the key of the value that must be returned from the query string.'),
54
    '#type' => 'textfield',
55
    '#required' => TRUE
56
  );
57
  if (isset($form_state['conf']['key'])) {
58
    $form['key']['#default_value'] = $form_state['conf']['key'];
59
  }
60
  $form['fallback_value'] = array(
61
    '#title' => t('Fallback value'),
62
    '#description' => t('Enter a value that must be returned if the above specified key does not exist in the query string.'),
63
    '#type' => 'textfield',
64
  );
65
  if (!empty($form_state['conf']['fallback_value'])) {
66
    $form['fallback_value']['#default_value'] = $form_state['conf']['fallback_value'];
67
  }
68
  return $form;
69
}
70

  
71
/**
72
 * Submit handler; settings form for the context.
73
 */
74
function ctools_context_query_string_settings_form_submit($form, &$form_state) {
75
  $form_state['conf']['key'] = $form_state['values']['key'];
76
  $form_state['conf']['fallback_value'] = $form_state['values']['fallback_value'];
77
}
78

  
79
/**
80
 * Convert a context into a string.
81
 */
82
function ctools_context_query_string_convert($context, $type) {
83
  switch ($type) {
84
    case 'raw':
85
      return $context->data;
86
    case 'html_safe':
87
      return check_plain($context->data);
88
  }
89
}
drupal7/sites/all/modules/ctools/plugins/relationships/entity_from_query_string.inc
1
<?php
2

  
3
/**
4
 * @file
5
 * Plugin to provide an relationship handler for entities from query string.
6
 */
7

  
8
/**
9
 * Plugins are described by creating a $plugin array which will be used
10
 * by the system that includes this file.
11
 */
12
$plugin = array(
13
  'title' => t('Entity from query string'),
14
  'keyword' => 'query_string_entity',
15
  'description' => t('Entity from query string.'),
16
  'required context' => new ctools_context_required(t('Query string'), 'query_string'),
17
  'context' => 'ctools_entity_from_query_string_context',
18
  'edit form' => 'ctools_entity_from_query_string_settings_form',
19
);
20

  
21
/**
22
 * Return a new context based on an existing context.
23
 */
24
function ctools_entity_from_query_string_context($context, $conf) {
25
  $entity_type = $conf['entity_type'];
26

  
27
  // If unset it wants a generic, unfilled context, which is just NULL.
28
  if (empty($context->data) || !isset($context->data) || !is_numeric($context->data)) {
29
    return ctools_context_create_empty('entity:' . $entity_type, NULL);
30
  }
31

  
32
  if (!empty($context->data) && is_numeric($context->data)) {
33
    // Load the entity from the query string value.
34
    $entity_id = $context->data;
35
    $entity = entity_load_single($entity_type, $entity_id);
36

  
37
    // Send it to ctools.
38
    return ctools_context_create('entity:' . $entity_type, $entity);
39
  }
40
}
41

  
42
/**
43
 * Settings form for the relationship.
44
 */
45
function ctools_entity_from_query_string_settings_form($form, &$form_state) {
46

  
47
  //Get all avalible enity types
48
  foreach (entity_get_info() as $key => $value) {
49
    $entity_types[$key] = $value['label'];
50
  }
51

  
52
  $form['entity_type'] = array(
53
    '#title' => t('Entity type'),
54
    '#description' => t('Choose entity type to load from query value'),
55
    '#type' => 'select',
56
    '#options' => $entity_types,
57
  );
58
  if (isset($form_state['conf']['entity_type'])) {
59
    $form['entity_type']['#default_value'] = $form_state['conf']['entity_type'];
60
  }
61

  
62
  return $form;
63
}
64

  
65
/**
66
 * Submit handler; settings form for the context.
67
 */
68
function ctools_entity_from_query_string_settings_form_submit($form, &$form_state) {
69
  $form_state['conf']['entity_type'] = $form_state['values']['entity_type'];
70
}
drupal7/sites/all/modules/ctools/plugins/relationships/user_category_edit_form_from_user.inc
15 15
  'description' => t('Adds user category edit form from a user context.'),
16 16
  'required context' => new ctools_context_required(t('User'), 'user'),
17 17
  'context' => 'ctools_user_category_edit_form_from_user_context',
18
  'edit form' => 'ctools_user_category_edit_form_from_user_settings_form',
19
  'defaults' => array('category' => NULL),
18 20
);
19 21

  
20 22
/**
......
25 27
    return ctools_context_create_empty('user_edit_form', NULL);
26 28
  }
27 29

  
30
  if(!empty($conf['category'])) {
31
    return ctools_context_create('user_edit_form', $context->data, array('category' => $conf['category']));
32
  }
33

  
28 34
  if (isset($context->data->user_category)) {
29 35
    return ctools_context_create('user_edit_form', $context->data, array('category' => $context->data->user_category));
30 36
  }
37

  
38
  return ctools_context_create('user_edit_form', $context->data);
39
}
40

  
41
/**
42
 * Settings form for the relationship.
43
 */
44
function ctools_user_category_edit_form_from_user_settings_form($form, &$form_state) {
45
  $conf = $form_state['conf'];
46

  
47
  $categories = _user_categories();
48
  $options = array();
49
  foreach($categories as $category) {
50
    $options[$category['name']] = $category['title'];
51
  }
52
  $form['category'] = array(
53
    '#type' => 'select',
54
    '#title' => t('Category'),
55
    '#options' => $options,
56
    '#default_value' => isset($conf['category']) ? $conf['category'] : NULL,
57
    '#empty_option' => 'Default',
58
  );
59

  
60
  return $form;
31 61
}
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 2016-08-17
10
version = "7.x-1.10"
9
; Information added by Drupal.org packaging script on 2016-10-16
10
version = "7.x-1.11"
11 11
core = "7.x"
12 12
project = "ctools"
13
datestamp = "1471454104"
13
datestamp = "1476581654"
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 2016-08-17
9
version = "7.x-1.10"
8
; Information added by Drupal.org packaging script on 2016-10-16
9
version = "7.x-1.11"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1471454104"
12
datestamp = "1476581654"
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 2016-08-17
12
version = "7.x-1.10"
11
; Information added by Drupal.org packaging script on 2016-10-16
12
version = "7.x-1.11"
13 13
core = "7.x"
14 14
project = "ctools"
15
datestamp = "1471454104"
15
datestamp = "1476581654"
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 2016-08-17
16
version = "7.x-1.10"
15
; Information added by Drupal.org packaging script on 2016-10-16
16
version = "7.x-1.11"
17 17
core = "7.x"
18 18
project = "ctools"
19
datestamp = "1471454104"
19
datestamp = "1476581654"
20 20

  
drupal7/sites/all/modules/ctools/views_content/plugins/content_types/views_panes.inc
143 143
    return;
144 144
  }
145 145

  
146
  $conf['pane_contexts'] = $contexts;
147
  $conf['panel_args'] = $panel_args;
146 148
  $view->display_handler->set_pane_conf($conf);
147 149

  
148
  $args = array();
149
  $arguments = $view->display_handler->get_option('arguments');
150

  
151
  $context_keys = isset($conf['context']) ? $conf['context'] : array();
152
  foreach ($view->display_handler->get_argument_input() as $id => $argument) {
153
    switch ($argument['type']) {
154
      case 'context':
155
        $key = array_shift($context_keys);
156
        if (isset($contexts[$key])) {
157
          if (strpos($argument['context'], '.')) {
158
            list($context, $converter) = explode('.', $argument['context'], 2);
159
            $args[] = ctools_context_convert_context($contexts[$key], $converter, array('sanitize' => FALSE));
160
          }
161
          else {
162
            $args[] = $contexts[$key]->argument;
163
          }
164
        }
165
        else {
166
          $args[] = isset($arguments[$id]['exception']['value']) ? $arguments[$id]['exception']['value'] : 'all';
167
        }
168
        break;
169

  
170
      case 'fixed':
171
        $args[] = $argument['fixed'];
172
        break;
173

  
174
      case 'panel':
175
        $args[] = isset($panel_args[$argument['panel']]) ? $panel_args[$argument['panel']] : NULL;
176
        break;
177

  
178
      case 'user':
179
        $args[] = (isset($conf['arguments'][$id])  && $conf['arguments'][$id] !== '') ? ctools_context_keyword_substitute($conf['arguments'][$id], array(), $contexts) : NULL;
180
        break;
181

  
182
     case 'wildcard':
183
        // Put in the wildcard.
184
       $args[] = isset($arguments[$id]['wildcard']) ? $arguments[$id]['wildcard'] : '*';
185
       break;
186

  
187
     case 'none':
188
     default:
189
       // Put in NULL.
190
       // views.module knows what to do with NULL (or missing) arguments
191
       $args[] = NULL;
192
       break;
193
    }
194
  }
195

  
196
  // remove any trailing NULL arguments as these are non-args:
197
  while (count($args) && end($args) === NULL) {
198
    array_pop($args);
199
  }
200

  
201
  $view->set_arguments($args);
202

  
203 150
  $allow = $view->display_handler->get_option('allow');
204

  
205
  if (!empty($conf['path'])) {
206
    $conf['path'] = ctools_context_keyword_substitute($conf['path'], array(), $contexts);
207
  }
208 151
  if ($allow['path_override'] && !empty($conf['path'])) {
209 152
    $view->override_path = $conf['path'];
210 153
  }
......
221 164
    $block->title_link = $view->get_url();
222 165
  }
223 166

  
224
  // more link
225
  if ($allow['more_link']) {
226
    if (empty($conf['more_link'])) {
227
      $view->display_handler->set_option('use_more', FALSE);
228
    }
229
    else {
230
      $view->display_handler->set_option('use_more', TRUE);
231
      // make sure the view runs the count query so we know whether or not the
232
      // more link applies.
233
      $view->get_total_rows = TRUE;
234
    }
235
  }
236

  
237
  if ($allow['items_per_page'] && isset($conf['items_per_page'])) {
238
    $view->set_items_per_page($conf['items_per_page']);
239
  }
240

  
241
  if ($allow['offset']) {
242
    $view->set_offset($conf['offset']);
243
  }
244

  
245
  if ($allow['use_pager']) {
246
    // Only set use_pager if they differ, this way we can avoid overwriting the
247
    // pager type that Views uses.
248
    $pager = $view->display_handler->get_option('pager');
249
    if ($conf['use_pager'] && ($pager['type'] == 'none' || $pager['type'] == 'some')) {
250
      $pager['type'] = 'full';
251
    }
252
    elseif (!$conf['use_pager'] && $pager['type'] != 'none' && $pager['type'] != 'some') {
253
      $pager['type'] = $view->get_items_per_page() || !empty($pager['options']['items_per_page']) ? 'some' : 'none';
254
    }
255

  
256
    if ($conf['use_pager']) {
257
      if (!isset($pager['options']['id']) || (isset($conf['pager_id']) && $pager['options']['id'] != $conf['pager_id'])) {
258
        $pager['options']['id'] = (int) $conf['pager_id'];
259
      }
260
    }
261

  
262
    $view->display_handler->set_option('pager', $pager);
263
  }
264

  
265
  if ($allow['fields_override']) {
266
    if ($conf['fields_override']) {
267
      $fields = $view->get_items('field');
268
      foreach ($fields as $field => $field_display) {
269
        $fields[$field]['exclude'] = empty($conf['fields_override'][$field]);
270
      }
271
      $view->display_handler->set_option('fields', $fields);
272

  
273
    }
274
  }
275

  
276
  if ($allow['exposed_form'] && !empty($conf['exposed'])) {
277
    foreach ($conf['exposed'] as $filter_name => $filter_value) {
278
      if (!is_array($filter_value)) {
279
        $conf['exposed'][$filter_name] = ctools_context_keyword_substitute($filter_value, array(), $contexts);
280
      }
281
    }
282
    $view->set_exposed_input($conf['exposed']);
283
  }
284

  
285 167
  $stored_feeds = drupal_add_feed();
286 168

  
287 169
  $block->content = $view->preview();
drupal7/sites/all/modules/ctools/views_content/plugins/views/views_content_plugin_display_panel_pane.inc
48 48
    return isset($this->has_pane_conf);
49 49
  }
50 50

  
51
  function set_pane_conf($conf = array()) {
51
  function set_pane_conf($conf = array(), $set_cache = TRUE) {
52 52
    $this->set_option('pane_conf', $conf);
53
    $this->view->dom_id = !empty($this->view->dom_id) ? $this->view->dom_id : md5($this->view->name . REQUEST_TIME . rand());
54
    if ($set_cache) {
55
      cache_set('view_panel_pane_' . $this->view->dom_id, $conf);
56
    }
53 57
    $this->has_pane_conf = TRUE;
54 58
  }
55 59

  
......
412 416
    return empty($conf['exposed_form']);
413 417
  }
414 418

  
419
  /**
420
   * Set the pane configuration options
421
   * Done here in handler for reuse between views_content_views_panes_content_type_render
422
   * and views_content_views_pre_view
423
   */
424
  function pane_process_conf() {
425
    ctools_include('context');
426
    $conf = $this->get_option('pane_conf');
427
    if (!$conf) {
428
      // See if dom id has been cached and get conf from there.
429
      if (!empty($this->view->dom_id) && ($cache = cache_get('view_panel_pane_' . $this->view->dom_id))) {
430
        $conf = $cache->data;
431
      }
432
      if (!$conf) {
433
        return;
434
      }
435
      $this->set_pane_conf($conf);
436
    }
437
    $contexts = $conf['pane_contexts'];
438
    $panel_args = $conf['panel_args'];
439
    $args = array();
440
    $arguments = $this->get_option('arguments');
441

  
442
    $context_keys = isset($conf['context']) ? $conf['context'] : array();
443
    foreach ($this->get_argument_input() as $id => $argument) {
444
      switch ($argument['type']) {
445
        case 'context':
446
          $key = array_shift($context_keys);
447
          if (isset($contexts[$key])) {
448
            if (strpos($argument['context'], '.')) {
449
              list($context, $converter) = explode('.', $argument['context'], 2);
450
              $args[] = ctools_context_convert_context($contexts[$key], $converter, array('sanitize' => FALSE));
451
            }
452
            else {
453
              $args[] = $contexts[$key]->argument;
454
            }
455
          }
456
          else {
457
            $args[] = isset($arguments[$id]['exception']['value']) ? $arguments[$id]['exception']['value'] : 'all';
458
          }
459
          break;
460

  
461
        case 'fixed':
462
          $args[] = $argument['fixed'];
463
          break;
464

  
465
        case 'panel':
466
          $args[] = isset($panel_args[$argument['panel']]) ? $panel_args[$argument['panel']] : NULL;
467
          break;
468

  
469
        case 'user':
470
          $args[] = (isset($conf['arguments'][$id])  && $conf['arguments'][$id] !== '') ? ctools_context_keyword_substitute($conf['arguments'][$id], array(), $contexts) : NULL;
471
          break;
472

  
473
       case 'wildcard':
474
          // Put in the wildcard.
475
         $args[] = isset($arguments[$id]['wildcard']) ? $arguments[$id]['wildcard'] : '*';
476
         break;
477

  
478
       case 'none':
479
       default:
480
         // Put in NULL.
481
         // views.module knows what to do with NULL (or missing) arguments
482
         $args[] = NULL;
483
         break;
484
      }
485
    }
486

  
487
    // remove any trailing NULL arguments as these are non-args:
488
    while (count($args) && end($args) === NULL) {
489
      array_pop($args);
490
    }
491

  
492
    $this->view->set_arguments($args);
493
    $allow = $this->get_option('allow');
494

  
495
    if (!empty($conf['path'])) {
496
      $conf['path'] = ctools_context_keyword_substitute($conf['path'], array(), $contexts);
497
    }
498
    if ($allow['path_override'] && !empty($conf['path'])) {
499
      $this->view->override_path = $conf['path'];
500
    }
501
    else if ($path = $this->get_option('inherit_panels_path')) {
502
      $this->view->override_path = $_GET['q'];
503
    }
504

  
505
    // more link
506
    if ($allow['more_link']) {
507
      if (empty($conf['more_link'])) {
508
        $this->set_option('use_more', FALSE);
509
      }
510
      else {
511
        $this->set_option('use_more', TRUE);
512
        // make sure the view runs the count query so we know whether or not the
513
        // more link applies.
514
        $this->view->get_total_rows = TRUE;
515
      }
516
    }
517

  
518
    if ($allow['items_per_page'] && isset($conf['items_per_page'])) {
519
      $this->view->set_items_per_page($conf['items_per_page']);
520
    }
521

  
522
    if ($allow['offset']) {
523
      $this->view->set_offset($conf['offset']);
524
    }
525

  
526
    if ($allow['use_pager']) {
527
      // Only set use_pager if they differ, this way we can avoid overwriting the
528
      // pager type that Views uses.
529
      $pager = $this->get_option('pager');
530
      if ($conf['use_pager'] && ($pager['type'] == 'none' || $pager['type'] == 'some')) {
531
        $pager['type'] = 'full';
532
      }
533
      elseif (!$conf['use_pager'] && $pager['type'] != 'none' && $pager['type'] != 'some') {
534
        $pager['type'] = $this->view->get_items_per_page() || !empty($pager['options']['items_per_page']) ? 'some' : 'none';
535
      }
536

  
537
      if ($conf['use_pager']) {
538
        if (!isset($pager['options']['id']) || (isset($conf['pager_id']) && $pager['options']['id'] != $conf['pager_id'])) {
539
          $pager['options']['id'] = (int) $conf['pager_id'];
540
        }
541
      }
542

  
543
      $this->set_option('pager', $pager);
544
    }
545

  
546
    if ($allow['fields_override']) {
547
      if ($conf['fields_override']) {
548
        $fields = $this->view->get_items('field');
549
        foreach ($fields as $field => $field_display) {
550
          $fields[$field]['exclude'] = empty($conf['fields_override'][$field]);
551
        }
552
        $this->set_option('fields', $fields);
553

  
554
      }
555
    }
556

  
557
    if ($allow['exposed_form'] && !empty($conf['exposed'])) {
558
      foreach ($conf['exposed'] as $filter_name => $filter_value) {
559
        if (!is_array($filter_value)) {
560
          $conf['exposed'][$filter_name] = ctools_context_keyword_substitute($filter_value, array(), $contexts);
561
        }
562
      }
563
      $this->view->set_exposed_input($conf['exposed']);
564
    }
565
  }
566

  
415 567
}
416 568

  
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 2016-08-17
14
version = "7.x-1.10"
13
; Information added by Drupal.org packaging script on 2016-10-16
14
version = "7.x-1.11"
15 15
core = "7.x"
16 16
project = "ctools"
17
datestamp = "1471454104"
17
datestamp = "1476581654"
18 18

  
drupal7/sites/all/modules/ctools/views_content/views_content.module
295 295
    );
296 296
  }
297 297
}
298

  
299
/**
300
 * Implements hook_module_implements_alter()
301
 */
302
function views_content_module_implements_alter(&$implementations, $hook) {
303
  if ($hook == 'views_pre_view') {
304
    $group = $implementations['views_content'];
305
    unset($implementations['views_content']);
306
    $implementations = array('views_content' => $group) + $implementations;
307
  }
308
}
309

  
310
/**
311
 * Implements hook_views_pre_view()
312
 */
313
function views_content_views_pre_view(&$view) {
314
  if (method_exists($view->display_handler, 'pane_process_conf')) {
315
    // process the pane configuration to prevent loss when using ajax
316
    $view->display_handler->pane_process_conf();
317
  }
318
}
drupal7/sites/all/modules/field_permissions/field_permissions.admin.css
1

  
2 1
/* Table cells. */
3 2
.field-permissions-cell,
4 3
.field-permissions-header {
......
29 28
  color: #444;
30 29
  background-color: #f0f0f0;
31 30
  border: 1px solid #aaa;
32

  
33 31
  /* CSS3 properties not supported by all browsers. */
34 32
  -webkit-box-shadow: 2px 2px 2px #ccc;
35
   -khtml-box-shadow: 2px 2px 2px #ccc;
36
    -icab-box-shadow: 2px 2px 2px #ccc;
37
     -moz-box-shadow: 2px 2px 2px #ccc;
38
       -o-box-shadow: 2px 2px 2px #ccc;
39
          box-shadow: 2px 2px 2px #ccc;
33
  -khtml-box-shadow: 2px 2px 2px #ccc;
34
  -icab-box-shadow: 2px 2px 2px #ccc;
35
  -moz-box-shadow: 2px 2px 2px #ccc;
36
  -o-box-shadow: 2px 2px 2px #ccc;
37
  box-shadow: 2px 2px 2px #ccc;
40 38
  -webkit-border-radius: 5px;
41
   -khtml-border-radius: 5px;
42
    -icab-border-radius: 5px;
43
     -moz-border-radius: 5px;
44
       -o-border-radius: 5px;
45
          border-radius: 5px;
39
  -khtml-border-radius: 5px;
40
  -icab-border-radius: 5px;
41
  -moz-border-radius: 5px;
42
  -o-border-radius: 5px;
43
  border-radius: 5px;
46 44
}
47 45
.field-permissions-tooltip .item-list,
48 46
#field-permissions-tooltip .item-list {
drupal7/sites/all/modules/field_permissions/field_permissions.admin.inc
8 8
/**
9 9
 * Obtain the list of field permissions.
10 10
 *
11
 * @param $field_label
11
 * @param string $field_label
12 12
 *   The human readable name of the field to use when constructing permission
13 13
 *   names. Usually this will be derived from one or more of the field instance
14 14
 *   labels.
15 15
 */
16 16
function field_permissions_list($field_label = '') {
17
  return array(
17
  $permissions = array(
18 18
    'create' => array(
19 19
      'label' => t('Create field'),
20 20
      'title' => t('Create own value for field %field', array('%field' => $field_label)),
......
36 36
      'title' => t("View anyone's value for field %field", array('%field' => $field_label)),
37 37
    ),
38 38
  );
39

  
40
  drupal_alter('field_permissions_list', $permissions, $field_label);
41

  
42
  return $permissions;
39 43
}
40 44

  
41 45
/**
42 46
 * Returns field permissions in a format suitable for use in hook_permission().
43 47
 *
44
 * @param $field
48
 * @param array $field
45 49
 *   The field to return permissions for.
46
 * @param $label
50
 * @param mixed $label
47 51
 *   (optional) The human readable name of the field to use when constructing
48 52
 *   permission names; for example, this might be the label of one of the
49 53
 *   corresponding field instances. If not provided, an appropriate label will
50 54
 *   be automatically derived from all the field's instances.
51 55
 *
52
 * @return
56
 * @return array
53 57
 *   An array of permission information, suitable for use in hook_permission().
54 58
 */
55 59
function field_permissions_list_field_permissions($field, $label = NULL) {
56
  $description = '';
57

  
58
  // If there is no preferred label, construct one from all the instance
59
  // labels.
60 60
  if (!isset($label)) {
61
    $labels = array();
62
    foreach ($field['bundles'] as $entity_type => $bundles) {
63
      foreach ($bundles as $bundle_name) {
64
        $instance = field_info_instance($entity_type, $field['field_name'], $bundle_name);
65
        $labels[] = $instance['label'];
61
    $label = $field['field_name'];
62
  }
63
  $instances = array();
64
  $description = '';
65
  foreach ($field['bundles'] as $entity_type => $bundles) {
66
    foreach ($bundles as $bundle_name) {
67
      $instance = field_info_instance($entity_type, $field['field_name'], $bundle_name);
68
      $entity = entity_get_info($entity_type);
69
      if (!isset($entity['bundles'][$bundle_name])) {
70
        continue;
66 71
      }
72
      $instance_desc_tokens = array(
73
        $entity['label'],
74
        $entity['bundles'][$bundle_name]['label'],
75
        $instance['label'],
76
      );
77
      $instances[] = '"' . implode(':', $instance_desc_tokens) . '"';
67 78
    }
68
    // If all the instances have the same label, just use that. Otherwise, use
69
    // the field name (with the full list of instance labels as the permission
70
    // description).
71
    $labels = array_unique($labels);
72
    if (count($labels) == 1) {
73
      $label = array_shift($labels);
74
    }
75
    else {
76
      $label = $field['field_name'];
77
      $description = t('This field appears as: %instances', array('%instances' => implode(', ', $labels)));
78
    }
79
    $description = t('This field appears as: %instances.', array('%instances' => implode(', ', $instances)));
79 80
  }
80 81

  
81 82
  $permissions = array();
......
91 92
}
92 93

  
93 94
/**
94
 * Implementation of hook_permission().
95
 * Implements hook_permission().
95 96
 */
96 97
function _field_permissions_permission() {
97 98
  $perms = array(
......
145 146
    '#type' => 'container',
146 147
    '#states' => array(
147 148
      'visible' => array(
148
        // We must cast this to a string until http://drupal.org/node/879580 is
149
        // fixed.
150
        ':input[name="field[field_permissions][type]"]' => array('value' => (string) FIELD_PERMISSIONS_CUSTOM),
149
        ':input[name="field[field_permissions][type]"]' => array('value' => FIELD_PERMISSIONS_CUSTOM),
151 150
      ),
152 151
    ),
153 152
    // Custom styling for the permissions matrix on the field settings page.
......
156 155
    ),
157 156
  );
158 157

  
158
  $form['field']['field_permissions']['permission_warning'] = array(
159
    '#type' => 'item',
160
    '#markup' => '<div class="messages error"><b>'
161
    . t('Field permissions error')
162
    . '</b><br />'
163
    . t('If you are seeing this message and are not seeing a table of permissions, something is wrong! See !link for more information.', array(
164
      '!link' => l(t('the Field Permission documentation'), 'https://www.drupal.org/node/2802067#known-issues', array(
165
        'attributes' => array('target' => '_blank'),
166
      )),
167
    )) . '</div>',
168
    '#states' => array(
169
      'visible' => array(
170
        ':input[name="field[field_permissions][type]"]' => array('value' => FIELD_PERMISSIONS_CUSTOM),
171
      ),
172
    ),
173
  );
174

  
159 175
  // Add the field permissions matrix itself. Wait until the #pre_render stage
160 176
  // to move it to the above container, to avoid having the permissions data
161 177
  // saved as part of the field record.
......
183 199
 * to actually be saved. For an example submit handler, see
184 200
 * _field_permissions_field_settings_form_submit().
185 201
 *
186
 * @param $field
202
 * @param array $field
187 203
 *   The field whose permissions will be displayed in the matrix.
188
 * @param $instance
204
 * @param array $instance
189 205
 *   The field instance for which the permissions will be displayed. Although
190 206
 *   the permissions are per-field rather than per-instance, the instance label
191 207
 *   will be used to display an appropriate human-readable name for each
192 208
 *   permission.
193 209
 *
194
 * @return
210
 * @return array
195 211
 *   A form array defining the permissions matrix.
196 212
 *
197 213
 * @see user_admin_permissions()
......
327 343
 * Menu callback; Field permissions overview.
328 344
 */
329 345
function field_permissions_overview() {
330
  drupal_add_css(drupal_get_path('module', 'field_permissions') .'/field_permissions.admin.css');
346
  drupal_add_css(drupal_get_path('module', 'field_permissions') . '/field_permissions.admin.css');
331 347

  
332
  $headers = array(t('Field name'), t('Field type'), t('Entity type'), t('Used in'));
348
  $headers = array(
349
    t('Field name'),
350
    t('Field type'),
351
    t('Entity type'),
352
    t('Used in'),
353
  );
333 354
  foreach (field_permissions_list() as $permission_type => $permission_info) {
334 355
    $headers[] = array('data' => $permission_info['label'], 'class' => 'field-permissions-header');
335 356
  }
336 357
  $destination = drupal_get_destination();
337 358

  
338
  // Load list of field instances, types and bundles in the system.
339
  $instances = field_info_instances();
359
  // Load list of fields, field types and bundles in the system.
340 360
  $field_types = field_info_field_types();
341
  $bundles = field_info_bundles();
361
  $bundles_info = field_info_bundles();
342 362

  
343 363
  // Retrieve the permissions for each role.
344 364
  $role_permissions = user_role_permissions(user_roles());
345 365

  
346 366
  // Based on field_ui_fields_list() in field_ui.admin.inc.
347 367
  $rows = array();
348
  foreach ($instances as $obj_type => $type_bundles) {
349
    foreach ($type_bundles as $bundle => $bundle_instances) {
350
      foreach ($bundle_instances as $field_name => $instance) {
368
  foreach (field_info_fields() as $field_name => $field) {
369
    foreach ($field['bundles'] as $entity_type => $bundles) {
370
      foreach ($bundles as $bundle) {
371
        // Some fields might belong to bundles that are disabled (which are not
372
        // returned by field_info_bundles()).
373
        // @see https://www.drupal.org/node/1351506
374
        if (!isset($bundles_info[$entity_type][$bundle])) {
375
          continue;
376
        }
351 377
        // Each field will have a row in the table.
352
        $field = field_info_field($field_name);
353
        $admin_path = _field_ui_bundle_admin_path($obj_type, $bundle);
378
        if (module_exists('field_ui')) {
379
          $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle);
380
          $field_admin_path = l($bundles_info[$entity_type][$bundle]['label'], $admin_path . '/fields/' . $field_name, array(
381
            'query' => $destination,
382
            'fragment' => 'edit-field-field-permissions-type',
383
          ));
384
        }
385
        else {
386
          $field_admin_path = $bundles_info[$entity_type][$bundle]['label'];
387
        }
354 388
        $rows[$field_name]['data'][0] = $field['locked'] ? t('@field_name (Locked)', array('@field_name' => $field_name)) : $field_name;
355
        $rows[$field_name]['data'][1] = t($field_types[$field['type']]['label']);
356
        $rows[$field_name]['data'][2] = $obj_type;
357
        $rows[$field_name]['data'][3][] = l($bundles[$obj_type][$bundle]['label'], $admin_path . '/fields/'. $field_name, array(
358
          'query' => $destination,
359
          'fragment' => 'edit-field-field-permissions-type',
360
        ));
389
        $rows[$field_name]['data'][1] = $field_types[$field['type']]['label'];
390
        $rows[$field_name]['data'][2] = $entity_type;
391
        $rows[$field_name]['data'][3][] = $field_admin_path;
361 392
        $rows[$field_name]['class'] = $field['locked'] ? array('menu-disabled') : array('');
362 393

  
363 394
        // Append field permissions information to the report.
......
381 412
            $all_users_have_access = isset($role_permissions[DRUPAL_ANONYMOUS_RID][$permission]) && isset($role_permissions[DRUPAL_AUTHENTICATED_RID][$permission]);
382 413
            $status_class = $all_users_have_access ? 'field-permissions-status-on' : 'field-permissions-status-off';
383 414
            $title = $all_users_have_access ? t('All users have this permission') : t('Not all users have this permission');
384
            $data = l('', 'admin/people/permissions', array(
415
            $data = l(NULL, 'admin/people/permissions', array(
385 416
              'attributes' => array(
386 417
                'class' => array('field-permissions-status', $status_class),
387 418
                'title' => $title,
......
416 447

  
417 448
    // Allow external modules alter the table headers and rows.
418 449
    foreach (module_implements('field_permissions_overview_alter') as $module) {
419
      $function = $module .'_field_permissions_overview_alter';
450
      $function = $module . '_field_permissions_overview_alter';
420 451
      $function($headers, $rows);
421 452
    }
422 453

  
drupal7/sites/all/modules/field_permissions/field_permissions.admin.js
1
/**
2
 * @file
3
 */
4

  
1 5
(function ($) {
2 6

  
3
Drupal.behaviors.fieldPermissionsSettings = {
4
  attach: function (context) {
5
    // For user fields, we want the "Create own value for field X" permission
6
    // row to only be displayed when it's meaningful (i.e., when the "Display
7
    // on user registration form" checkbox is checked).
8
    var $user_register_form_checkbox, $required_field_checkbox, $create_permission_row;
9
    $user_register_form_checkbox = $('.form-item-instance-settings-user-register-form .form-checkbox', context);
10
    if ($user_register_form_checkbox.length) {
11
      // The "Required field" checkbox can cause the user registration checkbox
12
      // to change, so we need it also.
13
      $required_field_checkbox = $('.form-item-instance-required .form-checkbox', context);
14
      if ($required_field_checkbox.length) {
15
        // Get the permissions table row corresponding to the "Create own value
16
        // for field X" permission. The theme_user_admin_permissions() function
17
        // does not give us a good way to directly detect which row contains
18
        // the create permissions, so we have rely on the fact that it will be
19
        // the first row.
20
        $create_permission_row = $('table#permissions tbody tr', context).filter(':first');
21
        new Drupal.fieldPermissions.HideCreatePermission($user_register_form_checkbox, $required_field_checkbox, $create_permission_row);
7
  Drupal.behaviors.fieldPermissionsSettings = {
8
    attach: function (context) {
9
      // For user fields, we want the "Create own value for field X" permission
10
      // row to only be displayed when it's meaningful (i.e., when the "Display
11
      // on user registration form" checkbox is checked).
12
      var $user_register_form_checkbox, $required_field_checkbox, $create_permission_row;
13
      $user_register_form_checkbox = $('.form-item-instance-settings-user-register-form .form-checkbox', context);
14
      if ($user_register_form_checkbox.length) {
15
        // The "Required field" checkbox can cause the user registration checkbox
16
        // to change, so we need it also.
17
        $required_field_checkbox = $('.form-item-instance-required .form-checkbox', context);
18
        if ($required_field_checkbox.length) {
19
          // Get the permissions table row corresponding to the "Create own value
20
          // for field X" permission. The theme_user_admin_permissions() function
21
          // does not give us a good way to directly detect which row contains
22
          // the create permissions, so we have rely on the fact that it will be
23
          // the first row.
24
          $create_permission_row = $('table#permissions tbody tr', context).filter(':first');
25
          new Drupal.fieldPermissions.HideCreatePermission($user_register_form_checkbox, $required_field_checkbox, $create_permission_row);
26
        }
22 27
      }
28

  
29
      // Show a warning if there's no available permissions matrix.
30
      $('#edit-field-field-permissions-permission-warning').toggle(!$('#permissions').length);
31

  
32
      $('[name="field[field_permissions][type]"]').bind('change', function(option) {
33
        $('#edit-field-field-permissions-permission-warning').toggle(!$('#permissions').length);
34
      });
23 35
    }
24
  }
25
};
36
  };
26 37

  
27
Drupal.fieldPermissions = {};
38
  Drupal.fieldPermissions = {};
28 39

  
29
/**
40
  /**
30 41
 * Constructor for the HideCreatePermission object.
31 42
 *
32 43
 * This object hides and shows the "Create own value for field X" permission
33 44
 * for user fields when it is appropriate to do so, depending on the state of
34 45
 * the "Display on user registration form" and "Required field" checkboxes.
35 46
 */
36
Drupal.fieldPermissions.HideCreatePermission = function ($user_register_form_checkbox, $required_field_checkbox, $create_permission_row) {
37
  this.$user_register_form_checkbox = $user_register_form_checkbox;
38
  this.$create_permission_row = $create_permission_row;
39
  // Start off by making sure the create permission row has the correct
40
  // visibility.
41
  this.setCreatePermissionVisibility();
42
  // Set the row's visibility again whenever the user registration checkbox
43
  // changes, or when the required field checkbox (which controls it) changes.
44
  $user_register_form_checkbox.bind('change', $.proxy(this.setCreatePermissionVisibility, this));
45
  $required_field_checkbox.bind('change', $.proxy(this.setCreatePermissionVisibility, this));
46
};
47
  Drupal.fieldPermissions.HideCreatePermission = function ($user_register_form_checkbox, $required_field_checkbox, $create_permission_row) {
48
    this.$user_register_form_checkbox = $user_register_form_checkbox;
49
    this.$create_permission_row = $create_permission_row;
50
    // Start off by making sure the create permission row has the correct
51
    // visibility.
52
    this.setCreatePermissionVisibility();
53
    // Set the row's visibility again whenever the user registration checkbox
54
    // changes, or when the required field checkbox (which controls it) changes.
55
    $user_register_form_checkbox.bind('change', $.proxy(this.setCreatePermissionVisibility, this));
56
    $required_field_checkbox.bind('change', $.proxy(this.setCreatePermissionVisibility, this));
57
  };
47 58

  
48
/**
49
 * Set the correct visibility of the "Create own value for field X" permission.
50
 */
51
Drupal.fieldPermissions.HideCreatePermission.prototype.setCreatePermissionVisibility = function () {
52
  // Granting permissions for "Create own value for field X" only makes sense
53
  // when the field is configured to appear on the user registration form, so
54
  // only show the row in the permissions table then.
55
  if (this.$user_register_form_checkbox.is(':checked')) {
56
    this.$create_permission_row.show();
57
  }
58
  else {
59
    this.$create_permission_row.hide();
60
  }
61
};
59
  /**
60
   * Set the correct visibility of the "Create own value for field X" permission.
61
   */
62
  Drupal.fieldPermissions.HideCreatePermission.prototype.setCreatePermissionVisibility = function () {
63
    // Granting permissions for "Create own value for field X" only makes sense
64
    // when the field is configured to appear on the user registration form, so
65
    // only show the row in the permissions table then.
66
    if (this.$user_register_form_checkbox.is(':checked')) {
67
      this.$create_permission_row.show();
68
    }
69
    else {
70
      this.$create_permission_row.hide();
71
    }
72
  };
62 73

  
63 74
})(jQuery);
drupal7/sites/all/modules/field_permissions/field_permissions.api.php
1
<?php
2

  
3
/**
4
 * @file
5
 * Hooks provided by the Field Permission module.
6
 */
7

  
8
/**
9
 * Defines the owner of an entity.
10
 *
11
 * Because not all entities have uids, this hook allows other modules to specify
12
 * one.
13
 *
14
 * @param int $uid
15
 *   The userid that will be checked against the current user's account->uid.
16
 * @param object $entity
17
 *   The entity this field belongs to.
18
 */
19
// @codingStandardsIgnoreStart
20
function hook_field_permissions_userid_ENTITY_TYPE_alter(&$uid, $entity) {
21
  // This example always assigns user 15 as the owner of an entity.
22
  $uid = 15;
23
}
24
// @codingStandardsIgnoreEnd
25

  
26
/**
27
 * Alter the permissions handled by field_permissions module.
28
 *
29
 * @param array $permissions
30
 *   The $permissions array created by the Field permissions module.
31
 * @param string $field_label
32
 *   The field name.
33
 */
34
function hook_field_permissions_list_alter(&$permissions, $field_label) {
35
  $permissions += array(
36
    'view own node preview' => array(
37
      'label' => t('View own field on node preview'),
38
      'title' => t('View own value for field %field on node preview', array('%field' => $field_label)),
39
    ),
40
    'view node preview' => array(
41
      'label' => t('View field on node preview'),
42
      'title' => t("View anyone's value for field %field on node preview", array('%field' => $field_label)),
43
    ),
44
  );
45
}
46

  
47
/**
48
 * Hook invoked with custom field permissions.
49
 *
50
 * This hook can be used to revoke access to the field. If access is not
51
 * revoked, default access of the Field permissions module will apply.
52
 *
53
 * @param string $op
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff