Commit a5734ab8 authored by lfagundes's avatar lfagundes

[ADD] freetag browse through related tags with morcego

parent b4d37d85
......@@ -4523,6 +4523,7 @@ tiki/templates/tiki-batch_upload.tpl -text
tiki/templates/tiki-blog_post.tpl -text
tiki/templates/tiki-bot_bar.tpl -text
tiki/templates/tiki-browse_categories.tpl -text
tiki/templates/tiki-browse_freetags.tpl -text
tiki/templates/tiki-browse_gallery.tpl -text
tiki/templates/tiki-browse_image.tpl -text
tiki/templates/tiki-calendar.tpl -text
......@@ -4864,6 +4865,7 @@ tiki/tiki-blog_rankings.php -text
tiki/tiki-blog_rss.php -text
tiki/tiki-blogs_rss.php -text
tiki/tiki-browse_categories.php -text
tiki/tiki-browse_freetags.php -text
tiki/tiki-browse_gallery.php -text
tiki/tiki-browse_image.php -text
tiki/tiki-calendar.php -text
......@@ -4940,6 +4942,7 @@ tiki/tiki-forum_rss.php -text
tiki/tiki-forums.php -text
tiki/tiki-forums_reported.php -text
tiki/tiki-forums_rss.php -text
tiki/tiki-freetag3d_xmlrpc.php -text
tiki/tiki-freetag_list_objects.php -text
tiki/tiki-friends.php -text
tiki/tiki-g-admin_activities.php -text
......
{* $Header: /cvsroot/tikiwiki/tiki/templates/tiki-browse_freetags.tpl,v 1.1 2005-12-12 22:45:06 lfagundes Exp $ *}
<h1><a class="pagetitle" href="tiki-freetag_list_objects.php">{tr}Tags{/tr}</a></h1>
{tr}Show objects tagged with{/tr} <b>{$tag}</b> {tr}in{/tr}:<br />
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}">{tr}All{/tr}</a>
{if $feature_wiki eq 'y'}
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=wiki+page">{if $type eq 'wiki page'}<span class="highlight">{/if}{tr}Wiki pages{/tr}{if $type eq 'wiki page'}</span>{/if}</a>
{/if}
{if $feature_galleries eq 'y'}
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=image+gallery">{if $type eq 'image gallery'}<span class="highlight">{/if}{tr}Image galleries{/tr}{if $type eq 'image gallery'}</span>{/if}</a>
{/if}
{if $feature_galleries eq 'y'}
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=image">{if $type eq 'image'}<span class="highlight">{/if}{tr}Images{/tr}{if $type eq image}</span>{/if}</a>
{/if}
{if $feature_file_galleries eq 'y'}
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=file+gallery">{if $type eq 'file gallery'}<span class="highlight">{/if}{tr}File galleries{/tr}{if $type eq 'file gallery'}</span>{/if}</a>
{/if}
{if $feature_blogs eq 'y'}
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=blog+post">{if $type eq 'blog'}<span class="highlight">{/if}{tr}Blogs{/tr}{if $type eq 'blog'}</span>{/if}</a>
{/if}
{if $feature_trackers eq 'y'}
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=tracker">{if $type eq 'tracker'}<span class="highlight">{/if}{tr}Trackers{/tr}{if $type eq 'tracker'}</span>{/if}</a>
{/if}<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=trackerItem">{if $type eq 'trackerItem'}<span class="highlight">{/if}{tr}Trackers Items{/tr}{if $type eq 'trackerItem'}</span>{/if}</a>
{if $feature_quizzes eq 'y'}
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=quiz">{if $type eq 'quiz'}<span class="highlight">{/if}{tr}Quizzes{/tr}{if $type eq 'quiz'}</span>{/if}</a>
{/if}
{if $feature_polls eq 'y'}
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=poll">{if $type eq 'poll'}<span class="highlight">{/if}{tr}Polls{/tr}{if $type eq 'poll'}</span>{/if}</a>
{/if}
{if $feature_surveys eq 'y'}
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=survey">{if $type eq 'survey'}<span class="highlight">{/if}{tr}Surveys{/tr}{if $type eq 'survey'}</span>{/if}</a>
{/if}
{if $feature_directory eq 'y'}
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=directory">{if $type eq 'directory'}<span class="highlight">{/if}{tr}Directory{/tr}{if $type eq 'directory'}</span>{/if}</a>
{/if}
{if $feature_faqs eq 'y'}
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=faq">{if $type eq 'faq'}<span class="highlight">{/if}{tr}FAQs{/tr}{if $type eq 'faq'}</span>{/if}</a>
{/if}
{if $feature_sheet eq 'y'}
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=sheet">{if $type eq 'sheet'}<span class="highlight">{/if}{tr}Sheets{/tr}{if $type eq 'sheet'}</span>{/if}</a>
{/if}
{if $feature_articles eq 'y'}
<a class="linkbut" href="tiki-freetag_list_objects.php?tag={$tag}&amp;type=article">{if $type eq 'article'}<span class="highlight">{/if}{tr}Articles{/tr}{if $type eq 'article'}</span>{/if}</a>
{/if}
<applet codebase="./lib/wiki3d" archive="morcego-0.4.0.jar" code="br.arca.morcego.Morcego" width="{$wiki_3d_width}" height="{$wiki_3d_height}">
<param name="serverUrl" value="{$base_url}/tiki-freetag3d_xmlrpc.php">
<param name="startNode" value="{$tag}">
<param name="windowWidth" value="{$wiki_3d_width}">
<param name="windowHeight" value="{$wiki_3d_height}">
<param name="viewWidth" value="{$wiki_3d_width}">
<param name="viewHeight" value="{$wiki_3d_height}">
<param name="navigationDepth" value="{$wiki_3d_navigation_depth}">
<param name="feedAnimationInterval" value="{$wiki_3d_feed_animation_interval}">
<param name="controlWindowName" value="tiki">
<param name="showArcaLogo" value="false">
<param name="showMorcegoLogo" value="false">
<param name="loadPageOnCenter" value="{$wiki_3d_autoload|default:"true"}">
<param name="cameraDistance" value="{$wiki_3d_camera_distance|default:"200"}">
<param name="adjustCameraPosition" value="{$wiki_3d_adjust_camera|default:"true"}">
<param name="fieldOfView" value="{$wiki_3d_fov|default:"250"}">
<param name="nodeSize" value="{$wiki_3d_node_size|default:"30"}">
<param name="textSize" value="{$wiki_3d_text_size|default:"40"}">
<param name="frictionConstant" value="{$wiki_3d_friction_constant|default:"0.4f"}">
<param name="elasticConstant" value="{$wiki_3d_elastic_constant|default:"0.5f"}">
<param name="eletrostaticConstant" value="{$wiki_3d_eletrostatic_constant|default:"1000f"}">
<param name="springSize" value="{$wiki_3d_spring_size|default:"100"}">
<param name="nodeMass" value="{$wiki_3d_node_mass|default:"5"}">
<param name="nodeCharge" value="{$wiki_3d_node_charde|default:"1"}">
</applet>
<h3>{$cantobjects} {tr}results found{/tr}</h3>
{if $cantobjects > 0}
<table class="normal">
{cycle values="odd,even" print=false}
{section name=ix loop=$objects}
<tr class="{cycle}" >
<td>{tr}{$objects[ix].type|replace:"wiki page":"Wiki"|replace:"article":"Article"|regex_replace:"/tracker [0-9]*/":"tracker item"}{/tr}</td>
<td><a href="{$objects[ix].href}" class="catname">{$objects[ix].name}</a></td>
<td>{$objects[ix].description}&nbsp;</td>
</tr>
{/section}
</table>
<br />
<div align="center">
<div class="mini">
{if $prev_offset >= 0}
[<a class="prevnext" href="tiki-freetag_list_objects.php?find={$find}&amp;type={$type}&amp;offset={$prev_offset}">{tr}prev{/tr}</a>]&nbsp;
{/if}
{tr}Page{/tr}: {$actual_page}/{$cant_pages}
{if $next_offset >= 0}
&nbsp;[<a class="prevnext" href="tiki-freetag_list_objects.php?find={$find}&amp;type={$type}&amp;offset={$next_offset}">{tr}next{/tr}</a>]
{/if}
{if $direct_pagination eq 'y'}
<br />
{section loop=$cant_pages name=foo}
{assign var=selector_offset value=$smarty.section.foo.index|times:$maxRecords}
<a class="prevnext" href="tiki-freetag_list_objects.php?find={$find}&amp;type={$type}&amp;offset={$selector_offset}">
{$smarty.section.foo.index_next}
</a>&nbsp;
{/section}
{/if}
</div>
</div>
{/if}
<?php
// $Header: /cvsroot/tikiwiki/tiki/tiki-browse_freetags.php,v 1.1 2005-12-12 22:45:05 lfagundes Exp $
// Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
//
// $Header: /cvsroot/tikiwiki/tiki/tiki-browse_freetags.php,v 1.1 2005-12-12 22:45:05 lfagundes Exp $
//
// Initialization
require_once ('tiki-setup.php');
include_once ('lib/freetag/freetaglib.php');
if ($feature_freetags != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_freetags");
$smarty->display("error.tpl");
die;
}
if (!isset($_REQUEST['tag'])) {
header('Location: tiki-freetag_list_objects.php');
exit;
}
if (!isset($_REQUEST["sort_mode"])) {
$sort_mode = 'name_asc';
} else {
$sort_mode = $_REQUEST["sort_mode"];
}
$smarty->assign_by_ref('sort_mode', $sort_mode);
if (!isset($_REQUEST["offset"])) {
$offset = 0;
} else {
$offset = $_REQUEST["offset"];
}
$smarty->assign_by_ref('offset', $offset);
if (!isset($_REQUEST["type"])) {
$type = '';
} else {
$type = $_REQUEST["type"];
}
$smarty->assign('type', $type);
if (isset($_REQUEST["user_only"]) && $_REQUEST["user_only"] == 'on') {
$view_user = $user;
$smarty->assign('user_only', 'on');
} else {
$view_user = '';
$smarty->assign('user_only', 'off');
}
$smarty->assign('tag', $_REQUEST['tag']);
$objects = $freetaglib->get_objects_with_tag($_REQUEST['tag'], $type, $view_user, $offset, $maxRecords); //, $sort_mode, $find);
$smarty->assign_by_ref('objects', $objects["data"]);
$smarty->assign_by_ref('cantobjects', $objects["cant"]);
$cant_pages = ceil($objects["cant"] / $maxRecords);
$smarty->assign_by_ref('cant_pages', $cant_pages);
$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
if ($objects["cant"] > ($offset + $maxRecords)) {
$smarty->assign('next_offset', $offset + $maxRecords);
} else {
$smarty->assign('next_offset', -1);
}
// If offset is > 0 then prev_offset
if ($offset > 0) {
$smarty->assign('prev_offset', $offset - $maxRecords);
} else {
$smarty->assign('prev_offset', -1);
}
$base_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$base_url = preg_replace('/\/tiki-browse_freetags.php.+$/','',$base_url);
$smarty->assign('base_url',$base_url);
$smarty->assign('related_tags',$freetaglib->similar_tags($_REQUEST['tag'],5));
$section = 'freetags';
include_once ('tiki-section_options.php');
ask_ticket('browse-freetags');
// Display the template
$smarty->assign('mid', 'tiki-browse_freetags.tpl');
$smarty->display("tiki.tpl");
?>
<?php
// $HEADER$
include_once("lib/init/initlib.php");
require_once('db/tiki-db.php');
require_once('lib/tikilib.php');
require_once('lib/userslib.php');
require_once("XML/Server.php");
require_once("lib/freetag/freetaglib.php");
$map = array ("getSubGraph" => array( "function" => "getSubGraph" ) );
$server = new XML_RPC_Server( $map );
function getSubGraph($params) {
global $freetaglib;
$nodeName = $params->getParam(0); $nodeName = $nodeName->scalarVal();
$depth = $params->getParam(1); $depth = $depth->scalarVal();
$nodes = array();
$passed = array($nodeName => true);
$queue = array($nodeName);
$i = 0;
while ($i <= $depth && sizeof($queue) > 0) {
$nextQueue = array();
foreach ($queue as $nodeName) {
$similar = $freetaglib->similar_tags($nodeName,5);
$neighbours = array();
foreach ($similar as $tag) {
$neighbours[] = $tag['tag'];
}
$temp_max = sizeof($neighbours);
for ($j = 0; $j < $temp_max; $j++) {
if (!isset($passed[$neighbours[$j]])) {
$nextQueue[] = $neighbours[$j];
$passed[$neighbours[$j]] = true;
}
$neighbours[$j] = new XML_RPC_Value($neighbours[$j]);
}
$node = array();
$base_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$base_url = preg_replace('/\/tiki-freetag3d_xmlrpc.php.*$/','',$base_url);
$actionUrl = "javascript:carregaLista('$nodeName');";
$color = '#0000FF';
$node['neighbours'] = new XML_RPC_Value($neighbours, "array");
if (!empty($color)) {
$node['color'] = new XML_RPC_Value($color, "string");
}
$node['actionUrl'] = new XML_RPC_Value($actionUrl, "string");
$nodes[$nodeName] = new XML_RPC_Value($node, "struct");
}
$i++;
$queue = $nextQueue;
}
$response = array("graph" => new XML_RPC_Value($nodes, "struct"));
return new XML_RPC_Response(new XML_RPC_Value($response, "struct"));
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment