[Rt-commit] r8962 - in rt/branches/3.7-EXPERIMENTAL: . html/User

sartak at bestpractical.com sartak at bestpractical.com
Fri Sep 7 12:54:25 EDT 2007


Author: sartak
Date: Fri Sep  7 12:54:18 2007
New Revision: 8962

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/html/User/Prefs.html
   rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t

Log:
 r42425 at onn:  sartak | 2007-09-07 12:54:08 -0400
 Finish moving PreferredKey to attributes


Modified: rt/branches/3.7-EXPERIMENTAL/html/User/Prefs.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/User/Prefs.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/User/Prefs.html	Fri Sep  7 12:54:18 2007
@@ -169,7 +169,9 @@
  <table cellspacing="0" cellpadding="0">
    <tr>
      <td class="label"><&|/l&>Preferred Key</&>:</td>
-     <td class="value"><& /Elements/SelectKey, EmailAddress => $UserObj->EmailAddress, Default => $UserObj->PreferredKey &></td>
+% my $prefkey = $UserObj->FirstAttribute('PreferredKey');
+% $prefkey = $prefkey ? $prefkey->Content : '';
+     <td class="value"><& /Elements/SelectKey, EmailAddress => $UserObj->EmailAddress, Default => $prefkey &></td>
    </tr>
  </table>
 </&>
@@ -225,7 +227,7 @@
 		    Organization RealName NickName Lang EmailEncoding WebEncoding 
 		    ExternalContactInfoId ContactInfoSystem Gecos ExternalAuthId 
 		    AuthSystem HomePhone WorkPhone MobilePhone PagerPhone Address1
-		Address2 City State Zip Country Lang PreferredKey
+		Address2 City State Zip Country Lang
 		   );
 
     $m->callback(
@@ -247,7 +249,7 @@
     push (@results, at fieldresults);
 
 
-# {{{ Deal with special fields: Privileged, Enabled and Password
+# {{{ Deal with special fields: Privileged, Enabled, Password, PreferredKey
 if  ( ($SetPrivileged) and ( $Privileged != $UserObj->Privileged) ) {
 my  ($code, $msg) = $UserObj->SetPrivileged($Privileged);
      push @results, loc('Privileged status: [_1]', loc_fuzzy($msg));
@@ -264,6 +266,11 @@
     push @results, loc("Passwords do not match. Your password has not been changed");
 }
 
+if ((defined $PreferredKey) && $PreferredKey ne $UserObj->FirstAttribute('PreferredKey')) {
+    my ($code, $msg) = $UserObj->SetAttribute(Name => 'PreferredKey', Content => $PreferredKey);
+    push @results, loc('Preferred Key: [_1]', loc_fuzzy($msg));
+}
+
 # }}}
 }
 

Modified: rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t	Fri Sep  7 12:54:18 2007
@@ -390,7 +390,9 @@
 # test key selection
 ok($user = RT::User->new($RT::SystemUser));
 ok($user->Load('root'), "Loaded user 'root'");
-is($user->PreferredKey, "9FA662C06DE22FC2", "preferred key is set correctly");
+my $prefkey = $user->FirstAttribute('PreferredKey');
+$prefkey = $prefkey ? $prefkey->Content : '';
+is($prefkey, "9FA662C06DE22FC2", "preferred key is set correctly");
 $m->get("$baseurl/User/Prefs.html");
 like($m->content, qr/Preferred Key/, "preferred key option shows up in preference");
 
@@ -405,7 +407,9 @@
 
 ok($user = RT::User->new($RT::SystemUser));
 ok($user->Load('root'), "Loaded user 'root'");
-is($user->PreferredKey, "DF651FA0632C4F50", "preferred key is set correctly to the new value");
+$prefkey = $user->FirstAttribute('PreferredKey');
+$prefkey = $prefkey ? $prefkey->Content : '';
+is($prefkey, "DF651FA0632C4F50", "preferred key is set correctly to the new value");
 
 $m->get("$baseurl/User/Prefs.html");
 like($m->content, qr/Preferred Key/, "preferred key option shows up in preference");


More information about the Rt-commit mailing list