From cb23990a846c1855de89b7c36c3997ca307f6565 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 16 Feb 2012 19:45:00 +0100 Subject: [PATCH 01/19] Use separate function to make absolute urls --- templates/settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/settings.php b/templates/settings.php index 97b6b256..a985ee9d 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -8,7 +8,7 @@ ?>
- t('Bookmarklet:');?> t('Add page to ownCloud'); ?> + t('Bookmarklet:');?> t('Add page to ownCloud'); ?>
t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.'); ?>
From 8b3262ea2004e1db829acedf54e3691a5d20e915 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 16 Feb 2012 21:01:13 +0100 Subject: [PATCH 02/19] Bookmarks: Fix image urls in bookmarks.js --- js/bookmarks.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/js/bookmarks.js b/js/bookmarks.js index 77f767cd..fadbbd55 100644 --- a/js/bookmarks.js +++ b/js/bookmarks.js @@ -85,7 +85,14 @@ function addOrEditBookmark(event) { $('.bookmarks_add').children('p').children('.bookmarks_input').val(''); $('.bookmarks_list').prepend( '
' + - '

 

' + + '

' + + '' + + '' + + ' ' + + '' + + '' + + '' + + '

' + '

' + title + '

' + '

' + tagshtml + '

' + '

' + url + '

' + @@ -154,8 +161,17 @@ function updateBookmarksList(bookmark) { } $('.bookmarks_list').append( '
' + - '

 

' + - '

' + encodeEntities(bookmark.title) + '

' + + '

' + + '' + + '' + + ' ' + + '' + + '' + + '' + + '

' + + '

'+ + '' + encodeEntities(bookmark.title) + '' + + '

' + '

' + encodeEntities(bookmark.url) + '

' + '
' ); From dacffb5a06b981f517881019dab138735f6ca7e5 Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Sun, 19 Feb 2012 20:18:27 -0500 Subject: [PATCH 03/19] Added bookmarklet for browser. Inspired by Google Bookmarks --- addBm.php | 3 ++- css/bookmarks.css | 15 ++++++++++++++- templates/list.php | 6 +++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/addBm.php b/addBm.php index 62ad5821..f56022c4 100644 --- a/addBm.php +++ b/addBm.php @@ -40,6 +40,7 @@ $url = isset($_GET['url']) ? urldecode($_GET['url']) : ''; $metadata = getURLMetadata($url); $tmpl->assign('URL', htmlentities($metadata['url'],ENT_COMPAT,'utf-8')); -$tmpl->assign('TITLE', htmlentities($metadata['title'],ENT_COMPAT,'utf-8')); +$title = isset($metadata['title']) ? $metadata['title'] : (isset($_GET['title']) ? $_GET['title'] : ''); +$tmpl->assign('TITLE', htmlentities($title,ENT_COMPAT,'utf-8')); $tmpl->printPage(); diff --git a/css/bookmarks.css b/css/bookmarks.css index 48f0bede..8dfdc8a0 100644 --- a/css/bookmarks.css +++ b/css/bookmarks.css @@ -83,4 +83,17 @@ .loading_meta { display: none; margin-left: 5px; -} \ No newline at end of file +} + +#footer { + color: #999; + font-size: medium; + text-align: center; + position: absolute; + bottom: 10px; + left: 0px; + width: 100%; + height: 20px; + visibility: visible; + display: block +} diff --git a/templates/list.php b/templates/list.php index ccfe74f0..d44a0ecb 100644 --- a/templates/list.php +++ b/templates/list.php @@ -22,4 +22,8 @@
t('You have no bookmarks'); ?> -
\ No newline at end of file + + From 08246e2f7130c77019dd4860dc9739a8b0fed8bd Mon Sep 17 00:00:00 2001 From: Marvin Thomas Rabe Date: Tue, 21 Feb 2012 18:28:27 +0100 Subject: [PATCH 04/19] Added missing files --- img/delete.png | Bin 0 -> 275 bytes img/edit.png | Bin 0 -> 310 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 img/delete.png create mode 100644 img/edit.png diff --git a/img/delete.png b/img/delete.png new file mode 100644 index 0000000000000000000000000000000000000000..bc0c782882deaa4f9ecf1676592ddba0cc9aacbc GIT binary patch literal 275 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR4%Pm*(PLD+t=F;b z*eX3n(MkRcKXtZMbAR7WZg&GK3{-9d P-NxYQ>gTe~DWM4f<>O_1 literal 0 HcmV?d00001 diff --git a/img/edit.png b/img/edit.png new file mode 100644 index 0000000000000000000000000000000000000000..9993a092df101d4b2796379ac6f1cbe62f131a3c GIT binary patch literal 310 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR4=coeX%YV7tbaA(MAa9*?eMT*!Qy-Sie zj Date: Tue, 21 Feb 2012 20:28:24 +0100 Subject: [PATCH 05/19] Bookmarks: uses the core action icons --- img/delete.png | Bin 275 -> 0 bytes img/edit.png | Bin 310 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 img/delete.png delete mode 100644 img/edit.png diff --git a/img/delete.png b/img/delete.png deleted file mode 100644 index bc0c782882deaa4f9ecf1676592ddba0cc9aacbc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 275 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR4%Pm*(PLD+t=F;b z*eX3n(MkRcKXtZMbAR7WZg&GK3{-9d P-NxYQ>gTe~DWM4f<>O_1 diff --git a/img/edit.png b/img/edit.png deleted file mode 100644 index 9993a092df101d4b2796379ac6f1cbe62f131a3c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 310 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR4=coeX%YV7tbaA(MAa9*?eMT*!Qy-Sie zj Date: Tue, 21 Feb 2012 22:31:35 +0100 Subject: [PATCH 06/19] UI problems solved. Bookmarks app updated. --- css/bookmarks.css | 5 ++++- js/bookmarks.js | 3 +++ templates/list.php | 10 ++++++---- templates/settings.php | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/css/bookmarks.css b/css/bookmarks.css index 8dfdc8a0..499a4e9c 100644 --- a/css/bookmarks.css +++ b/css/bookmarks.css @@ -1,4 +1,7 @@ -#content { overflow: auto; } +#content { overflow: auto; height: 100%; } +#firstrun { width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777;} +#firstrun small { display: block; font-weight: normal; font-size: 0.5em; } +#firstrun #selections { font-size:0.8em; width: 100%; margin: 2em auto auto auto; clear: both; } .bookmarks_headline { font-size: large; diff --git a/js/bookmarks.js b/js/bookmarks.js index fadbbd55..328f88a4 100644 --- a/js/bookmarks.js +++ b/js/bookmarks.js @@ -35,6 +35,7 @@ function getBookmarks() { for(var i in bookmarks.data) { updateBookmarksList(bookmarks.data[i]); + $("#firstrun").hide(); } $('.bookmark_link').click(recordClick); @@ -71,6 +72,8 @@ function addOrEditBookmark(event) { var tags = encodeEntities($('#bookmark_add_tags').val()); var taglist = tags.split(' '); var tagshtml = ''; + $("#firstrun").hide(); + for ( var i=0, len=taglist.length; i' + taglist[i] + ' '; } diff --git a/templates/list.php b/templates/list.php index d44a0ecb..bd33fe45 100644 --- a/templates/list.php +++ b/templates/list.php @@ -21,9 +21,11 @@

+
+
t('You have no bookmarks'); ?> -
- diff --git a/templates/settings.php b/templates/settings.php index a985ee9d..41433d84 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -8,7 +8,7 @@ ?>
- t('Bookmarklet:');?> t('Add page to ownCloud'); ?> + t('Bookmarklet:');?> ?output=popup&url="+c(b.location)+"&title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=510px,width=550px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300)})();'>t('Add page to ownCloud'); ?>
t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.'); ?>
From 2a17b5f690f36b44f483aea5bcc5632e4a9dc23b Mon Sep 17 00:00:00 2001 From: Marvin Thomas Rabe Date: Tue, 21 Feb 2012 23:08:57 +0100 Subject: [PATCH 07/19] Bookmarklet Window closes itself after submit. --- js/addBm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/addBm.js b/js/addBm.js index 6e13b59b..59735f80 100644 --- a/js/addBm.js +++ b/js/addBm.js @@ -10,7 +10,7 @@ function addBookmark(event) { url: 'ajax/addBookmark.php', data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags), success: function(data){ - location.href='index.php'; + window.close(); } }); } \ No newline at end of file From d205a5404dd893ad8e0b1b51288809c746c14f81 Mon Sep 17 00:00:00 2001 From: Marvin Thomas Rabe Date: Wed, 22 Feb 2012 16:04:17 +0100 Subject: [PATCH 08/19] Removed redundant code. --- addBm.php | 8 +------ ajax/addBookmark.php | 11 ++++++---- ajax/getMeta.php | 39 ----------------------------------- appinfo/app.php | 2 +- appinfo/database.xml | 8 ------- appinfo/info.xml | 4 ++-- js/addBm.js | 3 +-- js/bookmarks.js | 47 +++++++----------------------------------- settings.php | 4 +--- templates/addBm.php | 1 - templates/list.php | 2 +- templates/settings.php | 2 +- 12 files changed, 22 insertions(+), 109 deletions(-) delete mode 100644 ajax/getMeta.php diff --git a/addBm.php b/addBm.php index f56022c4..d3d6ab0b 100644 --- a/addBm.php +++ b/addBm.php @@ -27,8 +27,6 @@ require_once('../../lib/base.php'); OC_Util::checkLoggedIn(); OC_Util::checkAppEnabled('bookmarks'); -require_once('bookmarksHelper.php'); - OC_App::setActiveNavigationEntry( 'bookmarks_index' ); OC_Util::addScript('bookmarks','addBm'); @@ -37,10 +35,6 @@ OC_Util::addStyle('bookmarks', 'bookmarks'); $tmpl = new OC_Template( 'bookmarks', 'addBm', 'user' ); $url = isset($_GET['url']) ? urldecode($_GET['url']) : ''; -$metadata = getURLMetadata($url); - -$tmpl->assign('URL', htmlentities($metadata['url'],ENT_COMPAT,'utf-8')); -$title = isset($metadata['title']) ? $metadata['title'] : (isset($_GET['title']) ? $_GET['title'] : ''); -$tmpl->assign('TITLE', htmlentities($title,ENT_COMPAT,'utf-8')); +$tmpl->assign('URL', htmlentities($url,ENT_COMPAT,'utf-8')); $tmpl->printPage(); diff --git a/ajax/addBookmark.php b/ajax/addBookmark.php index 45b16ae5..89446564 100644 --- a/ajax/addBookmark.php +++ b/ajax/addBookmark.php @@ -45,8 +45,13 @@ $query = OC_DB::prepare(" (url, title, user_id, public, added, lastmodified) VALUES (?, ?, ?, 0, $_ut, $_ut) "); - - + +if(empty($_GET["title"])) { + require_once('../bookmarksHelper.php'); + $metadata = getURLMetadata($_GET["url"]); + $_GET["title"] = $metadata['title']; +} + $params=array( htmlspecialchars_decode($_GET["url"]), htmlspecialchars_decode($_GET["title"]), @@ -56,7 +61,6 @@ $query->execute($params); $b_id = OC_DB::insertid('*PREFIX*bookmarks'); - if($b_id !== false) { $query = OC_DB::prepare(" INSERT INTO *PREFIX*bookmarks_tags @@ -76,4 +80,3 @@ if($b_id !== false) { OC_JSON::success(array('data' => $b_id)); } - diff --git a/ajax/getMeta.php b/ajax/getMeta.php deleted file mode 100644 index ca797315..00000000 --- a/ajax/getMeta.php +++ /dev/null @@ -1,39 +0,0 @@ -. -* -*/ - -//no apps or filesystem -$RUNTIME_NOSETUPFS=true; - -require_once('../../../lib/base.php'); - -// Check if we are a user -OC_JSON::checkLoggedIn(); -OC_JSON::checkAppEnabled('bookmarks'); - -// $metadata = array(); - -require '../bookmarksHelper.php'; -$metadata = getURLMetadata(htmlspecialchars_decode($_GET["url"])); - - -OC_JSON::success(array('data' => $metadata)); diff --git a/appinfo/app.php b/appinfo/app.php index 479d8ed4..a1f6139d 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -1,6 +1,6 @@ +* Copyright (c) 2011 Marvin Thomas Rabe * Copyright (c) 2011 Arthur Schiwon * This file is licensed under the Affero General Public License version 3 or * later. diff --git a/appinfo/database.xml b/appinfo/database.xml index fca38ad8..f2fc68e4 100644 --- a/appinfo/database.xml +++ b/appinfo/database.xml @@ -75,14 +75,6 @@ descending - diff --git a/appinfo/info.xml b/appinfo/info.xml index 23aa6c21..862ab805 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -3,8 +3,8 @@ bookmarks Bookmarks Bookmark manager for ownCloud - 0.1 + 0.2 AGPL - Arthur Schiwon + Arthur Schiwon, Marvin Thomas Rabe 2 \ No newline at end of file diff --git a/js/addBm.js b/js/addBm.js index 59735f80..d64e55e8 100644 --- a/js/addBm.js +++ b/js/addBm.js @@ -4,11 +4,10 @@ $(document).ready(function() { function addBookmark(event) { var url = $('#bookmark_add_url').val(); - var title = $('#bookmark_add_title').val(); var tags = $('#bookmark_add_tags').val(); $.ajax({ url: 'ajax/addBookmark.php', - data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags), + data: 'url=' + encodeURI(url) + '&tags=' + encodeURI(tags), success: function(data){ window.close(); } diff --git a/js/bookmarks.js b/js/bookmarks.js index 328f88a4..6db0969a 100644 --- a/js/bookmarks.js +++ b/js/bookmarks.js @@ -11,8 +11,6 @@ $(document).ready(function() { $('#bookmark_add_submit').click(addOrEditBookmark); $(window).scroll(updateOnBottom); - $('#bookmark_add_url').focusout(getMetadata); - $('.bookmarks_list').empty(); getBookmarks(); @@ -47,20 +45,6 @@ function getBookmarks() { }); } -function getMetadata() { - var url = encodeEntities($('#bookmark_add_url').val()); - $('.loading_meta').css('display','inline'); - $.ajax({ - url: 'ajax/getMeta.php', - data: 'url=' + encodeURIComponent(url), - success: function(pageinfo){ - $('#bookmark_add_url').val(pageinfo.data.url); - $('#bookmark_add_title').val(pageinfo.data.title); - $('.loading_meta').css('display','none'); - } - }); -} - // function addBookmark() { // Instead of creating editBookmark() function, Converted the one above to // addOrEditBookmark() to make .js file more compact. @@ -86,21 +70,9 @@ function addOrEditBookmark(event) { var bookmark_id = response.data; $('.bookmarks_add').slideToggle(); $('.bookmarks_add').children('p').children('.bookmarks_input').val(''); - $('.bookmarks_list').prepend( - '
' + - '

' + - '' + - '' + - ' ' + - '' + - '' + - '' + - '

' + - '

' + title + '

' + - '

' + tagshtml + '

' + - '

' + url + '

' + - '
' - ); + $('.bookmarks_list').empty(); + bookmarks_page = 0; + getBookmarks(); } }); } @@ -112,15 +84,9 @@ function addOrEditBookmark(event) { $('.bookmarks_add').slideToggle(); $('.bookmarks_add').children('p').children('.bookmarks_input').val(''); $('#bookmark_add_id').val('0'); - - var record = $('.bookmark_single[data-id = "' + id + '"]'); - record.children('.bookmark_url:first').text(url); - - var record_title = record.children('.bookmark_title:first').children('a:first'); - record_title.attr('href', url); - record_title.text(title); - - record.children('.bookmark_tags:first').html(tagshtml); + $('.bookmarks_list').empty(); + bookmarks_page = 0; + getBookmarks(); } }); } @@ -162,6 +128,7 @@ function updateBookmarksList(bookmark) { if(!hasProtocol(bookmark.url)) { bookmark.url = 'http://' + bookmark.url; } + if(bookmark.title == '') bookmark.title = bookmark.url; $('.bookmarks_list').append( '
' + '

' + diff --git a/settings.php b/settings.php index 0ace04fa..9d945f64 100644 --- a/settings.php +++ b/settings.php @@ -1,6 +1,6 @@ + * Copyright (c) 2011 Marvin Thomas Rabe * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. @@ -8,6 +8,4 @@ $tmpl = new OC_Template( 'bookmarks', 'settings'); -//OC_Util::addScript('bookmarks','settings'); - return $tmpl->fetchPage(); diff --git a/templates/addBm.php b/templates/addBm.php index c285c357..9067d348 100644 --- a/templates/addBm.php +++ b/templates/addBm.php @@ -1,6 +1,5 @@

-

diff --git a/templates/list.php b/templates/list.php index bd33fe45..d772cb90 100644 --- a/templates/list.php +++ b/templates/list.php @@ -1,6 +1,6 @@ + * Copyright (c) 2011 Marvin Thomas Rabe * Copyright (c) 2011 Arthur Schiwon * This file is licensed under the Affero General Public License version 3 or * later. diff --git a/templates/settings.php b/templates/settings.php index 41433d84..b787e31f 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -1,6 +1,6 @@ + * Copyright (c) 2011 Marvin Thomas Rabe * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. From 1119f803005a824abe087f33d8a7ac3b41192cdb Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Wed, 22 Feb 2012 16:38:05 -0500 Subject: [PATCH 09/19] sharing code between the two bookmarklets --- css/bookmarks.css | 15 +-------------- templates/bookmarklet.php | 8 ++++++++ templates/list.php | 6 ++++-- templates/settings.php | 7 +++++-- 4 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 templates/bookmarklet.php diff --git a/css/bookmarks.css b/css/bookmarks.css index 499a4e9c..7203078f 100644 --- a/css/bookmarks.css +++ b/css/bookmarks.css @@ -1,7 +1,7 @@ #content { overflow: auto; height: 100%; } #firstrun { width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777;} #firstrun small { display: block; font-weight: normal; font-size: 0.5em; } -#firstrun #selections { font-size:0.8em; width: 100%; margin: 2em auto auto auto; clear: both; } +#firstrun #selections { font-size:0.8em; font-weight: normal; width: 100%; margin: 2em auto auto auto; clear: both; } .bookmarks_headline { font-size: large; @@ -87,16 +87,3 @@ display: none; margin-left: 5px; } - -#footer { - color: #999; - font-size: medium; - text-align: center; - position: absolute; - bottom: 10px; - left: 0px; - width: 100%; - height: 20px; - visibility: visible; - display: block -} diff --git a/templates/bookmarklet.php b/templates/bookmarklet.php new file mode 100644 index 00000000..eaae21d1 --- /dev/null +++ b/templates/bookmarklet.php @@ -0,0 +1,8 @@ +" .$l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage:') . " "; + echo ""; + echo $l->t('Add page to ownCloud') . ""; +} diff --git a/templates/list.php b/templates/list.php index d772cb90..ae63d4dc 100644 --- a/templates/list.php +++ b/templates/list.php @@ -24,8 +24,10 @@
diff --git a/templates/settings.php b/templates/settings.php index b787e31f..31edf747 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -8,7 +8,10 @@ ?>
- t('Bookmarklet:');?> ?output=popup&url="+c(b.location)+"&title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=510px,width=550px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300)})();'>t('Add page to ownCloud'); ?> -
t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.'); ?>
+ t('Bookmarklet
');?>
+
From 51a4119beacdb8356e1317121063dba34faffc41 Mon Sep 17 00:00:00 2001 From: Marvin Thomas Rabe Date: Wed, 22 Feb 2012 23:08:50 +0100 Subject: [PATCH 10/19] changed look of bookmarklet --- css/bookmarks.css | 2 +- templates/bookmarklet.php | 8 ++++---- templates/list.php | 8 +++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/css/bookmarks.css b/css/bookmarks.css index 7203078f..fedd2af7 100644 --- a/css/bookmarks.css +++ b/css/bookmarks.css @@ -1,6 +1,6 @@ #content { overflow: auto; height: 100%; } #firstrun { width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777;} -#firstrun small { display: block; font-weight: normal; font-size: 0.5em; } +#firstrun small { display: block; font-weight: normal; font-size: 0.5em; margin-bottom: 1.5em; } #firstrun #selections { font-size:0.8em; font-weight: normal; width: 100%; margin: 2em auto auto auto; clear: both; } .bookmarks_headline { diff --git a/templates/bookmarklet.php b/templates/bookmarklet.php index eaae21d1..5719603d 100644 --- a/templates/bookmarklet.php +++ b/templates/bookmarklet.php @@ -1,8 +1,8 @@ " .$l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage:') . " "; - echo ""; - echo $l->t('Add page to ownCloud') . ""; + $l = new OC_L10N('bookmarks'); + echo '' . $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage:') . '' + . '' + . $l->t('Add page to ownCloud') . ''; } diff --git a/templates/list.php b/templates/list.php index ae63d4dc..46577d16 100644 --- a/templates/list.php +++ b/templates/list.php @@ -23,11 +23,9 @@
- t('You have no bookmarks'); ?> -
t('You have no bookmarks'); + require_once('bookmarklet.php'); + createBookmarklet(); ?> -
From 5a4a8af2f14627a776596f14abc24c36c3a25980 Mon Sep 17 00:00:00 2001 From: Marvin Thomas Rabe Date: Wed, 22 Feb 2012 23:22:17 +0100 Subject: [PATCH 11/19] Updated bookmark form --- css/bookmarks.css | 7 +------ js/bookmarks.js | 18 +++--------------- templates/list.php | 13 ++++--------- 3 files changed, 8 insertions(+), 30 deletions(-) diff --git a/css/bookmarks.css b/css/bookmarks.css index fedd2af7..12ccf938 100644 --- a/css/bookmarks.css +++ b/css/bookmarks.css @@ -15,11 +15,6 @@ padding: 0.5ex; } -.bookmarks_add { - display: none; - margin-top: 45px; -} - .bookmarks_list { margin-top: 36px; } @@ -35,7 +30,7 @@ } .bookmarks_input { - width: 20em; + width: 8em; } .bookmark_actions { diff --git a/js/bookmarks.js b/js/bookmarks.js index 6db0969a..166024ea 100644 --- a/js/bookmarks.js +++ b/js/bookmarks.js @@ -3,11 +3,7 @@ var bookmarks_loading = false; var bookmarks_sorting = 'bookmarks_sorting_recent'; -$(document).ready(function() { - $('.bookmarks_addBtn').click(function(event){ - $('.bookmarks_add').slideToggle(); - }); - +$(document).ready(function() { $('#bookmark_add_submit').click(addOrEditBookmark); $(window).scroll(updateOnBottom); @@ -55,21 +51,14 @@ function addOrEditBookmark(event) { var title = encodeEntities($('#bookmark_add_title').val()); var tags = encodeEntities($('#bookmark_add_tags').val()); var taglist = tags.split(' '); - var tagshtml = ''; $("#firstrun").hide(); - - for ( var i=0, len=taglist.length; i' + taglist[i] + ' '; - } if (id == 0) { $.ajax({ url: 'ajax/addBookmark.php', 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_input').val(''); $('.bookmarks_list').empty(); bookmarks_page = 0; getBookmarks(); @@ -81,8 +70,7 @@ function addOrEditBookmark(event) { url: 'ajax/editBookmark.php', 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(''); + $('.bookmarks_input').val(''); $('#bookmark_add_id').val('0'); $('.bookmarks_list').empty(); bookmarks_page = 0; diff --git a/templates/list.php b/templates/list.php index 46577d16..b3849069 100644 --- a/templates/list.php +++ b/templates/list.php @@ -9,16 +9,11 @@ ?>
- -
-
-

-

-

-

-

-

+ + + +
From 7886728fadd286fde5b9b7b49d4a7f5010f455aa Mon Sep 17 00:00:00 2001 From: Marvin Thomas Rabe Date: Wed, 22 Feb 2012 23:28:36 +0100 Subject: [PATCH 12/19] No bookmarks message will now show up if all bookmarks are delted --- js/bookmarks.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/bookmarks.js b/js/bookmarks.js index 166024ea..2b8dbc3d 100644 --- a/js/bookmarks.js +++ b/js/bookmarks.js @@ -9,7 +9,6 @@ $(document).ready(function() { $('.bookmarks_list').empty(); getBookmarks(); - }); function getBookmarks() { @@ -50,7 +49,6 @@ function addOrEditBookmark(event) { 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(' '); $("#firstrun").hide(); if (id == 0) { @@ -86,7 +84,12 @@ function delBookmark(event) { $.ajax({ url: 'ajax/delBookmark.php', data: 'url=' + encodeURI($(this).parent().parent().children('.bookmark_url:first').text()), - success: function(data){ record.animate({ opacity: 'hide' }, 'fast'); } + success: function(data){ + record.remove(); + if($('.bookmarks_list').is(':empty')) { + $("#firstrun").show(); + } + } }); } From ce672c87d1ae73c4a437f968a28d1d756a98c991 Mon Sep 17 00:00:00 2001 From: Marvin Thomas Rabe Date: Wed, 22 Feb 2012 23:52:56 +0100 Subject: [PATCH 13/19] Changed bookmarklet to read later widget --- addBm.php | 13 +++------- ajax/addBookmark.php | 53 +++------------------------------------ bookmarksHelper.php | 52 ++++++++++++++++++++++++++++++++++++++ css/bookmarks.css | 1 + templates/addBm.php | 17 ++++++++----- templates/bookmarklet.php | 4 +-- 6 files changed, 72 insertions(+), 68 deletions(-) diff --git a/addBm.php b/addBm.php index d3d6ab0b..0225a7aa 100644 --- a/addBm.php +++ b/addBm.php @@ -27,14 +27,7 @@ require_once('../../lib/base.php'); OC_Util::checkLoggedIn(); OC_Util::checkAppEnabled('bookmarks'); -OC_App::setActiveNavigationEntry( 'bookmarks_index' ); +require_once('bookmarksHelper.php'); +addBookmark($_GET['url']); -OC_Util::addScript('bookmarks','addBm'); -OC_Util::addStyle('bookmarks', 'bookmarks'); - -$tmpl = new OC_Template( 'bookmarks', 'addBm', 'user' ); - -$url = isset($_GET['url']) ? urldecode($_GET['url']) : ''; -$tmpl->assign('URL', htmlentities($url,ENT_COMPAT,'utf-8')); - -$tmpl->printPage(); +include 'templates/addBm.php'; diff --git a/ajax/addBookmark.php b/ajax/addBookmark.php index 89446564..8cda7f0f 100644 --- a/ajax/addBookmark.php +++ b/ajax/addBookmark.php @@ -30,53 +30,6 @@ require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('bookmarks'); -$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); -if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){ - $_ut = "strftime('%s','now')"; -} elseif($CONFIG_DBTYPE == 'pgsql') { - $_ut = 'date_part(\'epoch\',now())::integer'; -} else { - $_ut = "UNIX_TIMESTAMP()"; -} - -//FIXME: Detect when user adds a known URL -$query = OC_DB::prepare(" - INSERT INTO *PREFIX*bookmarks - (url, title, user_id, public, added, lastmodified) - VALUES (?, ?, ?, 0, $_ut, $_ut) - "); - -if(empty($_GET["title"])) { - require_once('../bookmarksHelper.php'); - $metadata = getURLMetadata($_GET["url"]); - $_GET["title"] = $metadata['title']; -} - -$params=array( - htmlspecialchars_decode($_GET["url"]), - htmlspecialchars_decode($_GET["title"]), - OC_User::getUser() - ); -$query->execute($params); - -$b_id = OC_DB::insertid('*PREFIX*bookmarks'); - -if($b_id !== false) { - $query = OC_DB::prepare(" - INSERT INTO *PREFIX*bookmarks_tags - (bookmark_id, tag) - VALUES (?, ?) - "); - - $tags = explode(' ', urldecode($_GET["tags"])); - foreach ($tags as $tag) { - if(empty($tag)) { - //avoid saving blankspaces - continue; - } - $params = array($b_id, trim($tag)); - $query->execute($params); - } - - OC_JSON::success(array('data' => $b_id)); -} +require_once('../bookmarksHelper.php'); +$id = addBookmark($_GET['url'], $_GET['title'], $_GET['tags']); +OC_JSON::success(array('data' => $id)); \ No newline at end of file diff --git a/bookmarksHelper.php b/bookmarksHelper.php index ac512fbc..8def7401 100644 --- a/bookmarksHelper.php +++ b/bookmarksHelper.php @@ -70,3 +70,55 @@ function getURLMetadata($url) { return $metadata; } + +function addBookmark($url, $title='', $tags='') { + $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); + if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){ + $_ut = "strftime('%s','now')"; + } elseif($CONFIG_DBTYPE == 'pgsql') { + $_ut = 'date_part(\'epoch\',now())::integer'; + } else { + $_ut = "UNIX_TIMESTAMP()"; + } + + //FIXME: Detect when user adds a known URL + $query = OC_DB::prepare(" + INSERT INTO *PREFIX*bookmarks + (url, title, user_id, public, added, lastmodified) + VALUES (?, ?, ?, 0, $_ut, $_ut) + "); + + if(empty($title)) { + $metadata = getURLMetadata($url); + $title = $metadata['title']; + } + + $params=array( + htmlspecialchars_decode($url), + htmlspecialchars_decode($title), + OC_User::getUser() + ); + $query->execute($params); + + $b_id = OC_DB::insertid('*PREFIX*bookmarks'); + + if($b_id !== false) { + $query = OC_DB::prepare(" + INSERT INTO *PREFIX*bookmarks_tags + (bookmark_id, tag) + VALUES (?, ?) + "); + + $tags = explode(' ', urldecode($tags)); + foreach ($tags as $tag) { + if(empty($tag)) { + //avoid saving blankspaces + continue; + } + $params = array($b_id, trim($tag)); + $query->execute($params); + } + + return $b_id; + } +} \ No newline at end of file diff --git a/css/bookmarks.css b/css/bookmarks.css index 12ccf938..b1139f2c 100644 --- a/css/bookmarks.css +++ b/css/bookmarks.css @@ -1,6 +1,7 @@ #content { overflow: auto; height: 100%; } #firstrun { width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777;} #firstrun small { display: block; font-weight: normal; font-size: 0.5em; margin-bottom: 1.5em; } +#firstrun .button { font-size: 0.7em; } #firstrun #selections { font-size:0.8em; font-weight: normal; width: 100%; margin: 2em auto auto auto; clear: both; } .bookmarks_headline { diff --git a/templates/addBm.php b/templates/addBm.php index 9067d348..dbe673f5 100644 --- a/templates/addBm.php +++ b/templates/addBm.php @@ -1,6 +1,11 @@ -
-

-

-

-

-
+ + + + + Read later - ownCloud + + + +

Saved!

+ + \ No newline at end of file diff --git a/templates/bookmarklet.php b/templates/bookmarklet.php index 5719603d..23779477 100644 --- a/templates/bookmarklet.php +++ b/templates/bookmarklet.php @@ -3,6 +3,6 @@ function createBookmarklet() { $l = new OC_L10N('bookmarks'); echo '' . $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage:') . '' - . '' - . $l->t('Add page to ownCloud') . ''; + . '' + . $l->t('Read later') . ''; } From 4f6a1c63d01010379d132a3fdc94a84820ac12bc Mon Sep 17 00:00:00 2001 From: Marvin Thomas Rabe Date: Wed, 22 Feb 2012 23:53:54 +0100 Subject: [PATCH 14/19] Changed text --- templates/bookmarklet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/bookmarklet.php b/templates/bookmarklet.php index 23779477..3d8bbcc7 100644 --- a/templates/bookmarklet.php +++ b/templates/bookmarklet.php @@ -2,7 +2,7 @@ function createBookmarklet() { $l = new OC_L10N('bookmarks'); - echo '' . $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage:') . '' + echo '' . $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage quickly:') . '' . '' . $l->t('Read later') . ''; } From 189135ec69861d67c9e1d278d6d8268b4744bddb Mon Sep 17 00:00:00 2001 From: Marvin Thomas Rabe Date: Wed, 22 Feb 2012 23:58:38 +0100 Subject: [PATCH 15/19] Little bookmark improvement --- js/bookmarks.js | 3 +++ templates/list.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/js/bookmarks.js b/js/bookmarks.js index 2b8dbc3d..17688615 100644 --- a/js/bookmarks.js +++ b/js/bookmarks.js @@ -30,6 +30,9 @@ function getBookmarks() { updateBookmarksList(bookmarks.data[i]); $("#firstrun").hide(); } + if($('.bookmarks_list').is(':empty')) { + $("#firstrun").show(); + } $('.bookmark_link').click(recordClick); $('.bookmark_delete').click(delBookmark); diff --git a/templates/list.php b/templates/list.php index b3849069..1abdbb7f 100644 --- a/templates/list.php +++ b/templates/list.php @@ -17,7 +17,7 @@
-
+