Improvements to main : add send to button for each book
I created the issue #326 with a lot of different situations.
I would like to split it to be able to track progress and to explain each use case more precisely.
It would be great to have the sendto button directly in the book list
here, example with the list of the last fifty books
or in the case of a search.
For the moment, the sendto button is only available on the book details information page.
It will be great to get the sendto button directly in the list. mockup

I don't see the merits of it... What would the recipient gain from that? A list of 15 books in a zip? How would he know that he really wants all those books inside the zip? Or is just an mail to yourself?
No zip.
For each book on the list add the sendto button.
Clear example : you have read a book from a serie and you add the other ones to calibre. On cops you want to access the last books added and easily send the other books from the serie to the ereader device.
Le jeu. 9 mars 2017 19:16, Horus68 [email protected] a écrit :
I don't see the merits of it... What would the recipient gain from that? A list of 15 books in a zip? How would he know that he really wants that book? Or is just an mail to yourself?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/seblucas/cops/issues/329#issuecomment-285434110, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7U91AeprU6IxTGkpOlw3T1q8JHZonGks5rkEH_gaJpZM4MYNmy .
ok, so hitting each button mail from the list and not having to enter the details seems ok for me
yes, for each book you can hit the mail button directly and not having to enter the details.
I tried to create a mockup

In this usecase, the person who browses in COPS and the recipient ( the destination mail ) owns the smartphone AND the destination ereader.
In the issue #326 I provide a mockup with 2 mail buttons : 1 for favorite, 1 for new mail.
mockup with the 2 icons

In this usecase, the person who browses in COPS with a smartphone
could use the favorite icon to send a book to his ereader
or
could use the new mail icon to send a book to another ereader (not a favorite) or email.
I just bought a new ereader (kindle) supporting the sendto functionality for a member of my family.
Using COPS on a smartphone and the sendto functionality to put books on the selected kindle ereader or app is great BUT with the current implementation, it misses something, you can't select easily where you want to send, you have to provide an email address.
So I thought "what Amazon do ?"
In fact the answer is quite simple : Amazon provides a list of all ereader devices or apps connected to the account, this list is available on the book details page.
What I would like is for COPS to provide the same functionality a functionality that can be modified with the config section.
First a question would be asked Do you want to use multiple emails ? (checkbox)
If checked, it would be possible to provide as many items as wished with a name and email. default device : John's reader / email : [email protected] 2nd device : Bob's reader / email : [email protected] 3rd device ... and so on You can add / modify / delete an entry
mockup
of course, there would be a : "other destination" and that would open a dialog box to enter the email address.
It would be a huge improvement to the functionality and it would address the problems explained in #326
First : let's add the mail button !
It needs to add this part of the file : cops/templates/default/bookdetail.html
{{? data.mail == 1}}
<a id="mailButton" title="Mail // {{=data.format}}" href="empty.php" onclick="sendToMailAddress (this, {{=data.id}}); return false;" {{=it.c.config.kindleHack}}><i class="icon-envelope icon-large"></i></a>
{{?}}
to this file : cops/templates/default/main.html
It should be possible to add a class as the existing class download below to add the mail button proposed class
<h2 class="sendto">
{{? data.mail == 1}}
<a id="mailButton" title="Mail // {{=data.format}}" href="empty.php" onclick="sendToMailAddress (this, {{=data.id}}); return false;" {{=it.c.config.kindleHack}}><i class="icon-envelope icon-large"></i></a>
{{?}}
</h2>
existing class download
<h2 class="download">
{{~entry.book.preferedData:data:j}}
<a href="{{=data.url}}" {{=it.c.config.kindleHack}}>{{=data.name}}</a><br />
{{~}}
</h2>
Of course, it needs to be done also in the boostrap part of the code.
Once the mail button will be available, we'll see how implementing with multiple devices (as it is not something that we use all the time).
Second, let's use the config file to configure potential destination devices. file : cops/config_default.php
Why I propose to use the config file ? Because it is not frequent that we acquire a new ereader, so the config file seems a correct place for it. Also it is simplier because it does not need to have informations elsewhere.
sendto section of the config_default.php
* If you want to use a simple smtp server (provided by your ISP for example), you can configure it like that :
* $config['cops_mail_configuration'] = array( "smtp.host" => "smtp.free.fr",
* "smtp.username" => "",
* "smtp.password" => "",
* "smtp.secure" => "",
* "address.from" => "[email protected]",
* "subject" => "Sent by COPS : " // Not mandatory
* Device subsection of mail configuration
* to be used with kindle devices : you need to have a device and an email associated for each device.
* the device1 is the default device that will appear first in the select list
* the number of devices is used to create a loop and populate the select list
* "number_of_devices" => "n"
* "device1_name" => "name of your device1 kindle"
* "mail_device1" => "destination mail of your device1 kindle"
* "device2_name" => "name of your device2 kindle"
* "mail_device2" => "destination mail of your device2 kindle"
* );
With a loop, it would be possible to populate the list that would be visible in the interface.
So the selection list would display the following items device1 (selected by default) device2 the mail chosen in the config page other email (it would then ask for email selection)
It needs to modify this part of the file : cops/templates/default/bookdetail.html
{{? data.mail == 1}}
<a id="mailButton" title="Mail // {{=data.format}}" href="empty.php" onclick="sendToMailAddress (this, {{=data.id}}); return false;" {{=it.c.config.kindleHack}}><i class="icon-envelope icon-large"></i></a>
{{?}}
to something like this below.
with the loop, it is possible to populate the select list with the devices identified in the config file. an other choice is added to use the current email address a last choice is added to offer another address with a dialog box
{{? data.mail == 1}}
<select name="device" id="device">
{{ for $i_number_of_devices = 1 to data.number_of_devices ; $i_number_of_devices< data.number_of_devices ; $i_number_of_devices++ }}
<option value="device{{$i_number_of_devices }}" {{ if ($i_number_of_devices = 1) echo"selected" }}>{{data.device$i_number_of_devices_name }}</option>
{{;}}
<option value="Mail>{{data.id}}</option>
<option value="OtherMail>other mail...</option>
</select>
<a id="mailButton" title="Mail // {{=data.format}}" href="empty.php" onclick="sendToMailAddress (this, {{=data.id}}); return false;" {{=it.c.config.kindleHack}}><i class="icon-envelope icon-large"></i></a>
{{?}}
it needs to be done also in this file /cops/templates/default/main.html and also replicated in the bootstrap section.