mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-04-06 04:38 am

[dw-free] user-tag /manage/circle/add.bml

[commit: http://hg.dwscoalition.org/dw-free/rev/62dc8d03b3b5]

http://bugs.dwscoalition.org/show_bug.cgi?id=448

Update directorysearch errors to be WTF compatible.

Patch by [personal profile] janinedog.

Files modified:
  • cgi-bin/LJ/Directory/Constraint.pm
  • cgi-bin/LJ/Directory/Constraint/FriendOf.pm
  • cgi-bin/LJ/Directory/Constraint/HasFriend.pm
  • htdocs/community/search.bml
  • htdocs/directorysearch.bml
  • htdocs/directorysearch.bml.text
  • htdocs/js/directorysearchconstraints.js
--------------------------------------------------------------------------------
diff -r c0e09f6b18c8 -r 62dc8d03b3b5 cgi-bin/LJ/Directory/Constraint.pm
--- a/cgi-bin/LJ/Directory/Constraint.pm	Sun Apr 05 23:44:07 2009 +0000
+++ b/cgi-bin/LJ/Directory/Constraint.pm	Mon Apr 06 04:38:45 2009 +0000
@@ -9,8 +9,11 @@ use LJ::Directory::Constraint::Age;
 use LJ::Directory::Constraint::Age;
 use LJ::Directory::Constraint::Interest;
 use LJ::Directory::Constraint::UpdateTime;
-use LJ::Directory::Constraint::HasFriend;
-use LJ::Directory::Constraint::FriendOf;
+use LJ::Directory::Constraint::Trusts;
+use LJ::Directory::Constraint::TrustedBy;
+use LJ::Directory::Constraint::Watches;
+use LJ::Directory::Constraint::WatchedBy;
+use LJ::Directory::Constraint::MemberOf;
 use LJ::Directory::Constraint::Location;
 use LJ::Directory::Constraint::JournalType;
 use LJ::Directory::Constraint::Test;
@@ -19,7 +22,7 @@ sub constraints_from_formargs {
     my ($pkg, $postargs) = @_;
 
     my @ret;
-    foreach my $type (qw(Age Location UpdateTime Interest HasFriend FriendOf JournalType)) {
+    foreach my $type (qw(Age Location UpdateTime Interest Trusts TrustedBy Watches WatchedBy MemberOf JournalType)) {
        my $class = "LJ::Directory::Constraint::$type";
        my $con = eval { $class->new_from_formargs($postargs) };
        if ($con) {
diff -r c0e09f6b18c8 -r 62dc8d03b3b5 cgi-bin/LJ/Directory/Constraint/FriendOf.pm
--- a/cgi-bin/LJ/Directory/Constraint/FriendOf.pm	Sun Apr 05 23:44:07 2009 +0000
+++ b/cgi-bin/LJ/Directory/Constraint/FriendOf.pm	Mon Apr 06 04:38:45 2009 +0000
@@ -1,37 +0,0 @@
-package LJ::Directory::Constraint::FriendOf;
-use strict;
-use warnings;
-use base 'LJ::Directory::Constraint';
-use Carp qw(croak);
-
-sub new {
-    my ($pkg, %args) = @_;
-    my $self = bless {}, $pkg;
-    $self->{$_} = delete $args{$_} foreach qw(userid user);
-    croak "unknown args" if %args;
-    return $self;
-}
-
-sub new_from_formargs {
-    my ($pkg, $args) = @_;
-    return undef unless ($args->{fro_user} xor $args->{fro_userid});
-    return $pkg->new(user   => $args->{fro_user},
-                     userid => $args->{fro_userid});
-}
-
-sub cache_for { 5 * 60 }
-
-sub u {
-    my $self = shift;
-    return $self->{u} if $self->{u};
-    $self->{u} = $self->{userid} ? LJ::load_userid($self->{userid})
-        : LJ::load_user($self->{user});
-}
-
-sub matching_uids {
-    my $self = shift;
-    my $u = $self->u or return ();
-    return $u->friend_uids;
-}
-
-1;
diff -r c0e09f6b18c8 -r 62dc8d03b3b5 cgi-bin/LJ/Directory/Constraint/HasFriend.pm
--- a/cgi-bin/LJ/Directory/Constraint/HasFriend.pm	Sun Apr 05 23:44:07 2009 +0000
+++ b/cgi-bin/LJ/Directory/Constraint/HasFriend.pm	Mon Apr 06 04:38:45 2009 +0000
@@ -1,37 +0,0 @@
-package LJ::Directory::Constraint::HasFriend;
-use strict;
-use warnings;
-use base 'LJ::Directory::Constraint';
-use Carp qw(croak);
-
-sub new {
-    my ($pkg, %args) = @_;
-    my $self = bless {}, $pkg;
-    $self->{$_} = delete $args{$_} foreach qw(userid user);
-    croak "unknown args" if %args;
-    return $self;
-}
-
-sub new_from_formargs {
-    my ($pkg, $args) = @_;
-    return undef unless ($args->{fr_user} xor $args->{fr_userid});
-    return $pkg->new(user   => $args->{fr_user},
-                     userid => $args->{fr_userid});
-}
-
-sub cache_for { 5 * 60 }
-
-sub u {
-    my $self = shift;
-    return $self->{u} if $self->{u};
-    $self->{u} = $self->{userid} ? LJ::load_userid($self->{userid})
-        : LJ::load_user($self->{user});
-}
-
-sub matching_uids {
-    my $self = shift;
-    my $u = $self->u or return ();
-    return ($u->friendof_uids);
-}
-
-1;
diff -r c0e09f6b18c8 -r 62dc8d03b3b5 htdocs/community/search.bml
--- a/htdocs/community/search.bml	Sun Apr 05 23:44:07 2009 +0000
+++ b/htdocs/community/search.bml	Mon Apr 06 04:38:45 2009 +0000
@@ -95,7 +95,7 @@ name=><?_ml .label.hasmember _ml?>
 name=><?_ml .label.hasmember _ml?>
 code=>s_fr
 form<=
-Contains user <input name="fr_user" size='15' maxlength='25' /> as a member.
+Contains user <input name="user_is_member" size='15' maxlength='25' /> as a member.
 <=form
 crit?>
 
diff -r c0e09f6b18c8 -r 62dc8d03b3b5 htdocs/directorysearch.bml
--- a/htdocs/directorysearch.bml	Sun Apr 05 23:44:07 2009 +0000
+++ b/htdocs/directorysearch.bml	Mon Apr 06 04:38:45 2009 +0000
@@ -81,7 +81,7 @@ form<=
 <?_ml .updated_in_last _ml?> 
 <select name="ut_days">
 <option value="">-------</option>
-<option value="1"><?_ml .date _ml?></option>
+<option value="1"><?_ml .day _ml?></option>
 <option value="7"><?_ml .week _ml?></option>
 <option value="30"><?_ml .month _ml?></option>
 </select>
@@ -124,18 +124,17 @@ form<=
 <=form
 crit?>
 
-<!---- has friend ----->
+<!---- trust/watch ----->
 <?crit
-name=><?_ml .by_friends _ml?>
+name=><?_ml .by_circle _ml?>
 code=>s_fr
 form<=
 <?_code
-    my $ret = BML::ml('.user_lists_as_a_friend', { 'input' => "<input name=\"fr_user\" size='15' maxlength='25' />" });
-    return $ret;
-_code?>
-<br />
-<?_code
-    my $ret = BML::ml('.lists_user_as_a_friend', { 'input' => "<input name=\"fro_user\" size='15' maxlength='25' />" });
+    my $ret = BML::ml( '.user_trusts', { input => "<input name=\"user_trusts\" size='15' maxlength='25' />" } ) . "<br />";
+    $ret .= BML::ml( '.user_trusted_by', { input => "<input name=\"user_trusted_by\" size='15' maxlength='25' />" } ) . "<br />";
+    $ret .= BML::ml( '.user_watches', { input => "<input name=\"user_watches\" size='15' maxlength='25' />" } ) . "<br />";
+    $ret .= BML::ml( '.user_watched_by', { input => "<input name=\"user_watched_by\" size='15' maxlength='25' />" } );
+
     return $ret;
 _code?>
 <=form
diff -r c0e09f6b18c8 -r 62dc8d03b3b5 htdocs/directorysearch.bml.text
--- a/htdocs/directorysearch.bml.text	Sun Apr 05 23:44:07 2009 +0000
+++ b/htdocs/directorysearch.bml.text	Mon Apr 06 04:38:45 2009 +0000
@@ -6,7 +6,7 @@
 
 .by_age=By Age
 
-.by_friends=By Friends
+.by_circle=By Circle
 
 .by_gender=By Gender
 
@@ -31,8 +31,6 @@
 .female=Female
 
 .h1=Search Directory
-
-.lists_user_as_a_friend=[[input]] lists user as a friend.
 
 .male=Male
 
@@ -60,7 +58,13 @@
 
 .user_likes=User likes:
 
-.user_lists_as_a_friend=User lists [[input]] as a friend.
+.user_trusted_by=User is granted access by: [[input]]
+
+.user_trusts=User grants access to: [[input]]
+
+.user_watched_by=User is subscribed to by: [[input]]
+
+.user_watches=User is subscribed to: [[input]]
 
 .week=week
 
diff -r c0e09f6b18c8 -r 62dc8d03b3b5 htdocs/js/directorysearchconstraints.js
--- a/htdocs/js/directorysearchconstraints.js	Sun Apr 05 23:44:07 2009 +0000
+++ b/htdocs/js/directorysearchconstraints.js	Mon Apr 06 04:38:45 2009 +0000
@@ -339,8 +339,11 @@ var DirectorySearchConstraintTypes = [
                                       "Country",
                                       "City",
                                       "State",
-                                      "HasFriend",
-                                      "FriendOf"
+                                      "Trusts",
+                                      "TrustedBy",
+                                      "Watches",
+                                      "WatchedBy",
+                                      "MemberOf"
 ];
 
 var DirectorySearchConstraintPrototypes = {
@@ -383,14 +386,29 @@ var DirectorySearchConstraintPrototypes 
       unique: true
   },
 
-  HasFriend: {
-      fieldNames: ["fr_user"],
-      displayName: "Has Friend"
+  Trusts: {
+      fieldNames: ["user_trusts"],
+      displayName: "User Trusts"
   },
 
-  FriendOf: {
-      fieldNames: ["fro_user"],
-      displayName: "Is Friend Of"
+  TrustedBy: {
+      fieldNames: ["user_trusted_by"],
+      displayName: "User Trusted By"
+  },
+
+  Watches: {
+      fieldNames: ["user_watches"],
+      displayName: "User Watches"
+  },
+
+  WatchedBy: {
+      fieldNames: ["user_watched_by"],
+      displayName: "User Watched By"
+  },
+
+  MemberOf: {
+      fieldNames: ["user_is_member"],
+      displayName: "User is Member Of"
   },
 
   UpdateTime: {
--------------------------------------------------------------------------------