Nudge feature
darcs-hash:20081116022735-eefa4-366f6deb85942f859ebd532e477b57737bcafbf8.gz
This commit is contained in:
parent
44602ae0ff
commit
f3572aec7f
|
@ -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;
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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' */,
|
||||
|
|
|
@ -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) {
|
||||
|
|
23
lib/mail.php
23
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)) {
|
||||
|
|
21
lib/util.php
21
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;
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
BIN
theme/default/icon_checkmark.png
Normal file
BIN
theme/default/icon_checkmark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 781 B |
BIN
theme/default/icon_emote-wink.png
Normal file
BIN
theme/default/icon_emote-wink.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 914 B |
BIN
theme/default/icon_process-working.gif
Normal file
BIN
theme/default/icon_process-working.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user