diff --git a/language/english.php b/language/english.php index 7bedfa379..84a7a86ca 100644 --- a/language/english.php +++ b/language/english.php @@ -926,6 +926,17 @@ 'block_type_dynamic' => 'Dynamic' ); +############################################################################### +# Block Locations + +$LANG23 = array ( + 'blocks_article_footer_name' => 'Article Footer', + 'blocks_article_footer_desc' => 'Display Blocks in article Footer', + + 'blocks_article_topic_list_name' => 'Article Topic List', + 'blocks_article_topic_list_desc' => 'Displays Blocks right after every X number of articles in topics.' +); + ############################################################################### # admin/article.php @@ -2266,6 +2277,7 @@ 'whats_related_max' => "Max What's Related to Display", 'whats_related_trim' => "What's Related Title Length", 'default_cache_time_article' => "Default Article Cache Time", + 'blocks_article_topic_list_repeat_after' => "Article Topic List Blocks Location Repeat", 'aftersave_user' => "After Saving User", 'show_right_blocks' => "Always Show Right Blocks?", 'showfirstasfeatured' => "Show First Article as Featured?", diff --git a/language/english_utf-8.php b/language/english_utf-8.php index 69f927562..fce39b056 100644 --- a/language/english_utf-8.php +++ b/language/english_utf-8.php @@ -926,6 +926,17 @@ 'block_type_dynamic' => 'Dynamic' ); +############################################################################### +# Block Locations + +$LANG23 = array ( + 'blocks_article_footer_name' => 'Article Footer', + 'blocks_article_footer_desc' => 'Display Blocks in article Footer', + + 'blocks_article_topic_list_name' => 'Article Topic List', + 'blocks_article_topic_list_desc' => 'Displays Blocks right after every X number of articles in topics.' +); + ############################################################################### # admin/article.php @@ -2268,6 +2279,7 @@ 'whats_related_max' => "Max What's Related to Display", 'whats_related_trim' => "What's Related Title Length", 'default_cache_time_article' => "Default Article Cache Time", + 'blocks_article_topic_list_repeat_after' => "Article Topic List Blocks Location Repeat", 'aftersave_user' => "After Saving User", 'show_right_blocks' => "Always Show Right Blocks?", 'showfirstasfeatured' => "Show First Article as Featured?", diff --git a/language/japanese_utf-8.php b/language/japanese_utf-8.php index c7a5ca7a7..092296d2a 100644 --- a/language/japanese_utf-8.php +++ b/language/japanese_utf-8.php @@ -931,6 +931,17 @@ 'block_type_dynamic' => 'ダイナミック' ); +############################################################################### +# Block Locations + +$LANG23 = array ( + 'blocks_article_footer_name' => 'Article Footer', + 'blocks_article_footer_desc' => 'Display Blocks in article Footer', + + 'blocks_article_topic_list_name' => 'Article Topic List', + 'blocks_article_topic_list_desc' => 'Displays Blocks right after every X number of articles in topics.' +); + ############################################################################### # admin/article.php @@ -2274,6 +2285,7 @@ 'whats_related_max' => '表示する関連情報の最大数', 'whats_related_trim' => '関連情報のタイトルの最大長', 'default_cache_time_article' => '記事のキャッシュ期間のデフォルト', + 'blocks_article_topic_list_repeat_after' => "Article Topic List Blocks Location Repeat", 'aftersave_user' => 'ユーザー保存後の画面遷移', 'show_right_blocks' => '右ブロックを常に表示する', 'showfirstasfeatured' => '最初の記事を注目記事として表示する', diff --git a/public_html/admin/configuration_validation.php b/public_html/admin/configuration_validation.php index 8235f9c8a..394fc96e5 100644 --- a/public_html/admin/configuration_validation.php +++ b/public_html/admin/configuration_validation.php @@ -225,6 +225,7 @@ $_CONF_VALIDATE['Core']['whats_related_max'] = array('rule' => 'numeric'); $_CONF_VALIDATE['Core']['whats_related_trim'] = array('rule' => 'numeric'); $_CONF_VALIDATE['Core']['default_cache_time_article'] = array('rule' => 'numeric'); +$_CONF_VALIDATE['Core']['blocks_article_topic_list_repeat_after'] = array('rule' => 'numeric'); /* Subgroup Stories and Trackback, Tab Trackback */ $_CONF_VALIDATE['Core']['trackback_enabled'] = array('rule' => 'boolean'); diff --git a/public_html/admin/install/config-install.php b/public_html/admin/install/config-install.php index fc9cd85f0..e8b8f781d 100644 --- a/public_html/admin/install/config-install.php +++ b/public_html/admin/install/config-install.php @@ -145,6 +145,7 @@ function install_config() $c->add('whats_related_max',0,'text',1,7,NULL,1370,TRUE, $me, 7); $c->add('whats_related_trim',26,'text',1,7,NULL,1380,TRUE, $me, 7); $c->add('default_cache_time_article',0,'text',1,7,NULL,1390,TRUE, $me, 7); + $c->add('blocks_article_topic_list_repeat_after',1,'text',1,7,NULL,1400,TRUE, $me, 7); $c->add('tab_trackback', NULL, 'tab', 1, 8, NULL, 0, TRUE, $me, 8); $c->add('fs_trackback', NULL, 'fieldset', 1, 8, NULL, 0, TRUE, $me, 8); diff --git a/public_html/docs/english/config.html b/public_html/docs/english/config.html index e5692896f..4890e47e1 100644 --- a/public_html/docs/english/config.html +++ b/public_html/docs/english/config.html @@ -472,6 +472,10 @@

