Jelajahi Sumber

Ticket #4145 - Uploader's enhancement (Studio Pages builder)

AntonLV 3 tahun lalu
induk
melakukan
060fb99137

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

@@ -505,7 +505,6 @@
 	<string name="_adm_bp_dsc_page_url"><![CDATA[Page link to access the page.]]></string>
 	<string name="_adm_bp_dsc_page_visible_for_levels"><![CDATA[Select user levels that can see this page]]></string>
 	<string name="_adm_bp_err_block_added"><![CDATA[Cannot add block(s)]]></string>
-	<string name="_adm_bp_err_block_content_image_preview_delete"><![CDATA[Cannot delete image.]]></string>
 	<string name="_adm_bp_err_block_delete"><![CDATA[Cannot delete block]]></string>
 	<string name="_adm_bp_err_block_designbox"><![CDATA[Select a layout box for the block]]></string>
 	<string name="_adm_bp_err_block_edit"><![CDATA[Cannot update block]]></string>
@@ -539,8 +538,7 @@
 	<string name="_adm_bp_txt_block_content_image_align_empty"><![CDATA[Select alignment...]]></string>
 	<string name="_adm_bp_txt_block_content_image_align_left"><![CDATA[left]]></string>
 	<string name="_adm_bp_txt_block_content_image_align_right"><![CDATA[right]]></string>
-	<string name="_adm_bp_txt_block_content_image_file"><![CDATA[Upload New Image]]></string>
-	<string name="_adm_bp_txt_block_content_image_preview"><![CDATA[Current Image]]></string>
+	<string name="_adm_bp_txt_block_content_image_file"><![CDATA[Image]]></string>
 	<string name="_adm_bp_txt_block_content_lang"><![CDATA[Content]]></string>
 	<string name="_adm_bp_txt_block_content_menu"><![CDATA[Menu]]></string>
 	<string name="_adm_bp_txt_block_content_menu_empty"><![CDATA[Select menu...]]></string>
@@ -692,8 +690,6 @@
 	<string name="_adm_dsg_txt_inj_body"><![CDATA[&lt;BODY&gt; injection]]></string>
 	<string name="_adm_dsg_txt_inj_body_inf"><![CDATA[Code to insert before closing BODY tag]]></string>
 	<string name="_adm_err_cannot_process_action"><![CDATA[Cannot process action. It does not have an associated handler.]]></string>
-	<string name="_adm_err_form_view_iu_delete"><![CDATA[Cannot remove current image.]]></string>
-	<string name="_adm_err_form_view_iu_save"><![CDATA[Cannot save: ]]></string>
 	<string name="_adm_err_modules_already_disabled"><![CDATA[The module is already disabled.]]></string>
 	<string name="_adm_err_modules_already_enabled"><![CDATA[The module is already enabled.]]></string>
 	<string name="_adm_err_modules_already_installed"><![CDATA[The module was already installed.]]></string>
@@ -1797,9 +1793,6 @@
 	<string name="_adm_txt_confirm_cancel"><![CDATA[Cancel]]></string>
 	<string name="_adm_txt_confirm_ok"><![CDATA[OK]]></string>
 	<string name="_adm_txt_forgot_password"><![CDATA[Forgot password?]]></string>
-	<string name="_adm_txt_form_view_iu_delete"><![CDATA[Delete]]></string>
-	<string name="_adm_txt_form_view_iu_preview"><![CDATA[Current Image]]></string>
-	<string name="_adm_txt_form_view_iu_preview_empty"><![CDATA[No image uploaded.]]></string>
 	<string name="_adm_txt_form_view_missing"><![CDATA[missing]]></string>
 	<string name="_adm_txt_login_password"><![CDATA[password]]></string>
 	<string name="_adm_txt_login_email"><![CDATA[email]]></string>

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

@@ -505,7 +505,6 @@
 	<string name="_adm_bp_dsc_page_url"><![CDATA[Ссылка на страницу для доступа к ней.]]></string>
 	<string name="_adm_bp_dsc_page_visible_for_levels"><![CDATA[Выберите уровни пользователей, разрешённые для просмотра этой страницы]]></string>
 	<string name="_adm_bp_err_block_added"><![CDATA[Невозможно добавть блок(и)]]></string>
-	<string name="_adm_bp_err_block_content_image_preview_delete"><![CDATA[Невозможно удалить картинку.]]></string>
 	<string name="_adm_bp_err_block_delete"><![CDATA[Невозможно удалить блок]]></string>
 	<string name="_adm_bp_err_block_designbox"><![CDATA[Выберите способ отображения для блока]]></string>
 	<string name="_adm_bp_err_block_edit"><![CDATA[Невозможно обновить блок]]></string>
@@ -531,16 +530,15 @@
 	<string name="_adm_bp_mi_page_visibility"><![CDATA[Видимость]]></string>
 	<string name="_adm_bp_scs_save"><![CDATA[Изменения успешно сохранены]]></string>
 	<string name="_adm_bp_txt_block_active"><![CDATA[Активный]]></string>
-    <string name="_adm_bp_txt_block_async"><![CDATA[Асинхронный режим]]></string>
-    <string name="_adm_bp_txt_block_cache_lifetime"><![CDATA[Кэш для блока (в секундах)]]></string>
+        <string name="_adm_bp_txt_block_async"><![CDATA[Асинхронный режим]]></string>
+        <string name="_adm_bp_txt_block_cache_lifetime"><![CDATA[Кэш для блока (в секундах)]]></string>
 	<string name="_adm_bp_txt_block_content_attachments_html"><![CDATA[Вложения]]></string>
 	<string name="_adm_bp_txt_block_content_image_align"><![CDATA[Выравнивание]]></string>
 	<string name="_adm_bp_txt_block_content_image_align_center"><![CDATA[по центру]]></string>
 	<string name="_adm_bp_txt_block_content_image_align_empty"><![CDATA[Выбрать выравнивание...]]></string>
 	<string name="_adm_bp_txt_block_content_image_align_left"><![CDATA[слева]]></string>
 	<string name="_adm_bp_txt_block_content_image_align_right"><![CDATA[справа]]></string>
-	<string name="_adm_bp_txt_block_content_image_file"><![CDATA[Загрузить новую картинку]]></string>
-	<string name="_adm_bp_txt_block_content_image_preview"><![CDATA[Текущая картинка]]></string>
+	<string name="_adm_bp_txt_block_content_image_file"><![CDATA[Изображение]]></string>
 	<string name="_adm_bp_txt_block_content_lang"><![CDATA[Содержимое]]></string>
 	<string name="_adm_bp_txt_block_content_menu"><![CDATA[Меню]]></string>
 	<string name="_adm_bp_txt_block_content_menu_empty"><![CDATA[Выбрать меню...]]></string>
@@ -691,8 +689,6 @@
 	<string name="_adm_dsg_txt_inj_body"><![CDATA[&lt;BODY&gt; инъекция]]></string>
 	<string name="_adm_dsg_txt_inj_body_inf"><![CDATA[Код для вставки перед закрывающим BODY тагом]]></string>
 	<string name="_adm_err_cannot_process_action"><![CDATA[Невозможно выполнить действие. Отсутствует связанный обработчик.]]></string>
-	<string name="_adm_err_form_view_iu_delete"><![CDATA[Невозможно удалить текущую картинку.]]></string>
-	<string name="_adm_err_form_view_iu_save"><![CDATA[Невозможно сохранить: ]]></string>
 	<string name="_adm_err_modules_already_disabled"><![CDATA[Модуль уже отключён.]]></string>
 	<string name="_adm_err_modules_already_enabled"><![CDATA[Модуль уже включён.]]></string>
 	<string name="_adm_err_modules_already_installed"><![CDATA[Модуль уже установлен.]]></string>
@@ -1775,9 +1771,6 @@
 	<string name="_adm_txt_confirm_cancel"><![CDATA[Отменить]]></string>
 	<string name="_adm_txt_confirm_ok"><![CDATA[OK]]></string>
 	<string name="_adm_txt_forgot_password"><![CDATA[Забыли пароль?]]></string>
-	<string name="_adm_txt_form_view_iu_delete"><![CDATA[Удалить]]></string>
-	<string name="_adm_txt_form_view_iu_preview"><![CDATA[Текущее изображение]]></string>
-	<string name="_adm_txt_form_view_iu_preview_empty"><![CDATA[Ни одно изображение не было загружено.]]></string>
 	<string name="_adm_txt_form_view_missing"><![CDATA[отсутствует]]></string>
 	<string name="_adm_txt_login_password"><![CDATA[пароль]]></string>
 	<string name="_adm_txt_login_email"><![CDATA[эл. адрес]]></string>

+ 25 - 4
studio/classes/BxDolStudioBuilderPage.php

@@ -139,20 +139,41 @@ class BxDolStudioBuilderPage extends BxTemplStudioWidget
 
     protected function onSaveBlockImage(&$oForm, &$aBlock)
     {
+        $sInput = 'image_file';
+        $iProfileId = bx_get_logged_profile_id();
+
         $iImageId = 0;
         if($aBlock['content'] != '')
             list($iImageId) = explode($this->sParamsDivider, $aBlock['content']);
+        $iImageIdOld = $iImageId;
+
+        $bValue = bx_get($sInput) !== false;
+        $bFile = isset($_FILES[$sInput]) && !empty($_FILES[$sInput]['tmp_name']);
+
+        if($bValue || $bFile) {
+            $oStorage = BxDolStorage::getObjectInstance($oForm->aInputs[$sInput]['storage_object']);
+
+            $iImageId = 0;
+            if($bValue)
+                $iImageId = (int)bx_get($sInput);
+            else if($bFile) {
+                $iImageId = $oStorage->storeFileFromForm($_FILES[$sInput], false, $iProfileId);
+                $iImageId = $iImageId !== false ? (int)$iImageId : $oStorage->getErrorString();
+            }
+
+            if(is_int($iImageId) && $iImageId != 0 && $iImageId != $iImageIdOld)
+                $oStorage->deleteFile($iImageIdOld);
+        }
 
-        $iImageId = $oForm->processImageUploaderSave('image_file', $iImageId);
         if(is_string($iImageId) && !is_numeric($iImageId))
-            return array('msg' => $iImageId);
+            return ['msg' => $iImageId];
 
         $sImageAlign = $oForm->getCleanValue('image_align');
 
         unset($oForm->aInputs['image_file'], $oForm->aInputs['image_align']);
-        BxDolForm::setSubmittedValue('content', implode($this->sParamsDivider, array($iImageId, $sImageAlign)), $oForm->aFormAttrs['method']);
+        BxDolForm::setSubmittedValue('content', implode($this->sParamsDivider, [$iImageId, $sImageAlign]), $oForm->aFormAttrs['method']);
     }
-    
+
     protected function onSaveBlockRss(&$oForm, &$aBlock)
     {
         $aRss = array(

+ 0 - 25
studio/classes/BxDolStudioForm.php

@@ -60,31 +60,6 @@ class BxDolStudioForm extends BxBaseFormView
         return $this->update($iId);
     }
 
-    function processImageUploaderSave($sName, $iId = 0)
-    {
-        if($this->aInputs[$sName]['type'] != 'image_uploader')
-            return $iId;
-
-        $aInput = $this->aInputs[$sName];
-        if(!empty($_FILES[$sName]['tmp_name'])) {
-            $iProfileId = getLoggedId();
-
-            $sStorage = isset($aInput['storage_object']) && $aInput['storage_object'] != '' ? $aInput['storage_object'] : BX_DOL_STORAGE_OBJ_IMAGES;
-            $oStorage = BxDolStorage::getObjectInstance($sStorage);
-
-            if((int)$iId != 0 && !$oStorage->deleteFile($iId))
-                return _t('_adm_err_form_view_iu_delete');
-
-            $iId = $oStorage->storeFileFromForm($_FILES[$aInput['name']], false, $iProfileId);
-            if($iId === false)
-                return _t('_adm_err_form_view_iu_save') . $oStorage->getErrorString();
-
-            $oStorage->afterUploadCleanup($iId, $iProfileId);
-        }
-
-        return (int)$iId;
-    }
-
     function getCleanValue ($sName)
     {
         $aResult = parent::getCleanValue($sName);

+ 0 - 5
studio/js/builder_page.js

@@ -170,11 +170,6 @@ BxDolStudioBuilderPage.prototype.onCreateBlock = function(oData) {
 	window.location.href = this.parsePageUrl({page: this.sPage});
 };
 
-BxDolStudioBuilderPage.prototype.deleteBlockImage = function(iId) {
-	bx_loading(this.oHtmlIds['edit_block_popup_id'], true);
-	this.performAction('image_delete', {id:iId});
-};
-
 BxDolStudioBuilderPage.prototype.onChangeVisibleFor = function(oSelect) {
 	$(oSelect).parents('form:first').find('#bx-form-element-visible_for_levels').bx_anim($(oSelect).val() == 'all' ? 'hide' : 'show', this.sAnimationEffect, this.iAnimationSpeed);
 };

+ 0 - 17
studio/template/form_view_iu_preview.html

@@ -1,17 +0,0 @@
-<bx_if:show_empty>
-    <div class="bx-form-input-preview-empty bx-def-font-small bx-def-font-grayed">
-        <bx_text:_adm_txt_form_view_iu_preview_empty />
-    </div>
-</bx_if:show_empty>
-<bx_if:show_image>
-    <div class="bx-form-input-preview">
-        <img src="__url__" />
-        <bx_if:show_action_delete>
-            <p class="bx-def-padding-thd-top">
-                <button type="button" class="bx-btn bx-btn-small" onclick="javascript:__action__">
-                    <bx_text:_adm_txt_form_view_iu_delete />
-                </button>
-            </p>
-        </bx_if:show_action_delete>
-    </div>
-</bx_if:show_image>

+ 94 - 113
studio/template/scripts/BxBaseStudioBuilderPage.php

@@ -921,30 +921,6 @@ class BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
         return array('eval' => $sJsObject . '.onDeleteBlock(' . $iId . ', oData)');
     }
 
-    protected function actionImageDelete()
-    {
-        $sJsObject = $this->getPageJsObject();
-        $iId = (int)bx_get('id');
-
-        $aBlock = array();
-        $this->oDb->getBlocks(array('type' => 'by_id', 'value' => $iId), $aBlock, false);
-        if(empty($aBlock) || !is_array($aBlock))
-            return array('msg' => _t('_adm_bp_err_block_not_found'));
-
-        $iImageId = $sImageAlign = '';
-        if($aBlock['content'] != '')
-            list($iImageId, $sImageAlign) = explode($this->sParamsDivider, $aBlock['content']);
-
-        if(is_numeric($iImageId) && (int)$iImageId != 0) {
-            if(!BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES)->deleteFile((int)$iImageId, 0))
-                return array('msg' => _t('_adm_bp_err_block_content_image_preview_delete'));
-
-            $this->oDb->updateBlock($iId, array('content' => ''));
-        }
-
-        return $this->actionBlockEdit();
-    }
-
     protected function actionUriGet()
     {
         $oLanguage = BxDolStudioLanguagesUtils::getInstance();
@@ -1538,8 +1514,8 @@ class BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
         switch($aBlock['type']) {
             case BX_DOL_STUDIO_BP_BLOCK_CUSTOM:
             case BX_DOL_STUDIO_BP_BLOCK_RAW:
-                $aFields = array(
-                    'content' => array(
+                $aFields = [
+                    'content' => [
                         'type' => 'textarea',
                         'name' => 'content',
                         'caption' => _t('_adm_bp_txt_block_content_raw'),
@@ -1547,18 +1523,19 @@ class BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
                         'value' => $aBlock['content'],
                         'required' => '0',
                         'code' => 1,
-                        'attrs' => array('class' => 'bx-form-input-textarea-codemirror'),
-                        'db' => array (
+                        'attrs' => [
+                            'class' => 'bx-form-input-textarea-codemirror'
+                        ],
+                        'db' => [
                             'pass' => 'XssHtml',
-                        ),
-                    ),
-                );
+                        ],
+                    ],
+                ];
                 break;
 
             case BX_DOL_STUDIO_BP_BLOCK_HTML:
-            	
-                $aFields = array(
-                    'content' => array(
+                $aFields = [
+                    'content' => [
                         'type' => 'textarea',
                         'name' => 'content',
                         'caption' => _t('_adm_bp_txt_block_content_raw'),
@@ -1566,32 +1543,34 @@ class BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
                         'value' => $aBlock['content'],
                         'required' => '0',
                         'html' => 2,
-                		'attrs' => array('id' => $this->aHtmlIds['edit_block_editor_id']),
-                        'db' => array (
+                        'attrs' => [
+                            'id' => $this->aHtmlIds['edit_block_editor_id']
+                        ],
+                        'db' => [
                             'pass' => 'XssHtml',
-                        ),
-                    ),
-                    'attachments' => array(
+                        ],
+                    ],
+                    'attachments' => [
                     	'type' => 'files',
-	                    'name' => 'attachments',
-						'storage_object' => $this->sStorage,
-	 					'images_transcoder' => $this->sTranscoder,
-	 					'uploaders' => $this->aUploaders,
-						'multiple' => true,
-	 					'content_id' => $aBlock['id'],
-	 					'ghost_template' => BxDolStudioTemplate::getInstance()->parseHtmlByName('bp_fgt_attachments.html', array(
-                    		'js_object' => $this->getPageJsObject(),
-                    		'name' => 'attachments',
-							'editor_id' => $this->aHtmlIds['edit_block_editor_id'],
-                    	)),
-	                    'caption' => _t('_adm_bp_txt_block_content_attachments_html')
-                    )
-                );
+                        'name' => 'attachments',
+                        'storage_object' => $this->sStorage,
+                        'images_transcoder' => $this->sTranscoder,
+                        'uploaders' => $this->aUploaders,
+                        'multiple' => true,
+                        'content_id' => $aBlock['id'],
+                        'ghost_template' => BxDolStudioTemplate::getInstance()->parseHtmlByName('bp_fgt_attachments.html', [
+                            'js_object' => $this->getPageJsObject(),
+                            'name' => 'attachments',
+                            'editor_id' => $this->aHtmlIds['edit_block_editor_id'],
+                    	]),
+                        'caption' => _t('_adm_bp_txt_block_content_attachments_html')
+                    ]
+                ];
                 break;
 
             case BX_DOL_STUDIO_BP_BLOCK_LANG:
-                $aFields = array(
-                    'content' => array(
+                $aFields = [
+                    'content' => [
                         'type' => 'textarea_translatable',
                         'name' => 'content',
                         'caption' => _t('_adm_bp_txt_block_content_lang'),
@@ -1599,11 +1578,11 @@ class BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
                         'value' => $aBlock['content'],
                         'required' => '0',
                         'html' => 2,
-                        'db' => array (
+                        'db' => [
                             'pass' => 'XssHtml',
-                        ),
-                    ),
-                );
+                        ],
+                    ],
+                ];
                 break;
 
             case BX_DOL_STUDIO_BP_BLOCK_IMAGE:
@@ -1611,42 +1590,44 @@ class BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
                 if($aBlock['content'] != '')
                     list($iImageId, $sImageAlign) = explode($this->sParamsDivider, $aBlock['content']);
 
-                $aFields = array(
-                    'content' => array(
+                $aFields = [
+                    'content' => [
                         'type' => 'hidden',
                         'name' => 'content',
                         'value' => '',
-                        'db' => array (
+                        'db' => [
                             'pass' => 'Xss',
-                        ),
-                    ),
-                    'image_file' => array(
-                        'type' => 'image_uploader',
+                        ],
+                    ],
+                    'image_file' => [
+                        'type' => 'files',
                         'name' => 'image_file',
+                        'storage_object' => BX_DOL_STORAGE_OBJ_IMAGES,
+                        'images_transcoder' => 'sys_image_resize',
+                        'uploaders' => ['sys_html5'],
+                        'multiple' => false,
+                        'content_id' => $aBlock['id'],
+                        'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate('image_file'),
                         'caption' => _t('_adm_bp_txt_block_content_image_file'),
-                        'caption_preview' => _t('_adm_bp_txt_block_content_image_preview'),
-                        'info' => _t('_adm_bp_dsc_block_content_image_file'),
-                        'ajax_action_delete' => $this->getPageJsObject() . '.deleteBlockImage(' . $aBlock['id'] . ')',
-                        'value' => (int)$iImageId
-                    ),
-                    'image_align' => array(
+                    ],
+                    'image_align' => [
                         'type' => 'select',
                         'name' => 'image_align',
                         'caption' => _t('_adm_bp_txt_block_content_image_align'),
                         'info' => '',
                         'value' => $sImageAlign,
-                        'values' => array(
-                            array('key' => '', 'value' => _t('_adm_bp_txt_block_content_image_align_empty')),
-                            array('key' => 'left', 'value' => _t('_adm_bp_txt_block_content_image_align_left')),
-                            array('key' => 'center', 'value' => _t('_adm_bp_txt_block_content_image_align_center')),
-                            array('key' => 'right', 'value' => _t('_adm_bp_txt_block_content_image_align_right')),
-                        ),
+                        'values' => [
+                            ['key' => '', 'value' => _t('_adm_bp_txt_block_content_image_align_empty')],
+                            ['key' => 'left', 'value' => _t('_adm_bp_txt_block_content_image_align_left')],
+                            ['key' => 'center', 'value' => _t('_adm_bp_txt_block_content_image_align_center')],
+                            ['key' => 'right', 'value' => _t('_adm_bp_txt_block_content_image_align_right')],
+                        ],
                         'required' => '0',
-                        'db' => array (
+                        'db' => [
                             'pass' => 'Xss',
-                        ),
-                    ),
-                );
+                        ],
+                    ],
+                ];
                 break;
 
             case BX_DOL_STUDIO_BP_BLOCK_RSS:
@@ -1654,92 +1635,92 @@ class BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
                 if($aBlock['content'] != '')
                     list($sRssUrl, $sRssLength) = explode($this->sParamsDivider, $aBlock['content']);
 
-                $aFields = array(
-                    'content' => array(
+                $aFields = [
+                    'content' => [
                         'type' => 'hidden',
                         'name' => 'content',
                         'value' => '',
-                        'db' => array (
+                        'db' => [
                             'pass' => 'Xss',
-                        ),
-                    ),
-                    'rss_url' => array(
+                        ],
+                    ],
+                    'rss_url' => [
                         'type' => 'text',
                         'name' => 'rss_url',
                         'caption' => _t('_adm_bp_txt_block_content_rss_url'),
                         'info' => _t('_adm_bp_dsc_block_content_rss_url'),
                         'value' => $sRssUrl,
                         'required' => '0',
-                        'db' => array (
+                        'db' => [
                             'pass' => 'Xss',
-                        ),
-                    ),
-                    'rss_length' => array(
+                        ],
+                    ],
+                    'rss_length' => [
                         'type' => 'text',
                         'name' => 'rss_length',
                         'caption' => _t('_adm_bp_txt_block_content_rss_length'),
                         'info' => _t('_adm_bp_dsc_block_content_rss_length'),
                         'value' => $sRssLength,
                         'required' => '0',
-                        'db' => array (
+                        'db' => [
                             'pass' => 'Int',
-                        ),
-                    ),
-                );
+                        ],
+                    ],
+                ];
                 break;
 
             case BX_DOL_STUDIO_BP_BLOCK_MENU:
-                $aFields = array(
-                    'content' => array(
+                $aFields = [
+                    'content' => [
                         'type' => 'select',
                         'name' => 'content',
                         'caption' => _t('_adm_bp_txt_block_content_menu'),
                         'info' => '',
                         'value' => $aBlock['content'],
-                        'values' => array(),
+                        'values' => [],
                         'required' => '0',
-                        'db' => array (
+                        'db' => [
                             'pass' => 'Xss',
-                        ),
-                    )
-                );
+                        ],
+                    ]
+                ];
 
                 $sGroup = '';
                 $aMenus = $this->oDb->getMenus(true);
                 foreach($aMenus as $sKey => $aMenu) {
                     if($sGroup != $aMenu['module']) {
                         if(!empty($sGroup))
-                            $aFields['content']['values'][$sGroup . '_end'] = array('type' => 'group_end');
+                            $aFields['content']['values'][$sGroup . '_end'] = ['type' => 'group_end'];
 
                         $sGroup = $aMenu['module'];
-                        $aFields['content']['values'][$sGroup . '_beg'] = array('type' => 'group_header', 'value' => BxDolStudioUtils::getModuleTitle($sGroup));
+                        $aFields['content']['values'][$sGroup . '_beg'] = ['type' => 'group_header', 'value' => BxDolStudioUtils::getModuleTitle($sGroup)];
                     }
 
                     $aFields['content']['values'][$sKey] = _t($aMenu['title']);
                 }
 
-                $aFields['content']['values'] = array_merge(array('' => _t('_adm_bp_txt_block_content_menu_empty')), $aFields['content']['values']);
+                $aFields['content']['values'] = array_merge(['' => _t('_adm_bp_txt_block_content_menu_empty')], $aFields['content']['values']);
                 break;
 
             case BX_DOL_STUDIO_BP_BLOCK_SERVICE:
-                $aService = array('module' => '', 'method' => '');
+                $aService = ['module' => '', 'method' => ''];
                 if($aBlock['content'] != '')
                     $aService = unserialize($aBlock['content']);
 
-                $aFields = array(
-                    'service_module' => array(
+                $aFields = [
+                    'service_module' => [
                         'type' => 'value',
                         'name' => 'service_module',
                         'caption' => _t('_adm_bp_txt_block_content_service_module'),
                         'value' => $this->getModuleTitle($aService['module'])
-                    ),
-                    'service_method' => array(
+                    ],
+                    'service_method' => [
                         'type' => 'value',
                         'name' => 'service_method',
                         'caption' => _t('_adm_bp_txt_block_content_service_method'),
                         'value' => $aService['method']
-                    )
-                );
+                    ]
+                ];
                 break;
         }
 

+ 2 - 79
studio/template/scripts/BxBaseStudioFormView.php

@@ -28,21 +28,6 @@ class BxBaseStudioFormView extends BxDolStudioForm
         ));
     }
 
