|
From: <gem...@li...> - 2012-03-30 12:24:23
|
Revision: 584
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=584&view=rev
Author: matijsdejong
Date: 2012-03-30 12:24:12 +0000 (Fri, 30 Mar 2012)
Log Message:
-----------
When specified the users mail contains links to the first of the Default Url's of the organization the user belongs to.
Modified Paths:
--------------
trunk/library/classes/Gems/User/Organization.php
trunk/library/classes/Gems/User/User.php
trunk/library/classes/GemsEscort.php
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Modified: trunk/library/classes/Gems/User/Organization.php
===================================================================
--- trunk/library/classes/Gems/User/Organization.php 2012-03-30 11:12:07 UTC (rev 583)
+++ trunk/library/classes/Gems/User/Organization.php 2012-03-30 12:24:12 UTC (rev 584)
@@ -77,6 +77,12 @@
protected $db;
/**
+ *
+ * @var Gems_Util
+ */
+ protected $util;
+
+ /**
* When true respondents of this organization may login
*
* @return boolean
@@ -184,6 +190,20 @@
}
/**
+ * Return org dependent login url
+ *
+ * @return string
+ */
+ public function getLoginUrl()
+ {
+ if ($base = $this->_get('base_url')) {
+ return $base;
+ } else {
+ return $this->util->getCurrentURI();
+ }
+ }
+
+ /**
* Array of field name => values for sending E-Mail
*
* @return array
@@ -192,6 +212,7 @@
{
$result['organization'] = $this->getName();
$result['organization_location'] = $this->_get('gor_location');
+ $result['organization_login_url'] = $this->getLoginUrl();
$result['organization_reply_name'] = $this->_get('gor_contact_name');
$result['organization_reply_to'] = $this->_get('gor_contact_email');
$result['organization_signature'] = $this->getSignature();
@@ -274,6 +295,10 @@
}
// MUtil_Echo::track($sql, $data['can_access']);
+
+ if ($baseUrls = explode(' ', $data['gor_url_base'])) {
+ $data['base_url'] = reset($baseUrls);
+ }
} else {
$data = $this->_noOrganization;
}
Modified: trunk/library/classes/Gems/User/User.php
===================================================================
--- trunk/library/classes/Gems/User/User.php 2012-03-30 11:12:07 UTC (rev 583)
+++ trunk/library/classes/Gems/User/User.php 2012-03-30 12:24:12 UTC (rev 584)
@@ -766,7 +766,8 @@
*/
public function getMailFields($locale = null)
{
- $orgResults = $this->getBaseOrganization()->getMailFields();
+ $org = $this->getBaseOrganization();
+ $orgResults = $org->getMailFields();
$projResults = $this->project->getMailFields();
$result['bcc'] = $projResults['project_bcc'];
@@ -776,12 +777,12 @@
$result['full_name'] = trim($this->getGenderHello($locale) . ' ' . $this->getFullName());
$result['greeting'] = $this->getGreeting($locale);
$result['last_name'] = ltrim($this->_getVar('user_surname_prefix') . ' ') . $this->_getVar('user_last_name');
- $result['login_url'] = $this->util->getCurrentURI();
+ $result['login_url'] = $orgResults['organization_login_url'];
$result['name'] = $this->getFullName();
$result = $result + $orgResults + $projResults;
- $result['reset_ask'] = $this->util->getCurrentURI('index/resetpassword');
+ $result['reset_ask'] = $orgResults['organization_login_url'] . '/index/resetpassword';
$result['reply_to'] = $result['from'];
$result['to'] = $result['email'];
@@ -820,7 +821,7 @@
public function getResetPasswordMailFields($locale = null)
{
$result['reset_key'] = $this->getPasswordResetKey();
- $result['reset_url'] = $this->util->getCurrentURI('index/resetpassword/key/' . $result['reset_key']);
+ $result['reset_url'] = $this->getBaseOrganization()->getLoginUrl() . '/index/resetpassword/key/' . $result['reset_key'];
return $result + $this->getMailFields($locale);
}
@@ -1058,7 +1059,7 @@
public function sendMail($subjectTemplate, $bbBodyTemplate, $useResetFields = false, $locale = null)
{
if ($useResetFields && (! $this->canResetPassword())) {
- return $this->_('Trying to send a password reset to a user that cannot be reset.');
+ return $this->translate->_('Trying to send a password reset to a user that cannot be reset.');
}
$mail = new Gems_Mail();
Modified: trunk/library/classes/GemsEscort.php
===================================================================
--- trunk/library/classes/GemsEscort.php 2012-03-30 11:12:07 UTC (rev 583)
+++ trunk/library/classes/GemsEscort.php 2012-03-30 12:24:12 UTC (rev 584)
@@ -1658,6 +1658,8 @@
{
$locale = isset($tokenData['grs_iso_lang']) ? $tokenData['grs_iso_lang'] : $this->locale;
+ $orgResults = $this->getLoader()->getOrganization($tokenData['gor_id_organization'])->getMailFields();
+
// Prepare values
$genderHello = $this->getUtil()->getTranslated()->getGenderHello($locale);
$hello[] = $genderHello[$tokenData['grs_gender']];
@@ -1693,19 +1695,13 @@
array_shift($hello);
$result['{name}'] = implode(' ', $hello);
- $result['{organization}'] = $tokenData['gor_name'];
- $result['{organization_location}'] = $tokenData['gor_location'];
- $result['{organization_reply_name}'] = $tokenData['gor_contact_name'];
- $result['{organization_reply_to}'] = $tokenData['gor_contact_email'];
- $result['{organization_signature}'] = $tokenData['gor_signature'];
- $result['{organization_url}'] = $tokenData['gor_url'];
- $result['{organization_welcome}'] = $tokenData['gor_welcome'];
+ $result = $result + MUtil_Ra::braceKeys($orgResults, '{', '}');
$result['{round}'] = $tokenData['gto_round_description'];
- $result['{site_ask_url}'] = $this->util->getCurrentURI('ask/');
+ $result['{site_ask_url}'] = $orgResults['organization_login_url'] . '/ask/';
// Url's
- $url = $this->util->getCurrentURI('ask/forward/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token']);
+ $url = $orgResults['organization_login_url'] . '/ask/forward/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token'];
$url_input = $result['{site_ask_url}'] . 'index/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token'];
$result['{survey}'] = $tokenData['gsu_survey_name'];
Modified: trunk/library/languages/default-en.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-en.po
===================================================================
--- trunk/library/languages/default-en.po 2012-03-30 11:12:07 UTC (rev 583)
+++ trunk/library/languages/default-en.po 2012-03-30 12:24:12 UTC (rev 584)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-03-30 13:10+0100\n"
+"POT-Creation-Date: 2012-03-30 14:21+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -87,8 +87,8 @@
msgid "You must login to access this page."
msgstr "You must login to access this page."
-#: classes/GemsEscort.php:1713
-#: classes/GemsEscort.php:1715
+#: classes/GemsEscort.php:1709
+#: classes/GemsEscort.php:1711
#, php-format
msgid "%d survey"
msgid_plural "%d surveys"
@@ -3623,15 +3623,15 @@
msgid "You are not allowed to login from this location."
msgstr "You are not allowed to login from this location."
-#: classes/Gems/User/User.php:1061
+#: classes/Gems/User/User.php:1062
msgid "Trying to send a password reset to a user that cannot be reset."
msgstr "Trying to send a password reset to a user that cannot be reset."
-#: classes/Gems/User/User.php:1088
+#: classes/Gems/User/User.php:1089
msgid "Unable to send e-mail."
msgstr "Unable to send e-mail."
-#: classes/Gems/User/User.php:1215
+#: classes/Gems/User/User.php:1216
msgid "Cookies must be enabled for this site."
msgstr "Cookies must be enabled for this site."
Modified: trunk/library/languages/default-nl.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-nl.po
===================================================================
--- trunk/library/languages/default-nl.po 2012-03-30 11:12:07 UTC (rev 583)
+++ trunk/library/languages/default-nl.po 2012-03-30 12:24:12 UTC (rev 584)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse NL\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-03-30 13:11+0100\n"
+"POT-Creation-Date: 2012-03-30 14:21+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -87,8 +87,8 @@
msgid "You must login to access this page."
msgstr "U moet ingelogd zijn voor toegang tot deze pagina."
-#: classes/GemsEscort.php:1713
-#: classes/GemsEscort.php:1715
+#: classes/GemsEscort.php:1709
+#: classes/GemsEscort.php:1711
#, php-format
msgid "%d survey"
msgid_plural "%d surveys"
@@ -3623,15 +3623,15 @@
msgid "You are not allowed to login from this location."
msgstr "U kunt vanaf deze locatie niet inloggen."
-#: classes/Gems/User/User.php:1061
+#: classes/Gems/User/User.php:1062
msgid "Trying to send a password reset to a user that cannot be reset."
msgstr "Het wachtwoord voor deze gebruiker kan niet gewijzigd worden."
-#: classes/Gems/User/User.php:1088
+#: classes/Gems/User/User.php:1089
msgid "Unable to send e-mail."
msgstr "Verzenden e-mail mislukt."
-#: classes/Gems/User/User.php:1215
+#: classes/Gems/User/User.php:1216
msgid "Cookies must be enabled for this site."
msgstr "Zonder cookies heeft u geen toegang tot deze site."
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|