Articles and Trackback: Article

  • 0 = Not cached. Article is always regenerated.
  • -1 = Always cached and only regenerated when the article is updated and saved through the article editor.
  • + + blocks_article_topic_list_repeat_after + 1 + Article topic list blocks location repeats after this many article introductions are displayed in a topic.

    Articles and Trackback: Trackback

    diff --git a/public_html/docs/japanese/config.html b/public_html/docs/japanese/config.html index 3097eeeb4..0113321cb 100644 --- a/public_html/docs/japanese/config.html +++ b/public_html/docs/japanese/config.html @@ -433,6 +433,10 @@

    記事とトラックバック: 記事

  • 0 = キャッシュしません。記事は常にデータベースから生成されます。
  • -1 = 常にキャッシュし、エディターで記事を更新・保存した場合に限り、キャッシュを再生成します。
  • + + blocks_article_topic_list_repeat_after + 1 + Article topic list blocks location repeats after this many article introductions are displayed in a topic.

    記事とトラックバック: トラックバック

    diff --git a/public_html/index.php b/public_html/index.php index b6f48ab3b..441ad0923 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -346,7 +346,8 @@ function fixTopic(&$A, $tid_list) } // display first article - $display .= STORY_renderArticle($story, 'y'); + $articlecount = 1; // Post count of page + $display .= STORY_renderArticle($story, 'y', '', '', $articlecount); // get plugin center blocks after featured article if ($story->DisplayElements('featured') == 1) { @@ -355,10 +356,11 @@ function fixTopic(&$A, $tid_list) // get remaining stories while ($A = DB_fetcharray($result)) { + $articlecount++; fixTopic($A, $tid_list); $story = new Article(); $story->loadFromArray($A); - $display .= STORY_renderArticle($story, 'y'); + $display .= STORY_renderArticle($story, 'y', '', '' , $articlecount); } // get plugin center blocks that follow articles diff --git a/public_html/layout/denim/articletext.thtml b/public_html/layout/denim/articletext.thtml index e00d64883..0756b1d9a 100644 --- a/public_html/layout/denim/articletext.thtml +++ b/public_html/layout/denim/articletext.thtml @@ -54,6 +54,13 @@ {!endif} +{!if blocks_article_footer} +{blocks_article_footer} +{!endif} +{!if blocks_article_topic_list} +{blocks_article_topic_list} +{!endif} + {!if link_url}
    diff --git a/public_html/layout/denim_three/articletext.thtml b/public_html/layout/denim_three/articletext.thtml index 3e6398653..ee6ed221e 100644 --- a/public_html/layout/denim_three/articletext.thtml +++ b/public_html/layout/denim_three/articletext.thtml @@ -54,6 +54,13 @@ {!endif} +{!if blocks_article_footer} +{blocks_article_footer} +{!endif} +{!if blocks_article_topic_list} +{blocks_article_topic_list} +{!endif} + {!if link_url}
    diff --git a/public_html/layout/modern_curve/articletext.thtml b/public_html/layout/modern_curve/articletext.thtml index 5399dace8..51a15d452 100644 --- a/public_html/layout/modern_curve/articletext.thtml +++ b/public_html/layout/modern_curve/articletext.thtml @@ -59,6 +59,13 @@ {!endif} +{!if blocks_article_footer} +{blocks_article_footer} +{!endif} +{!if blocks_article_topic_list} +{blocks_article_topic_list} +{!endif} + {!if link_url}
    diff --git a/sql/updates/mysql_2.1.3_to_2.2.0.php b/sql/updates/mysql_2.1.3_to_2.2.0.php index 391e99fc0..2de52c2e7 100644 --- a/sql/updates/mysql_2.1.3_to_2.2.0.php +++ b/sql/updates/mysql_2.1.3_to_2.2.0.php @@ -109,6 +109,8 @@ function update_ConfValuesFor220() // Config option for enable/disable logging of 404 errors $c->add('404_log',1,'select',7,31,1,1840,TRUE, $me, 31); + // Config option to control how often the Article Topic List Block repeats on the page + $c->add('blocks_article_topic_list_repeat_after',1,'text',1,7,NULL,1400,TRUE, $me, 7); return true; } diff --git a/sql/updates/pgsql_2.1.3_to_2.2.0.php b/sql/updates/pgsql_2.1.3_to_2.2.0.php index 871265da5..7efe7af2d 100644 --- a/sql/updates/pgsql_2.1.3_to_2.2.0.php +++ b/sql/updates/pgsql_2.1.3_to_2.2.0.php @@ -108,6 +108,10 @@ function update_ConfValuesFor220() // Config option for enable/disable logging of 404 errors $c->add('404_log',1,'select',7,31,1,1840,TRUE, $me, 31); + + // Config option to control how often the Article Topic List Block repeats on the page + $c->add('blocks_article_topic_list_repeat_after',1,'text',1,7,NULL,1400,TRUE, $me, 7); + return true; } diff --git a/system/lib-article.php b/system/lib-article.php index 6cc0d4511..674840e5c 100644 --- a/system/lib-article.php +++ b/system/lib-article.php @@ -57,13 +57,13 @@ * submit.php and admin/article.php (Preview mode for the last two). * * @param Article $story The story to display, an instance of the Story class. - * @param string $index n = Full display of article. p = 'Preview' mode. Else introtext only. + * @param string $index n = Full display of article. p = 'Preview' mode. Else y = introtext only. * @param string $storyTpl The template to use to render the story. * @param string $query A search query, if one was specified. * @return string Article as formatted HTML. * Note: Formerly named COM_Article, and re-written totally since then. */ -function STORY_renderArticle($story, $index = '', $storyTpl = 'articletext.thtml', $query = '') +function STORY_renderArticle($story, $index = '', $storyTpl = 'articletext.thtml', $query = '', $articlecount = 1) { global $_CONF, $_TABLES, $_USER, $LANG01, $LANG05, $LANG11, $LANG_TRB, $_IMAGE_TYPE, $mode; @@ -646,13 +646,30 @@ function STORY_renderArticle($story, $index = '', $storyTpl = 'articletext.thtml } PLG_templateSetVars($article_filevar, $article); + // Used by Custom Block Locations (needs to be done before cache) + if ($index == 'n') { // p = preview, n = full article, y = intro only (displayed in topics) + PLG_templateSetVars($article_filevar . '_full', $article); + } elseif ($_CONF['blocks_article_topic_list_repeat_after'] > 0) { + if ($index == 'y' && ($articlecount %$_CONF['blocks_article_topic_list_repeat_after'] == 0)) { + PLG_templateSetVars($article_filevar . '_topic_list', $article); + } + } if ($index != 'p' && ($cache_time > 0 || $cache_time == -1)) { $article->create_instance($cacheInstance, $article_filevar); // CACHE_create_instance($cacheInstance, $article); } + } else { PLG_templateSetVars($article_filevar, $article); + // Used by Custom Block Locations + if ($index == 'n') { // p = preview, n = full article, y = intro only (displayed in topics) + PLG_templateSetVars($article_filevar . '_full', $article); + } elseif ($_CONF['blocks_article_topic_list_repeat_after'] > 0) { + if ($index == 'y' && ($articlecount %$_CONF['blocks_article_topic_list_repeat_after'] == 0)) { + PLG_templateSetVars($article_filevar . '_topic_list', $article); + } + } if (!$_CONF['cache_templates']) { // Hack (see Geeklog Bug Tracker issue #0001817): Cannot set the template variable directly with set_var since @@ -663,7 +680,7 @@ function STORY_renderArticle($story, $index = '', $storyTpl = 'articletext.thtml $article->templateCode[$article_filevar] = $retval; } } - + $article->parse('finalstory', $article_filevar); return $article->finish($article->get_var('finalstory')); @@ -1779,6 +1796,36 @@ function plugin_getfeednames_article() return $feeds; } +/** + * Return an array of Block Locations in plugin templates + */ +function plugin_getBlockLocations_article() +{ + global $LANG23; + + $block_locations = array(); + + // Add any extra block locations for plugin + // Remember these locations can only appear in templates that PLG_templateSetVars is used with + $block_locations[] = array( + 'id' => 'article_footer', // Unique string. No other block location (includes Geeklog itself and any other plugins or themes) can share the same id ("left" and "right" are already taken). + 'name' => $LANG23['blocks_article_footer_name'], + 'description' => $LANG23['blocks_article_footer_desc'], + 'template_name' => 'article_full', + 'template_variable' => 'blocks_article_footer' + ); + + $block_locations[] = array( + 'id' => 'article_topic_list', // Unique string. No other block location (includes Geeklog itself and any other plugins or themes) can share the same id ("left" and "right" are already taken). + 'name' => $LANG23['blocks_article_topic_list_name'], + 'description' => $LANG23['blocks_article_topic_list_desc'], + 'template_name' => 'article_topic_list', + 'template_variable' => 'blocks_article_topic_list' + ); + + return $block_locations; +} + /** * Config Option has changed. (use plugin api) *