mirror of
https://github.com/owncloud/bookmarks.git
synced 2025-02-21 18:54:32 +01:00
Fix merge conflict
This commit is contained in:
commit
97c67fe734
16
addBm.php
16
addBm.php
@ -28,18 +28,6 @@ OC_Util::checkLoggedIn();
|
|||||||
OC_Util::checkAppEnabled('bookmarks');
|
OC_Util::checkAppEnabled('bookmarks');
|
||||||
|
|
||||||
require_once('bookmarksHelper.php');
|
require_once('bookmarksHelper.php');
|
||||||
|
addBookmark($_GET['url'], '', 'Read-Later');
|
||||||
|
|
||||||
OC_App::setActiveNavigationEntry( 'bookmarks_index' );
|
include 'templates/addBm.php';
|
||||||
|
|
||||||
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();
|
|
||||||
|
@ -30,50 +30,6 @@ require_once('../../../lib/base.php');
|
|||||||
OC_JSON::checkLoggedIn();
|
OC_JSON::checkLoggedIn();
|
||||||
OC_JSON::checkAppEnabled('bookmarks');
|
OC_JSON::checkAppEnabled('bookmarks');
|
||||||
|
|
||||||
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
|
require_once('../bookmarksHelper.php');
|
||||||
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
|
$id = addBookmark($_GET['url'], $_GET['title'], $_GET['tags']);
|
||||||
$_ut = "strftime('%s','now')";
|
OC_JSON::success(array('data' => $id));
|
||||||
} 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));
|
|
||||||
}
|
|
||||||
|
|
@ -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));
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?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>
|
* Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||||
* This file is licensed under the Affero General Public License version 3 or
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
* later.
|
* later.
|
||||||
@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
OC::$CLASSPATH['OC_Bookmarks_Bookmarks'] = 'apps/bookmarks/lib/bookmarks.php';
|
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' ));
|
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::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');
|
OC_App::registerPersonal('bookmarks', 'settings');
|
||||||
require_once('apps/bookmarks/lib/search.php');
|
|
||||||
OC_Util::addScript('bookmarks','bookmarksearch');
|
OC_Util::addScript('bookmarks','bookmarksearch');
|
||||||
|
|
||||||
// Include the migration provider
|
// Include the migration provider
|
||||||
|
|
||||||
require_once('apps/bookmarks/lib/migrate.php');
|
require_once('apps/bookmarks/lib/migrate.php');
|
||||||
|
|
||||||
|
OC_Search::registerProvider('OC_Search_Provider_Bookmarks');
|
||||||
|
@ -75,14 +75,6 @@
|
|||||||
<sorting>descending</sorting>
|
<sorting>descending</sorting>
|
||||||
</field>
|
</field>
|
||||||
</index>
|
</index>
|
||||||
<!-- <index>
|
|
||||||
<name>url</name>
|
|
||||||
<unique>true</unique>
|
|
||||||
<field>
|
|
||||||
<name>url</name>
|
|
||||||
<sorting>ascending</sorting>
|
|
||||||
</field>
|
|
||||||
</index>-->
|
|
||||||
</declaration>
|
</declaration>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
<id>bookmarks</id>
|
<id>bookmarks</id>
|
||||||
<name>Bookmarks</name>
|
<name>Bookmarks</name>
|
||||||
<description>Bookmark manager for ownCloud</description>
|
<description>Bookmark manager for ownCloud</description>
|
||||||
<version>0.1</version>
|
<version>0.2</version>
|
||||||
<licence>AGPL</licence>
|
<licence>AGPL</licence>
|
||||||
<author>Arthur Schiwon</author>
|
<author>Arthur Schiwon, Marvin Thomas Rabe</author>
|
||||||
<require>2</require>
|
<require>2</require>
|
||||||
</info>
|
</info>
|
@ -70,3 +70,55 @@ function getURLMetadata($url) {
|
|||||||
|
|
||||||
return $metadata;
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -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 {
|
.bookmarks_headline {
|
||||||
font-size: large;
|
font-size: large;
|
||||||
@ -12,13 +16,10 @@
|
|||||||
padding: 0.5ex;
|
padding: 0.5ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bookmarks_add {
|
|
||||||
display: none;
|
|
||||||
margin-top: 45px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bookmarks_list {
|
.bookmarks_list {
|
||||||
margin-top: 36px;
|
overflow: auto;
|
||||||
|
position: fixed;
|
||||||
|
top: 6.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bookmarks_addBml {
|
.bookmarks_addBml {
|
||||||
@ -32,7 +33,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.bookmarks_input {
|
.bookmarks_input {
|
||||||
width: 20em;
|
width: 8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bookmark_actions {
|
.bookmark_actions {
|
||||||
|
@ -4,13 +4,12 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
function addBookmark(event) {
|
function addBookmark(event) {
|
||||||
var url = $('#bookmark_add_url').val();
|
var url = $('#bookmark_add_url').val();
|
||||||
var title = $('#bookmark_add_title').val();
|
|
||||||
var tags = $('#bookmark_add_tags').val();
|
var tags = $('#bookmark_add_tags').val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'ajax/addBookmark.php',
|
url: 'ajax/addBookmark.php',
|
||||||
data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
|
data: 'url=' + encodeURI(url) + '&tags=' + encodeURI(tags),
|
||||||
success: function(data){
|
success: function(data){
|
||||||
location.href='index.php';
|
window.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
101
js/bookmarks.js
101
js/bookmarks.js
@ -4,18 +4,15 @@ var bookmarks_loading = false;
|
|||||||
var bookmarks_sorting = 'bookmarks_sorting_recent';
|
var bookmarks_sorting = 'bookmarks_sorting_recent';
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.bookmarks_addBtn').click(function(event){
|
|
||||||
$('.bookmarks_add').slideToggle();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#bookmark_add_submit').click(addOrEditBookmark);
|
$('#bookmark_add_submit').click(addOrEditBookmark);
|
||||||
$(window).scroll(updateOnBottom);
|
$(window).resize(function () {
|
||||||
|
fillWindow($('.bookmarks_list'));
|
||||||
$('#bookmark_add_url').focusout(getMetadata);
|
});
|
||||||
|
$(window).resize();
|
||||||
|
$($('.bookmarks_list')).scroll(updateOnBottom);
|
||||||
|
|
||||||
$('.bookmarks_list').empty();
|
$('.bookmarks_list').empty();
|
||||||
getBookmarks();
|
getBookmarks();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function getBookmarks() {
|
function getBookmarks() {
|
||||||
@ -28,13 +25,19 @@ function getBookmarks() {
|
|||||||
url: 'ajax/updateList.php',
|
url: 'ajax/updateList.php',
|
||||||
data: 'tag=' + encodeURI($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting,
|
data: 'tag=' + encodeURI($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting,
|
||||||
success: function(bookmarks){
|
success: function(bookmarks){
|
||||||
bookmarks_page += 1;
|
if (bookmarks.data.length) {
|
||||||
|
bookmarks_page += 1;
|
||||||
|
}
|
||||||
$('.bookmark_link').unbind('click', recordClick);
|
$('.bookmark_link').unbind('click', recordClick);
|
||||||
$('.bookmark_delete').unbind('click', delBookmark);
|
$('.bookmark_delete').unbind('click', delBookmark);
|
||||||
$('.bookmark_edit').unbind('click', showBookmark);
|
$('.bookmark_edit').unbind('click', showBookmark);
|
||||||
|
|
||||||
for(var i in bookmarks.data) {
|
for(var i in bookmarks.data) {
|
||||||
updateBookmarksList(bookmarks.data[i]);
|
updateBookmarksList(bookmarks.data[i]);
|
||||||
|
$("#firstrun").hide();
|
||||||
|
}
|
||||||
|
if($('.bookmarks_list').is(':empty')) {
|
||||||
|
$("#firstrun").show();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.bookmark_link').click(recordClick);
|
$('.bookmark_link').click(recordClick);
|
||||||
@ -42,20 +45,9 @@ function getBookmarks() {
|
|||||||
$('.bookmark_edit').click(showBookmark);
|
$('.bookmark_edit').click(showBookmark);
|
||||||
|
|
||||||
bookmarks_loading = false;
|
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');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -69,28 +61,17 @@ function addOrEditBookmark(event) {
|
|||||||
var url = encodeEntities($('#bookmark_add_url').val());
|
var url = encodeEntities($('#bookmark_add_url').val());
|
||||||
var title = encodeEntities($('#bookmark_add_title').val());
|
var title = encodeEntities($('#bookmark_add_title').val());
|
||||||
var tags = encodeEntities($('#bookmark_add_tags').val());
|
var tags = encodeEntities($('#bookmark_add_tags').val());
|
||||||
var taglist = tags.split(' ');
|
$("#firstrun").hide();
|
||||||
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) {
|
if (id == 0) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'ajax/addBookmark.php',
|
url: 'ajax/addBookmark.php',
|
||||||
data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
|
data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
|
||||||
success: function(response){
|
success: function(response){
|
||||||
var bookmark_id = response.data;
|
$('.bookmarks_input').val('');
|
||||||
$('.bookmarks_add').slideToggle();
|
$('.bookmarks_list').empty();
|
||||||
$('.bookmarks_add').children('p').children('.bookmarks_input').val('');
|
bookmarks_page = 0;
|
||||||
$('.bookmarks_list').prepend(
|
getBookmarks();
|
||||||
'<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>'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -99,18 +80,11 @@ function addOrEditBookmark(event) {
|
|||||||
url: 'ajax/editBookmark.php',
|
url: 'ajax/editBookmark.php',
|
||||||
data: 'id=' + id + '&url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
|
data: 'id=' + id + '&url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
|
||||||
success: function(){
|
success: function(){
|
||||||
$('.bookmarks_add').slideToggle();
|
$('.bookmarks_input').val('');
|
||||||
$('.bookmarks_add').children('p').children('.bookmarks_input').val('');
|
|
||||||
$('#bookmark_add_id').val('0');
|
$('#bookmark_add_id').val('0');
|
||||||
|
$('.bookmarks_list').empty();
|
||||||
var record = $('.bookmark_single[data-id = "' + id + '"]');
|
bookmarks_page = 0;
|
||||||
record.children('.bookmark_url:first').text(url);
|
getBookmarks();
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -122,7 +96,12 @@ function delBookmark(event) {
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'ajax/delBookmark.php',
|
url: 'ajax/delBookmark.php',
|
||||||
data: 'url=' + encodeURI($(this).parent().parent().children('.bookmark_url:first').text()),
|
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)) {
|
if(!hasProtocol(bookmark.url)) {
|
||||||
bookmark.url = 'http://' + bookmark.url;
|
bookmark.url = 'http://' + bookmark.url;
|
||||||
}
|
}
|
||||||
|
if(bookmark.title == '') bookmark.title = bookmark.url;
|
||||||
$('.bookmarks_list').append(
|
$('.bookmarks_list').append(
|
||||||
'<div class="bookmark_single" data-id="' + bookmark.id +'" >' +
|
'<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_actions">' +
|
||||||
'<p class="bookmark_title"><a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a></p>' +
|
'<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>' +
|
'<p class="bookmark_url">' + encodeEntities(bookmark.url) + '</p>' +
|
||||||
'</div>'
|
'</div>'
|
||||||
);
|
);
|
||||||
@ -166,7 +155,11 @@ function updateBookmarksList(bookmark) {
|
|||||||
|
|
||||||
function updateOnBottom() {
|
function updateOnBottom() {
|
||||||
//check wether user is on bottom of the page
|
//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();
|
getBookmarks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OC_Search_Provider_Bookmarks extends OC_Search_Provider{
|
class OC_Search_Provider_Bookmarks implements OC_Search_Provider{
|
||||||
function search($query){
|
static function search($query){
|
||||||
$results=array();
|
$results=array();
|
||||||
|
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
@ -45,6 +45,3 @@ class OC_Search_Provider_Bookmarks extends OC_Search_Provider{
|
|||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
new OC_Search_Provider_Bookmarks();
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?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
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
* later.
|
* later.
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
@ -8,6 +8,4 @@
|
|||||||
|
|
||||||
$tmpl = new OC_Template( 'bookmarks', 'settings');
|
$tmpl = new OC_Template( 'bookmarks', 'settings');
|
||||||
|
|
||||||
//OC_Util::addScript('bookmarks','settings');
|
|
||||||
|
|
||||||
return $tmpl->fetchPage();
|
return $tmpl->fetchPage();
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
<div class="bookmarks_addBm">
|
<!DOCTYPE html>
|
||||||
<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>
|
<html lang="en">
|
||||||
<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>
|
<head>
|
||||||
<p><label class="bookmarks_label"><?php echo $l->t('Tags'); ?></label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
|
<meta charset="utf-8">
|
||||||
<p><label class="bookmarks_label"> </label><label class="bookmarks_hint"><?php echo $l->t('Hint: Use space to separate tags.'); ?></label></p>
|
<title>Read later - ownCloud</title>
|
||||||
<p><label class="bookmarks_label"></label><input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" /></p>
|
<link rel="stylesheet" href="css/readlater.css">
|
||||||
</div>
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="message"><h1>Saved!</h1></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
8
templates/bookmarklet.php
Normal file
8
templates/bookmarklet.php
Normal file
@ -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>';
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?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>
|
* Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||||
* This file is licensed under the Affero General Public License version 3 or
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
* later.
|
* later.
|
||||||
@ -9,17 +9,18 @@
|
|||||||
?>
|
?>
|
||||||
<input type="hidden" id="bookmarkFilterTag" value="<?php if(isset($_GET['tag'])) echo htmlentities($_GET['tag']); ?>" />
|
<input type="hidden" id="bookmarkFilterTag" value="<?php if(isset($_GET['tag'])) echo htmlentities($_GET['tag']); ?>" />
|
||||||
<div id="controls">
|
<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" />
|
<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>
|
<input type="text" id="bookmark_add_url" placeholder="<?php echo $l->t('Address'); ?>" class="bookmarks_input" />
|
||||||
<p><label class="bookmarks_label"><?php echo $l->t('Title'); ?></label><input type="text" id="bookmark_add_title" class="bookmarks_input" />
|
<input type="text" id="bookmark_add_title" placeholder="<?php echo $l->t('Title'); ?>" class="bookmarks_input" />
|
||||||
<img class="loading_meta" src="<?php echo OC_Helper::imagePath('core', 'loading.gif'); ?>" /></p>
|
<input type="text" id="bookmark_add_tags" placeholder="<?php echo $l->t('Tags'); ?>" class="bookmarks_input" />
|
||||||
<p><label class="bookmarks_label"><?php echo $l->t('Tags'); ?></label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
|
<input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" />
|
||||||
<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>
|
||||||
<div class="bookmarks_list">
|
<div class="bookmarks_list">
|
||||||
<?php echo $l->t('You have no bookmarks'); ?>
|
</div>
|
||||||
|
<div id="firstrun" style="display: none;">
|
||||||
|
<?php
|
||||||
|
echo $l->t('You have no bookmarks');
|
||||||
|
require_once('bookmarklet.php');
|
||||||
|
createBookmarklet();
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?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
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
* later.
|
* later.
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
@ -8,7 +8,10 @@
|
|||||||
?>
|
?>
|
||||||
<form id="bookmarks">
|
<form id="bookmarks">
|
||||||
<fieldset class="personalblock">
|
<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>
|
<span class="bold"><?php echo $l->t('Bookmarklet <br />');?></span>
|
||||||
<br/><em><?php echo $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.'); ?></em><br />
|
<?php
|
||||||
|
require_once('bookmarklet.php');
|
||||||
|
createBookmarklet();
|
||||||
|
?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user