]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
New Feature: adding private note to describe a bookmark. Just visible by the author...
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Mon, 12 Jan 2009 16:40:39 +0000 (16:40 +0000)
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Mon, 12 Jan 2009 16:40:39 +0000 (16:40 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@231 b3834d28-1941-0410-a4f8-b48e95affb8f

api/posts_add.php
bookmarks.php
edit.php
import.php
importNetscape.php
services/bookmarkservice.php
tables.sql
templates/editbookmark.tpl.php
upgrade.txt

index e27fc995592af0adc69a677a963678bf0ed0fba7..ba3e02ccac312509a7e0784c4909e9ee4e4e7075 100644 (file)
@@ -73,7 +73,7 @@ if (is_null($url) || is_null($description)) {
     if ($bookmarkservice->bookmarkExists($url, $userservice->getCurrentUserId()))
         $added = false;
     else
-        $added = $bookmarkservice->addBookmark($url, $description, $extended, $status, $tags, $dt, true);
+        $added = $bookmarkservice->addBookmark($url, $description, $extended, '', $status, $tags, $dt, true);
 }
 
 // Set up the XML file and output the result.
index b7a507702bd34ac7894100acdeb60fe113e6c3e0..f0ce07dd3e1b4107884937472dd459103d7e78fb 100644 (file)
@@ -32,11 +32,13 @@ isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): defi
 isset($_GET['title']) ? define('GET_TITLE', $_GET['title']): define('GET_TITLE', '');
 isset($_GET['address']) ? define('GET_ADDRESS', $_GET['address']): define('GET_ADDRESS', '');
 isset($_GET['description']) ? define('GET_DESCRIPTION', $_GET['description']): define('GET_DESCRIPTION', '');
+isset($_GET['privateNote']) ? define('GET_PRIVATENOTE', $_GET['privateNote']): define('GET_PRIVATENOTE', '');
 isset($_GET['tags']) ? define('GET_TAGS', $_GET['tags']): define('GET_TAGS', '');
 
 isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', '');
 isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('POST_ADDRESS', '');
 isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
+isset($_POST['privateNote']) ? define('POST_PRIVATENOTE', $_POST['privateNote']): define('POST_PRIVATENOTE', '');
 isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
 isset($_POST['tags']) ? define('POST_TAGS', $_POST['tags']): define('POST_TAGS', '');
 
