give bookmarks.tpl.php nice looking generated html code
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@749 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
a62dfd6d70
commit
fbf28d0753
1 changed files with 87 additions and 44 deletions
|
@ -1,14 +1,30 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Show a list of bookmarks.
|
||||||
|
*
|
||||||
|
* SemanticScuttle - your social bookmark manager.
|
||||||
|
*
|
||||||
|
* PHP version 5.
|
||||||
|
*
|
||||||
|
* @category Bookmarking
|
||||||
|
* @package SemanticScuttle
|
||||||
|
* @subcategory Templates
|
||||||
|
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
|
||||||
|
* @author Christian Weiske <cweiske@cweiske.de>
|
||||||
|
* @author Eric Dane <ericdane@users.sourceforge.net>
|
||||||
|
* @license GPL http://www.gnu.org/licenses/gpl.html
|
||||||
|
* @link http://sourceforge.net/projects/semanticscuttle
|
||||||
|
*/
|
||||||
|
|
||||||
/* Service creation: only useful services are created */
|
/* Service creation: only useful services are created */
|
||||||
$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
|
$bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark');
|
||||||
$tagservice =SemanticScuttle_Service_Factory::get('Tag');
|
$tagservice = SemanticScuttle_Service_Factory::get('Tag');
|
||||||
$cdservice =SemanticScuttle_Service_Factory::get('CommonDescription');
|
$cdservice = SemanticScuttle_Service_Factory::get('CommonDescription');
|
||||||
|
|
||||||
|
|
||||||
$pageName = isset($pageName)?$pageName:"";
|
$pageName = isset($pageName) ? $pageName : '';
|
||||||
$user = isset($user)?$user:"";
|
$user = isset($user) ? $user : '';
|
||||||
$currenttag = isset($currenttag)?$currenttag:"";
|
$currenttag = isset($currenttag) ? $currenttag : '';
|
||||||
|
|
||||||
|
|
||||||
$this->includeTemplate($GLOBALS['top_include']);
|
$this->includeTemplate($GLOBALS['top_include']);
|
||||||
|
@ -132,23 +148,23 @@ default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<a href="?sort=<?php echo $dateSort ?>"><?php echo T_("Date").$dateArrow; ?></a>
|
<a href="?sort=<?php echo $dateSort ?>"><?php echo T_("Date").$dateArrow; ?></a>
|
||||||
<span>/</span>
|
<span>/</span>
|
||||||
<a href="?sort=<?php echo $titleSort ?>"><?php echo T_("Title").$titleArrow; ?></a>
|
<a href="?sort=<?php echo $titleSort ?>"><?php echo T_("Title").$titleArrow; ?></a>
|
||||||
<span>/</span>
|
<span>/</span>
|
||||||
<?php if ($GLOBALS['enableVoting']) { ?>
|
<?php if ($GLOBALS['enableVoting']) { ?>
|
||||||
<a href="?sort=<?php echo $votingSort ?>"><?php echo T_("Voting").$votingArrow; ?></a>
|
<a href="?sort=<?php echo $votingSort ?>"><?php echo T_("Voting").$votingArrow; ?></a>
|
||||||
<span>/</span>
|
<span>/</span>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if($currenttag!= '') {
|
if ($currenttag!= '') {
|
||||||
if($user!= '') {
|
if ($user!= '') {
|
||||||
echo ' - ';
|
echo ' - ';
|
||||||
echo '<a href="'. createURL('tags', $currenttag) .'">';
|
echo '<a href="'. createURL('tags', $currenttag) .'">';
|
||||||
echo T_('Bookmarks from other users for this tag').'</a>';
|
echo T_('Bookmarks from other users for this tag').'</a>';
|
||||||
//echo T_(' for these tags');
|
//echo T_(' for these tags');
|
||||||
} else if($userservice->isLoggedOn()){
|
} else if ($userservice->isLoggedOn()){
|
||||||
echo ' - ';
|
echo ' - ';
|
||||||
echo '<a href="'. createURL('bookmarks', $currentUser->getUsername().'/'.$currenttag) .'">';
|
echo '<a href="'. createURL('bookmarks', $currentUser->getUsername().'/'.$currenttag) .'">';
|
||||||
echo T_('Only your bookmarks for this tag').'</a>';
|
echo T_('Only your bookmarks for this tag').'</a>';
|
||||||
|
@ -213,10 +229,8 @@ if($currenttag!= '') {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ol <?php echo ($start > 0 ? ' start="'. ++$start .'"' : ''); ?>
|
<ol<?php echo ($start > 0 ? ' start="'. ++$start .'"' : ''); ?> id="bookmarks">
|
||||||
id="bookmarks">
|
<?php
|
||||||
|
|
||||||
<?php
|
|
||||||
$addresses = array();
|
$addresses = array();
|
||||||
foreach ($bookmarks as $key => &$row) {
|
foreach ($bookmarks as $key => &$row) {
|
||||||
$addresses[$row['bId']] = $row['bAddress'];
|
$addresses[$row['bId']] = $row['bAddress'];
|
||||||
|
@ -253,35 +267,52 @@ if($currenttag!= '') {
|
||||||
$tagsForCopy = '';
|
$tagsForCopy = '';
|
||||||
$tags = $row['tags'];
|
$tags = $row['tags'];
|
||||||
foreach ($tags as $tkey => &$tag) {
|
foreach ($tags as $tkey => &$tag) {
|
||||||
$cats .= '<a href="'. sprintf($cat_url, filter($row['username'], 'url'), filter($tag, 'url')) .'" rel="tag">'. filter($tag) .'</a>, ';
|
$tagcaturl = sprintf(
|
||||||
$tagsForCopy.= $tag.',';
|
$cat_url,
|
||||||
|
filter($row['username'], 'url'),
|
||||||
|
filter($tag, 'url')
|
||||||
|
);
|
||||||
|
$cats .= sprintf(
|
||||||
|
'<a href="%s" rel="tag">%s</a>, ',
|
||||||
|
$tagcaturl, filter($tag)
|
||||||
|
);
|
||||||
|
$tagsForCopy .= $tag . ',';
|
||||||
}
|
}
|
||||||
$cats = substr($cats, 0, -2);
|
$cats = substr($cats, 0, -2);
|
||||||
if ($cats != '') {
|
if ($cats != '') {
|
||||||
$cats = ' '.T_('Tags:').' '. $cats;
|
$cats = T_('Tags:') . ' ' . $cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Edit and delete links
|
// Edit and delete links
|
||||||
$edit = '';
|
$edit = '';
|
||||||
if ($bookmarkservice->editAllowed($row)) {
|
if ($bookmarkservice->editAllowed($row)) {
|
||||||
$edit = ' - <a href="'. createURL('edit', $row['bId']) .'">'. T_('Edit') .'</a><script type="text/javascript">document.write(" - <a href=\"#\" onclick=\"deleteBookmark(this, '. $row['bId'] .'); return false;\">'. T_('Delete') .'<\/a>");</script>';
|
$edit = ' - <a href="' . createURL('edit', $row['bId']) . '">'
|
||||||
|
. T_('Edit')
|
||||||
|
. '</a>'
|
||||||
|
. '<script type="text/javascript">'
|
||||||
|
. 'document.write(" - <a href=\"#\" onclick=\"deleteBookmark(this, '. $row['bId'] .'); return false;\">'
|
||||||
|
. T_('Delete')
|
||||||
|
.'<\/a>");</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last update
|
// Last update
|
||||||
$update = ' <small title="'. T_('Last update') .'">('. date($GLOBALS['shortdate'], strtotime($row['bModified'])). ') </small>';
|
$update = ' <small title="'. T_('Last update') .'">('. date($GLOBALS['shortdate'], strtotime($row['bModified'])). ') </small>';
|
||||||
|
|
||||||
// User attribution
|
// User attribution
|
||||||
$copy = ' '. T_('by'). ' ';
|
$copy = ' ' . T_('by') . ' ';
|
||||||
if($userservice->isLoggedOn() && $currentUser->getUsername() == $row['username']) {
|
if ($userservice->isLoggedOn()
|
||||||
$copy.= T_('you');
|
&& $currentUser->getUsername() == $row['username']
|
||||||
|
) {
|
||||||
|
$copy .= T_('you');
|
||||||
} else {
|
} else {
|
||||||
$copy.= '<a href="'. createURL('bookmarks', $row['username']) .'">'. $row['username'] .'</a>';
|
$copy .= '<a href="' . createURL('bookmarks', $row['username']) . '">'
|
||||||
|
. $row['username'] . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Udders!
|
// Udders!
|
||||||
if (!isset($hash)) {
|
if (!isset($hash)) {
|
||||||
$others = $otherCounts[$row['bAddress']];
|
$others = $otherCounts[$row['bAddress']];
|
||||||
$ostart = '<a href="'. createURL('history', $row['bHash']) .'">';
|
$ostart = '<a href="' . createURL('history', $row['bHash']) . '">';
|
||||||
$oend = '</a>';
|
$oend = '</a>';
|
||||||
switch ($others) {
|
switch ($others) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -300,7 +331,10 @@ if($currenttag!= '') {
|
||||||
&& !$existence[$row['bAddress']]
|
&& !$existence[$row['bAddress']]
|
||||||
) {
|
) {
|
||||||
$copy .= ' - <a href="'
|
$copy .= ' - <a href="'
|
||||||
. createURL('bookmarks', $currentUser->getUsername() .'?action=add&copyOf='. $row['bId'])
|
. createURL(
|
||||||
|
'bookmarks',
|
||||||
|
$currentUser->getUsername()
|
||||||
|
. '?action=add&copyOf=' . $row['bId'])
|
||||||
. '" title="'.T_('Copy this bookmark to YOUR bookmarks.').'">'
|
. '" title="'.T_('Copy this bookmark to YOUR bookmarks.').'">'
|
||||||
. T_('Copy')
|
. T_('Copy')
|
||||||
. '</a>';
|
. '</a>';
|
||||||
|
@ -321,11 +355,11 @@ if($currenttag!= '') {
|
||||||
|
|
||||||
// Admin specific design
|
// Admin specific design
|
||||||
if ($userservice->isAdmin($row['username']) && $GLOBALS['enableAdminColors']) {
|
if ($userservice->isAdmin($row['username']) && $GLOBALS['enableAdminColors']) {
|
||||||
$adminBgClass = 'class="adminBackground"';
|
$adminBgClass = ' class="adminBackground"';
|
||||||
$adminStar = ' <img src="'. ROOT .'images/logo_24.gif" width="12px" title="'. T_('This bookmark is certified by an admin user.') .'" />';
|
$adminStar = ' <img src="'. ROOT .'images/logo_24.gif" width="12px" title="'. T_('This bookmark is certified by an admin user.') .'" />';
|
||||||
} else {
|
} else {
|
||||||
$adminBgClass = '';
|
$adminBgClass = '';
|
||||||
$adminStar = '';
|
$adminStar = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Private Note (just visible by the owner and his/her contacts)
|
// Private Note (just visible by the owner and his/her contacts)
|
||||||
|
@ -346,13 +380,16 @@ if($currenttag!= '') {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output
|
// Output
|
||||||
echo '<li class="xfolkentry'. $access .'" >'."\n";
|
echo ' <li class="xfolkentry'. $access .'">'."\n";
|
||||||
include 'bookmarks-thumbnail.inc.tpl.php';
|
include 'bookmarks-thumbnail.inc.tpl.php';
|
||||||
include 'bookmarks-vote.inc.tpl.php';
|
include 'bookmarks-vote.inc.tpl.php';
|
||||||
|
|
||||||
echo '<div '.$adminBgClass.' >';;
|
echo ' <div' . $adminBgClass . '>' . "\n";
|
||||||
|
|
||||||
echo '<div class="link"><a href="'. $address .'"'. $rel .' class="taggedlink" target="_blank">'. filter($row['bTitle']) ."</a>" . $adminStar . "</div>\n";
|
echo ' <div class="link">'
|
||||||
|
. '<a href="'. $address .'"'. $rel .' class="taggedlink" target="_blank">'
|
||||||
|
. filter($row['bTitle'])
|
||||||
|
. '</a>' . $adminStar . "</div>\n";
|
||||||
if ($row['bDescription'] == '') {
|
if ($row['bDescription'] == '') {
|
||||||
$bkDescription = $GLOBALS['blankDescription'];
|
$bkDescription = $GLOBALS['blankDescription'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -362,17 +399,23 @@ if($currenttag!= '') {
|
||||||
$bkDescription = preg_replace('@((http|https|ftp)://.*?)( |\r|$)@', '<a href="$1" rel="nofollow">$1</a>$3', $bkDescription); // make url clickable
|
$bkDescription = preg_replace('@((http|https|ftp)://.*?)( |\r|$)@', '<a href="$1" rel="nofollow">$1</a>$3', $bkDescription); // make url clickable
|
||||||
|
|
||||||
}
|
}
|
||||||
echo '<div class="description">'. nl2br($bkDescription) ."</div>\n";
|
echo ' <div class="description">'. nl2br($bkDescription) ."</div>\n";
|
||||||
//if(!isset($hash)) {
|
echo ' <div class="address">' . shortenString($oaddress) . "</div>\n";
|
||||||
echo '<div class="address">' . shortenString($oaddress) . '</div>';
|
|
||||||
//}
|
|
||||||
|
|
||||||
echo '<div class="meta">'. $cats . $copy . $edit . $update ."</div>\n";
|
echo ' <div class="meta">'
|
||||||
echo $privateNoteField!=''?'<div class="privateNote" title="'. T_('Private Note on this bookmark') .'">'.$privateNoteField."</div>\n":'';
|
. $cats . "\n"
|
||||||
|
. $copy . "\n"
|
||||||
|
. $edit . "\n"
|
||||||
|
. $update . "\n"
|
||||||
|
. " </div>\n";
|
||||||
|
echo $privateNoteField != ''
|
||||||
|
? ' <div class="privateNote" title="'. T_('Private Note on this bookmark') .'">'.$privateNoteField."</div>\n"
|
||||||
|
: '';
|
||||||
|
echo ' ';
|
||||||
include 'bookmarks-vote-horizontal.inc.tpl.php';
|
include 'bookmarks-vote-horizontal.inc.tpl.php';
|
||||||
echo '</div>';
|
echo " </div>\n";
|
||||||
|
|
||||||
echo "</li>\n";
|
echo " </li>\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue