Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_SimpleWikiPage.php |
— | — | @@ -13,6 +13,8 @@ |
14 | 14 | * advantage of the reduction of data is that these important values can be |
15 | 15 | * stored in smaller tables that allow for faster direct access than general |
16 | 16 | * page type values. |
| 17 | + * |
| 18 | + * @deprecated This auxiliary class will vanish in SMW 1.6 |
17 | 19 | * |
18 | 20 | * @author Markus Krötzsch |
19 | 21 | * @ingroup SMWDataValues |
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_WikiPage.php |
— | — | @@ -6,7 +6,13 @@ |
7 | 7 | |
8 | 8 | /** |
9 | 9 | * This datavalue implements special processing suitable for defining |
10 | | - * wikipages as values of properties. In contrast to most other types |
| 10 | + * wikipages as values of properties. |
| 11 | + * |
| 12 | + * The class can support general wiki pages, or pages of a fixed |
| 13 | + * namespace, Whether a namespace is fixed is decided based on the |
| 14 | + * type ID when the object is constructed. |
| 15 | + * |
| 16 | + * In contrast to most other types |
11 | 17 | * of values, wiki pages are determined by multiple components, as |
12 | 18 | * retruned by their getDBkeys() method: DBkey, namespace, interwiki |
13 | 19 | * prefix and sortkey. The last of those has a somewhat nonstandard |
— | — | @@ -155,12 +161,12 @@ |
156 | 162 | } |
157 | 163 | |
158 | 164 | protected function parseDBkeys( $args ) { |
159 | | - if ( count( $args ) != 4 ) { |
| 165 | + if ( count( $args ) < 3 ) { |
160 | 166 | smwfLoadExtensionMessages( 'SemanticMediaWiki' ); |
161 | 167 | $this->addError( wfMsgForContent( 'smw_notitle', $this->getPrefixedText() ) ); |
162 | 168 | $this->m_dataitem = new SMWDIWikiPage( 'ERROR', NS_MAIN, '', $this->m_typeid ); |
163 | 169 | } else { |
164 | | - $this->m_dataitem = new SMWDIWikiPage( $args[0], floatval( $args[1] ), $args[2], $args[3], $this->m_typeid ); |
| 170 | + $this->m_dataitem = new SMWDIWikiPage( $args[0], floatval( $args[1] ), $args[2], $this->m_typeid ); |
165 | 171 | $this->m_textform = str_replace( '_', ' ', $this->m_dataitem->getDBkey() ); |
166 | 172 | $this->m_id = -1; |
167 | 173 | $this->m_title = null; |
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | |
8 | 8 | /** |
9 | 9 | * This datavalue implements special processing suitable for defining types of |
10 | | - * properties. Types behave largely like values of type SMWSimpleWikiPageValue |
| 10 | + * properties. Types behave largely like values of type SMWWikiPageValue |
11 | 11 | * with three main differences. First, they actively check if a value is an |
12 | 12 | * alias for another type, modifying the internal representation accordingly. |
13 | 13 | * Second, they have a modified display for emphasizing if some type is defined |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | * @author Markus Krötzsch |
18 | 18 | * @ingroup SMWDataValues |
19 | 19 | */ |
20 | | -class SMWTypesValue extends SMWSimpleWikiPageValue { |
| 20 | +class SMWTypesValue extends SMWWikiPageValue { |
21 | 21 | |
22 | 22 | private $m_isalias; // record whether this is an alias to another type, used to avoid duplicates when listing page types |
23 | 23 | protected $m_reallabel; |
— | — | @@ -28,7 +28,8 @@ |
29 | 29 | } |
30 | 30 | |
31 | 31 | protected function parseDBkeys( $args ) { |
32 | | - parent::parseDBkeys( array( str_replace( ' ', '_', SMWDataValueFactory::findTypeLabel( $args[0] ) ) ) ); |
| 32 | + $pagedbkey = str_replace( ' ', '_', SMWDataValueFactory::findTypeLabel( $args[0] ) ); |
| 33 | + parent::parseDBkeys( array( $pagedbkey, $this->m_fixNamespace, '', $this->m_typeid ) ); |
33 | 34 | $this->m_reallabel = $this->m_textform; |
34 | 35 | $this->m_isalias = false; |
35 | 36 | } |
— | — | @@ -87,18 +88,20 @@ |
88 | 89 | } |
89 | 90 | |
90 | 91 | public function getWikiValue() { |
91 | | - return implode( '; ', $this->getTypeLabels() ); |
| 92 | + $this->unstub(); |
| 93 | + return $this->m_reallabel; |
92 | 94 | } |
93 | 95 | |
94 | 96 | public function getHash() { |
95 | | - return implode( "\t", $this->getTypeLabels() ); |
| 97 | + $this->unstub(); |
| 98 | + return $this->m_reallabel; |
96 | 99 | } |
97 | 100 | |
98 | 101 | /** |
99 | 102 | * This class uses type ids as DB keys. |
100 | 103 | */ |
101 | 104 | public function getDBkey() { |
102 | | - return ( $this->isValid() ) ? SMWDataValueFactory::findTypeID( $this->m_reallabel ):''; |
| 105 | + return ( $this->isValid() ) ? SMWDataValueFactory::findTypeID( $this->m_reallabel ) : ''; |
103 | 106 | } |
104 | 107 | |
105 | 108 | /** |
— | — | @@ -107,7 +110,7 @@ |
108 | 111 | */ |
109 | 112 | public function isBuiltIn() { |
110 | 113 | $v = $this->getDBkey(); |
111 | | - return ( ( $this->isUnary() ) && ( $v { 0 } == '_' ) ); |
| 114 | + return ( $v { 0 } == '_' ); |
112 | 115 | } |
113 | 116 | |
114 | 117 | /** |
— | — | @@ -119,38 +122,5 @@ |
120 | 123 | return $this->m_isalias; |
121 | 124 | } |
122 | 125 | |
123 | | - /** |
124 | | - * Retrieve type labels if needed. Can be done lazily. |
125 | | - */ |
126 | | - public function getTypeLabels() { |
127 | | - $this->unstub(); |
128 | | - return array( $this->m_reallabel ); |
129 | | - } |
130 | | - |
131 | | - /** |
132 | | - * Retrieve type captions if needed. Can be done lazily. The captions |
133 | | - * are different from the labels if type aliases are used. |
134 | | - */ |
135 | | - public function getTypeCaptions() { |
136 | | - $this->unstub(); |
137 | | - return array( $this->m_textform ); |
138 | | - } |
139 | | - |
140 | | - /** |
141 | | - * Retrieve type values. |
142 | | - * @deprecated This method is no longer meaningful and will vanish before SMW 1.6 |
143 | | - */ |
144 | | - public function getTypeValues() { |
145 | | - return array( $this ); |
146 | | - } |
147 | | - |
148 | | - /** |
149 | | - * Is this a simple unary type or some composed n-ary type? |
150 | | - * @deprecated This method is no longer meaningful and will vanish before SMW 1.6 |
151 | | - */ |
152 | | - public function isUnary() { |
153 | | - return true; |
154 | | - } |
155 | | - |
156 | 126 | } |
157 | 127 | |