Today I tried to style the comment reply page (comment/reply/%node) as a panel.

How can I override this system path as a panel page? It works for node-view / node-edit but I didn't find a way to overrride the comments reply form.

It tells me, that this path is already used, which is of course correct.

Any ideas?

Comments

ayalon’s picture

StatusFileSize
new4.4 KB

After I realized, that this task is handled in the ctools and not in the panels module, I was able to create a system override for comments reply.

Attached you will find my working file. Copy it to the folder 'ctools/delegator/plugins/tasks' and rename it:

comment_reply.inc

ayalon’s picture

Title: comment/reply/%node as a panel page? » comment/reply/%node as a system task for ctools
Category: support » task
Status: Active » Needs review
StatusFileSize
new4.49 KB

The fallback didn't work as expected. I corrected this:

Take this version

thomasmuirhead’s picture

Hi there,

I was wondering what would need changing to make this work with the page manager rather than delegator?

thanks

thomas

friolator’s picture

thanks for this! I got it working on our site for forum replies (We're using Advanced Forum 6.x-1.0), and the form does actually work. EXCEPT: the page doesn't correctly redirect after posting. that is, you can post a reply to a forum post and the reply winds up in the database, but after hitting submit, you're not taken out of the comment form, the page just reloads with a new comment form.

I don't know if this is handled here, or if it's something in advf or elsewhere. any clues?

thanks!

merlinofchaos’s picture

Status: Needs review » Needs work

This needs to be rerolled for the change from delegator to page manager.

I'm curious about #4. I recall I needed to do some extra work on node edit stuff to get it to forward to the right place, but that was using an actual form context. This doesn't actually supply that.

friolator’s picture

@merlinofchaos: Was the work you needed to do to handle forwarding within delegator/plugins/tasks/node_edit.inc or somewhere else? If i have some time I'll dig through some code to see if I can figure out a way to make this go, but I'm not really sure where to start looking!

Also - I assume that with Advanced Forum 2, which uses node comments, all of this stuff would pretty much just work within Panels, right? Since that's in Alpha now, we're weighing whether or not to give it a shot for a site that's going live in about a month.

Thanks!

merlinofchaos’s picture

The work I did for node_edit was within the context, which is a little different from how this is implemented. That means that I'm not sure it's actually relevant. =(

ayalon’s picture

You are right. The redirect is lost somehow. I was not able to fix that. Does someone has an idea, how this could be solved?

summit’s picture

Subscribing, greetings, Martijn

ekarelin’s picture

i've solved this problem very easily as

function yourmodulename_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
....
case 'comment_form':
$form['#submit'][] = 'youmodulename_comment_form_submit';
break;
....
}

function youmodulename_comment_form_submit($form, &$form_state) {
$form_state['redirect'][0] = 'node/'. $form_state['values']['nid'];
}

merlinofchaos’s picture

Project: Panels » Chaos Tool Suite (ctools)
Version: 6.x-3.x-dev » 6.x-1.x-dev
Component: Panel pages » Page Manager
Category: task » feature

Changing this to a feature request. If this can get cleaned up and made into an actual patch there is a good likelihood that, when it's ready, I'll accept it into CTools so it'd be lovely if someone would work on this.

manarth’s picture

Status: Needs work » Needs review
StatusFileSize
new36.47 KB

Here's a patch against DRUPAL-6--1 branch, which adds:

  • ctools context and argument handlers for cid (loading a comment-object based on the comment ID)
  • ctools content-type for adding arbitrary comments to a panel
  • ctools content-types for using comment context to add comment author, subject, body, etc
  • a page-manager plugin to handle the comment/reply/%node path and provide node and comment contexts
  • a JS auto-complete handler to allow auto-complete against comment titles

The code references a icon_comment.png which isn't in the patch - it'd be great if someone with more artistic talent than I could come up with something :-)

merlinofchaos’s picture

I need to do a full review of this, which will take awhile.

In the meantime:

+	drupal_set_message('loading CONTEXT '.print_r($cid,true));

Those have to go =)

manarth’s picture

StatusFileSize
new36.41 KB

Oops! Take 2...

PI_Ron’s picture

Hi guys.

I'm after a bit of help, Ive applied the patch in #23, and enabled the comment/reply/%node panel. When I click a comments reply link, the page refreshes and I get the message:

