Comments

Scott Reynolds’s picture

Status: Needs review » Needs work
StatusFileSize
new1.9 KB

Updated patch.. probably not really usable ...

jcnventura’s picture

There's no difference between the two patches.. Maybe you've selected the wrong upload?

Scott Reynolds’s picture

Status: Needs work » Needs review
StatusFileSize
new4.29 KB

Heres a updated patch that works with and without CTools.

Changes the all the links though to use "nojs", so almost seems silly not to use CTools at that point. If you want to put the email form in the modal you have to give the links a class ctools-use-modal. Again, it works without adding that class, just won't use a modal.

This works only for print_mail.

jcnventura’s picture

Status: Needs review » Needs work
StatusFileSize
new1.98 KB

I can't get it to work.. I have added the attached (slightly simplified) code and changed the link class to ctools-use-modal. I never got it to show up in a modal box...

João

Scott Reynolds’s picture

Status: Needs work » Needs review

for obvious reasons...

You need the change in hook_menu().

$js comes from CTools. Its not simplified its butchered...

Plz review #3

edit: and you need to clear your caches (your menu cache)

jcnventura’s picture

Status: Needs review » Needs work
StatusFileSize
new2.35 KB

I had tried #3, and never got it to work..

Indeed #4 was butchered beyond help, I uploaded the wrong version, sorry. That was my attempt at cutting down all the unnecessary crap to figure out the problem, but indeed I removed too much.

The version which I meant to upload is attached. It doesn't work for me, but I see no reason why #3 would work for you and not this one, which should have the bonus of working fine with or without Ctools, without adding the ugly 'nojs' path.

João

Scott Reynolds’s picture

without adding the ugly 'nojs' path. you need this so it will function with JS turned off. If you have CTools and the user doesn't have JavaScript turned on, the links will fail...

Furthermore, your patch doesn't add the nojs to the links, so the %ctools_js never gets loaded and validated.

The nojs is REQUIRED for this to work.

Scott Reynolds’s picture

Heres what #3 looked like for me: http://skitch.com/supermanscott/ndgm7/share-mail

jcnventura’s picture

Did you try my patch?

I get the same result with my patch, as with yours. That is, I see absolutely no difference in having this code there. They're both not working as expected, and simply display the form in a regular browser window. There must be something missing, and I suspect it must be some ctools javascript in the header.

Looking at the code you provided, the nojs only gets inserted into Drupal's menu system if ctools is not around, so I am pretty sure nojs is not really needed. I have validated my patch without ctools (and with) and the menu system works perfectly in choosing the handler function and displaying the form. Unless there's some ctools javascript rewriting the urls from nojs to something else, but then again, this code doesn't make it active on the original page.

Which version of ctools are you using? In my tests I was using 6.x-1.0.

PS: Now that I've released 6.x-1.9, none of the patches apply cleanly, but it's a simple matter to remove the
'access callback' => '_print_mail_access', line before applying the patch and to add it back afterwards.

jcnventura’s picture

Title: CTools Modal integration » Send by email modal form dialog using ctools
Assigned: Scott Reynolds » Unassigned
Category: task » feature
Status: Needs work » Needs review
StatusFileSize
new5.56 KB

I've finally made it work... Indeed the 'ugly nojs' is needed, along with a few includes which weren't in the original patch and the 'ctools-use-modal' class in the link.

However, still not sure if I want to integrate this in the module. Especially for 7.x-2.x, having to add the 'nojs' part of the path so that ctools can capture it will break the independence of the print_ui module.

jcnventura’s picture

Status: Needs review » Closed (won't fix)

If someone makes this work without having to change the path, please reopen and provide a patch.

tostinni’s picture

StatusFileSize
new5.63 KB

For those interested in this, here is a patch for the 7.x-1.2 branch.

lukio’s picture

StatusFileSize
new5.68 KB

Hello.

I changed the patch commited by #12 for 7.x-1.2 branch. Now close the modal after click the submit button. The cancel button it's not working yet.

lukio’s picture

StatusFileSize
new5.27 KB

I forgot, that I have to delete some lines that it doesn't need because it's at core module now.

Upload again.

lukio’s picture

StatusFileSize
new5.02 KB

Sorry. Upload again. Last I hope!

lukio’s picture

StatusFileSize
new5.12 KB

Now, when send the email, appears a new modal with the drupal_set_message and close button.

Advin’s picture

Thanks for the patch.
I use print ver. 1.2 and ctools 7.1.2
I applied patch (print_mail-ctools-modal-20121210-16.patch) and /nojs/ section in url apear.
But form don't open in modal.

How to enable modal feature?

tostinni’s picture

My patch in #12 needs you to rewrite the URL for the printmail form.
We used this in a view where we display a bunch of nodes and besides each one we add a field that link to printmail/nojs/123 where 123 is the node id.
Doing so you can email the node without leaving the view, it's pretty rough but serves us well.

Advin’s picture

StatusFileSize
new57.84 KB

Thank You for your answer!
I try to patch fresh module (ver 1.2) with #12. But have some error (screen in attachment).
Can you attach already patched modules (or send me to alekseydv at gmail.com) ?

upd: have no problem when applying #16 patch. But all forms don't open in modal =)

lukio’s picture

Advin,

check my patch #16. it's based on #12 and solved that problem.

idebr’s picture

StatusFileSize
new5.01 KB

#16 gives two errors in 7.x-1.2:
- $title on line 778 is undefined
- modal_forms/nojs/dismiss is not a valid page callback

Attached patch is a rerolled 7.x-1.2 version of #16 with one fix:
- Instead of displaying the status messages in the modal, redirect to the original page and display the status messages there

idebr’s picture

StatusFileSize
new6.88 KB

In addition to #22, still patch provides a no-js fallback

pancho29’s picture

Issue summary: View changes
StatusFileSize
new3.52 KB

I upload the patch update for version 7.x-2.2.