Commit ce4e2e42 authored by sylvieg's avatar sylvieg

[FIX]keep blogId filter when cliking on freetag from module most popular freetag

parent a2be2a61
......@@ -200,6 +200,8 @@ class FreetagLib extends ObjectLib
, $sort_mode = 'name_asc'
, $find = ''
, $broaden = 'n'
, $objectId = null
)
{
......@@ -319,14 +321,15 @@ class FreetagLib extends ObjectLib
$permMap = TikiLib::lib('object')->map_object_type_to_permission();
while ($row = $result->fetchRow()) {
$ok = false;
if ($tiki_p_admin == 'y') {
$ok = true;
} elseif ($row['type'] == 'blog post') {
if ($row['type'] == 'blog post') {
$bloglib = TikiLib::lib('blog');
$post_info = $bloglib->get_post($row['itemId']);
if ($this->user_has_perm_on_object($user, $post_info['blogId'], 'blog', 'tiki_p_read_blog')) {
if (!empty($objectId) && $objectId != $post_info['blogId']) {
} elseif ($tiki_p_admin == 'y' && $this->user_has_perm_on_object($user, $post_info['blogId'], 'blog', 'tiki_p_read_blog')) {
$ok = true;
}
} elseif ($tiki_p_admin == 'y') {
$ok = true;
} elseif ($this->user_has_perm_on_object($user, $row['itemId'], $row['type'], $permMap[$row['type']])) {
$ok = true;
}
......
......@@ -4,7 +4,7 @@
{foreach from=$most_popular_tags item=tag}
{if ($type ne 'cloud')}<li class="freetag">{/if}
{capture name=tagurl}{if (strstr($tag.tag, ' '))}"{$tag.tag}"{else}{$tag.tag}{/if}{/capture}
<a class="freetag_{$tag.size}" title="{tr}List everything tagged{/tr} {$tag.tag|escape}" href="tiki-browse_freetags.php?tag={$smarty.capture.tagurl|escape:'url'}{if !empty($module_params.where)}&amp;type={$module_params.where|escape:'url'}{/if}">{$tag.tag|escape}</a>
<a class="freetag_{$tag.size}" title="{tr}List everything tagged{/tr} {$tag.tag|escape}" href="tiki-browse_freetags.php?tag={$smarty.capture.tagurl|escape:'url'}{if !empty($module_params.where)}&amp;type={$module_params.where|escape:'url'}{/if}{if !empty($module_params.objectId)}&amp;objectId={$module_params.objectId|escape:'url'}{/if}">{$tag.tag|escape}</a>
&nbsp;
{if ($type ne 'cloud')}</li>{/if}
{/foreach}
......
......@@ -101,7 +101,7 @@
{assign var=thisbroaden value=''}
{/if}
{button _text="{tr}All{/tr}" _class=$thisclass href="tiki-browse_freetags.php?tag=$tagString$thisbroaden"}
{button _text="{tr}All{/tr}" _class=$thisclass href="tiki-browse_freetags.php?tag=$tagString$thisbroaden&amp;type="}
{foreach item=objectType from=$objects_with_freetags}
{foreach item=sect key=key from=$sections_enabled}
......@@ -152,15 +152,27 @@
{/if}
{/foreach}
{/foreach}
{if !empty($blogs)}
<div id="blogs"{if $type ne 'blog post'} style="visibility:hidden"{/if}>
<select name="objectId" onchange="this.form.submit();">
<option value="">--{tr}All blogs{/tr}--</option>
{foreach item=blog from=$blogs}
<option value="{$blog.blogId|escape}"{if $blog.blogId eq $objectId} selected="selected"{/if}>{$blog.title|escape}</option>
{/foreach}
</select>
</div>
{/if}
<input type="text" name="find" value="{$find}" />
<input type="hidden" name="old_type" value="{$type|escape}" />
<input type="text" name="find" value="{$find|escape}" />
<input type="submit" value="{tr}Filter{/tr}" />
{/capture}
</form>
{if $cpt > 1}
<div class="freetagsbrowse">{$smarty.capture.browse}</div>{/if}
</form>
<div class="freetagresult">
{if $tagString}
{if $cantobjects == 0}
......
......@@ -57,7 +57,7 @@ if (!isset($_REQUEST["offset"])) {
}
$smarty->assign_by_ref('offset', $offset);
if (!isset($_REQUEST["type"])) {
$type = '';
$type = isset($_REQUEST['old_type'])?$_REQUEST['old_type']: '';
} else {
$type = $_REQUEST["type"];
}
......@@ -100,7 +100,18 @@ if (empty($_REQUEST['tsort_mode'])) {
$tsort_mode = $_REQUEST['sort_mode'];
$smarty->assign_by_ref('tsort_mode', $tsort_mode);
}
$most_popular_tags = $freetaglib->get_most_popular_tags('', 0, $maxPopular, $tsort_mode);
if (!empty($_REQUEST['objectId'])) {
$objectId = $_REQUEST['objectId'];
} else {
$objectId = null;
}
$smarty->assign_by_ref('objectId', $objectId);
if ($prefs['feature_blogs'] == 'y' && $type == 'blog post') {
$blogs = TikiLib::lib('blog')->list_blogs();
$smarty->assign('blogs', $blogs['data']);
}
$most_popular_tags = $freetaglib->get_most_popular_tags('', 0, $maxPopular, $tsort_mode, $objectId);
if (!empty($prefs['freetags_cloud_colors'])) {
$colors = explode(',', $prefs['freetags_cloud_colors']);
$prev = '';
......@@ -121,7 +132,7 @@ if ($broaden == 'last') {
$tagArray[count($tagArray) - 1]
);
}
$objects = $freetaglib->get_objects_with_tag_combo($tagArray, $type, $view_user, $offset, $maxRecords, $sort_mode, $find, $broaden);
$objects = $freetaglib->get_objects_with_tag_combo($tagArray, $type, $view_user, $offset, $maxRecords, $sort_mode, $find, $broaden, $objectId);
$smarty->assign_by_ref('objects', $objects["data"]);
$smarty->assign_by_ref('cantobjects', $objects["cant"]);
......
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