//FIXME: Detect when user adds a known URL
$query = OC_DB::prepare("
INSERT INTO *PREFIX*bookmarks
- (url, title, description, user_id, public, added, lastmodified)
- VALUES (?, ?, ?, ?, 0, $_ut, $_ut)
+ (url, title, user_id, public, added, lastmodified)
+ VALUES (?, ?, ?, 0, $_ut, $_ut)
");
$params=array(
htmlspecialchars_decode($_GET["url"]),
htmlspecialchars_decode($_GET["title"]),
- htmlspecialchars_decode($_GET["description"]),
OC_User::getUser()
);
$query->execute($params);
$(window).scroll(updateOnBottom);
$('#bookmark_add_url').focusout(getMetadata);
- $('.' + bookmarks_sorting).addClass('bookmarks_sorting_active');
-
- $('.bookmarks_sorting li').click(function(event){changeSorting(this)});
$('.bookmarks_list').empty();
getBookmarks();
for(var i in bookmarks.data) {
updateBookmarksList(bookmarks.data[i]);
}
+
$('.bookmark_link').click(recordClick);
$('.bookmark_delete').click(delBookmark);
$('.bookmark_edit').click(showBookmark);
success: function(pageinfo){
$('#bookmark_add_url').val(pageinfo.data.url);
$('#bookmark_add_title').val(pageinfo.data.title);
- if (pageinfo.data.description !== undefined){
- $('#bookmark_add_description').val(pageinfo.data.description);
- }
$('.loading_meta').css('display','none');
}
});
}
-function changeSorting(sortEl) {
- $('.' + bookmarks_sorting).removeClass('bookmarks_sorting_active');
- bookmarks_sorting = sortEl.className;
- $('.' + bookmarks_sorting).addClass('bookmarks_sorting_active');
-
- $('.bookmarks_list').empty();
- bookmarks_page = 0;
- bookmarks_loading = false;
- getBookmarks();
-}
-
// function addBookmark() {
// Instead of creating editBookmark() function, Converted the one above to
// addOrEditBookmark() to make .js file more compact.
function addOrEditBookmark(event) {
var id = $('#bookmark_add_id').val();
- var url = encodeEntities($('#bookmark_add_url').val())
- var title = encodeEntities($('#bookmark_add_title').val())
- var description = encodeEntities($('#bookmark_add_description').val())
- var tags = encodeEntities($('#bookmark_add_tags').val())
- var taglist = tags.split(' ')
+ var url = encodeEntities($('#bookmark_add_url').val());
+ var title = encodeEntities($('#bookmark_add_title').val());
+ var tags = encodeEntities($('#bookmark_add_tags').val());
+ var taglist = tags.split(' ');
var tagshtml = '';
for ( var i=0, len=taglist.length; i<len; ++i ){
tagshtml += '<a class="bookmark_tag" href="?tag=' + encodeURI(taglist[i]) + '">' + taglist[i] + '</a> ';
if (id == 0) {
$.ajax({
url: 'ajax/addBookmark.php',
- data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&description=' + encodeURI(description) + '&tags=' + encodeURI(tags),
+ data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
success: function(response){
var bookmark_id = response.data;
$('.bookmarks_add').slideToggle();
$('.bookmarks_add').children('p').children('.bookmarks_input').val('');
$('.bookmarks_list').prepend(
'<div class="bookmark_single" data-id="' + bookmark_id + '" >' +
- '<p class="bookmark_title"><a href="' + url + '" target="_new" class="bookmark_link">' + title + '</a></p>' +
+ '<p class="bookmark_title"><a href="' + url + '" target="_blank" class="bookmark_link">' + title + '</a></p>' +
'<p class="bookmark_url">' + url + '</p>' +
- '<p class="bookmark_description">' + description + '</p>' +
'<p class="bookmark_tags">' + tagshtml + '</p>' +
'<p class="bookmark_actions"><span class="bookmark_delete">Delete</span> <span class="bookmark_edit">Edit</span></p>' +
'</div>'
else {
$.ajax({
url: 'ajax/editBookmark.php',
- data: 'id=' + id + '&url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&description=' +
- encodeURI(description) + '&tags=' + encodeURI(tags),
+ data: 'id=' + id + '&url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
success: function(){
$('.bookmarks_add').slideToggle();
$('.bookmarks_add').children('p').children('.bookmarks_input').val('');
var record = $('.bookmark_single[data-id = "' + id + '"]');
record.children('.bookmark_url:first').text(url);
- record.children('.bookmark_description:first').text(description);
var record_title = record.children('.bookmark_title:first').children('a:first');
record_title.attr('href', url);
}
function delBookmark(event) {
- var record = $(this).parent().parent()
+ var record = $(this).parent().parent();
$.ajax({
url: 'ajax/delBookmark.php',
data: 'url=' + encodeURI($(this).parent().parent().children('.bookmark_url:first').text()),
$('#bookmark_add_id').val(record.attr('data-id'));
$('#bookmark_add_url').val(record.children('.bookmark_url:first').text());
$('#bookmark_add_title').val(record.children('.bookmark_title:first').text());
- $('#bookmark_add_description').val(record.children('.bookmark_description:first').text());
$('#bookmark_add_tags').val(record.children('.bookmark_tags:first').text());
if ($('.bookmarks_add').css('display') == 'none') {
}
-function editBookmark(event) {
-
-}
-
function updateBookmarksList(bookmark) {
var tags = encodeEntities(bookmark.tags).split(' ');
var taglist = '';
}
$('.bookmarks_list').append(
'<div class="bookmark_single" data-id="' + bookmark.id +'" >' +
- '<p class="bookmark_title"><a href="' + encodeEntities(bookmark.url) + '" target="_new" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a></p>' +
+ '<p class="bookmark_title"><a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a></p>' +
'<p class="bookmark_url">' + encodeEntities(bookmark.url) + '</p>' +
- '<p class="bookmark_description">' + encodeEntities(bookmark.description) + '</p>' +
'<p class="bookmark_tags">' + taglist + '</p>' +
'<p class="bookmark_actions"><span class="bookmark_delete">Delete</span> <span class="bookmark_edit">Edit</span></p>' +
'</div>'
*/
?>
<input type="hidden" id="bookmarkFilterTag" value="<?php if(isset($_GET['tag'])) echo htmlentities($_GET['tag']); ?>" />
-<h2 class="bookmarks_headline"><?php echo isset($_GET["tag"]) ? $l->t('Bookmarks with tag: ') . urldecode($_GET["tag"]) : $l->t('All bookmarks'); ?></h2>
-<div class="bookmarks_menu">
+<div id="controls">
<input type="button" class="bookmarks_addBtn" value="<?php echo $l->t('Add bookmark'); ?>"/>
</div>
<div class="bookmarks_add">
<input type="hidden" id="bookmark_add_id" value="0" />
<p><label class="bookmarks_label"><?php echo $l->t('Address'); ?></label><input type="text" id="bookmark_add_url" class="bookmarks_input" /></p>
<p><label class="bookmarks_label"><?php echo $l->t('Title'); ?></label><input type="text" id="bookmark_add_title" class="bookmarks_input" />
- <img class="loading_meta" src="<?php echo OC_Helper::imagePath('core', 'loading.gif'); ?>" /></p>
- <p><label class="bookmarks_label"><?php echo $l->t('Description'); ?></label><input type="text" id="bookmark_add_description" class="bookmarks_input" />
<img class="loading_meta" src="<?php echo OC_Helper::imagePath('core', 'loading.gif'); ?>" /></p>
<p><label class="bookmarks_label"><?php echo $l->t('Tags'); ?></label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
<p><label class="bookmarks_label"> </label><label class="bookmarks_hint"><?php echo $l->t('Hint: Use space to separate tags.'); ?></label></p>
<p><label class="bookmarks_label"></label><input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" /></p>
</div>
-<div class="bookmarks_sorting pager">
- <ul>
- <li class="bookmarks_sorting_recent"><?php echo $l->t('Recent Bookmarks'); ?></li>
- <li class="bookmarks_sorting_clicks"><?php echo $l->t('Most clicks'); ?></li>
- </ul>
-</div>
-<div class="clear"></div>
<div class="bookmarks_list">
<?php echo $l->t('You have no bookmarks'); ?>
-</div>
+</div>
\ No newline at end of file