OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('bookmarks');
-require_once('bookmarksHelper.php');
-
OC_App::setActiveNavigationEntry( 'bookmarks_index' );
OC_Util::addScript('bookmarks','addBm');
$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();
(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"]),
$b_id = OC_DB::insertid('*PREFIX*bookmarks');
-
if($b_id !== false) {
$query = OC_DB::prepare("
INSERT INTO *PREFIX*bookmarks_tags
OC_JSON::success(array('data' => $b_id));
}
-
+++ /dev/null
-<?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));
<?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.
<sorting>descending</sorting>
</field>
</index>
-<!-- <index>
- <name>url</name>
- <unique>true</unique>
- <field>
- <name>url</name>
- <sorting>ascending</sorting>
- </field>
- </index>-->
</declaration>
</table>
<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
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();
}
$('#bookmark_add_submit').click(addOrEditBookmark);
$(window).scroll(updateOnBottom);
- $('#bookmark_add_url').focusout(getMetadata);
-
$('.bookmarks_list').empty();
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.
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> ' +
- '<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();
}
});
}
$('.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();
}
});
}
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">' +
<?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.
$tmpl = new OC_Template( 'bookmarks', 'settings');
-//OC_Util::addScript('bookmarks','settings');
-
return $tmpl->fetchPage();
<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>
<?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.
<?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.