Browse Source

Ticket #4678 - Studio: Update blocks on Dashboard. Version.

AntonLV 2 years ago
parent
commit
95296d4b2d

+ 1 - 0
modules/boonex/english/data/langs/system/en.xml

@@ -632,6 +632,7 @@
 	<string name="_adm_dbd_txt_version_n_available"><![CDATA[UNA {0} is available!]]></string>
 	<string name="_adm_dbd_txt_script_on"><![CDATA[UNA on]]></string>
 	<string name="_adm_dbd_txt_htools_status"><![CDATA[{0} - <b>{1}</b>]]></string>
+        <string name="_adm_dbd_txt_available"><![CDATA[Available:]]></string>
 	<string name="_adm_dbd_txt_installed"><![CDATA[Installed:]]></string>
 	<string name="_adm_dbd_txt_updated"><![CDATA[Updated:]]></string>
 	<string name="_adm_dbd_txt_version"><![CDATA[Version:]]></string>

+ 2 - 0
modules/boonex/russian/data/langs/system/ru.xml

@@ -630,7 +630,9 @@
 	<string name="_adm_dbd_txt_version_n_available"><![CDATA[Новая версия UNA {0}!]]></string>
 	<string name="_adm_dbd_txt_script_on"><![CDATA[UNA на]]></string>
 	<string name="_adm_dbd_txt_htools_status"><![CDATA[{0} - <b>{1}</b>]]></string>
+        <string name="_adm_dbd_txt_available"><![CDATA[Доступна:]]></string>
 	<string name="_adm_dbd_txt_installed"><![CDATA[Установлено:]]></string>
+        <string name="_adm_dbd_txt_updated"><![CDATA[Обновлено:]]></string>
 	<string name="_adm_dbd_txt_version"><![CDATA[Версия:]]></string>
 	<string name="_adm_dbd_msg_upgrade_started"><![CDATA[Сайт будет обновлён через минуту. <br />После этого нужно <a href="{0}store.php?page=updates">проверить обновления для модулей</a>.]]></string>
 	<string name="_adm_dbd_txt_su_database"><![CDATA[База данных]]></string>

+ 9 - 6
studio/js/dashboard.js

@@ -29,16 +29,19 @@ BxDolStudioDashboard.prototype.checkForUpgrade = function() {
 	$.get(
 		this.sActionsUrl,
 		{
-			dbd_action: 'check_for_upgrade',
-			_t: oDate.getTime()
+                    dbd_action: 'check_for_upgrade',
+                    _t: oDate.getTime()
 		},
 		function(oData) {
-			bx_loading(sDivId, false);
+                    bx_loading(sDivId, false);
 
-			if(!oData.data)
-			    return;
+                    if(!oData.data)
+                        return;
 
-			$('#' + sDivId + ' .bx-dbd-version-available').html(oData.data).show();
+                    $('#' + sDivId + ' .bx-dbd-version-available b').html(oData.data.version).parents('.bx-dbd-version-available:hidden').show();
+                    
+                    if(oData.data.upgrade != undefined && parseInt(oData.data.upgrade) == 1)
+                        $('#' + sDivId + ' .bx-dbd-block-actions').show()
 		},
 		'json'
 	);

+ 5 - 0
studio/template/css/common.less

@@ -47,6 +47,11 @@ a:hover > .sys-icon-a i {
 .bx-db-content.bx-content-padding-block {
     padding: 1.5rem;
 }
+.bx-db-content.bx-content-padding-block .bx-dbd-block-actions {
+    margin-left: -1.5rem;
+    margin-right: -1.5rem;
+    padding: 1.5rem 1.5rem 0 1.5rem;
+}
 .bx-db-content.bx-def-padding-top {
     padding: 1rem;
 }

+ 11 - 28
studio/template/css/dashboard.css

@@ -11,34 +11,17 @@ div.bx-dbd-block-content {
 }
 
 /*--- Versions block ---*/
-div.bx-dbd-virsion-image {
-	position: absolute;
-	top: 0px;
-	left: 0px;
-}
-div.bx-dbd-virsion-image img {
-	width: 110px;
-	height: 110px;
-}
-div.bx-dbd-virsion-info {
-	position: relative;
-	min-height: 110px;
-	margin-left: 130px;
-}
-div.bx-dbd-vi-column {
-	position: relative;
-	float: left;
-	width: 50%;
-}
-div.bx-dbd-version-available {
-	display: none;
-}
-div.bx-dbd-version {
-	position: relative;
-	float: left;
-
-	line-height: 26px;
-	line-height: 1.6rem;
+div.bx-dbd-version-image img {
+    width: 110px;
+    height: 110px;
+}
+.bx-dbd-version-info .bx-dbd-vii-row {
+    display: -webkit-flex;
+    display: flex;
+    -webkit-align-items: center;
+    align-items: center;
+    -webkit-flex-wrap: nowrap;
+    flex-wrap: nowrap;
 }
 
 /*--- Chart based blocks ---*/

+ 20 - 13
studio/template/dbd_versions.html

@@ -1,20 +1,27 @@
-<div id="bx-dbd-version" class="bx-dbd-block-content bx-def-margin-bottom">
-    <div class="bx-dbd-virsion-image">
-        <img src="<bx_image_url:dbd_version.svg />"/>
+<div id="bx-dbd-version">
+    <div class="bx-dbd-block-content bx-def-margin-bottom">
+        <div class="bx-dbd-version-image">
+            <img src="<bx_image_url:dbd_version.svg />"/>
+        </div>
+        <div class="bx-dbd-version-info">
+            <div class="bx-dbd-vi-title bx-def-margin-sec-topbottom text-2xl font-semibold">__domain__ __version__</div>
+            <div class="bx-dbd-vi-info space-y-4">
+                <div class="bx-dbd-vii-row">
+                    <img class="pr-4" src="<bx_icon_url:db-vi-installed.svg />" /><bx_text:_adm_dbd_txt_installed /><b class="pl-2">__installed__</b>
+                </div>
+                <bx_if:show_update_info>
+                    <div class="bx-dbd-vii-row"><img class="pr-4" src="<bx_icon_url:db-vi-updated.svg />" /><bx_text:_adm_dbd_txt_updated /><b class="pl-2">__updated__</b></div>
+                </bx_if:show_update_info>
+                <div class="bx-dbd-vii-row bx-dbd-version-available" style="display:none"><img class="pr-4" src="<bx_icon_url:db-vi-available.svg />" /><bx_text:_adm_dbd_txt_available /><b class="pl-2"></b></div>
+            </div>
+        </div>
     </div>
-    <div class="bx-dbd-virsion-info">
-        <div class="bx-def-margin-thd-top"><bx_text:_adm_dbd_txt_script_on />&nbsp;<b>__domain__</b></div>
-        <div class="bx-def-margin-thd-top">
-			<bx_text:_adm_dbd_txt_version />&nbsp;<b>__version__</b>&nbsp;<bx_text:_adm_dbd_txt_installed />&nbsp;<b>__installed__</b>
-			<bx_if:show_update_info>
-				&nbsp;<bx_text:_adm_dbd_txt_updated />&nbsp;<b>__updated__</b>
-			</bx_if:show_update_info>
-		</div>
-        <div class="bx-dbd-version-available bx-def-margin-thd-top bx-clearfix"></div>
+    <div class="bx-dbd-block-actions border-t border-b-zinc-200" style="display:none">
+        <a class="bx-btn bx-btn-primary" href="javascript:void(0)" onclick="javascript:__js_object__.performUpgrade()"><bx_text:_adm_dbd_btn_update /></a>
     </div>
     <script language="javascript">
         $(document).ready(function() {
             __js_object__.checkForUpgrade();
         });
     </script>
-</div>
+</div>

+ 0 - 6
studio/template/dbd_versions_upgrade.html

@@ -1,6 +0,0 @@
-<bx_if:show_version_available>
-	<div class="bx-dbd-version bx-def-margin-thd-right col-red1">__version_available__</div>
-</bx_if:show_version_available>
-<bx_if:show_upgrade_available>
-	<a class="bx-btn bx-btn-small" href="javascript:void(0)" onclick="javascript:__js_object__.performUpgrade()"><bx_text:_adm_dbd_btn_update /></a>
-</bx_if:show_upgrade_available>

+ 13 - 0
studio/template/images/icons/db-vi-available.svg

@@ -0,0 +1,13 @@
+<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
+<rect width="32" height="32" rx="8" fill="#E4E4E7"/>
+<g clip-path="url(#clip0_20_209)">
+<path d="M7 16C7 17.1819 7.23279 18.3522 7.68508 19.4442C8.13738 20.5361 8.80031 21.5282 9.63604 22.364C10.4718 23.1997 11.4639 23.8626 12.5558 24.3149C13.6478 24.7672 14.8181 25 16 25C17.1819 25 18.3522 24.7672 19.4442 24.3149C20.5361 23.8626 21.5282 23.1997 22.364 22.364C23.1997 21.5282 23.8626 20.5361 24.3149 19.4442C24.7672 18.3522 25 17.1819 25 16C25 14.8181 24.7672 13.6478 24.3149 12.5558C23.8626 11.4639 23.1997 10.4718 22.364 9.63604C21.5282 8.80031 20.5361 8.13738 19.4442 7.68508C18.3522 7.23279 17.1819 7 16 7C14.8181 7 13.6478 7.23279 12.5558 7.68508C11.4639 8.13738 10.4718 8.80031 9.63604 9.63604C8.80031 10.4718 8.13738 11.4639 7.68508 12.5558C7.23279 13.6478 7 14.8181 7 16Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M16 13V17" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M16 20V20.01" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</g>
+<defs>
+<clipPath id="clip0_20_209">
+<rect width="24" height="24" fill="white" transform="translate(4 4)"/>
+</clipPath>
+</defs>
+</svg>

+ 12 - 0
studio/template/images/icons/db-vi-installed.svg

@@ -0,0 +1,12 @@
+<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
+<rect width="32" height="32" rx="8" fill="#E4E4E7"/>
+<g clip-path="url(#clip0_20_190)">
+<path d="M7 16C7 17.1819 7.23279 18.3522 7.68508 19.4442C8.13738 20.5361 8.80031 21.5282 9.63604 22.364C10.4718 23.1997 11.4639 23.8626 12.5558 24.3149C13.6478 24.7672 14.8181 25 16 25C17.1819 25 18.3522 24.7672 19.4442 24.3149C20.5361 23.8626 21.5282 23.1997 22.364 22.364C23.1997 21.5282 23.8626 20.5361 24.3149 19.4442C24.7672 18.3522 25 17.1819 25 16C25 14.8181 24.7672 13.6478 24.3149 12.5558C23.8626 11.4639 23.1997 10.4718 22.364 9.63604C21.5282 8.80031 20.5361 8.13738 19.4442 7.68508C18.3522 7.23279 17.1819 7 16 7C14.8181 7 13.6478 7.23279 12.5558 7.68508C11.4639 8.13738 10.4718 8.80031 9.63604 9.63604C8.80031 10.4718 8.13738 11.4639 7.68508 12.5558C7.23279 13.6478 7 14.8181 7 16Z" stroke="#27272A" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M13 16L15 18L19 14" stroke="#27272A" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</g>
+<defs>
+<clipPath id="clip0_20_190">
+<rect width="24" height="24" fill="white" transform="translate(4 4)"/>
+</clipPath>
+</defs>
+</svg>

+ 11 - 0
studio/template/images/icons/db-vi-updated.svg

@@ -0,0 +1,11 @@
+<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
+<rect width="32" height="32" rx="8" fill="#E4E4E7"/>
+<g clip-path="url(#clip0_20_200)">
+<path d="M23.95 15C23.6971 13.0707 22.7498 11.2998 21.2853 10.0186C19.8209 8.73746 17.9397 8.03395 15.9939 8.03977C14.0482 8.04558 12.1712 8.76034 10.7145 10.0502C9.25771 11.3401 8.32098 13.1167 8.07963 15.0475C7.83829 16.9782 8.30888 18.9307 9.40332 20.5395C10.4978 22.1483 12.141 23.3031 14.0254 23.7877C15.9099 24.2722 17.9064 24.0534 19.6411 23.1722C21.3759 22.2909 22.73 20.8076 23.45 19M23.95 24V19H18.95" stroke="#27272A" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</g>
+<defs>
+<clipPath id="clip0_20_200">
+<rect width="24" height="24" fill="white" transform="translate(4 4)"/>
+</clipPath>
+</defs>
+</svg>

+ 10 - 20
studio/template/images/icons/wi-launcher.svg

@@ -1,28 +1,18 @@
 <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
-<g filter="url(#filter0_d_57_1596)">
-<rect width="48" height="48" rx="8" fill="url(#paint0_linear_57_1596)"/>
-<g clip-path="url(#clip0_57_1596)">
-<path d="M13.3333 14.6667C13.3333 14.3131 13.4738 13.9739 13.7238 13.7239C13.9739 13.4738 14.313 13.3333 14.6666 13.3333H20C20.3536 13.3333 20.6927 13.4738 20.9428 13.7239C21.1928 13.9739 21.3333 14.3131 21.3333 14.6667V20C21.3333 20.3536 21.1928 20.6928 20.9428 20.9428C20.6927 21.1929 20.3536 21.3333 20 21.3333H14.6666C14.313 21.3333 13.9739 21.1929 13.7238 20.9428C13.4738 20.6928 13.3333 20.3536 13.3333 20V14.6667Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M26.6667 14.6667C26.6667 14.3131 26.8072 13.9739 27.0572 13.7239C27.3073 13.4738 27.6464 13.3333 28 13.3333H33.3334C33.687 13.3333 34.0261 13.4738 34.2762 13.7239C34.5262 13.9739 34.6667 14.3131 34.6667 14.6667V20C34.6667 20.3536 34.5262 20.6928 34.2762 20.9428C34.0261 21.1929 33.687 21.3333 33.3334 21.3333H28C27.6464 21.3333 27.3073 21.1929 27.0572 20.9428C26.8072 20.6928 26.6667 20.3536 26.6667 20V14.6667Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M13.3333 28C13.3333 27.6464 13.4738 27.3072 13.7238 27.0572C13.9739 26.8071 14.313 26.6667 14.6666 26.6667H20C20.3536 26.6667 20.6927 26.8071 20.9428 27.0572C21.1928 27.3072 21.3333 27.6464 21.3333 28V33.3333C21.3333 33.6869 21.1928 34.0261 20.9428 34.2761C20.6927 34.5262 20.3536 34.6667 20 34.6667H14.6666C14.313 34.6667 13.9739 34.5262 13.7238 34.2761C13.4738 34.0261 13.3333 33.6869 13.3333 33.3333V28Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M26.6667 28C26.6667 27.6464 26.8072 27.3072 27.0572 27.0572C27.3073 26.8071 27.6464 26.6667 28 26.6667H33.3334C33.687 26.6667 34.0261 26.8071 34.2762 27.0572C34.5262 27.3072 34.6667 27.6464 34.6667 28V33.3333C34.6667 33.6869 34.5262 34.0261 34.2762 34.2761C34.0261 34.5262 33.687 34.6667 33.3334 34.6667H28C27.6464 34.6667 27.3073 34.5262 27.0572 34.2761C26.8072 34.0261 26.6667 33.6869 26.6667 33.3333V28Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
-</g>
+<mask id="mask0_206_1321" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="48" height="48">
+<path d="M48 0H0V48H48V0Z" fill="white"/>
+</mask>
+<g mask="url(#mask0_206_1321)">
+<path d="M40 0H8C3.58172 0 0 3.58172 0 8V40C0 44.4183 3.58172 48 8 48H40C44.4183 48 48 44.4183 48 40V8C48 3.58172 44.4183 0 40 0Z" fill="url(#paint0_linear_206_1321)"/>
+<path d="M10.6667 32C10.6667 29.9461 10.6667 28.9191 11.129 28.1647C11.3877 27.7425 11.7426 27.3876 12.1647 27.1289C12.9191 26.6667 13.9461 26.6667 16 26.6667C18.0539 26.6667 19.0809 26.6667 19.8353 27.1289C20.2574 27.3876 20.6124 27.7425 20.871 28.1647C21.3334 28.9191 21.3334 29.9461 21.3334 32C21.3334 34.0539 21.3334 35.0809 20.871 35.8353C20.6124 36.2575 20.2574 36.6124 19.8353 36.8711C19.0809 37.3333 18.0539 37.3333 16 37.3333C13.9461 37.3333 12.9191 37.3333 12.1647 36.8711C11.7426 36.6124 11.3877 36.2575 11.129 35.8353C10.6667 35.0809 10.6667 34.0539 10.6667 32Z" stroke="white" stroke-width="2"/>
+<path d="M26.6667 32C26.6667 29.9461 26.6667 28.9191 27.129 28.1647C27.3876 27.7425 27.7426 27.3876 28.1647 27.1289C28.9191 26.6667 29.9462 26.6667 32 26.6667C34.0539 26.6667 35.081 26.6667 35.8354 27.1289C36.2575 27.3876 36.6124 27.7425 36.8711 28.1647C37.3334 28.9191 37.3334 29.9461 37.3334 32C37.3334 34.0539 37.3334 35.0809 36.8711 35.8353C36.6124 36.2575 36.2575 36.6124 35.8354 36.8711C35.081 37.3333 34.0539 37.3333 32 37.3333C29.9462 37.3333 28.9191 37.3333 28.1647 36.8711C27.7426 36.6124 27.3876 36.2575 27.129 35.8353C26.6667 35.0809 26.6667 34.0539 26.6667 32Z" stroke="white" stroke-width="2"/>
+<path d="M10.6667 16C10.6667 13.9461 10.6667 12.9191 11.129 12.1647C11.3877 11.7426 11.7426 11.3877 12.1647 11.129C12.9191 10.6667 13.9461 10.6667 16 10.6667C18.0539 10.6667 19.0809 10.6667 19.8353 11.129C20.2574 11.3877 20.6124 11.7426 20.871 12.1647C21.3334 12.9191 21.3334 13.9461 21.3334 16C21.3334 18.0539 21.3334 19.0809 20.871 19.8353C20.6124 20.2574 20.2574 20.6124 19.8353 20.871C19.0809 21.3334 18.0539 21.3334 16 21.3334C13.9461 21.3334 12.9191 21.3334 12.1647 20.871C11.7426 20.6124 11.3877 20.2574 11.129 19.8353C10.6667 19.0809 10.6667 18.0539 10.6667 16Z" stroke="white" stroke-width="2"/>
+<path d="M26.6667 16C26.6667 13.9461 26.6667 12.9191 27.129 12.1647C27.3876 11.7426 27.7426 11.3877 28.1647 11.129C28.9191 10.6667 29.9462 10.6667 32 10.6667C34.0539 10.6667 35.081 10.6667 35.8354 11.129C36.2575 11.3877 36.6124 11.7426 36.8711 12.1647C37.3334 12.9191 37.3334 13.9461 37.3334 16C37.3334 18.0539 37.3334 19.0809 36.8711 19.8353C36.6124 20.2574 36.2575 20.6124 35.8354 20.871C35.081 21.3334 34.0539 21.3334 32 21.3334C29.9462 21.3334 28.9191 21.3334 28.1647 20.871C27.7426 20.6124 27.3876 20.2574 27.129 19.8353C26.6667 19.0809 26.6667 18.0539 26.6667 16Z" stroke="white" stroke-width="2"/>
 </g>
 <defs>
-<filter id="filter0_d_57_1596" x="0" y="0" width="48" height="48" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
-<feFlood flood-opacity="0" result="BackgroundImageFix"/>
-<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
-<feOffset/>
-<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0"/>
-<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_57_1596"/>
-<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_57_1596" result="shape"/>
-</filter>
-<linearGradient id="paint0_linear_57_1596" x1="24" y1="0" x2="24" y2="48" gradientUnits="userSpaceOnUse">
+<linearGradient id="paint0_linear_206_1321" x1="24" y1="0" x2="24" y2="48" gradientUnits="userSpaceOnUse">
 <stop stop-color="#71717A"/>
 <stop offset="1" stop-color="#52525B"/>
 </linearGradient>
-<clipPath id="clip0_57_1596">
-<rect width="32" height="32" fill="white" transform="translate(8 8)"/>
-</clipPath>
 </defs>
 </svg>

+ 13 - 26
studio/template/scripts/BxBaseStudioDashboard.php

@@ -68,25 +68,12 @@ class BxBaseStudioDashboard extends BxDolStudioDashboard
     {
         list($sVersionAvailable, $bUpgradeAvailable) = $this->getVersionUpgradeAvailable();
         if(!$sVersionAvailable && !$bUpgradeAvailable)
-            return '';
+            return [];
 
-        if($sVersionAvailable !== false)
-            $sVersionAvailable = _t('_adm_dbd_txt_version_n_available', $sVersionAvailable);
-
-            return BxDolStudioTemplate::getInstance()->parseHtmlByName('dbd_versions_upgrade.html', array(
-                'bx_if:show_version_available' => array(
-                'condition' => !empty($sVersionAvailable),
-                'content' => array(
-                    'version_available' => $sVersionAvailable
-                )
-            ),
-            'bx_if:show_upgrade_available' => array(
-                'condition' => $bUpgradeAvailable,
-                'content' => array(
-                    'js_object' => $this->getPageJsObject()
-                )
-            )
-        ));
+        return [
+            'version' => $sVersionAvailable, 
+            'upgrade' => (int)$bUpgradeAvailable
+        ];
     }
 
     public function serviceGetWidgetNotices() {
@@ -111,21 +98,21 @@ class BxBaseStudioDashboard extends BxDolStudioDashboard
     	return $iResult;
     }
 
-	public function serviceGetBlockVersion()
+    public function serviceGetBlockVersion()
     {
     	$sJsObject = $this->getPageJsObject();
         $aSysInfo = BxDolModuleQuery::getInstance()->getModuleByName('system');
         $sContent = BxDolStudioTemplate::getInstance()->parseHtmlByName('dbd_versions.html', array(
-        	'js_object' => $sJsObject,
+            'js_object' => $sJsObject,
             'domain' => getParam('site_title'),
             'version' => bx_get_ver(),
             'installed' => bx_time_js($aSysInfo['date']),
-			'bx_if:show_update_info' => array(
-        		'condition' => $aSysInfo['updated'] > 0,
-        		'content' => array(
-		        	'updated' => bx_time_js($aSysInfo['updated']),
-       			)
-       		),
+            'bx_if:show_update_info' => array(
+                'condition' => $aSysInfo['updated'] > 0,
+                'content' => array(
+                    'updated' => bx_time_js($aSysInfo['updated']),
+                )
+            ),
         ));
 
     	return array('content' => $sContent);