display_edit.inc File Reference

(1.1.2.63 2008/08/03 04:34:01 sdboyer)

Go to the source code of this file.

Functions

 _panels_ajax_ct_preconfigure (&$cache, &$pane)
 _panels_edit ($display, $destination, $content_types)
 _panels_edit_layout ($display, $finish, $destination, $allowed_layouts)
 _panels_edit_layout_settings ($display, $finish, $destination, $title)
 _panels_js_files ()
 _panels_render_preview_pane_disabled ($pane, $context)
 panels_add_content ($cache, $panel_id)
 panels_ajax ($op=NULL, $did=NULL, $pid=NULL)
 panels_ajax_add_config ($did=NULL, $pane_info=NULL)
 panels_ajax_add_content ($did=NULL, $panel_id=NULL)
 panels_ajax_cache ($did=NULL, $pid=NULL)
 panels_ajax_cache_settings ($cache, $pid, $method=NULL)
 panels_ajax_configure ($did=NULL, $pid=NULL)
 panels_ajax_set_cache_data (&$display, $pid, $method, $settings=array())
 panels_ajax_toggle_shown ($did=NULL, $pid=NULL, $op=NULL)
 panels_change_layout (&$form, $display, $new_layout_id)
 panels_choose_layout ($display, $finish, $destination, $allowed_layouts)
 panels_choose_layout_submit ($form_id, $form_values)
 panels_common_style_settings_form ($did, $style, $style_settings)
 panels_common_style_settings_form_submit ($form_id, $form_values)
 panels_common_style_settings_form_validate ($form_id, $form_values, $form)
 panels_content_config_add_form_submit ($form_values, $cache, $pane)
 panels_content_config_edit_form_submit ($form_values, $cache, $pane)
 panels_content_config_form ($cache, $pane, $add=FALSE)
 panels_content_config_form_submit ($form_id, $form_values)
 panels_content_config_form_validate ($form_id, $form_values, $form)
 panels_edit_cache_method_form ($display, $pid)
 panels_edit_cache_method_form_submit ($form_id, $form_values)
 panels_edit_cache_settings_form ($display, $pid, $method, $settings_function)
 panels_edit_cache_settings_form_submit ($form_id, $form_values)
 panels_edit_cache_settings_form_validate ($form_id, $form_values, $form)
 panels_edit_display ($display, $destination)
 panels_edit_display_submit ($form_id, $form_values)
 panels_edit_layout_settings_form ($display, $finish, $destination, $title)
 panels_edit_layout_settings_form_submit ($form_id, $form_values)
 panels_edit_layout_settings_form_validate ($form_id, $form_values, $form)
 panels_edit_submit_subform ($display)
 panels_get_pane_edit_form ($pane, $contexts, $parents)
 panels_panel_settings ($display)
 panels_panel_settings_ajax ($did, $panel, $name)
 panels_panel_settings_submit ($form_id, $form_values)
 panels_panel_settings_validate ($form_id, $form_values, $form)
 panels_show_pane ($display, $pane, $left_buttons, $buttons, $skin=TRUE)
 theme_panels_dnd ($content)
 theme_panels_edit_display ($form)
 theme_panels_hidden ()
 theme_panels_pane_collapsible ($block)
 theme_panels_pane_dnd ($block, $id, $label, $left_buttons=NULL, $buttons=NULL)
 theme_panels_panel_dnd ($content, $region, $label, $footer)


Function Documentation

_panels_edit ( display,
destination,
content_types 
)

Handle calling and processing of the form for editing display content.

Helper function for panels_edit().

See also:
panels_edit() for details on the various behaviors of this function.

Definition at line 19 of file display_edit.inc.

References panels_cache_clear(), panels_cache_get(), and panels_cache_set().

Referenced by panels_edit().

00019                                                               {
00020   $did = $display->did;
00021   if (!$did) {
00022     $display->did = $did = 'new';
00023   }
00024 
00025   // Load the display being edited from cache, if possible.
00026   if (!empty($_POST) && is_object($cache = panels_cache_get($did))) {
00027     $display = $cache->display;
00028   }
00029   else {
00030     panels_cache_clear($did);
00031     $cache = new stdClass();
00032     $cache->display = $display;
00033     $cache->content_types = $content_types;
00034     panels_cache_set($did, $cache);
00035   }
00036 
00037   // Break out the form pieces so we can return the new $display upon
00038   // successful submit.
00039 
00040   $form_id = 'panels_edit_display';
00041   $form = drupal_retrieve_form($form_id, $display, $destination);
00042 
00043   if ($result = drupal_process_form($form_id, $form)) {
00044     // successful submit
00045     return $result;
00046   }
00047 
00048   $output = drupal_render_form($form_id, $form);
00049   $output .= theme('panels_hidden');
00050   return $output;
00051 }

Here is the call graph for this function:

Here is the caller graph for this function:

_panels_edit_layout ( display,
finish,
destination,
allowed_layouts 
)

Handle calling and processing of the form for editing display layouts.

Helper function for panels_edit_layout().

See also:
panels_edit_layout() for details on the various behaviors of this function.

