Révision 136a805a
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/panels/panels.module | ||
---|---|---|
20 | 20 |
* ; Requires Panels v7.x-3.4 or newer. |
21 | 21 |
* dependencies[] = panels (>=3.4) |
22 | 22 |
*/ |
23 |
define('PANELS_VERSION', '7.x-3.5');
|
|
23 |
define('PANELS_VERSION', '7.x-3.6');
|
|
24 | 24 |
|
25 | 25 |
|
26 | 26 |
define('PANELS_TITLE_FIXED', 0); // Hide title use to be true/false. So false remains old behavior. |
... | ... | |
302 | 302 |
'title' => t("Change layouts with the Panels In-Place Editor"), |
303 | 303 |
'description' => t("Allows a user to change layouts with the IPE."), |
304 | 304 |
), |
305 |
'bypass access in place editing' => array( |
|
306 |
'title' => t("Bypass access checks when using Panels In-Place Editor"), |
|
307 |
'description' => t("Allows using IPE even if user does not have additional permissions granted by other modules."), |
|
308 |
'restrict access' => TRUE, |
|
309 |
), |
|
305 | 310 |
'administer advanced pane settings' => array( |
306 | 311 |
'title' => t("Configure advanced settings on Panel panes"), |
307 | 312 |
'description' => t(""), |
... | ... | |
404 | 409 |
'display_renderers' => array( |
405 | 410 |
'classes' => array('renderer'), |
406 | 411 |
), |
412 |
'panels_storage' => array(), |
|
407 | 413 |
); |
408 | 414 |
} |
409 | 415 |
|
... | ... | |
770 | 776 |
} |
771 | 777 |
return $output; |
772 | 778 |
} |
779 |
|
|
780 |
/** |
|
781 |
* Determine if the given user can perform the requested operation. |
|
782 |
* |
|
783 |
* @param string $op |
|
784 |
* An operation like: create, read, update, or delete. |
|
785 |
* @param object $account |
|
786 |
* (optional) The account to check access for. |
|
787 |
* |
|
788 |
* @return bool |
|
789 |
* TRUE if access is granted; otherwise FALSE. |
|
790 |
*/ |
|
791 |
function access($op, $account = NULL) { |
|
792 |
global $user; |
|
793 |
|
|
794 |
if (!$account) { |
|
795 |
$account = $user; |
|
796 |
} |
|
797 |
|
|
798 |
// Even administrators need to go through the access system. However, to |
|
799 |
// support legacy plugins, user 1 gets full access no matter what. |
|
800 |
if ($account->uid == 1) { |
|
801 |
return TRUE; |
|
802 |
} |
|
803 |
|
|
804 |
if (!in_array($op, array('create', 'read', 'update', 'delete', 'change layout'))) { |
|
805 |
return FALSE; |
|
806 |
} |
|
807 |
|
|
808 |
if (empty($this->storage_type) || empty($this->storage_id)) { |
|
809 |
return FALSE; |
|
810 |
} |
|
811 |
|
|
812 |
if ($this->storage_type == 'unknown') { |
|
813 |
return FALSE; |
|
814 |
} |
|
815 |
|
|
816 |
$storage_plugin = panels_get_panels_storage_plugin($this->storage_type); |
|
817 |
if (!$storage_plugin) { |
|
818 |
return FALSE; |
|
819 |
} |
|
820 |
|
|
821 |
$access_callback = panels_plugin_get_function('panels_storage', $storage_plugin, 'access callback'); |
|
822 |
if (!$access_callback) { |
|
823 |
return FALSE; |
|
824 |
} |
|
825 |
|
|
826 |
return $access_callback($this->storage_type, $this->storage_id, $op, $account); |
|
827 |
} |
|
773 | 828 |
} |
774 | 829 |
|
775 | 830 |
/** |
... | ... | |
1079 | 1134 |
$title_pid = $pid; |
1080 | 1135 |
} |
1081 | 1136 |
$pane->pid = $pid; |
1082 |
$output .= ctools_export_object('panels_pane', $pane, $prefix . ' ');
|
|
1083 |
$output .= "$prefix " . '$display->content[\'' . $pane->pid . '\'] = $pane' . ";\n";
|
|
1137 |
$output .= ctools_export_object('panels_pane', $pane, $prefix); |
|
1138 |
$output .= $prefix . '$display->content[\'' . $pane->pid . '\'] = $pane' . ";\n";
|
|
1084 | 1139 |
if (!isset($region_counters[$pane->panel])) { |
1085 | 1140 |
$region_counters[$pane->panel] = 0; |
1086 | 1141 |
} |
1087 |
$output .= "$prefix " . '$display->panels[\'' . $pane->panel . '\'][' . $region_counters[$pane->panel]++ .'] = \'' . $pane->pid . "';\n";
|
|
1142 |
$output .= $prefix . '$display->panels[\'' . $pane->panel . '\'][' . $region_counters[$pane->panel]++ .'] = \'' . $pane->pid . "';\n";
|
|
1088 | 1143 |
} |
1089 | 1144 |
} |
1090 | 1145 |
$output .= $prefix . '$display->hide_title = '; |
... | ... | |
1334 | 1389 |
$vars['pane_suffix'] = !empty($content->pane_suffix) ? $content->pane_suffix : ''; |
1335 | 1390 |
|
1336 | 1391 |
$vars['title'] = !empty($content->title) ? $content->title : ''; |
1337 |
$vars['title_heading'] = !empty($content->title_heading) ? $content->title_heading : 'h2';
|
|
1392 |
$vars['title_heading'] = !empty($content->title_heading) ? $content->title_heading : variable_get('override_title_heading', 'h2');
|
|
1338 | 1393 |
$vars['title_attributes_array']['class'][] = 'pane-title'; |
1339 | 1394 |
|
1340 | 1395 |
$vars['feeds'] = !empty($content->feeds) ? implode(' ', $content->feeds) : ''; |
... | ... | |
1410 | 1465 |
ctools_include('cleanstring'); |
1411 | 1466 |
$renderer->clean_key = ctools_cleanstring($cache_key); |
1412 | 1467 |
|
1468 |
$op = $renderer->get_panels_storage_op_for_ajax($method); |
|
1469 |
if (!$cache->display->access($op)) { |
|
1470 |
return MENU_ACCESS_DENIED; |
|
1471 |
} |
|
1472 |
|
|
1413 | 1473 |
$output = call_user_func_array(array($renderer, $method), $args); |
1414 | 1474 |
|
1415 | 1475 |
if (empty($output) && !empty($renderer->commands)) { |
... | ... | |
1721 | 1781 |
page_manager_set_wizard_cache($wizard_cache); |
1722 | 1782 |
} |
1723 | 1783 |
|
1784 |
/** |
|
1785 |
* Alter the page wizard basic page, when panels is selected, to inject page |
|
1786 |
* manager as the storage plugin for panels. |
|
1787 |
* @param $form |
|
1788 |
* @param $form_state |
|
1789 |
*/ |
|
1790 |
function panels_form_page_manager_page_form_basic_alter(&$form, &$form_state) { |
|
1791 |
$form['#validate'][] = 'panels_page_manager_handler_add_validate'; |
|
1792 |
} |
|
1793 |
|
|
1794 |
/** |
|
1795 |
* Alter the variant add page, so when panels is selected, page manager is the |
|
1796 |
* storage plugin for panels. |
|
1797 |
* @param $form |
|
1798 |
* @param $form_state |
|
1799 |
*/ |
|
1800 |
function panels_form_page_manager_handler_add_alter(&$form, &$form_state) { |
|
1801 |
$form['#validate'][] = 'panels_page_manager_handler_add_validate'; |
|
1802 |
} |
|
1803 |
|
|
1804 |
/** |
|
1805 |
* Perform the validation check to see if panel context is selected to use |
|
1806 |
* page manager as the storage plugin. |
|
1807 |
* @param $form |
|
1808 |
* @param $form_state |
|
1809 |
*/ |
|
1810 |
function panels_page_manager_handler_add_validate($form, &$form_state) { |
|
1811 |
if($form_state['values']['handler'] == 'panel_context') { |
|
1812 |
$form_state['page']->storage_type = 'page_manager'; |
|
1813 |
} |
|
1814 |
} |
|
1815 |
|
|
1724 | 1816 |
// -------------------------------------------------------------------------- |
1725 | 1817 |
// General utility functions |
1726 | 1818 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules