#1467 Minor fixes and comment adding

This commit is contained in:
Zacharie Guet
2021-10-16 11:31:37 +02:00
parent 6074e3fd46
commit 1a6fadb468
9 changed files with 137 additions and 40 deletions
+1
View File
@@ -376,6 +376,7 @@ DELETE FROM '. PLUGINS_TABLE .'
}
// Retrieve PEM versions
// Beta test : return last version on PEM if the current version isn't known or else return the current and the last version
function get_versions_to_check($beta_test=false, $version=PHPWG_VERSION)
{
global $conf;
+23 -6
View File
@@ -82,6 +82,8 @@ $template->assign('order_options',
// | start template output |
// +-----------------------------------------------------------------------+
// Beta test : show plugins of last version on PEM if the current version isn't present
// If the current version in known, give the current and last version's compatible plugins
$beta_test = false;
if(isset($_GET['beta-test']) && $_GET['beta-test'] == 'true')
@@ -115,26 +117,40 @@ if ($plugins->get_server_plugins(true, $beta_test))
. '&pwg_token='.get_pwg_token()
;
// get the age of the last revision in days
$last_revision_diff = date_diff(date_create($plugin['revision_date']), date_create());
$certification = 1;
$has_compatible_version = false;
if (get_branch_from_version($plugin['compatible_with_versions'][0]) !== get_branch_from_version(PHPWG_VERSION))
{
// Check if the current version is in the compatible version (not necessary if we are in beta test)
if ($beta_test) {
foreach ($plugin['compatible_with_versions'] as $vers) {
if (get_branch_from_version($vers) == get_branch_from_version(PHPWG_VERSION))
{
$has_compatible_version = true;
}
}
} else {
$has_compatible_version = true;
}
if (!$has_compatible_version) {
$certification = -1;
}
elseif ($last_revision_diff->days < 90)
}
elseif ($last_revision_diff->days < 90) // if the last revision is new of 3 month or less
{
$certification = 3;
}
elseif ($last_revision_diff->days < 180)
elseif ($last_revision_diff->days < 180) // 6 month or less
{
$certification = 2;
}
elseif ($last_revision_diff->y > 3)
elseif ($last_revision_diff->y > 3) // 3 years or less
{
$certification = 0;
}
// Between 6 month and 3 years : certification = 1
$template->append('plugins', array(
'ID' => $plugin['extension_id'],
@@ -144,6 +160,7 @@ if ($plugins->get_server_plugins(true, $beta_test))
'BIG_DESC' => $ext_desc,
'VERSION' => $plugin['revision_name'],
'REVISION_DATE' => preg_replace('/[^0-9]/', '', strtotime($plugin['revision_date'])),
'REVISION_FORMATED_DATE' => format_date($plugin['revision_date'], array('day','month','year')),
'AUTHOR' => $plugin['author_name'],
'DOWNLOADS' => $plugin['extension_nb_downloads'],
'URL_INSTALL' => $url_auto_install,
+4
View File
@@ -457,6 +457,10 @@ label>p.group_select {
background-color: white;
}
.slider::after {
color: white;
}
input:checked + .slider {
background-color: #ffa646;
}
+24 -4
View File
@@ -1,3 +1,4 @@
// <-- Define sort orders -->
var sortOrder = 'date';
var sortPlugins = (function (a, b) {
if (sortOrder == 'downloads' || sortOrder == 'revision' || sortOrder == 'date')
@@ -10,9 +11,14 @@ var sortPlugins = (function (a, b) {
$(function () {
// <-- Set the advanced filters -->
let betaTestPlugins = $('#showBetaTestPlugin')[0].hasAttribute('checked');
// object that remember filters states (initialized later)
let filters = {};
// toggle advanced filter's panel
$(".advanced-filter-btn").click(advanced_filter_button_click);
$(".advanced-filter span.icon-cancel").click(advanced_filter_hide);
@@ -68,9 +74,11 @@ $(function () {
displayStars(ratingContainer.find('.rating-star-container'), rating);
})
let authorNames = [{ value: '', text: str_all }];
let tagsNames = [{ value: '', text: str_all }]
// put default values in the select
let authorNames = [{ value: '', text: "-" }];
let tagsNames = [{ value: '', text: "-" }]
// read all plugin boxes to get author and tags
$('.pluginBox').each((i,el) => {
let author = $(el).data('author');
author.split(', ').forEach(name => {
@@ -136,6 +144,7 @@ $(function () {
}
});
// All the slider values and it's corresponding month's number and label
function value_to_month(val) {
switch (val) {
case 6:
@@ -157,11 +166,12 @@ $(function () {
return [60, str_x_years.replace('%d', 5)];
break;
default:
return [240, str_x_years.replace('%d', 20)];
return [Number.MAX_SAFE_INTEGER, str_from_begining];
break;
}
}
// The certification filter dosen't include incompatible if the beta-test option is not checked
let minCertification = betaTestPlugins ? -1 : 0;
$('.certification-filter-slider').slider({
@@ -175,6 +185,7 @@ $(function () {
}
});
// Diffrence between two dates, in months
function monthDiff(d1, d2) {
var months;
months = (d2.getFullYear() - d1.getFullYear()) * 12;
@@ -206,6 +217,8 @@ $(function () {
}
}
// Updates labels when input change
function updateRatingFilterLabel(value) {
displayStars($('.advanced-filter-rating .rating-star-container'), value);
}
@@ -227,6 +240,10 @@ $(function () {
$('.revision-date').html(label);
}
// <-- Apply advanced filters -->
// object that remember filters states
filters = {
"search": $('#search').val(),
"author": '',
@@ -285,6 +302,9 @@ $(function () {
})
$('#showBetaTestPlugin').on('change', (e) => {
$('.beta-test-plugin-switch .slider').addClass('loading');
let queryParams = new URLSearchParams(window.location.search);
queryParams.set("beta-test", e.currentTarget.checked.toString());
+16 -16
View File
@@ -14,21 +14,21 @@
{combine_css path="admin/themes/default/css/components/general.css"}
{footer_script}
const str_confirm_msg = '{"Yes, I am sure"|@translate}';
const str_cancel_msg = "{"No, I have changed my mind"|@translate}";
const str_install_title = '{'Are you sure you want to install the plugin "%s"?'|@translate|@escape:'javascript'}';
const str_confirm_msg = "{"Yes, I am sure"|@translate}";
const str_cancel_msg = "{"No, I have chaged my mind"|@translate}";
const str_install_title = "{'Are you sure you want to install the plugin "%s"?'|@translate|@escape:'javascript'}";
const strs_certification = {
"-1" : '{'This plugin is incompatible with your version'|@translate}',
"0" : '{'This plugin have no update since 3 years ! It may be outdated'|@translate}',
"1" : '{'This plugin has no recent update'|@translate}',
"2" : '{'This plugin was updated less than 6 months ago'|@translate}',
"3" : '{'This plugin have been updated recently'|@translate}',
"-1" : "{'This plugin is incompatible with your version'|@translate}",
"0" : "{'This plugin have no update since 3 years ! It may be outdated'|@translate}",
"1" : "{'This plugin has no recent update'|@translate}",
"2" : "{'This plugin was updated less than 6 months ago'|@translate}",
"3" : "{'This plugin have been updated recently'|@translate}",
};
const str_all = '{"All of them"|@translate}'
const str_x_month = '{"%d month"|@translate}';
const str_x_months = '{"%d months"|@translate}';
const str_x_year = '{"%d year"|@translate}';
const str_x_years = '{"%d years"|@translate}';
const str_x_month = "{"%d month"|@translate}";
const str_x_months = "{"%d months"|@translate}";
const str_x_year = "{"%d year"|@translate}";
const str_x_years = "{"%d years"|@translate}";
const str_from_begining = "{"since the beginning"|@translate}";
{/footer_script}
<div class="titrePage">
@@ -166,11 +166,11 @@ const str_x_years = '{"%d years"|@translate}';
{elseif $plugin.CERTIFICATION == 0}
title="{'This plugin have no update since 3 years ! It may be outdated'|@translate}"
{elseif $plugin.CERTIFICATION == -1}
title="{' This plugin is incompatible with your version'|@translate}"
title="{'This plugin is incompatible with your version'|@translate}"
{/if}
></i>
</div>
<div class="pluginAuthorVersion">{'By %s'|@translate:$plugin.AUTHOR}</div>
<div class="pluginAuthorVersion">{'by %s'|@translate:$plugin.AUTHOR}</div>
</div>
<div>
@@ -187,7 +187,7 @@ const str_x_years = '{"%d years"|@translate}';
</div>
{/if}
<div class="pluginDownload" title="{$plugin.DOWNLOADS} {'Downloads'|@translate}"><i class="icon-download">{$plugin.DOWNLOADS}</i></div>
<div class="pluginDownload" title="{'Version %s'|@translate:$plugin.VERSION}"><i class="icon-flow-branch"></i>{'Version %s'|@translate:$plugin.VERSION}</div>
<div class="pluginDownload" title="{$plugin.REVISION_FORMATED_DATE}"><i class="icon-flow-branch"></i>{'Version %s'|@translate:$plugin.VERSION}</div>
<a class="pluginLink" href="{$plugin.EXT_URL}"><i class="icon-link"></i>{'Website'|@translate}</a>
</div>
+53 -12
View File
@@ -1995,6 +1995,7 @@ h2:lang(en) { text-transform:capitalize; }
align-items: center;
justify-content: end;
margin-bottom: 10px;
position: relative;
}
.sort-actions > * {
@@ -2003,24 +2004,21 @@ h2:lang(en) { text-transform:capitalize; }
.sort-by {
display: flex;
flex-direction: column;
position: relative;
align-items: baseline;
}
.sort-by label {
color: #A4A4A4;
color: #777;
font-weight: bold;
font-size: 1.1em;
position: absolute;
top: 0;
left: 0;
transform: translateY(-100%);
margin-right: 10px;
}
.sort-by select {
display: block;
padding: 10px 18px;
width: 290px;
width: 230px;
}
@@ -2034,6 +2032,16 @@ h2:lang(en) { text-transform:capitalize; }
position: relative;
}
.beta-test-plugin-switch {
position: absolute;
left: 0;
}
.beta-test-plugin-switch label {
font-weight: bold;
margin-left: 5px;
}
#availablePlugins {
display: flex;
flex-wrap: wrap;
@@ -2050,6 +2058,11 @@ h2:lang(en) { text-transform:capitalize; }
margin-left: 5px;
}
.advanced-filter-revision-date .advanced-filter-item-label {
display: inline !important;
}
.pluginFilter {justify-content: end;position: absolute;right: 160px; z-index: 2; transform: translateY(6px);}
.pluginBox {
@@ -2273,6 +2286,7 @@ h2:lang(en) { text-transform:capitalize; }
.pluginTags {
display: flex;
flex-wrap: wrap;
margin-bottom: 4px;
}
.pluginTags > span {
@@ -2282,6 +2296,7 @@ h2:lang(en) { text-transform:capitalize; }
margin-right: 5px;
margin-bottom: 5px;
white-space: nowrap;
margin-top: 4px;
}
.pluginActions a {
@@ -4202,7 +4217,7 @@ input[type="text"].dError {border-color:#ff7070; background-color:#FFe5e5;}
transition: 1s;
}
.slider:before {
.slider:before, .slider::after {
position: absolute;
content: "";
height: 16px;
@@ -4213,10 +4228,36 @@ input[type="text"].dError {border-color:#ff7070; background-color:#FFe5e5;}
transition: .4s;
}
input:checked + .slider:before {
-webkit-transform: translateX(33px);
-ms-transform: translateX(33px);
transform: translateX(33px);
.slider::after {
content: "\E81D";
font-family: 'fontello';
font-size: 15px;
animation-name: spin;
animation-duration: .5s;
animation-iteration-count: infinite;
animation-timing-function: linear;
opacity: 0;
}
@keyframes spin {
from {
transform:rotate(0deg);
}
to {
transform:rotate(360deg);
}
}
input:checked + .slider:before, input:checked + .slider::after {
margin-left: 33px;
}
.slider.loading::before {
opacity: 0;
}
.slider.loading::after {
opacity: 1;
}
.notUsable input.disabled + .slider.activate_disabled:before {
+4
View File
@@ -584,6 +584,10 @@ label>p.group_select {
background-color: #151515;
}
.slider::after {
color: #151515;
}
input:checked + .slider {
background-color: #ff8c27;
}
+6 -1
View File
@@ -1242,13 +1242,18 @@ $lang['No access to administration, can see private content with appropriate per
$lang['Can be shared by several individuals without conflict (they cannot change the password).'] = 'Can be shared by several individuals without conflict (they cannot change the password).';
$lang['Equivalent to deactivation. The user is still in the list, but can no longer log in.'] = 'Equivalent to deactivation. The user is still in the list, but can no longer log in.';
$lang['%s MB'] = '%s MB';
$lang['All of them'] = 'All';
$lang['Show beta test plugins'] = 'Show beta test plugins';
$lang['Rating greater than'] = 'Rating greater than';
$lang['Last revision date is newer than'] = 'Last revision date is newer than';
$lang['Certification higher or equal to'] = 'Certification higher or equal to';
$lang['On %d rating(s)'] = 'On %d rating(s)';
$lang['Version %s'] = 'Version %s';
$lang['since the beginning'] = 'since the beginning';
$lang['This plugin is incompatible with your version'] = 'This plugin is incompatible with your version';
$lang['This plugin have no update since 3 years ! It may be outdated'] = 'This plugin have no update since 3 years ! It may be outdated';
$lang['This plugin has no recent update'] = 'This plugin has no recent update';
$lang['This plugin was updated less than 6 months ago'] = 'This plugin was updated less than 6 months ago';
$lang['This plugin have been updated recently'] = 'This plugin have been updated recently';
$lang['Your selection'] = 'Your selection';
$lang['action successfully performed.'] = 'action successfully performed.';
$lang['%s lines'] = "%s lines";
+6 -1
View File
@@ -1240,13 +1240,18 @@ $lang['No access to administration, can see private content with appropriate per
$lang['Can be shared by several individuals without conflict (they cannot change the password).'] = 'Partageable entre plusieurs personnes sans rentrer en conflit (mot de passe non modifiable).';
$lang['Equivalent to deactivation. The user is still in the list, but can no longer log in.'] = 'Équivalent à une désactivation. L\'utilisateur est toujours dans la liste mais ne peut plus se connecter.';
$lang['%s MB'] = '%s Mo';
$lang['All of them'] = 'Tous';
$lang['Show beta test plugins'] = 'Montrer les plugins en beta test';
$lang['Rating greater than'] = 'Notation supérieure à';
$lang['Last revision date is newer than'] = 'Dernière révision récente d\'au moins';
$lang['Certification higher or equal to'] = 'Certification plus haute ou égale à';
$lang['On %d rating(s)'] = 'Sur %d notation(s)';
$lang['Version %s'] = 'Version %s';
$lang['since the beginning'] = 'depuis le début';
$lang['This plugin is incompatible with your version'] = 'Ce plugin est incompatible avec votre version';
$lang['This plugin have no update since 3 years ! It may be outdated'] = 'Ce plugin n\'a pas eu de mise à jour depuis 3 ans ! Il peut être obsolète';
$lang['This plugin has no recent update'] = 'Ce plugin n\'a pas de mise à jour récente';
$lang['This plugin was updated less than 6 months ago'] = 'Ce plugin a eu une mise à jour il y a moins de 6 mois';
$lang['This plugin have been updated recently'] = 'Ce plugin a été mis à jour récemment';
$lang['Display'] = 'Afficher';
$lang['Posted %s on %s'] = 'Posté %s sur %s';
$lang['Portraits'] = 'Portraits';