Definition at line 261 of file display_edit.inc.

References panels_load_include().

Referenced by panels_edit_layout().

00261                                                                                 {
00262   panels_load_include('common');
00263   // module_name has been provided; the data was saved by the api_save() method.
00264   if (is_string($allowed_layouts)) {
00265     $allowed_layouts = unserialize(variable_get($allowed_layouts . "_allowed_layouts", serialize('')));
00266   }
00267   // if no parameter was provided, or the variable_get failed
00268   if (!$allowed_layouts) {
00269     // tries to load the common panels allowed layouts
00270     $allowed_layouts = unserialize(variable_get('panels_common_allowed_layouts', serialize('')));
00271     if (!$allowed_layouts) {
00272       // still no dice. simply creates a dummy version where all layouts are allowed.
00273       $allowed_layouts = new panels_allowed_layouts();
00274       $allowed_layouts->allow_new = TRUE;
00275     }
00276   }
00277   // sanitize allowed layout listing; this is redundant if the $allowed_layouts param was null, but the data is cached anyway
00278   $allowed_layouts->sync_with_available();
00279   // Break out the form pieces so we can return the new $display upon
00280   // successful submit.
00281   $form_id = 'panels_choose_layout';
00282   $form = drupal_retrieve_form($form_id, $display, $finish, $destination, array_filter($allowed_layouts->allowed_layout_settings));
00283 
00284   if ($result = drupal_process_form($form_id, $form)) {
00285     // successful submit
00286     return $result;
00287   }
00288   $output = drupal_render_form($form_id, $form);
00289   return $output;
00290 }

Here is the call graph for this function:

Here is the caller graph for this function:

_panels_edit_layout_settings ( display,
finish,
destination,
title 
)

Handle calling and processing of the form for editing display layout settings.

Helper function for panels_edit_layout_settings().

See also:
panels_edit_layout_settings() for details on the various behaviors of this function.

Definition at line 472 of file display_edit.inc.

Referenced by panels_edit_layout_settings().

00472                                                                                {
00473   // Break out the form pieces so we can return the new $display upon
00474   // successful submit.
00475   $form_id = 'panels_edit_layout_settings_form';
00476   $form = drupal_retrieve_form($form_id, $display, $finish, $destination, $title);
00477 
00478   if ($result = drupal_process_form($form_id, $form)) {
00479     // successful submit
00480     return $result;
00481   }
00482   $output = drupal_render_form($form_id, $form);
00483   return $output;
00484 }

Here is the caller graph for this function:

_panels_js_files (  ) 

Includes required JavaScript libraries.

Definition at line 1665 of file display_edit.inc.

References panels_get_path().

Referenced by theme_panels_edit_display().

01665                             {
01666   // while we don't use this directly some of our forms do.
01667   drupal_add_js('misc/collapse.js');
01668   drupal_add_js('misc/autocomplete.js');
01669 
01670   drupal_add_js(panels_get_path('js/lib/dimensions.js'));
01671   drupal_add_js(panels_get_path('js/lib/mc.js'));
01672   drupal_add_js(panels_get_path('js/lib/form.js'));
01673   drupal_add_js(array('panelsAjaxURL' => url('panels/ajax', NULL, NULL, TRUE)), 'setting');
01674   drupal_add_js(panels_get_path('js/display_editor.js'));
01675   drupal_add_js(panels_get_path('js/checkboxes.js'));
01676   drupal_add_js(panels_get_path('js/modal_forms.js'));
01677   drupal_add_css(panels_get_path('css/panels_dnd.css'));
01678   drupal_add_css(panels_get_path('css/panels_admin.css'));
01679 }

Here is the call graph for this function:

Here is the caller graph for this function:

_panels_render_preview_pane_disabled ( pane,
context 
)

Provide filler content for dynamic pane previews in the editor, as they're just a bad idea to have anyway, and can also cause infinite recursion loops that render the editor inaccessible in some cases.

Definition at line 660 of file display_edit.inc.

References panels_get_pane_title().

Referenced by panels_content_config_edit_form_submit(), and panels_show_pane().

