summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-01-12 16:40:39 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-01-12 16:40:39 +0000
commita70b6e9dacbb2c5c57425df6ef30802115509645 (patch)
treea7420f5a4b8b7d85f05782c93a1ad64eecf37a02
parent78b493f41c9490d3ef1c8c9f57c486ad40f9d152 (diff)
downloadsemanticscuttle-a70b6e9dacbb2c5c57425df6ef30802115509645.tar.gz
semanticscuttle-a70b6e9dacbb2c5c57425df6ef30802115509645.tar.bz2
New Feature: adding private note to describe a bookmark. Just visible by the author and friends. (Useful for collaborative work)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@231 b3834d28-1941-0410-a4f8-b48e95affb8f
-rw-r--r--api/posts_add.php2
-rw-r--r--bookmarks.php7
-rw-r--r--edit.php4
-rw-r--r--import.php2
-rw-r--r--importNetscape.php4
-rw-r--r--services/bookmarkservice.php10
-rw-r--r--tables.sql1
-rw-r--r--templates/editbookmark.tpl.php11
-rw-r--r--upgrade.txt3
9 files changed, 31 insertions, 13 deletions
diff --git a/api/posts_add.php b/api/posts_add.php
index e27fc99..ba3e02c 100644
--- a/api/posts_add.php
+++ b/api/posts_add.php
@@ -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.
diff --git a/bookmarks.php b/bookmarks.php
index b7a5077..f0ce07d 100644
--- a/bookmarks.php
+++ b/bookmarks.php
@@ -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
);
diff --git a/edit.php b/edit.php
index 7a5b0ab..1ecb9d0 100644
--- 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 != '') {
diff --git a/import.php b/import.php
index adf89ad..29a119b 100644
--- a/import.php
+++ b/import.php
@@ -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.');
diff --git a/importNetscape.php b/importNetscape.php
index b720001..e7fe31f 100644
--- a/importNetscape.php
+++ b/importNetscape.php
@@ -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.');
diff --git a/services/bookmarkservice.php b/services/bookmarkservice.php
index ecd93f2..4b000b4 100644
--- a/services/bookmarkservice.php
+++ b/services/bookmarkservice.php
@@ -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));
diff --git a/tables.sql b/tables.sql
index 9e5f5c4..f8a5f11 100644
--- a/tables.sql
+++ b/tables.sql
@@ -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`),
diff --git a/templates/editbookmark.tpl.php b/templates/editbookmark.tpl.php
index ab0e861..b3514f3 100644
--- a/templates/editbookmark.tpl.php
+++ b/templates/editbookmark.tpl.php
@@ -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">
diff --git a/upgrade.txt b/upgrade.txt
index 093d171..f525a2a 100644
--- a/upgrade.txt
+++ b/upgrade.txt
@@ -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