uppdated modules

This commit is contained in:
Bachir Soussi Chiadmi
2017-01-22 16:19:36 +01:00
parent 03be8f82aa
commit 8416e3eea1
748 changed files with 32317 additions and 20900 deletions
@@ -4,7 +4,7 @@ Note: this page is currently very preliminary. Please visit <a href="http://drup
This is a quick summary:
<ul>
<li>Visit administer >> site building >> pages to get to the primary page manager interface.</li>
<li>Visit administer >> structure >> pages to get to the primary page manager interface.</li>
<li>You can add custom pages for your basic landing pages, front pages, whatever you like for normal content display.</li>
<li>You can use the system pages to create finer control of how taxonomy vocabularies, nodes and user profiles are displayed.</li>
<li>When you add your first custom page, do not bother with the optional features. You will not need these until you get to more advanced tasks.</li>
@@ -1421,7 +1421,7 @@ function page_manager_handler_add_form($form, $form_state, $features = array())
'exists' => 'page_manager_handler_check_machine_name',
'source' => array('title'),
),
'#field_prefix' => '<span dir="ltr">' . $task['name'] . '__',
'#field_prefix' => '<span dir="ltr">' . $form_state['task_name'] . '__',
'#field_suffix' => '</span>&lrm;',
);
}
@@ -1466,7 +1466,7 @@ function page_manager_handler_add_form($form, $form_state, $features = array())
* Check if handler's machine-name is unique
*/
function page_manager_handler_check_machine_name($name, $element, $form_state) {
$name = $form_state['task']['name'] . '__' . $name;
$name = $form_state['task_name'] . '__' . $name;
return count(ctools_export_load_object('page_manager_handlers', 'names', array($name)));
}
@@ -1542,25 +1542,42 @@ function page_manager_handler_import_submit(&$form, &$form_state) {
* Rearrange the order of variants.
*/
function page_manager_handler_rearrange($form, &$form_state) {
ctools_include('context-task-handler');
$page = $form_state['page'];
$form['handlers'] = array('#tree' => TRUE);
// Get the number of variants to be displayed in order to set the delta
// to the proper value. This fixes problems in previous versions with sorting
// large numbers of variants.
$delta = count($page->handler_info)/2 + 1;
foreach ($page->handler_info as $id => $info) {
if ($info['changed'] & PAGE_MANAGER_CHANGED_DELETED) {
continue;
}
$handler = $page->handlers[$id];
$plugin = page_manager_get_task_handler($handler->handler);
$object = ctools_context_handler_get_task_object($page->task, $page->subtask, $handler);
$display = new stdClass();
$display->context = ctools_context_load_contexts($object, TRUE);
$content = page_manager_get_handler_title($plugin, $handler, $page->task, $page->subtask_id);
$access = ctools_access_group_summary(!empty($handler->conf['access']) ? $handler->conf['access'] : array(), $display->context);
if ($access) {
$access = t('This panel will be selected if @conditions.', array('@conditions' => $access));
}
else {
$access = t('This panel will always be selected.');
}
$content .= '<div>' . $access . '</div>';
$form['handlers'][$id]['title'] = array(
'#markup' => page_manager_get_handler_title($plugin, $handler, $page->task, $page->subtask_id),
'#markup' => $content,
);
$form['handlers'][$id]['weight'] = array(
'#type' => 'weight',
'#default_value' => $info['weight'],
'#delta' => 30,
'#delta' => $delta,
);
}
@@ -1671,6 +1688,12 @@ function page_manager_handler_clone_submit(&$form, &$form_state) {
page_manager_handler_add_to_page($form_state['page'], $handler, $form_state['values']['title']);
// Variant is cloned and added to the Page. Ensure the uuids are re-generated.
panels_panel_context_get_display($handler);
if (isset($handler->conf['display']) && method_exists($handler->conf['display'], 'clone_display')) {
$handler->conf['display'] = $handler->conf['display']->clone_display();
}
$plugin = page_manager_get_task_handler($handler->handler);
// It has no forms at all. Add the variant and go to its first operation.
$keys = array_keys($plugin['operations']);
@@ -5,9 +5,9 @@ dependencies[] = ctools
package = Chaos tool suite
version = CTOOLS_MODULE_VERSION
; Information added by Drupal.org packaging script on 2015-01-28
version = "7.x-1.6"
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
core = "7.x"
project = "ctools"
datestamp = "1422471484"
datestamp = "1479787162"
@@ -440,13 +440,18 @@ function page_manager_cache_load($task_name) {
*/
function page_manager_handler_get_name($task_name, $handlers, $handler) {
$base = str_replace('-', '_', $task_name);
$name = '';
// Optional machine name.
if (!empty($handler->conf['name'])) {
$name = $base . '__' . $handler->conf['name'];
if (count(ctools_export_load_object('page_manager_handlers', 'names', array($name)))) {
$name = '';
}
}
// If no machine name was provided, generate a unique name.
else {
// If no machine name was provided or the name is in use, generate a unique name.
if (empty($name)) {
$base .= '__' . $handler->handler;
// Use the ctools uuid generator to generate a unique id.
@@ -472,6 +477,10 @@ function page_manager_handler_add_to_page(&$page, &$handler, $title = NULL) {
if ($title) {
$handler->conf['title'] = $title;
$handler->conf['name'] = trim(preg_replace('/[^a-z0-9_]+/', '-', strtolower($title)), '-');
}
else {
$handler->conf['name'] = '';
}
$name = page_manager_handler_get_name($page->task_name, $page->handlers, $handler);
@@ -1193,7 +1202,7 @@ function page_manager_page_manager_pages_to_hook_code($names = array(), $name =
foreach ($objects as $object) {
// Have to implement our own because this export func sig requires it
$code .= $export['export callback']($object, TRUE, ' ');
$code .= " \${$export['identifier']}s['" . check_plain($object->$export['key']) . "'] = \${$export['identifier']};\n\n";
$code .= " \${$export['identifier']}s['" . check_plain($object->{$export['key']}) . "'] = \${$export['identifier']};\n\n";
}
$code .= " return \${$export['identifier']}s;\n";
$code .= "}\n";
@@ -3,7 +3,8 @@
/**
* @file
*
* This is the task handler plugin to handle generating 403, 404 and 301 response codes.
* This is the task handler plugin to handle generating 403, 404, 301 and 302
* response codes.
*/
// Plugin definition
@@ -108,7 +109,8 @@ function page_manager_http_response_codes() {
403 => t('403 Access denied'),
404 => t('404 Page not found'),
410 => t('410 Gone'),
301 => t('301 Redirect'),
301 => t('301 Permanent redirect'),
302 => t('302 Temporary redirect'),
);
}
@@ -216,6 +218,9 @@ function page_manager_http_response_title($handler, $task, $subtask) {
* General settings for the panel
*/
function page_manager_http_response_edit_settings($form, &$form_state) {
ctools_include('page_manager.admin', 'page_manager', '');
ctools_include('export', 'ctools');
$conf = $form_state['handler']->conf;
$form['title'] = array(
'#type' => 'textfield',
@@ -253,7 +258,7 @@ function page_manager_http_response_edit_settings($form, &$form_state) {
'#type' => 'textfield',
'#title' => t('Redirect destination'),
'#default_value' => $conf['destination'],
'#dependency' => array('edit-code' => array(301)),
'#dependency' => array('edit-code' => array(301, 302)),
'#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).'),
);
@@ -262,14 +267,28 @@ function page_manager_http_response_edit_settings($form, &$form_state) {
function page_manager_http_response_edit_settings_submit($form, &$form_state) {
$machine_name = $form_state['handler']->name;
$name = $form_state['task_id'] . '__' . $form_state['values']['name'];
$name = $form_state['task_name'] . '__' . $form_state['values']['name'];
// If new name doesn't equal machine name, we need to update and redirect.
if ($machine_name !== $name) {
$form_state['new trail'] = $form_state['trail'];
$delta = array_search($machine_name, $form_state['new trail']);
$form_state['new trail'][$delta] = $name;
$form_state['handler']->name = $name;
// If there's a trail, we need to replace it for redirection.
if (isset($form_state['trail'])) {
$form_state['new trail'] = $form_state['trail'];
$delta = array_search($machine_name, $form_state['new trail']);
$form_state['new trail'][$delta] = $name;
}
// If handler id is set, replace it.
if ($form_state['handler_id']) {
$form_state['handler_id'] = $name;
}
// If we're defining a new custom handler, move page handler to new name.
if (isset($form_state['page']->handlers[$machine_name]) && isset($form_state['page']->handler_info[$machine_name])) {
$form_state['page']->handlers[$name] = $form_state['page']->handlers[$machine_name];
unset($form_state['page']->handlers[$machine_name]);
$form_state['page']->handler_info[$name] = $form_state['page']->handler_info[$machine_name];
unset($form_state['page']->handler_info[$machine_name]);
}
}
$form_state['handler']->conf['title'] = $form_state['values']['title'];
@@ -296,7 +315,7 @@ function page_manager_http_response_render($handler, $base_contexts, $args, $tes
}
$info['response code'] = $handler->conf['code'];
if ($info['response code'] == 301) {
if ($info['response code'] == 301 || $info['response code'] == 302) {
$path = ctools_context_keyword_substitute($handler->conf['destination'], array(), $contexts);
$url = parse_url($path);
if (isset($url['query'])) {
@@ -108,7 +108,7 @@ function page_manager_node_edit($node) {
* Callback to handle the process of adding a node.
*
* This creates a basic $node and passes that off to page_manager_node_edit().
* It is modeled after Drupal's node_add() function.
* It is modelled after Drupal's node_add() function.
*
* Unlike node_add() we do not need to check node_access because that was
* already checked by the menu system.
@@ -78,10 +78,6 @@ function page_manager_node_view_menu_alter(&$items, $task) {
* node view, which is node_page_view().
*/
function page_manager_node_view_page($node) {
// Prep the node to be displayed so all of the regular hooks are triggered.
// Also save the output for later, in case it is needed.
$default_output = node_page_view($node);
// Load my task plugin
$task = page_manager_get_task('node_view');
@@ -107,6 +103,9 @@ function page_manager_node_view_page($node) {
}
}
// Prepare the node to be displayed so all of the regular hooks are triggered.
$default_output = node_page_view($node);
// Otherwise, fall back to the default output generated by node_page_view().
return $default_output;
}
@@ -61,7 +61,7 @@ function page_manager_page_menu(&$items, $task) {
}
$path = array();
$page_arguments = array($subtask_id);
$page_arguments = array((string) $subtask_id);
$access_arguments = array($subtask->access);
$load_arguments = array($subtask_id, '%index', '%map');
@@ -566,7 +566,7 @@ function page_manager_page_form_basic_validate(&$form, &$form_state) {
if (strpos($path, '%') === FALSE) {
$alias = db_query('SELECT alias, source FROM {url_alias} WHERE alias = :path', array(':path' => $path))->fetchObject();
if ($alias) {
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)));
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)));
}
}
else {
@@ -698,7 +698,7 @@ function page_manager_page_form_menu($form, &$form_state) {
'#title' => t('Title'),
'#type' => 'textfield',
'#default_value' => $menu['title'],
'#description' => t('If set to normal or tab, enter the text to use for the menu item.'),
'#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.'),
'#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab', 'action')),
);
@@ -1462,6 +1462,15 @@ function page_manager_page_form_clone_submit(&$form, &$form_state) {
$original->path = $form_state['values']['path'];
$handlers = !empty($form_state['values']['handlers']) ? $form_state['page']->handlers : FALSE;
// Ensure the handler uuids are re-generated.
if ($handlers) {
foreach ($handlers as &$handler) {
if (isset($handler->conf['display']) && method_exists($handler->conf['display'], 'clone_display')) {
$handler->conf['display'] = $handler->conf['display']->clone_display();
}
}
}
// Export the handler, which is a fantastic way to clean database IDs out of it.
$export = page_manager_page_export($original, $handlers);
ob_start();
@@ -151,7 +151,7 @@ function page_manager_term_view_page($term, $depth = NULL) {
foreach (module_implements('page_manager_override') as $module) {
$call = $module . '_page_manager_override';
if (($rc = $call('term_view')) && function_exists($rc)) {
return $rc($node);
return $rc($term, $depth);
}
}