-    function genRow(&$aInput)
-    {
-        $sRow = '';
-        switch($aInput['type']) {
-            case 'image_uploader':
-                $sRow = $this->genRowImageUploader($aInput);
-                break;
-
-             default:
-                $sRow = parent::genRow($aInput);
-        }
-
-        return $sRow;
-    }
-
     function genInput(&$aInput)
     {
         $sInput = '';
@@ -62,68 +47,6 @@ class BxBaseStudioFormView extends BxDolStudioForm
         return $sInput;
     }
 
-    function genRowImageUploader(&$aInput)
-    {
-        $aTmplVarsPreview = array(
-            'bx_if:show_empty' => array(
-                'condition' => true,
-                'content' => array()
-            ),
-            'bx_if:show_image' => array(
-                'condition' => false,
-                'content' => array()
-            )
-        );
-
-        if(($iId = (int)$aInput['value']) != 0) {
-
-            $sFileUrl = false;
-            if (!empty($aInput['transcoder_object'])) {
-                $oTranscoder = BxDolTranscoderImage::getObjectInstance($aInput['transcoder_object']);
-                $sFileUrl = $oTranscoder->getFileUrlNotReady($iId);
-                if (isset($aInput['transcoder_image_width']) && $aInput['transcoder_image_width'] > 0)
-                    $sFileUrl = bx_append_url_params($sFileUrl, array('x' => $aInput['transcoder_image_width']));
-                if (isset($aInput['transcoder_image_height']) && $aInput['transcoder_image_height'] > 0)
-                    $sFileUrl = bx_append_url_params($sFileUrl, array('y' => $aInput['transcoder_image_height']));
-            } 
-            else {
-                $sStorage = isset($aInput['storage_object']) && $aInput['storage_object'] != '' ? $aInput['storage_object'] : BX_DOL_STORAGE_OBJ_IMAGES;
-                $oStorage = BxDolStorage::getObjectInstance($sStorage);
-                $sFileUrl = $oStorage->getFileUrlById($iId);
-            }
-
-            if($sFileUrl !== false) {
-                $aTmplVarsPreview['bx_if:show_empty']['condition'] = false;
-                $aTmplVarsPreview['bx_if:show_image'] = array(
-                    'condition' => true,
-                    'content' => array(
-                        'url' => $sFileUrl,
-                        'bx_if:show_action_delete' => array(
-                            'condition' => isset($aInput['ajax_action_delete']) && $aInput['ajax_action_delete'] != "",
-                            'content' => array(
-                                'action' => $aInput['ajax_action_delete']
-                            )
-                        )
-                    )
-                );
-            }
-        }
-
-        $sRow = '';
-        $aInputPreview = array(
-            'type' => 'custom',
-            'name' => 'preview',
-            'caption' => isset($aInput['caption_preview']) ? $aInput['caption_preview'] : _t('_adm_txt_form_view_iu_preview'),
-            'content' => $this->oTemplate->parseHtmlByName('form_view_iu_preview.html', $aTmplVarsPreview)
-        );
-        $sRow .= $this->genRow($aInputPreview);
-
-        $aInput['type'] = 'file';
-        $sRow .= $this->genRow($aInput);
-
-        return $sRow;
-    }
-
     function genInputTranslatable(&$aInput, $sType = 'text')
     {
         $iValueLength = 20;
@@ -237,8 +160,8 @@ class BxBaseStudioFormView extends BxDolStudioForm
     function genInputCheckboxSet(&$aInput)
     {
      	$aInput['value'] = isset($aInput['value']) && $aInput['value'] && is_array($aInput['value']) ? $aInput['value'] : array();
-		if(!empty($aInput['reverse']))
-			$aInput['value'] = array_diff(array_keys($aInput['values']), $aInput['value']);
+        if(!empty($aInput['reverse']))
+            $aInput['value'] = array_diff(array_keys($aInput['values']), $aInput['value']);
 
         return parent::genInputCheckboxSet($aInput);
     }