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 <?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');
@ -6,9 +22,9 @@ $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']);
@ -213,9 +229,7 @@ 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) {
@ -253,18 +267,32 @@ 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(
$cat_url,
filter($row['username'], 'url'),
filter($tag, 'url')
);
$cats .= sprintf(
'<a href="%s" rel="tag">%s</a>, ',
$tagcaturl, filter($tag)
);
$tagsForCopy .= $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
@ -272,10 +300,13 @@ if($currenttag!= '') {
// User attribution // User attribution
$copy = ' ' . T_('by') . ' '; $copy = ' ' . T_('by') . ' ';
if($userservice->isLoggedOn() && $currentUser->getUsername() == $row['username']) { if ($userservice->isLoggedOn()
&& $currentUser->getUsername() == $row['username']
) {
$copy .= T_('you'); $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!
@ -300,7 +331,10 @@ if($currenttag!= '') {
&& !$existence[$row['bAddress']] && !$existence[$row['bAddress']]
) { ) {
$copy .= ' - <a href="' $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.').'">' . '" title="'.T_('Copy this bookmark to YOUR bookmarks.').'">'
. T_('Copy') . T_('Copy')
. '</a>'; . '</a>';
@ -350,9 +384,12 @@ if($currenttag!= '') {
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 {
@ -363,14 +400,20 @@ if($currenttag!= '') {
} }
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";
} }