Thank you for taking the time to review the module described below. Please let me know if you have any questions or need for me to make changes.
This is a Drupal 6 module that creates links to send emails with PDFs attached. 'Email this page as PDF' links can be added to multiple pages via a single template. This module has two levels of access. Administrators of the site can set up a templates which let users send a pre-defined PDF copy of a page. For users of the site, they are able to send a personalized message along with the PDF copy, as well as send a copy to themselves.
While the Print module also includes email and PDF versions that can be added to pages, this module allows administrators to have more control over the layout and design of the PDF copy that's emailed, or attach a completely separate PDF. It also allows administrators to add an Email prefix message to be included with the email, which cannot be changed or removed by the user.
Link to project page: http://drupal.org/sandbox/ClinicalTools/1444242
Git clone: git clone --branch 6.x-1.x http://git.drupal.org/sandbox/ClinicalTools/1444242.git email_pdfs
Reviews of other projects:
http://drupal.org/node/1753688#comment-6799102
http://drupal.org/node/1353778#comment-6799182
http://drupal.org/node/1236914#comment-6799300
http://drupal.org/node/1838490#comment-6824214
http://drupal.org/node/1859934#comment-6824234
http://drupal.org/node/1852590#comment-6824292
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | emailpdfs.txt | 7.23 KB | furamag |
Comments
Comment #1
furamag commentedReview of the 6.x branch:
1. I attached automated report generated with PAReview.sh.
2. There are files in master branch. You should replace them as described in http://drupal.org/node/1127732 at step 5.
3. Errors:
Error while installation:
warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'content_copy_import_form' was given in \includes\form.inc on line 377.
Node view and edit pages errors:
user warning: Table 'content_field_email_pdf_add_link' doesn't exist query: SELECT n.nid FROM content_field_email_pdf_add_link cfe JOIN node n ON cfe.nid=n.nid WHERE cfe.field_email_pdf_add_link_nid=1 AND n.status=1 in \sites\all\modules\email_pdfs\email_pdfs.module on line 157.
4. I wasn't able to use that module. I didn't find a way to add 'Email this page as PDF' links to any page. Also there are no items in "Default template" field on Email PDFs settings page. I can see only "none".
Comment #2
furamag commentedComment #3
maxtorete commentedYou should replace the git URI from first post with the public one (git clone http://git.drupal.org/sandbox/ClinicalTools/1444242.git email_pdfs)
On function email_pdfs_link_template($nid)
if submit_text will be presented to user, it should be passed throught t(), so it could be translated.
The same for function email_pdfs_uninstall() line:
And same again for email_template.cck.inc file.
Greets!
Comment #4
bradtanner commentedThank you so much for the feedback! I have committed fixes to address the issues identified above. The module should install correctly now and upon installation a new Email PDF content type should be available to create the 'Email this page as PDF' links.
In regards to the t() issue in email_template.cck.inc - that is a cck definition export that is being imported through a form programatically and I believe does not need to be wrapped in t().
Comment #5
bradtanner commentedComment #6
iler commentedYou should actually use st() function instead of t() function in hook_install and hook_uninstall functions.
drupal_set_message(t('The email_pdf_template node type was not removed. You must remove it manually.'));Comment #7
bradtanner commentedThanks! I've updated the hook_uninstall function to use st() instead of t().
Comment #8
musikpirat commentedYour git url in this issue does not work, maybe you can change it to
The README.txt is pretty hard to read. Line breaks a about 80 charactes would make it easier to read. Some separator for the different blocks would be great.
The function email_pdfs_link_path is empty, there is also some code that is disabled by comments. If it is not needed, you should remove it.
Comment #9
luxpaparazzi commentedAutomated review:
Review of the 6.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Get a review bonus and we will come back to your application sooner.
Comment #10
luxpaparazzi commented1. I suppose you can use relatives links for including php, so remove: drupal_get_path('module', 'email_pdfs')
email_pdfs_install_import(drupal_get_path('module', 'email_pdfs') . '/includes/email_template.cck.inc', 'email_pdf_template');I would also separate the include into another row, and probably put it's code into a function.
2. I hate reading long conditions on one line:
I recommand putting them on multi-lines as follow (a personal opinion):
3. Add Doc-Comments for all functions
4. I disrecommand mixing return types:
probably return NULL instead of FALSE
5. What shall this do?
6. Debugging code (code commented out) should be removed.
---
The response time for a review is now approaching 4 weeks.
Get a review bonus and we will come back to your application sooner.
See: http://drupal.org/node/1410826
You could for example start by evaluating my own project:
http://drupal.org/node/1302786
Comment #10.0
luxpaparazzi commentedFixing clone URI
Comment #11
bradtanner commentedI believe I've made all of the changes listed. Please review.
Comment #12
alansaviolobo commentedIn addition to the findings of PAReview.sh available at http://ventral.org/pareview/httpgitdrupalorgsandboxclinicaltools1444242git
here are my observations:
email_pdfs.module
-------------------------
line 100:
function
email_pdfs_node_editdoesn't seem to exist.line 109:
global $user;variable is not used.
line 118 & 121:
$output = email_pdfs_send_template($node);variable is not used.
line 128:
comment does not match the hook being implemented.
line 139:
comment does not match the hook being implemented.
line 212:
$sitestyle = variable_get('mimemail_sitestyle', 1);variable is not used.
email_template.cck.inc
------------------------------
this file does not have a
<?php. is it used ?Comment #13
bradtanner commentedI've fixed everything as reported. Please review again.
Note that I've renamed email_template.cck.inc to email_template.cck.txt since it is used as a text file for initial import.
Comment #14
serjas commenteddrupal_set_message(st('The email_pdf_template node type was not removed. You must remove it manually.'));if will be helpful if gave a link to delete the content type
Comment #15
bradtanner commentedAdded the link. Anything else needed?
Comment #16
webdorado commentedComment #17
bradtanner commentedPlease explain further as line 31 is a reference the $user object:
global $user;
I thought that if you are declaring your own global, then it should start with an underline, but I'm pretty sure that the $user object can't be referenced as $_user. Please correct me if I'm wrong though.
Comment #18
bradtanner commentedComment #19
webdorado commentedDear ClinicalTools,
You are absolutely right. Sorry for misinformation.
Comment #20
bradtanner commentedAny idea how long this will take before I can move this to a full project? It's been just under a month and haven't seen any movement. Is there a dashboard or something somewhere where I can see average wait time for the final approval/review?
Comment #21
luxpaparazzi commentedI recommand you to participate in the "review bonus" program: http://drupal.org/node/1410826
Comment #22
cubeinspire commentedAutomatic review:
1. There are still some minor code standard issues. See: http://ventral.org/pareview/httpgitdrupalorgsandboxclinicaltools1444242git
Manual review:
2. I think there is a problem with the name of the dependencies:
I'm searching on drupal.org modules but I cannot find a module called like those mentioned before so I cannot install the module and review it properly.
I passed over this problem commenting the unknown dependencies.
3. During install I have an incorrect file path reference that raises a warning:
This problem is related to the owner or the rights of this file (chmod - chown). If this is not a false positive, it should at least been mentioned at the README.txt or at best be repaired.
4. When I create a page and visit that page (after having enabling the module), I've got the following error:
user warning: Table 'd6.content_field_email_pdf_add_link' doesn't exist query: SELECT n.nid FROM content_field_email_pdf_add_link cfe JOIN node n ON cfe.nid=n.nid WHERE cfe.field_email_pdf_add_link_nid=1 AND n.status=1 in /var/www/d6/sites/all/modules/email_pdfs/email_pdfs.module on line 157.The table content_field_email_pdf_add_link doesn't exists. Is this a consequance of the issue 2 ? If not then it has to be solved.
5. You are creating a content type from a .txt file ? Why don't use the .install file execution to create and delete the content type ?
Comment #22.0
cubeinspire commentedFixing git clone command.
Comment #23
bradtanner commented1. Nothing in the link. I was working on this as you were checking it, so that may be why.
2. All of those modules are part of CCK http://drupal.org/project/cck. There's not a module called cck though - it's called content. All of the other modules are included in that download.
3. Fixed the file reference and added the information to the readme. You need to make sure the file is readable by the user that is serving webpages (apache or some other user).
4. Error caused by number 3. The node object didn't install.
5. I'm importing the cck export. There are a lot of fields added on to the node type but you didn't get any of them because you commented out the dependencies.
Comment #24
cubeinspire commentedI installed this module using drush, usually drush download and install all dependencies so I guess there is something out of norms either on the .info file, it could also be a drush/cck naming issue, not related to your module. It can help to check other d6 modules that require CCK to see how they set the dependencies.
In any case your module cannot be enabled with drush without manually installing dependencies. (I don't understand this as a blocker issue)
The other issues are, as you said, consequences of n°3.
Regarding n°5, I understand that you are importing a cck export, I just think that it would be much more clean to create the content type inside the hook_install() function instead of doing an import. The code doesn't change so much from what you got on the import, is just executed on a different way.
(here they give some examples: http://drupal.org/node/231019)
Also keeping a .txt file that is executed and that has to be chmoded (to what ? 777 ? ) could be dangerous. Someone with an FTP access (without any right to edit the modules) could edit the .txt file (that remember we were forced to give more rights! what kind of rights? ) and hack/break the system if the administrator uninstall and reinstall the email_pdfs module.
I know its a quite limit situation, but I think it's important to have a refexion on those practices as one of our responsibilities as contributors is to offer and maintain a secured code.
Comment #25
bradtanner commentedThe problem wasn't in the fact that you have to chmod the file to 777 - it was actually the reference to the location that was the problem. Your file just needs read access like ever other drupal file. Nothing wrong with that since every file in Drupal has to have that. I just thought it was a file permissions thing because of your comment, but that wasn't in fact the case. I've since fixed that so I don't think there's any security issues going on.
That example shows how to create a node type with a quick mention of all the other hooks that you have to implement to create a node type with additional fields but not showing how to do it - it's quite a bit more complicated in reality. I don't see any issues with importing a content type through the content type import form programatically (same as if you were to import it through the interface).
Comment #26
bradtanner commentedAs a follow up, I've changed the txt file to an inc file and made the import call a function. Now there is no way for someone with ill intent to even see the structure of the imported content type.
Additionally, I've added the dependency of 'content' to the info file. Drush will not be able to find the other modules but it will download the content module and then it will find the other modules and enable them.
Comment #27
klausimanual review:
require_once 'includes/mymodule.inc';. Also elsewhere.But otherwise looks RTBC to me. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #28
klausiNow actually removing tag.
Comment #29
bradtanner commented1. Fixed.
2. It's imported into the content type. While it's a specific content type, it's not one defined within the module other than importing it so those hooks aren't needed.
3. Addressed the issue. It should be clear now based off my profile information. Thanks.
Comment #29.0
bradtanner commentedAdding reviews.
Comment #30
bradtanner commentedAdding tag.
Comment #31
stborchertThanks for your contribution, Bradley!
I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #32
marymetcalf commentedThanks to all the reviewers as well. I am delighted that we can contribute to the Drupal community. My small organization has benefited so much from Drupal - we're looking forward to many more contributions.
Comment #33.0
(not verified) commentedAdding new parreview modules.