diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2012-04-15 16:01:06 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2012-04-15 16:01:06 +0200 |
commit | 679ddc0e327991a097c7ca52c11ef13d18cd389c (patch) | |
tree | c96356f9c9752c3d6ef807d9d31b784ca7cff856 | |
parent | f36d31f74d8500e1f450a4829e65ec4b81d4d18e (diff) | |
parent | 80f4c4f9234d7c7e8d035054ac20b7a7749df5b0 (diff) | |
download | nextcloud-server-679ddc0e327991a097c7ca52c11ef13d18cd389c.tar.gz nextcloud-server-679ddc0e327991a097c7ca52c11ef13d18cd389c.zip |
Merge branch 'master' of gitorious.org:owncloud/owncloud
-rw-r--r-- | apps/bookmarks/js/bookmarks.js | 36 | ||||
-rw-r--r-- | files/appinfo/app.php | 2 | ||||
-rw-r--r-- | files/js/filelist.js | 6 | ||||
-rw-r--r-- | settings/ajax/setlanguage.php | 10 |
4 files changed, 30 insertions, 24 deletions
diff --git a/apps/bookmarks/js/bookmarks.js b/apps/bookmarks/js/bookmarks.js index 9502af0a00d..16ed14c89b2 100644 --- a/apps/bookmarks/js/bookmarks.js +++ b/apps/bookmarks/js/bookmarks.js @@ -3,7 +3,7 @@ var bookmarks_loading = false; var bookmarks_sorting = 'bookmarks_sorting_recent'; -$(document).ready(function() { +$(document).ready(function() { $('#bookmark_add_submit').click(addOrEditBookmark); $(window).resize(function () { fillWindow($('.bookmarks_list')); @@ -18,10 +18,10 @@ function getBookmarks() { //have patience :) return; } - + $.ajax({ url: 'ajax/updateList.php', - data: 'tag=' + encodeURI($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting, + data: 'tag=' + encodeURIComponent($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting, success: function(bookmarks){ if (bookmarks.data.length) { bookmarks_page += 1; @@ -29,7 +29,7 @@ function getBookmarks() { $('.bookmark_link').unbind('click', recordClick); $('.bookmark_delete').unbind('click', delBookmark); $('.bookmark_edit').unbind('click', showBookmark); - + for(var i in bookmarks.data) { updateBookmarksList(bookmarks.data[i]); $("#firstrun").hide(); @@ -41,13 +41,13 @@ function getBookmarks() { $('.bookmark_link').click(recordClick); $('.bookmark_delete').click(delBookmark); $('.bookmark_edit').click(showBookmark); - + bookmarks_loading = false; if (bookmarks.data.length) { updateOnBottom() } } - }); + }); } // function addBookmark() { @@ -60,13 +60,13 @@ function addOrEditBookmark(event) { var title = encodeEntities($('#bookmark_add_title').val()); var tags = encodeEntities($('#bookmark_add_tags').val()); $("#firstrun").hide(); - + if (id == 0) { $.ajax({ url: 'ajax/addBookmark.php', - data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags), - success: function(response){ - $('.bookmarks_input').val(''); + data: 'url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags), + success: function(response){ + $('.bookmarks_input').val(''); $('.bookmarks_list').empty(); bookmarks_page = 0; getBookmarks(); @@ -76,8 +76,8 @@ function addOrEditBookmark(event) { else { $.ajax({ url: 'ajax/editBookmark.php', - data: 'id=' + id + '&url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags), - success: function(){ + data: 'id=' + id + '&url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags), + success: function(){ $('.bookmarks_input').val(''); $('#bookmark_add_id').val('0'); $('.bookmarks_list').empty(); @@ -86,14 +86,14 @@ function addOrEditBookmark(event) { } }); } - + } function delBookmark(event) { var record = $(this).parent().parent(); $.ajax({ url: 'ajax/delBookmark.php', - data: 'url=' + encodeURI($(this).parent().parent().children('.bookmark_url:first').text()), + data: 'url=' + encodeURIComponent($(this).parent().parent().children('.bookmark_url:first').text()), success: function(data){ record.remove(); if($('.bookmarks_list').is(':empty')) { @@ -109,7 +109,7 @@ function showBookmark(event) { $('#bookmark_add_url').val(record.children('.bookmark_url:first').text()); $('#bookmark_add_title').val(record.children('.bookmark_title:first').text()); $('#bookmark_add_tags').val(record.children('.bookmark_tags:first').text()); - + if ($('.bookmarks_add').css('display') == 'none') { $('.bookmarks_add').slideToggle(); } @@ -124,7 +124,7 @@ function updateBookmarksList(bookmark) { var taglist = ''; for ( var i=0, len=tags.length; i<len; ++i ){ if(tags[i] != '') - taglist = taglist + '<a class="bookmark_tag" href="?tag=' + encodeURI(tags[i]) + '">' + tags[i] + '</a> '; + taglist = taglist + '<a class="bookmark_tag" href="?tag=' + encodeURIComponent(tags[i]) + '">' + tags[i] + '</a> '; } if(!hasProtocol(bookmark.url)) { bookmark.url = 'http://' + bookmark.url; @@ -165,8 +165,8 @@ function updateOnBottom() { function recordClick(event) { $.ajax({ url: 'ajax/recordClick.php', - data: 'url=' + encodeURI($(this).attr('href')), - }); + data: 'url=' + encodeURIComponent($(this).attr('href')), + }); } function encodeEntities(s){ diff --git a/files/appinfo/app.php b/files/appinfo/app.php index 1b495e52f40..c4a2ee7407a 100644 --- a/files/appinfo/app.php +++ b/files/appinfo/app.php @@ -5,6 +5,6 @@ $l=OC_L10N::get('files'); OC_App::register( array( "order" => 2, "id" => "files", "name" => "Files" )); -OC_App::addNavigationEntry( array( "id" => "files_index", "order" => 1, "href" => OC_Helper::linkTo( "files", "index.php" ), "icon" => OC_Helper::imagePath( "core", "places/home.svg" ), "name" => $l->t("Files") )); +OC_App::addNavigationEntry( array( "id" => "files_index", "order" => 0, "href" => OC_Helper::linkTo( "files", "index.php" ), "icon" => OC_Helper::imagePath( "core", "places/home.svg" ), "name" => $l->t("Files") )); OC_Search::registerProvider('OC_Search_Provider_File'); diff --git a/files/js/filelist.js b/files/js/filelist.js index 533e03b43cd..5bd85fc29ef 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -1,4 +1,5 @@ FileList={ + useUndo:true, update:function(fileListHtml) { $('#fileList').empty().html(fileListHtml); }, @@ -163,7 +164,7 @@ FileList={ }); }, do_delete:function(files){ - if(FileList.deleteFiles){//finish any ongoing deletes first + if(FileList.deleteFiles || !FileList.useUndo){//finish any ongoing deletes first FileList.finishDelete(function(){ FileList.do_delete(files); }); @@ -196,7 +197,6 @@ FileList={ boolOperationFinished(data, function(){ $('#notification').fadeOut(); $.each(FileList.deleteFiles,function(index,file){ -// alert(file); FileList.remove(file); }); FileList.deleteCanceled=true; @@ -225,7 +225,7 @@ $(document).ready(function(){ } $('#notification').fadeOut(); }); - + FileList.useUndo=('onbeforeunload' in window) $(window).bind('beforeunload', function (){ FileList.finishDelete(null,true); }); diff --git a/settings/ajax/setlanguage.php b/settings/ajax/setlanguage.php index d8d1a860378..e3b00c3bc80 100644 --- a/settings/ajax/setlanguage.php +++ b/settings/ajax/setlanguage.php @@ -7,11 +7,17 @@ $l=OC_L10N::get('settings'); OC_JSON::checkLoggedIn(); + // Get data if( isset( $_POST['lang'] ) ){ + $languageCodes=OC_L10N::findAvailableLanguages(); $lang=$_POST['lang']; - OC_Preferences::setValue( OC_User::getUser(), 'core', 'lang', $lang ); - OC_JSON::success(array("data" => array( "message" => $l->t("Language changed") ))); + if(array_search($lang,$languageCodes) or $lang=='en'){ + OC_Preferences::setValue( OC_User::getUser(), 'core', 'lang', $lang ); + OC_JSON::success(array("data" => array( "message" => $l->t("Language changed") ))); + }else{ + OC_JSON::error(array("data" => array( "message" => $l->t("Invalid request") ))); + } }else{ OC_JSON::error(array("data" => array( "message" => $l->t("Invalid request") ))); } |