The comment you are replying to does not exist.

What is the correct setup for the comment/reply/%node panel?

manarth’s picture

StatusFileSize
new36.65 KB

Hi Tigeda - looks like there was a bug in the code...It was handling replies to other comments, but not new comments directly on the node.

This new patch should fix that.

The steps to install *should* simple be:
- patch the module
- flush caches
- navigate to /admin/build/pages
- click 'Enable' next to the 'comment_reply' entry

PI_Ron’s picture

Hi Manarth,

Thanks for that after reverting ctools and reapplying the patch it works correctly.

Just a couple of questions:

  • When I click delete comment, it says page not found. Not sure if this is common or not. Have you experience it?
  • When I click on parent, same thing 404.
  • Thanks again.

    manarth’s picture

    StatusFileSize
    new39.54 KB

    When I click delete comment, it says page not found"

    I can't reproduce this. If it's still an issue with the attached patch, can you repost with the panel-pane affected, and the panel page it's embedded on?

    When I click on parent, same thing 404"

    I hadn't realised that comment's implementation of hook_links creates a link using arg(0) . '/' . arg(1), which will only work on certain URLs. I've altered that link in the ctools plugin so it points to the correct parent node.

    The new patch:
    - Fixes the URL to the parent comment
    - Adds a "Delete comment" admin link to the pane
    - Adds the option to choose if the comment-links should be displayed (on the "Comment content" pane).
    - Contains various code-cleanup changes (mostly these are better inline comments)

    PI_Ron’s picture

    Hi Manarth,

    The new patch fixed the Parent link url.

    The delete link works as expected, I might of wasted your time a little here, I had a panel comment/delete/%comment that was causing the 404.

    My theme doesnt use any blocks apart from branding up the top, and footer. So everything is within panels. I'm trying to also override the comment/edit/cid and comment/delete/cid pages, I can override them fine, and place a comment form, but I'm not sure that I can pass the comment form a context like the "Comment being replied to" one you provide (for comment edit panel).

    For comment delete, I can override the comment/delete/cid page, but it doesnt delete the comment, and I'm not sure how I can print a system message in a panel (Are you sure you wan't to delete this comment? Yes/No).

    I can just leave them as they are, but it looks devastatingly ugly because everything disappears except the header/footer, and all content is rigt up against the left side of browser window.

    PI_Ron’s picture

    Issue tags: +html

    Bit the bullet and spent the morning converting the site to Panels Everywhere.. awesome stuff!

    wjaspers’s picture

    Issue tags: -html

    subbing. Would like to see in 7 as well.

    cartagena’s picture

    Also interested in D7 version...thank you!

    guybedford’s picture

    Yeah a d7 version is a really necessary complement for overriding the node pages with panels. I thought I didn't need this page, until comments had validation errors and they redirect to this url, which isn't a pretty sight!

    pwaterz’s picture

    Drupal 7 patch here. Not as elaborate as the patch above, but gets the job done http://drupal.org/node/1693352

    summit’s picture

    Wouldn't it be fine to have one patch for this please? greetings, Martijn

    pwaterz’s picture

    One patch for what? D6 and D7?

    summit’s picture

    D7 the same as D6. It says the one for D7 is not as elaborate as the patch above. Would be great if the quality of the patch for D6 and 7 is the same.
    Sorry if I was not clear on that remark.

    greetings, Martijn

    pwaterz’s picture

    The api is different in 7. This d6 patch attempts to completely abstract the comment reply page. By having a ctools content type for every component of the comment reply page. My patch just offers a ctool content type that give you the output of the comment reply form and allows you to make the comment/reply a panel page. Personally I dont think the level of abstraction is necessary. All the is really needed is the ctool task and the full form. If a person wants more abstraction they can write some very simple ctools content types.

    pwaterz’s picture

    In addition, I think it make sense to get this patch worked out as it. And see if users request more functionality. No sense in wasting time on something no one uses.

    japerry’s picture

    Issue summary: View changes
    Status: Needs review » Closed (outdated)

    Closing this issue as outdated as Drupal 6 ctools is not supported. If this issue is relevant for Drupal 7, feel free to re-open and mark for Drupal 7 (or 8)