Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php |
— | — | @@ -30,42 +30,46 @@ |
31 | 31 | * article that indicates further results). |
32 | 32 | */ |
33 | 33 | protected function doQuery() { |
34 | | - $store = smwfGetStore(); |
| 34 | + if ($this->limit > 0) { |
| 35 | + $store = smwfGetStore(); |
| 36 | + $desc = new SMWConceptDescription($this->mTitle); |
| 37 | + if ($this->from != '') { |
| 38 | + $dv = SMWWikiPageValue::makePage($this->from, NS_MAIN); // make a dummy wiki page as boundary |
| 39 | + $fromdesc = new SMWValueDescription($dv, SMW_CMP_GEQ); |
| 40 | + $desc = new SMWConjunction(array($desc,$fromdesc)); |
| 41 | + $order = 'ASC'; |
| 42 | + } elseif ($this->until != '') { |
| 43 | + $dv = SMWWikiPageValue::makePage($this->until, NS_MAIN); // make a dummy wiki page as boundary |
| 44 | + $fromdesc = new SMWValueDescription($dv, SMW_CMP_LEQ); |
| 45 | + $neqdesc = new SMWValueDescription($dv, SMW_CMP_NEQ); // do not include boundary in this case |
| 46 | + $desc = new SMWConjunction(array($desc,$fromdesc,$neqdesc)); |
| 47 | + $order = 'DESC'; |
| 48 | + } else { |
| 49 | + $order = 'ASC'; |
| 50 | + } |
| 51 | + $desc->addPrintRequest(new SMWPrintRequest(SMWPrintRequest::PRINT_THIS, '')); |
| 52 | + $query = new SMWQuery($desc); |
| 53 | + $query->sortkeys[''] = $order; |
| 54 | + $query->setLimit($this->limit+1); |
35 | 55 | |
36 | | - $desc = new SMWConceptDescription($this->mTitle); |
37 | | - if ($this->from != '') { |
38 | | - $dv = SMWWikiPageValue::makePage($this->from, NS_MAIN); // make a dummy wiki page as boundary |
39 | | - $fromdesc = new SMWValueDescription($dv, SMW_CMP_GEQ); |
40 | | - $desc = new SMWConjunction(array($desc,$fromdesc)); |
41 | | - $order = 'ASC'; |
42 | | - } elseif ($this->until != '') { |
43 | | - $dv = SMWWikiPageValue::makePage($this->until, NS_MAIN); // make a dummy wiki page as boundary |
44 | | - $fromdesc = new SMWValueDescription($dv, SMW_CMP_LEQ); |
45 | | - $neqdesc = new SMWValueDescription($dv, SMW_CMP_NEQ); // do not include boundary in this case |
46 | | - $desc = new SMWConjunction(array($desc,$fromdesc,$neqdesc)); |
47 | | - $order = 'DESC'; |
| 56 | + $result = $store->getQueryResult($query); |
| 57 | + $row = $result->getNext(); |
| 58 | + while ( $row !== false ) { |
| 59 | + $this->articles[] = end($row)->getNextObject(); |
| 60 | + $row = $result->getNext(); |
| 61 | + } |
| 62 | + if ($order == 'DESC') { |
| 63 | + $this->articles = array_reverse($this->articles); |
| 64 | + } |
| 65 | + $this->m_errors = $query->getErrors(); |
48 | 66 | } else { |
49 | | - $order = 'ASC'; |
| 67 | + $this->articles = array(); |
| 68 | + $this->errors = array(); |
50 | 69 | } |
51 | | - $desc->addPrintRequest(new SMWPrintRequest(SMWPrintRequest::PRINT_THIS, '')); |
52 | | - $query = new SMWQuery($desc); |
53 | | - $query->sortkeys[''] = $order; |
54 | | - $query->setLimit($this->limit+1); |
55 | | - |
56 | | - $result = $store->getQueryResult($query); |
57 | | - $row = $result->getNext(); |
58 | | - while ( $row !== false ) { |
59 | | - $this->articles[] = end($row)->getNextObject(); |
60 | | - $row = $result->getNext(); |
61 | | - } |
62 | | - if ($order == 'DESC') { |
63 | | - $this->articles = array_reverse($this->articles); |
64 | | - } |
65 | | - $this->m_errors = $query->getErrors(); |
66 | 70 | } |
67 | 71 | |
68 | 72 | /** |
69 | | - * Generates the headline for the page list and the HTML encoded list of pages which |
| 73 | + * Generates the headline for the page list and the HTML encoded list of pages which |
70 | 74 | * shall be shown. |
71 | 75 | */ |
72 | 76 | protected function getPages() { |
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_TypePage.php |
— | — | @@ -31,29 +31,33 @@ |
32 | 32 | * article that indicates further results). |
33 | 33 | */ |
34 | 34 | protected function doQuery() { |
35 | | - $store = smwfGetStore(); |
36 | | - $options = new SMWRequestOptions(); |
37 | | - $options->limit = $this->limit + 1; |
38 | | - $options->sort = true; |
39 | | - $typevalue = SMWDataValueFactory::newTypeIDValue('__typ', $this->mTitle->getText()); |
40 | | - $this->m_typevalue = $typevalue; |
41 | | - if ($this->from != '') { |
42 | | - $options->boundary = $this->from; |
43 | | - $options->ascending = true; |
44 | | - $options->include_boundary = true; |
45 | | - $this->articles = $store->getPropertySubjects(SMWPropertyValue::makeProperty('_TYPE'), $typevalue, $options); |
46 | | - } elseif ($this->until != '') { |
47 | | - $options->boundary = $this->until; |
48 | | - $options->ascending = false; |
49 | | - $options->include_boundary = false; |
50 | | - $this->articles = array_reverse($store->getPropertySubjects(SMWPropertyValue::makeProperty('_TYPE'), $typevalue, $options)); |
| 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->articles = $store->getPropertySubjects(SMWPropertyValue::makeProperty('_TYPE'), $typevalue, $options); |
| 47 | + } elseif ($this->until != '') { |
| 48 | + $options->boundary = $this->until; |
| 49 | + $options->ascending = false; |
| 50 | + $options->include_boundary = false; |
| 51 | + $this->articles = array_reverse($store->getPropertySubjects(SMWPropertyValue::makeProperty('_TYPE'), $typevalue, $options)); |
| 52 | + } else { |
| 53 | + $this->articles = $store->getPropertySubjects(SMWPropertyValue::makeProperty('_TYPE'), $typevalue, $options); |
| 54 | + } |
51 | 55 | } else { |
52 | | - $this->articles = $store->getPropertySubjects(SMWPropertyValue::makeProperty('_TYPE'), $typevalue, $options); |
| 56 | + $this->articles = array(); |
53 | 57 | } |
54 | 58 | } |
55 | 59 | |
56 | 60 | /** |
57 | | - * Generates the headline for the page list and the HTML encoded list of pages which |
| 61 | + * Generates the headline for the page list and the HTML encoded list of pages which |
58 | 62 | * shall be shown. |
59 | 63 | */ |
60 | 64 | protected function getPages() { |
— | — | @@ -65,8 +69,8 @@ |
66 | 70 | $r .= '<p style="font-style: italic; ">' .wfMsg('smw_isknowntype') . "</p>\n"; |
67 | 71 | } |
68 | 72 | /* |
69 | | - * TODO: also detect isAlias()? |
70 | | - * But smw_isaliastype message requires determining alias target; |
| 73 | + * TODO: also detect isAlias()? |
| 74 | + * But smw_isaliastype message requires determining alias target; |
71 | 75 | * code is in SMW_SpecialTypes, not SMW_DV_Types. |
72 | 76 | */ |
73 | 77 | $ti = htmlspecialchars( $this->mTitle->getText() ); |
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php |
— | — | @@ -41,24 +41,28 @@ |
42 | 42 | */ |
43 | 43 | protected function doQuery() { |
44 | 44 | $store = smwfGetStore(); |
45 | | - $options = new SMWRequestOptions(); |
46 | | - $options->limit = $this->limit + 1; |
47 | | - $options->sort = true; |
48 | | - $reverse = false; |
49 | | - if ($this->from != '') { |
50 | | - $options->boundary = $this->from; |
51 | | - $options->ascending = true; |
52 | | - $options->include_boundary = true; |
53 | | - } elseif ($this->until != '') { |
54 | | - $options->boundary = $this->until; |
55 | | - $options->ascending = false; |
56 | | - $options->include_boundary = false; |
57 | | - $reverse = true; |
| 45 | + if ($this->limit > 0) { // for limit==0 there is no paging, and no query |
| 46 | + $options = new SMWRequestOptions(); |
| 47 | + $options->limit = $this->limit + 1; |
| 48 | + $options->sort = true; |
| 49 | + $reverse = false; |
| 50 | + if ($this->from != '') { |
| 51 | + $options->boundary = $this->from; |
| 52 | + $options->ascending = true; |
| 53 | + $options->include_boundary = true; |
| 54 | + } elseif ($this->until != '') { |
| 55 | + $options->boundary = $this->until; |
| 56 | + $options->ascending = false; |
| 57 | + $options->include_boundary = false; |
| 58 | + $reverse = true; |
| 59 | + } |
| 60 | + $this->articles = $store->getAllPropertySubjects($this->mProperty, $options); |
| 61 | + if ($reverse) { |
| 62 | + $this->articles = array_reverse($this->articles); |
| 63 | + } |
| 64 | + } else { |
| 65 | + $this->articles = array(); |
58 | 66 | } |
59 | | - $this->articles = $store->getAllPropertySubjects($this->mProperty, $options); |
60 | | - if ($reverse) { |
61 | | - $this->articles = array_reverse($this->articles); |
62 | | - } |
63 | 67 | |
64 | 68 | // retrieve all subproperties of this property |
65 | 69 | $s_options = new SMWRequestOptions(); |
— | — | @@ -76,29 +80,27 @@ |
77 | 81 | wfLoadExtensionMessages('SemanticMediaWiki'); |
78 | 82 | $r = ''; |
79 | 83 | $ti = htmlspecialchars( $this->mTitle->getText() ); |
80 | | - $nav = $this->getNavigationLinks(); |
81 | 84 | if (count($this->subproperties) > 0) { |
82 | | - $r .= "<div id=\"mw-subcategories\">\n<h2>" . wfMsg('smw_subproperty_header',$ti) . "</h2>\n"; |
83 | | - $r .= '<p>'; |
| 85 | + $r .= "<div id=\"mw-subcategories\">\n<h2>" . wfMsg('smw_subproperty_header',$ti) . "</h2>\n<p>"; |
84 | 86 | if (!$this->mProperty->isUserDefined()) { |
85 | 87 | $r .= wfMsg('smw_isspecprop') . ' '; |
86 | 88 | } |
87 | | - $r .= wfMsgExt('smw_subpropertyarticlecount', array( 'parsemag' ), min($this->limit, count($this->subproperties))) . "</p>\n"; |
88 | | - if (count($this->subproperties) < 6) { |
89 | | - $r .= $this->shortList(0,count($this->subproperties), $this->subproperties); |
90 | | - } else { |
91 | | - $r .= $this->columnList(0,count($this->subproperties), $this->subproperties); |
92 | | - } |
| 89 | + $r .= wfMsgExt('smw_subpropertyarticlecount', array( 'parsemag' ), count($this->subproperties)) . "</p>\n"; |
| 90 | + $r .= (count($this->subproperties) < 6)? |
| 91 | + $this->shortList(0,count($this->subproperties), $this->subproperties): |
| 92 | + $this->columnList(0,count($this->subproperties), $this->subproperties); |
93 | 93 | $r .= "\n</div>"; |
94 | 94 | } |
95 | | - $r .= '<a name="SMWResults"></a>' . $nav . "<div id=\"mw-pages\">\n"; |
96 | | - $r .= '<h2>' . wfMsg('smw_attribute_header',$ti) . "</h2>\n"; |
97 | | - $r .= '<p>'; |
98 | | - if (!$this->mProperty->isUserDefined()) { |
99 | | - $r .= wfMsg('smw_isspecprop') . ' '; |
| 95 | + if (count($this->articles) > 0) { |
| 96 | + $nav = $this->getNavigationLinks(); |
| 97 | + $r .= '<a name="SMWResults"></a>' . $nav . "<div id=\"mw-pages\">\n" . |
| 98 | + '<h2>' . wfMsg('smw_attribute_header',$ti) . "</h2>\n<p>"; |
| 99 | + if (!$this->mProperty->isUserDefined()) { |
| 100 | + $r .= wfMsg('smw_isspecprop') . ' '; |
| 101 | + } |
| 102 | + $r .= wfMsgExt('smw_attributearticlecount', array( 'parsemag' ), min($this->limit, count($this->articles))) . "</p>\n" . |
| 103 | + $this->subjectObjectList() . "\n</div>" . $nav; |
100 | 104 | } |
101 | | - $r .= wfMsgExt('smw_attributearticlecount', array( 'parsemag' ), min($this->limit, count($this->articles))) . "</p>\n"; |
102 | | - $r .= $this->subjectObjectList() . "\n</div>" . $nav; |
103 | 105 | wfProfileOut( __METHOD__ . ' (SMW)'); |
104 | 106 | return $r; |
105 | 107 | } |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php |
— | — | @@ -120,7 +120,8 @@ |
121 | 121 | |
122 | 122 | ### |
123 | 123 | # Number results shown in the listings on pages in the namespaces Property, |
124 | | -# Type, and Concept. |
| 124 | +# Type, and Concept. If a value of 0 is given, the respective listings are |
| 125 | +# hidden completely. |
125 | 126 | ## |
126 | 127 | $smwgTypePagingLimit = 200; // same number as for categories |
127 | 128 | $smwgConceptPagingLimit = 200; // same number as for categories |
— | — | @@ -130,7 +131,7 @@ |
131 | 132 | ### |
132 | 133 | # How many values should at most be displayed for a page on the Property page? |
133 | 134 | ## |
134 | | -$smwgMaxPropertyValues = 3; // if large values are desired, consider reducing $smwgPropertyPagingLimit for unchanged performance |
| 135 | +$smwgMaxPropertyValues = 3; // if large values are desired, consider reducing $smwgPropertyPagingLimit for better performance |
135 | 136 | ## |
136 | 137 | |
137 | 138 | ### |
— | — | @@ -243,7 +244,7 @@ |
244 | 245 | # Array of available aliases for result formats. Can be redefined in |
245 | 246 | # the settings to disallow certain aliases or to register extension aliases. |
246 | 247 | # To disable an alias, do "unset($smwgResultAliases['alias']);" Disabled |
247 | | -# aliases will be treated like if the alias parameter had been omitted. |
| 248 | +# aliases will be treated like if the alias parameter had been omitted. |
248 | 249 | ## |
249 | 250 | $smwgResultAliases = array(); |
250 | 251 | ## |