Add emailing. re #53
This commit is contained in:
parent
6b8846e02b
commit
e833172e99
10
book.php
10
book.php
|
@ -140,14 +140,20 @@ class Book extends Base {
|
||||||
|
|
||||||
}
|
}
|
||||||
public function getFullContentArray () {
|
public function getFullContentArray () {
|
||||||
|
global $config;
|
||||||
$out = $this->getContentArray ();
|
$out = $this->getContentArray ();
|
||||||
|
|
||||||
$out ["coverurl"] = Data::getLink ($this, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml ();
|
$out ["coverurl"] = Data::getLink ($this, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml ();
|
||||||
$out ["thumbnailurl"] = Data::getLink ($this, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, 150)->hrefXhtml ();
|
$out ["thumbnailurl"] = Data::getLink ($this, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, 150)->hrefXhtml ();
|
||||||
$out ["content"] = $this->getComment (false);
|
$out ["content"] = $this->getComment (false);
|
||||||
$out ["datas"] = array ();
|
$out ["datas"] = array ();
|
||||||
|
$dataKindle = $this->GetMostInterestingDataToSendToKindle ();
|
||||||
foreach ($this->getDatas() as $data) {
|
foreach ($this->getDatas() as $data) {
|
||||||
array_push ($out ["datas"], array ("format" => $data->format, "url" => $data->getHtmlLink ()));
|
$tab = array ("id" => $data->id, "format" => $data->format, "url" => $data->getHtmlLink (), "mail" => 0);
|
||||||
|
if (!empty ($config['cops_mail_configuration']) && !is_null ($dataKindle) && $data->id == $dataKindle->id) {
|
||||||
|
$tab ["mail"] = 1;
|
||||||
|
}
|
||||||
|
array_push ($out ["datas"], $tab);
|
||||||
}
|
}
|
||||||
$out ["authors"] = array ();
|
$out ["authors"] = array ();
|
||||||
foreach ($this->getAuthors () as $author) {
|
foreach ($this->getAuthors () as $author) {
|
||||||
|
@ -264,7 +270,7 @@ class Book extends Base {
|
||||||
|
|
||||||
public function GetMostInterestingDataToSendToKindle ()
|
public function GetMostInterestingDataToSendToKindle ()
|
||||||
{
|
{
|
||||||
$bestFormatForKindle = array ("PDF", "MOBI");
|
$bestFormatForKindle = array ("EPUB", "PDF", "MOBI");
|
||||||
$bestRank = -1;
|
$bestRank = -1;
|
||||||
$bestData = NULL;
|
$bestData = NULL;
|
||||||
foreach ($this->getDatas () as $data) {
|
foreach ($this->getDatas () as $data) {
|
||||||
|
|
BIN
images/mail-send.png
Normal file
BIN
images/mail-send.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
|
@ -156,8 +156,12 @@ max-width:800px;
|
||||||
text-decoration : none;
|
text-decoration : none;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding: 5px 10px 5px 10px;
|
padding: 5px 10px 5px 10px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.download img {
|
||||||
|
vertical-align:middle;
|
||||||
|
}
|
||||||
|
|
||||||
.books h4{
|
.books h4{
|
||||||
display: inline;
|
display: inline;
|
||||||
|
|
|
@ -8,7 +8,11 @@
|
||||||
</span>
|
</span>
|
||||||
<h2 class="download">
|
<h2 class="download">
|
||||||
{{~it.book.datas:data:i}}
|
{{~it.book.datas:data:i}}
|
||||||
<a href="{{=data.url}}">{{=data.format}}</a><br />
|
<a href="{{=data.url}}">{{=data.format}}</a>
|
||||||
|
{{? data.mail == 1}}
|
||||||
|
<a href="customize.php" onclick="sendToMailAddress (this, {{=data.id}}); return false;"><img src="images/mail-send.png?v={{=it.const.version}}" alt="Mail" /></a>
|
||||||
|
{{?}}
|
||||||
|
<br />
|
||||||
{{~}}
|
{{~}}
|
||||||
</h2>
|
</h2>
|
||||||
<h1><a rel="bookmark" href="{{=strformat (it.const.url.detailUrl, it.book.id, it.databaseId)}}"><img src="images/Link.png?v={{=it.const.version}}" alt="{{=it.const.i18n.permalinkAlt}}" /></a>{{=htmlEscape (it.title)}}</h1>
|
<h1><a rel="bookmark" href="{{=strformat (it.const.url.detailUrl, it.book.id, it.databaseId)}}"><img src="images/Link.png?v={{=it.const.version}}" alt="{{=it.const.i18n.permalinkAlt}}" /></a>{{=htmlEscape (it.title)}}</h1>
|
||||||
|
|
17
util.js
17
util.js
|
@ -19,6 +19,23 @@ function elapsed () {
|
||||||
return "Elapsed : " + elapsed;
|
return "Elapsed : " + elapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function retourMail(data, textStatus, jqXHR ) {
|
||||||
|
alert (data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendToMailAddress (component, dataid) {
|
||||||
|
$toto = $.cookie ('email');
|
||||||
|
if (!$.cookie ('email')) {
|
||||||
|
var email = window.prompt ("Please enter your email : ", "");
|
||||||
|
$.cookie ('email', email);
|
||||||
|
}
|
||||||
|
email = $.cookie ('email');
|
||||||
|
var url = 'sendtomail.php';
|
||||||
|
if (currentData.databaseId) url = url + '?db=' + currentData.databaseId;
|
||||||
|
$.ajax ({url: url, type: 'post', data: { data: dataid, email: email }, success: retourMail});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function fancyBoxObject (title, type) {
|
function fancyBoxObject (title, type) {
|
||||||
var out = { prevEffect : 'none', nextEffect : 'none' };
|
var out = { prevEffect : 'none', nextEffect : 'none' };
|
||||||
if (isEink) {
|
if (isEink) {
|
||||||
|
|
Loading…
Reference in a new issue