Needs work
Project:
Pdfview
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
3 Jun 2004 at 16:31 UTC
Updated:
21 Aug 2006 at 10:04 UTC
Jump to comment: Most recent file
It isn't possible (at least in my installation) to decide which node types should be offered as pdf documents. This is clearly vital (especially concerning the PHP code issue) and the module is not really useful for production environments without it.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | pdfview_0.diff | 4.89 KB | motou |
| #5 | pdfview.diff | 4.21 KB | motou |
| #3 | pdfview_1.module | 8.76 KB | motou |
| #2 | pdfview.install | 651 bytes | motou |
| #1 | pdfview_0.module | 6.2 KB | motou |
Comments
Comment #1
motou commentedThis feature is here endly.....
I implemented a per node customizable PDF setting, which enables a user to choose if a node shows a "download pdf" link.
Hope you can enjoy it!
Comment #2
motou commentedand also a .install file.
Comment #3
motou commentedsorry, the file above is a wrong version. Here comes the right one.
Comment #4
Egon Bianchet commentedCan you provide a patch? See http://drupal.org/patch
Comment #5
motou commentedThanks for the tip!
My patch for pdfview.module is in the attatchment.
Comment #6
Egon Bianchet commentedI like the idea, but we have to work a bit more on it before I'll commit it.
I think there should be some rework of the choices in the content type settings. It should look this way:
Pdf dowload:
- Disabled
- Enabled for all nodes
- Enabled per node: defaults to disabled
- Enabled per node: defaults to enabled
The new setting should take care of the path too (node/x/pdf), not just of the link, or it would be possible to get pdf output for nodes even if the link is disabled.
So the term "showlink" should be dropped in favor of "pdf output" or something like that. The table "pdfview" should become "pdfview_nid" or "node_pdfview".
The function
pdfview_show_per_node($node)should be inhook_nodeapi, case 'load'; it should set a field like$node->pdfview_linkinstead of 'showlink';You must leave the
// $Idheader as it is ... CVS needs itWhat's the reason for the new headers? Maybe it deserves it's own issue + patch
Why not using just an update query in nodeapi case 'update'?
Why the first update in the install file?
That's it, thanks! :-)
Comment #7
motou commentedEgon Bianchet, your suggestion is great. I made the patch in that way 'cause in the mambo/joomla one can enable a link on a page in that way. :) In the fact, because the feature is not implemented for a while, but one of my projects really needs it. So I made the patch.
In my opinion, the second choice seems not necessary. Maybe you mean, there is no need to show pdf setting while editing a node with that setting?
You're right. It's an important secrity problem too. Problem is, what should Drupal show if an user types "node/x/pdf" when the pdf output of that node is disabled? A "Page not found" page?
I am not so familiar with the function hook_nodeapi. but thanks for the tip.
The using of new header is just because my bad habits of file organisation. I have different versions of pdfview.module, if i don't change the header, i don't know which file is the file I edited.
what is that for? I didn't know it before. But if it makes the module beautiful-looking. I will try it.
For the per node setting, one needs a DB table. Since i think one can use the .install file to add some tables for the normal user, i did it. That was also the only autonomy way I knew.
Comment #8
Egon Bianchet commentedExactly. Perhaps it could have just three options ('No pdf output', 'pdf output disabled by default', 'pdf output enabled by default') and use an access permission to discriminate between users who can change the pdf setting while editing the node and users who can't.
If the access restriction is placed the menu hook using the menu api, it should automatically show a "403 Forbidden" page.
http://api.drupal.org/api/4.7/function/hook_menu
http://api.drupal.org/api/4.7/function/hook_nodeapi
About the install file, I think that the first update isn't needed ...
Comment #9
motou commentedsuddenly i find it a little bit strange, when people need the option "No PDF output", why do they install this module? :)
Comment #10
Egon Bianchet commentedThey might need pdf output for stories but not for images ;-)
Comment #11
motou commentedOK. This time i have changed some code in the module, and also the table. I hope that makes egon happier. :)
changes:
* hook_nodeapi() with case 'load':
* access denied is done in pdfview_node_controller()
* table now is called "node_pdfview"
not changed:
* the three options. I still think it may make no sense if we add an option "totally disabled".