aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-02 21:20:49 +0000
committernickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-02 21:20:49 +0000
commit2c5c43f9a632b05d5557f980e83bcecdd3f1332a (patch)
tree6445d34a1ad106e069b2ad7e479e5ad35833585c
parent81decf8b30a6814f7e0514fdacbadb1368fe306d (diff)
downloadelgg-2c5c43f9a632b05d5557f980e83bcecdd3f1332a.tar.gz
elgg-2c5c43f9a632b05d5557f980e83bcecdd3f1332a.tar.bz2
Moving new Site Tags functionality out of Tagcloud plugin and into core.
git-svn-id: http://code.elgg.org/elgg/trunk@6332 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/tags.php24
-rw-r--r--languages/en.php1
-rw-r--r--mod/tagcloud/start.php16
-rw-r--r--mod/tagcloud/views/default/tagcloud/extend.php5
-rw-r--r--views/default/output/tagcloud.php14
5 files changed, 35 insertions, 25 deletions
diff --git a/engine/lib/tags.php b/engine/lib/tags.php
index 8d67a89bb..ce1fbbf93 100644
--- a/engine/lib/tags.php
+++ b/engine/lib/tags.php
@@ -357,9 +357,12 @@ function display_tagcloud($threshold = 1, $limit = 10, $metadata_name = "", $ent
elgg_deprecated_notice('display_cloud() was deprecated by elgg_view_tagcloud()!', 1.8);
- return elgg_view("output/tagcloud",array('value' => get_tags($threshold, $limit, $metadata_name, $entity_type, $entity_subtype, $owner_guid, $site_guid, $start_ts, $end_ts),
- 'type' => $entity_type,
- 'subtype' => $entity_subtype));
+ $tags = get_tags($threshold, $limit, $metadata_name, $entity_type, $entity_subtype, $owner_guid, $site_guid, $start_ts, $end_ts);
+ return elgg_view('output/tagcloud', array(
+ 'value' => $tags,
+ 'type' => $entity_type,
+ 'subtype' => $entity_subtype,
+ ));
}
/**
@@ -402,3 +405,18 @@ function elgg_get_registered_tag_metadata_names() {
// register the standard tags metadata name
elgg_register_tag_metadata_name('tags');
+
+register_page_handler('tags', 'elgg_tagcloud_page_handler');
+function elgg_tagcloud_page_handler($page) {
+ global $CONFIG;
+
+ switch ($page[0]) {
+ default:
+ $title = elgg_view_title(elgg_echo('tags:site_cloud'));
+ $tags = display_tagcloud(0, 100, 'tags');
+ $body = elgg_view_layout('one_column_with_sidebar', $title . $tags);
+
+ page_draw(elgg_echo('tags:site_cloud'), $body);
+ break;
+ }
+}
diff --git a/languages/en.php b/languages/en.php
index 486c6acab..6a74c6e76 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -944,6 +944,7 @@ You cannot reply to this email.",
*/
'tag_names:tags' => 'Tags',
+ 'tags:site_cloud' => 'Site Tag Cloud',
/**
* Languages according to ISO 639-1
diff --git a/mod/tagcloud/start.php b/mod/tagcloud/start.php
index 11d970c25..a2e4f5143 100644
--- a/mod/tagcloud/start.php
+++ b/mod/tagcloud/start.php
@@ -6,23 +6,7 @@
function tagcloud_init() {
add_widget_type('tagcloud', elgg_echo('tagcloud:widget:title'), elgg_echo('tagcloud:widget:description'));
-
elgg_extend_view('css','tagcloud/css');
- register_page_handler('tagcloud', 'tagcloud_page_handler');
-}
-
-function tagcloud_page_handler($page) {
- global $CONFIG;
-
- switch ($page[0]) {
- default:
- $title = elgg_view_title(elgg_echo('tagcloud:site:title'));
- $tags = display_tagcloud(0, 100, 'tags');
- $body = elgg_view_layout('one_column_with_sidebar', $title . $tags);
-
- page_draw(elgg_echo('tagcloud:site:title'), $body);
- break;
- }
}
register_elgg_event_handler('init', 'system', 'tagcloud_init');
diff --git a/mod/tagcloud/views/default/tagcloud/extend.php b/mod/tagcloud/views/default/tagcloud/extend.php
deleted file mode 100644
index 4ab144d18..000000000
--- a/mod/tagcloud/views/default/tagcloud/extend.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-echo '<p class="tags">';
-echo "<a href=\"{$vars['url']}pg/tagcloud\">All site tags</a>";
-echo '</p>'; \ No newline at end of file
diff --git a/views/default/output/tagcloud.php b/views/default/output/tagcloud.php
index ced3f2f30..6e78fc6f0 100644
--- a/views/default/output/tagcloud.php
+++ b/views/default/output/tagcloud.php
@@ -14,6 +14,8 @@
* @uses $vars['subtype'] Entity subtype
*/
+$context = get_context();
+
if (!empty($vars['subtype'])) {
$subtype = "&entity_subtype=" . urlencode($vars['subtype']);
} else {
@@ -34,7 +36,11 @@ if (!empty($vars['tagcloud']) && is_array($vars['tagcloud'])) {
$cloud = "";
$max = 0;
- $cloud .= '<h3>'.elgg_echo('tagcloud').'</h3>';
+ if ($context != 'tags') {
+ $title = elgg_echo('tagcloud');
+ $cloud .= "<h3>$title</h3>";
+ }
+
$cloud .= '<div class="tagcloud">';
foreach($vars['tagcloud'] as $tag) {
@@ -59,6 +65,12 @@ if (!empty($vars['tagcloud']) && is_array($vars['tagcloud'])) {
$cloud .= "$list</div>";
+ if ($context != 'tags') {
+ $cloud .= '<p class="tags">';
+ $cloud .= "<a href=\"{$vars['url']}pg/tags\">All site tags</a>";
+ $cloud .= '</p>';
+ }
+
$cloud .= elgg_view('tagcloud/extend');
echo $cloud;