Révision e4c061ad
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/ctools/page_manager/page_manager.admin.inc | ||
---|---|---|
95 | 95 |
|
96 | 96 |
$header = array( |
97 | 97 |
array('data' => t('Type'), 'class' => array('page-manager-page-type')), |
98 |
array('data' => t('Module'), 'class' => array('page-manager-page-module')), |
|
98 | 99 |
array('data' => t('Name'), 'class' => array('page-manager-page-name')), |
99 | 100 |
array('data' => t('Title'), 'class' => array('page-manager-page-title')), |
100 | 101 |
array('data' => t('Path'), 'class' => array('page-manager-page-path')), |
... | ... | |
175 | 176 |
$row = array('data' => array(), 'class' => $class, 'title' => strip_tags($task['admin description'])); |
176 | 177 |
|
177 | 178 |
$type = isset($task['admin type']) ? $task['admin type'] : t('System'); |
179 |
if (isset($task['module'])) { |
|
180 |
$module = $task['module']; |
|
181 |
} |
|
182 |
elseif (isset($task['subtask']->export_module)) { |
|
183 |
$module = $task['subtask']->export_module; |
|
184 |
} |
|
185 |
else { |
|
186 |
$module = ''; |
|
187 |
} |
|
178 | 188 |
$pages['types'][$type] = $type; |
179 | 189 |
$row['data']['type'] = array('data' => $type, 'class' => array('page-manager-page-type')); |
180 |
|
|
190 |
$row['data']['module'] = array('data' => $module, 'class' => array('page-manager-page-module')); |
|
181 | 191 |
$row['data']['name'] = array('data' => $task_name, 'class' => array('page-manager-page-name')); |
182 | 192 |
$row['data']['title'] = array('data' => $task['admin title'], 'class' => array('page-manager-page-title')); |
183 | 193 |
$row['data']['path'] = array('data' => $visible_path, 'class' => array('page-manager-page-path')); |
... | ... | |
401 | 411 |
* Render the edit page for a a page, custom or system. |
402 | 412 |
*/ |
403 | 413 |
function page_manager_edit_page($page) { |
404 |
drupal_set_title($page->subtask['admin title']); |
|
414 |
drupal_set_title($page->subtask['admin title'], PASS_THROUGH);
|
|
405 | 415 |
// Provide and process the save page form before anything else. |
406 | 416 |
$form_state = array('page' => &$page); |
407 | 417 |
$built_form = drupal_build_form('page_manager_save_page_form', $form_state); |
... | ... | |
464 | 474 |
return; |
465 | 475 |
} |
466 | 476 |
|
467 |
drupal_set_title($page->subtask['admin title']); |
|
477 |
drupal_set_title($page->subtask['admin title'], PASS_THROUGH);
|
|
468 | 478 |
return $output; |
469 | 479 |
} |
470 | 480 |
|
... | ... | |
577 | 587 |
), |
578 | 588 |
); |
579 | 589 |
|
580 |
// Restrict variant import to users who can already execute arbitrary PHP
|
|
581 |
if (user_access('use PHP for settings')) {
|
|
590 |
// Restrict variant import due to security implications.
|
|
591 |
if (user_access('use ctools import')) {
|
|
582 | 592 |
$result['actions']['children']['import'] = array( |
583 | 593 |
'title' => t('Import variant'), |
584 | 594 |
'description' => t('Add a new variant to this page from code exported from another page.'), |
... | ... | |
1308 | 1318 |
else { |
1309 | 1319 |
$handler->conf['title'] = $plugin['title']; |
1310 | 1320 |
} |
1321 |
$handler->conf['name'] = $form_state['values']['name']; |
|
1311 | 1322 |
$cache->new_handler = $handler; |
1312 | 1323 |
|
1313 | 1324 |
// Figure out which forms to present them with |
... | ... | |
1398 | 1409 |
'#title' => t('Title'), |
1399 | 1410 |
'#description' => t('Administrative title of this variant. If you leave blank it will be automatically assigned.'), |
1400 | 1411 |
); |
1412 |
|
|
1413 |
$form['name'] = array( |
|
1414 |
'#type' => 'machine_name', |
|
1415 |
'#title' => t('Machine name'), |
|
1416 |
'#required' => FALSE, |
|
1417 |
'#description' => t("A unique machine-readable name for this variant. It must only contain lowercase letters, numbers, and underscores. This name will be used when exporting the variant. If left empty the variant's name will be used instead."), |
|
1418 |
'#size' => 32, |
|
1419 |
'#maxlength' => 32, |
|
1420 |
'#machine_name' => array( |
|
1421 |
'exists' => 'page_manager_handler_check_machine_name', |
|
1422 |
'source' => array('title'), |
|
1423 |
), |
|
1424 |
'#field_prefix' => '<span dir="ltr">' . $task['name'] . '__', |
|
1425 |
'#field_suffix' => '</span>‎', |
|
1426 |
); |
|
1401 | 1427 |
} |
1402 | 1428 |
|
1403 | 1429 |
$form['handler'] = array( |
... | ... | |
1436 | 1462 |
return $form; |
1437 | 1463 |
} |
1438 | 1464 |
|
1465 |
/* |
|
1466 |
* Check if handler's machine-name is unique |
|
1467 |
*/ |
|
1468 |
function page_manager_handler_check_machine_name($name, $element, $form_state) { |
|
1469 |
$name = $form_state['task']['name'] . '__' . $name; |
|
1470 |
|
|
1471 |
return count(ctools_export_load_object('page_manager_handlers', 'names', array($name))); |
|
1472 |
} |
|
1473 |
|
|
1439 | 1474 |
/** |
1440 | 1475 |
* Rearrange the order of variants. |
1441 | 1476 |
*/ |
... | ... | |
1446 | 1481 |
'#description' => t('Enter the name of the new variant.'), |
1447 | 1482 |
); |
1448 | 1483 |
|
1449 |
if (user_access('use PHP for settings')) {
|
|
1484 |
if (user_access('use ctools import')) {
|
|
1450 | 1485 |
$form['object'] = array( |
1451 | 1486 |
'#type' => 'textarea', |
1452 | 1487 |
'#title' => t('Paste variant code here'), |
1453 | 1488 |
'#rows' => 15, |
1454 | 1489 |
); |
1455 | 1490 |
} |
1456 |
// Users ordinarily can't get here without the PHP block visibility perm. |
|
1457 |
// In case they somehow do, though, disable the form widget for extra safety. |
|
1491 |
// Users ordinarily can't get here without the 'import' permission, due to |
|
1492 |
// security implications. In case they somehow do, though, disable the form |
|
1493 |
// widget for extra safety. |
|
1458 | 1494 |
else { |
1459 | 1495 |
$form['shoveoff'] = array( |
1460 | 1496 |
'#markup' => '<div>' . t('You do not have sufficient permissions to perform this action.') . '</div>', |
... | ... | |
1468 | 1504 |
* Make sure that an import actually provides a handler. |
1469 | 1505 |
*/ |
1470 | 1506 |
function page_manager_handler_import_validate($form, &$form_state) { |
1471 |
if (!user_access('use PHP for settings')) {
|
|
1507 |
if (!user_access('use ctools import')) {
|
|
1472 | 1508 |
form_error($form['shoveoff'], t('You account permissions do not permit you to import.')); |
1473 | 1509 |
return; |
1474 | 1510 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules