From d23b13ec86e43672f0f4cc133ea9920f6bda55e0 Mon Sep 17 00:00:00 2001 From: Yuriy Pikhtarev Date: Sun, 24 Jun 2018 20:43:19 +0300 Subject: [PATCH] Fix release template editor Signed-off-by: Yuriy Pikhtarev --- posting.php | 2 +- styles/templates/posting_tpl.tpl | 112 +++++++++++++++---------------- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/posting.php b/posting.php index 61bef54c8..a3473b2f6 100644 --- a/posting.php +++ b/posting.php @@ -237,7 +237,7 @@ if ($mode == 'new_rel') { foreach ($sql as $row) { $topics .= $bb_cfg['tor_icons'][$row['tor_status']] . '' . $row['topic_title'] . '
'; } - if ($topics) { + if ($topics && !(IS_SUPER_ADMIN && !empty($_REQUEST['edit_tpl']))) { bb_die($topics . $lang['UNEXECUTED_RELEASE']); } } diff --git a/styles/templates/posting_tpl.tpl b/styles/templates/posting_tpl.tpl index 7e199d733..12cd38089 100644 --- a/styles/templates/posting_tpl.tpl +++ b/styles/templates/posting_tpl.tpl @@ -56,7 +56,7 @@ $(function(){ if ( /^<\-.*\->$/.test(v) ) { v = v.substring(2, v.length-2); } - if (k === 13 /* Enter */) { + if (k == 13 /* Enter */) { TPL.build_tpl_form( '<-'+ v +' ->', 'tpl-row-preview' ); $('#tpl-row-src').val(v); } @@ -66,10 +66,10 @@ $(function(){ $('#tpl-src-form').bind('mouseup keyup focus', function(e){ if (!$('#rel-preview:visible')[0]) return; if (e.keyCode) { - if ( !(e.keyCode === 38 /*up*/ || e.keyCode === 40 /*down*/) ) return; + if ( !(e.keyCode == 38 /*up*/ || e.keyCode == 40 /*down*/) ) return; } var ss = this.selectionStart; - if (ss === null) return; + if (ss == null) return; var v = this.value; var v = v.substring(0, ss).match(/.*$/)[0] + v.substring(ss, v.length).match(/^.*/)[0]; // текущая строка под курсором v = v.substring(2, v.length-2); @@ -84,7 +84,7 @@ $(function(){ var el = $sel.val(); var src = $.trim( $('#tpl-row-src').val() ); - if (src === '') { + if (src == '') { src += str_pad(el, 15); } src += ' '+ TPL.el_attr[el][0] +'['+ el +'] '; @@ -159,15 +159,15 @@ var TPL = { TPL.el_titles = {}; $.each(TPL.match_rows(str), function(i,row){ - if (row === null || row === '') return true; // continue + if (row == null || row == '') return true; // continue TPL.rows[i] = $.trim(row); }); $.each(TPL.rows, function(i,row){ var mr = TPL.match_cols(row); - if (mr[2] === null) return true; // continue + if (mr[2] == null) return true; // continue var title_id = mr[1]; // id элемента для подстановки его названия или {произвольное название} var input_els = mr[2]; - var row_title = (TPL.el_attr[title_id] !== null) ? TPL.el_attr[title_id][1] : TPL.trim_brackets(title_id); + var row_title = (TPL.el_attr[title_id] != null) ? TPL.el_attr[title_id][1] : TPL.trim_brackets(title_id); var $tr = $(''+ row_title +':'); var $td = $('td.rel-inputs', $tr); @@ -176,7 +176,7 @@ var TPL = { var el_html = ''; var me = TPL.match_el_attrs(el); // вставка шаблонного элемента типа TYPE[attr] - if (me[2] !== null) { + if (me[2] != null) { var at = me[2].split(','); var nm = at[0]; @@ -184,7 +184,7 @@ var TPL = { { case 'E': if ( $('#'+ nm +'-hid').length ) { - if (res_id === 'tpl-row-preview') { + if (res_id == 'tpl-row-preview') { el_html = ''+ $('#'+ nm +'-hid').html() +''; // скрытый элемент } } @@ -197,14 +197,14 @@ var TPL = { break; case 'INP': var id = TPL.build_el_id_title(nm); - var def = (TPL.el_attr[id] !== null) ? TPL.el_attr[id][2].split(',') : [200,80]; + var def = (TPL.el_attr[id] != null) ? TPL.el_attr[id][2].split(',') : [200,80]; var mlem = at[1] || def[0]; var size = at[2] || def[1]; el_html = ''; break; case 'TXT': var id = TPL.build_el_id_title(nm); - var def = (TPL.el_attr[id] !== null) ? TPL.el_attr[id][2].split(',') : [3]; + var def = (TPL.el_attr[id] != null) ? TPL.el_attr[id][2].split(',') : [3]; var rows = at[1] || def[0]; var cols = 100; el_html = '