[geeklog-hg] geeklog: Improved hidden topic feature. Added a related topics t...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Thu Jun 13 18:38:11 EDT 2013
changeset 9091:ef58539f9cb8
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/ef58539f9cb8
user: Tom <websitemaster at cogeco.net>
date: Thu Jun 13 15:17:54 2013 -0400
description:
Improved hidden topic feature. Added a related topics template variable for articles with a config option to disable. Added 2 autotags to return related items (related_items) for a object and related topics (related_topics) for an object (feature request #0001614)
diffstat:
language/english.php | 16 +-
language/english_utf-8.php | 16 +-
plugins/staticpages/functions.inc | 69 ++
public_html/admin/configuration_validation.php | 4 +
public_html/admin/install/config-install.php | 4 +
public_html/docs/english/config.html | 10 +
public_html/docs/english/theme.html | 10 +
public_html/docs/japanese/config.html | 10 +
public_html/layout/denim/featuredstorytext.thtml | 7 +-
public_html/layout/denim/storytext.thtml | 7 +-
public_html/layout/denim/topicnavigation.thtml | 13 +
public_html/layout/denim/topicoption.thtml | 1 -
public_html/layout/denim/topicoption_off.thtml | 1 -
public_html/layout/modern_curve/featuredstorytext.thtml | 7 +-
public_html/layout/modern_curve/storytext.thtml | 15 +-
public_html/layout/modern_curve/topicnavigation.thtml | 13 +
public_html/layout/modern_curve/topicoption.thtml | 6 -
public_html/layout/modern_curve/topicoption_off.thtml | 6 -
public_html/layout/professional/featuredstorytext.thtml | 7 +
public_html/layout/professional/storytext.thtml | 7 +
public_html/layout/professional/topicnavigation.thtml | 13 +
public_html/layout/professional/topicoption.thtml | 1 -
public_html/layout/professional/topicoption_off.thtml | 1 -
public_html/layout/professional_css/featuredstorytext.thtml | 9 +-
public_html/layout/professional_css/storytext.thtml | 9 +-
public_html/layout/professional_css/topicnavigation.thtml | 13 +
public_html/layout/professional_css/topicoption.thtml | 6 -
public_html/layout/professional_css/topicoption_off.thtml | 6 -
public_html/lib-common.php | 231 ++++---
sql/updates/mssql_2.0.0_to_2.0.1.php | 10 +-
sql/updates/mysql_2.0.0_to_2.0.1.php | 8 +-
sql/updates/pgsql_2.0.0_to_2.0.1.php | 10 +-
system/lib-plugins.php | 40 +
system/lib-story.php | 75 ++-
system/lib-topic.php | 345 +++++++++++-
35 files changed, 823 insertions(+), 183 deletions(-)
diffs (truncated from 1490 to 300 lines):
diff -r e37edd00d3d6 -r ef58539f9cb8 language/english.php
--- a/language/english.php Sat May 25 22:00:10 2013 -0400
+++ b/language/english.php Thu Jun 13 15:17:54 2013 -0400
@@ -910,7 +910,7 @@
33 => 'Inherit',
34 => 'Items of child topic are inherited',
35 => 'Hidden',
- 36 => 'Topic will be hidden and cannot be viewed directly, only inherited',
+ 36 => 'Topic will be hidden in the Topic Block until it\'s parent topic is selected',
37 => 'Root',
38 => 'All',
39 => 'Homepage Only',
@@ -930,7 +930,11 @@
53 => 'Image',
'breadcrumb_separator' => '>',
'breadcrumb_root' => 'Home',
- 'autotag_desc_topic' => '[topic: id alternate title] - Displays a link to a topic using the ID as the title. An alternate title may be specified but is not required.'
+ 'autotag_desc_topic' => '[topic:id alternate title] - Displays a link to a topic using the ID as the title. An alternate title may be specified but is not required.',
+ 'autotag_desc_related_topics' => '[related_topics:id type:plugin max:max_items_listed] - Creates a clickable horizontal list of related topics based on the item id and type.',
+ 'autotag_desc_related_items' => '[related_items:id type:plugin max:max_items_listed trim:max_length include:plugin] - Create a clickable list of related items based on the item id and type.',
+ 'no_related_items' => 'No related items found.',
+ 'topics:' => 'Topics:'
);
###############################################################################
@@ -1958,6 +1962,8 @@
'hide_main_page_navigation' => "Hide Main Page Navigation?",
'onlyrootfeatures' => "Only Root can Feature?",
'aftersave_story' => "After Saving Story",
+ 'related_topics' => "Related Topics",
+ 'related_topics_max' => "Max Related Topics to Display",
'aftersave_user' => "After Saving User",
'show_right_blocks' => "Always Show Right Blocks?",
'showfirstasfeatured' => "Show First Story as Featured?",
@@ -2049,6 +2055,9 @@
'search_def_sort' => "Default Sort Order",
'autotag_permissions_story' => '[story: ] Permissions',
'autotag_permissions_user' => '[user: ] Permissions',
+ 'autotag_permissions_topic' => '[topic: ] Permissions',
+ 'autotag_permissions_related_topics' => '[related_topics: ] Permissions',
+ 'autotag_permissions_related_items' => '[related_items: ] Permissions',
'multiple_breadcrumbs' => "Multiple Breadcrumbs",
'disable_breadcrumbs_topics' => "Disable Topic Breadcrumbs",
'disable_breadcrumbs_articles' => "Disable Article Breadcrumbs",
@@ -2197,7 +2206,8 @@
28 => array('No access' => 0, 'Use' => 2),
29 => array('md5' => 0, 'sha1' => 1, 'sha256' => 2, 'sha512' => 3, 'blowfish' => 4),
30 => array('Start' => 'start', 'End' => 'end', 'None' => 'none'),
- 31 => array('Newest First' => 'DESC', 'Oldest First' => 'ASC')
+ 31 => array('Newest First' => 'DESC', 'Oldest First' => 'ASC'),
+ 32 => array('Disabled' => 0, 'Just Article Pages' => 1, 'Articles and Topics' => 'articletopic')
);
################################################################################
diff -r e37edd00d3d6 -r ef58539f9cb8 language/english_utf-8.php
--- a/language/english_utf-8.php Sat May 25 22:00:10 2013 -0400
+++ b/language/english_utf-8.php Thu Jun 13 15:17:54 2013 -0400
@@ -910,7 +910,7 @@
33 => 'Inherit',
34 => 'Items of child topic are inherited',
35 => 'Hidden',
- 36 => 'Topic will be hidden and cannot be viewed directly, only inherited',
+ 36 => 'Topic will be hidden in the Topic Block until it\'s parent topic is selected',
37 => 'Root',
38 => 'All',
39 => 'Homepage Only',
@@ -930,7 +930,11 @@
53 => 'Image',
'breadcrumb_separator' => '>',
'breadcrumb_root' => 'Home',
- 'autotag_desc_topic' => '[topic: id alternate title] - Displays a link to a topic using the ID as the title. An alternate title may be specified but is not required.'
+ 'autotag_desc_topic' => '[topic:id alternate title] - Displays a link to a topic using the ID as the title. An alternate title may be specified but is not required.',
+ 'autotag_desc_related_topics' => '[related_topics:id type:plugin max:max_items_listed] - Creates a clickable horizontal list of related topics based on the item id and type.',
+ 'autotag_desc_related_items' => '[related_items:id type:plugin max:max_items_listed trim:max_length include:plugin] - Create a clickable list of related items based on the item id and type.',
+ 'no_related_items' => 'No related items found.',
+ 'topics:' => 'Topics:'
);
###############################################################################
@@ -1958,6 +1962,8 @@
'hide_main_page_navigation' => "Hide Main Page Navigation?",
'onlyrootfeatures' => "Only Root can Feature?",
'aftersave_story' => "After Saving Story",
+ 'related_topics' => "Related Topics",
+ 'related_topics_max' => "Max Related Topics to Display",
'aftersave_user' => "After Saving User",
'show_right_blocks' => "Always Show Right Blocks?",
'showfirstasfeatured' => "Show First Story as Featured?",
@@ -2049,6 +2055,9 @@
'search_def_sort' => "Default Sort Order",
'autotag_permissions_story' => '[story: ] Permissions',
'autotag_permissions_user' => '[user: ] Permissions',
+ 'autotag_permissions_topic' => '[topic: ] Permissions',
+ 'autotag_permissions_related_topics' => '[related_topics: ] Permissions',
+ 'autotag_permissions_related_items' => '[related_items: ] Permissions',
'multiple_breadcrumbs' => "Multiple Breadcrumbs",
'disable_breadcrumbs_topics' => "Disable Topic Breadcrumbs",
'disable_breadcrumbs_articles' => "Disable Article Breadcrumbs",
@@ -2197,7 +2206,8 @@
28 => array('No access' => 0, 'Use' => 2),
29 => array('md5' => 0, 'sha1' => 1, 'sha256' => 2, 'sha512' => 3, 'blowfish' => 4),
30 => array('Start' => 'start', 'End' => 'end', 'None' => 'none'),
- 31 => array('Newest First' => 'DESC', 'Oldest First' => 'ASC')
+ 31 => array('Newest First' => 'DESC', 'Oldest First' => 'ASC'),
+ 32 => array('Disabled' => 0, 'Just Article Pages' => 1, 'Articles and Topics' => 'articletopic')
);
################################################################################
diff -r e37edd00d3d6 -r ef58539f9cb8 plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc Sat May 25 22:00:10 2013 -0400
+++ b/plugins/staticpages/functions.inc Thu Jun 13 15:17:54 2013 -0400
@@ -1736,6 +1736,75 @@
}
/**
+* Return list of Static Pages for the Related Items block
+*
+* @param array $tids list of topic ids
+* @param int $max maximum number of items to return
+* @param int $trim max length of text
+* @return array array of links to related staticpages with unix timestamp as key
+*
+*/
+function plugin_getrelateditems_staticpages($tids, $max, $trim)
+{
+ global $_CONF, $_TABLES, $_SP_CONF;
+
+ $newstaticpages = array();
+
+ // Use setting from What's New block here since similar settings needed
+ if ($_SP_CONF['hidenewstaticpages'] == 'modified') {
+ $datecolumn = 'modified';
+ } else {
+ $datecolumn = 'created';
+ }
+ $extra_sql = "";
+ if ($_SP_CONF['includecenterblocks'] == 0) {
+ $extra_sql =' AND sp_centerblock = 0';
+ }
+ if ($_SP_CONF['includephp'] == 0) {
+ $extra_sql .=' AND sp_php = 0';
+ }
+
+ $sql = "SELECT sp_id, sp_title, UNIX_TIMESTAMP({$datecolumn}) sp_date
+ FROM {$_TABLES['staticpage']}, {$_TABLES['topic_assignments']} ta
+ WHERE ta.type = 'staticpages' AND ta.id = sp_id AND (ta.tid IN ('" . implode( "','", $tids ) . "'))
+ AND sp_content IS NOT NULL AND (draft_flag = 0) AND (template_flag = 0)
+ {$extra_sql} " . COM_getPermSQL('AND') . "
+ GROUP BY sp_id ORDER BY {$datecolumn} DESC LIMIT {$max}";
+
+ $result = DB_query($sql);
+ $nrows = DB_numRows($result);
+
+ if ($nrows > 0) {
+ $newstaticpages = array();
+
+ for ($x = 0; $x < $nrows; $x++) {
+ $A = DB_fetchArray($result);
+
+ $url = COM_buildUrl($_CONF['site_url']
+ . '/staticpages/index.php?page=' . $A['sp_id']);
+
+ $title = COM_undoSpecialChars(stripslashes( $A['sp_title']));
+ if ($trim > 0) {
+ $titletouse = COM_truncate($title, $trim, '...');
+ } else {
+ $titletouse = $title;
+ }
+ if ($title != $titletouse) {
+ $attr = array('title' => htmlspecialchars($title));
+ } else {
+ $attr = array();
+ }
+ $astaticpage = str_replace('$', '$', $titletouse);
+ $astaticpage = str_replace(' ', ' ', $astaticpage);
+
+ $newstaticpages[$A['sp_date']] = COM_createLink($astaticpage, $url, $attr);
+ }
+ }
+
+ return $newstaticpages;
+}
+
+/**
* Return new Static Pages for the What's New block
*
* @return string HTML list of new staticpages
diff -r e37edd00d3d6 -r ef58539f9cb8 public_html/admin/configuration_validation.php
--- a/public_html/admin/configuration_validation.php Sat May 25 22:00:10 2013 -0400
+++ b/public_html/admin/configuration_validation.php Thu Jun 13 15:17:54 2013 -0400
@@ -199,6 +199,10 @@
$_CONF_VALIDATE['Core']['aftersave_story'] = array(
'rule' => array('inList', array('admin', 'home', 'list', 'item'), true)
);
+$_CONF_VALIDATE['Core']['related_topics'] = array(
+ 'rule' => array('inList', array(0, 1, 2), false)
+);
+$_CONF_VALIDATE['Core']['related_topics_max'] = array('rule' => 'numeric');
/* Subgroup Stories and Trackback, Tab Trackback */
$_CONF_VALIDATE['Core']['trackback_enabled'] = array('rule' => 'boolean');
diff -r e37edd00d3d6 -r ef58539f9cb8 public_html/admin/install/config-install.php
--- a/public_html/admin/install/config-install.php Sat May 25 22:00:10 2013 -0400
+++ b/public_html/admin/install/config-install.php Thu Jun 13 15:17:54 2013 -0400
@@ -140,6 +140,8 @@
$c->add('hide_main_page_navigation',0,'select',1,7,0,1310,TRUE, $me, 7);
$c->add('onlyrootfeatures',0,'select',1,7,0,1320,TRUE, $me, 7);
$c->add('aftersave_story','list','select',1,7,9,1330,TRUE, $me, 7);
+ $c->add('related_topics',1,'select',1,7,32,1340,TRUE, $me, 7);
+ $c->add('related_topics_max',6,'text',1,7,NULL,1350,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);
@@ -426,6 +428,8 @@
$c->add('autotag_permissions_story', array(2, 2, 2, 2), '@select', 7, 41, 28, 1870, TRUE, $me, 37);
$c->add('autotag_permissions_user', array(2, 2, 2, 2), '@select', 7, 41, 28, 1880, TRUE, $me, 37);
$c->add('autotag_permissions_topic', array(2, 2, 2, 2), '@select', 7, 41, 28, 1890, TRUE, $me, 37);
+ $c->add('autotag_permissions_related_topics', array(2, 2, 0, 0), '@select', 7, 41, 28, 1900, TRUE, $me, 37);
+ $c->add('autotag_permissions_related_items', array(2, 2, 0, 0), '@select', 7, 41, 28, 1910, TRUE, $me, 37);
$c->add('tab_webservices', NULL, 'tab', 7, 40, NULL, 0, TRUE, $me, 40);
$c->add('fs_webservices', NULL, 'fieldset', 7, 40, NULL, 0, TRUE, $me, 40);
diff -r e37edd00d3d6 -r ef58539f9cb8 public_html/docs/english/config.html
--- a/public_html/docs/english/config.html Sat May 25 22:00:10 2013 -0400
+++ b/public_html/docs/english/config.html Thu Jun 13 15:17:54 2013 -0400
@@ -455,6 +455,16 @@
<strong>Note:</strong> This option is ignored for story submissions. Editing
a story submission will always send you back to the submission queue (i.e.
"Admin Home" aka Command & Control).</td></tr>
+<tr>
+ <td valign="top"><a name="desc_related_topics">related_topics</a></td>
+ <td valign="top">1</td>
+ <td valign="top">Set to display related topics on just article pages, article and topic pages, or no pages at all.</td></tr>
+<tr>
+<tr>
+ <td valign="top"><a name="desc_related_topics_max">related_topics_max</a></td>
+ <td valign="top">6</td>
+ <td valign="top">Maximum numbers of topics to display for Related Topics.</td></tr>
+<tr>
</table>
<h3><a name="stories_trackback">Stories and Trackback: Trackback</a></h3>
diff -r e37edd00d3d6 -r ef58539f9cb8 public_html/docs/english/theme.html
--- a/public_html/docs/english/theme.html Sat May 25 22:00:10 2013 -0400
+++ b/public_html/docs/english/theme.html Thu Jun 13 15:17:54 2013 -0400
@@ -200,6 +200,16 @@
featured and archived stories.</li>
</ol>
+<h2><a name="changes">Theme changes in Geeklog 2.0.1</a></h2>
+
+<ul>
+<li>Added the template varialbe {related_topics} to <tt>featuredstorytext.thtml</tt> and <tt>storytext.thtml</tt></li>li>
+<li>Removed <tt>topicoption.thtml</tt> and <tt>topicoption_off.thtml</tt>.
+ Added <tt>topicnavigation.thtml</tt> which uses blocks to reduce the number of template files.</li>
+<li>Renamed <tt>page_navigation.thtml</tt> to <tt>pagenavigation.thtml</tt>
+ to be consistent.</li>
+</ul>
+
<h2><a name="changes">Theme changes in Geeklog 2.0.0</a></h2>
<p>As of Geeklog 2.0.0 there are now 2 theme engines in Geeklog. Currently the themes Demin and Modern Curve use the 2.0.0 theme engine. The Professional and Professional CSS themes use the 1.8.1 engine.
diff -r e37edd00d3d6 -r ef58539f9cb8 public_html/docs/japanese/config.html
--- a/public_html/docs/japanese/config.html Sat May 25 22:00:10 2013 -0400
+++ b/public_html/docs/japanese/config.html Thu Jun 13 15:17:54 2013 -0400
@@ -400,6 +400,16 @@
<li>管çç»é¢TOPã表示ãã(admin): 管çç»é¢ã表示ãã¾ãã</li>
</ul>
<strong>注æ:</strong> è¨äºãæ稿ããå ´åããã®ãªãã·ã§ã³ã¯ç¡è¦ããã¾ããæ¿èªå¾
ã¡ã®è¨äºãç·¨éããã¨ã常ã«æ¿èªå¾
ã¡ä¸è¦§(ã¤ã¾ãã管çç»é¢)ã¸æ»ãã¾ãã</td></tr>
+<tr>
+ <td valign="top"><a name="desc_related_topics">related_topics</a></td>
+ <td valign="top">1</td>
+ <td valign="top">Set to display related topics on just article pages, article and topic pages, or no pages at all.</td></tr>
+<tr>
+<tr>
+ <td valign="top"><a name="desc_related_topics_max">related_topics_max</a></td>
+ <td valign="top">6</td>
+ <td valign="top">Maximum numbers of topics to display for Related Topics.</td></tr>
+<tr>
</table>
<h3><a name="stories_trackback">è¨äºã¨ãã©ãã¯ããã¯: ãã©ãã¯ããã¯</a></h3>
diff -r e37edd00d3d6 -r ef58539f9cb8 public_html/layout/denim/featuredstorytext.thtml
--- a/public_html/layout/denim/featuredstorytext.thtml Sat May 25 22:00:10 2013 -0400
+++ b/public_html/layout/denim/featuredstorytext.thtml Thu Jun 13 15:17:54 2013 -0400
@@ -1,5 +1,4 @@
-
-<!-- featuredstorytext.thtml { -->
+{# begin {templatelocation} #}
<div class="storytext featuredstorytext">
<h2 class="story_title">{start_storylink_anchortag}{story_title}{end_storylink_anchortag}</h2>
@@ -18,6 +17,8 @@
<span class="story_image">{story_anchortag_and_image_no_align}</span>
{story_text_no_br}
</div>
+
+ {related_topics}
<ul class="story_navi">
More information about the geeklog-cvs
mailing list