BxBaseStudioDesigner.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaView UNA Studio Representation classes
  7. * @ingroup UnaStudio
  8. * @{
  9. */
  10. class BxBaseStudioDesigner extends BxDolStudioDesigner
  11. {
  12. protected $sLogoFormId = 'adm-dsg-logo-form';
  13. protected $sLogoIframeId = 'adm-dsg-logo-iframe';
  14. protected $sIconFormId = 'adm-dsg-icon-form';
  15. protected $sIconIframeId = 'adm-dsg-icon-iframe';
  16. protected $sCoverFormId = 'adm-dsg-cover-form';
  17. protected $sCoverIframeId = 'adm-dsg-cover-iframe';
  18. protected $sCoverStorage = BX_DOL_STORAGE_OBJ_IMAGES;
  19. protected $sCoverTranscoder = 'sys_cover_preview';
  20. protected $sSplashFormId = 'adm-dsg-splash-form';
  21. protected $sSplashIframeId = 'adm-dsg-splash-iframe';
  22. protected $sSplashEditorId = 'adm-dsg-splash-editor';
  23. protected $sInjectionsFormId = 'adm-dsg-injections-form';
  24. protected $sInjectionsIframeId = 'adm-dsg-injections-iframe';
  25. protected $sInjectionsEditorId = 'adm-dsg-injections-editor';
  26. protected $aPageCss;
  27. protected $aPageJs;
  28. function __construct($sPage = '')
  29. {
  30. parent::__construct($sPage);
  31. $this->aPageCss = array('forms.css', 'designer.css');
  32. $this->aPageJs = array('settings.js', 'designer.js');
  33. }
  34. function getPageCss()
  35. {
  36. return array_merge(parent::getPageCss(), $this->aPageCss);
  37. }
  38. function getPageJs()
  39. {
  40. return array_merge(parent::getPageJs(), $this->aPageJs);
  41. }
  42. function getPageJsObject()
  43. {
  44. return 'oBxDolStudioDesigner';
  45. }
  46. function getPageJsClass()
  47. {
  48. return 'BxDolStudioDesigner';
  49. }
  50. public function getPageJsCode($aOptions = array(), $bWrap = true)
  51. {
  52. $aOptions = array_merge(array(
  53. 'sActionUrl' => $this->sManageUrl
  54. ), $aOptions);
  55. return parent::getPageJsCode($aOptions, $bWrap);
  56. }
  57. function getPageMenu($aMenu = array(), $aMarkers = array())
  58. {
  59. $sJsObject = $this->getPageJsObject();
  60. $aMenu = array();
  61. $aMenuItems = array(
  62. BX_DOL_STUDIO_DSG_TYPE_GENERAL => array('icon' => 'globe'),
  63. BX_DOL_STUDIO_DSG_TYPE_LOGO => array('icon' => 'pencil-alt'),
  64. BX_DOL_STUDIO_DSG_TYPE_ICON => array('icon' => 'far image'),
  65. BX_DOL_STUDIO_DSG_TYPE_COVER => array('icon' => 'far file-image'),
  66. BX_DOL_STUDIO_DSG_TYPE_SPLASH => array('icon' => 'far file-image'),
  67. BX_DOL_STUDIO_DSG_TYPE_INJECTIONS => array('icon' => 'object-group'),
  68. BX_DOL_STUDIO_DSG_TYPE_SETTINGS => array('icon' => 'cogs'),
  69. );
  70. foreach($aMenuItems as $sMenuItem => $aItem)
  71. $aMenu[] = array(
  72. 'name' => $sMenuItem,
  73. 'icon' => $aItem['icon'],
  74. 'link' => BX_DOL_URL_STUDIO . 'designer.php?page=' . $sMenuItem,
  75. 'title' => _t('_adm_lmi_cpt_' . $sMenuItem),
  76. 'selected' => $sMenuItem == $this->sPage
  77. );
  78. return parent::getPageMenu($aMenu);
  79. }
  80. function getPageCode($bHidden = false)
  81. {
  82. $sResult = parent::getPageCode();
  83. if($sResult === false)
  84. return false;
  85. $sMethod = 'get' . ucfirst($this->sPage);
  86. if(!method_exists($this, $sMethod))
  87. return '';
  88. return $sResult . $this->$sMethod();
  89. }
  90. protected function getGeneral()
  91. {
  92. $sJsObject = $this->getPageJsObject();
  93. $oTemplate = BxDolStudioTemplate::getInstance();
  94. $sResult = '';
  95. $sTemplate = getParam('template');
  96. $aTemplates = get_templates_array(true, false);
  97. $aTmplVarsTemplates = array ();
  98. foreach($aTemplates as $sUri => $aTemplate) {
  99. $sIcon = $this->getModuleIcon($aTemplate, 'store');
  100. $bIcon = strpos($sIcon, '.') === false && strcmp(substr($sIcon, 0, 10), 'data:image') != 0;
  101. $aTmplVarsTemplates[] = array(
  102. 'uri' => $sUri,
  103. 'title' => htmlspecialchars_adv($aTemplate['title']),
  104. 'version' => htmlspecialchars_adv($aTemplate['version']),
  105. 'vendor' => htmlspecialchars_adv($aTemplate['vendor']),
  106. 'bx_if:icon' => array (
  107. 'condition' => $bIcon,
  108. 'content' => array('icon' => $sIcon),
  109. ),
  110. 'bx_if:image' => array (
  111. 'condition' => !$bIcon,
  112. 'content' => array('icon_url' => $sIcon),
  113. ),
  114. 'bx_if:default' => array (
  115. 'condition' => $sUri == $sTemplate,
  116. 'content' => array (),
  117. ),
  118. 'bx_if:make_default' => array (
  119. 'condition' => $sUri != $sTemplate,
  120. 'content' => array(
  121. 'js_object' => $sJsObject,
  122. 'uri' => $sUri
  123. ),
  124. )
  125. );
  126. }
  127. $sContent = $sResult ? MsgBox($sResult, 10) : '';
  128. $sContent .= $oTemplate->parseHtmlByName('templates.html', array(
  129. 'bx_repeat:templates' => $aTmplVarsTemplates,
  130. ));
  131. return $oTemplate->parseHtmlByName('designer.html', array(
  132. 'content' => $sContent,
  133. 'js_content' => $this->getPageJsCode()
  134. ));
  135. }
  136. protected function getLogo()
  137. {
  138. $oTemplate = BxDolStudioTemplate::getInstance();
  139. $aForm = array(
  140. 'form_attrs' => array(
  141. 'id' => $this->sLogoFormId,
  142. 'name' => $this->sLogoFormId,
  143. 'action' => $this->sManageUrl,
  144. 'method' => 'post',
  145. 'enctype' => 'multipart/form-data',
  146. 'target' => $this->sLogoIframeId
  147. ),
  148. 'params' => array(
  149. 'db' => array(
  150. 'table' => '',
  151. 'key' => '',
  152. 'uri' => '',
  153. 'uri_title' => '',
  154. 'submit_name' => 'save'
  155. ),
  156. ),
  157. 'inputs' => array(
  158. 'page' => array(
  159. 'type' => 'hidden',
  160. 'name' => 'page',
  161. 'value' => $this->sPage
  162. ),
  163. 'image' => array(
  164. 'type' => 'image_uploader',
  165. 'name' => 'image',
  166. 'caption' => _t('_adm_dsg_txt_upload_image'),
  167. 'caption_preview' => _t('_adm_dsg_txt_upload_image_preview'),
  168. 'ajax_action_delete' => $this->getPageJsObject() . '.deleteLogo()',
  169. 'storage_object' => 'sys_images_custom',
  170. 'transcoder_object' => 'sys_custom_images',
  171. 'transcoder_image_width' => (int)getParam($this->sParamLogoWidth),
  172. 'transcoder_image_height' => (int)getParam($this->sParamLogoHeight),
  173. 'value' => (int)getParam($this->sParamLogo),
  174. ),
  175. 'width' => array(
  176. 'type' => 'text',
  177. 'name' => 'width',
  178. 'caption' => _t('_adm_stg_cpt_option_sys_site_logo_width'),
  179. 'value' => (int)getParam($this->sParamLogoWidth),
  180. 'db' => array (
  181. 'pass' => 'Int',
  182. ),
  183. ),
  184. 'height' => array(
  185. 'type' => 'text',
  186. 'name' => 'height',
  187. 'caption' => _t('_adm_stg_cpt_option_sys_site_logo_height'),
  188. 'value' => (int)getParam($this->sParamLogoHeight),
  189. 'db' => array (
  190. 'pass' => 'Int',
  191. ),
  192. ),
  193. 'alt' => array(
  194. 'type' => 'text',
  195. 'name' => 'alt',
  196. 'caption' => _t('_adm_dsg_txt_alt_text'),
  197. 'info' => _t('_adm_dsg_dsc_alt_text'),
  198. 'value' => getParam($this->sParamLogoAlt),
  199. 'checker' => array(
  200. 'func' => '',
  201. 'params' => array(),
  202. 'error' => ''
  203. ),
  204. 'db' => array (
  205. 'pass' => 'Xss',
  206. ),
  207. ),
  208. 'save' => array(
  209. 'type' => 'submit',
  210. 'name' => 'save',
  211. 'value' => _t('_adm_btn_designer_submit'),
  212. )
  213. )
  214. );
  215. $oForm = new BxTemplStudioFormView($aForm);
  216. $oForm->initChecker();
  217. if($oForm->isSubmittedAndValid()) {
  218. echo $this->submitLogo($oForm);
  219. exit;
  220. }
  221. return MsgBox(_t('_adm_dsg_txt_logo_redefinition')) . $oTemplate->parseHtmlByName('designer.html', array(
  222. 'content' => $this->getBlockCode(array(
  223. 'items' => $oTemplate->parseHtmlByName('dsr_logo.html', array('logo_iframe_id' => $this->sLogoIframeId, 'form' => $oForm->getCode())),
  224. )),
  225. 'js_content' => $this->getPageJsCode()
  226. ));
  227. }
  228. protected function getIcon()
  229. {
  230. $oTemplate = BxDolStudioTemplate::getInstance();
  231. $sPreview = "";
  232. $aTmplVars = array('bx_repeat:images' => array());
  233. if(($iId = (int)getParam('sys_site_icon')) != 0) {
  234. $aTranscoders = array(
  235. BX_DOL_TRANSCODER_OBJ_ICON_APPLE => '_adm_dsg_txt_icon_apple',
  236. BX_DOL_TRANSCODER_OBJ_ICON_FACEBOOK => '_adm_dsg_txt_icon_facebook',
  237. BX_DOL_TRANSCODER_OBJ_ICON_FAVICON => '_adm_dsg_txt_icon_favicon'
  238. );
  239. foreach($aTranscoders as $sTranscoder => $sTitle) {
  240. $oTranscoder = BxDolTranscoderImage::getObjectInstance($sTranscoder);
  241. $sImageUrl = $oTranscoder->getFileUrl($iId);
  242. if($sImageUrl === false) {
  243. setParam('sys_site_icon', 0);
  244. break;
  245. }
  246. $aFilterParams = $oTranscoder->getFilterParams('Resize');
  247. $bFilterWidth = !empty($aFilterParams['w']);
  248. $bFilterHeight = !empty($aFilterParams['h']);
  249. $aTmplVars['bx_repeat:images'][] = array(
  250. 'caption' => _t($sTitle),
  251. 'url' => $sImageUrl,
  252. 'bx_if:show_width' => array(
  253. 'condition' => $bFilterWidth,
  254. 'content' => array(
  255. 'width' => $bFilterWidth ? (int)$aFilterParams['w'] : 0
  256. )
  257. ),
  258. 'bx_if:show_height' => array(
  259. 'condition' => $bFilterHeight,
  260. 'content' => array(
  261. 'height' => $bFilterHeight ? (int)$aFilterParams['h'] : 0
  262. )
  263. ),
  264. );
  265. }
  266. $sPreview = $oTemplate->parseHtmlByName('dsr_icon_preview.html', $aTmplVars);
  267. }
  268. $aForm = array(
  269. 'form_attrs' => array(
  270. 'id' => $this->sIconFormId,
  271. 'name' => $this->sIconFormId,
  272. 'action' => BX_DOL_URL_STUDIO . 'designer.php',
  273. 'method' => 'post',
  274. 'enctype' => 'multipart/form-data',
  275. 'target' => $this->sIconIframeId
  276. ),
  277. 'params' => array(
  278. 'db' => array(
  279. 'table' => '',
  280. 'key' => '',
  281. 'uri' => '',
  282. 'uri_title' => '',
  283. 'submit_name' => 'save'
  284. ),
  285. ),
  286. 'inputs' => array(
  287. 'page' => array(
  288. 'type' => 'hidden',
  289. 'name' => 'page',
  290. 'value' => $this->sPage
  291. ),
  292. 'preview' => array(
  293. 'type' => 'custom',
  294. 'name' => 'preview',
  295. 'content' => $sPreview
  296. ),
  297. 'image' => array(
  298. 'type' => 'file',
  299. 'name' => 'image',
  300. 'caption' => _t('_adm_dsg_txt_upload_icon')
  301. ),
  302. 'save' => array(
  303. 'type' => 'submit',
  304. 'name' => 'save',
  305. 'value' => _t('_adm_btn_designer_submit'),
  306. )
  307. )
  308. );
  309. $oForm = new BxTemplStudioFormView($aForm);
  310. $oForm->initChecker();
  311. if($oForm->isSubmittedAndValid()) {
  312. echo $this->submitIcon($oForm);
  313. exit;
  314. }
  315. return $oTemplate->parseHtmlByName('designer.html', array(
  316. 'content' => $this->getBlockCode(array(
  317. 'items' => $oTemplate->parseHtmlByName('dsr_icon.html', array('icon_iframe_id' => $this->sIconIframeId, 'form' => $oForm->getCode())),
  318. )),
  319. 'js_content' => $this->getPageJsCode()
  320. ));
  321. }
  322. protected function getCover()
  323. {
  324. $sJsObject = $this->getPageJsObject();
  325. $oTemplate = BxDolStudioTemplate::getInstance();
  326. $oDbSettings = new BxDolStudioSettingsQuery();
  327. $aFormInputs = array();
  328. $aTmplVarsCovers = array();
  329. foreach($this->aCovers as $sCover => $aCover) {
  330. $aSetting = array();
  331. $oDbSettings->getOptions(array('type' => 'by_name', 'value' => $aCover['setting']), $aSetting, false);
  332. if(empty($aSetting) || !is_array($aSetting))
  333. continue;
  334. $aFormInputs[$sCover] = array(
  335. 'type' => 'files',
  336. 'name' => $sCover,
  337. 'storage_object' => $this->sCoverStorage,
  338. 'images_transcoder' => $this->sCoverTranscoder,
  339. 'uploaders' => array('sys_std_crop_cover'),
  340. 'multiple' => false,
  341. 'content_id' => $aSetting['id'],
  342. 'ghost_template' => BxDolStudioTemplate::getInstance()->parseHtmlByName('uploader_fgt_cover.html', array(
  343. 'name' => $sCover,
  344. )),
  345. 'caption' => _t('_adm_dsg_txt_upload_' . $sCover),
  346. 'db' => array (
  347. 'pass' => 'Int',
  348. )
  349. );
  350. if(($iImageId = (int)getParam($aCover['setting'])) == 0)
  351. continue;
  352. $sImageUrl = BxDolTranscoderImage::getObjectInstance($aCover['transcoder'])->getFileUrl($iImageId);
  353. if($sImageUrl === false) {
  354. setParam($aCover['setting'], 0);
  355. continue;
  356. }
  357. $aTmplVarsCovers[] = array(
  358. 'image_id' => $iImageId,
  359. 'content' => $oTemplate->parseHtmlByName($aCover['template'], array(
  360. 'js_object' => $sJsObject,
  361. 'type' => $sCover,
  362. 'caption' => _t($aCover['title']),
  363. 'image_id' => $iImageId,
  364. 'bx_if:show_bg' => array(
  365. 'condition' => !empty($sImageUrl),
  366. 'content' => array(
  367. 'image_url' => $sImageUrl
  368. )
  369. ),
  370. ))
  371. );
  372. }
  373. $aForm = array(
  374. 'form_attrs' => array(
  375. 'id' => $this->sCoverFormId,
  376. 'name' => $this->sCoverFormId,
  377. 'action' => BX_DOL_URL_STUDIO . 'designer.php',
  378. 'method' => 'post',
  379. 'enctype' => 'multipart/form-data',
  380. 'target' => $this->sCoverIframeId
  381. ),
  382. 'params' => array(
  383. 'db' => array(
  384. 'table' => '',
  385. 'key' => '',
  386. 'uri' => '',
  387. 'uri_title' => '',
  388. 'submit_name' => 'save'
  389. ),
  390. ),
  391. 'inputs' => array(
  392. 'page' => array(
  393. 'type' => 'hidden',
  394. 'name' => 'page',
  395. 'value' => $this->sPage
  396. ),
  397. 'preview' => array(
  398. 'type' => 'custom',
  399. 'name' => 'preview',
  400. 'content' => $oTemplate->parseHtmlByName('dsr_cover_preview.html', array(
  401. 'bx_repeat:covers' => $aTmplVarsCovers
  402. ))
  403. ),
  404. 'save' => array(
  405. 'type' => 'submit',
  406. 'name' => 'save',
  407. 'value' => _t('_adm_btn_designer_submit'),
  408. )
  409. )
  410. );
  411. $aForm['inputs'] = bx_array_insert_after($aFormInputs, $aForm['inputs'], 'preview');
  412. $oForm = new BxTemplStudioFormView($aForm);
  413. $oForm->initChecker();
  414. if($oForm->isSubmittedAndValid()) {
  415. echo $this->submitCover($oForm);
  416. exit;
  417. }
  418. $this->aPageCss[] = 'cover.css';
  419. return $oTemplate->parseHtmlByName('designer.html', array(
  420. 'content' => $this->getBlockCode(array(
  421. 'items' => $oTemplate->parseHtmlByName('dsr_cover.html', array('iframe_id' => $this->sCoverIframeId, 'form' => $oForm->getCode())),
  422. )),
  423. 'js_content' => $this->getPageJsCode()
  424. ));
  425. }
  426. protected function getSplash()
  427. {
  428. $oTemplate = BxDolStudioTemplate::getInstance();
  429. $aForm = array(
  430. 'form_attrs' => array(
  431. 'id' => $this->sSplashFormId,
  432. 'name' => $this->sSplashFormId,
  433. 'action' => BX_DOL_URL_STUDIO . 'designer.php',
  434. 'method' => 'post',
  435. 'enctype' => 'multipart/form-data',
  436. 'target' => $this->sSplashIframeId
  437. ),
  438. 'params' => array(
  439. 'db' => array(
  440. 'table' => '',
  441. 'key' => '',
  442. 'uri' => '',
  443. 'uri_title' => '',
  444. 'submit_name' => 'save'
  445. ),
  446. ),
  447. 'inputs' => array(
  448. 'page' => array(
  449. 'type' => 'hidden',
  450. 'name' => 'page',
  451. 'value' => $this->sPage
  452. ),
  453. 'enabled' => array(
  454. 'type' => 'checkbox',
  455. 'name' => 'enabled',
  456. 'caption' => _t('_adm_dsg_txt_splash_enabled'),
  457. 'value' => 'on',
  458. 'checked' => getParam('sys_site_splash_enabled') == 'on',
  459. 'db' => array (
  460. 'pass' => 'Xss',
  461. ),
  462. ),
  463. 'code' => array(
  464. 'type' => 'textarea',
  465. 'code' => true,
  466. 'name' => 'code',
  467. 'caption' => '',
  468. 'value' => getParam('sys_site_splash_code'),
  469. ),
  470. 'save' => array(
  471. 'type' => 'submit',
  472. 'name' => 'save',
  473. 'value' => _t('_adm_btn_designer_submit'),
  474. )
  475. )
  476. );
  477. $oForm = new BxTemplStudioFormView($aForm, $oTemplate);
  478. $oForm->initChecker();
  479. if($oForm->isSubmittedAndValid()) {
  480. echo $this->submitSplash($oForm);
  481. exit;
  482. }
  483. $oTemplate->addJs(array('codemirror/codemirror.min.js'));
  484. $oTemplate->addCss(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'codemirror/|codemirror.css');
  485. return $oTemplate->parseHtmlByName('designer.html', array(
  486. 'content' => $this->getBlockCode(array(
  487. 'items' => $oTemplate->parseHtmlByName('dsr_splash.html', array(
  488. 'warning' => MsgBox(_t('_adm_dsg_dsc_splash_warning')),
  489. 'splash_iframe_id' => $this->sSplashIframeId,
  490. 'form' => $oForm->getCode()
  491. )),
  492. )),
  493. 'js_content' => $this->getPageJsCode(array(
  494. 'sCodeMirror' => 'textarea[name=code]'
  495. )),
  496. ));
  497. }
  498. protected function getInjections()
  499. {
  500. $oTemplate = BxDolStudioTemplate::getInstance();
  501. $aForm = array(
  502. 'form_attrs' => array(
  503. 'id' => $this->sInjectionsFormId,
  504. 'name' => $this->sInjectionsFormId,
  505. 'action' => BX_DOL_URL_STUDIO . 'designer.php',
  506. 'method' => 'post',
  507. 'enctype' => 'multipart/form-data',
  508. 'target' => $this->sInjectionsIframeId
  509. ),
  510. 'params' => array(
  511. 'db' => array(
  512. 'table' => '',
  513. 'key' => '',
  514. 'uri' => '',
  515. 'uri_title' => '',
  516. 'submit_name' => 'save'
  517. ),
  518. ),
  519. 'inputs' => array(
  520. 'page' => array(
  521. 'type' => 'hidden',
  522. 'name' => 'page',
  523. 'value' => $this->sPage
  524. ),
  525. 'sys_head' => array(
  526. 'type' => 'textarea',
  527. 'code' => true,
  528. 'name' => 'sys_head',
  529. 'caption' => _t('_adm_dsg_txt_inj_head'),
  530. 'info' => _t('_adm_dsg_txt_inj_head_inf'),
  531. 'value' => $this->oDb->getOne("SELECT `data` FROM `sys_injections` WHERE `name`='sys_head'"),
  532. ),
  533. 'sys_body' => array(
  534. 'type' => 'textarea',
  535. 'code' => true,
  536. 'name' => 'sys_body',
  537. 'caption' => _t('_adm_dsg_txt_inj_body'),
  538. 'info' => _t('_adm_dsg_txt_inj_body_inf'),
  539. 'value' => $this->oDb->getOne("SELECT `data` FROM `sys_injections` WHERE `name`='sys_body'"),
  540. ),
  541. 'save' => array(
  542. 'type' => 'submit',
  543. 'name' => 'save',
  544. 'value' => _t('_adm_btn_designer_submit'),
  545. )
  546. )
  547. );
  548. $oForm = new BxTemplStudioFormView($aForm, $oTemplate);
  549. $oForm->initChecker();
  550. if($oForm->isSubmittedAndValid()) {
  551. echo $this->submitInjections($oForm);
  552. exit;
  553. }
  554. $oTemplate->addJs(array('codemirror/codemirror.min.js'));
  555. $oTemplate->addCss(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'codemirror/|codemirror.css');
  556. return $oTemplate->parseHtmlByName('designer.html', array(
  557. 'content' => $this->getBlockCode(array(
  558. 'items' => $oTemplate->parseHtmlByName('dsr_injections.html', array(
  559. 'warning' => '',
  560. 'splash_iframe_id' => $this->sInjectionsIframeId,
  561. 'form' => $oForm->getCode()
  562. )),
  563. )),
  564. 'js_content' => $this->getPageJsCode(array(
  565. 'sCodeMirror' => 'textarea[name=sys_head],textarea[name=sys_body]'
  566. ))
  567. ));
  568. }
  569. protected function getSettings()
  570. {
  571. $oPage = new BxTemplStudioSettings(BX_DOL_STUDIO_STG_TYPE_SYSTEM, BX_DOL_STUDIO_STG_CATEGORY_TEMPLATES);
  572. return BxDolStudioTemplate::getInstance()->parseHtmlByName('designer.html', array(
  573. 'content' => $oPage->getFormCode(),
  574. 'js_content' => $this->getPageJsCode()
  575. ));
  576. }
  577. }
  578. /** @} */