mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-25 10:49:58 +03:00
fixes #2268 add whats new popin
set popin display in user pref, if user closes don't display again keep bell notification displayed for 30 days so user can reopen modal for next version add user pref to install Add css for template when close popin call api method to update user pref to hide popin
This commit is contained in:
parent
f18f117d84
commit
bf3beb9bdd
7 changed files with 317 additions and 3 deletions
61
admin.php
61
admin.php
|
@ -338,6 +338,66 @@ if (
|
|||
invalidate_user_cache();
|
||||
}
|
||||
|
||||
$show_whats_new = false;
|
||||
|
||||
$whats_new_major_version = get_branch_from_version(PHPWG_VERSION);
|
||||
|
||||
if (userprefs_get_param('show_whats_new_'.$whats_new_major_version, true) and pwg_is_dbconf_writeable())
|
||||
{
|
||||
if ($user['registration_date'] > $conf['last_major_update'])
|
||||
{
|
||||
userprefs_update_param('show_whats_new_'.$whats_new_major_version, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// purge old whats_new_*
|
||||
if (isset($user['preferences']))
|
||||
{
|
||||
$userprefs_params_to_delete = array();
|
||||
|
||||
foreach (array_keys($user['preferences']) as $pref_param)
|
||||
{
|
||||
if (preg_match('/^whats_new_/', $pref_param))
|
||||
{
|
||||
$userprefs_params_to_delete[] = $pref_param;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($userprefs_params_to_delete) > 0)
|
||||
{
|
||||
userprefs_delete_param($userprefs_params_to_delete);
|
||||
}
|
||||
}
|
||||
|
||||
$show_whats_new = true;
|
||||
}
|
||||
}
|
||||
|
||||
$release_note_url = PHPWG_URL.'/releases/'.$whats_new_major_version.'.0.0';
|
||||
|
||||
$whats_new_imgs = array(
|
||||
'1' =>'https://ressources.piwigo.com/uploads/c/v/7/cv7jpz6hf8//2024/11/07/20241107171642-58ded6af.png',
|
||||
'2' =>'https://ressources.piwigo.com/uploads/c/v/7/cv7jpz6hf8//2024/11/07/20241107171642-9d651969.png',
|
||||
'3' =>'https://ressources.piwigo.com/uploads/c/v/7/cv7jpz6hf8//2024/11/07/20241107171643-d659d017.png',
|
||||
'4' =>'https://ressources.piwigo.com/uploads/c/v/7/cv7jpz6hf8//2024/11/07/20241107171642-1109101f.png',
|
||||
);
|
||||
|
||||
$display_bell = false;
|
||||
if (strtotime($conf['last_major_update']) > strtotime('1 month ago'))
|
||||
{
|
||||
$display_bell = true;
|
||||
}
|
||||
|
||||
$template->assign(
|
||||
array(
|
||||
'SHOW_WHATS_NEW' => $show_whats_new,
|
||||
'WHATS_NEW_MAJOR_VERSION' => $whats_new_major_version,
|
||||
'RELEASE_NOTE_URL' => $release_note_url,
|
||||
'WHATS_NEW_IMGS' => $whats_new_imgs,
|
||||
'DISPLAY_BELL' => $display_bell,
|
||||
)
|
||||
);
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Include specific page |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
@ -363,4 +423,5 @@ flush_page_messages();
|
|||
$template->pparse('admin');
|
||||
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
|
||||
?>
|
||||
|
|
|
@ -863,4 +863,25 @@ li.plupload_delete a:hover {background: url("images/cancelhover.svg")!important;
|
|||
|
||||
.cat-move-order-popin input[name=recursiveAutoOrder]:hover {
|
||||
background-color: #ffc17e;
|
||||
}
|
||||
|
||||
#whats_new_popin{
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.close_whats_new{
|
||||
color:white
|
||||
}
|
||||
|
||||
#whats_new h3{
|
||||
color: #3C3C3C;
|
||||
}
|
||||
|
||||
#whats_new button{
|
||||
background-color: #ECECEC;
|
||||
color: #3C3C3C;
|
||||
}
|
||||
|
||||
#whats_new button:hover{
|
||||
background-color:#FFA646;
|
||||
}
|
|
@ -17,7 +17,14 @@
|
|||
{/if}
|
||||
|
||||
<div id="footer">
|
||||
<a class="externalLink tiptip piwigo-logo" href="{$PHPWG_URL}" title="{'Visit Piwigo project website'|translate}"><img src="admin/themes/default/images/piwigo-grey.svg"></a>
|
||||
<div>
|
||||
<a class="externalLink tiptip piwigo-logo" href="{$PHPWG_URL}" title="{'Visit Piwigo project website'|translate}"><img src="admin/themes/default/images/piwigo-grey.svg"></a>
|
||||
{if isset($DISPLAY_BELL) and $DISPLAY_BELL}
|
||||
<span id="whats_new_notification" class="icon-blue tiptip" onclick="show_user_whats_new()" title="{'What\'s new in version %s'|translate:$WHATS_NEW_MAJOR_VERSION}">
|
||||
<i class="icon-bell"></i>
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
<div id="pageInfos">
|
||||
{if isset($debug.TIME) }
|
||||
{'Page generated in'|translate} {$debug.TIME} ({$debug.NB_QUERIES} {'SQL queries in'|translate} {$debug.SQL_TIME}) -
|
||||
|
@ -30,6 +37,44 @@
|
|||
</div>{* <!-- footer --> *}
|
||||
</div>{* <!-- the_page --> *}
|
||||
|
||||
<div id="whats_new">
|
||||
<div id="whats_new_popin">
|
||||
<a class="icon-cancel close_whats_new" onClick="hide_user_whats_new()"></a>
|
||||
<h3>{'What\'s new in version %s'|translate:$WHATS_NEW_MAJOR_VERSION}</h3>
|
||||
<div>
|
||||
<div class="whats_new_block_container">
|
||||
<div class="whats_new_block icon-yellow">
|
||||
<h4>{'A new interface for user management'|translate}</h4>
|
||||
<img src="{$WHATS_NEW_IMGS.1}">
|
||||
</div>
|
||||
<div class="whats_new_block icon-green">
|
||||
<h4>{'Brand new features : Activities logs and PDF reader'|translate}</h4>
|
||||
<img src="{$WHATS_NEW_IMGS.2}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="whats_new_block_container">
|
||||
<div class="whats_new_block icon-blue">
|
||||
<h4>{'Enhanced interface for batch manager and album selector'|translate}</h4>
|
||||
<img src="{$WHATS_NEW_IMGS.3}">
|
||||
</div>
|
||||
<div class="whats_new_block icon-purple">
|
||||
<h4>{'Even more filters for the gallery search engine'|translate}</h4>
|
||||
<img src="{$WHATS_NEW_IMGS.4}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="whats_new_buttons">
|
||||
<button onClick="hide_user_whats_new()"><i class="icon-thumbs-up"></i> {'Ok, got it!'|translate}</button>
|
||||
<a class="buttonLike" href="{$RELEASE_NOTE_URL}" target="_blank"><i class="icon-book"></i> {'Read the release note'|translate}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
{combine_script id='jquery.tipTip' load='footer' path='themes/default/js/plugins/jquery.tipTip.minified.js'}
|
||||
{footer_script require='jquery.tipTip'}
|
||||
|
@ -43,6 +88,30 @@ jQuery('a.externalLink').click(function() {
|
|||
window.open(jQuery(this).attr("href"));
|
||||
return false;
|
||||
});
|
||||
|
||||
function hide_user_whats_new() {
|
||||
$.ajax({
|
||||
url: "ws.php?format=json&method=pwg.users.preferences.set",
|
||||
type: "POST",
|
||||
dataType: "JSON",
|
||||
data: {
|
||||
param: 'show_whats_new_{$WHATS_NEW_MAJOR_VERSION}',
|
||||
value: false,
|
||||
}
|
||||
})
|
||||
$('#whats_new').hide();
|
||||
}
|
||||
|
||||
function show_user_whats_new() {
|
||||
$('#whats_new').show();
|
||||
}
|
||||
|
||||
{if isset($SHOW_WHATS_NEW) && $SHOW_WHATS_NEW}
|
||||
show_user_whats_new()
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
{/footer_script}
|
||||
|
||||
<!-- BEGIN get_combined -->
|
||||
|
|
|
@ -7555,4 +7555,134 @@ color:#FF7B00;
|
|||
.promote-content .left-side img {
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Css for whats new popin */
|
||||
#whats_new{
|
||||
display: none;
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
}
|
||||
|
||||
#whats_new_popin{
|
||||
width: 40%;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
text-align: left;
|
||||
padding: 30px;
|
||||
border-radius: 10px;
|
||||
max-height:90%;
|
||||
}
|
||||
|
||||
.close_whats_new{
|
||||
position: absolute;
|
||||
right: -40px;
|
||||
top: -40px;
|
||||
font-size: 30px;
|
||||
transition: all 125ms ease-out;
|
||||
}
|
||||
|
||||
#whats_new h3{
|
||||
font-size: 19px;
|
||||
font-weight: 700;
|
||||
line-height: 25.87px;
|
||||
text-align: center;
|
||||
background-color:transparent;
|
||||
margin-top:0px;
|
||||
}
|
||||
|
||||
#whats_new h4{
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
line-height: 20.43px;
|
||||
text-align: left;
|
||||
margin:0;
|
||||
margin-bottom:15px;
|
||||
}
|
||||
|
||||
#whats_new .whats_new_block_container{
|
||||
display:flex;
|
||||
}
|
||||
|
||||
#whats_new .whats_new_block{
|
||||
border-radius:13px;
|
||||
padding:15px;
|
||||
padding-bottom:0px;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
justify-content:space-between;
|
||||
margin:7px;
|
||||
}
|
||||
|
||||
#whats_new .whats_new_block:hover{
|
||||
scale:115%;
|
||||
transition:.6s;
|
||||
}
|
||||
|
||||
#whats_new .whats_new_block.icon-yellow:hover{
|
||||
transform-origin: top left;
|
||||
}
|
||||
|
||||
#whats_new .whats_new_block.icon-green:hover{
|
||||
transform-origin: top right;
|
||||
}
|
||||
|
||||
#whats_new .whats_new_block.icon-blue:hover{
|
||||
transform-origin: bottom left;
|
||||
}
|
||||
|
||||
#whats_new .whats_new_block.icon-purple:hover{
|
||||
transform-origin: bottom right;
|
||||
}
|
||||
|
||||
#whats_new .whats_new_block.icon-yellow,
|
||||
#whats_new .whats_new_block.icon-purple{
|
||||
width:40%;
|
||||
}
|
||||
|
||||
#whats_new .whats_new_block.icon-green,
|
||||
.whats_new_block.icon-blue{
|
||||
width:60%;
|
||||
}
|
||||
|
||||
|
||||
#whats_new .whats_new_block img{
|
||||
width:100%;
|
||||
height:auto;
|
||||
}
|
||||
|
||||
#whats_new .whats_new_buttons{
|
||||
display:flex;
|
||||
margin-top:15px;
|
||||
justify-content:space-between;
|
||||
}
|
||||
|
||||
#whats_new button{
|
||||
padding: 9px 10px;
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
line-height: normal;
|
||||
border:none;
|
||||
cursor:pointer;
|
||||
transition: all 125ms ease-out;
|
||||
}
|
||||
|
||||
#whats_new_notification{
|
||||
border-radius: 15px;
|
||||
top: 2px;
|
||||
position: absolute;
|
||||
right: 42px;
|
||||
padding: 1px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0px 4px 4px 0px #00000040;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
|
|
@ -2306,4 +2306,25 @@ ul.jqtree-tree li.jqtree-ghost span.jqtree-line {
|
|||
|
||||
.first-letter-capitalize::first-letter {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
#whats_new_popin{
|
||||
background-color: #3C3C3C;
|
||||
}
|
||||
|
||||
.close_whats_new{
|
||||
color:#3C3C3C;
|
||||
}
|
||||
|
||||
#whats_new h3{
|
||||
color: #CCCCCC;
|
||||
}
|
||||
|
||||
#whats_new button{
|
||||
background-color:#2E2E2E;
|
||||
color:#777777;
|
||||
}
|
||||
|
||||
#whats_new button:hover{
|
||||
background-color:#1B1B1B;
|
||||
}
|
|
@ -166,6 +166,12 @@ elseif ($conf['piwigo_installed_version'] != PHPWG_VERSION)
|
|||
conf_update_param('piwigo_installed_version', PHPWG_VERSION);
|
||||
}
|
||||
|
||||
if (!isset($conf['last_major_update']))
|
||||
{
|
||||
list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
|
||||
conf_update_param('last_major_update', $dbnow, true);
|
||||
}
|
||||
|
||||
// 2022-02-25 due to escape on "rank" (becoming a mysql keyword in version 8), the $conf['order_by'] might
|
||||
// use a "rank", even if admin/configuration.php should have removed it. We must remove it.
|
||||
// TODO remove this data update as soon as 2025 arrives
|
||||
|
@ -222,6 +228,8 @@ load_language('common.lang');
|
|||
if ( is_admin() || (defined('IN_ADMIN') and IN_ADMIN) )
|
||||
{
|
||||
load_language('admin.lang');
|
||||
// Add language for temporary strings for new popup, from piwigo 15
|
||||
load_language('whats_new_'.get_branch_from_version(PHPWG_VERSION).'.lang');
|
||||
}
|
||||
trigger_notify('loading_lang');
|
||||
load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
|
||||
|
|
|
@ -486,6 +486,8 @@ else
|
|||
|
||||
$user = build_user(1, true);
|
||||
log_user($user['id'], false);
|
||||
|
||||
$user['preferences']['show_whats_new_'.get_branch(PHPWG_VERSION)] = false;
|
||||
|
||||
// newsletter subscription
|
||||
if ($is_newsletter_subscribe)
|
||||
|
@ -497,9 +499,11 @@ else
|
|||
array('origin' => 'installation')
|
||||
);
|
||||
|
||||
userprefs_update_param('show_newsletter_subscription', false);
|
||||
$user['preferences']['show_newsletter_subscription'] = false;
|
||||
}
|
||||
|
||||
userprefs_save();
|
||||
|
||||
// email notification
|
||||
if (isset($_POST['send_credentials_by_mail']))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue