diff --git a/_build/build.transport.php b/_build/build.transport.php index cb9e38c..835fe27 100644 --- a/_build/build.transport.php +++ b/_build/build.transport.php @@ -28,13 +28,12 @@ /* define package */ define('PKG_NAME','Articles'); define('PKG_NAME_LOWER',strtolower(PKG_NAME)); -define('PKG_VERSION','1.7.2'); +define('PKG_VERSION','1.7.9'); define('PKG_RELEASE','pl'); /* define sources */ $root = dirname(dirname(__FILE__)).'/'; $sources = array( - 'root' => $root, 'root' => $root, 'build' => $root .'_build/', 'resolvers' => $root . '_build/resolvers/', @@ -234,4 +233,4 @@ $modx->log(modX::LOG_LEVEL_INFO,"\n
Package Built.
\nExecution time: {$totalTime}\n"); -exit (); \ No newline at end of file +exit (); diff --git a/_build/config.json b/_build/config.json index f4adddc..f03aed6 100755 --- a/_build/config.json +++ b/_build/config.json @@ -3,7 +3,7 @@ ,"lowCaseName": "articles" ,"description": "" ,"author": "Shaun McCormick" - ,"version": "1.7.2" + ,"version": "1.7.9" ,"package":{ "elements": { "plugins": [{ diff --git a/_build/data/transport.subpackages.php b/_build/data/transport.subpackages.php index f3bf7b4..2196c32 100644 --- a/_build/data/transport.subpackages.php +++ b/_build/data/transport.subpackages.php @@ -30,7 +30,7 @@ $subpackages = array( 'archivist' => 'archivist-1.2.4-pl', 'getpage' => 'getpage-1.2.3-pl', - 'getresources' => 'getresources-1.6.0-pl', + 'getresources' => 'getresources-1.6.1-pl', 'quip' => 'quip-2.3.3-pl', 'taglister' => 'taglister-1.1.7-pl', ); diff --git a/_build/resolvers/packages/resolve.getresources.php b/_build/resolvers/packages/resolve.getresources.php index 88ac8b1..b02cd9c 100644 --- a/_build/resolvers/packages/resolve.getresources.php +++ b/_build/resolvers/packages/resolve.getresources.php @@ -9,7 +9,7 @@ */ $success= true; if ($transport && $transport->xpdo) { - $signature = 'getresources-1.6.0-pl'; + $signature = 'getresources-1.6.1-pl'; $modx =& $transport->xpdo; $modx->addPackage('modx.transport',$modx->getOption('core_path').'model/'); diff --git a/_build/subpackages/getresources-1.6.0-pl.transport.zip b/_build/subpackages/getresources-1.6.0-pl.transport.zip deleted file mode 100644 index 4d77dfd..0000000 Binary files a/_build/subpackages/getresources-1.6.0-pl.transport.zip and /dev/null differ diff --git a/_build/subpackages/getresources-1.6.1-pl.transport.zip b/_build/subpackages/getresources-1.6.1-pl.transport.zip new file mode 100644 index 0000000..6226376 Binary files /dev/null and b/_build/subpackages/getresources-1.6.1-pl.transport.zip differ diff --git a/assets/components/articles/js/article/create.js b/assets/components/articles/js/article/create.js index 7d7551f..7a17018 100755 --- a/assets/components/articles/js/article/create.js +++ b/assets/components/articles/js/article/create.js @@ -126,6 +126,7 @@ Ext.extend(Articles.panel.Article,MODx.panel.Resource,{ ,height: 400 ,grow: false ,value: (config.record.content || config.record.ta) || '' + ,itemCls: 'contentblocks_replacement' },{ id: 'modx-content-below' ,border: false @@ -195,11 +196,6 @@ Ext.extend(Articles.panel.Article,MODx.panel.Resource,{ ,hiddenName: 'createdby' ,id: 'modx-resource-createdby' ,allowBlank: true - ,baseParams: { - action: 'getList' - ,combo: '1' - ,limit: 0 - } ,width: 300 ,value: config.record.createdby || MODx.user.id },{ @@ -229,11 +225,6 @@ Ext.extend(Articles.panel.Article,MODx.panel.Resource,{ ,id: 'modx-resource-template' ,anchor: '100%' ,editable: false - ,baseParams: { - action: 'getList' - ,combo: '1' - ,limit: '0' - } },{ xtype: 'textfield' ,fieldLabel: _('articles.article_alias') @@ -340,4 +331,4 @@ Ext.extend(Articles.panel.Article,MODx.panel.Resource,{ Ext.apply(o.form.baseParams,d); } }); -Ext.reg('modx-panel-article',Articles.panel.Article); \ No newline at end of file +Ext.reg('modx-panel-article',Articles.panel.Article); diff --git a/assets/components/articles/js/article/update.js b/assets/components/articles/js/article/update.js index 3d0b6d1..b8fa181 100755 --- a/assets/components/articles/js/article/update.js +++ b/assets/components/articles/js/article/update.js @@ -10,13 +10,20 @@ Articles.page.UpdateArticle = function(config) { Articles.page.UpdateArticle.superclass.constructor.call(this,config); }; Ext.extend(Articles.page.UpdateArticle,MODx.page.UpdateResource,{ - - getButtons: function(cfg) { + doesButtonExist: function(btnArray, lexiconKey) { + var exists = false; + btnArray.map(function(item) { + if(lexiconKey == item.text) exists = true; + }); + return exists; + } + ,getButtons: function(cfg) { var btns = []; - if (cfg.canSave == 1) { + if (cfg.canSave == 1 && !this.doesButtonExist(btns, _('save'))) { btns.push({ - process: 'update' + process: (MODx.config.connector_url) ? 'resource/update' : 'update' ,text: _('save') + ,cls: 'primary-button' ,method: 'remote' ,checkDirty: cfg.richtext || MODx.request.activeSave == 1 ? false : true ,keys: [{ @@ -25,7 +32,7 @@ Ext.extend(Articles.page.UpdateArticle,MODx.page.UpdateResource,{ }] }); btns.push('-'); - } else if (cfg.locked) { + } else if (cfg.locked && !this.doesButtonExist(btns, _('locked'))) { btns.push({ text: cfg.lockedText || _('locked') ,handler: Ext.emptyFn @@ -33,45 +40,61 @@ Ext.extend(Articles.page.UpdateArticle,MODx.page.UpdateResource,{ }); btns.push('-'); } - btns.push({ - text: _('articles.article_publish') - ,id: 'modx-article-publish' - ,hidden: cfg.record.published ? true : false - ,handler: this.publishArticle - }); - btns.push({ - text: _('articles.article_unpublish') - ,id: 'modx-article-unpublish' - ,hidden: cfg.record.published ? false : true - ,handler: this.unpublishArticle - }); - btns.push('-'); - btns.push({ - process: 'preview' - ,text: _('view') - ,handler: this.preview - ,scope: this - }); - btns.push('-'); - btns.push({ - process: 'cancel' - ,text: _('cancel') - ,handler: this.cancel - ,scope: this - }); - btns.push('-'); - btns.push({ - text: _('help_ex') - ,handler: MODx.loadHelpPane - }); - return btns; + if(cfg.publish_document && !this.doesButtonExist(btns, _('articles.article_publish'))) { + btns.push({ + text: _('articles.article_publish') + ,id: 'modx-article-publish' + ,hidden: cfg.record.published ? true : false + ,handler: this.publishArticle + }); + btns.push({ + text: _('articles.article_unpublish') + ,id: 'modx-article-unpublish' + ,hidden: cfg.record.published ? false : true + ,handler: this.unpublishArticle + }); + btns.push('-'); + } + if(!this.doesButtonExist(btns, _('view'))) { + btns.push({ + process: 'preview' + ,text: _('view') + ,handler: this.preview + ,scope: this + }); + btns.push('-'); + } + if(!this.doesButtonExist(btns, _('cancel'))) { + btns.push({ + process: 'cancel' + ,text: _('cancel') + ,handler: this.cancel + ,scope: this + }); + btns.push('-'); + } + if(!this.doesButtonExist(btns, _('help_ex'))) { + btns.push({ + text: _('help_ex') + ,handler: MODx.loadHelpPane + }); + } + + // remove duplicate spacings + for(var i=0; i<=(btns.length - 1); i++) { + var item = btns[i]; + if(item != '-') continue; + if(btns[i+1] == '-' || (btns[i+1] && btns[i+1].hidden == true)) btns.splice(i,1); + } + + return btns; } ,publishArticle: function(btn,e) { MODx.Ajax.request({ - url: MODx.config.connectors_url+'resource/index.php' + url: (MODx.config.connector_url) ? MODx.config.connector_url : MODx.config.connectors_url+'resource/index.php' ,params: { - action: 'publish' + action: (MODx.config.connector_url) ? 'resource/publish' : 'publish' ,id: MODx.request.id } ,listeners: { @@ -99,9 +122,9 @@ Ext.extend(Articles.page.UpdateArticle,MODx.page.UpdateResource,{ ,unpublishArticle: function(btn,e) { MODx.Ajax.request({ - url: MODx.config.connectors_url+'resource/index.php' + url: (MODx.config.connector_url) ? MODx.config.connector_url : MODx.config.connectors_url+'resource/index.php' ,params: { - action: 'unpublish' + action: (MODx.config.connector_url) ? 'resource/unpublish' : 'unpublish' ,id: MODx.request.id } ,listeners: { @@ -305,6 +328,7 @@ Ext.extend(Articles.panel.Article,MODx.panel.Resource,{ ,height: 400 ,grow: false ,value: (config.record.content || config.record.ta) || '' + ,itemCls: 'contentblocks_replacement' },{ id: 'modx-content-below' ,border: false @@ -371,11 +395,6 @@ Ext.extend(Articles.panel.Article,MODx.panel.Resource,{ ,hiddenName: 'createdby' ,id: 'modx-resource-createdby' ,allowBlank: true - ,baseParams: { - action: 'getList' - ,combo: '1' - ,limit: 0 - } ,width: 300 ,value: config.record.createdby },{ @@ -405,11 +424,6 @@ Ext.extend(Articles.panel.Article,MODx.panel.Resource,{ ,id: 'modx-resource-template' ,anchor: '100%' ,editable: false - ,baseParams: { - action: 'getList' - ,combo: '1' - ,limit: '0' - } },{ xtype: 'textfield' ,fieldLabel: _('articles.article_alias') @@ -539,4 +553,4 @@ Ext.extend(Articles.panel.Article,MODx.panel.Resource,{ } } }); -Ext.reg('modx-panel-article',Articles.panel.Article); \ No newline at end of file +Ext.reg('modx-panel-article',Articles.panel.Article); diff --git a/assets/components/articles/js/container/articles.import.window.js b/assets/components/articles/js/container/articles.import.window.js index 53ac395..c3fb38d 100644 --- a/assets/components/articles/js/container/articles.import.window.js +++ b/assets/components/articles/js/container/articles.import.window.js @@ -5,9 +5,9 @@ Articles.window.ArticlesImport = function(config) { Ext.applyIf(config,{ title: _('articles.articles_import') ,id: this.ident - ,height: 150 - ,width: '75%' - ,minWidth: 650 + // ,height: 150 + // ,width: '75%' + ,width: 600 ,url: Articles.connector_url ,action: 'container/import' ,fileUpload: true @@ -81,12 +81,13 @@ Articles.panel.ImportOptionsWordPress = function(config) { msgTarget: 'under' } ,items: [{ - xtype: 'textfield' - ,inputType: 'file' + xtype: (MODx.config.connector_url) ? 'fileuploadfield' : 'textfield' // check for 2.3 + ,buttonText: _('upload.buttons.upload') ,name: 'wp-file' ,fieldLabel: _('articles.import_wp_file') + ,inputType: (MODx.config.connector_url) ? 'text' : 'file' // check for 2.3 ,id: this.ident+'-wp-file' - ,anchor: '98%' + ,anchor: (MODx.config.connector_url) ? '100%' : '98%' // check for 2.3 },{ xtype: MODx.expandHelp ? 'label' : 'hidden' ,forId: this.ident+'-wp-file' @@ -98,7 +99,7 @@ Articles.panel.ImportOptionsWordPress = function(config) { ,fieldLabel: _('articles.import_wp_file_server') ,description: MODx.expandHelp ? '' : _('articles.import_wp_file_server') ,id: this.ident+'-wp-file-server' - ,anchor: '98%' + ,anchor: (MODx.config.connector_url) ? '100%' : '98%' // check for 2.3 ,value: '{core_path}import/' },{ xtype: MODx.expandHelp ? 'label' : 'hidden' @@ -264,12 +265,13 @@ Articles.panel.ImportOptionsBlogger = function(config) { msgTarget: 'under' } ,items: [{ - xtype: 'textfield' - ,inputType: 'file' + xtype: (MODx.config.connector_url) ? 'fileuploadfield' : 'textfield' // check for 2.3 + ,buttonText: _('upload.buttons.upload') ,name: 'blogger-file' ,fieldLabel: _('articles.import_blogger_file') + ,inputType: (MODx.config.connector_url) ? 'text' : 'file' // check for 2.3 ,id: this.ident+'-blogger-file' - ,anchor: '98%' + ,anchor: (MODx.config.connector_url) ? '100%' : '98%' // check for 2.3 },{ xtype: MODx.expandHelp ? 'label' : 'hidden' ,forId: this.ident+'-blogger-file' @@ -281,7 +283,7 @@ Articles.panel.ImportOptionsBlogger = function(config) { ,fieldLabel: _('articles.import_blogger_file_server') ,description: MODx.expandHelp ? '' : _('articles.import_blogger_file_server') ,id: this.ident+'-blogger-file-server' - ,anchor: '98%' + ,anchor: (MODx.config.connector_url) ? '100%' : '98%' // check for 2.3 ,value: '{core_path}import/' },{ xtype: MODx.expandHelp ? 'label' : 'hidden' diff --git a/assets/components/articles/js/container/container.articles.grid.js b/assets/components/articles/js/container/container.articles.grid.js index 638e5c3..ca6a41c 100644 --- a/assets/components/articles/js/container/container.articles.grid.js +++ b/assets/components/articles/js/container/container.articles.grid.js @@ -63,6 +63,7 @@ Articles.grid.ContainerArticles = function(config) { }] ,tbar: [{ text: _('articles.article_create') + ,cls: 'primary-button' ,handler: this.createArticle ,scope: this },{ @@ -100,6 +101,7 @@ Articles.grid.ContainerArticles = function(config) { xtype: 'textfield' ,name: 'search' ,id: 'articles-article-search' + ,cls: 'x-form-filter' ,emptyText: _('search_ellipsis') ,listeners: { 'change': {fn: this.search, scope: this} @@ -117,6 +119,7 @@ Articles.grid.ContainerArticles = function(config) { },{ xtype: 'button' ,id: 'modx-filter-clear' + ,cls: 'x-form-filter-clear' ,text: _('filter_clear') ,listeners: { 'click': {fn: this.clearFilter, scope: this} @@ -125,7 +128,7 @@ Articles.grid.ContainerArticles = function(config) { }); Articles.grid.ContainerArticles.superclass.constructor.call(this,config); this._makeTemplates(); - this.on('rowclick',MODx.fireResourceFormChange); + //this.on('rowclick',MODx.fireResourceFormChange); this.on('click', this.handleButtons, this); }; Ext.extend(Articles.grid.ContainerArticles,MODx.grid.Grid,{ @@ -264,9 +267,9 @@ Ext.extend(Articles.grid.ContainerArticles,MODx.grid.Grid,{ MODx.msg.confirm({ title: _('articles.article_delete') ,text: _('articles.article_delete_confirm') - ,url: MODx.config.connectors_url+'resource/index.php' + ,url: (MODx.config.connector_url) ? MODx.config.connector_url : MODx.config.connectors_url+'resource/index.php' ,params: { - action: 'delete' + action: (MODx.config.connector_url) ? 'resource/delete' : 'delete' ,id: this.menu.record.id } ,listeners: { @@ -319,9 +322,9 @@ Ext.extend(Articles.grid.ContainerArticles,MODx.grid.Grid,{ ,undeleteArticle: function(btn,e) { MODx.Ajax.request({ - url: MODx.config.connectors_url+'resource/index.php' + url: (MODx.config.connector_url) ? MODx.config.connector_url : MODx.config.connectors_url+'resource/index.php' ,params: { - action: 'undelete' + action: (MODx.config.connector_url) ? 'resource/undelete' : 'undelete' ,id: this.menu.record.id } ,listeners: { @@ -372,9 +375,9 @@ Ext.extend(Articles.grid.ContainerArticles,MODx.grid.Grid,{ ,publishArticle: function(btn,e) { MODx.Ajax.request({ - url: MODx.config.connectors_url+'resource/index.php' + url: (MODx.config.connector_url) ? MODx.config.connector_url : MODx.config.connectors_url+'resource/index.php' ,params: { - action: 'publish' + action: (MODx.config.connector_url) ? 'resource/publish' : 'publish' ,id: this.menu.record.id } ,listeners: { @@ -385,9 +388,9 @@ Ext.extend(Articles.grid.ContainerArticles,MODx.grid.Grid,{ ,unpublishArticle: function(btn,e) { MODx.Ajax.request({ - url: MODx.config.connectors_url+'resource/index.php' + url: (MODx.config.connector_url) ? MODx.config.connector_url : MODx.config.connectors_url+'resource/index.php' ,params: { - action: 'unpublish' + action: (MODx.config.connector_url) ? 'resource/unpublish' : 'unpublish' ,id: this.menu.record.id } ,listeners: { diff --git a/assets/components/articles/js/container/container.common.js b/assets/components/articles/js/container/container.common.js index cc67c85..f9a0aad 100644 --- a/assets/components/articles/js/container/container.common.js +++ b/assets/components/articles/js/container/container.common.js @@ -66,6 +66,16 @@ Articles.panel.ContainerAdvancedSettings = function(config) { ,html: _('resource_longtitle_help') ,cls: 'desc-under' + },{ + xtype: 'combo-boolean' + ,name: 'setting_articlesPublished' + ,hiddenName: 'setting_articlesPublished' + ,id: 'articles-published' + ,fieldLabel: _('resource_published') + ,description: MODx.expandHelp ? '' : _('resource_published_help') + ' ' + _('articles.setting.published_desc') + ,width: 120 + ,listeners: oc + ,value: MODx.config.publish_default },{ xtype: 'combo-boolean' ,name: 'setting_articlesRichtext' @@ -1540,11 +1550,6 @@ Ext.extend(Articles.panel.ContainerTemplateSettings,MODx.Panel,{ ,id: 'modx-resource-template' ,anchor: '100%' ,editable: false - ,baseParams: { - action: 'getList' - ,combo: '1' - ,limit: '0' - } ,value: config.record.template || MODx.config['articles.default_container_template'] ,listeners: oc },{ @@ -1573,11 +1578,6 @@ Ext.extend(Articles.panel.ContainerTemplateSettings,MODx.Panel,{ ,anchor: '100%' ,value: config.record.setting_articleTemplate || MODx.config['articles.default_article_template'] ,listeners: oc - ,baseParams: { - action: 'getList' - ,combo: '1' - ,limit: 0 - } },{ xtype: MODx.expandHelp ? 'label' : 'hidden' ,forId: 'articles-setting-articleTemplate' @@ -1616,7 +1616,7 @@ Ext.extend(Articles.panel.ContainerTemplateSettings,MODx.Panel,{ ,height: 250 ,grow: false ,border: false - ,value: config.record && config.record.content ? config.record.content : "[[+articles]]\n\n[[+paging]]" + ,value: config.record && config.record.content ? config.record.content : "[[+articles]]\n\n[[!+page.nav:notempty=`\n
\n\t\n
\n`]]" },{ id: 'modx-content-below' ,border: false @@ -1651,4 +1651,4 @@ Articles.combo.Shorteners = function(config) { Articles.combo.Shorteners.superclass.constructor.call(this,config); }; Ext.extend(Articles.combo.Shorteners,MODx.combo.ComboBox); -Ext.reg('articles-combo-shorteners',Articles.combo.Shorteners); \ No newline at end of file +Ext.reg('articles-combo-shorteners',Articles.combo.Shorteners); diff --git a/assets/components/articles/js/container/create.js b/assets/components/articles/js/container/create.js index d66666f..759a91a 100644 --- a/assets/components/articles/js/container/create.js +++ b/assets/components/articles/js/container/create.js @@ -221,7 +221,15 @@ Ext.extend(Articles.panel.Container,MODx.panel.Resource,{ ,id: 'modx-resource-hidemenu' ,inputValue: 1 ,checked: parseInt(config.record.hidemenu) || false - + },{ + xtype: 'xcheckbox' + ,boxLabel: _('resource_folder') + ,hideLabel: true + ,description: '[[*isfolder]]
'+_('resource_folder_help') + ,name: 'isfolder' + ,id: 'modx-resource-isfolder' + ,inputValue: 1 + ,checked: parseInt(config.record.isfolder) || true },{ xtype: 'xcheckbox' ,boxLabel: _('resource_published') diff --git a/assets/components/articles/js/container/update.js b/assets/components/articles/js/container/update.js index 0473ee9..1064d35 100644 --- a/assets/components/articles/js/container/update.js +++ b/assets/components/articles/js/container/update.js @@ -241,7 +241,15 @@ Ext.extend(Articles.panel.Container,MODx.panel.Resource,{ ,id: 'modx-resource-hidemenu' ,inputValue: 1 ,checked: parseInt(config.record.hidemenu) || false - + },{ + xtype: 'xcheckbox' + ,boxLabel: _('resource_folder') + ,hideLabel: true + ,description: '[[*isfolder]]
'+_('resource_folder_help') + ,name: 'isfolder' + ,id: 'modx-resource-isfolder' + ,inputValue: 1 + ,checked: parseInt(config.record.isfolder) || false },{ xtype: 'xcheckbox' ,boxLabel: _('resource_published') diff --git a/assets/components/articles/js/extras/tagfield.js b/assets/components/articles/js/extras/tagfield.js index b7c690c..1721628 100755 --- a/assets/components/articles/js/extras/tagfield.js +++ b/assets/components/articles/js/extras/tagfield.js @@ -137,7 +137,7 @@ Ext.extend(Articles.extra.Tags,Ext.form.ComboBox,{ this.el.parent().wrap({ tag: 'div' - ,class: 'bxr-field-tags' + ,class: 'bxr-field-tags x-superboxselect' // x-superboxselect class needed to correctly display the tag remove button/cross }); this.el.parent().wrap({ diff --git a/core/components/articles/controllers/article/create.class.php b/core/components/articles/controllers/article/create.class.php index fba76d6..fce9d97 100755 --- a/core/components/articles/controllers/article/create.class.php +++ b/core/components/articles/controllers/article/create.class.php @@ -19,7 +19,9 @@ * * @package articles */ -require_once $modx->getOption('manager_path',null,MODX_MANAGER_PATH).'controllers/default/resource/create.class.php'; +if(!class_exists('ResourceCreateManagerController')) { + require_once $modx->getOption('manager_path',null,MODX_MANAGER_PATH).'controllers/'.$modx->getOption('manager_theme',null,'default').'/resource/create.class.php'; +} /** * @package articles */ @@ -73,7 +75,6 @@ public function getLanguageTopics() { public function process(array $scriptProperties = array()) { $placeholders = parent::process($scriptProperties); - $this->resourceArray['published'] = 0; $this->getDefaultContainerSettings(); return $placeholders; } @@ -87,6 +88,7 @@ public function getDefaultContainerSettings() { $settings = $container->getProperties('articles'); $this->resourceArray['template'] = $this->modx->getOption('articleTemplate',$settings,0); $this->resourceArray['richtext'] = $this->modx->getOption('articlesRichtext',$settings,1); + $this->resourceArray['published'] = $this->modx->getOption('articlesPublished',$settings,$this->modx->getOption('publish_default', null, 0)); } } } \ No newline at end of file diff --git a/core/components/articles/controllers/article/update.class.php b/core/components/articles/controllers/article/update.class.php index 57e4376..6e9aa32 100755 --- a/core/components/articles/controllers/article/update.class.php +++ b/core/components/articles/controllers/article/update.class.php @@ -19,7 +19,9 @@ * * @package articles */ -require_once $modx->getOption('manager_path',null,MODX_MANAGER_PATH).'controllers/default/resource/update.class.php'; +if(!class_exists('ResourceUpdateManagerController')) { + require_once $modx->getOption('manager_path',null,MODX_MANAGER_PATH).'controllers/'.$modx->getOption('manager_theme',null,'default').'/resource/update.class.php'; +} /** * @package articles */ diff --git a/core/components/articles/controllers/container/create.class.php b/core/components/articles/controllers/container/create.class.php index b1a1475..c2f3c0c 100644 --- a/core/components/articles/controllers/container/create.class.php +++ b/core/components/articles/controllers/container/create.class.php @@ -19,7 +19,9 @@ * * @package articles */ -require_once $modx->getOption('manager_path',null,MODX_MANAGER_PATH).'controllers/default/resource/create.class.php'; +if(!class_exists('ResourceCreateManagerController')) { + require_once $modx->getOption('manager_path',null,MODX_MANAGER_PATH).'controllers/'.$modx->getOption('manager_theme',null,'default').'/resource/create.class.php'; +} /** * @package articles */ @@ -33,6 +35,7 @@ public function loadCustomCssJs() { $connectorUrl = $articlesAssetsUrl.'connector.php'; $articlesJsUrl = $articlesAssetsUrl.'js/'; $this->resourceArray['articles_container_settings'] = $this->resource->getContainerSettings(); + $this->resourceArray['isfolder'] = true; $this->addJavascript($managerUrl.'assets/modext/util/datetime.js'); $this->addJavascript($managerUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js'); $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.grid.resource.security.js'); diff --git a/core/components/articles/controllers/container/update.class.php b/core/components/articles/controllers/container/update.class.php index 8b2cf0a..34ab4fb 100644 --- a/core/components/articles/controllers/container/update.class.php +++ b/core/components/articles/controllers/container/update.class.php @@ -22,7 +22,9 @@ /** * @var modX $modx */ -require_once $modx->getOption('manager_path',null,MODX_MANAGER_PATH).'controllers/default/resource/update.class.php'; +if(!class_exists('ResourceUpdateManagerController')) { + require_once $modx->getOption('manager_path',null,MODX_MANAGER_PATH).'controllers/'.$modx->getOption('manager_theme',null,'default').'/resource/update.class.php'; +} /** * @package articles */ diff --git a/core/components/articles/docs/changelog.txt b/core/components/articles/docs/changelog.txt index 418f99a..4f8f62b 100644 --- a/core/components/articles/docs/changelog.txt +++ b/core/components/articles/docs/changelog.txt @@ -1,5 +1,40 @@ Changelog for Articles. +Articles 1.7.9 +=============================== +- Add setting for default published status of new article +- Updated getlist to be multibyte safe and article update getButtons override change +- 2.3 Fixes + +Articles 1.7.8 +=============================== +- #92 Fix Articles save on update in Revolution 2.3 + +Articles 1.7.7 +=============================== +- #90 Fix Articles in Revolution 2.3 +- #87 Implement compatibility for ContentBlocks (v1.1) + +Articles 1.7.6 +=============================== + - #50 Conditionally load classes in controller + - #68 Fix False Positive on Confirm Navigation warning + - #64 Remove static html code from page.nav placeholder + - #62 Allow number at start of tag to be treated still as tag (@jasonbird) + - Update getResources to 1.6.1 + +Articles 1.7.5 +=============================== + - #54 Fix RSS Feeds (Revert PR #15,#25) + +Articles 1.7.4 +=============================== + - Add support for disabled cache_alias_map + +Articles 1.7.3 +=============================== + - Change package name from Articles to articles for xPDO compatibility + Articles 1.7.2 =============================== - Rebuilt tagging component. Thanks to Jan Peca (TheBoxer) @@ -231,4 +266,4 @@ Articles 1.0.0 - Automatic archiving of Articles - Integrated tagging - Easy templating for containers and articles -- Initial release. \ No newline at end of file +- Initial release. diff --git a/core/components/articles/lexicon/de/default.inc.php b/core/components/articles/lexicon/de/default.inc.php index 60b0e49..eead27c 100644 --- a/core/components/articles/lexicon/de/default.inc.php +++ b/core/components/articles/lexicon/de/default.inc.php @@ -154,7 +154,7 @@ $_lang['articles.setting.articleUriTemplate'] = 'Articles-URL-Format'; $_lang['articles.setting.articleUriTemplate_desc'] = '%Y = Jahr (4-stellig), %m = Monat (mit führenden Nullen), %d = Tag (mit führenden Nullen), %alias = Artikel-Alias, %id = Artikel-ID, %ext = Dateiendung (z.B. html). Hinweis: Änderungen an dieser Einstellung wirken sich nur auf *neue* Artikel aus, es sei denn, Sie ändern den Alias oder ziehen alte Artikel zurück und veröffentlichen sie erneut, wodurch ihre URLs im neuen Format neu generiert werden.'; -/* template / archives settings */ +/* Template / archives settings */ $_lang['articles.setting.articleTemplate'] = 'Artikel-Template'; $_lang['articles.setting.articleTemplate_desc'] = 'Das Template, das standardmäßig für Artikel verwendet wird.'; $_lang['articles.setting.tplArticleRow'] = 'Artikel-Zeilen-Chunk'; @@ -205,7 +205,7 @@ $_lang['articles.setting.rssAlias'] = 'RSS-Alias (Permalink)'; $_lang['articles.setting.rssAlias_desc'] = 'Der Alias (Permalink) für den RSS-Feed, der an die Articles-Container-URL angehängt wird.'; $_lang['articles.setting.rssItems'] = 'Anzahl der RSS-Elemente'; -$_lang['articles.setting.rssItems_desc'] = 'Die Anzahl der RSS-Elemente, die im RSS-Feed angezeigt werden sollen.'; +$_lang['articles.setting.rssItems_desc'] = 'Die Anzahl der RSS-Elemente, die im RSS-Feed angezeigt werden sollen. Geben Sie 0 ein für unbegrenzt viele Elemente.'; $_lang['articles.setting.tplRssFeed'] = 'RSS-Feed-Chunk'; $_lang['articles.setting.tplRssFeed_desc'] = 'Der Chunk, der für das RSS-Feed-Template verwendet wird.'; $_lang['articles.setting.tplRssItem'] = 'RSS-Element-Chunk'; @@ -228,6 +228,8 @@ $_lang['articles.setting.latestPostsLimit_desc'] = 'Die Anzahl der anzuzeigenden neuesten Artikel.'; $_lang['articles.setting.latestPostsOffset'] = 'Start-Index für neueste Artikel'; $_lang['articles.setting.latestPostsOffset_desc'] = 'Der Start-Index der Liste der neuesten Artikel.'; +$_lang['articles.setting.otherLatestPosts'] = 'Andere Listen-Parameter'; +$_lang['articles.setting.otherLatestPosts_desc'] = 'Alle anderen Eigenschaften, die Sie dem getResources-/getPage-Aufruf für das "Neueste Artikel"-Widget hinzufügen möchten. Verwenden Sie dafür MODX-Tag-Syntax, als ob Sie sie zu dem Snippet-Aufruf hinzufügen würden (z.B. &eigenschaft=`wert`).'; /* Notifications */ $_lang['articles.setting.notifyTwitter'] = 'An Twitter senden'; @@ -326,22 +328,29 @@ $_lang['articles.setting.commentsGravatarIcon'] = 'Gravatar-Icon-Stil'; $_lang['articles.setting.commentsGravatarIcon_desc'] = 'Der Gravatar-Icon-Typ, der für Benutzer ohne Gravatar genutzt wird.'; $_lang['articles.setting.commentsGravatarSize'] = 'Gravatar-Icon-Größe'; -$_lang['articles.setting.commentsGravatarSize_desc'] = 'Die Größe des Gravatars in Pixeln.'; +$_lang['articles.setting.commentsGravatarSize_desc'] = 'Die Größe des Gravatars in Pixeln. Der Standardwert ist 50.'; $_lang['articles.setting.'] = ''; $_lang['articles.setting._desc'] = ''; +$_lang['articles.loading'] = 'Lade'; /* Settings */ $_lang['setting_articles.article_show_longtitle'] = 'Feld für langen Titel anzeigen'; $_lang['setting_articles.article_show_longtitle_desc'] = 'Setzen Sie diese Einstellung auf "Ja", wenn das Feld "Langer Titel" beim Bearbeiten eines Artikels eingeblendet werden soll.'; $_lang['setting_articles.default_container_template'] = 'Standard-Artikel-Container-Template'; -$_lang['setting_articles.default_container_template_desc'] = 'Das Template, das standardmäßig verwendet wird, wenn ein neuer Artikel-Container erstellt wird.'; +$_lang['setting_articles.default_container_template_desc'] = 'Das Template (ID), das standardmäßig verwendet wird, wenn ein neuer Artikel-Container erstellt wird.'; $_lang['setting_articles.default_article_template'] = 'Standard-Artikel-Template'; -$_lang['setting_articles.default_article_template_desc'] = 'Das Template, das standardmäßig verwendet wird, wenn ein neuer Artikel erstellt wird und im Container selbst kein Template angegeben ist.'; +$_lang['setting_articles.default_article_template_desc'] = 'Das Template (ID), das standardmäßig verwendet wird, wenn ein neuer Artikel erstellt wird und im Container selbst kein Template angegeben ist.'; $_lang['setting_articles.container_ids'] = 'Container-IDs für das Routing von suchmaschinenfreundlichen URLs'; $_lang['setting_articles.container_ids_desc'] = 'Eine kommaseparierte Liste von Container-IDs, die für das Routing von suchmaschinenfreundlichen URLs verwendet werden. Es wird empfohlen, hier keine Änderungen vorzunehmen.'; // FURL routing $_lang['setting_articles.default_article_sort_field'] = 'Standard-Sortierfeld für Artikel im Manager'; -$_lang['setting_articles.default_article_sort_field_desc'] = 'Das Standard-Sortierfeld für die Artikel-Liste beim Bearbeiten eines Containers.'; \ No newline at end of file +$_lang['setting_articles.default_article_sort_field_desc'] = 'Das Standard-Sortierfeld für die Artikel-Liste beim Bearbeiten eines Containers.'; + +$_lang['setting_articles.mgr_date_format'] = 'Manager-Datumsformat'; +$_lang['setting_articles.mgr_date_format_desc'] = 'Datumsformat, das innerhalb eines Artikel-Containers angezeigt wird, wenn Artikel im Manager aufgelistet werden.'; + +$_lang['setting_articles.mgr_time_format'] = 'Manager-Zeitformat'; +$_lang['setting_articles.mgr_time_format_desc'] = 'Zeitformat, das innerhalb eines Artikel-Containers angezeigt wird, wenn Artikel im Manager aufgelistet werden.'; diff --git a/core/components/articles/lexicon/en/default.inc.php b/core/components/articles/lexicon/en/default.inc.php index 1f9cd04..bbb3a09 100755 --- a/core/components/articles/lexicon/en/default.inc.php +++ b/core/components/articles/lexicon/en/default.inc.php @@ -132,6 +132,7 @@ /* General */ $_lang['articles.setting.updateServicesEnabled'] = 'Enable Update Services'; $_lang['articles.setting.updateServicesEnabled_desc'] = 'If on, Articles will attempt to ping Ping-o-Matic whenever you publish an Article, to send out your article\'s title and URL to major search engines.'; +$_lang['articles.setting.published_desc'] = 'Default published status for new articles.'; $_lang['articles.setting.richtext_desc'] = 'Once created, individual Articles can override this value.'; $_lang['articles.setting.sortBy'] = 'Sort Field'; $_lang['articles.setting.sortBy_desc'] = 'The field to sort by on the main and archives listing pages.'; @@ -201,7 +202,7 @@ $_lang['articles.setting.rssAlias'] = 'RSS Alias (Permalink)'; $_lang['articles.setting.rssAlias_desc'] = 'The alias (permalink) for the RSS feed, appended to the Articles Container URL.'; $_lang['articles.setting.rssItems'] = 'Number of RSS Items'; -$_lang['articles.setting.rssItems_desc'] = 'The number of RSS items to show on the RSS feed.'; +$_lang['articles.setting.rssItems_desc'] = 'The number of RSS items to show on the RSS feed. Set to 0 for unlimited.'; $_lang['articles.setting.tplRssFeed'] = 'RSS Feed Chunk'; $_lang['articles.setting.tplRssFeed_desc'] = 'The Chunk to use for the RSS Feed template.'; $_lang['articles.setting.tplRssItem'] = 'RSS Item Chunk'; diff --git a/core/components/articles/model/articles/article.class.php b/core/components/articles/model/articles/article.class.php index f2a9230..e1b05ce 100644 --- a/core/components/articles/model/articles/article.class.php +++ b/core/components/articles/model/articles/article.class.php @@ -72,9 +72,9 @@ public function getContainerSettings() { $settings = $this->getProperties('articles'); /** @var ArticlesContainer $container */ $container = $this->getOne('Container'); - if ($container) { - $settings = $container->getContainerSettings(); - } + if(method_exists($container, 'getContainerSettings')) { + $settings = $container->getContainerSettings(); + } return is_array($settings) ? $settings : array(); } @@ -182,7 +182,7 @@ public function getCommentsCountCall(array $settings = array()) { * @return string */ public function getTagsCall(array $settings = array()) { - $call = '[[!tolinks? &useTagsFurl=`1` &items=`[[*articlestags]]` &target=`'.$this->get('parent').'`]]'; + $call = '[[!tolinks? &useTagsFurl=`[[++friendly_urls]]` &items=`[[*articlestags]]` &target=`'.$this->get('parent').'`]]'; $this->xpdo->setPlaceholder('article_tags',$call); return $call; } @@ -257,7 +257,9 @@ public function setArchiveUri() { return false; } - $settings = $container->getContainerSettings(); + if(method_exists($container, 'getContainerSettings')) { + $settings = $container->getContainerSettings(); + } if($this->get('pub_date')) $date = $this->get('pub_date'); else $date = $this->get('published') ? $this->get('publishedon') : $this->get('createdon'); diff --git a/core/components/articles/model/articles/articlescontainer.class.php b/core/components/articles/model/articles/articlescontainer.class.php index 4230c2f..368aae9 100644 --- a/core/components/articles/model/articles/articlescontainer.class.php +++ b/core/components/articles/model/articles/articlescontainer.class.php @@ -320,9 +320,12 @@ public function getRssCall() { public function getPostListingCall($placeholderPrefix = '') { $settings = $this->getContainerSettings(); $where = array('class_key' => 'Article'); - if (!empty($_REQUEST['arc_user'])) { - $userPk = $this->xpdo->sanitizeString($_REQUEST['arc_user']); - if (intval($userPk) == 0) { + if (!empty($_REQUEST['arc_author'])) { + $userPk = $this->xpdo->sanitizeString($_REQUEST['arc_author']); + if (function_exists('filter_var')) { + $userPkNum = filter_var($userPk,FILTER_VALIDATE_INT); + } else { $userPkNum = intval($userPk); } + if ($userPkNum == 0) { /** @var modUser $user */ $user = $this->xpdo->getObject('modUser',array('username' => $userPk)); if ($user) { @@ -372,13 +375,7 @@ public function getPostListingCall($placeholderPrefix = '') { ]]'; $this->xpdo->setPlaceholder($placeholderPrefix.'articles',$output); - $this->xpdo->setPlaceholder($placeholderPrefix.'paging','[[!+page.nav:notempty=` -
- -
-`]]'); + $this->xpdo->setPlaceholder($placeholderPrefix.'paging','[[!+page.nav]]'); return $output; } @@ -715,7 +712,7 @@ public function afterSave() { $this->addContainerId(); $this->removeFromArchivistIds(); $this->setProperty('clearCache',true); - $this->object->set('isfolder',true); + //$this->object->set('isfolder',true); return parent::afterSave(); } diff --git a/core/components/articles/model/articles/articlesrouter.class.php b/core/components/articles/model/articles/articlesrouter.class.php index 711cfae..ac96f35 100644 --- a/core/components/articles/model/articles/articlesrouter.class.php +++ b/core/components/articles/model/articles/articlesrouter.class.php @@ -53,15 +53,23 @@ public function route() { $resourceId = false; $prefix = 'arc_'; foreach ($containerIds as $archive) { + if (empty($archive)) continue; $archive = explode(':',$archive); $archiveId = $archive[0]; - if(is_array($this->modx->aliasMap)) { - $alias = array_search($archiveId,$this->modx->aliasMap); - if ($alias && strpos($search,$alias) !== false) { - $search = str_replace($alias,'',$search); - $resourceId = $archiveId; - if (isset($archive[1])) $prefix = $archive[1]; - } + + if (method_exists($this->modx->context, 'getResourceURI')) { + $alias = $this->modx->context->getResourceURI($archiveId); + } else { + $alias = is_array($this->modx->aliasMap) ? array_search($archiveId, $this->modx->aliasMap) : ''; + } + if ($alias && $startPageId == $archiveId) { + $startPageResId = $archiveId; + if (isset($archive[1])) $startPagePrefix = $archive[1]; + } + if ($alias && strpos($search, $alias) === 0) { + $search = substr($search, strlen($alias)); + $resourceId = $archiveId; + if (isset($archive[1])) $prefix = $archive[1]; } } if (!$resourceId) return false; @@ -72,10 +80,10 @@ public function route() { /* tag handling! */ if ($params[0] == 'tags') { - $_GET['tag'] = $params[1]; + $_REQUEST[$prefix.'author'] = $_GET['tag'] = urldecode($params[1]); /* author based */ } else if ($params[0] == 'user' || $params[0] == 'author') { - $_GET[$prefix.'author'] = $params[1]; + $_REQUEST[$prefix.'author'] = $_GET[$prefix.'author'] = urldecode($params[1]); /* numeric "archives/1234" */ } else if ($params[0] == 'archives' && !empty($params[1])) { @@ -87,9 +95,27 @@ public function route() { /* normal yyyy/mm/dd or yyyy/mm */ } else { /* set Archivist parameters for date-based archives */ - $_GET[$prefix.'year'] = $params[0]; - if (isset($params[1])) $_GET[$prefix.'month'] = $params[1]; - if (isset($params[2])) $_GET[$prefix.'day'] = $params[2]; + + if(is_numeric($params[0])) { + $_REQUEST[$prefix.'year'] = $_GET[$prefix.'year'] = $params[0]; + if (isset($params[1]) && is_numeric($params[1])) { + $_REQUEST[$prefix.'month'] = $_GET[$prefix.'month'] = $params[1]; + } else if(isset($params[1])) { + // Display the default 404 page if "month" is not a number + $this->modx->sendForward($this->modx->getOption('error_page'), 'HTTP/1.1 404 Not Found'); + } + if (isset($params[2]) && is_numeric($params[2])) { + $_REQUEST[$prefix.'day'] = $_GET[$prefix.'day'] = $params[2]; + } else if(isset($params[2])) { + // Display the default 404 page if "day" is not a number + $this->modx->sendForward($this->modx->getOption('error_page'), 'HTTP/1.1 404 Not Found'); + + } + } else { + // Display the default 404 page if nothing found + $this->modx->sendForward($this->modx->getOption('error_page'), 'HTTP/1.1 404 Not Found'); + } + } /* forward */ diff --git a/core/components/articles/model/articles/mysql/article.map.inc.php b/core/components/articles/model/articles/mysql/article.map.inc.php index 79fa117..4962c76 100644 --- a/core/components/articles/model/articles/mysql/article.map.inc.php +++ b/core/components/articles/model/articles/mysql/article.map.inc.php @@ -1,9 +1,17 @@ 'Articles', + 'package' => 'articles', + 'version' => '1.1', + 'extends' => 'modResource', + 'fields' => + array ( + ), + 'fieldMeta' => + array ( + ), 'aggregates' => array ( 'Container' => diff --git a/core/components/articles/model/articles/mysql/articlescontainer.map.inc.php b/core/components/articles/model/articles/mysql/articlescontainer.map.inc.php index 43b0fe9..d74a015 100644 --- a/core/components/articles/model/articles/mysql/articlescontainer.map.inc.php +++ b/core/components/articles/model/articles/mysql/articlescontainer.map.inc.php @@ -1,9 +1,17 @@ 'Articles', + 'package' => 'articles', + 'version' => '1.1', + 'extends' => 'modResource', + 'fields' => + array ( + ), + 'fieldMeta' => + array ( + ), 'composites' => array ( 'Articles' => diff --git a/core/components/articles/model/schema/articles.mysql.schema.xml b/core/components/articles/model/schema/articles.mysql.schema.xml index 5893db8..28e4a8a 100644 --- a/core/components/articles/model/schema/articles.mysql.schema.xml +++ b/core/components/articles/model/schema/articles.mysql.schema.xml @@ -1,9 +1,9 @@ - + - \ No newline at end of file + diff --git a/core/components/articles/processors/article/getlist.class.php b/core/components/articles/processors/article/getlist.class.php index 29b0d54..21b7078 100644 --- a/core/components/articles/processors/article/getlist.class.php +++ b/core/components/articles/processors/article/getlist.class.php @@ -31,7 +31,7 @@ class ArticleGetListProcessor extends modObjectGetListProcessor { public $objectType = 'article'; public $languageTopics = array('resource','articles:default'); - /** @var modAction $editAction */ + /** @var int|string $editAction */ public $editAction; /** @var modTemplateVar $tvTags */ public $tvTags; @@ -41,10 +41,16 @@ class ArticleGetListProcessor extends modObjectGetListProcessor { public $commentsEnabled = false; public function initialize() { - $this->editAction = $this->modx->getObject('modAction',array( + $action = $this->modx->getObject('modAction',array( 'namespace' => 'core', 'controller' => 'resource/update', )); + if ($action) { + $this->editAction = $action->get('id'); + } + else { + $this->editAction = 'resource/update'; + } $this->defaultSortField = $this->modx->getOption('articles.default_article_sort_field',null,'createdon'); if ($this->getParentContainer()) { @@ -185,7 +191,7 @@ public function prepareRow(xPDOObject $object) { $resourceArray['publishedon_time'] = strftime($this->modx->getOption('articles.mgr_time_format',null,'%H:%I %p'),$publishedon); $resourceArray['publishedon'] = strftime('%b %d, %Y %H:%I %p',$publishedon); } - $resourceArray['action_edit'] = '?a='.$this->editAction->get('id').'&action=post/update&id='.$resourceArray['id']; + $resourceArray['action_edit'] = '?a='.$this->editAction.'&action=post/update&id='.$resourceArray['id']; if (!array_key_exists('comments',$resourceArray)) $resourceArray['comments'] = 0; $this->modx->getContext($resourceArray['context_key']); @@ -229,10 +235,10 @@ public function prepareRow(xPDOObject $object) { } public function ellipsis($string,$length = 300) { - if (strlen($string) > $length) { - $string = substr($string,0,$length).'...'; - } + if (mb_strlen($string) > $length) { + $string = mb_substr($string,0,$length,$this->modx->config['charset']).'...'; + } return $string; } } -return 'ArticleGetListProcessor'; \ No newline at end of file +return 'ArticleGetListProcessor'; diff --git a/readme.md b/readme.md index fedcf3b..438a8fa 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,11 @@ # Articles -Articles is currently maintained at [modxcms/Articles](http://github.com/modxcms/Articles). Please [go there](http://github.com/modxcms/Articles). +This is the official repo for the MODX blogging extra Articles. + + * The documentation can be found at [MODX Docs](http://rtfm.modx.com/extras/revo/articles). + * Help can be found at the [MODX Forum](http://forums.modx.com/board?board=265) + +## Discuss +Join the conversation in our public Gitter chat room. + +[![Gitter chat](https://badges.gitter.im/modxcms/Articles.png)](https://gitter.im/modxcms/Articles)