Guys, I've written ctools context for webform submissions, it is useful for overriding submission page using panels.
please review and let me know your feedback.
I'm using Page manager existing pages to override submission page.

Comments

sharique’s picture

StatusFileSize
new3.11 KB

Here is the patch, build against 3.x branch.

sharique’s picture

Title: Ctools context for webform submission - please review » Ctools context and panel page for webform submission patch
Version: 7.x-3.18 » 7.x-3.x-dev
Issue tags: ++patch
StatusFileSize
new9.75 KB

I also added panel page (ctools task) for webform submissions, so you don't need pm_existing pages module any more. please review.

rajiv.singh’s picture

Looks good to me

quicksketch’s picture

Version: 7.x-3.x-dev » 7.x-4.x-dev
Status: Needs review » Needs work

I don't regularly use Panels, so I'm not super-keen on including this in the main module.

This bit of code seems rather hackish, shouldn't there be a way to get information without using arg() here? And combining everything into $data->{$component['form_key']} won't work because form keys are not unique, they're allowed to duplicate as long as they're on different pages or fieldsets.

+    $nid = arg(1);
+    $sid = arg(3);
+
+    $submission = webform_get_submission($nid, $sid);
+    $node = node_load($nid);
+    $components = $node->webform['components'];
+    $page_count = 1;
+    _webform_components_tree_build($components, $component_tree, 0, $page_count);
+
+    $data = new stdClass();
+
+    // Make sure at least one field is available
+    if (isset($component_tree['children'])) {
+      // Recursively add components to the form.
+      foreach ($component_tree['children'] as $cid => $component) {
+        $data->{$component['form_key']} = $submission->data[$cid]['value'][0];
+      }
+    }
+    $data->nid = $nid;
+    $data->sid = $sid;

This kind of use of GLOBALs and variables isn't going to fly either:

+function webform_webform_submission_view_enable($cache, $status) {
+  variable_set('webform_webform_submission_view_disabled', $status);
+
+  // Set a global flag so that the menu routine knows it needs
+  // to set a message if enabling cannot be done.
+  if (!$status) {
+    $GLOBALS['webform_webform_submission_view_disabled'] = TRUE;
+  }
+}
sharique’s picture

I'm also newbee at panels coding, I just copied over node_view task and done changes according requirements.

sharique’s picture

Status: Needs work » Needs review
StatusFileSize
new9.78 KB

Here is updated patch. I only able to use if GLOBALs, it getting nid,sid in $data hence not able to remove arg().

quicksketch’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

I've been using Panels more regularly recently, but from the looks of this patch, this isn't code that I'd be comfortable maintaining within the project. I don't really understand what this code is doing (possibly due to Panels/Page Manager rather than this code itself) so I'd rather see this live as a stand-alone project for the time being. Even though I'm using Panels on almost every project these days, and I use Webform on every project, the need to combine both of them isn't a scenario I've encountered. So I hope I'm not over-extrapolating my individual experience here, but for me the maintenance cost compared to the reward aren't in balance.

I'm open to reconsideration. But this doesn't look like a good fit for the main project to me.