Projet

Général

Profil

Révision 5a7e6170

Ajouté par Florent Torregrosa il y a environ 10 ans

Update :

  • panels : 7.x-3.3 -> 7.x-3.4
  • pdf_reader : 7.x-1.0-rc4 -> 7.x-1.0-rc5

Voir les différences:

drupal7/sites/all/modules/panels/plugins/display_renderers/panels_renderer_editor.class.php
153 153

  
154 154
    $output = '<div class="' . $class . '" id="panel-pane-' . $pane->pid . '">';
155 155

  
156
    if (!$block->title) {
156
    if (empty($block->title)) {
157 157
      $block->title = t('No title');
158 158
    }
159 159

  
......
186 186

  
187 187
    $style_title = isset($style['title']) ? $style['title'] : t('Default');
188 188

  
189
    $style_links[] = array(
189
    $style_links['title'] = array(
190 190
      'title' => $style_title,
191 191
      'attributes' => array('class' => array('panels-text')),
192 192
    );
193 193

  
194
    $style_links[] = array(
194
    $style_links['change'] = array(
195 195
      'title' => t('Change'),
196 196
      'href' => $this->get_url('style-type', $type, $id),
197 197
      'attributes' => array('class' => array('ctools-use-modal')),
......
199 199

  
200 200
    $function = $type != 'pane' ? 'settings form' : 'pane settings form';
201 201
    if (panels_plugin_get_function('styles', $style, $function)) {
202
      $style_links[] = array(
202
      $style_links['settings'] = array(
203 203
        'title' => t('Settings'),
204 204
        'href' => $this->get_url('style-settings', $type, $id),
205 205
        'attributes' => array('class' => array('ctools-use-modal')),
......
307 307
    $links = array();
308 308

  
309 309
    if (!empty($pane->shown)) {
310
      $links[] = array(
310
      $links['top']['disabled'] = array(
311 311
        'title' => t('Disable this pane'),
312 312
        'href' => $this->get_url('hide', $pane->pid),
313 313
        'attributes' => array('class' => array('use-ajax')),
314 314
      );
315 315
    }
316 316
    else {
317
      $links[] = array(
317
      $links['top']['enable'] = array(
318 318
        'title' => t('Enable this pane'),
319 319
        'href' => $this->get_url('show', $pane->pid),
320 320
        'attributes' => array('class' => array('use-ajax')),
......
322 322
    }
323 323

  
324 324
    if (isset($this->display->title_pane) && $this->display->title_pane == $pane->pid) {
325
      $links['panels-set-title'] = array(
325
      $links['top']['panels-set-title'] = array(
326 326
        'title' => t('&#x2713;Panel title'),
327 327
        'html' => TRUE,
328 328
      );
329 329
    }
330 330
    else {
331
      $links['panels-set-title'] = array(
331
      $links['top']['panels-set-title'] = array(
332 332
        'title' => t('Panel title'),
333 333
        'href' => $this->get_url('panel-title', $pane->pid),
334 334
        'attributes' => array('class' => array('use-ajax')),
......
338 338
    $subtype = ctools_content_get_subtype($content_type, $pane->subtype);
339 339

  
340 340
    if (ctools_content_editable($content_type, $subtype, $pane->configuration)) {
341
      $links[] = array(
341
      $links['top']['settings'] = array(
342 342
        'title' => isset($content_type['edit text']) ? $content_type['edit text'] : t('Settings'),
343 343
        'href' => $this->get_url('edit-pane', $pane->pid),
344 344
        'attributes' => array('class' => array('ctools-use-modal')),
......
346 346
    }
347 347

  
348 348
    if (user_access('administer advanced pane settings')) {
349
      $links[] = array(
349
      $links['top']['css'] = array(
350 350
        'title' => t('CSS properties'),
351 351
        'href' => $this->get_url('pane-css', $pane->pid),
352 352
        'attributes' => array('class' => array('ctools-use-modal')),
......
354 354
    }
355 355

  
356 356
    if (user_access('administer panels styles')) {
357
      $links[] = array(
358
        'title' => '<hr />',
359
        'html' => TRUE,
360
      );
361

  
362
      $style_links = $this->get_style_links('pane', $pane->pid);
363

  
364
      $links[] = array(
365
        'title' => '<span class="dropdown-header">' . t('Style') . '</span>' . theme_links(array('links' => $style_links, 'attributes' => array(), 'heading' => array())),
366
        'html' => TRUE,
367
        'attributes' => array('class' => array('panels-sub-menu')),
368
      );
357
      $links['style'] = $this->get_style_links('pane', $pane->pid);
369 358
    }
370 359

  
371 360
    if (user_access('administer pane access')) {
372
      $links[] = array(
373
        'title' => '<hr />',
374
        'html' => TRUE,
375
      );
376

  
377 361
      $contexts = $this->display->context;
378 362
      // Make sure we have the logged in user context
379 363
      if (!isset($contexts['logged-in-user'])) {
......
385 369
      if (!empty($pane->access['plugins'])) {
386 370
        foreach ($pane->access['plugins'] as $id => $test) {
387 371
          $plugin = ctools_get_access_plugin($test['name']);
388
          $access_title  = isset($plugin['title']) ? $plugin['title'] : t('Broken/missing access plugin %plugin', array('%plugin' => $test['name']));
372
          $access_title = isset($plugin['title']) ? $plugin['title'] : t('Broken/missing access plugin %plugin', array('%plugin' => $test['name']));
389 373
          $access_description = ctools_access_summary($plugin, $contexts, $test);
390 374

  
391 375
          $visibility_links[] = array(
......
396 380
        }
397 381
      }
398 382
      if (empty($visibility_links)) {
399
        $visibility_links[] = array(
383
        $visibility_links['no_rules'] = array(
400 384
          'title' => t('No rules'),
401 385
          'attributes' => array('class' => array('panels-text')),
402 386
        );
403 387
      }
404 388

  
405
      $visibility_links[] = array(
389
      $visibility_links['add_rule'] = array(
406 390
        'title' => t('Add new rule'),
407 391
        'href' => $this->get_url('access-add-test', $pane->pid),
408 392
        'attributes' => array('class' => array('ctools-use-modal')),
409 393
      );
410 394

  
411
      $visibility_links[] = array(
395
      $visibility_links['settings'] = array(
412 396
        'title' => t('Settings'),
413 397
        'href' => $this->get_url('access-settings', $pane->pid),
414 398
        'attributes' => array('class' => array('ctools-use-modal')),
415 399
      );
416 400

  
417
      $links[] = array(
418
        'title' => '<span class="dropdown-header">' . t('Visibility rules') . '</span>' . theme_links(array('links' => $visibility_links, 'attributes' => array(), 'heading' => array())),
419
        'html' => TRUE,
420
        'attributes' => array('class' => array('panels-sub-menu')),
421
      );
401
      $links['visibility'] = $visibility_links;
422 402
    }
423 403

  
424 404
    if (user_access('use panels locks')) {
425
      $links[] = array(
426
        'title' => '<hr />',
427
        'html' => TRUE,
428
      );
429

  
430 405
      $lock_type = !empty($pane->locks['type']) ? $pane->locks['type'] : 'none';
431 406
      switch ($lock_type) {
432 407
        case 'immovable':
......
441 416
          break;
442 417
      }
443 418

  
444
      $lock_links[] = array(
419
      $lock_links['lock'] = array(
445 420
        'title' => $lock_method,
446 421
        'attributes' => array('class' => array('panels-text')),
447 422
      );
448
      $lock_links[] = array(
423
      $lock_links['change'] = array(
449 424
        'title' => t('Change'),
450 425
        'href' => $this->get_url('lock', $pane->pid),
451 426
        'attributes' => array('class' => array('ctools-use-modal')),
452 427
      );
453 428

  
454
      $links[] = array(
455
        'title' => '<span class="dropdown-header">' . t('Locking') . '</span>' . theme_links(array('links' => $lock_links, 'attributes' => array(), 'heading' => array())),
456
        'html' => TRUE,
457
        'attributes' => array('class' => array('panels-sub-menu')),
458
      );
429
      $links['lock'] = $lock_links;
459 430
    }
460 431

  
461 432
    if (panels_get_caches() && user_access('use panels caching features')) {
462
      $links[] = array(
463
        'title' => '<hr />',
464
        'html' => TRUE,
465
      );
466

  
467 433
      $method = isset($pane->cache['method']) ? $pane->cache['method'] : 0;
468 434
      $info = panels_get_cache($method);
469 435
      $cache_method = isset($info['title']) ? $info['title'] : t('No caching');
470
      $cache_links[] = array(
436
      $cache_links['title'] = array(
471 437
        'title' => $cache_method,
472 438
        'attributes' => array('class' => array('panels-text')),
473 439
      );
474
      $cache_links[] = array(
440
      $cache_links['change'] = array(
475 441
        'title' => t('Change'),
476 442
        'href' => $this->get_url('cache-method', $pane->pid),
477 443
        'attributes' => array('class' => array('ctools-use-modal')),
478 444
      );
479 445
      if (panels_plugin_get_function('cache', $info, 'settings form')) {
480
        $cache_links[] = array(
446
        $cache_links['settings'] = array(
481 447
          'title' => t('Settings'),
482 448
          'href' => $this->get_url('cache-settings', $pane->pid),
483 449
          'attributes' => array('class' => array('ctools-use-modal')),
484 450
        );
485 451
      }
486 452

  
487
      $links[] = array(
488
        'title' => '<span class="dropdown-header">' . t('Caching') . '</span>' . theme_links(array('links' => $cache_links, 'attributes' => array(), 'heading' => array())),
489
        'html' => TRUE,
490
        'attributes' => array('class' => array('panels-sub-menu')),
491
      );
453
      $links['cache'] = $cache_links;
492 454
    }
493 455

  
494
    $links[] = array(
495
      'title' => '<hr />',
496
      'html' => TRUE,
497
    );
498

  
499
    $links[] = array(
456
    $links['bottom']['remove'] = array(
500 457
      'title' => t('Remove'),
501 458
      'href' => '#',
502 459
      'attributes' => array(
......
505 462
      ),
506 463
    );
507 464

  
508
    return theme('ctools_dropdown', array('title' => theme('image', array('path' => ctools_image_path('icon-configure.png', 'panels'))), 'links' => $links, 'image' => TRUE));
465
    // Allow others to add/remove links from pane context menu.
466
    // Grouped by 'top', 'style', 'visibility', 'lock', 'cache' and 'bottom'
467
    drupal_alter('get_pane_links', $links, $pane, $content_type);
468

  
469
    $dropdown_links = $links['top'];
470
    foreach (array(
471
  'style' => 'Style',
472
  'visibility' => 'Visibility rules',
473
  'lock' => 'Locking',
474
  'cache' => 'Caching'
475
    ) as $category => $label) {
476
      $dropdown_links[] = array(
477
        'title' => '<hr />',
478
        'html' => TRUE,
479
      );
480
      $dropdown_links[] = array(
481
        'title' => '<span class="dropdown-header">' . t($label) . '</span>' . theme_links(array('links' => $links[$category], 'attributes' => array(), 'heading' => array())),
482
        'html' => TRUE,
483
        'attributes' => array('class' => array('panels-sub-menu')),
484
      );
485
    }
486

  
487
    $dropdown_links[] = array(
488
      'title' => '<hr />',
489
      'html' => TRUE,
490
    );
491
    $dropdown_links = array_merge($dropdown_links, $links['bottom']);
492

  
493
    return theme('ctools_dropdown', array('title' => theme('image', array('path' => ctools_image_path('icon-configure.png', 'panels'))), 'links' => $dropdown_links, 'image' => TRUE));
509 494
  }
510 495

  
511 496
  // -----------------------------------------------------------------------
......
581 566
   * @todo -- this should be in CTools.
582 567
   */
583 568
  function get_category($content_type) {
584
    if (isset($content_type['top level'])) {
569
    if (!empty($content_type['top level'])) {
585 570
      $category = 'root';
586 571
    }
587 572
    else if (isset($content_type['category'])) {
......
656 641
    $content_type = ctools_get_content_type($type_name);
657 642
    $subtype = ctools_content_get_subtype($content_type, $subtype_name);
658 643

  
659
    if (!isset($step) || !isset($this->cache->new_pane)) {
644
    // Determine if we are adding a different pane than previously cached. This
645
    // is used to load the different pane into cache so that multistep forms
646
    // have the correct context instead of a previously cached version that
647
    // does not match the pane currently being added.
648
    $is_different_pane = FALSE;
649
    if (isset($this->cache) && isset($this->cache->new_pane)) {
650
      $diff_type = $type_name != $this->cache->new_pane->type;
651
      $diff_subtype = $subtype_name != $this->cache->new_pane->subtype;
652

  
653
      $is_different_pane = $diff_type || $diff_subtype;
654
    }
655

  
656
    if (!isset($step) || !isset($this->cache->new_pane) || $is_different_pane) {
660 657
      $pane = panels_new_pane($type_name, $subtype_name, TRUE);
661 658
      $this->cache->new_pane = &$pane;
662 659
    }
......
757 754
      // References get blown away with AJAX caching. This will fix that.
758 755
      $this->cache->display->content[$pid] = $form_state['pane'];
759 756

  
757
      // Conditionally overwrite the context for this panel if present in the form state.
758
      if (!empty($form_state['display_cache']->display->context)) {
759
        $this->cache->display->context = $form_state['display_cache']->display->context;
760
      }
761

  
760 762
      panels_edit_cache_set($this->cache);
761 763
      $this->command_update_pane($pid);
762 764
      $this->commands[] = ctools_modal_command_dismiss();
......
1158 1160
      unset($this->cache->style);
1159 1161
    }
1160 1162

  
1161
    // $conf was a reference so it should just modify.
1163
    // Copy settings from form state back into the cache.
1164
    if(!empty($form_state['values']['settings'])) {
1165
      $this->cache->display->content[$pid]->style['settings'] = $form_state['values']['settings'];
1166
    }
1167

  
1162 1168
    panels_edit_cache_set($this->cache);
1163 1169

  
1164 1170
    $this->commands[] = ctools_modal_command_dismiss();
......
1501 1507
 * Choose cache method form
1502 1508
 */
1503 1509
function panels_edit_cache_method_form($form, &$form_state) {
1510
  ctools_form_include($form_state, 'plugins', 'panels');
1511
  form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
1504 1512
  $display = &$form_state['display'];
1505 1513
  $conf = &$form_state['conf'];
1506 1514

  
......
1549 1557
 * Cache settings form
1550 1558
 */
1551 1559
function panels_edit_cache_settings_form($form, &$form_state) {
1560
  ctools_form_include($form_state, 'plugins', 'panels');
1561
  form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
1552 1562
  $display = &$form_state['display'];
1553 1563
  $conf = &$form_state['conf'];
1554 1564
  $pid = $form_state['pid'];
......
1609 1619
 * Choose style form
1610 1620
 */
1611 1621
function panels_edit_style_type_form($form, &$form_state) {
1622
  ctools_form_include($form_state, 'plugins', 'panels');
1623
  form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
1612 1624
  $display = &$form_state['display'];
1613 1625
  $style = $form_state['style'];
1614 1626
  $type = $form_state['type'];
......
1659 1671
 * Style settings form
1660 1672
 */
1661 1673
function panels_edit_style_settings_form($form, &$form_state) {
1674
  ctools_form_include($form_state, 'plugins', 'panels');
1675
  form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
1662 1676
  $display = &$form_state['display'];
1663 1677
  $conf = &$form_state['conf'];
1664 1678
  $pid = $form_state['pid'];
......
1713 1727
 * Configure CSS on a pane form.
1714 1728
 */
1715 1729
function panels_edit_configure_pane_css_form($form, &$form_state) {
1730
  ctools_form_include($form_state, 'plugins', 'panels');
1731
  form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
1716 1732
  $display = &$form_state['display'];
1717 1733
  $pane = &$form_state['pane'];
1718 1734

  
......
1755 1771
 * Configure lock on a pane form.
1756 1772
 */
1757 1773
function panels_edit_configure_pane_lock_form($form, &$form_state) {
1774
  ctools_form_include($form_state, 'plugins', 'panels');
1775
  form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
1758 1776
  $display = &$form_state['display'];
1759 1777
  $pane = &$form_state['pane'];
1760 1778

  
......
1830 1848
 * Form to control basic visibility settings.
1831 1849
 */
1832 1850
function panels_edit_configure_access_settings_form($form, &$form_state) {
1851
  ctools_form_include($form_state, 'plugins', 'panels');
1852
  form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
1833 1853
  $display = &$form_state['display'];
1834 1854
  $pane = &$form_state['pane'];
1835 1855

  
......
1867 1887
 * Form to add a visibility rule.
1868 1888
 */
1869 1889
function panels_edit_add_access_test_form($form, &$form_state) {
1890
  ctools_form_include($form_state, 'plugins', 'panels');
1891
  form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
1870 1892
  $display = &$form_state['display'];
1871 1893
  $pane = &$form_state['pane'];
1872 1894

  
......
1896 1918
 * Form to configure a visibility rule.
1897 1919
 */
1898 1920
function panels_edit_configure_access_test_form($form, &$form_state) {
1921
  ctools_form_include($form_state, 'plugins', 'panels');
1922
  form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
1899 1923
  $display = &$form_state['display'];
1900 1924
  $test = &$form_state['test'];
1901 1925
  $plugin = &$form_state['plugin'];

Formats disponibles : Unified diff