Index: branches/wmf-deployment/extensions/LiquidThreads/i18n/Lqt.i18n.php |
— | — | @@ -261,6 +261,10 @@ |
262 | 262 | |
263 | 263 | 'lqt-newmessages-n' => 'New messages ($1)', |
264 | 264 | 'lqt_newmessages' => 'New messages', |
| 265 | + |
| 266 | + // Automatic summaries |
| 267 | + 'lqt-newpost-summary' => 'New thread: $1', |
| 268 | + 'lqt-reply-summary' => 'Reply to [[$2|$1]]', |
265 | 269 | ); |
266 | 270 | |
267 | 271 | /** Message documentation (Message documentation) |
— | — | @@ -842,6 +846,7 @@ |
843 | 847 | * @author EugeneZelenko |
844 | 848 | * @author Jim-by |
845 | 849 | * @author Mormegil |
| 850 | + * @author Raymond |
846 | 851 | * @author Александр Сигачёв |
847 | 852 | */ |
848 | 853 | $messages['be-tarask'] = array( |
— | — | @@ -1066,6 +1071,8 @@ |
1067 | 1072 | 'lqt-feed-reply-intro' => 'Адказ на $3 (на $1) разьмешчаны $2', |
1068 | 1073 | 'lqt-newmessages-n' => 'Новыя паведамленьні ($1)', |
1069 | 1074 | 'lqt_newmessages' => 'Новыя паведамленьні', |
| 1075 | + 'lqt-newpost-summary' => 'Новая галіна: $1', |
| 1076 | + 'lqt-reply-summary' => 'Адказаць на [[$2|$1]]', |
1070 | 1077 | ); |
1071 | 1078 | |
1072 | 1079 | /** Bulgarian (Български) |
— | — | @@ -4615,6 +4622,7 @@ |
4616 | 4623 | /** Hungarian (Magyar) |
4617 | 4624 | * @author Dani |
4618 | 4625 | * @author Glanthor Reviol |
| 4626 | + * @author Raymond |
4619 | 4627 | * @author Tgr |
4620 | 4628 | */ |
4621 | 4629 | $messages['hu'] = array( |
— | — | @@ -4661,11 +4669,11 @@ |
4662 | 4670 | 'lqt_hist_merged_to' => 'Hozzászólás áthelyezve egy másik beszélgetésből', |
4663 | 4671 | 'lqt_revision_as_of' => 'Változat időbélyege: $2 $3', |
4664 | 4672 | 'lqt_change_new_thread' => 'Ez a beszélgetésfolyam első változata', |
4665 | | - 'lqt_change_reply_created' => 'A kiemelt megjegyzés ennél a változatnál készült.', |
4666 | | - 'lqt_change_edited_root' => 'A kiemelt megjegyzés ennél a változatnál szerkesztve volt.', |
| 4673 | + 'lqt_change_reply_created' => 'A [$1 kiemelt megjegyzés] ennél a változatnál készült.', |
| 4674 | + 'lqt_change_edited_root' => 'A [$1 kiemelt megjegyzés] ennél a változatnál szerkesztve volt.', |
4667 | 4675 | 'lqt_change_edited_summary' => 'A beszélgetésfolyam összefoglalója szerkesztve volt', |
4668 | | - 'lqt_change_undeleted' => 'A kiemelt hozzászólás helyre lett állítva', |
4669 | | - 'lqt_change_moved' => 'A beszélgetésfolyam át lett helyezve egy másik vitalapra', |
| 4676 | + 'lqt_change_undeleted' => 'A [$1 kiemelt hozzászólás] helyre lett állítva', |
| 4677 | + 'lqt_change_moved' => '[$1 A beszélgetésfolyam] át lett helyezve egy másik vitalapra', |
4670 | 4678 | 'lqt_change_subject_edited' => 'A beszélgetésfolyam tárgya megváltozott', |
4671 | 4679 | 'lqt_youhavenewmessages' => '[$1 új üzeneted] érkezett.', |
4672 | 4680 | 'lqt_protectedfromreply' => 'Ez a beszélgetés $1 a válaszlehetőségtől.', |
— | — | @@ -8157,6 +8165,7 @@ |
8158 | 8166 | |
8159 | 8167 | /** Yakut (Саха тыла) |
8160 | 8168 | * @author HalanTul |
| 8169 | + * @author Raymond |
8161 | 8170 | */ |
8162 | 8171 | $messages['sah'] = array( |
8163 | 8172 | 'lqt-desc' => 'Ырытыы сирэйдэригэр салаалары эбэр', |
— | — | @@ -8204,6 +8213,7 @@ |
8205 | 8214 | 'lqt_hist_merged_from' => 'Хоруй атын салааҕа көһөрүлүннэ', |
8206 | 8215 | 'lqt_hist_merged_to' => 'Хоруй атын салааттан көһөрүлүннэ', |
8207 | 8216 | 'lqt_hist_split_from' => 'Саҥа салааҕа көһөр', |
| 8217 | + 'lqt_hist_root_blanked' => 'Комментарий тиэкиһэ сотуллубут', |
8208 | 8218 | 'lqt_revision_as_of' => 'Барыл $2 $3.', |
8209 | 8219 | 'lqt_change_new_thread' => 'Салаа бастакы барыла', |
8210 | 8220 | 'lqt_change_reply_created' => '[$1 бэлиэтэммит комментарий] бу барылга оҥоһуллубут.', |
— | — | @@ -8217,11 +8227,13 @@ |
8218 | 8228 | 'lqt_change_merged_from' => 'Бу салаа [$1 хоруйа] атын салааҕа көһөрүллүбүт', |
8219 | 8229 | 'lqt_change_merged_to' => '[$1 Бэлиэтэммит хоруй] атын салааттан көһөрүллүбүт', |
8220 | 8230 | 'lqt_change_split_from' => '[$1 Бу салаа] аннынан баар салаа туспа салаа буолбут', |
| 8231 | + 'lqt_change_root_blanked' => '[$1 комментарий] тиэкиһэ сотуллубут.', |
8221 | 8232 | 'lqt_youhavenewmessages' => 'Эйиэхэ [$1 саҥа сурук] кэлбит.', |
8222 | 8233 | 'lqt_protectedfromreply' => 'Бу салаа киниэхэ хоруйтан $1.', |
8223 | 8234 | 'lqt_protectedfromreply_link' => 'көмүскэммит', |
8224 | 8235 | 'lqt_subject' => 'Аата:', |
8225 | 8236 | 'lqt_noreason' => 'Төрүөтэ ыйыллыбатах.', |
| 8237 | + 'lqt_move_placeholder' => 'Бу салаа $1 салааны $3 $4 сирэйгэ $2 кыттааччы көһөрбүтүн туһунан кэпсиир.', |
8226 | 8238 | 'lqt_thread_deleted_for_sysops' => "Бу салаа '''сотуллубут''', дьаһабылларга эрэ костөр кыахтаах.", |
8227 | 8239 | 'lqt_thread_deleted' => 'Бу салаа сотуллубут.', |
8228 | 8240 | 'lqt_summary_notice' => 'Бу ырытыы $2 хонуктан ордук кэмҥэ уларытыллыбатах. |
— | — | @@ -8257,6 +8269,8 @@ |
8258 | 8270 | 'lqt_delete_show_checkbox' => 'Сотуллубут салаалары көрдөр', |
8259 | 8271 | 'lqt_talkpage_autocreate_summary' => 'Саҥа ырытыы сирэйэ бастакы этии оҥоһуллубутун кэннэ апатмаатынан оҥоһулунна.', |
8260 | 8272 | 'lqt_header_warning_big' => 'Маны эрэдээксийэлиигин $1.', |
| 8273 | + 'lqt_header_warning_after_big' => 'Ааттар биллэрии уонна киирии быһыытынан туттуллаллар. |
| 8274 | +Эн маны оҥоруоххун сөп $2.', |
8261 | 8275 | 'lqt_header_warning_bold' => 'ырытар сирэй аата', |
8262 | 8276 | 'lqt_header_warning_new_discussion' => 'саҥа ырытыыны саҕалааһын', |
8263 | 8277 | 'lqt_sorting_order' => 'Наардааһын бэрээдэгэ:', |
— | — | @@ -8288,6 +8302,8 @@ |
8289 | 8303 | 'lqt-new-messages' => '✒ Эйиэхэ саҥа суруктар бааллар.', |
8290 | 8304 | 'lqt-email-info-undo' => 'Билигин көрбүт салаабын төннөр.', |
8291 | 8305 | 'lqt-date-info' => 'Бу сигэ арахса сылдьар, тоҕо диэтэххэ эн туох баар салаалары барытын көрө олороҕун.', |
| 8306 | + 'lqt_rc_new_discussion' => 'Манна $2 • Саҥа ырытыы "$1" $3 суруйар:', |
| 8307 | + 'lqt_rc_new_reply' => 'Манна "$1" $2 • хоруйдаан $3 суруйар:', |
8292 | 8308 | 'lqt_rc_author_original' => '(бастакы ааптар)', |
8293 | 8309 | 'lqt_rc_author_others' => '(ааптара суох)', |
8294 | 8310 | 'lqt-newmessages-context' => 'Толору салаа', |
— | — | @@ -8317,6 +8333,7 @@ |
8318 | 8334 | Олору сотуоххун баҕарбат буоллаххына ол хоруйдары бастаан атын салааларга таһаар.', |
8319 | 8335 | 'lqt-delete-parent-deleted' => 'Үөһээ салаа сотулунна ($1)', |
8320 | 8336 | 'lqt-delete-replies-done' => 'Бу салаа хоруйдара эмиэ сотулуннулар.', |
| 8337 | + 'lqt-movethread' => 'Аатын уларыт', |
8321 | 8338 | 'right-lqt-split' => 'Салаалары араарыы', |
8322 | 8339 | 'right-lqt-merge' => 'Салаалары холбооһун', |
8323 | 8340 | 'lqt-thread-merge' => 'Атын салааҕа холбооһун', |
— | — | @@ -8325,13 +8342,16 @@ |
8326 | 8343 | 'lqt-thread-merge-source' => 'Холбонор салаалар:', |
8327 | 8344 | 'lqt-thread-merge-dest' => 'Ханна холбоноллоро:', |
8328 | 8345 | 'lqt-merge-submit' => 'Холбоо', |
| 8346 | + 'lqt-merge-success' => '$1 салаа $2 салааҕа сөпкө холбонно.', |
8329 | 8347 | 'lqt-log-name' => 'Ырытыы салааларын сурунаала', |
8330 | 8348 | 'lqt-log-header' => 'Бу сурунаалга ырытыы салааларыгар туох буолбута суруллан иһэр.', |
| 8349 | + 'lqt-log-action-move' => '[[$1]] мантан [[$2]] манна [[$3]] көспүт.', |
8331 | 8350 | 'lqt-preference-notify-talk' => 'Кэтиир салаабар саҥа этии киирдэҕинэ мин почтабар сурукта ыыт', |
8332 | 8351 | 'lqt-preference-watch-threads' => 'Оҥорбут уонна хоруйдаабыт салааларбын кэтииргэ', |
8333 | 8352 | 'prefs-lqt' => 'Салааларынан ырытыылар', |
8334 | 8353 | 'lqt-preference-display-depth' => 'Хоруйдар көрдөрүллэр дириҥнэрэ:', |
8335 | 8354 | 'lqt-preference-display-count' => 'Хоруйдар көрдөрүллэр ахсааннара', |
| 8355 | + 'lqt-preference-custom-signatures' => 'Кыттаачылар улартыллар илии баттааһыннарын көрдөр', |
8336 | 8356 | 'lqt-enotif-subject-reply' => '{{SITENAME}} ырытыы — Хоруй: $1', |
8337 | 8357 | 'lqt-enotif-subject-newthread' => '{{SITENAME}} ырытыы — Саҥа салаа: $1', |
8338 | 8358 | 'lqt-enotif-newthread' => 'Дорообо, $1. |
— | — | @@ -8353,6 +8373,8 @@ |
8354 | 8374 | 'lqt-ajax-update-link' => 'Саҥардыы', |
8355 | 8375 | 'lqt-thread-show-replies' => '$1 хоруйу көрдөр', |
8356 | 8376 | 'lqt-thread-show-more' => 'Өссө элбэҕи көрдөр', |
| 8377 | + 'lqt-thread-link-url' => 'URL:', |
| 8378 | + 'lqt-thread-link-title' => 'Биики сигэ:', |
8357 | 8379 | 'lqt-feed-title-all' => '{{SITENAME}} — Саҥа суруктар', |
8358 | 8380 | 'lqt-feed-title-all-from' => '{{SITENAME}} — Саҥа суруктар $1', |
8359 | 8381 | 'lqt-feed-title-new-threads' => '{{SITENAME}} — Саҥа салаалар', |
— | — | @@ -8361,6 +8383,7 @@ |
8362 | 8384 | 'lqt-feed-title-replies-from' => '{{SITENAME}} — Хоруйдар $1', |
8363 | 8385 | 'lqt-feed-new-thread-intro' => 'Манна $1 $2 оҥорбут саҥа салаата', |
8364 | 8386 | 'lqt-feed-reply-intro' => '$3 сурукка хоруй ($1) манна баар $2', |
| 8387 | + 'lqt-newmessages-n' => 'Саҥа этиилэр ($1)', |
8365 | 8388 | 'lqt_newmessages' => 'Саҥа этиилэр', |
8366 | 8389 | ); |
8367 | 8390 | |
Index: branches/wmf-deployment/extensions/LiquidThreads/lqt.css |
— | — | @@ -1,10 +1,11 @@ |
2 | 2 | |
3 | 3 | #wpTextbox1 { |
4 | 4 | /* Textareas in lqt use auto-sizing based on these properties */ |
5 | | - height: 5em; |
6 | | - max-height: 10em; |
7 | | - min-height: 5em; |
| 5 | + height: 7.5em; |
| 6 | + max-height: 30em; |
| 7 | + min-height: 7.5em; |
8 | 8 | } |
| 9 | + |
9 | 10 | .lqt_watchlist_messages_notice { |
10 | 11 | background-color: #eee; |
11 | 12 | border: 1px solid #ddd; |
Index: branches/wmf-deployment/extensions/LiquidThreads/pages/NewUserMessagesView.php |
— | — | @@ -65,7 +65,8 @@ |
66 | 66 | |
67 | 67 | $topid = $thread->topmostThread()->id(); |
68 | 68 | |
69 | | - if ( in_array( $thread->id(), $this->targets[$topid] ) ) |
| 69 | + if ( is_array( $this->targets[$topid] ) && |
| 70 | + in_array( $thread->id(), $this->targets[$topid] ) ) |
70 | 71 | return "$origClass lqt_post_new_message"; |
71 | 72 | |
72 | 73 | return $origClass; |
Index: branches/wmf-deployment/extensions/LiquidThreads/api/ApiThreadAction.php |
— | — | @@ -12,9 +12,9 @@ |
13 | 13 | 'markunread' => 'actionMarkUnread', |
14 | 14 | 'split' => 'actionSplit', |
15 | 15 | 'merge' => 'actionMerge', |
16 | | -// 'reply', // Not implemented |
| 16 | + 'reply' => 'actionReply', // Not implemented |
17 | 17 | 'newthread' => 'actionNewThread', |
18 | | -// 'setsubject', |
| 18 | + 'setsubject' => 'actionSetSubject', |
19 | 19 | ); |
20 | 20 | } |
21 | 21 | |
— | — | @@ -260,6 +260,7 @@ |
261 | 261 | public function actionNewThread( $threads, $params ) { |
262 | 262 | global $wgUser; |
263 | 263 | |
| 264 | + // Validate talkpage parameters |
264 | 265 | if ( empty( $params['talkpage'] ) ) { |
265 | 266 | $this->dieUsage( 'You must specify a talk-page to post the thread to', |
266 | 267 | 'missing-param' ); |
— | — | @@ -276,6 +277,8 @@ |
277 | 278 | } |
278 | 279 | $talkpage = new Article( $talkpageTitle ); |
279 | 280 | |
| 281 | + |
| 282 | + // Validate subject, generate a title |
280 | 283 | if ( empty( $params['subject'] ) ) { |
281 | 284 | $this->dieUsage( 'You must specify a thread subject', |
282 | 285 | 'missing-param' ); |
— | — | @@ -292,29 +295,119 @@ |
293 | 296 | |
294 | 297 | return; |
295 | 298 | } |
| 299 | + $article = new Article( $title ); |
296 | 300 | |
| 301 | + // Check for text |
297 | 302 | if ( empty( $params['text'] ) ) { |
298 | 303 | $this->dieUsage( 'You must include text in your post', 'no-text' ); |
299 | 304 | return; |
300 | 305 | } |
| 306 | + $text = $params['text']; |
301 | 307 | |
| 308 | + // Generate or pull summary |
302 | 309 | $summary = wfMsg( 'lqt-newpost-summary', $subject ); |
| 310 | + if ( !empty( $params['reason'] ) ) { |
| 311 | + $summary = $params['reason']; |
| 312 | + } |
303 | 313 | |
304 | | - if ( !empty( $params['summary'] ) ) { |
305 | | - $summary = $params['summary']; |
| 314 | + // Inform hooks what we're doing |
| 315 | + LqtHooks::$editTalkpage = $talkpage; |
| 316 | + LqtHooks::$editArticle = $article; |
| 317 | + LqtHooks::$editThread = null; |
| 318 | + LqtHooks::$editType = 'new'; |
| 319 | + LqtHooks::$editAppliesTo = null; |
| 320 | + |
| 321 | + $token = $params['token']; |
| 322 | + |
| 323 | + // All seems in order. Construct an API edit request |
| 324 | + $requestData = array( |
| 325 | + 'action' => 'edit', |
| 326 | + 'title' => $title->getPrefixedText(), |
| 327 | + 'text' => $text, |
| 328 | + 'summary' => $summary, |
| 329 | + 'token' => $token, |
| 330 | + 'basetimestamp' => wfTimestampNow(), |
| 331 | + 'format' => 'json', |
| 332 | + ); |
| 333 | + |
| 334 | + $editReq = new FauxRequest( $requestData, true ); |
| 335 | + $internalApi = new ApiMain( $editReq, true ); |
| 336 | + $internalApi->execute(); |
| 337 | + |
| 338 | + $editResult = $internalApi->getResultData(); |
| 339 | + |
| 340 | + if ( $editResult['edit']['result'] != 'Success' ) { |
| 341 | + $result = array( 'result' => 'EditFailure', 'details' => $editResult ); |
| 342 | + $this->getResult()->addValue( null, $this->getModuleName(), $result ); |
| 343 | + return; |
306 | 344 | } |
307 | 345 | |
| 346 | + $articleId = $editResult['edit']['pageid']; |
| 347 | + |
| 348 | + // Reload article data |
| 349 | + $article = Article::newFromId( $articleId ); |
| 350 | + |
| 351 | + $thread = LqtView::postEditUpdates( 'new', null, $article, $talkpage, |
| 352 | + $subject, $summary, null, $text ); |
| 353 | + |
| 354 | + $result = array( |
| 355 | + 'result' => 'Success', |
| 356 | + 'thread-id' => $thread->id(), |
| 357 | + 'thread-title' => $thread->title()->getPrefixedText(), |
| 358 | + ); |
| 359 | + |
| 360 | + $result = array( 'thread' => $result ); |
| 361 | + |
| 362 | + $this->getResult()->addValue( null, $this->getModuleName(), $result ); |
| 363 | + } |
| 364 | + |
| 365 | + public function actionReply( $threads, $params ) { |
| 366 | + global $wgUser; |
| 367 | + |
| 368 | + // Validate thread parameter |
| 369 | + if ( count($threads) > 1 ) { |
| 370 | + $this->dieUsage( 'You may only reply to one thread at a time', |
| 371 | + 'too-many-threads' ); |
| 372 | + return; |
| 373 | + } elseif ( count($threads) < 1 ) { |
| 374 | + $this->dieUsage( 'You must specify a thread to reply to', |
| 375 | + 'no-specified-threads' ); |
| 376 | + return; |
| 377 | + } |
| 378 | + $replyTo = array_pop( $threads ); |
| 379 | + |
| 380 | + // Validate text parameter |
| 381 | + if ( empty( $params['text'] ) ) { |
| 382 | + $this->dieUsage( 'You must include text in your post', 'no-text' ); |
| 383 | + return; |
| 384 | + } |
| 385 | + |
308 | 386 | $text = $params['text']; |
309 | 387 | |
| 388 | + // Generate/pull summary |
| 389 | + $summary = wfMsg( 'lqt-reply-summary', $replyTo->subject(), |
| 390 | + $replyTo->title()->getPrefixedText() ); |
| 391 | + |
| 392 | + if ( !empty( $params['reason'] ) ) { |
| 393 | + $summary = $params['reason']; |
| 394 | + } |
| 395 | + |
| 396 | + // Grab data from parent |
| 397 | + $talkpage = $replyTo->article(); |
| 398 | + $subject = $replyTo->subject(); |
| 399 | + |
| 400 | + // Generate a reply title. |
| 401 | + $title = Threads::newReplyTitle( $replyTo, $wgUser ); |
310 | 402 | $article = new Article( $title ); |
311 | 403 | |
312 | 404 | // Inform hooks what we're doing |
313 | 405 | LqtHooks::$editTalkpage = $talkpage; |
314 | 406 | LqtHooks::$editArticle = $article; |
315 | 407 | LqtHooks::$editThread = null; |
316 | | - LqtHooks::$editType = 'new'; |
317 | | - LqtHooks::$editAppliesTo = null; |
| 408 | + LqtHooks::$editType = 'reply'; |
| 409 | + LqtHooks::$editAppliesTo = $replyTo; |
318 | 410 | |
| 411 | + // Pull token in |
319 | 412 | $token = $params['token']; |
320 | 413 | |
321 | 414 | // All seems in order. Construct an API edit request |
— | — | @@ -345,18 +438,71 @@ |
346 | 439 | // Reload article data |
347 | 440 | $article = Article::newFromId( $articleId ); |
348 | 441 | |
349 | | - $thread = LqtView::postEditUpdates( 'new', null, $article, $talkpage, |
| 442 | + $thread = LqtView::postEditUpdates( 'reply', $replyTo, $article, $talkpage, |
350 | 443 | $subject, $summary, null, $text ); |
351 | 444 | |
352 | 445 | $result = array( |
| 446 | + 'action' => 'reply', |
353 | 447 | 'result' => 'Success', |
354 | 448 | 'thread-id' => $thread->id(), |
355 | 449 | 'thread-title' => $thread->title()->getPrefixedText(), |
| 450 | + 'parent-id' => $replyTo->id(), |
| 451 | + 'parent-title' => $replyTo->title()->getPrefixedText(), |
| 452 | + 'ancestor-id' => $replyTo->topmostThread()->id(), |
| 453 | + 'ancestor-title' => $replyTo->topmostThread()->title()->getPrefixedText(), |
356 | 454 | ); |
357 | 455 | |
| 456 | + $result = array( 'thread' => $result ); |
| 457 | + |
358 | 458 | $this->getResult()->addValue( null, $this->getModuleName(), $result ); |
359 | 459 | } |
360 | 460 | |
| 461 | + public function actionSetSubject( $threads, $params ) { |
| 462 | + // Validate thread parameter |
| 463 | + if ( count($threads) > 1 ) { |
| 464 | + $this->dieUsage( 'You may only change the subject of one thread at a time', |
| 465 | + 'too-many-threads' ); |
| 466 | + return; |
| 467 | + } elseif ( count($threads) < 1 ) { |
| 468 | + $this->dieUsage( 'You must specify a thread to change the subject of', |
| 469 | + 'no-specified-threads' ); |
| 470 | + return; |
| 471 | + } |
| 472 | + $thread = array_pop( $threads ); |
| 473 | + |
| 474 | + // Validate subject |
| 475 | + if ( empty( $params['subject'] ) ) { |
| 476 | + $this->dieUsage( 'You must specify a thread subject', |
| 477 | + 'missing-param' ); |
| 478 | + return; |
| 479 | + } |
| 480 | + |
| 481 | + $subject = $params['subject']; |
| 482 | + $title = null; |
| 483 | + $subjectOk = Thread::validateSubject( $subject, &$title, null, $talkpage ); |
| 484 | + |
| 485 | + if ( !$subjectOk ) { |
| 486 | + $this->dieUsage( 'The subject you specified is not valid', |
| 487 | + 'invalid-subject' ); |
| 488 | + |
| 489 | + return; |
| 490 | + } |
| 491 | + |
| 492 | + $thread->setSubject( $subject ); |
| 493 | + |
| 494 | + $result = array( |
| 495 | + 'action' => 'setsubject', |
| 496 | + 'result' => 'success', |
| 497 | + 'thread-id' => $thread->id(), |
| 498 | + 'thread-title' => $thread->title(), |
| 499 | + 'new-subject' => $subject, |
| 500 | + ); |
| 501 | + |
| 502 | + $result = array( 'thread' => $result ); |
| 503 | + |
| 504 | + $this->getResult()->addValue( null, $this->getModuleName(), $result ); |
| 505 | + } |
| 506 | + |
361 | 507 | public function getVersion() { |
362 | 508 | return __CLASS__ . ': $Id: $'; |
363 | 509 | } |
Index: branches/wmf-deployment/extensions/LiquidThreads/lqt.js |
— | — | @@ -27,8 +27,6 @@ |
28 | 28 | |
29 | 29 | liquidThreads.injectEditForm( query, replyDiv, e.preload ); |
30 | 30 | liquidThreads.currentReplyThread = thread_id; |
31 | | - |
32 | | - return false; |
33 | 31 | }, |
34 | 32 | |
35 | 33 | 'handleNewLink' : function(e) { |
— | — | @@ -40,8 +38,6 @@ |
41 | 39 | |
42 | 40 | liquidThreads.injectEditForm( query, container ); |
43 | 41 | liquidThreads.currentReplyThread = 0; |
44 | | - |
45 | | - return false; |
46 | 42 | }, |
47 | 43 | |
48 | 44 | 'injectEditForm' : function(query, container, preload) { |
— | — | @@ -56,16 +52,18 @@ |
57 | 53 | var finishShow = function() { |
58 | 54 | // Scroll to the textbox |
59 | 55 | var targetOffset = $j(container).find('#wpTextbox1').offset().top; |
| 56 | + var windowHeight = $j(window).height(); |
| 57 | + var editBoxHeight = $j(container).height(); |
60 | 58 | |
61 | 59 | if (!targetOffset) { |
62 | 60 | targetOffset = $j(container).offset().top; |
63 | 61 | } |
64 | 62 | |
65 | | - // Buffer at the top, roughly enough to see the heading and one line |
66 | | - targetOffset -= 100; |
67 | | - $j('html,body').animate({scrollTop: targetOffset}, 'slow'); |
| 63 | + var scrollOffset = targetOffset - windowHeight + editBoxHeight; |
| 64 | + |
| 65 | + $j('html,body').animate({scrollTop: scrollOffset}, 'slow'); |
68 | 66 | // Auto-focus and set to auto-grow as well |
69 | | - $j(container).find('#wpTextbox1').focus().autogrow(); |
| 67 | + $j(container).find('#wpTextbox1').focus();//.autogrow(); |
70 | 68 | // Focus the subject field if there is one. Overrides previous line. |
71 | 69 | $j(container).find('#lqt_subject_field').focus(); |
72 | 70 | } |
— | — | @@ -101,6 +99,9 @@ |
102 | 100 | $j.getScript( stylepath+'/common/preview.js', |
103 | 101 | function() { setupLivePreview(); } ); |
104 | 102 | } |
| 103 | + |
| 104 | + // Add AJAX save handler |
| 105 | + $j(container).find('#wpSave').click( liquidThreads.handleAJAXSave ); |
105 | 106 | }; |
106 | 107 | |
107 | 108 | mwEditButtons = []; |
— | — | @@ -314,6 +315,11 @@ |
315 | 316 | e.preventDefault(); |
316 | 317 | |
317 | 318 | var thread = $j(this).closest('.lqt_thread'); |
| 319 | + |
| 320 | + liquidThreads.doReloadThread( thread ); |
| 321 | + }, |
| 322 | + |
| 323 | + 'doReloadThread' : function( thread /* The .lqt_thread */ ) { |
318 | 324 | var post = thread.find('div.lqt-post-wrapper')[0]; |
319 | 325 | post = $j(post); |
320 | 326 | var threadId = post.data('thread-id'); |
— | — | @@ -565,6 +571,163 @@ |
566 | 572 | dialog.dialog( dialogOptions ); |
567 | 573 | |
568 | 574 | e.preventDefault(); |
| 575 | + }, |
| 576 | + |
| 577 | + 'getToken' : function( callback ) { |
| 578 | + var getTokenParams = |
| 579 | + { |
| 580 | + 'action' : 'query', |
| 581 | + 'prop' : 'info', |
| 582 | + 'intoken' : 'edit', |
| 583 | + 'titles' : 'Some Title', |
| 584 | + 'format' : 'json' |
| 585 | + }; |
| 586 | + |
| 587 | + $j.get( wgScriptPath+'/api'+wgScriptExtension, getTokenParams, |
| 588 | + function( data ) { |
| 589 | + var token = data.query.pages[-1].edittoken; |
| 590 | + |
| 591 | + callback(token); |
| 592 | + }, 'json' ); |
| 593 | + }, |
| 594 | + |
| 595 | + 'handleAJAXSave' : function( e ) { |
| 596 | + var editform = $j(this).closest('.lqt-edit-form'); |
| 597 | + var type = editform.find('input[name=lqt_method]').val(); |
| 598 | + |
| 599 | + var text = editform.find('#wpTextbox1').val(); |
| 600 | + var summary = editform.find('#wpSummary').val(); |
| 601 | + var subject = editform.find( '#lqt_subject_field' ).val(); |
| 602 | + var replyThread = editform.find('input[name=lqt_operand]').val(); |
| 603 | + |
| 604 | + var spinner = $j('<div class="mw-ajax-loader"/>'); |
| 605 | + editform.prepend(spinner); |
| 606 | + |
| 607 | + var replyCallback = function( data ) { |
| 608 | + // Grab topmost thread, reload it. |
| 609 | + var topmostThread = editform.closest('.lqt-thread-topmost'); |
| 610 | + liquidThreads.doReloadThread( topmostThread ); |
| 611 | + } |
| 612 | + |
| 613 | + var newCallback = function( data ) { |
| 614 | + // Grab the thread ID |
| 615 | + var newThreadID = data.threadaction.thread['thread-id']; |
| 616 | + |
| 617 | + var renderParams = |
| 618 | + { |
| 619 | + 'action' : 'query', |
| 620 | + 'list' : 'threads', |
| 621 | + 'thid' : newThreadID, |
| 622 | + 'thrender' : '1', |
| 623 | + 'format' : 'json' |
| 624 | + }; |
| 625 | + |
| 626 | + $j.post( wgScriptPath+'/api'+wgScriptExtension, renderParams, |
| 627 | + function(data) { |
| 628 | + var html = data.query.threads[0].content; |
| 629 | + var newThread = $j(html); |
| 630 | + |
| 631 | + $j('.lqt_toc').after(newThread); |
| 632 | + |
| 633 | + $j(newThread).find( '.lqt-post-wrapper').each( |
| 634 | + function() { |
| 635 | + // Set up thread. |
| 636 | + liquidThreads.setupThread( $j(this) ); |
| 637 | + } |
| 638 | + ); |
| 639 | + }, 'json' ); |
| 640 | + } |
| 641 | + |
| 642 | + var doneCallback = function(data) { |
| 643 | + spinner.remove(); |
| 644 | + |
| 645 | + try { |
| 646 | + var result = data.threadaction.thread.result; |
| 647 | + } catch ( err ) { |
| 648 | + result = 'error'; |
| 649 | + } |
| 650 | + |
| 651 | + if ( result != 'Success' ) { |
| 652 | + // Create a hidden field to mimic the save button, and |
| 653 | + // submit it normally, so they'll get a real error message. |
| 654 | + |
| 655 | + var saveHidden = $j('<input/>'); |
| 656 | + saveHidden.attr( 'type', 'hidden' ); |
| 657 | + saveHidden.attr( 'name', 'wpSave' ); |
| 658 | + saveHidden.attr( 'value', 'Save' ); |
| 659 | + |
| 660 | + var form = editform.find('#editform'); |
| 661 | + form.append(saveHidden); |
| 662 | + form.submit(); |
| 663 | + return; |
| 664 | + } |
| 665 | + |
| 666 | + if ( type == 'reply' ) { |
| 667 | + replyCallback( data ); |
| 668 | + } |
| 669 | + |
| 670 | + if ( type == 'talkpage_new_thread' ) { |
| 671 | + newCallback( data ); |
| 672 | + } |
| 673 | + }; |
| 674 | + |
| 675 | + if ( type == 'reply' ) { |
| 676 | + liquidThreads.doReply( replyThread, text, summary, doneCallback); |
| 677 | + |
| 678 | + e.preventDefault(); |
| 679 | + } else if ( type == 'talkpage_new_thread' ) { |
| 680 | + liquidThreads.doNewThread( wgPageName, subject, text, summary, |
| 681 | + doneCallback ); |
| 682 | + |
| 683 | + e.preventDefault(); |
| 684 | + } |
| 685 | + }, |
| 686 | + |
| 687 | + 'doNewThread' : function( talkpage, subject, text, summary, callback ) { |
| 688 | + liquidThreads.getToken( |
| 689 | + function(token) { |
| 690 | + var newTopicParams = |
| 691 | + { |
| 692 | + 'action' : 'threadaction', |
| 693 | + 'threadaction' : 'newthread', |
| 694 | + 'talkpage' : talkpage, |
| 695 | + 'subject' : subject, |
| 696 | + 'text' : text, |
| 697 | + 'token' : token, |
| 698 | + 'format' : 'json', |
| 699 | + 'reason' : summary |
| 700 | + }; |
| 701 | + |
| 702 | + $j.post( wgScriptPath+'/api'+wgScriptExtension, newTopicParams, |
| 703 | + function(data) { |
| 704 | + if (callback) { |
| 705 | + callback(data); |
| 706 | + } |
| 707 | + }, 'json' ); |
| 708 | + } ); |
| 709 | + }, |
| 710 | + |
| 711 | + 'doReply' : function( thread, text, summary, callback ) { |
| 712 | + liquidThreads.getToken( |
| 713 | + function(token) { |
| 714 | + var replyParams = |
| 715 | + { |
| 716 | + 'action' : 'threadaction', |
| 717 | + 'threadaction' : 'reply', |
| 718 | + 'thread' : thread, |
| 719 | + 'text' : text, |
| 720 | + 'token' : token, |
| 721 | + 'format' : 'json', |
| 722 | + 'reason' : summary |
| 723 | + }; |
| 724 | + |
| 725 | + $j.post( wgScriptPath+'/api'+wgScriptExtension, replyParams, |
| 726 | + function(data) { |
| 727 | + if (callback) { |
| 728 | + callback(data); |
| 729 | + } |
| 730 | + }, 'json' ); |
| 731 | + } ); |
569 | 732 | } |
570 | 733 | } |
571 | 734 | |
— | — | @@ -617,6 +780,6 @@ |
618 | 781 | setInterval( liquidThreads.checkForUpdates, 60000 ); |
619 | 782 | |
620 | 783 | // Autogrowing textarea - this only affects the new-topic page |
621 | | - $j('#wpTextbox1').autogrow(); |
| 784 | +// $j('#wpTextbox1')//.autogrow(); |
622 | 785 | } ); |
623 | 786 | |
Property changes on: branches/wmf-deployment/extensions/LiquidThreads |
___________________________________________________________________ |
Name: svn:mergeinfo |
624 | 787 | - /branches/REL1_15/phase3/extensions/LiquidThreads:51646 |
/trunk/extensions/LiquidThreads:56151-57891 |
/trunk/phase3/extensions/LiquidThreads:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447 |
625 | 788 | + /branches/REL1_15/phase3/extensions/LiquidThreads:51646 |
/trunk/extensions/LiquidThreads:56151-57920 |
/trunk/phase3/extensions/LiquidThreads:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447 |