Index: trunk/extensions/SemanticResultFormats/Calendar/SRF_Calendar.php |
— | — | @@ -111,8 +111,11 @@ |
112 | 112 | } |
113 | 113 | |
114 | 114 | $result = SRFCalendar::displayCalendar($events); |
115 | | - |
116 | | - return array($result, 'noparse' => 'true', 'isHTML' => 'true'); |
| 115 | + global $wgParser; |
| 116 | + if (is_null($wgParser->getTitle())) |
| 117 | + return $result; |
| 118 | + else |
| 119 | + return array($result, 'noparse' => 'true', 'isHTML' => 'true'); |
117 | 120 | } |
118 | 121 | |
119 | 122 | |
— | — | @@ -154,8 +157,24 @@ |
155 | 158 | )); |
156 | 159 | wfLoadExtensionMessages('SemanticResultFormats'); |
157 | 160 | |
| 161 | + // set variables differently depending on whether this is |
| 162 | + // being called from an #ask call or the Special:Ask page |
158 | 163 | $page_title = $wgParser->getTitle(); |
159 | | - $skin = $wgParser->getOptions()->getSkin(); |
| 164 | + $in_ask_page = is_null($page_title); |
| 165 | + if ($in_ask_page) { |
| 166 | + global $wgTitle; |
| 167 | + $page_title = $wgTitle; |
| 168 | + global $wgUser; |
| 169 | + $skin = $wgUser->getSkin(); |
| 170 | + $additional_query_string = ''; |
| 171 | + foreach ($wgRequest->getValues() as $key => $value) { |
| 172 | + if ($key != 'month' && $key != 'year') |
| 173 | + $additional_query_string .= "&$key=$value"; |
| 174 | + } |
| 175 | + } else { |
| 176 | + $skin = $wgParser->getOptions()->getSkin(); |
| 177 | + $additional_query_string = ''; |
| 178 | + } |
160 | 179 | // get all the date-based values we need - the current month |
161 | 180 | // and year (i.e., the one the user is looking at - not |
162 | 181 | // necessarily the "current" ones), the previous and next months |
— | — | @@ -195,8 +214,8 @@ |
196 | 215 | if ($cur_year == "0") {$cur_year = "1"; } |
197 | 216 | if ($next_year == "0") {$next_year = "1"; } |
198 | 217 | if ($prev_year == "0") {$prev_year = "-1"; } |
199 | | - $prev_month_url = $page_title->getLocalURL("month=$prev_month_num&year=$prev_year"); |
200 | | - $next_month_url = $page_title->getLocalURL("month=$next_month_num&year=$next_year"); |
| 218 | + $prev_month_url = $page_title->getLocalURL("month=$prev_month_num&year=$prev_year" . $additional_query_string); |
| 219 | + $next_month_url = $page_title->getLocalURL("month=$next_month_num&year=$next_year" . $additional_query_string); |
201 | 220 | $today_url = $page_title->getLocalURL(); |
202 | 221 | $today_text = wfMsg('srfc_today'); |
203 | 222 | $prev_month_text = wfMsg('srfc_previousmonth'); |