Index: trunk/extensions/DSMW/DSMW.php |
— | — | @@ -92,7 +92,6 @@ |
93 | 93 | $wgAutoloadClasses['DSMWPropertyTypeJob'] = "$wgDSMWIP/jobs/DSMWPropertyTypeJob.php"; |
94 | 94 | |
95 | 95 | $wgAutoloadClasses['DSMWSiteId'] = "$wgDSMWIP/includes/DSMWSiteId.php"; |
96 | | -$wgAutoloadClasses['DSMWExhibits'] = "$wgDSMWIP/includes/DSMWExhibits.php"; |
97 | 96 | |
98 | 97 | $wgExtensionFunctions[] = 'dsmwgSetupFunction'; |
99 | 98 | |
— | — | @@ -163,13 +162,6 @@ |
164 | 163 | PULLFEED => true, |
165 | 164 | CHANGESET => true |
166 | 165 | ); |
167 | | - |
168 | | - if ( defined( 'SRF_VERSION' ) ) { |
169 | | - global $wgDSMWExhibits; |
170 | | - if ( !is_object( $wgDSMWExhibits ) ) { |
171 | | - $wgDSMWExhibits = new DSMWExhibits(); |
172 | | - } |
173 | | - } |
174 | 166 | } |
175 | 167 | |
176 | 168 | require_once dirname( __FILE__ ) . '/DSMW_Settings.php'; |
Index: trunk/extensions/DSMW/specials/ArticleAdminPage.php |
— | — | @@ -332,223 +332,6 @@ |
333 | 333 | $wgOut->addHTML( $output ); |
334 | 334 | return false; |
335 | 335 | } |
336 | | - |
337 | | - /** |
338 | | - * $action=admin is generated when the administration tab is clicked |
339 | | - * Calculates every that is displayed on this page (cf user manual) |
340 | | - * |
341 | | - * @global <Object> $wgOut output page instance |
342 | | - * @global <Object> $wgCachePages |
343 | | - * @global <String> $wgServerName |
344 | | - * @global <String> $wgScriptPath |
345 | | - * @param <String> $action |
346 | | - * @param <Object> $article |
347 | | - * @return <bool> |
348 | | - */ |
349 | | - function onUnknownAction( $action, $article ) { |
350 | | - global $wgOut, $wgCachePages, $wgServerName, $wgScriptPath, $wgScriptExtension; |
351 | | - |
352 | | - $urlServer = 'http://' . $wgServerName . $wgScriptPath; |
353 | | - |
354 | | - $wgCachePages = false; |
355 | | - // Verify that the action coming in is "admin" |
356 | | - if ( $action == "admin" ) { |
357 | | - wfDebugLog( 'p2p', 'Admin page' ); |
358 | | - if ( $article->mTitle->getNamespace() == 0 ) $title = $article->mTitle->getText(); |
359 | | - else $title = $article->mTitle->getNsText() . ':' . $article->mTitle->getText(); |
360 | | - wfDebugLog( 'p2p', ' -> title : ' . $title ); |
361 | | - $wgOut->setPagetitle( 'DSMW on ' . $title ); |
362 | | - |
363 | | - // part list of patch |
364 | | - $patchs = utils::orderPatchByPrevious( $title ); |
365 | | -$wgOut->addWikiText( '[[Special:ArticleAdminPage|DSMW Admin functions]] |
366 | | - |
367 | | -==Features==' ); |
368 | | - $output = '<div style="width:60%;height:40%;overflow:auto;"> |
369 | | -<table style="border-bottom: 2px solid #000;"> |
370 | | -<caption><b>List of patchs</b></caption>'; |
371 | | - |
372 | | - // color the remote patch of the current page |
373 | | - foreach ( $patchs as $patch ) { |
374 | | - wfDebugLog( 'p2p', ' -> patchId : ' . $patch ); |
375 | | - if ( !utils::isRemote( $patch ) ) { |
376 | | - wfDebugLog( 'p2p', ' -> remote patch' ); |
377 | | - $output .= '<tr BGCOLOR="#CCCCCC"><td>' . wfTimestamp( TS_RFC2822, $article->getTimestamp() ) . ' : </td>'; |
378 | | - // $output .= '<tr><td BGCOLOR="#33CC00"><a href="'.$_SERVER['PHP_SELF'].'?title='.$patch.'">'.$patch.'</a></td>'; |
379 | | - } else { |
380 | | - wfDebugLog( 'p2p', ' -> local patch' ); |
381 | | - $output .= '<tr><td>' . wfTimestamp( TS_RFC2822, $article->getTimestamp() ) . ' : </td>'; |
382 | | - // $output .= '<tr><td><a href="'.$_SERVER['PHP_SELF'].'?title='.$patch.'">'.$patch.'</a></td>'; |
383 | | - |
384 | | - } |
385 | | - |
386 | | - // count the number of delete and insert operations into the patch |
387 | | - |
388 | | - |
389 | | - $results = array(); |
390 | | - $op = utils::getSemanticQuery( '[[Patch:+]][[patchID::' . $patch . ']]', '?hasOperation' ); |
391 | | - $count = $op->getCount(); |
392 | | - for ( $i = 0; $i < $count; $i++ ) { |
393 | | - |
394 | | - $row = $op->getNext(); |
395 | | - if ( $row === false ) break; |
396 | | - $row = $row[1]; |
397 | | - |
398 | | - $col = $row->getContent();// SMWResultArray object |
399 | | - foreach ( $col as $object ) {// SMWDataValue object |
400 | | - $wikiValue = $object->getWikiValue(); |
401 | | - $results[] = $wikiValue; |
402 | | - } |
403 | | - } |
404 | | - |
405 | | - |
406 | | - $countOp = utils::countOperation( $results );// old code passed $op parameter |
407 | | - $output .= '<td>' . $countOp['insert'] . ' insert, ' . $countOp['delete'] . ' delete</td>'; |
408 | | - $output .= '<td>(<a href="' . $_SERVER['PHP_SELF'] . '?title=' . $patch . '">' . $patch . '</a>)</td></tr>'; |
409 | | - /*$titlePatch = Title::newFromText( $patch,PATCH ); |
410 | | - $article = new Article( $title );*/ |
411 | | - } |
412 | | - $output .= '</table></div>'; |
413 | | - |
414 | | - // list of push |
415 | | - |
416 | | - |
417 | | - $pushs = array(); |
418 | | - $res = utils::getSemanticQuery( '[[ChangeSet:+]][[hasPatch::' . $patchs[0] . ']][[inPushFeed::+]]', '?inPushFeed' ); |
419 | | - $count = $res->getCount(); |
420 | | - for ( $i = 0; $i < $count; $i++ ) { |
421 | | - |
422 | | - $row = $res->getNext(); |
423 | | - if ( $row === false ) break; |
424 | | - $row = $row[1]; |
425 | | - |
426 | | - $col = $row->getContent();// SMWResultArray object |
427 | | - foreach ( $col as $object ) {// SMWDataValue object |
428 | | - $wikiValue = $object->getWikiValue(); |
429 | | - $pushs[] = $wikiValue; |
430 | | - } |
431 | | - } |
432 | | - |
433 | | - |
434 | | - if ( !empty ( $pushs ) ) { |
435 | | - |
436 | | - $output .= '<br><div style="width:60%;height:40%;overflow:auto;"><table style="border-bottom: 2px solid #000;"><caption><b>List of pushs</b></caption>'; |
437 | | - foreach ( $pushs as $push ) { |
438 | | - |
439 | | - $pushName = $push; |
440 | | - |
441 | | - $output .= '<tr><td align="right" width="50%"><a href="' . $_SERVER['PHP_SELF'] . '?title=' . $pushName . '">' . $pushName . '</a> : </td>'; |
442 | | - |
443 | | - // count the number of published patchs by the current pushFeed for the current page |
444 | | - $published = utils::getPublishedPatchs( $urlServer, $pushName, $title ); |
445 | | - |
446 | | - // $publishedInPush = utils::getSemanticRequest('http://'.$wgServerName.$wgScriptPath, '', $param); |
447 | | - // count the number of unpublished patchs |
448 | | - $unpublished = array_diff( $patchs, $published ); |
449 | | - if ( !is_null( $unpublished ) && count( $unpublished ) > 0 ) { |
450 | | - $output .= '<td align="left" width="50%">' . count( $unpublished ) . ' unpublished patchs on ' . count( $patchs ) . ' </td></tr>'; |
451 | | - } else { |
452 | | - $output .= '<td align="left" width="50%"> all ' . $title . "'" . 'patchs are pushed </td></tr>'; |
453 | | - } |
454 | | - } |
455 | | - $output .= '</table></div>'; |
456 | | - |
457 | | - }// end if empty $pushs |
458 | | - |
459 | | - // part list of pull |
460 | | - |
461 | | - $pulls = array(); |
462 | | - $res = utils::getSemanticQuery( '[[ChangeSet:+]][[hasPatch::' . $patchs[0] . ']][[inPullFeed::+]]', '?inPullFeed' ); |
463 | | - $count = $res->getCount(); |
464 | | - for ( $i = 0; $i < $count; $i++ ) { |
465 | | - |
466 | | - $row = $res->getNext(); |
467 | | - if ( $row === false ) break; |
468 | | - $row = $row[1]; |
469 | | - |
470 | | - $col = $row->getContent();// SMWResultArray object |
471 | | - foreach ( $col as $object ) {// SMWDataValue object |
472 | | - $wikiValue = $object->getWikiValue(); |
473 | | - $pulls[] = $wikiValue; |
474 | | - } |
475 | | - } |
476 | | - |
477 | | - |
478 | | - if ( !empty ( $pulls ) ) { |
479 | | - |
480 | | - $output .= '<br><div style="width:60%;height:40%;overflow:auto;"><table style="border-bottom: 2px solid #000;"><caption><b>List of pull</b></caption>'; |
481 | | - foreach ( $pulls as $pull ) { |
482 | | - |
483 | | - |
484 | | - $pullName = $pull; |
485 | | - $pushServer = getPushURL( $pullName ); |
486 | | - $pushName = getPushName( $pullName ); |
487 | | - $output .= '<tr><td align="right" width="50%"><a href="' . $_SERVER['PHP_SELF'] . '?title=' . $pullName . '">' . $pullName . '</a> : </td>'; |
488 | | - |
489 | | - $pulledPatch = utils::getPulledPatches( $pullName ); |
490 | | - $patchs = array(); |
491 | | - foreach ( $pulledPatch as $patch ) { |
492 | | - |
493 | | - $onPage = array(); |
494 | | - $res = utils::getSemanticQuery( '[[Patch:+]][[patchID::' . $patch . ']]', '?onPage' ); |
495 | | - $count = $res->getCount(); |
496 | | - for ( $i = 0; $i < $count; $i++ ) { |
497 | | - |
498 | | - $row = $res->getNext(); |
499 | | - if ( $row === false ) break; |
500 | | - $row = $row[1]; |
501 | | - |
502 | | - $col = $row->getContent();// SMWResultArray object |
503 | | - foreach ( $col as $object ) {// SMWDataValue object |
504 | | - $wikiValue = $object->getWikiValue(); |
505 | | - $onPage[] = $wikiValue; |
506 | | - } |
507 | | - } |
508 | | - if ( $onPage[0] == $title ) { |
509 | | - $patchs[] = $patch; |
510 | | - } |
511 | | - } |
512 | | - |
513 | | - $published = utils::getPublishedPatchs( $pushServer, $pushName, $title ); |
514 | | - |
515 | | - if ( !is_null( $published ) ) { |
516 | | - $unpublished = array_diff( $patchs, $published ); |
517 | | - $t = count( $published ); |
518 | | - $t = count( $patchs ); |
519 | | - $count = count( $published ) - count( $patchs ); |
520 | | - $output .= '<td align="left" width="50%"> ' . $count . ' unpulled patchs </td></tr>'; |
521 | | - } else { |
522 | | - $output .= '<td align="left" width="50%"> up to date </td></tr>'; |
523 | | - } |
524 | | - } |
525 | | - $output .= '</table></div>'; |
526 | | - |
527 | | - }// end if empty $pulls |
528 | | - |
529 | | - // part push page |
530 | | - $url = "http://" . $wgServerName . $wgScriptPath . "/index{$wgScriptExtension}"; |
531 | | - $output .= ' |
532 | | -<h2>Actions</h2> |
533 | | -<div><FORM name="formPush"> |
534 | | -<table > |
535 | | -<tr><td> <input type="button" value="PUSH" onClick="pushpage(\'' . $url . '\',\'' . $title . '\');"></input></td></tr></table></form></div> |
536 | | -This [Push page : "' . $title . '"] action will create a PushFeed and |
537 | | -publish the modifications of the "' . $title . '" article |
538 | | - |
539 | | -<div id="pushstatus" style="display: none; width: 100%; clear: both;" > |
540 | | -<a name="PUSH_Progress_:" id="PUSH_Progress_:"></a><h2> <span class="mw-headline"> PUSH Progress : </span></h2> |
541 | | -<div id="statepush" ></div><br /> |
542 | | -</div> |
543 | | -'; |
544 | | - |
545 | | - |
546 | | - $wgOut->addHTML( $output ); |
547 | | - return false; |
548 | | - } |
549 | | - else { |
550 | | - return true; |
551 | | - } |
552 | | - } |
553 | 336 | |
554 | 337 | /** |
555 | 338 | * Defines the "Article Admin tab" |
Index: trunk/extensions/DSMW/includes/DSMWExhibits.php |
— | — | @@ -1,111 +0,0 @@ |
2 | | -<?php |
3 | | -/* |
4 | | - * @copyright INRIA-LORIA-SCORE Team |
5 | | - * @author muller jean-philippe |
6 | | - */ |
7 | | - |
8 | | -/** |
9 | | - * DSMWExhibits adds a tab on each article only if SemanticResultFormats |
10 | | - * extension is loaded. This tab opens a page that shows informations about DSMW |
11 | | - * |
12 | | - */ |
13 | | -class DSMWExhibits { |
14 | | - |
15 | | - // Constructor |
16 | | - public function DSMWExhibits() { |
17 | | - global $wgHooks; |
18 | | - |
19 | | - $wgHooks['UnknownAction'][] = $this; |
20 | | - $wgHooks['SkinTemplateTabs'][] = $this; |
21 | | - } |
22 | | - |
23 | | - public function onUnknownAction( $action, $article ) { |
24 | | - global $wgOut, $wgCachePages, $wgTitle, $wgDBPrefix, $wgDenyAccessMessage; |
25 | | - |
26 | | - $wgCachePages = false; |
27 | | - |
28 | | - if ( $action == 'exhibit' ) { |
29 | | - $wgOut->setPageTitle( str_replace( '_', ' ', $wgTitle->getDBKey() ) ); |
30 | | - |
31 | | - if ( $wgTitle->mNamespace == PULLFEED ) {// if this page is a PullFeed |
32 | | - $text = '==Patches pulled on the {{PAGENAME}}\'s channel== |
33 | | - |
34 | | -{{#ask: [[-hasPatch::<q>[[inPullFeed::PullFeed:{{PAGENAME}}]]</q>]] |
35 | | -|?onPage |
36 | | -|?modification date |
37 | | -| format=exhibit |
38 | | -| views=timeline, table, tabular |
39 | | -|sort=modification date |
40 | | -|facets=onPage |
41 | | -| limit=1000 |
42 | | -}}'; |
43 | | - } elseif ( $wgTitle->mNamespace == PUSHFEED ) {// if this page is a PushFeed |
44 | | - $text = '==Patches pushed on the {{PAGENAME}}\'s channel== |
45 | | - |
46 | | -{{#ask: [[-hasPatch::<q>[[inPushFeed::PushFeed:{{PAGENAME}}]]</q>]] |
47 | | -|?onPage |
48 | | -|?modification date |
49 | | -| format=exhibit |
50 | | -| views=timeline, table, tabular |
51 | | -|sort=modification date |
52 | | -|facets=onPage |
53 | | -| limit=1000 |
54 | | -}}'; |
55 | | - } |
56 | | - else {// articles in main namespace |
57 | | - |
58 | | - $text = '=={{PAGENAME}}\'s patches== |
59 | | - |
60 | | -{{#ask: [[Patch:+]] [[onPage::' . $wgTitle->getDBKey() . ']] |
61 | | -|?patchID |
62 | | -| ?modification date |
63 | | -| format=exhibit |
64 | | -| views=timeline, table, tabular |
65 | | -| start=modification date |
66 | | -| timelineHeight=200 |
67 | | -| limit=500 |
68 | | -}} |
69 | | - |
70 | | -==Informations about the patches of this page== |
71 | | - |
72 | | -{{#ask: [[hasPatch::<q>[[Patch:+]] [[onPage::{{PAGENAME}}]]</q>]] |
73 | | -|?inPushFeed |
74 | | -|?modification date |
75 | | -| format=table |
76 | | -| sort=modification date |
77 | | -|default=no results |
78 | | -|mainlabel=ChangeSet |
79 | | -}} |
80 | | -'; |
81 | | - }// end else |
82 | | - |
83 | | - $wgOut->addWikiText( $text ); |
84 | | - |
85 | | - return false; |
86 | | - } |
87 | | - else { |
88 | | - return true; |
89 | | - } |
90 | | - } |
91 | | - |
92 | | - public function onSkinTemplateTabs( $skin, $content_actions ) { |
93 | | - global $wgRequest; |
94 | | - |
95 | | - $action = $wgRequest->getText( 'action' ); |
96 | | - |
97 | | - if ( $skin->mTitle->mNamespace == PATCH |
98 | | - // || $skin->mTitle->mNamespace == PULLFEED |
99 | | - // || $skin->mTitle->mNamespace == PUSHFEED |
100 | | - || $skin->mTitle->mNamespace == CHANGESET |
101 | | - ) { |
102 | | - } else { |
103 | | - $content_actions['exhibit'] = array( |
104 | | - 'class' => ( $action == 'exhibit' ) ? 'selected' : false, |
105 | | - 'text' => "dsmw exhibits", |
106 | | - 'href' => $skin->mTitle->getLocalURL( 'action=exhibit' ) |
107 | | - ); |
108 | | - } |
109 | | - return true; |
110 | | - } |
111 | | - |
112 | | -} |