On 03/08/2011 02:57 PM, Endi Sukma Dewata wrote:
On 3/8/2011 1:15 PM, Adam Young wrote:
Now manages to pre-populate the pkey for the user.


It pops up 'invalid uid: must be Unicode text'.
The IPA.whoami is an associative array, not a string.


From 06e5ae11c19e6db0829af43ad0e01eb8c3a0b569 Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Tue, 8 Mar 2011 13:11:19 -0500
Subject: [PATCH] selfservice facets
 don't default to search behavior for facets if in the self service use case

https://fedorahosted.org/freeipa/ticket/1070
---
 install/ui/associate.js |    4 +++-
 install/ui/details.js   |    2 +-
 install/ui/entity.js    |   18 +++++++++++++++++-
 install/ui/webui.js     |    2 ++
 4 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/install/ui/associate.js b/install/ui/associate.js
index e8cb4d0b53583ded681c69f8660e7dcb7f7f3abb..2fbe4868f1cd0161a8721026fbe42884d473d2ba 100644
--- a/install/ui/associate.js
+++ b/install/ui/associate.js
@@ -481,7 +481,9 @@ IPA.association_table_widget = function (spec) {
     };
 
     that.create_add_dialog = function() {
-        var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
+        
+        var pkey = IPA.get_pkey(that.entity_name);
+
         var label = IPA.metadata.objects[that.other_entity].label;
         var title = IPA.messages.association.add;
 
diff --git a/install/ui/details.js b/install/ui/details.js
index 895c19aa11d756ee4ea60b598441ac4e8692c476..4a70d154d298d21e9f5ca116f8c5f565f5bcf8d7 100644
--- a/install/ui/details.js
+++ b/install/ui/details.js
@@ -593,7 +593,7 @@ IPA.details_refresh = function() {
 
     var that = this;
 
-    that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) ;
+    that.pkey = IPA.get_pkey(that.entity_name);
 
     var command = IPA.command({
         method: that.entity_name+'_show',
diff --git a/install/ui/entity.js b/install/ui/entity.js
index f8e61af8edd4a7ea2688c0b819f449044bdd10ac..c922bf547606719dbd3fbbadef698cc2e7d3f482 100644
--- a/install/ui/entity.js
+++ b/install/ui/entity.js
@@ -25,6 +25,18 @@
 
 /* REQUIRES: ipa.js, details.js, search.js, add.js */
 
+
+IPA.get_pkey = function(entity_name){
+    var pkey = $.bbq.getState(entity_name + '-pkey', true) || '';
+    if (!pkey){
+        if (IPA.is_self_service){
+            pkey = IPA.whoami.uid[0];
+        }
+    }
+    return pkey;
+}
+
+
 IPA.facet = function (spec) {
 
     spec = spec || {};
@@ -339,7 +351,11 @@ IPA.entity_set_facet_definition = function (entity_name, list) {
 IPA.current_facet =  function (entity){
     var facet_name = $.bbq.getState(entity.name + '-facet', true);
     if (!facet_name && entity.facets.length) {
-        facet_name = entity.facets[0].name;
+        if (IPA.is_self_service){
+            facet_name = 'details';
+        }else{
+            facet_name = entity.facets[0].name;
+        }
     }
     return facet_name;
 };
diff --git a/install/ui/webui.js b/install/ui/webui.js
index fd33120d89f6daf849207e5541ab0b638f172e8e..17c2efcdcbd309a1832be1b12b6a08fe82d5e5c3 100644
--- a/install/ui/webui.js
+++ b/install/ui/webui.js
@@ -147,9 +147,11 @@ $(function() {
         var navigation = $('#navigation');
 
         if (should_show_all_ui()){
+            IPA.is_self_service = false;
             IPA.tab_set = IPA.admin_tab_set();
             IPA.nav.create(IPA.tab_set, navigation, 'tabs');
         } else {
+            IPA.is_self_service = true;
             IPA.tab_set = IPA.self_serv_tab_set();
             IPA.nav.create(IPA.tab_set, navigation, 'tabs');
 
-- 
1.7.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to