Index: trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php |
— | — | @@ -1,4 +1,4 @@ |
2 | | -<?php |
| 2 | +<?php |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Result printer that prints query results as a gallery. |
— | — | @@ -7,7 +7,8 @@ |
8 | 8 | * @ingroup SemanticResultFormats |
9 | 9 | * |
10 | 10 | * @author Rowan Rodrik van der Molen |
11 | | - * @author Jeroen De Dauw, mwjames |
| 11 | + * @author Jeroen De Dauw |
| 12 | + * @author mwjames |
12 | 13 | */ |
13 | 14 | class SRFGallery extends SMWResultPrinter { |
14 | 15 | |
— | — | @@ -29,18 +30,35 @@ |
30 | 31 | $ig->setShowFilename( false ); |
31 | 32 | $ig->setParser( $wgParser ); |
32 | 33 | $ig->setCaption( $this->mIntro ); // set caption to IQ header |
33 | | - |
| 34 | + |
34 | 35 | if ( $this->m_params['galleryformat'] == 'carousel' ) { |
35 | 36 | // Set attributes for jcarousel |
36 | | - $mAttribs['id'] = 'carousel'; |
| 37 | + $mAttribs['id'] = 'carousel'; |
37 | 38 | $mAttribs['class'] = 'jcarousel-skin-smw'; |
| 39 | + |
| 40 | + // Aoid js loading issues by not displaying anything until js is able to do so |
38 | 41 | $mAttribs['style'] = 'display:none;'; |
| 42 | + |
| 43 | + // Horizontal or vertical orientation |
| 44 | + $mAttribs['orientation'] = 'horizontal'; |
| 45 | + |
| 46 | + // Whether to wrap at the first/last item (or both) and jump back to the start/end |
| 47 | + $mAttribs['wrap'] = 'both'; |
| 48 | + |
| 49 | + // Use perrow parameter to determine the scroll sequence |
| 50 | + if( empty($this->m_params['perrow']) ){ |
| 51 | + $mAttribs['scroll'] = 1; // default 1 |
| 52 | + }else{ |
| 53 | + $mAttribs['scroll'] = $this->m_params['perrow']; |
| 54 | + $mAttribs['visible'] = $this->m_params['perrow']; |
| 55 | + } |
| 56 | + |
39 | 57 | $ig->setAttributes( $mAttribs ); |
40 | | - |
41 | | - // Require the javascript |
| 58 | + |
| 59 | + // Load javascript module |
42 | 60 | SMWOutputs::requireResource( 'ext.srf.jcarousel' ); |
43 | 61 | } |
44 | | - |
| 62 | + |
45 | 63 | // In case galleryformat = carousel, perrow should not be set |
46 | 64 | if ( $this->m_params['perrow'] !== '' && $this->m_params['galleryformat'] !== 'carousel' ) { |
47 | 65 | $ig->setPerRow( $this->m_params['perrow'] ); |
— | — | @@ -177,7 +195,7 @@ |
178 | 196 | $ig->add( $imgTitle, $imgCaption ); |
179 | 197 | |
180 | 198 | // Only add real images (bug #5586) |
181 | | - if ( $imgTitle->getNamespace() == NS_IMAGE && !$imgTitle->getDBkey() == null ) { |
| 199 | + if ( $imgTitle->getNamespace() == NS_IMAGE && !is_null($imgTitle->getDBkey()) ) { |
182 | 200 | $wgParser->mOutput->addImage( $imgTitle->getDBkey() ); |
183 | 201 | } |
184 | 202 | } |
— | — | @@ -193,6 +211,7 @@ |
194 | 212 | $params = parent::getParameters(); |
195 | 213 | |
196 | 214 | if ( defined( 'MW_SUPPORTS_RESOURCE_MODULES' ) ) { |
| 215 | + // Since 1.7.1 |
197 | 216 | $params['galleryformat'] = new Parameter( 'galleryformat', Parameter::TYPE_STRING, '' ); |
198 | 217 | $params['galleryformat']->setMessage( 'srf_paramdesc_galleryformat' ); |
199 | 218 | $params['galleryformat']->addCriteria( new CriterionInArray( 'carousel' ) ); |
Index: trunk/extensions/SemanticResultFormats/Gallery/resources/ext.srf.jcarousel.css |
— | — | @@ -1,228 +1,268 @@ |
2 | | -/** |
| 2 | +/** |
3 | 3 | * Adopted .jcarousel-skin-tango css for SRF Gallery Carousel module |
4 | 4 | * |
5 | 5 | * @licence: GNU GPL v3 or later |
6 | 6 | * @author: mwjames and others |
7 | 7 | * |
8 | | - * @release: 0.1 |
| 8 | + * @release: 0.1.2 |
9 | 9 | */ |
10 | 10 | |
11 | 11 | .jcarousel-skin-smw .jcarousel-container { |
12 | | - background: #ffffff; |
13 | | - border: 1px solid #eee; |
| 12 | + background: #ffffff; |
14 | 13 | } |
15 | 14 | |
16 | 15 | .jcarousel-skin-smw .jcarousel-direction-rtl { |
17 | 16 | direction: rtl; |
18 | 17 | } |
19 | 18 | |
| 19 | +.jcarousel-list .jcarousel-list-horizontal { |
| 20 | + margin-left:20px; |
| 21 | +} |
| 22 | + |
20 | 23 | .jcarousel-skin-smw .jcarousel-container-horizontal { |
21 | | - width: 99.6%; |
22 | | - padding: 0px 1px; |
| 24 | + width: 99.6%; |
| 25 | + padding: 0px 1px; |
| 26 | + margin-bottom:10px; |
| 27 | + border: 1px solid #eee; |
| 28 | + |
23 | 29 | } |
24 | 30 | |
25 | 31 | .jcarousel-skin-smw .jcarousel-container-vertical { |
26 | | - width: 175px; |
27 | | - height: 345px; |
28 | | - padding: 40px 20px; |
| 32 | + width: 155px; |
| 33 | + height: 365px; |
| 34 | + padding: 23px 15px; |
| 35 | + margin-left:10px; |
| 36 | + margin-bottom:10px; |
| 37 | + border: 1px solid #eee; |
| 38 | + float:right; |
29 | 39 | } |
30 | 40 | |
31 | 41 | .jcarousel-skin-smw .jcarousel-clip { |
32 | | - overflow: hidden; |
| 42 | + overflow: hidden; |
33 | 43 | } |
34 | 44 | |
35 | 45 | .jcarousel-skin-smw .jcarousel-clip-horizontal { |
36 | | - width: 97%; |
37 | | - height: auto; |
| 46 | + width: 97%; |
| 47 | + height: auto; |
38 | 48 | } |
39 | 49 | |
40 | 50 | .jcarousel-skin-smw .jcarousel-clip-vertical { |
41 | | - width: 175px; |
42 | | - height: 345px; |
| 51 | + width: 160px; |
| 52 | + height: 355px; |
43 | 53 | } |
44 | 54 | |
45 | 55 | .jcarousel-skin-smw .jcarousel-item { |
46 | | - width: auto; |
47 | | - height: auto; |
| 56 | + width: auto; |
| 57 | + height: auto; |
48 | 58 | } |
49 | 59 | |
50 | 60 | .jcarousel-skin-smw .jcarousel-item-horizontal { |
51 | 61 | margin-left: 23px; |
52 | | - margin-right: 0px; |
| 62 | + margin-right: 0px; |
| 63 | + margin-top: 4px; |
53 | 64 | } |
54 | 65 | |
55 | 66 | .jcarousel-skin-smw .jcarousel-direction-rtl .jcarousel-item-horizontal { |
56 | | - margin-left: 10px; |
57 | | - margin-right: 0; |
| 67 | + margin-left: 0px; |
| 68 | + margin-right: 23px; |
58 | 69 | } |
59 | 70 | |
60 | 71 | .jcarousel-skin-smw .jcarousel-item-vertical { |
61 | | - margin-bottom: 10px; |
| 72 | + margin-bottom: 10px; |
62 | 73 | } |
63 | 74 | |
64 | 75 | .jcarousel-skin-smw .jcarousel-item-placeholder { |
65 | | - background: #fff; |
66 | | - color: #000; |
| 76 | + background: #fff; |
| 77 | + color: #000; |
67 | 78 | } |
68 | 79 | |
69 | 80 | /** |
70 | 81 | * Horizontal Buttons |
71 | 82 | */ |
72 | 83 | .jcarousel-skin-smw .jcarousel-next-horizontal { |
73 | | - position: absolute; |
74 | | - top: -1px; |
75 | | - right: -1px; |
76 | | - width: 32px; |
77 | | - height: 32px; |
78 | | - cursor: pointer; |
79 | | - background: transparent url(images/next-horizontal.png) no-repeat 0 0; |
80 | | - background-size:7px 11px; |
| 84 | + position: absolute; |
| 85 | + top: -1px; |
| 86 | + right: -1px; |
| 87 | + width: 32px; |
| 88 | + height: 32px; |
| 89 | + cursor: pointer; |
| 90 | + background: transparent url(images/next-horizontal.png) no-repeat 0 0; |
| 91 | + background-size:7px 11px; |
81 | 92 | } |
82 | 93 | |
83 | 94 | .jcarousel-skin-smw .jcarousel-direction-rtl .jcarousel-next-horizontal { |
84 | | - left: 5px; |
85 | | - right: auto; |
86 | | - background-image: url(images/next-horizontal.png); |
| 95 | + left: -1px; |
| 96 | + right: auto; |
| 97 | + background-image: url(images/next-horizontal.png); |
87 | 98 | } |
88 | 99 | |
89 | 100 | .jcarousel-skin-smw .jcarousel-next-horizontal:hover, |
90 | 101 | .jcarousel-skin-smw .jcarousel-next-horizontal:focus { |
91 | | - background-position: -32px 0; |
| 102 | + background-position: -32px 0; |
92 | 103 | } |
93 | 104 | |
94 | 105 | .jcarousel-skin-smw .jcarousel-next-horizontal:active { |
95 | | - background-position: -64px 0; |
| 106 | + background-position: -64px 0; |
96 | 107 | } |
97 | 108 | |
98 | 109 | .jcarousel-skin-smw .jcarousel-next-disabled-horizontal, |
99 | 110 | .jcarousel-skin-smw .jcarousel-next-disabled-horizontal:hover, |
100 | 111 | .jcarousel-skin-smw .jcarousel-next-disabled-horizontal:focus, |
101 | 112 | .jcarousel-skin-smw .jcarousel-next-disabled-horizontal:active { |
102 | | - cursor: default; |
103 | | - background-position: -96px 0; |
| 113 | + cursor: default; |
| 114 | + background-position: -96px 0; |
104 | 115 | } |
105 | 116 | |
106 | 117 | .jcarousel-skin-smw .jcarousel-prev-horizontal { |
107 | | - position: absolute; |
108 | | - top: -1px; |
109 | | - left: -1px; |
110 | | - width: 32px; |
111 | | - height: 32px; |
112 | | - cursor: pointer; |
113 | | - background: transparent url(images/prev-horizontal.png) no-repeat 0 0; |
114 | | - background-size:7px 11px; |
| 118 | + position: absolute; |
| 119 | + top: -1px; |
| 120 | + left: -1px; |
| 121 | + width: 32px; |
| 122 | + height: 32px; |
| 123 | + cursor: pointer; |
| 124 | + background: transparent url(images/prev-horizontal.png) no-repeat 0 0; |
| 125 | + background-size:7px 11px; |
115 | 126 | } |
116 | 127 | |
117 | 128 | .jcarousel-skin-smw .jcarousel-direction-rtl .jcarousel-prev-horizontal { |
118 | | - left: auto; |
119 | | - right: 5px; |
120 | | - background-image: url(images/prev-horizontal.png); |
| 129 | + left: auto; |
| 130 | + right: -1px; |
| 131 | + background-image: url(images/prev-horizontal.png); |
121 | 132 | } |
122 | 133 | |
123 | 134 | .jcarousel-skin-smw .jcarousel-prev-horizontal:hover, |
124 | 135 | .jcarousel-skin-smw .jcarousel-prev-horizontal:focus { |
125 | | - background-position: -32px 0; |
| 136 | + background-position: -32px 0; |
126 | 137 | } |
127 | 138 | |
128 | 139 | .jcarousel-skin-smw .jcarousel-prev-horizontal:active { |
129 | | - background-position: -64px 0; |
| 140 | + background-position: -64px 0; |
130 | 141 | } |
131 | 142 | |
132 | 143 | .jcarousel-skin-smw .jcarousel-prev-disabled-horizontal, |
133 | 144 | .jcarousel-skin-smw .jcarousel-prev-disabled-horizontal:hover, |
134 | 145 | .jcarousel-skin-smw .jcarousel-prev-disabled-horizontal:focus, |
135 | 146 | .jcarousel-skin-smw .jcarousel-prev-disabled-horizontal:active { |
136 | | - cursor: default; |
137 | | - background-position: -96px 0; |
| 147 | + cursor: default; |
| 148 | + background-position: -96px 0; |
138 | 149 | } |
139 | 150 | |
140 | | -.jcarousel-skin-smw .jcarousel-next-horizontal, .jcarousel-skin-smw .jcarousel-prev-horizontal { |
141 | | - background-color: whiteSmoke; |
142 | | - background-position: center; |
143 | | - background-repeat: no-repeat; |
144 | | - border: 1px solid gainsboro; |
145 | | - color: #7B7B7B; |
146 | | - cursor: pointer; |
147 | | - font-size: 24px; |
148 | | - font-weight: bold; |
149 | | - height: 100%; |
150 | | - line-height: 216px; |
151 | | - text-align: center; |
152 | | - text-decoration: none; |
153 | | - position: absolute; |
154 | | - width: 23px; |
155 | | - |
156 | | - border-radius: 2px 0 0 2px; |
157 | | - -moz-border-radius: 2px 0 0 2px; |
158 | | - -webkit-border-radius: 2px 0 0 2px; |
159 | | - |
| 151 | +.jcarousel-skin-smw .jcarousel-next-horizontal, |
| 152 | +.jcarousel-skin-smw .jcarousel-prev-horizontal { |
| 153 | + background-color: whiteSmoke; |
| 154 | + background-position: center; |
| 155 | + background-repeat: no-repeat; |
| 156 | + border: 1px solid gainsboro; |
| 157 | + color: #7B7B7B; |
| 158 | + cursor: pointer; |
| 159 | + font-size: 24px; |
| 160 | + font-weight: bold; |
| 161 | + height: 100%; |
| 162 | + line-height: 216px; |
| 163 | + text-align: center; |
| 164 | + text-decoration: none; |
| 165 | + position: absolute; |
| 166 | + width: 23px; |
| 167 | + border-radius: 2px 0 0 2px; |
| 168 | + -moz-border-radius: 2px 0 0 2px; |
| 169 | + -webkit-border-radius: 2px 0 0 2px; |
160 | 170 | } |
161 | 171 | |
162 | | -.jcarousel-skin-smw .jcarousel-next-horizontal:hover, .jcarousel-skin-smw .jcarousel-prev-horizontal:hover { |
163 | | - background-color: #F8F8F8; |
164 | | - border-color: #D6D6D6; |
165 | | - box-shadow:inset 0 0 1px rgba(0, 0, 0, 0.1); |
166 | | - color: #4B4B4B; |
167 | | - text-decoration: none; |
| 172 | +.jcarousel-skin-smw .jcarousel-next-horizontal:hover, |
| 173 | +.jcarousel-skin-smw .jcarousel-prev-horizontal:hover { |
| 174 | + background-color: #F8F8F8; |
| 175 | + border-color: #D6D6D6; |
| 176 | + box-shadow:inset 0 0 1px rgba(0, 0, 0, 0.1); |
| 177 | + color: #4B4B4B; |
| 178 | + text-decoration: none; |
168 | 179 | } |
169 | 180 | |
170 | 181 | /** |
171 | 182 | * Vertical Buttons |
172 | 183 | */ |
173 | 184 | .jcarousel-skin-smw .jcarousel-next-vertical { |
174 | | - position: absolute; |
175 | | - bottom: 5px; |
176 | | - left: 43px; |
177 | | - width: 32px; |
178 | | - height: 32px; |
179 | | - cursor: pointer; |
180 | | - background: transparent url(images/next-vertical.png) no-repeat 0 0; |
| 185 | + position: absolute; |
| 186 | + bottom: -1px; |
| 187 | + left: -1px; |
| 188 | + width: 32px; |
| 189 | + height: 32px; |
| 190 | + cursor: pointer; |
| 191 | + background: transparent url(images/next-vertical.png) no-repeat 0 0; |
| 192 | + background-size:11px 7px; |
| 193 | + |
181 | 194 | } |
182 | 195 | |
183 | 196 | .jcarousel-skin-smw .jcarousel-next-vertical:hover, |
184 | 197 | .jcarousel-skin-smw .jcarousel-next-vertical:focus { |
185 | | - background-position: 0 -32px; |
| 198 | + background-position: 0 -32px; |
186 | 199 | } |
187 | 200 | |
188 | 201 | .jcarousel-skin-smw .jcarousel-next-vertical:active { |
189 | | - background-position: 0 -64px; |
| 202 | + background-position: 0 -64px; |
190 | 203 | } |
191 | 204 | |
192 | 205 | .jcarousel-skin-smw .jcarousel-next-disabled-vertical, |
193 | 206 | .jcarousel-skin-smw .jcarousel-next-disabled-vertical:hover, |
194 | 207 | .jcarousel-skin-smw .jcarousel-next-disabled-vertical:focus, |
195 | 208 | .jcarousel-skin-smw .jcarousel-next-disabled-vertical:active { |
196 | | - cursor: default; |
197 | | - background-position: 0 -96px; |
| 209 | + cursor: default; |
| 210 | + background-position: 0 -96px; |
198 | 211 | } |
199 | 212 | |
200 | 213 | .jcarousel-skin-smw .jcarousel-prev-vertical { |
201 | | - position: absolute; |
202 | | - top: 5px; |
203 | | - left: 43px; |
204 | | - width: 32px; |
205 | | - height: 32px; |
206 | | - cursor: pointer; |
207 | | - background: transparent url(images/prev-vertical.png) no-repeat 0 0; |
| 214 | + position: absolute; |
| 215 | + top: -1px; |
| 216 | + left: -1px; |
| 217 | + width: 32px; |
| 218 | + height: 32px; |
| 219 | + cursor: pointer; |
| 220 | + background: transparent url(images/prev-vertical.png) no-repeat 0 0; |
| 221 | + background-size:11px 7px; |
208 | 222 | } |
209 | 223 | |
210 | 224 | .jcarousel-skin-smw .jcarousel-prev-vertical:hover, |
211 | 225 | .jcarousel-skin-smw .jcarousel-prev-vertical:focus { |
212 | | - background-position: 0 -32px; |
| 226 | + background-position: 0 -32px; |
213 | 227 | } |
214 | 228 | |
215 | 229 | .jcarousel-skin-smw .jcarousel-prev-vertical:active { |
216 | | - background-position: 0 -64px; |
| 230 | + background-position: 0 -64px; |
217 | 231 | } |
218 | 232 | |
219 | 233 | .jcarousel-skin-smw .jcarousel-prev-disabled-vertical, |
220 | 234 | .jcarousel-skin-smw .jcarousel-prev-disabled-vertical:hover, |
221 | 235 | .jcarousel-skin-smw .jcarousel-prev-disabled-vertical:focus, |
222 | 236 | .jcarousel-skin-smw .jcarousel-prev-disabled-vertical:active { |
223 | | - cursor: default; |
224 | | - background-position: 0 -96px; |
| 237 | + cursor: default; |
| 238 | + background-position: 0 -96px; |
225 | 239 | } |
226 | 240 | |
227 | | -.jcarousel-list .jcarousel-list-horizontal { |
228 | | - margin-left:20px; |
229 | | -} |
| 241 | +.jcarousel-skin-smw .jcarousel-next-vertical, |
| 242 | +.jcarousel-skin-smw .jcarousel-prev-vertical { |
| 243 | + background-color: whiteSmoke; |
| 244 | + background-position: center; |
| 245 | + background-repeat: no-repeat; |
| 246 | + border: 1px solid gainsboro; |
| 247 | + color: #7B7B7B; |
| 248 | + cursor: pointer; |
| 249 | + font-size: 24px; |
| 250 | + font-weight: bold; |
| 251 | + width: 100%; |
| 252 | + line-height: 216px; |
| 253 | + text-align: center; |
| 254 | + text-decoration: none; |
| 255 | + position: absolute; |
| 256 | + height: 23px; |
| 257 | + border-radius: 2px 0 0 2px; |
| 258 | + -moz-border-radius: 2px 0 0 2px; |
| 259 | + -webkit-border-radius: 2px 0 0 2px; |
| 260 | +} |
| 261 | + |
| 262 | +.jcarousel-skin-smw .jcarousel-next-vertical:hover, |
| 263 | +.jcarousel-skin-smw .jcarousel-prev-vertical:hover { |
| 264 | + background-color: #F8F8F8; |
| 265 | + border-color: #D6D6D6; |
| 266 | + box-shadow:inset 0 0 1px rgba(0, 0, 0, 0.1); |
| 267 | + color: #4B4B4B; |
| 268 | + text-decoration: none; |
| 269 | +} |
\ No newline at end of file |
Index: trunk/extensions/SemanticResultFormats/Gallery/resources/ext.srf.jcarousel.js |
— | — | @@ -11,12 +11,24 @@ |
12 | 12 | |
13 | 13 | $( document ).ready( function() { |
14 | 14 | |
| 15 | + var v_visible = parseInt($( '#carousel' ).attr( 'visible' ) ), |
| 16 | + v_scroll = parseInt($( '#carousel' ).attr( 'scroll' ) ), |
| 17 | + v_directionality = $( '#carousel' ).attr( 'directionality' ), |
| 18 | + v_orientation = $( '#carousel' ).attr( 'orientation' ), |
| 19 | + v_wrap = $( '#carousel' ).attr( 'wrap' ), |
| 20 | + v_vertical = v_orientation === 'vertical', |
| 21 | + v_rtl = v_directionality === 'rtl'; |
| 22 | + |
15 | 23 | // Display carousel only after js is loaded and ready otherwise display=none |
16 | 24 | $( '#carousel').show(); |
17 | 25 | |
18 | 26 | // Call the jcarousel plug-in |
19 | 27 | $( '#carousel' ).jcarousel( { |
20 | | - wrap: 'circular' |
| 28 | + scroll: v_scroll, // Number of items to be scrolled |
| 29 | + visible: v_visible, // calculated and set visible elements |
| 30 | + wrap: 'circular', // Whether to wrap at the first/last item (Options are "first", "last", "both" or "circular") |
| 31 | + vertical: v_vertical, // Whether the carousel appears in horizontal or vertical orientation |
| 32 | + rtl: v_rtl // Directionality |
21 | 33 | } ); |
22 | 34 | |
23 | 35 | } ); |