galtv.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. Ext.override(Ext.slider.Thumb, {
  2. onDrag: function(e) {
  3. var slider = this.slider,
  4. index = this.index,
  5. newValue = this.getNewValue();
  6. if (this.constrain) {
  7. var above = slider.thumbs[index + 1],
  8. below = slider.thumbs[index - 1];
  9. if (below != undefined && newValue <= below.value) newValue = below.value;
  10. if (above != undefined && newValue >= above.value) newValue = above.value;
  11. }
  12. slider.setValue(index, newValue, false);
  13. slider.fireEvent('drag', slider, e, this);
  14. }
  15. });
  16. GAL.TV = function(config) {
  17. config = config || {};
  18. config.data = config.data || {gal_src:false};
  19. this.previewTpl = new Ext.XTemplate('<tpl for=".">'
  20. ,'<tpl if="gal_src">'
  21. ,'<img src="'+GAL.config.connector_url+'?action=web/phpthumb&src={gal_src}&h={gal_image_height}&w={gal_image_width}&zc=0&far=C&fltr[]=rot|{gal_rotate}&{gal_other}" '
  22. ,' alt="{gal_name}" class="{gal_class}" id="tv'+config.tv+'-image" style="width: {gal_image_width}px; height: {gal_image_height}px" />'
  23. ,'</tpl>'
  24. ,'</tpl>');
  25. this.previewTpl.compile();
  26. var item = this.previewTpl.applyTemplate(config.data);
  27. Ext.applyIf(config,{
  28. layout: 'column'
  29. ,autoHeight: true
  30. ,labelWidth: 160
  31. ,maxHeight: 400
  32. ,autoScroll: true
  33. ,border: false
  34. ,width: Ext.getCmp('modx-panel-resource').getWidth() - 300
  35. ,defaults: {
  36. border: false
  37. }
  38. ,forceLayout: true
  39. ,renderTo: 'tv'+config.tv+'-form'
  40. ,items: [{
  41. columnWidth: .4
  42. ,bodyStyle: 'padding: 10px;'
  43. ,border: false
  44. ,items: [{
  45. layout: 'column'
  46. ,border: false
  47. ,items: [{
  48. columnWidth: .5
  49. ,border: false
  50. ,items: [{
  51. xtype: 'button'
  52. ,text: _('gallery.choose_item')
  53. ,tv: config.tv
  54. ,handler: this.loadBrowser
  55. ,scope: this
  56. }]
  57. },{
  58. columnWidth: .5
  59. ,border: false
  60. ,items: [{
  61. xtype: 'button'
  62. ,text: _('gallery.clear_image')
  63. ,tv: config.tv
  64. ,handler: this.clearValues
  65. ,scope: this
  66. }]
  67. }]
  68. },{
  69. html: '<br />' ,border: false
  70. },{
  71. id: 'tv'+config.tv+'-preview-ct'
  72. ,html: '<div class="gal_tv-preview x-panel-body x-panel-body-noheader x-panel-body-noborder" id="tv'+config.tv+'-image-panel" style="height: auto; overflow: auto;">'
  73. +'<div class="gal-crop-wrapper" id="tv'+config.tv+'-crop-wrapper" style="overflow: visible; width: '+config.data['gal_image_width']+'px; height: '+config.data['gal_image_height']+'px; position: absolute;"></div>'
  74. +'<div id="tv'+config.tv+'-preview" style="height: auto; overflow: visible;">'+item+'</div>'
  75. +'</div>'
  76. ,border: false
  77. ,autoScroll: true
  78. ,autoHeight: true
  79. }]
  80. },{
  81. columnWidth: .6
  82. ,layout: 'form'
  83. ,bodyStyle: 'padding: 45px 10px 10px;'
  84. ,border: false
  85. ,items: [{
  86. xtype: 'hidden'
  87. ,name: 'gal_id'
  88. ,id: 'tv'+config.tv+'-gal_id'
  89. ,value: config.data['gal_id'] || 0
  90. },{
  91. xtype: 'hidden'
  92. ,name: 'gal_album'
  93. ,id: 'tv'+config.tv+'-gal_album'
  94. ,value: config.data['gal_album'] || 0
  95. },{
  96. xtype: 'hidden'
  97. ,name: 'gal_src'
  98. ,id: 'tv'+config.tv+'-gal_src'
  99. ,value: config.data['gal_src'] || ''
  100. },{
  101. xtype: 'hidden'
  102. ,name: 'orig_width'
  103. ,id: 'tv'+config.tv+'-gal_orig_width'
  104. ,value: config.data['gal_orig_width'] || 0
  105. ,listeners: {'change':this.syncHidden,scope:this}
  106. },{
  107. xtype: 'hidden'
  108. ,name: 'gal_orig_height'
  109. ,id: 'tv'+config.tv+'-gal_orig_height'
  110. ,value: config.data['gal_orig_height'] || 0
  111. ,listeners: {'change':this.syncHidden,scope:this}
  112. },{
  113. xtype: 'textfield'
  114. ,name: 'gal_name'
  115. ,id: 'tv'+config.tv+'-gal_name'
  116. ,fieldLabel: _('gallery.title')
  117. ,value: config.data['gal_name'] || ''
  118. ,anchor: '97%'
  119. ,listeners: {'change':this.syncHidden,scope:this}
  120. },{
  121. xtype: 'textfield'
  122. ,name: 'gal_description'
  123. ,id: 'tv'+config.tv+'-gal_description'
  124. ,fieldLabel: _('gallery.alt_text')
  125. ,value: config.data['gal_description'] || ''
  126. ,anchor: '97%'
  127. ,listeners: {'change':this.syncHidden,scope:this}
  128. },{
  129. xtype: 'textfield'
  130. ,name: 'gal_class'
  131. ,id: 'tv'+config.tv+'-gal_class'
  132. ,fieldLabel: _('gallery.class')
  133. ,value: config.data['gal_class'] || ''
  134. ,anchor: '97%'
  135. ,listeners: {'change':this.syncHidden,scope:this}
  136. },{
  137. xtype: 'textfield'
  138. ,name: 'gal_image_width'
  139. ,id: 'tv'+config.tv+'-gal_image_width'
  140. ,fieldLabel: _('gallery.width')
  141. ,value: config.data['gal_image_width'] || 0
  142. ,anchor: '97%'
  143. ,listeners: {'change':this.syncHidden,scope:this}
  144. },{
  145. xtype: 'textfield'
  146. ,name: 'gal_image_height'
  147. ,id: 'tv'+config.tv+'-gal_image_height'
  148. ,fieldLabel: _('gallery.height')
  149. ,value: config.data['gal_image_height'] || 0
  150. ,anchor: '97%'
  151. ,listeners: {'change':this.syncHidden,scope:this}
  152. },{
  153. xtype: 'slider'
  154. ,id: 'tv'+config.tv+'-gal_sizer'
  155. ,fieldLabel: _('gallery.resize')
  156. ,name: 'gal_sizer'
  157. ,minValue: 5
  158. ,maxValue: 100
  159. ,value: config.data['gal_sizer'] || 100
  160. ,anchor: '97%'
  161. ,listeners: {
  162. 'changecomplete': {fn:function(sl,e) {
  163. this.resetCropValues();
  164. this.disableCrop();
  165. this.resizeImage(sl,e,'gal_sizer');
  166. },scope:this}
  167. }
  168. ,plugins: [new Ext.slider.Tip({
  169. getText: function(thumb){
  170. return String.format('<b>{0}%</b>', thumb.value);
  171. }
  172. })]
  173. },{
  174. xtype: 'radiogroup'
  175. ,id: 'tv'+config.tv+'-gal_rotate'
  176. ,fieldLabel: _('gallery.rotate')
  177. ,name: 'gal_rotate'
  178. ,items: [
  179. {boxLabel: '0',name: 'gal_rotate',inputValue: 0,value: 0, checked: config.data['gal_rotate'] == 0}
  180. ,{boxLabel: '90',name: 'gal_rotate',inputValue: 90,value: 90, checked: config.data['gal_rotate'] == 90}
  181. ,{boxLabel: '180',name: 'gal_rotate',inputValue: 180,value: 180, checked: config.data['gal_rotate'] == 180}
  182. ,{boxLabel: '270',name: 'gal_rotate',inputValue: 270,value: 270, checked: config.data['gal_rotate'] == 270}
  183. ]
  184. ,allowBlank: false
  185. ,value: config.data['gal_rotate'] || 0
  186. ,anchor: '97%'
  187. ,listeners: {'change':this.syncHidden,scope:this}
  188. },{
  189. xtype: 'textfield'
  190. ,id: 'tv'+config.tv+'-gal_other'
  191. ,name: 'gal_other'
  192. ,fieldLabel: _('gallery.other_opt')
  193. ,description: _('gallery.other_opt_desc')
  194. ,value: config.data['gal_other'] || ''
  195. ,anchor: '97%'
  196. ,listeners: {'change':this.syncHidden,scope:this}
  197. },{
  198. xtype: 'fieldset'
  199. ,collapsible: true
  200. ,collapsed: true
  201. ,autoHeight: true
  202. ,title: _('gallery.watermark_options')
  203. ,items: [{
  204. html: '<p>'+_('gallery.watermark_options_desc')+'</p>'
  205. ,border: false
  206. },{
  207. xtype: 'textfield'
  208. ,id: 'tv'+config.tv+'-gal_watermark-text'
  209. ,fieldLabel: _('gallery.watermark_text')
  210. ,description: _('gallery.watermark_text_desc')
  211. ,name: 'gal_watermark-text'
  212. ,allowBlank: true
  213. ,anchor: '97%'
  214. ,value: config.data['gal_watermark-text'] || ''
  215. ,listeners: {'change':this.syncHidden,scope:this}
  216. },{
  217. xtype: 'combo'
  218. ,id: 'tv'+config.tv+'-gal_watermark-text-position'
  219. ,fieldLabel: _('gallery.watermark_text_position')
  220. ,store: [
  221. ['BR',_('gallery.pos_br')]
  222. ,['BL',_('gallery.pos_bl')]
  223. ,['TR',_('gallery.pos_tr')]
  224. ,['TL',_('gallery.pos_tl')]
  225. ,['C',_('gallery.pos_c')]
  226. ,['R',_('gallery.pos_r')]
  227. ,['L',_('gallery.pos_l')]
  228. ,['T',_('gallery.pos_t')]
  229. ,['B',_('gallery.pos_b')]
  230. ]
  231. ,description: _('gallery.watermark_text_position_desc')
  232. ,name: 'gal_watermark-text-position'
  233. ,allowBlank: true
  234. ,anchor: '97%'
  235. ,typeAhead: false
  236. ,forceSelection: true
  237. ,triggerAction: 'all'
  238. ,selectOnFocus: true
  239. ,editable: false
  240. ,value: config.data['gal_watermark-text-position'] || ''
  241. ,listeners: {'select':this.syncHidden,scope:this}
  242. }]
  243. },{
  244. xtype: 'fieldset'
  245. ,collapsible: false
  246. ,collapsed: true
  247. ,checkboxToggle: true
  248. ,autoHeight: true
  249. ,title: _('gallery.crop_enable')
  250. ,id: 'tv'+config.tv+'-gal_cropMode'
  251. ,checkboxName: 'gal_cropMode'
  252. ,onCheckClick: this.loadCropMode.createDelegate(this)
  253. ,items: [{
  254. xtype: 'hidden'
  255. ,name: 'gal_cropCoords'
  256. ,anchor: '97%'
  257. ,id: 'tv'+config.tv+'-gal_cropCoords'
  258. ,value: config.data['gal_cropCoords'] ? Ext.encode(config.data['gal_cropCoords']) : '{}'
  259. },{
  260. xtype: 'statictextfield'
  261. ,name: 'gal_cropTop'
  262. ,id: 'tv'+config.tv+'-gal_cropTop'
  263. ,fieldLabel: _('gallery.crop_top')
  264. ,value: config.data['gal_cropTop'] || 0
  265. ,allowBlank: true
  266. ,anchor: '97%'
  267. ,submitValue: true
  268. },{
  269. xtype: 'statictextfield'
  270. ,name: 'gal_cropRight'
  271. ,id: 'tv'+config.tv+'-gal_cropRight'
  272. ,fieldLabel: _('gallery.crop_right')
  273. ,value: config.data['gal_cropRight'] || 0
  274. ,allowBlank: true
  275. ,anchor: '97%'
  276. ,submitValue: true
  277. },{
  278. xtype: 'statictextfield'
  279. ,name: 'gal_cropBottom'
  280. ,id: 'tv'+config.tv+'-gal_cropBottom'
  281. ,fieldLabel: _('gallery.crop_bottom')
  282. ,value: config.data['gal_cropBottom'] || 0
  283. ,allowBlank: true
  284. ,anchor: '97%'
  285. ,submitValue: true
  286. },{
  287. xtype: 'statictextfield'
  288. ,name: 'gal_cropLeft'
  289. ,id: 'tv'+config.tv+'-gal_cropLeft'
  290. ,fieldLabel: _('gallery.crop_left')
  291. ,value: config.data['gal_cropLeft'] || 0
  292. ,allowBlank: true
  293. ,anchor: '97%'
  294. ,submitValue: true
  295. }]
  296. },{
  297. html: '&nbsp;' ,border: false
  298. }]
  299. }]
  300. });
  301. GAL.TV.superclass.constructor.call(this,config);
  302. this.setValues(config.data);
  303. if (config.data['gal_cropCoords'] && config.data['gal_cropCoords'] != '{}') {
  304. this.enableCrop();
  305. }
  306. };
  307. Ext.extend(GAL.TV,MODx.Panel,{
  308. browser: null
  309. ,inCropMode: false
  310. ,fields: ['gal_id','gal_album','gal_src','gal_orig_width','gal_orig_height'
  311. ,'gal_name','gal_description','gal_class'
  312. ,'gal_image_width','gal_image_height','gal_slider','gal_rotate'
  313. ,'gal_watermark-text','gal_watermark-text-position','gal_other'
  314. ,'gal_cropCoords','gal_cropTop','gal_cropRight','gal_cropBottom','gal_cropLeft','gal_cropMode']
  315. ,setValues: function(vs) {
  316. var id;
  317. for (id in vs) {
  318. this.setValue(id,vs[id]);
  319. }
  320. return this;
  321. }
  322. ,setValue: function(k,v) {
  323. var f = this.findField(k);
  324. if (f && f.setValue) {
  325. var vs = {};
  326. vs[k] = v;
  327. this.setHiddenField(vs);
  328. return f.setValue(v);
  329. }
  330. return false;
  331. }
  332. ,getValue: function(k) {
  333. var v;
  334. var f = this.findField(k);
  335. if (f && f.getValue) {
  336. v = f.getValue();
  337. if (Ext.isObject(v)) {
  338. v = v.value;
  339. }
  340. return v;
  341. }
  342. return null;
  343. }
  344. ,getValues: function() {
  345. var f,i,v;
  346. var vs = {};
  347. for (i=0;i<this.fields.length;i++) {
  348. vs[this.fields[i]] = this.getValue(this.fields[i]);
  349. }
  350. return vs;
  351. }
  352. ,findField: function(k) {
  353. var f = Ext.getCmp('tv'+this.config.tv+'-'+k);
  354. return f ? f : null;
  355. }
  356. ,loadCropMode: function(v,b,c) {
  357. var el = Ext.get(b);
  358. if (el && el.dom && el.dom.checked) {
  359. this.enableCrop();
  360. } else {this.disableCrop();}
  361. }
  362. ,disableCrop: function() {
  363. if (this.resizable) {
  364. this.resizable.el.hide();
  365. }
  366. var fld = this.findField('gal_cropMode').collapse();
  367. this.resetCropValues();
  368. //this.cropMask.hide();
  369. }
  370. ,enableCrop: function() {
  371. this.findField('gal_cropMode').expand();
  372. this.loadCropper();
  373. var img = Ext.get('tv'+this.config.tv+'-image');
  374. this.imageBox = img.getBox();
  375. }
  376. ,loadCropper: function() {
  377. if (this.inCropMode) {
  378. this.resizable.el.show();
  379. var cd = this.getValues();
  380. this.resizable.resize4(cd['gal_cropTop'],cd['gal_cropRight'],cd['gal_cropBottom'],cd['gal_cropLeft']);
  381. //this.cropMask.show(Ext.get('tv'+this.config.tv+'-image'));
  382. return;
  383. }
  384. var cw = Ext.get('tv'+this.config.tv+'-crop-wrapper');
  385. var img = Ext.get('tv'+this.config.tv+'-image');
  386. this.imageBox = img.getBox();
  387. this.resizable = new Ext.Resizable(cw, {
  388. wrap: true
  389. ,minWidth: 0
  390. ,minHeight: 0
  391. ,dynamic: false
  392. ,transparent: false
  393. ,handles: 'all'
  394. ,draggable: false
  395. ,pinned: false
  396. ,style: 'overflow: visible;'
  397. ,constrainTo: 'tv'+this.config.tv+'-image'
  398. ,resize4 : function(t,r,b,l) {
  399. var imgBox = Ext.get('tv'+this.tv+'-image').getBox();
  400. var w = imgBox.width-(parseInt(r)+parseInt(l));
  401. var h = imgBox.height-(parseInt(b)+parseInt(t));
  402. this.el.setBox({
  403. x: imgBox.x+parseInt(l)
  404. ,y: imgBox.y+parseInt(t)
  405. ,width: w
  406. ,height: h
  407. },false,true);
  408. this.updateChildSize();
  409. }
  410. ,tv: this.config.tv
  411. ,imgBox: this.imageBox
  412. ,img: Ext.get('tv'+this.config.tv+'-image')
  413. });
  414. if (!this.inCropMode) {
  415. var d = this.getValues();
  416. this.resizable.resize4(d['gal_cropTop'],d['gal_cropRight'],d['gal_cropBottom'],d['gal_cropLeft']);
  417. }
  418. this.resizable.on('resize',this.onCrop,this);
  419. this.resizable.getEl().setStyle('border','1px solid black');
  420. cw.select("div[id]").each(function(div) {
  421. if (div.hasClass("x-resizable-handle")) div.setOpacity(.75);
  422. });
  423. //this.cropMask = new Ext.Spotlight({animate: true});
  424. //this.cropMask.maskEl = this.resizable.getEl();
  425. //this.cropMask.show(img);
  426. this.inCropMode = true;
  427. }
  428. ,onCrop: function(res) {
  429. var cropBox = res.el.getBox();
  430. var imageBox = Ext.get('tv'+this.config.tv+'-image').getBox();
  431. var x1 = cropBox.x - imageBox.x;
  432. var y1 = cropBox.y - imageBox.y;
  433. var x2 = x1 + cropBox.width;
  434. var y2 = y1 + cropBox.height;
  435. var rr = imageBox.width - x2;
  436. var rb = imageBox.height - y2;
  437. this.cropCoords = {
  438. left: x1 > 0 ? x1 : 0
  439. ,right: x2 > 0 ? x2 : 0
  440. ,top: y1 > 0 ? y1 : 0
  441. ,bottom: y2 > 0 ? y2 : 0
  442. ,relRight: rr > 0 ? rr : 0
  443. ,relBottom: rb > 0 ? rb : 0
  444. ,on: true
  445. };
  446. var vs = {
  447. 'gal_cropCoords': Ext.encode(this.cropCoords)
  448. ,'gal_cropTop': this.cropCoords.top
  449. ,'gal_cropRight': this.cropCoords.relRight
  450. ,'gal_cropBottom': this.cropCoords.relBottom
  451. ,'gal_cropLeft': this.cropCoords.left
  452. };
  453. this.setValues(vs);
  454. }
  455. ,resetCropValues: function() {
  456. this.setValue('gal_cropCoords','');
  457. this.setValue('gal_cropTop',0);
  458. this.setValue('gal_cropRight',0);
  459. this.setValue('gal_cropBottom',0);
  460. this.setValue('gal_cropLeft',0);
  461. }
  462. ,syncHidden: function(tf,nv,nm) {
  463. var v = tf.getValue();
  464. if (typeof v != 'number' && typeof v != 'boolean' && typeof v != 'object') {
  465. v = v.replace("'",'&apos;');
  466. } else if (typeof v == 'object') {
  467. v = v.value;
  468. }
  469. var n = tf.getName ? tf.getName() : nm;
  470. this.setValue(n,v+'');
  471. this.updateImage();
  472. }
  473. ,resizeImage: function(sl,e,name) {
  474. var nv = this.getValue(name);
  475. var w = this.getValue('gal_orig_width');
  476. var h = this.getValue('gal_orig_height');
  477. var nw = Ext.util.Format.round(w * (nv / 100),0);
  478. var nh = Ext.util.Format.round(h * (nv / 100),0);
  479. if (name == 'gal_sizer') {
  480. this.setValue('gal_image_width',nw);
  481. this.setValue('gal_image_height',nh);
  482. this.syncHidden(sl,nv,'gal_sizer');
  483. }
  484. this.updateImage();
  485. this.resetCropValues();
  486. }
  487. ,updateImage: function() {
  488. var vs = this.getValues();
  489. var p = Ext.get('tv'+this.config.tv+'-preview');
  490. if (p) {
  491. this.previewTpl.overwrite(p,vs);
  492. }
  493. this.imageBox = Ext.get('tv'+this.config.tv+'-image').getBox();
  494. if (this.resizer) {this.resizer.imgBox = this.imageBox;}
  495. return true;
  496. }
  497. ,loadBrowser: function(btn,e) {
  498. var alb = this.config.data['gal_album'] || 0;
  499. if (this.browser === null) {
  500. this.browser = MODx.load({
  501. xtype: 'gal-browser'
  502. ,album: alb
  503. ,rootVisible: this.config.rootVisible || false
  504. ,listeners: {
  505. 'select': {fn: this.selectImage,scope:this}
  506. }
  507. });
  508. }
  509. this.browser.win.view.store.setBaseParam('album',alb);
  510. this.browser.win.view.store.load();
  511. this.browser.show(btn);
  512. }
  513. ,selectImage: function(data) {
  514. data['gal_url'] = data.absoluteImage;
  515. data['gal_src'] = data.absoluteImage;
  516. this.fireEvent('select',data);
  517. data['gal_id'] = data.id;
  518. data['gal_name'] = data.name;
  519. data['gal_description'] = data.description;
  520. data['gal_image_width'] = data.image_width;
  521. data['gal_image_height'] = data.image_height;
  522. data['gal_orig_width'] = data.image_width;
  523. data['gal_orig_height'] = data.image_height;
  524. data['gal_album'] = data.album;
  525. data['gal_watermark-text'] = '';
  526. data['gal_watermark-text-position'] = 'BL';
  527. data['gal_other'] = '';
  528. data['gal_rotate'] = 0;
  529. data['gal_sizer'] = 100;
  530. this.setValues(data);
  531. this.updateImage();
  532. this.disableCrop();
  533. }
  534. ,setHiddenField: function(data) {
  535. var fld = Ext.get('tv'+this.config.tv);
  536. var js = Ext.decode(fld.dom.value);
  537. js = Ext.apply(js,data);
  538. fld.dom.value = Ext.encode(js);
  539. Ext.getCmp('modx-panel-resource').markDirty();
  540. }
  541. ,clearValues: function() {
  542. this.setValues({
  543. 'gal_id': 0
  544. ,'gal_name': ''
  545. ,'gal_description': ''
  546. ,'gal_class': ''
  547. ,'gal_image_width': 0
  548. ,'gal_image_height': 0
  549. ,'gal_slider': 100
  550. ,'gal_rotate': 0
  551. ,'gal_watermark-text': ''
  552. ,'gal_watermark-text-position': 'BL'
  553. ,'gal_other' : ''
  554. ,'gal_cropCoords': ''
  555. ,'gal_cropTop': 0
  556. ,'gal_cropRight': 0
  557. ,'gal_cropBottom': 0
  558. ,'gal_cropLeft': 0
  559. ,'gal_cropMode': 0
  560. });
  561. this.disableCrop();
  562. Ext.getCmp('modx-panel-resource').markDirty();
  563. Ext.get('tv'+this.config.tv+'-preview').update('&nbsp;');
  564. var fld = Ext.get('tv'+this.config.tv);
  565. fld.dom.value = Ext.encode({});
  566. }
  567. });
  568. Ext.reg('gal-panel-tv',GAL.TV);
  569. Ext.Spotlight.prototype.createElements = function(){
  570. /** changed, as we do not want to hide the whole body, but just the containing panel */
  571. var bd = this.maskEl;
  572. this.right = bd.createChild({cls:'x-spotlight'});
  573. this.left = bd.createChild({cls:'x-spotlight'});
  574. this.top = bd.createChild({cls:'x-spotlight'});
  575. this.bottom = bd.createChild({cls:'x-spotlight'});
  576. this.all = new Ext.CompositeElement([this.right, this.left, this.top, this.bottom]);
  577. };