summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/bookmarks/addBm.php8
-rw-r--r--apps/bookmarks/ajax/addBookmark.php11
-rw-r--r--apps/bookmarks/ajax/getMeta.php39
-rw-r--r--apps/bookmarks/appinfo/app.php2
-rw-r--r--apps/bookmarks/appinfo/database.xml8
-rw-r--r--apps/bookmarks/appinfo/info.xml4
-rw-r--r--apps/bookmarks/js/addBm.js3
-rw-r--r--apps/bookmarks/js/bookmarks.js47
-rw-r--r--apps/bookmarks/settings.php4
-rw-r--r--apps/bookmarks/templates/addBm.php1
-rw-r--r--apps/bookmarks/templates/list.php2
-rw-r--r--apps/bookmarks/templates/settings.php2
12 files changed, 22 insertions, 109 deletions
diff --git a/apps/bookmarks/addBm.php b/apps/bookmarks/addBm.php
index f56022c42c2..d3d6ab0b1a2 100644
--- a/apps/bookmarks/addBm.php
+++ b/apps/bookmarks/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/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php
index 45b16ae5fa6..89446564110 100644
--- a/apps/bookmarks/ajax/addBookmark.php
+++ b/apps/bookmarks/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/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 479d8ed4767..a1f6139d89b 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.
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/js/addBm.js b/apps/bookmarks/js/addBm.js
index 59735f80ca6..d64e55e8920 100644
--- a/apps/bookmarks/js/addBm.js
+++ b/apps/bookmarks/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/apps/bookmarks/js/bookmarks.js b/apps/bookmarks/js/bookmarks.js
index 328f88a45d9..6db0969a2bb 100644
--- a/apps/bookmarks/js/bookmarks.js
+++ b/apps/bookmarks/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(
- '<div class="bookmark_single" data-id="' + bookmark_id + '" >' +
- '<p class="bookmark_actions">' +
- '<span class="bookmark_delete">' +
- '<img class="svg" src="'+OC.imagePath('core', 'actions/delete')+'" title="Delete">' +
- '</span>&nbsp;' +
- '<span class="bookmark_edit">' +
- '<img class="svg" src="'+OC.imagePath('core', 'actions/rename')+'" 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_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(
'<div class="bookmark_single" data-id="' + bookmark.id +'" >' +
'<p class="bookmark_actions">' +
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..9067d3481a3 100644
--- a/apps/bookmarks/templates/addBm.php
+++ b/apps/bookmarks/templates/addBm.php
@@ -1,6 +1,5 @@
<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>
diff --git a/apps/bookmarks/templates/list.php b/apps/bookmarks/templates/list.php
index bd33fe457fd..d772cb905aa 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.
diff --git a/apps/bookmarks/templates/settings.php b/apps/bookmarks/templates/settings.php
index 41433d84767..b787e31f3c5 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.