Interface fix: add tags cloud from all users into add bookmark window
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@182 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
013ba82313
commit
ef4fd0ad27
1 changed files with 51 additions and 30 deletions
|
@ -1,35 +1,61 @@
|
|||
<?php
|
||||
/***************************************************************************
|
||||
Copyright (C) 2005 - 2006 Scuttle project
|
||||
http://sourceforge.net/projects/scuttle/
|
||||
http://scuttle.org/
|
||||
Copyright (C) 2005 - 2006 Scuttle project
|
||||
http://sourceforge.net/projects/scuttle/
|
||||
http://scuttle.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
|
||||
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
||||
|
||||
$logged_on_userid = $userservice->getCurrentUserId();
|
||||
|
||||
//tags from current user
|
||||
$userPopularTags =& $b2tservice->getPopularTags($logged_on_userid, 25, $logged_on_userid);
|
||||
$userPopularTagsCloud =& $b2tservice->tagCloud($userPopularTags, 5, 90, 175);
|
||||
$userPopularTagsCount = count($userPopularTags);
|
||||
|
||||
if ($userPopularTagsCount > 0) {
|
||||
?>
|
||||
//tags from all users
|
||||
$allPopularTags =& $b2tservice->getPopularTags(null, 5, $logged_on_userid);
|
||||
$allPopularTagsCloud =& $b2tservice->tagCloud($allPopularTags, 5, 90, 175);
|
||||
$allPopularTagsCount = count($allPopularTags);
|
||||
|
||||
|
||||
// function printing the cloud
|
||||
function writeTagsProposition($tagsCloud, $title) {
|
||||
echo 'document.write(\'<div class="collapsible">\');';
|
||||
echo 'document.write(\'<h3>'. $title .'<\/h3>\');';
|
||||
echo 'document.write(\'<p id="popularTags" class="tags">\');';
|
||||
|
||||
$taglist = '';
|
||||
foreach(array_keys($tagsCloud) as $key) {
|
||||
$row =& $tagsCloud[$key];
|
||||
$entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']);
|
||||
$taglist .= '<span title="'. $row['bCount'] .' '. $entries .'" style="font-size:'. $row['size'] .'" onclick="addTag(this)">'. filter($row['tag']) .'<\/span> ';
|
||||
}
|
||||
|
||||
echo 'document.write(\''. $taglist .'\');';
|
||||
echo 'document.write(\'<\/p>\');';
|
||||
echo 'document.write(\'<\/div>\');';
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($allPopularTagsCount > 0 || $userPopularTagsCount > 0 ) { ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
Array.prototype.contains = function (ele) {
|
||||
|
@ -97,22 +123,17 @@ function addTag(ele) {
|
|||
document.getElementById('tags').focus();
|
||||
}
|
||||
|
||||
document.write('<div class="collapsible">');
|
||||
document.write('<h3><?php echo T_('Popular Tags'); ?><\/h3>');
|
||||
document.write('<p id="popularTags" class="tags">');
|
||||
|
||||
<?php
|
||||
$taglist = '';
|
||||
foreach(array_keys($userPopularTagsCloud) as $key) {
|
||||
$row =& $userPopularTagsCloud[$key];
|
||||
$entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']);
|
||||
$taglist .= '<span title="'. $row['bCount'] .' '. $entries .'" style="font-size:'. $row['size'] .'" onclick="addTag(this)">'. filter($row['tag']) .'<\/span> ';
|
||||
if( $userPopularTagsCount > 0) {
|
||||
writeTagsProposition($userPopularTagsCloud, T_('Popular Tags'));
|
||||
}
|
||||
if( $allPopularTagsCount > 0) {
|
||||
writeTagsProposition($allPopularTagsCloud, T_('Popular Tags From All Users'));
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
document.write('<?php echo $taglist ?>');
|
||||
document.write('<\/p>');
|
||||
document.write('<\/div>');
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
|
Loading…
Reference in a new issue