Index: trunk/extensions/Tasks/Tasks.body.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | return $key; |
51 | 51 | } |
52 | 52 | } |
53 | | - |
| 53 | + |
54 | 54 | /** |
55 | 55 | * Returns the text key for a given task type constant |
56 | 56 | * @param $num numeric key |
— | — | @@ -62,14 +62,12 @@ |
63 | 63 | } |
64 | 64 | return $this->task_types[$num]; |
65 | 65 | } |
66 | | - |
| 66 | + |
67 | 67 | /** |
68 | 68 | * Updates task_types and creation_tasks from wfMsg |
69 | 69 | * @fixme Provide localized display names for user's UI language |
70 | 70 | */ |
71 | 71 | function update_types() { # Checked for HTML and MySQL insertion attacks |
72 | | - wfLoadExtensionMessages('Tasks'); |
73 | | - |
74 | 72 | # task type numeric key, text key, localized text |
75 | 73 | $this->task_types = array(); |
76 | 74 | $s = wfMsgForContent( 'tasks_task_types' ); |
— | — | @@ -179,7 +177,7 @@ |
180 | 178 | $tg[$t->task_type] = $t->task_status; |
181 | 179 | } |
182 | 180 | } |
183 | | - |
| 181 | + |
184 | 182 | foreach( array_keys( $this->task_types ) as $a ) { |
185 | 183 | if( $exists == $this->is_creation_task( $a ) ) { |
186 | 184 | # Creation task and existence exclude each other |
— | — | @@ -222,7 +220,7 @@ |
223 | 221 | } |
224 | 222 | return $out; |
225 | 223 | } |
226 | | - |
| 224 | + |
227 | 225 | /** |
228 | 226 | * Adds a new task |
229 | 227 | */ |
— | — | @@ -249,7 +247,7 @@ |
250 | 248 | 'task_timestamp' => $dbw->timestamp() |
251 | 249 | ) ); |
252 | 250 | } |
253 | | - |
| 251 | + |
254 | 252 | /** |
255 | 253 | * For a list of tasks, get a single table row |
256 | 254 | * This function is heavy on output! |
— | — | @@ -257,7 +255,7 @@ |
258 | 256 | function get_task_table_row( &$task, &$title, $show_page = false, $returnto = '' ) { # Checked for HTML and MySQL insertion attacks |
259 | 257 | global $wgContLang, $wgUser, $wgTasksNamespace, $wgExtraNamespaces; |
260 | 258 | $out = ''; |
261 | | - $sk =& $wgUser->getSkin(); |
| 259 | + $sk = $wgUser->getSkin(); |
262 | 260 | $ct = $wgContLang->timeanddate( $task->task_timestamp ); # Time object from string of digits |
263 | 261 | $cu = Title::makeTitleSafe( NS_USER, $task->task_user_text ); # Safe user name |
264 | 262 | $comment = htmlspecialchars( $task->task_comment ); # Safe user comment, no HTML allowed |
— | — | @@ -355,7 +353,7 @@ |
356 | 354 | if( $wgUser->isAllowed( 'delete' ) ) { |
357 | 355 | $txt[] = $sk->makeLinkObj( $title, wfMsgHTML( 'tasks_delete' ), "action=tasks&mode=delete&taskid={$tid}{$returnto}" ); |
358 | 356 | } |
359 | | - |
| 357 | + |
360 | 358 | if( count( $txt ) > 0 ) { |
361 | 359 | $out .= '<br />' . implode( ' - ', $txt ); |
362 | 360 | } |
— | — | @@ -364,7 +362,7 @@ |
365 | 363 | $tdp = $this->get_task_discussion_page( $task ); |
366 | 364 | $out .= '<br />' . $sk->makeLinkObj( $tdp, wfMsgHTML('tasks_discussion_page_link') ); |
367 | 365 | $out .= '</td></tr>' ; |
368 | | - |
| 366 | + |
369 | 367 | # Transclude comments page, if wanted |
370 | 368 | if( $wgUser->getOption( 'show_task_comments' ) ) { |
371 | 369 | if( $this->pagemode == 'search' || $this->pagemode == 'tasks_of_page' ) { |
— | — | @@ -375,7 +373,7 @@ |
376 | 374 | } |
377 | 375 | |
378 | 376 | /** |
379 | | - * Returns the |
| 377 | + * Returns the |
380 | 378 | * @param Title $title of task page to load |
381 | 379 | * @param int $col_compensator Number of table columns to span |
382 | 380 | * @return string HTML table row, or empty string |
— | — | @@ -417,12 +415,12 @@ |
418 | 416 | } |
419 | 417 | |
420 | 418 | $out = "<h2>" . wfMsgHTML( 'tasks_existing_header' ) . "</h2>\n" . |
421 | | - "<table border='1' cellspacing='1' cellpadding='2'>" . |
| 419 | + "<table border='1' cellspacing='1' cellpadding='2'>" . |
422 | 420 | "<tr>" . self::getTableHeader() . "</tr>" . |
423 | 421 | $out . "</table>"; |
424 | 422 | return $out; |
425 | 423 | } |
426 | | - |
| 424 | + |
427 | 425 | /** |
428 | 426 | * Checks if there's a "mode" set in the URL of the current page |
429 | 427 | * (performs changes on tasks, like assigning or closing them) |
— | — | @@ -532,7 +530,7 @@ |
533 | 531 | |
534 | 532 | return $out; |
535 | 533 | } |
536 | | - |
| 534 | + |
537 | 535 | /** |
538 | 536 | * Returns the number for the status |
539 | 537 | * @param string $status key |
— | — | @@ -547,7 +545,7 @@ |
548 | 546 | # Invalid status |
549 | 547 | return 0; |
550 | 548 | } |
551 | | - |
| 549 | + |
552 | 550 | /** |
553 | 551 | * Changes the status of a task, performs some associated cleanup, and logs the action |
554 | 552 | */ |
— | — | @@ -589,8 +587,8 @@ |
590 | 588 | $log = new LogPage( 'tasks' ); |
591 | 589 | $log->addEntry( 'tasks', $title, $act ); |
592 | 590 | } |
593 | | - |
594 | | - |
| 591 | + |
| 592 | + |
595 | 593 | /** |
596 | 594 | * Returns the list of active tasks for this page, for display in the sidebar |
597 | 595 | */ |
— | — | @@ -692,9 +690,9 @@ |
693 | 691 | $dbw->update( 'tasks', |
694 | 692 | array( 'task_page_title' => $new_title->getPrefixedDBkey() ), # SET |
695 | 693 | array( 'task_page_title' => $old_title->getPrefixedDBkey() ), # WHERE |
696 | | - __METHOD__ ); |
| 694 | + __METHOD__ ); |
697 | 695 | } |
698 | | - |
| 696 | + |
699 | 697 | /** |
700 | 698 | * THIS IS THE MAIN FUNCTION FOR THE TAB-BASED INTERFACE |
701 | 699 | */ |
— | — | @@ -747,7 +745,7 @@ |
748 | 746 | } |
749 | 747 | return false; |
750 | 748 | } |
751 | | - |
| 749 | + |
752 | 750 | /** |
753 | 751 | * Confirm that the given redirect page is local to this site |
754 | 752 | * FIXME: this can still pass you anywhere on the domain, |
— | — | @@ -806,7 +804,7 @@ |
807 | 805 | . '</form>'; |
808 | 806 | return $out; |
809 | 807 | } |
810 | | - |
| 808 | + |
811 | 809 | /** |
812 | 810 | * Returns the exisiting tasks for a single page |
813 | 811 | */ |
— | — | @@ -857,7 +855,7 @@ |
858 | 856 | krsort( $ret ); |
859 | 857 | return $ret; |
860 | 858 | } |
861 | | - |
| 859 | + |
862 | 860 | /** |
863 | 861 | * Special page main function |
864 | 862 | */ |
— | — | @@ -868,7 +866,7 @@ |
869 | 867 | $mode = trim( $wgRequest->getVal( 'mode' ) ); |
870 | 868 | $skin = $wgUser->getSkin(); |
871 | 869 | $dbr = wfGetDB( DB_SLAVE ); |
872 | | - |
| 870 | + |
873 | 871 | # Assignments |
874 | 872 | if( $wgUser->isLoggedIn() ) { |
875 | 873 | if( $mode == 'myassignments' ) { |
— | — | @@ -928,7 +926,7 @@ |
929 | 927 | $status_type = $_POST['status_type']; |
930 | 928 | } |
931 | 929 | $ascending = $wgRequest->getCheck( 'ascending' ); |
932 | | - |
| 930 | + |
933 | 931 | $get_task_type = $wgRequest->getInt( 'task_type' , 0 ) ; |
934 | 932 | if ( count ( $task_type ) == 0 && $get_task_type > 0 ) { |
935 | 933 | $task_type = array() ; |
— | — | @@ -957,7 +955,7 @@ |
958 | 956 | # No choice => search all |
959 | 957 | $search_status = array_keys( $this->status_types ); |
960 | 958 | } |
961 | | - |
| 959 | + |
962 | 960 | $limit = intval( wfMsg( 'tasks_search_limit' ) ); |
963 | 961 | $offset = $wgRequest->getInt( 'offset', 0 ); |
964 | 962 | if( $wgRequest->getCheck( 'next' ) ) { |
— | — | @@ -1058,7 +1056,7 @@ |
1059 | 1057 | $this->setHeaders(); |
1060 | 1058 | $wgOut->addHTML( $out ); |
1061 | 1059 | } |
1062 | | - |
| 1060 | + |
1063 | 1061 | /** |
1064 | 1062 | * Format an HTML checkbox |
1065 | 1063 | * @param string $name |
Index: trunk/extensions/Tasks/Tasks.php |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | $wgHooks['ArticleDeleteComplete'][] = 'TasksHooks::onArticleDeleteComplete'; |
72 | 72 | $wgHooks['ArticleInsertComplete'][] = 'TasksHooks::onArticleInsertComplete'; |
73 | 73 | $wgHooks['SkinTemplatePreventOtherActiveTabs'][] = 'TasksHooks::onSkinTemplatePreventOtherActiveTabs'; |
74 | | -$wgHooks['SkinTemplateTabs'][] = 'TasksHooks::onSkinTemplateTabs'; |
| 74 | +$wgHooks['SkinTemplateNavigation'][] = 'TasksHooks::onSkinTemplateNavigation'; |
75 | 75 | $wgHooks['UnknownAction'][] = 'TasksHooks::onUnknownAction'; |
76 | 76 | $wgHooks['ParserTestTables'][] = 'TasksHooks::onParserTestTables'; |
77 | 77 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'TasksHooks::onLoadExtensionSchemaUpdates'; |
Index: trunk/extensions/Tasks/Tasks.hooks.php |
— | — | @@ -24,9 +24,9 @@ |
25 | 25 | self::headerSign( $title ); |
26 | 26 | return true; |
27 | 27 | } |
28 | | - |
| 28 | + |
29 | 29 | $subtitle = ''; |
30 | | - |
| 30 | + |
31 | 31 | if( ctype_digit( $title->getText() ) ) { |
32 | 32 | // Page title format 'Task:123', suggested by Rowan Collins |
33 | 33 | $taskid = intval( $title->getText() ); |
— | — | @@ -35,7 +35,6 @@ |
36 | 36 | return true; |
37 | 37 | } |
38 | 38 | |
39 | | - wfLoadExtensionMessages('Tasks'); |
40 | 39 | $st = new SpecialTasks(); |
41 | 40 | $task = ''; |
42 | 41 | $page_title = $st->get_title_from_task( $taskid, $task ); |
— | — | @@ -49,11 +48,11 @@ |
50 | 49 | $link1 = $sk->makeLinkObj( $page_title ); |
51 | 50 | $link2 = $sk->makeLinkObj( $page_title, wfMsgHTML( 'tasks_here' ), 'action=tasks' ); |
52 | 51 | $subtitle .= '<div id="task_header">' . wfMsgForContent( 'tasks_discussion_page_for', $link1, $link2 ) . "</div>\n" ; |
53 | | - $subtitle .= '<table border="1" cellspacing="1" cellpadding="2" id="task_header_table">' . |
| 52 | + $subtitle .= '<table border="1" cellspacing="1" cellpadding="2" id="task_header_table">' . |
54 | 53 | '<tr>' . SpecialTasks::getTableHeader( false ) . "</tr>\n"; |
55 | 54 | $subtitle .= $st->get_task_table_row( $task, $page_title, false, $returnto ); |
56 | 55 | $subtitle .= "</table>\n"; |
57 | | - |
| 56 | + |
58 | 57 | $subtitle = $wgOut->getSubtitle() . '<br />' . $subtitle; |
59 | 58 | $wgOut->setSubtitle( $subtitle ); |
60 | 59 | return true; |
— | — | @@ -74,14 +73,13 @@ |
75 | 74 | return true; |
76 | 75 | } |
77 | 76 | |
78 | | - wfLoadExtensionMessages('Tasks'); |
79 | 77 | $st = new SpecialTasks(); |
80 | 78 | $tasks = $st->get_open_task_list( $title, true ); |
81 | 79 | if( count( $tasks ) == 0 ) { |
82 | | - # No tasks |
| 80 | + # No tasks |
83 | 81 | return true; |
84 | 82 | } |
85 | | - |
| 83 | + |
86 | 84 | $out = ''; |
87 | 85 | $max = 0; |
88 | 86 | foreach( $tasks as $task ) { |
— | — | @@ -105,10 +103,10 @@ |
106 | 104 | # Nothing for you to see here, please move along |
107 | 105 | return; |
108 | 106 | } |
109 | | - |
| 107 | + |
110 | 108 | // Wiki-safe output |
111 | 109 | $out = $wgOut->parse( '<div id="task_sign">' . $max_msg . '</div>' ); |
112 | | - |
| 110 | + |
113 | 111 | $subtitle = $wgOut->getSubtitle() . '<br />' . $out; |
114 | 112 | $wgOut->setSubtitle( $subtitle ); |
115 | 113 | } |
— | — | @@ -126,12 +124,11 @@ |
127 | 125 | # No special pages please |
128 | 126 | return true; |
129 | 127 | } |
130 | | - |
131 | | - wfLoadExtensionMessages('Tasks'); |
| 128 | + |
132 | 129 | $st = new SpecialTasks; |
133 | 130 | $tasks = $st->get_open_task_list( $wgTitle, true ); |
134 | 131 | if( count( $tasks ) == 0 ) { |
135 | | - # No tasks |
| 132 | + # No tasks |
136 | 133 | return true; |
137 | 134 | } |
138 | 135 | |
— | — | @@ -160,7 +157,7 @@ |
161 | 158 | } |
162 | 159 | ?></li> |
163 | 160 | <?php |
164 | | - |
| 161 | + |
165 | 162 | } |
166 | 163 | return true; |
167 | 164 | } |
— | — | @@ -174,8 +171,6 @@ |
175 | 172 | return false; |
176 | 173 | } |
177 | 174 | |
178 | | - wfLoadExtensionMessages('Tasks'); |
179 | | - |
180 | 175 | $st = new SpecialTasks; |
181 | 176 | $st->rename_tasks_page( $old_title, $new_title ); |
182 | 177 | return false; |
— | — | @@ -187,7 +182,6 @@ |
188 | 183 | */ |
189 | 184 | public static function onArticleDeleteComplete( &$article, &$user, $reason ) { # Checked for HTML and MySQL insertion attacks |
190 | 185 | # return false ; # Uncomment this line to prevent deletion of tasks upon deletion of article |
191 | | - wfLoadExtensionMessages('Tasks'); |
192 | 186 | $t = $article->getTitle(); |
193 | 187 | if( $t->isTalkPage() ) { |
194 | 188 | # No tasks for talk pages, no need to bother the database... |
— | — | @@ -214,16 +208,15 @@ |
215 | 209 | */ |
216 | 210 | public static function onArticleInsertComplete( &$article, &$user, $text, $summary, $isminor, $watchthis, $something ) { # Checked for HTML and MySQL insertion attacks |
217 | 211 | global $wgUser; |
218 | | - wfLoadExtensionMessages('Tasks'); |
219 | 212 | $t = $article->getTitle(); |
220 | 213 | if( $t->isTalkPage() ) { |
221 | 214 | # No tasks for talk pages, no need to bother the database... |
222 | 215 | return false; |
223 | 216 | } |
224 | | - |
| 217 | + |
225 | 218 | $st = new SpecialTasks; |
226 | 219 | $tasks = $st->get_tasks_for_page( $t, true ); |
227 | | - |
| 220 | + |
228 | 221 | # Mark creation tasks as closed |
229 | 222 | foreach( $tasks as $task ) { |
230 | 223 | if( !$st->is_creation_task( $task->task_type ) ) { |
— | — | @@ -236,13 +229,13 @@ |
237 | 230 | } |
238 | 231 | $st->change_task_status( $task->task_id, MW_TASK_CLOSED ); |
239 | 232 | $st->set_new_article_id( $t ); |
240 | | - |
| 233 | + |
241 | 234 | $id = $t->getArticleId(); |
242 | 235 | # Nothing more to do |
243 | 236 | break; |
244 | 237 | } |
245 | | - |
246 | | - # OPTIONALLY create a new task |
| 238 | + |
| 239 | + # OPTIONALLY create a new task |
247 | 240 | $on_create = $st->get_task_num( wfMsgForContent( 'tasks_event_on_creation' ) ); |
248 | 241 | $on_create_anon = $st->get_task_num( wfMsgForContent( 'tasks_event_on_creation_anon' ) ); |
249 | 242 | $add_task = MW_TASK_INVALID; |
— | — | @@ -255,7 +248,7 @@ |
256 | 249 | $comment = htmlspecialchars( wfMsgForContent( 'tasks_on_creation_comment' ) ); |
257 | 250 | $st->add_new_task( $t, $comment, $add_task ) ; |
258 | 251 | } |
259 | | - |
| 252 | + |
260 | 253 | return false; |
261 | 254 | } |
262 | 255 | |
— | — | @@ -275,7 +268,7 @@ |
276 | 269 | * @param array $content_actions |
277 | 270 | * @return bool true to continue running other hooks, false to abort operation |
278 | 271 | */ |
279 | | - public static function onSkinTemplateTabs( $skin, &$content_actions ) { # Checked for HTML and MySQL insertion attacks |
| 272 | + public static function onSkinTemplateNavigation( $skin, &$content_actions ) { # Checked for HTML and MySQL insertion attacks |
280 | 273 | global $wgTitle, $wgRequest; |
281 | 274 | |
282 | 275 | if( $wgTitle->isTalkPage() ) { |
— | — | @@ -287,8 +280,7 @@ |
288 | 281 | return true; |
289 | 282 | } |
290 | 283 | |
291 | | - wfLoadExtensionMessages('Tasks'); |
292 | | - $content_actions['tasks'] = array( |
| 284 | + $content_actions['actions']['tasks'] = array( |
293 | 285 | 'class' => ($wgRequest->getVal( 'action', 'view' ) == 'tasks') ? 'selected' : false, |
294 | 286 | 'text' => wfMsgHTML('tasks_tab'), |
295 | 287 | 'href' => $wgTitle->getLocalUrl( 'action=tasks' ) |
— | — | @@ -304,9 +296,7 @@ |
305 | 297 | # Not my kind of action! |
306 | 298 | return true; |
307 | 299 | } |
308 | | - |
309 | | - wfLoadExtensionMessages('Tasks'); |
310 | | - |
| 300 | + |
311 | 301 | $t = new SpecialTasks; |
312 | 302 | return $t->page_management( $article->getTitle() ); |
313 | 303 | } |