mirror of
https://github.com/owncloud/bookmarks.git
synced 2024-12-01 05:24:11 +01:00
Bookmark: Correct JS and import functions
This commit is contained in:
parent
4604f72109
commit
cd79eac477
@ -4,10 +4,10 @@ OCP\App::checkAppEnabled('bookmarks');
|
||||
|
||||
|
||||
$l = new OC_l10n('bookmarks');
|
||||
|
||||
if (isset($_FILES['bm_import'])) {
|
||||
$error = array();
|
||||
|
||||
if(empty($_FILES)) {
|
||||
OCP\Util::writeLog('bookmarks',"No file provided for import", \OCP\Util::WARN);
|
||||
$error[]= $l->t('No file provided for import');
|
||||
}elseif (isset($_FILES['bm_import'])) {
|
||||
$file = $_FILES['bm_import']['tmp_name'];
|
||||
if($_FILES['bm_import']['type'] =='text/html') {
|
||||
$error = OC_Bookmarks_Bookmarks::importFile($file);
|
||||
@ -21,6 +21,7 @@ if (isset($_FILES['bm_import'])) {
|
||||
$error[]= $l->t('Unsupported file type for import');
|
||||
}
|
||||
}
|
||||
|
||||
OC_JSON::error(array('data'=>$error));
|
||||
//force charset as not set by OC_JSON
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
11
index.php
11
index.php
@ -32,22 +32,11 @@ OCP\App::setActiveNavigationEntry( 'bookmarks_index' );
|
||||
OCP\Util::addscript('bookmarks', 'settings');
|
||||
OCP\Util::addscript('bookmarks', 'bookmarks');
|
||||
OCP\Util::addStyle('bookmarks', 'bookmarks');
|
||||
OCP\Util::addscript('bookmarks', 'addBm');
|
||||
|
||||
|
||||
OCP\Util::addscript('bookmarks/3rdparty', 'tag-it');
|
||||
OCP\Util::addscript('bookmarks/3rdparty', 'js_tpl');
|
||||
OCP\Util::addStyle('bookmarks/3rdparty', 'jquery.tagit');
|
||||
$qtags = OC_Bookmarks_Bookmarks::findTags(array(), 0, 400);
|
||||
|
||||
$tags = array();
|
||||
foreach($qtags as $tag) {
|
||||
$tags[] = $tag['tag'];
|
||||
}
|
||||
|
||||
|
||||
$tmpl = new OCP\Template( 'bookmarks', 'list', 'user' );
|
||||
|
||||
$tmpl->assign('req_tag', isset($_GET['tag']) ? $_GET['tag'] : '');
|
||||
$tmpl->assign('tags', json_encode($tags), false);
|
||||
$tmpl->printPage();
|
||||
|
@ -75,3 +75,11 @@
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
$(document).ready(function() {
|
||||
$('body').bookmark_dialog({
|
||||
'on_success': function(){
|
||||
self.close();
|
||||
}
|
||||
});
|
||||
});
|
@ -2,7 +2,7 @@ var bookmarks_page = 0;
|
||||
var bookmarks_loading = false;
|
||||
var dialog;
|
||||
var bookmarks_sorting = 'bookmarks_sorting_recent';
|
||||
|
||||
var fullTags = [];
|
||||
$(document).ready(function() {
|
||||
watchUrlField();
|
||||
$('#bm_import').change(attachSettingEvent);
|
||||
|
@ -20,11 +20,4 @@ foreach($qtags as $tag) {
|
||||
}
|
||||
|
||||
?>
|
||||
var fullTags = <?php echo json_encode($tags);?>;
|
||||
$(document).ready(function() {
|
||||
$('body').bookmark_dialog({
|
||||
'on_success': function(){
|
||||
self.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
fullTags = <?php echo json_encode($tags);?>;
|
@ -14,6 +14,10 @@ function fileUpload(form, result_div) {
|
||||
try{
|
||||
data = $.parseJSON(iframe.contents().text());
|
||||
}catch (e){}
|
||||
if(!data) {
|
||||
result_div.text(t('bookmark', 'Import error'));
|
||||
return;
|
||||
}
|
||||
if(data.status == 'error') {
|
||||
list = $("<ul></ul>").addClass('setting_error_list');
|
||||
console.log(data);
|
||||
|
Loading…
Reference in New Issue
Block a user