summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2012-09-03 01:15:39 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2012-09-03 01:16:28 +0200
commit379554e1b06dfc35127d9aadf8d8c1417c5ab14d (patch)
tree212a43716a011374ef50e956938f368f8c388358
parentff09dc5c27a0c6af2c6946d293da0522a336bb6c (diff)
fixed weird showAll post request
-rw-r--r--ajax/usersettings.php12
-rw-r--r--js/main.js8
2 files changed, 5 insertions, 15 deletions
diff --git a/ajax/usersettings.php b/ajax/usersettings.php
index 9ddd69f6e..27fc11cb1 100644
--- a/ajax/usersettings.php
+++ b/ajax/usersettings.php
@@ -15,16 +15,8 @@ OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('news');
OCP\JSON::callCheck();
-switch($_POST['show']){
- case 'all':
- $showAll = true;
- break;
- default:
- $showAll = false;
- break;
+if(isset($_POST['showAll'])){
+ OCP\Config::setUserValue(OCP\USER::getUser(), 'news', 'showAll', $_POST['showAll']);
}
-// TODO: receive and save user settings
-OCP\Config::setUserValue(OCP\USER::getUser(), 'news', 'showAll', $showAll);
-
OCP\JSON::success(); \ No newline at end of file
diff --git a/js/main.js b/js/main.js
index cf4351c3b..467316c03 100644
--- a/js/main.js
+++ b/js/main.js
@@ -103,12 +103,10 @@ $(document).ready(function(){
var data = {};
var showAll;
if($(this).hasClass('show_all')){
- data.show = 'unread';
- showAll = false;
+ data.showAll = false;
$(this).addClass('show_unread').removeClass('show_all');
} else {
- data.show = 'all';
- showAll = true;
+ data.showAll = true;
$(this).addClass('show_all').removeClass('show_unread');
}
@@ -116,7 +114,7 @@ $(document).ready(function(){
$.post(OC.filePath('news', 'ajax', 'usersettings.php'), data, function(jsondata){
if(jsondata.status == 'success'){
- News.Objects.Menu.setShowAll(showAll);
+ News.Objects.Menu.setShowAll(data.showAll);
} else {
OC.dialogs.alert(jsonData.data.message, t('news', 'Error'));
}