diff --git a/ajax/import.php b/ajax/import.php index 6264bc78..5bf8bfe9 100644 --- a/ajax/import.php +++ b/ajax/import.php @@ -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'); diff --git a/index.php b/index.php index 27761d06..342e2b82 100644 --- a/index.php +++ b/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(); diff --git a/js/addBm.js b/js/addBm.js index 615593ce..25ffa859 100644 --- a/js/addBm.js +++ b/js/addBm.js @@ -74,4 +74,12 @@ }); }; -})(jQuery); \ No newline at end of file +})(jQuery); + +$(document).ready(function() { + $('body').bookmark_dialog({ + 'on_success': function(){ + self.close(); + } + }); +}); \ No newline at end of file diff --git a/js/bookmarks.js b/js/bookmarks.js index 575619fc..f66994c9 100644 --- a/js/bookmarks.js +++ b/js/bookmarks.js @@ -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); diff --git a/js/full_tags.php b/js/full_tags.php index 5bba4f89..931c71aa 100644 --- a/js/full_tags.php +++ b/js/full_tags.php @@ -20,11 +20,4 @@ foreach($qtags as $tag) { } ?> -var fullTags = ; -$(document).ready(function() { - $('body').bookmark_dialog({ - 'on_success': function(){ - self.close(); - } - }); -}); \ No newline at end of file +fullTags = ; \ No newline at end of file diff --git a/js/settings.js b/js/settings.js index 1865983e..22bba6f9 100644 --- a/js/settings.js +++ b/js/settings.js @@ -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 = $("