Index: trunk/extensions/QPoll/clientside/qp_results.css |
— | — | @@ -1,8 +1,8 @@ |
2 | | -.qpoll .head {font-weight:bold; color:Gray;} |
3 | | -.qpoll .question_id {font-weight:bold;} |
4 | | -.qpoll .question_name {font-weight:bold; color:blue;} |
5 | | -.qpoll table.qdata {border-collapse: collapse;} |
6 | | -.qpoll table.qdata th {border: 1px Gray solid; background-color:LightGrey; padding: 3px;} |
| 2 | +.qpoll .head { font-weight:bold; background-color:Seashell; padding:2px; } |
| 3 | +.qpoll .question_id { font-weight:bold; } |
| 4 | +.qpoll .question_name { font-weight:bold; color:blue; } |
| 5 | +.qpoll table.qdata { border-collapse: collapse; } |
| 6 | +.qpoll table.qdata th { border: 1px Gray solid; background-color:LightGrey; padding: 3px; } |
7 | 7 | .qpoll table.qdata tr.spans { color:Navy; } |
8 | 8 | .qpoll table.qdata td {border: 1px Gray solid; text-align: center; padding: 3px;} |
9 | 9 | .qpoll table.qdata td.stats {background-color: Azure;} |
Index: trunk/extensions/QPoll/specials/qp_special.php |
— | — | @@ -64,6 +64,28 @@ |
65 | 65 | return self::$linker->link( $target, $text, $customAttribs, $query, $options ); |
66 | 66 | } |
67 | 67 | |
| 68 | + /** |
| 69 | + * Displays current poll actions links. |
| 70 | + */ |
| 71 | + function showPollActionsList( $pid, $poll_id, Title $poll_title ) { |
| 72 | + global $wgContLang; |
| 73 | + return wfMsg( |
| 74 | + 'qp_results_line_qpl', |
| 75 | + # pagename |
| 76 | + qp_Setup::specialchars( $wgContLang->convert( $poll_title->getPrefixedText() ) ), |
| 77 | + # polltitle |
| 78 | + qp_Setup::specialchars( $poll_id ), |
| 79 | + # goto link |
| 80 | + $this->qpLink( $poll_title, wfMsg( 'qp_source_link' ) ), |
| 81 | + # voices link |
| 82 | + $this->qpLink( $this->getTitle(), wfMsg( 'qp_stats_link' ), array(), array( "id" => intval( $pid ), "action" => "stats" ) ), |
| 83 | + # users link |
| 84 | + $this->qpLink( $this->getTitle(), wfMsg( 'qp_users_link' ), array(), array( "id" => intval( $pid ), "action" => "pulist" ) ), |
| 85 | + # not participated link |
| 86 | + $this->qpLink( $this->getTitle(), wfMsg( 'qp_not_participated_link' ), array(), array( "id" => intval( $pid ), "action" => "npulist" ) ) |
| 87 | + ); |
| 88 | + } |
| 89 | + |
68 | 90 | } /* end of qp_SpecialPage class */ |
69 | 91 | |
70 | 92 | /** |
Index: trunk/extensions/QPoll/specials/qp_results.php |
— | — | @@ -186,7 +186,6 @@ |
187 | 187 | $tags[] = array( '__tag' => 'div', wfMsg( 'qp_poll_has_no_interpretation' ) ); |
188 | 188 | return $tags; |
189 | 189 | } |
190 | | - # 'parentheses' key is unavailable in MediaWiki 1.15.x |
191 | 190 | $interp_link = $this->qpLink( $interpTitle, $interpTitle->getPrefixedText() ); |
192 | 191 | $tags[] = array( '__tag' => 'div', wfMsg( 'qp_browse_to_interpretation', $interp_link ) ); |
193 | 192 | $interpResultView = new qp_InterpResultView( true ); |
— | — | @@ -213,14 +212,17 @@ |
214 | 213 | if ( !$pollStore->loadUserVote() ) { |
215 | 214 | return ''; |
216 | 215 | } |
217 | | - $poll_title = $pollStore->getTitle(); |
218 | | - # 'parentheses' key is unavailable in MediaWiki 1.15.x |
219 | | - $poll_link = $this->qpLink( $poll_title, $poll_title->getPrefixedText() . wfMsg( 'word-separator' ) . wfMsg( 'qp_parentheses', $pollStore->mPollId ) ); |
220 | | - $headerTags = $this->getAnswerHeader( $pollStore ); |
221 | | - $output = wfMsg( 'qp_browse_to_user', $user_link ) . "<br />\n" . |
222 | | - wfMsg( 'qp_browse_to_poll', $poll_link ) . "<br />\n" . |
223 | | - qp_Renderer::renderTagArray( $headerTags ); |
224 | | - unset( $headerTags ); |
| 216 | + $head = array(); |
| 217 | + $head[] = $this->showPollActionsList( |
| 218 | + $pollStore->pid, |
| 219 | + $pollStore->mPollId, |
| 220 | + $pollStore->getTitle() |
| 221 | + ); |
| 222 | + $head[] = wfMsg( 'qp_browse_to_user', $user_link ); |
| 223 | + $head[] = $this->getAnswerHeader( $pollStore ); |
| 224 | + qp_Renderer::applyAttrsToRow( $head, array( '__tag' => 'li', '__end' => "\n" ) ); |
| 225 | + $head = array( '__tag' => 'ul', 'class' => 'head', '__end' => "\n", $head ); |
| 226 | + $output = qp_Renderer::renderTagArray( $head ); |
225 | 227 | foreach ( $pollStore->Questions as $qdata ) { |
226 | 228 | if ( $pollStore->isUsedQuestion( $qdata->question_id ) ) { |
227 | 229 | $qview = $qdata->getView(); |
— | — | @@ -238,10 +240,14 @@ |
239 | 241 | $pollStore->loadQuestions(); |
240 | 242 | $pollStore->loadTotals(); |
241 | 243 | $pollStore->calculateStatistics(); |
242 | | - $poll_title = $pollStore->getTitle(); |
243 | | - # 'parentheses' is unavailable in 1.14.x |
244 | | - $poll_link = $this->qpLink( $poll_title, $poll_title->getPrefixedText() . wfMsg( 'word-separator' ) . wfMsg( 'qp_parentheses', $pollStore->mPollId ) ); |
245 | | - $output .= wfMsg( 'qp_browse_to_poll', $poll_link ) . "<br />\n"; |
| 244 | + $head = array( '__tag' => 'div', 'class' => 'head', '__end' => "\n", |
| 245 | + $this->showPollActionsList( |
| 246 | + $pollStore->pid, |
| 247 | + $pollStore->mPollId, |
| 248 | + $pollStore->getTitle() |
| 249 | + ) |
| 250 | + ); |
| 251 | + $output .= qp_Renderer::renderTagArray( $head ); |
246 | 252 | $interpTitle = $pollStore->getInterpTitle(); |
247 | 253 | if ( $interpTitle instanceof Title ) { |
248 | 254 | $interp_link = $this->qpLink( $interpTitle, $interpTitle->getPrefixedText() ); |
— | — | @@ -408,7 +414,11 @@ |
409 | 415 | } |
410 | 416 | |
411 | 417 | function getPageHeader() { |
412 | | - return PollResults::getPollsLink() . '<div class="head">' . wfMsg( 'qp_users_list' ) . '<div>' . $this->different_order_by_link . '</div></div>'; |
| 418 | + return PollResults::getPollsLink() . |
| 419 | + '<ul class="head">' . |
| 420 | + wfMsg( 'qp_users_list' ) . |
| 421 | + '<li>' . $this->different_order_by_link . |
| 422 | + '</li></ul>'; |
413 | 423 | } |
414 | 424 | |
415 | 425 | } /* end of qp_UsersList class */ |
— | — | @@ -446,7 +456,14 @@ |
447 | 457 | if ( $userName !== false ) { |
448 | 458 | $userTitle = Title::makeTitleSafe( NS_USER, $userName ); |
449 | 459 | $user_link = $this->qpLink( $userTitle, $userName ); |
450 | | - return PollResults::getPollsLink() . PollResults::getUsersLink() . '<div class="head">' . $user_link . ': ' . ( $this->inverse ? wfMsgExt( 'qp_user_missing_polls_link', 'parsemag', $userName ) : wfMsgExt( 'qp_user_polls_link', array( 'parsemag' ), $pidcount, $userName ) ) . ' ' . '</div>'; |
| 460 | + return PollResults::getPollsLink() . |
| 461 | + PollResults::getUsersLink() . |
| 462 | + '<ul class="head">' . |
| 463 | + "<li>{$user_link}: " . |
| 464 | + ( $this->inverse ? |
| 465 | + wfMsgExt( 'qp_user_missing_polls_link', 'parsemag', $userName ) : |
| 466 | + wfMsgExt( 'qp_user_polls_link', array( 'parsemag' ), $pidcount, $userName ) ) |
| 467 | + . "</li></ul>\n"; |
451 | 468 | } |
452 | 469 | } |
453 | 470 | |
— | — | @@ -519,19 +536,18 @@ |
520 | 537 | |
521 | 538 | function formatResult( $result ) { |
522 | 539 | global $wgLang, $wgContLang; |
523 | | - $poll_title = Title::makeTitle( $result->ns, $result->title, qp_AbstractPoll::s_getPollTitleFragment( $result->poll_id, '' ) ); |
524 | | - $pagename = qp_Setup::specialchars( $wgContLang->convert( $poll_title->getPrefixedText() ) ); |
525 | | - $pollname = qp_Setup::specialchars( $result->poll_id ); |
526 | | - $goto_link = $this->qpLink( $poll_title, wfMsg( 'qp_source_link' ) ); |
527 | | - $voices_link = $this->qpLink( $this->getTitle(), wfMsg( 'qp_stats_link' ), array(), array( "id" => intval( $result->pid ), "action" => "stats" ) ); |
528 | | - $users_link = $this->qpLink( $this->getTitle(), wfMsg( 'qp_users_link' ), array(), array( "id" => intval( $result->pid ), "action" => "pulist" ) ); |
529 | | - $not_participated_link = $this->qpLink( $this->getTitle(), wfMsg( 'qp_not_participated_link' ), array(), array( "id" => intval( $result->pid ), "action" => "npulist" ) ); |
530 | | - $link = wfMsg( 'qp_results_line_qpl', $pagename, $pollname, $goto_link, $voices_link, $users_link, $not_participated_link ); |
531 | | - return $link; |
| 540 | + return $this->showPollActionsList( |
| 541 | + intval( $result->pid ), |
| 542 | + $result->poll_id, |
| 543 | + Title::makeTitle( $result->ns, $result->title, qp_AbstractPoll::s_getPollTitleFragment( $result->poll_id, '' ) ) |
| 544 | + ); |
532 | 545 | } |
533 | 546 | |
534 | 547 | function getPageHeader() { |
535 | | - return PollResults::getUsersLink() . '<div class="head">' . wfMsg( 'qp_polls_list' ) . '</div>'; |
| 548 | + return PollResults::getUsersLink() . |
| 549 | + '<ul class="head"><li>' . |
| 550 | + wfMsg( 'qp_polls_list' ) . |
| 551 | + '</li></ul>'; |
536 | 552 | } |
537 | 553 | |
538 | 554 | } /* end of qp_PollsList class */ |
— | — | @@ -566,13 +582,18 @@ |
567 | 583 | $poll_title = Title::makeTitle( intval( $row->ns ), $row->title, qp_AbstractPoll::s_getPollTitleFragment( $row->poll_id, '' ) ); |
568 | 584 | $pagename = qp_Setup::specialchars( $wgContLang->convert( $poll_title->getPrefixedText() ) ); |
569 | 585 | $pollname = qp_Setup::specialchars( $row->poll_id ); |
570 | | - $goto_link = $this->qpLink( $poll_title, wfMsg( 'qp_source_link' ) ); |
571 | | - $spec = wfMsg( 'qp_header_line_qpul', wfMsg( $this->inverse ? 'qp_not_participated_link' : 'qp_users_link' ), $pagename, $pollname ); |
572 | | - $head[] = PollResults::getPollsLink(); |
573 | | - $head[] = PollResults::getUsersLink(); |
574 | | - $head[] = array( '__tag' => 'div', 'class' => 'head', 0 => $spec ); |
575 | | - $head[] = ' (' . $goto_link . ')'; |
576 | | - $link = qp_Renderer::renderTagArray( $head ); |
| 586 | + $head = array(); |
| 587 | + $head[] = $this->showPollActionsList( |
| 588 | + $this->pid, |
| 589 | + $row->poll_id, |
| 590 | + $poll_title |
| 591 | + ); |
| 592 | + $head[] = wfMsg( 'qp_header_line_qpul', wfMsg( $this->inverse ? 'qp_not_participated_link' : 'qp_users_link' ), $pagename, $pollname ); |
| 593 | + qp_Renderer::applyAttrsToRow( $head, array( '__tag' => 'li', '__end' => "\n" ) ); |
| 594 | + $head = array( '__tag' => 'ul', 'class' => 'head', $head ); |
| 595 | + $link = PollResults::getPollsLink() . |
| 596 | + PollResults::getUsersLink(). |
| 597 | + qp_Renderer::renderTagArray( $head ); |
577 | 598 | } |
578 | 599 | return $link; |
579 | 600 | } |
— | — | @@ -659,13 +680,13 @@ |
660 | 681 | $poll_title = Title::makeTitle( intval( $this->ns ), $this->title, qp_AbstractPoll::s_getPollTitleFragment( $this->poll_id, '' ) ); |
661 | 682 | $pagename = qp_Setup::specialchars( $wgContLang->convert( $poll_title->getPrefixedText() ) ); |
662 | 683 | $pollname = qp_Setup::specialchars( $this->poll_id ); |
663 | | - $goto_link = $this->qpLink( $poll_title, wfMsg( 'qp_source_link' ) ); |
664 | | - $spec = wfMsg( 'qp_header_line_qpul', wfMsg( 'qp_users_link' ), $pagename, $pollname ); |
665 | | - $head[] = PollResults::getPollsLink(); |
666 | | - $head[] = PollResults::getUsersLink(); |
667 | | - $head[] = array( '__tag' => 'div', 'class' => 'head', 0 => $spec ); |
668 | | - # 'parentheses' are unavailable in MW 1.14.x |
669 | | - $head[] = wfMsg( 'qp_parentheses', $goto_link ) . '<br />'; |
| 684 | + $head = array(); |
| 685 | + $head[] = $this->showPollActionsList( |
| 686 | + $pollStore->pid, |
| 687 | + $pollStore->mPollId, |
| 688 | + $poll_title |
| 689 | + ); |
| 690 | + $head[] = wfMsg( 'qp_header_line_qpul', wfMsg( 'qp_users_link' ), $pagename, $pollname ); |
670 | 691 | $ques_found = false; |
671 | 692 | foreach ( $pollStore->Questions as $qdata ) { |
672 | 693 | if ( $qdata->question_id == $this->question_id ) { |
— | — | @@ -682,13 +703,16 @@ |
683 | 704 | if ( array_key_exists( 'spanId', $categ ) ) { |
684 | 705 | $cat_name = wfMsg( 'qp_full_category_name', $cat_name, $qdata->CategorySpans[ $categ['spanId'] ]['name'] ); |
685 | 706 | } |
686 | | - $qpa = wfMsg( 'qp_header_line_qucl', |
| 707 | + $head[] = wfMsg( 'qp_header_line_qucl', |
687 | 708 | $this->question_id, |
688 | 709 | qp_Setup::entities( $qdata->CommonQuestion ), |
689 | 710 | qp_Setup::entities( $proptext ), |
690 | | - qp_Setup::entities( $cat_name ) ) . '<br />'; |
691 | | - $head[] = array( '__tag' => 'div', 'class' => 'head', 'style' => 'padding-left:2em;', 0 => $qpa ); |
692 | | - $link = qp_Renderer::renderTagArray( $head ); |
| 711 | + qp_Setup::entities( $cat_name ) ); |
| 712 | + qp_Renderer::applyAttrsToRow( $head, array( '__tag' => 'li', '__end' => "\n" ) ); |
| 713 | + $head = array( '__tag' => 'ul', 'class' => 'head', $head ); |
| 714 | + $link = PollResults::getPollsLink() . |
| 715 | + PollResults::getUsersLink() . |
| 716 | + qp_Renderer::renderTagArray( $head ); |
693 | 717 | } |
694 | 718 | } |
695 | 719 | } |
Index: trunk/extensions/QPoll/ctrl/question/qp_mixedquestion.php |
— | — | @@ -10,9 +10,6 @@ |
11 | 11 | */ |
12 | 12 | class qp_MixedQuestion extends qp_TabularQuestion { |
13 | 13 | |
14 | | - # required count of single proposal categories that should be filled by user |
15 | | - var $mCatReq = 1; |
16 | | - |
17 | 14 | /** |
18 | 15 | * Creates question view which should be renreded and |
19 | 16 | * also may be altered during the poll generation |
Index: trunk/extensions/QPoll/ctrl/question/qp_tabularquestion.php |
— | — | @@ -10,6 +10,9 @@ |
11 | 11 | */ |
12 | 12 | class qp_TabularQuestion extends qp_StubQuestion { |
13 | 13 | |
| 14 | + # required count of single proposal categories that should be filled by user |
| 15 | + var $mCatReq = 1; |
| 16 | + |
14 | 17 | /** |
15 | 18 | * Constructor |
16 | 19 | * @public |
— | — | @@ -363,12 +366,23 @@ |
364 | 367 | $pview->setErrorMessage( wfMsg( 'qp_error_proposal_text_empty' ), 'error' ); |
365 | 368 | $pview->addCellsClass( 'error' ); |
366 | 369 | } |
| 370 | + ## Check for unanswered categories. |
| 371 | + if ( ( $catreq = $prop_attrs->catreq ) === null ) { |
| 372 | + $catreq = $this->mCatReq; |
| 373 | + } |
| 374 | + if ( $inputType === 'radio' && $catreq > 1 ) { |
| 375 | + # radio buttons row always require not more than one category, |
| 376 | + # otherwise the poll will be impossible to submit sucessfully. |
| 377 | + $catreq = 1; |
| 378 | + } |
367 | 379 | # If the proposal was submitted but unanswered |
368 | | - if ( $this->poll->mBeingCorrected && !array_key_exists( $proposalId, $this->mProposalCategoryId ) ) { |
| 380 | + if ( $this->poll->mBeingCorrected && |
| 381 | + $this->hasMissingCategories( $proposalId, $catreq, count( $this->mCategories ) ) ) { |
369 | 382 | # if there was no previous errors, hightlight the whole row |
370 | 383 | if ( $this->getState() == '' ) { |
371 | 384 | $pview->addCellsClass( 'error' ); |
372 | 385 | } |
| 386 | + # the proposal was submitted but has not enough answered categories |
373 | 387 | $pview->prependErrorMessage( wfMsg( 'qp_error_no_answer' ), 'NA' ); |
374 | 388 | } |
375 | 389 | if ( $pview->text !== null ) { |