mirror of
https://github.com/owncloud/bookmarks.git
synced 2025-01-31 01:52:11 +01:00
Rework to have a working popup
This commit is contained in:
parent
8d59e3b9f0
commit
d163d70b92
23
addBm.php
23
addBm.php
@ -27,17 +27,20 @@
|
||||
OCP\User::checkLoggedIn();
|
||||
OCP\App::checkAppEnabled('bookmarks');
|
||||
|
||||
|
||||
require_once('bookmarksHelper.php');
|
||||
|
||||
|
||||
|
||||
if(!isset($_GET['url']) || trim($_GET['url']) == '') {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
$tmpl = new OCP\Template( '', '404', 'guest' );
|
||||
$tmpl->printPage();
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once('bookmarksHelper.php');
|
||||
|
||||
if(isset($_POST['url'])) {
|
||||
addBookmark($_POST['url'], '', 'Read-Later');
|
||||
}elseif(isset($_POST['url'])) {
|
||||
$bm = addBookmark($_POST['url'], $_POST['title'], implode(' ',$_POST['item']['tags']),$_POST['desc'], $_POST['is_public']);
|
||||
OCP\JSON::success(array('id'=>$bm));
|
||||
exit();
|
||||
}
|
||||
|
||||
OCP\Util::addscript('bookmarks','tag-it');
|
||||
@ -45,10 +48,12 @@ OCP\Util::addscript('bookmarks','addBm');
|
||||
OCP\Util::addStyle('bookmarks', 'bookmarks');
|
||||
OCP\Util::addStyle('bookmarks', 'jquery.tagit');
|
||||
|
||||
$bm = array('title'=>'hello world',
|
||||
$datas = getURLMetadata($_GET['url']);
|
||||
|
||||
$bm = array('title'=> $datas['title'] ? $datas['title'] : '' ,
|
||||
'url'=> $_GET['url'],
|
||||
'tags'=> array('@admin','music','test'),
|
||||
'desc'=>'A fancy description',
|
||||
'tags'=> array(),
|
||||
'desc'=>'',
|
||||
'is_public'=>1,
|
||||
);
|
||||
|
||||
|
@ -55,7 +55,6 @@ function getURLMetadata($url) {
|
||||
$url = 'http://' . $url;
|
||||
}
|
||||
$metadata['url'] = $url;
|
||||
|
||||
if (!function_exists('curl_init')){
|
||||
return $metadata;
|
||||
}
|
||||
|
@ -5,9 +5,7 @@ $(document).ready(function() {
|
||||
$('#addBm').submit(bookletSubmit);
|
||||
$('#tags').tagit({
|
||||
allowSpaces: true,
|
||||
availableTags: sampleTags,
|
||||
itemName: 'item',
|
||||
fieldName: 'tags',
|
||||
availableTags: sampleTags
|
||||
});
|
||||
});
|
||||
|
||||
@ -36,7 +34,9 @@ function bookletSubmit(event) {
|
||||
url: $('#addBm').attr('action'),
|
||||
data: $('#addBm').serialize(),
|
||||
success: function(data){
|
||||
if(data.status == 'success'){
|
||||
self.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user