Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 67.13 KB | None | 0 0
  1. /*
  2. * Форма новости
  3. *
  4. *
  5. */
  6.  
  7. Ext.app.ThemeView = function(styleId, form) {
  8. Ext.get('actualTehemeHeader').setStyle('display', 'none');
  9. Ext.get('quoteTehemeHeader').setStyle('display', 'none');
  10. return(
  11. Ext.app.actualThemeView((styleId === 104), form)
  12. || Ext.app.quoteThemeView((styleId === 200), form)
  13. );
  14. }
  15.  
  16. Ext.app.actualThemeView = function(hide, form) {
  17. // лишние элементы формы
  18. var hide_form_item = ['body', 'source_block', 'pickers_tags', 'pickers_themes', 'photoauthor', 'alt'];
  19. var fi = form.items;
  20. var fic = fi.getCount();
  21. for (i = 0; i < fic; i++) {
  22. var item = fi.itemAt(i);
  23. if (hide_form_item.indexOf(item.name) !== -1) {
  24. if (hide) {
  25. item.hide();
  26. } else {
  27. item.show();
  28. }
  29. }
  30. }
  31. // лишние блоки формы
  32. var id_blocks = [
  33. 'id_block_bigtitle',
  34. 'id_block_source',
  35. 'id_block_checkboxes',
  36. 'id_block_regional_news',
  37. 'id_block_wide_news',
  38. 'id_block_digest'
  39. ];
  40. Ext.each(id_blocks, function(id){
  41. Ext.get(id).setStyle('display', (hide) ? 'none' : 'block');
  42. });
  43. Ext.get('actualTehemeHeader').setStyle('display', (hide) ? 'block' : 'none');
  44.  
  45. return hide;
  46. }
  47.  
  48. // вид админки цитат
  49. Ext.app.quoteThemeView = function(hide, form) {
  50. // лишние элементы формы
  51. var hide_form_item = ['body', 'descript', 'isauthor', 'source_name', 'pickers_tags', 'pickers_themes',
  52. 'photoauthor', 'alt'];
  53. var fi = form.items;
  54. var fic = fi.getCount();
  55. for (i = 0; i < fic; i++) {
  56. var item = fi.itemAt(i);
  57. if (item.name == 'title') {
  58. // убрать|вернуть ограничение на кол-во символов
  59. item.maxLength = (hide) ? 255 : 70;
  60. item.validate();
  61. }
  62. if (hide_form_item.indexOf(item.name) !== -1) {
  63. if (hide) {
  64. item.hide();
  65. } else {
  66. item.show();
  67. }
  68. }
  69. }
  70. // лишние блоки формы
  71. var id_blocks = [
  72. 'id_block_bigtitle',
  73. 'id_block_checkboxes',
  74. 'id_block_regional_news',
  75. 'id_block_wide_news',
  76. 'id_block_digest'
  77. ];
  78. Ext.each(id_blocks, function(id) {
  79. Ext.get(id).setStyle('display', hide ? 'none' : 'block');
  80. });
  81. Ext.get('quoteTehemeHeader').setStyle('display', hide ? 'block' : 'none');
  82.  
  83. return hide;
  84. }
  85.  
  86. Ext.form.PickersFormPanel = Ext.extend(Ext.form.FormPanel, {
  87. // применяем конфигурацию
  88. initComponent: function() {
  89. var _this = this;
  90.  
  91. var secStore = new Ext.data.JsonStore({
  92. fields: ['name', 'value', 'firststyle'],
  93. proxy: new Ext.data.DirectProxy({
  94. directFn:pickerstree.readSections
  95. }),
  96. root: 'data',
  97. autoLoad: true
  98. });
  99.  
  100. var tagsStore = new Ext.data.JsonStore({
  101. fields: ['name', 'value'],
  102. proxy: new Ext.data.DirectProxy({
  103. directFn:tagstree.readSections
  104. }),
  105. root: 'data',
  106. autoLoad: true
  107. });
  108.  
  109. var themesStore = new Ext.data.JsonStore({
  110. fields: ['name', 'value'],
  111. baseParams: {
  112. extAction: 'themestree',
  113. extMethod: 'readSections'
  114. },
  115. proxy: new Ext.data.DirectProxy({
  116. directFn: themestree.readSections
  117. }),
  118. root: 'data',
  119. remoteSort: true,
  120. autoLoad: true
  121. });
  122.  
  123. var config = {
  124. labelAlign: 'left',
  125. trackResetOnLoad: true,
  126. submitAllvalues: true,
  127. buttonAlign: 'left',
  128. frame: true,
  129. link: '/?id=',
  130. defaults: {
  131. width:800,
  132. enableKeyEvents: true,
  133. allowBlank: true,
  134. submitValue: false,
  135. bubbleEvents: ['focus', 'blur', 'change', 'htmlchange'] // всплытие событий фокуса и потери фокуса \
  136. // для отключения перехватчика событий грида (нужно только если эта форма вложена в поле грида), \
  137. // обработчики на эти события подключаются извне, для формы html редактора вызывается \\
  138. // отдельный обработчик
  139. },
  140. reader: new Ext.data.JsonReader(),
  141. items: [{
  142. xtype: 'hidden',
  143. name: 'id',
  144. ref: 'idfield',
  145. id: 'articleId'
  146. }, {
  147. xtype: 'hidden',
  148. name: 'sort',
  149. ref: 'sort'
  150. }, {
  151. xtype: 'hidden',
  152. name: 'is_diggest',
  153. ref: 'is_diggest'
  154. }, {
  155. xtype: 'hidden',
  156. name: 'is_widecart',
  157. ref: 'is_widecart'
  158. }, {
  159. xtype: 'hidden',
  160. name: 'big_fp',
  161. ref: 'big_fp'
  162. }, {
  163. xtype: 'hidden',
  164. name: 'small_fp',
  165. ref: 'small_fp'
  166. }, {
  167. xtype: 'hidden',
  168. name: 'vsmall_fp',
  169. ref: 'vsmall_fp'
  170. }, {
  171. xtype: 'hidden',
  172. name: 'source_fp',
  173. ref: 'source_fp'
  174. }, {
  175. xtype: 'hidden',
  176. name: 'wide_fp',
  177. ref: 'wide_fp'
  178. }, {
  179. xtype: 'hidden',
  180. name: 'source_fp_orig',
  181. ref: 'source_fp_orig'
  182. }, {
  183. xtype: 'hidden',
  184. name: 'img_url',
  185. ref: 'img_url'
  186. }, {
  187. xtype: 'hidden',
  188. name: 'img_author',
  189. ref: 'img_author'
  190. }, {
  191. xtype: 'hidden',
  192. name: 'img_cc',
  193. ref: 'img_cc'
  194. }, {
  195. xtype: 'hidden',
  196. name: 'img_cc_url',
  197. ref: 'img_cc_url'
  198. }, {
  199. xtype: 'hidden',
  200. name: 'img_alt',
  201. ref: 'img_alt'
  202. }, {
  203. xtype: 'hidden',
  204. name: 'img_title',
  205. ref: 'img_title'
  206. }, {
  207. xtype: 'hidden',
  208. name: 'del',
  209. ref: 'del'
  210. }, {
  211. xtype: 'hidden',
  212. name: 'news_agre',
  213. ref: 'news_agre',
  214. id: 'news_agre'
  215. }, {
  216. layout: 'column',
  217. width: 1518,
  218. items: [{
  219. columnWidth: 0.47,
  220. layout: 'form',
  221. defaults: {
  222. anchor:'100%',
  223. submitValue: false,
  224. bubbleEvents:['change']
  225. },
  226. items: [{
  227. xtype:'textfield',
  228. maxLength:70,
  229. fieldLabel: 'Title SEO',
  230. submitValue: false,
  231. name: 'title_seo',
  232. enableKeyEvents: true,
  233. listeners: {
  234. keyup: Ext.app.QuotesChristmasTrees,
  235. keypress: Ext.app.QuotesChristmasTrees
  236. }
  237. }]
  238. }]
  239. },{
  240. layout: 'column',
  241. width: 1518,
  242. items: [{
  243. columnWidth: 0.47,
  244. layout: 'form',
  245. defaults: {
  246. anchor:'100%',
  247. submitValue: false,
  248. bubbleEvents:['change']
  249. },
  250. items: [{
  251. xtype:'textfield',
  252. maxLength:70,
  253. fieldLabel: 'Заголовок',
  254. submitValue: false,
  255. name: 'title',
  256. enableKeyEvents: true,
  257. listeners: {
  258. keyup: Ext.app.QuotesChristmasTrees,
  259. keypress: Ext.app.QuotesChristmasTrees
  260. }
  261. }]
  262. }, {
  263. columnWidth:0.11,
  264. layout: 'form',
  265. defaults:{
  266. anchor:'100%',
  267. submitValue: false,
  268. bubbleEvents:['change']
  269. },
  270. items: [{
  271. xtype: 'datefield',
  272. fieldLabel: 'дата',
  273. hideLabel: true,
  274. labelAlign: 'right',
  275. ref: '../../lastmod',
  276. submitValue: false,
  277. format: 'd.m.Y H:i:s',
  278. name: 'lastmod'
  279. }]
  280. }, {
  281. columnWidth: 0.42,
  282. id: 'id_block_bigtitle',
  283. layout: 'form',
  284. defaults:{
  285. anchor: '100%',
  286. submitValue: false,
  287. bubbleEvents: ['change']
  288. },
  289. items: [{
  290. xtype: 'textfield',
  291. maxLength: 70,
  292. fieldLabel:'&nbsp;&nbsp;Шпигель',
  293. submitValue: false,
  294. name: 'bigtitle',
  295. enableKeyEvents: true,
  296. listeners: {
  297. keyup: Ext.app.QuotesChristmasTrees,
  298. keydown: Ext.app.QuotesChristmasTrees
  299. }
  300. }]
  301. }]
  302. }, {
  303. layout: 'column',
  304. items: [{
  305. layout: 'form',
  306. defaults:{
  307. hideLabel: true,
  308. submitValue: false,
  309. bubbleEvents: ['change']
  310. }
  311. }, {
  312. layout: 'form',
  313. defaults: {
  314. width: 608,
  315. submitValue: false,
  316. bubbleEvents: ['change']
  317. },
  318. items: [{
  319. xtype: 'textarea',
  320. fieldLabel: 'Анонс',
  321. grow: true,
  322. growMin: 20,
  323. name: 'descript',
  324. enableKeyEvents: true,
  325. listeners: {
  326. keyup: Ext.app.QuotesChristmasTrees,
  327. keypress: Ext.app.QuotesChristmasTrees
  328. }
  329. }]
  330. }]
  331. }, {
  332. width: 915,
  333. id: 'id_block_source',
  334. layout: 'column',
  335. items: [{
  336. columnWidth: 0.5,
  337. layout: 'form',
  338. defaults: {
  339. anchor: '96%',
  340. submitValue: false,
  341. bubbleEvents: ['change']
  342. },
  343. items: [{
  344. fieldLabel: '',
  345. xtype: 'combo',
  346. mode: 'local',
  347. triggerAction: 'all',
  348. forceSelection: true,
  349. editable: false,
  350. name: 'isauthor',
  351. displayField: 'name',
  352. valueField: 'value',
  353. value: '0',
  354. store: new Ext.data.JsonStore({
  355. fields: ['name', 'value'],
  356. data: [
  357. {name: 'Источник (если не задан, то будет info.sibnet.ru)', value: '0'},
  358. {name: 'Автор', value: '1'}
  359. ]
  360. }),
  361. listeners: {
  362. show: function (event) {
  363. if (this.value == 0) { // Источник
  364. Ext.getCmp('source_name').setHideTrigger(true);
  365. } else if (this.value == 1) { // Автор
  366. Ext.getCmp('source_name').setHideTrigger(false);
  367. }
  368. },
  369. select: function (event) {
  370. if (this.value == 0) { // Источник
  371. Ext.getCmp('source_name').setHideTrigger(true);
  372. } else if (this.value == 1) { // Автор
  373. Ext.getCmp('source_name').setHideTrigger(false);
  374. }
  375. }
  376. }
  377. }, {
  378. id: 'source_name',
  379. fieldLabel: 'Источник',
  380. xtype: 'combo',
  381. mode: 'local',
  382. triggerAction: 'all',
  383. forceSelection: false,
  384. editable: true,
  385. name: 'source_name',
  386. displayField: 'name',
  387. valueField: 'name',
  388. hideTrigger: true,
  389. value: '',
  390. store: new Ext.data.JsonStore({
  391. fields: ['name', 'url'],
  392. data: [
  393. {name: 'Олег Чернов, Sibnet.ru', url: '385'},
  394. {name: 'Вячеслав Корзун, Sibnet.ru', url: '384'},
  395. {name: 'Полина Разуваева, Sibnet.ru', url: '389'},
  396. {name: 'Елена Кондратенко, Sibnet.ru', url: '387'},
  397. {name: 'Светлана Дрягилева, Sibnet.ru', url: '388'},
  398. {name: 'Ольга Диянова, Sibnet.ru', url: '383'},
  399. {name: 'Елена Медведева, Sibnet.ru', url: '390'},
  400. {name: 'Елизавета Разумникова, Sibnet.ru', url: '386'},
  401. {name: 'Олег Девятилов', url: '392'},
  402. {name: 'Елена Козлова', url: '393'},
  403. {name: 'Очистить', url: '0'}
  404. ]
  405. }),
  406. listeners: {
  407. keyup: Ext.app.QuotesChristmasTrees,
  408. keypress: Ext.app.QuotesChristmasTrees,
  409. select: function (event) {
  410. if(this.value == 'Очистить') {
  411. Ext.getCmp('source_link').setValue("")
  412. this.setValue("")
  413. } else {
  414. var items = this.store.data.items
  415. for (var i = 0; i < items.length; i++) {
  416. if(this.value == items[i].data.name) {
  417. Ext.getCmp('source_link').setValue("https://info.sibnet.ru/articles/" + items[i].data.url)
  418. }
  419. }
  420. }
  421. }
  422. }
  423. }]
  424. }, {
  425. columnWidth: 0.5,
  426. layout: 'form',
  427. defaults: {
  428. anchor: '100%',
  429. submitValue: false,
  430. bubbleEvents: ['change']
  431. },
  432. items: [
  433. {
  434. xtype: 'checkbox',
  435. name: 'goto_source',
  436. fieldLabel: 'Всех на ист.'
  437. }, {
  438. id: 'source_link',
  439. xtype: 'textfield',
  440. fieldLabel: 'url на Источник',
  441. name: 'source_link'
  442. }
  443. ]
  444. }]
  445. }, {
  446. xtype: 'superboxselect',
  447. anchor:'100%',
  448. name: 'altsection',
  449. ref: 'altsection',
  450. mode: 'remote',
  451. fieldLabel: 'Рубрики',
  452. allowBlank: false,
  453. emptyText: 'Не выбрано',
  454. submitValue:false,
  455. store: secStore,
  456. triggerAction: 'all',
  457. displayField: 'name',
  458. valueField: 'value',
  459. checkChangeBuffer: 500,
  460. listeners: {
  461. 'valid': function(e) {
  462. // специальное оформление для "Актуальные темы" и "Цитаты"
  463. var record = e.usedRecords;
  464. var firststyle = (record.getCount()) ? parseInt(record.itemAt(0).data.firststyle) : false;
  465. var form = this.ownerCt.getForm();
  466. if (Ext.app.ThemeView(firststyle, form)) {
  467. this.hide();
  468. } else {
  469. this.show();
  470. }
  471. }
  472. }
  473. }, {
  474. xtype: 'superboxselect',
  475. anchor:'100%',
  476. name: 'pickers_tags',
  477. ref: 'pickers_tags',
  478. mode: 'remote',
  479. fieldLabel: 'Теги',
  480. allowBlank: true,
  481. emptyText: 'none',
  482. submitValue:false,
  483. store: tagsStore,
  484. triggerAction: 'all',
  485. displayField: 'name',
  486. valueField: 'value',
  487. checkChangeBuffer: 500
  488. }, {
  489. xtype: 'superboxselect',
  490. anchor: '100%',
  491. name: 'pickers_themes',
  492. ref: 'pickers_themes',
  493. mode: 'remote',
  494. fieldLabel: 'Темы',
  495. allowBlank: true,
  496. emptyText: 'none',
  497. submitValue: false,
  498. store: themesStore,
  499. triggerAction: 'all',
  500. displayField: 'name',
  501. valueField: 'value',
  502. checkChangeBuffer: 500
  503. }, {
  504. anchor:'100%',
  505. layout: 'column',
  506. id: 'id_block_checkboxes',
  507. items:[{
  508. layout: 'form',
  509. defaults:{
  510. labelStyle: 'text-align:right;',
  511. submitValue: false,
  512. bubbleEvents:['change']
  513. },
  514. items: [{
  515. xtype:'checkbox',
  516. fieldLabel: 'Выделенная',
  517. name: 'isbigtitle',
  518. itemId: 'isbigtitle',
  519. ref: '../../isbigtitle'
  520.  
  521. }]
  522. }, {
  523. layout: 'form',
  524. defaults: {
  525. labelStyle: 'text-align:right',
  526. submitValue: false,
  527. bubbleEvents: ['change']
  528. },
  529. items: [{
  530. xtype: 'checkbox',
  531. fieldLabel: 'Заблокировано',
  532. name: 'blocked'
  533. }]
  534. }, {
  535. layout: 'form',
  536. defaults:{
  537. labelStyle: 'text-align:right',
  538. submitValue: false,
  539. bubbleEvents:['change']
  540. },
  541. items: [{
  542. xtype:'checkbox',
  543. fieldLabel: 'Без коммент.',
  544. name: 'nocomments'
  545. }]
  546. }, {
  547. layout: 'form',
  548. id: 'agre_buttonset',
  549. xtype: 'splitbutton',
  550. text: 'Агрегаторы', // button_set - несколько значений одной цифрой
  551. tooltip: 'Передать в новостные агрегаторы: news.yandex.ru, news.google ...',
  552. iconCls: 'app-ico-checkbox-unchecked',
  553. bubbleEvents:['change'],
  554. style: 'margin-left:23px;margin-right:7px;',
  555. my_iconCls0: 'app-ico-checkbox-unchecked',
  556. my_iconCls1: 'app-ico-checkbox-mix-checked',
  557. my_iconCls2: 'app-ico-checkbox-full-checked',
  558. my_fn_check: function(setValue) {
  559. var powcount_sum = 0; // число всех чекбоксов
  560. var powcount_checked = 0; // число всех выбранных чекбоксов
  561.  
  562. this.menu.items.each(function(menuItem) {
  563. // проверяем прочеканность
  564. var value = menuItem.value | false;
  565. if (value == false) {
  566. return true;
  567. }
  568. //alert(value);
  569. var pow2 = 1 << (value - 1); // id элем. меню в степени 2
  570. if (typeof(setValue) !== 'undefined') {
  571. var state = (setValue & pow2) ? true : false;
  572. menuItem.setChecked(state, true);
  573. menuItem.checked = state;
  574. }
  575. if (menuItem.checked) {
  576. powcount_checked += pow2;
  577. }
  578. powcount_sum += pow2;
  579. });
  580.  
  581. // ставим иконку кнопке.
  582. var iconCls = powcount_checked != 0
  583. ? (powcount_checked != powcount_sum ? this.my_iconCls1 : this.my_iconCls2)
  584. : this.my_iconCls0; // по умолчанию unchecked
  585. this.setIconClass(iconCls);
  586.  
  587. this.value = powcount_checked; // реальная цифра почеканных чекбоксов
  588. this.maxValue = powcount_sum; // цифра - если бы все были прочеканны
  589. //alert(powcount_sum);
  590. Ext.getCmp('news_agre').setValue(powcount_checked); // запись в скрытое поле для отправки на сервер
  591. },
  592. handler: function() {
  593. // check|unchek при клике на кнопку
  594. var setValue = this.value == this.maxValue ? 0 : -1;
  595. this.my_fn_check(setValue);
  596. },
  597. menu: {
  598. defaults: {
  599. xtype: 'menucheckitem',
  600. hideOnClick: false, // не закрывать меню при выборе чекбоксов
  601. submitValue: false,
  602. listeners: {
  603. checkchange: function(menuItem, checked) {
  604. // обрабатываем чеки
  605. var root = this.findParentByType('button');
  606. root.my_fn_check();
  607. }
  608. }
  609. },
  610. items: [
  611. // value - bit analog mysql set 63max
  612. { value: 1, text: 'news.yandex.ru' },
  613. { value: 2, text: 'news.google.com' },
  614. { value: 3, text: 'news.mail.ru' },
  615. { value: 4, text: 'news.rambler.ru' },
  616. { value: 5, text: 'news.liveinternet.ru' },
  617. { xtype: 'menuseparator' },
  618. {
  619. text: 'все',
  620. xtype: '',
  621. onClick: function() {
  622. var root = this.findParentByType('button');
  623. var setValue = (root.value == root.maxValue) ? 0 : -1;
  624. root.my_fn_check(setValue);
  625. }
  626. }
  627. ] // items
  628. } // menu
  629. }, { // Агрегаторы
  630. layout: 'form',
  631. id: 'zen_yandex',
  632. defaults: {
  633. labelStyle: 'text-align:right',
  634. submitValue: false,
  635. bubbleEvents: ['change']
  636. },
  637. items: [{
  638. xtype: 'checkbox',
  639. fieldLabel: 'Zen.sport.ya',
  640. name: 'zen_yandex',
  641. listeners: {
  642. change: {
  643. fn: function (event) {
  644. // Порядковый номер Агрегатора
  645. var value = 6;
  646. var pow2 = 1 << (value - 1);
  647. var agre_buttonset = Ext.getCmp('agre_buttonset');
  648. //alert(agre_buttonset.value);
  649. alert(this.checked);
  650. if(this.checked) {
  651. agre_buttonset.value += pow2;
  652. } else {
  653. agre_buttonset.value -= pow2;
  654. }
  655. alert(agre_buttonset.value);
  656.  
  657. }
  658. }
  659. },
  660. }]
  661. },{
  662. layout: 'form',
  663. defaults:{
  664. labelStyle: 'text-align:right',
  665. submitValue: false,
  666. bubbleEvents:['change']
  667. },
  668. items: [{
  669. xtype:'checkbox',
  670. fieldLabel: 'В информер',
  671. name: 'informer'
  672. }]
  673. }, {
  674. layout: 'form',
  675. defaults: {
  676. labelStyle: 'text-align:right',
  677. submitValue: false,
  678. bubbleEvents: ['change']
  679. },
  680. items: [{
  681. xtype: 'checkbox',
  682. fieldLabel: 'в ленте sibnet',
  683. name: 'export_flag',
  684. checked: true
  685. }]
  686. }, {
  687. layout: 'form',
  688. defaults:{
  689. labelStyle: 'text-align:right',
  690. submitValue: false,
  691. bubbleEvents: ['change']
  692. },
  693. items: [{
  694. xtype: 'checkbox',
  695. fieldLabel: 'Реклама',
  696. name: 'ad'
  697. }]
  698. }, {
  699. defaults: {
  700. labelStyle: 'display: none; width: 0',
  701. submitValue: false,
  702. bubbleEvents: ['change']
  703. },
  704. items: [{
  705. fieldLabel: '',
  706. width: 120,
  707. xtype: 'combo',
  708. mode: 'local',
  709. triggerAction: 'all',
  710. forceSelection: true,
  711. editable: false,
  712. name: 'flags',
  713. displayField: 'name',
  714. valueField: 'value',
  715. value: '0',
  716. store: new Ext.data.JsonStore({
  717. fields: ['name', 'value'],
  718. data: [
  719. { name: 'нет фото/видео', value: '0' },
  720. { name: 'есть фото' , value: '1' },
  721. { name: 'есть видео' , value: '2' },
  722. { name: 'есть ф. и в.' , value: '3' },
  723. { name: 'инфографика' , value: '8' },
  724. { name: 'online' , value: '16' },
  725. { name: 'без фото' , value: '4' }
  726. ]
  727. })
  728. }]
  729. }]
  730. }, {
  731. xtype: 'container',
  732. layout: {
  733. type: 'table',
  734. columns: 2
  735. },
  736. defaults: {
  737. anchor: '100%',
  738. labelWidth: 72
  739. },
  740. items: [
  741. {
  742. xtype: 'container',
  743. margin: 4,
  744. padding: 1,
  745. layout: {
  746. type: 'table',
  747. columns: 2
  748. },
  749. style: { border: '1px solid #ccc' },
  750. width: 230,
  751. height: 82,
  752. padding: 2,
  753. items: [
  754. {
  755. xtype: 'image',
  756. ref: '../../small_fp_source',
  757. resetImageSize: false,
  758. style: {
  759. width: '110px',
  760. height: '82px'
  761. }
  762. }, {
  763. xtype: 'image',
  764. ref: '../../small_wide_fp',
  765. resetImageSize: false,
  766. style: {
  767. marginLeft: '5px',
  768. width: '110px',
  769. height: '73px'
  770. }
  771. }
  772. ]
  773. }, {
  774. xtype: 'container',
  775. width: 800,
  776. layout: {
  777. type: 'form',
  778. columns: 4
  779. },
  780. style: { marginLeft: '5px' },
  781. defaults: {
  782. anchor: '100%',
  783. decimalSeparator: '.',
  784. submitValue: false,
  785. width: '100%',
  786. style: { marginBottom: '5px' }
  787. },
  788. items: [
  789. {
  790. xtype: 'displayfield',
  791. id: 'actualTehemeHeader',
  792. value: '<div>^ Заголовок и описание темы</div><div>< фото темы</div>',
  793. style: 'font-size: 16px;'
  794. }, {
  795. xtype: 'displayfield',
  796. id: 'quoteTehemeHeader',
  797. value: '<div>^ Ссылка с цитаты (если ввели ссылку, поставьте галочку "всех на источник")</div><div>< фото цитаты</div>',
  798. style: 'font-size: 16px;'
  799. }, {
  800. xtype:'textfield',
  801. fieldLabel: 'Авт. фото в теле новости ',
  802. name: 'photoauthor',
  803. value: '© ',
  804. enableKeyEvents: true,
  805. listeners: {
  806. keyup: Ext.app.QuotesChristmasTrees,
  807. keypress: Ext.app.QuotesChristmasTrees
  808. }
  809. }, {
  810. xtype:'textfield',
  811. fieldLabel: 'Заголовок изображения',
  812. name: 'title_img',
  813. enableKeyEvents: true,
  814. listeners: {
  815. keyup: Ext.app.QuotesChristmasTrees,
  816. keypress: Ext.app.QuotesChristmasTrees
  817. }
  818. }, {
  819. xtype:'textfield',
  820. fieldLabel: 'Подпись к фото',
  821. name: 'alt',
  822. enableKeyEvents: true,
  823. listeners: {
  824. keyup: Ext.app.QuotesChristmasTrees,
  825. keypress: Ext.app.QuotesChristmasTrees
  826. }
  827. }
  828. ]
  829. }
  830. ]
  831. }, {
  832. xtype: 'container',
  833. layout: {
  834. type: 'table',
  835. columns: 4
  836. },
  837. defaults: { margin: '0 8 0 0' },
  838. padding: '0 0 0 12',
  839. items: [{
  840. xtype: 'button',
  841. text: 'Редактировать',
  842. iconCls: 'x-htmleditor-imageupload-cropbutton',
  843. itemId: 'cropButton',
  844. ref: '../imgEditButton',
  845. scope: this,
  846. tooltip: 'Редактировать изображение',
  847. style: {
  848. margin: '-28px 0 0 4px',
  849. position: 'absolute'
  850. },
  851. handler: this._editImageHandler
  852. }]
  853. }, {
  854. layout: 'column',
  855. width: 920,
  856. items: [{
  857. columnWidth: 0.37,
  858. layout: 'form',
  859. defaults: {
  860. anchor:'100%',
  861. submitValue: false,
  862. bubbleEvents:['change']
  863. },
  864. items: [{
  865. xtype: 'button',
  866. text: 'Редактировать фотослайдер',
  867. iconCls: 'x-htmleditor-imageupload-cropbutton',
  868. itemId: 'photoSliderButton',
  869. ref: '../photoSliderEditButton',
  870. scope: this,
  871. tooltip: 'Редактировать фотослайдер',
  872. handler: this.onPhotoSliderOpen
  873. }]
  874. }, {
  875. columnWidth: 0.37,
  876. layout: 'form',
  877. defaults: {
  878. anchor:'100%',
  879. submitValue: false,
  880. bubbleEvents:['change']
  881. },
  882. items: [{
  883. xtype: 'button',
  884. text: 'Редактировать фотоленту',
  885. iconCls: 'x-htmleditor-imageupload-cropbutton',
  886. itemId: 'photoBlogButton',
  887. ref: '../photoBlogEditButton',
  888. scope: this,
  889. tooltip: 'Редактировать фотоленту',
  890. style: {
  891. margin: '0px 0px 0px 30px'
  892. },
  893. handler: this.onPhotoBlogOpen
  894. }]
  895. }, {
  896. columnWidth: 0.2,
  897. layout: 'form',
  898. defaults: {
  899. anchor:'100%',
  900. submitValue: false,
  901. bubbleEvents:['change']
  902. },
  903. items: [{
  904. xtype: 'button',
  905. text: 'Отправить в Яндекс',
  906. iconCls: '',
  907. itemId: 'Ybutton',
  908. style: {
  909. margin: '0px 0px 0px 30px'
  910. },
  911. listeners: {
  912. click: {
  913. fn: function (event) {
  914. _this.sendYandex();
  915. }
  916. }
  917. },
  918. scope: this
  919. }]
  920. }]
  921. }, {
  922. xtype: 'advhtmleditor',
  923. hideLabel: true,
  924. fieldLabel: 'Содержание',
  925. name: 'body',
  926. width: 960,
  927. height: 600,
  928. style: 'font-family:Verdana, Helvetica, sans-serif;',
  929.  
  930. // костыль - добавляем кнопку вставки картинки в тело новости
  931. listeners: {
  932. PickersFormPanel: (PickersFormPanel = this),
  933. init: function() {
  934. PickersFormPanel._injectCss(cmp, '/isr_features.css' + Ext.app.cssSuffix);
  935. },
  936. render: function(cmp) {
  937. cmp.getToolbar().add({
  938. iconCls: 'x-htmleditor-imageupload',
  939. tooltip: 'Вставить фото',
  940. cmp: cmp,
  941. handler: function() {
  942. PickersFormPanel._bodyImageHandler(this.cmp);
  943. }
  944. });
  945. }
  946. }
  947. }],
  948. buttons: [{
  949. text: 'Опубликовать!',
  950. iconCls: 'icon-form-yes',
  951. itemId:'PublicButton',
  952. handler: this.onPublic,
  953. scope: this
  954. }, {
  955. xtype: 'tbspacer',
  956. width: 50
  957. }, {
  958. text: 'Региональные новости',
  959. id: 'id_block_regional_news',
  960. iconCls: '',
  961. itemId: 'Rbutton',
  962. handler: function() {
  963. var id = this.idfield.getValue();
  964. if (id && this.del.getValue() == 0)
  965. window.open('/admin_main_news/?id=' + id);
  966. else
  967. alert('Новость должна быть сохранена и опубликована!');
  968. },
  969. scope: this
  970. }, {
  971. text: 'Слайдер на главной',
  972. id: 'id_block_wide_news',
  973. iconCls: '',
  974. itemId: 'Wbutton',
  975. handler: this.onWideChange,
  976. scope: this
  977. }, {
  978. text: 'Дайджест дня',
  979. id: 'id_block_digest',
  980. iconCls: '',
  981. itemId: 'Dbutton',
  982. handler: this.onDiggestChange,
  983. scope: this
  984. }, {
  985. text: 'Приоритетная',
  986. iconCls: '',
  987. itemId: 'Pbutton',
  988. handler: this.onPriorityChange,
  989. scope: this
  990. }, {
  991. xtype: 'tbspacer',
  992. width: 50
  993. }, {
  994. itemId:'win',
  995. text: 'Просмотр',
  996. iconCls: '',
  997. disabled:true,
  998. scope: this,
  999. handler: function() {
  1000. if (this.link && this.idfield.value)
  1001. window.open(this.link + this.idfield.value);
  1002. }
  1003. }, {
  1004. xtype: 'tbspacer',
  1005. width: 50
  1006. }, {
  1007. text: 'Сохранить',
  1008. iconCls: 'icon-save',
  1009. listeners: {
  1010. click: {
  1011. buffer: 500,
  1012. fn: function (event) {
  1013. _this.onUpdate(this, event);
  1014. }
  1015. }
  1016. },
  1017. scope: this
  1018. }]
  1019. };
  1020.  
  1021. Ext.apply(this, config);
  1022. Ext.apply(this.initialConfig, config);
  1023.  
  1024. Ext.form.PickersFormPanel.superclass.initComponent.apply(this, arguments);
  1025.  
  1026. this.altsection.store.on('load', function() {
  1027. if (this.dontreset) {
  1028. this.dontreset = false;
  1029. } else {
  1030. this.originalValue = this.getValue();
  1031. }
  1032. }, this.altsection);
  1033.  
  1034. this.pickers_tags.store.on('load', function() {
  1035. if (this.dontreset) {
  1036. this.dontreset = false;
  1037. } else
  1038. this.originalValue = this.getValue();
  1039. }, this.pickers_tags);
  1040. this.pickers_themes.store.on('load', function() {
  1041. if (this.dontreset) {
  1042. this.dontreset = false;
  1043. } else
  1044. this.originalValue = this.getValue();
  1045. }, this.pickers_themes);
  1046. this.getForm().on('actioncomplete', function(form, action) {
  1047. // action - данные детальной формы
  1048. if (action.type == 'load') {
  1049. // <Костыль> для news_agre - Агрегаторы
  1050. var agre_buttonset = Ext.getCmp('agre_buttonset');
  1051. if (agre_buttonset.rendered) {
  1052. //alert(action.result.data.news_agre);
  1053. agre_buttonset.my_fn_check(action.result.data.news_agre);
  1054. }
  1055. var zen_yandex = Ext.getCmp('zen_yandex');
  1056. if(zen_yandex.rendered) {
  1057. // Порядковый номер Агрегатора
  1058. zen_yandex.items.each(function(i){
  1059. var pow2 = 1 << (6 - 1);
  1060. var agre = action.result.data.news_agre;
  1061. if (typeof(agre) !== 'undefined') {
  1062. var state = (agre & pow2) ? true : false;
  1063. i.setValue(state);
  1064. }
  1065. })
  1066. }
  1067. // </Костыль>
  1068.  
  1069. var img = action.reader.jsonData.records.small_fp;
  1070. this.small_fp_source.setSrc(img ? '/' + img : Ext.BLANK_IMAGE_URL);
  1071.  
  1072. var wide_img = action.reader.jsonData.records.wide_fp;
  1073. this.small_wide_fp.setSrc(wide_img ? '/' + wide_img : Ext.BLANK_IMAGE_URL);
  1074.  
  1075. this.PublicChange();
  1076. this.PriorityChange();
  1077. this.DiggestChange();
  1078. this.WideChange();
  1079. this.YandexChange();
  1080. }
  1081. }, this);
  1082.  
  1083. this.on('afterrender', function(form) {
  1084. if (!form.drTarget)
  1085. form.drTarget = new Ext.dd.DropTarget(form.body.dom, {
  1086. ddGroup: 'pickers',
  1087. notifyEnter: function(ddSource, e, data) {
  1088. this.el.stopFx();
  1089. this.el.highlight();
  1090. },
  1091. notifyDrop: function(ddSource, e, data) {
  1092. if (data.node.ownerTree.id == 'tags-tree') {
  1093. var oldval = form.pickers_tags.getValue();
  1094. form.pickers_tags.setValue(oldval + ',' + data.node.id);
  1095. form.pickers_tags.dontreset = true;
  1096. } else if (data.node.ownerTree.id == 'themes-tree') {
  1097. var oldval = form.pickers_themes.getValue();
  1098. form.pickers_themes.setValue(oldval + ',' + data.node.id);
  1099. form.pickers_themes.dontreset = true;
  1100. } else if (data.node.ownerTree.id == 'feed-tree') {
  1101. var oldval = form.altsection.getValue();
  1102. form.altsection.setValue(oldval + ',' + data.node.id);
  1103. form.altsection.dontreset = true;
  1104. }
  1105. }
  1106. });
  1107. }, this);
  1108. },
  1109. onUpdate: function(btn, ev) {
  1110. this.fireEvent('clickonsave', btn, ev);
  1111. },
  1112. onPublic: function(btn, ev) {
  1113. var id = this.idfield.getValue();
  1114. if (id) {
  1115. var d = this.del.getValue();
  1116. var me = this;
  1117. Ext.Ajax.request({
  1118. url: this.url,
  1119. params: {
  1120. extAction: 'pickers',
  1121. extMethod: 'setPublic',
  1122. id: id,
  1123. del: d
  1124. },
  1125. success: function(response) {
  1126. var obj = Ext.ux.errorhandler.jsonajax(response);
  1127. if (obj && obj.success) {
  1128. if (d>0)
  1129. me.del.setValue(0);
  1130. else
  1131. me.del.setValue(1);
  1132. me.PublicChange();
  1133. }
  1134. },
  1135. failure: Ext.ux.errorhandler.failuremessage
  1136. });
  1137. }
  1138. },
  1139.  
  1140. // Отправка текста в Яндекс Оригинальные тексты
  1141. sendYandex: function() {
  1142. frm = this.getForm();
  1143. frm.items.each(function(f) {
  1144. if (f.xtype == 'advhtmleditor') {
  1145. var text = f.getValue();
  1146. text = text.replace(/<[^>]*>/g, ' ');
  1147. text = text.replace(/&nbsp;/g, ' ');
  1148. text = text.replace(/&gt;/g, '>');
  1149. text = text.replace(/&lt;/g, '<');
  1150. text = text.replace(/\n+/g, ' ');
  1151. text = text.replace(/ +/g, ' ');
  1152. if (text.length < 500) {
  1153. alert('Текст меньше 500 знаков!');
  1154. } else if (text.length > 32000) {
  1155. alert('Текст больше 32000 знаков!');
  1156. } else {
  1157. Ext.Ajax.request({
  1158. url: Ext.app.REMOTING_API.url,
  1159. params: {
  1160. extAction: 'pickers',
  1161. extMethod: 'sendYandex',
  1162. text: text
  1163. },
  1164. success: function(response) {
  1165. var data = Ext.decode(response.responseText);
  1166. if (data) {
  1167. if (data.success) {
  1168. alert(data.msg);
  1169. this.YandexChange();
  1170. } else {
  1171. alert(data.msg);
  1172. }
  1173. }
  1174. },
  1175. failure: Ext.ux.errorhandler.failuremessage
  1176. });
  1177. }
  1178. }
  1179. })
  1180. },
  1181.  
  1182. // выборка только измененных значений
  1183. getModifiedFieldsValues: function() {
  1184. frm = this.getForm();
  1185. var o = false,
  1186. n,
  1187. key,
  1188. val;
  1189. frm.items.each(function(f) {
  1190. if (this.create_fix && f.xtype == 'superboxselect')
  1191. f.originalValue = '';
  1192. if (!f.disabled && f.isDirty()) {
  1193. n = f.getName();
  1194. key = o[n];
  1195. val = f.getValue();
  1196. if (val != f.originalValue) {
  1197. o = o ? o : {};
  1198. if (Ext.isDefined(key)) {
  1199. if (Ext.isArray(key)) {
  1200. o[n].push(val);
  1201. } else {
  1202. o[n] = [key, val];
  1203. }
  1204. } else {
  1205. o[n] = val;
  1206. }
  1207. }
  1208. }
  1209. }, this);
  1210. if (o.altsection) {
  1211. o.del = this.del.getValue();
  1212. }
  1213.  
  1214. return o;
  1215. },
  1216. setModifiedFieldsValues: function(values, response_values) {
  1217. if (this.create_fix)
  1218. this.create_fix = false;
  1219. var resp_records = response_values.records;
  1220. var me = this;
  1221. frm = this.getForm();
  1222. frm.items.each(function(f) {
  1223. n = f.getName();
  1224. if (values[n]) {
  1225. f.originalValue = values[n];
  1226. }
  1227. if (resp_records[n]) {
  1228. if (n == 'title') {
  1229. me.setTitle(resp_records[n]);
  1230. }
  1231. f.setValue(resp_records[n]);
  1232. f.originalValue = f.getValue();
  1233. if (n == 'del') {
  1234. me.PublicChange();
  1235. me.PriorityChange();
  1236. }
  1237. }
  1238. });
  1239. },
  1240. _editImageHandler: function() {
  1241. var bigimage = '';
  1242. if ((img_src = this.source_fp.getValue())) {
  1243. var http = new RegExp('^https?:');
  1244. bigimage = Ext.DomHelper.createDom({
  1245. tag: 'img',
  1246. src: (http.test(img_src) ? '' : '/') + img_src
  1247. });
  1248. }
  1249. this.uploadDialog = new Sibnet.adminjs.NewsImageDialog({
  1250. submitUrl: this.url,
  1251. managerUrl: this.url,
  1252. baseParams: {extAction: 'ImageNewsMapper'},
  1253. imageToEdit: bigimage,
  1254. width: 830,
  1255. pageSize: 120,
  1256. disableServerSideEdit: false,
  1257. disableStyling: false,
  1258. disableDelete: true,
  1259. inline: false
  1260. });
  1261.  
  1262. this.uploadDialog.img_url.setValue(this.img_url.getValue());
  1263. this.uploadDialog.img_author.setValue(img_src ? this.img_author.getValue() : '© ');
  1264. this.uploadDialog.img_cc.setValue(this.img_cc.getValue());
  1265. this.uploadDialog.img_cc_url.setValue(this.img_cc_url.getValue());
  1266. this.uploadDialog.img_alt.setValue(this.img_alt.getValue());
  1267. this.uploadDialog.img_title.setValue(this.img_title.getValue());
  1268.  
  1269. this.uploadDialog.isbigtitle.setValue(this.isbigtitle.getValue());
  1270.  
  1271. Ext.FREE_CROP = false;
  1272.  
  1273. var me = this;
  1274. this.uploadDialog.on('mainArticleImageEdited', function () {
  1275. var newimg = this.imageUploadForm.vistaPrevia.src;
  1276. if (newimg) {
  1277. newimg = newimg.replace(new RegExp('https://' + document.domain + '(:[0-9]+)?/', 'g'), '');
  1278. var old_img = me.source_fp.getValue();
  1279. var sm_newimg = '';
  1280. var sm = newimg.split('.');
  1281. if (sm.length == 2 && (sm[1] == 'jpg' || sm[1] == 'jpeg' || sm[1] == 'gif' || sm[1] == 'png')) {
  1282. sm_newimg = sm[0] + 's.' + (sm[1] == 'jpeg' ? 'jpg' : sm[1]);
  1283. }
  1284. if (sm_newimg && /^ni_source\/tmp\//.test(sm_newimg))
  1285. me.small_fp_source.setSrc('/' + sm_newimg + '?' + Math.floor(Math.random() * 111111));
  1286. if (old_img != newimg)
  1287. me.source_fp.setValue(newimg);
  1288. }
  1289.  
  1290. var newimg_3x2 = this.imageUploadForm.imagePreview_3_2.src;
  1291. if (newimg_3x2) {
  1292. newimg_3x2 = newimg_3x2.replace(new RegExp('https://' + document.domain + '(:[0-9]+)?/', 'g'), '');
  1293. var old_img_3x2 = me.wide_fp.getValue();
  1294. var sm_newimg = '';
  1295. var sm = newimg_3x2.split('.');
  1296. if (sm.length == 2 && (sm[1] == 'jpg' || sm[1] == 'jpeg' || sm[1] == 'gif' || sm[1] == 'png')) {
  1297. sm_newimg = sm[0] + 's.' + (sm[1] == 'jpeg' ? 'jpg' : sm[1]);
  1298. }
  1299. if (sm_newimg && /^ni_source\/tmp\//.test(sm_newimg)) {
  1300. me.small_wide_fp.setSrc('/' + sm_newimg + '?' + Math.floor(Math.random() * 111111));
  1301. }
  1302. if (old_img_3x2 != newimg_3x2)
  1303. me.wide_fp.setValue(newimg_3x2);
  1304. }
  1305.  
  1306. // задать source_fp_orig при сохр стр. (если там не пусто - то менялся исходник фото)
  1307. var source_fp_orig = this.source_fp_orig.getValue();
  1308. source_fp_orig = source_fp_orig.replace(new RegExp('https://' + document.domain + '/', 'g'), '');
  1309. me.source_fp_orig.setValue(source_fp_orig);
  1310.  
  1311. var isbigtitle = this.isbigtitle.getValue(); // коммерческая
  1312. me.isbigtitle.setValue(isbigtitle);
  1313. me.img_url.setValue(this.img_url.getValue());
  1314. me.img_author.setValue(this.img_author.getValue());
  1315. me.img_cc.setValue(this.img_cc.getValue());
  1316. me.img_cc_url.setValue(this.img_cc_url.getValue());
  1317. me.img_alt.setValue(this.img_alt.getValue());
  1318. me.img_title.setValue(this.img_title.getValue());
  1319.  
  1320. this.close();
  1321. });
  1322. this.uploadDialog.show();
  1323. },
  1324.  
  1325. // private
  1326. // instead of overriding the htmleditor header method we just append another css file to it's iframe head
  1327. _injectCss: function (cmp, cssFile) {
  1328. var frameName = cmp.iframe.name;
  1329. var iframe;
  1330.  
  1331. iframe = document.frames ? document.frames[frameName] : window.frames[frameName];
  1332.  
  1333. // we have to add our custom css file to the iframe
  1334. var ss = iframe.document.createElement('link');
  1335. ss.type = 'text/css';
  1336. ss.rel = 'stylesheet';
  1337. ss.href = cssFile;
  1338.  
  1339. if (document.all) {
  1340. iframe.document.createStyleSheet(ss.href);
  1341. } else {
  1342. iframe.document.getElementsByTagName('head')[0].appendChild(ss);
  1343. }
  1344. },
  1345.  
  1346. // вставка фото в тело редактора
  1347. _bodyImageHandler: function(cmp) {
  1348. var bigimage = '';
  1349. var img_src = '';
  1350.  
  1351. this.uploadDialog = new Sibnet.adminjs.NewsImageDialog({
  1352. submitUrl: this.url,
  1353. managerUrl: this.url,
  1354. width: 830,
  1355. baseParams: { extAction:'ImageNewsMapper' },
  1356. imageToEdit: bigimage,
  1357. pageSize: 120,
  1358. disableServerSideEdit: false,
  1359. disableStyling: false,
  1360. disableDelete: true,
  1361. inline: true
  1362. });
  1363.  
  1364. // предзаполнить значения
  1365. this.uploadDialog.img_url.setValue('');
  1366. this.uploadDialog.img_author.setValue('© ');
  1367. this.uploadDialog.img_cc.setValue('');
  1368. this.uploadDialog.img_cc_url.setValue('');
  1369. this.uploadDialog.img_alt.setValue('');
  1370. this.uploadDialog.img_title.setValue('');
  1371.  
  1372. Ext.FREE_CROP = true;
  1373.  
  1374. // после нажатия ОК при вставке изображения в текст новости
  1375. this.uploadDialog.on('inlineArticleImageEdited', function () {
  1376. var newimg_src = (/sibnet\.ru\/ni/g.test(this.imageUploadForm.vistaPrevia.src)) ? this.imageUploadForm.vistaPrevia.src : this.imageUploadForm.src.el.getValue();
  1377. if (!newimg_src) {
  1378. this.close();
  1379. return false;
  1380. }
  1381.  
  1382. var newimg_0w1h = this.imageUploadForm.realSize.getValue().split('x');
  1383. var img_url = this.img_url.getValue();
  1384. var img_author = this.img_author.getValue();
  1385. var img_cc = this.img_cc.getValue();
  1386. var img_cc_url = this.img_cc_url.getValue();
  1387. var isbigtitle = this.isbigtitle.getValue(); // коммерческая
  1388. var img_alt = this.img_alt.getValue();
  1389. var img_title = this.img_title.getValue();
  1390.  
  1391. var html = '\n<div class="isr_bi_c' + (newimg_0w1h[0] <= 480 ? ' inline_block' : '' ) + '">'
  1392. html += '<div class="isr_bi_ic">';
  1393. html += (newimg_0w1h[0]>480)
  1394. ? '<img src="' + newimg_src + '" alt="' + img_alt + '" width="100%" class="isr_imgover480" title="' + img_title + '">'
  1395. : '<img src="' + newimg_src + '" alt="' + img_alt + '" width="' + newimg_0w1h[0]
  1396. + '" height="' + newimg_0w1h[1] + '" title="' + img_title + '">';
  1397. html += '</div>';
  1398.  
  1399. var sale_photo_html = '<div class="isr_bi_caption"><span class="isr_sale_photo">Купить иллюстрацию</span></div>';
  1400.  
  1401. if (img_author.length && img_author != '© ') {
  1402. html += '<div class="isr_bi_caption">';
  1403. html += (img_url.length && !(/fotobank\.sibnet\.ru/.test(img_url)))
  1404. ? '<a href="' + img_url + '" target="_blank" rel="nofollow">Фото</a><span>: </span>'
  1405. : '<span>Фото: </span>';
  1406. html += '<span>' + img_author + '</span>';
  1407. html += img_cc_url.length
  1408. ? '<span> / </span><a href="' + img_cc_url + '" target="_blank" rel="nofollow">'
  1409. + img_cc + '</a>'
  1410. : '';
  1411. html += isbigtitle ? ' <span>|</span> ' + sale_photo_html : '';
  1412. html+='</div>';
  1413. } else {
  1414. if (isbigtitle) {
  1415. html += sale_photo_html;
  1416. }
  1417. }
  1418.  
  1419. html += '</div></br>\n</br>\n';
  1420.  
  1421. cmp.insertAtCursor(html);
  1422.  
  1423. Ext.FREE_CROP = false;
  1424. this.close();
  1425. });
  1426. this.uploadDialog.show();
  1427. },
  1428. PublicChange: function() {
  1429. var p_btn = this.getFooterToolbar().getComponent('PublicButton');
  1430. p_btn.enable();
  1431. if (this.del.getValue() > 0) {
  1432. p_btn.setIconClass('icon-form-yes');
  1433. p_btn.setText('Опубликовать');
  1434. } else {
  1435. p_btn.setIconClass('sib-elist0');
  1436. p_btn.setText('Скрыть');
  1437. }
  1438. },
  1439. PriorityChange: function() {
  1440. p_btn = this.getFooterToolbar().getComponent('Pbutton');
  1441. p_btn.enable();
  1442. if (this.sort.getValue() > 0)
  1443. p_btn.setIconClass('icon-form-yes');
  1444. else p_btn.setIconClass('');
  1445. },
  1446. DiggestChange: function() {
  1447. p_btn = this.getFooterToolbar().getComponent('Dbutton');
  1448. if (this.is_diggest.getValue() > 0)
  1449. p_btn.setIconClass('icon-form-yes');
  1450. else
  1451. p_btn.setIconClass('');
  1452. },
  1453. YandexChange: function() {
  1454. // p_btn = this.getFooterToolbar().getComponent('Ybutton');
  1455. // if (this.is_diggest.getValue() > 0)
  1456. // p_btn.setIconClass('icon-form-yes');
  1457. // else
  1458. // p_btn.setIconClass('');
  1459. p_btn.setIconClass('');
  1460. },
  1461. onDiggestChange: function() {
  1462. var fff_val = this.idfield.getValue();
  1463. var win = new Ext.ux.ItemSelectWindow({
  1464. title: 'Установка дайджеста дня',
  1465. url: this.url,
  1466. baseParams: {extAction:'pickers', extMethod: 'saveDiggest'},
  1467. baseParams1: {
  1468. sort: 'is_diggest',
  1469. filter: [{
  1470. type: 'list',
  1471. value: 1,
  1472. field: 'is_diggest'
  1473. }]
  1474. },
  1475. baseParams2: {
  1476. filter: [{
  1477. type: 'list',
  1478. value: 0,
  1479. field: 'is_diggest'
  1480. }, {
  1481. type: 'numeric',
  1482. comparison: 'eq',
  1483. value: fff_val,
  1484. field: 'id'
  1485. }]
  1486. },
  1487. directLoad: pickers.read
  1488. });
  1489.  
  1490. win.show();
  1491. win.m_form.getForm().on('actioncomplete' , function(form, action) {
  1492. if (action.result.success) {
  1493. var rec = form.findField('itemselector').multiselects[1].store.getById(fff_val);
  1494. if (typeof rec != 'undefined') {
  1495. this.is_diggest.setValue(1);
  1496. this.is_diggest.originalValue = 1;
  1497. } else {
  1498. this.is_diggest.setValue(0);
  1499. this.is_diggest.originalValue = 0;
  1500. }
  1501. this.DiggestChange();
  1502. }
  1503. }, this);
  1504. },
  1505. WideChange: function() {
  1506. p_btn = this.getFooterToolbar().getComponent('Wbutton');
  1507. if (this.is_widecart.getValue() > 0)
  1508. p_btn.setIconClass('icon-form-yes');
  1509. else
  1510. p_btn.setIconClass('');
  1511. },
  1512. onWideChange: function() {
  1513. var fff_val = this.idfield.getValue();
  1514. var win = new Ext.ux.ItemSelectWindow({
  1515. title: 'Слайдер на главной',
  1516. url: this.url,
  1517. baseParams: {
  1518. extAction: 'pickers',
  1519. extMethod: 'saveWideCart'
  1520. },
  1521. baseParams1: {
  1522. sort:'is_widecart',
  1523. filter: [
  1524. { type: 'list', value: 1, field: 'is_widecart' }
  1525. ]
  1526. },
  1527. baseParams2: {
  1528. filter: [
  1529. { type: 'list', value: 0, field: 'is_widecart' },
  1530. { type: 'numeric', comparison: 'eq', value: fff_val, field: 'id'}
  1531. ]
  1532. },
  1533. directLoad: pickers.read
  1534. }); win.show();
  1535. win.m_form.getForm().on('actioncomplete' , function(form, action) {
  1536. if (action.result.success) {
  1537. var rec = form.findField('itemselector').multiselects[1].store.getById(fff_val);
  1538. if (typeof rec != 'undefined') {
  1539. this.is_widecart.setValue(1);
  1540. this.is_widecart.originalValue = 1;
  1541. } else {
  1542. this.is_widecart.setValue(0);
  1543. this.is_widecart.originalValue = 0;
  1544. }
  1545. this.WideChange();
  1546. }
  1547. }, this);
  1548. },
  1549. onPriorityChange: function() {
  1550. var fff_val = this.idfield.getValue();
  1551. var sects = this.altsection.getValue();
  1552. if (sects && fff_val) {
  1553. var sect = sects.split(',')[0];
  1554. var win = new Ext.ux.ItemPriorityWindow({
  1555. title: 'Установка приоритетных новостей',
  1556. url: this.url,
  1557. baseParams: {
  1558. extAction: 'pickers',
  1559. extMethod: 'savePriority',
  1560. section: sect,
  1561. target:
  1562. fff_val
  1563. },
  1564. baseParams1: {
  1565. section: sect,
  1566. sort: 'sort',
  1567. dir: 'DESC',
  1568. filter: [{
  1569. type:'numeric',
  1570. comparison:'gt',
  1571. value:1,
  1572. field:'sort'
  1573. }]
  1574. },
  1575. baseParams2: {
  1576. section: sect,
  1577. filter: [{
  1578. type: 'numeric',
  1579. comparison: 'eq',
  1580. value: fff_val,
  1581. field: 'id'
  1582. }, {
  1583. type: 'numeric',
  1584. comparison: 'eq',
  1585. value: 0,
  1586. field: 'sort'
  1587. }]
  1588. },
  1589. directLoad: pickers.read,
  1590. sectionLoad: pickerstree.readSections,
  1591. baseParams3: {
  1592. query:sects,
  1593. valuesqry:true
  1594. }
  1595. });
  1596.  
  1597. win.show();
  1598. win.m_form.getForm().on('actioncomplete' , function(form, action) {
  1599. if (action.result.success) {
  1600. var rec = form.findField('itemselector').multiselects[1].store.getById(fff_val);
  1601. if (typeof rec != 'undefined') {
  1602. this.sort.setValue(1);
  1603. this.sort.originalValue = 1;
  1604. } else {
  1605. this.sort.setValue(0);
  1606. this.sort.originalValue = 0;
  1607. }
  1608. this.PriorityChange();
  1609. }
  1610. }, this);
  1611. }
  1612. },
  1613. onPhotoBlogOpen: function() {
  1614. var hiddenArticleId = Ext.getCmp('articleId');
  1615. var articleId = hiddenArticleId.getValue();
  1616. window.open(
  1617. '/gtw/media/image/' + articleId + '/',
  1618. '',
  1619. 'width=1300,height=800,location=no,resizable=yes,scrollbars=yes,top=' + ((screen.height - 800) / 2)
  1620. + ',left=' + ((screen.width - 1300) / 2)
  1621. )
  1622. },
  1623. onPhotoSliderOpen: function() {
  1624. var hiddenArticleId = Ext.getCmp('articleId');
  1625. var articleId = hiddenArticleId.getValue();
  1626. window.open(
  1627. '/gtw/media/image/' + articleId + '/?in_slider=1',
  1628. '',
  1629. 'width=1300,height=800,location=no,resizable=yes,scrollbars=yes,top=' + ((screen.height - 800) / 2)
  1630. + ',left=' + ((screen.width - 1300) / 2)
  1631. )
  1632. }
  1633. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement