Skip to content
Browse files

IPE works!!!!

  • Loading branch information...
1 parent fd40677 commit ffcde187d0cbb46f9528b420fdce088c60da1063 @merlinofchaos merlinofchaos committed Oct 7, 2010
View
10 includes/plugins.inc
@@ -406,11 +406,6 @@ function panels_get_renderer_handler($plugin, &$display) {
* Choose a renderer for a display based on a render pipeline setting.
*/
function panels_get_renderer($pipeline_name, &$display) {
- // If operating in legacy mode, only the legacy renderer is available:
- if (variable_get('panels_legacy_rendering_mode', TRUE)) {
- return panels_get_renderer_handler('legacy', $display);
- }
-
// Load the pipeline
ctools_include('export');
$pipeline = ctools_export_crud_load('panels_renderer_pipeline', $pipeline_name);
@@ -468,11 +463,6 @@ function _panels_renderer_pipeline_sort($a, $b) {
* sorting. Descriptions are left in.
*/
function panels_get_renderer_pipelines($sort = TRUE) {
- // If operating in legacy mode, only the legacy renderer is available:
- if (variable_get('panels_legacy_rendering_mode', TRUE)) {
- return array();
- }
-
ctools_include('export');
$pipelines = ctools_export_crud_load_all('panels_renderer_pipeline');
if ($sort) {
View
2 panels_ipe/css/panels_ipe.css
@@ -172,7 +172,7 @@ div#panels-ipe-control-container {
background-color: #000;
padding: 0.5em 1em;
min-width: 9.5em;
- max-width: 12.5em;
+ max-width: 14.5em;
min-height: 2em;
max-height: 2.5em;
-moz-border-radius-topleft:5px;
View
137 panels_ipe/js/panels_ipe.js
@@ -27,37 +27,9 @@ $(function() {
});
});
-Drupal.behaviors.PanelsIPE = function(context) {
- Drupal.PanelsIPE.bindClickDelete(context);
-};
-
-Drupal.CTools.AJAX.commands.initIPE = function(data) {
- if (Drupal.PanelsIPE.editors[data.key]) {
- Drupal.PanelsIPE.editors[data.key].initEditing(data.data);
- }
-};
-
-Drupal.CTools.AJAX.commands.unlockIPE = function(data) {
- if (confirm(data.message)) {
- var ajaxOptions = {
- type: "POST",
- url: data.break_path,
- data: { 'js': 1 },
- global: true,
- success: Drupal.CTools.AJAX.respond,
- error: function(xhr) {
- Drupal.CTools.AJAX.handleErrors(xhr, ipe.cfg.formPath);
- },
- dataType: 'json'
- };
-
- $.ajax(ajaxOptions);
- };
-};
-
-Drupal.CTools.AJAX.commands.endIPE = function(data) {
- if (Drupal.PanelsIPE.editors[data.key]) {
- Drupal.PanelsIPE.editors[data.key].endEditing(data);
+Drupal.behaviors.PanelsIPE = {
+ attach: function(context) {
+ Drupal.PanelsIPE.bindClickDelete(context);
}
};
@@ -114,37 +86,28 @@ function DrupalPanelsIPE(cache_key, cfg) {
});
$('.panels-ipe-form-container', ipe.control).append(formdata);
- // bind ajax submit to the form
- $('form', ipe.control).submit(function(event) {
- url = $(this).attr('action');
- try {
- var ajaxOptions = {
- type: 'POST',
- url: url,
- data: { 'js': 1 },
- global: true,
- success: Drupal.CTools.AJAX.respond,
- error: function(xhr) {
- Drupal.CTools.AJAX.handleErrors(xhr, url);
- },
- dataType: 'json'
+
+ $('input:submit:not(.ajax-processed)', ipe.control).addClass('ajax-processed').each(function() {
+ var element_settings = {};
+
+ element_settings.url = $(this.form).attr('action');
+ element_settings.setClick = true;
+ element_settings.event = 'click';
+ element_settings.progress = { 'type': 'throbber' };
+
+ var base = $(this).attr('id');
+ Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
+ if ($(this).attr('id') == 'panels-ipe-save') {
+ Drupal.ajax[base].options.beforeSerialize = function (element_settings, options) {
+ ipe.saveEditing();
+ return Drupal.ajax[base].beforeSerialize(element_settings, options);
};
- $(this).ajaxSubmit(ajaxOptions);
}
- catch (err) {
- alert("An error occurred while attempting to process " + url);
- return false;
+ if ($(this).attr('id') == 'panels-ipe-cancel') {
+ Drupal.ajax[base].options.beforeSend = function () {
+ return ipe.cancelEditing();
+ };
}
- return false;
- });
-
- $('input:submit', ipe.control).each(function() {
- if ($(this).val() == 'Save') {
- $(this).click(ipe.saveEditing);
- };
- if ($(this).val() == 'Cancel') {
- $(this).click(ipe.cancelEditing);
- };
});
// Perform visual effects in a particular sequence.
@@ -168,9 +131,6 @@ function DrupalPanelsIPE(cache_key, cfg) {
};
this.saveEditing = function() {
- // Put our button in.
- this.form.clk = this;
-
$('div.panels-ipe-region', ipe.topParent).each(function() {
var val = '';
var region = $(this).attr('id').split('panels-ipe-regionid-')[1];
@@ -183,14 +143,11 @@ function DrupalPanelsIPE(cache_key, cfg) {
val += id;
}
});
- $('input#edit-panel-pane-' + region, ipe.control).val(val);
+ $('input[name="panel[pane][' + region + ']"]', ipe.control).val(val);
});
}
this.cancelEditing = function() {
- // Put our button in.
- this.form.clk = this;
-
if (ipe.topParent.hasClass('changed')) {
ipe.changed = true;
}
@@ -233,9 +190,20 @@ function DrupalPanelsIPE(cache_key, cfg) {
this.createSortContainers();
+ var element_settings = {
+ url: ipe.cfg.formPath,
+ event: 'click',
+ keypress: false,
+ // No throbber at all.
+ progress: { 'type': 'none' }
+ };
+
+ Drupal.ajax['ipe-ajax'] = new Drupal.ajax('ipe-ajax', $('div.panels-ipe-startedit', this.control).get(0), element_settings);
+
+/*
var ajaxOptions = {
type: "POST",
- url: ipe.cfg.formPath,
+ url: ,
data: { 'js': 1 },
global: true,
success: Drupal.CTools.AJAX.respond,
@@ -249,6 +217,41 @@ function DrupalPanelsIPE(cache_key, cfg) {
var $this = $(this);
$.ajax(ajaxOptions);
});
+ */
};
+$(function() {
+ Drupal.ajax.prototype.commands.initIPE = function(ajax, data, status) {
+ if (Drupal.PanelsIPE.editors[data.key]) {
+ Drupal.PanelsIPE.editors[data.key].initEditing(data.data);
+ }
+ };
+
+ Drupal.ajax.prototype.commands.unlockIPE = function(ajax, data, status) {
+ if (confirm(data.message)) {
+ var ajaxOptions = {
+ type: "POST",
+ url: data.break_path,
+ data: { 'js': 1 },
+ global: true,
+ success: Drupal.CTools.AJAX.respond,
+ error: function(xhr) {
+ Drupal.CTools.AJAX.handleErrors(xhr, ipe.cfg.formPath);
+ },
+ dataType: 'json'
+ };
+
+ $.ajax(ajaxOptions);
+ };
+ };
+
+ Drupal.ajax.prototype.commands.endIPE = function(ajax, data, status) {
+ if (Drupal.PanelsIPE.editors[data.key]) {
+ Drupal.PanelsIPE.editors[data.key].endEditing(data);
+ }
+ };
+
+
+});
+
})(jQuery);
View
7 panels_ipe/panels_ipe.module
@@ -141,7 +141,7 @@ function panels_ipe_get_cache_key($key = NULL) {
*
* @param unknown_type $main
*/
-function panels_ipe_footer($main = 0) {
+function panels_ipe_page_alter(&$page) {
$key = panels_ipe_get_cache_key();
if (!isset($key)) {
return;
@@ -155,5 +155,8 @@ function panels_ipe_footer($main = 0) {
$output .= "</div>";
$output .= "<div class='panels-ipe-form-container panels-ipe-on clearfix'</div>";
$output .= "</div></div>";
- return $output;
+
+ $page['page_bottom']['panels_ipe'] = array(
+ '#markup' => $output,
+ );
}
View
27 panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
@@ -43,7 +43,13 @@ function add_meta() {
drupal_add_js(array('PanelsIPECacheKeys' => array($this->clean_key)), 'setting');
drupal_add_js(array('PanelsIPESettings' => array($this->clean_key => $settings)), 'setting');
- jquery_ui_add(array('ui.draggable', 'ui.droppable', 'ui.sortable'));
+ drupal_add_library('system', 'ui.draggable');
+ drupal_add_library('system', 'ui.droppable');
+ drupal_add_library('system', 'ui.sortable');
+// drupal_add_js('misc/ui/jquery.ui.draggable.min.js');
+// drupal_add_js('misc/ui/jquery.ui.droppable.min.js');
+// drupal_add_js('misc/ui/jquery.ui.sortable.min.js');
+// jquery_ui_add(array('ui.draggable', 'ui.droppable', 'ui.sortable'));
parent::add_meta();
}
@@ -95,7 +101,7 @@ function render_pane_content(&$pane) {
*/
function render_region($region_id, $panes) {
// Generate this region's 'empty' placeholder pane from the IPE plugin.
- $empty_ph = theme('panels_ipe_placeholder_pane', array('region_id' => $region_id, 'region_title' => $this->plugins['layout']['panels'][$region_id]));
+ $empty_ph = theme('panels_ipe_placeholder_pane', array('region_id' => $region_id, 'region_title' => $this->plugins['layout']['regions'][$region_id]));
// Wrap the placeholder in some guaranteed markup.
$panes['empty_placeholder'] = '<div class="panels-ipe-placeholder panels-ipe-on panels-ipe-portlet-marker panels-ipe-portlet-static">' . $empty_ph . "</div>";
@@ -146,18 +152,18 @@ function ajax_save_form($break = NULL) {
);
$output = drupal_build_form('panels_ipe_edit_control_form', $form_state);
- if ($output) {
+ if (empty($form_state['executed'])) {
// At this point, we want to save the cache to ensure that we have a lock.
panels_edit_cache_set($this->cache);
$this->commands[] = array(
'command' => 'initIPE',
'key' => $this->clean_key,
- 'data' => $output,
+ 'data' => drupal_render($output),
);
return;
}
- // no output == submit
+ // Otherwise it was submitted.
if (!empty($form_state['clicked_button']['#save-display'])) {
// Saved. Save the cache.
panels_edit_cache_save($this->cache);
@@ -185,8 +191,8 @@ function command_update_pane($pid) {
$pane = $this->display->content[$pid];
}
- $this->commands[] = ctools_ajax_command_replace("#panels-ipe-paneid-$pane->pid", $this->render_pane($pane));
- $this->commands[] = ctools_ajax_command_changed("#panels-ipe-display-{$this->clean_key}");
+ $this->commands[] = ajax_command_replace("#panels-ipe-paneid-$pane->pid", $this->render_pane($pane));
+ $this->commands[] = ajax_command_changed("#panels-ipe-display-{$this->clean_key}");
}
/**
@@ -202,15 +208,15 @@ function command_add_pane($pid) {
ctools_include('cleanstring');
$region_id = ctools_cleanstring($pane->panel);
- $this->commands[] = ctools_ajax_command_append("#panels-ipe-regionid-$region_id div.panels-ipe-sort-container", $this->render_pane($pane));
- $this->commands[] = ctools_ajax_command_changed("#panels-ipe-display-{$this->clean_key}");
+ $this->commands[] = ajax_command_append("#panels-ipe-regionid-$region_id div.panels-ipe-sort-container", $this->render_pane($pane));
+ $this->commands[] = ajax_command_changed("#panels-ipe-display-{$this->clean_key}");
}
}
/**
* FAPI callback to create the Save/Cancel form for the IPE.
*/
-function panels_ipe_edit_control_form(&$form_state) {
+function panels_ipe_edit_control_form($form, &$form_state) {
$display = &$form_state['display'];
// @todo -- this should be unnecessary as we ensure cache_key is set in add_meta()
// $display->cache_key = isset($display->cache_key) ? $display->cache_key : $display->did;
@@ -246,6 +252,7 @@ function panels_ipe_edit_control_form(&$form_state) {
);
$form['buttons']['cancel'] = array(
'#type' => 'submit',
+ '#id' => 'panels-ipe-cancel',
'#value' => t('Cancel'),
);
return $form;
View
2 plugins/layouts/flexible/flexible-admin.js
@@ -382,7 +382,7 @@ $(function() {
* Provide an AJAX response command to fix the first/last bits of a
* group.
*/
- Drupal.ajax.prototype.flexible_fix_firstlast = function(ajax, data, status) {
+ Drupal.ajax.prototype.commands.flexible_fix_firstlast = function(ajax, data, status) {
$(data.selector + ' > div > .' + data.base)
.removeClass(data.base + '-first')
.removeClass(data.base + '-last');
View
5 plugins/task_handlers/panel_context.inc
@@ -279,11 +279,6 @@ function panels_panel_context_render($handler, $base_contexts, $args, $test = TR
// With an argument, this actually sets the display.
panels_get_current_page_display($display);
- // Handle backward compatibility with the IPE checkbox.
- if (empty($handler->conf['pipeline'])) {
- $handler->conf['pipeline'] = !empty($handler->conf['use_ipe']) ? 'ipe' : 'standard';
- }
-
$renderer = panels_get_renderer($handler->conf['pipeline'], $display);
$info = array(

0 comments on commit ffcde18

Please sign in to comment.
Something went wrong with that request. Please try again.