Index: tags/extensions/PageSchemas/REL_0_3/PS_Tabs.php |
— | — | @@ -0,0 +1,79 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * @file PS_Tabs.php |
| 6 | + * @ingroup |
| 7 | + * |
| 8 | + * @author Ankit Garg |
| 9 | + * @author Yaron Koren |
| 10 | + */ |
| 11 | +final class PSTabs { |
| 12 | + |
| 13 | + public static function displayTabs( $obj, &$content_actions ) { |
| 14 | + global $wgUser; |
| 15 | + |
| 16 | + $title = $obj->getTitle(); |
| 17 | + if ( $title->getNamespace() != NS_CATEGORY ){ |
| 18 | + return true; |
| 19 | + } |
| 20 | + |
| 21 | + $category = $title->getText(); |
| 22 | + $pageSchemaObj = new PSSchema( $category ); |
| 23 | + $isPSDefined = $pageSchemaObj->isPSDefined(); |
| 24 | + |
| 25 | + global $wgTitle, $wgRequest; |
| 26 | + |
| 27 | + if ( $wgUser->isAllowed( 'edit' ) && $wgTitle->userCan( 'edit' ) ) { |
| 28 | + $content_actions['editschema'] = array( |
| 29 | + 'text' => ( $isPSDefined ) ? wfMsg( 'editschema' ) : wfMsg( 'createschema' ), |
| 30 | + 'class' => $wgRequest->getVal( 'action' ) == 'editschema' ? 'selected' : '', |
| 31 | + 'href' => $title->getLocalURL( 'action=editschema' ) |
| 32 | + ); |
| 33 | + } |
| 34 | + |
| 35 | + if ( $isPSDefined && $wgUser->isAllowed( 'generatepages' ) ) { |
| 36 | + $content_actions['generatepages'] = array( |
| 37 | + 'text' => wfMsg( 'generatepages' ), |
| 38 | + 'class' => $wgRequest->getVal( 'action' ) == 'generatepages' ? 'selected' : '', |
| 39 | + 'href' => $title->getLocalURL( 'action=generatepages' ) |
| 40 | + ); |
| 41 | + } |
| 42 | + |
| 43 | + return true; |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * Function called for some skins, most notably 'Vector'. |
| 48 | + */ |
| 49 | + public static function displayTabs2( $obj, &$links ) { |
| 50 | + // The old '$content_actions' array is thankfully just a sub-array of this one |
| 51 | + $views_links = $links['actions']; |
| 52 | + self::displayTabs( $obj, $views_links ); |
| 53 | + $links['actions'] = $views_links; |
| 54 | + return true; |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * Adds handling for the tabs 'generatepages' and 'editschema'. |
| 59 | + */ |
| 60 | + public static function onUnknownAction( $action, Article $article ) { |
| 61 | + $title = $article->getTitle(); |
| 62 | + |
| 63 | + // These tabs should only exist for category pages |
| 64 | + if ( $title->getNamespace() != NS_CATEGORY ) { |
| 65 | + return true; |
| 66 | + } |
| 67 | + |
| 68 | + $categoryName = $title->getText(); |
| 69 | + if ( $action == 'generatepages' ) { |
| 70 | + $generatePagesPage = new PSGeneratePages(); |
| 71 | + $generatePagesPage->execute( $categoryName ); |
| 72 | + return false; |
| 73 | + } elseif ( $action == 'editschema' ) { |
| 74 | + $editSchemaPage = new PSEditSchema(); |
| 75 | + $editSchemaPage->execute( $categoryName ); |
| 76 | + return false; |
| 77 | + } |
| 78 | + return true; |
| 79 | + } |
| 80 | +} |
Property changes on: tags/extensions/PageSchemas/REL_0_3/PS_Tabs.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 81 | + native |
Index: tags/extensions/PageSchemas/REL_0_3/LICENSE |
— | — | @@ -0,0 +1,339 @@ |
| 2 | + GNU GENERAL PUBLIC LICENSE |
| 3 | + Version 2, June 1991 |
| 4 | + |
| 5 | + Copyright (C) 1989, 1991 Free Software Foundation, Inc., |
| 6 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 7 | + Everyone is permitted to copy and distribute verbatim copies |
| 8 | + of this license document, but changing it is not allowed. |
| 9 | + |
| 10 | + Preamble |
| 11 | + |
| 12 | + The licenses for most software are designed to take away your |
| 13 | +freedom to share and change it. By contrast, the GNU General Public |
| 14 | +License is intended to guarantee your freedom to share and change free |
| 15 | +software--to make sure the software is free for all its users. This |
| 16 | +General Public License applies to most of the Free Software |
| 17 | +Foundation's software and to any other program whose authors commit to |
| 18 | +using it. (Some other Free Software Foundation software is covered by |
| 19 | +the GNU Lesser General Public License instead.) You can apply it to |
| 20 | +your programs, too. |
| 21 | + |
| 22 | + When we speak of free software, we are referring to freedom, not |
| 23 | +price. Our General Public Licenses are designed to make sure that you |
| 24 | +have the freedom to distribute copies of free software (and charge for |
| 25 | +this service if you wish), that you receive source code or can get it |
| 26 | +if you want it, that you can change the software or use pieces of it |
| 27 | +in new free programs; and that you know you can do these things. |
| 28 | + |
| 29 | + To protect your rights, we need to make restrictions that forbid |
| 30 | +anyone to deny you these rights or to ask you to surrender the rights. |
| 31 | +These restrictions translate to certain responsibilities for you if you |
| 32 | +distribute copies of the software, or if you modify it. |
| 33 | + |
| 34 | + For example, if you distribute copies of such a program, whether |
| 35 | +gratis or for a fee, you must give the recipients all the rights that |
| 36 | +you have. You must make sure that they, too, receive or can get the |
| 37 | +source code. And you must show them these terms so they know their |
| 38 | +rights. |
| 39 | + |
| 40 | + We protect your rights with two steps: (1) copyright the software, and |
| 41 | +(2) offer you this license which gives you legal permission to copy, |
| 42 | +distribute and/or modify the software. |
| 43 | + |
| 44 | + Also, for each author's protection and ours, we want to make certain |
| 45 | +that everyone understands that there is no warranty for this free |
| 46 | +software. If the software is modified by someone else and passed on, we |
| 47 | +want its recipients to know that what they have is not the original, so |
| 48 | +that any problems introduced by others will not reflect on the original |
| 49 | +authors' reputations. |
| 50 | + |
| 51 | + Finally, any free program is threatened constantly by software |
| 52 | +patents. We wish to avoid the danger that redistributors of a free |
| 53 | +program will individually obtain patent licenses, in effect making the |
| 54 | +program proprietary. To prevent this, we have made it clear that any |
| 55 | +patent must be licensed for everyone's free use or not licensed at all. |
| 56 | + |
| 57 | + The precise terms and conditions for copying, distribution and |
| 58 | +modification follow. |
| 59 | + |
| 60 | + GNU GENERAL PUBLIC LICENSE |
| 61 | + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
| 62 | + |
| 63 | + 0. This License applies to any program or other work which contains |
| 64 | +a notice placed by the copyright holder saying it may be distributed |
| 65 | +under the terms of this General Public License. The "Program", below, |
| 66 | +refers to any such program or work, and a "work based on the Program" |
| 67 | +means either the Program or any derivative work under copyright law: |
| 68 | +that is to say, a work containing the Program or a portion of it, |
| 69 | +either verbatim or with modifications and/or translated into another |
| 70 | +language. (Hereinafter, translation is included without limitation in |
| 71 | +the term "modification".) Each licensee is addressed as "you". |
| 72 | + |
| 73 | +Activities other than copying, distribution and modification are not |
| 74 | +covered by this License; they are outside its scope. The act of |
| 75 | +running the Program is not restricted, and the output from the Program |
| 76 | +is covered only if its contents constitute a work based on the |
| 77 | +Program (independent of having been made by running the Program). |
| 78 | +Whether that is true depends on what the Program does. |
| 79 | + |
| 80 | + 1. You may copy and distribute verbatim copies of the Program's |
| 81 | +source code as you receive it, in any medium, provided that you |
| 82 | +conspicuously and appropriately publish on each copy an appropriate |
| 83 | +copyright notice and disclaimer of warranty; keep intact all the |
| 84 | +notices that refer to this License and to the absence of any warranty; |
| 85 | +and give any other recipients of the Program a copy of this License |
| 86 | +along with the Program. |
| 87 | + |
| 88 | +You may charge a fee for the physical act of transferring a copy, and |
| 89 | +you may at your option offer warranty protection in exchange for a fee. |
| 90 | + |
| 91 | + 2. You may modify your copy or copies of the Program or any portion |
| 92 | +of it, thus forming a work based on the Program, and copy and |
| 93 | +distribute such modifications or work under the terms of Section 1 |
| 94 | +above, provided that you also meet all of these conditions: |
| 95 | + |
| 96 | + a) You must cause the modified files to carry prominent notices |
| 97 | + stating that you changed the files and the date of any change. |
| 98 | + |
| 99 | + b) You must cause any work that you distribute or publish, that in |
| 100 | + whole or in part contains or is derived from the Program or any |
| 101 | + part thereof, to be licensed as a whole at no charge to all third |
| 102 | + parties under the terms of this License. |
| 103 | + |
| 104 | + c) If the modified program normally reads commands interactively |
| 105 | + when run, you must cause it, when started running for such |
| 106 | + interactive use in the most ordinary way, to print or display an |
| 107 | + announcement including an appropriate copyright notice and a |
| 108 | + notice that there is no warranty (or else, saying that you provide |
| 109 | + a warranty) and that users may redistribute the program under |
| 110 | + these conditions, and telling the user how to view a copy of this |
| 111 | + License. (Exception: if the Program itself is interactive but |
| 112 | + does not normally print such an announcement, your work based on |
| 113 | + the Program is not required to print an announcement.) |
| 114 | + |
| 115 | +These requirements apply to the modified work as a whole. If |
| 116 | +identifiable sections of that work are not derived from the Program, |
| 117 | +and can be reasonably considered independent and separate works in |
| 118 | +themselves, then this License, and its terms, do not apply to those |
| 119 | +sections when you distribute them as separate works. But when you |
| 120 | +distribute the same sections as part of a whole which is a work based |
| 121 | +on the Program, the distribution of the whole must be on the terms of |
| 122 | +this License, whose permissions for other licensees extend to the |
| 123 | +entire whole, and thus to each and every part regardless of who wrote it. |
| 124 | + |
| 125 | +Thus, it is not the intent of this section to claim rights or contest |
| 126 | +your rights to work written entirely by you; rather, the intent is to |
| 127 | +exercise the right to control the distribution of derivative or |
| 128 | +collective works based on the Program. |
| 129 | + |
| 130 | +In addition, mere aggregation of another work not based on the Program |
| 131 | +with the Program (or with a work based on the Program) on a volume of |
| 132 | +a storage or distribution medium does not bring the other work under |
| 133 | +the scope of this License. |
| 134 | + |
| 135 | + 3. You may copy and distribute the Program (or a work based on it, |
| 136 | +under Section 2) in object code or executable form under the terms of |
| 137 | +Sections 1 and 2 above provided that you also do one of the following: |
| 138 | + |
| 139 | + a) Accompany it with the complete corresponding machine-readable |
| 140 | + source code, which must be distributed under the terms of Sections |
| 141 | + 1 and 2 above on a medium customarily used for software interchange; or, |
| 142 | + |
| 143 | + b) Accompany it with a written offer, valid for at least three |
| 144 | + years, to give any third party, for a charge no more than your |
| 145 | + cost of physically performing source distribution, a complete |
| 146 | + machine-readable copy of the corresponding source code, to be |
| 147 | + distributed under the terms of Sections 1 and 2 above on a medium |
| 148 | + customarily used for software interchange; or, |
| 149 | + |
| 150 | + c) Accompany it with the information you received as to the offer |
| 151 | + to distribute corresponding source code. (This alternative is |
| 152 | + allowed only for noncommercial distribution and only if you |
| 153 | + received the program in object code or executable form with such |
| 154 | + an offer, in accord with Subsection b above.) |
| 155 | + |
| 156 | +The source code for a work means the preferred form of the work for |
| 157 | +making modifications to it. For an executable work, complete source |
| 158 | +code means all the source code for all modules it contains, plus any |
| 159 | +associated interface definition files, plus the scripts used to |
| 160 | +control compilation and installation of the executable. However, as a |
| 161 | +special exception, the source code distributed need not include |
| 162 | +anything that is normally distributed (in either source or binary |
| 163 | +form) with the major components (compiler, kernel, and so on) of the |
| 164 | +operating system on which the executable runs, unless that component |
| 165 | +itself accompanies the executable. |
| 166 | + |
| 167 | +If distribution of executable or object code is made by offering |
| 168 | +access to copy from a designated place, then offering equivalent |
| 169 | +access to copy the source code from the same place counts as |
| 170 | +distribution of the source code, even though third parties are not |
| 171 | +compelled to copy the source along with the object code. |
| 172 | + |
| 173 | + 4. You may not copy, modify, sublicense, or distribute the Program |
| 174 | +except as expressly provided under this License. Any attempt |
| 175 | +otherwise to copy, modify, sublicense or distribute the Program is |
| 176 | +void, and will automatically terminate your rights under this License. |
| 177 | +However, parties who have received copies, or rights, from you under |
| 178 | +this License will not have their licenses terminated so long as such |
| 179 | +parties remain in full compliance. |
| 180 | + |
| 181 | + 5. You are not required to accept this License, since you have not |
| 182 | +signed it. However, nothing else grants you permission to modify or |
| 183 | +distribute the Program or its derivative works. These actions are |
| 184 | +prohibited by law if you do not accept this License. Therefore, by |
| 185 | +modifying or distributing the Program (or any work based on the |
| 186 | +Program), you indicate your acceptance of this License to do so, and |
| 187 | +all its terms and conditions for copying, distributing or modifying |
| 188 | +the Program or works based on it. |
| 189 | + |
| 190 | + 6. Each time you redistribute the Program (or any work based on the |
| 191 | +Program), the recipient automatically receives a license from the |
| 192 | +original licensor to copy, distribute or modify the Program subject to |
| 193 | +these terms and conditions. You may not impose any further |
| 194 | +restrictions on the recipients' exercise of the rights granted herein. |
| 195 | +You are not responsible for enforcing compliance by third parties to |
| 196 | +this License. |
| 197 | + |
| 198 | + 7. If, as a consequence of a court judgment or allegation of patent |
| 199 | +infringement or for any other reason (not limited to patent issues), |
| 200 | +conditions are imposed on you (whether by court order, agreement or |
| 201 | +otherwise) that contradict the conditions of this License, they do not |
| 202 | +excuse you from the conditions of this License. If you cannot |
| 203 | +distribute so as to satisfy simultaneously your obligations under this |
| 204 | +License and any other pertinent obligations, then as a consequence you |
| 205 | +may not distribute the Program at all. For example, if a patent |
| 206 | +license would not permit royalty-free redistribution of the Program by |
| 207 | +all those who receive copies directly or indirectly through you, then |
| 208 | +the only way you could satisfy both it and this License would be to |
| 209 | +refrain entirely from distribution of the Program. |
| 210 | + |
| 211 | +If any portion of this section is held invalid or unenforceable under |
| 212 | +any particular circumstance, the balance of the section is intended to |
| 213 | +apply and the section as a whole is intended to apply in other |
| 214 | +circumstances. |
| 215 | + |
| 216 | +It is not the purpose of this section to induce you to infringe any |
| 217 | +patents or other property right claims or to contest validity of any |
| 218 | +such claims; this section has the sole purpose of protecting the |
| 219 | +integrity of the free software distribution system, which is |
| 220 | +implemented by public license practices. Many people have made |
| 221 | +generous contributions to the wide range of software distributed |
| 222 | +through that system in reliance on consistent application of that |
| 223 | +system; it is up to the author/donor to decide if he or she is willing |
| 224 | +to distribute software through any other system and a licensee cannot |
| 225 | +impose that choice. |
| 226 | + |
| 227 | +This section is intended to make thoroughly clear what is believed to |
| 228 | +be a consequence of the rest of this License. |
| 229 | + |
| 230 | + 8. If the distribution and/or use of the Program is restricted in |
| 231 | +certain countries either by patents or by copyrighted interfaces, the |
| 232 | +original copyright holder who places the Program under this License |
| 233 | +may add an explicit geographical distribution limitation excluding |
| 234 | +those countries, so that distribution is permitted only in or among |
| 235 | +countries not thus excluded. In such case, this License incorporates |
| 236 | +the limitation as if written in the body of this License. |
| 237 | + |
| 238 | + 9. The Free Software Foundation may publish revised and/or new versions |
| 239 | +of the General Public License from time to time. Such new versions will |
| 240 | +be similar in spirit to the present version, but may differ in detail to |
| 241 | +address new problems or concerns. |
| 242 | + |
| 243 | +Each version is given a distinguishing version number. If the Program |
| 244 | +specifies a version number of this License which applies to it and "any |
| 245 | +later version", you have the option of following the terms and conditions |
| 246 | +either of that version or of any later version published by the Free |
| 247 | +Software Foundation. If the Program does not specify a version number of |
| 248 | +this License, you may choose any version ever published by the Free Software |
| 249 | +Foundation. |
| 250 | + |
| 251 | + 10. If you wish to incorporate parts of the Program into other free |
| 252 | +programs whose distribution conditions are different, write to the author |
| 253 | +to ask for permission. For software which is copyrighted by the Free |
| 254 | +Software Foundation, write to the Free Software Foundation; we sometimes |
| 255 | +make exceptions for this. Our decision will be guided by the two goals |
| 256 | +of preserving the free status of all derivatives of our free software and |
| 257 | +of promoting the sharing and reuse of software generally. |
| 258 | + |
| 259 | + NO WARRANTY |
| 260 | + |
| 261 | + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
| 262 | +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
| 263 | +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
| 264 | +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
| 265 | +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 266 | +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
| 267 | +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
| 268 | +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
| 269 | +REPAIR OR CORRECTION. |
| 270 | + |
| 271 | + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
| 272 | +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
| 273 | +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
| 274 | +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
| 275 | +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
| 276 | +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
| 277 | +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
| 278 | +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
| 279 | +POSSIBILITY OF SUCH DAMAGES. |
| 280 | + |
| 281 | + END OF TERMS AND CONDITIONS |
| 282 | + |
| 283 | + How to Apply These Terms to Your New Programs |
| 284 | + |
| 285 | + If you develop a new program, and you want it to be of the greatest |
| 286 | +possible use to the public, the best way to achieve this is to make it |
| 287 | +free software which everyone can redistribute and change under these terms. |
| 288 | + |
| 289 | + To do so, attach the following notices to the program. It is safest |
| 290 | +to attach them to the start of each source file to most effectively |
| 291 | +convey the exclusion of warranty; and each file should have at least |
| 292 | +the "copyright" line and a pointer to where the full notice is found. |
| 293 | + |
| 294 | + <one line to give the program's name and a brief idea of what it does.> |
| 295 | + Copyright (C) <year> <name of author> |
| 296 | + |
| 297 | + This program is free software; you can redistribute it and/or modify |
| 298 | + it under the terms of the GNU General Public License as published by |
| 299 | + the Free Software Foundation; either version 2 of the License, or |
| 300 | + (at your option) any later version. |
| 301 | + |
| 302 | + This program is distributed in the hope that it will be useful, |
| 303 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 304 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 305 | + GNU General Public License for more details. |
| 306 | + |
| 307 | + You should have received a copy of the GNU General Public License along |
| 308 | + with this program; if not, write to the Free Software Foundation, Inc., |
| 309 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 310 | + |
| 311 | +Also add information on how to contact you by electronic and paper mail. |
| 312 | + |
| 313 | +If the program is interactive, make it output a short notice like this |
| 314 | +when it starts in an interactive mode: |
| 315 | + |
| 316 | + Gnomovision version 69, Copyright (C) year name of author |
| 317 | + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
| 318 | + This is free software, and you are welcome to redistribute it |
| 319 | + under certain conditions; type `show c' for details. |
| 320 | + |
| 321 | +The hypothetical commands `show w' and `show c' should show the appropriate |
| 322 | +parts of the General Public License. Of course, the commands you use may |
| 323 | +be called something other than `show w' and `show c'; they could even be |
| 324 | +mouse-clicks or menu items--whatever suits your program. |
| 325 | + |
| 326 | +You should also get your employer (if you work as a programmer) or your |
| 327 | +school, if any, to sign a "copyright disclaimer" for the program, if |
| 328 | +necessary. Here is a sample; alter the names: |
| 329 | + |
| 330 | + Yoyodyne, Inc., hereby disclaims all copyright interest in the program |
| 331 | + `Gnomovision' (which makes passes at compilers) written by James Hacker. |
| 332 | + |
| 333 | + <signature of Ty Coon>, 1 April 1989 |
| 334 | + Ty Coon, President of Vice |
| 335 | + |
| 336 | +This General Public License does not permit incorporating your program into |
| 337 | +proprietary programs. If your program is a subroutine library, you may |
| 338 | +consider it more useful to permit linking proprietary applications with the |
| 339 | +library. If this is what you want to do, use the GNU Lesser General |
| 340 | +Public License instead of this License. |
Property changes on: tags/extensions/PageSchemas/REL_0_3/LICENSE |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 341 | + native |
Index: tags/extensions/PageSchemas/REL_0_3/PS_ExtensionHandler.php |
— | — | @@ -0,0 +1,109 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * PSExtensionHandler - meant to be subclassed by the Page Schemas handler |
| 5 | + * class for each extension. |
| 6 | + * |
| 7 | + * @author Yaron Koren |
| 8 | + * @file |
| 9 | + * @ingroup SF |
| 10 | + */ |
| 11 | + |
| 12 | +class PSExtensionHandler { |
| 13 | + |
| 14 | + /** |
| 15 | + * Creates an object to hold form-wide information, based on an XML |
| 16 | + * object from the Page Schemas extension. |
| 17 | + */ |
| 18 | + public static function createPageSchemasObject( $tagName, $xml ) { |
| 19 | + return array(); |
| 20 | + } |
| 21 | + |
| 22 | + /** |
| 23 | + * Creates Page Schemas XML for form-wide information. |
| 24 | + */ |
| 25 | + public static function createSchemaXMLFromForm() { |
| 26 | + return null; |
| 27 | + } |
| 28 | + |
| 29 | + /** |
| 30 | + * Creates Page Schemas XML for form information on templates. |
| 31 | + */ |
| 32 | + public static function createTemplateXMLFromForm() { |
| 33 | + return null; |
| 34 | + } |
| 35 | + |
| 36 | + /** |
| 37 | + * Creates Page Schemas XML for form fields. |
| 38 | + */ |
| 39 | + public static function createFieldXMLFromForm() { |
| 40 | + return null; |
| 41 | + } |
| 42 | + |
| 43 | + public static function getDisplayColor() { |
| 44 | + return 'white'; |
| 45 | + } |
| 46 | + |
| 47 | + public static function getSchemaDisplayString() { |
| 48 | + return null; |
| 49 | + } |
| 50 | + |
| 51 | + public static function getSchemaEditingHTML( $pageSchema ) { |
| 52 | + return null; |
| 53 | + } |
| 54 | + |
| 55 | + public static function getTemplateDisplayString() { |
| 56 | + return null; |
| 57 | + } |
| 58 | + |
| 59 | + public static function getTemplateEditingHTML( $psTemplate ) { |
| 60 | + return null; |
| 61 | + } |
| 62 | + |
| 63 | + public static function getFieldDisplayString() { |
| 64 | + return null; |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * Returns the HTML for inputs to define a single form field, |
| 69 | + * within the Page Schemas 'edit schema' page. |
| 70 | + */ |
| 71 | + public static function getFieldEditingHTML( $psField ) { |
| 72 | + return null; |
| 73 | + } |
| 74 | + |
| 75 | + public static function getFieldInfo( $psTemplate ) { |
| 76 | + return null; |
| 77 | + } |
| 78 | + |
| 79 | + /** |
| 80 | + * Return the list of pages that Semantic Forms could generate from |
| 81 | + * the current Page Schemas schema. |
| 82 | + */ |
| 83 | + public static function getPagesToGenerate( $psSchemaObj ) { |
| 84 | + return array(); |
| 85 | + } |
| 86 | + |
| 87 | + /** |
| 88 | + * Generate pages (form and templates) specified in the list. |
| 89 | + */ |
| 90 | + public static function generatePages( $psSchemaObj, $selectedPages ) { |
| 91 | + } |
| 92 | + |
| 93 | + public static function getSchemaDisplayValues( $schemaXML ) { |
| 94 | + return null; |
| 95 | + } |
| 96 | + |
| 97 | + /** |
| 98 | + * Displays form details for one template in the Page Schemas XML. |
| 99 | + */ |
| 100 | + public static function getTemplateDisplayValues( $templateXML ) { |
| 101 | + return null; |
| 102 | + } |
| 103 | + |
| 104 | + /** |
| 105 | + * Displays data on a single form input in the Page Schemas XML. |
| 106 | + */ |
| 107 | + public static function getFieldDisplayValues( $fieldXML ) { |
| 108 | + return null; |
| 109 | + } |
| 110 | +} |
Property changes on: tags/extensions/PageSchemas/REL_0_3/PS_ExtensionHandler.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 111 | + native |
Index: tags/extensions/PageSchemas/REL_0_3/PageSchemas.classes.php |
— | — | @@ -0,0 +1,476 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Classes for the Page Schemas extension. |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +/** |
| 11 | + * Class that holds utility functions for the Page Schemas extension. |
| 12 | + */ |
| 13 | +class PageSchemas { |
| 14 | + |
| 15 | + public static function getCategoriesWithPSDefined(){ |
| 16 | + $cat_titles = array(); |
| 17 | + $dbr = wfGetDB( DB_SLAVE ); |
| 18 | + //get the result set, query : select page_props |
| 19 | + $res = $dbr->select( 'page_props', |
| 20 | + array( |
| 21 | + 'pp_page', |
| 22 | + 'pp_propname', |
| 23 | + 'pp_value' |
| 24 | + ), |
| 25 | + array( |
| 26 | + 'pp_propname' => 'PageSchema' |
| 27 | + ) |
| 28 | + ); |
| 29 | + while ( $row = $dbr->fetchRow( $res ) ) { |
| 30 | + if( $row[2] != null ){ |
| 31 | + $page_id_cat = $row[0]; |
| 32 | + if( Title::newFromId($page_id_cat)->getNamespace() == NS_CATEGORY){ |
| 33 | + $cat_text = Title::newFromId($page_id_cat)->getText(); |
| 34 | + $cat_titles[] = $cat_text; |
| 35 | + } |
| 36 | + } |
| 37 | + } |
| 38 | + $dbr->freeResult( $res ); |
| 39 | + return $cat_titles; |
| 40 | + } |
| 41 | + |
| 42 | + /** |
| 43 | + * Includes the necessary Javascript and CSS files for the form |
| 44 | + * to display and work correctly. |
| 45 | + * |
| 46 | + * Accepts an optional Parser instance, or uses $wgOut if omitted. |
| 47 | + */ |
| 48 | + public static function addJavascriptAndCSS( $parser = null ) { |
| 49 | + global $wgOut; |
| 50 | + |
| 51 | + if ( !$parser ) { |
| 52 | + $wgOut->addMeta( 'robots', 'noindex,nofollow' ); |
| 53 | + } |
| 54 | + |
| 55 | + // Handling depends on whether or not this page is embedded |
| 56 | + // in another page. |
| 57 | + if ( !is_null( $parser ) ) { |
| 58 | + $output = $parser->getOutput(); |
| 59 | + } else { |
| 60 | + global $wgOut; |
| 61 | + $output = $wgOut; |
| 62 | + } |
| 63 | + $output->addModules( 'ext.pageschemas.main' ); |
| 64 | + } |
| 65 | + |
| 66 | + public static function titleString( $title ) { |
| 67 | + $namespace = $title->getNsText(); |
| 68 | + if ( $namespace != '' ) { |
| 69 | + $namespace .= ':'; |
| 70 | + } |
| 71 | + if ( MWNamespace::isCapitalized( $title->getNamespace() ) ) { |
| 72 | + global $wgContLang; |
| 73 | + return $namespace . $wgContLang->ucfirst( $title->getText() ); |
| 74 | + } else { |
| 75 | + return $namespace . $title->getText(); |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | + public static function validateXML( $xml, &$error_msg ) { |
| 80 | + $xmlDTD =<<<END |
| 81 | +<?xml version="1.0" encoding="utf-8"?> |
| 82 | +<!DOCTYPE PageSchema [ |
| 83 | +<!ELEMENT PageSchema (Template*)> |
| 84 | +<!ELEMENT PageSchema (semanticforms_Form*)> |
| 85 | +<!ATTLIST PageSchema name CDATA #REQUIRED> |
| 86 | +<!ELEMENT Template (Field*)> |
| 87 | +<!ATTLIST Template name CDATA #REQUIRED> |
| 88 | +<!ATTLIST semanticforms_Form name CDATA #REQUIRED> |
| 89 | +<!ATTLIST Field name CDATA #REQUIRED> |
| 90 | +]> |
| 91 | + |
| 92 | +END; |
| 93 | + // <? - this little tag is here to restore syntax highlighting in vi |
| 94 | + |
| 95 | + // We are using the SimpleXML library to do the XML validation |
| 96 | + // for now - this may change later. |
| 97 | + // Hide parsing warnings. |
| 98 | + libxml_use_internal_errors(true); |
| 99 | + $xml_success = simplexml_load_string($xmlDTD.$xml); |
| 100 | + $errors = libxml_get_errors(); |
| 101 | + $error_msg = $errors[0]->message; |
| 102 | + return $xml_success; |
| 103 | + } |
| 104 | + |
| 105 | + static function tableRowHTML( $css_class, $data_type, $value = null, $bgColor = null ) { |
| 106 | + $data_type = htmlspecialchars( $data_type ); |
| 107 | + if ( !is_null( $bgColor ) ) { |
| 108 | + // We don't actually use the passed-in background color, except as an indicator |
| 109 | + // that this is a header row for extension data, and thus should have special |
| 110 | + // display. |
| 111 | + // In the future, the background color may get used, though. |
| 112 | + $data_type = HTML::element( 'span', array( 'style' => "color: #993333;" ), $data_type ); |
| 113 | + } |
| 114 | + if ( $value == '' ) { |
| 115 | + $content = $data_type; |
| 116 | + } else { |
| 117 | + $content = "$data_type: " . HTML::element( 'span', array( 'class' => 'rowValue' ), $value ); |
| 118 | + } |
| 119 | + $cellAttrs = array( 'colspan' => 2, 'class' => $css_class ); |
| 120 | + $cell = HTML::rawElement( 'td', $cellAttrs, $content ); |
| 121 | + $text = HTML::rawElement( 'tr', array( 'style' => 'border: 1px black solid; margin: 10px;' ), $cell ); |
| 122 | + $text .= "\n"; |
| 123 | + return $text; |
| 124 | + } |
| 125 | + |
| 126 | + static function attrRowHTML( $cssClass, $fieldName, $value ) { |
| 127 | + $fieldNameAttrs = array( 'class' => $cssClass, 'style' => 'font-weight: normal;' ); |
| 128 | + $fieldNameCell = HTML::rawElement( 'td', $fieldNameAttrs, $fieldName ); |
| 129 | + $valueCell = HTML::element( 'td', array( 'class' => 'msg', 'style' => 'font-weight: bold;' ), $value ); |
| 130 | + $text = HTML::rawElement( 'tr', null, $fieldNameCell . "\n" . $valueCell ); |
| 131 | + $text .= "\n"; |
| 132 | + return $text; |
| 133 | + } |
| 134 | + |
| 135 | + // TODO - this should be a non-static method of the PSSchema class, |
| 136 | + // instead of taking in XML. |
| 137 | + static function displaySchema( $schemaXML ) { |
| 138 | + global $wgTitle, $wgPageSchemasHandlerClasses; |
| 139 | + |
| 140 | + if ( $wgTitle->getNamespace() != NS_CATEGORY ) { |
| 141 | + return ''; |
| 142 | + } |
| 143 | + $text = "<table class=\"pageSchema mw-collapsible mw-collapsed\">\n"; |
| 144 | + $name = $schemaXML->attributes()->name; |
| 145 | + $text .= self::tableRowHTML( 'pageSchemaHeader', 'Page schema' ); |
| 146 | + |
| 147 | + foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) { |
| 148 | + $returnVals = call_user_func( array( $psHandlerClass, 'getSchemaDisplayValues' ), $schemaXML ); |
| 149 | + if ( count( $returnVals ) != 2 ) { |
| 150 | + continue; |
| 151 | + } |
| 152 | + list( $elementName, $values ) = $returnVals; |
| 153 | + $label = call_user_func( array( $psHandlerClass, 'getSchemaDisplayString' ) ); |
| 154 | + $bgColor = call_user_func( array( $psHandlerClass, 'getDisplayColor' ) ); |
| 155 | + $text .= self::tableRowHTML( 'schemaExtensionRow', $label, $elementName, $bgColor ); |
| 156 | + foreach ( $values as $fieldName => $value ) { |
| 157 | + $text .= self::attrRowHTML( 'schemaAttrRow', $fieldName, $value ); |
| 158 | + } |
| 159 | + } |
| 160 | + foreach ( $schemaXML->children() as $tag => $child ) { |
| 161 | + if ( $tag == 'Template') { |
| 162 | + $text .= self::displayTemplate( $child ); |
| 163 | + } |
| 164 | + } |
| 165 | + $text .= "</table>\n"; |
| 166 | + return $text; |
| 167 | + } |
| 168 | + |
| 169 | + static function displayTemplate ( $templateXML ) { |
| 170 | + global $wgPageSchemasHandlerClasses; |
| 171 | + |
| 172 | + $name = $templateXML->attributes()->name; |
| 173 | + $text = self::tableRowHTML( 'templateRow', 'Template', $name ); |
| 174 | + $multiple = $templateXML->attributes()->multiple; |
| 175 | + if ( $multiple == 'multiple' ) { |
| 176 | + $text .= self::attrRowHTML( 'schemaAttrRow', 'multiple', null ); |
| 177 | + } |
| 178 | + |
| 179 | + foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) { |
| 180 | + $returnVals = call_user_func( array( $psHandlerClass, 'getTemplateDisplayValues' ), $templateXML ); |
| 181 | + if ( count( $returnVals ) != 2 ) { |
| 182 | + continue; |
| 183 | + } |
| 184 | + list( $elementName, $values ) = $returnVals; |
| 185 | + $label = call_user_func( array( $psHandlerClass, 'getTemplateDisplayString' ) ); |
| 186 | + $bgColor = call_user_func( array( $psHandlerClass, 'getDisplayColor' ) ); |
| 187 | + $text .= self::tableRowHTML( 'fieldExtensionRow', $label, $elementName, $bgColor ); |
| 188 | + foreach ( $values as $fieldName => $value ) { |
| 189 | + $text .= self::attrRowHTML( 'fieldAttrRow', $fieldName, $value ); |
| 190 | + } |
| 191 | + } |
| 192 | + foreach ( $templateXML->children() as $child ) { |
| 193 | + $text .= self::displayField( $child ); |
| 194 | + } |
| 195 | + return $text; |
| 196 | + } |
| 197 | + |
| 198 | + static function displayField ( $fieldXML ) { |
| 199 | + global $wgPageSchemasHandlerClasses; |
| 200 | + |
| 201 | + $name = $fieldXML->attributes()->name; |
| 202 | + $text = self::tableRowHTML( 'fieldRow', 'Field', $name ); |
| 203 | + |
| 204 | + if( ((string) $fieldXML->attributes()->list) == "list" ) { |
| 205 | + $text .= self::attrRowHTML( 'fieldAttrRow', 'List', null ); |
| 206 | + } |
| 207 | + $fieldDisplay = (string) $fieldXML->attributes()->display; |
| 208 | + if( $fieldDisplay != "" ) { |
| 209 | + $text .= self::attrRowHTML( 'fieldAttrRow', 'Display', $fieldDisplay ); |
| 210 | + } |
| 211 | + foreach ( $fieldXML->children() as $tag => $child ) { |
| 212 | + if ( $tag == 'Label' ) { |
| 213 | + $text .= self::attrRowHTML( 'fieldAttrRow', 'Label', $child ); |
| 214 | + } |
| 215 | + } |
| 216 | + |
| 217 | + // Let extensions that store data within the Page Schemas XML |
| 218 | + // each handle displaying their data, by adding to this array. |
| 219 | + foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) { |
| 220 | + $returnVals = call_user_func( array( $psHandlerClass, 'getFieldDisplayValues' ), $fieldXML ); |
| 221 | + if ( count( $returnVals ) != 2 ) { |
| 222 | + continue; |
| 223 | + } |
| 224 | + list( $elementName, $values ) = $returnVals; |
| 225 | + $label = call_user_func( array( $psHandlerClass, 'getFieldDisplayString' ) ); |
| 226 | + $bgColor = call_user_func( array( $psHandlerClass, 'getDisplayColor' ) ); |
| 227 | + $text .= self::tableRowHTML( 'fieldExtensionRow', $label, $elementName, $bgColor ); |
| 228 | + foreach ( $values as $fieldName => $value ) { |
| 229 | + $text .= self::attrRowHTML( 'fieldAttrRow', $fieldName, $value ); |
| 230 | + } |
| 231 | + } |
| 232 | + return $text; |
| 233 | + } |
| 234 | + |
| 235 | + public static function getValueFromObject( $object, $key ) { |
| 236 | + if ( is_null( $object ) ) { |
| 237 | + return null; |
| 238 | + } elseif ( !array_key_exists( $key, $object ) ) { |
| 239 | + return null; |
| 240 | + } |
| 241 | + return $object[$key]; |
| 242 | + } |
| 243 | +} |
| 244 | + |
| 245 | +/** |
| 246 | + * Holds the data contained within the <PageSchema> XML tag. |
| 247 | + */ |
| 248 | +class PSSchema { |
| 249 | + private $mCategoryName = ""; |
| 250 | + private $mPageXML = null; |
| 251 | + /* Stores the template objects */ |
| 252 | + private $mTemplates = array(); |
| 253 | + private $mIsPSDefined = true; |
| 254 | + |
| 255 | + function __construct ( $categoryName ) { |
| 256 | + $this->mCategoryName = $categoryName; |
| 257 | + $title = Title::newFromText( $categoryName, NS_CATEGORY ); |
| 258 | + $dbr = wfGetDB( DB_SLAVE ); |
| 259 | + $res = $dbr->select( 'page_props', |
| 260 | + array( |
| 261 | + 'pp_page', |
| 262 | + 'pp_propname', |
| 263 | + 'pp_value' |
| 264 | + ), |
| 265 | + array( |
| 266 | + 'pp_page' => $title->getArticleID(), |
| 267 | + 'pp_propname' => 'PageSchema' |
| 268 | + ) |
| 269 | + ); |
| 270 | + // first row of the result set |
| 271 | + $row = $dbr->fetchRow( $res ); |
| 272 | + if ( $row == null) { |
| 273 | + $this->mIsPSDefined = false; |
| 274 | + } else { |
| 275 | + // retrieve the third attribute, which is pp_value |
| 276 | + $pageXMLstr = $row[2]; |
| 277 | + $this->mPageXML = simplexml_load_string ( $pageXMLstr ); |
| 278 | + // index for template objects |
| 279 | + $i = 0; |
| 280 | + $inherited_templates = array(); |
| 281 | + foreach ( $this->mPageXML->children() as $tag => $child ) { |
| 282 | + if ( $tag == 'InheritsFrom ' ) { |
| 283 | + $schema_to_inherit = (string) $child->attributes()->schema; |
| 284 | + if( $schema_to_inherit !=null ){ |
| 285 | + $inheritedSchemaObj = new PSSchema( $schema_to_inherit ); |
| 286 | + $inherited_templates = $inheritedSchemaObj->getTemplates(); |
| 287 | + } |
| 288 | + } |
| 289 | + if ( $tag == 'Template' ) { |
| 290 | + $ignore = (string) $child->attributes()->ignore; |
| 291 | + if ( count($child->children()) > 0 ) { |
| 292 | + $templateObj = new PSTemplate($child); |
| 293 | + $this->mTemplates[$i++]= $templateObj; |
| 294 | + } elseif ( $ignore != "true" ) { |
| 295 | + // Code to add templates from inherited templates |
| 296 | + $temp_name = (string) $child->attributes()->name; |
| 297 | + foreach( $inherited_templates as $inherited_template ) { |
| 298 | + if( $temp_name == $inherited_template->getName() ){ |
| 299 | + $this->mTemplates[$i++] = $inherited_template; |
| 300 | + } |
| 301 | + } |
| 302 | + } |
| 303 | + } |
| 304 | + } |
| 305 | + } |
| 306 | + } |
| 307 | + |
| 308 | + /** |
| 309 | + * Generates all pages selected by the user, based on the Page Schemas XML. |
| 310 | + */ |
| 311 | + public function generateAllPages ( $selectedPageList ) { |
| 312 | + global $wgPageSchemasHandlerClasses; |
| 313 | + foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) { |
| 314 | + call_user_func( array( $psHandlerClass, 'generatePages' ), $this, $selectedPageList ); |
| 315 | + } |
| 316 | + } |
| 317 | + |
| 318 | + public function getCategoryName() { |
| 319 | + return $this->mCategoryName; |
| 320 | + } |
| 321 | + |
| 322 | + public function getXML() { |
| 323 | + return $this->mPageXML; |
| 324 | + } |
| 325 | + |
| 326 | + public function isPSDefined() { |
| 327 | + return $this->mIsPSDefined; |
| 328 | + } |
| 329 | + |
| 330 | + /** |
| 331 | + * Returns an array of PSTemplate objects. |
| 332 | + */ |
| 333 | + public function getTemplates() { |
| 334 | + return $this->mTemplates; |
| 335 | + } |
| 336 | + |
| 337 | + public function getObject( $objectName ) { |
| 338 | + global $wgPageSchemasHandlerClasses; |
| 339 | + foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) { |
| 340 | + $object = call_user_func( array( $psHandlerClass, 'createPageSchemasObject' ), $objectName, $this->mPageXML ); |
| 341 | + if ( !is_null( $object ) ) { |
| 342 | + return $object; |
| 343 | + } |
| 344 | + } |
| 345 | + return null; |
| 346 | + } |
| 347 | +} |
| 348 | + |
| 349 | +class PSTemplate { |
| 350 | + private $mFields = array(); |
| 351 | + private $mTemplateName = ""; |
| 352 | + private $mTemplateXML = null; |
| 353 | + private $mMultipleAllowed = false; |
| 354 | + |
| 355 | + function __construct( $templateXML ) { |
| 356 | + $this->mTemplateXML = $templateXML; |
| 357 | + $this->mTemplateName = (string) $templateXML->attributes()->name; |
| 358 | + if( ((string) $templateXML->attributes()->multiple) == "multiple" ) { |
| 359 | + $this->mMultipleAllowed = true; |
| 360 | + } |
| 361 | + // Index for template objects |
| 362 | + $i = 0 ; |
| 363 | + $inherited_fields = array(); |
| 364 | + foreach ($templateXML->children() as $child) { |
| 365 | + if ( $child->getName() == 'InheritsFrom' ) { |
| 366 | + $schema_to_inherit = (string) $child->attributes()->schema; |
| 367 | + $template_to_inherit = (string) $child->attributes()->template; |
| 368 | + if ( $schema_to_inherit != null && $template_to_inherit != null ) { |
| 369 | + $inheritedSchemaObj = new PSSchema( $schema_to_inherit ); |
| 370 | + $inherited_templates = $inheritedSchemaObj->getTemplates(); |
| 371 | + foreach( $inherited_templates as $inherited_template ) { |
| 372 | + if( $template_to_inherit == $inherited_template->getName() ){ |
| 373 | + $inherited_fields = $inherited_template->getFields(); |
| 374 | + } |
| 375 | + } |
| 376 | + } |
| 377 | + } elseif ( $child->getName() == "Field" ) { |
| 378 | + $ignore = (string) $child->attributes()->ignore; |
| 379 | + if ( count($child->children()) > 0 ) { //@TODO :Can be dealt more efficiently |
| 380 | + $fieldObj = new PSTemplateField( $child ); |
| 381 | + $this->mFields[$i++]= $fieldObj; |
| 382 | + } elseif ( $ignore != "true" ) { |
| 383 | + // Code to add fields from inherited templates |
| 384 | + $field_name = (string) $child->attributes()->name; |
| 385 | + foreach ( $inherited_fields as $inherited_field ) { |
| 386 | + if ( $field_name == $inherited_field->getName() ) { |
| 387 | + $this->mFields[$i++]= $inherited_field; |
| 388 | + } |
| 389 | + } |
| 390 | + } |
| 391 | + } |
| 392 | + } |
| 393 | + } |
| 394 | + |
| 395 | + public function getName() { |
| 396 | + return $this->mTemplateName; |
| 397 | + } |
| 398 | + |
| 399 | + public function getXML() { |
| 400 | + return $this->mTemplateXML; |
| 401 | + } |
| 402 | + |
| 403 | + public function isMultiple() { |
| 404 | + return $this->mMultipleAllowed; |
| 405 | + } |
| 406 | + |
| 407 | + public function getObject( $objectName ) { |
| 408 | + global $wgPageSchemasHandlerClasses; |
| 409 | + foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) { |
| 410 | + $object = call_user_func( array( $psHandlerClass, 'createPageSchemasObject' ), $objectName, $this->mTemplateXML ); |
| 411 | + if ( !empty( $object ) ) { |
| 412 | + return $object; |
| 413 | + } |
| 414 | + } |
| 415 | + return null; |
| 416 | + } |
| 417 | + |
| 418 | + public function getFields() { |
| 419 | + return $this->mFields; |
| 420 | + } |
| 421 | +} |
| 422 | + |
| 423 | +class PSTemplateField { |
| 424 | + private $mFieldName = ""; |
| 425 | + private $mFieldXML = null; |
| 426 | + private $mFieldLabel = ""; |
| 427 | + private $mIsList = false; |
| 428 | + private $mDelimiter = null; |
| 429 | + private $mDisplay = null; |
| 430 | + |
| 431 | + function __construct( $fieldXML ) { |
| 432 | + $this->mFieldXML = $fieldXML; |
| 433 | + $this->mFieldName = (string)$fieldXML->attributes()->name; |
| 434 | + if ( ((string)$fieldXML->attributes()->list) == "list") { |
| 435 | + $this->mIsList = true; |
| 436 | + } |
| 437 | + $this->mDelimiter = $fieldXML->attributes()->delimiter; |
| 438 | + $this->mDisplay = $fieldXML->attributes()->display; |
| 439 | + foreach ( $fieldXML->children() as $tag => $child ) { |
| 440 | + if ( $tag == 'Label' ) { |
| 441 | + $this->mFieldLabel = $child; |
| 442 | + } |
| 443 | + } |
| 444 | + } |
| 445 | + |
| 446 | + public function getDelimiter() { |
| 447 | + return $this->mDelimiter; |
| 448 | + } |
| 449 | + |
| 450 | + public function getDisplay() { |
| 451 | + return $this->mDisplay; |
| 452 | + } |
| 453 | + |
| 454 | + public function getName() { |
| 455 | + return $this->mFieldName; |
| 456 | + } |
| 457 | + |
| 458 | + public function getLabel() { |
| 459 | + return $this->mFieldLabel; |
| 460 | + } |
| 461 | + |
| 462 | + public function isList() { |
| 463 | + return $this->mIsList; |
| 464 | + } |
| 465 | + |
| 466 | + public function getObject( $objectName ) { |
| 467 | + global $wgPageSchemasHandlerClasses; |
| 468 | + |
| 469 | + foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) { |
| 470 | + $object = call_user_func( array( $psHandlerClass, 'createPageSchemasObject' ), $objectName, $this->mFieldXML ); |
| 471 | + if ( !is_null( $object ) ) { |
| 472 | + return $object; |
| 473 | + } |
| 474 | + } |
| 475 | + return null; |
| 476 | + } |
| 477 | +} |
Property changes on: tags/extensions/PageSchemas/REL_0_3/PageSchemas.classes.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 478 | + native |
Index: tags/extensions/PageSchemas/REL_0_3/PS_CreatePageJob.php |
— | — | @@ -0,0 +1,47 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Background job to create a new property page, |
| 6 | + * |
| 7 | + * @author Ankit Garg |
| 8 | + */ |
| 9 | +class PSCreatePageJob extends Job { |
| 10 | + |
| 11 | + function __construct( $title, $params = '', $id = 0 ) { |
| 12 | + parent::__construct( 'pageSchemasCreatePage', $title, $params, $id ); |
| 13 | + } |
| 14 | + |
| 15 | + /** |
| 16 | + * Run a pageSchemasCreatePage job |
| 17 | + * @return boolean success |
| 18 | + */ |
| 19 | + function run() { |
| 20 | + wfProfileIn( __METHOD__ ); |
| 21 | + |
| 22 | + if ( is_null( $this->title ) ) { |
| 23 | + $this->error = "pageSchemasCreatePage: Invalid title"; |
| 24 | + wfProfileOut( __METHOD__ ); |
| 25 | + return false; |
| 26 | + } |
| 27 | + $article = new Article( $this->title ); |
| 28 | + if ( !$article ) { |
| 29 | + $this->error = 'pageSchemasCreatePage: Article not found "' . $this->title->getPrefixedDBkey() . '"'; |
| 30 | + wfProfileOut( __METHOD__ ); |
| 31 | + return false; |
| 32 | + } |
| 33 | + |
| 34 | + $page_text = $this->params['page_text']; |
| 35 | + // change global $wgUser variable to the one |
| 36 | + // specified by the job only for the extent of this |
| 37 | + // replacement |
| 38 | + global $wgUser; |
| 39 | + $actual_user = $wgUser; |
| 40 | + $wgUser = User::newFromId( $this->params['user_id'] ); |
| 41 | + $edit_summary = wfMsgForContent( 'ps-generatepages-editsummary' ); |
| 42 | + $article->doEdit( $page_text, $edit_summary ); |
| 43 | + $wgUser = $actual_user; |
| 44 | + wfProfileOut( __METHOD__ ); |
| 45 | + return true; |
| 46 | + } |
| 47 | +} |
| 48 | + |
Property changes on: tags/extensions/PageSchemas/REL_0_3/PS_CreatePageJob.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 49 | + native |
Index: tags/extensions/PageSchemas/REL_0_3/specials/PS_GeneratePages.php |
— | — | @@ -0,0 +1,96 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Displays an interface to let users create all pages based on the |
| 5 | + * Page Schemas XML. |
| 6 | + * |
| 7 | + * @author Ankit Garg |
| 8 | + * @author Yaron Koren |
| 9 | + */ |
| 10 | + |
| 11 | + |
| 12 | +class PSGeneratePages extends IncludableSpecialPage { |
| 13 | + function __construct() { |
| 14 | + parent::__construct( 'GeneratePages', 'generatepages' ); |
| 15 | + } |
| 16 | + |
| 17 | + function execute( $category ) { |
| 18 | + global $wgUser, $wgRequest, $wgOut, $wgPageSchemasHandlerClasses; |
| 19 | + |
| 20 | + if ( ! $wgUser->isAllowed( 'generatepages' ) ) { |
| 21 | + $wgOut->permissionRequired( 'generatepages' ); |
| 22 | + return; |
| 23 | + } |
| 24 | + |
| 25 | + $this->setHeaders(); |
| 26 | + $param = $wgRequest->getText('param'); |
| 27 | + if ( !empty( $param ) && !empty( $category ) ) { |
| 28 | + // Generate the pages! |
| 29 | + $this->generatePages( $param, $wgRequest->getArray( 'page' ) ); |
| 30 | + $text = Html::element( 'p', null, wfMsg( 'ps-generatepages-success' ) ); |
| 31 | + $wgOut->addHTML( $text ); |
| 32 | + return true; |
| 33 | + } |
| 34 | + |
| 35 | + if ( $category == "") { |
| 36 | + // No category listed. |
| 37 | + // TODO - show an error message. |
| 38 | + return true; |
| 39 | + } |
| 40 | + |
| 41 | + // Standard "generate pages" form, with category name set. |
| 42 | + // Check for a valid category, with a page schema defined. |
| 43 | + $pageSchemaObj = new PSSchema( $category ); |
| 44 | + if ( !$pageSchemaObj->isPSDefined() ) { |
| 45 | + $text = Html::element( 'p', null, wfMsg( 'ps-generatepages-noschema' ) ); |
| 46 | + $wgOut->addHTML( $text ); |
| 47 | + return true; |
| 48 | + } |
| 49 | + |
| 50 | + $text = Html::element( 'p', null, wfMsg( 'ps-generatepages-desc' ) ) . "\n"; |
| 51 | + $text .= '<form method="post">'; |
| 52 | + $text .= Html::input( 'param', $category, 'hidden' ) . "\n"; |
| 53 | + |
| 54 | + // This hook will set an array of strings, with each value |
| 55 | + // as a title of a page to be created. |
| 56 | + $pageList = array(); |
| 57 | + foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) { |
| 58 | + $pagesFromHandler = call_user_func( array( $psHandlerClass, "getPagesToGenerate" ), $pageSchemaObj ); |
| 59 | + foreach ( $pagesFromHandler as $page ) { |
| 60 | + $pageList[] = $page; |
| 61 | + } |
| 62 | + } |
| 63 | + // SpecialPage::getSkin() was added in MW 1.18 |
| 64 | + if ( is_callable( $this, 'getSkin' ) ) { |
| 65 | + $skin = $this->getSkin(); |
| 66 | + } else { |
| 67 | + global $wgUser; |
| 68 | + $skin = $wgUser->getSkin(); |
| 69 | + } |
| 70 | + foreach ( $pageList as $page ) { |
| 71 | + if ( !( $page instanceof Title ) ) { continue; } |
| 72 | + $pageName = PageSchemas::titleString( $page ); |
| 73 | + $text .= Html::input( 'page[]', $pageName, 'checkbox', array( 'checked' => true ) ); |
| 74 | + $text .= "\n" . $skin->link( $page ) . "<br />\n"; |
| 75 | + } |
| 76 | + $text .= "<br />\n"; |
| 77 | + $text .= Html::input( null, wfMsg( 'generatepages' ), 'submit' ); |
| 78 | + $text .= "\n</form>"; |
| 79 | + $wgOut->addHTML( $text ); |
| 80 | + return true; |
| 81 | + } |
| 82 | + |
| 83 | + /** |
| 84 | + * Creates all the pages that the user specified. |
| 85 | + */ |
| 86 | + function generatePages( $categoryName, $selectedPageList ) { |
| 87 | + $pageSchema = new PSSchema( $categoryName ); |
| 88 | + $pageSchema->generateAllPages( $selectedPageList ); |
| 89 | + } |
| 90 | + |
| 91 | + /** |
| 92 | + * Don't list this in Special:SpecialPages. |
| 93 | + */ |
| 94 | + function isListed() { |
| 95 | + return false; |
| 96 | + } |
| 97 | +} |
Property changes on: tags/extensions/PageSchemas/REL_0_3/specials/PS_GeneratePages.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 98 | + native |
Index: tags/extensions/PageSchemas/REL_0_3/specials/PS_EditSchema.php |
— | — | @@ -0,0 +1,557 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Displays an interface to let users create and edit the <PageSchema> XML. |
| 5 | + * |
| 6 | + * @author Ankit Garg |
| 7 | + * @author Yaron Koren |
| 8 | + */ |
| 9 | + |
| 10 | +class PSEditSchema extends IncludableSpecialPage { |
| 11 | + function __construct() { |
| 12 | + parent::__construct( 'EditSchema', 'edit' ); |
| 13 | + } |
| 14 | + |
| 15 | + /** |
| 16 | + * Returns a nicely-formatted version of the XML passed in. |
| 17 | + * |
| 18 | + * Code based on |
| 19 | + * http://coffeecoders.de/2011/03/how-to-pretty-print-a-simplexmlobject-in-php/ |
| 20 | + */ |
| 21 | + static function prettyPrintXML( $xml ){ |
| 22 | + // Turn the XML string into a DOMDocument object, and then |
| 23 | + // back again, to have it displayed nicely. |
| 24 | + $domDocument = new DOMDocument('1.0'); |
| 25 | + $domDocument->preserveWhiteSpace = false; |
| 26 | + $domDocument->formatOutput = true; |
| 27 | + $domDocument->loadXML( $xml ); |
| 28 | + return $domDocument->saveXML( $domDocument->documentElement ); |
| 29 | + } |
| 30 | + |
| 31 | + /** |
| 32 | + * Creates full <PageSchema> XML text, based on what was passed in by |
| 33 | + * the form. |
| 34 | + */ |
| 35 | + static function createPageSchemaXMLFromForm() { |
| 36 | + global $wgRequest, $wgPageSchemasHandlerClasses; |
| 37 | + |
| 38 | + // Generate the XML from the form elements. |
| 39 | + $psXML = '<PageSchema>'; |
| 40 | + $additionalXML = $wgRequest->getText( 'ps_add_xml' ); |
| 41 | + $psXML .= $additionalXML; |
| 42 | + $fieldName = ""; |
| 43 | + $fieldNum = -1; |
| 44 | + $templateNum = -1; |
| 45 | + // Arrays to store the extension-specific XML entered in the form |
| 46 | + $schemaXMLFromExtensions = array(); |
| 47 | + $templateXMLFromExtensions = array(); |
| 48 | + $fieldXMLFromExtensions = array(); |
| 49 | + foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) { |
| 50 | + $schemaXMLFromExtensions[] = call_user_func( array( $psHandlerClass, 'createSchemaXMLFromForm' ) ); |
| 51 | + $templateXMLFromExtensions[] = call_user_func( array( $psHandlerClass, 'createTemplateXMLFromForm' ) ); |
| 52 | + $fieldXMLFromExtensions[] = call_user_func( array( $psHandlerClass, 'createFieldXMLFromForm' ) ); |
| 53 | + } |
| 54 | + foreach ( $schemaXMLFromExtensions as $xml ) { |
| 55 | + if ( !empty( $xml ) ) { |
| 56 | + $psXML .= $xml; |
| 57 | + } |
| 58 | + } |
| 59 | + foreach ( $wgRequest->getValues() as $var => $val ) { |
| 60 | + // Ignore fields from the hidden/starter div |
| 61 | + if ( substr( $var, 0, 7 ) == 't_name_' ) { |
| 62 | + $templateNum = substr( $var, 7 ); |
| 63 | + $templateAttrs = array( 'name' => $val ); |
| 64 | + if ( $wgRequest->getCheck( 'is_multiple_' . $templateNum ) ) { |
| 65 | + $templateAttrs['multiple'] = 'multiple'; |
| 66 | + } |
| 67 | + $psXML .= Xml::openElement( 'Template', $templateAttrs ); |
| 68 | + |
| 69 | + // Get XML created by extensions for this template |
| 70 | + foreach ( $templateXMLFromExtensions as $extensionName => $xmlPerTemplate ) { |
| 71 | + if ( !empty( $xmlPerTemplate[$templateNum] ) ) { |
| 72 | + $psXML .= $xmlPerTemplate[$templateNum]; |
| 73 | + } |
| 74 | + } |
| 75 | + } elseif ( substr( $var, 0, 7 ) == 'f_name_' ) { |
| 76 | + $fieldNum = substr( $var, 7 ); |
| 77 | + $fieldName = $val; |
| 78 | + $fieldAttrs = array( 'name' => $fieldName ); |
| 79 | + if ( $wgRequest->getCheck( 'f_is_list_' . $fieldNum ) ) { |
| 80 | + $fieldAttrs['list'] = 'list'; |
| 81 | + $delimiter = $wgRequest->getText( 'f_delimiter_' . $fieldNum ); |
| 82 | + if ( $delimiter != '' ) { |
| 83 | + $fieldAttrs['delimiter'] = $delimiter; |
| 84 | + } |
| 85 | + } |
| 86 | + $fieldDisplay = $wgRequest->getText( 'f_display_' . $fieldNum ); |
| 87 | + if ( $fieldDisplay != 'show' ) { |
| 88 | + $fieldAttrs['display'] = $fieldDisplay; |
| 89 | + } |
| 90 | + $psXML .= Xml::openElement( 'Field', $fieldAttrs ); |
| 91 | + } elseif ( substr( $var, 0, 8 ) == 'f_label_' ) { |
| 92 | + if ( !empty( $val ) ) { |
| 93 | + $psXML .= '<Label>' . $val . '</Label>'; |
| 94 | + } |
| 95 | + |
| 96 | + // Get XML created by extensions for this field |
| 97 | + foreach ( $fieldXMLFromExtensions as $extensionName => $xmlPerField ) { |
| 98 | + if ( !empty( $xmlPerField[$fieldNum] ) ) { |
| 99 | + $psXML .= $xmlPerField[$fieldNum]; |
| 100 | + } |
| 101 | + } |
| 102 | + } elseif ( substr( $var, 0, 10 ) == 'f_add_xml_' ) { |
| 103 | + $psXML .= $val; |
| 104 | + $psXML .= '</Field>'; |
| 105 | + } elseif ( substr( $var, 0, 10 ) == 't_add_xml_' ) { |
| 106 | + $psXML .= $val; |
| 107 | + $psXML .= '</Template>'; |
| 108 | + } |
| 109 | + } |
| 110 | + $psXML .= '</PageSchema>'; |
| 111 | + return self::prettyPrintXML( $psXML ); |
| 112 | + } |
| 113 | + |
| 114 | + /** |
| 115 | + * Displays a list of links to categories that have a page schema |
| 116 | + * defined; for use in Special:EditSchema, if no category is specified. |
| 117 | + */ |
| 118 | + static function showLinksToCategories() { |
| 119 | + $cat_titles = array(); |
| 120 | + $count_title = 0; |
| 121 | + $text = ""; |
| 122 | + $dbr = wfGetDB( DB_SLAVE ); |
| 123 | + //get the result set, query : slect page_props |
| 124 | + $res = $dbr->select( 'page_props', |
| 125 | + array( |
| 126 | + 'pp_page', |
| 127 | + 'pp_propname', |
| 128 | + 'pp_value' |
| 129 | + ), |
| 130 | + array( |
| 131 | + 'pp_propname' => 'PageSchema' |
| 132 | + ) |
| 133 | + ); |
| 134 | + $editSchemaPage = SpecialPage::getTitleFor( 'EditSchema' ); |
| 135 | + $text .= "<ul>\n"; |
| 136 | + while ( $row = $dbr->fetchRow( $res ) ) { |
| 137 | + if ( $row[2] == null ) { |
| 138 | + continue; |
| 139 | + } |
| 140 | + $catTitle = Title::newFromID( $row[0] ); |
| 141 | + if ( $catTitle->getNamespace() !== NS_CATEGORY ) { |
| 142 | + continue; |
| 143 | + } |
| 144 | + $catName = $catTitle->getText(); |
| 145 | + $url = $catTitle->getFullURL( 'action=editschema' ); |
| 146 | + $text .= Html::rawElement( 'li', |
| 147 | + null, |
| 148 | + Html::element( 'a', array( 'href' => $url ), $catName ) |
| 149 | + ); |
| 150 | + } |
| 151 | + $text .= "</ul>\n"; |
| 152 | + $dbr->freeResult( $res ); |
| 153 | + return $text; |
| 154 | + } |
| 155 | + |
| 156 | + /** |
| 157 | + * Returns the HTML for one section of the EditSchema form. |
| 158 | + */ |
| 159 | + static function printFormSection( $label, $headerColor, $mainHTML, $sectionClass, $hasExistingValues = true ) { |
| 160 | + // Section header |
| 161 | + $headerContents = ''; |
| 162 | + if ( empty( $sectionClass ) ) { |
| 163 | + $checkboxAttrs = array( 'class' => 'sectionCheckbox' ); |
| 164 | + if ( $hasExistingValues ) { |
| 165 | + $checkboxAttrs['checked'] = true; |
| 166 | + } |
| 167 | + $headerContents .= "\n\t\t" . Html::input( 'show_section', null, 'checkbox', $checkboxAttrs ) . ' '; |
| 168 | + } |
| 169 | + $headerContents .= $label . "\n"; |
| 170 | + $sectionHTML = "\n\t\t\t\t\t" . Html::rawElement( 'div', array( |
| 171 | + 'class' => 'sectionHeader', |
| 172 | + 'style' => "background: $headerColor;" |
| 173 | + ), $headerContents ); |
| 174 | + |
| 175 | + // Body of section, with all the inputs. |
| 176 | + $sectionHTML .= "\n\t" . Html::rawElement( 'div', array( 'class' => 'sectionBody' ), "\n" . $mainHTML ); |
| 177 | + |
| 178 | + // Wrapper around the whole thing. |
| 179 | + $className = "editSchemaSection $sectionClass"; |
| 180 | + $text = "\n\t\t\t\t" . Html::rawElement( 'div', array( 'class' => $className ), $sectionHTML ) . "\n"; |
| 181 | + return $text; |
| 182 | + } |
| 183 | + |
| 184 | + /** |
| 185 | + * Returns the HTML for a form section coming from a specific extension. |
| 186 | + */ |
| 187 | + static function printFieldHTMLForExtension( $valuesFromExtension, $label, $color ) { |
| 188 | + list( $html, $hasExistingValues ) = $valuesFromExtension; |
| 189 | + return self::printFormSection( $label, $color, $html, null, $hasExistingValues ); |
| 190 | + } |
| 191 | + |
| 192 | + /** |
| 193 | + * Returns the HTML for a section of the form comprising one |
| 194 | + * template field. |
| 195 | + */ |
| 196 | + static function printFieldSection( $field_xml = null, $psField = null ) { |
| 197 | + global $wgPageSchemasHandlerClasses; |
| 198 | + |
| 199 | + if ( is_null( $field_xml ) ) { |
| 200 | + $fieldNum = 'fnum'; |
| 201 | + } else { |
| 202 | + global $wgPageSchemasFieldNum; |
| 203 | + $fieldNum = $wgPageSchemasFieldNum; |
| 204 | + $wgPageSchemasFieldNum++; |
| 205 | + } |
| 206 | + |
| 207 | + $fieldName = ''; |
| 208 | + $delimiter = ''; |
| 209 | + $fieldLabel = ''; |
| 210 | + $isListAttrs = array( 'class' => 'isListCheckbox' ); |
| 211 | + $delimiterAttrs = array( 'class' => 'delimiterInput' ); |
| 212 | + $fieldDisplay = ''; |
| 213 | + $text = "\n\t\t\t"; |
| 214 | + if ( is_null( $field_xml ) ) { |
| 215 | + $text .= '<div class="fieldBox" id="starterField" style="display: none" >'; |
| 216 | + } else { |
| 217 | + $text .= '<div class="fieldBox" >'; |
| 218 | + $fieldName = (string)$field_xml->attributes()->name; |
| 219 | + if ( ((string)$field_xml->attributes()->delimiter) != null || ((string)$field_xml->attributes()->delimiter) != '' ) { |
| 220 | + $delimiter = (string)$field_xml->attributes()->delimiter; |
| 221 | + } |
| 222 | + foreach ( $field_xml->children() as $tag => $child ) { |
| 223 | + if ( $tag == 'Label' ) { |
| 224 | + $fieldLabel = (string)$child; |
| 225 | + } |
| 226 | + } |
| 227 | + if ( ((string)$field_xml->attributes()->list) == "list" ) { |
| 228 | + $isListAttrs['checked'] = 'checked'; |
| 229 | + } |
| 230 | + $fieldDisplay = (string)$field_xml->attributes()->display; |
| 231 | + } |
| 232 | + $fieldHTML = wfMsg( 'ps-namelabel' ) . ' '; |
| 233 | + $fieldHTML .= Html::input( 'f_name_' . $fieldNum, $fieldName, 'text', array( 'size' => 25 ) ) . ' '; |
| 234 | + $fieldHTML .= wfMsg( 'ps-displaylabel' ) . ' '; |
| 235 | + $fieldHTML .= Html::input( 'f_label_' . $fieldNum, $fieldLabel, 'text', array( 'size' => 25 ) ); |
| 236 | + $fieldHTML = Html::rawElement( 'p', null, $fieldHTML ) . "\n"; |
| 237 | + $fieldIsListInput = Html::input( 'f_is_list_' . $fieldNum, null, 'checkbox', $isListAttrs ); |
| 238 | + $fieldHTML .= Html::rawElement( 'p', null, $fieldIsListInput . ' ' . wfMsg( 'ps-field-list-label' ) ); |
| 239 | + $fieldDelimiterInput = Html::input ( 'f_delimiter_' . $fieldNum, $delimiter, 'text', array( 'size' => 3 ) ); |
| 240 | + $fieldHTML .= "\n" . Html::rawElement( 'p', $delimiterAttrs, wfMsg( 'ps-delimiter-label' ) . ' ' . $fieldDelimiterInput ); |
| 241 | + // Create radiobutton for display of field |
| 242 | + $displayShownAttrs = array(); |
| 243 | + $displayIfNonEmptyAttrs = array(); |
| 244 | + $displayHiddenAttrs = array(); |
| 245 | + // Now set which of the values should be checked |
| 246 | + if ( $fieldDisplay == '' ) { |
| 247 | + $displayShownAttrs['checked'] = true; |
| 248 | + } elseif ( $fieldDisplay == 'nonempty' ) { |
| 249 | + $displayIfNonEmptyAttrs['checked'] = true; |
| 250 | + } elseif ( $fieldDisplay == 'hidden' ) { |
| 251 | + $displayHiddenAttrs['checked'] = true; |
| 252 | + } |
| 253 | + $groupName = 'f_display_' . $fieldNum; |
| 254 | + $fieldDisplayShownInput = Html::input( $groupName, 'show', 'radio', $displayShownAttrs ); |
| 255 | + $fieldDisplayIfNonEmptyInput = Html::input( $groupName, 'nonempty', 'radio', $displayIfNonEmptyAttrs ); |
| 256 | + $fieldDisplayHiddenInput = Html::input( $groupName, 'hidden', 'radio', $displayHiddenAttrs ); |
| 257 | + $fieldHTML .= Html::rawElement( 'p', null, $fieldDisplayShownInput . ' ' . "Display this field always" . ' ' . $fieldDisplayIfNonEmptyInput . ' ' . "Display if not empty" . ' ' . $fieldDisplayHiddenInput . ' ' . "Hide" ); |
| 258 | + |
| 259 | + // Insert HTML text from extensions |
| 260 | + foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) { |
| 261 | + $valuesFromExtension = call_user_func( array( $psHandlerClass, "getFieldEditingHTML" ), $psField ); |
| 262 | + if ( is_null( $valuesFromExtension ) ) { |
| 263 | + continue; |
| 264 | + } |
| 265 | + $label = call_user_func( array( $psHandlerClass, "getFieldDisplayString" ) ); |
| 266 | + $color = call_user_func( array( $psHandlerClass, "getDisplayColor" ) ); |
| 267 | + $html = self::printFieldHTMLForExtension( $valuesFromExtension, $label, $color ); |
| 268 | + // We use 'num' here, instead of 'fnum', to distinguish |
| 269 | + // between field names from Page Schemas (which get |
| 270 | + // their number set via Javascript) and field names from |
| 271 | + // other extensions (which get their number set via PHP). |
| 272 | + // Is this important to do? Probably not. |
| 273 | + $fieldHTML .= str_replace( 'num', $fieldNum, $html ); |
| 274 | + } |
| 275 | + |
| 276 | + // TODO - this needs to get set. |
| 277 | + $field_add_xml = null; |
| 278 | + $additionalXMLInput = "\n\t\t\t\t" . Html::textarea( "f_add_xml_$fieldNum", $field_add_xml, array( 'rows' => 4, 'style' => 'width: 100%;' ) ); |
| 279 | + $fieldHTML .= "<p>" . wfMsg('ps-add-xml-label') . $additionalXMLInput . "</p>\n"; |
| 280 | + $fieldHTML .= Html::input( 'remove-field', wfMsg( 'ps-remove-field' ), 'button', |
| 281 | + array( 'class' => 'deleteField' ) |
| 282 | + ); |
| 283 | + $text .= "\n" . self::printFormSection( wfMsg( 'ps-field' ), '#AAA', $fieldHTML, 'editSchemaFieldSection' ); |
| 284 | + $text .= "\t</div><!-- fieldBox -->\n"; |
| 285 | + return $text; |
| 286 | + } |
| 287 | + |
| 288 | + /** |
| 289 | + * Returns the HTML for a section of the form comprising one template. |
| 290 | + */ |
| 291 | + static function printTemplateSection( $template_num = 'tnum', $templateXML = null, $psTemplate = null ) { |
| 292 | + global $wgPageSchemasHandlerClasses; |
| 293 | + |
| 294 | + if ( is_null( $psTemplate ) ) { |
| 295 | + $psTemplateFields = array(); |
| 296 | + } else { |
| 297 | + $psTemplateFields = $psTemplate->getFields(); |
| 298 | + } |
| 299 | + $attrs = array(); |
| 300 | + $templateXMLElements = array(); |
| 301 | + $text = "\t"; |
| 302 | + if ( is_null( $templateXML ) ) { |
| 303 | + $text .= '<div class="templateBox" id="starterTemplate" style="display: none">' . "\n"; |
| 304 | + $templateName = ''; |
| 305 | + } else { |
| 306 | + $text .= '<div class="templateBox" >' . "\n"; |
| 307 | + $templateName = (string) $templateXML->attributes()->name; |
| 308 | + if ( ( (string)$templateXML->attributes()->multiple ) == "multiple" ) { |
| 309 | + $attrs['checked'] = 'checked'; |
| 310 | + } |
| 311 | + $templateXMLElements = $templateXML->children(); |
| 312 | + } |
| 313 | + $templateNameInput = wfMsg( 'ps-namelabel' ) . ' '; |
| 314 | + $templateNameInput .= Html::input( 't_name_' . $template_num, $templateName, 'text' ); |
| 315 | + $templateHTML = "\t\t" . Html::rawElement( 'p', null, $templateNameInput ) . "\n"; |
| 316 | + $templateIsMultipleInput = Html::input( 'is_multiple_' . $template_num, null, 'checkbox', $attrs ); |
| 317 | + $templateHTML .= "\t\t" . Html::rawElement( 'p', null, $templateIsMultipleInput . ' ' . wfMsg( 'ps-multiple-temp-label' ) ); |
| 318 | + $template_add_xml = ""; |
| 319 | + // TODO - set this correctly. |
| 320 | + /* |
| 321 | + foreach ( $templateXMLElements as $templateXMLElement ) { |
| 322 | + if ( !empty( $templateXMLElement ) && $templateXMLElement->getName() != 'Field' ) { |
| 323 | + $template_add_xml .= (string)$templateXMLElement->asXML(); |
| 324 | + } |
| 325 | + } |
| 326 | + */ |
| 327 | + |
| 328 | + foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) { |
| 329 | + $valuesFromExtension = call_user_func( array( $psHandlerClass, "getTemplateEditingHTML" ), $psTemplate ); |
| 330 | + if ( is_null( $valuesFromExtension ) ) { |
| 331 | + continue; |
| 332 | + } |
| 333 | + $label = call_user_func( array( $psHandlerClass, "getTemplateDisplayString" ) ); |
| 334 | + $color = call_user_func( array( $psHandlerClass, "getDisplayColor" ) ); |
| 335 | + $html = self::printFieldHTMLForExtension( $valuesFromExtension, $label, $color ); |
| 336 | + $templateHTML .= str_replace( 'num', $template_num, $html ); |
| 337 | + } |
| 338 | + |
| 339 | + $templateHTML .= "\n\t\t" . '<div class="fieldsList">'; |
| 340 | + $fieldNumInTemplate = 0; |
| 341 | + // If this is a "starter" template, create the starter |
| 342 | + // field HTML. |
| 343 | + if ( is_null( $psTemplate ) ) { |
| 344 | + $templateHTML .= self::printFieldSection(); |
| 345 | + } |
| 346 | + foreach ( $templateXMLElements as $templateXMLElement ) { |
| 347 | + if ( empty( $templateXMLElement ) ) { |
| 348 | + // Do nothing (?) |
| 349 | + } elseif ( $templateXMLElement->getName() == "Field" ) { |
| 350 | + $psTemplateField = $psTemplateFields[$fieldNumInTemplate]; |
| 351 | + $templateHTML .= self::printFieldSection( $templateXMLElement, $psTemplateField ); |
| 352 | + $fieldNumInTemplate++; |
| 353 | + } |
| 354 | + } |
| 355 | + $templateHTML .= "\t</div><!-- fieldsList -->\n"; |
| 356 | + $add_field_button = Xml::element( 'input', |
| 357 | + array( |
| 358 | + 'type' => 'button', |
| 359 | + 'class' => 'editSchemaAddField', |
| 360 | + 'value' => wfMsg( 'ps-add-field' ), |
| 361 | + ) |
| 362 | + ); |
| 363 | + $templateHTML .= Xml::tags( 'p', null, $add_field_button ) . "\n"; |
| 364 | + $templateHTML .= "<hr />\n"; |
| 365 | + $additionalXMLInput = "\n\t\t\t\t" . Html::textarea( "t_add_xml_$template_num", $template_add_xml, array( 'rows' => 4, 'style' => 'width: 100%;' ) ); |
| 366 | + $templateHTML .= "\n<p>" . wfMsg('ps-add-xml-label') . "\n\t\t\t\t" . $additionalXMLInput . "\n\t\t\t</p>"; |
| 367 | + $templateHTML .= '<p>' . Html::input( 'remove-template', 'Remove template', 'button', array( 'class' => 'deleteTemplate' ) ) . "</p>\n"; |
| 368 | + $text .= self::printFormSection( wfMsg( 'ps-template' ), '#CCC', $templateHTML, 'editSchemaTemplateSection' ); |
| 369 | + $text .= "\t</div><!-- templateBox-->\n"; |
| 370 | + return $text; |
| 371 | + } |
| 372 | + |
| 373 | + /** |
| 374 | + * Returns the HTML to display an entire form. |
| 375 | + */ |
| 376 | + static function printForm( $pageSchemaObj = null, $pageXML = null ) { |
| 377 | + global $wgPageSchemasHandlerClasses; |
| 378 | + |
| 379 | + if ( is_null( $pageSchemaObj ) ) { |
| 380 | + $psTemplates = array(); |
| 381 | + } else { |
| 382 | + $psTemplates = $pageSchemaObj->getTemplates(); |
| 383 | + } |
| 384 | + |
| 385 | + if ( is_null( $pageXML ) ) { |
| 386 | + $pageXMLChildren = array(); |
| 387 | + } else { |
| 388 | + $pageXMLChildren = $pageXML->children(); |
| 389 | + } |
| 390 | + |
| 391 | + $ps_add_xml = ''; |
| 392 | + // TODO - set this correctly. |
| 393 | + /* |
| 394 | + foreach ( $pageXMLChildren as $template_xml ) { |
| 395 | + if ( $template_xml->getName() != 'Template') { |
| 396 | + $ps_add_xml .= (string)$template_xml->asXML(); |
| 397 | + } |
| 398 | + } |
| 399 | + */ |
| 400 | + |
| 401 | + $text = '<form id="editSchemaForm" action="" method="post">' . "\n"; |
| 402 | + $additionalXMLInput = "\n\t\t\t\t" . Html::textarea( 'ps_add_xml', $ps_add_xml, array( 'rows' => 4, 'style' => 'width: 100%;' ) ); |
| 403 | + $text .= '<p>' . wfMsg('ps-add-xml-label') . $additionalXMLInput . "\n</p>"; |
| 404 | + |
| 405 | + foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) { |
| 406 | + $valuesFromExtension = call_user_func( array( $psHandlerClass, "getSchemaEditingHTML" ), $pageSchemaObj ); |
| 407 | + if ( is_null( $valuesFromExtension ) ) { |
| 408 | + continue; |
| 409 | + } |
| 410 | + $label = call_user_func( array( $psHandlerClass, "getSchemaDisplayString" ) ); |
| 411 | + $color = call_user_func( array( $psHandlerClass, "getDisplayColor" ) ); |
| 412 | + $text .= self::printFieldHTMLForExtension( $valuesFromExtension, $label, $color ); |
| 413 | + } |
| 414 | + |
| 415 | + $text .= '<div id="templatesList">' . "\n"; |
| 416 | + |
| 417 | + $templateNum = 0; |
| 418 | + |
| 419 | + // Add 'starter', hidden template section. |
| 420 | + $text .= self::printTemplateSection(); |
| 421 | + /* index for template objects */ |
| 422 | + foreach ( $pageXMLChildren as $tag => $pageXMLChild ) { |
| 423 | + if ( $tag == 'Template' ) { |
| 424 | + $psTemplate = $psTemplates[$templateNum]; |
| 425 | + $text .= self::printTemplateSection( $templateNum, $pageXMLChild, $psTemplate ); |
| 426 | + $templateNum++; |
| 427 | + } |
| 428 | + } |
| 429 | + $add_template_button = Xml::element( 'input', |
| 430 | + array( |
| 431 | + 'type' => 'button', |
| 432 | + 'class' => 'editSchemaAddTemplate', |
| 433 | + 'value' => wfMsg( 'ps-add-template' ), |
| 434 | + ) |
| 435 | + ); |
| 436 | + $text .= "\t</div><!-- templatesList -->\n"; |
| 437 | + $text .= Xml::tags( 'p', null, $add_template_button ) . "\n"; |
| 438 | + $text .= "\t\t<hr />\n"; |
| 439 | + $label = wfMsg( 'summary' ); |
| 440 | + $text .= <<<END |
| 441 | + <p> |
| 442 | + <span id='wpSummaryLabel'><label for='wpSummary'>$label</label></span> |
| 443 | + <input type='text' value="" name='wpSummary' id='wpSummary' maxlength='200' size='60' /> |
| 444 | + </p> |
| 445 | + |
| 446 | +END; |
| 447 | + $attr = array( |
| 448 | + 'id' => 'wpSave', |
| 449 | + 'accesskey' => wfMsg( 'accesskey-save' ), |
| 450 | + 'title' => wfMsg( 'tooltip-save' ), |
| 451 | + ); |
| 452 | + $saveButton = Html::input( 'wpSave', wfMsg( 'savearticle' ), 'submit', $attr ); |
| 453 | + $text .= "\t\t" . Html::rawElement( 'div', array( 'class' => 'editButtons' ), |
| 454 | + $saveButton ) . "\n"; |
| 455 | + $text .= "\t</form>\n"; |
| 456 | + |
| 457 | + return $text; |
| 458 | + } |
| 459 | + |
| 460 | + function execute( $category ) { |
| 461 | + global $wgRequest, $wgOut, $wgUser, $wgTitle; |
| 462 | + |
| 463 | + // If a category has been selected (i.e., it's not just |
| 464 | + // Special:EditSchema), only display this if the user is |
| 465 | + // allowed to edit the category page. |
| 466 | + if ( !is_null( $category ) && ( !$wgUser->isAllowed( 'edit' ) || !$wgTitle->userCan( 'edit' ) ) ) { |
| 467 | + $wgOut->permissionRequired( 'edit' ); |
| 468 | + return; |
| 469 | + } |
| 470 | + |
| 471 | + |
| 472 | + $this->setHeaders(); |
| 473 | + $text = '<p>' . wfMsg( 'ps-page-desc-edit-schema' ) . '</p>'; |
| 474 | + PageSchemas::addJavascriptAndCSS(); |
| 475 | + |
| 476 | + $save_page = $wgRequest->getCheck( 'wpSave' ); |
| 477 | + if ( $save_page ) { |
| 478 | + $psXML = self::createPageSchemaXMLFromForm(); |
| 479 | + $categoryTitle = Title::newFromText( $category, NS_CATEGORY ); |
| 480 | + $categoryArticle = new Article( $categoryTitle ); |
| 481 | + if ( $categoryTitle->exists() ) { |
| 482 | + $pageText = $categoryArticle->getContent(); |
| 483 | + $pageSchemaObj = new PSSchema( $category ); |
| 484 | + if ( $pageSchemaObj->isPSDefined() ) { |
| 485 | + // Do some preg_replace magic. |
| 486 | + // This is necessary if the <PageSchema> tag |
| 487 | + // accepts any attributes - which it currently |
| 488 | + // does not, but it may well in the future. |
| 489 | + $tag = "PageSchema"; |
| 490 | + $pageText = preg_replace( '{<' . $tag . '[^>]*>([^@]*?)</' . $tag . '>' . '}', $psXML, $pageText ); |
| 491 | + } else { |
| 492 | + $pageText = $psXML . $pageText; |
| 493 | + } |
| 494 | + } else { |
| 495 | + $pageText = $psXML; |
| 496 | + } |
| 497 | + $editSummary = $wgRequest->getVal( 'wpSummary' ); |
| 498 | + $categoryArticle->doEdit( $pageText, $editSummary ); |
| 499 | + $redirectURL = $categoryTitle->getLocalURL(); |
| 500 | + $text = <<<END |
| 501 | + <script type="text/javascript"> |
| 502 | + window.onload = function() { |
| 503 | + window.location="$redirectURL"; |
| 504 | + } |
| 505 | + </script> |
| 506 | + |
| 507 | +END; |
| 508 | + $wgOut->addHTML( $text ); |
| 509 | + return true; |
| 510 | + } |
| 511 | + |
| 512 | + if ( $category == "" ) { |
| 513 | + // No category was specified - show the list of |
| 514 | + // categories with a page schema defined. |
| 515 | + $text = self::showLinksToCategories(); |
| 516 | + $wgOut->addHTML( $text ); |
| 517 | + return true; |
| 518 | + } |
| 519 | + |
| 520 | + // We have a category - show a form. |
| 521 | + // See if a page schema has already been defined for this category. |
| 522 | + $title = Title::newFromText( $category, NS_CATEGORY ); |
| 523 | + $pageId = $title->getArticleID(); |
| 524 | + $dbr = wfGetDB( DB_SLAVE ); |
| 525 | + $res = $dbr->select( 'page_props', |
| 526 | + array( |
| 527 | + 'pp_page', |
| 528 | + 'pp_propname', |
| 529 | + 'pp_value' |
| 530 | + ), |
| 531 | + array( |
| 532 | + 'pp_page' => $pageId, |
| 533 | + ) |
| 534 | + ); |
| 535 | + |
| 536 | + $row = $dbr->fetchRow( $res ); |
| 537 | + if ( $row == null && !$title->exists() ) { |
| 538 | + // Category doesn't exist. |
| 539 | + $wgOut->setPageTitle( wfMsg( 'createschema' ) ); |
| 540 | + $text = '<p>' . wfMsg( 'ps-page-desc-cat-not-exist' ) . '</p>'; |
| 541 | + $text .= self::printForm(); |
| 542 | + } elseif ( ( $row[1] != 'PageSchema' ) || ( $row[2] == null ) ) { |
| 543 | + // Category exists, but has no page schema. |
| 544 | + $text = '<p>' . wfMsg( 'ps-page-desc-ps-not-exist' ) . '</p>'; |
| 545 | + $wgOut->setPageTitle( wfMsg( 'createschema' ) ); |
| 546 | + $text .= self::printForm(); |
| 547 | + } else { |
| 548 | + // It's a category with an existing page schema - |
| 549 | + // populate the form with its values. |
| 550 | + $pageSchemaObj = new PSSchema( $category ); |
| 551 | + $pageXMLstr = $row[2]; |
| 552 | + $pageXML = simplexml_load_string( $pageXMLstr ); |
| 553 | + $text = self::printForm( $pageSchemaObj, $pageXML ); |
| 554 | + } |
| 555 | + $wgOut->addHTML( $text ); |
| 556 | + return true; |
| 557 | + } |
| 558 | +} |
Property changes on: tags/extensions/PageSchemas/REL_0_3/specials/PS_EditSchema.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 559 | + native |
Index: tags/extensions/PageSchemas/REL_0_3/PageSchemas.i18n.php |
— | — | @@ -0,0 +1,726 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Messages file for the PageSchemas extension |
| 6 | + * |
| 7 | + * @file |
| 8 | + * @ingroup Extensions |
| 9 | + */ |
| 10 | + |
| 11 | +/** |
| 12 | + * Get all extension messages |
| 13 | + * |
| 14 | + * @return array |
| 15 | + */ |
| 16 | +$messages = array(); |
| 17 | + |
| 18 | +$messages['en'] = array( |
| 19 | + 'ps-desc' => 'Defines the data structure for all pages in a category using XML', |
| 20 | + 'ps-schema-description' => 'Page schema', |
| 21 | + 'generatepages' => 'Generate pages', |
| 22 | + 'ps-generatepages-desc' => 'Generate the following pages, based on this category\'s schema:', |
| 23 | + 'ps-generatepages-success' => 'The selected pages will be generated.', |
| 24 | + 'ps-generatepages-noschema' => 'Error: There is no page schema defined for this category.', |
| 25 | + 'ps-generatepages-editsummary' => 'Generated from a page schema', |
| 26 | + 'ps-page-desc-cat-not-exist' => 'This category does not exist yet. Create this category and its page schema:', |
| 27 | + 'ps-page-desc-ps-not-exist' => 'This category exists, but does not have a page schema. Create schema:', |
| 28 | + 'ps-page-desc-edit-schema' => 'Edit the page schema for this category:', |
| 29 | + 'ps-delimiter-label' => 'Delimiter for values (default is ","):', |
| 30 | + 'ps-multiple-temp-label' => 'Allow multiple instances of this template', |
| 31 | + 'ps-field-list-label' => 'This field can hold a list of values', |
| 32 | + 'ps-template' => 'Template', |
| 33 | + 'ps-add-template' => 'Add template', |
| 34 | + 'ps-remove-template' => 'Remove template', |
| 35 | + 'ps-field' => 'Field', |
| 36 | + 'ps-namelabel' => 'Name:', |
| 37 | + 'ps-displaylabel' => 'Display label:', |
| 38 | + 'ps-add-field' => 'Add field', |
| 39 | + 'ps-remove-field' => 'Remove field', |
| 40 | + 'ps-add-xml-label' => 'Additional XML:', |
| 41 | + 'ps-optional-name' => 'Name (leave blank to set to field name):', |
| 42 | + 'editschema' => 'Edit schema', |
| 43 | + 'createschema' => 'Create schema', |
| 44 | + 'right-generatepages' => 'View "Generate pages" tab and page', |
| 45 | + 'action-generatepages' => 'view the "Generate pages" tab and page', |
| 46 | +); |
| 47 | + |
| 48 | +/** Message documentation (Message documentation) |
| 49 | + * @author Ankit Garg |
| 50 | + * @author EugeneZelenko |
| 51 | + * @author Purodha |
| 52 | + * @author Raymond |
| 53 | + */ |
| 54 | +$messages['qqq'] = array( |
| 55 | + 'ps-desc' => '{{desc}}', |
| 56 | + 'ps-template' => 'A MediaWiki template', |
| 57 | + 'ps-field' => 'A "field" here is both a template parameter and a form field', |
| 58 | + 'ps-displaylabel' => 'The term for the text that shows up next to a field when it is displayed', |
| 59 | + 'editschema' => 'This is a special page name.', |
| 60 | + 'createschema' => 'This is a special page name.', |
| 61 | + 'right-generatepages' => '{{doc-right|generatepages}}', |
| 62 | + 'action-generatepages' => '{{doc-action|generatepages}}', |
| 63 | +); |
| 64 | + |
| 65 | +/** Afrikaans (Afrikaans) |
| 66 | + * @author Naudefj |
| 67 | + */ |
| 68 | +$messages['af'] = array( |
| 69 | + 'ps-desc' => 'Ondersteun sjablone waarvoor die datastruktuur via XML gedefinieer is', |
| 70 | +); |
| 71 | + |
| 72 | +/** Arabic (العربية) |
| 73 | + * @author Meno25 |
| 74 | + */ |
| 75 | +$messages['ar'] = array( |
| 76 | + 'ps-desc' => 'يدعم القوالب التي تعرف هيكل بياناتها من خلال علامات XML', |
| 77 | +); |
| 78 | + |
| 79 | +/** Egyptian Spoken Arabic (مصرى) |
| 80 | + * @author Dudi |
| 81 | + * @author Ghaly |
| 82 | + */ |
| 83 | +$messages['arz'] = array( |
| 84 | + 'ps-desc' => 'بيدعم القوالب اللى بتعرّف هيكل الداتا بتاعتها عن طريق علامات XML', |
| 85 | +); |
| 86 | + |
| 87 | +/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
| 88 | + * @author EugeneZelenko |
| 89 | + * @author Jim-by |
| 90 | + * @author Renessaince |
| 91 | + * @author Wizardist |
| 92 | + */ |
| 93 | +$messages['be-tarask'] = array( |
| 94 | + 'ps-desc' => 'Падтрымлівае шаблёны, якія вызначаюць уласную структуру зьвестак праз XML-разьметку', |
| 95 | + 'ps-schema-description' => 'Апісаньне схемы:', |
| 96 | + 'generatepages' => 'Стварыць старонкі', |
| 97 | + 'ps-generatepages-desc' => 'Стварае наступныя старонкі, зыходзячы са схемы катэгорыі:', |
| 98 | + 'ps-generatepages-success' => 'Старонкі будуць створаныя.', |
| 99 | + 'ps-generatepages-noschema' => 'Памылка: для гэтай катэгорыі ня вызначаная схема старонкі.', |
| 100 | + 'ps-page-desc-cat-not-exist' => 'Гэтая катэгорыя яшчэ не існуе. Стварыць яе са схемай старонкі:', |
| 101 | + 'ps-page-desc-ps-not-exist' => 'Гэтая катэгорыя існуе, аднак ня мае схемы старонкі. Стварыць схему:', |
| 102 | + 'ps-page-desc-edit-schema' => 'Рэдагаваць схему старонак для гэтай катэгорыі:', |
| 103 | + 'ps-delimiter-label' => 'Разьдзяляльнік для значэньняў (па змоўчваньні «,»):', |
| 104 | + 'ps-multiple-temp-label' => 'Дазволіць некалькі варыянтаў гэтага шаблёну', |
| 105 | + 'ps-field-list-label' => 'Гэтае поле можа зьмяшчаць набор значэньняў', |
| 106 | + 'ps-template' => 'Шаблён', |
| 107 | + 'ps-add-template' => 'Дадаць шаблён', |
| 108 | + 'ps-remove-template' => 'Выдаліць шаблён', |
| 109 | + 'ps-field' => 'Поле', |
| 110 | + 'ps-displaylabel' => 'Паказваць пазнаку:', |
| 111 | + 'ps-add-field' => 'Дадаць поле', |
| 112 | + 'ps-remove-field' => 'Выдаліць поле', |
| 113 | + 'ps-add-xml-label' => 'Дадатковы XML:', |
| 114 | + 'editschema' => 'Рэдагаваць схему', |
| 115 | +); |
| 116 | + |
| 117 | +/** Breton (Brezhoneg) |
| 118 | + * @author Fulup |
| 119 | + * @author Y-M D |
| 120 | + */ |
| 121 | +$messages['br'] = array( |
| 122 | + 'ps-desc' => 'Skorañ a ra ar patromoù dre dermeniñ o framm roadennoù gant balizennoù XML', |
| 123 | + 'ps-schema-description' => 'Chema ar bajenn', |
| 124 | + 'generatepages' => 'Genel ar pajennoù', |
| 125 | + 'ps-template' => 'Patrom', |
| 126 | + 'ps-add-template' => 'Ouzhpennañ ur patrom', |
| 127 | + 'ps-remove-template' => 'Lemel ur patrom', |
| 128 | + 'ps-field' => 'Maezienn', |
| 129 | + 'ps-namelabel' => 'Anv :', |
| 130 | + 'ps-displaylabel' => 'Tikedenn diskwel :', |
| 131 | + 'ps-add-field' => 'Ouzhpennañ ur vaezienn', |
| 132 | + 'ps-remove-field' => 'Lemel ar vaezienn', |
| 133 | + 'editschema' => 'Kemmañ ar chema', |
| 134 | + 'createschema' => 'Krouiñ ur chema', |
| 135 | +); |
| 136 | + |
| 137 | +/** Bosnian (Bosanski) |
| 138 | + * @author CERminator |
| 139 | + */ |
| 140 | +$messages['bs'] = array( |
| 141 | + 'ps-desc' => 'Podržava šablone koji definiraju svoju strukturu podataka preko XML opisnog jezika', |
| 142 | +); |
| 143 | + |
| 144 | +/** German (Deutsch) |
| 145 | + * @author Imre |
| 146 | + * @author Kghbln |
| 147 | + */ |
| 148 | +$messages['de'] = array( |
| 149 | + 'ps-desc' => 'Ermöglicht, unter Verwendung von XML, das Definieren einer Datenstruktur für alle Seiten in einer Kategorie', |
| 150 | + 'ps-schema-description' => 'Seitenschema:', |
| 151 | + 'generatepages' => 'Seiten generieren', |
| 152 | + 'ps-generatepages-desc' => 'Die folgenden Seiten auf Basis des Schemas dieser Kategorie generieren:', |
| 153 | + 'ps-generatepages-success' => 'Die ausgewählten Seiten werden generiert.', |
| 154 | + 'ps-generatepages-noschema' => 'Fehler: Es wurde kein Schema für diese Kategorie definiert.', |
| 155 | + 'ps-generatepages-editsummary' => 'Auf Basis eines Seitenschemas generiert', |
| 156 | + 'ps-page-desc-cat-not-exist' => 'Diese Kategorie ist noch nicht vorhanden. Erstelle diese Kategorie und ihr Schema:', |
| 157 | + 'ps-page-desc-ps-not-exist' => 'Diese Kategorie ist vorhanden, verfügt aber noch nicht über ein Schema. Erstelle das Schema:', |
| 158 | + 'ps-page-desc-edit-schema' => 'Bearbeite das Schema dieser Kategorie:', |
| 159 | + 'ps-delimiter-label' => 'Trennzeichen für Werte (Standardwert ist „,“):', |
| 160 | + 'ps-multiple-temp-label' => 'Diese Vorlage für mehrere Instanzen freigeben', |
| 161 | + 'ps-field-list-label' => 'Dieses Feld kann eine Liste von Werten enthalten', |
| 162 | + 'ps-template' => 'Vorlage', |
| 163 | + 'ps-add-template' => 'Vorlage hinzufügen', |
| 164 | + 'ps-remove-template' => 'Vorlage entfernen', |
| 165 | + 'ps-field' => 'Feld', |
| 166 | + 'ps-namelabel' => 'Name:', |
| 167 | + 'ps-displaylabel' => 'Anzuzeigender Feldname:', |
| 168 | + 'ps-add-field' => 'Feld hinzufügen', |
| 169 | + 'ps-remove-field' => 'Feld entfernen', |
| 170 | + 'ps-add-xml-label' => 'Zusätzliches XML:', |
| 171 | + 'ps-optional-name' => 'Name (leer lassen, um den Feldnamen zu verwenden):', |
| 172 | + 'editschema' => 'Schema bearbeiten', |
| 173 | + 'createschema' => 'Schema erstellen', |
| 174 | + 'right-generatepages' => 'Den Reiter „Seiten generieren“ sowie die entsprechende Seite sehen', |
| 175 | + 'action-generatepages' => 'den Reiter „Seiten generieren“ sowie die entsprechende Seite zu sehen', |
| 176 | +); |
| 177 | + |
| 178 | +/** German (formal address) (Deutsch (Sie-Form)) |
| 179 | + * @author Kghbln |
| 180 | + */ |
| 181 | +$messages['de-formal'] = array( |
| 182 | + 'ps-page-desc-cat-not-exist' => 'Diese Kategorie ist noch nicht vorhanden. Erstellen Sie diese Kategorie und ihr Schema:', |
| 183 | + 'ps-page-desc-ps-not-exist' => 'Diese Kategorie ist vorhanden, verfügt aber noch nicht über ein Schema. Erstellen Sie das Schema:', |
| 184 | + 'ps-page-desc-edit-schema' => 'Bearbeiten Sie das Schema dieser Kategorie:', |
| 185 | +); |
| 186 | + |
| 187 | +/** Lower Sorbian (Dolnoserbski) |
| 188 | + * @author Michawiki |
| 189 | + */ |
| 190 | +$messages['dsb'] = array( |
| 191 | + 'ps-desc' => 'Definěrujo strukturu datow za wšykne boki w kategoriji z pomocu XML', |
| 192 | +); |
| 193 | + |
| 194 | +/** Greek (Ελληνικά) |
| 195 | + * @author Περίεργος |
| 196 | + */ |
| 197 | +$messages['el'] = array( |
| 198 | + 'ps-desc' => 'Υποστηρίζει πρότυπα που καθορίζουν τη δομή των δεδομένων τους μέσω της σήμανσης XML', |
| 199 | +); |
| 200 | + |
| 201 | +/** Spanish (Español) |
| 202 | + * @author Translationista |
| 203 | + */ |
| 204 | +$messages['es'] = array( |
| 205 | + 'ps-desc' => 'Admite plantillas que definen su estructura de datos a través de XML', |
| 206 | +); |
| 207 | + |
| 208 | +/** Finnish (Suomi) |
| 209 | + * @author Crt |
| 210 | + */ |
| 211 | +$messages['fi'] = array( |
| 212 | + 'ps-desc' => 'Tukee mallineiden tietorakenteiden määrittelyä XML-merkkauskielen kautta.', |
| 213 | +); |
| 214 | + |
| 215 | +/** French (Français) |
| 216 | + * @author Gomoko |
| 217 | + * @author IAlex |
| 218 | + * @author PieRRoMaN |
| 219 | + * @author Zebulon84 |
| 220 | + */ |
| 221 | +$messages['fr'] = array( |
| 222 | + 'ps-desc' => 'Définit la structure des données pour toutes les pages dans une catégorie en utilisant XML', |
| 223 | + 'ps-schema-description' => 'Schéma de la page', |
| 224 | + 'generatepages' => 'Générer les pages', |
| 225 | + 'ps-generatepages-desc' => "Générer les pages suivantes, d'après le schéma de cette catégorie:", |
| 226 | + 'ps-generatepages-success' => 'Les pages sélectionnées seront générés.', |
| 227 | + 'ps-generatepages-noschema' => "Erreur: il n'y a pas de schéma de page défini pour cette catégorie", |
| 228 | + 'ps-generatepages-editsummary' => 'Généré depuis le schéma de page', |
| 229 | + 'ps-page-desc-cat-not-exist' => "Cette catégorie n'existe pas encore. Créez-la avec son schéma de page:", |
| 230 | + 'ps-page-desc-ps-not-exist' => "Cette catégorie existe, mais n'a pas de schéma de page. Créez le schéma:", |
| 231 | + 'ps-page-desc-edit-schema' => 'Éditez le schéma de page pour cette catégorie:', |
| 232 | + 'ps-delimiter-label' => 'Délimiteur pour les valeurs ("," par défaut):', |
| 233 | + 'ps-multiple-temp-label' => 'Permet plusieurs instances de ce modèle', |
| 234 | + 'ps-field-list-label' => 'Ce champ peut contenir une liste de valeurs', |
| 235 | + 'ps-template' => 'Modèle', |
| 236 | + 'ps-add-template' => 'Ajouter un modèle', |
| 237 | + 'ps-remove-template' => 'Supprimer un modèle', |
| 238 | + 'ps-field' => 'Champ', |
| 239 | + 'ps-namelabel' => 'Nom :', |
| 240 | + 'ps-displaylabel' => 'Afficher le libellé:', |
| 241 | + 'ps-add-field' => 'Ajouter un champ', |
| 242 | + 'ps-remove-field' => 'Supprimer un champ', |
| 243 | + 'ps-add-xml-label' => 'XML supplémentaire:', |
| 244 | + 'ps-optional-name' => 'Nom (laisser blanc pour mettre le nom du champ):', |
| 245 | + 'editschema' => 'Modifier le schéma', |
| 246 | + 'createschema' => 'Créer le schéma', |
| 247 | + 'right-generatepages' => 'Afficher l\'onglet "Générer les pages" et la page', |
| 248 | + 'action-generatepages' => "afficher la page ou l'onglet « Générer les pages »", |
| 249 | +); |
| 250 | + |
| 251 | +/** Franco-Provençal (Arpetan) |
| 252 | + * @author ChrisPtDe |
| 253 | + */ |
| 254 | +$messages['frp'] = array( |
| 255 | + 'ps-desc' => 'Dèfenét la structura de les balyês por totes les pâges dens una catègorie en utilisent XML.', |
| 256 | + 'ps-schema-description' => 'Plan de la pâge', |
| 257 | + 'generatepages' => 'Fâre les pâges', |
| 258 | + 'ps-generatepages-editsummary' => 'Fêt dês lo plan de pâge', |
| 259 | + 'ps-template' => 'Modèlo', |
| 260 | + 'ps-add-template' => 'Apondre un modèlo', |
| 261 | + 'ps-remove-template' => 'Enlevar un modèlo', |
| 262 | + 'ps-field' => 'Champ', |
| 263 | + 'ps-namelabel' => 'Nom :', |
| 264 | + 'ps-displaylabel' => 'Ètiquèta por la visualisacion :', |
| 265 | + 'ps-add-field' => 'Apondre un champ', |
| 266 | + 'ps-remove-field' => 'Enlevar un champ', |
| 267 | + 'ps-add-xml-label' => 'XML de ples :', |
| 268 | + 'editschema' => 'Changiér lo plan', |
| 269 | + 'createschema' => 'Fâre lo plan', |
| 270 | +); |
| 271 | + |
| 272 | +/** Galician (Galego) |
| 273 | + * @author MetalBrasil |
| 274 | + * @author Toliño |
| 275 | + */ |
| 276 | +$messages['gl'] = array( |
| 277 | + 'ps-desc' => 'Define a estrutura de datos de todas as páxinas dunha categoría mediante formato XML', |
| 278 | + 'ps-schema-description' => 'Esquema da páxina', |
| 279 | + 'generatepages' => 'Xerar as páxinas', |
| 280 | + 'ps-generatepages-desc' => 'Xerar as seguintes páxinas, segundo o esquema desta categoría:', |
| 281 | + 'ps-generatepages-success' => 'As páxinas seleccionadas van ser xeradas.', |
| 282 | + 'ps-generatepages-noschema' => 'Erro: Non hai ningún esquema de páxina definido para esta categoría.', |
| 283 | + 'ps-generatepages-editsummary' => 'Xerado a partir do esquema de páxina', |
| 284 | + 'ps-page-desc-cat-not-exist' => 'Esta categoría aínda non existe. Cree esta categoría e o seu esquema de páxina:', |
| 285 | + 'ps-page-desc-ps-not-exist' => 'A categoría existe, pero non ten un esquema de páxina. Cree o esquema:', |
| 286 | + 'ps-page-desc-edit-schema' => 'Edite o esquema de páxina desta categoría:', |
| 287 | + 'ps-delimiter-label' => 'Delimitador de valores (por defecto é ","):', |
| 288 | + 'ps-multiple-temp-label' => 'Permitir varias instancias deste modelo', |
| 289 | + 'ps-field-list-label' => 'Este campo pode conter unha lista de valores', |
| 290 | + 'ps-template' => 'Modelo', |
| 291 | + 'ps-add-template' => 'Engadir un modelo', |
| 292 | + 'ps-remove-template' => 'Eliminar un modelo', |
| 293 | + 'ps-field' => 'Campo', |
| 294 | + 'ps-namelabel' => 'Nome:', |
| 295 | + 'ps-displaylabel' => 'Mostrar a etiqueta:', |
| 296 | + 'ps-add-field' => 'Engadir un campo', |
| 297 | + 'ps-remove-field' => 'Eliminar un campo', |
| 298 | + 'ps-add-xml-label' => 'XML adicional:', |
| 299 | + 'ps-optional-name' => 'Nome (déixeo en branco para definir o nome do campo):', |
| 300 | + 'editschema' => 'Editar o esquema', |
| 301 | + 'createschema' => 'Crear o esquema', |
| 302 | + 'right-generatepages' => 'Ollar a lapela e a páxina "Xerar as páxinas"', |
| 303 | + 'action-generatepages' => 'ollar a lapela e a páxina "Xerar as páxinas"', |
| 304 | +); |
| 305 | + |
| 306 | +/** Swiss German (Alemannisch) |
| 307 | + * @author Als-Chlämens |
| 308 | + * @author Als-Holder |
| 309 | + */ |
| 310 | +$messages['gsw'] = array( |
| 311 | + 'ps-desc' => 'Definiert d Datestruktur für alli Syte inere Kategori, wo XML bruuche', |
| 312 | + 'ps-schema-description' => 'Syteschema:', |
| 313 | + 'generatepages' => 'Syte generiere', |
| 314 | + 'ps-generatepages-desc' => 'Die Syte, wo folge, uff Basis vum Schema vo dere Kategori generiere', |
| 315 | + 'ps-generatepages-success' => 'Die Syte, wo ussgwäält sin, werde generiert.', |
| 316 | + 'ps-generatepages-noschema' => 'Fääler: Für die Kategori isch kei Schema definiert.', |
| 317 | + 'ps-generatepages-editsummary' => 'Uff Basis vum Schema, wo folgt, generiert', |
| 318 | + 'ps-page-desc-cat-not-exist' => "Die Kategorie git's no nit. Die Kategori un ihr Schema erstelle:", |
| 319 | + 'ps-template' => 'Vorlag', |
| 320 | + 'ps-add-template' => 'Vorlag zuefiege', |
| 321 | + 'ps-remove-template' => 'Vorlag usenee', |
| 322 | + 'ps-field' => 'Fäld', |
| 323 | + 'ps-namelabel' => 'Name:', |
| 324 | + 'ps-add-field' => 'Fieg Fäld yy', |
| 325 | + 'ps-remove-field' => 'Fäld uusenee', |
| 326 | + 'ps-add-xml-label' => 'Zuesätzlichs XML:', |
| 327 | +); |
| 328 | + |
| 329 | +/** Hebrew (עברית) |
| 330 | + * @author Amire80 |
| 331 | + * @author YaronSh |
| 332 | + */ |
| 333 | +$messages['he'] = array( |
| 334 | + 'ps-desc' => 'הגדרת מבני נתונים לכל הדפים בקטגוריה באמצעות XML', |
| 335 | + 'generatepages' => 'יצירת דפים', |
| 336 | +); |
| 337 | + |
| 338 | +/** Upper Sorbian (Hornjoserbsce) |
| 339 | + * @author Michawiki |
| 340 | + */ |
| 341 | +$messages['hsb'] = array( |
| 342 | + 'ps-desc' => 'Definuje datowu strukturu za wšě strony w kategoriji z pomocu XML', |
| 343 | +); |
| 344 | + |
| 345 | +/** Hungarian (Magyar) |
| 346 | + * @author Dani |
| 347 | + */ |
| 348 | +$messages['hu'] = array( |
| 349 | + 'ps-desc' => 'Lehetővé teszi, hogy a sablonok XML-jelölőnyelv segítségével definiálják az adatstruktúrájukat', |
| 350 | +); |
| 351 | + |
| 352 | +/** Interlingua (Interlingua) |
| 353 | + * @author McDutchie |
| 354 | + */ |
| 355 | +$messages['ia'] = array( |
| 356 | + 'ps-desc' => 'Defini le structura de datos pro tote le paginas in un categoria usante XML', |
| 357 | + 'ps-schema-description' => 'Schema de pagina', |
| 358 | + 'generatepages' => 'Generar paginas', |
| 359 | + 'ps-generatepages-desc' => 'Generar le sequente paginas a base del schema de iste categoria:', |
| 360 | + 'ps-generatepages-success' => 'Le paginas seligite essera generate.', |
| 361 | + 'ps-generatepages-noschema' => 'Error: Il non ha un schema de pagina definite pro iste categoria.', |
| 362 | + 'ps-generatepages-editsummary' => 'Generate ab un schema de pagina', |
| 363 | + 'ps-page-desc-cat-not-exist' => 'Iste categoria non existe ancora. Crea iste categoria e su schema de pagina:', |
| 364 | + 'ps-page-desc-ps-not-exist' => 'Iste categoria existe, ma non ha un schema de pagina. Crea le schema:', |
| 365 | + 'ps-page-desc-edit-schema' => 'Modifica le schema de pagina pro iste categoria:', |
| 366 | + 'ps-delimiter-label' => 'Delimitator pro valores (predefinition es ","):', |
| 367 | + 'ps-multiple-temp-label' => 'Permitter plure instantias de iste patrono', |
| 368 | + 'ps-field-list-label' => 'Iste campo pote tener un lista de valores', |
| 369 | + 'ps-template' => 'Patrono', |
| 370 | + 'ps-add-template' => 'Adder patrono', |
| 371 | + 'ps-remove-template' => 'Remover patrono', |
| 372 | + 'ps-field' => 'Campo', |
| 373 | + 'ps-namelabel' => 'Nomine:', |
| 374 | + 'ps-displaylabel' => 'Etiquetta pro monstrar:', |
| 375 | + 'ps-add-field' => 'Adder campo', |
| 376 | + 'ps-remove-field' => 'Remover campo', |
| 377 | + 'ps-add-xml-label' => 'Additional XML:', |
| 378 | + 'ps-optional-name' => 'Nomine (lassar vacue pro definir como le nomine del campo):', |
| 379 | + 'editschema' => 'Modificar schema', |
| 380 | + 'createschema' => 'Crear schema', |
| 381 | + 'right-generatepages' => 'Vider le scheda e pagina "Generar paginas"', |
| 382 | + 'action-generatepages' => 'vider le scheda e pagina "Generar paginas"', |
| 383 | +); |
| 384 | + |
| 385 | +/** Indonesian (Bahasa Indonesia) |
| 386 | + * @author IvanLanin |
| 387 | + */ |
| 388 | +$messages['id'] = array( |
| 389 | + 'ps-desc' => 'Mendukung templat untuk dapat mendefinisikan struktur data mereka melalui markah XML', |
| 390 | +); |
| 391 | + |
| 392 | +/** Igbo (Igbo) |
| 393 | + * @author Ukabia |
| 394 | + */ |
| 395 | +$messages['ig'] = array( |
| 396 | + 'ps-desc' => 'Në nyé ike maka mkpurụ ihü, në nyé úchè maka ázú omárí ha nke shi édé XML', |
| 397 | +); |
| 398 | + |
| 399 | +/** Japanese (日本語) |
| 400 | + * @author Fryed-peach |
| 401 | + * @author Schu |
| 402 | + */ |
| 403 | +$messages['ja'] = array( |
| 404 | + 'ps-desc' => 'XML マークアップによってデータ構造を定義するテンプレートをサポートします。', |
| 405 | + 'ps-schema-description' => 'スキーマの説明:', |
| 406 | + 'generatepages' => 'ページを生成', |
| 407 | + 'ps-generatepages-desc' => 'このカテゴリのスキーマに基づいて、次のページを生成', |
| 408 | + 'ps-generatepages-success' => 'ページが生成されます。', |
| 409 | + 'ps-generatepages-noschema' => 'エラー:このカテゴリに定義されているページのスキーマはありません。', |
| 410 | + 'ps-page-desc-cat-not-exist' => 'このカテゴリはまだ存在しません。このカテゴリとそのページのスキーマを作成します。', |
| 411 | + 'ps-page-desc-ps-not-exist' => 'このカテゴリは存在しますが、ページのスキーマを持っていません。スキーマを作成:', |
| 412 | + 'ps-page-desc-edit-schema' => 'このカテゴリのページのスキーマを編集:', |
| 413 | + 'ps-delimiter-label' => '値の区切り文字 (デフォルトは "," ):', |
| 414 | + 'ps-multiple-temp-label' => 'このテンプレートの複数のインスタンスを許可', |
| 415 | + 'ps-field-list-label' => 'このフィールドは、値のリストを保持することができます', |
| 416 | + 'ps-template' => 'テンプレート', |
| 417 | + 'ps-add-template' => 'テンプレートを追加', |
| 418 | + 'ps-remove-template' => 'テンプレートを削除', |
| 419 | + 'ps-field' => 'フィールド', |
| 420 | + 'ps-displaylabel' => '表示ラベル:', |
| 421 | + 'ps-add-field' => 'フィールドを追加', |
| 422 | + 'ps-remove-field' => 'フィールドを削除', |
| 423 | + 'ps-add-xml-label' => '追加のXML:', |
| 424 | + 'editschema' => 'スキーマを編集', |
| 425 | +); |
| 426 | + |
| 427 | +/** Colognian (Ripoarisch) |
| 428 | + * @author Purodha |
| 429 | + */ |
| 430 | +$messages['ksh'] = array( |
| 431 | + 'ps-desc' => 'Ongerschtöz, dat mer de Dateschtruktur vun Schablone övver en <i lang="en">XML</i> Fommaat beschrieve kann.', |
| 432 | + 'ps-schema-description' => 'Dat XML-Schema beschrevve:', |
| 433 | + 'generatepages' => 'Sigge automattesch aanlääje', |
| 434 | + 'ps-generatepages-desc' => 'Donn de Sigge en dä Leß heh automattesch aanlääje, noh dämm XML-Schema för di Saachjropp:', |
| 435 | + 'ps-generatepages-success' => 'Di Sigge wääde automattesch aanjelaat.', |
| 436 | + 'ps-generatepages-noschema' => 'Fähler: Mer han kei XML-Schema för di Saachjropp.', |
| 437 | + 'ps-page-desc-cat-not-exist' => 'Di Saachjropp jidd_et noch nit. Donn di Jropp aanlääje un e Schema för dä ier Siggg:', |
| 438 | + 'ps-page-desc-ps-not-exist' => 'Heh di Saachjropp jidd_et, ävver se hät kei XML-Schema. Donn ein aanlääje:', |
| 439 | + 'ps-page-desc-edit-schema' => 'Donn dat XML-Schema för di Saachjropp ändere:', |
| 440 | + 'ps-field-list-label' => 'En däm Feld kann en Leß met Wääte shtonn', |
| 441 | + 'ps-template' => 'Schabloon', |
| 442 | + 'ps-add-template' => 'Donn en Schabloon dobei', |
| 443 | + 'ps-remove-template' => 'Maach di Schabloon fott', |
| 444 | + 'ps-field' => 'Väld', |
| 445 | + 'ps-add-field' => 'Donn e Feld dobei', |
| 446 | + 'ps-remove-field' => 'Nemm dat Feld fott', |
| 447 | + 'ps-add-xml-label' => 'Zohsäzlesh XML:', |
| 448 | + 'ps-optional-name' => 'Dä Name — kam_mer läddesch lohße, dann ess_et automattesch dä Name vun däm Feld:', |
| 449 | + 'editschema' => 'Et Schema ändere', |
| 450 | + 'createschema' => 'E XML-Schema aanlääje', |
| 451 | +); |
| 452 | + |
| 453 | +/** Luxembourgish (Lëtzebuergesch) |
| 454 | + * @author Robby |
| 455 | + */ |
| 456 | +$messages['lb'] = array( |
| 457 | + 'ps-desc' => "Definéiert d'Date-Struktur per XML fir all Säiten an enger Kategorie", |
| 458 | + 'ps-schema-description' => 'Schema vun der Säit', |
| 459 | + 'generatepages' => 'Säite generéieren', |
| 460 | + 'ps-generatepages-desc' => 'Dës Säiten op der Basis vum Schema vun dëser Kategorie generéieren:', |
| 461 | + 'ps-generatepages-success' => 'Déi erausgesichte Säite gi generéiert.', |
| 462 | + 'ps-generatepages-noschema' => 'Feeler: et ass kee Säite-Schema fir dës Kategorie definéiert', |
| 463 | + 'ps-generatepages-editsummary' => 'Generéiert op Basis vum Säite-Schema', |
| 464 | + 'ps-page-desc-cat-not-exist' => 'Dës Kategorie gëtt et nach net. Leet dës Kategorie an hire Säite-Schema un:', |
| 465 | + 'ps-page-desc-ps-not-exist' => 'Dës Kategorie gëtt et, awer si huet nach kee Säite-Schema. Leet de Schema un:', |
| 466 | + 'ps-page-desc-edit-schema' => 'De Säite-Schema fir dës Kategorie änneren:', |
| 467 | + 'ps-multiple-temp-label' => 'Méi Instanze vun dësem Schema zouloossen', |
| 468 | + 'ps-field-list-label' => 'An dësem Feld kann eng Lëscht vu Wäerter stoen', |
| 469 | + 'ps-template' => 'Schabloun', |
| 470 | + 'ps-add-template' => 'Schabloun derbäisetzen', |
| 471 | + 'ps-remove-template' => 'Schablon ewechhuelen', |
| 472 | + 'ps-field' => 'Feld', |
| 473 | + 'ps-namelabel' => 'Numm:', |
| 474 | + 'ps-displaylabel' => 'Etiquette weisen:', |
| 475 | + 'ps-add-field' => 'Feld derbäisetzen', |
| 476 | + 'ps-remove-field' => 'Feld ewechhuelen', |
| 477 | + 'ps-add-xml-label' => 'Zousätzlechen XML:', |
| 478 | + 'ps-optional-name' => 'Numm (eidel loosse fir den Numm vum Feld ze benotzen):', |
| 479 | + 'editschema' => 'Schema änneren', |
| 480 | + 'createschema' => 'Schema uleeën', |
| 481 | +); |
| 482 | + |
| 483 | +/** Macedonian (Македонски) |
| 484 | + * @author Bjankuloski06 |
| 485 | + */ |
| 486 | +$messages['mk'] = array( |
| 487 | + 'ps-desc' => 'Ја определува податочната структура на сите страници во една категорија користејќи XML', |
| 488 | + 'ps-schema-description' => 'Шемата на страници', |
| 489 | + 'generatepages' => 'Создај страници', |
| 490 | + 'ps-generatepages-desc' => 'Создај ги следниве страници врз основа на шемата на категоријата:', |
| 491 | + 'ps-generatepages-success' => 'Избраните страници ќе бидат создадени.', |
| 492 | + 'ps-generatepages-noschema' => 'Грешка: оваа категорија нема определена шема на страници', |
| 493 | + 'ps-generatepages-editsummary' => 'Создадено од шемата на страницата', |
| 494 | + 'ps-page-desc-cat-not-exist' => 'Оваа категорија сè уште не постои. Создај ја категоријата и нејзината шема на страници:', |
| 495 | + 'ps-page-desc-ps-not-exist' => 'Оваа категорија постои, но нема шема на страници. Создај шема:', |
| 496 | + 'ps-page-desc-edit-schema' => 'Уреди ја шемата на страници за оваа категорија:', |
| 497 | + 'ps-delimiter-label' => 'Одделвач за вредности (стандардниот е „,“):', |
| 498 | + 'ps-multiple-temp-label' => 'Дозволи повеќе примероци на овој шаблон', |
| 499 | + 'ps-field-list-label' => 'Ова поле може да содржи список на вредности', |
| 500 | + 'ps-template' => 'Шаблон', |
| 501 | + 'ps-add-template' => 'Додај шаблон', |
| 502 | + 'ps-remove-template' => 'Отстрани шаблон', |
| 503 | + 'ps-field' => 'Поле', |
| 504 | + 'ps-namelabel' => 'Име:', |
| 505 | + 'ps-displaylabel' => 'Натпис за приказ:', |
| 506 | + 'ps-add-field' => 'Додај поле', |
| 507 | + 'ps-remove-field' => 'Отстрани поле', |
| 508 | + 'ps-add-xml-label' => 'Дополнителен XML:', |
| 509 | + 'ps-optional-name' => 'Име (оставете празно за да биде како името на полето):', |
| 510 | + 'editschema' => 'Уреди шема', |
| 511 | + 'createschema' => 'Создај шема', |
| 512 | + 'right-generatepages' => 'Јазичето „Создај страници“ и неговата страница', |
| 513 | + 'action-generatepages' => 'приказ на јазичето „Создај страници“ и неговата страница', |
| 514 | +); |
| 515 | + |
| 516 | +/** Norwegian (bokmål) (Norsk (bokmål)) |
| 517 | + * @author Nghtwlkr |
| 518 | + */ |
| 519 | +$messages['nb'] = array( |
| 520 | + 'ps-desc' => 'Støtter maler som definerer datastrukturen sin gjennom XML-markering', |
| 521 | +); |
| 522 | + |
| 523 | +/** Dutch (Nederlands) |
| 524 | + * @author SPQRobin |
| 525 | + * @author Siebrand |
| 526 | + */ |
| 527 | +$messages['nl'] = array( |
| 528 | + 'ps-desc' => "Bepaalt de gegevensstructuur van alle pagina's in een categorie via XML", |
| 529 | + 'ps-schema-description' => 'Paginaschema', |
| 530 | + 'generatepages' => "Pagina's aanmaken", |
| 531 | + 'ps-generatepages-desc' => "Maak de volgende pagina's aan, gebaseerd op dit categorieschema:", |
| 532 | + 'ps-generatepages-success' => "De geselecteerde pagina's worden aangemaakt.", |
| 533 | + 'ps-generatepages-noschema' => 'Fout: Er is geen paginaschema voor deze categorie.', |
| 534 | + 'ps-generatepages-editsummary' => 'Aangemaakt vanuit een paginaschema', |
| 535 | + 'ps-page-desc-cat-not-exist' => 'Deze categorie bestaat nog niet. Maak deze categorie en het bijbehorende paginaschema aan:', |
| 536 | + 'ps-page-desc-ps-not-exist' => 'Deze categorie bestaat, maar heeft geen paginaschema. Maak het paginaschema aan:', |
| 537 | + 'ps-page-desc-edit-schema' => 'Bewerkt het paginaschema voor deze categorie:', |
| 538 | + 'ps-delimiter-label' => 'Scheidingsteken voor waarden (standaard ","):', |
| 539 | + 'ps-multiple-temp-label' => 'Meerdere exemplaren van dit sjabloon toestaan', |
| 540 | + 'ps-field-list-label' => 'Dit veld kan een lijst met waarden bevatten', |
| 541 | + 'ps-template' => 'Sjabloon', |
| 542 | + 'ps-add-template' => 'Sjabloon toevoegen', |
| 543 | + 'ps-remove-template' => 'Sjabloon verwijderen', |
| 544 | + 'ps-field' => 'Veld', |
| 545 | + 'ps-namelabel' => 'Naam:', |
| 546 | + 'ps-displaylabel' => 'Label weergeven:', |
| 547 | + 'ps-add-field' => 'Veld toevoegen', |
| 548 | + 'ps-remove-field' => 'Veld verwijderen', |
| 549 | + 'ps-add-xml-label' => 'Extra XML:', |
| 550 | + 'ps-optional-name' => 'Naam (laat leeg om in te stellen op de veldnaam):', |
| 551 | + 'editschema' => 'Schema bewerken', |
| 552 | + 'createschema' => 'Schema aanmaken', |
| 553 | + 'right-generatepages' => 'Mag het tabblad en de pagina "Pagina\'s aanmaken" zijn', |
| 554 | + 'action-generatepages' => 'het tabblad en de pagina "Pagina\'s aanmaken" te zien', |
| 555 | +); |
| 556 | + |
| 557 | +/** Norwegian Nynorsk (Norsk (nynorsk)) |
| 558 | + * @author Harald Khan |
| 559 | + */ |
| 560 | +$messages['nn'] = array( |
| 561 | + 'ps-desc' => 'Støttar malar som definerer datastrukturen sin gjennom XML-markering.', |
| 562 | +); |
| 563 | + |
| 564 | +/** Occitan (Occitan) |
| 565 | + * @author Cedric31 |
| 566 | + */ |
| 567 | +$messages['oc'] = array( |
| 568 | + 'ps-desc' => 'Supòrta los modèls en definissent lor estructura de donadas via de balisas XML', |
| 569 | +); |
| 570 | + |
| 571 | +/** Polish (Polski) |
| 572 | + * @author Sp5uhe |
| 573 | + * @author Woytecr |
| 574 | + */ |
| 575 | +$messages['pl'] = array( |
| 576 | + 'ps-desc' => 'Obsługa definiowania struktury szablonów z wykorzystaniem znaczników XML', |
| 577 | + 'ps-delimiter-label' => 'Separator wartości (domyślnie „,”)', |
| 578 | + 'ps-template' => 'Szablon', |
| 579 | + 'ps-add-template' => 'Dodaj szablon', |
| 580 | + 'ps-remove-template' => 'Usuń szablon', |
| 581 | + 'ps-field' => 'Pole', |
| 582 | + 'ps-namelabel' => 'Nazwa', |
| 583 | + 'ps-displaylabel' => 'Wyświetlana etykieta', |
| 584 | + 'ps-add-field' => 'Dodaj pole', |
| 585 | + 'ps-remove-field' => 'Usuń pole', |
| 586 | +); |
| 587 | + |
| 588 | +/** Piedmontese (Piemontèis) |
| 589 | + * @author Borichèt |
| 590 | + * @author Dragonòt |
| 591 | + */ |
| 592 | +$messages['pms'] = array( |
| 593 | + 'ps-desc' => "A manten jë stamp ch'a definisso soa strutura dij dat via markup XML", |
| 594 | +); |
| 595 | + |
| 596 | +/** Portuguese (Português) |
| 597 | + * @author Hamilton Abreu |
| 598 | + */ |
| 599 | +$messages['pt'] = array( |
| 600 | + 'ps-desc' => 'Permite criar modelos, cuja estrutura de dados é definida através de uma notação XML', |
| 601 | +); |
| 602 | + |
| 603 | +/** Brazilian Portuguese (Português do Brasil) |
| 604 | + * @author Daemorris |
| 605 | + */ |
| 606 | +$messages['pt-br'] = array( |
| 607 | + 'ps-desc' => 'Suporta predefinições definindo suas estruturas de dados via marcação XML', |
| 608 | +); |
| 609 | + |
| 610 | +/** Tarandíne (Tarandíne) |
| 611 | + * @author Joetaras |
| 612 | + */ |
| 613 | +$messages['roa-tara'] = array( |
| 614 | + 'ps-desc' => "Definisce le strutture de le date pe tutte le pàggene jndr'à 'na categorije ausanne l'XML", |
| 615 | + 'ps-schema-description' => "Schema d'a pàgene", |
| 616 | + 'ps-template' => 'Template', |
| 617 | + 'ps-add-template' => "Aggiunge 'u template", |
| 618 | + 'ps-remove-template' => "Live 'u template", |
| 619 | + 'ps-field' => 'Cambe', |
| 620 | +); |
| 621 | + |
| 622 | +/** Russian (Русский) |
| 623 | + * @author Eleferen |
| 624 | + * @author Александр Сигачёв |
| 625 | + */ |
| 626 | +$messages['ru'] = array( |
| 627 | + 'ps-desc' => 'Определяет структуру данных для всех страниц в категории с помощью XML', |
| 628 | + 'ps-schema-description' => 'Схема страницы', |
| 629 | + 'generatepages' => 'Создание страниц', |
| 630 | +); |
| 631 | + |
| 632 | +/** Slovenian (Slovenščina) |
| 633 | + * @author Dbc334 |
| 634 | + */ |
| 635 | +$messages['sl'] = array( |
| 636 | + 'ps-desc' => 'Opredeljuje zgradbo podatkov vseh strani v kategoriji z uporabo XML', |
| 637 | + 'ps-schema-description' => 'Shema strani', |
| 638 | + 'generatepages' => 'Ustvari strani', |
| 639 | + 'ps-generatepages-desc' => 'Ustvari naslednje strani, temelječe na shemi te kategorije:', |
| 640 | + 'ps-generatepages-success' => 'Ustvarjene bodo naslednje strani.', |
| 641 | + 'ps-generatepages-noschema' => 'Napaka: Kategorija nima določene sheme strani.', |
| 642 | + 'ps-generatepages-editsummary' => 'Ustvarjeno iz sheme strani', |
| 643 | + 'ps-page-desc-cat-not-exist' => 'Ta kategorija še ne obstaja. Ustvarite kategorijo in njeno shemo strani:', |
| 644 | + 'ps-page-desc-ps-not-exist' => 'Ta kategorija obstaja, vendar nima sheme strani. Ustvarite shemo:', |
| 645 | + 'ps-page-desc-edit-schema' => 'Uredi shemo strani te kategorije:', |
| 646 | + 'ps-delimiter-label' => 'Ločilo vrednosti (privzeto je »,«):', |
| 647 | + 'ps-multiple-temp-label' => 'Dovoli več primerkov predloge', |
| 648 | + 'ps-field-list-label' => 'Polje lahko vsebuje seznam vrednosti', |
| 649 | + 'ps-template' => 'Predloga', |
| 650 | + 'ps-add-template' => 'Dodaj predlogo', |
| 651 | + 'ps-remove-template' => 'Odstrani predlogo', |
| 652 | + 'ps-field' => 'Polje', |
| 653 | + 'ps-namelabel' => 'Ime:', |
| 654 | + 'ps-displaylabel' => 'Prikaži oznako:', |
| 655 | + 'ps-add-field' => 'Dodaj polje', |
| 656 | + 'ps-remove-field' => 'Odstrani polje', |
| 657 | + 'ps-add-xml-label' => 'Dodatni XML:', |
| 658 | + 'ps-optional-name' => 'Ime (pustite prazno, da nastavite na ime polje):', |
| 659 | + 'editschema' => 'Uredi shemo', |
| 660 | + 'createschema' => 'Ustvarite shemo', |
| 661 | + 'right-generatepages' => 'Ogled zavihka in strani »Ustvari strani«', |
| 662 | + 'action-generatepages' => 'ogled zavihka in strani »Ustvari strani«', |
| 663 | +); |
| 664 | + |
| 665 | +/** Serbian (Cyrillic script) (Српски (ћирилица)) |
| 666 | + * @author Rancher |
| 667 | + */ |
| 668 | +$messages['sr-ec'] = array( |
| 669 | + 'ps-desc' => 'Одређује структуру података за све странице у категорији користећи XML', |
| 670 | +); |
| 671 | + |
| 672 | +/** Serbian (Latin script) (Srpski (latinica)) */ |
| 673 | +$messages['sr-el'] = array( |
| 674 | + 'ps-desc' => 'Određuje strukturu podataka za sve stranice u kategoriji koristeći XML', |
| 675 | +); |
| 676 | + |
| 677 | +/** Swedish (Svenska) |
| 678 | + * @author Per |
| 679 | + */ |
| 680 | +$messages['sv'] = array( |
| 681 | + 'ps-desc' => 'Stödjer mallar som definierar datastrukturen med XML-markering', |
| 682 | +); |
| 683 | + |
| 684 | +/** Tagalog (Tagalog) |
| 685 | + * @author AnakngAraw |
| 686 | + */ |
| 687 | +$messages['tl'] = array( |
| 688 | + 'ps-desc' => 'Tumatangkilik sa mga suleras na nagbibigay kahulugan sa kanilang kayarian ng dato sa pamamagitan ng pagmarkang XML', |
| 689 | +); |
| 690 | + |
| 691 | +/** Turkish (Türkçe) |
| 692 | + * @author Vito Genovese |
| 693 | + */ |
| 694 | +$messages['tr'] = array( |
| 695 | + 'ps-desc' => 'XML işaretlemesi ile veri yapılarını tanımlayan şablonları destekler', |
| 696 | +); |
| 697 | + |
| 698 | +/** Ukrainian (Українська) |
| 699 | + * @author NickK |
| 700 | + * @author Prima klasy4na |
| 701 | + * @author Тест |
| 702 | + */ |
| 703 | +$messages['uk'] = array( |
| 704 | + 'ps-desc' => 'Підтримує визначення структури даних шаблонів за допомогою розмітки XML', |
| 705 | +); |
| 706 | + |
| 707 | +/** Vietnamese (Tiếng Việt) |
| 708 | + * @author Minh Nguyen |
| 709 | + */ |
| 710 | +$messages['vi'] = array( |
| 711 | + 'ps-desc' => 'Cho phép định nghĩa cấu trúc dữ liệu của bản mẫu dùng mã XML', |
| 712 | +); |
| 713 | + |
| 714 | +/** Simplified Chinese (中文(简体)) |
| 715 | + * @author Chenxiaoqino |
| 716 | + */ |
| 717 | +$messages['zh-hans'] = array( |
| 718 | + 'ps-desc' => '支持的模版已将其数据结构用XML代码声明。', |
| 719 | +); |
| 720 | + |
| 721 | +/** Traditional Chinese (中文(繁體)) |
| 722 | + * @author Mark85296341 |
| 723 | + */ |
| 724 | +$messages['zh-hant'] = array( |
| 725 | + 'ps-desc' => '支援的模版已將其資料結構用 XML 代碼聲明。', |
| 726 | +); |
| 727 | + |
Property changes on: tags/extensions/PageSchemas/REL_0_3/PageSchemas.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 728 | + native |
Index: tags/extensions/PageSchemas/REL_0_3/PageSchemas.php |
— | — | @@ -0,0 +1,94 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Page Schemas extension |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * |
| 9 | + * This is the main include file for the Page Schemas MediaWiki extension. |
| 10 | + * |
| 11 | + * Usage: Add the following line in LocalSettings.php: |
| 12 | + * require_once( "$IP/extensions/PageSchemas/PageSchemas.php" ); |
| 13 | + */ |
| 14 | + |
| 15 | +// Check environment |
| 16 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 17 | + echo( "This is an extension to the MediaWiki package and cannot be run standalone.\n" ); |
| 18 | + die( -1 ); |
| 19 | +} |
| 20 | + |
| 21 | +/* Configuration */ |
| 22 | + |
| 23 | +define( 'PAGE_SCHEMAS_VERSION', '0.3' ); |
| 24 | + |
| 25 | +// Credits |
| 26 | +$wgExtensionCredits['parserhook'][] = array( |
| 27 | + 'path' => __FILE__, |
| 28 | + 'name' => 'Page Schemas', |
| 29 | + 'author' => array( 'Ankit Garg', 'Yaron Koren' ), |
| 30 | + 'version' => PAGE_SCHEMAS_VERSION, |
| 31 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Page_Schemas', |
| 32 | + 'descriptionmsg' => 'ps-desc', |
| 33 | +); |
| 34 | + |
| 35 | +// Shortcut to this extension directory |
| 36 | +$dir = dirname( __FILE__ ) . '/'; |
| 37 | + |
| 38 | +// Internationalization |
| 39 | +$wgExtensionMessagesFiles['PageSchemas'] = $dir . 'PageSchemas.i18n.php'; |
| 40 | + |
| 41 | +// Job classes |
| 42 | +$wgJobClasses['pageSchemasCreatePage'] = 'PSCreatePageJob'; |
| 43 | +$wgAutoloadClasses['PSCreatePageJob'] = $dir . 'PS_CreatePageJob.php'; |
| 44 | + |
| 45 | +// Register page classes |
| 46 | +$wgAutoloadClasses['PageSchemasHooks'] = $dir . 'PageSchemas.hooks.php'; |
| 47 | +$wgAutoloadClasses['PageSchemas'] = $dir . 'PageSchemas.classes.php'; |
| 48 | +$wgAutoloadClasses['PSSchema'] = $dir . 'PageSchemas.classes.php'; |
| 49 | +$wgAutoloadClasses['ApiQueryPageSchemas'] = $dir . 'ApiQueryPageSchemas.php'; |
| 50 | +$wgAutoloadClasses['PSGeneratePages'] = $dir . 'specials/PS_GeneratePages.php'; |
| 51 | +$wgAutoloadClasses['PSEditSchema'] = $dir . 'specials/PS_EditSchema.php'; |
| 52 | +$wgAutoloadClasses['PSTabs'] = $dir . 'PS_Tabs.php'; |
| 53 | +$wgAutoloadClasses['PSExtensionHandler'] = $dir . 'PS_ExtensionHandler.php'; |
| 54 | + |
| 55 | +// Register special pages |
| 56 | +$wgSpecialPages['GeneratePages'] = 'PSGeneratePages'; |
| 57 | +$wgSpecialPages['EditSchema'] = 'PSEditSchema'; |
| 58 | +$wgSpecialPageGroups['GeneratePages'] = 'other'; |
| 59 | +$wgSpecialPageGroups['EditSchema'] = 'other'; |
| 60 | +// Register parser hook |
| 61 | +$wgHooks['ParserFirstCallInit'][] = 'PageSchemasHooks::register'; |
| 62 | + |
| 63 | +// Register page_props usage |
| 64 | +$wgPageProps['PageSchema'] = 'Contents of <PageSchema> tag'; |
| 65 | + |
| 66 | +$wgHooks['UnknownAction'][] = 'PSTabs::onUnknownAction'; |
| 67 | +$wgHooks['SkinTemplateTabs'][] = 'PSTabs::displayTabs'; |
| 68 | +$wgHooks['SkinTemplateNavigation'][] = 'PSTabs::displayTabs2'; |
| 69 | + |
| 70 | +// User right for viewing the 'Generate pages' page |
| 71 | +$wgAvailableRights[] = 'generatepages'; |
| 72 | +$wgGroupPermissions['sysop']['generatepages'] = true; |
| 73 | + |
| 74 | +// Register client-side modules |
| 75 | +$pageSchemasResourceTemplate = array( |
| 76 | + 'localBasePath' => $dir, |
| 77 | + 'remoteExtPath' => 'PageSchemas' |
| 78 | +); |
| 79 | +$wgResourceModules += array( |
| 80 | + 'ext.pageschemas.main' => $pageSchemasResourceTemplate + array( |
| 81 | + 'scripts' => array( |
| 82 | + 'PageSchemas.js', |
| 83 | + ), |
| 84 | + 'styles' => array( |
| 85 | + 'PageSchemas.css', |
| 86 | + ), |
| 87 | + 'dependencies' => array( |
| 88 | + 'jquery', |
| 89 | + ), |
| 90 | + ), |
| 91 | +); |
| 92 | + |
| 93 | +// Page Schemas global variables |
| 94 | +$wgPageSchemasFieldNum = 0; |
| 95 | +$wgPageSchemasHandlerClasses = array(); |
Property changes on: tags/extensions/PageSchemas/REL_0_3/PageSchemas.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 96 | + native |
Index: tags/extensions/PageSchemas/REL_0_3/PageSchemas.css |
— | — | @@ -0,0 +1,152 @@ |
| 2 | +/** |
| 3 | + * Used to display page schema information directly on the category page. |
| 4 | + */ |
| 5 | +table.pageSchema { |
| 6 | + border: 1px solid #ccc; |
| 7 | +} |
| 8 | + |
| 9 | +table.pageSchema td { |
| 10 | + padding-right: 5px; |
| 11 | +} |
| 12 | + |
| 13 | +body.rtl .pageSchema td { |
| 14 | + padding-right: auto; |
| 15 | + padding-left: 5px; |
| 16 | +} |
| 17 | + |
| 18 | +table.pageSchema .pageSchemaHeader { |
| 19 | + padding-left: 5px; |
| 20 | +} |
| 21 | + |
| 22 | +body.rtl .pageSchema .pageSchemaHeader { |
| 23 | + padding-left: auto; |
| 24 | + padding-right: 5px; |
| 25 | +} |
| 26 | + |
| 27 | +table.pageSchema .pageSchemaHeader span.rowValue { |
| 28 | + font-weight: bold; |
| 29 | +} |
| 30 | + |
| 31 | +.pageSchema .schemaExtensionRow { |
| 32 | + padding-left: 5px; |
| 33 | +} |
| 34 | + |
| 35 | +body.rtl .pageSchema .schemaExtensionRow { |
| 36 | + padding-left: auto; |
| 37 | + padding-right: 5px; |
| 38 | +} |
| 39 | + |
| 40 | +.pageSchema .schemaAttrRow { |
| 41 | + padding-left: 25px; |
| 42 | + background: white; |
| 43 | + font-weight: bold; |
| 44 | +} |
| 45 | + |
| 46 | +body.rtl .pageSchema .schemaAttrRow { |
| 47 | + padding-left: auto; |
| 48 | + padding-left: 25px; |
| 49 | +} |
| 50 | + |
| 51 | +table.pageSchema .templateRow { |
| 52 | + background: #d3c2a0; |
| 53 | + padding-left: 5px; |
| 54 | +} |
| 55 | + |
| 56 | +body.rtl .pageSchema .templaterow { |
| 57 | + padding-left: auto; |
| 58 | + padding-right: 5px; |
| 59 | +} |
| 60 | + |
| 61 | +.pageSchema span.rowValue { |
| 62 | + font-weight: bold; |
| 63 | +} |
| 64 | + |
| 65 | +.pageSchema .fieldRow { |
| 66 | + background: #eeddbb; |
| 67 | + padding-left: 25px; |
| 68 | +} |
| 69 | + |
| 70 | +body.rtl .pageSchema .fieldRow { |
| 71 | + padding-left: auto; |
| 72 | + padding-right: 25px; |
| 73 | +} |
| 74 | + |
| 75 | +.pageSchema .fieldExtensionRow { |
| 76 | + padding-left: 26px; |
| 77 | + border-top: 1px solid #ddd; |
| 78 | +} |
| 79 | + |
| 80 | +body.rtl .pageSchema .fieldExtensionRow { |
| 81 | + padding-left: auto; |
| 82 | + padding-right: 26px; |
| 83 | +} |
| 84 | + |
| 85 | +.pageSchema .fieldAttrRow { |
| 86 | + padding-left: 45px; |
| 87 | + background: white; |
| 88 | + font-weight: bold; |
| 89 | +} |
| 90 | + |
| 91 | +body.rtl .pageSchema .fieldAttrRow { |
| 92 | + padding-left: auto; |
| 93 | + padding-left: 45px; |
| 94 | +} |
| 95 | + |
| 96 | +.pageSchema .paramData { |
| 97 | + padding-left: 5px; |
| 98 | + background: #77dd77; |
| 99 | +} |
| 100 | + |
| 101 | +body.rtl .pageSchema .paramData { |
| 102 | + padding-left: auto; |
| 103 | + padding-right: 5px; |
| 104 | +} |
| 105 | + |
| 106 | +.pageSchema .paramData span.rowValue { |
| 107 | + font-weight: bold; |
| 108 | +} |
| 109 | + |
| 110 | +.pageSchema .paramDataField { |
| 111 | + background: #99ff99; |
| 112 | + padding-left: 35px; |
| 113 | +} |
| 114 | + |
| 115 | +body.rtl .pageSchema .paramDataField { |
| 116 | + padding-left: auto; |
| 117 | + padding-right: 35px; |
| 118 | +} |
| 119 | + |
| 120 | +.pageSchema .msg { |
| 121 | + padding-left: 5px; |
| 122 | + background: white; |
| 123 | +} |
| 124 | + |
| 125 | +body.rtl .pageSchema .msg { |
| 126 | + padding-left: auto; |
| 127 | + padding-right: 5px; |
| 128 | +} |
| 129 | + |
| 130 | +/** |
| 131 | + * Used in Special:EditSchema |
| 132 | + */ |
| 133 | +div.editSchemaSection { |
| 134 | + border: 1px #999 solid; |
| 135 | + background: white; |
| 136 | + padding: 0px; |
| 137 | + margin-bottom: 10px; |
| 138 | + margin-top: 10px; |
| 139 | +} |
| 140 | +div.editSchemaTemplateSection { |
| 141 | + background: #EEE; |
| 142 | +} |
| 143 | +div.editSchemaFieldSection { |
| 144 | + background: #CCC; |
| 145 | +} |
| 146 | +div.editSchemaSection .sectionHeader { |
| 147 | + font-weight: bold; |
| 148 | + padding: 4px 7px; |
| 149 | + border-bottom: 1px #bbb solid; |
| 150 | +} |
| 151 | +div.editSchemaSection .sectionBody { |
| 152 | + padding: 5px 15px; |
| 153 | +} |
Property changes on: tags/extensions/PageSchemas/REL_0_3/PageSchemas.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 154 | + native |
Index: tags/extensions/PageSchemas/REL_0_3/PageSchemas.hooks.php |
— | — | @@ -0,0 +1,56 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Hook functions for the Page Schemas extension |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +class PageSchemasHooks { |
| 11 | + |
| 12 | + // Initialization |
| 13 | + public static function register( &$parser ) { |
| 14 | + // Register the hook with the parser |
| 15 | + $parser->setHook( 'PageSchema', array( 'PageSchemasHooks', 'render' ) ); |
| 16 | + // Initialize the global array of "handler" classes |
| 17 | + wfRunHooks( 'PageSchemasRegisterHandlers' ); |
| 18 | + return true; |
| 19 | + } |
| 20 | + |
| 21 | + // Render the displayed XML, if any |
| 22 | + public static function render( $input, $args, $parser, $frame ) { |
| 23 | + // Disable cache so that CSS will get loaded |
| 24 | + $parser->disableCache(); |
| 25 | + |
| 26 | + // If this call is contained in a transcluded page or template, |
| 27 | + // or if the input is empty, display nothing. |
| 28 | + if ( !$frame->title->equals( $parser->getTitle() ) || $input == '' ) { |
| 29 | + return; |
| 30 | + } |
| 31 | + |
| 32 | + // TODO: Do processing here, like parse to an array |
| 33 | + $error_msg = null; |
| 34 | + |
| 35 | + // recreate the top-level <PageSchema> tag, with whatever |
| 36 | + // attributes it contained, because that was actually a tag- |
| 37 | + // function call, as opposed to a real XML tag |
| 38 | + $input = Xml::tags( 'PageSchema', $args, $input ); |
| 39 | + |
| 40 | + if ( $xml_object = PageSchemas::validateXML( $input, $error_msg ) ) { |
| 41 | + // Store the XML in the page_props table |
| 42 | + $parser->getOutput()->setProperty( 'PageSchema', $input ); |
| 43 | + // Display the schema on the screen |
| 44 | + global $wgOut, $wgScriptPath; |
| 45 | + $wgOut->addStyle( $wgScriptPath . '/extensions/PageSchemas/PageSchemas.css' ); |
| 46 | + $text = PageSchemas::displaySchema( $xml_object ); |
| 47 | + } else { |
| 48 | + // Store error message in the page_props table |
| 49 | + $parser->getOutput()->setProperty( 'PageSchema', $error_msg ); |
| 50 | + $text = Html::element( 'p', null, "The (incorrect) XML definition for this template is:" ) . "\n"; |
| 51 | + $text .= Html::element( 'pre', null, $input ); |
| 52 | + } |
| 53 | + |
| 54 | + // return output |
| 55 | + return $text; |
| 56 | + } |
| 57 | +} |
Property changes on: tags/extensions/PageSchemas/REL_0_3/PageSchemas.hooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 58 | + native |
Index: tags/extensions/PageSchemas/REL_0_3/PageSchemas.js |
— | — | @@ -0,0 +1,106 @@ |
| 2 | +/** |
| 3 | + * Javascript for the Page Schemas extension. |
| 4 | + * |
| 5 | + * @author Ankit Garg |
| 6 | + * @author Yaron Koren |
| 7 | + */ |
| 8 | + |
| 9 | + |
| 10 | +var fieldNum = jQuery('.fieldBox:visible').length; |
| 11 | +var templateNum = jQuery('.templateBox:visible').length; |
| 12 | + |
| 13 | +jQuery.fn.editSchemaMakeTemplateDeleter = function() { |
| 14 | + jQuery(this).click( function() { |
| 15 | + // Remove the encompassing div for this instance. |
| 16 | + jQuery(this).closest(".templateBox") |
| 17 | + .fadeOut('fast', function() { jQuery(this).remove(); }); |
| 18 | + }); |
| 19 | +} |
| 20 | + |
| 21 | +jQuery.fn.editSchemaMakeFieldDeleter = function() { |
| 22 | + jQuery(this).click( function() { |
| 23 | + // Remove the encompassing div for this instance. |
| 24 | + jQuery(this).closest(".fieldBox") |
| 25 | + .fadeOut('fast', function() { jQuery(this).remove(); }); |
| 26 | + }); |
| 27 | +} |
| 28 | + |
| 29 | +jQuery.fn.editSchemaMakeFieldAdder = function() { |
| 30 | + jQuery(this).click( function() { |
| 31 | + newField = jQuery('#starterField').clone().css('display', '').removeAttr('id'); |
| 32 | + newHTML = newField.html().replace(/fnum/g, fieldNum); |
| 33 | + newField.html(newHTML); |
| 34 | + newField.find(".deleteField").editSchemaMakeFieldDeleter(); |
| 35 | + jQuery(this).closest('.templateBox').find('.fieldsList').append(newField); |
| 36 | + // TODO - have this apply only to the added field, instead of all fields. |
| 37 | + jQuery(".deleteField").editSchemaMakeFieldDeleter(); |
| 38 | + jQuery('.sectionCheckbox').click(function() { |
| 39 | + jQuery(this).editSchemaToggleSectionDisplay(); |
| 40 | + }); |
| 41 | + jQuery('.isListCheckbox').click(function() { |
| 42 | + jQuery(this).editSchemaToggleDelimiterInput(); |
| 43 | + }); |
| 44 | + fieldNum++; |
| 45 | + } ); |
| 46 | +} |
| 47 | + |
| 48 | +jQuery.fn.editSchemaMakeTemplateAdder = function() { |
| 49 | + jQuery(this).click( function() { |
| 50 | + newField = jQuery('#starterTemplate').clone().css('display', '').remove('#starterField').removeAttr('id'); |
| 51 | + newHTML = newField.html().replace(/tnum/g, templateNum); |
| 52 | + newField.html(newHTML); |
| 53 | + newField.find(".deleteTemplate").editSchemaMakeTemplateDeleter(); |
| 54 | + jQuery('#templatesList').append(newField); |
| 55 | + // TODO - have this apply only to the added template, instead of all templates. |
| 56 | + jQuery(".editSchemaAddField").editSchemaMakeFieldAdder(); |
| 57 | + jQuery('.sectionCheckbox').click(function() { |
| 58 | + jQuery(this).editSchemaToggleSectionDisplay(); |
| 59 | + }); |
| 60 | + jQuery('.isListCheckbox').click(function() { |
| 61 | + jQuery(this).editSchemaToggleDelimiterInput(); |
| 62 | + }); |
| 63 | + templateNum++; |
| 64 | + } ); |
| 65 | +} |
| 66 | + |
| 67 | +jQuery.fn.editSchemaToggleDelimiterInput = function() { |
| 68 | + if (this.is(":checked")) { |
| 69 | + this.closest('.fieldBox').find('.delimiterInput').css('display', ''); |
| 70 | + } else { |
| 71 | + this.closest('.fieldBox').find('.delimiterInput').css('display', 'none'); |
| 72 | + } |
| 73 | +} |
| 74 | + |
| 75 | +jQuery.fn.editSchemaToggleSectionDisplay = function() { |
| 76 | + if (this.is(":checked")) { |
| 77 | + this.closest('.editSchemaSection').find('.sectionBody').css('display', '').removeClass('hiddenSection'); |
| 78 | + } else { |
| 79 | + this.closest('.editSchemaSection').find('.sectionBody').css('display', 'none').addClass('hiddenSection'); |
| 80 | + } |
| 81 | +} |
| 82 | + |
| 83 | +jQuery(document).ready(function() { |
| 84 | + // Add and delete buttons |
| 85 | + jQuery(".deleteTemplate").editSchemaMakeTemplateDeleter(); |
| 86 | + jQuery(".editSchemaAddTemplate").editSchemaMakeTemplateAdder(); |
| 87 | + jQuery(".deleteField").editSchemaMakeFieldDeleter(); |
| 88 | + jQuery(".editSchemaAddField").editSchemaMakeFieldAdder(); |
| 89 | + |
| 90 | + // Checkboxes |
| 91 | + jQuery('.isListCheckbox').each(function() { |
| 92 | + jQuery(this).editSchemaToggleDelimiterInput(); |
| 93 | + }); |
| 94 | + jQuery('.isListCheckbox').click(function() { |
| 95 | + jQuery(this).editSchemaToggleDelimiterInput(); |
| 96 | + }); |
| 97 | + jQuery('.sectionCheckbox').each(function() { |
| 98 | + jQuery(this).editSchemaToggleSectionDisplay(); |
| 99 | + }); |
| 100 | + jQuery('.sectionCheckbox').click(function() { |
| 101 | + jQuery(this).editSchemaToggleSectionDisplay(); |
| 102 | + }); |
| 103 | + jQuery('#editSchemaForm').submit( function() { |
| 104 | + jQuery(':hidden').find("input, select, textarea").attr('disabled', 'disabled'); |
| 105 | + return true; |
| 106 | + } ); |
| 107 | +}); |
Property changes on: tags/extensions/PageSchemas/REL_0_3/PageSchemas.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 108 | + native |
Index: tags/extensions/PageSchemas/REL_0_3/README |
— | — | @@ -0,0 +1,43 @@ |
| 2 | +Page Schemas extension |
| 3 | + |
| 4 | + Version 0.3 |
| 5 | + Ankit Garg and Yaron Koren |
| 6 | + |
| 7 | +This is free software licensed under the GNU General Public License. Please |
| 8 | +see http://www.gnu.org/copyleft/gpl.html for further details, including the |
| 9 | +full text and terms of the license. |
| 10 | + |
| 11 | +== Overview == |
| 12 | + |
| 13 | +Page Schemas is an extension to MediaWiki that allows for defining all the |
| 14 | +schema information about a "class", or data type - for naming, display, |
| 15 | +data input, and browsing - within a single piece of XML contained within a |
| 16 | +category page. This XML can then be used to generate all the necessary |
| 17 | +additional pages needed to put the schema into effect, such as template |
| 18 | +pages and, for instance, if Semantic Forms is installed, form pages. The |
| 19 | +XML can be created and edited via a helper form, preventing users from |
| 20 | +having to generate or modify it manually. |
| 21 | + |
| 22 | +Page Schemas allows other extensions to define their own fields to add to |
| 23 | +the XML, using hooks. |
| 24 | + |
| 25 | +For more information, see the extension homepage at: |
| 26 | +http://www.mediawiki.org/wiki/Extension:Page_Schemas |
| 27 | + |
| 28 | +== Requirements == |
| 29 | + |
| 30 | +This version of the Page Schemas extension requires MediaWiki 1.17 or higher. |
| 31 | + |
| 32 | +== Installation == |
| 33 | + |
| 34 | +To install the extension, place the entire 'PageSchemas' directory |
| 35 | +within your MediaWiki 'extensions' directory, then add the following |
| 36 | +line to your 'LocalSettings.php' file: |
| 37 | + |
| 38 | + require_once( "$IP/extensions/PageSchemas/PageSchemas.php" ); |
| 39 | + |
| 40 | +== Contact == |
| 41 | + |
| 42 | +Comments, questions, suggestions and bug reports are welcome, and can |
| 43 | +be placed on the Talk page for the extension, or sent to Yaron at |
| 44 | +yaron57@gmail.com. |
Property changes on: tags/extensions/PageSchemas/REL_0_3/README |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 45 | + native |