From 7428a3467c28756c7d8c3ad848753aa2fcac3065 Mon Sep 17 00:00:00 2001 From: mensonge Date: Tue, 11 Mar 2008 12:36:23 +0000 Subject: [PATCH] New feature: website thumbnail git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@62 b3834d28-1941-0410-a4f8-b48e95affb8f --- config.inc.php.example | 5 +++ scuttle.css | 7 ++++ templates/bookmarks.tpl.php | 4 +++ tests/tag2TagTest.php | 66 +++++++++++++++++++++++++++++++++---- 4 files changed, 76 insertions(+), 6 deletions(-) diff --git a/config.inc.php.example b/config.inc.php.example index f6f7e45..1adc740 100644 --- a/config.inc.php.example +++ b/config.inc.php.example @@ -91,6 +91,8 @@ $dbname = 'scuttle'; # enableCommonTagDescription : true or false # enableCommonBookmarkDescription : true or false # +# enableWebsiteThumbnails : true or false. According to artviper.net license, buy a license if you gain profit with your pages. (see http://www.websitethumbnail.de/) +# ###################################################################### $sitename = 'SemanticScuttle'; @@ -131,5 +133,8 @@ $antispamAnswer = 'semanticscuttle'; $enableCommonTagDescription = true; $enableCommonBookmarkDescription = true; +$enableWebsiteThumbnails = true; // see above, if you gain profit with your pages + + include_once('debug.inc.php'); ?> diff --git a/scuttle.css b/scuttle.css index 2303ff4..1e80cb1 100644 --- a/scuttle.css +++ b/scuttle.css @@ -163,6 +163,13 @@ html > body ol#bookmarks { margin: 0 1em; padding: 0; } +img.thumbnail { + float: left; + padding: 1px; + margin-right: 6px; + margin-bottom:4px; + border:1px solid #AAA; +} div.link a { color: blue; font-size: medium; diff --git a/templates/bookmarks.tpl.php b/templates/bookmarks.tpl.php index e4cfe04..90d1e58 100644 --- a/templates/bookmarks.tpl.php +++ b/templates/bookmarks.tpl.php @@ -157,6 +157,9 @@ window.onload = playerLoad; // Output echo '
  • '."\n"; + if ($GLOBALS['enableWebsiteThumbnails']) { + echo ''; + } echo '\n"; if ($row['bDescription'] != '') { echo '
    '. filter($row['bDescription']) ."
    \n"; @@ -164,6 +167,7 @@ window.onload = playerLoad; if(!isset($hash)) { echo '
    '.$address.'
    '; } + echo '
    '. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit ."
    \n"; echo "
  • \n"; } diff --git a/tests/tag2TagTest.php b/tests/tag2TagTest.php index 87dde52..ea0adf0 100644 --- a/tests/tag2TagTest.php +++ b/tests/tag2TagTest.php @@ -321,7 +321,7 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase $this->assertTrue($tsts->existStat('a', '>', 10)); $this->assertFalse($tsts->existStat('a', '>', 20)); $tsts->increaseNbUpdate('a', '>', 10); - $this->assertSame(1, $tsts->getNbUpdate('a', '>', 10)); + $this->assertSame(1, $tsts->getNbUpdates('a', '>', 10)); $tsts->deleteAll(); @@ -339,11 +339,11 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase $tts->addLinkedTags('a', 'b', '>', 1); $tts->addLinkedTags('b', 'e', '>', 1); - $this->assertSame(3, $tsts->getNbUpdate('a', '>', '1')); - $this->assertSame(2, $tsts->getNbUpdate('b', '>', '1')); - $this->assertSame(0, $tsts->getNbUpdate('c', '>', '1')); - $this->assertSame(0, $tsts->getNbUpdate('d', '>', '1')); - $this->assertSame(0, $tsts->getNbUpdate('e', '>', '1')); + $this->assertSame(3, $tsts->getNbUpdates('a', '>', '1')); + $this->assertSame(2, $tsts->getNbUpdates('b', '>', '1')); + $this->assertSame(0, $tsts->getNbUpdates('c', '>', '1')); + $this->assertSame(0, $tsts->getNbUpdates('d', '>', '1')); + $this->assertSame(0, $tsts->getNbUpdates('e', '>', '1')); $nbC = $tsts->getNbChildren('a', '>', 1); @@ -391,6 +391,29 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase $this->assertSame(3, $nbD); $this->assertSame(2, $maxDepth); + //do cases for synonyms + + $tsts->deleteAll(); + $tts->deleteAll(); + + $tts->addLinkedTags('a', 'b', '>', 1); + $tts->addLinkedTags('b', 'c', '=', 1); + /*$tts->addLinkedTags('a', 'c', '>', 1); + $tts->addLinkedTags('j', 'i', '=', 1); + $tts->addLinkedTags('f', 'i', '=', 1); + $tts->addLinkedTags('d', 'f', '>', 1); + $tts->addLinkedTags('d', 'e', '>', 1); + $tts->addLinkedTags('j', 'k', '>', 1);*/ + + $nbC = $tsts->getNbChildren('a', '>', 1); + $nbD = $tsts->getNbDescendants('a', '>', 1); + $nbU = $tsts->getNbUpdates('a', '>', 1); + $maxDepth = $tsts->getMaxDepth('a', '>', 1); + //$this->assertSame(2, $tts->getLinkedTags('a', '>', 1)); + $this->assertSame(1, $nbC); + $this->assertSame(2, $nbD); + $this->assertSame(2, $nbU); + $this->assertSame(1, $maxDepth); // advanced case with fore loop //$tts->addLinkedTags('d', 'c', '>', 1); @@ -398,5 +421,36 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase // advanced case with back loop //$tts->addLinkedTags('e', 'a', '>', 1); } + + public function testRenameFunction() + { + $tts = $this->tts; + $ts = $this->ts; + $bs = $this->bs; + $tsts = $this->tsts; + + // with classic tags (users 10 & 20) + $tags = array('a', 'b', 'c'); + $bs->addBookmark("http://site1.com", "title", "description", "status", $tags, null, false, false, 10); + + $tags = array('a', 'b', 'c'); + $bs->addBookmark("http://site2.com", "title", "description", "status", $tags, null, false, false, 20); + + $bookmarks = $bs->getBookmarks(0, NULL, 10, 'a'); + $this->assertSame(array(), $bookmarks); + + $ts->renameTag(10, 'a', 'ddd'); + $tags1 = $ts->getTagsForBookmark(1); + $this->assertSame(array('b', 'c', 'ddd'), $tags1); + + + // with linked tags + + $tts->addLinkedTags('b', 'c', '>', 1); + $tts->addLinkedTags('a', 'd', '>', 1); + + //with stats + + } } ?>