modx.panel.resource.weblink.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * @class MODx.panel.WebLink
  3. * @extends MODx.FormPanel
  4. * @param {Object} config An object of configuration properties
  5. * @xtype modx-panel-weblink
  6. */
  7. MODx.panel.WebLink = function(config) {
  8. config = config || {};
  9. Ext.applyIf(config,{
  10. id: 'modx-panel-resource'
  11. ,class_key: 'modWebLink'
  12. ,items: this.getFields(config)
  13. });
  14. MODx.panel.WebLink.superclass.constructor.call(this,config);
  15. };
  16. Ext.extend(MODx.panel.WebLink,MODx.panel.Resource,{
  17. defaultClassKey: 'modWebLink'
  18. ,classLexiconKey: 'weblink'
  19. ,rteElements: false
  20. ,getPageHeader: function(config) {
  21. return {
  22. html: _('weblink_new')
  23. ,id: 'modx-resource-header'
  24. ,xtype: 'modx-header'
  25. };
  26. }
  27. ,getMainFields: function(config) {
  28. var its = MODx.panel.WebLink.superclass.getMainFields.call(this,config);
  29. its.push({
  30. xtype: 'textfield'
  31. ,fieldLabel: _('weblink')
  32. ,description: '<b>[[*content]]</b><br />'+_('weblink_help')
  33. ,name: 'content'
  34. ,id: 'modx-weblink-content'
  35. ,anchor: '100%'
  36. ,value: (config.record.content || config.record.ta) || 'http://'
  37. });
  38. return its;
  39. }
  40. ,getContentField: function(config) {
  41. return null;
  42. }
  43. ,getSettingLeftFields: function(config) {
  44. var its = MODx.panel.WebLink.superclass.getSettingLeftFields.call(this,config);
  45. its.push({
  46. xtype: 'textfield'
  47. ,fieldLabel: _('weblink_response_code')
  48. ,description: _('weblink_response_code_help')
  49. ,name: 'responseCode'
  50. ,id: 'modx-weblink-responseCode'
  51. ,anchor: '100%'
  52. ,value: (config.record.responseCode) || 'HTTP/1.1 301 Moved Permanently'
  53. });
  54. return its;
  55. }
  56. });
  57. Ext.reg('modx-panel-weblink',MODx.panel.WebLink);