Add core update notification to admin dashboard

This commit is contained in:
Kijin Sung 2021-01-31 02:15:23 +09:00
parent d25690e3e9
commit 9c9629f7e1
5 changed files with 49 additions and 1 deletions

View file

@ -340,6 +340,8 @@ $lang->user_theme = 'User Theme';
$lang->user_define = 'User Defined';
$lang->by_you = 'User setting';
$lang->update_available = 'Update Available';
$lang->core_update_available = 'Rhymix $VERSION has been released.';
$lang->core_update_link = 'Download';
$lang->need_complete_configuration = 'Please complete configuration of recently updated modules.';
$lang->need_complete_configuration_details = 'New features may not function properly until their configuration has been completed.';
$lang->need_update_and_table = 'Need to Create DB Table and Update Module';

View file

@ -335,7 +335,9 @@ $lang->msg_thumbnail_not_exist = '썸네일이 없습니다';
$lang->user_theme = '사용자 테마';
$lang->user_define = '사용자 정의 테마';
$lang->by_you = '사용자 설정';
$lang->update_available = '업데이트 가능';
$lang->update_available = '업데이트가 있습니다.';
$lang->core_update_available = 'Rhymix $VERSION 버전이 릴리즈되었습니다.';
$lang->core_update_link = '다운로드';
$lang->need_complete_configuration = '업데이트된 모듈의 설정을 완료해야 합니다.';
$lang->need_complete_configuration_details = '설정을 완료하지 않으면 새 기능이 정상적으로 작동하지 않을 수 있습니다.';
$lang->need_update_and_table = 'DB Table 생성과 모듈 업데이트 필요';

View file

@ -101,6 +101,9 @@ body>.x,
.message.error h3 {
color: #943a38;
}
.message.core_update {
display: none;
}
.x h1 {
font-size: 22px;
}

View file

@ -37,6 +37,11 @@
</ul>
</div>
<div class="message update core_update" data-current-version="{\RX_VERSION}">
<h2>{$lang->update_available}</h2>
<p>{$lang->core_update_available} <a href="https://rhymix.org/" target="_blank">{$lang->core_update_link}</a></p>
</div>
<div class="message update" cond="$addTables || $needUpdate">
<h2>{$lang->need_complete_configuration}</h2>
<p>{$lang->need_complete_configuration_details}</p>

View file

@ -1,4 +1,40 @@
/* NAVER (developers@xpressengine.com) */
// core update check
jQuery(function($) {
var core_update = $('.core_update');
if (!core_update.size()) {
return;
}
var version_decode = function(str) {
var version_number = 0;
var extra_strings = '';
var parts = str.split(/[\.-]/);
$.each(parts, function(i, part) {
if (part.match(/^[0-9]+$/)) {
version_number += parseInt(part, 10) * Math.pow(1000, 3 - i);
} else {
extra_strings = extra_strings + part;
}
});
return String(version_number) + (extra_strings === '' ? 'z' : extra_strings);
};
var current_version = version_decode(core_update.data('current-version'));
$.ajax({
url: 'https://api.rhymix.org/version.json',
dataType: 'json',
cache: true,
success: function(data) {
var latest_version = version_decode(data.latest);
if (latest_version > current_version) {
var version_replace = core_update.find('p').first();
version_replace.html(version_replace.html().replace('$VERSION', data.latest));
core_update.show();
}
}
});
});
// install module
function doInstallModule(module) {
var params = [];