Просмотр исходного кода

Merge branch 'master' of https://github.com/unaio/una

AntonLV 6 лет назад
Родитель
Сommit
c13895c3f4

+ 1 - 1
install/sql/system.sql

@@ -315,7 +315,7 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex
 (@iCategoryId, 'sys_editor_default', '_adm_stg_cpt_option_sys_editor_default', 'sys_tinymce', 'digit', '', '', '', 50),
 (@iCategoryId, 'sys_captcha_default', '_adm_stg_cpt_option_sys_captcha_default', 'sys_recaptcha_new', 'digit', '', '', '', 51),
 (@iCategoryId, 'sys_player_default', '_adm_stg_cpt_option_sys_player_default', 'sys_html5', 'digit', '', '', '', 55),
-(@iCategoryId, 'sys_player_default_format', '_adm_stg_cpt_option_sys_player_default_format', 'sd', 'select', 'sd,hd', '', '', 56),
+(@iCategoryId, 'sys_player_default_format', '_adm_stg_cpt_option_sys_player_default_quality', 'sd', 'select', 'sd,hd', '', '', 56),
 
 (@iCategoryId, 'sys_live_updates_interval', '_adm_stg_cpt_option_sys_live_updates_interval', '10000', 'digit', '', '', '', 60),
 

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

@@ -1385,7 +1385,7 @@
 	<string name="_adm_stg_cpt_option_sys_default_payment"><![CDATA[Payment module]]></string>
     <string name="_adm_stg_cpt_option_sys_editor_default"><![CDATA[Default HTML editor]]></string>
 	<string name="_adm_stg_cpt_option_sys_player_default"><![CDATA[Default Player]]></string>
-	<string name="_adm_stg_cpt_option_sys_player_default_format"><![CDATA[Default video format]]></string>
+	<string name="_adm_stg_cpt_option_sys_player_default_quality"><![CDATA[Default video quality]]></string>
 	<string name="_adm_stg_cpt_option_sys_format_date"><![CDATA[Date Format]]></string>
 	<string name="_adm_stg_cpt_option_sys_format_datetime"><![CDATA[Datetime Format]]></string>
 	<string name="_adm_stg_cpt_option_sys_format_time"><![CDATA[Time Format]]></string>

+ 2 - 2
modules/boonex/market/classes/BxMarketDb.php

@@ -645,7 +645,7 @@ class BxMarketDb extends BxBaseModTextDb
                 );
 
                 $sWhereClause = " AND `tfe`.`content_id`=:content_id";
-                $sOrderClause = "`tfe`.`type` ASC, `tfe`.`version` DESC";
+                $sOrderClause = "`tfe`.`type` ASC, `tfe`.`order` DESC";
                 break;
 
 			case 'content_id_and_type':
@@ -677,7 +677,7 @@ class BxMarketDb extends BxBaseModTextDb
         		" . $sFieldsClause . "
             FROM `" . $sTable . "` AS `tfe`" . $sJoinClause . "
             WHERE 1" . $sWhereClause . $sOrderClause . $sLimitClause;
-
+        //echo   $aMethod['params'][0];
         return call_user_func_array(array($this, $aMethod['name']), $aMethod['params']);
     }
 

+ 51 - 34
modules/boonex/market/classes/BxMarketTemplate.php

