diff options
author | Tom Needham <needham.thomas@gmail.com> | 2012-03-02 21:35:48 +0000 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2012-03-02 21:35:48 +0000 |
commit | 45ef2ecf52abc58e5c21105345cb2b0560102939 (patch) | |
tree | 9062ce6085c06c191146607aa8e1df8f3763c938 /apps/bookmarks | |
parent | 33c5b3a2efa8559a3e960e6d8256576aab604869 (diff) | |
parent | 3e84f170e7133d9acc46123ba4c901a24e438b2c (diff) | |
download | nextcloud-server-45ef2ecf52abc58e5c21105345cb2b0560102939.tar.gz nextcloud-server-45ef2ecf52abc58e5c21105345cb2b0560102939.zip |
Fix merge conflict
Diffstat (limited to 'apps/bookmarks')
-rw-r--r-- | apps/bookmarks/addBm.php | 16 | ||||
-rw-r--r-- | apps/bookmarks/ajax/addBookmark.php | 50 | ||||
-rw-r--r-- | apps/bookmarks/ajax/getMeta.php | 39 | ||||
-rw-r--r-- | apps/bookmarks/appinfo/app.php | 8 | ||||
-rw-r--r-- | apps/bookmarks/appinfo/database.xml | 8 | ||||
-rw-r--r-- | apps/bookmarks/appinfo/info.xml | 4 | ||||
-rw-r--r-- | apps/bookmarks/bookmarksHelper.php | 52 | ||||
-rw-r--r-- | apps/bookmarks/css/bookmarks.css | 19 | ||||
-rw-r--r-- | apps/bookmarks/js/addBm.js | 5 | ||||
-rw-r--r-- | apps/bookmarks/js/bookmarks.js | 103 | ||||
-rw-r--r-- | apps/bookmarks/lib/search.php | 7 | ||||
-rw-r--r-- | apps/bookmarks/settings.php | 4 | ||||
-rw-r--r-- | apps/bookmarks/templates/addBm.php | 18 | ||||
-rw-r--r-- | apps/bookmarks/templates/bookmarklet.php | 8 | ||||
-rw-r--r-- | apps/bookmarks/templates/list.php | 25 | ||||
-rw-r--r-- | apps/bookmarks/templates/settings.php | 9 |
16 files changed, 165 insertions, 210 deletions
diff --git a/apps/bookmarks/addBm.php b/apps/bookmarks/addBm.php index 62ad5821dbf..861b677222d 100644 --- a/apps/bookmarks/addBm.php +++ b/apps/bookmarks/addBm.php @@ -28,18 +28,6 @@ OC_Util::checkLoggedIn(); OC_Util::checkAppEnabled('bookmarks'); require_once('bookmarksHelper.php'); +addBookmark($_GET['url'], '', 'Read-Later'); -OC_App::setActiveNavigationEntry( 'bookmarks_index' ); - -OC_Util::addScript('bookmarks','addBm'); -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')); -$tmpl->assign('TITLE', htmlentities($metadata['title'],ENT_COMPAT,'utf-8')); - -$tmpl->printPage(); +include 'templates/addBm.php'; diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php index 45b16ae5fa6..8cda7f0f060 100644 --- a/apps/bookmarks/ajax/addBookmark.php +++ b/apps/bookmarks/ajax/addBookmark.php @@ -30,50 +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) - "); - - -$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/apps/bookmarks/ajax/getMeta.php b/apps/bookmarks/ajax/getMeta.php deleted file mode 100644 index ca797315ef4..00000000000 --- a/apps/bookmarks/ajax/getMeta.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -/** -* ownCloud - bookmarks plugin -* -* @author Arthur Schiwon -* @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -//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/apps/bookmarks/appinfo/app.php b/apps/bookmarks/appinfo/app.php index 54812188418..13d76e08179 100644 --- a/apps/bookmarks/appinfo/app.php +++ b/apps/bookmarks/appinfo/app.php @@ -1,6 +1,6 @@ <?php /** -* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de> +* Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de> * Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de> * This file is licensed under the Affero General Public License version 3 or * later. @@ -8,6 +8,7 @@ */ OC::$CLASSPATH['OC_Bookmarks_Bookmarks'] = 'apps/bookmarks/lib/bookmarks.php'; +OC::$CLASSPATH['OC_Search_Provider_Bookmarks'] = 'apps/bookmarks/lib/search.php'; OC_App::register( array( 'order' => 70, 'id' => 'bookmark', 'name' => 'Bookmarks' )); @@ -15,9 +16,10 @@ $l = new OC_l10n('bookmarks'); OC_App::addNavigationEntry( array( 'id' => 'bookmarks_index', 'order' => 70, 'href' => OC_Helper::linkTo( 'bookmarks', 'index.php' ), 'icon' => OC_Helper::imagePath( 'bookmarks', 'bookmarks.png' ), 'name' => $l->t('Bookmarks'))); OC_App::registerPersonal('bookmarks', 'settings'); -require_once('apps/bookmarks/lib/search.php'); OC_Util::addScript('bookmarks','bookmarksearch'); // Include the migration provider -require_once('apps/bookmarks/lib/migrate.php');
\ No newline at end of file +require_once('apps/bookmarks/lib/migrate.php'); + +OC_Search::registerProvider('OC_Search_Provider_Bookmarks'); diff --git a/apps/bookmarks/appinfo/database.xml b/apps/bookmarks/appinfo/database.xml index fca38ad84b2..f2fc68e4b58 100644 --- a/apps/bookmarks/appinfo/database.xml +++ b/apps/bookmarks/appinfo/database.xml @@ -75,14 +75,6 @@ <sorting>descending</sorting> </field> </index> -<!-- <index> - <name>url</name> - <unique>true</unique> - <field> - <name>url</name> - <sorting>ascending</sorting> - </field> - </index>--> </declaration> </table> diff --git a/apps/bookmarks/appinfo/info.xml b/apps/bookmarks/appinfo/info.xml index 23aa6c219a9..862ab805a60 100644 --- a/apps/bookmarks/appinfo/info.xml +++ b/apps/bookmarks/appinfo/info.xml @@ -3,8 +3,8 @@ <id>bookmarks</id> <name>Bookmarks</name> <description>Bookmark manager for ownCloud</description> - <version>0.1</version> + <version>0.2</version> <licence>AGPL</licence> - <author>Arthur Schiwon</author> + <author>Arthur Schiwon, Marvin Thomas Rabe</author> <require>2</require> </info>
\ No newline at end of file diff --git a/apps/bookmarks/bookmarksHelper.php b/apps/bookmarks/bookmarksHelper.php index ac512fbc241..8def7401e2f 100644 --- a/apps/bookmarks/bookmarksHelper.php +++ b/apps/bookmarks/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/apps/bookmarks/css/bookmarks.css b/apps/bookmarks/css/bookmarks.css index 48f0bede110..3a3e0fbf6b3 100644 --- a/apps/bookmarks/css/bookmarks.css +++ b/apps/bookmarks/css/bookmarks.css @@ -1,4 +1,8 @@ -#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; 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 { font-size: large; @@ -12,13 +16,10 @@ padding: 0.5ex; } -.bookmarks_add { - display: none; - margin-top: 45px; -} - .bookmarks_list { - margin-top: 36px; + overflow: auto; + position: fixed; + top: 6.5em; } .bookmarks_addBml { @@ -32,7 +33,7 @@ } .bookmarks_input { - width: 20em; + width: 8em; } .bookmark_actions { @@ -83,4 +84,4 @@ .loading_meta { display: none; margin-left: 5px; -}
\ No newline at end of file +} diff --git a/apps/bookmarks/js/addBm.js b/apps/bookmarks/js/addBm.js index 6e13b59bb2e..d64e55e8920 100644 --- a/apps/bookmarks/js/addBm.js +++ b/apps/bookmarks/js/addBm.js @@ -4,13 +4,12 @@ $(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){ - location.href='index.php'; + window.close(); } }); }
\ No newline at end of file diff --git a/apps/bookmarks/js/bookmarks.js b/apps/bookmarks/js/bookmarks.js index 77f767cdb81..fa5adde2545 100644 --- a/apps/bookmarks/js/bookmarks.js +++ b/apps/bookmarks/js/bookmarks.js @@ -3,19 +3,16 @@ 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); - - $('#bookmark_add_url').focusout(getMetadata); + $(window).resize(function () { + fillWindow($('.bookmarks_list')); + }); + $(window).resize(); + $($('.bookmarks_list')).scroll(updateOnBottom); $('.bookmarks_list').empty(); getBookmarks(); - }); function getBookmarks() { @@ -28,13 +25,19 @@ function getBookmarks() { url: 'ajax/updateList.php', data: 'tag=' + encodeURI($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting, success: function(bookmarks){ - bookmarks_page += 1; + if (bookmarks.data.length) { + bookmarks_page += 1; + } $('.bookmark_link').unbind('click', recordClick); $('.bookmark_delete').unbind('click', delBookmark); $('.bookmark_edit').unbind('click', showBookmark); for(var i in bookmarks.data) { updateBookmarksList(bookmarks.data[i]); + $("#firstrun").hide(); + } + if($('.bookmarks_list').is(':empty')) { + $("#firstrun").show(); } $('.bookmark_link').click(recordClick); @@ -42,24 +45,13 @@ function getBookmarks() { $('.bookmark_edit').click(showBookmark); bookmarks_loading = false; + if (bookmarks.data.length) { + updateOnBottom() + } } }); } -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. @@ -69,28 +61,17 @@ 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(' '); - 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> '; - } + $("#firstrun").hide(); 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_list').prepend( - '<div class="bookmark_single" data-id="' + bookmark_id + '" >' + - '<p class="bookmark_actions"><span class="bookmark_delete"><img src="img/delete.png" title="Delete"></span> <span class="bookmark_edit"><img src="img/edit.png" title="Edit"></span></p>' + - '<p class="bookmark_title"><a href="' + url + '" target="_blank" class="bookmark_link">' + title + '</a></p>' + - '<p class="bookmark_tags">' + tagshtml + '</p>' + - '<p class="bookmark_url">' + url + '</p>' + - '</div>' - ); + $('.bookmarks_input').val(''); + $('.bookmarks_list').empty(); + bookmarks_page = 0; + getBookmarks(); } }); } @@ -99,18 +80,11 @@ 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'); - - 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(); } }); } @@ -122,7 +96,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(); + } + } }); } @@ -152,10 +131,20 @@ function updateBookmarksList(bookmark) { if(!hasProtocol(bookmark.url)) { bookmark.url = 'http://' + bookmark.url; } + if(bookmark.title == '') bookmark.title = bookmark.url; $('.bookmarks_list').append( '<div class="bookmark_single" data-id="' + bookmark.id +'" >' + - '<p class="bookmark_actions"><span class="bookmark_delete"><img src="img/delete.png" title="Delete"></span> <span class="bookmark_edit"><img src="img/edit.png" title="Edit"></span></p>' + - '<p class="bookmark_title"><a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a></p>' + + '<p class="bookmark_actions">' + + '<span class="bookmark_edit">' + + '<img class="svg" src="'+OC.imagePath('core', 'actions/rename')+'" title="Edit">' + + '</span>' + + '<span class="bookmark_delete">' + + '<img class="svg" src="'+OC.imagePath('core', 'actions/delete')+'" title="Delete">' + + '</span> ' + + '</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>' + '</div>' ); @@ -166,7 +155,11 @@ function updateBookmarksList(bookmark) { function updateOnBottom() { //check wether user is on bottom of the page - if ($('body').height() <= ($(window).height() + $(window).scrollTop())) { + var top = $('.bookmarks_list>:last-child').position().top; + var height = $('.bookmarks_list').height(); + // use a bit of margin to begin loading before we are really at the + // bottom + if (top < height * 1.2) { getBookmarks(); } } diff --git a/apps/bookmarks/lib/search.php b/apps/bookmarks/lib/search.php index 59495db82ea..235587855d9 100644 --- a/apps/bookmarks/lib/search.php +++ b/apps/bookmarks/lib/search.php @@ -20,8 +20,8 @@ * */ -class OC_Search_Provider_Bookmarks extends OC_Search_Provider{ - function search($query){ +class OC_Search_Provider_Bookmarks implements OC_Search_Provider{ + static function search($query){ $results=array(); $offset = 0; @@ -45,6 +45,3 @@ class OC_Search_Provider_Bookmarks extends OC_Search_Provider{ return $results; } } -new OC_Search_Provider_Bookmarks(); - -?> diff --git a/apps/bookmarks/settings.php b/apps/bookmarks/settings.php index 0ace04fa2c8..9d945f64dad 100644 --- a/apps/bookmarks/settings.php +++ b/apps/bookmarks/settings.php @@ -1,6 +1,6 @@ <?php /** - * Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de> + * Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de> * 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/apps/bookmarks/templates/addBm.php b/apps/bookmarks/templates/addBm.php index c285c3579c5..dbe673f53a8 100644 --- a/apps/bookmarks/templates/addBm.php +++ b/apps/bookmarks/templates/addBm.php @@ -1,7 +1,11 @@ -<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('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> +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Read later - ownCloud</title> + <link rel="stylesheet" href="css/readlater.css"> + </head> + <body> + <div class="message"><h1>Saved!</h1></div> + </body> +</html>
\ No newline at end of file diff --git a/apps/bookmarks/templates/bookmarklet.php b/apps/bookmarks/templates/bookmarklet.php new file mode 100644 index 00000000000..5ea67f04df2 --- /dev/null +++ b/apps/bookmarks/templates/bookmarklet.php @@ -0,0 +1,8 @@ +<?php + +function createBookmarklet() { + $l = new OC_L10N('bookmarks'); + echo '<small>' . $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage quickly:') . '</small>' + . '<a class="bookmarklet" href="javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open(\'' . OC_Helper::linkToAbsolute('bookmarks', 'addBm.php') . '?output=popup&url=\'+c(b.location),\'bkmk_popup\',\'left=\'+((a.screenX||a.screenLeft)+10)+\',top=\'+((a.screenY||a.screenTop)+10)+\',height=230px,width=230px,resizable=1,alwaysRaised=1\');a.setTimeout(function(){d.focus()},300);})();">' + . $l->t('Read later') . '</a>'; +} diff --git a/apps/bookmarks/templates/list.php b/apps/bookmarks/templates/list.php index ccfe74f008f..1abdbb7f838 100644 --- a/apps/bookmarks/templates/list.php +++ b/apps/bookmarks/templates/list.php @@ -1,6 +1,6 @@ <?php /** - * Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de> + * Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de> * Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de> * This file is licensed under the Affero General Public License version 3 or * later. @@ -9,17 +9,18 @@ ?> <input type="hidden" id="bookmarkFilterTag" value="<?php if(isset($_GET['tag'])) echo htmlentities($_GET['tag']); ?>" /> <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('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> + <input type="text" id="bookmark_add_url" placeholder="<?php echo $l->t('Address'); ?>" class="bookmarks_input" /> + <input type="text" id="bookmark_add_title" placeholder="<?php echo $l->t('Title'); ?>" class="bookmarks_input" /> + <input type="text" id="bookmark_add_tags" placeholder="<?php echo $l->t('Tags'); ?>" class="bookmarks_input" /> + <input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" /> </div> <div class="bookmarks_list"> - <?php echo $l->t('You have no bookmarks'); ?> -</div>
\ No newline at end of file +</div> +<div id="firstrun" style="display: none;"> + <?php + echo $l->t('You have no bookmarks'); + require_once('bookmarklet.php'); + createBookmarklet(); + ?> +</div> diff --git a/apps/bookmarks/templates/settings.php b/apps/bookmarks/templates/settings.php index 97b6b256c09..31edf7478bf 100644 --- a/apps/bookmarks/templates/settings.php +++ b/apps/bookmarks/templates/settings.php @@ -1,6 +1,6 @@ <?php /** - * Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de> + * Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. @@ -8,7 +8,10 @@ ?> <form id="bookmarks"> <fieldset class="personalblock"> - <span class="bold"><?php echo $l->t('Bookmarklet:');?></span> <a class="bookmarks_addBml" href="javascript:(function(){url=encodeURIComponent(location.href);window.open('<?php echo OC_Helper::linkTo('bookmarks', 'addBm.php', null, true); ?>?url='+url, 'owncloud-bookmarks') })()"><?php echo $l->t('Add page to ownCloud'); ?></a> - <br/><em><?php echo $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.'); ?></em><br /> + <span class="bold"><?php echo $l->t('Bookmarklet <br />');?></span> + <?php + require_once('bookmarklet.php'); + createBookmarklet(); + ?> </fieldset> </form> |