Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialTypes.php |
— | — | @@ -11,9 +11,9 @@ |
12 | 12 | * @ingroup SMWSpecialPage |
13 | 13 | * @ingroup SpecialPage |
14 | 14 | * |
15 | | - * @author S Page |
| 15 | + * @todo The messages 'smw_isnotype' and 'smw_typeunits', maybe 'smw_isaliastype', could be obsolete now. |
| 16 | + * |
16 | 17 | * @author Markus Krötzsch |
17 | | - * @author Jeroen De Dauw |
18 | 18 | */ |
19 | 19 | class SMWSpecialTypes extends SpecialPage { |
20 | 20 | |
— | — | @@ -22,142 +22,79 @@ |
23 | 23 | smwfLoadExtensionMessages( 'SemanticMediaWiki' ); |
24 | 24 | } |
25 | 25 | |
26 | | - public function execute( $param ) { |
27 | | - wfProfileIn( 'smwfDoSpecialTypes (SMW)' ); |
28 | | - |
| 26 | + public function execute( $param ) { |
29 | 27 | global $wgOut; |
30 | | - |
31 | | - $wgOut->setPageTitle( wfMsg( 'types' ) ); |
32 | | - |
33 | | - $rep = new TypesPage(); |
34 | | - |
35 | | - // execute() method added in MW 1.18 |
36 | | - if ( method_exists( $rep, 'execute' ) ) { |
37 | | - $rep->execute( $param ); |
| 28 | + wfProfileIn( 'smwfDoSpecialTypes (SMW)' ); |
| 29 | + |
| 30 | + $params = SMWInfolink::decodeParameters( $param, false ); |
| 31 | + $typeLabel = reset( $params ); |
| 32 | + |
| 33 | + if ( $typeLabel == false ) { |
| 34 | + $wgOut->setPageTitle( wfMsg( 'types' ) ); |
| 35 | + $html = $this->getTypesList(); |
| 36 | + } else { |
| 37 | + $typeName = str_replace( '_', ' ', $typeLabel ); |
| 38 | + $wgOut->setPageTitle( $typeName ); // Maybe add a better message for this |
| 39 | + $html = $this->getTypeProperties( $typeLabel ); |
38 | 40 | } |
39 | | - else { |
40 | | - list( $limit, $offset ) = wfCheckLimits(); |
41 | | - $rep->doQuery( $offset, $limit ); |
42 | | - } |
43 | | - |
44 | | - // Ensure locally collected output data is pushed to the output! |
| 41 | + |
| 42 | + $wgOut->addHTML( $html ); |
45 | 43 | SMWOutputs::commitToOutputPage( $wgOut ); |
46 | | - |
| 44 | + |
47 | 45 | wfProfileOut( 'smwfDoSpecialTypes (SMW)' ); |
48 | 46 | } |
49 | | - |
50 | | -} |
51 | 47 | |
52 | | -class TypesPage extends QueryPage { |
| 48 | + protected function getTypesList() { |
| 49 | + $html = '<p>' . htmlspecialchars( wfMsg( 'smw_types_docu' ) ) . "</p><br />\n"; |
53 | 50 | |
54 | | - public function __construct( $name = 'Types' ) { |
55 | | - global $wgVersion; |
56 | | - if ( version_compare( $wgVersion, '1.17', '>=' ) ) { |
57 | | - parent::__construct( $name ); |
| 51 | + $typeLabels = SMWDataValueFactory::getKnownTypeLabels(); |
| 52 | + asort( $typeLabels, SORT_STRING ); |
| 53 | + |
| 54 | + $html .= "<ul>\n"; |
| 55 | + foreach ( $typeLabels as $typeId => $label ) { |
| 56 | + $typeValue = SMWTypesValue::newFromTypeId( $typeId ); |
| 57 | + $html .= '<li>' . $typeValue->getLongHTMLText( $this->getSkin() ) . "</li>\n"; |
58 | 58 | } |
59 | | - } |
60 | | - |
61 | | - function getName() { |
62 | | - return 'Types'; |
63 | | - } |
| 59 | + $html .= "</ul>\n"; |
64 | 60 | |
65 | | - function isExpensive() { |
66 | | - return false; |
| 61 | + return $html; |
67 | 62 | } |
68 | 63 | |
69 | | - function isSyndicated() { |
70 | | - return false; |
71 | | - } |
| 64 | + protected function getTypeProperties( $typeLabel ) { |
| 65 | + global $wgRequest, $smwgTypePagingLimit; |
72 | 66 | |
73 | | - function getPageHeader() { |
74 | | - return '<p>' . htmlspecialchars( wfMsg( 'smw_types_docu' ) ) . "</p><br />\n"; |
75 | | - } |
| 67 | + if ( $smwgTypePagingLimit <= 0 ) return ''; // not too useful, but we comply to this request |
76 | 68 | |
77 | | - /* Failed attempt to fix https://bugzilla.wikimedia.org/show_bug.cgi?id=27440 |
78 | | - function getQueryInfo() { |
79 | | - $joinConds = array(); |
80 | | - |
81 | | - foreach ( SMWDataValueFactory::getKnownTypeLabels() as $label ) { |
82 | | - $label = str_replace( ' ', '_', $label ); // DBkey form so that SQL can elminate duplicates |
83 | | - $joinConds['page'] = array( 'UNION', "(SELECT 'Types' as type, " . |
84 | | - SMW_NS_TYPE . |
85 | | - " as namespace, '$label' as title, " . |
86 | | - "'$label' as value, 1 as count)" ); |
| 69 | + $from = $wgRequest->getVal( 'from' ); |
| 70 | + $until = $wgRequest->getVal( 'until' ); |
| 71 | + $typeValue = SMWDataValueFactory::newTypeIDValue( '__typ', $typeLabel ); |
| 72 | + |
| 73 | + $store = smwfGetStore(); |
| 74 | + $options = SMWPageLister::getRequestOptions( $smwgTypePagingLimit, $from, $until ); |
| 75 | + $diWikiPages = $store->getPropertySubjects( new SMWDIProperty( '_TYPE' ), $typeValue->getDataItem(), $options ); |
| 76 | + if ( !$options->ascending ) { |
| 77 | + $diWikiPages = array_reverse( $diWikiPages ); |
87 | 78 | } |
88 | | - |
89 | | - return array( |
90 | | - 'tables' => array( 'page' ), |
91 | | - 'fields' => array( |
92 | | - SMW_NS_TYPE . ' AS namespace', |
93 | | - 'page_title AS value', |
94 | | - 'page_title AS title', |
95 | | - '1 AS count' |
96 | | - ), |
97 | | - 'conds' => array( |
98 | | - 'page_namespace' => SMW_NS_TYPE, |
99 | | - 'page_is_redirect' => '0' |
100 | | - ), |
101 | | - 'join_conds' => $joinConds |
102 | | - ); |
103 | | - } |
104 | | - */ |
105 | | - |
106 | | - function getSQL() { |
107 | | - $dbr = wfGetDB( DB_SLAVE ); |
108 | | - $page = $dbr->tableName( 'page' ); |
109 | | - $NStype = SMW_NS_TYPE; |
110 | | - // TODO: Perhaps use the dbr syntax from SpecialAllpages. |
111 | | - // NOTE: type, namespace, title and value must all be defined for QueryPage to work (incl. caching) |
112 | | - $sql = "(SELECT 'Types' as type, {$NStype} as namespace, page_title as title, " . |
113 | | - "page_title as value, 1 as count FROM $page WHERE page_namespace = $NStype AND page_is_redirect = '0')"; |
114 | | - // make SQL for built-in datatypes |
115 | | - foreach ( SMWDataValueFactory::getKnownTypeLabels() as $label ) { |
116 | | - $label = str_replace( ' ', '_', $label ); // DBkey form so that SQL can elminate duplicates |
117 | | - $sql .= " UNION (SELECT 'Types' as type, {$NStype} as namespace, '$label' as title, " . |
118 | | - "'$label' as value, 1 as count)"; |
119 | | - } |
120 | | - return $sql; |
121 | | - } |
122 | 79 | |
123 | | - function sortDescending() { |
124 | | - return false; |
125 | | - } |
| 80 | + $result = ''; |
126 | 81 | |
127 | | - function formatResult( $skin, $result ) { |
128 | | - return $this->getTypeInfo( $skin, $result->value ); |
129 | | - } |
| 82 | + if ( count( $diWikiPages ) > 0 ) { |
| 83 | + $pageLister = new SMWPageLister( $diWikiPages, null, $this->getSkin(), $smwgTypePagingLimit, $from, $until ); |
130 | 84 | |
131 | | - /** |
132 | | - * Returns the info about a type as HTML. |
133 | | - */ |
134 | | - function getTypeInfo( $skin, $titletext ) { |
135 | | - $tv = SMWDataValueFactory::newTypeIDValue( '__typ', $titletext ); |
136 | | - $info = array(); |
137 | | - $error = array(); |
138 | | - if ( $tv->isAlias() ) { // print the type title as found, long text would (again) print the alias |
139 | | - $ttitle = Title::makeTitle( SMW_NS_TYPE, $titletext ); |
140 | | - $link = $skin->makeKnownLinkObj( $ttitle, $ttitle->getText() ); // aliases are only found if the page exists |
141 | | - $info[] = wfMsg( 'smw_isaliastype', $tv->getLongHTMLText() ); |
142 | | - } else { |
143 | | - $link = $tv->getLongHTMLText( $skin ); |
144 | | - if ( !$tv->isBuiltIn() ) { // find out whether and how this was user-defined |
145 | | - $dv = SMWDataValueFactory::newTypeObjectValue( $tv ); |
146 | | - $units = $dv->getUnitList(); |
147 | | - if ( count( $units ) == 0 ) { |
148 | | - $error[] = wfMsg( 'smw_isnotype', $tv->getLongHTMLText() ); |
149 | | - } else { |
150 | | - $info[] = wfMsg( 'smw_typeunits', $tv->getLongHTMLText(), implode( ', ', $units ) ); |
151 | | - } |
152 | | - } |
| 85 | + $title = $this->getTitleFor( 'Types', $typeLabel ); |
| 86 | + $title->setFragment( '#SMWResults' ); // Make navigation point to the result list. |
| 87 | + $navigation = $pageLister->getNavigationLinks( $title ); |
| 88 | + |
| 89 | + $resultNumber = min( $smwgTypePagingLimit, count( $diWikiPages ) ); |
| 90 | + $typeName = $typeValue->getLongWikiText(); |
| 91 | + |
| 92 | + $result .= "<a name=\"SMWResults\"></a><div id=\"mw-pages\">\n" . |
| 93 | + '<h2>' . wfMsg( 'smw_type_header', $typeName ) . "</h2>\n<p>" . |
| 94 | + wfMsgExt( 'smw_typearticlecount', array( 'parsemag' ), $resultNumber ) . "</p>\n" . |
| 95 | + $navigation . $pageLister->formatList() . $navigation . "\n</div>"; |
153 | 96 | } |
154 | | - |
155 | | - if ( count( $error ) > 0 ) { |
156 | | - $link .= smwfEncodeMessages( $error ); |
157 | | - } |
158 | | - if ( count( $info ) > 0 ) { |
159 | | - $link .= smwfEncodeMessages( $info, 'info' ); |
160 | | - } |
161 | | - return $link; |
| 97 | + |
| 98 | + return $result; |
162 | 99 | } |
163 | 100 | |
164 | 101 | } |
Index: trunk/extensions/SemanticMediaWiki/RELEASE-NOTES |
— | — | @@ -2,13 +2,37 @@ |
3 | 3 | |
4 | 4 | == SMW 1.6.0 == |
5 | 5 | |
| 6 | +* Full support for synchronizing RDF stores with SMW, and for answering #ask |
| 7 | + queries based on this data. The communication happens via SPARQL (1.1), and |
| 8 | + all SPARQL-capable stores should be supported. The following settings are |
| 9 | + needed in LocalSettings.php: |
| 10 | + $smwgDefaultStore = 'SMWSparqlStore'; |
| 11 | + $smwgSparqlDatabase = 'SMWSparqlDatabase'; |
| 12 | + // The following should be set to the URLs to reach the store: |
| 13 | + $smwgSparqlQueryEndpoint = 'http://localhost:8080/sparql/'; |
| 14 | + $smwgSparqlUpdateEndpoint = 'http://localhost:8080/update/'; |
| 15 | + $smwgSparqlDataEndpoint = 'http://localhost:8080/data/'; // can be empty |
| 16 | +* The Type namespace has been abolished. Builtin types now are displayed by the |
| 17 | + special page Special:Types, and there are no "custom types" any longer. |
| 18 | + By default, the Type namespace is gone and existing pages in this namespace |
| 19 | + can no longer be accessed. This can be changed by setting |
| 20 | + $smwgHistoricTypeNamespace = true in LocalSettings.php before including SMW. |
6 | 21 | * Changed the way in which units of measurement work. Type:Number now does not |
7 | | - accept any units, but units can be used with custom types as before. However |
8 | | - only units with a conversion factor on the custom type page are accepted. |
| 22 | + accept any units, and a new type "Quantity" is used for numbers with units. |
| 23 | + Units must be declared on the property page (not on the Type page as before), |
| 24 | + and only units that have a declared conversion factor are accepted. |
| 25 | +* The declaration of Type:Record properties has changed. Instead of a list of |
| 26 | + datatypes, the declaration now requires a list of properties that are to be |
| 27 | + used for the fields of the record. The declaration is still done with the |
| 28 | + property "has fields" as before. |
9 | 29 | * Changed the way parameters in query printers are specified and handled |
10 | 30 | using the Validator extension. This includes improvements to the parameter |
11 | 31 | options in the Special:Ask GUI and better error reporting for ask queries. |
12 | 32 | * Added UNIX-style DSV (Delimiter-separated values) result format. |
| 33 | +* Reworked internal data model, cleaning up and re-implementing SMWDataValue and |
| 34 | + all of its subclasses, and introducing new data item classes to handle data. |
| 35 | + The class SMWCompatibilityHelpers provides temporal help for extensions that |
| 36 | + still depend on the old format and APIs. |
13 | 37 | * Fixed PostGres SQL issues with the installation and upgrade code. |
14 | 38 | |
15 | 39 | == SMW 1.5.6 == |
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php |
— | — | @@ -96,34 +96,43 @@ |
97 | 97 | } |
98 | 98 | |
99 | 99 | public function getShortWikiText( $linked = null ) { |
| 100 | + global $wgContLang; |
100 | 101 | if ( ( $linked === null ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $this->m_caption == '' ) ) { |
101 | 102 | return $this->m_caption; |
102 | | - } else { // TODO provide a Special page with the functionality of former Type pages, and link to it here |
103 | | - return $this->m_caption; |
| 103 | + } else { |
| 104 | + $titleText = SpecialPageFactory::getLocalNameFor( 'Types', $this->m_realLabel ); |
| 105 | + $namespace = $wgContLang->getNsText( NS_SPECIAL ); |
| 106 | + return "[[$namespace:$titleText|{$this->m_caption}]]"; |
104 | 107 | } |
105 | 108 | } |
106 | 109 | |
107 | 110 | public function getShortHTMLText( $linker = null ) { |
108 | 111 | if ( ( $linked === null ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $this->m_caption == '' ) ) { |
109 | 112 | return htmlspecialchars( $this->m_caption ); |
110 | | - } else { // TODO provide a Special page with the functionality of former Type pages, and link to it here |
111 | | - return htmlspecialchars( $this->m_caption ); |
| 113 | + } else { |
| 114 | + $titleText = SpecialPageFactory::getLocalNameFor( 'Types', $this->m_realLabel ); |
| 115 | + $title = Title::makeTitle( NS_SPECIAL, $titleText ); |
| 116 | + return $linker->makeLinkObj( $title, htmlspecialchars( $this->m_caption ) ); |
112 | 117 | } |
113 | 118 | } |
114 | 119 | |
115 | 120 | public function getLongWikiText( $linked = null ) { |
116 | 121 | if ( ( $linked === null ) || ( $linked === false ) ) { |
117 | 122 | return $this->m_realLabel; |
118 | | - } else { // TODO provide a Special page with the functionality of former Type pages, and link to it here |
119 | | - return $this->m_realLabel; |
| 123 | + } else { |
| 124 | + $titleText = SpecialPageFactory::getLocalNameFor( 'Types', $this->m_realLabel ); |
| 125 | + $namespace = $wgContLang->getNsText( NS_SPECIAL ); |
| 126 | + return "[[$namespace:$titleText|{$this->m_realLabel}]]"; |
120 | 127 | } |
121 | 128 | } |
122 | 129 | |
123 | 130 | public function getLongHTMLText( $linker = null ) { |
124 | 131 | if ( ( $linker === null ) || ( $linker === false ) ) { |
125 | 132 | return htmlspecialchars( $this->m_realLabel ); |
126 | | - } else { // TODO provide a Special page with the functionality of former Type pages, and link to it here |
127 | | - return htmlspecialchars( $this->m_realLabel ); |
| 133 | + } else { |
| 134 | + $titleText = SpecialPageFactory::getLocalNameFor( 'Types', $this->m_realLabel ); |
| 135 | + $title = Title::makeTitle( NS_SPECIAL, $titleText ); |
| 136 | + return $linker->makeLinkObj( $title, htmlspecialchars( $this->m_realLabel ) ); |
128 | 137 | } |
129 | 138 | } |
130 | 139 | |
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_TypePage.php |
— | — | @@ -1,119 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Special handling for type description pages. |
5 | | - * Some code based on CategoryPage.php |
6 | | - * |
7 | | - * @author: Markus Krötzsch |
8 | | - * @file |
9 | | - * @ingroup SMW |
10 | | - */ |
11 | | - |
12 | | -/** |
13 | | - * Implementation of MediaWiki's Article that shows additional information on |
14 | | - * Type: pages. Very simliar to CategoryPage. |
15 | | - * @ingroup SMW |
16 | | - */ |
17 | | -class SMWTypePage extends SMWOrderedListPage { |
18 | | - |
19 | | - protected $m_typevalue; |
20 | | - |
21 | | - /** |
22 | | - * Use higher limit. This operation is very similar to showing members of cateogies. |
23 | | - */ |
24 | | - protected function initParameters() { |
25 | | - global $smwgTypePagingLimit; |
26 | | - $this->limit = $smwgTypePagingLimit; |
27 | | - return true; |
28 | | - } |
29 | | - |
30 | | - /** |
31 | | - * Fill the internal arrays with the set of data items to be displayed |
32 | | - * (possibly plus one additional item to indicate further results). |
33 | | - */ |
34 | | - protected function doQuery() { |
35 | | - if ( $this->limit > 0 ) { |
36 | | - $store = smwfGetStore(); |
37 | | - $options = new SMWRequestOptions(); |
38 | | - $options->limit = $this->limit + 1; |
39 | | - $options->sort = true; |
40 | | - $typevalue = SMWDataValueFactory::newTypeIDValue( '__typ', $this->mTitle->getText() ); |
41 | | - $this->m_typevalue = $typevalue; |
42 | | - if ( $this->from != '' ) { |
43 | | - $options->boundary = $this->from; |
44 | | - $options->ascending = true; |
45 | | - $options->include_boundary = true; |
46 | | - $this->diWikiPages = $store->getPropertySubjects( new SMWDIProperty( '_TYPE' ), $typevalue->getDataItem(), $options ); |
47 | | - } elseif ( $this->until != '' ) { |
48 | | - $options->boundary = $this->until; |
49 | | - $options->ascending = false; |
50 | | - $options->include_boundary = false; |
51 | | - $this->diWikiPages = array_reverse( $store->getPropertySubjects( new SMWDIProperty( '_TYPE' ), $typevalue->getDataItem(), $options ) ); |
52 | | - } else { |
53 | | - $this->diWikiPages = $store->getPropertySubjects( new SMWDIProperty( '_TYPE' ), $typevalue->getDataItem(), $options ); |
54 | | - } |
55 | | - } else { |
56 | | - $this->diWikiPages = array(); |
57 | | - } |
58 | | - } |
59 | | - |
60 | | - /** |
61 | | - * Generates the headline for the page list and the HTML encoded list of pages which |
62 | | - * shall be shown. |
63 | | - */ |
64 | | - protected function getPages() { |
65 | | - wfProfileIn( __METHOD__ . ' (SMW)' ); |
66 | | - smwfLoadExtensionMessages( 'SemanticMediaWiki' ); |
67 | | - $r = ''; |
68 | | - $typevalue = $this->m_typevalue; |
69 | | - if ( $typevalue->isBuiltIn() ) { |
70 | | - $r .= '<p style="font-style: italic; ">' . wfMsg( 'smw_isknowntype' ) . "</p>\n"; |
71 | | - } |
72 | | - /* |
73 | | - * TODO: also detect isAlias()? |
74 | | - * But smw_isaliastype message requires determining alias target; |
75 | | - * code is in SMW_SpecialTypes, not SMW_DV_Types. |
76 | | - */ |
77 | | - $ti = htmlspecialchars( $this->mTitle->getText() ); |
78 | | - $nav = $this->getNavigationLinks(); |
79 | | - $r .= '<a name="SMWResults"></a>' . $nav . "<div id=\"mw-pages\">\n"; |
80 | | - |
81 | | - $r .= '<h2>' . wfMsg( 'smw_type_header', $ti ) . "</h2>\n"; |
82 | | - $r .= wfMsgExt( 'smw_typearticlecount', array( 'parsemag' ), min( $this->limit, count( $this->diWikiPages ) ) ) . "\n"; |
83 | | - |
84 | | - $r .= $this->formatList(); |
85 | | - $r .= "\n</div>" . $nav; |
86 | | - wfProfileOut( __METHOD__ . ' (SMW)' ); |
87 | | - return $r; |
88 | | - } |
89 | | - |
90 | | - /** |
91 | | - * Format a list of data items chunked by letter, either as a |
92 | | - * bullet list or a columnar format, depending on the length. |
93 | | - * |
94 | | - * @param $cutoff integer, use columns for more results than that |
95 | | - * @return string |
96 | | - */ |
97 | | - private function formatList( $cutoff = 6 ) { |
98 | | - $end = count( $this->diWikiPages ); |
99 | | - if ( $end > $this->limit ) { |
100 | | - if ( $this->until != '' ) { |
101 | | - $start = 1; |
102 | | - } else { |
103 | | - $start = 0; |
104 | | - $end --; |
105 | | - } |
106 | | - } else { |
107 | | - $start = 0; |
108 | | - } |
109 | | - |
110 | | - if ( count ( $this->diWikiPages ) > $cutoff ) { |
111 | | - return $this->columnList( $start, $end, $this->diWikiPages ); |
112 | | - } elseif ( count( $this->diWikiPages ) > 0 ) { |
113 | | - // for short lists of diWikiPages |
114 | | - return $this->shortList( $start, $end, $this->diWikiPages ); |
115 | | - } |
116 | | - return ''; |
117 | | - } |
118 | | - |
119 | | -} |
120 | | - |
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | protected function getHtml() { |
35 | 35 | wfProfileIn( __METHOD__ . ' (SMW)' ); |
36 | 36 | |
37 | | - if ( $this->limit > 0 ) { |
| 37 | + if ( $this->limit > 0 ) { // limit==0: configuration setting to disable this completely |
38 | 38 | $store = smwfGetStore(); |
39 | 39 | $description = new SMWConceptDescription( $this->getDataItem() ); |
40 | 40 | $query = SMWPageLister::getQuery( $description, $this->limit, $this->from, $this->until ); |
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | * @return string |
85 | 85 | */ |
86 | 86 | protected function getPropertyValueList() { |
87 | | - if ( $this->limit > 0 ) { // for limit==0 there is no paging, and no query |
| 87 | + if ( $this->limit > 0 ) { // limit==0: configuration setting to disable this completely |
88 | 88 | $store = smwfGetStore(); |
89 | 89 | $options = SMWPageLister::getRequestOptions( $this->limit, $this->from, $this->until ); |
90 | 90 | $diWikiPages = $store->getAllPropertySubjects( $this->mProperty, $options ); |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SetupLight.php |
— | — | @@ -96,7 +96,6 @@ |
97 | 97 | $wgAutoloadClasses['SMWOutputs'] = $smwgIP . 'includes/SMW_Outputs.php'; |
98 | 98 | $wgAutoloadClasses['SMWSemanticData'] = $smwgIP . 'includes/SMW_SemanticData.php'; |
99 | 99 | $wgAutoloadClasses['SMWOrderedListPage'] = $smwgIP . 'includes/articlepages/SMW_OrderedListPage.php'; |
100 | | -// $wgAutoloadClasses['SMWTypePage'] = $smwgIP . 'includes/articlepages/SMW_TypePage.php'; |
101 | 100 | $wgAutoloadClasses['SMWPropertyPage'] = $smwgIP . 'includes/articlepages/SMW_PropertyPage.php'; |
102 | 101 | // $wgAutoloadClasses['SMWConceptPage'] = $smwgIP . 'includes/articlepages/SMW_ConceptPage.php'; |
103 | 102 | $wgAutoloadClasses['SMWQueryLanguage'] = $smwgIP . 'includes/SMW_QueryLanguage.php'; |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php |
— | — | @@ -114,7 +114,6 @@ |
115 | 115 | // Article pages |
116 | 116 | $apDir = $smwgIP . 'includes/articlepages/'; |
117 | 117 | $wgAutoloadClasses['SMWOrderedListPage'] = $apDir . 'SMW_OrderedListPage.php'; |
118 | | - $wgAutoloadClasses['SMWTypePage'] = $apDir . 'SMW_TypePage.php'; |
119 | 118 | $wgAutoloadClasses['SMWPropertyPage'] = $apDir . 'SMW_PropertyPage.php'; |
120 | 119 | $wgAutoloadClasses['SMWConceptPage'] = $apDir . 'SMW_ConceptPage.php'; |
121 | 120 | |
— | — | @@ -429,9 +428,7 @@ |
430 | 429 | * @return true |
431 | 430 | */ |
432 | 431 | function smwfOnArticleFromTitle( Title &$title, /* Article */ &$article ) { |
433 | | - if ( $title->getNamespace() == SMW_NS_TYPE ) { |
434 | | - $article = new SMWTypePage( $title ); |
435 | | - } elseif ( $title->getNamespace() == SMW_NS_PROPERTY ) { |
| 432 | + if ( $title->getNamespace() == SMW_NS_PROPERTY ) { |
436 | 433 | $article = new SMWPropertyPage( $title ); |
437 | 434 | } elseif ( $title->getNamespace() == SMW_NS_CONCEPT ) { |
438 | 435 | $article = new SMWConceptPage( $title ); |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php |
— | — | @@ -86,16 +86,35 @@ |
87 | 87 | * Function that returns an array of namespace identifiers. |
88 | 88 | */ |
89 | 89 | function getNamespaces() { |
90 | | - return $this->m_Namespaces; |
| 90 | + global $smwgHistoricTypeNamespace; |
| 91 | + $namespaces = $this->m_Namespaces; |
| 92 | + if ( !$smwgHistoricTypeNamespace ) { |
| 93 | + unset( $namespaces[SMW_NS_TYPE] ); |
| 94 | + unset( $namespaces[SMW_NS_TYPE_TALK] ); |
| 95 | + } |
| 96 | + return $namespaces; |
91 | 97 | } |
92 | 98 | |
93 | 99 | /** |
94 | 100 | * Function that returns an array of namespace aliases, if any. |
95 | 101 | */ |
96 | 102 | function getNamespaceAliases() { |
97 | | - return $this->m_useEnDefaultAliases ? |
98 | | - $this->m_NamespaceAliases + SMWLanguage::$enNamespaceAliases: |
99 | | - $this->m_NamespaceAliases; |
| 103 | + global $smwgHistoricTypeNamespace; |
| 104 | + |
| 105 | + $namespaceAliases = $this->m_NamespaceAliases; |
| 106 | + if ( $this->m_useEnDefaultAliases ) { |
| 107 | + $namespaceAliases = $namespaceAliases + SMWLanguage::$enNamespaceAliases; |
| 108 | + } |
| 109 | + |
| 110 | + if ( !$smwgHistoricTypeNamespace ) { |
| 111 | + foreach ($namespaceAliases as $alias => $namespace) { |
| 112 | + if ( $namespace == SMW_NS_TYPE || $namespace == SMW_NS_TYPE_TALK ) { |
| 113 | + unset( $namespaceAliases[$alias] ); |
| 114 | + } |
| 115 | + } |
| 116 | + } |
| 117 | + |
| 118 | + return $namespaceAliases; |
100 | 119 | } |
101 | 120 | |
102 | 121 | /** |
Index: trunk/extensions/SemanticMediaWiki/SMW_Settings.php |
— | — | @@ -69,6 +69,18 @@ |
70 | 70 | require_once( 'includes/SMW_Setup.php' ); |
71 | 71 | |
72 | 72 | ### |
| 73 | +# Setting this option to true before including this file to enable the old |
| 74 | +# Type: namespace that SMW used up to version 1.5.*. This should only be |
| 75 | +# done to make the pages of this namespace temporarily accessible in order to |
| 76 | +# move their content to other pages. If the namespace is not registered, then |
| 77 | +# existing pages in this namespace cannot be found in the wiki. |
| 78 | +## |
| 79 | +if ( !isset( $smwgHistoricTypeNamespace ) ) { |
| 80 | + $smwgHistoricTypeNamespace = false; |
| 81 | +} |
| 82 | +## |
| 83 | + |
| 84 | +### |
73 | 85 | # If you already have custom namespaces on your site, insert |
74 | 86 | # $smwgNamespaceIndex = ???; |
75 | 87 | # into your LocalSettings.php *before* including this file. The number ??? must |
— | — | @@ -173,6 +185,7 @@ |
174 | 186 | # performance problems. |
175 | 187 | ## |
176 | 188 | $smwgSearchByPropertyFuzzy = true; |
| 189 | +## |
177 | 190 | |
178 | 191 | ### |
179 | 192 | # Number results shown in the listings on pages in the namespaces Property, |