Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/SemanticFormsInputs.i18n.php |
— | — | @@ -0,0 +1,490 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Language file for Semantic Forms Inputs |
| 5 | + */ |
| 6 | + |
| 7 | +$messages = array(); |
| 8 | + |
| 9 | +$messages['en'] = array( |
| 10 | + 'semanticformsinputs-desc' => 'Additional input types for [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
| 11 | + 'semanticformsinputs-wrongformat' => 'Wrong format.', |
| 12 | + 'semanticformsinputs-close' => 'Close', |
| 13 | + 'semanticformsinputs-prev' => 'Previous', |
| 14 | + 'semanticformsinputs-next' => 'Next', |
| 15 | + 'semanticformsinputs-today' => 'Today', |
| 16 | + 'semanticformsinputs-dateformatlong' => 'd MM yy', // see http://docs.jquery.com/UI/Datepicker/formatDate |
| 17 | + 'semanticformsinputs-dateformatshort' => 'dd/mm/yy', // see http://docs.jquery.com/UI/Datepicker/formatDate |
| 18 | + 'semanticformsinputs-firstdayofweek' => '0' // 0 - sunday, 1 - monday... |
| 19 | +); |
| 20 | + |
| 21 | +/** Message documentation (Message documentation) |
| 22 | + * @author EugeneZelenko |
| 23 | + * @author F.trott |
| 24 | + * @author Siebrand |
| 25 | + * @author The Evil IP address |
| 26 | + */ |
| 27 | +$messages['qqq'] = array( |
| 28 | + 'semanticformsinputs-desc' => '{{desc}}', |
| 29 | + 'semanticformsinputs-close' => '{{Identical|Close}}', |
| 30 | + 'semanticformsinputs-prev' => '{{Identical|Previous}}', |
| 31 | + 'semanticformsinputs-next' => '{{Identical|Next}}', |
| 32 | + 'semanticformsinputs-dateformatlong' => "{{doc-important|This is a machine-readable date format string!| <br>It is used by a function to format a date. It will not be read by a human user. Do not translate each letter literally! Instead insert the date format for your language using the english-based letters. See http://docs.jquery.com/UI/Datepicker/formatDate }} |
| 33 | + |
| 34 | +{{doc-important|This is an ''optional'' message. Do not translate it, if it would remain unchanged in your language. }}", |
| 35 | + 'semanticformsinputs-dateformatshort' => "{{doc-important|This is a machine-readable date format string!| <br>It is used by a function to format a date. It will not be read by a human user. Do not translate each letter literally! Instead insert the date format for your language using the english-based letters. See http://docs.jquery.com/UI/Datepicker/formatDate }} |
| 36 | + |
| 37 | +{{doc-important|This is an ''optional'' message. Do not translate it, if it would remain unchanged in your language. }}", |
| 38 | +); |
| 39 | + |
| 40 | +/** Afrikaans (Afrikaans) |
| 41 | + * @author Naudefj |
| 42 | + */ |
| 43 | +$messages['af'] = array( |
| 44 | + 'semanticformsinputs-desc' => 'Ekstra invoertipes vir [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
| 45 | + 'semanticformsinputs-wrongformat' => 'Verkeerde formaat.', |
| 46 | + 'semanticformsinputs-close' => 'Sluit', |
| 47 | + 'semanticformsinputs-prev' => 'Vorige', |
| 48 | + 'semanticformsinputs-next' => 'Volgende', |
| 49 | + 'semanticformsinputs-today' => 'Vandag', |
| 50 | +); |
| 51 | + |
| 52 | +/** Aramaic (ܐܪܡܝܐ) |
| 53 | + * @author Basharh |
| 54 | + */ |
| 55 | +$messages['arc'] = array( |
| 56 | + 'semanticformsinputs-close' => 'ܣܟܘܪ', |
| 57 | + 'semanticformsinputs-prev' => 'ܩܕܡ', |
| 58 | + 'semanticformsinputs-next' => 'ܒܬܪ', |
| 59 | + 'semanticformsinputs-today' => 'ܝܘܡܢܐ', |
| 60 | +); |
| 61 | + |
| 62 | +/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
| 63 | + * @author EugeneZelenko |
| 64 | + * @author Jim-by |
| 65 | + */ |
| 66 | +$messages['be-tarask'] = array( |
| 67 | + 'semanticformsinputs-desc' => 'Дадатковыя тыпы ўводу для [http://www.mediawiki.org/wiki/Extension:Semantic_Forms сэмантычных формаў]', |
| 68 | + 'semanticformsinputs-wrongformat' => 'Няслушны фармат.', |
| 69 | + 'semanticformsinputs-close' => 'Закрыць', |
| 70 | + 'semanticformsinputs-prev' => 'Папярэдняе', |
| 71 | + 'semanticformsinputs-next' => 'Наступнае', |
| 72 | + 'semanticformsinputs-today' => 'Сёньня', |
| 73 | +); |
| 74 | + |
| 75 | +/** Breton (Brezhoneg) |
| 76 | + * @author Gwendal |
| 77 | + * @author Y-M D |
| 78 | + */ |
| 79 | +$messages['br'] = array( |
| 80 | + 'semanticformsinputs-desc' => 'Doareoù moned ouzhpenn evit [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
| 81 | + 'semanticformsinputs-wrongformat' => 'Furmad fall.', |
| 82 | + 'semanticformsinputs-close' => 'Serriñ', |
| 83 | + 'semanticformsinputs-prev' => 'Kent', |
| 84 | + 'semanticformsinputs-next' => "War-lerc'h", |
| 85 | + 'semanticformsinputs-today' => 'Hiziv', |
| 86 | +); |
| 87 | + |
| 88 | +/** Bosnian (Bosanski) |
| 89 | + * @author CERminator |
| 90 | + */ |
| 91 | +$messages['bs'] = array( |
| 92 | + 'semanticformsinputs-desc' => 'Dodatne vrste unosa za [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantičke forme]', |
| 93 | + 'semanticformsinputs-wrongformat' => 'Pogrešan format.', |
| 94 | + 'semanticformsinputs-close' => 'Zatvori', |
| 95 | + 'semanticformsinputs-prev' => 'Prethodno', |
| 96 | + 'semanticformsinputs-next' => 'Slijedeće', |
| 97 | + 'semanticformsinputs-today' => 'Danas', |
| 98 | +); |
| 99 | + |
| 100 | +/** Catalan (Català) |
| 101 | + * @author Toniher |
| 102 | + */ |
| 103 | +$messages['ca'] = array( |
| 104 | + 'semanticformsinputs-desc' => "Tipus d'entrada addicionals per al [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]", |
| 105 | + 'semanticformsinputs-wrongformat' => 'Format incorrecte.', |
| 106 | + 'semanticformsinputs-close' => 'Tanca', |
| 107 | + 'semanticformsinputs-prev' => 'Anterior', |
| 108 | + 'semanticformsinputs-next' => 'Següent', |
| 109 | + 'semanticformsinputs-today' => 'Avui', |
| 110 | +); |
| 111 | + |
| 112 | +/** Czech (Česky) */ |
| 113 | +$messages['cs'] = array( |
| 114 | + 'semanticformsinputs-close' => 'Zavřít', |
| 115 | + 'semanticformsinputs-prev' => 'Předchozí', |
| 116 | + 'semanticformsinputs-next' => 'Další', |
| 117 | +); |
| 118 | + |
| 119 | +/** German (Deutsch) |
| 120 | + * @author Kghbln |
| 121 | + */ |
| 122 | +$messages['de'] = array( |
| 123 | + 'semanticformsinputs-desc' => 'Ermöglicht zusätzliche Eingabearten für [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
| 124 | + 'semanticformsinputs-wrongformat' => 'Falsches Format.', |
| 125 | + 'semanticformsinputs-close' => 'Schließen', |
| 126 | + 'semanticformsinputs-prev' => 'Voriger Monat', |
| 127 | + 'semanticformsinputs-next' => 'Nächster Monat', |
| 128 | + 'semanticformsinputs-today' => 'Heute', |
| 129 | + 'semanticformsinputs-dateformatlong' => 'd. MM yy', |
| 130 | + 'semanticformsinputs-dateformatshort' => 'dd.mm.yy', |
| 131 | + 'semanticformsinputs-firstdayofweek' => '1', |
| 132 | +); |
| 133 | + |
| 134 | +/** Lower Sorbian (Dolnoserbski) |
| 135 | + * @author Michawiki |
| 136 | + */ |
| 137 | +$messages['dsb'] = array( |
| 138 | + 'semanticformsinputs-desc' => 'Pśidatne zapódawańske typy [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
| 139 | + 'semanticformsinputs-wrongformat' => 'Wopacny format', |
| 140 | + 'semanticformsinputs-close' => 'Zacyniś', |
| 141 | + 'semanticformsinputs-prev' => 'Pjerwjejšny', |
| 142 | + 'semanticformsinputs-next' => 'Pśiducy', |
| 143 | + 'semanticformsinputs-today' => 'Źinsa', |
| 144 | +); |
| 145 | + |
| 146 | +/** Spanish (Español) |
| 147 | + * @author Danke7 |
| 148 | + * @author Translationista |
| 149 | + */ |
| 150 | +$messages['es'] = array( |
| 151 | + 'semanticformsinputs-desc' => 'Tipos de entrada adicionales para [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formularios Semánticos]', |
| 152 | + 'semanticformsinputs-wrongformat' => 'Formato incorrecto.', |
| 153 | + 'semanticformsinputs-close' => 'Cerrar', |
| 154 | + 'semanticformsinputs-prev' => 'Anterior', |
| 155 | + 'semanticformsinputs-next' => 'Siguiente', |
| 156 | + 'semanticformsinputs-today' => 'Hoy', |
| 157 | +); |
| 158 | + |
| 159 | +/** French (Français) |
| 160 | + * @author F.trott |
| 161 | + * @author IAlex |
| 162 | + */ |
| 163 | +$messages['fr'] = array( |
| 164 | + 'semanticformsinputs-desc' => "Types d'entrées additionnelles pour [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formulaires sémantiques]", |
| 165 | + 'semanticformsinputs-wrongformat' => 'Format erroné.', |
| 166 | + 'semanticformsinputs-close' => 'Fermer', |
| 167 | + 'semanticformsinputs-prev' => 'Précédent', |
| 168 | + 'semanticformsinputs-next' => 'Suivant', |
| 169 | + 'semanticformsinputs-today' => "Aujourd'hui", |
| 170 | + 'semanticformsinputs-dateformatshort' => 'dd / mm / yy', |
| 171 | + 'semanticformsinputs-firstdayofweek' => '0', |
| 172 | +); |
| 173 | + |
| 174 | +/** Franco-Provençal (Arpetan) |
| 175 | + * @author ChrisPtDe |
| 176 | + */ |
| 177 | +$messages['frp'] = array( |
| 178 | + 'semanticformsinputs-wrongformat' => 'Crouyo format.', |
| 179 | +); |
| 180 | + |
| 181 | +/** Galician (Galego) |
| 182 | + * @author Toliño |
| 183 | + */ |
| 184 | +$messages['gl'] = array( |
| 185 | + 'semanticformsinputs-desc' => 'Tipos de entrada adicionais para os [http://www.mediawiki.org/wiki/Extension:Semantic_Forms formularios semánticos]', |
| 186 | + 'semanticformsinputs-wrongformat' => 'Formato incorrecto.', |
| 187 | + 'semanticformsinputs-close' => 'Pechar', |
| 188 | + 'semanticformsinputs-prev' => 'Anterior', |
| 189 | + 'semanticformsinputs-next' => 'Seguinte', |
| 190 | + 'semanticformsinputs-today' => 'Hoxe', |
| 191 | +); |
| 192 | + |
| 193 | +/** Swiss German (Alemannisch) |
| 194 | + * @author Als-Holder |
| 195 | + */ |
| 196 | +$messages['gsw'] = array( |
| 197 | + 'semanticformsinputs-desc' => 'Mecht zuesätzligi Arte vu Yygabe megli fir [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
| 198 | + 'semanticformsinputs-wrongformat' => 'Falsch Format.', |
| 199 | + 'semanticformsinputs-close' => 'Zuemache', |
| 200 | + 'semanticformsinputs-prev' => 'Vorigi', |
| 201 | + 'semanticformsinputs-next' => 'Negschti', |
| 202 | + 'semanticformsinputs-today' => 'Hit', |
| 203 | +); |
| 204 | + |
| 205 | +/** Hebrew (עברית) |
| 206 | + * @author YaronSh |
| 207 | + */ |
| 208 | +$messages['he'] = array( |
| 209 | + 'semanticformsinputs-desc' => 'סוגי קלט נוספים עבור [http://www.mediawiki.org/wiki/Extension:Semantic_Forms טפסים סמנטיים]', |
| 210 | + 'semanticformsinputs-wrongformat' => 'מבנה שגוי.', |
| 211 | + 'semanticformsinputs-close' => 'סגירה', |
| 212 | + 'semanticformsinputs-prev' => 'הקודם', |
| 213 | + 'semanticformsinputs-next' => 'הבא', |
| 214 | + 'semanticformsinputs-today' => 'היום', |
| 215 | +); |
| 216 | + |
| 217 | +/** Upper Sorbian (Hornjoserbsce) |
| 218 | + * @author Michawiki |
| 219 | + */ |
| 220 | +$messages['hsb'] = array( |
| 221 | + 'semanticformsinputs-desc' => 'Přidatne zapodawanske typy za [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
| 222 | + 'semanticformsinputs-wrongformat' => 'Wopačny format', |
| 223 | + 'semanticformsinputs-close' => 'Začinić', |
| 224 | + 'semanticformsinputs-prev' => 'Předchadny', |
| 225 | + 'semanticformsinputs-next' => 'Přichodny', |
| 226 | + 'semanticformsinputs-today' => 'Dźensa', |
| 227 | +); |
| 228 | + |
| 229 | +/** Hungarian (Magyar) |
| 230 | + * @author Dani |
| 231 | + */ |
| 232 | +$messages['hu'] = array( |
| 233 | + 'semanticformsinputs-wrongformat' => 'Hibás formátum.', |
| 234 | + 'semanticformsinputs-close' => 'Bezárás', |
| 235 | + 'semanticformsinputs-prev' => 'Előző', |
| 236 | + 'semanticformsinputs-next' => 'Következő', |
| 237 | + 'semanticformsinputs-today' => 'Ma', |
| 238 | +); |
| 239 | + |
| 240 | +/** Interlingua (Interlingua) |
| 241 | + * @author McDutchie |
| 242 | + */ |
| 243 | +$messages['ia'] = array( |
| 244 | + 'semanticformsinputs-desc' => 'Additional typos de entrata pro [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formularios Semantic]', |
| 245 | + 'semanticformsinputs-wrongformat' => 'Formato incorrecte.', |
| 246 | + 'semanticformsinputs-close' => 'Clauder', |
| 247 | + 'semanticformsinputs-prev' => 'Precedente', |
| 248 | + 'semanticformsinputs-next' => 'Sequente', |
| 249 | + 'semanticformsinputs-today' => 'Hodie', |
| 250 | +); |
| 251 | + |
| 252 | +/** Indonesian (Bahasa Indonesia) |
| 253 | + * @author Farras |
| 254 | + * @author IvanLanin |
| 255 | + */ |
| 256 | +$messages['id'] = array( |
| 257 | + 'semanticformsinputs-desc' => 'Jenis masukan tambahan untuk [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
| 258 | + 'semanticformsinputs-wrongformat' => 'Format salah.', |
| 259 | + 'semanticformsinputs-close' => 'Penutup', |
| 260 | + 'semanticformsinputs-prev' => 'Sebelumnya', |
| 261 | + 'semanticformsinputs-next' => 'Selanjutnya', |
| 262 | + 'semanticformsinputs-today' => 'Hari ini', |
| 263 | +); |
| 264 | + |
| 265 | +/** Japanese (日本語) |
| 266 | + * @author Yanajin66 |
| 267 | + * @author 青子守歌 |
| 268 | + */ |
| 269 | +$messages['ja'] = array( |
| 270 | + 'semanticformsinputs-desc' => ' [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]のための追加の入力タイプ', |
| 271 | + 'semanticformsinputs-wrongformat' => '間違った形式です。', |
| 272 | + 'semanticformsinputs-close' => '閉じる', |
| 273 | + 'semanticformsinputs-prev' => '前へ', |
| 274 | + 'semanticformsinputs-next' => '次へ', |
| 275 | + 'semanticformsinputs-today' => '今日', |
| 276 | +); |
| 277 | + |
| 278 | +/** Khmer (ភាសាខ្មែរ) |
| 279 | + * @author គីមស៊្រុន |
| 280 | + */ |
| 281 | +$messages['km'] = array( |
| 282 | + 'semanticformsinputs-close' => 'បិទ', |
| 283 | + 'semanticformsinputs-prev' => 'មុន', |
| 284 | + 'semanticformsinputs-next' => 'ក្រោយ', |
| 285 | + 'semanticformsinputs-today' => 'ថ្ងៃនេះ', |
| 286 | +); |
| 287 | + |
| 288 | +/** Kurdish (Latin) (Kurdî (Latin)) |
| 289 | + * @author George Animal |
| 290 | + */ |
| 291 | +$messages['ku-latn'] = array( |
| 292 | + 'semanticformsinputs-today' => 'Îro', |
| 293 | +); |
| 294 | + |
| 295 | +/** Luxembourgish (Lëtzebuergesch) |
| 296 | + * @author Robby |
| 297 | + */ |
| 298 | +$messages['lb'] = array( |
| 299 | + 'semanticformsinputs-desc' => "Zousätzlech Manéieren fir d'Eraginn fir [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Formulairen]", |
| 300 | + 'semanticformsinputs-wrongformat' => 'Falsche Format.', |
| 301 | + 'semanticformsinputs-close' => 'Zoumaachen', |
| 302 | + 'semanticformsinputs-prev' => 'Vireg', |
| 303 | + 'semanticformsinputs-next' => 'Nächst', |
| 304 | + 'semanticformsinputs-today' => 'Haut', |
| 305 | +); |
| 306 | + |
| 307 | +/** Macedonian (Македонски) |
| 308 | + * @author Bjankuloski06 |
| 309 | + * @author F.trott |
| 310 | + */ |
| 311 | +$messages['mk'] = array( |
| 312 | + 'semanticformsinputs-desc' => 'Дополнителни типови на внос за [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Семантички обрасци]', |
| 313 | + 'semanticformsinputs-wrongformat' => 'Погрешен формат.', |
| 314 | + 'semanticformsinputs-close' => 'Затвори', |
| 315 | + 'semanticformsinputs-prev' => 'Претходно', |
| 316 | + 'semanticformsinputs-next' => 'Следно', |
| 317 | + 'semanticformsinputs-today' => 'Денес', |
| 318 | + 'semanticformsinputs-dateformatlong' => 'd MM yy', |
| 319 | + 'semanticformsinputs-dateformatshort' => 'dd/mm/yy', |
| 320 | +); |
| 321 | + |
| 322 | +/** Malayalam (മലയാളം) |
| 323 | + * @author Praveenp |
| 324 | + */ |
| 325 | +$messages['ml'] = array( |
| 326 | + 'semanticformsinputs-close' => 'അടയ്ക്കുക', |
| 327 | + 'semanticformsinputs-prev' => 'മുൻപത്തേത്', |
| 328 | + 'semanticformsinputs-next' => 'അടുത്തത്', |
| 329 | + 'semanticformsinputs-today' => 'ഇന്ന്', |
| 330 | +); |
| 331 | + |
| 332 | +/** Dutch (Nederlands) |
| 333 | + * @author Siebrand |
| 334 | + */ |
| 335 | +$messages['nl'] = array( |
| 336 | + 'semanticformsinputs-desc' => 'Extra invoertypen voor [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
| 337 | + 'semanticformsinputs-wrongformat' => 'Onjuiste opmaak.', |
| 338 | + 'semanticformsinputs-close' => 'Sluiten', |
| 339 | + 'semanticformsinputs-prev' => 'Vorige', |
| 340 | + 'semanticformsinputs-next' => 'Volgende', |
| 341 | + 'semanticformsinputs-today' => 'Vandaag', |
| 342 | +); |
| 343 | + |
| 344 | +/** Norwegian (bokmål) (Norsk (bokmål)) |
| 345 | + * @author Nghtwlkr |
| 346 | + */ |
| 347 | +$messages['no'] = array( |
| 348 | + 'semanticformsinputs-desc' => 'Ekstra inndatatyper for [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
| 349 | + 'semanticformsinputs-wrongformat' => 'Feil format.', |
| 350 | + 'semanticformsinputs-close' => 'Lukk', |
| 351 | + 'semanticformsinputs-prev' => 'Forrige', |
| 352 | + 'semanticformsinputs-next' => 'Neste', |
| 353 | + 'semanticformsinputs-today' => 'I dag', |
| 354 | +); |
| 355 | + |
| 356 | +/** Deitsch (Deitsch) |
| 357 | + * @author Xqt |
| 358 | + */ |
| 359 | +$messages['pdc'] = array( |
| 360 | + 'semanticformsinputs-next' => 'Neegschte', |
| 361 | +); |
| 362 | + |
| 363 | +/** Pälzisch (Pälzisch) |
| 364 | + * @author Xqt |
| 365 | + */ |
| 366 | +$messages['pfl'] = array( |
| 367 | + 'semanticformsinputs-prev' => 'Voriche', |
| 368 | + 'semanticformsinputs-next' => 'Negschte', |
| 369 | +); |
| 370 | + |
| 371 | +/** Polish (Polski) |
| 372 | + * @author Sp5uhe |
| 373 | + */ |
| 374 | +$messages['pl'] = array( |
| 375 | + 'semanticformsinputs-desc' => 'Dodatkowe typy wejściowe dla [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formularzy Semantycznych]', |
| 376 | + 'semanticformsinputs-wrongformat' => 'Niewłaściwy format.', |
| 377 | + 'semanticformsinputs-close' => 'Zamknij', |
| 378 | + 'semanticformsinputs-prev' => 'Poprzednie', |
| 379 | + 'semanticformsinputs-next' => 'Następne', |
| 380 | + 'semanticformsinputs-today' => 'Dziś', |
| 381 | +); |
| 382 | + |
| 383 | +/** Piedmontese (Piemontèis) |
| 384 | + * @author Borichèt |
| 385 | + * @author Dragonòt |
| 386 | + */ |
| 387 | +$messages['pms'] = array( |
| 388 | + 'semanticformsinputs-desc' => "Sòrt d'intrade adissionaj për [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formolari Semàntich]", |
| 389 | + 'semanticformsinputs-wrongformat' => 'Formà pa bon.', |
| 390 | + 'semanticformsinputs-close' => 'Sara', |
| 391 | + 'semanticformsinputs-prev' => 'Prima', |
| 392 | + 'semanticformsinputs-next' => 'Apress', |
| 393 | + 'semanticformsinputs-today' => 'Ancheuj', |
| 394 | +); |
| 395 | + |
| 396 | +/** Portuguese (Português) |
| 397 | + * @author Hamilton Abreu |
| 398 | + */ |
| 399 | +$messages['pt'] = array( |
| 400 | + 'semanticformsinputs-desc' => 'Tipos de entrada adicionais para [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formulários Semânticos]', |
| 401 | + 'semanticformsinputs-wrongformat' => 'Formato incorrecto.', |
| 402 | + 'semanticformsinputs-close' => 'Fechar', |
| 403 | + 'semanticformsinputs-prev' => 'Anterior', |
| 404 | + 'semanticformsinputs-next' => 'Seguinte', |
| 405 | + 'semanticformsinputs-today' => 'Hoje', |
| 406 | +); |
| 407 | + |
| 408 | +/** Brazilian Portuguese (Português do Brasil) |
| 409 | + * @author Giro720 |
| 410 | + */ |
| 411 | +$messages['pt-br'] = array( |
| 412 | + 'semanticformsinputs-desc' => 'Tipos de entrada adicionais para [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formulários Semânticos]', |
| 413 | + 'semanticformsinputs-wrongformat' => 'Formato incorreto.', |
| 414 | + 'semanticformsinputs-close' => 'Fechar', |
| 415 | + 'semanticformsinputs-prev' => 'Anterior', |
| 416 | + 'semanticformsinputs-next' => 'Seguinte', |
| 417 | + 'semanticformsinputs-today' => 'Hoje', |
| 418 | +); |
| 419 | + |
| 420 | +/** Tarandíne (Tarandíne) |
| 421 | + * @author Joetaras |
| 422 | + */ |
| 423 | +$messages['roa-tara'] = array( |
| 424 | + 'semanticformsinputs-desc' => 'Tipe de input aggiundive pe le [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Module Semandece]', |
| 425 | + 'semanticformsinputs-wrongformat' => 'Formate sbagliate', |
| 426 | +); |
| 427 | + |
| 428 | +/** Russian (Русский) |
| 429 | + * @author MaxSem |
| 430 | + * @author Александр Сигачёв |
| 431 | + * @author Сrower |
| 432 | + */ |
| 433 | +$messages['ru'] = array( |
| 434 | + 'semanticformsinputs-desc' => 'Дополнительные входящие типы для [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Семантических Форм]', |
| 435 | + 'semanticformsinputs-wrongformat' => 'Неверный формат.', |
| 436 | + 'semanticformsinputs-close' => 'Закрыть', |
| 437 | + 'semanticformsinputs-prev' => 'Предыдущая', |
| 438 | + 'semanticformsinputs-next' => 'Следующая', |
| 439 | + 'semanticformsinputs-today' => 'Сегодня', |
| 440 | +); |
| 441 | + |
| 442 | +/** Telugu (తెలుగు) |
| 443 | + * @author Veeven |
| 444 | + */ |
| 445 | +$messages['te'] = array( |
| 446 | + 'semanticformsinputs-close' => 'మూసివేయి', |
| 447 | + 'semanticformsinputs-prev' => 'గత', |
| 448 | + 'semanticformsinputs-next' => 'తదుపరి', |
| 449 | + 'semanticformsinputs-today' => 'ఈరోజు', |
| 450 | +); |
| 451 | + |
| 452 | +/** Tagalog (Tagalog) |
| 453 | + * @author AnakngAraw |
| 454 | + */ |
| 455 | +$messages['tl'] = array( |
| 456 | + 'semanticformsinputs-desc' => 'Karagdagang mga tipo ng pagpasok para sa [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Anyong Semantiko]', |
| 457 | + 'semanticformsinputs-wrongformat' => 'Maling anyo.', |
| 458 | + 'semanticformsinputs-close' => 'Isara', |
| 459 | + 'semanticformsinputs-prev' => 'Nakaraan', |
| 460 | + 'semanticformsinputs-next' => 'Susunod', |
| 461 | + 'semanticformsinputs-today' => 'Ngayon', |
| 462 | +); |
| 463 | + |
| 464 | +/** Ukrainian (Українська) |
| 465 | + * @author Тест |
| 466 | + */ |
| 467 | +$messages['uk'] = array( |
| 468 | + 'semanticformsinputs-close' => 'Закрити', |
| 469 | + 'semanticformsinputs-prev' => 'Попередня', |
| 470 | + 'semanticformsinputs-next' => 'Наступна', |
| 471 | +); |
| 472 | + |
| 473 | +/** Simplified Chinese (中文(简体)) */ |
| 474 | +$messages['zh-hans'] = array( |
| 475 | + 'semanticformsinputs-close' => '关闭', |
| 476 | + 'semanticformsinputs-prev' => '向前', |
| 477 | + 'semanticformsinputs-next' => '下一个', |
| 478 | + 'semanticformsinputs-today' => '今天', |
| 479 | +); |
| 480 | + |
| 481 | +/** Traditional Chinese (中文(繁體)) |
| 482 | + * @author Mark85296341 |
| 483 | + */ |
| 484 | +$messages['zh-hant'] = array( |
| 485 | + 'semanticformsinputs-wrongformat' => '格式不正確。', |
| 486 | + 'semanticformsinputs-close' => '關閉', |
| 487 | + 'semanticformsinputs-prev' => '上一個', |
| 488 | + 'semanticformsinputs-next' => '下一個', |
| 489 | + 'semanticformsinputs-today' => '今天', |
| 490 | +); |
| 491 | + |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/SemanticFormsInputs.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 492 | + native |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/SemanticFormsInputs.php |
— | — | @@ -0,0 +1,82 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Additional input types for [http://www.mediawiki.org/wiki/Extension:SemanticForms Semantic Forms]. |
| 5 | + * |
| 6 | + * @author Stephan Gambke |
| 7 | + * @author Sanyam Goyal |
| 8 | + * @version 0.4.1 |
| 9 | + */ |
| 10 | + |
| 11 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 12 | + die( 'This file is a MediaWiki extension, it is not a valid entry point.' ); |
| 13 | +} |
| 14 | + |
| 15 | +if ( !defined( 'SF_VERSION' ) ) { |
| 16 | + die( 'This is a Semantic Forms extension. You need to install Semantic Forms first.' ); |
| 17 | +} |
| 18 | + |
| 19 | +define( 'SFI_VERSION', '0.4.1' ); |
| 20 | + |
| 21 | +// create and initialize settings |
| 22 | +$sfigSettings = new SFISettings(); |
| 23 | + |
| 24 | +// register extension |
| 25 | +$wgExtensionCredits[defined( 'SEMANTIC_EXTENSION_TYPE' ) ? 'semantic' : 'other'][] = array( |
| 26 | + 'path' => __FILE__, |
| 27 | + 'name' => 'Semantic Forms Inputs', |
| 28 | + 'author' => array( '[http://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]', 'Sanyam Goyal', 'Yaron Koren' ), |
| 29 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Semantic_Forms_Inputs', |
| 30 | + 'descriptionmsg' => 'semanticformsinputs-desc', |
| 31 | + 'version' => SFI_VERSION, |
| 32 | +); |
| 33 | + |
| 34 | +$dir = dirname( __FILE__ ); |
| 35 | + |
| 36 | +// load user settings |
| 37 | +require_once( $dir . '/SFI_Settings.php' ); |
| 38 | + |
| 39 | +$wgExtensionMessagesFiles['SemanticFormsInputs'] = $dir . '/SemanticFormsInputs.i18n.php'; |
| 40 | +$wgExtensionFunctions[] = "wfSFISetup"; |
| 41 | +$wgAutoloadClasses['SFIInputs'] = $dir . '/SFI_Inputs.php'; |
| 42 | + |
| 43 | +/* |
| 44 | + * Class to encapsulate all settings |
| 45 | + */ |
| 46 | +class SFISettings { |
| 47 | + // general settings |
| 48 | + public $scriptPath; |
| 49 | + //public $yuiBase; |
| 50 | + |
| 51 | + // settings for input type datepicker |
| 52 | + public $datePickerFirstDate; |
| 53 | + public $datePickerLastDate; |
| 54 | + public $datePickerDateFormat; |
| 55 | + public $datePickerWeekStart; |
| 56 | + public $datePickerShowWeekNumbers; |
| 57 | + public $datePickerDisableInputField; |
| 58 | + public $datePickerShowResetButton; |
| 59 | + public $datePickerDisabledDaysOfWeek; |
| 60 | + public $datePickerHighlightedDaysOfWeek; |
| 61 | + public $datePickerDisabledDates; |
| 62 | + public $datePickerHighlightedDates; |
| 63 | + public $datePickerMonthNames; |
| 64 | + public $datePickerDayNames; |
| 65 | +} |
| 66 | + |
| 67 | +/* |
| 68 | + * Registers the input types with Semantic Forms. |
| 69 | + */ |
| 70 | +function wfSFISetup() { |
| 71 | + global $sfgFormPrinter, $wgOut; |
| 72 | + |
| 73 | + $sfgFormPrinter->setInputTypeHook( 'regexp', array( 'SFIInputs', 'regexpHTML' ), array() ); |
| 74 | + $sfgFormPrinter->setInputTypeHook( 'datepicker', array( 'SFIInputs', 'jqDatePickerHTML' ), array() ); |
| 75 | + $sfgFormPrinter->setInputTypeHook( 'simpledatepicker', array( 'SFIInputs', 'jqDatePickerHTML' ), array() ); |
| 76 | + $sfgFormPrinter->setInputTypeHook( 'timepicker', array( 'SFIInputs', 'timepickerHTML' ), array() ); |
| 77 | + $sfgFormPrinter->setInputTypeHook( 'datetimepicker', array( 'SFIInputs', 'datetimepickerHTML' ), array() ); |
| 78 | +// $sfgFormPrinter->setInputTypeHook( 'wysiwyg', array( 'SFIInputs', 'wysiwygHTML' ), array() ); |
| 79 | + $sfgFormPrinter->setInputTypeHook( 'menuselect', array( 'SFIInputs', 'menuselectHTML' ), array() ); |
| 80 | + |
| 81 | + // TODO: obsolete as of MW 1.16, remove around 1.18 or so |
| 82 | + wfLoadExtensionMessages( 'SemanticFormsInputs' ); |
| 83 | +} |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/SemanticFormsInputs.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 84 | + native |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/TimePickerResetButton.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/TimePickerResetButton.gif |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 85 | + image/gif |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/DatePickerButtonDisabled.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/DatePickerButtonDisabled.gif |
___________________________________________________________________ |
Added: svn:mime-type |
3 | 86 | + image/gif |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/MenuSelectArrow.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/MenuSelectArrow.gif |
___________________________________________________________________ |
Added: svn:mime-type |
4 | 87 | + image/gif |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/TimePickerButtonDisabled.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/TimePickerButtonDisabled.gif |
___________________________________________________________________ |
Added: svn:mime-type |
5 | 88 | + image/gif |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/DateTimePickerResetButtonDisabled.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/DateTimePickerResetButtonDisabled.gif |
___________________________________________________________________ |
Added: svn:mime-type |
6 | 89 | + image/gif |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/DatePickerResetButtonDisabled.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/DatePickerResetButtonDisabled.gif |
___________________________________________________________________ |
Added: svn:mime-type |
7 | 90 | + image/gif |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/TimePickerResetButtonDisabled.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/TimePickerResetButtonDisabled.gif |
___________________________________________________________________ |
Added: svn:mime-type |
8 | 91 | + image/gif |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/DatePickerButton.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/DatePickerButton.gif |
___________________________________________________________________ |
Added: svn:mime-type |
9 | 92 | + image/gif |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/TimePickerButton.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/TimePickerButton.gif |
___________________________________________________________________ |
Added: svn:mime-type |
10 | 93 | + image/gif |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/DateTimePickerResetButton.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/DateTimePickerResetButton.gif |
___________________________________________________________________ |
Added: svn:mime-type |
11 | 94 | + image/gif |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/DatePickerResetButton.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/images/DatePickerResetButton.gif |
___________________________________________________________________ |
Added: svn:mime-type |
12 | 95 | + image/gif |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/SFI_Settings.php |
— | — | @@ -0,0 +1,155 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Settings for the Semantic Forms Inputs extension. |
| 5 | + * |
| 6 | + * @author Stephan Gambke |
| 7 | + * |
| 8 | + * To change the default settings you can uncomment (or copy) the |
| 9 | + * examples here and adjust them to your needs. You may as well |
| 10 | + * include them in your LocalSettings.php. |
| 11 | + */ |
| 12 | + |
| 13 | +## |
| 14 | +# This is the path to your installation of Semantic Forms Inputs as |
| 15 | +# seen from the web. No final slash. |
| 16 | +# |
| 17 | +$sfigSettings->scriptPath = $wgScriptPath . '/extensions/SemanticFormsInputs'; |
| 18 | + |
| 19 | +## Date Picker Settings |
| 20 | + |
| 21 | +## |
| 22 | +# This is the first selectable date (format yyyy/mm/dd) |
| 23 | +# Sample value: '2005/01/01' |
| 24 | +# |
| 25 | +$sfigSettings->datePickerFirstDate = null; |
| 26 | + |
| 27 | +## |
| 28 | +# This is the last selectable date (format yyyy/mm/dd) |
| 29 | +# Sample value: '2015/31/12' |
| 30 | +# |
| 31 | +$sfigSettings->datePickerLastDate = null; |
| 32 | + |
| 33 | +## |
| 34 | +# The date format string used for the user input. |
| 35 | +# The date sent back to the form is fixed to yyyy/mm/dd |
| 36 | +# (that is, yy/mm/dd in the format code below). |
| 37 | +# |
| 38 | +# The format can be combinations of the following: |
| 39 | +# |
| 40 | +# d - day of month (no leading zero) |
| 41 | +# dd - day of month (two digit) |
| 42 | +# o - day of the year (no leading zeros) |
| 43 | +# oo - day of the year (three digit) |
| 44 | +# D - day name short |
| 45 | +# DD - day name long |
| 46 | +# m - month of year (no leading zero) |
| 47 | +# mm - month of year (two digit) |
| 48 | +# M - month name short |
| 49 | +# MM - month name long |
| 50 | +# y - year (two digit) |
| 51 | +# yy - year (four digit) |
| 52 | +# @ - Unix timestamp (ms since 01/01/1970) |
| 53 | +# ! - Windows ticks (100ns since 01/01/0001) |
| 54 | +# '...' - literal text |
| 55 | +# '' - single quote |
| 56 | +# anything else - literal text |
| 57 | +# |
| 58 | +# There are also two predefined standard date formats available: |
| 59 | +# |
| 60 | +# SHORT - short date format localized to the wiki user language |
| 61 | +# LONG - long date format localized to the wiki user language |
| 62 | +# |
| 63 | +$sfigSettings->datePickerDateFormat = 'SHORT'; |
| 64 | + |
| 65 | +## |
| 66 | +# This determines the start of the week in the display. |
| 67 | +# Set it to: 0 (Zero) for Sunday, 1 (One) for Monday etc. |
| 68 | +# If set to null the day is localized to the wiki user language |
| 69 | +# Sample value: 1 |
| 70 | +# |
| 71 | +$sfigSettings->datePickerWeekStart = null; |
| 72 | + |
| 73 | +## |
| 74 | +# This determines if the number of the week shall be shown. |
| 75 | +# |
| 76 | +$sfigSettings->datePickerShowWeekNumbers = false; |
| 77 | + |
| 78 | +## |
| 79 | +# This determines if the input field shall be disabled. The user can |
| 80 | +# only set the date via the datepicker in this case. |
| 81 | +# |
| 82 | +$sfigSettings->datePickerDisableInputField = false; |
| 83 | + |
| 84 | +## |
| 85 | +# This determines if a reset button shall be shown. This is the only |
| 86 | +# way to erase the input field if it is disabled for direct input. |
| 87 | +# |
| 88 | +$sfigSettings->datePickerShowResetButton = false; |
| 89 | + |
| 90 | +## |
| 91 | +# This is a string of disabled days of the week, i.e. days the user can not |
| 92 | +# pick. The days must be given as comma-separated list of numbers starting |
| 93 | +# with 0 for Sunday. |
| 94 | +# Sample value: "6,0" |
| 95 | +# |
| 96 | +$sfigSettings->datePickerDisabledDaysOfWeek = null; |
| 97 | + |
| 98 | +## |
| 99 | +# This is a string of highlighted days of the week. The days must be given as |
| 100 | +# comma-separated list of numbers starting with 0 for Sunday. |
| 101 | +# Sample value: "6,0" |
| 102 | +# |
| 103 | +$sfigSettings->datePickerHighlightedDaysOfWeek = null; |
| 104 | + |
| 105 | +## |
| 106 | +# This is a string of disabled dates, i.e. days the user cannot pick. The |
| 107 | +# days must be given as comma-separated list of dates or date ranges. The |
| 108 | +# format for days is yyyy/mm/dd, for date ranges use yyyy/mm/dd-yyyy/mm/dd. |
| 109 | +# Spaces are permissible. |
| 110 | +# Sample value: "2010/12/25 - 2011/01/06, 2011/05/01" |
| 111 | +# |
| 112 | +$sfigSettings->datePickerDisabledDates = null; |
| 113 | + |
| 114 | +## |
| 115 | +# This is a string of highlighted dates. The days must be given as |
| 116 | +# comma-separated list of dates or date ranges. The format for days is |
| 117 | +# yyyy/mm/dd, for date ranges use yyyy/mm/dd-yyyy/mm/dd. Spaces are |
| 118 | +# permissible. |
| 119 | +# Sample value: "2010/12/25 - 2011/01/06, 2011/05/01" |
| 120 | +# |
| 121 | +$sfigSettings->datePickerHighlightedDates = null; |
| 122 | + |
| 123 | + |
| 124 | +## Time Picker Settings |
| 125 | + |
| 126 | +## |
| 127 | +# This is the first selectable time (format hh:mm) |
| 128 | +# Sample value: '00:00' |
| 129 | +# |
| 130 | +$sfigSettings->timePickerMinTime = null; |
| 131 | + |
| 132 | +## |
| 133 | +# This is the last selectable time (format hh:mm) |
| 134 | +# Sample value: '24:00' |
| 135 | +# |
| 136 | +$sfigSettings->timePickerMaxTime = null; |
| 137 | + |
| 138 | +## |
| 139 | +# This determines if the input field shall be disabled. The user can |
| 140 | +# only set the time via the timepicker in this case. |
| 141 | +# |
| 142 | +$sfigSettings->timePickerDisableInputField = false; |
| 143 | + |
| 144 | +## |
| 145 | +# This determines if a reset button shall be shown. This is the only |
| 146 | +# way to erase the input field if it is disabled for direct input. |
| 147 | +# |
| 148 | +$sfigSettings->timePickerShowResetButton = false; |
| 149 | + |
| 150 | + |
| 151 | +## |
| 152 | +# This determines if a reset button shall be shown. This is the only |
| 153 | +# way to erase the input field if it is disabled for direct input. |
| 154 | +# |
| 155 | +$sfigSettings->datetimePickerShowResetButton = false; |
| 156 | + |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/SFI_Settings.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 157 | + native |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/skins/SFI_Timepicker.css |
— | — | @@ -0,0 +1,34 @@ |
| 2 | +/** |
| 3 | + * Style sheet for the input type timepicker. |
| 4 | + * |
| 5 | + * @author Stephan Gambke |
| 6 | + */ |
| 7 | + |
| 8 | +.SFI_timepicker { |
| 9 | + position: absolute; |
| 10 | + cursor: default; |
| 11 | + margin-top: 22px; |
| 12 | +} |
| 13 | + |
| 14 | +.SFI_timepicker ul { /* hours and minutes lists */ |
| 15 | + margin: 0px; |
| 16 | + padding: 0px; |
| 17 | + list-style: none; |
| 18 | + position: absolute; |
| 19 | +} |
| 20 | + |
| 21 | +.SFI_timepicker ul ul { /* minutes lists only */ |
| 22 | + margin-left: 24px; |
| 23 | + margin-right: 24px; |
| 24 | + margin-top: -22px; |
| 25 | +} |
| 26 | + |
| 27 | + |
| 28 | +.SFI_timepicker li { /* hours and minutes entries */ |
| 29 | + margin: 1px 0px; |
| 30 | + padding: 0px; |
| 31 | + text-align: center; |
| 32 | + line-height: 22px; |
| 33 | + width: 22px; |
| 34 | +} |
| 35 | + |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/skins/SFI_Timepicker.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 36 | + native |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/skins/SFI_Menuselect.css |
— | — | @@ -0,0 +1,59 @@ |
| 2 | +/** |
| 3 | + * Style sheet for the input type menuselect. |
| 4 | + * |
| 5 | + * @author Stephan Gambke |
| 6 | + */ |
| 7 | + |
| 8 | +.SFI_menuselect { |
| 9 | + visibility: hidden; /* will be shown by JS when setup is finished*/ |
| 10 | + display: block; |
| 11 | + cursor: default; |
| 12 | + position: absolute; |
| 13 | +} |
| 14 | + |
| 15 | +.SFI_menuselect a { |
| 16 | + cursor: default; |
| 17 | +} |
| 18 | + |
| 19 | +.SFI_menuselect ul { /* all lists */ |
| 20 | + margin: 0px; |
| 21 | + padding: 0px; |
| 22 | + /*margin: -20px; |
| 23 | + padding: 20px;*/ |
| 24 | + list-style: none; |
| 25 | + position: absolute; |
| 26 | + display: inline; |
| 27 | +} |
| 28 | + |
| 29 | +.SFI_menuselect ul ul { /* sub-item lists only */ |
| 30 | + margin-left: 2px; |
| 31 | + margin-right: 2px; |
| 32 | + margin-top: -2px; |
| 33 | + /*margin-left: -18px; |
| 34 | + margin-right: -18px; |
| 35 | + margin-top: -22px;*/ |
| 36 | +} |
| 37 | + |
| 38 | + |
| 39 | +.SFI_menuselect li { /* all entries */ |
| 40 | + margin: 1px 0px; |
| 41 | + padding: 0px 0px; |
| 42 | + text-align: left; |
| 43 | + /*position: static;*/ |
| 44 | + /*display:inline;*/ |
| 45 | + /*min-width: 100px;*/ |
| 46 | +} |
| 47 | + |
| 48 | +.SFI_menuselect li>span { /* all entries */ |
| 49 | + display:inline-block; |
| 50 | + width:100%; |
| 51 | +} |
| 52 | + |
| 53 | +.SFI_menuselect li>span>div.cont { |
| 54 | + padding:0px 2px; |
| 55 | +} |
| 56 | + |
| 57 | +.SFI_menuselect li>span>div.arrow { |
| 58 | + float:right; |
| 59 | +} |
| 60 | + |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/skins/SFI_Menuselect.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 61 | + native |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/COPYING |
— | — | @@ -0,0 +1,348 @@ |
| 2 | +The license text below "----" applies to all files within this distribution, other |
| 3 | +than those that are in a directory which contains files named "LICENSE" or |
| 4 | +"COPYING", or a subdirectory thereof. For those files, the license text contained in |
| 5 | +said file overrides any license information contained in directories of smaller depth. |
| 6 | +Alternative licenses are typically used for software that is provided by external |
| 7 | +parties, and merely packaged with the Semantic Forms release for convenience. |
| 8 | +---- |
| 9 | + |
| 10 | + GNU GENERAL PUBLIC LICENSE |
| 11 | + Version 2, June 1991 |
| 12 | + |
| 13 | + Copyright (C) 1989, 1991 Free Software Foundation, Inc. |
| 14 | + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 15 | + Everyone is permitted to copy and distribute verbatim copies |
| 16 | + of this license document, but changing it is not allowed. |
| 17 | + |
| 18 | + Preamble |
| 19 | + |
| 20 | + The licenses for most software are designed to take away your |
| 21 | +freedom to share and change it. By contrast, the GNU General Public |
| 22 | +License is intended to guarantee your freedom to share and change free |
| 23 | +software--to make sure the software is free for all its users. This |
| 24 | +General Public License applies to most of the Free Software |
| 25 | +Foundation's software and to any other program whose authors commit to |
| 26 | +using it. (Some other Free Software Foundation software is covered by |
| 27 | +the GNU Library General Public License instead.) You can apply it to |
| 28 | +your programs, too. |
| 29 | + |
| 30 | + When we speak of free software, we are referring to freedom, not |
| 31 | +price. Our General Public Licenses are designed to make sure that you |
| 32 | +have the freedom to distribute copies of free software (and charge for |
| 33 | +this service if you wish), that you receive source code or can get it |
| 34 | +if you want it, that you can change the software or use pieces of it |
| 35 | +in new free programs; and that you know you can do these things. |
| 36 | + |
| 37 | + To protect your rights, we need to make restrictions that forbid |
| 38 | +anyone to deny you these rights or to ask you to surrender the rights. |
| 39 | +These restrictions translate to certain responsibilities for you if you |
| 40 | +distribute copies of the software, or if you modify it. |
| 41 | + |
| 42 | + For example, if you distribute copies of such a program, whether |
| 43 | +gratis or for a fee, you must give the recipients all the rights that |
| 44 | +you have. You must make sure that they, too, receive or can get the |
| 45 | +source code. And you must show them these terms so they know their |
| 46 | +rights. |
| 47 | + |
| 48 | + We protect your rights with two steps: (1) copyright the software, and |
| 49 | +(2) offer you this license which gives you legal permission to copy, |
| 50 | +distribute and/or modify the software. |
| 51 | + |
| 52 | + Also, for each author's protection and ours, we want to make certain |
| 53 | +that everyone understands that there is no warranty for this free |
| 54 | +software. If the software is modified by someone else and passed on, we |
| 55 | +want its recipients to know that what they have is not the original, so |
| 56 | +that any problems introduced by others will not reflect on the original |
| 57 | +authors' reputations. |
| 58 | + |
| 59 | + Finally, any free program is threatened constantly by software |
| 60 | +patents. We wish to avoid the danger that redistributors of a free |
| 61 | +program will individually obtain patent licenses, in effect making the |
| 62 | +program proprietary. To prevent this, we have made it clear that any |
| 63 | +patent must be licensed for everyone's free use or not licensed at all. |
| 64 | + |
| 65 | + The precise terms and conditions for copying, distribution and |
| 66 | +modification follow. |
| 67 | + |
| 68 | + GNU GENERAL PUBLIC LICENSE |
| 69 | + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
| 70 | + |
| 71 | + 0. This License applies to any program or other work which contains |
| 72 | +a notice placed by the copyright holder saying it may be distributed |
| 73 | +under the terms of this General Public License. The "Program", below, |
| 74 | +refers to any such program or work, and a "work based on the Program" |
| 75 | +means either the Program or any derivative work under copyright law: |
| 76 | +that is to say, a work containing the Program or a portion of it, |
| 77 | +either verbatim or with modifications and/or translated into another |
| 78 | +language. (Hereinafter, translation is included without limitation in |
| 79 | +the term "modification".) Each licensee is addressed as "you". |
| 80 | + |
| 81 | +Activities other than copying, distribution and modification are not |
| 82 | +covered by this License; they are outside its scope. The act of |
| 83 | +running the Program is not restricted, and the output from the Program |
| 84 | +is covered only if its contents constitute a work based on the |
| 85 | +Program (independent of having been made by running the Program). |
| 86 | +Whether that is true depends on what the Program does. |
| 87 | + |
| 88 | + 1. You may copy and distribute verbatim copies of the Program's |
| 89 | +source code as you receive it, in any medium, provided that you |
| 90 | +conspicuously and appropriately publish on each copy an appropriate |
| 91 | +copyright notice and disclaimer of warranty; keep intact all the |
| 92 | +notices that refer to this License and to the absence of any warranty; |
| 93 | +and give any other recipients of the Program a copy of this License |
| 94 | +along with the Program. |
| 95 | + |
| 96 | +You may charge a fee for the physical act of transferring a copy, and |
| 97 | +you may at your option offer warranty protection in exchange for a fee. |
| 98 | + |
| 99 | + 2. You may modify your copy or copies of the Program or any portion |
| 100 | +of it, thus forming a work based on the Program, and copy and |
| 101 | +distribute such modifications or work under the terms of Section 1 |
| 102 | +above, provided that you also meet all of these conditions: |
| 103 | + |
| 104 | + a) You must cause the modified files to carry prominent notices |
| 105 | + stating that you changed the files and the date of any change. |
| 106 | + |
| 107 | + b) You must cause any work that you distribute or publish, that in |
| 108 | + whole or in part contains or is derived from the Program or any |
| 109 | + part thereof, to be licensed as a whole at no charge to all third |
| 110 | + parties under the terms of this License. |
| 111 | + |
| 112 | + c) If the modified program normally reads commands interactively |
| 113 | + when run, you must cause it, when started running for such |
| 114 | + interactive use in the most ordinary way, to print or display an |
| 115 | + announcement including an appropriate copyright notice and a |
| 116 | + notice that there is no warranty (or else, saying that you provide |
| 117 | + a warranty) and that users may redistribute the program under |
| 118 | + these conditions, and telling the user how to view a copy of this |
| 119 | + License. (Exception: if the Program itself is interactive but |
| 120 | + does not normally print such an announcement, your work based on |
| 121 | + the Program is not required to print an announcement.) |
| 122 | + |
| 123 | +These requirements apply to the modified work as a whole. If |
| 124 | +identifiable sections of that work are not derived from the Program, |
| 125 | +and can be reasonably considered independent and separate works in |
| 126 | +themselves, then this License, and its terms, do not apply to those |
| 127 | +sections when you distribute them as separate works. But when you |
| 128 | +distribute the same sections as part of a whole which is a work based |
| 129 | +on the Program, the distribution of the whole must be on the terms of |
| 130 | +this License, whose permissions for other licensees extend to the |
| 131 | +entire whole, and thus to each and every part regardless of who wrote it. |
| 132 | + |
| 133 | +Thus, it is not the intent of this section to claim rights or contest |
| 134 | +your rights to work written entirely by you; rather, the intent is to |
| 135 | +exercise the right to control the distribution of derivative or |
| 136 | +collective works based on the Program. |
| 137 | + |
| 138 | +In addition, mere aggregation of another work not based on the Program |
| 139 | +with the Program (or with a work based on the Program) on a volume of |
| 140 | +a storage or distribution medium does not bring the other work under |
| 141 | +the scope of this License. |
| 142 | + |
| 143 | + 3. You may copy and distribute the Program (or a work based on it, |
| 144 | +under Section 2) in object code or executable form under the terms of |
| 145 | +Sections 1 and 2 above provided that you also do one of the following: |
| 146 | + |
| 147 | + a) Accompany it with the complete corresponding machine-readable |
| 148 | + source code, which must be distributed under the terms of Sections |
| 149 | + 1 and 2 above on a medium customarily used for software interchange; or, |
| 150 | + |
| 151 | + b) Accompany it with a written offer, valid for at least three |
| 152 | + years, to give any third party, for a charge no more than your |
| 153 | + cost of physically performing source distribution, a complete |
| 154 | + machine-readable copy of the corresponding source code, to be |
| 155 | + distributed under the terms of Sections 1 and 2 above on a medium |
| 156 | + customarily used for software interchange; or, |
| 157 | + |
| 158 | + c) Accompany it with the information you received as to the offer |
| 159 | + to distribute corresponding source code. (This alternative is |
| 160 | + allowed only for noncommercial distribution and only if you |
| 161 | + received the program in object code or executable form with such |
| 162 | + an offer, in accord with Subsection b above.) |
| 163 | + |
| 164 | +The source code for a work means the preferred form of the work for |
| 165 | +making modifications to it. For an executable work, complete source |
| 166 | +code means all the source code for all modules it contains, plus any |
| 167 | +associated interface definition files, plus the scripts used to |
| 168 | +control compilation and installation of the executable. However, as a |
| 169 | +special exception, the source code distributed need not include |
| 170 | +anything that is normally distributed (in either source or binary |
| 171 | +form) with the major components (compiler, kernel, and so on) of the |
| 172 | +operating system on which the executable runs, unless that component |
| 173 | +itself accompanies the executable. |
| 174 | + |
| 175 | +If distribution of executable or object code is made by offering |
| 176 | +access to copy from a designated place, then offering equivalent |
| 177 | +access to copy the source code from the same place counts as |
| 178 | +distribution of the source code, even though third parties are not |
| 179 | +compelled to copy the source along with the object code. |
| 180 | + |
| 181 | + 4. You may not copy, modify, sublicense, or distribute the Program |
| 182 | +except as expressly provided under this License. Any attempt |
| 183 | +otherwise to copy, modify, sublicense or distribute the Program is |
| 184 | +void, and will automatically terminate your rights under this License. |
| 185 | +However, parties who have received copies, or rights, from you under |
| 186 | +this License will not have their licenses terminated so long as such |
| 187 | +parties remain in full compliance. |
| 188 | + |
| 189 | + 5. You are not required to accept this License, since you have not |
| 190 | +signed it. However, nothing else grants you permission to modify or |
| 191 | +distribute the Program or its derivative works. These actions are |
| 192 | +prohibited by law if you do not accept this License. Therefore, by |
| 193 | +modifying or distributing the Program (or any work based on the |
| 194 | +Program), you indicate your acceptance of this License to do so, and |
| 195 | +all its terms and conditions for copying, distributing or modifying |
| 196 | +the Program or works based on it. |
| 197 | + |
| 198 | + 6. Each time you redistribute the Program (or any work based on the |
| 199 | +Program), the recipient automatically receives a license from the |
| 200 | +original licensor to copy, distribute or modify the Program subject to |
| 201 | +these terms and conditions. You may not impose any further |
| 202 | +restrictions on the recipients' exercise of the rights granted herein. |
| 203 | +You are not responsible for enforcing compliance by third parties to |
| 204 | +this License. |
| 205 | + |
| 206 | + 7. If, as a consequence of a court judgment or allegation of patent |
| 207 | +infringement or for any other reason (not limited to patent issues), |
| 208 | +conditions are imposed on you (whether by court order, agreement or |
| 209 | +otherwise) that contradict the conditions of this License, they do not |
| 210 | +excuse you from the conditions of this License. If you cannot |
| 211 | +distribute so as to satisfy simultaneously your obligations under this |
| 212 | +License and any other pertinent obligations, then as a consequence you |
| 213 | +may not distribute the Program at all. For example, if a patent |
| 214 | +license would not permit royalty-free redistribution of the Program by |
| 215 | +all those who receive copies directly or indirectly through you, then |
| 216 | +the only way you could satisfy both it and this License would be to |
| 217 | +refrain entirely from distribution of the Program. |
| 218 | + |
| 219 | +If any portion of this section is held invalid or unenforceable under |
| 220 | +any particular circumstance, the balance of the section is intended to |
| 221 | +apply and the section as a whole is intended to apply in other |
| 222 | +circumstances. |
| 223 | + |
| 224 | +It is not the purpose of this section to induce you to infringe any |
| 225 | +patents or other property right claims or to contest validity of any |
| 226 | +such claims; this section has the sole purpose of protecting the |
| 227 | +integrity of the free software distribution system, which is |
| 228 | +implemented by public license practices. Many people have made |
| 229 | +generous contributions to the wide range of software distributed |
| 230 | +through that system in reliance on consistent application of that |
| 231 | +system; it is up to the author/donor to decide if he or she is willing |
| 232 | +to distribute software through any other system and a licensee cannot |
| 233 | +impose that choice. |
| 234 | + |
| 235 | +This section is intended to make thoroughly clear what is believed to |
| 236 | +be a consequence of the rest of this License. |
| 237 | + |
| 238 | + 8. If the distribution and/or use of the Program is restricted in |
| 239 | +certain countries either by patents or by copyrighted interfaces, the |
| 240 | +original copyright holder who places the Program under this License |
| 241 | +may add an explicit geographical distribution limitation excluding |
| 242 | +those countries, so that distribution is permitted only in or among |
| 243 | +countries not thus excluded. In such case, this License incorporates |
| 244 | +the limitation as if written in the body of this License. |
| 245 | + |
| 246 | + 9. The Free Software Foundation may publish revised and/or new versions |
| 247 | +of the General Public License from time to time. Such new versions will |
| 248 | +be similar in spirit to the present version, but may differ in detail to |
| 249 | +address new problems or concerns. |
| 250 | + |
| 251 | +Each version is given a distinguishing version number. If the Program |
| 252 | +specifies a version number of this License which applies to it and "any |
| 253 | +later version", you have the option of following the terms and conditions |
| 254 | +either of that version or of any later version published by the Free |
| 255 | +Software Foundation. If the Program does not specify a version number of |
| 256 | +this License, you may choose any version ever published by the Free Software |
| 257 | +Foundation. |
| 258 | + |
| 259 | + 10. If you wish to incorporate parts of the Program into other free |
| 260 | +programs whose distribution conditions are different, write to the author |
| 261 | +to ask for permission. For software which is copyrighted by the Free |
| 262 | +Software Foundation, write to the Free Software Foundation; we sometimes |
| 263 | +make exceptions for this. Our decision will be guided by the two goals |
| 264 | +of preserving the free status of all derivatives of our free software and |
| 265 | +of promoting the sharing and reuse of software generally. |
| 266 | + |
| 267 | + NO WARRANTY |
| 268 | + |
| 269 | + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
| 270 | +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
| 271 | +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
| 272 | +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
| 273 | +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 274 | +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
| 275 | +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
| 276 | +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
| 277 | +REPAIR OR CORRECTION. |
| 278 | + |
| 279 | + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
| 280 | +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
| 281 | +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
| 282 | +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
| 283 | +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
| 284 | +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
| 285 | +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
| 286 | +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
| 287 | +POSSIBILITY OF SUCH DAMAGES. |
| 288 | + |
| 289 | + END OF TERMS AND CONDITIONS |
| 290 | + |
| 291 | + How to Apply These Terms to Your New Programs |
| 292 | + |
| 293 | + If you develop a new program, and you want it to be of the greatest |
| 294 | +possible use to the public, the best way to achieve this is to make it |
| 295 | +free software which everyone can redistribute and change under these terms. |
| 296 | + |
| 297 | + To do so, attach the following notices to the program. It is safest |
| 298 | +to attach them to the start of each source file to most effectively |
| 299 | +convey the exclusion of warranty; and each file should have at least |
| 300 | +the "copyright" line and a pointer to where the full notice is found. |
| 301 | + |
| 302 | + <one line to give the program's name and a brief idea of what it does.> |
| 303 | + Copyright (C) <year> <name of author> |
| 304 | + |
| 305 | + This program is free software; you can redistribute it and/or modify |
| 306 | + it under the terms of the GNU General Public License as published by |
| 307 | + the Free Software Foundation; either version 2 of the License, or |
| 308 | + (at your option) any later version. |
| 309 | + |
| 310 | + This program is distributed in the hope that it will be useful, |
| 311 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 312 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 313 | + GNU General Public License for more details. |
| 314 | + |
| 315 | + You should have received a copy of the GNU General Public License |
| 316 | + along with this program; if not, write to the Free Software |
| 317 | + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 318 | + |
| 319 | + |
| 320 | +Also add information on how to contact you by electronic and paper mail. |
| 321 | + |
| 322 | +If the program is interactive, make it output a short notice like this |
| 323 | +when it starts in an interactive mode: |
| 324 | + |
| 325 | + Gnomovision version 69, Copyright (C) year name of author |
| 326 | + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
| 327 | + This is free software, and you are welcome to redistribute it |
| 328 | + under certain conditions; type `show c' for details. |
| 329 | + |
| 330 | +The hypothetical commands `show w' and `show c' should show the appropriate |
| 331 | +parts of the General Public License. Of course, the commands you use may |
| 332 | +be called something other than `show w' and `show c'; they could even be |
| 333 | +mouse-clicks or menu items--whatever suits your program. |
| 334 | + |
| 335 | +You should also get your employer (if you work as a programmer) or your |
| 336 | +school, if any, to sign a "copyright disclaimer" for the program, if |
| 337 | +necessary. Here is a sample; alter the names: |
| 338 | + |
| 339 | + Yoyodyne, Inc., hereby disclaims all copyright interest in the program |
| 340 | + `Gnomovision' (which makes passes at compilers) written by James Hacker. |
| 341 | + |
| 342 | + <signature of Ty Coon>, 1 April 1989 |
| 343 | + Ty Coon, President of Vice |
| 344 | + |
| 345 | +This General Public License does not permit incorporating your program into |
| 346 | +proprietary programs. If your program is a subroutine library, you may |
| 347 | +consider it more useful to permit linking proprietary applications with the |
| 348 | +library. If this is what you want to do, use the GNU Library General |
| 349 | +Public License instead of this License. |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/COPYING |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 350 | + native |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/SFI_Inputs.php |
— | — | @@ -0,0 +1,1312 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Input definitions for the Semantic Forms Inputs extension. |
| 5 | + * |
| 6 | + * @author Stephan Gambke |
| 7 | + * @author Sanyam Goyal |
| 8 | + * @author Yaron Koren |
| 9 | + * |
| 10 | + */ |
| 11 | + |
| 12 | +if ( !defined( 'SFI_VERSION' ) ) { |
| 13 | + die( 'This file is part of a MediaWiki extension, it is not a valid entry point.' ); |
| 14 | +} |
| 15 | + |
| 16 | +class SFIInputs { |
| 17 | + |
| 18 | + /** |
| 19 | + * Creates the html text for an input. |
| 20 | + * |
| 21 | + * Common attributes for input types are set according to the parameters. |
| 22 | + * The parameters are the standard parameters set by Semantic Forms' |
| 23 | + * InputTypeHook plus some optional. |
| 24 | + * |
| 25 | + * @param string $cur_value |
| 26 | + * @param string $input_name |
| 27 | + * @param boolean $is_mandatory |
| 28 | + * @param boolean $is_disabled |
| 29 | + * @param array $other_args |
| 30 | + * @param string $input_id (optional) |
| 31 | + * @param int $tabindex (optional) |
| 32 | + * @param string $class |
| 33 | + * @return string the html text of an input element |
| 34 | + */ |
| 35 | + static private function textHTML ( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args, $input_id = null, $tabindex = null, $class = "" ) { |
| 36 | + |
| 37 | + global $sfgFieldNum, $sfgTabIndex; |
| 38 | + |
| 39 | + // array of attributes to pass to the input field |
| 40 | + $attribs = array( |
| 41 | + "name" => $input_name, |
| 42 | + "class" => $class, |
| 43 | + "value" => $cur_value, |
| 44 | + "type" => "text" |
| 45 | + ); |
| 46 | + |
| 47 | + // set size attrib |
| 48 | + if ( array_key_exists( 'size', $other_args ) ) { |
| 49 | + $attribs['size'] = $other_args['size']; |
| 50 | + } |
| 51 | + |
| 52 | + // set maxlength attrib |
| 53 | + if ( array_key_exists( 'maxlength', $other_args ) ) { |
| 54 | + $attribs['maxlength'] = $other_args['maxlength']; |
| 55 | + } |
| 56 | + |
| 57 | + // modify class attribute for mandatory form fields |
| 58 | + if ( $is_mandatory ) { |
| 59 | + $attribs["class"] .= ' mandatoryField'; |
| 60 | + } |
| 61 | + |
| 62 | + // add user class(es) to class attribute of input field |
| 63 | + if ( array_key_exists( 'class', $other_args ) ) { |
| 64 | + $attribs["class"] .= ' ' . $other_args['class']; |
| 65 | + } |
| 66 | + |
| 67 | + // set readonly attrib |
| 68 | + if ( $is_disabled ) { |
| 69 | + $attribs["readonly"] = "1"; |
| 70 | + } |
| 71 | + |
| 72 | + // if no special input id is specified set the Semantic Forms standard |
| 73 | + if ( $input_id == null ) { |
| 74 | + $attribs[ 'id' ] = "input_" . $sfgFieldNum; |
| 75 | + } else { |
| 76 | + $attribs[ 'id' ] = $input_id; |
| 77 | + } |
| 78 | + |
| 79 | + |
| 80 | + if ( $tabindex == null ) $attribs[ 'tabindex' ] = $sfgTabIndex; |
| 81 | + else $attribs[ 'tabindex' ] = $tabindex; |
| 82 | + |
| 83 | + // $html = Html::element( "input", $attribs ); |
| 84 | + $html = Xml::element( "input", $attribs ); |
| 85 | + |
| 86 | + return $html; |
| 87 | + |
| 88 | + } |
| 89 | + |
| 90 | + /** |
| 91 | + * Setup function for input type regexp. |
| 92 | + * |
| 93 | + * Loads the Javascript code used by all regexp filters. |
| 94 | + */ |
| 95 | + static private function regexpSetup() { |
| 96 | + |
| 97 | + global $wgOut; |
| 98 | + global $sfigSettings; |
| 99 | + |
| 100 | + static $hasRun = false; |
| 101 | + |
| 102 | + if ( !$hasRun ) { |
| 103 | + $hasRun = true; |
| 104 | + |
| 105 | + $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/regexp.js"></script> ' ); |
| 106 | + |
| 107 | + } |
| 108 | + } |
| 109 | + |
| 110 | + |
| 111 | + /** |
| 112 | + * Definition of input type "regexp" |
| 113 | + * |
| 114 | + * Returns the html code to be included in the page and registers the |
| 115 | + * input's JS initialisation method |
| 116 | + * |
| 117 | + * @param string $cur_value current value of this field (which is sometimes null) |
| 118 | + * @param string $input_name HTML name that this input should have |
| 119 | + * @param boolean $is_mandatory indicates whether this field is mandatory for the user |
| 120 | + * @param boolean $is_disabled indicates whether this field is disabled (meaning, the user can't edit) |
| 121 | + * @param array $other_args hash representing all the other properties defined for this input in the form definition |
| 122 | + * @return string html code of input |
| 123 | + */ |
| 124 | + static function regexpHTML ( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
| 125 | + |
| 126 | + global $wgOut; |
| 127 | + global $sfgFieldNum; // used for setting various HTML IDs |
| 128 | + global $sfgJSValidationCalls; // array of Javascript calls to determine if page can be saved |
| 129 | + global $sfgFormPrinter; |
| 130 | + |
| 131 | + self::regexpSetup(); |
| 132 | + |
| 133 | + // set base input type |
| 134 | + if ( array_key_exists( 'base type', $other_args ) ) { |
| 135 | + |
| 136 | + $baseType = trim( $other_args['base type'] ); |
| 137 | + unset( $other_args['base type'] ); |
| 138 | + |
| 139 | + // if unknown set default base input type |
| 140 | + if ( ! array_key_exists( $baseType, $sfgFormPrinter->mInputTypeHooks ) ) |
| 141 | + $baseType = 'text'; |
| 142 | + } |
| 143 | + else $baseType = 'text'; |
| 144 | + |
| 145 | + // set base prefix string |
| 146 | + if ( array_key_exists( 'base prefix', $other_args ) ) { |
| 147 | + $basePrefix = trim( $other_args['base prefix'] ) . "."; |
| 148 | + unset( $other_args['base prefix'] ); |
| 149 | + } |
| 150 | + else $basePrefix = ''; |
| 151 | + |
| 152 | + // set OR character |
| 153 | + if ( array_key_exists( 'or char', $other_args ) ) { |
| 154 | + $orChar = trim( $other_args['or char'] ); |
| 155 | + unset( $other_args['or char'] ); |
| 156 | + } |
| 157 | + else $orChar = '!'; |
| 158 | + |
| 159 | + // set inverse string |
| 160 | + if ( array_key_exists( 'inverse', $other_args ) ) { |
| 161 | + $inverseString = 'true'; |
| 162 | + unset( $other_args['inverse'] ); |
| 163 | + } |
| 164 | + else $inverseString = 'false'; |
| 165 | + |
| 166 | + // set regexp string |
| 167 | + if ( array_key_exists( 'regexp', $other_args ) ) { |
| 168 | + |
| 169 | + $regexp = str_replace( $orChar, '|', trim( $other_args['regexp'] ) ); |
| 170 | + unset( $other_args['regexp'] ); |
| 171 | + |
| 172 | + // check for leading/trailing delimiter and remove it (else reset regexp) |
| 173 | + if ( preg_match ( "/^\/.*\/\$/", $regexp ) ) { |
| 174 | + |
| 175 | + $regexp = substr( $regexp, 1, strlen( $regexp ) - 2 ); |
| 176 | + |
| 177 | + } |
| 178 | + else $regexp = '.*'; |
| 179 | + |
| 180 | + } |
| 181 | + else $regexp = '.*'; |
| 182 | + |
| 183 | + // set failure message string |
| 184 | + if ( array_key_exists( 'message', $other_args ) ) { |
| 185 | + $message = trim( $other_args['message'] ); |
| 186 | + unset( $other_args['message'] ); |
| 187 | + } |
| 188 | + else $message = wfMsg( 'semanticformsinputs-wrongformat' ); |
| 189 | + |
| 190 | + // sanitize error message and regexp for JS |
| 191 | + $message = Xml::encodeJsVar( $message ); |
| 192 | + $regexp = Xml::encodeJsVar( $regexp ); |
| 193 | + |
| 194 | + // register event to validate regexp on submit/preview |
| 195 | + $jstext = <<<JAVASCRIPT |
| 196 | +jQuery(function(){ |
| 197 | + jQuery('#input_$sfgFieldNum').SemanticForms_registerInputValidation( SFI_RE_validate, {retext: {$regexp}, inverse: {$inverseString}, message: {$message} }); |
| 198 | +}); |
| 199 | +JAVASCRIPT; |
| 200 | + |
| 201 | + $wgOut->addInlineScript( $jstext ); |
| 202 | + |
| 203 | + // create other_args for base input type |
| 204 | + $new_other_args = array(); |
| 205 | + |
| 206 | + foreach ( $other_args as $key => $value ) |
| 207 | + if ( $basePrefix && strpos( $key, $basePrefix ) === 0 ) { |
| 208 | + $new_other_args[substr( $key, strlen( $basePrefix ) )] = $value; |
| 209 | + } else |
| 210 | + $new_other_args[$key] = $value; |
| 211 | + |
| 212 | + // setup parameters for base input type |
| 213 | + $funcArgs = array(); |
| 214 | + $funcArgs[] = $cur_value; |
| 215 | + $funcArgs[] = $input_name; |
| 216 | + $funcArgs[] = $is_mandatory; |
| 217 | + $funcArgs[] = $is_disabled; |
| 218 | + $funcArgs[] = $new_other_args; |
| 219 | + |
| 220 | + // get the input type hooks for the base input type |
| 221 | + $hook_values = $sfgFormPrinter->mInputTypeHooks[$baseType]; |
| 222 | + |
| 223 | + // generate html and JS code for base input type and return it |
| 224 | + return call_user_func_array( $hook_values[0], $funcArgs ); |
| 225 | + |
| 226 | +} |
| 227 | + |
| 228 | + |
| 229 | + /** |
| 230 | + * Setup for input type jqdatepicker. |
| 231 | + * |
| 232 | + * Adds the Javascript code used by all datepickers. |
| 233 | + */ |
| 234 | + static private function jqDatePickerSetup () { |
| 235 | + global $wgOut, $wgLang, $sfgScriptPath; |
| 236 | + global $sfigSettings; |
| 237 | + |
| 238 | + static $hasRun = false; |
| 239 | + |
| 240 | + if ( !$hasRun ) { |
| 241 | + $hasRun = true; |
| 242 | + |
| 243 | + $wgOut->addScript( '<script type="text/javascript" src="' . $sfgScriptPath . '/libs/jquery-ui/jquery.ui.datepicker.min.js"></script> ' ); |
| 244 | + $wgOut->addExtensionStyle( $sfgScriptPath . '/skins/jquery-ui/base/jquery.ui.datepicker.css' ); |
| 245 | + $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/datepicker.js"></script> ' ); |
| 246 | + |
| 247 | + // set localized messages (use MW i18n, not jQuery i18n) |
| 248 | + $jstext = |
| 249 | + "jQuery(function(){\n" |
| 250 | + . " jQuery.datepicker.regional['wiki'] = {\n" |
| 251 | + . " closeText: '" . wfMsg( 'semanticformsinputs-close' ) . "',\n" |
| 252 | + . " prevText: '" . wfMsg( 'semanticformsinputs-prev' ) . "',\n" |
| 253 | + . " nextText: '" . wfMsg( 'semanticformsinputs-next' ) . "',\n" |
| 254 | + . " currentText: '" . wfMsg( 'semanticformsinputs-today' ) . "',\n" |
| 255 | + . " monthNames: ['" |
| 256 | + . wfMsg( 'january' ) . "','" |
| 257 | + . wfMsg( 'february' ) . "','" |
| 258 | + . wfMsg( 'march' ) . "','" |
| 259 | + . wfMsg( 'april' ) . "','" |
| 260 | + . wfMsg( 'may_long' ) . "','" |
| 261 | + . wfMsg( 'june' ) . "','" |
| 262 | + . wfMsg( 'july' ) . "','" |
| 263 | + . wfMsg( 'august' ) . "','" |
| 264 | + . wfMsg( 'september' ) . "','" |
| 265 | + . wfMsg( 'october' ) . "','" |
| 266 | + . wfMsg( 'november' ) . "','" |
| 267 | + . wfMsg( 'december' ) . "'],\n" |
| 268 | + . " monthNamesShort: ['" |
| 269 | + . wfMsg( 'jan' ) . "','" |
| 270 | + . wfMsg( 'feb' ) . "','" |
| 271 | + . wfMsg( 'mar' ) . "','" |
| 272 | + . wfMsg( 'apr' ) . "','" |
| 273 | + . wfMsg( 'may' ) . "','" |
| 274 | + . wfMsg( 'jun' ) . "','" |
| 275 | + . wfMsg( 'jul' ) . "','" |
| 276 | + . wfMsg( 'aug' ) . "','" |
| 277 | + . wfMsg( 'sep' ) . "','" |
| 278 | + . wfMsg( 'oct' ) . "','" |
| 279 | + . wfMsg( 'nov' ) . "','" |
| 280 | + . wfMsg( 'dec' ) . "'],\n" |
| 281 | + . " dayNames: ['" |
| 282 | + . wfMsg( 'sunday' ) . "','" |
| 283 | + . wfMsg( 'monday' ) . "','" |
| 284 | + . wfMsg( 'tuesday' ) . "','" |
| 285 | + . wfMsg( 'wednesday' ) . "','" |
| 286 | + . wfMsg( 'thursday' ) . "','" |
| 287 | + . wfMsg( 'friday' ) . "','" |
| 288 | + . wfMsg( 'saturday' ) . "'],\n" |
| 289 | + . " dayNamesShort: ['" |
| 290 | + . wfMsg( 'sun' ) . "','" |
| 291 | + . wfMsg( 'mon' ) . "','" |
| 292 | + . wfMsg( 'tue' ) . "','" |
| 293 | + . wfMsg( 'wed' ) . "','" |
| 294 | + . wfMsg( 'thu' ) . "','" |
| 295 | + . wfMsg( 'fri' ) . "','" |
| 296 | + . wfMsg( 'sat' ) . "'],\n" |
| 297 | + . " dayNamesMin: ['" |
| 298 | + . $wgLang->firstChar( wfMsg( 'sun' ) ) . "','" |
| 299 | + . $wgLang->firstChar( wfMsg( 'mon' ) ) . "','" |
| 300 | + . $wgLang->firstChar( wfMsg( 'tue' ) ) . "','" |
| 301 | + . $wgLang->firstChar( wfMsg( 'wed' ) ) . "','" |
| 302 | + . $wgLang->firstChar( wfMsg( 'thu' ) ) . "','" |
| 303 | + . $wgLang->firstChar( wfMsg( 'fri' ) ) . "','" |
| 304 | + . $wgLang->firstChar( wfMsg( 'sat' ) ) . "'],\n" |
| 305 | + . " weekHeader: '',\n" |
| 306 | + . " dateFormat: '" . wfMsg( 'semanticformsinputs-dateformatshort' ) . "',\n" |
| 307 | + . " firstDay: '" . wfMsg( 'semanticformsinputs-firstdayofweek' ) . "',\n" |
| 308 | + . " isRTL: " . ( $wgLang->isRTL() ? "true":"false" ) . ",\n" |
| 309 | + . " showMonthAfterYear: false,\n" |
| 310 | + . " yearSuffix: ''};\n" |
| 311 | + . " jQuery.datepicker.setDefaults(jQuery.datepicker.regional['wiki']);\n" |
| 312 | + . "});\n"; |
| 313 | + |
| 314 | + |
| 315 | + $wgOut->addInlineScript( $jstext ); |
| 316 | + |
| 317 | + } |
| 318 | + } |
| 319 | + |
| 320 | + /** |
| 321 | + * Sort and merge time ranges in an array |
| 322 | + * |
| 323 | + * expects an array of arrays |
| 324 | + * the inner arrays must contain two dates representing the start and end |
| 325 | + * date of a time range |
| 326 | + * |
| 327 | + * returns an array of arrays with the date ranges sorted and overlapping |
| 328 | + * ranges merged |
| 329 | + * |
| 330 | + * @param array $ranges array of arrays of DateTimes |
| 331 | + * @return array of arrays of DateTimes |
| 332 | + */ |
| 333 | + static private function sortAndMergeRanges ( $ranges ) { |
| 334 | + |
| 335 | + // sort ranges, earliest date first |
| 336 | + sort( $ranges ); |
| 337 | + |
| 338 | + // stores the start of the current date range |
| 339 | + $currmin = FALSE; |
| 340 | + |
| 341 | + // stores the date the next ranges start date has to top to not overlap |
| 342 | + $nextmin = FALSE; |
| 343 | + |
| 344 | + // result array |
| 345 | + $mergedRanges = array(); |
| 346 | + |
| 347 | + foreach ( $ranges as $range ) { |
| 348 | + |
| 349 | + // ignore empty date ranges |
| 350 | + if ( !$range ) continue; |
| 351 | + |
| 352 | + if ( !$currmin ) { // found first valid range |
| 353 | + |
| 354 | + $currmin = $range[0]; |
| 355 | + $nextmin = $range[1]; |
| 356 | + $nextmin->modify( '+1 day' ); |
| 357 | + |
| 358 | + } elseif ( $range[0] <= $nextmin ) { // overlap detected |
| 359 | + |
| 360 | + $currmin = min( $currmin, $range[0] ); |
| 361 | + |
| 362 | + $range[1]->modify( '+1 day' ); |
| 363 | + $nextmin = max( $nextmin, $range[1] ); |
| 364 | + |
| 365 | + } else { // no overlap, store current range and continue with next |
| 366 | + |
| 367 | + $nextmin->modify( '-1 day' ); |
| 368 | + $mergedRanges[] = array( $currmin, $nextmin ); |
| 369 | + |
| 370 | + $currmin = $range[0]; |
| 371 | + $nextmin = $range[1]; |
| 372 | + $nextmin->modify( '+1 day' ); |
| 373 | + |
| 374 | + } |
| 375 | + |
| 376 | + } |
| 377 | + |
| 378 | + // store last range |
| 379 | + if ( $currmin ) { |
| 380 | + $nextmin->modify( '-1 day' ); |
| 381 | + $mergedRanges[] = array( $currmin, $nextmin ); |
| 382 | + } |
| 383 | + |
| 384 | + return $mergedRanges; |
| 385 | + |
| 386 | + } |
| 387 | + |
| 388 | + /** |
| 389 | + * Creates an array of arrays of dates from an array of strings |
| 390 | + * |
| 391 | + * expects an array of strings containing dates or date ranges in the format |
| 392 | + * "yyyy/mm/dd" or "yyyy/mm/dd-yyyy/mm/dd" |
| 393 | + * |
| 394 | + * returns an array of arrays, each of the latter consisting of two dates |
| 395 | + * representing the start and end date of the range |
| 396 | + * |
| 397 | + * The result array will contain null values for unparseable date strings |
| 398 | + * |
| 399 | + * @param array $rangesAsStrings array of strings with dates and date ranges |
| 400 | + * @return array of arrays of DateTimes |
| 401 | + */ |
| 402 | + static private function createRangesArray ( $rangesAsStrings ) { |
| 403 | + |
| 404 | + // transform array of strings into array of array of dates |
| 405 | + // have to use create_function to be PHP pre5.3 compatible |
| 406 | + return array_map( create_function( '$range', ' |
| 407 | + |
| 408 | + if ( strpos ( $range, "-" ) === FALSE ) { // single date |
| 409 | + $date = date_create( $range ); |
| 410 | + return ( $date ) ? array( $date, clone $date ):null; |
| 411 | + } else { // date range |
| 412 | + $dates = array_map( "date_create", explode( "-", $range ) ); |
| 413 | + return ( $dates[0] && $dates[1] ) ? $dates:null; |
| 414 | + } |
| 415 | + |
| 416 | + ' ), $rangesAsStrings ); |
| 417 | + |
| 418 | + } |
| 419 | + |
| 420 | + /** |
| 421 | + * Takes an array of date ranges and returns an array containing the gaps |
| 422 | + * |
| 423 | + * The very first and the very last date of the original string are lost in |
| 424 | + * the process, of course, as they do not delimit a gap. This means, after |
| 425 | + * repeated inversion the result would eventually be empty. |
| 426 | + * |
| 427 | + * @param array $ranges of arrays of DateTimes |
| 428 | + * @return array of arrays of DateTimes |
| 429 | + */ |
| 430 | + static private function invertRangesArray( $ranges ) { |
| 431 | + |
| 432 | + // the result (initially empty) |
| 433 | + $invRanges = null; |
| 434 | + |
| 435 | + // the minimum of the current gap (initially none) |
| 436 | + $min = null; |
| 437 | + |
| 438 | + foreach ( $ranges as $range ) { |
| 439 | + |
| 440 | + if ( $min ) { // if min date of current gap is known store gap |
| 441 | + $min->modify( "+1day " ); |
| 442 | + $range[0]->modify( "-1day " ); |
| 443 | + $invRanges[] = array( $min, $range[0] ); |
| 444 | + } |
| 445 | + |
| 446 | + $min = $range[1]; // store min date of next gap |
| 447 | + |
| 448 | + } |
| 449 | + |
| 450 | + return $invRanges; |
| 451 | + } |
| 452 | + |
| 453 | + |
| 454 | + /** |
| 455 | + * Definition of input type "datepicker". |
| 456 | + * |
| 457 | + * Returns the html code to be included in the page and registers the |
| 458 | + * input's JS initialisation method |
| 459 | + * |
| 460 | + * @param string $cur_value current value of this field (which is sometimes null) |
| 461 | + * @param string $input_name HTML name that this input should have |
| 462 | + * @param boolean $is_mandatory indicates whether this field is mandatory for the user |
| 463 | + * @param boolean $is_disabled indicates whether this field is disabled (meaning, the user can't edit) |
| 464 | + * @param array $other_args hash representing all the other properties defined for this input in the form definition |
| 465 | + * @return string html code of input |
| 466 | + */ |
| 467 | + static function jqDatePickerHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
| 468 | + |
| 469 | + global $wgOut, $wgLang, $wgAmericanDates; // MW variables |
| 470 | + global $sfgFieldNum, $sfgScriptPath, $sfgTabIndex; // SF variables |
| 471 | + global $sfigSettings; // SFI variables |
| 472 | + |
| 473 | + // call common setup for all jqdatepickers |
| 474 | + self::jqDatePickerSetup(); |
| 475 | + |
| 476 | + // The datepicker is created in three steps: |
| 477 | + // first: set up HTML attributes |
| 478 | + // second: set up JS attributes |
| 479 | + // third: assemble HTML and JS code |
| 480 | + |
| 481 | + |
| 482 | + // first: set up HTML attributes |
| 483 | + // nothing much to do here, self::textHTML will take care od the standard stuff |
| 484 | + |
| 485 | + // store user class(es) for use with buttons |
| 486 | + if ( array_key_exists( 'class', $other_args ) ) { |
| 487 | + $userClasses = $other_args['class']; |
| 488 | + } else $userClasses = ""; |
| 489 | + |
| 490 | + // should the input field be disabled? |
| 491 | + $inputFieldDisabled = |
| 492 | + array_key_exists( 'disable input field', $other_args ) |
| 493 | + || ( !array_key_exists( 'enable input field', $other_args ) && $sfigSettings->datePickerDisableInputField ) |
| 494 | + || $is_disabled ; |
| 495 | + |
| 496 | + // second: set up JS attributes |
| 497 | + |
| 498 | + // set up attributes required for both enabled and disabled datepickers |
| 499 | + $jsattribs = array( |
| 500 | + 'currValue' => $cur_value, |
| 501 | + 'disabled' => $is_disabled, |
| 502 | + 'userClasses' => $userClasses |
| 503 | + ); |
| 504 | + |
| 505 | + if ( array_key_exists( 'part of dtp', $other_args ) ) { |
| 506 | + $jsattribs['partOfDTP'] = $other_args['part of dtp']; |
| 507 | + } |
| 508 | + |
| 509 | + // set date format |
| 510 | + // SHORT and LONG are SFI specific acronyms and are translated here |
| 511 | + // into format strings, anything else is passed to the jQuery date picker |
| 512 | + // Americans need special treatment |
| 513 | + if ( $wgAmericanDates && $wgLang->getCode() == "en" ) { |
| 514 | + |
| 515 | + if ( array_key_exists( 'date format', $other_args ) ) { |
| 516 | + |
| 517 | + if ( $other_args['date format'] == 'SHORT' ) { |
| 518 | + $jsattribs['dateFormat'] = 'mm/dd/yy'; |
| 519 | + } elseif ( $other_args['date format'] == 'LONG' ) { |
| 520 | + $jsattribs['dateFormat'] = 'MM d, yy'; |
| 521 | + } else { |
| 522 | + $jsattribs['dateFormat'] = $other_args['date format']; |
| 523 | + } |
| 524 | + |
| 525 | + } elseif ( $sfigSettings->datePickerDateFormat ) { |
| 526 | + |
| 527 | + if ( $sfigSettings->datePickerDateFormat == 'SHORT' ) { |
| 528 | + $jsattribs['dateFormat'] = 'mm/dd/yy'; |
| 529 | + } elseif ( $sfigSettings->datePickerDateFormat == 'LONG' ) { |
| 530 | + $jsattribs['dateFormat'] = 'MM d, yy'; |
| 531 | + } else { |
| 532 | + $jsattribs['dateFormat'] = $sfigSettings->datePickerDateFormat; |
| 533 | + } |
| 534 | + |
| 535 | + } else $jsattribs['dateFormat'] = 'yy/mm/dd'; |
| 536 | + |
| 537 | + } else { |
| 538 | + |
| 539 | + if ( array_key_exists( 'date format', $other_args ) ) { |
| 540 | + |
| 541 | + if ( $other_args['date format'] == 'SHORT' ) { |
| 542 | + $jsattribs['dateFormat'] = wfMsg( 'semanticformsinputs-dateformatshort' ); |
| 543 | + } elseif ( $other_args['date format'] == 'LONG' ) { |
| 544 | + $jsattribs['dateFormat'] = wfMsg( 'semanticformsinputs-dateformatlong' ); |
| 545 | + } else { |
| 546 | + $jsattribs['dateFormat'] = $other_args['date format']; |
| 547 | + } |
| 548 | + |
| 549 | + } elseif ( $sfigSettings->datePickerDateFormat ) { |
| 550 | + |
| 551 | + if ( $sfigSettings->datePickerDateFormat == 'SHORT' ) { |
| 552 | + $jsattribs['dateFormat'] = wfMsg( 'semanticformsinputs-dateformatshort' ); |
| 553 | + } elseif ( $sfigSettings->datePickerDateFormat == 'LONG' ) { |
| 554 | + $jsattribs['dateFormat'] = wfMsg( 'semanticformsinputs-dateformatlong' ); |
| 555 | + } else { |
| 556 | + $jsattribs['dateFormat'] = $sfigSettings->datePickerDateFormat; |
| 557 | + } |
| 558 | + |
| 559 | + } else $jsattribs['dateFormat'] = 'yy/mm/dd'; |
| 560 | + |
| 561 | + } |
| 562 | + |
| 563 | + // setup attributes required only for either disabled or enabled datepickers |
| 564 | + if ( $is_disabled ) { |
| 565 | + |
| 566 | + $jsattribs['buttonImage'] = $sfigSettings->scriptPath . '/images/DatePickerButtonDisabled.gif'; |
| 567 | + |
| 568 | + if ( array_key_exists( 'show reset button', $other_args ) || |
| 569 | + ( !array_key_exists( 'hide reset button', $other_args ) && $sfigSettings->datePickerShowResetButton ) ) { |
| 570 | + |
| 571 | + $jsattribs['resetButtonImage'] = $sfigSettings->scriptPath . '/images/DatePickerResetButtonDisabled.gif'; |
| 572 | + |
| 573 | + } |
| 574 | + |
| 575 | + } else { |
| 576 | + |
| 577 | + $jsattribs['buttonImage'] = $sfigSettings->scriptPath . '/images/DatePickerButton.gif'; |
| 578 | + |
| 579 | + if ( array_key_exists( 'show reset button', $other_args ) || |
| 580 | + ( !array_key_exists( 'hide reset button', $other_args ) && $sfigSettings->datePickerShowResetButton ) ) { |
| 581 | + |
| 582 | + $jsattribs['resetButtonImage'] = $sfigSettings->scriptPath . '/images/DatePickerResetButton.gif'; |
| 583 | + |
| 584 | + } |
| 585 | + |
| 586 | + // find min date, max date and disabled dates |
| 587 | + |
| 588 | + // set first date |
| 589 | + if ( array_key_exists( 'first date', $other_args ) ) { |
| 590 | + $minDate = date_create( $other_args['first date'] ); |
| 591 | + } elseif ( $sfigSettings->datePickerFirstDate ) { |
| 592 | + $minDate = date_create( $sfigSettings->datePickerFirstDate ); |
| 593 | + } else { |
| 594 | + $minDate = null; |
| 595 | + } |
| 596 | + |
| 597 | + // set last date |
| 598 | + if ( array_key_exists( 'last date', $other_args ) ) { |
| 599 | + $maxDate = date_create( $other_args['last date'] ); |
| 600 | + } elseif ( $sfigSettings->datePickerLastDate ) { |
| 601 | + $maxDate = date_create( $sfigSettings->datePickerLastDate ); |
| 602 | + } else { |
| 603 | + $maxDate = null; |
| 604 | + } |
| 605 | + |
| 606 | + // find allowed values and invert them to get disabled values |
| 607 | + if ( array_key_exists( 'possible_values', $other_args ) && count( $other_args['possible_values'] ) ) { |
| 608 | + |
| 609 | + $enabledDates = self::sortAndMergeRanges( self::createRangesArray( $other_args['possible_values'] ) ); |
| 610 | + |
| 611 | + // correct min/max date to the first/last allowed value |
| 612 | + if ( !$minDate || $minDate < $enabledDates[0][0] ) { |
| 613 | + $minDate = $enabledDates[0][0]; |
| 614 | + } |
| 615 | + |
| 616 | + if ( !$maxDate || $maxDate > $enabledDates[count( $enabledDates ) - 1][1] ) { |
| 617 | + $maxDate = $enabledDates[count( $enabledDates ) - 1][1]; |
| 618 | + } |
| 619 | + |
| 620 | + $disabledDates = self::invertRangesArray( $enabledDates ); |
| 621 | + |
| 622 | + } else $disabledDates = array(); |
| 623 | + |
| 624 | + // add user-defined or default disabled values |
| 625 | + if ( array_key_exists( 'disable dates', $other_args ) ) { |
| 626 | + |
| 627 | + $disabledDates = |
| 628 | + self::sortAndMergeRanges( |
| 629 | + array_merge( $disabledDates, self::createRangesArray( explode( ',' , $other_args['disable dates'] ) ) ) ); |
| 630 | + |
| 631 | + } elseif ( $sfigSettings->datePickerDisabledDates ) { |
| 632 | + |
| 633 | + $disabledDates = |
| 634 | + self::sortAndMergeRanges( |
| 635 | + array_merge( $disabledDates, self::createRangesArray( explode( ',' , $sfigSettings->datePickerDisabledDates ) ) ) ); |
| 636 | + |
| 637 | + } |
| 638 | + |
| 639 | + // if a minDate is set, discard all disabled dates below the min date |
| 640 | + if ( $minDate ) { |
| 641 | + |
| 642 | + // discard all ranges of disabled dates that are entirely below the min date |
| 643 | + while ( $minDate && count( $disabledDates ) && $disabledDates[0][1] < $minDate ) array_shift( $disabledDates ); |
| 644 | + |
| 645 | + // if min date is in first disabled date range, discard that range and adjust min date |
| 646 | + if ( count( $disabledDates ) && $disabledDates[0][0] <= $minDate && $disabledDates[0][1] >= $minDate ) { |
| 647 | + $minDate = $disabledDates[0][1]; |
| 648 | + array_shift( $disabledDates ); |
| 649 | + $minDate->modify( "+1 day" ); |
| 650 | + } |
| 651 | + } |
| 652 | + |
| 653 | + // if a maxDate is set, discard all disabled dates above the max date |
| 654 | + if ( $maxDate ) { |
| 655 | + |
| 656 | + // discard all ranges of disabled dates that are entirely above the max date |
| 657 | + while ( count( $disabledDates ) && $disabledDates[count( $disabledDates ) - 1][0] > $maxDate ) array_pop( $disabledDates ); |
| 658 | + |
| 659 | + // if max date is in last disabled date range, discard that range and adjust max date |
| 660 | + if ( count( $disabledDates ) && $disabledDates[count( $disabledDates ) - 1][0] <= $maxDate && $disabledDates[count( $disabledDates ) - 1][1] >= $maxDate ) { |
| 661 | + $maxDate = $disabledDates[count( $disabledDates ) - 1][0]; |
| 662 | + array_pop( $disabledDates ); |
| 663 | + $maxDate->modify( "-1 day" ); |
| 664 | + } |
| 665 | + } |
| 666 | + // finished with disabled dates |
| 667 | + |
| 668 | + // find highlighted dates |
| 669 | + if ( array_key_exists( "highlight dates", $other_args ) ) { |
| 670 | + $highlightedDates = self::sortAndMergeRanges ( self::createRangesArray( explode( ',' , $other_args["highlight dates"] ) ) ) ; |
| 671 | + } else if ( $sfigSettings->datePickerHighlightedDates ) { |
| 672 | + $highlightedDates = self::sortAndMergeRanges ( self::createRangesArray( explode( ',' , $sfigSettings->datePickerHighlightedDates ) ) ) ; |
| 673 | + } else { |
| 674 | + $highlightedDates = null; |
| 675 | + } |
| 676 | + |
| 677 | + |
| 678 | + // find disabled week days and mark them in an array |
| 679 | + if ( array_key_exists( "disable days of week", $other_args ) ) { |
| 680 | + $disabledDaysString = $other_args['disable days of week']; |
| 681 | + } else { |
| 682 | + $disabledDaysString = $sfigSettings->datePickerDisabledDaysOfWeek; |
| 683 | + } |
| 684 | + |
| 685 | + if ( $disabledDaysString != null ) { |
| 686 | + |
| 687 | + $disabledDays = array( false, false, false, false, false, false, false ); |
| 688 | + |
| 689 | + foreach ( explode( ',', $disabledDaysString ) as $day ) { |
| 690 | + |
| 691 | + if ( is_numeric( $day ) && $day >= 0 && $day <= 6 ) { |
| 692 | + $disabledDays[$day] = true; |
| 693 | + } |
| 694 | + |
| 695 | + } |
| 696 | + |
| 697 | + } else { |
| 698 | + $disabledDays = null; |
| 699 | + } |
| 700 | + |
| 701 | + // find highlighted week days and mark them in an array |
| 702 | + if ( array_key_exists( "highlight days of week", $other_args ) ) { |
| 703 | + $highlightedDaysString = $other_args['highlight days of week']; |
| 704 | + } else { |
| 705 | + $highlightedDaysString = $sfigSettings->datePickerHighlightedDaysOfWeek; |
| 706 | + } |
| 707 | + |
| 708 | + if ( $highlightedDaysString != null ) { |
| 709 | + |
| 710 | + $highlightedDays = array( false, false, false, false, false, false, false ); |
| 711 | + |
| 712 | + foreach ( explode( ',', $highlightedDaysString ) as $day ) { |
| 713 | + |
| 714 | + if ( is_numeric( $day ) && $day >= 0 && $day <= 6 ) { |
| 715 | + $highlightedDays[$day] = true; |
| 716 | + } |
| 717 | + |
| 718 | + } |
| 719 | + |
| 720 | + } else { |
| 721 | + $highlightedDays = null; |
| 722 | + } |
| 723 | + |
| 724 | + // set first day of the week |
| 725 | + if ( array_key_exists( 'week start', $other_args ) ) { |
| 726 | + $jsattribs['firstDay'] = $other_args['week start']; |
| 727 | + } elseif ( $sfigSettings->datePickerWeekStart != null ) { |
| 728 | + $jsattribs['firstDay'] = $sfigSettings->datePickerWeekStart; |
| 729 | + } else { |
| 730 | + $jsattribs['firstDay'] = wfMsg( 'semanticformsinputs-firstdayofweek' ); |
| 731 | + } |
| 732 | + |
| 733 | + // set show week number |
| 734 | + if ( array_key_exists( 'show week numbers', $other_args ) |
| 735 | + || ( !array_key_exists( 'hide week numbers', $other_args ) && $sfigSettings->datePickerShowWeekNumbers ) ) { |
| 736 | + |
| 737 | + $jsattribs['showWeek'] = true; |
| 738 | + } else { |
| 739 | + $jsattribs['showWeek'] = false; |
| 740 | + } |
| 741 | + |
| 742 | + // store min date as JS attrib |
| 743 | + if ( $minDate ) { |
| 744 | + $jsattribs['minDate'] = $minDate->format( 'Y/m/d' ); |
| 745 | + } |
| 746 | + |
| 747 | + // store max date as JS attrib |
| 748 | + if ( $maxDate ) { |
| 749 | + $jsattribs['maxDate'] = $maxDate->format( 'Y/m/d' ); |
| 750 | + } |
| 751 | + |
| 752 | + // register disabled dates with datepicker |
| 753 | + if ( count( $disabledDates ) > 0 ) { |
| 754 | + |
| 755 | + // convert the PHP array of date ranges into an array of numbers |
| 756 | + $jsattribs["disabledDates"] = array_map( create_function ( '$range', ' |
| 757 | + |
| 758 | + $y0 = $range[0]->format( "Y" ); |
| 759 | + $m0 = $range[0]->format( "m" ) - 1; |
| 760 | + $d0 = $range[0]->format( "d" ); |
| 761 | + |
| 762 | + $y1 = $range[1]->format( "Y" ); |
| 763 | + $m1 = $range[1]->format( "m" ) - 1; |
| 764 | + $d1 = $range[1]->format( "d" ); |
| 765 | + |
| 766 | + return array($y0, $m0, $d0, $y1, $m1, $d1); |
| 767 | + ' ) , $disabledDates ); |
| 768 | + } |
| 769 | + |
| 770 | + // register highlighted dates with datepicker |
| 771 | + if ( count( $highlightedDates ) > 0 ) { |
| 772 | + |
| 773 | + // convert the PHP array of date ranges into an array of numbers |
| 774 | + $jsattribs["highlightedDates"] = array_map( create_function ( '$range', ' |
| 775 | + |
| 776 | + $y0 = $range[0]->format( "Y" ); |
| 777 | + $m0 = $range[0]->format( "m" ) - 1; |
| 778 | + $d0 = $range[0]->format( "d" ); |
| 779 | + |
| 780 | + $y1 = $range[1]->format( "Y" ); |
| 781 | + $m1 = $range[1]->format( "m" ) - 1; |
| 782 | + $d1 = $range[1]->format( "d" ); |
| 783 | + |
| 784 | + return array($y0, $m0, $d0, $y1, $m1, $d1); |
| 785 | + ' ) , $highlightedDates ); |
| 786 | + } |
| 787 | + |
| 788 | + // register disabled days of week with datepicker |
| 789 | + if ( count( $disabledDays ) > 0 ) { |
| 790 | + $jsattribs["disabledDays"] = $disabledDays; |
| 791 | + } |
| 792 | + |
| 793 | + // register highlighted days of week with datepicker |
| 794 | + if ( count( $highlightedDays ) > 0 ) { |
| 795 | + $jsattribs["highlightedDays"] = $highlightedDays; |
| 796 | + } |
| 797 | + } |
| 798 | + |
| 799 | + |
| 800 | + // third: assemble HTML and JS code |
| 801 | + |
| 802 | + // start with the displayed input and append the real, but hidden |
| 803 | + // input that gets sent to SF; it will be filled by the datepicker |
| 804 | + $html = self::textHTML( $cur_value, "", $is_mandatory, $inputFieldDisabled, |
| 805 | + $other_args, "input_{$sfgFieldNum}_dp_show", null, "createboxInput" ); |
| 806 | + |
| 807 | + if ( ! array_key_exists( 'part of dtp', $other_args ) ) { |
| 808 | + |
| 809 | + $html .= Xml::element( "input", |
| 810 | + array( |
| 811 | + "id" => "input_{$sfgFieldNum}", |
| 812 | + "name" => $input_name, |
| 813 | + "type" => "hidden", |
| 814 | + "value" => $cur_value |
| 815 | + ) ); |
| 816 | + |
| 817 | + // wrap in span (e.g. used for mandatory inputs) |
| 818 | + $html = '<span class="inputSpan' . ($is_mandatory ? ' mandatoryFieldSpan' : '') . '">' .$html . '</span>'; |
| 819 | + } |
| 820 | + |
| 821 | + // build JS code from attributes array |
| 822 | + $jsattribsString = Xml::encodeJsVar( $jsattribs ); |
| 823 | + |
| 824 | + // wrap the JS code fragment in a function for deferred init |
| 825 | + $jstext = <<<JAVASCRIPT |
| 826 | +jQuery(function(){ jQuery('#input_{$sfgFieldNum}_dp_show').SemanticForms_registerInputInit(SFI_DP_init, $jsattribsString ); }); |
| 827 | +JAVASCRIPT; |
| 828 | + |
| 829 | + // insert the code of the JS init function into the pages code |
| 830 | + $wgOut->addScript( '<script type="text/javascript">' . $jstext . '</script>' ); |
| 831 | + |
| 832 | + //return array( $html, "", "initInput$sfgFieldNum" ); |
| 833 | + return $html; |
| 834 | + |
| 835 | + } |
| 836 | + |
| 837 | + /** |
| 838 | + * Setup for input type jqdatepicker. |
| 839 | + * |
| 840 | + * Adds the Javascript code used by all datetimepickers. |
| 841 | + */ |
| 842 | + static private function datetimePickerSetup () { |
| 843 | + |
| 844 | + global $wgOut, $sfigSettings; |
| 845 | + |
| 846 | + static $hasRun = false; |
| 847 | + |
| 848 | + if ( !$hasRun ) { |
| 849 | + $hasRun = true; |
| 850 | + |
| 851 | + $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/datetimepicker.js"></script> ' ); |
| 852 | + |
| 853 | + } |
| 854 | + } |
| 855 | + |
| 856 | + /** |
| 857 | + * Definition of input type "datetimepicker". |
| 858 | + * |
| 859 | + * Returns the html code to be included in the page and registers the |
| 860 | + * input's JS initialisation method |
| 861 | + * |
| 862 | + * @param string $cur_value current value of this field (which is sometimes null) |
| 863 | + * @param string $input_name HTML name that this input should have |
| 864 | + * @param boolean $is_mandatory indicates whether this field is mandatory for the user |
| 865 | + * @param boolean $is_disabled indicates whether this field is disabled (meaning, the user can't edit) |
| 866 | + * @param array $other_args hash representing all the other properties defined for this input in the form definition |
| 867 | + * @return string html code of input |
| 868 | + */ |
| 869 | + static function datetimepickerHTML($cur_value, $input_name, $is_mandatory, $is_disabled, $other_args) { |
| 870 | + |
| 871 | + global $wgOut, $sfgFieldNum, $sfigSettings; |
| 872 | + |
| 873 | + self::datetimePickerSetup(); |
| 874 | + |
| 875 | + $other_args["part of dtp"] = true; |
| 876 | + |
| 877 | + $jsattribs = array(); |
| 878 | + |
| 879 | + // if we have to show a reset button |
| 880 | + if ( array_key_exists( 'show reset button', $other_args ) || |
| 881 | + ( !array_key_exists( 'hide reset button', $other_args ) && $sfigSettings->datetimePickerShowResetButton ) ) { |
| 882 | + |
| 883 | + // some values must be available to the init function |
| 884 | + |
| 885 | + // is the button disabled? |
| 886 | + $jsattribs['disabled'] = $is_disabled; |
| 887 | + |
| 888 | + // set the button image |
| 889 | + if ( $is_disabled ) { |
| 890 | + $jsattribs['resetButtonImage'] = $sfigSettings->scriptPath . '/images/DateTimePickerResetButtonDisabled.gif'; |
| 891 | + } else { |
| 892 | + $jsattribs['resetButtonImage'] = $sfigSettings->scriptPath . '/images/DateTimePickerResetButton.gif'; |
| 893 | + } |
| 894 | + |
| 895 | + // set user classes |
| 896 | + if ( array_key_exists( 'class', $other_args ) ) $jsattribs[ "userClasses" ] = $other_args['class']; |
| 897 | + else $jsattribs[ "userClasses" ] = ""; |
| 898 | + |
| 899 | + } |
| 900 | + |
| 901 | + // find allowed values and keep only the date portion |
| 902 | + if ( array_key_exists( 'possible_values', $other_args ) && |
| 903 | + count( $other_args[ 'possible_values' ] ) ) { |
| 904 | + |
| 905 | + $other_args[ 'possible_values' ] = preg_replace( |
| 906 | + '/^\s*(\d{4}\/\d{2}\/\d{2}).*/', |
| 907 | + '$1', |
| 908 | + $other_args[ 'possible_values' ] |
| 909 | + ); |
| 910 | + } |
| 911 | + |
| 912 | + $dateTimeString = trim( $cur_value ); |
| 913 | + $dateString = ''; |
| 914 | + $timeString = ''; |
| 915 | + |
| 916 | + $separatorPos = strpos($dateTimeString, " "); |
| 917 | + |
| 918 | + // does it have a separating whitespace? assume it's a date & time |
| 919 | + if ( $separatorPos ) { |
| 920 | + $dateString = substr( $dateTimeString, 0, $separatorPos ); |
| 921 | + $timeString = substr( $dateTimeString, $separatorPos + 1 ); |
| 922 | + |
| 923 | + // does it start with a time of some kind? |
| 924 | + } elseif ( preg_match( '/^\d?\d:\d\d/', $dateTimeString ) ) { |
| 925 | + $timeString = $dateTimeString; |
| 926 | + |
| 927 | + // if all else fails assume it's a date |
| 928 | + } else { |
| 929 | + $dateString = $dateTimeString; |
| 930 | + } |
| 931 | + |
| 932 | + $html = '<span class="inputSpan' . ($is_mandatory ? ' mandatoryFieldSpan' : '') . '">' . |
| 933 | + self::jqDatePickerHTML( $dateString, $input_name, $is_mandatory, $is_disabled, $other_args) . " " . |
| 934 | + self::timepickerHTML( $timeString, $input_name, $is_mandatory, $is_disabled, $other_args) . |
| 935 | + Xml::element("input", |
| 936 | + array( |
| 937 | + "id" => "input_{$sfgFieldNum}", |
| 938 | + "name" => $input_name, |
| 939 | + "type" => "hidden", |
| 940 | + "value" => $cur_value |
| 941 | + )) |
| 942 | + . '</span>'; |
| 943 | + |
| 944 | + // build JS code from attributes array |
| 945 | + $jsattribsString = Xml::encodeJsVar( $jsattribs ); |
| 946 | + |
| 947 | + $jstext = <<<JAVASCRIPT |
| 948 | +jQuery(function(){ jQuery('#input_$sfgFieldNum').SemanticForms_registerInputInit(SFI_DTP_init, $jsattribsString ); }); |
| 949 | +JAVASCRIPT; |
| 950 | + |
| 951 | + // insert the code of the JS init function into the pages code |
| 952 | + $wgOut->addScript('<script type="text/javascript">' . $jstext . '</script>'); |
| 953 | + |
| 954 | + return $html; |
| 955 | + } |
| 956 | + |
| 957 | +// |
| 958 | +// static function wysiwygSetup() { |
| 959 | +// |
| 960 | +// } |
| 961 | +// |
| 962 | +// |
| 963 | +// static function wysiwygHTML ( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
| 964 | +// |
| 965 | +// global $wgOut, $wgLang, $wgAmericanDates, $wgScriptPath, $wgFCKEditorDir; |
| 966 | +// global $sfgFieldNum, $sfgScriptPath, $sfigSettings; |
| 967 | +// global $sfgTabIndex, $sfgJSValidationCalls; // used to represent the current tab index in the form |
| 968 | +// |
| 969 | +// $htmltext = Html::element('textarea', array( |
| 970 | +// 'id' => "input_$sfgFieldNum", |
| 971 | +// 'class' => 'createboxInput', |
| 972 | +// 'name' => $input_name, |
| 973 | +// 'tabindex' => $sfgTabIndex, |
| 974 | +// 'rows' => 25, |
| 975 | +// 'cols' => 80 |
| 976 | +// )); |
| 977 | +// |
| 978 | +// $jstext = <<<JAVASCRIPT |
| 979 | +// addOnloadHook(function() |
| 980 | +// { |
| 981 | +// var oFCKeditor = new FCKeditor( 'input_$sfgFieldNum', '100%', '100%') ; |
| 982 | +// oFCKeditor.BasePath = "$wgScriptPath/$wgFCKEditorDir/" ; |
| 983 | +// oFCKeditor.ReplaceTextarea() ; |
| 984 | +// }); |
| 985 | +// |
| 986 | +// JAVASCRIPT; |
| 987 | +// |
| 988 | +// $sfgJSValidationCalls[] = "function() {document.getElementById('input_$sfgFieldNum').value = FCKeditorAPI.GetInstance('input_$sfgFieldNum').GetHtml();return true;}"; |
| 989 | +// |
| 990 | +// $wgOut->addScript( '<script type="text/javascript">' . $jstext . '</script>' ); |
| 991 | +// return array( $htmltext, "" ); |
| 992 | +// } |
| 993 | +// |
| 994 | + |
| 995 | + |
| 996 | + /** |
| 997 | + * Setup for input type "timepicker". |
| 998 | + * |
| 999 | + * Adds the Javascript code and css used by all timepickers. |
| 1000 | + */ |
| 1001 | + static private function timepickerSetup() { |
| 1002 | + |
| 1003 | + global $sfigSettings, $wgOut; |
| 1004 | + |
| 1005 | + static $hasRun = false; |
| 1006 | + |
| 1007 | + if ( !$hasRun ) { |
| 1008 | + |
| 1009 | + $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/timepicker.js"></script> ' ); |
| 1010 | + $wgOut->addExtensionStyle( $sfigSettings->scriptPath . '/skins/SFI_Timepicker.css' ); |
| 1011 | + |
| 1012 | + } |
| 1013 | + |
| 1014 | + } |
| 1015 | + |
| 1016 | + /** |
| 1017 | + * Definition of input type "timepicker" |
| 1018 | + * |
| 1019 | + * Returns the html code to be included in the page and registers the |
| 1020 | + * input's JS initialisation method |
| 1021 | + * |
| 1022 | + * @param string $cur_value current value of this field (which is sometimes null) |
| 1023 | + * @param string $input_name HTML name that this input should have |
| 1024 | + * @param boolean $is_mandatory indicates whether this field is mandatory for the user |
| 1025 | + * @param boolean $is_disabled indicates whether this field is disabled (meaning, the user can't edit) |
| 1026 | + * @param array $other_args hash representing all the other properties defined for this input in the form definition |
| 1027 | + * @return string html code of input |
| 1028 | + */ |
| 1029 | + static function timepickerHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
| 1030 | + |
| 1031 | + global $wgOut; |
| 1032 | + global $sfgFieldNum; |
| 1033 | + global $sfigSettings; |
| 1034 | + |
| 1035 | + // The timepicker is created in four steps: |
| 1036 | + // first: set up HTML attributes |
| 1037 | + // second: assemble HTML |
| 1038 | + // third: set up JS attributes |
| 1039 | + // fourth: assemble JS call |
| 1040 | + |
| 1041 | + |
| 1042 | + // first: set up HTML attributes |
| 1043 | + $inputFieldDisabled = |
| 1044 | + array_key_exists( 'disable input field', $other_args ) |
| 1045 | + || ( !array_key_exists( 'enable input field', $other_args ) && $sfigSettings->timePickerDisableInputField ) |
| 1046 | + || $is_disabled ; |
| 1047 | + |
| 1048 | + if ( array_key_exists( 'class', $other_args ) ) $userClasses = $other_args['class']; |
| 1049 | + else $userClasses = ""; |
| 1050 | + |
| 1051 | + // second: assemble HTML |
| 1052 | + // create visible input field (for display) and invisible field (for data) |
| 1053 | + $html = self::textHTML( $cur_value, '', $is_mandatory, $inputFieldDisabled, $other_args, "input_{$sfgFieldNum}_tp_show", null, "createboxInput" ); |
| 1054 | + |
| 1055 | + if ( ! array_key_exists( 'part of dtp', $other_args ) ) { |
| 1056 | + $html .= Xml::element( "input", array( |
| 1057 | + 'id' => "input_{$sfgFieldNum}", |
| 1058 | + 'type' => 'hidden', |
| 1059 | + 'name' => $input_name, |
| 1060 | + 'value' => $cur_value |
| 1061 | + ) ); |
| 1062 | + } |
| 1063 | + |
| 1064 | + // append time picker button |
| 1065 | + if ( $is_disabled ) { |
| 1066 | + |
| 1067 | + $html .= Xml::openElement( |
| 1068 | + "button", |
| 1069 | + array( |
| 1070 | + 'type' => 'button', |
| 1071 | + 'class' => 'createboxInput ' . $userClasses, |
| 1072 | + 'disabled' => '1', |
| 1073 | + 'id' => "input_{$sfgFieldNum}_button" |
| 1074 | + ) ) |
| 1075 | + |
| 1076 | + . Xml::element( |
| 1077 | + "image", |
| 1078 | + array( 'src' => $sfigSettings->scriptPath . '/images/TimePickerButtonDisabled.gif' ) |
| 1079 | + ) |
| 1080 | + |
| 1081 | + . Xml::closeElement( "button" ); |
| 1082 | + |
| 1083 | + } else { |
| 1084 | + |
| 1085 | + $html .= "<button " |
| 1086 | + . Xml::expandAttributes ( array( |
| 1087 | + 'type' => 'button', |
| 1088 | + 'class' => 'createboxInput ' . $userClasses, |
| 1089 | + 'name' => "button", |
| 1090 | + ) ) |
| 1091 | + . " onclick=\"document.getElementById(this.id.replace('_button','_tp_show')).focus();\"" |
| 1092 | + . ">" |
| 1093 | + |
| 1094 | + . Xml::element( |
| 1095 | + "image", |
| 1096 | + array( 'src' => $sfigSettings->scriptPath . '/images/TimePickerButton.gif' ) |
| 1097 | + ) |
| 1098 | + |
| 1099 | + . Xml::closeElement( "button" ); |
| 1100 | + |
| 1101 | + } |
| 1102 | + |
| 1103 | + // append reset button (if selected) |
| 1104 | + if ( ! array_key_exists( 'part of dtp', $other_args ) && |
| 1105 | + ( array_key_exists( 'show reset button', $other_args ) || |
| 1106 | + $sfigSettings->timePickerShowResetButton && !array_key_exists( 'hide reset button', $other_args ) |
| 1107 | + ) |
| 1108 | + ) { |
| 1109 | + |
| 1110 | + if ( $is_disabled ) { |
| 1111 | + |
| 1112 | + $html .= Xml::openElement( |
| 1113 | + "button", |
| 1114 | + array( |
| 1115 | + 'type' => 'button', |
| 1116 | + 'class' => 'createboxInput ' . $userClasses, |
| 1117 | + 'disabled' => '1', |
| 1118 | + 'id' => "input_{$sfgFieldNum}_resetbutton" |
| 1119 | + ) ) |
| 1120 | + |
| 1121 | + . Xml::element( |
| 1122 | + "image", |
| 1123 | + array( 'src' => $sfigSettings->scriptPath . '/images/TimePickerResetButtonDisabled.gif' ) |
| 1124 | + |
| 1125 | + ) |
| 1126 | + . Xml::closeElement( "button" ); |
| 1127 | + |
| 1128 | + } else { |
| 1129 | + |
| 1130 | + $html .= "<button " |
| 1131 | + . Xml::expandAttributes ( array( |
| 1132 | + 'type' => 'button', |
| 1133 | + 'class' => 'createboxInput ' . $userClasses, |
| 1134 | + 'name' => "resetbutton", |
| 1135 | + ) ) |
| 1136 | + . " onclick=\"document.getElementById(this.id.replace('_resetbutton','')).value='';" |
| 1137 | + . "document.getElementById(this.id.replace('_resetbutton','_tp_show')).value='';\"" |
| 1138 | + . ">" |
| 1139 | + |
| 1140 | + . Xml::element( |
| 1141 | + "image", |
| 1142 | + array( 'src' => $sfigSettings->scriptPath . '/images/TimePickerResetButton.gif' ) |
| 1143 | + |
| 1144 | + ) |
| 1145 | + . Xml::closeElement( "button" ); |
| 1146 | + |
| 1147 | + } |
| 1148 | + } |
| 1149 | + |
| 1150 | + // wrap in span (e.g. used for mandatory inputs) |
| 1151 | + if ( ! array_key_exists( 'part of dtp', $other_args ) ) { |
| 1152 | + $html = '<span class="inputSpan' . ($is_mandatory ? ' mandatoryFieldSpan' : '') . '">' .$html . '</span>'; |
| 1153 | + } |
| 1154 | + |
| 1155 | + // third: if the timepicker is not disabled set up JS attributes ans assemble JS call |
| 1156 | + if ( !$is_disabled ) { |
| 1157 | + |
| 1158 | + self::timepickerSetup(); |
| 1159 | + |
| 1160 | + // set min time if valid, else use default |
| 1161 | + if ( array_key_exists( 'mintime', $other_args ) |
| 1162 | + && ( preg_match( '/^\d+:\d\d$/', trim( $other_args['mintime'] ) ) == 1 ) ) { |
| 1163 | + $minTime = trim( $other_args[ 'mintime' ] ); |
| 1164 | + } elseif ( $sfigSettings->timePickerMinTime != null ) { |
| 1165 | + $minTime = $sfigSettings->timePickerMinTime ; |
| 1166 | + } else { |
| 1167 | + $minTime = '00:00'; |
| 1168 | + } |
| 1169 | + |
| 1170 | + // set max time if valid, else use default |
| 1171 | + if ( array_key_exists( 'maxtime', $other_args ) |
| 1172 | + && ( preg_match( '/^\d+:\d\d$/', trim( $other_args['maxtime'] ) ) == 1 ) ) { |
| 1173 | + $maxTime = trim( $other_args[ 'maxtime' ] ); |
| 1174 | + } elseif ( $sfigSettings->timePickerMaxTime != null ) { |
| 1175 | + $maxTime = $sfigSettings->timePickerMaxTime ; |
| 1176 | + } else { |
| 1177 | + $maxTime = '23:59'; |
| 1178 | + } |
| 1179 | + |
| 1180 | + // set interval if valid, else use default |
| 1181 | + if ( array_key_exists( 'interval', $other_args ) |
| 1182 | + && preg_match( '/^\d+$/', trim( $other_args['interval'] ) ) == 1 ) { |
| 1183 | + $interval = trim( $other_args[ 'interval' ] ); |
| 1184 | + } else { |
| 1185 | + $interval = '15'; |
| 1186 | + } |
| 1187 | + |
| 1188 | + // build JS code from attributes array |
| 1189 | + $jsattribs = array( |
| 1190 | + "minTime" => $minTime, |
| 1191 | + "maxTime" => $maxTime, |
| 1192 | + "interval" => $interval, |
| 1193 | + "format" => "hh:mm" |
| 1194 | + ); |
| 1195 | + |
| 1196 | + if ( array_key_exists( 'part of dtp', $other_args ) ) { |
| 1197 | + $jsattribs['partOfDTP'] = $other_args['part of dtp']; |
| 1198 | + } |
| 1199 | + |
| 1200 | + $jstext = Xml::encodeJsVar( $jsattribs ); |
| 1201 | + |
| 1202 | + $jstext = <<<JAVASCRIPT |
| 1203 | +jQuery(function(){ jQuery('#input_{$sfgFieldNum}_tp_show').SemanticForms_registerInputInit(SFI_TP_init, $jstext ); }); |
| 1204 | +JAVASCRIPT; |
| 1205 | + |
| 1206 | + // write JS code directly to the page's code |
| 1207 | + $wgOut->addScript( '<script type="text/javascript">' . $jstext . '</script>' ); |
| 1208 | + |
| 1209 | + // return HTML and name of JS init function |
| 1210 | + |
| 1211 | + } |
| 1212 | + |
| 1213 | + return $html; |
| 1214 | + |
| 1215 | + } |
| 1216 | + |
| 1217 | + /** |
| 1218 | + * Setup for input type "menuselect". |
| 1219 | + * Adds the Javascript code and css used by all menuselects. |
| 1220 | + */ |
| 1221 | + static private function menuselectSetup() { |
| 1222 | + |
| 1223 | + global $wgOut; |
| 1224 | + global $sfigSettings; |
| 1225 | + |
| 1226 | + static $hasRun = false; |
| 1227 | + |
| 1228 | + if ( !$hasRun ) { |
| 1229 | + |
| 1230 | + $wgOut->addScript( '<script type="text/javascript">sfigScriptPath="' . $sfigSettings->scriptPath . '";</script> ' ); |
| 1231 | + $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/menuselect.js"></script> ' ); |
| 1232 | + $wgOut->addExtensionStyle( $sfigSettings->scriptPath . '/skins/SFI_Menuselect.css' ); |
| 1233 | + |
| 1234 | + } |
| 1235 | + |
| 1236 | + } |
| 1237 | + |
| 1238 | + /** |
| 1239 | + * Definition of input type "menuselect" |
| 1240 | + * |
| 1241 | + * Returns the html code to be included in the page and registers the |
| 1242 | + * input's JS initialisation method |
| 1243 | + * |
| 1244 | + * @param string $cur_value current value of this field (which is sometimes null) |
| 1245 | + * @param string $input_name HTML name that this input should have |
| 1246 | + * @param boolean $is_mandatory indicates whether this field is mandatory for the user |
| 1247 | + * @param boolean $is_disabled indicates whether this field is disabled (meaning, the user can't edit) |
| 1248 | + * @param array $other_args hash representing all the other properties defined for this input in the form definition |
| 1249 | + * @return string html code of input |
| 1250 | + */ |
| 1251 | + static function menuselectHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
| 1252 | + global $wgParser, $wgUser, $wgTitle, $wgOut; |
| 1253 | + global $sfgFieldNum; |
| 1254 | + global $sfigSettings; |
| 1255 | + |
| 1256 | + self::menuselectSetup(); |
| 1257 | + |
| 1258 | + // first: set up HTML attributes |
| 1259 | + $inputFieldDisabled = |
| 1260 | + array_key_exists( 'disable input field', $other_args ) |
| 1261 | + || ( !array_key_exists( 'enable input field', $other_args ) && $sfigSettings->timePickerDisableInputField ) |
| 1262 | + || $is_disabled ; |
| 1263 | + |
| 1264 | + // second: assemble HTML |
| 1265 | + // create visible input field (for display) and invisible field (for data) |
| 1266 | + $html = self::textHTML( $cur_value, '', $is_mandatory, $inputFieldDisabled, $other_args, "input_{$sfgFieldNum}_show", null, "createboxInput" ) |
| 1267 | + . Xml::element( "input", array( |
| 1268 | + 'id' => "input_{$sfgFieldNum}", |
| 1269 | + 'type' => 'hidden', |
| 1270 | + 'name' => $input_name, |
| 1271 | + 'value' => $cur_value |
| 1272 | + ) ); |
| 1273 | + |
| 1274 | + |
| 1275 | + $html .= "<span class='SFI_menuselect' id='span_{$sfgFieldNum}_tree'>"; |
| 1276 | + |
| 1277 | + |
| 1278 | + // if ( array_key_exists( 'delimiter', $other_args ) ) $delimiter = $other_args[ 'delimiter' ]; |
| 1279 | + // else $delimiter = ' '; |
| 1280 | + |
| 1281 | + // parse menu structure |
| 1282 | + |
| 1283 | + $options = ParserOptions::newFromUser( $wgUser ); |
| 1284 | + |
| 1285 | + $oldStripState = $wgParser->mStripState; |
| 1286 | + $wgParser->mStripState = new StripState(); |
| 1287 | + |
| 1288 | + // FIXME: SF does not parse options correctly. Users have to replace | by {{!}} |
| 1289 | + $structure = str_replace( '{{!}}', '|', $other_args["structure"] ); |
| 1290 | + |
| 1291 | + $structure = $wgParser->parse( $structure, $wgTitle, $options )->getText(); |
| 1292 | + |
| 1293 | + $wgParser->mStripState = $oldStripState; |
| 1294 | + |
| 1295 | + |
| 1296 | + $html .= str_replace( '<li', '<li class=\'ui-state-default\'', $structure ); |
| 1297 | + |
| 1298 | + $html .= "</span>"; |
| 1299 | + |
| 1300 | + // wrap in span (e.g. used for mandatory inputs) |
| 1301 | + $html = '<span class="inputSpan' . ($is_mandatory ? ' mandatoryFieldSpan' : '') . '">' .$html . '</span>'; |
| 1302 | + |
| 1303 | + $jstext = <<<JAVASCRIPT |
| 1304 | +jQuery(function(){ jQuery('#input_$sfgFieldNum').SemanticForms_registerInputInit(SFI_MS_init, null ); }); |
| 1305 | +JAVASCRIPT; |
| 1306 | + |
| 1307 | + // write JS code directly to the page's code |
| 1308 | + $wgOut->addScript( '<script type="text/javascript">' . $jstext . '</script>' ); |
| 1309 | + |
| 1310 | + return array( $html, "", "SFI_MS_init" ); |
| 1311 | + |
| 1312 | + } |
| 1313 | +} |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/SFI_Inputs.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 1314 | + native |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/libs/menuselect.js |
— | — | @@ -0,0 +1,271 @@ |
| 2 | +/** |
| 3 | + * Javascript code to be used with input type menuselect. |
| 4 | + * |
| 5 | + * @author Stephan Gambke |
| 6 | + * |
| 7 | + */ |
| 8 | + |
| 9 | +/** |
| 10 | + * Initializes a menuselect input |
| 11 | + * |
| 12 | + * @param inputID ( String ) the id of the input to initialize |
| 13 | + */ |
| 14 | +function SFI_MS_init( inputID, params ) { |
| 15 | + |
| 16 | + jQuery('#' + inputID + "_show").one('focus', function(){ |
| 17 | + var treeid = "#" + inputID.replace(/input/,"span") + "_tree" |
| 18 | + |
| 19 | + jQuery(treeid).css("visibility","hidden"); |
| 20 | + |
| 21 | + // wrap content in span to separate content from sub-menus, |
| 22 | + // wrap content in div to support animating the list item width later |
| 23 | + jQuery( treeid + " li" ).each( |
| 24 | + function() { |
| 25 | + |
| 26 | + jQuery( this ).contents().not( "ul" ) |
| 27 | + .wrapAll( '<span />' ) |
| 28 | + .wrapAll( '<div class="cont"/>' ); |
| 29 | + |
| 30 | + jQuery( this ).contents().not( "ul" ) |
| 31 | + .find("div.cont") |
| 32 | + .css({ |
| 33 | + position:'fixed', |
| 34 | + top: '0px', |
| 35 | + left: '0px' |
| 36 | + }); |
| 37 | + |
| 38 | + // insert the arrows indicating submenus |
| 39 | + if ( jQuery( this ).children( "ul" ).length > 0 ) { |
| 40 | + jQuery( this ).children( "span" ).children( "div" ) |
| 41 | + .before( '<div class="arrow" ><img src="' + sfigScriptPath + '/images/MenuSelectArrow.gif" /></div>' ) |
| 42 | + } |
| 43 | + |
| 44 | + } ); |
| 45 | + |
| 46 | + // ensure labels of list item have constant width regardless of width of list item |
| 47 | + // prevents layout changes when list item width is changed |
| 48 | + // set position static ( was set to fixed to calculate text width ) |
| 49 | + jQuery( treeid + " li>span>div.cont" ).each( function() { |
| 50 | + jQuery( this ).width( jQuery( this ).outerWidth(true) + jQuery( this ).siblings("div.arrow").outerWidth(true) + 5); |
| 51 | + jQuery( this ).css( "position", "static" ); |
| 52 | + } ); |
| 53 | + |
| 54 | + // add class for default state and fix dimensions |
| 55 | + jQuery( treeid + " li" ) |
| 56 | + .addClass( "ui-state-default" ) |
| 57 | + .each( |
| 58 | + function() { |
| 59 | + jQuery(this).height(jQuery(this).height()); |
| 60 | + jQuery(this).width(jQuery(this).width()); |
| 61 | + |
| 62 | + // to be used for restoring width after mouse leves this item |
| 63 | + jQuery(this).data("width", jQuery(this).width()); |
| 64 | + } |
| 65 | + ); |
| 66 | + |
| 67 | + // initially hide everything |
| 68 | + jQuery( treeid + " ul" ) |
| 69 | + .css({"z-index":1}) |
| 70 | + .hide() |
| 71 | + .fadeTo(0, 0 ); |
| 72 | + |
| 73 | + // some crap "browsers" need special treatment |
| 74 | + if ( jQuery.browser.msie ) { |
| 75 | + jQuery( treeid + " ul" ).css({ "position":"relative" }); |
| 76 | + } |
| 77 | + |
| 78 | + // sanitize links |
| 79 | + jQuery( treeid ).find( "a" ) |
| 80 | + .each( |
| 81 | + function() { |
| 82 | + |
| 83 | + // find title of target page |
| 84 | + if ( jQuery( this ).hasClass( 'new' ) ) { // for red links get it from the href |
| 85 | + |
| 86 | + regexp = /.*title=([^&]*).*/; |
| 87 | + res = regexp.exec( jQuery( this ).attr( 'href' ) ); |
| 88 | + |
| 89 | + title = unescape( res[1] ); |
| 90 | + |
| 91 | + jQuery( this ).data( 'title', title ); // save title in data |
| 92 | + |
| 93 | + } else { // for normal links title is in the links title attribute |
| 94 | + jQuery( this ) |
| 95 | + .data( 'title', jQuery( this ).attr( 'title' ) ); // save title in data |
| 96 | + } |
| 97 | + |
| 98 | + jQuery( this ) |
| 99 | + .removeAttr( 'title' ) // remove title to prevent tooltips on links |
| 100 | + .bind( "click", function( event ) { |
| 101 | + event.preventDefault(); |
| 102 | + } ) // prevent following links |
| 103 | + |
| 104 | + } |
| 105 | + ); |
| 106 | + |
| 107 | + // attach event handlers |
| 108 | + |
| 109 | + // mouse entered list item |
| 110 | + jQuery( treeid + " li" ) |
| 111 | + .mouseenter( function( evt ) { |
| 112 | + |
| 113 | + // switch classes to change display style |
| 114 | + jQuery( evt.currentTarget ) |
| 115 | + .removeClass( "ui-state-default" ) |
| 116 | + .addClass( "ui-state-hover" ); |
| 117 | + |
| 118 | + // if we reentered (i.e. moved mouse from item to sub-item) |
| 119 | + if (jQuery( evt.currentTarget ).data( "timeout" ) != null) { |
| 120 | + |
| 121 | + // clear any timeout that may still run on the list item |
| 122 | + // (i.e. do not fade out submenu) |
| 123 | + clearTimeout( jQuery( evt.currentTarget ).data( "timeout" ) ); |
| 124 | + jQuery( evt.currentTarget ).data( "timeout", null ); |
| 125 | + |
| 126 | + // abort further actions (just leave the submenu open) |
| 127 | + return; |
| 128 | + } |
| 129 | + |
| 130 | + |
| 131 | + // if list item has sub-items... |
| 132 | + if ( jQuery( evt.currentTarget ).children( "ul" ).length > 0 ) { |
| 133 | + |
| 134 | + // set timeout to show sub-items |
| 135 | + jQuery( evt.currentTarget ) |
| 136 | + .data( "timeout", setTimeout( |
| 137 | + function() { |
| 138 | + |
| 139 | + // clear timeout data |
| 140 | + jQuery( evt.currentTarget ).data( "timeout", null ); |
| 141 | + |
| 142 | + // some crap "browsers" need special treatment |
| 143 | + if ( jQuery.browser.msie ) { |
| 144 | + jQuery( evt.currentTarget ).children( "ul" ) |
| 145 | + .css( { |
| 146 | + "top": -jQuery( evt.currentTarget ).outerHeight(), |
| 147 | + "left": jQuery( evt.currentTarget ).outerWidth() + 10 |
| 148 | + } ); |
| 149 | + } |
| 150 | + |
| 151 | + // fade in sub-menu |
| 152 | + // can not use fadeIn, it sets display:block |
| 153 | + jQuery( evt.currentTarget ).children( "ul" ) |
| 154 | + .css( { |
| 155 | + "display":"inline", |
| 156 | + "z-index":100 |
| 157 | + } ) |
| 158 | + .fadeTo( 400, 1 ); |
| 159 | + |
| 160 | + w = jQuery( evt.currentTarget ).width(); |
| 161 | + |
| 162 | + // animate list item width |
| 163 | + jQuery( evt.currentTarget ) |
| 164 | + .animate( { "width": w + 10 }, 100 ); |
| 165 | + |
| 166 | + }, 400 ) |
| 167 | + ); |
| 168 | + } |
| 169 | + |
| 170 | + } ); |
| 171 | + |
| 172 | + // mouse left list item |
| 173 | + jQuery( treeid + " li" ) |
| 174 | + .mouseleave( function( evt ) { |
| 175 | + |
| 176 | + // switch classes to change display style |
| 177 | + jQuery( evt.currentTarget ) |
| 178 | + .removeClass( "ui-state-hover" ) |
| 179 | + .addClass( "ui-state-default" ) |
| 180 | + |
| 181 | + // if we just moved in and out of the item (without really hovering) |
| 182 | + if (jQuery( evt.currentTarget ).data( "timeout" ) != null) { |
| 183 | + |
| 184 | + // clear any timeout that may still run on the list item |
| 185 | + // (i.e. do not fade in submenu) |
| 186 | + clearTimeout( jQuery( evt.currentTarget ).data( "timeout" ) ); |
| 187 | + jQuery( evt.currentTarget ).data( "timeout", null ); |
| 188 | + |
| 189 | + // abort further actions (no need to close) |
| 190 | + return; |
| 191 | + } |
| 192 | + |
| 193 | + // if list item has sub-items... |
| 194 | + if ( jQuery( evt.currentTarget ).children( "ul" ).length > 0 ) { |
| 195 | + |
| 196 | + // hide sub-items after a short pause |
| 197 | + jQuery( evt.currentTarget ).data( "timeout", setTimeout( |
| 198 | + function() { |
| 199 | + |
| 200 | + // clear timeout data |
| 201 | + jQuery( evt.currentTarget ).data( "timeout", null ); |
| 202 | + |
| 203 | + // fade out sub-menu |
| 204 | + // when finished set display:none and put list item back in |
| 205 | + // line ( i.e. animate to original width ) |
| 206 | + jQuery( evt.currentTarget ).children( "ul" ) |
| 207 | + .css( "z-index", 1 ) |
| 208 | + .fadeTo( 400, 0, |
| 209 | + function() { |
| 210 | + |
| 211 | + jQuery( this ).css( "display", "none" ); |
| 212 | + |
| 213 | + // animate list item width |
| 214 | + jQuery( this ).parent() |
| 215 | + .animate( { "width": jQuery( this ).parent().data( "width" ) }, 100 ); |
| 216 | + } |
| 217 | + ); |
| 218 | + |
| 219 | + }, 400 ) |
| 220 | + ); |
| 221 | + } |
| 222 | + |
| 223 | + } ); |
| 224 | + |
| 225 | + // clicked list item |
| 226 | + jQuery( treeid + " li" ) |
| 227 | + .mousedown( function() { |
| 228 | + |
| 229 | + // set visible value and leave input |
| 230 | + jQuery( "#" + inputID + "_show" ).attr( "value", jQuery( this ) |
| 231 | + .children( "span" ).find( "div.cont" ).text() ).blur(); |
| 232 | + |
| 233 | + // set hidden value that gets sent back to the server |
| 234 | + link = jQuery( this ).children( "span" ).find( "div.cont>a" ); |
| 235 | + |
| 236 | + // if content is link |
| 237 | + if ( link.length == 1 ) { |
| 238 | + |
| 239 | + // use title set by MW |
| 240 | + jQuery( "#" + inputID ).attr( "value", link.data( "title" ) ); |
| 241 | + |
| 242 | + } else { |
| 243 | + |
| 244 | + // just use text of list item |
| 245 | + jQuery( "#" + inputID ).attr( "value", jQuery( this ).children( "span" ).find( "div.cont" ).text() ); |
| 246 | + |
| 247 | + } |
| 248 | + return false; |
| 249 | + |
| 250 | + } ); |
| 251 | + |
| 252 | + // show top menu when input gets focus |
| 253 | + jQuery( "#" + inputID + "_show" ) |
| 254 | + .focus( function() { |
| 255 | + jQuery( treeid + ">ul" ).css( "display", "inline" ).fadeTo( 400, 1 ); |
| 256 | + } ); |
| 257 | + |
| 258 | + // hide all menus when input loses focus |
| 259 | + jQuery( "#" + inputID + "_show" ) |
| 260 | + .blur( function() { |
| 261 | + |
| 262 | + jQuery( treeid + " ul" ).fadeTo( 400, 0, |
| 263 | + function() { |
| 264 | + jQuery( this ).css( "display", "none" ); |
| 265 | + } ); |
| 266 | + } ); |
| 267 | + |
| 268 | + jQuery( treeid ).css("visibility","visible"); |
| 269 | + jQuery( treeid + ">ul" ).css( "display", "inline" ).fadeTo( 400, 1 ); |
| 270 | + |
| 271 | + }); |
| 272 | +} |
\ No newline at end of file |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/libs/menuselect.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 273 | + native |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/libs/datetimepicker.js |
— | — | @@ -0,0 +1,37 @@ |
| 2 | +/** |
| 3 | + * Javascript code to be used with input type datepicker. |
| 4 | + * |
| 5 | + * @author Stephan Gambke |
| 6 | + * |
| 7 | + */ |
| 8 | + |
| 9 | + |
| 10 | +function SFI_DTP_init ( input_id, params ) { |
| 11 | + |
| 12 | + var dp = jQuery( "#" + input_id + "_dp_show"); // datepicker element |
| 13 | + var tp = jQuery( "#" + input_id + "_tp_show"); // timepicker element |
| 14 | + |
| 15 | + jQuery( "#" + input_id + "_dp_show, #" + input_id + "_tp_show" ).change (function(){ |
| 16 | + jQuery( "#" + input_id ).attr("value", |
| 17 | + jQuery.datepicker.formatDate( dp.datepicker("option", "altFormat"), dp.datepicker("getDate"), null ) + |
| 18 | + " " + tp.attr( "value" ) |
| 19 | + ); |
| 20 | + }) |
| 21 | + |
| 22 | + if ( params.resetButtonImage ) { |
| 23 | + |
| 24 | + if ( params.disabled ) { |
| 25 | + // append inert reset button if image is set |
| 26 | + tp.parent().append('<button type="button" class="ui-datetimepicker-trigger' + params.userClasses + '" disabled><img src="' + params.resetButtonImage + '" alt="..." title="..."></button>'); |
| 27 | + } else { |
| 28 | + var resetbutton = jQuery('<button type="button" class="ui-datetimepicker-trigger ' + params.userClasses + '" ><img src="' + params.resetButtonImage + '" alt="..." title="..."></button>'); |
| 29 | + tp.parent().append(resetbutton); |
| 30 | + resetbutton.click(function(){ |
| 31 | + dp.datepicker( "setDate", null); |
| 32 | + tp.attr( "value", "" ); |
| 33 | + jQuery( "#" + input_id ).attr( "value", "" ); |
| 34 | + }) |
| 35 | + } |
| 36 | + } |
| 37 | + |
| 38 | +} |
\ No newline at end of file |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/libs/datetimepicker.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 39 | + native |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/libs/regexp.js |
— | — | @@ -0,0 +1,30 @@ |
| 2 | +/** |
| 3 | + * Javascript code to be used with input type regexp. |
| 4 | + * |
| 5 | + * @author Stephan Gambke |
| 6 | + * |
| 7 | + */ |
| 8 | + |
| 9 | +/** |
| 10 | + * Validates inputs of type regexp. |
| 11 | + * |
| 12 | + * @param input_id (String) the id string of the input to check |
| 13 | + * @param params (Object) the parameter object for the check, contains |
| 14 | + * retext: (String) regular expression the input's value has to match |
| 15 | + * inverse: (Boolean) if the check result shall be inverted |
| 16 | + * message: (String) the message too be printed if the input's value does not match |
| 17 | + * @return (Boolean) true, if the input's value matches the regular expression in |
| 18 | + * retext, false otherwise; the value is inverted if inverse is true |
| 19 | + */ |
| 20 | +function SFI_RE_validate ( input_id, params ) { //input_number, retext, inverse, message, multiple |
| 21 | + |
| 22 | + var re = new RegExp( jQuery( "<div/>" ).html( params.retext ).text() ); |
| 23 | + var match = re.test( jQuery('#' + input_id).attr("value") ); |
| 24 | + |
| 25 | + if ( ( match && ! params.inverse ) || ( ! match && params.inverse ) ) { |
| 26 | + return true; |
| 27 | + } else { |
| 28 | + jQuery( '#' + input_id ).parent().addErrorMessage(params.message); |
| 29 | + return false; |
| 30 | + } |
| 31 | +} |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/libs/regexp.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 32 | + native |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/libs/datepicker.js |
— | — | @@ -0,0 +1,192 @@ |
| 2 | +/** |
| 3 | + * Javascript code to be used with input type datepicker. |
| 4 | + * |
| 5 | + * @author Stephan Gambke |
| 6 | + * |
| 7 | + */ |
| 8 | + |
| 9 | +function SFI_DP_init ( input_id, params ) { |
| 10 | + |
| 11 | + var input = jQuery("#" + input_id); |
| 12 | + var re = /\d{4}\/\d{2}\/\d{2}/ |
| 13 | + |
| 14 | + if ( params.disabled ) { |
| 15 | + |
| 16 | + // append inert reset button if image is set |
| 17 | + if ( params.resetButtonImage && ! params.partOfDTP ) { |
| 18 | + input.after('<button type="button" class="ui-datepicker-trigger' + params.userClasses + '" disabled><img src="' + params.resetButtonImage + '" alt="..." title="..."></button>'); |
| 19 | + } |
| 20 | + |
| 21 | + // append inert datepicker button |
| 22 | + input.after('<button type="button" class="ui-datepicker-trigger' + params.userClasses + '" disabled><img src="' + params.buttonImage + '" alt="..." title="..."></button>'); |
| 23 | + |
| 24 | + // set value for input fields |
| 25 | + try { |
| 26 | + if ( ! re.test( params.currValue ) ) { |
| 27 | + throw "Wrong date format!"; |
| 28 | + } |
| 29 | + input.attr( "value", jQuery.datepicker.formatDate(params.dateFormat, jQuery.datepicker.parseDate( "yy/mm/dd", params.currValue, null ), null ) ); |
| 30 | + |
| 31 | + } catch (e) { |
| 32 | + input.attr( "value", params.currValue ); |
| 33 | + } |
| 34 | + } else { |
| 35 | + |
| 36 | + // append reset button if image is set |
| 37 | + if ( params.resetButtonImage && ! params.partOfDTP ) { |
| 38 | + var resetbutton = jQuery('<button type="button" class="ui-datepicker-trigger ' + params.userClasses + '" ><img src="' + params.resetButtonImage + '" alt="..." title="..."></button>'); |
| 39 | + input.after(resetbutton); |
| 40 | + resetbutton.click(function(){ |
| 41 | + input.datepicker( "setDate", null); |
| 42 | + }) |
| 43 | + } |
| 44 | + |
| 45 | + input.datepicker( { |
| 46 | + "showOn": "both", |
| 47 | + "buttonImage": params.buttonImage, |
| 48 | + "buttonImageOnly": false, |
| 49 | + "changeMonth": true, |
| 50 | + "changeYear": true, |
| 51 | + "altFormat": "yy/mm/dd", |
| 52 | + // Today button does not work (http://dev.jqueryui.com/ticket/4045) |
| 53 | + // do not show button panel for now |
| 54 | + // TODO: show date picker button panel when bug is fixed |
| 55 | + "showButtonPanel": false, |
| 56 | + "firstDay": params.firstDay, |
| 57 | + "showWeek": params.showWeek, |
| 58 | + "dateFormat": params.dateFormat, |
| 59 | + "beforeShowDay": function (date) {return SFI_DP_checkDate("#" + input_id, date);} |
| 60 | + } ); |
| 61 | + |
| 62 | + if ( ! params.partOfDTP ) { |
| 63 | + input.datepicker( "option", "altField", "#" + input_id.replace( "_dp_show", "" ) ); |
| 64 | + } |
| 65 | + |
| 66 | + if ( params.minDate ) { |
| 67 | + input.datepicker( "option", "minDate", |
| 68 | + jQuery.datepicker.parseDate("yy/mm/dd", params.minDate, null) ); |
| 69 | + } |
| 70 | + |
| 71 | + if ( params.maxDate ) { |
| 72 | + input.datepicker( "option", "maxDate", |
| 73 | + jQuery.datepicker.parseDate("yy/mm/dd", params.maxDate, null) ); |
| 74 | + } |
| 75 | + |
| 76 | + if ( params.userClasses ) { |
| 77 | + input.datepicker("widget").addClass( params.userClasses ); |
| 78 | + jQuery("#" + input_id + " + button").addClass( params.userClasses ); |
| 79 | + } |
| 80 | + |
| 81 | + if ( params.disabledDates ) { |
| 82 | + |
| 83 | + var disabledDates = new Array(); |
| 84 | + |
| 85 | + for (i in params.disabledDates) |
| 86 | + disabledDates.push([ |
| 87 | + new Date(params.disabledDates[i][0], params.disabledDates[i][1], params.disabledDates[i][2]), |
| 88 | + new Date(params.disabledDates[i][3], params.disabledDates[i][4], params.disabledDates[i][5]) |
| 89 | + ]); |
| 90 | + |
| 91 | + input.datepicker("option", "disabledDates", disabledDates); |
| 92 | + |
| 93 | + delete disabledDates; |
| 94 | + } |
| 95 | + |
| 96 | + if ( params.highlightedDates ) { |
| 97 | + |
| 98 | + var highlightedDates = new Array(); |
| 99 | + |
| 100 | + for (i in params.highlightedDates) |
| 101 | + highlightedDates.push([ |
| 102 | + new Date(params.highlightedDates[i][0], params.highlightedDates[i][1], params.highlightedDates[i][2]), |
| 103 | + new Date(params.highlightedDates[i][3], params.highlightedDates[i][4], params.highlightedDates[i][5]) |
| 104 | + ]); |
| 105 | + |
| 106 | + input.datepicker("option", "highlightedDates", highlightedDates); |
| 107 | + |
| 108 | + delete highlightedDates; |
| 109 | + } |
| 110 | + |
| 111 | + if (params.disabledDays) { |
| 112 | + input.datepicker("option", "disabledDays", params.disabledDays); |
| 113 | + } |
| 114 | + |
| 115 | + if (params.highlightedDays) { |
| 116 | + input.datepicker("option", "highlightedDays", params.highlightedDays); |
| 117 | + } |
| 118 | + |
| 119 | + try { |
| 120 | + if ( ! re.test( params.currValue ) ) { |
| 121 | + throw "Wrong date format!"; |
| 122 | + } |
| 123 | + input.datepicker( "setDate", jQuery.datepicker.parseDate( "yy/mm/dd", params.currValue, null ) ); |
| 124 | + |
| 125 | + } catch (e) { |
| 126 | + input.attr( "value", params.currValue ); |
| 127 | + jQuery( "#" + input_id.replace( "_dp_show", "" )).attr( "value", params.currValue ); |
| 128 | + } |
| 129 | + |
| 130 | + // delete date when user deletes input field |
| 131 | + input.change(function() { |
| 132 | + |
| 133 | + if ( this.value == "" ) { |
| 134 | + input.datepicker( "setDate", null ); |
| 135 | + } |
| 136 | + |
| 137 | + }); |
| 138 | + } |
| 139 | +} |
| 140 | + |
| 141 | +/** |
| 142 | + * Checks a date if it is to be enabled or highlighted |
| 143 | + * |
| 144 | + * This function is a callback function given to the jQuery datepicker to be |
| 145 | + * called for every date before it is displayed. |
| 146 | + * |
| 147 | + * @param input the input the datepicker works on |
| 148 | + * @param date the date object that is to be displayed |
| 149 | + * @return Array(Boolean enabled, Boolean highlighted, "") determining the style and behaviour |
| 150 | + */ |
| 151 | +function SFI_DP_checkDate( input, date ) { |
| 152 | + |
| 153 | + var enable = true |
| 154 | + |
| 155 | + var disabledDates = jQuery( input ).datepicker( "option", "disabledDates" ); |
| 156 | + |
| 157 | + if ( disabledDates ) { |
| 158 | + for ( i = 0; i < disabledDates.length; ++i ) { |
| 159 | + if ( (date >= disabledDates[i][0] ) && ( date <= disabledDates[i][1] ) ) { |
| 160 | + enable = false; |
| 161 | + break; |
| 162 | + } |
| 163 | + } |
| 164 | + } |
| 165 | + |
| 166 | + var disabledDays = jQuery( input ).datepicker( "option", "disabledDays" ); |
| 167 | + |
| 168 | + if ( disabledDays ) { |
| 169 | + enable = enable && !disabledDays[ date.getDay() ]; |
| 170 | + } |
| 171 | + |
| 172 | + var highlightedDates = jQuery( input ).datepicker( "option", "highlightedDates" ); |
| 173 | + var highlight = ""; |
| 174 | + |
| 175 | + if ( highlightedDates ) { |
| 176 | + for ( var i = 0; i < highlightedDates.length; ++i ) { |
| 177 | + if ( ( date >= highlightedDates[i][0] ) && ( date <= highlightedDates[i][1] ) ) { |
| 178 | + highlight = "ui-state-highlight"; |
| 179 | + break; |
| 180 | + } |
| 181 | + } |
| 182 | + } |
| 183 | + |
| 184 | + var highlightedDays = jQuery( input ).datepicker( "option", "highlightedDays" ); |
| 185 | + |
| 186 | + if ( highlightedDays ) { |
| 187 | + if ( highlightedDays[ date.getDay() ] ) { |
| 188 | + highlight = "ui-state-highlight"; |
| 189 | + } |
| 190 | + } |
| 191 | + |
| 192 | + return [ enable, highlight, "" ]; |
| 193 | +} |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/libs/datepicker.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 194 | + native |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/libs/timepicker.js |
— | — | @@ -0,0 +1,178 @@ |
| 2 | +/** |
| 3 | + * Javascript code to be used with input type timepicker. |
| 4 | + * |
| 5 | + * @author Stephan Gambke |
| 6 | + * |
| 7 | + */ |
| 8 | + |
| 9 | +/** |
| 10 | + * Initializes a timepicker input |
| 11 | + * |
| 12 | + * @param inputID (String) the id of the input to initialize |
| 13 | + * @param params (Object) the parameter object for the timepicker, contains |
| 14 | + * minTime: (String) the minimum time to be shown (format hh:mm) |
| 15 | + * maxTime: (String) the maximum time to be shown (format hh:mm) |
| 16 | + * interval: (String) the interval between selectable times in minutes |
| 17 | + * format: (String) a format string (unused) (do we even need it?) |
| 18 | + * |
| 19 | + */ |
| 20 | +function SFI_TP_init( inputIDshow, params ) { // minTime, maxTime, interval, format |
| 21 | + |
| 22 | + var inputID = inputIDshow.replace( "_tp_show", "" ); |
| 23 | + |
| 24 | + // sanitize inputs |
| 25 | + var re = /^\d+:\d\d$/; |
| 26 | + var minh = 0; |
| 27 | + var minm = 0; |
| 28 | + |
| 29 | + var maxh = 23; |
| 30 | + var maxm = 59; |
| 31 | + |
| 32 | + if ( re.test( params.minTime ) ) { |
| 33 | + |
| 34 | + var min = params.minTime.split( ':', 2 ); |
| 35 | + minh = Number( min[0] ); |
| 36 | + minm = Number( min[1] ); |
| 37 | + |
| 38 | + if ( minm > 59 ) minm = 59; |
| 39 | + } |
| 40 | + |
| 41 | + if ( re.test( params.maxTime ) ) { |
| 42 | + |
| 43 | + var max = params.maxTime.split( ':', 2 ); |
| 44 | + maxh = Number( max[0] ); |
| 45 | + maxm = Number( max[1] ); |
| 46 | + |
| 47 | + if ( maxm > 59 ) maxm = 59; |
| 48 | + } |
| 49 | + |
| 50 | + var interv = Number( params.interval ); |
| 51 | + |
| 52 | + if ( interv < 1 ) interv = 1; |
| 53 | + else if ( interv > 60 ) interv = 60; |
| 54 | + |
| 55 | + // build html structure |
| 56 | + var sp = jQuery( "<span class='SFI_timepicker' id='" + inputID + "_tree' ></span>" ).insertBefore( "#" + inputIDshow ); |
| 57 | + |
| 58 | + var ulh = jQuery( "<ul>" ).appendTo( sp ); |
| 59 | + |
| 60 | + |
| 61 | + for ( var h = minh; h <= maxh; ++h ) { |
| 62 | + |
| 63 | + var lih = jQuery( "<li class='ui-state-default'>" + ( ( h < 10 ) ? "0" : "" ) + h + "</li>" ).appendTo( ulh ); |
| 64 | + |
| 65 | + //TODO: Replace value for "show" by formatted string |
| 66 | + lih |
| 67 | + .data( "value", ( ( h < 10 ) ? "0" : "" ) + h + ":00" ) |
| 68 | + .data( "show", ( ( h < 10 ) ?"0" : "" ) + h + ":00" ); |
| 69 | + |
| 70 | + var ulm = jQuery( "<ul>" ).appendTo( lih ); |
| 71 | + |
| 72 | + for ( var m = ( (h == minh) ? minm : 0 ) ; m <= ( (h == maxh) ? maxm : 59 ); m += interv ) { |
| 73 | + |
| 74 | + var lim = jQuery( "<li class='ui-state-default'>" + ( ( m < 10 ) ? "0" : "" ) + m + "</li>" ).appendTo( ulm ); |
| 75 | + |
| 76 | + //TODO: Replace value for "show" by formatted string |
| 77 | + lim |
| 78 | + .data( "value", ( ( h < 10 ) ? "0" : "" ) + h + ":" + ( ( m < 10 ) ? "0" : "") + m ) |
| 79 | + .data( "show", ( ( h < 10 ) ? "0" : "") + h + ":" + ( ( m < 10 ) ? "0" : "" ) + m ); |
| 80 | + |
| 81 | + } |
| 82 | + |
| 83 | + } |
| 84 | + |
| 85 | + // initially hide everything |
| 86 | + jQuery("#" + inputID + "_tree ul") |
| 87 | + .hide(); |
| 88 | + |
| 89 | + // attach event handlers |
| 90 | + jQuery("#" + inputID + "_tree li") // hours |
| 91 | + .mouseover(function(evt){ |
| 92 | + |
| 93 | + // clear any timeout that may still run on the last list item |
| 94 | + clearTimeout(jQuery(evt.currentTarget).data("timeout")); |
| 95 | + |
| 96 | + jQuery(evt.currentTarget) |
| 97 | + |
| 98 | + // switch classes to change display style |
| 99 | + .removeClass("ui-state-default") |
| 100 | + .addClass("ui-state-hover") |
| 101 | + |
| 102 | + // set timeout to show minutes for selected hour |
| 103 | + .data("timeout", setTimeout( |
| 104 | + function(){ |
| 105 | + //console.log("mouseover timer " + jQuery(evt.currentTarget).text()); |
| 106 | + jQuery(evt.currentTarget).children().fadeIn(); |
| 107 | + },400)); |
| 108 | + |
| 109 | + }); |
| 110 | + |
| 111 | + jQuery("#" + inputID + "_tree li") // hours |
| 112 | + .mouseout(function(evt){ |
| 113 | + |
| 114 | + // clear any timeout that may still run on this jQuery list item |
| 115 | + clearTimeout(jQuery(evt.currentTarget).data("timeout")); |
| 116 | + |
| 117 | + jQuery(evt.currentTarget) |
| 118 | + |
| 119 | + // switch classes to change display style |
| 120 | + .removeClass("ui-state-hover") |
| 121 | + .addClass("ui-state-default") |
| 122 | + |
| 123 | + // hide minutes after a short pause |
| 124 | + .data("timeout", setTimeout( |
| 125 | + function(){ |
| 126 | + //console.log("mouseout timer " + jQuery(evt.currentTarget).text()); |
| 127 | + jQuery(evt.currentTarget).children().fadeOut(); |
| 128 | + },400)); |
| 129 | + |
| 130 | + }); |
| 131 | + |
| 132 | + jQuery("#" + inputID + "_tree li") // hours, minutes |
| 133 | + .mousedown(function(evt){ |
| 134 | + // set values and leave input |
| 135 | + jQuery("#" + inputIDshow ).attr("value", jQuery(this).data("show")).blur().change(); |
| 136 | + //jQuery("#" + inputID ).attr("value", jQuery(this).data("value")); |
| 137 | + |
| 138 | + // clear any timeout that may still run on this jQuery list item |
| 139 | + clearTimeout(jQuery(evt.currentTarget).data("timeout")); |
| 140 | + |
| 141 | + jQuery(evt.currentTarget) |
| 142 | + |
| 143 | + // switch classes to change display style |
| 144 | + .removeClass("ui-state-hover") |
| 145 | + .addClass("ui-state-default") |
| 146 | + |
| 147 | + // avoid propagation to parent list item (e.g. hours), |
| 148 | + // they would overwrite the input value |
| 149 | + return false; |
| 150 | + }); |
| 151 | + |
| 152 | + // show timepicker when input gets focus |
| 153 | + jQuery("#" + inputIDshow ).focus(function() { |
| 154 | + jQuery("#" + inputID + "_tree>ul").fadeIn(); |
| 155 | + }); |
| 156 | + |
| 157 | + // hide timepicker when input loses focus |
| 158 | + jQuery("#" + inputIDshow ).blur(function() { |
| 159 | + jQuery("#" + inputID + "_tree ul").fadeOut("normal", function() {jQuery(this).hide()}); |
| 160 | + }); |
| 161 | + |
| 162 | + if ( ! params.partOfDTP ) { |
| 163 | + jQuery("#" + inputIDshow).change(function() { |
| 164 | + jQuery("#" + inputID ).attr("value", jQuery(this).attr("value")); |
| 165 | + }); |
| 166 | + } |
| 167 | + |
| 168 | + jQuery("#" + inputID + '_tp_show ~ button[name="button"]' ) |
| 169 | + .attr("id", inputID + "_button") |
| 170 | + .click(function() { |
| 171 | + jQuery("#" + inputIDshow ).focus(); |
| 172 | + }); |
| 173 | + |
| 174 | + jQuery("#" + inputID + '_tp_show ~ button[name="resetbutton"]' ) |
| 175 | + .attr("id", inputID + "_resetbutton") |
| 176 | + .click(function() { |
| 177 | + jQuery("#" + inputIDshow ).attr("value", ""); |
| 178 | + }); |
| 179 | +} |
\ No newline at end of file |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/libs/timepicker.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 180 | + native |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/README |
— | — | @@ -0,0 +1,58 @@ |
| 2 | +Semantic Forms Inputs is an extension to MediaWiki that provides |
| 3 | +additional input types for the Semantic Forms extension. |
| 4 | + |
| 5 | +The Semantic Forms extension allows users to add, edit and query data |
| 6 | +of a Semantic MediaWiki-based wiki using forms. For every form field |
| 7 | +the input type specifies the type of input a field will have in the |
| 8 | +form. Semantic Forms comes with basic input types for all data |
| 9 | +types. This extension -- Semantic Forms Inputs -- aims to collect |
| 10 | +further, visually and/or functionally enhanced input types. |
| 11 | + |
| 12 | +For the full description, see the Semantic Forms Inputs homepage: |
| 13 | +http://www.mediawiki.org/wiki/Extension:Semantic_Forms_Inputs |
| 14 | + |
| 15 | +This software is licensed under the GNU General Public License (GPL). |
| 16 | +See the COPYING file for more information. |
| 17 | + |
| 18 | +== Installation == |
| 19 | + |
| 20 | +Having at least MediaWiki 1.16, Semantic MediaWiki 1.5.4 and Semantic |
| 21 | +Forms 2.0.8 installed is a precondition for the Semantic Forms Inputs |
| 22 | +extension version 0.4 and above; the code will not work without it. |
| 23 | + |
| 24 | +To install Semantic Forms Inputs, create a directory named |
| 25 | +SemanticFormsInputs in the extensions directory of your MediaWiki |
| 26 | +installation and copy the extension's files into it. Then add the |
| 27 | +following line to your LocalSettings.php below the inclusion of the |
| 28 | +Semantic Forms extension: |
| 29 | + |
| 30 | +require_once('extensions/SemanticFormsInputs/SemanticFormsInputs.php'); |
| 31 | + |
| 32 | +== Credits == |
| 33 | + |
| 34 | +Semantic Forms Inputs was written by Stephan Gambke, Sanyam Goyal and |
| 35 | +Yaron Koren. |
| 36 | + |
| 37 | +The 'datepicker' input uses the jQuery and jQuery UI libraries. |
| 38 | +See http://jquery.org/ and http://jqueryui.com/ . |
| 39 | + |
| 40 | +Button icons are derived from the Mini Icons 2 icon set from |
| 41 | +brandspankingnew.net. See |
| 42 | +http://www.brandspankingnew.net/archive/2006/12/hohoho.html |
| 43 | + |
| 44 | + |
| 45 | +== Contact == |
| 46 | + |
| 47 | +Bugs should preferably be reported on the Wikimedia bug tracker: |
| 48 | +http://bugzilla.wikimedia.org/ |
| 49 | + |
| 50 | +Comments, questions and suggestions can be send or posted to: |
| 51 | + |
| 52 | +* the appropriate Semantic MediaWiki mailing list: |
| 53 | + http://lists.sourceforge.net/lists/listinfo/semediawiki-user |
| 54 | + |
| 55 | +* the Semantic Forms Inputs discussion page on mediawiki.org: |
| 56 | + http://www.mediawiki.org/wiki/Extension_talk:Semantic_Forms_Inputs |
| 57 | + |
| 58 | +* the author: |
| 59 | + http://www.mediawiki.org/wiki/Special:EmailUser/F.trott |
Property changes on: tags/extensions/SemanticFormsInputs/REL_0_4_1/README |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 60 | + native |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/SemanticFormsInputs/SemanticFormsInputs.i18n.php |
— | — | @@ -1,490 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Language file for Semantic Forms Inputs |
5 | | - */ |
6 | | - |
7 | | -$messages = array(); |
8 | | - |
9 | | -$messages['en'] = array( |
10 | | - 'semanticformsinputs-desc' => 'Additional input types for [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
11 | | - 'semanticformsinputs-wrongformat' => 'Wrong format.', |
12 | | - 'semanticformsinputs-close' => 'Close', |
13 | | - 'semanticformsinputs-prev' => 'Previous', |
14 | | - 'semanticformsinputs-next' => 'Next', |
15 | | - 'semanticformsinputs-today' => 'Today', |
16 | | - 'semanticformsinputs-dateformatlong' => 'd MM yy', // see http://docs.jquery.com/UI/Datepicker/formatDate |
17 | | - 'semanticformsinputs-dateformatshort' => 'dd/mm/yy', // see http://docs.jquery.com/UI/Datepicker/formatDate |
18 | | - 'semanticformsinputs-firstdayofweek' => '0' // 0 - sunday, 1 - monday... |
19 | | -); |
20 | | - |
21 | | -/** Message documentation (Message documentation) |
22 | | - * @author EugeneZelenko |
23 | | - * @author F.trott |
24 | | - * @author Siebrand |
25 | | - * @author The Evil IP address |
26 | | - */ |
27 | | -$messages['qqq'] = array( |
28 | | - 'semanticformsinputs-desc' => '{{desc}}', |
29 | | - 'semanticformsinputs-close' => '{{Identical|Close}}', |
30 | | - 'semanticformsinputs-prev' => '{{Identical|Previous}}', |
31 | | - 'semanticformsinputs-next' => '{{Identical|Next}}', |
32 | | - 'semanticformsinputs-dateformatlong' => "{{doc-important|This is a machine-readable date format string!| <br>It is used by a function to format a date. It will not be read by a human user. Do not translate each letter literally! Instead insert the date format for your language using the english-based letters. See http://docs.jquery.com/UI/Datepicker/formatDate }} |
33 | | - |
34 | | -{{doc-important|This is an ''optional'' message. Do not translate it, if it would remain unchanged in your language. }}", |
35 | | - 'semanticformsinputs-dateformatshort' => "{{doc-important|This is a machine-readable date format string!| <br>It is used by a function to format a date. It will not be read by a human user. Do not translate each letter literally! Instead insert the date format for your language using the english-based letters. See http://docs.jquery.com/UI/Datepicker/formatDate }} |
36 | | - |
37 | | -{{doc-important|This is an ''optional'' message. Do not translate it, if it would remain unchanged in your language. }}", |
38 | | -); |
39 | | - |
40 | | -/** Afrikaans (Afrikaans) |
41 | | - * @author Naudefj |
42 | | - */ |
43 | | -$messages['af'] = array( |
44 | | - 'semanticformsinputs-desc' => 'Ekstra invoertipes vir [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
45 | | - 'semanticformsinputs-wrongformat' => 'Verkeerde formaat.', |
46 | | - 'semanticformsinputs-close' => 'Sluit', |
47 | | - 'semanticformsinputs-prev' => 'Vorige', |
48 | | - 'semanticformsinputs-next' => 'Volgende', |
49 | | - 'semanticformsinputs-today' => 'Vandag', |
50 | | -); |
51 | | - |
52 | | -/** Aramaic (ܐܪܡܝܐ) |
53 | | - * @author Basharh |
54 | | - */ |
55 | | -$messages['arc'] = array( |
56 | | - 'semanticformsinputs-close' => 'ܣܟܘܪ', |
57 | | - 'semanticformsinputs-prev' => 'ܩܕܡ', |
58 | | - 'semanticformsinputs-next' => 'ܒܬܪ', |
59 | | - 'semanticformsinputs-today' => 'ܝܘܡܢܐ', |
60 | | -); |
61 | | - |
62 | | -/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
63 | | - * @author EugeneZelenko |
64 | | - * @author Jim-by |
65 | | - */ |
66 | | -$messages['be-tarask'] = array( |
67 | | - 'semanticformsinputs-desc' => 'Дадатковыя тыпы ўводу для [http://www.mediawiki.org/wiki/Extension:Semantic_Forms сэмантычных формаў]', |
68 | | - 'semanticformsinputs-wrongformat' => 'Няслушны фармат.', |
69 | | - 'semanticformsinputs-close' => 'Закрыць', |
70 | | - 'semanticformsinputs-prev' => 'Папярэдняе', |
71 | | - 'semanticformsinputs-next' => 'Наступнае', |
72 | | - 'semanticformsinputs-today' => 'Сёньня', |
73 | | -); |
74 | | - |
75 | | -/** Breton (Brezhoneg) |
76 | | - * @author Gwendal |
77 | | - * @author Y-M D |
78 | | - */ |
79 | | -$messages['br'] = array( |
80 | | - 'semanticformsinputs-desc' => 'Doareoù moned ouzhpenn evit [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
81 | | - 'semanticformsinputs-wrongformat' => 'Furmad fall.', |
82 | | - 'semanticformsinputs-close' => 'Serriñ', |
83 | | - 'semanticformsinputs-prev' => 'Kent', |
84 | | - 'semanticformsinputs-next' => "War-lerc'h", |
85 | | - 'semanticformsinputs-today' => 'Hiziv', |
86 | | -); |
87 | | - |
88 | | -/** Bosnian (Bosanski) |
89 | | - * @author CERminator |
90 | | - */ |
91 | | -$messages['bs'] = array( |
92 | | - 'semanticformsinputs-desc' => 'Dodatne vrste unosa za [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantičke forme]', |
93 | | - 'semanticformsinputs-wrongformat' => 'Pogrešan format.', |
94 | | - 'semanticformsinputs-close' => 'Zatvori', |
95 | | - 'semanticformsinputs-prev' => 'Prethodno', |
96 | | - 'semanticformsinputs-next' => 'Slijedeće', |
97 | | - 'semanticformsinputs-today' => 'Danas', |
98 | | -); |
99 | | - |
100 | | -/** Catalan (Català) |
101 | | - * @author Toniher |
102 | | - */ |
103 | | -$messages['ca'] = array( |
104 | | - 'semanticformsinputs-desc' => "Tipus d'entrada addicionals per al [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]", |
105 | | - 'semanticformsinputs-wrongformat' => 'Format incorrecte.', |
106 | | - 'semanticformsinputs-close' => 'Tanca', |
107 | | - 'semanticformsinputs-prev' => 'Anterior', |
108 | | - 'semanticformsinputs-next' => 'Següent', |
109 | | - 'semanticformsinputs-today' => 'Avui', |
110 | | -); |
111 | | - |
112 | | -/** Czech (Česky) */ |
113 | | -$messages['cs'] = array( |
114 | | - 'semanticformsinputs-close' => 'Zavřít', |
115 | | - 'semanticformsinputs-prev' => 'Předchozí', |
116 | | - 'semanticformsinputs-next' => 'Další', |
117 | | -); |
118 | | - |
119 | | -/** German (Deutsch) |
120 | | - * @author Kghbln |
121 | | - */ |
122 | | -$messages['de'] = array( |
123 | | - 'semanticformsinputs-desc' => 'Ermöglicht zusätzliche Eingabearten für [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
124 | | - 'semanticformsinputs-wrongformat' => 'Falsches Format.', |
125 | | - 'semanticformsinputs-close' => 'Schließen', |
126 | | - 'semanticformsinputs-prev' => 'Voriger Monat', |
127 | | - 'semanticformsinputs-next' => 'Nächster Monat', |
128 | | - 'semanticformsinputs-today' => 'Heute', |
129 | | - 'semanticformsinputs-dateformatlong' => 'd. MM yy', |
130 | | - 'semanticformsinputs-dateformatshort' => 'dd.mm.yy', |
131 | | - 'semanticformsinputs-firstdayofweek' => '1', |
132 | | -); |
133 | | - |
134 | | -/** Lower Sorbian (Dolnoserbski) |
135 | | - * @author Michawiki |
136 | | - */ |
137 | | -$messages['dsb'] = array( |
138 | | - 'semanticformsinputs-desc' => 'Pśidatne zapódawańske typy [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
139 | | - 'semanticformsinputs-wrongformat' => 'Wopacny format', |
140 | | - 'semanticformsinputs-close' => 'Zacyniś', |
141 | | - 'semanticformsinputs-prev' => 'Pjerwjejšny', |
142 | | - 'semanticformsinputs-next' => 'Pśiducy', |
143 | | - 'semanticformsinputs-today' => 'Źinsa', |
144 | | -); |
145 | | - |
146 | | -/** Spanish (Español) |
147 | | - * @author Danke7 |
148 | | - * @author Translationista |
149 | | - */ |
150 | | -$messages['es'] = array( |
151 | | - 'semanticformsinputs-desc' => 'Tipos de entrada adicionales para [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formularios Semánticos]', |
152 | | - 'semanticformsinputs-wrongformat' => 'Formato incorrecto.', |
153 | | - 'semanticformsinputs-close' => 'Cerrar', |
154 | | - 'semanticformsinputs-prev' => 'Anterior', |
155 | | - 'semanticformsinputs-next' => 'Siguiente', |
156 | | - 'semanticformsinputs-today' => 'Hoy', |
157 | | -); |
158 | | - |
159 | | -/** French (Français) |
160 | | - * @author F.trott |
161 | | - * @author IAlex |
162 | | - */ |
163 | | -$messages['fr'] = array( |
164 | | - 'semanticformsinputs-desc' => "Types d'entrées additionnelles pour [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formulaires sémantiques]", |
165 | | - 'semanticformsinputs-wrongformat' => 'Format erroné.', |
166 | | - 'semanticformsinputs-close' => 'Fermer', |
167 | | - 'semanticformsinputs-prev' => 'Précédent', |
168 | | - 'semanticformsinputs-next' => 'Suivant', |
169 | | - 'semanticformsinputs-today' => "Aujourd'hui", |
170 | | - 'semanticformsinputs-dateformatshort' => 'dd / mm / yy', |
171 | | - 'semanticformsinputs-firstdayofweek' => '0', |
172 | | -); |
173 | | - |
174 | | -/** Franco-Provençal (Arpetan) |
175 | | - * @author ChrisPtDe |
176 | | - */ |
177 | | -$messages['frp'] = array( |
178 | | - 'semanticformsinputs-wrongformat' => 'Crouyo format.', |
179 | | -); |
180 | | - |
181 | | -/** Galician (Galego) |
182 | | - * @author Toliño |
183 | | - */ |
184 | | -$messages['gl'] = array( |
185 | | - 'semanticformsinputs-desc' => 'Tipos de entrada adicionais para os [http://www.mediawiki.org/wiki/Extension:Semantic_Forms formularios semánticos]', |
186 | | - 'semanticformsinputs-wrongformat' => 'Formato incorrecto.', |
187 | | - 'semanticformsinputs-close' => 'Pechar', |
188 | | - 'semanticformsinputs-prev' => 'Anterior', |
189 | | - 'semanticformsinputs-next' => 'Seguinte', |
190 | | - 'semanticformsinputs-today' => 'Hoxe', |
191 | | -); |
192 | | - |
193 | | -/** Swiss German (Alemannisch) |
194 | | - * @author Als-Holder |
195 | | - */ |
196 | | -$messages['gsw'] = array( |
197 | | - 'semanticformsinputs-desc' => 'Mecht zuesätzligi Arte vu Yygabe megli fir [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
198 | | - 'semanticformsinputs-wrongformat' => 'Falsch Format.', |
199 | | - 'semanticformsinputs-close' => 'Zuemache', |
200 | | - 'semanticformsinputs-prev' => 'Vorigi', |
201 | | - 'semanticformsinputs-next' => 'Negschti', |
202 | | - 'semanticformsinputs-today' => 'Hit', |
203 | | -); |
204 | | - |
205 | | -/** Hebrew (עברית) |
206 | | - * @author YaronSh |
207 | | - */ |
208 | | -$messages['he'] = array( |
209 | | - 'semanticformsinputs-desc' => 'סוגי קלט נוספים עבור [http://www.mediawiki.org/wiki/Extension:Semantic_Forms טפסים סמנטיים]', |
210 | | - 'semanticformsinputs-wrongformat' => 'מבנה שגוי.', |
211 | | - 'semanticformsinputs-close' => 'סגירה', |
212 | | - 'semanticformsinputs-prev' => 'הקודם', |
213 | | - 'semanticformsinputs-next' => 'הבא', |
214 | | - 'semanticformsinputs-today' => 'היום', |
215 | | -); |
216 | | - |
217 | | -/** Upper Sorbian (Hornjoserbsce) |
218 | | - * @author Michawiki |
219 | | - */ |
220 | | -$messages['hsb'] = array( |
221 | | - 'semanticformsinputs-desc' => 'Přidatne zapodawanske typy za [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
222 | | - 'semanticformsinputs-wrongformat' => 'Wopačny format', |
223 | | - 'semanticformsinputs-close' => 'Začinić', |
224 | | - 'semanticformsinputs-prev' => 'Předchadny', |
225 | | - 'semanticformsinputs-next' => 'Přichodny', |
226 | | - 'semanticformsinputs-today' => 'Dźensa', |
227 | | -); |
228 | | - |
229 | | -/** Hungarian (Magyar) |
230 | | - * @author Dani |
231 | | - */ |
232 | | -$messages['hu'] = array( |
233 | | - 'semanticformsinputs-wrongformat' => 'Hibás formátum.', |
234 | | - 'semanticformsinputs-close' => 'Bezárás', |
235 | | - 'semanticformsinputs-prev' => 'Előző', |
236 | | - 'semanticformsinputs-next' => 'Következő', |
237 | | - 'semanticformsinputs-today' => 'Ma', |
238 | | -); |
239 | | - |
240 | | -/** Interlingua (Interlingua) |
241 | | - * @author McDutchie |
242 | | - */ |
243 | | -$messages['ia'] = array( |
244 | | - 'semanticformsinputs-desc' => 'Additional typos de entrata pro [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formularios Semantic]', |
245 | | - 'semanticformsinputs-wrongformat' => 'Formato incorrecte.', |
246 | | - 'semanticformsinputs-close' => 'Clauder', |
247 | | - 'semanticformsinputs-prev' => 'Precedente', |
248 | | - 'semanticformsinputs-next' => 'Sequente', |
249 | | - 'semanticformsinputs-today' => 'Hodie', |
250 | | -); |
251 | | - |
252 | | -/** Indonesian (Bahasa Indonesia) |
253 | | - * @author Farras |
254 | | - * @author IvanLanin |
255 | | - */ |
256 | | -$messages['id'] = array( |
257 | | - 'semanticformsinputs-desc' => 'Jenis masukan tambahan untuk [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
258 | | - 'semanticformsinputs-wrongformat' => 'Format salah.', |
259 | | - 'semanticformsinputs-close' => 'Penutup', |
260 | | - 'semanticformsinputs-prev' => 'Sebelumnya', |
261 | | - 'semanticformsinputs-next' => 'Selanjutnya', |
262 | | - 'semanticformsinputs-today' => 'Hari ini', |
263 | | -); |
264 | | - |
265 | | -/** Japanese (日本語) |
266 | | - * @author Yanajin66 |
267 | | - * @author 青子守歌 |
268 | | - */ |
269 | | -$messages['ja'] = array( |
270 | | - 'semanticformsinputs-desc' => ' [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]のための追加の入力タイプ', |
271 | | - 'semanticformsinputs-wrongformat' => '間違った形式です。', |
272 | | - 'semanticformsinputs-close' => '閉じる', |
273 | | - 'semanticformsinputs-prev' => '前へ', |
274 | | - 'semanticformsinputs-next' => '次へ', |
275 | | - 'semanticformsinputs-today' => '今日', |
276 | | -); |
277 | | - |
278 | | -/** Khmer (ភាសាខ្មែរ) |
279 | | - * @author គីមស៊្រុន |
280 | | - */ |
281 | | -$messages['km'] = array( |
282 | | - 'semanticformsinputs-close' => 'បិទ', |
283 | | - 'semanticformsinputs-prev' => 'មុន', |
284 | | - 'semanticformsinputs-next' => 'ក្រោយ', |
285 | | - 'semanticformsinputs-today' => 'ថ្ងៃនេះ', |
286 | | -); |
287 | | - |
288 | | -/** Kurdish (Latin) (Kurdî (Latin)) |
289 | | - * @author George Animal |
290 | | - */ |
291 | | -$messages['ku-latn'] = array( |
292 | | - 'semanticformsinputs-today' => 'Îro', |
293 | | -); |
294 | | - |
295 | | -/** Luxembourgish (Lëtzebuergesch) |
296 | | - * @author Robby |
297 | | - */ |
298 | | -$messages['lb'] = array( |
299 | | - 'semanticformsinputs-desc' => "Zousätzlech Manéieren fir d'Eraginn fir [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Formulairen]", |
300 | | - 'semanticformsinputs-wrongformat' => 'Falsche Format.', |
301 | | - 'semanticformsinputs-close' => 'Zoumaachen', |
302 | | - 'semanticformsinputs-prev' => 'Vireg', |
303 | | - 'semanticformsinputs-next' => 'Nächst', |
304 | | - 'semanticformsinputs-today' => 'Haut', |
305 | | -); |
306 | | - |
307 | | -/** Macedonian (Македонски) |
308 | | - * @author Bjankuloski06 |
309 | | - * @author F.trott |
310 | | - */ |
311 | | -$messages['mk'] = array( |
312 | | - 'semanticformsinputs-desc' => 'Дополнителни типови на внос за [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Семантички обрасци]', |
313 | | - 'semanticformsinputs-wrongformat' => 'Погрешен формат.', |
314 | | - 'semanticformsinputs-close' => 'Затвори', |
315 | | - 'semanticformsinputs-prev' => 'Претходно', |
316 | | - 'semanticformsinputs-next' => 'Следно', |
317 | | - 'semanticformsinputs-today' => 'Денес', |
318 | | - 'semanticformsinputs-dateformatlong' => 'd MM yy', |
319 | | - 'semanticformsinputs-dateformatshort' => 'dd/mm/yy', |
320 | | -); |
321 | | - |
322 | | -/** Malayalam (മലയാളം) |
323 | | - * @author Praveenp |
324 | | - */ |
325 | | -$messages['ml'] = array( |
326 | | - 'semanticformsinputs-close' => 'അടയ്ക്കുക', |
327 | | - 'semanticformsinputs-prev' => 'മുൻപത്തേത്', |
328 | | - 'semanticformsinputs-next' => 'അടുത്തത്', |
329 | | - 'semanticformsinputs-today' => 'ഇന്ന്', |
330 | | -); |
331 | | - |
332 | | -/** Dutch (Nederlands) |
333 | | - * @author Siebrand |
334 | | - */ |
335 | | -$messages['nl'] = array( |
336 | | - 'semanticformsinputs-desc' => 'Extra invoertypen voor [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
337 | | - 'semanticformsinputs-wrongformat' => 'Onjuiste opmaak.', |
338 | | - 'semanticformsinputs-close' => 'Sluiten', |
339 | | - 'semanticformsinputs-prev' => 'Vorige', |
340 | | - 'semanticformsinputs-next' => 'Volgende', |
341 | | - 'semanticformsinputs-today' => 'Vandaag', |
342 | | -); |
343 | | - |
344 | | -/** Norwegian (bokmål) (Norsk (bokmål)) |
345 | | - * @author Nghtwlkr |
346 | | - */ |
347 | | -$messages['no'] = array( |
348 | | - 'semanticformsinputs-desc' => 'Ekstra inndatatyper for [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms]', |
349 | | - 'semanticformsinputs-wrongformat' => 'Feil format.', |
350 | | - 'semanticformsinputs-close' => 'Lukk', |
351 | | - 'semanticformsinputs-prev' => 'Forrige', |
352 | | - 'semanticformsinputs-next' => 'Neste', |
353 | | - 'semanticformsinputs-today' => 'I dag', |
354 | | -); |
355 | | - |
356 | | -/** Deitsch (Deitsch) |
357 | | - * @author Xqt |
358 | | - */ |
359 | | -$messages['pdc'] = array( |
360 | | - 'semanticformsinputs-next' => 'Neegschte', |
361 | | -); |
362 | | - |
363 | | -/** Pälzisch (Pälzisch) |
364 | | - * @author Xqt |
365 | | - */ |
366 | | -$messages['pfl'] = array( |
367 | | - 'semanticformsinputs-prev' => 'Voriche', |
368 | | - 'semanticformsinputs-next' => 'Negschte', |
369 | | -); |
370 | | - |
371 | | -/** Polish (Polski) |
372 | | - * @author Sp5uhe |
373 | | - */ |
374 | | -$messages['pl'] = array( |
375 | | - 'semanticformsinputs-desc' => 'Dodatkowe typy wejściowe dla [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formularzy Semantycznych]', |
376 | | - 'semanticformsinputs-wrongformat' => 'Niewłaściwy format.', |
377 | | - 'semanticformsinputs-close' => 'Zamknij', |
378 | | - 'semanticformsinputs-prev' => 'Poprzednie', |
379 | | - 'semanticformsinputs-next' => 'Następne', |
380 | | - 'semanticformsinputs-today' => 'Dziś', |
381 | | -); |
382 | | - |
383 | | -/** Piedmontese (Piemontèis) |
384 | | - * @author Borichèt |
385 | | - * @author Dragonòt |
386 | | - */ |
387 | | -$messages['pms'] = array( |
388 | | - 'semanticformsinputs-desc' => "Sòrt d'intrade adissionaj për [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formolari Semàntich]", |
389 | | - 'semanticformsinputs-wrongformat' => 'Formà pa bon.', |
390 | | - 'semanticformsinputs-close' => 'Sara', |
391 | | - 'semanticformsinputs-prev' => 'Prima', |
392 | | - 'semanticformsinputs-next' => 'Apress', |
393 | | - 'semanticformsinputs-today' => 'Ancheuj', |
394 | | -); |
395 | | - |
396 | | -/** Portuguese (Português) |
397 | | - * @author Hamilton Abreu |
398 | | - */ |
399 | | -$messages['pt'] = array( |
400 | | - 'semanticformsinputs-desc' => 'Tipos de entrada adicionais para [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formulários Semânticos]', |
401 | | - 'semanticformsinputs-wrongformat' => 'Formato incorrecto.', |
402 | | - 'semanticformsinputs-close' => 'Fechar', |
403 | | - 'semanticformsinputs-prev' => 'Anterior', |
404 | | - 'semanticformsinputs-next' => 'Seguinte', |
405 | | - 'semanticformsinputs-today' => 'Hoje', |
406 | | -); |
407 | | - |
408 | | -/** Brazilian Portuguese (Português do Brasil) |
409 | | - * @author Giro720 |
410 | | - */ |
411 | | -$messages['pt-br'] = array( |
412 | | - 'semanticformsinputs-desc' => 'Tipos de entrada adicionais para [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Formulários Semânticos]', |
413 | | - 'semanticformsinputs-wrongformat' => 'Formato incorreto.', |
414 | | - 'semanticformsinputs-close' => 'Fechar', |
415 | | - 'semanticformsinputs-prev' => 'Anterior', |
416 | | - 'semanticformsinputs-next' => 'Seguinte', |
417 | | - 'semanticformsinputs-today' => 'Hoje', |
418 | | -); |
419 | | - |
420 | | -/** Tarandíne (Tarandíne) |
421 | | - * @author Joetaras |
422 | | - */ |
423 | | -$messages['roa-tara'] = array( |
424 | | - 'semanticformsinputs-desc' => 'Tipe de input aggiundive pe le [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Module Semandece]', |
425 | | - 'semanticformsinputs-wrongformat' => 'Formate sbagliate', |
426 | | -); |
427 | | - |
428 | | -/** Russian (Русский) |
429 | | - * @author MaxSem |
430 | | - * @author Александр Сигачёв |
431 | | - * @author Сrower |
432 | | - */ |
433 | | -$messages['ru'] = array( |
434 | | - 'semanticformsinputs-desc' => 'Дополнительные входящие типы для [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Семантических Форм]', |
435 | | - 'semanticformsinputs-wrongformat' => 'Неверный формат.', |
436 | | - 'semanticformsinputs-close' => 'Закрыть', |
437 | | - 'semanticformsinputs-prev' => 'Предыдущая', |
438 | | - 'semanticformsinputs-next' => 'Следующая', |
439 | | - 'semanticformsinputs-today' => 'Сегодня', |
440 | | -); |
441 | | - |
442 | | -/** Telugu (తెలుగు) |
443 | | - * @author Veeven |
444 | | - */ |
445 | | -$messages['te'] = array( |
446 | | - 'semanticformsinputs-close' => 'మూసివేయి', |
447 | | - 'semanticformsinputs-prev' => 'గత', |
448 | | - 'semanticformsinputs-next' => 'తదుపరి', |
449 | | - 'semanticformsinputs-today' => 'ఈరోజు', |
450 | | -); |
451 | | - |
452 | | -/** Tagalog (Tagalog) |
453 | | - * @author AnakngAraw |
454 | | - */ |
455 | | -$messages['tl'] = array( |
456 | | - 'semanticformsinputs-desc' => 'Karagdagang mga tipo ng pagpasok para sa [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Anyong Semantiko]', |
457 | | - 'semanticformsinputs-wrongformat' => 'Maling anyo.', |
458 | | - 'semanticformsinputs-close' => 'Isara', |
459 | | - 'semanticformsinputs-prev' => 'Nakaraan', |
460 | | - 'semanticformsinputs-next' => 'Susunod', |
461 | | - 'semanticformsinputs-today' => 'Ngayon', |
462 | | -); |
463 | | - |
464 | | -/** Ukrainian (Українська) |
465 | | - * @author Тест |
466 | | - */ |
467 | | -$messages['uk'] = array( |
468 | | - 'semanticformsinputs-close' => 'Закрити', |
469 | | - 'semanticformsinputs-prev' => 'Попередня', |
470 | | - 'semanticformsinputs-next' => 'Наступна', |
471 | | -); |
472 | | - |
473 | | -/** Simplified Chinese (中文(简体)) */ |
474 | | -$messages['zh-hans'] = array( |
475 | | - 'semanticformsinputs-close' => '关闭', |
476 | | - 'semanticformsinputs-prev' => '向前', |
477 | | - 'semanticformsinputs-next' => '下一个', |
478 | | - 'semanticformsinputs-today' => '今天', |
479 | | -); |
480 | | - |
481 | | -/** Traditional Chinese (中文(繁體)) |
482 | | - * @author Mark85296341 |
483 | | - */ |
484 | | -$messages['zh-hant'] = array( |
485 | | - 'semanticformsinputs-wrongformat' => '格式不正確。', |
486 | | - 'semanticformsinputs-close' => '關閉', |
487 | | - 'semanticformsinputs-prev' => '上一個', |
488 | | - 'semanticformsinputs-next' => '下一個', |
489 | | - 'semanticformsinputs-today' => '今天', |
490 | | -); |
491 | | - |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/SemanticFormsInputs/SemanticFormsInputs.php |
— | — | @@ -1,82 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Additional input types for [http://www.mediawiki.org/wiki/Extension:SemanticForms Semantic Forms]. |
5 | | - * |
6 | | - * @author Stephan Gambke |
7 | | - * @author Sanyam Goyal |
8 | | - * @version 0.4.1 |
9 | | - */ |
10 | | - |
11 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
12 | | - die( 'This file is a MediaWiki extension, it is not a valid entry point.' ); |
13 | | -} |
14 | | - |
15 | | -if ( !defined( 'SF_VERSION' ) ) { |
16 | | - die( 'This is a Semantic Forms extension. You need to install Semantic Forms first.' ); |
17 | | -} |
18 | | - |
19 | | -define( 'SFI_VERSION', '0.4.1' ); |
20 | | - |
21 | | -// create and initialize settings |
22 | | -$sfigSettings = new SFISettings(); |
23 | | - |
24 | | -// register extension |
25 | | -$wgExtensionCredits[defined( 'SEMANTIC_EXTENSION_TYPE' ) ? 'semantic' : 'other'][] = array( |
26 | | - 'path' => __FILE__, |
27 | | - 'name' => 'Semantic Forms Inputs', |
28 | | - 'author' => array( '[http://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]', 'Sanyam Goyal', 'Yaron Koren' ), |
29 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:Semantic_Forms_Inputs', |
30 | | - 'descriptionmsg' => 'semanticformsinputs-desc', |
31 | | - 'version' => SFI_VERSION, |
32 | | -); |
33 | | - |
34 | | -$dir = dirname( __FILE__ ); |
35 | | - |
36 | | -// load user settings |
37 | | -require_once( $dir . '/SFI_Settings.php' ); |
38 | | - |
39 | | -$wgExtensionMessagesFiles['SemanticFormsInputs'] = $dir . '/SemanticFormsInputs.i18n.php'; |
40 | | -$wgExtensionFunctions[] = "wfSFISetup"; |
41 | | -$wgAutoloadClasses['SFIInputs'] = $dir . '/SFI_Inputs.php'; |
42 | | - |
43 | | -/* |
44 | | - * Class to encapsulate all settings |
45 | | - */ |
46 | | -class SFISettings { |
47 | | - // general settings |
48 | | - public $scriptPath; |
49 | | - //public $yuiBase; |
50 | | - |
51 | | - // settings for input type datepicker |
52 | | - public $datePickerFirstDate; |
53 | | - public $datePickerLastDate; |
54 | | - public $datePickerDateFormat; |
55 | | - public $datePickerWeekStart; |
56 | | - public $datePickerShowWeekNumbers; |
57 | | - public $datePickerDisableInputField; |
58 | | - public $datePickerShowResetButton; |
59 | | - public $datePickerDisabledDaysOfWeek; |
60 | | - public $datePickerHighlightedDaysOfWeek; |
61 | | - public $datePickerDisabledDates; |
62 | | - public $datePickerHighlightedDates; |
63 | | - public $datePickerMonthNames; |
64 | | - public $datePickerDayNames; |
65 | | -} |
66 | | - |
67 | | -/* |
68 | | - * Registers the input types with Semantic Forms. |
69 | | - */ |
70 | | -function wfSFISetup() { |
71 | | - global $sfgFormPrinter, $wgOut; |
72 | | - |
73 | | - $sfgFormPrinter->setInputTypeHook( 'regexp', array( 'SFIInputs', 'regexpHTML' ), array() ); |
74 | | - $sfgFormPrinter->setInputTypeHook( 'datepicker', array( 'SFIInputs', 'jqDatePickerHTML' ), array() ); |
75 | | - $sfgFormPrinter->setInputTypeHook( 'simpledatepicker', array( 'SFIInputs', 'jqDatePickerHTML' ), array() ); |
76 | | - $sfgFormPrinter->setInputTypeHook( 'timepicker', array( 'SFIInputs', 'timepickerHTML' ), array() ); |
77 | | - $sfgFormPrinter->setInputTypeHook( 'datetimepicker', array( 'SFIInputs', 'datetimepickerHTML' ), array() ); |
78 | | -// $sfgFormPrinter->setInputTypeHook( 'wysiwyg', array( 'SFIInputs', 'wysiwygHTML' ), array() ); |
79 | | - $sfgFormPrinter->setInputTypeHook( 'menuselect', array( 'SFIInputs', 'menuselectHTML' ), array() ); |
80 | | - |
81 | | - // TODO: obsolete as of MW 1.16, remove around 1.18 or so |
82 | | - wfLoadExtensionMessages( 'SemanticFormsInputs' ); |
83 | | -} |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/SemanticFormsInputs/SFI_Settings.php |
— | — | @@ -1,155 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Settings for the Semantic Forms Inputs extension. |
5 | | - * |
6 | | - * @author Stephan Gambke |
7 | | - * |
8 | | - * To change the default settings you can uncomment (or copy) the |
9 | | - * examples here and adjust them to your needs. You may as well |
10 | | - * include them in your LocalSettings.php. |
11 | | - */ |
12 | | - |
13 | | -## |
14 | | -# This is the path to your installation of Semantic Forms Inputs as |
15 | | -# seen from the web. No final slash. |
16 | | -# |
17 | | -$sfigSettings->scriptPath = $wgScriptPath . '/extensions/SemanticFormsInputs'; |
18 | | - |
19 | | -## Date Picker Settings |
20 | | - |
21 | | -## |
22 | | -# This is the first selectable date (format yyyy/mm/dd) |
23 | | -# Sample value: '2005/01/01' |
24 | | -# |
25 | | -$sfigSettings->datePickerFirstDate = null; |
26 | | - |
27 | | -## |
28 | | -# This is the last selectable date (format yyyy/mm/dd) |
29 | | -# Sample value: '2015/31/12' |
30 | | -# |
31 | | -$sfigSettings->datePickerLastDate = null; |
32 | | - |
33 | | -## |
34 | | -# The date format string used for the user input. |
35 | | -# The date sent back to the form is fixed to yyyy/mm/dd |
36 | | -# (that is, yy/mm/dd in the format code below). |
37 | | -# |
38 | | -# The format can be combinations of the following: |
39 | | -# |
40 | | -# d - day of month (no leading zero) |
41 | | -# dd - day of month (two digit) |
42 | | -# o - day of the year (no leading zeros) |
43 | | -# oo - day of the year (three digit) |
44 | | -# D - day name short |
45 | | -# DD - day name long |
46 | | -# m - month of year (no leading zero) |
47 | | -# mm - month of year (two digit) |
48 | | -# M - month name short |
49 | | -# MM - month name long |
50 | | -# y - year (two digit) |
51 | | -# yy - year (four digit) |
52 | | -# @ - Unix timestamp (ms since 01/01/1970) |
53 | | -# ! - Windows ticks (100ns since 01/01/0001) |
54 | | -# '...' - literal text |
55 | | -# '' - single quote |
56 | | -# anything else - literal text |
57 | | -# |
58 | | -# There are also two predefined standard date formats available: |
59 | | -# |
60 | | -# SHORT - short date format localized to the wiki user language |
61 | | -# LONG - long date format localized to the wiki user language |
62 | | -# |
63 | | -$sfigSettings->datePickerDateFormat = 'SHORT'; |
64 | | - |
65 | | -## |
66 | | -# This determines the start of the week in the display. |
67 | | -# Set it to: 0 (Zero) for Sunday, 1 (One) for Monday etc. |
68 | | -# If set to null the day is localized to the wiki user language |
69 | | -# Sample value: 1 |
70 | | -# |
71 | | -$sfigSettings->datePickerWeekStart = null; |
72 | | - |
73 | | -## |
74 | | -# This determines if the number of the week shall be shown. |
75 | | -# |
76 | | -$sfigSettings->datePickerShowWeekNumbers = false; |
77 | | - |
78 | | -## |
79 | | -# This determines if the input field shall be disabled. The user can |
80 | | -# only set the date via the datepicker in this case. |
81 | | -# |
82 | | -$sfigSettings->datePickerDisableInputField = false; |
83 | | - |
84 | | -## |
85 | | -# This determines if a reset button shall be shown. This is the only |
86 | | -# way to erase the input field if it is disabled for direct input. |
87 | | -# |
88 | | -$sfigSettings->datePickerShowResetButton = false; |
89 | | - |
90 | | -## |
91 | | -# This is a string of disabled days of the week, i.e. days the user can not |
92 | | -# pick. The days must be given as comma-separated list of numbers starting |
93 | | -# with 0 for Sunday. |
94 | | -# Sample value: "6,0" |
95 | | -# |
96 | | -$sfigSettings->datePickerDisabledDaysOfWeek = null; |
97 | | - |
98 | | -## |
99 | | -# This is a string of highlighted days of the week. The days must be given as |
100 | | -# comma-separated list of numbers starting with 0 for Sunday. |
101 | | -# Sample value: "6,0" |
102 | | -# |
103 | | -$sfigSettings->datePickerHighlightedDaysOfWeek = null; |
104 | | - |
105 | | -## |
106 | | -# This is a string of disabled dates, i.e. days the user cannot pick. The |
107 | | -# days must be given as comma-separated list of dates or date ranges. The |
108 | | -# format for days is yyyy/mm/dd, for date ranges use yyyy/mm/dd-yyyy/mm/dd. |
109 | | -# Spaces are permissible. |
110 | | -# Sample value: "2010/12/25 - 2011/01/06, 2011/05/01" |
111 | | -# |
112 | | -$sfigSettings->datePickerDisabledDates = null; |
113 | | - |
114 | | -## |
115 | | -# This is a string of highlighted dates. The days must be given as |
116 | | -# comma-separated list of dates or date ranges. The format for days is |
117 | | -# yyyy/mm/dd, for date ranges use yyyy/mm/dd-yyyy/mm/dd. Spaces are |
118 | | -# permissible. |
119 | | -# Sample value: "2010/12/25 - 2011/01/06, 2011/05/01" |
120 | | -# |
121 | | -$sfigSettings->datePickerHighlightedDates = null; |
122 | | - |
123 | | - |
124 | | -## Time Picker Settings |
125 | | - |
126 | | -## |
127 | | -# This is the first selectable time (format hh:mm) |
128 | | -# Sample value: '00:00' |
129 | | -# |
130 | | -$sfigSettings->timePickerMinTime = null; |
131 | | - |
132 | | -## |
133 | | -# This is the last selectable time (format hh:mm) |
134 | | -# Sample value: '24:00' |
135 | | -# |
136 | | -$sfigSettings->timePickerMaxTime = null; |
137 | | - |
138 | | -## |
139 | | -# This determines if the input field shall be disabled. The user can |
140 | | -# only set the time via the timepicker in this case. |
141 | | -# |
142 | | -$sfigSettings->timePickerDisableInputField = false; |
143 | | - |
144 | | -## |
145 | | -# This determines if a reset button shall be shown. This is the only |
146 | | -# way to erase the input field if it is disabled for direct input. |
147 | | -# |
148 | | -$sfigSettings->timePickerShowResetButton = false; |
149 | | - |
150 | | - |
151 | | -## |
152 | | -# This determines if a reset button shall be shown. This is the only |
153 | | -# way to erase the input field if it is disabled for direct input. |
154 | | -# |
155 | | -$sfigSettings->datetimePickerShowResetButton = false; |
156 | | - |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/SemanticFormsInputs/COPYING |
— | — | @@ -1,348 +0,0 @@ |
2 | | -The license text below "----" applies to all files within this distribution, other |
3 | | -than those that are in a directory which contains files named "LICENSE" or |
4 | | -"COPYING", or a subdirectory thereof. For those files, the license text contained in |
5 | | -said file overrides any license information contained in directories of smaller depth. |
6 | | -Alternative licenses are typically used for software that is provided by external |
7 | | -parties, and merely packaged with the Semantic Forms release for convenience. |
8 | | - |
9 | | - GNU GENERAL PUBLIC LICENSE |
10 | | - Version 2, June 1991 |
11 | | - |
12 | | - Copyright (C) 1989, 1991 Free Software Foundation, Inc. |
13 | | - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
14 | | - Everyone is permitted to copy and distribute verbatim copies |
15 | | - of this license document, but changing it is not allowed. |
16 | | - |
17 | | - Preamble |
18 | | - |
19 | | - The licenses for most software are designed to take away your |
20 | | -freedom to share and change it. By contrast, the GNU General Public |
21 | | -License is intended to guarantee your freedom to share and change free |
22 | | -software--to make sure the software is free for all its users. This |
23 | | -General Public License applies to most of the Free Software |
24 | | -Foundation's software and to any other program whose authors commit to |
25 | | -using it. (Some other Free Software Foundation software is covered by |
26 | | -the GNU Library General Public License instead.) You can apply it to |
27 | | -your programs, too. |
28 | | - |
29 | | - When we speak of free software, we are referring to freedom, not |
30 | | -price. Our General Public Licenses are designed to make sure that you |
31 | | -have the freedom to distribute copies of free software (and charge for |
32 | | -this service if you wish), that you receive source code or can get it |
33 | | -if you want it, that you can change the software or use pieces of it |
34 | | -in new free programs; and that you know you can do these things. |
35 | | - |
36 | | - To protect your rights, we need to make restrictions that forbid |
37 | | -anyone to deny you these rights or to ask you to surrender the rights. |
38 | | -These restrictions translate to certain responsibilities for you if you |
39 | | -distribute copies of the software, or if you modify it. |
40 | | - |
41 | | - For example, if you distribute copies of such a program, whether |
42 | | -gratis or for a fee, you must give the recipients all the rights that |
43 | | -you have. You must make sure that they, too, receive or can get the |
44 | | -source code. And you must show them these terms so they know their |
45 | | -rights. |
46 | | - |
47 | | - We protect your rights with two steps: (1) copyright the software, and |
48 | | -(2) offer you this license which gives you legal permission to copy, |
49 | | -distribute and/or modify the software. |
50 | | - |
51 | | - Also, for each author's protection and ours, we want to make certain |
52 | | -that everyone understands that there is no warranty for this free |
53 | | -software. If the software is modified by someone else and passed on, we |
54 | | -want its recipients to know that what they have is not the original, so |
55 | | -that any problems introduced by others will not reflect on the original |
56 | | -authors' reputations. |
57 | | - |
58 | | - Finally, any free program is threatened constantly by software |
59 | | -patents. We wish to avoid the danger that redistributors of a free |
60 | | -program will individually obtain patent licenses, in effect making the |
61 | | -program proprietary. To prevent this, we have made it clear that any |
62 | | -patent must be licensed for everyone's free use or not licensed at all. |
63 | | - |
64 | | - The precise terms and conditions for copying, distribution and |
65 | | -modification follow. |
66 | | - |
67 | | - GNU GENERAL PUBLIC LICENSE |
68 | | - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
69 | | - |
70 | | - 0. This License applies to any program or other work which contains |
71 | | -a notice placed by the copyright holder saying it may be distributed |
72 | | -under the terms of this General Public License. The "Program", below, |
73 | | -refers to any such program or work, and a "work based on the Program" |
74 | | -means either the Program or any derivative work under copyright law: |
75 | | -that is to say, a work containing the Program or a portion of it, |
76 | | -either verbatim or with modifications and/or translated into another |
77 | | -language. (Hereinafter, translation is included without limitation in |
78 | | -the term "modification".) Each licensee is addressed as "you". |
79 | | - |
80 | | -Activities other than copying, distribution and modification are not |
81 | | -covered by this License; they are outside its scope. The act of |
82 | | -running the Program is not restricted, and the output from the Program |
83 | | -is covered only if its contents constitute a work based on the |
84 | | -Program (independent of having been made by running the Program). |
85 | | -Whether that is true depends on what the Program does. |
86 | | - |
87 | | - 1. You may copy and distribute verbatim copies of the Program's |
88 | | -source code as you receive it, in any medium, provided that you |
89 | | -conspicuously and appropriately publish on each copy an appropriate |
90 | | -copyright notice and disclaimer of warranty; keep intact all the |
91 | | -notices that refer to this License and to the absence of any warranty; |
92 | | -and give any other recipients of the Program a copy of this License |
93 | | -along with the Program. |
94 | | - |
95 | | -You may charge a fee for the physical act of transferring a copy, and |
96 | | -you may at your option offer warranty protection in exchange for a fee. |
97 | | - |
98 | | - 2. You may modify your copy or copies of the Program or any portion |
99 | | -of it, thus forming a work based on the Program, and copy and |
100 | | -distribute such modifications or work under the terms of Section 1 |
101 | | -above, provided that you also meet all of these conditions: |
102 | | - |
103 | | - a) You must cause the modified files to carry prominent notices |
104 | | - stating that you changed the files and the date of any change. |
105 | | - |
106 | | - b) You must cause any work that you distribute or publish, that in |
107 | | - whole or in part contains or is derived from the Program or any |
108 | | - part thereof, to be licensed as a whole at no charge to all third |
109 | | - parties under the terms of this License. |
110 | | - |
111 | | - c) If the modified program normally reads commands interactively |
112 | | - when run, you must cause it, when started running for such |
113 | | - interactive use in the most ordinary way, to print or display an |
114 | | - announcement including an appropriate copyright notice and a |
115 | | - notice that there is no warranty (or else, saying that you provide |
116 | | - a warranty) and that users may redistribute the program under |
117 | | - these conditions, and telling the user how to view a copy of this |
118 | | - License. (Exception: if the Program itself is interactive but |
119 | | - does not normally print such an announcement, your work based on |
120 | | - the Program is not required to print an announcement.) |
121 | | - |
122 | | -These requirements apply to the modified work as a whole. If |
123 | | -identifiable sections of that work are not derived from the Program, |
124 | | -and can be reasonably considered independent and separate works in |
125 | | -themselves, then this License, and its terms, do not apply to those |
126 | | -sections when you distribute them as separate works. But when you |
127 | | -distribute the same sections as part of a whole which is a work based |
128 | | -on the Program, the distribution of the whole must be on the terms of |
129 | | -this License, whose permissions for other licensees extend to the |
130 | | -entire whole, and thus to each and every part regardless of who wrote it. |
131 | | - |
132 | | -Thus, it is not the intent of this section to claim rights or contest |
133 | | -your rights to work written entirely by you; rather, the intent is to |
134 | | -exercise the right to control the distribution of derivative or |
135 | | -collective works based on the Program. |
136 | | - |
137 | | -In addition, mere aggregation of another work not based on the Program |
138 | | -with the Program (or with a work based on the Program) on a volume of |
139 | | -a storage or distribution medium does not bring the other work under |
140 | | -the scope of this License. |
141 | | - |
142 | | - 3. You may copy and distribute the Program (or a work based on it, |
143 | | -under Section 2) in object code or executable form under the terms of |
144 | | -Sections 1 and 2 above provided that you also do one of the following: |
145 | | - |
146 | | - a) Accompany it with the complete corresponding machine-readable |
147 | | - source code, which must be distributed under the terms of Sections |
148 | | - 1 and 2 above on a medium customarily used for software interchange; or, |
149 | | - |
150 | | - b) Accompany it with a written offer, valid for at least three |
151 | | - years, to give any third party, for a charge no more than your |
152 | | - cost of physically performing source distribution, a complete |
153 | | - machine-readable copy of the corresponding source code, to be |
154 | | - distributed under the terms of Sections 1 and 2 above on a medium |
155 | | - customarily used for software interchange; or, |
156 | | - |
157 | | - c) Accompany it with the information you received as to the offer |
158 | | - to distribute corresponding source code. (This alternative is |
159 | | - allowed only for noncommercial distribution and only if you |
160 | | - received the program in object code or executable form with such |
161 | | - an offer, in accord with Subsection b above.) |
162 | | - |
163 | | -The source code for a work means the preferred form of the work for |
164 | | -making modifications to it. For an executable work, complete source |
165 | | -code means all the source code for all modules it contains, plus any |
166 | | -associated interface definition files, plus the scripts used to |
167 | | -control compilation and installation of the executable. However, as a |
168 | | -special exception, the source code distributed need not include |
169 | | -anything that is normally distributed (in either source or binary |
170 | | -form) with the major components (compiler, kernel, and so on) of the |
171 | | -operating system on which the executable runs, unless that component |
172 | | -itself accompanies the executable. |
173 | | - |
174 | | -If distribution of executable or object code is made by offering |
175 | | -access to copy from a designated place, then offering equivalent |
176 | | -access to copy the source code from the same place counts as |
177 | | -distribution of the source code, even though third parties are not |
178 | | -compelled to copy the source along with the object code. |
179 | | - |
180 | | - 4. You may not copy, modify, sublicense, or distribute the Program |
181 | | -except as expressly provided under this License. Any attempt |
182 | | -otherwise to copy, modify, sublicense or distribute the Program is |
183 | | -void, and will automatically terminate your rights under this License. |
184 | | -However, parties who have received copies, or rights, from you under |
185 | | -this License will not have their licenses terminated so long as such |
186 | | -parties remain in full compliance. |
187 | | - |
188 | | - 5. You are not required to accept this License, since you have not |
189 | | -signed it. However, nothing else grants you permission to modify or |
190 | | -distribute the Program or its derivative works. These actions are |
191 | | -prohibited by law if you do not accept this License. Therefore, by |
192 | | -modifying or distributing the Program (or any work based on the |
193 | | -Program), you indicate your acceptance of this License to do so, and |
194 | | -all its terms and conditions for copying, distributing or modifying |
195 | | -the Program or works based on it. |
196 | | - |
197 | | - 6. Each time you redistribute the Program (or any work based on the |
198 | | -Program), the recipient automatically receives a license from the |
199 | | -original licensor to copy, distribute or modify the Program subject to |
200 | | -these terms and conditions. You may not impose any further |
201 | | -restrictions on the recipients' exercise of the rights granted herein. |
202 | | -You are not responsible for enforcing compliance by third parties to |
203 | | -this License. |
204 | | - |
205 | | - 7. If, as a consequence of a court judgment or allegation of patent |
206 | | -infringement or for any other reason (not limited to patent issues), |
207 | | -conditions are imposed on you (whether by court order, agreement or |
208 | | -otherwise) that contradict the conditions of this License, they do not |
209 | | -excuse you from the conditions of this License. If you cannot |
210 | | -distribute so as to satisfy simultaneously your obligations under this |
211 | | -License and any other pertinent obligations, then as a consequence you |
212 | | -may not distribute the Program at all. For example, if a patent |
213 | | -license would not permit royalty-free redistribution of the Program by |
214 | | -all those who receive copies directly or indirectly through you, then |
215 | | -the only way you could satisfy both it and this License would be to |
216 | | -refrain entirely from distribution of the Program. |
217 | | - |
218 | | -If any portion of this section is held invalid or unenforceable under |
219 | | -any particular circumstance, the balance of the section is intended to |
220 | | -apply and the section as a whole is intended to apply in other |
221 | | -circumstances. |
222 | | - |
223 | | -It is not the purpose of this section to induce you to infringe any |
224 | | -patents or other property right claims or to contest validity of any |
225 | | -such claims; this section has the sole purpose of protecting the |
226 | | -integrity of the free software distribution system, which is |
227 | | -implemented by public license practices. Many people have made |
228 | | -generous contributions to the wide range of software distributed |
229 | | -through that system in reliance on consistent application of that |
230 | | -system; it is up to the author/donor to decide if he or she is willing |
231 | | -to distribute software through any other system and a licensee cannot |
232 | | -impose that choice. |
233 | | - |
234 | | -This section is intended to make thoroughly clear what is believed to |
235 | | -be a consequence of the rest of this License. |
236 | | - |
237 | | - 8. If the distribution and/or use of the Program is restricted in |
238 | | -certain countries either by patents or by copyrighted interfaces, the |
239 | | -original copyright holder who places the Program under this License |
240 | | -may add an explicit geographical distribution limitation excluding |
241 | | -those countries, so that distribution is permitted only in or among |
242 | | -countries not thus excluded. In such case, this License incorporates |
243 | | -the limitation as if written in the body of this License. |
244 | | - |
245 | | - 9. The Free Software Foundation may publish revised and/or new versions |
246 | | -of the General Public License from time to time. Such new versions will |
247 | | -be similar in spirit to the present version, but may differ in detail to |
248 | | -address new problems or concerns. |
249 | | - |
250 | | -Each version is given a distinguishing version number. If the Program |
251 | | -specifies a version number of this License which applies to it and "any |
252 | | -later version", you have the option of following the terms and conditions |
253 | | -either of that version or of any later version published by the Free |
254 | | -Software Foundation. If the Program does not specify a version number of |
255 | | -this License, you may choose any version ever published by the Free Software |
256 | | -Foundation. |
257 | | - |
258 | | - 10. If you wish to incorporate parts of the Program into other free |
259 | | -programs whose distribution conditions are different, write to the author |
260 | | -to ask for permission. For software which is copyrighted by the Free |
261 | | -Software Foundation, write to the Free Software Foundation; we sometimes |
262 | | -make exceptions for this. Our decision will be guided by the two goals |
263 | | -of preserving the free status of all derivatives of our free software and |
264 | | -of promoting the sharing and reuse of software generally. |
265 | | - |
266 | | - NO WARRANTY |
267 | | - |
268 | | - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
269 | | -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
270 | | -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
271 | | -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
272 | | -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
273 | | -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
274 | | -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
275 | | -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
276 | | -REPAIR OR CORRECTION. |
277 | | - |
278 | | - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
279 | | -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
280 | | -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
281 | | -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
282 | | -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
283 | | -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
284 | | -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
285 | | -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
286 | | -POSSIBILITY OF SUCH DAMAGES. |
287 | | - |
288 | | - END OF TERMS AND CONDITIONS |
289 | | - |
290 | | - How to Apply These Terms to Your New Programs |
291 | | - |
292 | | - If you develop a new program, and you want it to be of the greatest |
293 | | -possible use to the public, the best way to achieve this is to make it |
294 | | -free software which everyone can redistribute and change under these terms. |
295 | | - |
296 | | - To do so, attach the following notices to the program. It is safest |
297 | | -to attach them to the start of each source file to most effectively |
298 | | -convey the exclusion of warranty; and each file should have at least |
299 | | -the "copyright" line and a pointer to where the full notice is found. |
300 | | - |
301 | | - <one line to give the program's name and a brief idea of what it does.> |
302 | | - Copyright (C) <year> <name of author> |
303 | | - |
304 | | - This program is free software; you can redistribute it and/or modify |
305 | | - it under the terms of the GNU General Public License as published by |
306 | | - the Free Software Foundation; either version 2 of the License, or |
307 | | - (at your option) any later version. |
308 | | - |
309 | | - This program is distributed in the hope that it will be useful, |
310 | | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
311 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
312 | | - GNU General Public License for more details. |
313 | | - |
314 | | - You should have received a copy of the GNU General Public License |
315 | | - along with this program; if not, write to the Free Software |
316 | | - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
317 | | - |
318 | | - |
319 | | -Also add information on how to contact you by electronic and paper mail. |
320 | | - |
321 | | -If the program is interactive, make it output a short notice like this |
322 | | -when it starts in an interactive mode: |
323 | | - |
324 | | - Gnomovision version 69, Copyright (C) year name of author |
325 | | - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
326 | | - This is free software, and you are welcome to redistribute it |
327 | | - under certain conditions; type `show c' for details. |
328 | | - |
329 | | -The hypothetical commands `show w' and `show c' should show the appropriate |
330 | | -parts of the General Public License. Of course, the commands you use may |
331 | | -be called something other than `show w' and `show c'; they could even be |
332 | | -mouse-clicks or menu items--whatever suits your program. |
333 | | - |
334 | | -You should also get your employer (if you work as a programmer) or your |
335 | | -school, if any, to sign a "copyright disclaimer" for the program, if |
336 | | -necessary. Here is a sample; alter the names: |
337 | | - |
338 | | - Yoyodyne, Inc., hereby disclaims all copyright interest in the program |
339 | | - `Gnomovision' (which makes passes at compilers) written by James Hacker. |
340 | | - |
341 | | - <signature of Ty Coon>, 1 April 1989 |
342 | | - Ty Coon, President of Vice |
343 | | - |
344 | | -This General Public License does not permit incorporating your program into |
345 | | -proprietary programs. If your program is a subroutine library, you may |
346 | | -consider it more useful to permit linking proprietary applications with the |
347 | | -library. If this is what you want to do, use the GNU Library General |
348 | | -Public License instead of this License. |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/SemanticFormsInputs/SFI_Inputs.php |
— | — | @@ -1,1312 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Input definitions for the Semantic Forms Inputs extension. |
5 | | - * |
6 | | - * @author Stephan Gambke |
7 | | - * @author Sanyam Goyal |
8 | | - * @author Yaron Koren |
9 | | - * |
10 | | - */ |
11 | | - |
12 | | -if ( !defined( 'SFI_VERSION' ) ) { |
13 | | - die( 'This file is part of a MediaWiki extension, it is not a valid entry point.' ); |
14 | | -} |
15 | | - |
16 | | -class SFIInputs { |
17 | | - |
18 | | - /** |
19 | | - * Creates the html text for an input. |
20 | | - * |
21 | | - * Common attributes for input types are set according to the parameters. |
22 | | - * The parameters are the standard parameters set by Semantic Forms' |
23 | | - * InputTypeHook plus some optional. |
24 | | - * |
25 | | - * @param string $cur_value |
26 | | - * @param string $input_name |
27 | | - * @param boolean $is_mandatory |
28 | | - * @param boolean $is_disabled |
29 | | - * @param array $other_args |
30 | | - * @param string $input_id (optional) |
31 | | - * @param int $tabindex (optional) |
32 | | - * @param string $class |
33 | | - * @return string the html text of an input element |
34 | | - */ |
35 | | - static private function textHTML ( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args, $input_id = null, $tabindex = null, $class = "" ) { |
36 | | - |
37 | | - global $sfgFieldNum, $sfgTabIndex; |
38 | | - |
39 | | - // array of attributes to pass to the input field |
40 | | - $attribs = array( |
41 | | - "name" => $input_name, |
42 | | - "class" => $class, |
43 | | - "value" => $cur_value, |
44 | | - "type" => "text" |
45 | | - ); |
46 | | - |
47 | | - // set size attrib |
48 | | - if ( array_key_exists( 'size', $other_args ) ) { |
49 | | - $attribs['size'] = $other_args['size']; |
50 | | - } |
51 | | - |
52 | | - // set maxlength attrib |
53 | | - if ( array_key_exists( 'maxlength', $other_args ) ) { |
54 | | - $attribs['maxlength'] = $other_args['maxlength']; |
55 | | - } |
56 | | - |
57 | | - // modify class attribute for mandatory form fields |
58 | | - if ( $is_mandatory ) { |
59 | | - $attribs["class"] .= ' mandatoryField'; |
60 | | - } |
61 | | - |
62 | | - // add user class(es) to class attribute of input field |
63 | | - if ( array_key_exists( 'class', $other_args ) ) { |
64 | | - $attribs["class"] .= ' ' . $other_args['class']; |
65 | | - } |
66 | | - |
67 | | - // set readonly attrib |
68 | | - if ( $is_disabled ) { |
69 | | - $attribs["readonly"] = "1"; |
70 | | - } |
71 | | - |
72 | | - // if no special input id is specified set the Semantic Forms standard |
73 | | - if ( $input_id == null ) { |
74 | | - $attribs[ 'id' ] = "input_" . $sfgFieldNum; |
75 | | - } else { |
76 | | - $attribs[ 'id' ] = $input_id; |
77 | | - } |
78 | | - |
79 | | - |
80 | | - if ( $tabindex == null ) $attribs[ 'tabindex' ] = $sfgTabIndex; |
81 | | - else $attribs[ 'tabindex' ] = $tabindex; |
82 | | - |
83 | | - // $html = Html::element( "input", $attribs ); |
84 | | - $html = Xml::element( "input", $attribs ); |
85 | | - |
86 | | - return $html; |
87 | | - |
88 | | - } |
89 | | - |
90 | | - /** |
91 | | - * Setup function for input type regexp. |
92 | | - * |
93 | | - * Loads the Javascript code used by all regexp filters. |
94 | | - */ |
95 | | - static private function regexpSetup() { |
96 | | - |
97 | | - global $wgOut; |
98 | | - global $sfigSettings; |
99 | | - |
100 | | - static $hasRun = false; |
101 | | - |
102 | | - if ( !$hasRun ) { |
103 | | - $hasRun = true; |
104 | | - |
105 | | - $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/regexp.js"></script> ' ); |
106 | | - |
107 | | - } |
108 | | - } |
109 | | - |
110 | | - |
111 | | - /** |
112 | | - * Definition of input type "regexp" |
113 | | - * |
114 | | - * Returns the html code to be included in the page and registers the |
115 | | - * input's JS initialisation method |
116 | | - * |
117 | | - * @param string $cur_value current value of this field (which is sometimes null) |
118 | | - * @param string $input_name HTML name that this input should have |
119 | | - * @param boolean $is_mandatory indicates whether this field is mandatory for the user |
120 | | - * @param boolean $is_disabled indicates whether this field is disabled (meaning, the user can't edit) |
121 | | - * @param array $other_args hash representing all the other properties defined for this input in the form definition |
122 | | - * @return string html code of input |
123 | | - */ |
124 | | - static function regexpHTML ( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
125 | | - |
126 | | - global $wgOut; |
127 | | - global $sfgFieldNum; // used for setting various HTML IDs |
128 | | - global $sfgJSValidationCalls; // array of Javascript calls to determine if page can be saved |
129 | | - global $sfgFormPrinter; |
130 | | - |
131 | | - self::regexpSetup(); |
132 | | - |
133 | | - // set base input type |
134 | | - if ( array_key_exists( 'base type', $other_args ) ) { |
135 | | - |
136 | | - $baseType = trim( $other_args['base type'] ); |
137 | | - unset( $other_args['base type'] ); |
138 | | - |
139 | | - // if unknown set default base input type |
140 | | - if ( ! array_key_exists( $baseType, $sfgFormPrinter->mInputTypeHooks ) ) |
141 | | - $baseType = 'text'; |
142 | | - } |
143 | | - else $baseType = 'text'; |
144 | | - |
145 | | - // set base prefix string |
146 | | - if ( array_key_exists( 'base prefix', $other_args ) ) { |
147 | | - $basePrefix = trim( $other_args['base prefix'] ) . "."; |
148 | | - unset( $other_args['base prefix'] ); |
149 | | - } |
150 | | - else $basePrefix = ''; |
151 | | - |
152 | | - // set OR character |
153 | | - if ( array_key_exists( 'or char', $other_args ) ) { |
154 | | - $orChar = trim( $other_args['or char'] ); |
155 | | - unset( $other_args['or char'] ); |
156 | | - } |
157 | | - else $orChar = '!'; |
158 | | - |
159 | | - // set inverse string |
160 | | - if ( array_key_exists( 'inverse', $other_args ) ) { |
161 | | - $inverseString = 'true'; |
162 | | - unset( $other_args['inverse'] ); |
163 | | - } |
164 | | - else $inverseString = 'false'; |
165 | | - |
166 | | - // set regexp string |
167 | | - if ( array_key_exists( 'regexp', $other_args ) ) { |
168 | | - |
169 | | - $regexp = str_replace( $orChar, '|', trim( $other_args['regexp'] ) ); |
170 | | - unset( $other_args['regexp'] ); |
171 | | - |
172 | | - // check for leading/trailing delimiter and remove it (else reset regexp) |
173 | | - if ( preg_match ( "/^\/.*\/\$/", $regexp ) ) { |
174 | | - |
175 | | - $regexp = substr( $regexp, 1, strlen( $regexp ) - 2 ); |
176 | | - |
177 | | - } |
178 | | - else $regexp = '.*'; |
179 | | - |
180 | | - } |
181 | | - else $regexp = '.*'; |
182 | | - |
183 | | - // set failure message string |
184 | | - if ( array_key_exists( 'message', $other_args ) ) { |
185 | | - $message = trim( $other_args['message'] ); |
186 | | - unset( $other_args['message'] ); |
187 | | - } |
188 | | - else $message = wfMsg( 'semanticformsinputs-wrongformat' ); |
189 | | - |
190 | | - // sanitize error message and regexp for JS |
191 | | - $message = Xml::encodeJsVar( $message ); |
192 | | - $regexp = Xml::encodeJsVar( $regexp ); |
193 | | - |
194 | | - // register event to validate regexp on submit/preview |
195 | | - $jstext = <<<JAVASCRIPT |
196 | | -jQuery(function(){ |
197 | | - jQuery('#input_$sfgFieldNum').SemanticForms_registerInputValidation( SFI_RE_validate, {retext: {$regexp}, inverse: {$inverseString}, message: {$message} }); |
198 | | -}); |
199 | | -JAVASCRIPT; |
200 | | - |
201 | | - $wgOut->addInlineScript( $jstext ); |
202 | | - |
203 | | - // create other_args for base input type |
204 | | - $new_other_args = array(); |
205 | | - |
206 | | - foreach ( $other_args as $key => $value ) |
207 | | - if ( $basePrefix && strpos( $key, $basePrefix ) === 0 ) { |
208 | | - $new_other_args[substr( $key, strlen( $basePrefix ) )] = $value; |
209 | | - } else |
210 | | - $new_other_args[$key] = $value; |
211 | | - |
212 | | - // setup parameters for base input type |
213 | | - $funcArgs = array(); |
214 | | - $funcArgs[] = $cur_value; |
215 | | - $funcArgs[] = $input_name; |
216 | | - $funcArgs[] = $is_mandatory; |
217 | | - $funcArgs[] = $is_disabled; |
218 | | - $funcArgs[] = $new_other_args; |
219 | | - |
220 | | - // get the input type hooks for the base input type |
221 | | - $hook_values = $sfgFormPrinter->mInputTypeHooks[$baseType]; |
222 | | - |
223 | | - // generate html and JS code for base input type and return it |
224 | | - return call_user_func_array( $hook_values[0], $funcArgs ); |
225 | | - |
226 | | -} |
227 | | - |
228 | | - |
229 | | - /** |
230 | | - * Setup for input type jqdatepicker. |
231 | | - * |
232 | | - * Adds the Javascript code used by all datepickers. |
233 | | - */ |
234 | | - static private function jqDatePickerSetup () { |
235 | | - global $wgOut, $wgLang, $sfgScriptPath; |
236 | | - global $sfigSettings; |
237 | | - |
238 | | - static $hasRun = false; |
239 | | - |
240 | | - if ( !$hasRun ) { |
241 | | - $hasRun = true; |
242 | | - |
243 | | - $wgOut->addScript( '<script type="text/javascript" src="' . $sfgScriptPath . '/libs/jquery-ui/jquery.ui.datepicker.min.js"></script> ' ); |
244 | | - $wgOut->addExtensionStyle( $sfgScriptPath . '/skins/jquery-ui/base/jquery.ui.datepicker.css' ); |
245 | | - $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/datepicker.js"></script> ' ); |
246 | | - |
247 | | - // set localized messages (use MW i18n, not jQuery i18n) |
248 | | - $jstext = |
249 | | - "jQuery(function(){\n" |
250 | | - . " jQuery.datepicker.regional['wiki'] = {\n" |
251 | | - . " closeText: '" . wfMsg( 'semanticformsinputs-close' ) . "',\n" |
252 | | - . " prevText: '" . wfMsg( 'semanticformsinputs-prev' ) . "',\n" |
253 | | - . " nextText: '" . wfMsg( 'semanticformsinputs-next' ) . "',\n" |
254 | | - . " currentText: '" . wfMsg( 'semanticformsinputs-today' ) . "',\n" |
255 | | - . " monthNames: ['" |
256 | | - . wfMsg( 'january' ) . "','" |
257 | | - . wfMsg( 'february' ) . "','" |
258 | | - . wfMsg( 'march' ) . "','" |
259 | | - . wfMsg( 'april' ) . "','" |
260 | | - . wfMsg( 'may_long' ) . "','" |
261 | | - . wfMsg( 'june' ) . "','" |
262 | | - . wfMsg( 'july' ) . "','" |
263 | | - . wfMsg( 'august' ) . "','" |
264 | | - . wfMsg( 'september' ) . "','" |
265 | | - . wfMsg( 'october' ) . "','" |
266 | | - . wfMsg( 'november' ) . "','" |
267 | | - . wfMsg( 'december' ) . "'],\n" |
268 | | - . " monthNamesShort: ['" |
269 | | - . wfMsg( 'jan' ) . "','" |
270 | | - . wfMsg( 'feb' ) . "','" |
271 | | - . wfMsg( 'mar' ) . "','" |
272 | | - . wfMsg( 'apr' ) . "','" |
273 | | - . wfMsg( 'may' ) . "','" |
274 | | - . wfMsg( 'jun' ) . "','" |
275 | | - . wfMsg( 'jul' ) . "','" |
276 | | - . wfMsg( 'aug' ) . "','" |
277 | | - . wfMsg( 'sep' ) . "','" |
278 | | - . wfMsg( 'oct' ) . "','" |
279 | | - . wfMsg( 'nov' ) . "','" |
280 | | - . wfMsg( 'dec' ) . "'],\n" |
281 | | - . " dayNames: ['" |
282 | | - . wfMsg( 'sunday' ) . "','" |
283 | | - . wfMsg( 'monday' ) . "','" |
284 | | - . wfMsg( 'tuesday' ) . "','" |
285 | | - . wfMsg( 'wednesday' ) . "','" |
286 | | - . wfMsg( 'thursday' ) . "','" |
287 | | - . wfMsg( 'friday' ) . "','" |
288 | | - . wfMsg( 'saturday' ) . "'],\n" |
289 | | - . " dayNamesShort: ['" |
290 | | - . wfMsg( 'sun' ) . "','" |
291 | | - . wfMsg( 'mon' ) . "','" |
292 | | - . wfMsg( 'tue' ) . "','" |
293 | | - . wfMsg( 'wed' ) . "','" |
294 | | - . wfMsg( 'thu' ) . "','" |
295 | | - . wfMsg( 'fri' ) . "','" |
296 | | - . wfMsg( 'sat' ) . "'],\n" |
297 | | - . " dayNamesMin: ['" |
298 | | - . $wgLang->firstChar( wfMsg( 'sun' ) ) . "','" |
299 | | - . $wgLang->firstChar( wfMsg( 'mon' ) ) . "','" |
300 | | - . $wgLang->firstChar( wfMsg( 'tue' ) ) . "','" |
301 | | - . $wgLang->firstChar( wfMsg( 'wed' ) ) . "','" |
302 | | - . $wgLang->firstChar( wfMsg( 'thu' ) ) . "','" |
303 | | - . $wgLang->firstChar( wfMsg( 'fri' ) ) . "','" |
304 | | - . $wgLang->firstChar( wfMsg( 'sat' ) ) . "'],\n" |
305 | | - . " weekHeader: '',\n" |
306 | | - . " dateFormat: '" . wfMsg( 'semanticformsinputs-dateformatshort' ) . "',\n" |
307 | | - . " firstDay: '" . wfMsg( 'semanticformsinputs-firstdayofweek' ) . "',\n" |
308 | | - . " isRTL: " . ( $wgLang->isRTL() ? "true":"false" ) . ",\n" |
309 | | - . " showMonthAfterYear: false,\n" |
310 | | - . " yearSuffix: ''};\n" |
311 | | - . " jQuery.datepicker.setDefaults(jQuery.datepicker.regional['wiki']);\n" |
312 | | - . "});\n"; |
313 | | - |
314 | | - |
315 | | - $wgOut->addInlineScript( $jstext ); |
316 | | - |
317 | | - } |
318 | | - } |
319 | | - |
320 | | - /** |
321 | | - * Sort and merge time ranges in an array |
322 | | - * |
323 | | - * expects an array of arrays |
324 | | - * the inner arrays must contain two dates representing the start and end |
325 | | - * date of a time range |
326 | | - * |
327 | | - * returns an array of arrays with the date ranges sorted and overlapping |
328 | | - * ranges merged |
329 | | - * |
330 | | - * @param array $ranges array of arrays of DateTimes |
331 | | - * @return array of arrays of DateTimes |
332 | | - */ |
333 | | - static private function sortAndMergeRanges ( $ranges ) { |
334 | | - |
335 | | - // sort ranges, earliest date first |
336 | | - sort( $ranges ); |
337 | | - |
338 | | - // stores the start of the current date range |
339 | | - $currmin = FALSE; |
340 | | - |
341 | | - // stores the date the next ranges start date has to top to not overlap |
342 | | - $nextmin = FALSE; |
343 | | - |
344 | | - // result array |
345 | | - $mergedRanges = array(); |
346 | | - |
347 | | - foreach ( $ranges as $range ) { |
348 | | - |
349 | | - // ignore empty date ranges |
350 | | - if ( !$range ) continue; |
351 | | - |
352 | | - if ( !$currmin ) { // found first valid range |
353 | | - |
354 | | - $currmin = $range[0]; |
355 | | - $nextmin = $range[1]; |
356 | | - $nextmin->modify( '+1 day' ); |
357 | | - |
358 | | - } elseif ( $range[0] <= $nextmin ) { // overlap detected |
359 | | - |
360 | | - $currmin = min( $currmin, $range[0] ); |
361 | | - |
362 | | - $range[1]->modify( '+1 day' ); |
363 | | - $nextmin = max( $nextmin, $range[1] ); |
364 | | - |
365 | | - } else { // no overlap, store current range and continue with next |
366 | | - |
367 | | - $nextmin->modify( '-1 day' ); |
368 | | - $mergedRanges[] = array( $currmin, $nextmin ); |
369 | | - |
370 | | - $currmin = $range[0]; |
371 | | - $nextmin = $range[1]; |
372 | | - $nextmin->modify( '+1 day' ); |
373 | | - |
374 | | - } |
375 | | - |
376 | | - } |
377 | | - |
378 | | - // store last range |
379 | | - if ( $currmin ) { |
380 | | - $nextmin->modify( '-1 day' ); |
381 | | - $mergedRanges[] = array( $currmin, $nextmin ); |
382 | | - } |
383 | | - |
384 | | - return $mergedRanges; |
385 | | - |
386 | | - } |
387 | | - |
388 | | - /** |
389 | | - * Creates an array of arrays of dates from an array of strings |
390 | | - * |
391 | | - * expects an array of strings containing dates or date ranges in the format |
392 | | - * "yyyy/mm/dd" or "yyyy/mm/dd-yyyy/mm/dd" |
393 | | - * |
394 | | - * returns an array of arrays, each of the latter consisting of two dates |
395 | | - * representing the start and end date of the range |
396 | | - * |
397 | | - * The result array will contain null values for unparseable date strings |
398 | | - * |
399 | | - * @param array $rangesAsStrings array of strings with dates and date ranges |
400 | | - * @return array of arrays of DateTimes |
401 | | - */ |
402 | | - static private function createRangesArray ( $rangesAsStrings ) { |
403 | | - |
404 | | - // transform array of strings into array of array of dates |
405 | | - // have to use create_function to be PHP pre5.3 compatible |
406 | | - return array_map( create_function( '$range', ' |
407 | | - |
408 | | - if ( strpos ( $range, "-" ) === FALSE ) { // single date |
409 | | - $date = date_create( $range ); |
410 | | - return ( $date ) ? array( $date, clone $date ):null; |
411 | | - } else { // date range |
412 | | - $dates = array_map( "date_create", explode( "-", $range ) ); |
413 | | - return ( $dates[0] && $dates[1] ) ? $dates:null; |
414 | | - } |
415 | | - |
416 | | - ' ), $rangesAsStrings ); |
417 | | - |
418 | | - } |
419 | | - |
420 | | - /** |
421 | | - * Takes an array of date ranges and returns an array containing the gaps |
422 | | - * |
423 | | - * The very first and the very last date of the original string are lost in |
424 | | - * the process, of course, as they do not delimit a gap. This means, after |
425 | | - * repeated inversion the result would eventually be empty. |
426 | | - * |
427 | | - * @param array $ranges of arrays of DateTimes |
428 | | - * @return array of arrays of DateTimes |
429 | | - */ |
430 | | - static private function invertRangesArray( $ranges ) { |
431 | | - |
432 | | - // the result (initially empty) |
433 | | - $invRanges = null; |
434 | | - |
435 | | - // the minimum of the current gap (initially none) |
436 | | - $min = null; |
437 | | - |
438 | | - foreach ( $ranges as $range ) { |
439 | | - |
440 | | - if ( $min ) { // if min date of current gap is known store gap |
441 | | - $min->modify( "+1day " ); |
442 | | - $range[0]->modify( "-1day " ); |
443 | | - $invRanges[] = array( $min, $range[0] ); |
444 | | - } |
445 | | - |
446 | | - $min = $range[1]; // store min date of next gap |
447 | | - |
448 | | - } |
449 | | - |
450 | | - return $invRanges; |
451 | | - } |
452 | | - |
453 | | - |
454 | | - /** |
455 | | - * Definition of input type "datepicker". |
456 | | - * |
457 | | - * Returns the html code to be included in the page and registers the |
458 | | - * input's JS initialisation method |
459 | | - * |
460 | | - * @param string $cur_value current value of this field (which is sometimes null) |
461 | | - * @param string $input_name HTML name that this input should have |
462 | | - * @param boolean $is_mandatory indicates whether this field is mandatory for the user |
463 | | - * @param boolean $is_disabled indicates whether this field is disabled (meaning, the user can't edit) |
464 | | - * @param array $other_args hash representing all the other properties defined for this input in the form definition |
465 | | - * @return string html code of input |
466 | | - */ |
467 | | - static function jqDatePickerHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
468 | | - |
469 | | - global $wgOut, $wgLang, $wgAmericanDates; // MW variables |
470 | | - global $sfgFieldNum, $sfgScriptPath, $sfgTabIndex; // SF variables |
471 | | - global $sfigSettings; // SFI variables |
472 | | - |
473 | | - // call common setup for all jqdatepickers |
474 | | - self::jqDatePickerSetup(); |
475 | | - |
476 | | - // The datepicker is created in three steps: |
477 | | - // first: set up HTML attributes |
478 | | - // second: set up JS attributes |
479 | | - // third: assemble HTML and JS code |
480 | | - |
481 | | - |
482 | | - // first: set up HTML attributes |
483 | | - // nothing much to do here, self::textHTML will take care od the standard stuff |
484 | | - |
485 | | - // store user class(es) for use with buttons |
486 | | - if ( array_key_exists( 'class', $other_args ) ) { |
487 | | - $userClasses = $other_args['class']; |
488 | | - } else $userClasses = ""; |
489 | | - |
490 | | - // should the input field be disabled? |
491 | | - $inputFieldDisabled = |
492 | | - array_key_exists( 'disable input field', $other_args ) |
493 | | - || ( !array_key_exists( 'enable input field', $other_args ) && $sfigSettings->datePickerDisableInputField ) |
494 | | - || $is_disabled ; |
495 | | - |
496 | | - // second: set up JS attributes |
497 | | - |
498 | | - // set up attributes required for both enabled and disabled datepickers |
499 | | - $jsattribs = array( |
500 | | - 'currValue' => $cur_value, |
501 | | - 'disabled' => $is_disabled, |
502 | | - 'userClasses' => $userClasses |
503 | | - ); |
504 | | - |
505 | | - if ( array_key_exists( 'part of dtp', $other_args ) ) { |
506 | | - $jsattribs['partOfDTP'] = $other_args['part of dtp']; |
507 | | - } |
508 | | - |
509 | | - // set date format |
510 | | - // SHORT and LONG are SFI specific acronyms and are translated here |
511 | | - // into format strings, anything else is passed to the jQuery date picker |
512 | | - // Americans need special treatment |
513 | | - if ( $wgAmericanDates && $wgLang->getCode() == "en" ) { |
514 | | - |
515 | | - if ( array_key_exists( 'date format', $other_args ) ) { |
516 | | - |
517 | | - if ( $other_args['date format'] == 'SHORT' ) { |
518 | | - $jsattribs['dateFormat'] = 'mm/dd/yy'; |
519 | | - } elseif ( $other_args['date format'] == 'LONG' ) { |
520 | | - $jsattribs['dateFormat'] = 'MM d, yy'; |
521 | | - } else { |
522 | | - $jsattribs['dateFormat'] = $other_args['date format']; |
523 | | - } |
524 | | - |
525 | | - } elseif ( $sfigSettings->datePickerDateFormat ) { |
526 | | - |
527 | | - if ( $sfigSettings->datePickerDateFormat == 'SHORT' ) { |
528 | | - $jsattribs['dateFormat'] = 'mm/dd/yy'; |
529 | | - } elseif ( $sfigSettings->datePickerDateFormat == 'LONG' ) { |
530 | | - $jsattribs['dateFormat'] = 'MM d, yy'; |
531 | | - } else { |
532 | | - $jsattribs['dateFormat'] = $sfigSettings->datePickerDateFormat; |
533 | | - } |
534 | | - |
535 | | - } else $jsattribs['dateFormat'] = 'yy/mm/dd'; |
536 | | - |
537 | | - } else { |
538 | | - |
539 | | - if ( array_key_exists( 'date format', $other_args ) ) { |
540 | | - |
541 | | - if ( $other_args['date format'] == 'SHORT' ) { |
542 | | - $jsattribs['dateFormat'] = wfMsg( 'semanticformsinputs-dateformatshort' ); |
543 | | - } elseif ( $other_args['date format'] == 'LONG' ) { |
544 | | - $jsattribs['dateFormat'] = wfMsg( 'semanticformsinputs-dateformatlong' ); |
545 | | - } else { |
546 | | - $jsattribs['dateFormat'] = $other_args['date format']; |
547 | | - } |
548 | | - |
549 | | - } elseif ( $sfigSettings->datePickerDateFormat ) { |
550 | | - |
551 | | - if ( $sfigSettings->datePickerDateFormat == 'SHORT' ) { |
552 | | - $jsattribs['dateFormat'] = wfMsg( 'semanticformsinputs-dateformatshort' ); |
553 | | - } elseif ( $sfigSettings->datePickerDateFormat == 'LONG' ) { |
554 | | - $jsattribs['dateFormat'] = wfMsg( 'semanticformsinputs-dateformatlong' ); |
555 | | - } else { |
556 | | - $jsattribs['dateFormat'] = $sfigSettings->datePickerDateFormat; |
557 | | - } |
558 | | - |
559 | | - } else $jsattribs['dateFormat'] = 'yy/mm/dd'; |
560 | | - |
561 | | - } |
562 | | - |
563 | | - // setup attributes required only for either disabled or enabled datepickers |
564 | | - if ( $is_disabled ) { |
565 | | - |
566 | | - $jsattribs['buttonImage'] = $sfigSettings->scriptPath . '/images/DatePickerButtonDisabled.gif'; |
567 | | - |
568 | | - if ( array_key_exists( 'show reset button', $other_args ) || |
569 | | - ( !array_key_exists( 'hide reset button', $other_args ) && $sfigSettings->datePickerShowResetButton ) ) { |
570 | | - |
571 | | - $jsattribs['resetButtonImage'] = $sfigSettings->scriptPath . '/images/DatePickerResetButtonDisabled.gif'; |
572 | | - |
573 | | - } |
574 | | - |
575 | | - } else { |
576 | | - |
577 | | - $jsattribs['buttonImage'] = $sfigSettings->scriptPath . '/images/DatePickerButton.gif'; |
578 | | - |
579 | | - if ( array_key_exists( 'show reset button', $other_args ) || |
580 | | - ( !array_key_exists( 'hide reset button', $other_args ) && $sfigSettings->datePickerShowResetButton ) ) { |
581 | | - |
582 | | - $jsattribs['resetButtonImage'] = $sfigSettings->scriptPath . '/images/DatePickerResetButton.gif'; |
583 | | - |
584 | | - } |
585 | | - |
586 | | - // find min date, max date and disabled dates |
587 | | - |
588 | | - // set first date |
589 | | - if ( array_key_exists( 'first date', $other_args ) ) { |
590 | | - $minDate = date_create( $other_args['first date'] ); |
591 | | - } elseif ( $sfigSettings->datePickerFirstDate ) { |
592 | | - $minDate = date_create( $sfigSettings->datePickerFirstDate ); |
593 | | - } else { |
594 | | - $minDate = null; |
595 | | - } |
596 | | - |
597 | | - // set last date |
598 | | - if ( array_key_exists( 'last date', $other_args ) ) { |
599 | | - $maxDate = date_create( $other_args['last date'] ); |
600 | | - } elseif ( $sfigSettings->datePickerLastDate ) { |
601 | | - $maxDate = date_create( $sfigSettings->datePickerLastDate ); |
602 | | - } else { |
603 | | - $maxDate = null; |
604 | | - } |
605 | | - |
606 | | - // find allowed values and invert them to get disabled values |
607 | | - if ( array_key_exists( 'possible_values', $other_args ) && count( $other_args['possible_values'] ) ) { |
608 | | - |
609 | | - $enabledDates = self::sortAndMergeRanges( self::createRangesArray( $other_args['possible_values'] ) ); |
610 | | - |
611 | | - // correct min/max date to the first/last allowed value |
612 | | - if ( !$minDate || $minDate < $enabledDates[0][0] ) { |
613 | | - $minDate = $enabledDates[0][0]; |
614 | | - } |
615 | | - |
616 | | - if ( !$maxDate || $maxDate > $enabledDates[count( $enabledDates ) - 1][1] ) { |
617 | | - $maxDate = $enabledDates[count( $enabledDates ) - 1][1]; |
618 | | - } |
619 | | - |
620 | | - $disabledDates = self::invertRangesArray( $enabledDates ); |
621 | | - |
622 | | - } else $disabledDates = array(); |
623 | | - |
624 | | - // add user-defined or default disabled values |
625 | | - if ( array_key_exists( 'disable dates', $other_args ) ) { |
626 | | - |
627 | | - $disabledDates = |
628 | | - self::sortAndMergeRanges( |
629 | | - array_merge( $disabledDates, self::createRangesArray( explode( ',' , $other_args['disable dates'] ) ) ) ); |
630 | | - |
631 | | - } elseif ( $sfigSettings->datePickerDisabledDates ) { |
632 | | - |
633 | | - $disabledDates = |
634 | | - self::sortAndMergeRanges( |
635 | | - array_merge( $disabledDates, self::createRangesArray( explode( ',' , $sfigSettings->datePickerDisabledDates ) ) ) ); |
636 | | - |
637 | | - } |
638 | | - |
639 | | - // if a minDate is set, discard all disabled dates below the min date |
640 | | - if ( $minDate ) { |
641 | | - |
642 | | - // discard all ranges of disabled dates that are entirely below the min date |
643 | | - while ( $minDate && count( $disabledDates ) && $disabledDates[0][1] < $minDate ) array_shift( $disabledDates ); |
644 | | - |
645 | | - // if min date is in first disabled date range, discard that range and adjust min date |
646 | | - if ( count( $disabledDates ) && $disabledDates[0][0] <= $minDate && $disabledDates[0][1] >= $minDate ) { |
647 | | - $minDate = $disabledDates[0][1]; |
648 | | - array_shift( $disabledDates ); |
649 | | - $minDate->modify( "+1 day" ); |
650 | | - } |
651 | | - } |
652 | | - |
653 | | - // if a maxDate is set, discard all disabled dates above the max date |
654 | | - if ( $maxDate ) { |
655 | | - |
656 | | - // discard all ranges of disabled dates that are entirely above the max date |
657 | | - while ( count( $disabledDates ) && $disabledDates[count( $disabledDates ) - 1][0] > $maxDate ) array_pop( $disabledDates ); |
658 | | - |
659 | | - // if max date is in last disabled date range, discard that range and adjust max date |
660 | | - if ( count( $disabledDates ) && $disabledDates[count( $disabledDates ) - 1][0] <= $maxDate && $disabledDates[count( $disabledDates ) - 1][1] >= $maxDate ) { |
661 | | - $maxDate = $disabledDates[count( $disabledDates ) - 1][0]; |
662 | | - array_pop( $disabledDates ); |
663 | | - $maxDate->modify( "-1 day" ); |
664 | | - } |
665 | | - } |
666 | | - // finished with disabled dates |
667 | | - |
668 | | - // find highlighted dates |
669 | | - if ( array_key_exists( "highlight dates", $other_args ) ) { |
670 | | - $highlightedDates = self::sortAndMergeRanges ( self::createRangesArray( explode( ',' , $other_args["highlight dates"] ) ) ) ; |
671 | | - } else if ( $sfigSettings->datePickerHighlightedDates ) { |
672 | | - $highlightedDates = self::sortAndMergeRanges ( self::createRangesArray( explode( ',' , $sfigSettings->datePickerHighlightedDates ) ) ) ; |
673 | | - } else { |
674 | | - $highlightedDates = null; |
675 | | - } |
676 | | - |
677 | | - |
678 | | - // find disabled week days and mark them in an array |
679 | | - if ( array_key_exists( "disable days of week", $other_args ) ) { |
680 | | - $disabledDaysString = $other_args['disable days of week']; |
681 | | - } else { |
682 | | - $disabledDaysString = $sfigSettings->datePickerDisabledDaysOfWeek; |
683 | | - } |
684 | | - |
685 | | - if ( $disabledDaysString != null ) { |
686 | | - |
687 | | - $disabledDays = array( false, false, false, false, false, false, false ); |
688 | | - |
689 | | - foreach ( explode( ',', $disabledDaysString ) as $day ) { |
690 | | - |
691 | | - if ( is_numeric( $day ) && $day >= 0 && $day <= 6 ) { |
692 | | - $disabledDays[$day] = true; |
693 | | - } |
694 | | - |
695 | | - } |
696 | | - |
697 | | - } else { |
698 | | - $disabledDays = null; |
699 | | - } |
700 | | - |
701 | | - // find highlighted week days and mark them in an array |
702 | | - if ( array_key_exists( "highlight days of week", $other_args ) ) { |
703 | | - $highlightedDaysString = $other_args['highlight days of week']; |
704 | | - } else { |
705 | | - $highlightedDaysString = $sfigSettings->datePickerHighlightedDaysOfWeek; |
706 | | - } |
707 | | - |
708 | | - if ( $highlightedDaysString != null ) { |
709 | | - |
710 | | - $highlightedDays = array( false, false, false, false, false, false, false ); |
711 | | - |
712 | | - foreach ( explode( ',', $highlightedDaysString ) as $day ) { |
713 | | - |
714 | | - if ( is_numeric( $day ) && $day >= 0 && $day <= 6 ) { |
715 | | - $highlightedDays[$day] = true; |
716 | | - } |
717 | | - |
718 | | - } |
719 | | - |
720 | | - } else { |
721 | | - $highlightedDays = null; |
722 | | - } |
723 | | - |
724 | | - // set first day of the week |
725 | | - if ( array_key_exists( 'week start', $other_args ) ) { |
726 | | - $jsattribs['firstDay'] = $other_args['week start']; |
727 | | - } elseif ( $sfigSettings->datePickerWeekStart != null ) { |
728 | | - $jsattribs['firstDay'] = $sfigSettings->datePickerWeekStart; |
729 | | - } else { |
730 | | - $jsattribs['firstDay'] = wfMsg( 'semanticformsinputs-firstdayofweek' ); |
731 | | - } |
732 | | - |
733 | | - // set show week number |
734 | | - if ( array_key_exists( 'show week numbers', $other_args ) |
735 | | - || ( !array_key_exists( 'hide week numbers', $other_args ) && $sfigSettings->datePickerShowWeekNumbers ) ) { |
736 | | - |
737 | | - $jsattribs['showWeek'] = true; |
738 | | - } else { |
739 | | - $jsattribs['showWeek'] = false; |
740 | | - } |
741 | | - |
742 | | - // store min date as JS attrib |
743 | | - if ( $minDate ) { |
744 | | - $jsattribs['minDate'] = $minDate->format( 'Y/m/d' ); |
745 | | - } |
746 | | - |
747 | | - // store max date as JS attrib |
748 | | - if ( $maxDate ) { |
749 | | - $jsattribs['maxDate'] = $maxDate->format( 'Y/m/d' ); |
750 | | - } |
751 | | - |
752 | | - // register disabled dates with datepicker |
753 | | - if ( count( $disabledDates ) > 0 ) { |
754 | | - |
755 | | - // convert the PHP array of date ranges into an array of numbers |
756 | | - $jsattribs["disabledDates"] = array_map( create_function ( '$range', ' |
757 | | - |
758 | | - $y0 = $range[0]->format( "Y" ); |
759 | | - $m0 = $range[0]->format( "m" ) - 1; |
760 | | - $d0 = $range[0]->format( "d" ); |
761 | | - |
762 | | - $y1 = $range[1]->format( "Y" ); |
763 | | - $m1 = $range[1]->format( "m" ) - 1; |
764 | | - $d1 = $range[1]->format( "d" ); |
765 | | - |
766 | | - return array($y0, $m0, $d0, $y1, $m1, $d1); |
767 | | - ' ) , $disabledDates ); |
768 | | - } |
769 | | - |
770 | | - // register highlighted dates with datepicker |
771 | | - if ( count( $highlightedDates ) > 0 ) { |
772 | | - |
773 | | - // convert the PHP array of date ranges into an array of numbers |
774 | | - $jsattribs["highlightedDates"] = array_map( create_function ( '$range', ' |
775 | | - |
776 | | - $y0 = $range[0]->format( "Y" ); |
777 | | - $m0 = $range[0]->format( "m" ) - 1; |
778 | | - $d0 = $range[0]->format( "d" ); |
779 | | - |
780 | | - $y1 = $range[1]->format( "Y" ); |
781 | | - $m1 = $range[1]->format( "m" ) - 1; |
782 | | - $d1 = $range[1]->format( "d" ); |
783 | | - |
784 | | - return array($y0, $m0, $d0, $y1, $m1, $d1); |
785 | | - ' ) , $highlightedDates ); |
786 | | - } |
787 | | - |
788 | | - // register disabled days of week with datepicker |
789 | | - if ( count( $disabledDays ) > 0 ) { |
790 | | - $jsattribs["disabledDays"] = $disabledDays; |
791 | | - } |
792 | | - |
793 | | - // register highlighted days of week with datepicker |
794 | | - if ( count( $highlightedDays ) > 0 ) { |
795 | | - $jsattribs["highlightedDays"] = $highlightedDays; |
796 | | - } |
797 | | - } |
798 | | - |
799 | | - |
800 | | - // third: assemble HTML and JS code |
801 | | - |
802 | | - // start with the displayed input and append the real, but hidden |
803 | | - // input that gets sent to SF; it will be filled by the datepicker |
804 | | - $html = self::textHTML( $cur_value, "", $is_mandatory, $inputFieldDisabled, |
805 | | - $other_args, "input_{$sfgFieldNum}_dp_show", null, "createboxInput" ); |
806 | | - |
807 | | - if ( ! array_key_exists( 'part of dtp', $other_args ) ) { |
808 | | - |
809 | | - $html .= Xml::element( "input", |
810 | | - array( |
811 | | - "id" => "input_{$sfgFieldNum}", |
812 | | - "name" => $input_name, |
813 | | - "type" => "hidden", |
814 | | - "value" => $cur_value |
815 | | - ) ); |
816 | | - |
817 | | - // wrap in span (e.g. used for mandatory inputs) |
818 | | - $html = '<span class="inputSpan' . ($is_mandatory ? ' mandatoryFieldSpan' : '') . '">' .$html . '</span>'; |
819 | | - } |
820 | | - |
821 | | - // build JS code from attributes array |
822 | | - $jsattribsString = Xml::encodeJsVar( $jsattribs ); |
823 | | - |
824 | | - // wrap the JS code fragment in a function for deferred init |
825 | | - $jstext = <<<JAVASCRIPT |
826 | | -jQuery(function(){ jQuery('#input_{$sfgFieldNum}_dp_show').SemanticForms_registerInputInit(SFI_DP_init, $jsattribsString ); }); |
827 | | -JAVASCRIPT; |
828 | | - |
829 | | - // insert the code of the JS init function into the pages code |
830 | | - $wgOut->addScript( '<script type="text/javascript">' . $jstext . '</script>' ); |
831 | | - |
832 | | - //return array( $html, "", "initInput$sfgFieldNum" ); |
833 | | - return $html; |
834 | | - |
835 | | - } |
836 | | - |
837 | | - /** |
838 | | - * Setup for input type jqdatepicker. |
839 | | - * |
840 | | - * Adds the Javascript code used by all datetimepickers. |
841 | | - */ |
842 | | - static private function datetimePickerSetup () { |
843 | | - |
844 | | - global $wgOut, $sfigSettings; |
845 | | - |
846 | | - static $hasRun = false; |
847 | | - |
848 | | - if ( !$hasRun ) { |
849 | | - $hasRun = true; |
850 | | - |
851 | | - $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/datetimepicker.js"></script> ' ); |
852 | | - |
853 | | - } |
854 | | - } |
855 | | - |
856 | | - /** |
857 | | - * Definition of input type "datetimepicker". |
858 | | - * |
859 | | - * Returns the html code to be included in the page and registers the |
860 | | - * input's JS initialisation method |
861 | | - * |
862 | | - * @param string $cur_value current value of this field (which is sometimes null) |
863 | | - * @param string $input_name HTML name that this input should have |
864 | | - * @param boolean $is_mandatory indicates whether this field is mandatory for the user |
865 | | - * @param boolean $is_disabled indicates whether this field is disabled (meaning, the user can't edit) |
866 | | - * @param array $other_args hash representing all the other properties defined for this input in the form definition |
867 | | - * @return string html code of input |
868 | | - */ |
869 | | - static function datetimepickerHTML($cur_value, $input_name, $is_mandatory, $is_disabled, $other_args) { |
870 | | - |
871 | | - global $wgOut, $sfgFieldNum, $sfigSettings; |
872 | | - |
873 | | - self::datetimePickerSetup(); |
874 | | - |
875 | | - $other_args["part of dtp"] = true; |
876 | | - |
877 | | - $jsattribs = array(); |
878 | | - |
879 | | - // if we have to show a reset button |
880 | | - if ( array_key_exists( 'show reset button', $other_args ) || |
881 | | - ( !array_key_exists( 'hide reset button', $other_args ) && $sfigSettings->datetimePickerShowResetButton ) ) { |
882 | | - |
883 | | - // some values must be available to the init function |
884 | | - |
885 | | - // is the button disabled? |
886 | | - $jsattribs['disabled'] = $is_disabled; |
887 | | - |
888 | | - // set the button image |
889 | | - if ( $is_disabled ) { |
890 | | - $jsattribs['resetButtonImage'] = $sfigSettings->scriptPath . '/images/DateTimePickerResetButtonDisabled.gif'; |
891 | | - } else { |
892 | | - $jsattribs['resetButtonImage'] = $sfigSettings->scriptPath . '/images/DateTimePickerResetButton.gif'; |
893 | | - } |
894 | | - |
895 | | - // set user classes |
896 | | - if ( array_key_exists( 'class', $other_args ) ) $jsattribs[ "userClasses" ] = $other_args['class']; |
897 | | - else $jsattribs[ "userClasses" ] = ""; |
898 | | - |
899 | | - } |
900 | | - |
901 | | - // find allowed values and keep only the date portion |
902 | | - if ( array_key_exists( 'possible_values', $other_args ) && |
903 | | - count( $other_args[ 'possible_values' ] ) ) { |
904 | | - |
905 | | - $other_args[ 'possible_values' ] = preg_replace( |
906 | | - '/^\s*(\d{4}\/\d{2}\/\d{2}).*/', |
907 | | - '$1', |
908 | | - $other_args[ 'possible_values' ] |
909 | | - ); |
910 | | - } |
911 | | - |
912 | | - $dateTimeString = trim( $cur_value ); |
913 | | - $dateString = ''; |
914 | | - $timeString = ''; |
915 | | - |
916 | | - $separatorPos = strpos($dateTimeString, " "); |
917 | | - |
918 | | - // does it have a separating whitespace? assume it's a date & time |
919 | | - if ( $separatorPos ) { |
920 | | - $dateString = substr( $dateTimeString, 0, $separatorPos ); |
921 | | - $timeString = substr( $dateTimeString, $separatorPos + 1 ); |
922 | | - |
923 | | - // does it start with a time of some kind? |
924 | | - } elseif ( preg_match( '/^\d?\d:\d\d/', $dateTimeString ) ) { |
925 | | - $timeString = $dateTimeString; |
926 | | - |
927 | | - // if all else fails assume it's a date |
928 | | - } else { |
929 | | - $dateString = $dateTimeString; |
930 | | - } |
931 | | - |
932 | | - $html = '<span class="inputSpan' . ($is_mandatory ? ' mandatoryFieldSpan' : '') . '">' . |
933 | | - self::jqDatePickerHTML( $dateString, $input_name, $is_mandatory, $is_disabled, $other_args) . " " . |
934 | | - self::timepickerHTML( $timeString, $input_name, $is_mandatory, $is_disabled, $other_args) . |
935 | | - Xml::element("input", |
936 | | - array( |
937 | | - "id" => "input_{$sfgFieldNum}", |
938 | | - "name" => $input_name, |
939 | | - "type" => "hidden", |
940 | | - "value" => $cur_value |
941 | | - )) |
942 | | - . '</span>'; |
943 | | - |
944 | | - // build JS code from attributes array |
945 | | - $jsattribsString = Xml::encodeJsVar( $jsattribs ); |
946 | | - |
947 | | - $jstext = <<<JAVASCRIPT |
948 | | -jQuery(function(){ jQuery('#input_$sfgFieldNum').SemanticForms_registerInputInit(SFI_DTP_init, $jsattribsString ); }); |
949 | | -JAVASCRIPT; |
950 | | - |
951 | | - // insert the code of the JS init function into the pages code |
952 | | - $wgOut->addScript('<script type="text/javascript">' . $jstext . '</script>'); |
953 | | - |
954 | | - return $html; |
955 | | - } |
956 | | - |
957 | | -// |
958 | | -// static function wysiwygSetup() { |
959 | | -// |
960 | | -// } |
961 | | -// |
962 | | -// |
963 | | -// static function wysiwygHTML ( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
964 | | -// |
965 | | -// global $wgOut, $wgLang, $wgAmericanDates, $wgScriptPath, $wgFCKEditorDir; |
966 | | -// global $sfgFieldNum, $sfgScriptPath, $sfigSettings; |
967 | | -// global $sfgTabIndex, $sfgJSValidationCalls; // used to represent the current tab index in the form |
968 | | -// |
969 | | -// $htmltext = Html::element('textarea', array( |
970 | | -// 'id' => "input_$sfgFieldNum", |
971 | | -// 'class' => 'createboxInput', |
972 | | -// 'name' => $input_name, |
973 | | -// 'tabindex' => $sfgTabIndex, |
974 | | -// 'rows' => 25, |
975 | | -// 'cols' => 80 |
976 | | -// )); |
977 | | -// |
978 | | -// $jstext = <<<JAVASCRIPT |
979 | | -// addOnloadHook(function() |
980 | | -// { |
981 | | -// var oFCKeditor = new FCKeditor( 'input_$sfgFieldNum', '100%', '100%') ; |
982 | | -// oFCKeditor.BasePath = "$wgScriptPath/$wgFCKEditorDir/" ; |
983 | | -// oFCKeditor.ReplaceTextarea() ; |
984 | | -// }); |
985 | | -// |
986 | | -// JAVASCRIPT; |
987 | | -// |
988 | | -// $sfgJSValidationCalls[] = "function() {document.getElementById('input_$sfgFieldNum').value = FCKeditorAPI.GetInstance('input_$sfgFieldNum').GetHtml();return true;}"; |
989 | | -// |
990 | | -// $wgOut->addScript( '<script type="text/javascript">' . $jstext . '</script>' ); |
991 | | -// return array( $htmltext, "" ); |
992 | | -// } |
993 | | -// |
994 | | - |
995 | | - |
996 | | - /** |
997 | | - * Setup for input type "timepicker". |
998 | | - * |
999 | | - * Adds the Javascript code and css used by all timepickers. |
1000 | | - */ |
1001 | | - static private function timepickerSetup() { |
1002 | | - |
1003 | | - global $sfigSettings, $wgOut; |
1004 | | - |
1005 | | - static $hasRun = false; |
1006 | | - |
1007 | | - if ( !$hasRun ) { |
1008 | | - |
1009 | | - $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/timepicker.js"></script> ' ); |
1010 | | - $wgOut->addExtensionStyle( $sfigSettings->scriptPath . '/skins/SFI_Timepicker.css' ); |
1011 | | - |
1012 | | - } |
1013 | | - |
1014 | | - } |
1015 | | - |
1016 | | - /** |
1017 | | - * Definition of input type "timepicker" |
1018 | | - * |
1019 | | - * Returns the html code to be included in the page and registers the |
1020 | | - * input's JS initialisation method |
1021 | | - * |
1022 | | - * @param string $cur_value current value of this field (which is sometimes null) |
1023 | | - * @param string $input_name HTML name that this input should have |
1024 | | - * @param boolean $is_mandatory indicates whether this field is mandatory for the user |
1025 | | - * @param boolean $is_disabled indicates whether this field is disabled (meaning, the user can't edit) |
1026 | | - * @param array $other_args hash representing all the other properties defined for this input in the form definition |
1027 | | - * @return string html code of input |
1028 | | - */ |
1029 | | - static function timepickerHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
1030 | | - |
1031 | | - global $wgOut; |
1032 | | - global $sfgFieldNum; |
1033 | | - global $sfigSettings; |
1034 | | - |
1035 | | - // The timepicker is created in four steps: |
1036 | | - // first: set up HTML attributes |
1037 | | - // second: assemble HTML |
1038 | | - // third: set up JS attributes |
1039 | | - // fourth: assemble JS call |
1040 | | - |
1041 | | - |
1042 | | - // first: set up HTML attributes |
1043 | | - $inputFieldDisabled = |
1044 | | - array_key_exists( 'disable input field', $other_args ) |
1045 | | - || ( !array_key_exists( 'enable input field', $other_args ) && $sfigSettings->timePickerDisableInputField ) |
1046 | | - || $is_disabled ; |
1047 | | - |
1048 | | - if ( array_key_exists( 'class', $other_args ) ) $userClasses = $other_args['class']; |
1049 | | - else $userClasses = ""; |
1050 | | - |
1051 | | - // second: assemble HTML |
1052 | | - // create visible input field (for display) and invisible field (for data) |
1053 | | - $html = self::textHTML( $cur_value, '', $is_mandatory, $inputFieldDisabled, $other_args, "input_{$sfgFieldNum}_tp_show", null, "createboxInput" ); |
1054 | | - |
1055 | | - if ( ! array_key_exists( 'part of dtp', $other_args ) ) { |
1056 | | - $html .= Xml::element( "input", array( |
1057 | | - 'id' => "input_{$sfgFieldNum}", |
1058 | | - 'type' => 'hidden', |
1059 | | - 'name' => $input_name, |
1060 | | - 'value' => $cur_value |
1061 | | - ) ); |
1062 | | - } |
1063 | | - |
1064 | | - // append time picker button |
1065 | | - if ( $is_disabled ) { |
1066 | | - |
1067 | | - $html .= Xml::openElement( |
1068 | | - "button", |
1069 | | - array( |
1070 | | - 'type' => 'button', |
1071 | | - 'class' => 'createboxInput ' . $userClasses, |
1072 | | - 'disabled' => '1', |
1073 | | - 'id' => "input_{$sfgFieldNum}_button" |
1074 | | - ) ) |
1075 | | - |
1076 | | - . Xml::element( |
1077 | | - "image", |
1078 | | - array( 'src' => $sfigSettings->scriptPath . '/images/TimePickerButtonDisabled.gif' ) |
1079 | | - ) |
1080 | | - |
1081 | | - . Xml::closeElement( "button" ); |
1082 | | - |
1083 | | - } else { |
1084 | | - |
1085 | | - $html .= "<button " |
1086 | | - . Xml::expandAttributes ( array( |
1087 | | - 'type' => 'button', |
1088 | | - 'class' => 'createboxInput ' . $userClasses, |
1089 | | - 'name' => "button", |
1090 | | - ) ) |
1091 | | - . " onclick=\"document.getElementById(this.id.replace('_button','_tp_show')).focus();\"" |
1092 | | - . ">" |
1093 | | - |
1094 | | - . Xml::element( |
1095 | | - "image", |
1096 | | - array( 'src' => $sfigSettings->scriptPath . '/images/TimePickerButton.gif' ) |
1097 | | - ) |
1098 | | - |
1099 | | - . Xml::closeElement( "button" ); |
1100 | | - |
1101 | | - } |
1102 | | - |
1103 | | - // append reset button (if selected) |
1104 | | - if ( ! array_key_exists( 'part of dtp', $other_args ) && |
1105 | | - ( array_key_exists( 'show reset button', $other_args ) || |
1106 | | - $sfigSettings->timePickerShowResetButton && !array_key_exists( 'hide reset button', $other_args ) |
1107 | | - ) |
1108 | | - ) { |
1109 | | - |
1110 | | - if ( $is_disabled ) { |
1111 | | - |
1112 | | - $html .= Xml::openElement( |
1113 | | - "button", |
1114 | | - array( |
1115 | | - 'type' => 'button', |
1116 | | - 'class' => 'createboxInput ' . $userClasses, |
1117 | | - 'disabled' => '1', |
1118 | | - 'id' => "input_{$sfgFieldNum}_resetbutton" |
1119 | | - ) ) |
1120 | | - |
1121 | | - . Xml::element( |
1122 | | - "image", |
1123 | | - array( 'src' => $sfigSettings->scriptPath . '/images/TimePickerResetButtonDisabled.gif' ) |
1124 | | - |
1125 | | - ) |
1126 | | - . Xml::closeElement( "button" ); |
1127 | | - |
1128 | | - } else { |
1129 | | - |
1130 | | - $html .= "<button " |
1131 | | - . Xml::expandAttributes ( array( |
1132 | | - 'type' => 'button', |
1133 | | - 'class' => 'createboxInput ' . $userClasses, |
1134 | | - 'name' => "resetbutton", |
1135 | | - ) ) |
1136 | | - . " onclick=\"document.getElementById(this.id.replace('_resetbutton','')).value='';" |
1137 | | - . "document.getElementById(this.id.replace('_resetbutton','_tp_show')).value='';\"" |
1138 | | - . ">" |
1139 | | - |
1140 | | - . Xml::element( |
1141 | | - "image", |
1142 | | - array( 'src' => $sfigSettings->scriptPath . '/images/TimePickerResetButton.gif' ) |
1143 | | - |
1144 | | - ) |
1145 | | - . Xml::closeElement( "button" ); |
1146 | | - |
1147 | | - } |
1148 | | - } |
1149 | | - |
1150 | | - // wrap in span (e.g. used for mandatory inputs) |
1151 | | - if ( ! array_key_exists( 'part of dtp', $other_args ) ) { |
1152 | | - $html = '<span class="inputSpan' . ($is_mandatory ? ' mandatoryFieldSpan' : '') . '">' .$html . '</span>'; |
1153 | | - } |
1154 | | - |
1155 | | - // third: if the timepicker is not disabled set up JS attributes ans assemble JS call |
1156 | | - if ( !$is_disabled ) { |
1157 | | - |
1158 | | - self::timepickerSetup(); |
1159 | | - |
1160 | | - // set min time if valid, else use default |
1161 | | - if ( array_key_exists( 'mintime', $other_args ) |
1162 | | - && ( preg_match( '/^\d+:\d\d$/', trim( $other_args['mintime'] ) ) == 1 ) ) { |
1163 | | - $minTime = trim( $other_args[ 'mintime' ] ); |
1164 | | - } elseif ( $sfigSettings->timePickerMinTime != null ) { |
1165 | | - $minTime = $sfigSettings->timePickerMinTime ; |
1166 | | - } else { |
1167 | | - $minTime = '00:00'; |
1168 | | - } |
1169 | | - |
1170 | | - // set max time if valid, else use default |
1171 | | - if ( array_key_exists( 'maxtime', $other_args ) |
1172 | | - && ( preg_match( '/^\d+:\d\d$/', trim( $other_args['maxtime'] ) ) == 1 ) ) { |
1173 | | - $maxTime = trim( $other_args[ 'maxtime' ] ); |
1174 | | - } elseif ( $sfigSettings->timePickerMaxTime != null ) { |
1175 | | - $maxTime = $sfigSettings->timePickerMaxTime ; |
1176 | | - } else { |
1177 | | - $maxTime = '23:59'; |
1178 | | - } |
1179 | | - |
1180 | | - // set interval if valid, else use default |
1181 | | - if ( array_key_exists( 'interval', $other_args ) |
1182 | | - && preg_match( '/^\d+$/', trim( $other_args['interval'] ) ) == 1 ) { |
1183 | | - $interval = trim( $other_args[ 'interval' ] ); |
1184 | | - } else { |
1185 | | - $interval = '15'; |
1186 | | - } |
1187 | | - |
1188 | | - // build JS code from attributes array |
1189 | | - $jsattribs = array( |
1190 | | - "minTime" => $minTime, |
1191 | | - "maxTime" => $maxTime, |
1192 | | - "interval" => $interval, |
1193 | | - "format" => "hh:mm" |
1194 | | - ); |
1195 | | - |
1196 | | - if ( array_key_exists( 'part of dtp', $other_args ) ) { |
1197 | | - $jsattribs['partOfDTP'] = $other_args['part of dtp']; |
1198 | | - } |
1199 | | - |
1200 | | - $jstext = Xml::encodeJsVar( $jsattribs ); |
1201 | | - |
1202 | | - $jstext = <<<JAVASCRIPT |
1203 | | -jQuery(function(){ jQuery('#input_{$sfgFieldNum}_tp_show').SemanticForms_registerInputInit(SFI_TP_init, $jstext ); }); |
1204 | | -JAVASCRIPT; |
1205 | | - |
1206 | | - // write JS code directly to the page's code |
1207 | | - $wgOut->addScript( '<script type="text/javascript">' . $jstext . '</script>' ); |
1208 | | - |
1209 | | - // return HTML and name of JS init function |
1210 | | - |
1211 | | - } |
1212 | | - |
1213 | | - return $html; |
1214 | | - |
1215 | | - } |
1216 | | - |
1217 | | - /** |
1218 | | - * Setup for input type "menuselect". |
1219 | | - * Adds the Javascript code and css used by all menuselects. |
1220 | | - */ |
1221 | | - static private function menuselectSetup() { |
1222 | | - |
1223 | | - global $wgOut; |
1224 | | - global $sfigSettings; |
1225 | | - |
1226 | | - static $hasRun = false; |
1227 | | - |
1228 | | - if ( !$hasRun ) { |
1229 | | - |
1230 | | - $wgOut->addScript( '<script type="text/javascript">sfigScriptPath="' . $sfigSettings->scriptPath . '";</script> ' ); |
1231 | | - $wgOut->addScript( '<script type="text/javascript" src="' . $sfigSettings->scriptPath . '/libs/menuselect.js"></script> ' ); |
1232 | | - $wgOut->addExtensionStyle( $sfigSettings->scriptPath . '/skins/SFI_Menuselect.css' ); |
1233 | | - |
1234 | | - } |
1235 | | - |
1236 | | - } |
1237 | | - |
1238 | | - /** |
1239 | | - * Definition of input type "menuselect" |
1240 | | - * |
1241 | | - * Returns the html code to be included in the page and registers the |
1242 | | - * input's JS initialisation method |
1243 | | - * |
1244 | | - * @param string $cur_value current value of this field (which is sometimes null) |
1245 | | - * @param string $input_name HTML name that this input should have |
1246 | | - * @param boolean $is_mandatory indicates whether this field is mandatory for the user |
1247 | | - * @param boolean $is_disabled indicates whether this field is disabled (meaning, the user can't edit) |
1248 | | - * @param array $other_args hash representing all the other properties defined for this input in the form definition |
1249 | | - * @return string html code of input |
1250 | | - */ |
1251 | | - static function menuselectHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
1252 | | - global $wgParser, $wgUser, $wgTitle, $wgOut; |
1253 | | - global $sfgFieldNum; |
1254 | | - global $sfigSettings; |
1255 | | - |
1256 | | - self::menuselectSetup(); |
1257 | | - |
1258 | | - // first: set up HTML attributes |
1259 | | - $inputFieldDisabled = |
1260 | | - array_key_exists( 'disable input field', $other_args ) |
1261 | | - || ( !array_key_exists( 'enable input field', $other_args ) && $sfigSettings->timePickerDisableInputField ) |
1262 | | - || $is_disabled ; |
1263 | | - |
1264 | | - // second: assemble HTML |
1265 | | - // create visible input field (for display) and invisible field (for data) |
1266 | | - $html = self::textHTML( $cur_value, '', $is_mandatory, $inputFieldDisabled, $other_args, "input_{$sfgFieldNum}_show", null, "createboxInput" ) |
1267 | | - . Xml::element( "input", array( |
1268 | | - 'id' => "input_{$sfgFieldNum}", |
1269 | | - 'type' => 'hidden', |
1270 | | - 'name' => $input_name, |
1271 | | - 'value' => $cur_value |
1272 | | - ) ); |
1273 | | - |
1274 | | - |
1275 | | - $html .= "<span class='SFI_menuselect' id='span_{$sfgFieldNum}_tree'>"; |
1276 | | - |
1277 | | - |
1278 | | - // if ( array_key_exists( 'delimiter', $other_args ) ) $delimiter = $other_args[ 'delimiter' ]; |
1279 | | - // else $delimiter = ' '; |
1280 | | - |
1281 | | - // parse menu structure |
1282 | | - |
1283 | | - $options = ParserOptions::newFromUser( $wgUser ); |
1284 | | - |
1285 | | - $oldStripState = $wgParser->mStripState; |
1286 | | - $wgParser->mStripState = new StripState(); |
1287 | | - |
1288 | | - // FIXME: SF does not parse options correctly. Users have to replace | by {{!}} |
1289 | | - $structure = str_replace( '{{!}}', '|', $other_args["structure"] ); |
1290 | | - |
1291 | | - $structure = $wgParser->parse( $structure, $wgTitle, $options )->getText(); |
1292 | | - |
1293 | | - $wgParser->mStripState = $oldStripState; |
1294 | | - |
1295 | | - |
1296 | | - $html .= str_replace( '<li', '<li class=\'ui-state-default\'', $structure ); |
1297 | | - |
1298 | | - $html .= "</span>"; |
1299 | | - |
1300 | | - // wrap in span (e.g. used for mandatory inputs) |
1301 | | - $html = '<span class="inputSpan' . ($is_mandatory ? ' mandatoryFieldSpan' : '') . '">' .$html . '</span>'; |
1302 | | - |
1303 | | - $jstext = <<<JAVASCRIPT |
1304 | | -jQuery(function(){ jQuery('#input_$sfgFieldNum').SemanticForms_registerInputInit(SFI_MS_init, null ); }); |
1305 | | -JAVASCRIPT; |
1306 | | - |
1307 | | - // write JS code directly to the page's code |
1308 | | - $wgOut->addScript( '<script type="text/javascript">' . $jstext . '</script>' ); |
1309 | | - |
1310 | | - return array( $html, "", "SFI_MS_init" ); |
1311 | | - |
1312 | | - } |
1313 | | -} |
Index: tags/extensions/SemanticFormsInputs/REL_0_4_1/SemanticFormsInputs/README |
— | — | @@ -1,58 +0,0 @@ |
2 | | -Semantic Forms Inputs is an extension to MediaWiki that provides |
3 | | -additional input types for the Semantic Forms extension. |
4 | | - |
5 | | -The Semantic Forms extension allows users to add, edit and query data |
6 | | -of a Semantic MediaWiki-based wiki using forms. For every form field |
7 | | -the input type specifies the type of input a field will have in the |
8 | | -form. Semantic Forms comes with basic input types for all data |
9 | | -types. This extension -- Semantic Forms Inputs -- aims to collect |
10 | | -further, visually and/or functionally enhanced input types. |
11 | | - |
12 | | -For the full description, see the Semantic Forms Inputs homepage: |
13 | | -http://www.mediawiki.org/wiki/Extension:Semantic_Forms_Inputs |
14 | | - |
15 | | -This software is licensed under the GNU General Public License (GPL). |
16 | | -See the COPYING file for more information. |
17 | | - |
18 | | -== Installation == |
19 | | - |
20 | | -Having at least MediaWiki 1.16, Semantic MediaWiki 1.5.4 and Semantic |
21 | | -Forms 2.0.8 installed is a precondition for the Semantic Forms Inputs |
22 | | -extension version 0.4 and above; the code will not work without it. |
23 | | - |
24 | | -To install Semantic Forms Inputs, create a directory named |
25 | | -SemanticFormsInputs in the extensions directory of your MediaWiki |
26 | | -installation and copy the extension's files into it. Then add the |
27 | | -following line to your LocalSettings.php below the inclusion of the |
28 | | -Semantic Forms extension: |
29 | | - |
30 | | -require_once('extensions/SemanticFormsInputs/SemanticFormsInputs.php'); |
31 | | - |
32 | | -== Credits == |
33 | | - |
34 | | -Semantic Forms Inputs was written by Stephan Gambke, Sanyam Goyal and |
35 | | -Yaron Koren. |
36 | | - |
37 | | -The 'datepicker' input uses the jQuery and jQuery UI libraries. |
38 | | -See http://jquery.org/ and http://jqueryui.com/ . |
39 | | - |
40 | | -Button icons are derived from the Mini Icons 2 icon set from |
41 | | -brandspankingnew.net. See |
42 | | -http://www.brandspankingnew.net/archive/2006/12/hohoho.html |
43 | | - |
44 | | - |
45 | | -== Contact == |
46 | | - |
47 | | -Bugs should preferably be reported on the Wikimedia bug tracker: |
48 | | -http://bugzilla.wikimedia.org/ |
49 | | - |
50 | | -Comments, questions and suggestions can be send or posted to: |
51 | | - |
52 | | -* the appropriate Semantic MediaWiki mailing list: |
53 | | - http://lists.sourceforge.net/lists/listinfo/semediawiki-user |
54 | | - |
55 | | -* the Semantic Forms Inputs discussion page on mediawiki.org: |
56 | | - http://www.mediawiki.org/wiki/Extension_talk:Semantic_Forms_Inputs |
57 | | - |
58 | | -* the author: |
59 | | - http://www.mediawiki.org/wiki/Special:EmailUser/F.trott |