From 78492b0c32910d02aaeed23e5518b6c676a77c43 Mon Sep 17 00:00:00 2001 From: "roman.lesnikov@gmail.com" Date: Tue, 6 Dec 2022 11:15:37 +0200 Subject: [PATCH] #4145 - Uploader's enhancement (studio) --- studio/template/form_ghost_template.html | 12 ++++++++++++ .../scripts/BxBaseStudioBuilderPage.php | 4 +--- .../template/scripts/BxBaseStudioDesigner.php | 18 +++++------------- .../scripts/BxBaseStudioFormsField.php | 1 - .../template/scripts/BxBaseStudioFunctions.php | 9 +++++++++ .../scripts/BxBaseStudioGridStorages.php | 6 +++--- .../template/scripts/BxBaseStudioOptions.php | 2 +- studio/template/strg_fgt_files.html | 12 ------------ studio/template/strg_fgt_images.html | 12 ------------ studio/template/uploader_fgt_cover.html | 11 ----------- studio/template/uploader_fgt_icon.html | 11 ----------- template/css/uploaders.css | 7 +------ template/uploader_nested_form_wrapper.html | 4 ++-- 13 files changed, 34 insertions(+), 75 deletions(-) create mode 100644 studio/template/form_ghost_template.html delete mode 100644 studio/template/strg_fgt_files.html delete mode 100644 studio/template/strg_fgt_images.html delete mode 100644 studio/template/uploader_fgt_cover.html delete mode 100644 studio/template/uploader_fgt_icon.html diff --git a/studio/template/form_ghost_template.html b/studio/template/form_ghost_template.html new file mode 100644 index 0000000000..4b6d1e9c4d --- /dev/null +++ b/studio/template/form_ghost_template.html @@ -0,0 +1,12 @@ +
+
+ + +
+ +
+ + + +
+
diff --git a/studio/template/scripts/BxBaseStudioBuilderPage.php b/studio/template/scripts/BxBaseStudioBuilderPage.php index 72ecd2b650..e9827c5136 100644 --- a/studio/template/scripts/BxBaseStudioBuilderPage.php +++ b/studio/template/scripts/BxBaseStudioBuilderPage.php @@ -1162,9 +1162,7 @@ protected function getSettingsCover($aPage = array(), $bCreate = true, $bInputsO 'uploaders' => $this->aUploadersCover, 'multiple' => false, 'content_id' => isset($aPage['id']) ? $aPage['id'] : 0, - 'ghost_template' => BxDolStudioTemplate::getInstance()->parseHtmlByName('uploader_fgt_cover.html', array( - 'name' => 'cover_image', - )), + 'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate('cover_image'), 'caption' => _t('_adm_bp_txt_page_cover_image'), 'db' => array ( 'pass' => 'Int', diff --git a/studio/template/scripts/BxBaseStudioDesigner.php b/studio/template/scripts/BxBaseStudioDesigner.php index bcb51e64a3..1245334415 100644 --- a/studio/template/scripts/BxBaseStudioDesigner.php +++ b/studio/template/scripts/BxBaseStudioDesigner.php @@ -275,7 +275,7 @@ protected function getIcon() ), ); } - + $aForm = array( 'form_attrs' => array( 'id' => $this->sIconFormId, @@ -322,9 +322,7 @@ protected function getIcon() 'uploaders' => ['sys_html5'], 'multiple' => false, 'content_id' => $this->aIcons['icon_apple']['id'], - 'ghost_template' => $oTemplate->parseHtmlByName('uploader_fgt_icon.html', array( - 'name' => 'icon_apple', - )), + 'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate('icon_apple'), 'caption' => _t('_adm_dsg_txt_upload_icon_apple'), 'info' => _t('_adm_dsg_txt_upload_icon_apple_inf'), ), @@ -336,9 +334,7 @@ protected function getIcon() 'uploaders' => ['sys_html5'], 'multiple' => false, 'content_id' => $this->aIcons['icon_android']['id'], - 'ghost_template' => $oTemplate->parseHtmlByName('uploader_fgt_icon.html', array( - 'name' => 'icon_android', - )), + 'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate('icon_android'), 'caption' => _t('_adm_dsg_txt_upload_icon_android'), 'info' => _t('_adm_dsg_txt_upload_icon_android_inf'), ), @@ -350,9 +346,7 @@ protected function getIcon() 'uploaders' => ['sys_html5'], 'multiple' => false, 'content_id' => $this->aIcons['icon_android_splash']['id'], - 'ghost_template' => $oTemplate->parseHtmlByName('uploader_fgt_icon.html', array( - 'name' => 'icon_android_splash', - )), + 'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate('icon_android_splash'), 'caption' => _t('_adm_dsg_txt_upload_icon_android_splash'), 'info' => _t('_adm_dsg_txt_upload_icon_android_splash_inf'), ), @@ -405,9 +399,7 @@ protected function getCover() 'uploaders' => array('sys_std_crop_cover'), 'multiple' => false, 'content_id' => $aSetting['id'], - 'ghost_template' => BxDolStudioTemplate::getInstance()->parseHtmlByName('uploader_fgt_cover.html', array( - 'name' => $sCover, - )), + 'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate($sCover), 'caption' => _t('_adm_dsg_txt_upload_' . $sCover), 'db' => array ( 'pass' => 'Int', diff --git a/studio/template/scripts/BxBaseStudioFormsField.php b/studio/template/scripts/BxBaseStudioFormsField.php index 4b08d4a167..36020c1a9b 100644 --- a/studio/template/scripts/BxBaseStudioFormsField.php +++ b/studio/template/scripts/BxBaseStudioFormsField.php @@ -1576,7 +1576,6 @@ public function init() ); $aUploaders = array( - 'sys_simple' => '_sys_uploader_simple_title', 'sys_html5' => '_sys_uploader_html5_title' ); foreach($aUploaders as $sObject => $sTitle) { diff --git a/studio/template/scripts/BxBaseStudioFunctions.php b/studio/template/scripts/BxBaseStudioFunctions.php index 88e066074c..f3d6e839a4 100644 --- a/studio/template/scripts/BxBaseStudioFunctions.php +++ b/studio/template/scripts/BxBaseStudioFunctions.php @@ -176,6 +176,15 @@ public function getWidget($mixedWidget, $aParams = array()) )); } + + public function getDefaultGhostTemplate($mParams, $sTemplateName = 'form_ghost_template.html') + { + if (!is_array($mParams)) + $mParams = ['name' => $mParams]; + + return BxDolStudioTemplate::getInstance()->parseHtmlByName($sTemplateName, $mParams); + } + protected function getInjHeadLiveUpdates() { return ''; diff --git a/studio/template/scripts/BxBaseStudioGridStorages.php b/studio/template/scripts/BxBaseStudioGridStorages.php index 8a6b70d40e..c401bdd2ac 100644 --- a/studio/template/scripts/BxBaseStudioGridStorages.php +++ b/studio/template/scripts/BxBaseStudioGridStorages.php @@ -154,9 +154,7 @@ protected function _getFormObject($sAction) 'uploaders' => $this->_aUploaders, 'multiple' => true, 'content_id' => 0, - 'ghost_template' => BxDolStudioTemplate::getInstance()->parseHtmlByName('strg_fgt_' . $this->_sType . '.html', array( - 'name' => $this->_sType . '[]' - )), + 'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate($this->_sType . '[]'), 'caption' => '' ), 'submit' => array( @@ -172,3 +170,5 @@ protected function _getFormObject($sAction) } /** @} */ + + diff --git a/studio/template/scripts/BxBaseStudioOptions.php b/studio/template/scripts/BxBaseStudioOptions.php index 593d42d396..196caa413f 100644 --- a/studio/template/scripts/BxBaseStudioOptions.php +++ b/studio/template/scripts/BxBaseStudioOptions.php @@ -621,7 +621,7 @@ protected function field($aItem, $aItems2Mixes) 'upload_buttons_titles' => ['HTML5' => _t('_sys_uploader_button_name_single')], 'multiple' => false, 'content_id' => $iContentId, - 'ghost_template' => ['inputs' => []], + 'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate($aItem['name']), 'caption' => _t($aItem['caption']), 'value' => $mixedValue, 'attrs' => $aAttributes, diff --git a/studio/template/strg_fgt_files.html b/studio/template/strg_fgt_files.html deleted file mode 100644 index 777797a165..0000000000 --- a/studio/template/strg_fgt_files.html +++ /dev/null @@ -1,12 +0,0 @@ -
- -
- -
-
-
{file_name}
-
- -
-
-
\ No newline at end of file diff --git a/studio/template/strg_fgt_images.html b/studio/template/strg_fgt_images.html deleted file mode 100644 index 777797a165..0000000000 --- a/studio/template/strg_fgt_images.html +++ /dev/null @@ -1,12 +0,0 @@ -
- -
- -
-
-
{file_name}
-
- -
-
-
\ No newline at end of file diff --git a/studio/template/uploader_fgt_cover.html b/studio/template/uploader_fgt_cover.html deleted file mode 100644 index dc929107ee..0000000000 --- a/studio/template/uploader_fgt_cover.html +++ /dev/null @@ -1,11 +0,0 @@ -
- -
- -
-
-
- -
-
-
\ No newline at end of file diff --git a/studio/template/uploader_fgt_icon.html b/studio/template/uploader_fgt_icon.html deleted file mode 100644 index dde8f02932..0000000000 --- a/studio/template/uploader_fgt_icon.html +++ /dev/null @@ -1,11 +0,0 @@ -
- -
- -
-
-
- -
-
-
\ No newline at end of file diff --git a/template/css/uploaders.css b/template/css/uploaders.css index 191e6394a7..85601ee127 100644 --- a/template/css/uploaders.css +++ b/template/css/uploaders.css @@ -3,7 +3,7 @@ color:#900; } .bx-uploader-ghost{ - width: 290px; + max-width: 290px; display: flex; flex-direction: column; align-items: center; @@ -57,11 +57,6 @@ -webkit-box-reflect: below 0px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(.7, transparent), to(rgba(0,0,0,0.4))); } -.bx-uploader-ghost-form { - width:500px; - float:left; -} - .bx-uploader-ghost-form-filename { } diff --git a/template/uploader_nested_form_wrapper.html b/template/uploader_nested_form_wrapper.html index cd22d5fcd0..2719f5e4e7 100644 --- a/template/uploader_nested_form_wrapper.html +++ b/template/uploader_nested_form_wrapper.html @@ -1,11 +1,11 @@ -
+
{file_name}
__nested_form__ -
+