@@ -351,44 +351,61 @@ class BxMarketTemplate extends BxBaseModTextTemplate
 
     protected function getAttachments($sStorage, $aData, $aParams = array())
     {
-    	$aFiles = $this->_oDb->getFile(array('type' => 'content_id_key_file_id', 'content_id' => $aData['id']));
+        $aFiles = $this->_oDb->getFile(array('type' => 'content_id_key_file_id', 'content_id' => $aData['id']));
 
-    	$aAttachments = parent::getAttachments($sStorage, $aData, $aParams);
-    	if(empty($aAttachments) || !is_array($aAttachments))
-    		return $aAttachments;
+        $aAttachments_ = parent::getAttachments($sStorage, $aData, $aParams);
+        $aAttachments = array();
+        foreach($aAttachments_ as $aAttachment) {
+            $aAttachments[(int)$aAttachment['id']] = $aAttachment;
+        }
+        
+        if(empty($aAttachments) || !is_array($aAttachments))
+            return $aAttachments;
 
         $aResults = array();
-    	foreach($aAttachments as $iIndex => $aAttachment) {
-    		$iAttachmentId = (int)$aAttachment['id'];
-
-    		$aAttachments[$iIndex]['class'] = (int)$aData['package'] == $iAttachmentId ? ' bx-market-attachment-main' : '';
-    		$aAttachments[$iIndex]['bx_if:main'] = array(
-    			'condition' => (int)$aData['package'] == $iAttachmentId,
-    			'content' => array()
-    		);
-
-    		$bAttachment = !empty($aFiles[$iAttachmentId]);
-    		$aAttachments[$iIndex]['bx_if:not_image']['content'] = array_merge($aAttachments[$iIndex]['bx_if:not_image']['content'], array(
-    			'file_type' => $bAttachment ? _t('_bx_market_form_entry_input_files_type_' . $aFiles[$iAttachmentId]['type']) : '',
-    			'bx_if:show_version' => array(
-    				'condition' => $bAttachment && $aFiles[$iAttachmentId]['type'] == BX_MARKET_FILE_TYPE_VERSION,
-    				'content' => array(
-    					'file_version' => $bAttachment ? $aFiles[$iAttachmentId]['version'] : ''
-    				)
-    			),
-    			'bx_if:show_update' => array(
-    				'condition' => $bAttachment && $aFiles[$iAttachmentId]['type'] == BX_MARKET_FILE_TYPE_UPDATE,
-    				'content' => array(
-    					'file_version_from_to' => $bAttachment ? _t('_bx_market_form_entry_input_files_version_from_x_to_y', $aFiles[$iAttachmentId]['version'], $aFiles[$iAttachmentId]['version_to']) : ''
-    				)
-    			)
-    		));
-
-    		$aFiles[$iAttachmentId] = $aAttachments[$iIndex];
-    		$aResults[$iAttachmentId] = $aAttachments[$iIndex];
-    	}
+        $sCaptionType = "";
+        foreach($aFiles as $iAttachmentId => $aFile) {
+            $aAttachments[$iAttachmentId]['class'] = (int)$aData['package'] == $iAttachmentId ? ' bx-market-attachment-main' : '';
+            $aAttachments[$iAttachmentId]['bx_if:main'] = array(
+                'condition' => (int)$aData['package'] == $iAttachmentId,
+                'content' => array()
+            );
+            
+            $bSeparatorNeeded = false;
+            if ($aFiles[$iAttachmentId]['type'] != $sCaptionType){
+                $bSeparatorNeeded = true;
+                $sCaptionType = $aFiles[$iAttachmentId]['type'];
+                
+
+            }
+            if ((int)$aData['package'] == $iAttachmentId){
+                $bSeparatorNeeded = true;
+                $sCaptionType = 'latest';
+            }
+            
+            $bAttachment = !empty($aFiles[$iAttachmentId]);
+            $aAttachments[$iAttachmentId]['bx_if:not_image']['content'] = array_merge($aAttachments[$iAttachmentId]['bx_if:not_image']['content'], array(
+                'file_type' => $bAttachment ? _t('_bx_market_form_entry_input_files_type_' . $aFiles[$iAttachmentId]['type']) : '',
+                'bx_if:show_version' => array(
+                    'condition' => $bAttachment && $aFiles[$iAttachmentId]['type'] == BX_MARKET_FILE_TYPE_VERSION,
+                    'content' => array(
+                        'file_version' => $bAttachment ? $aFiles[$iAttachmentId]['version'] : ''
+                    )
+                ),
+                'bx_if:show_update' => array(
+                    'condition' => $bAttachment && $aFiles[$iAttachmentId]['type'] == BX_MARKET_FILE_TYPE_UPDATE,
+                    'content' => array(
+                        'file_version_from_to' => $bAttachment ? _t('_bx_market_form_entry_input_files_version_from_x_to_y', $aFiles[$iAttachmentId]['version'], $aFiles[$iAttachmentId]['version_to']) : ''
+                    )
+                )
+            ));
+            $aAttachments[$iAttachmentId]['bx_if:show_separator'] = array('condition' => $bSeparatorNeeded, 'content' => array('type' => _t('_bx_market_form_entry_input_files_version_caption_' . $sCaptionType)));
+
+            $aFiles[$iAttachmentId] = $aAttachments[$iAttachmentId];
+            $aResults[$iAttachmentId] = $aAttachments[$iAttachmentId];
+        }
 
-    	return array_intersect_key($aFiles, $aResults);
+        return array_intersect_key($aFiles, $aResults);
     }
 
     protected function getAttachmentsImagesTranscoders ($sStorage = '')

