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
This commit is contained in:
parent
78b493f41c
commit
a70b6e9dac
9 changed files with 31 additions and 13 deletions
|
@ -73,7 +73,7 @@ if (is_null($url) || is_null($description)) {
|
||||||
if ($bookmarkservice->bookmarkExists($url, $userservice->getCurrentUserId()))
|
if ($bookmarkservice->bookmarkExists($url, $userservice->getCurrentUserId()))
|
||||||
$added = false;
|
$added = false;
|
||||||
else
|
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.
|
// Set up the XML file and output the result.
|
||||||
|
|
|
@ -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['title']) ? define('GET_TITLE', $_GET['title']): define('GET_TITLE', '');
|
||||||
isset($_GET['address']) ? define('GET_ADDRESS', $_GET['address']): define('GET_ADDRESS', '');
|
isset($_GET['address']) ? define('GET_ADDRESS', $_GET['address']): define('GET_ADDRESS', '');
|
||||||
isset($_GET['description']) ? define('GET_DESCRIPTION', $_GET['description']): define('GET_DESCRIPTION', '');
|
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($_GET['tags']) ? define('GET_TAGS', $_GET['tags']): define('GET_TAGS', '');
|
||||||
|
|
||||||
isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', '');
|
isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', '');
|
||||||
isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('POST_ADDRESS', '');
|
isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('POST_ADDRESS', '');
|
||||||
isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
|
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['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
|
||||||
isset($_POST['tags']) ? define('POST_TAGS', $_POST['tags']): define('POST_TAGS', '');
|
isset($_POST['tags']) ? define('POST_TAGS', $_POST['tags']): define('POST_TAGS', '');
|
||||||
|
|
||||||
|
@ -133,10 +135,11 @@ if ($userservice->isLoggedOn() && POST_SUBMITTED != '') {
|
||||||
} else {
|
} else {
|
||||||
$title = trim(POST_TITLE);
|
$title = trim(POST_TITLE);
|
||||||
$description = trim(POST_DESCRIPTION);
|
$description = trim(POST_DESCRIPTION);
|
||||||
|
$privateNote = trim(POST_PRIVATENOTE);
|
||||||
$status = intval(POST_STATUS);
|
$status = intval(POST_STATUS);
|
||||||
$categories = trim(POST_TAGS);
|
$categories = trim(POST_TAGS);
|
||||||
$saved = true;
|
$saved = true;
|
||||||
if ($bookmarkservice->addBookmark($address, $title, $description, $status, $categories)) {
|
if ($bookmarkservice->addBookmark($address, $title, $description, $privateNote, $status, $categories)) {
|
||||||
if (POST_POPUP != '') {
|
if (POST_POPUP != '') {
|
||||||
$tplVars['msg'] = '<script type="text/javascript">window.close();</script>';
|
$tplVars['msg'] = '<script type="text/javascript">window.close();</script>';
|
||||||
} else {
|
} else {
|
||||||
|
@ -175,6 +178,7 @@ if ($templatename == 'editbookmark.tpl') {
|
||||||
'bTitle' => stripslashes(POST_TITLE),
|
'bTitle' => stripslashes(POST_TITLE),
|
||||||
'bAddress' => stripslashes(POST_ADDRESS),
|
'bAddress' => stripslashes(POST_ADDRESS),
|
||||||
'bDescription' => stripslashes(POST_DESCRIPTION),
|
'bDescription' => stripslashes(POST_DESCRIPTION),
|
||||||
|
'bPrivateNote' => stripslashes(POST_PRIVATENOTE),
|
||||||
'tags' => (POST_TAGS ? explode(',', stripslashes(POST_TAGS)) : array()),
|
'tags' => (POST_TAGS ? explode(',', stripslashes(POST_TAGS)) : array()),
|
||||||
'bStatus' => 0,
|
'bStatus' => 0,
|
||||||
);
|
);
|
||||||
|
@ -184,6 +188,7 @@ if ($templatename == 'editbookmark.tpl') {
|
||||||
'bTitle' => stripslashes(GET_TITLE),
|
'bTitle' => stripslashes(GET_TITLE),
|
||||||
'bAddress' => stripslashes(GET_ADDRESS),
|
'bAddress' => stripslashes(GET_ADDRESS),
|
||||||
'bDescription' => stripslashes(GET_DESCRIPTION),
|
'bDescription' => stripslashes(GET_DESCRIPTION),
|
||||||
|
'bPrivateNote' => stripslashes(GET_PRIVATENOTE),
|
||||||
'tags' => (GET_TAGS ? explode(',', stripslashes(GET_TAGS)) : array()),
|
'tags' => (GET_TAGS ? explode(',', stripslashes(GET_TAGS)) : array()),
|
||||||
'bStatus' => 0
|
'bStatus' => 0
|
||||||
);
|
);
|
||||||
|
|
4
edit.php
4
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['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', '');
|
||||||
isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('POST_ADDRESS', '');
|
isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('POST_ADDRESS', '');
|
||||||
isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
|
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['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
|
||||||
isset($_POST['tags']) ? define('POST_TAGS', $_POST['tags']): define('POST_TAGS', '');
|
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);
|
$address = trim(POST_ADDRESS);
|
||||||
$title = trim(POST_TITLE);
|
$title = trim(POST_TITLE);
|
||||||
$description = trim(POST_DESCRIPTION);
|
$description = trim(POST_DESCRIPTION);
|
||||||
|
$privateNote = trim(POST_PRIVATENOTE);
|
||||||
$status = intval(POST_STATUS);
|
$status = intval(POST_STATUS);
|
||||||
$tags = trim(POST_TAGS);
|
$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');
|
$tplvars['error'] = T_('Error while saving your bookmark');
|
||||||
} else {
|
} else {
|
||||||
if (POST_POPUP != '') {
|
if (POST_POPUP != '') {
|
||||||
|
|
|
@ -100,7 +100,7 @@ function startElement($parser, $name, $attrs) {
|
||||||
$bDatetime = gmdate('Y-m-d H:i:s');
|
$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.');
|
$tplVars['msg'] = T_('Bookmark imported.');
|
||||||
else
|
else
|
||||||
$tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
|
$tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
|
||||||
|
|
|
@ -84,6 +84,8 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
|
||||||
case "TAGS":
|
case "TAGS":
|
||||||
$bCategories = $attrVal;
|
$bCategories = $attrVal;
|
||||||
break;
|
break;
|
||||||
|
case "NOTE":
|
||||||
|
$bPrivateNote = $attrVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$bTitle = trim($titles[$i]);
|
$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');
|
$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++;
|
$countImportedBookmarks++;
|
||||||
} else {
|
} else {
|
||||||
$tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
|
$tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
|
||||||
|
|
|
@ -108,7 +108,7 @@ class BookmarkService {
|
||||||
|
|
||||||
// Adds a bookmark to the database.
|
// Adds a bookmark to the database.
|
||||||
// Note that date is expected to be a string that's interpretable by strtotime().
|
// 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) {
|
if($sId == -1) {
|
||||||
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
||||||
$sId = $userservice->getCurrentUserId();
|
$sId = $userservice->getCurrentUserId();
|
||||||
|
@ -134,7 +134,7 @@ class BookmarkService {
|
||||||
$datetime = gmdate('Y-m-d H:i:s', $time);
|
$datetime = gmdate('Y-m-d H:i:s', $time);
|
||||||
|
|
||||||
// Set up the SQL insert statement and execute it.
|
// 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);
|
$sql = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
|
||||||
$this->db->sql_transaction('begin');
|
$this->db->sql_transaction('begin');
|
||||||
if (!($dbresult = & $this->db->sql_query($sql))) {
|
if (!($dbresult = & $this->db->sql_query($sql))) {
|
||||||
|
@ -154,8 +154,6 @@ class BookmarkService {
|
||||||
$extension = end($uriparts);
|
$extension = end($uriparts);
|
||||||
unset($uriparts);
|
unset($uriparts);
|
||||||
|
|
||||||
trigger_error($GLOBALS['filetypes'].'aaaaaaaaaaaaaaaaaaaaa');
|
|
||||||
|
|
||||||
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
|
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
|
||||||
if (!$b2tservice->attachTags($bId, $categories, $fromApi, $extension, false, $fromImport)) {
|
if (!$b2tservice->attachTags($bId, $categories, $fromApi, $extension, false, $fromImport)) {
|
||||||
$this->db->sql_transaction('rollback');
|
$this->db->sql_transaction('rollback');
|
||||||
|
@ -167,7 +165,7 @@ class BookmarkService {
|
||||||
return $bId;
|
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))
|
if (!is_numeric($bId))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -183,7 +181,7 @@ class BookmarkService {
|
||||||
$moddatetime = gmdate('Y-m-d H:i:s', time());
|
$moddatetime = gmdate('Y-m-d H:i:s', time());
|
||||||
|
|
||||||
// Set up the SQL update statement and execute it.
|
// 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)) {
|
if (!is_null($date)) {
|
||||||
$datetime = gmdate('Y-m-d H:i:s', strtotime($date));
|
$datetime = gmdate('Y-m-d H:i:s', strtotime($date));
|
||||||
|
|
|
@ -15,6 +15,7 @@ CREATE TABLE `sc_bookmarks` (
|
||||||
`bTitle` varchar(255) NOT NULL default '',
|
`bTitle` varchar(255) NOT NULL default '',
|
||||||
`bAddress` text NOT NULL,
|
`bAddress` text NOT NULL,
|
||||||
`bDescription` varchar(1500) default NULL,
|
`bDescription` varchar(1500) default NULL,
|
||||||
|
`bPrivateNote` varchar(1500) default NULL,
|
||||||
`bHash` varchar(32) NOT NULL default '',
|
`bHash` varchar(32) NOT NULL default '',
|
||||||
PRIMARY KEY (`bId`),
|
PRIMARY KEY (`bId`),
|
||||||
KEY `sc_bookmarks_usd` (`uId`,`bStatus`,`bDatetime`),
|
KEY `sc_bookmarks_usd` (`uId`,`bStatus`,`bDatetime`),
|
||||||
|
|
|
@ -40,7 +40,10 @@ $this->includeTemplate("dojo.inc");
|
||||||
<td>← <?php echo T_('Required'); ?></td>
|
<td>← <?php echo T_('Required'); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<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><textarea name="description" id="description" rows="5" cols="63" ><?php echo filter($row['bDescription'], 'xml'); ?></textarea></td>
|
||||||
<td>← <?php echo T_('You can use anchors to delimite attributes. for example: [publisher]blah[/publisher] '); ?>
|
<td>← <?php echo T_('You can use anchors to delimite attributes. for example: [publisher]blah[/publisher] '); ?>
|
||||||
<?php if(count($GLOBALS['descriptionAnchors'])>0): ?>
|
<?php if(count($GLOBALS['descriptionAnchors'])>0): ?>
|
||||||
|
@ -56,6 +59,12 @@ $this->includeTemplate("dojo.inc");
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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>← <?php echo T_('Just visible by you and your friends.'); ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="left"><?php echo T_('Tags'); ?></th>
|
<th align="left"><?php echo T_('Tags'); ?></th>
|
||||||
<td class="scuttletheme">
|
<td class="scuttletheme">
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
- Backup you database
|
- Backup you database
|
||||||
- Make a copy from your SemanticScuttle Web directory
|
- Make a copy from your SemanticScuttle Web directory
|
||||||
- Upgrade your database by following instructions ONE after ONE (order is important) :
|
- 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
|
- 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
|
* Add variable : $descriptionAnchors = array("author", "isbn", "address"=>"[address][street][/street][city][/city][/address]"); #add a possible anchor (structured content) for bookmarks' description field
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue