' + MODx.util.safeHtml(response.message) + '
'; } - var datestamps = Ext.select(".date_stamp", container); - datestamps.each(function (el) { - el.dom.innerText = new Date(el.dom.innerText).format(MODx.config.manager_date_format + ' ' + MODx.config.manager_time_format); - }); }, scope: this } ,failure: { diff --git a/manager/assets/modext/widgets/resource/modx.panel.resource.data.js b/manager/assets/modext/widgets/resource/modx.panel.resource.data.js index ea57402aace..e9889b13e64 100644 --- a/manager/assets/modext/widgets/resource/modx.panel.resource.data.js +++ b/manager/assets/modext/widgets/resource/modx.panel.resource.data.js @@ -2,8 +2,7 @@ MODx.panel.ResourceData = function(config) { config = config || {}; var df = { border: false - ,msgTarget: 'side' - ,width: 300 + ,anchor: '100%' }; Ext.applyIf(config,{ url: MODx.config.connector_url @@ -27,119 +26,99 @@ MODx.panel.ResourceData = function(config) { name: 'context_key' ,fieldLabel: _('context') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'alias' ,fieldLabel: _('resource_alias') ,description: _('resource_alias_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'template_name' ,fieldLabel: _('resource_template') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'pagetitle' ,fieldLabel: _('resource_pagetitle') ,description: _('resource_pagetitle_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'longtitle' ,fieldLabel: _('resource_longtitle') ,description: _('resource_longtitle_help') ,xtype: 'statictextfield' - ,anchor: '100%' ,value: _('notset') },{ name: 'description' ,fieldLabel: _('resource_description') ,description: _('resource_description_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'introtext' ,fieldLabel: _('resource_summary') ,description: _('resource_summary_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'content' ,fieldLabel: _('resource_content') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'published' ,fieldLabel: _('resource_published') ,description: _('resource_published_help') ,xtype: 'staticboolean' - ,anchor: '100%' },{ name: 'deleted' ,fieldLabel: _('deleted') ,xtype: 'staticboolean' - ,anchor: '100%' },{ name: 'publishedon' ,fieldLabel: _('resource_publishedon') ,description: _('resource_publishedon_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'pub_date' ,fieldLabel: _('resource_publishdate') ,description: _('resource_publishdate_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'unpub_date' ,fieldLabel: _('resource_unpublishdate') ,description: _('resource_unpublishdate_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'hidemenu' ,fieldLabel: _('resource_hide_from_menus') ,description: _('resource_hide_from_menus_help') ,xtype: 'staticboolean' - ,anchor: '100%' },{ name: 'menutitle' ,fieldLabel: _('resource_menutitle') ,description: _('resource_menutitle_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'menuindex' ,fieldLabel: _('resource_menuindex') ,description: _('resource_menuindex_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'link_attributes' ,fieldLabel: _('resource_link_attributes') ,description: _('resource_link_attributes_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'class_key' ,fieldLabel: _('class_key') ,description: _('resource_class_key_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'content_type' ,fieldLabel: _('resource_content_type') ,description: _('resource_content_type_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'isfolder' ,fieldLabel: _('resource_folder') ,description: _('resource_folder_help') ,xtype: 'staticboolean' - ,anchor: '100%' },{ name: 'show_in_tree' ,fieldLabel: _('resource_show_in_tree') @@ -163,7 +142,6 @@ MODx.panel.ResourceData = function(config) { ,fieldLabel: _('resource_uri_override') ,description: _('resource_uri_override_help') ,xtype: 'staticboolean' - ,anchor: '100%' },{ name: 'uri' ,fieldLabel: _('resource_uri') @@ -175,31 +153,26 @@ MODx.panel.ResourceData = function(config) { ,fieldLabel: _('resource_parent') ,description: _('resource_parent_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'content_dispo' ,fieldLabel: _('resource_contentdispo') ,description: _('resource_contentdispo_help') ,xtype: 'statictextfield' - ,anchor: '100%' },{ name: 'richtext' ,fieldLabel: _('resource_richtext') ,description: _('resource_richtext_help') ,xtype: 'staticboolean' - ,anchor: '100%' },{ name: 'searchable' ,fieldLabel: _('resource_searchable') ,description: _('resource_searchable_help') ,xtype: 'staticboolean' - ,anchor: '100%' },{ name: 'cacheable' ,fieldLabel: _('resource_cacheable') ,description: _('resource_cacheable_help') ,xtype: 'staticboolean' - ,anchor: '100%' }] },{ title: _('changes') @@ -213,7 +186,6 @@ MODx.panel.ResourceData = function(config) { ,items: [{ name: 'createdon_adjusted' ,fieldLabel: _('resource_createdon') - ,anchor: '100%' },{ name: 'createdon_by' ,fieldLabel: _('resource_createdby') @@ -221,22 +193,17 @@ MODx.panel.ResourceData = function(config) { },{ name: 'publishedon_adjusted' ,fieldLabel: _('resource_publishedon') - ,anchor: '100%' },{ name: 'publishedon_by' ,fieldLabel: _('resource_publishedby') - ,anchor: '100%' },{ name: 'editedon_adjusted' ,fieldLabel: _('resource_editedon') - ,anchor: '100%' },{ name: 'editedon_by' ,fieldLabel: _('resource_editedby') - ,anchor: '100%' },{ xtype: 'modx-grid-manager-log' - ,anchor: '100%' ,preventRender: true ,formpanel: 'modx-panel-manager-log' ,baseParams: { @@ -297,8 +264,7 @@ Ext.extend(MODx.panel.ResourceData,MODx.FormPanel,{ } ,listeners: { 'success': {fn:function(r) { - if (r.object.pub_date == '0') { r.object.pub_date = ''; } - if (r.object.unpub_date == '0') { r.object.unpub_date = ''; } + r.object.publishedon = r.object.publishedon_adjusted; Ext.get('modx-resource-header').update(Ext.util.Format.htmlEncode(r.object.pagetitle)); this.getForm().setValues(r.object); this.fireEvent('ready'); diff --git a/manager/assets/modext/widgets/resource/modx.panel.resource.schedule.js b/manager/assets/modext/widgets/resource/modx.panel.resource.schedule.js index 13fc9227bf5..4be9016330f 100644 --- a/manager/assets/modext/widgets/resource/modx.panel.resource.schedule.js +++ b/manager/assets/modext/widgets/resource/modx.panel.resource.schedule.js @@ -57,7 +57,7 @@ MODx.grid.ResourceSchedule = function(config) { ,'pagetitle' ,'class_key' ,{name: 'pub_date', type: 'date'} - ,{name: 'unpub_date', type:'date'} + ,{name: 'unpub_date', type: 'date'} ,'menu' ] ,showActionsColumn: false @@ -88,7 +88,7 @@ MODx.grid.ResourceSchedule = function(config) { ,timeFormat: MODx.config.manager_time_format ,ctCls: 'x-datetime-inline-editor' } - ,renderer: Ext.util.Format.dateRenderer(MODx.config.manager_date_format + ' ' + MODx.config.manager_time_format) + ,renderer: Ext.util.Format.dateRenderer(MODx.config.manager_date_format + MODx.config.manager_datetime_separator + MODx.config.manager_time_format) },{ header: _('unpublish_date') ,dataIndex: 'unpub_date' @@ -99,7 +99,7 @@ MODx.grid.ResourceSchedule = function(config) { ,timeFormat: MODx.config.manager_time_format ,ctCls: 'x-datetime-inline-editor' } - ,renderer: Ext.util.Format.dateRenderer(MODx.config.manager_date_format + ' ' + MODx.config.manager_time_format) + ,renderer: Ext.util.Format.dateRenderer(MODx.config.manager_date_format + MODx.config.manager_datetime_separator + MODx.config.manager_time_format) }] ,tbar: [{ text: _('showing_pub') @@ -108,7 +108,7 @@ MODx.grid.ResourceSchedule = function(config) { ,enableToggle: true ,tooltip: _('click_to_change') ,id: 'btn-toggle' - ,cls:'primary-button' + ,cls: 'primary-button' }] }); MODx.grid.ResourceSchedule.superclass.constructor.call(this,config); diff --git a/manager/assets/modext/widgets/security/modx.grid.user.recent.resource.js b/manager/assets/modext/widgets/security/modx.grid.user.recent.resource.js index cb749b53652..a64f3929cde 100644 --- a/manager/assets/modext/widgets/security/modx.grid.user.recent.resource.js +++ b/manager/assets/modext/widgets/security/modx.grid.user.recent.resource.js @@ -37,7 +37,6 @@ MODx.grid.RecentlyEditedResourcesByUser = function(config) { },{ header: _('editedon') ,dataIndex: 'occurred' - ,renderer : Ext.util.Format.dateRenderer(dateFormat) },{ header: _('published') ,dataIndex: 'published' diff --git a/manager/assets/modext/widgets/system/modx.grid.manager.log.js b/manager/assets/modext/widgets/system/modx.grid.manager.log.js index 8a0b549defd..82088d5cb05 100644 --- a/manager/assets/modext/widgets/system/modx.grid.manager.log.js +++ b/manager/assets/modext/widgets/system/modx.grid.manager.log.js @@ -75,6 +75,7 @@ MODx.panel.ManagerLog = function(config) { ,name: 'dateStart' ,allowBlank: true ,anchor: '100%' + ,format: MODx.config.manager_date_format ,listeners: { 'select': {fn: this.filter, scope: this} ,'render': {fn:this._addEnterKeyHandler} @@ -85,6 +86,7 @@ MODx.panel.ManagerLog = function(config) { ,name: 'dateEnd' ,allowBlank: true ,anchor: '100%' + ,format: MODx.config.manager_date_format ,listeners: { 'select': {fn: this.filter, scope: this} ,'render': {fn:this._addEnterKeyHandler} diff --git a/manager/assets/modext/workspace/lexicon/lexicon.grid.js b/manager/assets/modext/workspace/lexicon/lexicon.grid.js index 7d7d5440d10..6b074fa3c78 100644 --- a/manager/assets/modext/workspace/lexicon/lexicon.grid.js +++ b/manager/assets/modext/workspace/lexicon/lexicon.grid.js @@ -49,7 +49,6 @@ MODx.grid.Lexicon = function(config = {}) { header: _('last_modified') ,dataIndex: 'editedon' ,width: 125 - ,renderer: this._renderLastModDate }] ,tbar: { cls: 'has-nested-filters', @@ -236,12 +235,12 @@ Ext.extend(MODx.grid.Lexicon,MODx.grid.Grid,{ } } + /** + * @deprecated since 3.0.5. To be removed in future release. Datetime formatting + * now handled in back end processors to provide uniform display across components. + */ ,_renderLastModDate: function(value) { - if (Ext.isEmpty(value)) { - return '—'; - } - - return new Date(value*1000).format(MODx.config.manager_date_format + ' ' + MODx.config.manager_time_format); + return value; } ,loadWindow2: function(btn,e,o) { diff --git a/manager/assets/modext/workspace/package.grid.js b/manager/assets/modext/workspace/package.grid.js index c25d19b2098..3914fb4080b 100644 --- a/manager/assets/modext/workspace/package.grid.js +++ b/manager/assets/modext/workspace/package.grid.js @@ -211,16 +211,11 @@ Ext.extend(MODx.grid.Package,MODx.grid.Grid,{ return this.mainColumnTpl.apply(values); } - ,dateColumnRenderer: function(d,c) { - switch(d) { - case '': - case null: - c.css = 'not-installed'; - return _('not_installed'); - default: - c.css = ''; - return _('installed_on',{'time':d}); + ,dateColumnRenderer: function(value, metaData) { + if (Ext.isEmpty(value) || value.includes(_('not_installed'))) { + metaData.css = 'not-installed'; } + return value; } ,onClick: function(e){ diff --git a/manager/assets/modext/workspace/package/package.versions.grid.js b/manager/assets/modext/workspace/package/package.versions.grid.js index 0223981dd67..eac7118d076 100644 --- a/manager/assets/modext/workspace/package/package.versions.grid.js +++ b/manager/assets/modext/workspace/package/package.versions.grid.js @@ -41,16 +41,11 @@ MODx.grid.PackageVersions = function(config) { }; Ext.extend(MODx.grid.PackageVersions,MODx.grid.Grid,{ - _rins: function(d,c) { - switch(d) { - case '': - case null: - c.css = 'not-installed'; - return _('not_installed'); - default: - c.css = ''; - return d; + _rins: function(value, metaData) { + if (Ext.isEmpty(value) || value.includes(_('not_installed'))) { + metaData.css = 'not-installed'; } + return value; } ,removePriorVersion: function(btn,e) { diff --git a/manager/controllers/default/resource/data.class.php b/manager/controllers/default/resource/data.class.php index 39614ebfb4b..887fb1965c2 100644 --- a/manager/controllers/default/resource/data.class.php +++ b/manager/controllers/default/resource/data.class.php @@ -1,4 +1,5 @@ modx->cacheManager->get($this->resource->getCacheKey(), [ xPDO::OPT_CACHE_KEY => $this->modx->getOption('cache_resource_key', null, 'resource'), xPDO::OPT_CACHE_HANDLER => $this->modx->getOption('cache_resource_handler', null, $this->modx->getOption(xPDO::OPT_CACHE_HANDLER)), - xPDO::OPT_CACHE_FORMAT => (integer)$this->modx->getOption('cache_resource_format', null, $this->modx->getOption(xPDO::OPT_CACHE_FORMAT, null, xPDOCacheManager::CACHE_PHP)), + xPDO::OPT_CACHE_FORMAT => (int)$this->modx->getOption('cache_resource_format', null, $this->modx->getOption(xPDO::OPT_CACHE_FORMAT, null, xPDOCacheManager::CACHE_PHP)), ]); if ($buffer) { $placeholders['buffer'] = htmlspecialchars($buffer['resource']['_content']); @@ -115,9 +116,9 @@ public function process(array $scriptProperties = []) $placeholders['_ctx'] = $this->resource->get('context_key'); return $placeholders; + return ''; } - /** * @return string */ @@ -160,7 +161,7 @@ public function getTemplateFile() */ public function getLanguageTopics() { - return ['resource']; + return ['resource', 'manager_log']; } diff --git a/manager/controllers/default/system/file/edit.class.php b/manager/controllers/default/system/file/edit.class.php index 42ce2e85543..60de7d64891 100644 --- a/manager/controllers/default/system/file/edit.class.php +++ b/manager/controllers/default/system/file/edit.class.php @@ -1,4 +1,5 @@ modx->services->get(modManagerDateFormatter::class); + if (!empty($this->fileRecord['last_accessed'])) { + $this->fileRecord['last_accessed'] = $formatter->formatDateTime($this->fileRecord['last_accessed']); + } + if (!empty($this->fileRecord['last_modified'])) { + $this->fileRecord['last_modified'] = $formatter->formatDateTime($this->fileRecord['last_modified']); + } $this->canSave = true; $placeholders['fa'] = $this->fileRecord; diff --git a/manager/templates/default/dashboard/onlineusers.tpl b/manager/templates/default/dashboard/onlineusers.tpl index 3831a516074..1fba0446044 100644 --- a/manager/templates/default/dashboard/onlineusers.tpl +++ b/manager/templates/default/dashboard/onlineusers.tpl @@ -28,8 +28,8 @@