Index: trunk/extensions/DataTransfer/specials/DT_ViewXML.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * Shows list of all forms on the site. |
| 4 | + * Displays an interface to let the user export pages from the wiki in XML form |
5 | 5 | * |
6 | 6 | * @author Yaron Koren |
7 | 7 | */ |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | |
29 | 29 | function getCategoriesList() { |
30 | 30 | global $wgContLang, $dtgContLang; |
31 | | - $dt_props = $dtgContLang->getSpecialPropertiesArray(); |
| 31 | + $dt_props = $dtgContLang->getPropertyLabels(); |
32 | 32 | $exclusion_cat_name = str_replace(' ', '_', $dt_props[DT_SP_IS_EXCLUDED_FROM_XML]); |
33 | 33 | $exclusion_cat_full_name = $wgContLang->getNSText(NS_CATEGORY) . ':' . $exclusion_cat_name; |
34 | 34 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -66,7 +66,7 @@ |
67 | 67 | function getGroupings() { |
68 | 68 | global $dtgContLang; |
69 | 69 | |
70 | | - $dt_props = $dtgContLang->getSpecialPropertiesArray(); |
| 70 | + $dt_props = $dtgContLang->getPropertyLabels(); |
71 | 71 | $xml_grouping_prop = str_replace(' ', '_', $dt_props[DT_SP_HAS_XML_GROUPING]); |
72 | 72 | |
73 | 73 | global $smwgIP; |
— | — | @@ -241,7 +241,7 @@ |
242 | 242 | |
243 | 243 | // if this page belongs to the exclusion category, exit |
244 | 244 | $parent_categories = $title->getParentCategoryTree(array()); |
245 | | - $dt_props = $dtgContLang->getSpecialPropertiesArray(); |
| 245 | + $dt_props = $dtgContLang->getPropertyLabels(); |
246 | 246 | //$exclusion_category = $title->newFromText($dt_props[DT_SP_IS_EXCLUDED_FROM_XML], NS_CATEGORY); |
247 | 247 | $exclusion_category = $wgContLang->getNSText(NS_CATEGORY) . ':' . str_replace(' ', '_', $dt_props[DT_SP_IS_EXCLUDED_FROM_XML]); |
248 | 248 | if (treeContainsElement($parent_categories, $exclusion_category)) |
— | — | @@ -491,31 +491,38 @@ |
492 | 492 | $text .= "</Pages>"; |
493 | 493 | print $text; |
494 | 494 | } else { |
495 | | - $text = "<form action=\"\" method=\"get\">\n"; |
496 | | - $text .= "<p>" . wfMsg('dt_viewxml_docu') . "</p>\n"; |
497 | | - $text .= "<h2>" . wfMsg('dt_viewxml_categories') . "</h2>\n"; |
498 | | - $categories = getCategoriesList(); |
499 | | - foreach ($categories as $category) { |
500 | | - $title = Title::makeTitle( NS_CATEGORY, $category ); |
501 | | - $link = $skin->makeLinkObj( $title, $title->getText() ); |
502 | | - $text .= "<input type=\"checkbox\" name=\"categories[$category]\" /> $link <br />\n"; |
503 | | - } |
504 | | - $text .= "<h2>" . wfMsg('dt_viewxml_namespaces') . "</h2>\n"; |
505 | | - $namespaces = getNamespacesList(); |
506 | | - foreach ($namespaces as $namespace) { |
507 | | - if ($namespace == 0) { |
508 | | - $ns_name = "Main"; |
509 | | - } else { |
510 | | - $ns_name = $wgCanonicalNamespaceNames["$namespace"]; |
| 495 | + // set 'title' as hidden field, in case there's no URL niceness |
| 496 | + global $wgContLang; |
| 497 | + $mw_namespace_labels = $wgContLang->getNamespaces(); |
| 498 | + $special_namespace = $mw_namespace_labels[NS_SPECIAL]; |
| 499 | + $text =<<<END |
| 500 | + <form action="" method="get"> |
| 501 | + <input type="hidden" name="title" value="$special_namespace:ViewXML"> |
| 502 | + |
| 503 | +END; |
| 504 | + $text .= "<p>" . wfMsg('dt_viewxml_docu') . "</p>\n"; |
| 505 | + $text .= "<h2>" . wfMsg('dt_viewxml_categories') . "</h2>\n"; |
| 506 | + $categories = getCategoriesList(); |
| 507 | + foreach ($categories as $category) { |
| 508 | + $title = Title::makeTitle( NS_CATEGORY, $category ); |
| 509 | + $link = $skin->makeLinkObj( $title, $title->getText() ); |
| 510 | + $text .= "<input type=\"checkbox\" name=\"categories[$category]\" /> $link <br />\n"; |
511 | 511 | } |
512 | | - $ns_name = str_replace('_', ' ', $ns_name); |
513 | | - $text .= "<input type=\"checkbox\" name=\"namespaces[$namespace]\" /> $ns_name <br />\n"; |
514 | | - } |
515 | | - $text .= "<br /><p><input type=\"checkbox\" name=\"simplified_format\" /> " . wfMsg('dt_viewxml_simplifiedformat') . "</p>\n"; |
516 | | - $text .= "<input type=\"submit\" value=\"" . wfMsg('viewxml') . "\">\n"; |
517 | | - $text .= "</form>\n"; |
| 512 | + $text .= "<h2>" . wfMsg('dt_viewxml_namespaces') . "</h2>\n"; |
| 513 | + $namespaces = getNamespacesList(); |
| 514 | + foreach ($namespaces as $namespace) { |
| 515 | + if ($namespace == 0) { |
| 516 | + $ns_name = "Main"; |
| 517 | + } else { |
| 518 | + $ns_name = $wgCanonicalNamespaceNames["$namespace"]; |
| 519 | + } |
| 520 | + $ns_name = str_replace('_', ' ', $ns_name); |
| 521 | + $text .= "<input type=\"checkbox\" name=\"namespaces[$namespace]\" /> $ns_name <br />\n"; |
| 522 | + } |
| 523 | + $text .= "<br /><p><input type=\"checkbox\" name=\"simplified_format\" /> " . wfMsg('dt_viewxml_simplifiedformat') . "</p>\n"; |
| 524 | + $text .= "<input type=\"submit\" value=\"" . wfMsg('viewxml') . "\">\n"; |
| 525 | + $text .= "</form>\n"; |
518 | 526 | |
519 | | - $wgOut->addHTML($text); |
520 | | - |
| 527 | + $wgOut->addHTML($text); |
521 | 528 | } |
522 | 529 | } |