| 72 | | |
| 73 | | = Adding MF/PL statement check box |
| 74 | | |
| 75 | | In order to add a check box to have users agree to the MF/PL Statement of Unity I edited two files: `actions/register.php` and `plugins/OpenID/actions/finishopenidlogin.php`. The exact changes are shown below from the output of `git diff`. |
| 76 | | |
| 77 | | {{{ |
| 78 | | diff --git a/actions/register.php b/actions/register.php |
| 79 | | index 82fb9fc..8ae5c00 100644 |
| 80 | | --- a/actions/register.php |
| 81 | | +++ b/actions/register.php |
| 82 | | @@ -200,6 +200,10 @@ class RegisterAction extends Action |
| 83 | | // TRANS: Form validation error displayed when trying to register without agreeing to the site license. |
| 84 | | $this->showForm(_('You cannot register if you do not '. |
| 85 | | 'agree to the license.')); |
| 86 | | + } else if (!$this->boolean('mfpl_statement')) { |
| 87 | | + // TRANS: Form validation error displayed when trying to register without agreeing to the statement. |
| 88 | | + $this->showForm(_('You cannot register if you do not '. |
| 89 | | + 'agree to the MF/PL Statement of Unity.')); |
| 90 | | } else if ($email && !Validate::email($email, common_config('email', 'check_domain'))) { |
| 91 | | // TRANS: Form validation error displayed when trying to register without a valid e-mail address. |
| 92 | | $this->showForm(_('Not a valid email address.')); |
| 93 | | @@ -499,6 +503,21 @@ class RegisterAction extends Action |
| 94 | | $this->raw($this->licenseCheckbox()); |
| 95 | | $this->elementEnd('label'); |
| 96 | | $this->elementEnd('li'); |
| 97 | | + // MFPL statement |
| 98 | | + $attrs = array('type' => 'checkbox', |
| 99 | | + 'id' => 'mfpl_statement', |
| 100 | | + 'class' => 'checkbox', |
| 101 | | + 'name' => 'mfpl_statement', |
| 102 | | + 'value' => 'true'); |
| 103 | | + if ($this->boolean('mfpl_statement')) { |
| 104 | | + $attrs['checked'] = 'checked'; |
| 105 | | + } |
| 106 | | + $this->elementStart('li'); |
| 107 | | + $this->element('input', $attrs); |
| 108 | | + $this->elementStart('label', array('class' => 'checkbox', 'for' => 'mfpl_statement')); |
| 109 | | + $this->raw($this->statementCheckbox()); |
| 110 | | + $this->elementEnd('label'); |
| 111 | | + $this->elementEnd('li'); |
| 112 | | } |
| 113 | | $this->elementEnd('ul'); |
| 114 | | // TRANS: Button text to register a user on account registration page. |
| 115 | | @@ -541,7 +560,7 @@ class RegisterAction extends Action |
| 116 | | $message = _('My text and files are available under %s ' . |
| 117 | | 'except this private data: password, ' . |
| 118 | | 'email address, IM address, and phone number.'); |
| 119 | | - $link = '<a href="' . |
| 120 | | + $link = '<a target="_blank" href="' . |
| 121 | | htmlspecialchars(common_config('license', 'url')) . |
| 122 | | '">' . |
| 123 | | htmlspecialchars(common_config('license', 'title')) . |
| 124 | | @@ -551,6 +570,12 @@ class RegisterAction extends Action |
| 125 | | return $out; |
| 126 | | } |
| 127 | | |
| 128 | | + function statementCheckbox() |
| 129 | | + { |
| 130 | | + // TRANS: Statement checkbox label in registration dialog. |
| 131 | | + return _('I agree to the <a href="https://mayfirst.org/unity" target="_blank">May First/People Link Statement of Unity.</a>'); |
| 132 | | + } |
| 133 | | + |
| 134 | | /** |
| 135 | | * Show some information about registering for the site |
| 136 | | * |
| 137 | | }}} |
| 138 | | |
| 139 | | {{{ |
| 140 | | diff --git a/plugins/OpenID/actions/finishopenidlogin.php b/plugins/OpenID/actions/finishopenidlogin.php |
| 141 | | index 3a99988..755516d 100644 |
| 142 | | --- a/plugins/OpenID/actions/finishopenidlogin.php |
| 143 | | +++ b/plugins/OpenID/actions/finishopenidlogin.php |
| 144 | | @@ -49,6 +49,12 @@ class FinishopenidloginAction extends Action |
| 145 | | $this->trimmed('newname')); |
| 146 | | return; |
| 147 | | } |
| 148 | | + if (!$this->boolean('mfpl_statement')) { |
| 149 | | + // TRANS: Message given if user does not agree with the statement. |
| 150 | | + $this->showForm(_m('You cannot register if you do not agree to the MF/PL Statement of Unity.'), |
| 151 | | + $this->trimmed('newname')); |
| 152 | | + return; |
| 153 | | + } |
| 154 | | $this->createNewUser(); |
| 155 | | } else if ($this->arg('connect')) { |
| 156 | | $this->connectUser(); |
| 157 | | @@ -155,7 +161,7 @@ class FinishopenidloginAction extends Action |
| 158 | | $message = _m('My text and files are available under %s ' . |
| 159 | | 'except this private data: password, ' . |
| 160 | | 'email address, IM address, and phone number.'); |
| 161 | | - $link = '<a href="' . |
| 162 | | + $link = '<a target="_blank" href="' . |
| 163 | | htmlspecialchars(common_config('license', 'url')) . |
| 164 | | '">' . |
| 165 | | htmlspecialchars(common_config('license', 'title')) . |
| 166 | | @@ -163,6 +169,23 @@ class FinishopenidloginAction extends Action |
| 167 | | $this->raw(sprintf(htmlspecialchars($message), $link)); |
| 168 | | $this->elementEnd('label'); |
| 169 | | $this->elementEnd('li'); |
| 170 | | + |
| 171 | | + // MFPL statement |
| 172 | | + $this->elementStart('li'); |
| 173 | | + $this->element('input', array('type' => 'checkbox', |
| 174 | | + 'id' => 'mfpl_statement', |
| 175 | | + 'class' => 'checkbox', |
| 176 | | + 'name' => 'mfpl_statement', |
| 177 | | + 'value' => 'true')); |
| 178 | | + $this->elementStart('label', array('for' => 'mfpl_statement', |
| 179 | | + 'class' => 'checkbox')); |
| 180 | | + // TRANS: OpenID plugin link text. |
| 181 | | + // TRANS: %s is a link to a license with the license name as link text. |
| 182 | | + $message = _m('I agree to the <a href="https://mayfirst.org/unity" target="_blank">May First/People Link Statement of Unity.</a>'); |
| 183 | | + $this->raw($message); |
| 184 | | + $this->elementEnd('label'); |
| 185 | | + $this->elementEnd('li'); |
| 186 | | + |
| 187 | | $this->elementEnd('ul'); |
| 188 | | // TRANS: Button label in form in which to create a new user on the site for an OpenID. |
| 189 | | $this->submit('create', _m('BUTTON', 'Create')); |
| 190 | | }}} |