1
0
Эх сурвалжийг харах

#31 - Store fixes and improvements.

AntonLV 12 жил өмнө
parent
commit
8bfdad8783

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

@@ -1198,6 +1198,7 @@
 	<string name="_adm_str_txt_pv_updated"><![CDATA[Updated]]></string>
 	<string name="_adm_str_txt_pv_vendor"><![CDATA[Vendor]]></string>
 	<string name="_adm_str_txt_pv_version"><![CDATA[Version]]></string>
+	<string name="_adm_str_txt_pv_version_mask"><![CDATA[{0} ({1} is available)]]></string>
 	<string name="_adm_str_txt_update_from_to"><![CDATA[{0} - {1}]]></string>
 	<string name="_adm_tmi_cpt_edit"><![CDATA[Manage Launcher]]></string>
 	<string name="_adm_tmi_cpt_favorite"><![CDATA[Show Favorite Only]]></string>

+ 2 - 1
studio/classes/BxDolStudioInstallerUtils.php

@@ -367,13 +367,14 @@ class BxDolStudioInstallerUtils extends BxDolInstallerUtils implements iBxDolSin
 
         $bInstalled = !empty($aInstalledPathes) && in_array($sModulePath, $aInstalledPathes);
         $bEnabled = $bInstalled && !empty($aInstalledInfo) && (int)$aInstalledInfo[$sModulePath]['enabled'] == 1;
+        $sVersion = $bInstalled && !empty($aInstalledInfo) ? $aInstalledInfo[$sModulePath]['version'] : $aConfig['version'];
 
         return array(
         	'type' => $aConfig['type'],
             'name' => isset($aConfig['name']) ? $aConfig['name'] : $aConfig['home_uri'],
             'title' => bx_process_output($aConfig['title']),
             'vendor' => $aConfig['vendor'],
-            'version' => $aConfig['version'],
+            'version' => $sVersion,
             'uri' => $aConfig['home_uri'],
             'dir' => $aConfig['home_dir'],
             'note' => isset($aConfig['note']) ? bx_process_output($aConfig['note']) : '',

+ 9 - 6
studio/template/scripts/BxBaseStudioStore.php

@@ -430,20 +430,21 @@ class BxBaseStudioStore extends BxDolStudioStore
         if(empty($aProduct) || !is_array($aProduct))
             return array('code' => 1, 'message' => (!empty($aProduct) ? $aProduct : _t('_adm_str_err_no_product_info')));
 
-		$aDownloaded = $this->getDownloadedModules();
+		$aDownloaded = $this->getDownloadedModules(false);
 
         $bFree = (int)$aProduct['is_free'] == 1;
         $bPurchased = (int)$aProduct['is_purchased'] == 1;
 
         $bDownloadable = (int)$aProduct['is_file'] == 1;
-        $bDownloaded = in_array($aProduct['name'], $aDownloaded);
+        $bDownloaded = array_key_exists($sModuleName, $aDownloaded);
         $bDownload = ($bFree || $bPurchased) && $bDownloadable;
 
         $bDiscount = !empty($aProduct['discount']);
-        $bScreenshots = is_array($aProduct['screenshots']) && !empty($aProduct['screenshots']);
+        $sVersion = $bDownloaded && version_compare($aDownloaded[$sModuleName]['version'], $aProduct['version']) != 0 ? _t('_adm_str_txt_pv_version_mask', $aDownloaded[$sModuleName]['version'], $aProduct['version']) : $aProduct['version'];
 
         $iScreenshots = 0;
         $aScreenshots = array();
+        $bScreenshots = is_array($aProduct['screenshots']) && !empty($aProduct['screenshots']);
         if($bScreenshots) {
             $iScreenshots = count($aProduct['screenshots']);
             foreach($aProduct['screenshots'] as $aScreenshot)
@@ -459,7 +460,7 @@ class BxBaseStudioStore extends BxDolStudioStore
             'url' => $aProduct['url'],
             'author_name' => $aProduct['author_name'],
             'author_url' => $aProduct['author_url'],
-            'version' => $aProduct['version'],
+            'version' => $sVersion,
             'price' => !$bFree ? _t('_adm_str_txt_price_csign', $aProduct['author_currency_sign'], $aProduct['price']) : _t('_adm_str_txt_price_free'),
             'bx_if:show_discount' => array(
                 'condition' => !$bFree && $bDiscount,
@@ -689,10 +690,12 @@ class BxBaseStudioStore extends BxDolStudioStore
         return $sResult;
     }
 
-    private function getDownloadedModules()
+    private function getDownloadedModules($bNamesOnly = true)
     {
 		bx_import('BxDolStudioInstallerUtils');
-        return array_keys(BxDolStudioInstallerUtils::getInstance()->getModules(false));
+		$aModules = BxDolStudioInstallerUtils::getInstance()->getModules(false);
+
+        return $bNamesOnly ? array_keys($aModules) : $aModules;
     }
 }