diff options
-rw-r--r-- | actions/emailsettings.php | 5 | ||||
-rw-r--r-- | actions/showstream.php | 15 | ||||
-rw-r--r-- | db/laconica.sql | 1 | ||||
-rw-r--r-- | db/laconica_pg.sql | 2 | ||||
-rw-r--r-- | js/util.js | 5 | ||||
-rw-r--r-- | lib/mail.php | 23 | ||||
-rw-r--r-- | lib/util.php | 21 | ||||
-rw-r--r-- | theme/default/display.css | 42 | ||||
-rw-r--r-- | theme/default/icon_checkmark.png | bin | 0 -> 781 bytes | |||
-rw-r--r-- | theme/default/icon_emote-wink.png | bin | 0 -> 914 bytes | |||
-rw-r--r-- | theme/default/icon_process-working.gif | bin | 0 -> 1849 bytes | |||
-rw-r--r-- | theme/default/ie7.css | 12 |
12 files changed, 121 insertions, 5 deletions
diff --git a/actions/emailsettings.php b/actions/emailsettings.php index 6e189a909..bc79c14f9 100644 --- a/actions/emailsettings.php +++ b/actions/emailsettings.php @@ -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; diff --git a/actions/showstream.php b/actions/showstream.php index 9db31c108..56858b477 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -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('×'); common_element_end('a'); } + common_element_end('p'); common_element_end('li'); } -}
\ No newline at end of file +} diff --git a/db/laconica.sql b/db/laconica.sql index 87ac6e26d..4f4c37bd6 100644 --- a/db/laconica.sql +++ b/db/laconica.sql @@ -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', diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index d027dc0af..e784bb169 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -47,6 +47,8 @@ create table "user" ( email varchar(255) unique /* comment 'email address for password recovery etc.' */,
incomingemail varchar(255) unique /* comment 'email address for post-by-email' */,
emailnotifysub integer default 1 /* comment 'Notify by email of subscriptions' */,
+ emailnotifyfav integer default 1 /* comment 'Notify by email of favorites' */,
+ emailnotifynudge integer default 1 /* comment 'Notify by email of nudges' */,
emailmicroid integer default 1 /* comment 'whether to publish email microid' */,
language varchar(50) /* comment 'preferred language' */,
timezone varchar(50) /* comment 'timezone' */,
diff --git a/js/util.js b/js/util.js index 151c0d111..d0673b839 100644 --- a/js/util.js +++ b/js/util.js @@ -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) { diff --git a/lib/mail.php b/lib/mail.php index b96bc7161..a4764bfb5 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -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)) { diff --git a/lib/util.php b/lib/util.php index e958a87ba..43e565fbf 100644 --- a/lib/util.php +++ b/lib/util.php @@ -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; } diff --git a/theme/default/display.css b/theme/default/display.css index 91cc057fa..19ec7b48d 100644 --- a/theme/default/display.css +++ b/theme/default/display.css @@ -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 Binary files differnew file mode 100644 index 000000000..818e3b5f8 --- /dev/null +++ b/theme/default/icon_checkmark.png diff --git a/theme/default/icon_emote-wink.png b/theme/default/icon_emote-wink.png Binary files differnew file mode 100644 index 000000000..46be68557 --- /dev/null +++ b/theme/default/icon_emote-wink.png diff --git a/theme/default/icon_process-working.gif b/theme/default/icon_process-working.gif Binary files differnew file mode 100644 index 000000000..d42f72c72 --- /dev/null +++ b/theme/default/icon_process-working.gif diff --git a/theme/default/ie7.css b/theme/default/ie7.css index 99bc4e79f..14534c05e 100644 --- a/theme/default/ie7.css +++ b/theme/default/ie7.css @@ -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; } |