From 859a67ae9a3083812f4df1a8f0be93b97e6d3c7c Mon Sep 17 00:00:00 2001 From: Jenkins for ownCloud Date: Wed, 31 Oct 2012 00:03:12 +0100 Subject: [PATCH 1/4] [tx-robot] updated from transifex --- l10n/nb_NO.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/l10n/nb_NO.php b/l10n/nb_NO.php index 5670ade5..4ffc3fd7 100644 --- a/l10n/nb_NO.php +++ b/l10n/nb_NO.php @@ -1,9 +1,33 @@ "Bokmerker", "Tags" => "Etikett", +"Edit bookmark" => "Endre bokmerke", +"Are you sure you want to remove this tag from every entry?" => "Er du sikker på at du vil slette denne taggen fra alle oppføringene?", +"Warning" => "Advarsel", +"Bookm." => "Bokmrk.", +"Add a bookmark" => "Legg til et bokmerke", +"Close" => "Lukk", +"The title of the page" => "Tittel for siden", +"The address of the page" => "Adressen til siden", +"Description of the page" => "Beskrivelse av siden", +"Save" => "Lagre", "Drag this to your browser bookmarks and click it, when you want to bookmark a webpage quickly:" => "Dra denne over din nettlesers bokmerker og klikk den, hvis du ønsker å hurtig legge til bokmerke for en nettside", "Read later" => "Les senere", +"Edit" => "Endre", +"Delete" => "Slett", +"Cancel" => "Avbryt", "Address" => "Adresse", +"Add bookmark" => "Legg til bokmerke", +"List" => "Liste", +"Image" => "Bilde", +"Hide" => "Skjul", +"Show" => "Vis", +"Related Tags" => "Relaterte tagger", "You have no bookmarks" => "Du har ingen bokmerker", -"Bookmarklet
" => "Bokmerke
" +"Bookmarklet
" => "Bokmerke
", +"Import bookmarks" => "Importer bokmerker", +"Bookmark html file" => "Legg html fil til bokmerker", +"Import" => "Importer", +"Export bookmarks" => "Eksporter bokmerker", +"Export" => "Eksporter" ); From d81c83e65c3533407a4358fcda88fe815855d26a Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Wed, 31 Oct 2012 21:31:43 +0000 Subject: [PATCH 2/4] Bookmark: Migrate setting into app fix #51 --- ajax/import.php | 27 +++++++++++++++++++ appinfo/app.php | 1 - css/bookmarks.css | 37 +++++++++++++++++++++++++ js/bookmarks.js | 8 ++++++ js/settings.js | 57 +++++++++++++++++++++++++++++++++++++++ settings.php | 24 ++--------------- templates/addBm.php | 2 +- templates/bookmarklet.php | 2 +- templates/list.php | 12 +++++++++ templates/settings.php | 31 +++++++++++---------- 10 files changed, 160 insertions(+), 41 deletions(-) create mode 100644 ajax/import.php create mode 100644 js/settings.js diff --git a/ajax/import.php b/ajax/import.php new file mode 100644 index 00000000..6264bc78 --- /dev/null +++ b/ajax/import.php @@ -0,0 +1,27 @@ +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'); +exit(); diff --git a/appinfo/app.php b/appinfo/app.php index 1b4e1ddf..84013d9d 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -17,7 +17,6 @@ OCP\App::addNavigationEntry( array( 'id' => 'bookmarks_index', 'name' => $l->t('Bookmarks') )); -OCP\App::registerPersonal('bookmarks', 'settings'); OCP\Util::addscript('bookmarks', 'bookmarksearch'); OC_Search::registerProvider('OC_Search_Provider_Bookmarks'); diff --git a/css/bookmarks.css b/css/bookmarks.css index 7fe274ae..3062ad9c 100644 --- a/css/bookmarks.css +++ b/css/bookmarks.css @@ -333,4 +333,41 @@ li:hover em { display : none; } position: absolute; right: 1em; top: auto; +} + +#bookmark_settings { + -moz-box-sizing: border-box; + background: none repeat scroll 0 0 #EEEEEE; + border-right: 1px solid #CCCCCC; + border-top: 1px solid #CCCCCC; + bottom: 0; + height: 2.8em; + margin: 0; + overflow: visible; + padding: 0; + position: fixed; + width: 20em; + z-index: 2; +} +#leftcontent #bookmark_settings li{ + padding: 0; + background-color:transparent; +} +#leftcontent #bookmark_settings li:hover{ + background-color:transparent; +} + +#bookmark_settings .controls { + height: 100%; + width: 100%; +} + +#bookmark_settings .controls > li:last-child button { + margin-right: 0.3em; +} +#bookmark_settings button { + height: 2.4em; + margin: 0.15em 0 0 0.15em; + padding: 0.2em 0.1em 0; + width: 2.4em; } \ No newline at end of file diff --git a/js/bookmarks.js b/js/bookmarks.js index dba3cd25..0b5f4f08 100644 --- a/js/bookmarks.js +++ b/js/bookmarks.js @@ -9,6 +9,14 @@ $(document).ready(function() { $('.centercontent').click(clickSideBar); $('#view_type input').click(clickSwitchView); $('#bookmark_add_submit').click(addBookmark); + $('#settingsbtn').on('click keydown', function() { + try { + OC.appSettings({appid:'bookmarks', loadJS:true, cache:false}); + } catch(e) { + alert(e); + } + }); + $(window).resize(function () { fillWindow($('.bookmarks_list')); }); diff --git a/js/settings.js b/js/settings.js new file mode 100644 index 00000000..f005337d --- /dev/null +++ b/js/settings.js @@ -0,0 +1,57 @@ +$(document).ready(function() { + $('#bm_import_submit').click(attachSettingEvent); +}); + + +function attachSettingEvent(event) { + event.preventDefault(); + fileUpload($(this).closest('form'), $('#upload')); +} +function fileUpload(form, result_div) { + + var uploadEventHandler = function () { + var data = {}; + try{ + data = $.parseJSON(iframe.contents().text()); + }catch (e){} + if(data.status == 'error') { + list = $("").addClass('setting_error_list'); + console.log(data); + $.each(data.data,function(index, item){ + list.append($( "
  • " ).text(item)); + }); + result_div.html(list); + } else { + result_div.text(t('bookmark', 'Import completed successfully.')); + } + }; + + // Create the iframe... + var iframe; + if($('#upload_iframe').length === 1) + iframe = $('#upload_iframe') + else { + iframe = $('').attr({ + id: 'upload_iframe', + name: 'upload_iframe', + width: '0', + height: '0', + border: '0', + style: 'display:none' + }).bind('load',uploadEventHandler); + form.append(iframe); + } + + // Set properties of form... + form.attr({ + target: 'upload_iframe', + method: 'post', + enctype: 'multipart/form-data', + encoding: 'multipart/form-data' + }); + + // Submit the form... + form.submit(); + + result_div.text(t('bookmark', 'Uploading...')); +} \ No newline at end of file diff --git a/settings.php b/settings.php index 626bbc9e..dae1d581 100644 --- a/settings.php +++ b/settings.php @@ -8,25 +8,5 @@ OCP\App::checkAppEnabled('bookmarks'); -if (isset($_POST['bm_import'])) { - $error = array(); - - $file = $_FILES['bm_import']['tmp_name']; - if($_FILES['bm_import']['type'] =='text/html') { - $error = OC_Bookmarks_Bookmarks::importFile($file); - - } else { - $error[]= array('error' => 'Unsupported file type for import', - 'hint' => ''); - } - - $tmpl = new OCP\Template('bookmarks', 'settings'); - // Any problems? - if(count($error)) { - $tmpl->assign('error', $error); - } - return $tmpl->fetchPage(); -} else { - $tmpl = new OCP\Template( 'bookmarks', 'settings'); - return $tmpl->fetchPage(); -} +$tmpl = new OCP\Template('bookmarks', 'settings'); +$tmpl->printPage(); diff --git a/templates/addBm.php b/templates/addBm.php index 171b81c8..6457c551 100644 --- a/templates/addBm.php +++ b/templates/addBm.php @@ -1,6 +1,6 @@
    -