Révision 136a805a
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/panels/panels_node/panels_node.module | ||
---|---|---|
17 | 17 |
*/ |
18 | 18 |
function panels_node_permission() { |
19 | 19 |
return array( |
20 |
'create panel-nodes' => array( |
|
21 |
'title' => t('Create panel nodes'), |
|
22 |
'description' => t('Create new panel nodes.'), |
|
23 |
), |
|
24 |
'edit any panel-nodes' => array( |
|
25 |
'title' => t('Edit any panel-nodes'), |
|
26 |
'description' => t('Edit all pre-existing panel nodes regardless of ownership.'), |
|
27 |
), |
|
28 |
'edit own panel-nodes' => array( |
|
29 |
'title' => t('Edit own panel nodes'), |
|
30 |
'description' => t('Edit panel nodes owned by this user.'), |
|
31 |
), |
|
32 | 20 |
'administer panel-nodes' => array( |
33 | 21 |
'title' => t('Administer panel nodes'), |
34 | 22 |
'description' => t('Full administrative access to panel nodes including create, update and delete all'), |
35 | 23 |
), |
36 |
'delete any panel-nodes' => array( |
|
37 |
'title' => t('Delete any panel nodes'), |
|
38 |
'description' => t('Delete any panel node regardless of ownership'), |
|
39 |
), |
|
40 |
'delete own panel-nodes' => array( |
|
41 |
'title' => t('Delete own panel nodes'), |
|
42 |
'description' => t('Delete any panel node owned by this user.'), |
|
43 |
), |
|
44 | 24 |
); |
45 | 25 |
} |
46 | 26 |
|
27 |
/** |
|
28 |
* Implementation of hook_ctools_plugin_directory(). |
|
29 |
*/ |
|
30 |
function panels_node_ctools_plugin_directory($module, $plugin) { |
|
31 |
if ($module == 'panels' && $plugin == 'panels_storage') { |
|
32 |
return 'plugins/' . $plugin; |
|
33 |
} |
|
34 |
} |
|
35 |
|
|
47 | 36 |
/** |
48 | 37 |
* Implementation of hook_menu(). |
49 | 38 |
*/ |
... | ... | |
113 | 102 |
ctools_include('common', 'panels'); |
114 | 103 |
|
115 | 104 |
$layouts = panels_common_get_allowed_layouts('panels_node'); |
116 |
return panels_common_print_layout_links($layouts, 'node/add/panel', array('query' => $_GET));
|
|
105 |
return panels_common_print_layout_links($layouts, 'node/add/panel', array('query' => drupal_get_query_parameters()));
|
|
117 | 106 |
} |
118 | 107 |
|
119 | 108 |
// --------------------------------------------------------------------------- |
... | ... | |
156 | 145 |
if (user_access('administer panel-nodes', $account)) { |
157 | 146 |
return NODE_ACCESS_ALLOW; |
158 | 147 |
} |
159 |
|
|
160 |
if ($op == 'create' && user_access('create panel-nodes', $account)) { |
|
161 |
return NODE_ACCESS_ALLOW; |
|
162 |
} |
|
163 |
|
|
164 |
if ($op == 'update' && (user_access('edit any panel-nodes', $account) || $node->uid == $account->uid && user_access('edit own panel-nodes', $account))) { |
|
165 |
return NODE_ACCESS_ALLOW; |
|
166 |
} |
|
167 |
|
|
168 |
|
|
169 |
if ($op == 'delete' && (user_access('delete any panel-nodes') || $node->uid == $account->uid && user_access('delete own panel-nodes'))) { |
|
170 |
return NODE_ACCESS_ALLOW; |
|
171 |
} |
|
172 | 148 |
} |
173 | 149 |
|
174 | 150 |
/** |
... | ... | |
183 | 159 |
// and if that doesn't work present them with a list to pick from. |
184 | 160 |
$panel_layout = isset($node->panel_layout) ? $node->panel_layout : arg(3); |
185 | 161 |
if (empty($panel_layout)) { |
186 |
$opts = $_GET; |
|
187 |
unset($opts['q']); |
|
188 |
return drupal_goto('node/add/panel/choose-layout', $opts); |
|
162 |
drupal_goto('node/add/panel/choose-layout', array('query' => drupal_get_query_parameters())); |
|
189 | 163 |
} |
190 | 164 |
|
191 | 165 |
$layout = panels_get_layout($panel_layout); |
192 | 166 |
if (empty($layout)) { |
193 |
return drupal_not_found();
|
|
167 |
return MENU_NOT_FOUND;
|
|
194 | 168 |
} |
195 | 169 |
$form['panels_node']['layout'] = array( |
196 | 170 |
'#type' => 'value', |
... | ... | |
233 | 207 |
'#type' => 'radios', |
234 | 208 |
'#options' => $options, |
235 | 209 |
'#title' => t('Renderer'), |
236 |
'#default_value' => isset($node->panels_node['pipeline']) ? $node->panels_node['pipeline'] : 'standard',
|
|
210 |
'#default_value' => isset($node->panels_node['pipeline']) ? $node->panels_node['pipeline'] : variable_get('panels_renderer_default', 'standard'),
|
|
237 | 211 |
); |
238 | 212 |
|
239 | 213 |
return $form; |
... | ... | |
271 | 245 |
// Create a new display and record that. |
272 | 246 |
$display = panels_new_display(); |
273 | 247 |
$display->layout = $node->panels_node['layout']; |
248 |
$display->storage_type = 'panels_node'; |
|
249 |
$display->storage_id = $node->nid; |
|
274 | 250 |
|
275 | 251 |
// Special handling for nodes being imported from an export.module data dump. |
276 | 252 |
if (!empty($node->export_display)) { |
... | ... | |
431 | 407 |
); |
432 | 408 |
} |
433 | 409 |
|
410 |
/** |
|
411 |
* Implements hook_panels_ipe_access(). |
|
412 |
*/ |
|
413 |
function panels_node_panels_ipe_access($display) { |
|
414 |
// We only care about Panels displays from panels_node. |
|
415 |
if (isset($display->context['panel-node'])) { |
|
416 |
// Only allow access to use the IPE if the user has 'update' access to |
|
417 |
// the underlying node. |
|
418 |
$node = $display->context['panel-node']->data; |
|
419 |
return node_access('update', $node); |
|
420 |
} |
|
421 |
} |
|
422 |
|
|
434 | 423 |
// --------------------------------------------------------------------------- |
435 | 424 |
// Callbacks for panel caching. |
436 | 425 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules