]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Nudge feature
authorcsarven <csarven@controlyourself.ca>
Sun, 16 Nov 2008 02:27:35 +0000 (21:27 -0500)
committercsarven <csarven@controlyourself.ca>
Sun, 16 Nov 2008 02:27:35 +0000 (21:27 -0500)
darcs-hash:20081116022735-eefa4-366f6deb85942f859ebd532e477b57737bcafbf8.gz

12 files changed:
actions/emailsettings.php
actions/showstream.php
db/laconica.sql
db/laconica_pg.sql
js/util.js
lib/mail.php
lib/util.php
theme/default/display.css
theme/default/icon_checkmark.png [new file with mode: 0644]
theme/default/icon_emote-wink.png [new file with mode: 0644]
theme/default/icon_process-working.gif [new file with mode: 0644]
theme/default/ie7.css

index 6e189a909d4a4c585cce158fa74a796a007a0b1f..bc79c14f942f90c84800409d68de4e14453bdacd 100644 (file)
@@ -94,6 +94,9 @@ class EmailsettingsAction extends SettingsAction {
                common_checkbox('emailnotifymsg',
                                _('Send me email when someone sends me a private message.'),
                                $user->emailnotifymsg);
+               common_checkbox('emailnotifynudge',
+                               _('Send me an email when someone nudges me.'),
+                               $user->emailnotifnudge);
                common_checkbox('emailpost',
                                                _('I want to post notices by email.'),
                                                $user->emailpost);
@@ -150,6 +153,7 @@ class EmailsettingsAction extends SettingsAction {
                $emailnotifysub = $this->boolean('emailnotifysub');
                $emailnotifyfav = $this->boolean('emailnotifyfav');
                $emailnotifymsg = $this->boolean('emailnotifymsg');
+               $emailnotifynudge = $this->boolean('emailnotifynudge');
                $emailmicroid = $this->boolean('emailmicroid');
                $emailpost = $this->boolean('emailpost');
 
@@ -164,6 +168,7 @@ class EmailsettingsAction extends SettingsAction {
                $user->emailnotifysub = $emailnotifysub;
                $user->emailnotifyfav = $emailnotifyfav;
                $user->emailnotifymsg = $emailnotifymsg;
+               $user->emailnotifynudge = $emailnotifynudge;
                $user->emailmicroid = $emailmicroid;
                $user->emailpost = $emailpost;
 
index 9db31c108e82b02af3d3a4234970d925c9c022a5..56858b477d7eec3fcde95e91e2d2575863d14199 100644 (file)
@@ -64,7 +64,6 @@ class ShowstreamAction extends StreamAction {
        }
 
        function show_top($user) {
-
                $cur = common_current_user();
 
                if ($cur && $cur->id == $user->id) {
@@ -167,6 +166,10 @@ class ShowstreamAction extends StreamAction {
                                                                        'width' => AVATAR_PROFILE_SIZE,
                                                                        'height' => AVATAR_PROFILE_SIZE,
                                                                        'alt' => $profile->nickname));
+
+        common_element_start('ul', array('id' => 'profile_actions'));
+
+        common_element_start('li', array('id' => 'profile_subscribe'));
                $cur = common_current_user();
                if ($cur) {
                        if ($cur->id != $profile->id) {
@@ -179,13 +182,20 @@ class ShowstreamAction extends StreamAction {
                } else {
                        $this->show_remote_subscribe_link($profile);
                }
+        common_element_end('li');
                
                $user = User::staticGet('id', $profile->id);
                
                if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) {
+            common_element_start('li', array('id' => 'profile_send_a_new_message'));
                        common_element('a', array('href' => common_local_url('newmessage', array('to' => $user->id))),
                                                   _('Send a message'));
+            common_element_end('li');
+            common_element_start('li', array('id' => 'profile_nudge'));
+            common_nudge_form($user);
+            common_element_end('li');
                }
+        common_element_end('ul');
                
                common_element_end('div');
 
@@ -475,7 +485,8 @@ class ShowstreamAction extends StreamAction {
                        common_raw('&times;');
                        common_element_end('a');
                }
+               
                common_element_end('p');
                common_element_end('li');
        }
-}
\ No newline at end of file
+}
index 87ac6e26db686f98194c0d8267a1be03157acebc..4f4c37bd6a3443308050c8adb9682d3af48b4d79 100644 (file)
@@ -48,6 +48,7 @@ create table user (
     incomingemail varchar(255) unique key comment 'email address for post-by-email',
     emailnotifysub tinyint default 1 comment 'Notify by email of subscriptions',
     emailnotifyfav tinyint default 1 comment 'Notify by email of favorites',
+    emailnotifynudge tinyint default 1 comment 'Notify by email of nudges',
     emailnotifymsg tinyint default 1 comment 'Notify by email of direct messages',
     emailmicroid tinyint default 1 comment 'whether to publish email microid',
     language varchar(50) comment 'preferred language',
index d027dc0af03ec86b112d14873cf23e233ff8b149..e784bb16996fd0b3861cd270c7cc59631b05ea13 100644 (file)
@@ -47,6 +47,8 @@ create table "user" (
     email varchar(255) unique /* comment 'email address for password recovery etc.' */,\r
     incomingemail varchar(255) unique /* comment 'email address for post-by-email' */,\r
     emailnotifysub integer default 1 /* comment 'Notify by email of subscriptions' */,\r
+    emailnotifyfav integer default 1 /* comment 'Notify by email of favorites' */,\r
+    emailnotifynudge integer default 1 /* comment 'Notify by email of nudges' */,\r
     emailmicroid integer default 1 /* comment 'whether to publish email microid' */,\r
     language varchar(50) /* comment 'preferred language' */,\r
     timezone varchar(50) /* comment 'timezone' */,\r
index 151c0d111441b83b141b78292c2ccd88f519d04f..d0673b8397206565118b6c33dedaf662e1351534 100644 (file)
@@ -85,6 +85,11 @@ $(document).ready(function(){
        $("form.disfavor").ajaxForm(disoptions);
        $("form.favor").each(addAjaxHidden);
        $("form.disfavor").each(addAjaxHidden);
+
+       $("#nudge").ajaxForm ({ dataType: 'xml',
+                                                       success: function(xml) { $("#nudge").replaceWith(document._importNode($("#nudge_response", xml).get(0),true)); }
+                                                });
+       $("#nudge .submit").bind('click', function(e) { $(this).addClass("processing"); }); 
 });
 
 function doreply(nick,id) {
index b96bc7161db07c3d8e0fe026f0c59e07b3579579..a4764bfb5491443e5b55f13a9a69b8c4c20bac2e 100644 (file)
@@ -232,6 +232,29 @@ function mail_confirm_sms($code, $nickname, $address) {
        mail_send($recipients, $headers, $body);
 }
 
+
+function mail_notify_nudge($from, $to) {
+
+       $subject = sprintf(_('You\'ve been nudged by %s'), $from->nickname);
+
+       $from_profile = $from->getProfile();
+
+       $body = sprintf(_("%1\$s (%2\$s) is wondering what you are up to these days and is inviting you to post some news.\n\n".
+                                         "You can reply to their message here:\n\n".
+                                         "%3\$s\n\n".
+                                         "Don't reply to this email; it won't get to them.\n\n".
+                                         "With kind regards,\n".
+                                         "%4\$s\n"),
+                                       $from_profile->getBestName(),
+                                       $from->nickname,
+                                       common_local_url('newmessage', array('to' => $from->id)),
+                                       common_config('site', 'name'));
+
+       return mail_to_user($to, $subject, $body);
+}
+
+
+
 function mail_notify_message($message, $from=NULL, $to=NULL) {
 
        if (is_null($from)) {
index e958a87babf867b1162fcf66a75f8ad51c46f28c..43e565fbf335c7066f9e5f30f7695a80f3b9035e 100644 (file)
@@ -978,6 +978,8 @@ function common_fancy_url($action, $args=NULL) {
                } else {
                        return common_path('main/remote');
                }
+        case 'nudge':
+               return common_path($args['nickname'].'/nudge');
         case 'openidlogin':
                return common_path('main/openid');
         case 'profilesettings':
@@ -1861,6 +1863,25 @@ function common_favor_form($notice) {
        common_element_end('form');
 }
 
+function common_nudge_form($profile) {
+       common_element_start('form', array('id' => 'nudge', 'method' => 'post',
+                                                                          'action' => common_local_url('nudge', array('nickname' => $profile->nickname))));
+       common_hidden('token', common_session_token()); //Is this necessary?
+//     common_element('input', array('id' => 'nudge_nickname',
+//                                                               'name' => 'nudge_nickname',
+//                                                               'type' => 'hidden',
+//                                                               'value' => $profile->nickname));
+       common_element('input', array('type' => 'submit',
+                                                                 'class' => 'submit',
+                                                                 'value' => _('Send a nudge')));
+       common_element_end('form');
+}
+
+function common_nudge_response() {
+       common_element('p', array('id' => 'nudge_response'), _('Nudge sent!'));
+}
+
+
 function common_cache_key($extra) {
        return 'laconica:' . common_keyize(common_config('site', 'name')) . ':' . $extra;
 }
index 91cc057fa0834ba721e7952e376760108d4ef3f8..19ec7b48dab2cb089495940e72349aef6483c11a 100644 (file)
@@ -208,6 +208,48 @@ input#disfavor, input.disfavor {
 }
 
 
+/*profile_actions*/
+#profile_actions {
+padding-left:0;
+list-style-type:none;
+margin:0;
+}
+#profile_actions li {
+margin-bottom:0.5em;
+clear:both;
+}
+
+#profile_actions #profile_nudge input.submit {
+margin:0;
+padding:0;
+padding-left:17px;
+background:transparent url(icon_emote-wink.png) 0 1px no-repeat;
+color:#C15D42;
+font-family:Georgia,"Times New Roman",Times,serif;
+font-weight:normal;
+font-size:14px;
+text-align:left;
+float:left;
+line-height:18px;
+}
+#profile_actions #profile_nudge input.submit:hover {
+background-color:transparent;
+color:#C15D42;
+}
+
+#wrap #content input.processing {
+padding-left:17px;
+background:transparent url(icon_process-working.gif) 0 1px no-repeat;
+line-height:18px;
+}
+
+#wrap p#nudge_response {
+padding-left:20px;
+background:transparent url(icon_checkmark.png) 0 1px no-repeat;
+line-height:18px;
+font-size:14px;
+}
+
 
 /* ----- Nav Footer ----- */
 #nav_sub {
diff --git a/theme/default/icon_checkmark.png b/theme/default/icon_checkmark.png
new file mode 100644 (file)
index 0000000..818e3b5
Binary files /dev/null and b/theme/default/icon_checkmark.png differ
diff --git a/theme/default/icon_emote-wink.png b/theme/default/icon_emote-wink.png
new file mode 100644 (file)
index 0000000..46be685
Binary files /dev/null and b/theme/default/icon_emote-wink.png differ
diff --git a/theme/default/icon_process-working.gif b/theme/default/icon_process-working.gif
new file mode 100644 (file)
index 0000000..d42f72c
Binary files /dev/null and b/theme/default/icon_process-working.gif differ
index 99bc4e79f1a008e0aca46cacee1791d48f4a7a1b..14534c05e851f0306242aeff822d06b5da9062f2 100644 (file)
@@ -1,7 +1,5 @@
 @charset "UTF-8";
 /* CSS Document */
-
-
 input.disfavor,
 input.favor {
        text-indent:0;
@@ -9,11 +7,19 @@ input.favor {
        padding-left:25px;
 }
 
+#profile_actions li {
+float:left;
+clear:both;
+}
+#profile_actions #profile_nudge input.submit {
+margin-left:0;
+width:100px;
+}
+
 #statistics dd {
        clear: both;
        }               
        
-       
 #subscriptions_avatars li {
        float: left;
        }