@@ -133,10 +135,11 @@ if ($userservice->isLoggedOn() && POST_SUBMITTED != '') {
                } else {
                        $title = trim(POST_TITLE);
                        $description = trim(POST_DESCRIPTION);
+                       $privateNote = trim(POST_PRIVATENOTE);
                        $status = intval(POST_STATUS);
                        $categories = trim(POST_TAGS);
                        $saved = true;
-                       if ($bookmarkservice->addBookmark($address, $title, $description, $status, $categories)) {
+                       if ($bookmarkservice->addBookmark($address, $title, $description, $privateNote, $status, $categories)) {
                                if (POST_POPUP != '') {
                                        $tplVars['msg'] = '<script type="text/javascript">window.close();</script>';
                                } else {
@@ -175,6 +178,7 @@ if ($templatename == 'editbookmark.tpl') {
                 'bTitle' => stripslashes(POST_TITLE),
                 'bAddress' => stripslashes(POST_ADDRESS),
                 'bDescription' => stripslashes(POST_DESCRIPTION),
+                           'bPrivateNote' => stripslashes(POST_PRIVATENOTE),
                 'tags' => (POST_TAGS ? explode(',', stripslashes(POST_TAGS)) : array()),
                                'bStatus' => 0,
                        );
@@ -184,6 +188,7 @@ if ($templatename == 'editbookmark.tpl') {
                 'bTitle' => stripslashes(GET_TITLE),
                 'bAddress' => stripslashes(GET_ADDRESS),
                 'bDescription' => stripslashes(GET_DESCRIPTION),
+                           'bPrivateNote' => stripslashes(GET_PRIVATENOTE),
                 'tags' => (GET_TAGS ? explode(',', stripslashes(GET_TAGS)) : array()),
                                'bStatus' => 0
                        );
index 7a5b0ab86368907e0fd81bccd5249b16cf0394ac..1ecb9d01d77e06672260425c1b386b1ecbf09d55 100644 (file)
--- a/edit.php
+++ b/edit.php
@@ -31,6 +31,7 @@ isset($_POST['delete']) ? define('POST_DELETE', $_POST['delete']): define('POST_
 isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', '');
 isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('POST_ADDRESS', '');
 isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
+isset($_POST['privateNote']) ? define('POST_PRIVATENOTE', $_POST['privateNote']): define('POST_PRIVATENOTE', '');
 isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
 isset($_POST['tags']) ? define('POST_TAGS', $_POST['tags']): define('POST_TAGS', '');
 
@@ -62,10 +63,11 @@ if (!($row = $bookmarkservice->getBookmark(intval($bookmark), true))) {
             $address = trim(POST_ADDRESS);
             $title = trim(POST_TITLE);
             $description = trim(POST_DESCRIPTION);
+            $privateNote = trim(POST_PRIVATENOTE);
             $status = intval(POST_STATUS);
             $tags = trim(POST_TAGS);
             
-            if (!$bookmarkservice->updateBookmark($bId, $address, $title, $description, $status, $tags)) {
+            if (!$bookmarkservice->updateBookmark($bId, $address, $title, $description, $privateNote, $status, $tags)) {
                 $tplvars['error'] = T_('Error while saving your bookmark');
             } else {
                 if (POST_POPUP != '') {
index adf89ad65456f69aec2a9cd043bc03e12f7b25bb..29a119bd2ef4425e021e3f5c48da95e18c516517 100644 (file)
@@ -100,7 +100,7 @@ function startElement($parser, $name, $attrs) {
                                $bDatetime = gmdate('Y-m-d H:i:s');
                        }
 
-                       if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $status, $tags, $bDatetime, true, true))
+                       if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, '', $status, $tags, $bDatetime, true, true))
                        $tplVars['msg'] = T_('Bookmark imported.');
                        else
                        $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
index b72000196ca2211f09d99bb429a786dc59a64108..e7fe31fc42b6983bab7c822b1998b9c7ce109f67 100644 (file)
@@ -84,6 +84,8 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
                                case "TAGS":
                                        $bCategories = $attrVal;
                                        break;
+                               case "NOTE":
+                                       $bPrivateNote = $attrVal;
                        }
                }
                $bTitle = trim($titles[$i]);
@@ -100,7 +102,7 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
                                        $bDatetime = gmdate('Y-m-d H:i:s');
                                }
 
-                               if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $status, $bCategories, $bDatetime, false, true)) {
+                               if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $bPrivateNote, $status, $bCategories, $bDatetime, false, true)) {
                                        $countImportedBookmarks++;
                                } else {
                                        $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
index ecd93f2deaaa33894a39abbff7ad3930aedb8a40..4b000b4949b300603280cb4e08912660eea925f8 100644 (file)
@@ -108,7 +108,7 @@ class BookmarkService {
 
        // Adds a bookmark to the database.
        // Note that date is expected to be a string that's interpretable by strtotime().
-       function addBookmark($address, $title, $description, $status, $categories, $date = NULL, $fromApi = false, $fromImport = false, $sId = -1) {
+       function addBookmark($address, $title, $description, $privateNote, $status, $categories, $date = NULL, $fromApi = false, $fromImport = false, $sId = -1) {
                if($sId == -1) {
                        $userservice = & ServiceFactory :: getServiceInstance('UserService');
                        $sId = $userservice->getCurrentUserId();
@@ -134,7 +134,7 @@ class BookmarkService {
                $datetime = gmdate('Y-m-d H:i:s', $time);
 
                // Set up the SQL insert statement and execute it.
-               $values = array('uId' => intval($sId), 'bIp' => $ip, 'bDatetime' => $datetime, 'bModified' => $datetime, 'bTitle' => $title, 'bAddress' => $address, 'bDescription' => $description, 'bStatus' => intval($status), 'bHash' => md5($address));
+               $values = array('uId' => intval($sId), 'bIp' => $ip, 'bDatetime' => $datetime, 'bModified' => $datetime, 'bTitle' => $title, 'bAddress' => $address, 'bDescription' => $description, 'bPrivateNote' => $privateNote, 'bStatus' => intval($status), 'bHash' => md5($address));
                $sql = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
                $this->db->sql_transaction('begin');
                if (!($dbresult = & $this->db->sql_query($sql))) {
@@ -153,8 +153,6 @@ class BookmarkService {
                $uriparts = explode('.', $address);
                $extension = end($uriparts);
                unset($uriparts);
-               
-               trigger_error($GLOBALS['filetypes'].'aaaaaaaaaaaaaaaaaaaaa');
 
                $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
                if (!$b2tservice->attachTags($bId, $categories, $fromApi, $extension, false, $fromImport)) {
@@ -167,7 +165,7 @@ class BookmarkService {
                return $bId;
        }
 
-       function updateBookmark($bId, $address, $title, $description, $status, $categories, $date = NULL, $fromApi = false) {
+       function updateBookmark($bId, $address, $title, $description, $privateNote, $status, $categories, $date = NULL, $fromApi = false) {
                if (!is_numeric($bId))
                return false;
 
@@ -183,7 +181,7 @@ class BookmarkService {
                $moddatetime = gmdate('Y-m-d H:i:s', time());
 
                // Set up the SQL update statement and execute it.
-               $updates = array('bModified' => $moddatetime, 'bTitle' => $title, 'bAddress' => $address, 'bDescription' => $description, 'bStatus' => $status, 'bHash' => md5($address));
+               $updates = array('bModified' => $moddatetime, 'bTitle' => $title, 'bAddress' => $address, 'bDescription' => $description, 'bPrivateNote' => $privateNote, 'bStatus' => $status, 'bHash' => md5($address));
 
                if (!is_null($date)) {
                        $datetime = gmdate('Y-m-d H:i:s', strtotime($date));
index 9e5f5c4c7db34059f91e68d1519af79edbf39028..f8a5f116c536e18d544d8a5d3c2d06f9635f78bd 100644 (file)
@@ -15,6 +15,7 @@ CREATE TABLE `sc_bookmarks` (
   `bTitle` varchar(255) NOT NULL default '',
   `bAddress` text NOT NULL,
   `bDescription` varchar(1500) default NULL,
+  `bPrivateNote` varchar(1500) default NULL,
   `bHash` varchar(32) NOT NULL default '',
   PRIMARY KEY  (`bId`),
   KEY `sc_bookmarks_usd` (`uId`,`bStatus`,`bDatetime`),
index ab0e861056917084b94f07294a76c73ab86bf3ef..b3514f34d853eff897f1300cc3fc8ae02e5a95f4 100644 (file)
@@ -40,7 +40,10 @@ $this->includeTemplate("dojo.inc");
     <td>&larr; <?php echo T_('Required'); ?></td>
 </tr>
 <tr>
-    <th align="left"><?php echo T_('Description'); ?></th>
+    <th align="left">
+    <?php echo T_('Description'); ?>
+    <a onclick="var nz = document.getElementById('privateNoteZone'); nz.style.display='';this.style.display='none';"><?php echo T_("Add Note"); ?></a>
+    </th>
     <td><textarea name="description" id="description" rows="5" cols="63" ><?php echo filter($row['bDescription'], 'xml'); ?></textarea></td>
     <td>&larr; <?php echo T_('You can use anchors to delimite attributes. for example: [publisher]blah[/publisher] '); ?> 
     <?php if(count($GLOBALS['descriptionAnchors'])>0): ?>
@@ -56,6 +59,12 @@ $this->includeTemplate("dojo.inc");
     <?php endif; ?>
     </td>
 </tr>
+<tr id="privateNoteZone" <?php if(strlen($row['bPrivateNote'])==0):?>style="display:none"<?php endif; ?>>
+    <th align="left"><?php echo T_('Private Note'); ?></th>
+    <td><textarea name="privateNote" id="privateNote" rows="1" cols="63" ><?php echo filter($row['bPrivateNote'], 'xml'); ?></textarea></td>
+    <td>&larr; <?php echo T_('Just visible by you and your friends.'); ?> 
+    </td>
+</tr>
 <tr>
     <th align="left"><?php echo T_('Tags'); ?></th>
     <td class="scuttletheme">
index 093d17166c763404b6730cd01908c8f3c4d2b6cc..f525a2a718e46502ef74aeec307feffc7e515eb7 100644 (file)
@@ -4,7 +4,8 @@
 - Backup you database
 - Make a copy from your SemanticScuttle Web directory
 - Upgrade your database by following instructions ONE after ONE (order is important) :
-* NO CHANGE
+* ALTER TABLE `sc_bookmarks` ADD `bPrivateNote` VARCHAR( 1500 ) NOT NULL AFTER `bDescription` ;
+
 - Upgrade your current configuration file (config.inc.php) with respect to config.inc.php.example
 * Add variable : $descriptionAnchors = array("author", "isbn", "address"=>"[address][street][/street][city][/city][/address]"); #add a possible anchor (structured content) for bookmarks' description field