info.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /**
  2. * Loads the system info page
  3. *
  4. * @class MODx.page.SystemInfo
  5. * @extends MODx.Component
  6. * @param {Object} config An object of config properties
  7. * @xtype modx-page-system-info
  8. */
  9. MODx.page.SystemInfo = function(config) {
  10. config = config || {};
  11. Ext.applyIf(config,{
  12. components: [{
  13. xtype: 'modx-panel-system-info'
  14. ,data: config.data
  15. }]
  16. });
  17. MODx.page.SystemInfo.superclass.constructor.call(this,config);
  18. };
  19. Ext.extend(MODx.page.SystemInfo,MODx.Component);
  20. Ext.reg('modx-page-system-info',MODx.page.SystemInfo);
  21. var viewPHPInfo = function() {
  22. window.open(MODx.config.connector_url+'?action=system/phpinfo&HTTP_MODAUTH='+MODx.siteId);
  23. };
  24. MODx.panel.SystemInfo = function(config) {
  25. config = config || {};
  26. var info = [{
  27. fieldLabel: _('modx_version')
  28. ,name: 'modx_version'
  29. },{
  30. fieldLabel: _('version_codename')
  31. ,name: 'code_name'
  32. },{
  33. html: '<a href="javascript:;" onclick="viewPHPInfo();return false;">'+_('view')+'</a>'
  34. ,fieldLabel: 'phpinfo()'
  35. ,name: 'phpinfo'
  36. ,xtype: 'container'
  37. },{
  38. fieldLabel: _('servertime')
  39. ,name: 'servertime'
  40. },{
  41. fieldLabel: _('localtime')
  42. ,name: 'localtime'
  43. },{
  44. fieldLabel: _('serveroffset')
  45. ,name: 'serveroffset'
  46. },{
  47. html: '<hr />'
  48. ,xtype: 'container'
  49. },{
  50. fieldLabel: _('extjs_version')
  51. ,name: 'extjs_version'
  52. ,value: '3.4.1'
  53. },{
  54. fieldLabel: _('smarty_version')
  55. ,name: 'smarty_version'
  56. ,value: '3.1.27'
  57. },{
  58. fieldLabel: _('phpmailer_version')
  59. ,name: 'phpmailer_version'
  60. ,value: '5.2.14'
  61. },{
  62. fieldLabel: _('magpie_version')
  63. ,name: 'magpie_version'
  64. ,value: '0.72'
  65. },{
  66. html: '<hr />'
  67. ,xtype: 'container'
  68. },{
  69. fieldLabel: _('database_type')
  70. ,name: 'database_type'
  71. },{
  72. fieldLabel: _('database_version')
  73. ,name: 'database_version'
  74. },{
  75. fieldLabel: _('database_charset')
  76. ,name: 'database_charset'
  77. },{
  78. fieldLabel: _('database_name')
  79. ,name: 'database_name'
  80. },{
  81. fieldLabel: _('database_server')
  82. ,name: 'database_server'
  83. },{
  84. fieldLabel: _('table_prefix')
  85. ,name: 'table_prefix'
  86. }];
  87. if (config.data) {
  88. for (var c in config.data) {
  89. info.push({
  90. html: '<hr />'
  91. ,xtype: 'container'
  92. });
  93. for (var d in config.data[c]) {
  94. info.push({
  95. fieldLabel: d
  96. ,name: d
  97. ,value: config.data[c][d]
  98. });
  99. }
  100. }
  101. }
  102. var pnl = [{
  103. html: '<p>'+_('sysinfo_desc')+'</p>'
  104. ,id: 'modx-sysinfo-msg'
  105. ,xtype: 'modx-description'
  106. },{
  107. xtype: 'panel'
  108. ,border: false
  109. ,cls:'main-wrapper'
  110. ,layout: 'form'
  111. ,defaults: {
  112. border: false
  113. ,msgTarget: 'side'
  114. ,anchor: '100%'
  115. }
  116. ,defaultType: 'displayfield'
  117. ,items: [info]
  118. }];
  119. Ext.applyIf(config, {
  120. id: 'modx-panel-system-info'
  121. ,url: MODx.config.connector_url
  122. ,layout: 'anchor'
  123. ,cls: 'container'
  124. ,items: [{
  125. html: _('view_sysinfo')
  126. ,id: 'modx-error-log-header'
  127. ,xtype: 'modx-header'
  128. },MODx.getPageStructure([{
  129. title: _('view_sysinfo')
  130. ,layout: 'form'
  131. ,id: 'modx-plugin-form'
  132. ,labelWidth: 230
  133. ,defaults: { border: false }
  134. ,items: pnl
  135. },{
  136. title: _('db_header')
  137. ,id: 'modx-sysinfo-dbtables'
  138. ,layout: 'anchor'
  139. ,items: [{
  140. html: '<p>'+_('db_info_' + MODx.config.dbtype)+'</p>'
  141. ,id: 'modx-sysinfo-dbtables-msg'
  142. ,xtype: 'modx-description'
  143. },{
  144. xtype: 'modx-grid-databasetables'
  145. ,cls:'main-wrapper'
  146. ,preventRender: true
  147. }]
  148. },{
  149. title: _('recent_docs')
  150. ,id: 'modx-sysinfo-recent-docs'
  151. ,layout: 'anchor'
  152. ,items: [{
  153. html: '<p>'+_('sysinfo_activity_message')+'</p>'
  154. ,id: 'modx-sysinfo-recent-docs-msg'
  155. ,xtype: 'modx-description'
  156. },{
  157. xtype: 'modx-grid-resource-active'
  158. ,cls:'main-wrapper'
  159. ,title: _('recent_docs')
  160. ,preventRender: true
  161. }]
  162. }])]
  163. ,listeners: {
  164. 'setup': {fn:this.setup,scope:this}
  165. ,'success': {fn:this.success,scope:this}
  166. ,'beforeSubmit': {fn:this.beforeSubmit,scope:this}
  167. }
  168. });
  169. MODx.panel.SystemInfo.superclass.constructor.call(this,config);
  170. };
  171. Ext.extend(MODx.panel.SystemInfo,MODx.FormPanel,{
  172. initialized: false
  173. ,setup: function() {
  174. if (this.config.plugin === '' || this.config.plugin === 0 || this.initialized) {
  175. this.fireEvent('ready');
  176. return false;
  177. }
  178. MODx.Ajax.request({
  179. url: this.config.url
  180. ,params: {
  181. action: 'system/info'
  182. }
  183. ,listeners: {
  184. 'success': {
  185. fn: function(r) {
  186. this.getForm().setValues(r.object);
  187. this.initialized = true;
  188. }
  189. ,scope: this
  190. }
  191. }
  192. });
  193. }
  194. ,beforeSubmit: function(o) {
  195. }
  196. ,success: function(o) {
  197. }
  198. });
  199. Ext.reg('modx-panel-system-info',MODx.panel.SystemInfo);