r23253 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23252‎ | r23253 | r23254 >
Date:21:07, 22 June 2007
Author:jhb
Status:old
Tags:
Comment:
first go at ratings box
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/flaggedrevs.css (modified) (history)
  • /trunk/extensions/FlaggedRevs/flaggedrevs.js (modified) (history)
  • /trunk/extensions/FlaggedRevs/img/1-small.png (added) (history)
  • /trunk/extensions/FlaggedRevs/img/1.png (added) (history)
  • /trunk/extensions/FlaggedRevs/img/2-small.png (added) (history)
  • /trunk/extensions/FlaggedRevs/img/2.png (added) (history)
  • /trunk/extensions/FlaggedRevs/img/3-small.png (added) (history)
  • /trunk/extensions/FlaggedRevs/img/3.png (added) (history)
  • /trunk/extensions/FlaggedRevs/img/fr-marker-100.png (added) (history)
  • /trunk/extensions/FlaggedRevs/img/fr-marker-20.png (added) (history)
  • /trunk/extensions/FlaggedRevs/img/fr-marker-40.png (added) (history)
  • /trunk/extensions/FlaggedRevs/img/fr-marker-60.png (added) (history)
  • /trunk/extensions/FlaggedRevs/img/fr-marker-80.png (added) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -343,7 +343,8 @@
344344 else
345345 $classmarker = 0;
346346 $levelmarker = $level * 20 + 20; //XXX do this better
347 - $tag .= "&nbsp;<span class='fr-marker-$levelmarker'><strong>" . wfMsgHtml("revreview-$quality") . "</strong>: <span class='fr-text-value'>$valuetext&nbsp;</span>&nbsp;</span>\n";
 347+
 348+ $tag .= "<div class='fr-group'><span class='fr-text'>" . wfMsgHtml("revreview-$quality") . "&nbsp;</span><span class='fr-marker value$levelmarker'>$valuetext</span></div>\n";
348349 }
349350 return $tag;
350351 }
@@ -807,16 +808,16 @@
808809 # Looking at some specific old rev or if flagged revs override only for anons
809810 if( !$this->pageOverride() ) {
810811 $revs_since = parent::getRevCountSince( $pageid, $tfrev->fr_rev_id );
811 - $simpleTag = true;
 812+ #$simpleTag = true;
812813 # Construct some tagging
813814 if( !$wgOut->isPrintable() ) {
814815 $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic';
815816 $tag .= wfMsgExt($msg, array('parseinline'), $tfrev->fr_rev_id, $time, $revs_since);
816817 # Hide clutter
817 - $tag .= ' <a href="javascript:toggleRevRatings()">' . wfMsg('revreview-toggle') . '</a>';
818 - $tag .= '<span id="mwrevisionratings" style="display:none">' .
819 - wfMsg('revreview-rating') . parent::addTagRatings( $flags ) .
820 - '</span>';
 818+ #$tag .= ' <a href="javascript:toggleRevRatings()">' . wfMsg('revreview-toggle') . '</a>';
 819+ #$tag .= '<span id="mwrevisionratings" style="display:none">' .
 820+ $tag .= wfMsg('revreview-rating') . parent::addTagRatings( $flags );
 821+ #.'</span>';
821822 }
822823 # Viewing the page normally: override the page
823824 } else {
@@ -832,10 +833,10 @@
833834 $tag = wfMsgExt('revreview-quality', array('parseinline'), $vis_id, $article->getLatest(), $revs_since, $time);
834835 else
835836 $tag = wfMsgExt('revreview-basic', array('parseinline'), $vis_id, $article->getLatest(), $revs_since, $time);
836 - $tag .= ' <a href="javascript:toggleRevRatings()">' . wfMsg('revreview-toggle') . '</a>';
837 - $tag .= '<span id="mwrevisionratings" style="display:none"><p>' .
838 - parent::addTagRatings( $flags ) .
839 - '</p></span>';
 837+ #$tag .= ' <a href="javascript:toggleRevRatings()">' . wfMsg('revreview-toggle') . '</a>';
 838+ #$tag .= '<span id="mwrevisionratings" style="display:none"><p>' .
 839+ $tag .= parent::addTagRatings( $flags );
 840+ #.'</p></span>';
840841 }
841842 # Try the stable page cache
842843 $parserOutput = parent::getPageCache( $article );
@@ -860,23 +861,30 @@
861862 }
862863 // Some checks for which tag CSS to use
863864 if( $simpleTag )
864 - $tagClass = 'flaggedrevs_notice';
 865+ $tagClass = 'value1';
865866 else if( $pristine )
866 - $tagClass = 'flaggedrevs_tag3';
 867+ $tagClass = 'value3';
867868 else if( $quality )
868 - $tagClass = 'flaggedrevs_tag2';
 869+ $tagClass = 'value2';
869870 else
870 - $tagClass = 'flaggedrevs_tag1';
 871+ $tagClass = 'value1';
871872 // Wrap tag contents in a div
872873 if( $tag !='' )
873 - $tag = '<div id="mwrevisiontag" class="' . $tagClass . ' plainlinks">'.$tag.'</div>';
 874+ $tag = '<div id="mwrevisiontag_open" class="flaggedrevs_tag1 ' . $tagClass1 . ' plainlinks">'.$tag.'</div>';
874875 // Set the new body HTML, place a tag on top
875876 $wgOut->mBodytext = $tag . $wgOut->mBodytext . $notes;
 877+ $extra="<div id='mwrevisiontag_closed' class='flaggedrevs_short $tagClass'></div>
 878+ <script type='text/javascript'>
 879+ var review_open = document.getElementById('mwrevisiontag_open');
 880+ review_open.style.display = 'none';
 881+ </script>";
 882+ $wgOut->addHTML($extra);
 883+
876884 } else {
877 - $tag = '<div id="mwrevisiontag" class="mw-warning plainlinks">'.wfMsgExt('revreview-noflagged', array('parseinline')).'</div>';
 885+ $tag = '<div id="mwrevisiontag_open" class="mw-warning plainlinks">'.wfMsgExt('revreview-noflagged', array('parseinline')).'</div>';
878886 $wgOut->addHTML( $tag );
879887 }
880 - return true;
 888+ return true;
881889 }
882890
883891 function addToEditView( &$editform ) {
@@ -906,10 +914,10 @@
907915 $msg = $this->isQuality( $flags ) ? 'revreview-newest-quality' : 'revreview-newest-basic';
908916 $tag = wfMsgExt($msg, array('parseinline'), $tfrev->fr_rev_id, $time, $revs_since );
909917 # Hide clutter
910 - $tag .= ' <a href="javascript:toggleRevRatings()">' . wfMsg('revreview-toggle') . '</a>';
911 - $tag .= '<span id="mwrevisionratings" style="display:none">' .
912 - wfMsg('revreview-rating') . parent::addTagRatings( $flags ) .
913 - '</span>';
 918+ #$tag .= ' <a href="javascript:toggleRevRatings()">' . wfMsg('revreview-toggle') . '</a>';
 919+ #$tag .= '<span id="mwrevisionratings" style="display:none">' .
 920+ $tag .= wfMsg('revreview-rating') . parent::addTagRatings( $flags );
 921+ # .'</span>';
914922 $wgOut->addHTML( '<div id="mwrevisiontag" class="flaggedrevs_notice plainlinks">' . $tag . '</div><br/>' );
915923 }
916924 return true;
Index: trunk/extensions/FlaggedRevs/flaggedrevs.css
@@ -1,115 +1,100 @@
2 -.flaggedrevs_tag1 {
 2+.flaggedrevs_tag1, .flaggedrevs_tag2, .flaggedrevs_tag3, .flaggedrevs_notes {
33 border: 1px solid #aaa;
44 background-color: #f0f8ff;
5 - padding: 5px;
 5+ padding: 10px;
66 font-size: 80%;
7 - margin-left: 50px;
8 - margin-right: 50px;
9 - text-align: center;
 7+ margin-left: 12px;
 8+ width: 200px;
 9+ position: relative;
 10+ float: right;
 11+ top: 5px;
 12+ right: 15px;
1013 }
11 -
12 -.flaggedrevs_tag2 {
13 - border: 1px solid #aaa;
14 - background-color: #f0fff0;
15 - padding: 5px;
16 - font-size: 80%;
17 - margin-left: 50px;
18 - margin-right: 50px;
19 - text-align: center;
 14+.flaggedrevs_short {
 15+ padding: 0px;
 16+ margin: 0px;
 17+ width: 27px;
 18+ position: relative;
 19+ float: right;
 20+ top: 5px;
 21+ right: 15px;
 22+ background-repeat: no-repeat;
 23+ background-position: 0px 0px;
 24+ height: 27px;
 25+ cursor: pointer;
2026 }
2127
22 -.flaggedrevs_tag3 {
23 - border: 1px solid #aaa;
24 - background-color: #fffff0;
25 - padding: 5px;
26 - font-size: 80%;
27 - margin-left: 50px;
28 - margin-right: 50px;
29 - text-align: center;
30 -}
 28+.value1 {
 29+ background-image: url(../FlaggedRevs/img/1.png);
 30+}
3131
32 -.flaggedrevs_notes {
33 - border: 1px solid #aaa;
34 - background-color: #f9f9f9;
35 - padding: 5px;
36 - font-size: 80%;
37 - margin-left: 50px;
38 - margin-right: 50px;
39 - text-align: center;
 32+.value2 {
 33+ background-image: url(../FlaggedRevs/img/2.png);
4034 }
41 -
 35+.value3 {
 36+ background-image: url(../FlaggedRevs/img/3.png);
 37+}
4238 .flaggedrevs_notice {
43 - border: 1px solid #aaa;
44 - background-color: #f9f9f9;
45 - padding: 5px;
4639 font-size: 80%;
47 - margin-left: 50px;
48 - margin-right: 50px;
49 - text-align: center;
 40+ line-height: 1.2em;
 41+ margin: 0 0 1.4em 1em;
 42+ color: #7d7d7d;
 43+ width: auto;
5044 }
5145
52 -/*.fr-marker-1 span {display: none};*/
53 -.fr-marker-1 {
54 - background-image: url(../FlaggedRevs/img/boxY.png);
55 - background-repeat: no-repeat;
56 - min-width: 16px;
57 - width: 16px;
58 - height: 16px;
59 - min-height: 16px;
60 - padding: 3px 16px 0px 20px;
 46+.fr-text {
 47+ height: 14px;
 48+ margin: 0px 7px 0px 0px;
 49+ padding: 0px;
 50+ float: left;
 51+ line-height: 15px;
 52+ font-weight: bold;
 53+ width: 80px;
6154 }
62 -
63 -.fr-text-value {
64 - /*font-size:0px; */
65 - min-width:100px;
66 - width: 100px;
67 -
 55+.fr-marker {
 56+ height: 14px;
 57+ width: 95px;
 58+ left: 0px;
 59+ top: 0px;
 60+ margin: 0px;
 61+ padding: 0px;
 62+ float: left;
 63+ background-image: url(../FlaggedRevs/img/fr-marker-20.png);
 64+ background-repeat: no-repeat;
 65+ background-position: 0px 0px;
 66+ line-height: 15px;
 67+ text-align: center;
6868 }
69 -
70 -
71 -.fr-marker-20 {
72 - background-image: url(../FlaggedRevs/img/bar_20.png);
73 - background-position: bottom left;
74 - background-repeat: no-repeat;
75 - padding-bottom: 3px;
 69+.value40 {
 70+ background-image: url(../FlaggedRevs/img/fr-marker-40.png);
7671 }
77 -.fr-marker-40 {
78 - background-image: url(../FlaggedRevs/img/bar_40.png);
79 - background-position: bottom left;
80 - background-repeat: no-repeat;
81 - padding-bottom: 3px;
 72+.value60 {
 73+ background-image: url(../FlaggedRevs/img/fr-marker-60.png);
8274 }
83 -
84 -.fr-marker-60 {
85 - background-image: url(../FlaggedRevs/img/bar_60.png);
86 - background-position: bottom left;
87 - background-repeat: no-repeat;
88 - padding-bottom: 3px;
89 -
 75+.value80 {
 76+ background-image: url(../FlaggedRevs/img/fr-marker-80.png);
9077 }
91 -
92 -.fr-marker-80 {
93 - background-image: url(../FlaggedRevs/img/bar_80.png);
94 - background-position: bottom left;
95 - background-repeat: no-repeat;
96 - padding-bottom: 3px;
 78+.value100 {
 79+ background-image: url(../FlaggedRevs/img/fr-marker-100.png);
9780 }
98 -
99 -.fr-marker-100 {
100 - background-image: url(../FlaggedRevs/img/bar_100.png);
101 - background-position: bottom left;
102 - background-repeat: no-repeat;
103 - padding-bottom: 3px;
 81+.fr-group {
 82+ display: block;
 83+ clear: left;
 84+ float: left;
 85+ margin-top: 5px;
10486 }
105 -
106 -.fr-marker-2 {
107 - background-image: url(../FlaggedRevs/img/boxC.png);
108 - background-repeat: no-repeat;
109 - padding: 3px 16px 0px 0px;
 87+.flaggedrevs_tag1 p {
 88+ position: relative;
 89+ margin: 0px;
 90+ padding: 0px 0px 10px;
 91+ line-height: 15px;
11092 }
111 -
112 -.fr-marker-0 {
113 - background-image: url(../FlaggedRevs/img/boxQ.png);
114 - background-repeat: no-repeat;
115 - padding: 3px 16px 0px 0px;
 93+#close_review {
 94+ position:relative;
 95+ float: right;
 96+ z-index: 5;
 97+ font-size: 150%;
 98+ margin-top: -5px;
 99+ cursor: pointer;
116100 }
 101+
Index: trunk/extensions/FlaggedRevs/flaggedrevs.js
@@ -6,4 +6,50 @@
77 } else {
88 ratings.style.display = 'none';
99 }
10 -}
\ No newline at end of file
 10+}
 11+
 12+
 13+
 14+
 15+
 16+function hookAnyEvent(hookName, hookFunct, element) {
 17+ if(!element){
 18+ var element = window;
 19+ }
 20+ if (element.addEventListener) {
 21+ element.addEventListener(hookName, hookFunct, false);
 22+ } else if (element.attachEvent) {
 23+ element.attachEvent("on" + hookName, hookFunct);
 24+ }
 25+}
 26+
 27+
 28+var open_review_listen = function(evt){
 29+ var review_closed = document.getElementById('mwrevisiontag_closed');
 30+ hookAnyEvent("click", open_the_review, review_closed);
 31+}
 32+
 33+var open_the_review = function(evt){
 34+ var review_open = document.getElementById('mwrevisiontag_open');
 35+ review_open.style.display = 'block';
 36+ var review_closed = document.getElementById('mwrevisiontag_closed');
 37+ review_closed.style.display = 'none';
 38+ var close_review = document.getElementById('close_review');
 39+ if(!close_review){
 40+ var close_review = document.createElement('div');
 41+ close_review.id ="close_review";
 42+ close_review.innerHTML = 'X';
 43+ review_open.insertBefore(close_review, review_open.firstChild);
 44+ hookAnyEvent("click", close_the_review, close_review);
 45+ }
 46+}
 47+var close_the_review = function(evt){
 48+ var review_open = document.getElementById('mwrevisiontag_open');
 49+ review_open.style.display = 'none';
 50+ var review_closed = document.getElementById('mwrevisiontag_closed');
 51+ review_closed.style.display = 'block';
 52+}
 53+
 54+addOnloadHook(open_review_listen);
 55+
 56+
Index: trunk/extensions/FlaggedRevs/img/1.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/FlaggedRevs/img/1.png
___________________________________________________________________
Added: svn:mime-type
1157 + image/png
Index: trunk/extensions/FlaggedRevs/img/2.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/FlaggedRevs/img/2.png
___________________________________________________________________
Added: svn:mime-type
1258 + image/png
Index: trunk/extensions/FlaggedRevs/img/3.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/FlaggedRevs/img/3.png
___________________________________________________________________
Added: svn:mime-type
1359 + image/png
Index: trunk/extensions/FlaggedRevs/img/fr-marker-20.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/FlaggedRevs/img/fr-marker-20.png
___________________________________________________________________
Added: svn:mime-type
1460 + image/png
Index: trunk/extensions/FlaggedRevs/img/1-small.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/FlaggedRevs/img/1-small.png
___________________________________________________________________
Added: svn:mime-type
1561 + image/png
Index: trunk/extensions/FlaggedRevs/img/fr-marker-40.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/FlaggedRevs/img/fr-marker-40.png
___________________________________________________________________
Added: svn:mime-type
1662 + image/png
Index: trunk/extensions/FlaggedRevs/img/2-small.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/FlaggedRevs/img/2-small.png
___________________________________________________________________
Added: svn:mime-type
1763 + image/png
Index: trunk/extensions/FlaggedRevs/img/3-small.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/FlaggedRevs/img/3-small.png
___________________________________________________________________
Added: svn:mime-type
1864 + image/png
Index: trunk/extensions/FlaggedRevs/img/fr-marker-60.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/FlaggedRevs/img/fr-marker-60.png
___________________________________________________________________
Added: svn:mime-type
1965 + image/png
Index: trunk/extensions/FlaggedRevs/img/fr-marker-80.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/FlaggedRevs/img/fr-marker-80.png
___________________________________________________________________
Added: svn:mime-type
2066 + image/png
Index: trunk/extensions/FlaggedRevs/img/fr-marker-100.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/FlaggedRevs/img/fr-marker-100.png
___________________________________________________________________
Added: svn:mime-type
2167 + image/png

Follow-up revisions

RevisionCommit summaryAuthorDate
r23265*Partial revert of r23253-23254, please add alternative UIs using a configura...aaron22:38, 22 June 2007

Status & tagging log