From 6b1732d9a2e7084b571051406f5f115f391c5030 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 May 2011 10:43:47 -0700 Subject: [PATCH 01/10] remove object nav for search --- lib/searchaction.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib/searchaction.php b/lib/searchaction.php index 030d2bb724..fd5f0b3ff5 100644 --- a/lib/searchaction.php +++ b/lib/searchaction.php @@ -62,20 +62,6 @@ class SearchAction extends Action $this->showPage(); } - /** - * Show tabset for this page - * - * Uses the SearchGroupNav widget - * - * @return void - * @see SearchGroupNav - */ - function showObjectNav() - { - $nav = new SearchGroupNav($this, $this->trimmed('q')); - $nav->show(); - } - function showTop($arr=null) { $error = null; From f67607d2f1371e3991042aecea8e1d9fb68bf1ad Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 May 2011 10:48:12 -0700 Subject: [PATCH 02/10] change 'You and friends' to 'Home' --- actions/all.php | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/actions/all.php b/actions/all.php index f558c3925f..388f24daad 100644 --- a/actions/all.php +++ b/actions/all.php @@ -84,12 +84,12 @@ class AllAction extends ProfileAction function title() { - if ($this->page > 1) { - // TRANS: Page title. %1$s is user nickname, %2$d is page number - return sprintf(_('%1$s and friends, page %2$d'), $this->user->nickname, $this->page); + $user = common_current_user(); + if ($user->id == $this->user->id) { + return _('Home'); } else { - // TRANS: Page title. %s is user nickname - return sprintf(_("%s and friends"), $this->user->nickname); + $profile = $this->user->getProfile(); + return sprintf(_("%s's Home"), $profile->getBestName()); } } @@ -190,18 +190,6 @@ class AllAction extends ProfileAction // $pop = new InboxTagCloudSection($this, $this->user); // $pop->show(); } - - function showPageTitle() - { - $user = common_current_user(); - if ($user && ($user->id == $this->user->id)) { - // TRANS: H1 text for page when viewing a list for self. - $this->element('h1', null, _("You and friends")); - } else { - // TRANS: H1 text for page. %s is a user nickname. - $this->element('h1', null, sprintf(_('%s and friends'), $this->user->nickname)); - } - } } class ThreadingInboxNoticeStream extends ThreadingNoticeStream From be57e253fb40097864cfbcde8efa71e6a187fd94 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 May 2011 10:49:46 -0700 Subject: [PATCH 03/10] 'Home' to 'Home timeline' --- actions/all.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actions/all.php b/actions/all.php index 388f24daad..8ee3ec3fa6 100644 --- a/actions/all.php +++ b/actions/all.php @@ -86,10 +86,10 @@ class AllAction extends ProfileAction { $user = common_current_user(); if ($user->id == $this->user->id) { - return _('Home'); + return _('Home timeline'); } else { $profile = $this->user->getProfile(); - return sprintf(_("%s's Home"), $profile->getBestName()); + return sprintf(_("%s's home timeline"), $profile->getBestName()); } } From 914de296a15593a3df2ded680c177aaf24b727c7 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 May 2011 11:05:38 -0700 Subject: [PATCH 04/10] send a confirmation email when registering by script --- plugins/EmailRegistration/scripts/registeremailuser.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/EmailRegistration/scripts/registeremailuser.php b/plugins/EmailRegistration/scripts/registeremailuser.php index a8c942d3dd..a9eff9a848 100644 --- a/plugins/EmailRegistration/scripts/registeremailuser.php +++ b/plugins/EmailRegistration/scripts/registeremailuser.php @@ -20,11 +20,14 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); +$shortoptions = 'w'; +$longoptions = array('welcome'); + $helptext = << Options: --e --email Send a confirmation message to the email address +-w --welcome Send a welcome email register a new user by email address. @@ -40,7 +43,7 @@ $email = $args[0]; $confirm = EmailRegistrationPlugin::registerEmail($email); -if (have_option('e', 'email')) { +if (have_option('w', 'welcome')) { EmailRegistrationPlugin::sendConfirmEmail($confirm); } From b432cc72c91793c24981d799a0eabbf03d5132da Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 May 2011 11:10:21 -0700 Subject: [PATCH 05/10] optionally send welcome email in installforemail.php --- .../DomainStatusNetwork/scripts/installforemail.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/DomainStatusNetwork/scripts/installforemail.php b/plugins/DomainStatusNetwork/scripts/installforemail.php index a1f7a65cd3..037e0cad1f 100644 --- a/plugins/DomainStatusNetwork/scripts/installforemail.php +++ b/plugins/DomainStatusNetwork/scripts/installforemail.php @@ -22,8 +22,15 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); +$shortoptions = 'w'; +$longoptions = array('welcome'); + $helptext = << +Create a new account and, if necessary, a new network for the given email address + +-w --welcome Send a welcome email END_OF_INSTALLFOREMAIL_HELP; @@ -54,6 +61,10 @@ StatusNet::switchSite($sn->nickname); $confirm = EmailRegistrationPlugin::registerEmail($email); +if (have_option('w', 'welcome')) { + EmailRegistrationPlugin::sendConfirmEmail($confirm); +} + $confirmUrl = common_local_url('register', array('code' => $confirm->code)); print $confirmUrl."\n"; From c46406b209d36f697d419e2bcb6c4e37a3e660fd Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 May 2011 11:28:49 -0700 Subject: [PATCH 06/10] low-level hook for loading templates --- lib/docfile.php | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/docfile.php b/lib/docfile.php index 982177315a..e396870695 100644 --- a/lib/docfile.php +++ b/lib/docfile.php @@ -63,24 +63,29 @@ class DocFile $filename = null; - foreach ($paths as $path) { + if (Event::handle('StartDocFileForTitle', array($title, &$paths, &$filename))) { - $def = $path.'/'.$title; + foreach ($paths as $path) { - if (!file_exists($def)) { - $def = null; + $def = $path.'/'.$title; + + if (!file_exists($def)) { + $def = null; + } + + $lang = glob($path.'/'.$title.'.*'); + + if ($lang === false) { + $lang = array(); + } + + if (!empty($lang) || !empty($def)) { + $filename = self::negotiateLanguage($lang, $def); + break; + } } - $lang = glob($path.'/'.$title.'.*'); - - if ($lang === false) { - $lang = array(); - } - - if (!empty($lang) || !empty($def)) { - $filename = self::negotiateLanguage($lang, $def); - break; - } + Event::handle('EndDocFileForTitle', array($title, $paths, &$filename)); } if (empty($filename)) { From 332b9400c65bb85a7ccc8e6a873be9e7f4e1776a Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 May 2011 11:30:56 -0700 Subject: [PATCH 07/10] Document new docfile events --- EVENTS.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/EVENTS.txt b/EVENTS.txt index 5bf6078a1c..e1620a7e2a 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -1381,3 +1381,13 @@ StartRegisterSuccess: Before showing the registration success message StartRegisterSuccess: After showing the registration success message - $action: the registration action + +StartDocFileForTitle: Before searching for a doc or mail template +- $title: Title we're looking for +- &$paths: Paths we're searching +- &$filename: Filename so far (set this if you want) + +EndDocFileForTitle: After searching for a doc or mail template +- $title: Title we looked for +- $paths: Paths we searched +- &$filename: Filename so far (set this if you want) From 1b5bd8991bfb3e0b6891b464e9b1f172ce79f72e Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 May 2011 11:37:03 -0700 Subject: [PATCH 08/10] use a template for confirmation email --- .../EmailRegistrationPlugin.php | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/plugins/EmailRegistration/EmailRegistrationPlugin.php b/plugins/EmailRegistration/EmailRegistrationPlugin.php index 548702514a..8759614129 100644 --- a/plugins/EmailRegistration/EmailRegistrationPlugin.php +++ b/plugins/EmailRegistration/EmailRegistrationPlugin.php @@ -155,7 +155,7 @@ class EmailRegistrationPlugin extends Plugin return $nickname; } - static function sendConfirmEmail($confirm) + static function sendConfirmEmail($confirm, $title=null) { $sitename = common_config('site', 'name'); @@ -165,25 +165,31 @@ class EmailRegistrationPlugin extends Plugin $headers['To'] = trim($confirm->address); // TRANS: Subject for confirmation e-mail. // TRANS: %s is the StatusNet sitename. - $headers['Subject'] = sprintf(_m('Confirm your registration on %s'), $sitename); + $headers['Subject'] = sprintf(_m('Welcome to %s'), $sitename); + $headers['Content-Type'] = 'text/html; charset=UTF-8'; $confirmUrl = common_local_url('register', array('code' => $confirm->code)); - // TRANS: Body for confirmation e-mail. - // TRANS: %1$s is the StatusNet sitename, %2$s is the confirmation URL. - $body = sprintf(_m('Someone (probably you) has requested an account on %1$s using this email address.'. - "\n". - 'To confirm the address, click the following URL or copy it into the address bar of your browser.'. - "\n". - '%2$s'. - "\n". - 'If it was not you, you can safely ignore this message.'), - $sitename, - $confirmUrl); + if (empty($title)) { + $title = 'confirmemailreg'; + } + + $confirmTemplate = DocFile::forTitle($title, DocFile::mailPaths()); + + $body = $confirmTemplate->toHTML(array('confirmurl' => $confirmUrl)); mail_send($recipients, $headers, $body); } + function onEndDocFileForTitle($title, $paths, &$filename) + { + if ($title == 'confirmemailreg' && empty($filename)) { + $filename = dirname(__FILE__).'/mail-src/'.$title; + return false; + } + return true; + } + function onPluginVersion(&$versions) { $versions[] = array('name' => 'EmailRegistration', From aef62ccbcc5930692b86c2136fe15df6b9b0cbea Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 May 2011 11:37:32 -0700 Subject: [PATCH 09/10] Option for custom template for confirmation email --- .../scripts/installforemail.php | 15 +++++++++++---- .../scripts/registeremailuser.php | 15 +++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/plugins/DomainStatusNetwork/scripts/installforemail.php b/plugins/DomainStatusNetwork/scripts/installforemail.php index 037e0cad1f..98ce620c28 100644 --- a/plugins/DomainStatusNetwork/scripts/installforemail.php +++ b/plugins/DomainStatusNetwork/scripts/installforemail.php @@ -22,15 +22,16 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); -$shortoptions = 'w'; -$longoptions = array('welcome'); +$shortoptions = 'wt::'; +$longoptions = array('welcome', 'template='); $helptext = << Create a new account and, if necessary, a new network for the given email address --w --welcome Send a welcome email +-w --welcome Send a welcome email +-t --template= Use this email template END_OF_INSTALLFOREMAIL_HELP; @@ -62,7 +63,13 @@ StatusNet::switchSite($sn->nickname); $confirm = EmailRegistrationPlugin::registerEmail($email); if (have_option('w', 'welcome')) { - EmailRegistrationPlugin::sendConfirmEmail($confirm); + if (have_option('t', 'template')) { + // use the provided template + EmailRegistrationPlugin::sendConfirmEmail($confirm, get_option_value('t', 'template')); + } else { + // use the default template + EmailRegistrationPlugin::sendConfirmEmail($confirm); + } } $confirmUrl = common_local_url('register', array('code' => $confirm->code)); diff --git a/plugins/EmailRegistration/scripts/registeremailuser.php b/plugins/EmailRegistration/scripts/registeremailuser.php index a9eff9a848..02915240d3 100644 --- a/plugins/EmailRegistration/scripts/registeremailuser.php +++ b/plugins/EmailRegistration/scripts/registeremailuser.php @@ -20,14 +20,15 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); -$shortoptions = 'w'; -$longoptions = array('welcome'); +$shortoptions = 'wt::'; +$longoptions = array('welcome', 'template='); $helptext = << Options: --w --welcome Send a welcome email +-w --welcome Send a welcome email +-t --template= Use this email template register a new user by email address. @@ -44,7 +45,13 @@ $email = $args[0]; $confirm = EmailRegistrationPlugin::registerEmail($email); if (have_option('w', 'welcome')) { - EmailRegistrationPlugin::sendConfirmEmail($confirm); + if (have_option('t', 'template')) { + // use the provided template + EmailRegistrationPlugin::sendConfirmEmail($confirm, get_option_value('t', 'template')); + } else { + // use the default template + EmailRegistrationPlugin::sendConfirmEmail($confirm); + } } $confirmUrl = common_local_url('register', array('code' => $confirm->code)); From 7e1ae44fad9dba14fc3bac75a9fcc666f210b82e Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 May 2011 12:25:34 -0700 Subject: [PATCH 10/10] source for registration email confirmation --- plugins/EmailRegistration/mail-src/confirmemailreg | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 plugins/EmailRegistration/mail-src/confirmemailreg diff --git a/plugins/EmailRegistration/mail-src/confirmemailreg b/plugins/EmailRegistration/mail-src/confirmemailreg new file mode 100644 index 0000000000..954a2c0dfc --- /dev/null +++ b/plugins/EmailRegistration/mail-src/confirmemailreg @@ -0,0 +1,7 @@ +Someone (probably you) has requested an account on %%site.name%% using this email address. + +To confirm the address, click the following URL or copy it into the address bar of your browser. + +> [%%arg.confirmurl%%](%%arg.confirmurl%%) + +If it was not you, you can safely ignore this message.