From d9cf0280d281c09042c704a0b87762ca41546c8f Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sun, 17 Apr 2011 16:32:52 -0700 Subject: [PATCH] Give microapp form elements unique ids --- plugins/Bookmark/bookmarkform.php | 2 +- plugins/Bookmark/initialbookmarkform.php | 2 +- plugins/Event/cancelrsvpform.php | 4 +-- plugins/Event/eventform.php | 42 ++++++++++++++---------- plugins/Event/rsvpform.php | 21 +++++++----- plugins/Poll/newpollform.php | 8 +++-- plugins/Poll/pollresponseform.php | 2 +- plugins/QnA/lib/qnanewanswerform.php | 6 ++-- plugins/QnA/lib/qnanewquestionform.php | 12 ++++--- plugins/QnA/lib/qnashowanswerform.php | 9 ++--- plugins/QnA/lib/qnashowquestionform.php | 9 ++--- 11 files changed, 68 insertions(+), 49 deletions(-) diff --git a/plugins/Bookmark/bookmarkform.php b/plugins/Bookmark/bookmarkform.php index 802bbe6c9c..ff75ace71e 100644 --- a/plugins/Bookmark/bookmarkform.php +++ b/plugins/Bookmark/bookmarkform.php @@ -181,7 +181,7 @@ class BookmarkForm extends Form function formActions() { // TRANS: Button text for action to save a new bookmark. - $this->out->submit('submit', _m('BUTTON', 'Save')); + $this->out->submit('bookmark-submit', _m('BUTTON', 'Save'), 'submit', 'submit'); } function scaleImage($width, $height) diff --git a/plugins/Bookmark/initialbookmarkform.php b/plugins/Bookmark/initialbookmarkform.php index 70a2657783..a82941b16a 100644 --- a/plugins/Bookmark/initialbookmarkform.php +++ b/plugins/Bookmark/initialbookmarkform.php @@ -88,6 +88,6 @@ class InitialBookmarkForm extends Form function formActions() { // TRANS: Button text for action to save a new bookmark. - $this->out->submit('submit', _m('BUTTON', 'Add')); + $this->out->submit('initial-bookmark-submit', _m('BUTTON', 'Add'), 'submit', 'submit'); } } diff --git a/plugins/Event/cancelrsvpform.php b/plugins/Event/cancelrsvpform.php index 107351135a..3047c57bee 100644 --- a/plugins/Event/cancelrsvpform.php +++ b/plugins/Event/cancelrsvpform.php @@ -93,7 +93,7 @@ class CancelRSVPForm extends Form { $this->out->elementStart('fieldset', array('id' => 'new_rsvp_data')); - $this->out->hidden('rsvp', $this->rsvp->id); + $this->out->hidden('rsvp-id', $this->rsvp->id, 'rsvp'); switch (RSVP::verbFor($this->rsvp->response)) { case RSVP::POSITIVE: @@ -121,6 +121,6 @@ class CancelRSVPForm extends Form function formActions() { // TRANS: Button text to cancel responding to an RSVP ("please respond") item. - $this->out->submit('cancel', _m('BUTTON', 'Cancel')); + $this->out->submit('rsvp-cancel', _m('BUTTON', 'Cancel')); } } diff --git a/plugins/Event/eventform.php b/plugins/Event/eventform.php index 832604a31d..e7d7a26bea 100644 --- a/plugins/Event/eventform.php +++ b/plugins/Event/eventform.php @@ -87,75 +87,83 @@ class EventForm extends Form $this->out->elementStart('ul', 'form_data'); $this->li(); - $this->out->input('title', + $this->out->input('event-title', // TRANS: Field label on event form. _m('LABEL','Title'), null, // TRANS: Field title on event form. - _m('Title of the event.')); + _m('Title of the event.'), + 'title'); $this->unli(); $this->li(); - $this->out->input('startdate', + $this->out->input('event-startdate', // TRANS: Field label on event form. _m('LABEL','Start date'), null, // TRANS: Field title on event form. - _m('Date the event starts.')); + _m('Date the event starts.'), + 'startdate'); $this->unli(); $this->li(); - $this->out->input('starttime', + $this->out->input('event-starttime', // TRANS: Field label on event form. _m('LABEL','Start time'), null, // TRANS: Field title on event form. - _m('Time the event starts.')); + _m('Time the event starts.'), + 'starttime'); $this->unli(); $this->li(); - $this->out->input('enddate', + $this->out->input('event-enddate', // TRANS: Field label on event form. _m('LABEL','End date'), null, // TRANS: Field title on event form. - _m('Date the event ends.')); + _m('Date the event ends.'), + 'enddate'); $this->unli(); $this->li(); - $this->out->input('endtime', + $this->out->input('event-endtime', // TRANS: Field label on event form. _m('LABEL','End time'), null, // TRANS: Field title on event form. - _m('Time the event ends.')); + _m('Time the event ends.'), + 'endtime'); $this->unli(); $this->li(); - $this->out->input('location', + $this->out->input('event-location', // TRANS: Field label on event form. _m('LABEL','Location'), null, // TRANS: Field title on event form. - _m('Event location.')); + _m('Event location.'), + 'location'); $this->unli(); $this->li(); - $this->out->input('url', + $this->out->input('event-url', // TRANS: Field label on event form. _m('LABEL','URL'), null, // TRANS: Field title on event form. - _m('URL for more information.')); + _m('URL for more information.'), + 'url'); $this->unli(); $this->li(); - $this->out->input('description', + $this->out->input('event-description', // TRANS: Field label on event form. _m('LABEL','Description'), null, // TRANS: Field title on event form. - _m('Description of the event.')); + _m('Description of the event.'), + 'description'); $this->unli(); $this->out->elementEnd('ul'); @@ -176,6 +184,6 @@ class EventForm extends Form function formActions() { // TRANS: Button text to save an event.. - $this->out->submit('submit', _m('BUTTON', 'Save')); + $this->out->submit('event-submit', _m('BUTTON', 'Save'), 'submit', 'submit'); } } diff --git a/plugins/Event/rsvpform.php b/plugins/Event/rsvpform.php index 6f86004f94..7bb926039e 100644 --- a/plugins/Event/rsvpform.php +++ b/plugins/Event/rsvpform.php @@ -96,7 +96,7 @@ class RSVPForm extends Form // TRANS: Field label on form to RSVP ("please respond") for an event. $this->out->text(_m('RSVP:')); - $this->out->hidden('event', $this->event->id); + $this->out->hidden('event-id', $this->event->id, 'event'); $this->out->hidden('submitvalue', ''); $this->out->elementEnd('fieldset'); @@ -119,12 +119,17 @@ class RSVPForm extends Form function submitButton($id, $label) { - $this->out->element('input', array('type' => 'submit', - 'id' => $id, - 'name' => $id, - 'class' => 'submit', - 'value' => $label, - 'title' => $label, - 'onClick' => 'this.form.submitvalue.value = this.name; return true;')); + $this->out->element( + 'input', + array( + 'type' => 'submit', + 'id' => 'rsvp-submit', + 'name' => $id, + 'class' => 'submit', + 'value' => $label, + 'title' => $label, + 'onClick' => 'this.form.submitvalue.value = this.name; return true;' + ) + ); } } diff --git a/plugins/Poll/newpollform.php b/plugins/Poll/newpollform.php index 37d7bc149c..309125a686 100644 --- a/plugins/Poll/newpollform.php +++ b/plugins/Poll/newpollform.php @@ -122,11 +122,13 @@ class NewpollForm extends Form $default = ''; } $this->li(); - $this->out->input('option' . ($i + 1), + $this->out->input('poll-option' . ($i + 1), // TRANS: Field label for an answer option on the page to create a poll. // TRANS: %d is the option number. sprintf(_m('Option %d'), $i + 1), - $default); + $default, + null, + 'option' . ($i + 1)); $this->unli(); } @@ -148,6 +150,6 @@ class NewpollForm extends Form function formActions() { // TRANS: Button text for saving a new poll. - $this->out->submit('submit', _m('BUTTON', 'Save')); + $this->out->submit('poll-submit', _m('BUTTON', 'Save'), 'submit', 'submit'); } } diff --git a/plugins/Poll/pollresponseform.php b/plugins/Poll/pollresponseform.php index ce1c31f6c2..31e8db9414 100644 --- a/plugins/Poll/pollresponseform.php +++ b/plugins/Poll/pollresponseform.php @@ -124,6 +124,6 @@ class PollResponseForm extends Form function formActions() { // TRANS: Button text for submitting a poll response. - $this->out->submit('submit', _m('BUTTON', 'Submit')); + $this->out->submit('poll-response-submit', _m('BUTTON', 'Submit'), 'submit', 'submit'); } } diff --git a/plugins/QnA/lib/qnanewanswerform.php b/plugins/QnA/lib/qnanewanswerform.php index 2a81679ca3..ac8d2793bf 100644 --- a/plugins/QnA/lib/qnanewanswerform.php +++ b/plugins/QnA/lib/qnanewanswerform.php @@ -109,8 +109,8 @@ class QnanewanswerForm extends Form $out->raw($this->question->asHTML()); } - $out->hidden('id', $id); - $out->textarea('answer', 'answer'); + $out->hidden('qna-question-id', $id, 'id'); + $out->textarea('qna-answer', 'answer', null, null, 'answer'); } /** @@ -121,7 +121,7 @@ class QnanewanswerForm extends Form function formActions() { // TRANS: Button text for submitting a poll response. - $this->out->submit('submit', _m('BUTTON', 'Answer')); + $this->out->submit('qna-answer-submit', _m('BUTTON', 'Answer'), 'submit', 'submit'); } } diff --git a/plugins/QnA/lib/qnanewquestionform.php b/plugins/QnA/lib/qnanewquestionform.php index 1def13a8c4..cbd4e1bc68 100644 --- a/plugins/QnA/lib/qnanewquestionform.php +++ b/plugins/QnA/lib/qnanewquestionform.php @@ -105,18 +105,20 @@ class QnanewquestionForm extends Form $this->li(); $this->out->input( - 'title', + 'qna-question-title', _m('Title'), $this->title, - _m('Title of your question') + _m('Title of your question'), + 'title' ); $this->unli(); $this->li(); $this->out->textarea( - 'description', + 'qna-question-description', _m('Description'), $this->description, - _m('Your question in detail') + _m('Your question in detail'), + 'description' ); $this->unli(); @@ -138,6 +140,6 @@ class QnanewquestionForm extends Form function formActions() { // TRANS: Button text for saving a new question. - $this->out->submit('submit', _m('BUTTON', 'Save')); + $this->out->submit('qna-question-submit', _m('BUTTON', 'Save'), 'submit', 'submit'); } } diff --git a/plugins/QnA/lib/qnashowanswerform.php b/plugins/QnA/lib/qnashowanswerform.php index f3923698d2..8db00e0fcd 100644 --- a/plugins/QnA/lib/qnashowanswerform.php +++ b/plugins/QnA/lib/qnashowanswerform.php @@ -121,8 +121,9 @@ class QnashowanswerForm extends Form function formData() { $this->out->hidden( - 'id', - 'answer-' . $this->answer->id + 'qna-answer-id', + 'answer-' . $this->answer->id, + 'id' ); $this->out->raw($this->answer->asHTML()); @@ -144,11 +145,11 @@ class QnashowanswerForm extends Form if ($user->id == $this->question->profile_id) { if (empty($this->answer->best)) { $this->out->submit( - 'best', + 'qna-best-answer', // TRANS: Button text for marking an answer as "best" _m('BUTTON', 'Best'), 'submit', - null, + 'submit', // TRANS: Title for button text marking an answer as "best" _('Mark as best answer') ); diff --git a/plugins/QnA/lib/qnashowquestionform.php b/plugins/QnA/lib/qnashowquestionform.php index ad29d0d018..27abd42757 100644 --- a/plugins/QnA/lib/qnashowquestionform.php +++ b/plugins/QnA/lib/qnashowquestionform.php @@ -114,8 +114,9 @@ class QnashowquestionForm extends Form function formData() { $this->out->hidden( - 'id', - 'question-' . $this->question->id + 'qna-quesiton-id', + 'question-' . $this->question->id, + 'id' ); $this->out->raw($this->question->asHTML()); @@ -136,11 +137,11 @@ class QnashowquestionForm extends Form if (empty($this->question->closed)) { if ($user->id == $this->question->profile_id) { $this->out->submit( - 'close', + 'qna-question-close', // TRANS: Button text for closing a question _m('BUTTON', 'Close'), 'submit', - null, + 'submit', // TRANS: Title for button text for closing a question _('Close the question') ); -- 2.39.5