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:
cweiske 2010-09-26 22:05:20 +00:00
parent a62dfd6d70
commit fbf28d0753

View File

@ -1,4 +1,20 @@
<?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 */
$bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark');
@ -6,9 +22,9 @@ $tagservice =SemanticScuttle_Service_Factory::get('Tag');
$cdservice = SemanticScuttle_Service_Factory::get('CommonDescription');
$pageName = isset($pageName)?$pageName:"";
$user = isset($user)?$user:"";
$currenttag = isset($currenttag)?$currenttag:"";
$pageName = isset($pageName) ? $pageName : '';
$user = isset($user) ? $user : '';
$currenttag = isset($currenttag) ? $currenttag : '';
$this->includeTemplate($GLOBALS['top_include']);
@ -213,9 +229,7 @@ if($currenttag!= '') {
<ol <?php echo ($start > 0 ? ' start="'. ++$start .'"' : ''); ?>
id="bookmarks">
<ol<?php echo ($start > 0 ? ' start="'. ++$start .'"' : ''); ?> id="bookmarks">
<?php
$addresses = array();
foreach ($bookmarks as $key => &$row) {
@ -253,18 +267,32 @@ if($currenttag!= '') {
$tagsForCopy = '';
$tags = $row['tags'];
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(
$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);
if ($cats != '') {
$cats = ' '.T_('Tags:').' '. $cats;
$cats = T_('Tags:') . ' ' . $cats;
}
// Edit and delete links
$edit = '';
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
@ -272,10 +300,13 @@ if($currenttag!= '') {
// User attribution
$copy = ' ' . T_('by') . ' ';
if($userservice->isLoggedOn() && $currentUser->getUsername() == $row['username']) {
if ($userservice->isLoggedOn()
&& $currentUser->getUsername() == $row['username']
) {
$copy .= T_('you');
} else {
$copy.= '<a href="'. createURL('bookmarks', $row['username']) .'">'. $row['username'] .'</a>';
$copy .= '<a href="' . createURL('bookmarks', $row['username']) . '">'
. $row['username'] . '</a>';
}
// Udders!
@ -300,7 +331,10 @@ if($currenttag!= '') {
&& !$existence[$row['bAddress']]
) {
$copy .= ' - <a href="'
. createURL('bookmarks', $currentUser->getUsername() .'?action=add&amp;copyOf='. $row['bId'])
. createURL(
'bookmarks',
$currentUser->getUsername()
. '?action=add&amp;copyOf=' . $row['bId'])
. '" title="'.T_('Copy this bookmark to YOUR bookmarks.').'">'
. T_('Copy')
. '</a>';
@ -350,9 +384,12 @@ if($currenttag!= '') {
include 'bookmarks-thumbnail.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'] == '') {
$bkDescription = $GLOBALS['blankDescription'];
} else {
@ -363,14 +400,20 @@ if($currenttag!= '') {
}
echo ' <div class="description">'. nl2br($bkDescription) ."</div>\n";
//if(!isset($hash)) {
echo '<div class="address">' . shortenString($oaddress) . '</div>';
//}
echo ' <div class="address">' . shortenString($oaddress) . "</div>\n";
echo '<div class="meta">'. $cats . $copy . $edit . $update ."</div>\n";
echo $privateNoteField!=''?'<div class="privateNote" title="'. T_('Private Note on this bookmark') .'">'.$privateNoteField."</div>\n":'';
echo ' <div class="meta">'
. $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';
echo '</div>';
echo " </div>\n";
echo " </li>\n";
}