http://www.mediawiki.org/wiki/Special:Code/MediaWiki/98001
Revision: 98001
Author: catrope
Date: 2011-09-24 13:52:36 +0000 (Sat, 24 Sep 2011)
Log Message:
-----------
SpecialMoodBarFeedback: Add nojs paging links
* Add images for left and right arrows, enabled and disabled. Used the images
Brandon uploaded to mediawiki.org
** The naming is a bit weird. I would've preferred to call them
page-{active,disabled}-{left,right}.png , but had to use {ltr,rtl} instead
because ResourceLoader instructs CSSJanus to flip ltrand rtl in URLs, but not
to flip left and right in URLs. I considered changing that behavior but didn't
like the backwards compatibility implications. I may revisit that later
* Add messages for "More" (which was hardcoded all the time; for shame!),
"Newer" and "Older"
* Output a link or a <span>, depending on whether there are results in the
given direction. Going back (the "Newer" link) is not yet functional
* Tweak the CSS
** Share common rules between More, Newer and Older
** Show either More or Newer&Older, depending on whether JS is enabled. This
requires r95318 which is currently only in trunk
** Made the text for disabled "links" (really spans) gray. Pulled the color
value from the PNG
Modified Paths:
--------------
trunk/extensions/MoodBar/MoodBar.i18n.php
trunk/extensions/MoodBar/SpecialMoodBarFeedback.php
trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/page.css
Added Paths:
-----------
trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-active-ltr.png
trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-active-rtl.png
trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-disabled-ltr.png
trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-disabled-rtl.png
Modified: trunk/extensions/MoodBar/MoodBar.i18n.php
===================================================================
--- trunk/extensions/MoodBar/MoodBar.i18n.php 2011-09-24 12:56:49 UTC (rev
98000)
+++ trunk/extensions/MoodBar/MoodBar.i18n.php 2011-09-24 13:52:36 UTC (rev
98001)
@@ -84,6 +84,9 @@
'moodbar-feedback-whatis' => 'What is this feature?',
'moodbar-feedback-permalink' => 'link to here',
'moodbar-feedback-noresults' => 'There are no comments that match your
filters.',
+ 'moodbar-feedback-more' => 'More',
+ 'moodbar-feedback-newer' => 'Newer',
+ 'moodbar-feedback-older' => 'Older',
// Mood types
'moodbar-type-happy' => 'Happy',
'moodbar-type-sad' => 'Sad',
Modified: trunk/extensions/MoodBar/SpecialMoodBarFeedback.php
===================================================================
--- trunk/extensions/MoodBar/SpecialMoodBarFeedback.php 2011-09-24 12:56:49 UTC
(rev 98000)
+++ trunk/extensions/MoodBar/SpecialMoodBarFeedback.php 2011-09-24 13:52:36 UTC
(rev 98001)
@@ -102,6 +102,7 @@
global $wgLang, $wgRequest;
$now = wfTimestamp( TS_UNIX );
$list = '';
+ $firstRow = false; // TODO support the "Newer" link with this
foreach ( $rows as $row ) {
$type = $row->mbf_type;
$typeMsg = wfMessage( "moodbar-type-$type" )->escaped();
@@ -139,11 +140,33 @@
// Only show paging stuff if the result is not empty
and there are more results
$html = "<ul id=\"fbd-list\">$list</ul>";
if ( $lastRow ) {
- $offset = wfTimestamp( TS_MW,
$lastRow->mbf_timestamp ) . '|' . intval( $lastRow->mbf_id );
- $moreURL = htmlspecialchars(
$this->getTitle()->getLinkURL( $this->getQuery( $offset ) ) );
$moreText = wfMessage( 'moodbar-feedback-more'
)->escaped();
- $html .= "<div id=\"fbd-list-more\"><a
href=\"$moreURL\">More</a></div>";
+ $html .= '<div id="fbd-list-more"><a href="#">'
. $moreText . '</a></div>';
}
+
+ $olderURL = $newerURL = false;
+ if ( $lastRow ) {
+ $offset = wfTimestamp( TS_MW,
$lastRow->mbf_timestamp ) . '|' . intval( $lastRow->mbf_id );
+ $olderURL = htmlspecialchars(
$this->getTitle()->getLinkURL( $this->getQuery( $offset ) ) );
+ }
+ if ( $firstRow ) {
+ $newerURL = htmlspecialchars( '#' ); // TODO
+ }
+ $olderText = wfMessage( 'moodbar-feedback-older'
)->escaped();
+ $newerText = wfMessage( 'moodbar-feedback-newer'
)->escaped();
+ $html .= '<div id="fbd-list-newer-older"><div
id="fbd-list-newer">';
+ if ( $newerURL ) {
+ $html .= "<a href=\"$newerURL\">$newerText</a>";
+ } else {
+ $html .= "<span
class=\"fbd-page-disabled\">$newerText</span>";
+ }
+ $html .= '</div><div id="fbd-list-older">';
+ if ( $olderURL ) {
+ $html .= "<a href=\"$olderURL\">$olderText</a>";
+ } else {
+ $html .= "<span
class=\"fbd-page-disabled\">$olderText</span>";
+ }
+ $html .= '</div><div style="clear: both;"></div></div>';
return $html;
}
}
Added:
trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-active-ltr.png
===================================================================
(Binary files differ)
Property changes on:
trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-active-ltr.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added:
trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-active-rtl.png
===================================================================
(Binary files differ)
Property changes on:
trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-active-rtl.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added:
trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-disabled-ltr.png
===================================================================
(Binary files differ)
Property changes on:
trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-disabled-ltr.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added:
trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-disabled-rtl.png
===================================================================
(Binary files differ)
Property changes on:
trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/images/page-disabled-rtl.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Modified: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/page.css
===================================================================
--- trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/page.css
2011-09-24 12:56:49 UTC (rev 98000)
+++ trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/page.css
2011-09-24 13:52:36 UTC (rev 98001)
@@ -87,22 +87,82 @@
list-style: none;
}
-#fbd-list-more {
+.client-nojs #fbd-list-more {
+ display: none;
+}
+
+.client-js #fbd-list-newer-older {
+ display: none;
+}
+
+#fbd-list-more, #fbd-list-newer-older {
margin: 1em 0 0 13em;
padding: 0.5em;
background-color: #e8f2f8;
+}
+
+#fbd-list-more a, #fbd-list-newer a, #fbd-list-older a,
+#fbd-list-newer .fbd-page-disabled, #fbd-list-older .fbd-page-disabled {
+ font-size: 1.4em;
+ background-repeat: no-repeat;
+}
+
+#fbd-list-more {
text-align: center;
}
#fbd-list-more a {
- font-size: 1.4em;
- padding-left: 20px;
/* @embed */
background-image: url(images/page-more.png);
background-position: left center;
- background-repeat: no-repeat;
+ padding-left: 20px;
}
+#fbd-list-newer {
+ float: left;
+}
+
+#fbd-list-newer a, #fbd-list-newer .fbd-page-disabled {
+ background-position: left center;
+ padding-left: 20px;
+}
+
+/* The images here are named -ltr instead of -left and -rtl instead of -right
+ * because ResourceLoader flips -ltr and -rtl in URLs, but not -left and -right
+ */
+#fbd-list-newer a {
+ /* @embed */
+ background-image: url(images/page-active-ltr.png);
+}
+
+#fbd-list-newer .fbd-page-disabled {
+ /* @embed */
+ background-image: url(images/page-disabled-ltr.png);
+}
+
+#fbd-list-older {
+ float: right;
+}
+
+#fbd-list-older a, #fbd-list-older .fbd-page-disabled {
+ background-position: right center;
+ padding-right: 20px;
+}
+
+#fbd-list-older a {
+ /* @embed */
+ background-image: url(images/page-active-rtl.png);
+}
+
+#fbd-list-older .fbd-page-disabled {
+ /* @embed */
+ background-image: url(images/page-disabled-rtl.png);
+}
+
+.fbd-page-disabled {
+ color: #c6c6c6;
+}
+
.fbd-item {
border-bottom: solid 1px silver;
position: relative;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs