related to #1428 Added advertising banner on upload photo page

This commit is contained in:
Matthieu Leproux
2022-06-14 16:18:01 +02:00
parent aeb762e331
commit 3df8d9fe6d
5 changed files with 207 additions and 0 deletions

View File

@@ -42,6 +42,39 @@ DELETE FROM '.CADDIE_TABLE.'
redirect(get_root_url().'admin.php?page=batch_manager&filter=prefilter-caddie');
}
if (userprefs_get_param('promote-mobile-apps', true))
{
$query = '
SELECT registration_date
FROM '.USER_INFOS_TABLE.'
WHERE user_id = 1
;';
$result = pwg_db_fetch_assoc(pwg_query($query));
$register_date = $result['registration_date'];
$query = '
SELECT count(*) as nb_categories
FROM '.CATEGORIES_TABLE.'
;';
$result = pwg_db_fetch_assoc(pwg_query($query));
$nb_cats = $result['nb_categories'];
$query = '
SELECT count(*) as nb_images
FROM '.IMAGES_TABLE.'
;';
$result = pwg_db_fetch_assoc(pwg_query($query));
$nb_images = $result['nb_images'];
// 2 Weeks = 1209600 seconds
// To see the mobile app promote, the account must have 2 weeks ancient, 3 albums created and 30 photos uploaded
$template->assign("PROMOTE_MOBILE_APPS", (time() - strtotime($register_date) > 1209600 and $nb_cats >= 3 and $nb_images >= 30));
} else {
$template->assign("PROMOTE_MOBILE_APPS", false);
}
// +-----------------------------------------------------------------------+
// | Formats Mode |
// +-----------------------------------------------------------------------+

View File

@@ -91,6 +91,26 @@ var uploadCategory = null;
{literal}
jQuery(document).ready(function(){
jQuery(".close-apps").on("click", function() {
jQuery(".promote-apps").hide();
});
jQuery(".dont-show-again").on("click", function() {
jQuery.ajax({
url: "ws.php?format=json&method=pwg.users.preferences.set",
type: "POST",
dataType: "JSON",
data: {
param: 'promote-mobile-apps',
value: false,
},
success: function(res) {
console.log(res);
jQuery(".promote-apps").hide();
}
})
})
jQuery("#uploadWarningsSummary a.showInfo").click(function() {
jQuery("#uploadWarningsSummary").hide();
jQuery("#uploadWarnings").show();
@@ -428,6 +448,28 @@ jQuery(document).ready(function(){
</div>
{/if}
{if $PROMOTE_MOBILE_APPS}
<div class="promote-apps">
<span class="icon-cancel close-apps"></span>
<div class="promote-content">
<div class="left-side">
<img src="https://de.piwigo.org/./plugins/piwigo-piwigodotorg/images/mobile_applications/Group_77.png">
<div class="promote-text">
<span>{"Piwigo is also on mobile."|@translate|escape:javascript}</span>
<span>{"Try now !"|@translate|escape:javascript}</span>
</div>
</div>
<div class="mid-side"></div>
<div class="right-side">
<div class="promote-text">
<span>{"Install Piwigo on mobile"|@translate|escape:javascript}</span>
<a href="https://piwigo.org/mobile-applications" target="_blank"><span class="go-to-porg icon-download">{"Install"|@translate|escape:javascript}</span></a>
</div>
</div>
</div>
<span class="dont-show-again">{"Ne plus afficher"|@translate|escape:javascript}</span>
</div>
{/if}
<form id="uploadForm" class="{if $DISPLAY_FORMATS}format-mode{/if}" enctype="multipart/form-data" method="post" action="{$form_action}"{if $NB_ALBUMS == 0} style="display:none;"{/if}>
{if not $DISPLAY_FORMATS}

View File

@@ -6595,4 +6595,128 @@ color:#FF7B00;
.search-result-item .notClickable {
opacity: 0.3;
color: black !important;
}
.promote-apps {
display: flex;
flex-direction: column;
justify-content: flex-end;
border-bottom: 1px solid lightgray;
padding: 0 15px 15px 15px;
}
.close-apps {
padding: 1px;
margin-left: auto;
border-radius: 50%;
background: #BBB;
color: #000;
font-size: 19px;
}
.close-apps::before {
transform: translateY(-1px);
}
.dont-show-again {
margin-left: auto;
background: #BBB;
color: #000;
border-radius: 20px;
padding: 3px 8px;
font-weight: 700;
}
.dont-show-again:hover,
.close-apps:hover {
cursor: pointer;
}
.promote-content {
display: flex;
flex-direction: row;
justify-content: space-around;
}
.promote-content .left-side {
display: flex;
flex-direction: row;
align-items: center;
}
.promote-content .mid-side {
border-right: 1px solid gray;
}
.promote-content .right-side {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.promote-content .left-side img {
width: 170px;
margin-left: 60px;
margin-right: 80px;
}
.promote-text {
display: flex;
flex-direction: column;
font-size: 30px;
font-weight: 700;
color: #000;
}
.promote-text span:first-child {
margin-bottom: 5px;
}
.promote-text span:last-child {
margin-top: 5px;
}
.go-to-porg {
cursor: pointer;
padding: 7px 14px;
font-size: 18px;
font-weight: bold;
background-color: #ffa744;
color: #3c3c3c;
width: 150px;
text-align: center;
}
.go-to-porg::before {
margin-right: 10px;
}
.promote-content .right-side .promote-text {
display: flex;
flex-direction: column;
align-items: center;
}
@media (max-width: 1450px) {
.promote-text span {
font-size: 20px;
}
.promote-content .left-side img {
margin-left: 60px;
}
}
@media (max-width: 1170px) {
.promote-content .left-side img {
margin: 0 20px 0 0;
}
}
@media (max-width: 1050px) {
.promote-text span {
font-size: 15px;
}
.promote-content .left-side img {
width: 100px;
}
}

View File

@@ -1289,4 +1289,8 @@ $lang['Add as filter'] = 'Add as filter';
$lang['Show plugins compatible with previous version of Piwigo'] = 'Show plugins compatible with previous version of Piwigo';
$lang['Placer au début'] = 'Place at the start';
$lang['Placer à la fin'] = 'Place at the end';
$lang['Piwigo is also on mobile.'] = 'Piwigo is also on mobile.';
$lang['Try now !'] = 'Try now !';
$lang['Install Piwigo on mobile'] = 'Install Piwigo on mobile';
// Leave this line empty

View File

@@ -418,3 +418,7 @@ $lang['Password: ********** (no copy by email)'] = 'Mot de passe : ********** (p
$lang['Album name, 1 &rarr; 5 &rarr; 10 &rarr; 100'] = 'Nom d\'album, 1 &rarr; 5 &rarr; 10 &rarr; 100';
$lang['Album name, 100 &rarr; 10 &rarr; 5 &rarr; 1'] = 'Nom d\'album, 100 &rarr; 10 &rarr; 5 &rarr; 1';
$lang['Start-Date'] = 'Date de début';
$lang['Piwigo is also on mobile.'] = 'Piwigo est également sur mobile.';
$lang['Try now !'] = 'Venez essayer dès maintenant !';
$lang['Install Piwigo on mobile'] = 'Installez Piwigo sur mobile';