AntonLV 7 lat temu
rodzic
commit
1e12de3ece

+ 32 - 25
modules/boonex/market/classes/BxMarketFormEntry.php

@@ -110,26 +110,15 @@ class BxMarketFormEntry extends BxBaseModTextFormEntry
         return $sCode;
     }
 
-	function initChecker ($aValues = array (), $aSpecificValues = array())
+    function initChecker ($aValues = array (), $aSpecificValues = array())
     {
         $CNF = &$this->_oModule->_oConfig->CNF;
 
-        if (isset($this->aInputs[$CNF['FIELD_FILE']])) {
-
-            $aContentInfo = false;
-            if ($aValues && !empty($aValues['id'])) {
-                $aContentInfo = $this->_oModule->_oDb->getContentInfoById ($aValues['id']);
-                $this->aInputs[$CNF['FIELD_FILE']]['content_id'] = $aValues['id'];
-            }
-
-            $this->aInputs[$CNF['FIELD_FILE']]['ghost_template'] = $this->_oModule->_oTemplate->getGhostTemplateFile($this, $aContentInfo);
-        }
-
         if(isset($this->aInputs[$CNF['FIELD_SUBENTRIES']]) && !empty($aValues[$CNF['FIELD_ID']])) {
             $oConnection = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTION_SUBENTRIES']);
             if($oConnection)
-		        $this->aInputs[$CNF['FIELD_SUBENTRIES']]['value'] = $oConnection->getConnectedContent((int)$aValues[$CNF['FIELD_ID']]);
-		}
+                $this->aInputs[$CNF['FIELD_SUBENTRIES']]['value'] = $oConnection->getConnectedContent((int)$aValues[$CNF['FIELD_ID']]);
+        }
 
         return parent::initChecker($aValues, $aSpecificValues);
     }
@@ -258,22 +247,40 @@ class BxMarketFormEntry extends BxBaseModTextFormEntry
     }
 
     protected function _getPhotoGhostTmplVars($aContentInfo = array())
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        $aResult = parent::_getPhotoGhostTmplVars($aContentInfo);
+        $aResult = array_merge($aResult, array(
+            'cover_id' => isset($aContentInfo[$CNF['FIELD_COVER']]) ? $aContentInfo[$CNF['FIELD_COVER']] : 0,
+            'bx_if:set_cover' => array (
+                'condition' => CHECK_ACTION_RESULT_ALLOWED === $this->_oModule->checkAllowedSetCover(),
+                'content' => array (
+                    'name_cover' => $CNF['FIELD_COVER'],
+                ),
+            ),
+        ));
+
+        return $aResult;
+    }
+
+    protected function _getFileGhostTmplVars($aContentInfo = array())
     {
     	$CNF = &$this->_oModule->_oConfig->CNF;
 
-    	$aResult = parent::_getPhotoGhostTmplVars($aContentInfo);
-    	$aResult = array_merge($aResult, array(
-    		'cover_id' => isset($aContentInfo[$CNF['FIELD_COVER']]) ? $aContentInfo[$CNF['FIELD_COVER']] : 0,
-    		'bx_if:set_cover' => array (
-				'condition' => CHECK_ACTION_RESULT_ALLOWED === $this->_oModule->checkAllowedSetCover(),
-				'content' => array (
-					'name_cover' => $CNF['FIELD_COVER'],
-				),
-			),
-    	));
+        $aResult = parent::_getFileGhostTmplVars($aContentInfo);
+        $aResult = array_merge($aResult, array(
+            'thumb_id' => isset($aContentInfo[$CNF['FIELD_PACKAGE']]) ? $aContentInfo[$CNF['FIELD_PACKAGE']] : 0,
+            'bx_if:set_thumb' => array (
+                'condition' => true,
+                'content' => array(
+                    'name_thumb' => $CNF['FIELD_PACKAGE'],
+                ),
+            ),
+        ));
 
     	return $aResult;
-	}
+    }
 
     protected function genCustomInputSubentries($aInput)
     {

+ 10 - 18
modules/boonex/market/classes/BxMarketTemplate.php

@@ -130,24 +130,6 @@ class BxMarketTemplate extends BxBaseModTextTemplate
     	));    	
     }
 
-    public function getGhostTemplateFile($oForm, $aContentInfo)
-    {
-    	$CNF = &$this->getModule()->_oConfig->CNF;
-
-    	return $this->parseHtmlByName('form_ghost_template_file.html', array (
-                'name' => $oForm->aInputs[$CNF['FIELD_FILE']]['name'],
-                'content_id' => $oForm->aInputs[$CNF['FIELD_FILE']]['content_id'],
-                'editor_id' => $CNF['FIELD_TEXT_ID'],
-                'thumb_id' => isset($aContentInfo[$CNF['FIELD_PACKAGE']]) ? $aContentInfo[$CNF['FIELD_PACKAGE']] : 0,
-                'bx_if:set_thumb' => array (
-                    'condition' => true,
-                    'content' => array(
-            			'name_thumb' => $CNF['FIELD_PACKAGE'],
-            		),
-                ),
-            ));
-    }
-
     protected function getUnit ($aData, $aParams = array())
     {
         $bTmplVarsSectionAuthor = false;
@@ -400,6 +382,16 @@ class BxMarketTemplate extends BxBaseModTextTemplate
     	return array_intersect_key($aFiles, $aResults);
     }
 
+    protected function getAttachmentsImagesTranscoders ($sStorage = '')
+    {
+        $CNF = &$this->getModule()->_oConfig->CNF;
+
+        $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']);
+        $oTranscoderPreview = isset($CNF['OBJECT_IMAGES_TRANSCODER_PICTURE']) && $CNF['OBJECT_IMAGES_TRANSCODER_PICTURE'] ? BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PICTURE']) : null;
+
+        return array($oTranscoder, $oTranscoderPreview);
+    }
+
     protected function _getHeaderImage($aData)
     {
         return $this->getModule()->getEntryImageData($aData, 'FIELD_COVER');

+ 18 - 23
modules/boonex/market/template/form_ghost_template_file.html

@@ -8,42 +8,37 @@
 	        <img src="{file_icon}" class="bx-def-round-corners bx-base-general-icon bx-base-general-icon-{file_id}" />
 	    </div>
 	    <span class="bx-base-general-uploader-ghost">
-			<b><bx_text:_bx_market_form_entry_input_files_name /></b><br />
+                <b><bx_text:_bx_market_form_entry_input_files_name /></b><br />
 	        <input class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" type="text" value="{file_name}" readonly="1" /><br />
 	
-			<b><bx_text:_bx_market_form_entry_input_files_type /></b><br />
-			<select class="bx-def-font-inputs bx-form-input-select bx-def-margin-sec-bottom" name="type-{file_id}" onchange="javascript:oBxMarketForm.changeFileType(this);">
-				<option value="version"{file_type_version_selected}><bx_text:_bx_market_form_entry_input_files_type_version /></option>
-				<option value="update"{file_type_update_selected}><bx_text:_bx_market_form_entry_input_files_type_update /></option>
-			</select><br />
+                <b><bx_text:_bx_market_form_entry_input_files_type /></b><br />
+                <select class="bx-def-font-inputs bx-form-input-select bx-def-margin-sec-bottom" name="type-{file_id}" onchange="javascript:oBxMarketForm.changeFileType(this);">
+                    <option value="version"{file_type_version_selected}><bx_text:_bx_market_form_entry_input_files_type_version /></option>
+                    <option value="update"{file_type_update_selected}><bx_text:_bx_market_form_entry_input_files_type_update /></option>
+                </select><br />
 	
-			<span class="bx-uploader-ghost-type-rel bx-uploader-ghost-type-version"{file_type_version_elements}>
-		    	<b><bx_text:_bx_market_form_entry_input_files_version /></b><br />
-		    	<input class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" type="text" name="version-{file_id}" value="{file_version_attr}" /><br />
-			</span>
+                <span class="bx-uploader-ghost-type-rel bx-uploader-ghost-type-version"{file_type_version_elements}>
+                    <b><bx_text:_bx_market_form_entry_input_files_version /></b><br />
+                    <input class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" type="text" name="version-{file_id}" value="{file_version_attr}" /><br />
+                </span>
 	
-			<span class="bx-uploader-ghost-type-rel bx-uploader-ghost-type-update"{file_type_update_elements}>
-				<b><bx_text:_bx_market_form_entry_input_files_version_from /></b><br />
-		    	<select class="bx-def-font-inputs bx-form-input-select bx-def-margin-sec-bottom" name="version-from-{file_id}">{file_version_from_options}</select><br />
-				<b><bx_text:_bx_market_form_entry_input_files_version_to /></b><br />
-		    	<select class="bx-def-font-inputs bx-form-input-select bx-def-margin-sec-bottom" name="version-to-{file_id}">{file_version_to_options}</select><br />
-			</span>
-	
-	        <span class="bx-base-general-intert-to-post-link" id="bx-base-general-intert-to-post-link-{file_id}" style="display:none;">
-	            <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_insert_to_post('{file_id}', '{file_url}', '__editor_id__');"><bx_text:_sys_txt_form_entry_input_picture_insert /></a>
-	        </span>
+                <span class="bx-uploader-ghost-type-rel bx-uploader-ghost-type-update"{file_type_update_elements}>
+                    <b><bx_text:_bx_market_form_entry_input_files_version_from /></b><br />
+                    <select class="bx-def-font-inputs bx-form-input-select bx-def-margin-sec-bottom" name="version-from-{file_id}">{file_version_from_options}</select><br />
+                        <b><bx_text:_bx_market_form_entry_input_files_version_to /></b><br />
+                    <select class="bx-def-font-inputs bx-form-input-select bx-def-margin-sec-bottom" name="version-to-{file_id}">{file_version_to_options}</select><br />
+                </span>
 	        <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
-	
+
 	        <bx_if:set_thumb>
 	            <span class="bx-base-general-use-as-thumb bx-uploader-ghost-type-rel bx-uploader-ghost-type-version"{file_type_version_elements}>
 	                <input type="checkbox" name="__name_thumb__[]" value="{file_id}" onclick="bx_base_general_select_thumb(this)" id="__name_thumb__-{file_id}" /> 
 	                <label for="__name_thumb__-{file_id}"><bx_text:_bx_market_form_entry_input_files_use_as_main /></label>
 	            </span>
 	        </bx_if:set_thumb>
-	
 	    </span>
     </div>
 </div>
 <script type="text/javascript" language="javascript">
     bx_market_ghost_init($('#bx-uploader-file-{storage_object}-{file_id}'), {file_id}, __thumb_id__);
-</script>
+</script>