Closed (won't fix)
Project:
Printer, email and PDF versions
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
2 Oct 2009 at 18:10 UTC
Updated:
18 Dec 2019 at 22:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Scott Reynolds commentedUpdated patch.. probably not really usable ...
Comment #2
jcnventuraThere's no difference between the two patches.. Maybe you've selected the wrong upload?
Comment #3
Scott Reynolds commentedHeres 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.
Comment #4
jcnventuraI 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
Comment #5
Scott Reynolds commentedfor 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)
Comment #6
jcnventuraI 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
Comment #7
Scott Reynolds commentedwithout 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.
Comment #8
Scott Reynolds commentedHeres what #3 looked like for me: http://skitch.com/supermanscott/ndgm7/share-mail
Comment #9
jcnventuraDid 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.Comment #10
jcnventuraI'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.
Comment #11
jcnventuraIf someone makes this work without having to change the path, please reopen and provide a patch.
Comment #12
tostinni commentedFor those interested in this, here is a patch for the 7.x-1.2 branch.
Comment #13
lukio commentedHello.
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.
Comment #14
lukio commentedI forgot, that I have to delete some lines that it doesn't need because it's at core module now.
Upload again.
Comment #15
lukio commentedSorry. Upload again. Last I hope!
Comment #16
lukio commentedNow, when send the email, appears a new modal with the drupal_set_message and close button.
Comment #17
Advin commentedThanks 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?
Comment #18
tostinni commentedMy 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/123where 123 is the node id.Doing so you can email the node without leaving the view, it's pretty rough but serves us well.
Comment #19
Advin commentedThank 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 =)
Comment #20
lukio commentedAdvin,
check my patch #16. it's based on #12 and solved that problem.
Comment #21
idebr commented#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
Comment #22
idebr commentedIn addition to #22, still patch provides a no-js fallback
Comment #23
pancho29 commentedI upload the patch update for version 7.x-2.2.