partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 65f5b306165a9caa7c56af0440f9c488c8a65065
parent 1bf8aef9d2489d4f807037fa5ddc1acbe6270bc1
Author: felicitus <felicitus@felicitus.org>
Date:   Tue, 15 May 2012 16:42:12 +0200

Read initial user preferences when logged in via HTTP AUTH

Diffstat:
Msrc/frontend/index.php | 8++++++++
Msrc/frontend/js/PartKeepr.js | 12+++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/frontend/index.php b/src/frontend/index.php @@ -42,6 +42,14 @@ if (Configuration::getOption("partkeepr.auth.http", false) === true) { $aParameters["autoLoginUsername"] = $user->getUsername(); $aParameters["auto_start_session"] = $session->getSessionID(); + + $aPreferences = array(); + + foreach ($user->getPreferences() as $result) { + $aPreferences[] = $result->serialize(); + } + + $aParameters["userPreferences"] = array("response" => array("data" => $aPreferences)); } /* Information about maximum upload sizes */ diff --git a/src/frontend/js/PartKeepr.js b/src/frontend/js/PartKeepr.js @@ -66,9 +66,15 @@ Ext.application({ onLogin: function () { this.createGlobalStores(); - var records = this.getUserPreferenceStore().getProxy().getReader().read(PartKeepr.initialUserPreferences); - this.getUserPreferenceStore().loadRecords(records.records); - + if (window.parameters.userPreferences) { + PartKeepr.getApplication().setInitialUserPreferences(window.parameters.userPreferences); + } + + if (PartKeepr.initialUserPreferences) { + var records = this.getUserPreferenceStore().getProxy().getReader().read(PartKeepr.initialUserPreferences); + this.getUserPreferenceStore().loadRecords(records.records); + } + this.reloadStores(); var j = Ext.create("PartKeepr.PartManager", {