+ 5 - 2
modules/boonex/market/install/langs/en.xml

@@ -88,7 +88,7 @@
 	<string name="_bx_market_form_entry_input_files_type_update"><![CDATA[update]]></string>
 	<string name="_bx_market_form_entry_input_files_version_from"><![CDATA[Version from:]]></string>
 	<string name="_bx_market_form_entry_input_files_version_to"><![CDATA[Version to:]]></string>
-	<string name="_bx_market_form_entry_input_files_version_from_x_to_y"><![CDATA[Version from {0} to {1}]]></string>
+	<string name="_bx_market_form_entry_input_files_version_from_x_to_y"><![CDATA[{0} to {1}]]></string>
     <string name="_bx_market_form_entry_input_sys_allow_view_to"><![CDATA[Who can view]]></string>
     <string name="_bx_market_form_entry_input_allow_view_to"><![CDATA[Who can view]]></string>
     <string name="_bx_market_form_entry_input_sys_allow_purchase_to"><![CDATA[Who can purchase]]></string>
@@ -107,8 +107,11 @@
     <string name="_bx_market_form_entry_input_subentries"><![CDATA[Subproducts]]></string>
     <string name="_bx_market_form_entry_input_subentries_inf"><![CDATA[Leave empty if you don't want to create association.]]></string>
     <string name="_bx_market_form_entry_input_subentries_placeholder"><![CDATA[Type product name here...]]></string>
+    <string name="_bx_market_form_entry_input_files_version_caption_latest"><![CDATA[Latest version]]></string>
+    <string name="_bx_market_form_entry_input_files_version_caption_version"><![CDATA[Older versions]]></string>
+    <string name="_bx_market_form_entry_input_files_version_caption_update"><![CDATA[Updates]]></string>
 
-	<string name="_bx_market_acl_action_create_entry"><![CDATA[Create Product]]></string>
+  <string name="_bx_market_acl_action_create_entry"><![CDATA[Create Product]]></string>
 	<string name="_bx_market_acl_action_delete_entry"><![CDATA[Delete Product]]></string>
 	<string name="_bx_market_acl_action_download_entry"><![CDATA[Download Product]]></string>
 	<string name="_bx_market_acl_action_view_entry"><![CDATA[View Product]]></string>

+ 23 - 22
modules/boonex/market/template/attachments.html

@@ -1,11 +1,14 @@
 <div class="bx-base-text-attachments bx-market-attachments bx-clearfix">
     <bx_repeat:attachments>
-        <div class="bx-base-text-attachment bx-market-attachment bx-def-box bx-def-color-bg-box bx-def-gal-img-size__class__" style="float:left;">
-        	<bx_if:main>
-        		<div class="bx-market-a-main bx-def-font-h2">
-        			<i class="sys-icon check col-green3" title="<bx_text_attribute:_bx_market_txt_most_current_version />"></i>
-        		</div>
-        	</bx_if:main>
+        <bx_if:show_separator>
+            <div class="bx-market-attachment-separator bx-base-text-attachment bx-market-attachment bx-def-margin-sec-left"><div class="bx-def-font-h3 bx-def-padding-top"> __type__</div></div>
+        </bx_if:show_separator>
+        <div class="bx-base-text-attachment bx-market-attachment bx-def-box bx-def-color-bg-box bx-def-round-corners bx-def-margin-sec __class__" style="float:left;">
+            <bx_if:main>
+                <div class="bx-market-a-main bx-def-font-h2">
+                    <i class="sys-icon check col-green3" title="<bx_text_attribute:_bx_market_txt_most_current_version />"></i>
+                </div>
+            </bx_if:main>
             <bx_if:image>
                 <a target="_blank" href="javascript:void(0);" title="__attr_file_name__" onclick="$('#__popup_id__').dolPopupImage('__url_original__', $(this).parent())">
                     <img class="bx-def-gal-img-size" src="__url_preview__" />
@@ -16,24 +19,22 @@
                 __video__
             </bx_if:video>
             <bx_if:not_image>
-            	<div class="bx-market-a-text bx-def-margin">
-	                <a target="_blank" href="__url_original__" title="__attr_file_name__">__file_name__</a>
-	                <div class="bx-def-font-grayed"><bx_text:_bx_market_form_entry_input_files_type /> __file_type__</div>
-	                <bx_if:show_version>
-	                	<div class="bx-def-font-grayed"><bx_text:_bx_market_form_entry_input_files_version /> __file_version__</div>
-	                </bx_if:show_version>
-	                <bx_if:show_update>
-	                	<div class="bx-def-font-grayed">__file_version_from_to__</div>
-	                </bx_if:show_update>
-	                
-	                
+                <div class="bx-market-a-text bx-def-margin">
+                    <i class="sys-icon file-archive sys-colored far"></i>
+                    <div class="bx-market-attachment-text">
+                        <bx_if:show_version>
+                            <div class="bx-def-font-h3"> __file_version__</div>
+                        </bx_if:show_version>
+                        <bx_if:show_update>
+                            <div class="bx-def-font-h3">__file_version_from_to__</div>
+                        </bx_if:show_update>
+                        <div class="bx-market-attachment-info bx-def-font-small bx-def-font-grayed">__file_type__ &bull; __file_name__ </div>
+                    </div>
+                    <div class="bx-def-margin-sec-top">
+                        <a target="_blank" href="__url_original__" title="__attr_file_name__" class="bx-btn bx-btn-primary bx-btn-small"><bx_text_attribute:_bx_market_menu_item_title_download /></a>
+                    </div>
                 </div>
             </bx_if:not_image>
         </div>
     </bx_repeat:attachments>
-    <script>
-        $(document).ready(function() {
-            bx_center_content('.bx-base-text-attachments', '.bx-base-text-attachment', true);
-        });
-    </script>
 </div>

+ 22 - 1
modules/boonex/market/template/css/main.css

@@ -129,17 +129,38 @@ div.bx-market-unit-title-badges {
 div.bx-market-attachment {
 	position: relative;
 	display: none;
+    width: calc(25% - 1.2rem);
 }
 div.bx-market-attachment.bx-market-attachment-main {
     display: block;
 }
 div.bx-market-a-main {
 	position: absolute;
-
 	top: 0.25rem;
 	right: 0.5rem;
 }
 div.bx-market-a-text {
 	overflow: hidden;
 	text-overflow: ellipsis;
+}
+div.bx-market-a-text i.sys-icon{
+    font-size: 2.5rem;
+    float: left;
+    margin-right: 1rem;
+}
+div.bx-market-attachment-separator{
+    clear:both;
+    width:100%;
+}
+div.bx-market-attachment-text{
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    height: 2.7rem;
+	width:calc(100% - 3rem);
+}
+div.bx-market-attachment-info{
+	white-space: nowrap; 
+    overflow: hidden; 
+    text-overflow: ellipsis; 
 }

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

@@ -1372,7 +1372,7 @@
 	<string name="_adm_stg_cpt_option_sys_default_payment"><![CDATA[Модуль оплаты]]></string>
 	<string name="_adm_stg_cpt_option_sys_editor_default"><![CDATA[HTML редактор по умолчанию]]></string>
 	<string name="_adm_stg_cpt_option_sys_player_default"><![CDATA[Плеер по умолчанию]]></string>
-	<string name="_adm_stg_cpt_option_sys_player_default_format"><![CDATA[Видео формат по умолчанию]]></string>
+	<string name="_adm_stg_cpt_option_sys_player_default_quality"><![CDATA[Качество видео по умолчанию]]></string>
 	<string name="_adm_stg_cpt_option_sys_format_date"><![CDATA[Формат даты]]></string>
 	<string name="_adm_stg_cpt_option_sys_format_datetime"><![CDATA[Формат даты и времени]]></string>
 	<string name="_adm_stg_cpt_option_sys_format_time"><![CDATA[Формат времени]]></string>