From: <gem...@li...> - 2012-07-18 09:34:30
|
Revision: 853 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=853&view=rev Author: mennodekker Date: 2012-07-18 09:34:20 +0000 (Wed, 18 Jul 2012) Log Message: ----------- Fixed #549: Allow a layered login when organizations have children dev: allow to set label for top and child organization elements from the project's indexController Modified Paths: -------------- trunk/library/classes/Gems/Default/IndexAction.php trunk/library/classes/Gems/User/Form/LayeredLoginForm.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/Default/IndexAction.php =================================================================== --- trunk/library/classes/Gems/Default/IndexAction.php 2012-07-18 08:01:04 UTC (rev 852) +++ trunk/library/classes/Gems/Default/IndexAction.php 2012-07-18 09:34:20 UTC (rev 853) @@ -117,7 +117,12 @@ Gems_Html::init(); if ($this->layeredLogin === true) { + // Allow to set labels without modifying the form by overriding the below methods + $args['topOrganizationDescription'] = $this->getTopOrganizationDescription(); + $args['childOrganizationDescription'] = $this->getChildOrganizationDescription(); + return $this->loader->getUserLoader()->getLayeredLoginForm($args); + } else { return $this->loader->getUserLoader()->getLoginForm($args); } @@ -203,6 +208,28 @@ } /** + * Modify this to set a new title for the child organization element + * if you use layered login + * + * @return string + */ + public function getChildOrganizationDescription() + { + return $this->translate->_('Department'); + } + + /** + * Modify this to set a new title for the top organization element + * if you use layered login + * + * @return string + */ + public function getTopOrganizationDescription() + { + return $this->translate->_('Organization'); + } + + /** * Dummy: always rerouted by GemsEscort */ public function indexAction() { } Modified: trunk/library/classes/Gems/User/Form/LayeredLoginForm.php =================================================================== --- trunk/library/classes/Gems/User/Form/LayeredLoginForm.php 2012-07-18 08:01:04 UTC (rev 852) +++ trunk/library/classes/Gems/User/Form/LayeredLoginForm.php 2012-07-18 09:34:20 UTC (rev 853) @@ -62,6 +62,20 @@ public $topOrganizationFieldName = 'toporganization'; /** + * The label for the top-organization element + * + * @var string + */ + public $topOrganizationDescription = null; + + /** + * The label for the child-organization element + * + * @var string + */ + public $childOrganizationDescription = null; + + /** * Return array of organizations that are a child of the given parentId * * @param int $parentId @@ -142,7 +156,7 @@ } else { $element = new Zend_Form_Element_Select($this->organizationFieldName); - $element->setLabel($this->translate->_('Organization')); + $element->setLabel($this->childOrganizationDescription); $element->setRegisterInArrayValidator(true); $element->setRequired(true); $element->setMultiOptions($childOrgs); @@ -214,7 +228,7 @@ } elseif (! $element instanceof Zend_Form_Element_Select) { $element = new Zend_Form_Element_Select($this->topOrganizationFieldName); - $element->setLabel($this->translate->_('Organization')); + $element->setLabel($this->topOrganizationDescription); $element->setRegisterInArrayValidator(true); $element->setRequired(true); $element->setMultiOptions($orgs); @@ -239,10 +253,49 @@ */ public function loadDefaultElements() { + // If not already set, set some defaults for organization elements + if (is_null($this->topOrganizationDescription)) { + $this->topOrganizationDescription = $this->translate->_('Organization'); + } + + if (is_null($this->childOrganizationDescription)) { + $this->childOrganizationDescription = $this->translate->_('Department'); + } + $this->getTopOrganizationElement(); parent::loadDefaultElements(); return $this; } + + /** + * Set the label for the child organization element + * + * Enables loading of parameter through Zend_Form::__construct() + * + * @param string $description + * @return Gems_User_Form_LayeredLoginForm (continuation pattern) + */ + public function setChildOrganizationDescription($description = null) + { + $this->childOrganizationDescription = $description; + + return $this; + } + + /** + * Set the label for the top organization element + * + * Enables loading of parameter through Zend_Form::__construct() + * + * @param string $description + * @return Gems_User_Form_LayeredLoginForm (continuation pattern) + */ + public function setTopOrganizationDescription($description = null) + { + $this->topOrganizationDescription = $description; + + return $this; + } } \ No newline at end of file Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-07-18 08:01:04 UTC (rev 852) +++ trunk/library/languages/default-en.po 2012-07-18 09:34:20 UTC (rev 853) @@ -2,9 +2,9 @@ msgstr "" "Project-Id-Version: GemsTracker EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-07-16 19:30+0100\n" +"POT-Creation-Date: 2012-07-18 11:33+0100\n" "PO-Revision-Date: \n" -"Last-Translator: Matijs de Jong <mj...@ma...>\n" +"Last-Translator: Menno Dekker <men...@er...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -1026,78 +1026,82 @@ msgid "Administrative groups" msgstr "Administrative groups" -#: classes/Gems/Default/IndexAction.php:157 +#: classes/Gems/Default/IndexAction.php:174 msgid "Request password reset" msgstr "Request password reset" -#: classes/Gems/Default/IndexAction.php:161 +#: classes/Gems/Default/IndexAction.php:178 msgid "Please enter your organization and your username or e-mail address. " msgstr "Please enter your organization and your username or e-mail address. " -#: classes/Gems/Default/IndexAction.php:163 +#: classes/Gems/Default/IndexAction.php:180 msgid "Please enter your username or e-mail address. " msgstr "Please enter your username or e-mail address. " -#: classes/Gems/Default/IndexAction.php:165 +#: classes/Gems/Default/IndexAction.php:182 msgid "We will then send you an e-mail with a link. The link will bring you to a page where you can set a new password of your choice." msgstr "We will then send you an e-mail with a link. The link will bring you to a page where you can set a new password of your choice." -#: classes/Gems/Default/IndexAction.php:171 +#: classes/Gems/Default/IndexAction.php:188 msgid "Execute password reset" msgstr "Execute password reset" -#: classes/Gems/Default/IndexAction.php:172 +#: classes/Gems/Default/IndexAction.php:189 msgid "We received your password reset request." msgstr "We received your password reset request." -#: classes/Gems/Default/IndexAction.php:175 +#: classes/Gems/Default/IndexAction.php:192 #, php-format msgid "Welcome to %s" msgstr "Welcome to %s" -#: classes/Gems/Default/IndexAction.php:176 +#: classes/Gems/Default/IndexAction.php:193 msgid "Welcome to this website." msgstr "Welcome to this website." -#: classes/Gems/Default/IndexAction.php:179 +#: classes/Gems/Default/IndexAction.php:196 msgid "Please enter your password of choice twice." msgstr "Please enter your password of choice twice." #: classes/Gems/Default/IndexAction.php:218 +msgid "Department" +msgstr "Department" + +#: classes/Gems/Default/IndexAction.php:257 msgid "Your password must be changed." msgstr "Your password must be changed." -#: classes/Gems/Default/IndexAction.php:233 +#: classes/Gems/Default/IndexAction.php:272 #, php-format msgid "Login successful, welcome %s." msgstr "Login successful, welcome %s." -#: classes/Gems/Default/IndexAction.php:273 +#: classes/Gems/Default/IndexAction.php:316 #, php-format msgid "Good bye: %s." msgstr "Good bye: %s." -#: classes/Gems/Default/IndexAction.php:296 +#: classes/Gems/Default/IndexAction.php:339 msgid "Your password reset request is no longer valid, please request a new link." msgstr "Your password reset request is no longer valid, please request a new link." -#: classes/Gems/Default/IndexAction.php:298 +#: classes/Gems/Default/IndexAction.php:341 msgid "Your password input request is no longer valid, please request a new link." msgstr "Your password input request is no longer valid, please request a new link." -#: classes/Gems/Default/IndexAction.php:317 +#: classes/Gems/Default/IndexAction.php:360 msgid "We sent you an e-mail with a reset link. Click on the link in the e-mail." msgstr "We sent you an e-mail with a reset link. Click on the link in the e-mail." -#: classes/Gems/Default/IndexAction.php:326 +#: classes/Gems/Default/IndexAction.php:369 msgid "New password is active." msgstr "New password is active." -#: classes/Gems/Default/IndexAction.php:347 +#: classes/Gems/Default/IndexAction.php:390 msgid "Password reset requested" msgstr "Password reset requested" -#: classes/Gems/Default/IndexAction.php:350 +#: classes/Gems/Default/IndexAction.php:393 msgid "" "Dear {greeting},\n" "\n" @@ -4227,23 +4231,19 @@ #: snippets/DeleteSingleSurveyInSourceTokenSnippet.php:172 #: snippets/DeleteSingleSurveyNotUsedTokenSnippet.php:143 -#: snippets/DeleteTrackTokenSnippet.php:193 msgid "Edit token" msgstr "Edit token" #: snippets/DeleteSingleSurveyInSourceTokenSnippet.php:225 -#: snippets/DeleteTrackTokenSnippet.php:245 #, php-format msgid "Redo of token %s." msgstr "Redo of token %s." #: snippets/DeleteSingleSurveyInSourceTokenSnippet.php:228 -#: snippets/DeleteTrackTokenSnippet.php:248 msgid "Old comment:" msgstr "Old comment:" #: snippets/DeleteSingleSurveyInSourceTokenSnippet.php:249 -#: snippets/DeleteTrackTokenSnippet.php:269 #, php-format msgid "Created replacement token %2$s for token %1$s." msgstr "Created replacement token %2$s for token %1$s." @@ -4258,6 +4258,7 @@ msgstr "Deleted token %s for survey %s." #: snippets/DeleteTrackTokenSnippet.php:286 +#: snippets/EditTrackTokenSnippet.php:182 #, php-format msgid "%d token changed by recalculation." msgid_plural "%d tokens changed by recalculation." Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-07-18 08:01:04 UTC (rev 852) +++ trunk/library/languages/default-nl.po 2012-07-18 09:34:20 UTC (rev 853) @@ -2,9 +2,9 @@ msgstr "" "Project-Id-Version: GemsTracker NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-07-16 19:31+0100\n" +"POT-Creation-Date: 2012-07-18 11:32+0100\n" "PO-Revision-Date: \n" -"Last-Translator: Matijs de Jong <mj...@ma...>\n" +"Last-Translator: Menno Dekker <men...@er...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -1026,78 +1026,82 @@ msgid "Administrative groups" msgstr "Beheer groepen" -#: classes/Gems/Default/IndexAction.php:157 +#: classes/Gems/Default/IndexAction.php:174 msgid "Request password reset" msgstr "Wachtwoord vergeten?" -#: classes/Gems/Default/IndexAction.php:161 +#: classes/Gems/Default/IndexAction.php:178 msgid "Please enter your organization and your username or e-mail address. " msgstr "Geef uw organisatie en uw email adres of de gebruikersnaam op. " -#: classes/Gems/Default/IndexAction.php:163 +#: classes/Gems/Default/IndexAction.php:180 msgid "Please enter your username or e-mail address. " msgstr "Geef uw email adres of gebruikersnaam op. " -#: classes/Gems/Default/IndexAction.php:165 +#: classes/Gems/Default/IndexAction.php:182 msgid "We will then send you an e-mail with a link. The link will bring you to a page where you can set a new password of your choice." msgstr "Vervolgens sturen wij u een email met een link. De link verwijst naar een pagina waar u een zelfgekozen wachtwoord in kan voeren." -#: classes/Gems/Default/IndexAction.php:171 +#: classes/Gems/Default/IndexAction.php:188 msgid "Execute password reset" msgstr "Vervang vergeten passwood" -#: classes/Gems/Default/IndexAction.php:172 +#: classes/Gems/Default/IndexAction.php:189 msgid "We received your password reset request." msgstr "We hebben uw verzoek voor een nieuw wachtwoord ontvangen." -#: classes/Gems/Default/IndexAction.php:175 +#: classes/Gems/Default/IndexAction.php:192 #, php-format msgid "Welcome to %s" msgstr "Welkom bij %s" -#: classes/Gems/Default/IndexAction.php:176 +#: classes/Gems/Default/IndexAction.php:193 msgid "Welcome to this website." msgstr "Welkom op deze website." -#: classes/Gems/Default/IndexAction.php:179 +#: classes/Gems/Default/IndexAction.php:196 msgid "Please enter your password of choice twice." msgstr "Geef twee keer een zelfgekozen wachtwoord op." #: classes/Gems/Default/IndexAction.php:218 +msgid "Department" +msgstr "Afdeling" + +#: classes/Gems/Default/IndexAction.php:257 msgid "Your password must be changed." msgstr "Uw wachtwoord moet veranderd worden." -#: classes/Gems/Default/IndexAction.php:233 +#: classes/Gems/Default/IndexAction.php:272 #, php-format msgid "Login successful, welcome %s." msgstr "Login in orde, welkom %s." -#: classes/Gems/Default/IndexAction.php:273 +#: classes/Gems/Default/IndexAction.php:316 #, php-format msgid "Good bye: %s." msgstr "Tot ziens: %s." -#: classes/Gems/Default/IndexAction.php:296 +#: classes/Gems/Default/IndexAction.php:339 msgid "Your password reset request is no longer valid, please request a new link." msgstr "Uw verzoek om een nieuw wachtwoord is niet meer geldig, maar u kan hieronder een nieuwe link aanvragen." -#: classes/Gems/Default/IndexAction.php:298 +#: classes/Gems/Default/IndexAction.php:341 msgid "Your password input request is no longer valid, please request a new link." msgstr "Uw link om een wachtwoord in te voeren is niet meer geldig, maar u kan hieronder een nieuwe link aanvragen." -#: classes/Gems/Default/IndexAction.php:317 +#: classes/Gems/Default/IndexAction.php:360 msgid "We sent you an e-mail with a reset link. Click on the link in the e-mail." msgstr "We hebben u een email met reset link gestuurd. Klik op de link in de email." -#: classes/Gems/Default/IndexAction.php:326 +#: classes/Gems/Default/IndexAction.php:369 msgid "New password is active." msgstr "Nieuwe wachtwoord geactiveerd." -#: classes/Gems/Default/IndexAction.php:347 +#: classes/Gems/Default/IndexAction.php:390 msgid "Password reset requested" msgstr "Wachtwoord reset aangevraagd" -#: classes/Gems/Default/IndexAction.php:350 +#: classes/Gems/Default/IndexAction.php:393 msgid "" "Dear {greeting},\n" "\n" @@ -4227,23 +4231,19 @@ #: snippets/DeleteSingleSurveyInSourceTokenSnippet.php:172 #: snippets/DeleteSingleSurveyNotUsedTokenSnippet.php:143 -#: snippets/DeleteTrackTokenSnippet.php:193 msgid "Edit token" msgstr "Kenmerk bewerken" #: snippets/DeleteSingleSurveyInSourceTokenSnippet.php:225 -#: snippets/DeleteTrackTokenSnippet.php:245 #, php-format msgid "Redo of token %s." msgstr "Herkansing voor kenmerk %s." #: snippets/DeleteSingleSurveyInSourceTokenSnippet.php:228 -#: snippets/DeleteTrackTokenSnippet.php:248 msgid "Old comment:" msgstr "Oude opmerkingen" #: snippets/DeleteSingleSurveyInSourceTokenSnippet.php:249 -#: snippets/DeleteTrackTokenSnippet.php:269 #, php-format msgid "Created replacement token %2$s for token %1$s." msgstr "Kenmerk %s is vervangen door het nieuwe kenmerk %s." @@ -4258,6 +4258,7 @@ msgstr "Kenmerk %s voor vragenlijsten %s is verwijderd." #: snippets/DeleteTrackTokenSnippet.php:286 +#: snippets/EditTrackTokenSnippet.php:182 #, php-format msgid "%d token changed by recalculation." msgid_plural "%d tokens changed by recalculation." This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |