Link to sandbox page:
https://www.drupal.org/sandbox/mosewrite/2427607
Git clone command:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/mosewrite/2427607.git
Initial Manual reviews of other projects
https://www.drupal.org/node/2443865#comment-9675165
https://www.drupal.org/node/2432439#comment-9662483
https://www.drupal.org/node/2328637#comment-9675241
Current Manual Reviews
https://www.drupal.org/node/2444455#comment-9699353
https://www.drupal.org/node/2448653#comment-9702811
https://www.drupal.org/node/2362563#comment-9709875
Description
Send to Kindle lets a site's users send Kindle-supported documents to their Kindle devices. This only works on field type 'file'. It creates a custom field formatter, which must be specified for the file field in question, when creating or editing the content type.
This module requires the mail system and mime mail modules:
After installation each user profile will have a new field called 'Send-to-Kindle E-Mail Address'. This is the email address of the Kindle device to which the user wants documents sent. The user *MUST* go into their Amazon account and configure their Kindle device to receive emails from 'kindlemail@domain_name', where 'domain_name' is the domain of the Drupal site. The Send-to-Kindle user profile field has a description that instructs the user to do this.
When the file is displayed, that display will be identical to the 'Generic file' formatter, except there will be a button directly after it that reads 'Send to Kindle'. The button only appears if the file is a supported file type for Kindle. Click the button, and the document is sent to the user's Kindle.
For customization purposes, the module includes a template file called 'send_to_kindle_kindlebutton.tpl.php'. Copy this file to your theme directory, and you can theme and modify the the file link as you wish. The template has a variable in it, $params, which contains all the file information. Modify it, and you can modify how the email is sent.
This module is similar to 'Amazon Send to Kindle'. It differs from that project in that 'Send File to Kindle' is restricted to (unsurprisingly) sending files and only sends files that are compatible with a Kindle. 'Amazon Send to Kindle' saves and sends all types of content to a given Kindle. 'Send File to Kindle' is much more single-purpose, much more focused.
One of the review commenters asked how this project differs from 'Readability Button'. It differs significantly because 'Readability Button' integrates a given page of content into the Readability service, which allows a page to be read offline or on another device, or both. That has little to do with sending a document file to a Kindle device for reading on that device.
Because the module operates by sending an email with an attachment to an email address for a given Kindle device, you may want to evaluate the module by specifying a different email address -- such as your own -- to which to send the email and attached file. By default the module does not allow a non-Kindle email address to be saved in the user profile. You can change this and allow the module to save a non-Kindle email address by going to the function below, which is in send_file_to_kindle.module and changing the line that reads '$is_good = FALSE'; to '$is_good = TRUE;'
function send_file_to_kindle_form_validate($form, &$form_state) {
$submitted_email = $form_state['values']['send_file_to_kindle'][LANGUAGE_NONE][0]['value'];
$is_good = TRUE;
// Get the domain string and convert to lower case.
$var = explode('@', $submitted_email);
$domain = drupal_strtolower(array_pop($var));
// If it's not empty and not a valid email or the domain isn't kindle.com,
// fail.
if ($submitted_email != '') {
if (!valid_email_address($submitted_email) || ($domain != 'kindle.com')) {
// Change the line below to TRUE to test with non-Kindle email addresses.
$is_good = FALSE;
}
}
if (!$is_good) {
form_set_error('send_file_to_kindle', t('Your Kindle email address is invalid. It must be a valid email and be for the domain kindle.com. You do not have to provide an email address.'));
}
}| Comment | File | Size | Author |
|---|---|---|---|
| #24 | coder-results.txt | 2.33 KB | klausi |
Comments
Comment #1
nabil.sadki commentedAutomated review :
EDIT: remove long pareview.sh dump, see http://pareview.sh/pareview/httpgitdrupalorgsandboxmosewrite2427607git
Comment #2
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxmosewrite2427607git
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #3
mlmoseley commentedI have fixed every issue and the module now passes all code review completely. I will look at writing some unit tests for it, but that is a learning curve for me and will probably be a few weeks at least. In the meantime, please feel free to examine the module.
--Marshall
Comment #4
mlmoseley commentedComment #5
mlmoseley commentedComment #6
mlmoseley commentedComment #7
mlmoseley commentedThis project is not showing up in the issues queue. Can anyone tell me why?
Comment #8
mlmoseley commentedComment #9
klausiComment #10
klausiReview of the 7.x-1.x branch (commit 65c30a5):
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. You have to get a review bonus to get a review from me.
manual review:
So the project page and the data loss issue are blockers right now. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #11
mlmoseley commentedThank. I'll get to work.
Comment #12
mlmoseley commentedComment #13
mlmoseley commented1. send_file_to_kindle_form_alter(): if you are targeting only one form you should use hook_form_FORM_ID_alter() instead.
Done.
2. send_file_to_kindle_form_validate(): doc block is wrong, the first line only repeats the function name? See https://www.drupal.org/coding-standards/docs#forms
Done.
3. send_file_to_kindle_supported_extension(): same here, the first line of a doc comment should be the short description. See https://www.drupal.org/coding-standards/docs#functions
Done.
4. send_file_to_kindle_message_mail(): hook_message_mail() does not exist. Did you mean hook_mail()?
Yes. Done.
5. "$message['params']['plaintext'] = 'Attached is your document';": all user facing text must run through t() for translation.
Done.
6. send_file_to_kindle_button_form(): doc block is wrong, this is not hook_form()? See https://www.drupal.org/coding-standards/docs#forms
Done. Changed to form constructor doc block.
7. " '#value' => 'Send to Kindle',": all user facing text must run through t() for translation.
Done.
8. send_file_to_kindle_kindlebutton.tpl.php: ideally a template should not call such API functions, you should only be dealing with variables and if statements. You should prepare all necessary variables before calling theme() or do it in a preprocess function.
Done. All templatized, and the themer can now modify the form array in the template to modify how the email is sent. I've also included the file object in case he/she wants to build their own link.
9. send_file_to_kindle_button(): do not call drupal_render() here, rendering should be done as late as possible, could be done in the template with render().
Done. Render is now in the template.
10. send_file_to_kindle_disable(): deleting data should only happen on uninstall hooks, otherwise you have data loss when the module is disabled.
This is a problem. When I simply disable the module using hook_disable, the user profile field remains visible in the user profile. Even if I was able to hide it on display, it remains visible and editable on the user profile edit form. There seems to be nothing I can do under hook_disable to hide the profile field but reptant he data (the email address). All the solutions I've discovered recommend using the field permissions module, but I think creating a dependency just so the module can be disabled is too much to ask, and inelegant.
On the other hand, if when the module is disabled and then re-enabled, all the user has to do is enter his/her Kindle email in the profile again...that's not a big burden. So unless someone can offer me a solution, I'm going to leave this as it is.
11. send_file_to_kindle_disable(): do not use "print" here, use drupal_set_message() with t() and appropriate placeholders.
Done.
12. "t('Note: using your Amazon account, you must configure your Kindle device to accept email from ') . $from_email . t(' otherwise the document will not show up on your Kindle.')": do not concatenate variables into translatable strings like that, use placeholders with t() instead. See https://api.drupal.org/api/drupal/includes!bootstrap.inc/function/t/7
Done
Comment #14
mlmoseley commentedAddressed all of the most recent issues.
Comment #15
mlmoseley commentedComment #16
mlmoseley commentedComment #17
davidsheart02 commentedDon't include the LICENSE.txt file: https://www.drupal.org/node/1587704
Your git clone command is missing the renaming of your project and could lead to a bad test. May want to update that.
Comment #18
mlmoseley commentedComment #19
mlmoseley commentedComment #20
mlmoseley commentedComment #21
mlmoseley commentedI@davidsheart02. have removed the LICENSE.txt file. I don't understand this comment: "Your git clone command is missing the renaming of your project and could lead to a bad test. May want to update that." To what renaming are you referring?
Comment #22
mlmoseley commentedI have completed three more reviews and added back in the 'PAReview: review' bonus tag.
Comment #23
mlmoseley commentedComment #24
klausiReview of the 7.x-1.x branch (commit e74bc25):
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. You have to get a review bonus to get a review from me.
manual review:
But otherwise looks good to me.
Assigning to cweagans as he might have time to take a final look at this.
Comment #25
mlmoseley commentedI have fixed the issues in issue 24, and the project now passes Code Sniffer and phpcs with flying colors. How do I take this to RTBC?
Comment #26
cweagansThanks for your contribution, mlmoseley!
I updated your account so you can 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 stay 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 #27
klausiMarking as fixed.