removed description. changed target to _blank. removed sorting. updated layout.

This commit is contained in:
Marvin Thomas Rabe 2011-10-08 13:54:45 +02:00
parent f3f5d775b5
commit 6b64aa3faf
11 changed files with 41 additions and 105 deletions

View File

@ -41,6 +41,5 @@ $metadata = getURLMetadata($url);
$tmpl->assign('URL', htmlentities($metadata['url']));
$tmpl->assign('TITLE', htmlentities($metadata['title']));
$tmpl->assign('DESCRIPTION', htmlentities($metadata['description']));
$tmpl->printPage();

View File

@ -40,15 +40,14 @@ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
//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);

View File

@ -41,14 +41,13 @@ $bookmark_id = (int)$_GET["id"];
$query = OC_DB::prepare("
UPDATE *PREFIX*bookmarks
SET url = ?, title =?, description = ?, lastmodified = $_ut
SET url = ?, title =?, lastmodified = $_ut
WHERE id = $bookmark_id
");
$params=array(
htmlspecialchars_decode($_GET["url"]),
htmlspecialchars_decode($_GET["title"]),
htmlspecialchars_decode($_GET["description"]),
);
$query->execute($params);

View File

@ -59,7 +59,7 @@ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
}
$query = OC_DB::prepare('
SELECT id, url, title, description,
SELECT id, url, title,
CASE WHEN *PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
THEN GROUP_CONCAT( tag ' .$_gc_separator. ' )
ELSE \' \'

View File

@ -29,13 +29,6 @@
<notnull>true</notnull>
<length>140</length>
</field>
<field>
<name>description</name>
<type>text</type>
<default></default>
<notnull>false</notnull>
<length>255</length>
</field>
<field>
<name>user_id</name>
<type>text</type>

View File

@ -19,10 +19,6 @@ function getURLMetadata($url) {
$metadata['title'] = htmlspecialchars_decode(@$match[1]);
$meta = get_meta_tags($url);
if(array_key_exists('description', $meta)) {
$metadata['description'] = $meta['description'];
}
return $metadata;
}

View File

@ -12,34 +12,13 @@
padding: 0.5ex;
}
.bookmark_actions {
font-size: smaller;
color: #ff44ff;
padding-left: 4em;
}
.bookmark_actions span:hover {
cursor: pointer;
text-decoration: underline;
}
.bookmarks_sorting {
float: left;
margin-left: 2em;
}
.bookmarks_sorting li {
padding: 1ex 1em;
border: 1px solid gray;
-moz-border-radius:1em; -webkit-border-radius:1em; border-radius:1em;
}
.bookmarks_sorting_active {
font-weight: bold;
}
.bookmarks_add {
display: none;
margin-top: 45px;
}
.bookmarks_list {
margin-top: 45px;
}
.bookmarks_addBml {
@ -56,15 +35,28 @@
width: 20em;
}
.bookmark_actions {
display: none;
font-size: smaller;
color: #666;
padding-left: 4em;
}
.bookmark_actions span:hover {
cursor: pointer;
text-decoration: underline;
}
.bookmark_single {
margin-left: 2em;
margin-top: 3ex;
padding: 0.5ex;
/* border-bottom: 1px solid black; */
padding: 0.5em 1em;
}
.bookmark_single:hover {
background-color: #ccccff;
background-color: #EAEAEA;
}
.bookmark_single:hover .bookmark_actions {
display: block;
}
.bookmark_title {
@ -77,14 +69,10 @@
color: green;
}
.bookmark_tags {
.bookmark_tag {
color: #ff3333;
}
.clear {
clear:both;
}
.loading_meta {
display: none;
margin-left: 5px;

View File

@ -5,11 +5,10 @@ $(document).ready(function() {
function addBookmark(event) {
var url = $('#bookmark_add_url').val();
var title = $('#bookmark_add_title').val();
var description = $('#bookmark_add_description').val();
var tags = $('#bookmark_add_tags').val();
$.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(data){
location.href='index.php';
}

View File

@ -12,9 +12,6 @@ $(document).ready(function() {
$(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();
@ -39,6 +36,7 @@ function getBookmarks() {
for(var i in bookmarks.data) {
updateBookmarksList(bookmarks.data[i]);
}
$('.bookmark_link').click(recordClick);
$('.bookmark_delete').click(delBookmark);
$('.bookmark_edit').click(showBookmark);
@ -57,36 +55,21 @@ function getMetadata() {
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> ';
@ -95,16 +78,15 @@ function addOrEditBookmark(event) {
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>&nbsp;<span class="bookmark_edit">Edit</span></p>' +
'</div>'
@ -115,8 +97,7 @@ function addOrEditBookmark(event) {
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('');
@ -124,7 +105,6 @@ function addOrEditBookmark(event) {
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);
@ -138,7 +118,7 @@ function addOrEditBookmark(event) {
}
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()),
@ -151,7 +131,6 @@ function showBookmark(event) {
$('#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') {
@ -163,10 +142,6 @@ function showBookmark(event) {
}
function editBookmark(event) {
}
function updateBookmarksList(bookmark) {
var tags = encodeEntities(bookmark.tags).split(' ');
var taglist = '';
@ -178,9 +153,8 @@ function updateBookmarksList(bookmark) {
}
$('.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>&nbsp;<span class="bookmark_edit">Edit</span></p>' +
'</div>'

View File

@ -1,7 +1,6 @@
<div class="bookmarks_addBm">
<p><label class="bookmarks_label"><?php echo $l->t('Address'); ?></label><input type="text" id="bookmark_add_url" class="bookmarks_input" value="<?php echo $_['URL']; ?>"/></p>
<p><label class="bookmarks_label"><?php echo $l->t('Title'); ?></label><input type="text" id="bookmark_add_title" class="bookmarks_input" value="<?php echo $_['TITLE']; ?>" /></p>
<p><label class="bookmarks_label"><?php echo $l->t('Description'); ?></label><input type="text" id="bookmark_add_description" class="bookmarks_input" value="<?php echo $_['DESCRIPTION']; ?>" /></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>

View File

@ -8,28 +8,18 @@
*/
?>
<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>