00660                                                                {
00661   $block = new stdClass();
00662   $block->title   = panels_get_pane_title($pane, $context);
00663   $block->content = '<em>' . t("Dynamic content previews have been disabled to improve performance and stability for this editing screen.") . '</em>';
00664   return $block;
00665 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_ajax ( op = NULL,
did = NULL,
pid = NULL 
)

Entry point into all ajax operations.

Parameters:
string $op The name of the edit operation being performed.
integer $did The id of the $display object being edited (if any).
integer $pid The id of the pane object being edited (if any).

Definition at line 678 of file display_edit.inc.

References panels_ajax_render(), panels_cache_get(), and panels_edit_submit_subform().

00678                                                            {
00679   switch ($op) {
00680     case 'submit-form':
00681       if ((is_numeric($did) || $did == 'new') && $cache = panels_cache_get($did)) {
00682         $output = panels_edit_submit_subform($cache->display);
00683       }
00684       break;
00685 
00686     default:
00687   }
00688 
00689   panels_ajax_render($output);
00690 }

Here is the call graph for this function:

panels_change_layout ( &$  form,
display,
new_layout_id 
)

Form definition for the display layout converter.

This form is only triggered if the user attempts to change the layout for a display that has already had content assigned to it. It allows the user to select where the panes located in to-be-deleted panels should be relocated to.

Parameters:
array $form A structured FAPI $form array.
object $display instanceof panels_display
The panels_display object that was modified on the preceding display layout editing form.
string $new_layout_id A string containing the name of the layout the display is to be converted to. These strings correspond exactly to the filenames of the *.inc files in panels/layouts. So, if the new layout that's been selected is the 'Two Column bricks' layout, then $new_layout_id will be 'twocol_bricks', corresponding to panels/layouts/twocol_bricks.inc.

Definition at line 411 of file display_edit.inc.

References panels_get_layout(), panels_get_panels(), and panels_print_layout_icon().

Referenced by panels_choose_layout().

00411                                                                 {
00412   $new_layout = panels_get_layout($new_layout_id);
00413   $new_layout_panels = panels_get_panels($new_layout, $display);
00414 
00415   $options = $new_layout_panels;
00416   $keys = array_keys($options);
00417   $default = $options[0];
00418 
00419   $old_layout = panels_get_layout($display->layout);
00420 
00421   $form['container'] = array(
00422     '#prefix' => '<div class="change-layout-display">',
00423     '#suffix' => '</div>',
00424   );
00425 
00426   $form['container']['old_layout'] = array(
00427     '#value' => panels_print_layout_icon($display->layout, $old_layout, check_plain($old_layout['title'])),
00428   );
00429 
00430   $form['container']['right_arrow'] = array(
00431     '#value' => theme('image', drupal_get_path('module', 'panels') . '/images/go-right.png'),
00432   );
00433   $form['container']['new_layout'] = array(
00434     '#value' => panels_print_layout_icon($new_layout_id, $new_layout, check_plain($new_layout['title'])),
00435   );
00436 
00437   $form['container-clearer'] = array(
00438     // TODO: FIx this ot use clear-block instead
00439     '#value' => '<div style="clear: both;"></div>',
00440   );
00441 
00442   $form['old'] = array(
00443     '#tree' => true,
00444     '#prefix' => '<div class="panels-layout-list">',
00445     '#suffix' => '</div>',
00446   );
00447 
00448   $old_layout_panels = panels_get_panels($old_layout, $display);
00449   foreach ($display->panels as $id => $content) {
00450     $form['old'][$id] = array(
00451       '#type' => 'select',
00452       '#title' => t('Move content in @layout to', array('@layout' => $old_layout_panels[$id])),
00453       '#options' => $options,
00454       '#default_value' => array_key_exists($id, $options) ? $id : $default,
00455     );
00456   }
00457 
00458   $form['back'] = array(
00459     '#type' => 'submit',
00460     '#value' => t('Back'),
00461   );
00462   return $form;
00463 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_choose_layout ( display,
finish,
destination,
allowed_layouts 
)

Form definition for the display layout editor.

Definition at line 297 of file display_edit.inc.

References panels_change_layout(), panels_get_layouts(), panels_get_path(), and panels_print_layout_icon().

00297                                                                                  {
00298   $layouts = array();
00299   $available_layouts = panels_get_layouts();
00300   foreach ($available_layouts as $layout_key => $layout_settings) {
00301     if (!empty($allowed_layouts[$layout_key])) {
00302       $layouts[$layout_key] = $layout_settings;
00303     }
00304   }
00305   foreach ($layouts as $id => $layout) {
00306     $options[$id] = panels_print_layout_icon($id, $layout, check_plain($layout['title']));
00307   }
00308 
00309   drupal_add_js(panels_get_path('js/layout.js'));
00310   $form['layout'] = array(
00311     '#type' => 'radios',
00312     '#title' => t('Choose layout'),
00313     '#options' => $options,
00314     '#default_value' => in_array($display->layout, array_keys($layouts)) ? $display->layout : NULL,
00315     '#attributes' => array('class' => 'clear-block'),
00316   );
00317 
00318   $form['variables'] = array(
00319     '#type' => 'value',
00320     '#value' => array($display, $finish, $destination),
00321   );
00322 
00323   if (empty($destination)) {
00324     $form['#redirect'] = FALSE;
00325   }
00326 
00327   if ($_POST['op'] && $_POST['op'] != t('Back') && $display->content) {
00328     $form['#post'] = $_POST;
00329     $form = form_builder('panels_choose_layout', $form);
00330     unset($form['#post']);
00331     $form['layout']['#type'] = 'hidden';
00332     panels_change_layout($form, $display, $form['layout']['#value']);
00333   }
00334 
00335   if (($_POST['op'] && $_POST['op'] != t('Back')) || !$display->content) {
00336     $form['submit'] = array(
00337       '#type' => 'submit',
00338       '#value' => $finish,
00339     );
00340   }
00341   else {
00342     $form['submit'] = array(
00343       '#type' => 'submit',
00344       '#value' => t('Next'),
00345     );
00346   }
00347 
00348   // no token please
00349   $form['#token'] = FALSE;
00350   return $form;
00351 }

Here is the call graph for this function:

panels_choose_layout_submit ( form_id,
form_values 
)

Handle form submission of the display layout editor.

The behavior of this function is fairly complex and irregular compared to most FAPI submit handlers. See the documentation on panels_edit_layout() for detailed discussion of this behavior.

Definition at line 360 of file display_edit.inc.

References panels_save_display().

00360                                                              {
00361   list($display, $finish, $destination) = $form_values['variables'];
00362   $new_layout_id = $form_values['layout'];
00363 
00364   if ($form_values['op'] == $finish) {
00365     if (!empty($form_values['old'])) {
00366       foreach ($form_values['old'] as $id => $new_id) {
00367         $content[$new_id] = array_merge((array) $content[$new_id], $display->panels[$id]);
00368         foreach ($content[$new_id] as $pid) {
00369           $display->content[$pid]->panel = $new_id;
00370         }
00371       }
00372 
00373       $display->panels = $content;
00374     }
00375 
00376     $display->layout = $new_layout_id;
00377 
00378     // save it back to our session.
00379     panels_save_display($display);
00380     if (empty($destination)) {
00381       return $display;
00382     }
00383 
00384     return $destination;
00385   }
00386 
00387   return FALSE;
00388 }

Here is the call graph for this function:

panels_common_style_settings_form_submit ( form_id,
form_values 
)

Allows panel styles to validate their style settings.

Definition at line 1652 of file display_edit.inc.

01652                                                                           {
01653   $style = $form_values['style'];
01654 
01655   if (isset($style['settings form submit']) && function_exists($style['settings form submit'])) {
01656     $style['settings form submit']($form_values['style_settings']);
01657   }
01658 
01659   return $form_values['style_settings'];
01660 }

panels_common_style_settings_form_validate ( form_id,
form_values,
form 
)

Allows panel styles to validate their style settings.

Definition at line 1641 of file display_edit.inc.

01641                                                                                    {
01642   $style = $form_values['style'];
01643 
01644   if (isset($style['settings form validate']) && function_exists($style['settings form validate'])) {
01645     $style['settings form validate']($form, $form_values['style_settings']);
01646   }
01647 }

panels_content_config_add_form_submit ( form_values,
cache,
pane 
)

Definition at line 1141 of file display_edit.inc.

References panels_add_button(), panels_get_caches(), and panels_show_pane().

01141                                                                             {
01142   $ajax_vars = new stdClass();
01143   $ajax_vars->type   = 'add';
01144   $ajax_vars->region = $cache->content_config[$pane->pid]['panel_id'];
01145 
01146   $cache->display->panels[$cache->content_config[$pane->pid]['panel_id']][] = $pane->pid;
01147   $cache->display->content[$pane->pid]->shown = TRUE;
01148 
01149   // we need to fake the buttons a little.
01150   // new panes are shown by default
01151   $buttons['configure'] = panels_add_button('icon-configure.png', t('Configure'), t('Configure this pane'), 'pane-configure');
01152   $buttons['configure']['#parents'] = array('button', $pane->pid, 'configure');
01153 
01154   if (panels_get_caches() && user_access('use panels caching features')) {
01155     $buttons['cache'] = panels_add_button('icon-cache.png', t('Caching'), t('Control caching'), 'pane-cache');
01156     $buttons['cache']['#parents'] = array('button', $pane->pid, 'cache');
01157   }
01158 
01159   $buttons['show_hide'] = panels_add_button('icon-hidepane.png', t('Show/Hide Toggle'), t('Hide this pane'), 'pane-toggle-shown');
01160   $buttons['show_hide']['#parents'] = array('button', $pane->pid, 'show_hide');
01161 
01162   $buttons['delete'] = panels_add_button('icon-delete.png', t('Delete'), t('Remove this pane'), 'pane-delete');
01163   $buttons['delete']['#parents'] = array('button', $pane->pid, 'delete');
01164 
01165   $buttons = form_builder('dummy', $buttons);
01166 
01167   // Render the new pane for the javascript.
01168   $ajax_vars->output = panels_show_pane($cache->display, $cache->display->content[$pane->pid], NULL, drupal_render($buttons));
01169   return $ajax_vars;
01170 }

Here is the call graph for this function:

panels_content_config_form_validate ( form_id,
form_values,
form 
)

FAPI validator for panels_content_config_form().

Call any validation functions defined by the content type.

Definition at line 1084 of file display_edit.inc.

References panels_ct_pane_validate_form().

01084                                                                             {
01085   list($cache, $pane, $add, $op) = $form_values['vars'];
01086   panels_ct_pane_validate_form($pane->type, $form['configuration'], $form_values['configuration'], $op);
01087 }

Here is the call graph for this function:

panels_edit_cache_settings_form_validate ( form_id,
form_values,
form 
)

Validate cache settings.

Definition at line 1351 of file display_edit.inc.

References panels_plugin_get_function().

01351                                                                                  {
01352   if ($function = panels_plugin_get_function('cache', $form_values['method'], 'settings form validate')) {
01353     $function($form, $form_values['settings']);
01354   }
01355 }

Here is the call graph for this function:

panels_edit_display ( display,
destination 
)

Form definition for the panels display editor

No validation function is necessary, as all 'validation' is handled either in the lead-up to form rendering (through the selection of specified content types) or by the validation functions specific to the ajax modals & content types.

See also:
panels_edit_display_submit()

Definition at line 64 of file display_edit.inc.

References panels_add_button(), panels_get_caches(), panels_get_layout(), panels_get_panels(), and panels_get_path().

00064                                                      {
00065   $form['did'] = array(
00066     '#type' => 'hidden',
00067     '#value' => $display->did,
00068     '#id' => 'panel-did',
00069   );
00070 
00071   $form['op'] = array(
00072     '#type' => 'hidden',
00073     '#id' => 'panel-op',
00074   );
00075 
00076   $form['panels_display'] = array(
00077     '#type' => 'value',
00078     '#value' => $display,
00079   );
00080 
00081   if (!empty($destination)) {
00082     $form['destination'] = array(
00083       '#type' => 'value',
00084       '#value' => $destination,
00085     );
00086   }
00087   else {
00088     $form['#redirect'] = FALSE;
00089   }
00090 
00091   $explanation_text = '<p>';
00092   $explanation_text .= t('Grab the title bar of any pane to drag-and-drop it into another panel. Click the add pane button (!addicon) in any panel to add more content. Click the configure (!configicon) button on any pane to re-configure that pane. Click the cache (!cacheicon) button to configure caching for that pane specifically. Click the show/hide (!showicon/!hideicon) toggle button to show or hide that pane. Panes hidden in this way will be hidden from <em>everyone</em> until the hidden status is toggled off.',
00093     array(
00094       '!addicon' => '<span class="inline-icon-help">' . theme('image', panels_get_path('images/icon-addcontent.png'), t('Add content to this panel'), t('Add content to this panel')) . '</span>',
00095       '!configicon' => '<span class="inline-icon-help">' . theme('image', panels_get_path('images/icon-configure.png'), t('Configure this pane'), t('Configure this pane')) . '</span>',
00096       '!cacheicon' => '<span class="inline-icon-help">' . theme('image', panels_get_path('images/icon-cache.png'), t('Control caching'), t('Control caching')) . '</span>',
00097       '!showicon' => '<span class="inline-icon-help">' . theme('image', panels_get_path('images/icon-showpane.png'), t('Show this pane'), t('Show this pane')) . '</span>',
00098       '!hideicon' => '<span class="inline-icon-help">' . theme('image', panels_get_path('images/icon-hidepane.png'), t('Hide this pane'), t('Hide this pane')) . '</span>',
00099     )
00100   );
00101   $explanation_text .= '</p>';
00102 
00103   $form['explanation'] = array(
00104     '#value' => $explanation_text,
00105   );
00106 
00107   $layout = panels_get_layout($display->layout);
00108   $layout_panels = panels_get_panels($layout, $display);
00109 
00110   $form['button']['#tree'] = TRUE;
00111   $caches = panels_get_caches();
00112 
00113   foreach ($display->content as $pid => $pane) {
00114     // This test ensures we don't put anything for panes that are in panels
00115     // that don't exist -- as can happen when flexible changes.
00116     if ($layout_panels[$pane->panel]) {
00117       $form['button'][$pid]['#tree'] = TRUE;
00118       if ($caches && user_access('use panels caching features')) {
00119         $form['button'][$pid]['cache'] = panels_add_button('icon-cache.png', t('Caching'), t('Control caching'), 'pane-cache');
00120       }
00121       $form['button'][$pid]['show_hide'] = panels_add_button($pane->shown ? 'icon-hidepane.png' : 'icon-showpane.png', t('Show/Hide Toggle'), $pane->shown ? t('Hide this pane') : t('Show this pane'), 'pane-toggle-shown');
00122       $form['button'][$pid]['configure'] = panels_add_button('icon-configure.png', t('Configure'), t('Configure this pane'), 'pane-configure');
00123       $form['button'][$pid]['delete'] = panels_add_button('icon-delete.png', t('Delete'), t('Remove this pane'), 'pane-delete');
00124     }
00125   }
00126 
00127   foreach ($layout_panels as $id => $name) {
00128     $form['panels'][$id]['add'] = panels_add_button('icon-addcontent.png', t('Add content'), t('Add content to this panel'), 'pane-add', "pane-add-$id");
00129   }
00130 
00131   $form['panel'] = array('#tree' => TRUE);
00132   $form['panel']['pane'] = array('#tree' => TRUE);
00133 
00134   foreach ($layout_panels as $panel_id => $title) {
00135     $form['panel']['pane'][$panel_id] = array(
00136       // Use 'hidden' instead of 'value' so the js can access it.
00137       '#type' => 'hidden',
00138       '#default_value' => implode(',', (array) $display->panels[$panel_id]),
00139     );
00140   }
00141   $form['submit'] = array(
00142     '#type' => 'submit',
00143     '#value' => t('Save'),
00144     '#id' => 'panels-dnd-save',
00145   );
00146   $form['cancel'] = array(
00147     '#type' => 'submit',
00148     '#value' => t('Cancel'),
00149   );
00150 
00151   $form['hide'] = array(
00152     '#prefix' => '<span id="panels-js-only">',
00153     '#suffix' => '</span>',
00154   );
00155 
00156   $form['hide']['hide-all'] = array(
00157     '#type' => 'submit',
00158     '#value' => t('Hide all'),
00159     '#id' => 'panels-hide-all',
00160   );
00161 
00162   $form['hide']['show-all'] = array(
00163     '#type' => 'submit',
00164     '#value' => t('Show all'),
00165     '#id' => 'panels-show-all',
00166   );
00167 
00168   $form['hide']['cache-settings'] = array(
00169     '#type' => 'submit',
00170     '#value' => t('Cache settings'),
00171     '#id' => 'panels-cache-settings',
00172   );
00173 
00174   return $form;
00175 }

Here is the call graph for this function:

panels_edit_display_submit ( form_id,
form_values 
)

Handle form submission of the display content editor.

The behavior of this function is fairly complex and irregular compared to most FAPI submit handlers. See the documentation on panels_edit() for a detailed discussion of this behavior.

Definition at line 224 of file display_edit.inc.

References panels_cache_clear(), and panels_save_display().

00224                                                             {
00225   $display = $form_values['panels_display'];
00226   if ($form_values['op'] == t('Save')) {
00227     $old_content = $display->content;
00228     $display->content = array();
00229 
00230     foreach ($form_values['panel']['pane'] as $panel_id => $panes) {
00231       $display->panels[$panel_id] = array();
00232       if ($panes) {
00233         $pids = explode(',', $panes);
00234         // need to filter the array, b/c passing it in a hidden field can generate trash
00235         foreach (array_filter($pids) as $pid) {
00236           if ($old_content[$pid]) {
00237             $display->panels[$panel_id][] = $pid;
00238             $old_content[$pid]->panel = $panel_id;
00239             $display->content[$pid] = $old_content[$pid];
00240           }
00241         }
00242       }
00243     }
00244     drupal_set_message(t('Panel content has been updated.'));
00245     panels_save_display($display);
00246   }
00247 
00248   panels_cache_clear($display->did);
00249   if (empty($form_values['destination'])) {
00250     return $display;
00251   }
00252 }

Here is the call graph for this function:

panels_edit_layout_settings_form ( display,
finish,
destination,
title 
)

Form definition for the display layout settings editor.

See also:
panels_edit_layout_settings_form_validate()

panels_edit_layout_settings_form_submit()

Definition at line 493 of file display_edit.inc.

References panels_get_layout(), and panels_panel_settings().

00493                                                                                    {
00494   $layout = panels_get_layout($display->layout);
00495   $form = array();
00496   if (!empty($layout['settings form']) && function_exists($layout['settings form'])) { // TODO doc the ability to do this as part of the API
00497     $form['layout_settings'] = $layout['settings form']($display, $layout, $display->layout_settings);
00498     $form['layout_settings']['#tree'] = TRUE;
00499   }
00500 
00501   if ($title) {
00502     $form['display_title'] = array (
00503       '#type' => 'fieldset',
00504       '#title' => t('Panel Title'),
00505       '#tree' => TRUE,
00506     );
00507 
00508     $form['display_title']['title'] = array(
00509       '#type' => 'textfield',
00510       '#size' => 35,
00511       '#default_value' => $display->title,
00512       '#title' => t('Title'),
00513       '#description' => t('The title of this panel. Your theme will render this text as the main page title when a user views this panel. Note that there are some circumstances in which this title can be overridden elsewhere.'),
00514     );
00515 
00516     $form['display_title']['hide_title'] = array(
00517       '#type' => 'checkbox',
00518       '#title' => t('Hide Title?'),
00519       '#default_value' => $display->hide_title,
00520       '#description' => t('Check this box to hide the main page title for this panel.'),
00521     );
00522 
00523     if (is_string($title)) {
00524       $form['display_title']['title']['#description'] .= t(" If you leave this field blank, then the default title, '@title', will be used instead.", array('@title' => $title));
00525     }
00526   }
00527 
00528   $form += panels_panel_settings($display);
00529 
00530   $form['variables'] = array(
00531     '#type' => 'value',
00532     '#value' => array($display, $finish, $destination, $title),
00533   );
00534 
00535   if (empty($destination)) {
00536     $form['#redirect'] = FALSE;
00537   }
00538 
00539   $form['layout'] = array(
00540     '#type' => 'value',
00541     '#value' => $layout,
00542   );
00543 
00544   // Always show a Save button even if they sent in a Next or something similar
00545   // button.
00546   if ($finish !== t('Save')) {
00547     $form['save'] = array(
00548       '#type' => 'submit',
00549       '#value' => t('Save'),
00550     );
00551   }
00552 
00553   $form['submit'] = array(
00554     '#type' => 'submit',
00555     '#value' => $finish,
00556   );
00557 
00558 
00559   return $form;
00560 }

Here is the call graph for this function:

panels_edit_layout_settings_form_submit ( form_id,
form_values 
)

Definition at line 571 of file display_edit.inc.

References panels_panel_settings_submit(), and panels_save_display().

00571                                                                          {
00572   list($display, $finish, $destination, $title) = $form_values['variables'];
00573   panels_panel_settings_submit($form_id, $form_values);
00574 
00575   $layout = $form_values['layout'];
00576   if (!empty($layout['settings submit']) && function_exists($layout['settings submit'])) {
00577     $layout['settings submit']($form_values['layout_settings'], $display, $layout, $display->layout_settings);
00578   }
00579 
00580   if (isset($form_values['display_title']['title'])) {
00581     $display->title = $form_values['display_title']['title'];
00582     $display->hide_title = $form_values['display_title']['hide_title'];
00583   }
00584 
00585   if ($form_values['op'] == $finish || $form_values['op'] == t('Save')) {
00586     $display->layout_settings = $form_values['layout_settings'];
00587     $display->panel_settings = $form_values['panel_settings'];
00588 
00589     panels_save_display($display);
00590     drupal_set_message("Your layout settings have been saved.");
00591     if ($form_values['op'] != $finish) {
00592       // This forces us to come back here if they hit Save.
00593       $_REQUEST['destination'] = $_GET['q'];
00594     }
00595     if (empty($destination)) {
00596       return $display;
00597     }
00598     return $destination;
00599   }
00600 }

Here is the call graph for this function:

panels_edit_layout_settings_form_validate ( form_id,
form_values,
form 
)

Definition at line 562 of file display_edit.inc.

References panels_panel_settings_validate().

00562                                                                                   {
00563   list($display, $finish, $destination) = $form_values['variables'];
00564   panels_panel_settings_validate($form_id, $form_values, $form);
00565   $layout = $form_values['layout'];
00566   if (!empty($layout['settings validate']) && function_exists($layout['settings validate'])) {
00567     $layout['settings validate']($form_values['layout_settings'], $form['layout_settings'], $display, $layout, $display->layout_settings);
00568   }
00569 }

Here is the call graph for this function:

panels_get_pane_edit_form ( pane,
contexts,
parents 
)

Display the edit form for a pane.

Parameters:
$pane The pane to edit.
$parents The form api parents array that this subform will live in.

Definition at line 610 of file display_edit.inc.

00610                                                                {
00611   return panels_ct_get_edit_form($pane->type, $pane->subtype, $contexts, $pane->configuration, $parents);
00612 }

panels_panel_settings_submit ( form_id,
form_values 
)

Definition at line 1562 of file display_edit.inc.

References panels_common_cache_clear().

Referenced by panels_edit_layout_settings_form_submit().

01562                                                               {
01563   panels_common_cache_clear('style_settings', $form_values['panel_settings']['did']);
01564 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_panel_settings_validate ( form_id,
form_values,
form 
)

ends PanelsAjax group

Definition at line 1557 of file display_edit.inc.

References panels_common_cache_get().

Referenced by panels_edit_layout_settings_form_validate().

01557                                                                        {
01558   $settings = panels_common_cache_get('style_settings', $form_values['panel_settings']['did']);
01559   form_set_value($form['panel_settings']['style_settings'], $settings);
01560 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_show_pane ( display,
pane,
left_buttons,
buttons,
skin = TRUE 
)

Render a single pane in the edit environment.

Parameters:
$pane The pane to render.
$left_buttons Buttons that go on the left side of the pane.
$buttons Buttons that go on the right side of the pane.
$skin If true, provide the outside div. Used to provide an easy way to get just the innards for ajax replacement

Definition at line 628 of file display_edit.inc.

References _panels_render_preview_pane_disabled(), panels_get_content_type(), and panels_get_pane_title().

Referenced by panels_content_config_add_form_submit(), and theme_panels_edit_display().

00628                                                                                   {
00629   $content_type = panels_get_content_type($pane->type);
00630   $block = new stdClass();
00631   if (empty($content_type)) {
00632     $block->title = '<em>' . t('Missing content type') . '</em>';
00633     $block->content = t('This pane\'s content type is either missing or has been deleted. This pane will not render.');
00634   }
00635   elseif (function_exists($content_type['editor render callback'])) {
00636     $block = $content_type['editor render callback']($display, $pane);
00637   }
00638   else {
00639     $block = _panels_render_preview_pane_disabled($pane, $display->context);
00640   }
00641 
00642   // This is just used for the title bar of the pane, not the content itself.
00643   // If we know the content type, use the appropriate title for that type,
00644   // otherwise, set the title using the content itself.
00645   $title = !empty($content_type) ? panels_get_pane_title($pane, $display->context) : $block->title;
00646   $output = theme('panels_pane_dnd', $block, $pane->pid, $title, $left_buttons, $buttons);
00647   if ($skin) {
00648     $class = 'panel-pane' . ($pane->shown ? '' : ' hidden-pane');
00649     $output = '<div class="' . $class . '" id="panel-pane-' . $pane->pid . '">' . $output . '</div>';
00650   }
00651   return $output;
00652 }

Here is the call graph for this function:

Here is the caller graph for this function:

theme_panels_dnd ( content  ) 

Definition at line 1685 of file display_edit.inc.

01685                                     {
01686   $output = "<div class=\"panels-dnd\" id=\"panels-dnd-main\">$content</div>";
01687   return $output;
01688 }

theme_panels_edit_display ( form  ) 

Theme the form for editing display content.

Parameters:
array $form A structured FAPI $form array.
Returns:
string $output HTML ready to be rendered. Note that the html produced here should be printed, not returned, as it bypasses block rendering. Block rendering must be bypassed because sidebars created using negative margins break ajax drag-and-drop.

Definition at line 190 of file display_edit.inc.

References _panels_js_files(), panels_get_layout(), panels_get_panels(), panels_render_layout(), and panels_show_pane().

00190                                           {
00191   _panels_js_files();
00192   $display = $form['panels_display']['#value'];
00193   $layout = panels_get_layout($display->layout);
00194   $layout_panels = panels_get_panels($layout, $display);
00195   $save_buttons = drupal_render($form['submit']) . drupal_render($form['cancel']);
00196 
00197   foreach ($layout_panels as $panel_id => $title) {
00198     foreach ((array) $display->panels[$panel_id] as $pid) {
00199       $pane = $display->content[$pid];
00200       $left_buttons = NULL;
00201       $buttons = drupal_render($form['button'][$pid]['configure']);
00202       if (!empty($form['button'][$pid]['cache'])) {
00203         $buttons .= drupal_render($form['button'][$pid]['cache']);
00204       }
00205       $buttons .= drupal_render($form['button'][$pid]['show_hide']);
00206       $buttons .= drupal_render($form['button'][$pid]['delete']);
00207       $content[$pane->panel] .= panels_show_pane($display, $pane, $left_buttons, $buttons);
00208     }
00209     $content[$panel_id] = theme('panels_panel_dnd', $content[$panel_id], $panel_id, $title, drupal_render($form['panels'][$panel_id]['add']));
00210   }
00211   $output .= drupal_render($form);
00212   $output .= theme('panels_dnd', panels_render_layout($layout, $content, '', $display->layout_settings));
00213   $output .= $save_buttons;
00214   return $output;
00215 }

Here is the call graph for this function:

theme_panels_hidden (  ) 

This is separate because it must be outside the <form> to work, and everything in the form theme is inside the form.

Definition at line 1727 of file display_edit.inc.

References panels_get_path().

01727                                {
01728   $close_text     = t('Close Window');
01729   $close_image    = theme('image', panels_get_path('images/icon-delete.png'), t('Close window'), t('Close window'));
01730   $throbber_image = theme('image', panels_get_path('images/throbber.gif'), t('Loading...'), t('Loading'));
01731   $output         = <<<EOF
01732 <div class="panels-hidden">\n
01733   <div id="panels-modal">\n
01734     <div class="panels-modal-content">\n
01735        <div class="modal-header">\n
01736          <a class="close" href="#">$close_text $close_image</a>\n
01737          <span class="modal-title">&nbsp;</span>\n
01738        </div>\n
01739        <div class="modal-content">\n
01740        </div>\n
01741     </div>\n
01742   </div>\n
01743   <div id="panels-throbber">\n
01744     <div class="panels-throbber-wrapper">
01745       $throbber_image\n
01746     </div>
01747   </div>\n
01748 </div>\n
01749 EOF;
01750 
01751   return $output;
01752 }

Here is the call graph for this function:

theme_panels_pane_collapsible ( block  ) 

Definition at line 1716 of file display_edit.inc.

01716                                                {
01717   $output .= '<h2 class="title">' . $block->title . '</h2>';
01718   $output .= '<div class="content">' . filter_xss_admin($block->content) . '</div>';
01719   return $output;
01720 }

theme_panels_pane_dnd ( block,
id,
label,
left_buttons = NULL,
buttons = NULL 
)

Definition at line 1696 of file display_edit.inc.

01696                                                                                            {
01697   if (!$block->title) {
01698     $block->title = t('No title');
01699   }
01700   static $count = 0;
01701   $output .= "<div class=\"grabber\">";
01702   if ($buttons) {
01703     $output .= "<span class='buttons'>$buttons</span>";
01704   }
01705   if ($left_buttons) {
01706     $output .= "<span class='left_buttons'>$left_buttons</span>";
01707   }
01708   $output .= "<span class=\"text\">$label</span></div>";
01709   $output .= '<div class="panel-pane-collapsible">';
01710   $output .= theme('panels_pane_collapsible', $block);
01711   $output .= '</div>';
01712   return $output;
01713 }

theme_panels_panel_dnd ( content,
region,
label,
footer 
)

Definition at line 1691 of file display_edit.inc.

01691                                                                     {
01692   return "<div class=\"panels-display\" id=\"panel-pane-$region\">$footer<h2 class=\"label\">$label</h2>$content</div>";
01693 }


Generated on Thu Jul 29 05:00:16 2010 for Panels 2 by  doxygen 1.5.6