Index: trunk/extensions/DSMW/DSMW.hooks.php |
— | — | @@ -655,7 +655,7 @@ |
656 | 656 | $listOp1 = $logoot1->generate( $text, $actualtext ); |
657 | 657 | // creation Patch P2 |
658 | 658 | $tmp = serialize( $listOp1 ); |
659 | | - $patch = new Patch( false, false, $listOp1, $urlServer, $rev_id1 ); |
| 659 | + $patch = new DSMWPatch( false, false, $listOp1, $urlServer, $rev_id1 ); |
660 | 660 | |
661 | 661 | if ( $editpage->mTitle->getNamespace() == 0 ) { |
662 | 662 | $title = $editpage->mTitle->getText(); |
— | — | @@ -671,7 +671,7 @@ |
672 | 672 | $listOp = $logoot->generate( $conctext, $actualtext ); |
673 | 673 | $modelAfterIntegrate = $logoot->getModel(); |
674 | 674 | $tmp = serialize( $listOp ); |
675 | | - $patch = new Patch( false, false, $listOp, $urlServer, $rev_id1 ); |
| 675 | + $patch = new DSMWPatch( false, false, $listOp, $urlServer, $rev_id1 ); |
676 | 676 | |
677 | 677 | if ( $editpage->mTitle->getNamespace() == 0 ) |
678 | 678 | $title = $editpage->mTitle->getText(); |
— | — | @@ -720,7 +720,7 @@ |
721 | 721 | |
722 | 722 | $revID = $lastRevision->getId(); |
723 | 723 | $model = DSMWRevisionManager::loadModel( $rev_id ); |
724 | | - $patch = new Patch( false, true, null, $urlServer, $rev_id, null, null, null, $localfile->mime, $localfile->size, urldecode( $localfile->url ), null ); |
| 724 | + $patch = new DSMWPatch( false, true, null, $urlServer, $rev_id, null, null, null, $localfile->mime, $localfile->size, urldecode( $localfile->url ), null ); |
725 | 725 | $patch->storePage( $localfile->getTitle(), $revID ); // stores the patch in a wikipage |
726 | 726 | DSMWRevisionManager::storeModel( $revID, $sessionId = session_id(), $model, $blobCB = 0 ); |
727 | 727 | } |
Index: trunk/extensions/DSMW/jobs/DSMWUpdateJob.php |
— | — | @@ -104,10 +104,10 @@ |
105 | 105 | $mime = $a['mime']; |
106 | 106 | $size = $a['size']; |
107 | 107 | $url = $a['url']; |
108 | | - $patch = new Patch( false, true, null, $urlServer . $wgScriptPath, 0, null, null, null, $mime, $size, $url, null ); |
| 108 | + $patch = new DSMWPatch( false, true, null, $urlServer . $wgScriptPath, 0, null, null, null, $mime, $size, $url, null ); |
109 | 109 | $patch->storePage( 'File:' . $lastRev->getTitle()->getText(), $lastRev->getId() ); |
110 | 110 | } else { |
111 | | - $patch = new Patch( false, false, $listOp, $urlServer, 0 ); |
| 111 | + $patch = new DSMWPatch( false, false, $listOp, $urlServer, 0 ); |
112 | 112 | $patch->storePage( $lastRev->getTitle()->getText(), $lastRev->getId() ); |
113 | 113 | } |
114 | 114 | |
Index: trunk/extensions/DSMW/patch/Patch.php |
— | — | @@ -1,194 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Object that wraps an operation list and other features concerning an article |
6 | | - * page. |
7 | | - * |
8 | | - * @copyright INRIA-LORIA-ECOO project |
9 | | - * @author muller jean-philippe & Morel Émile |
10 | | - */ |
11 | | -class Patch { |
12 | | - |
13 | | - private $mPatchId; |
14 | | - private $mOperations = array(); |
15 | | - private $mPrevPatch; |
16 | | - private $mCausal; |
17 | | - private $mSiteId; |
18 | | - private $mSiteUrl; |
19 | | - private $mRemote; |
20 | | - private $mAttachment; |
21 | | - private $mMime; |
22 | | - private $mSize; |
23 | | - private $mUrl; |
24 | | - private $mDate; |
25 | | - private $mID; |
26 | | - |
27 | | - /** |
28 | | - * |
29 | | - * @param <bool> $remote |
30 | | - * @param <bool> $attachment |
31 | | - * @param <array> $operations |
32 | | - * @param <string> $siteUrl |
33 | | - * @param <array> $causalLink |
34 | | - * @param <string> $patchid |
35 | | - * @param <string> $previousPatch |
36 | | - * @param <string> $siteID |
37 | | - * @param <string> $Mime |
38 | | - * @param <string> $Size |
39 | | - * @param <string> $Url |
40 | | - * @param <string> $Date |
41 | | - */ |
42 | | - public function __construct( $remote, $attachment, $operations, $siteUrl = '', $causalLink = '', $patchid = '', $previousPatch = '', $siteID = '', $Mime = '', $Size = '', $Url = '', $Date = '' ) { |
43 | | - global $wgServer; |
44 | | - |
45 | | - $this->mRemote = $remote; |
46 | | - $this->mID = utils::generateID(); |
47 | | - |
48 | | - if ( $remote == true ) { |
49 | | - $this->mPatchId = $patchid; |
50 | | - $this->mSiteId = $siteID; |
51 | | - $this->mID = $patchid; |
52 | | - } else { |
53 | | - $this->mPatchId = "Patch:" . $this->mID; |
54 | | - $this->mSiteId = DSMWSiteId::getInstance()->getSiteId(); |
55 | | - } |
56 | | - |
57 | | - $this->mOperations = $operations; |
58 | | - $this->mPrevPatch = $previousPatch; |
59 | | - $this->mSiteUrl = $siteUrl; |
60 | | - $this->mCausal = $causalLink; |
61 | | - |
62 | | - $this->mAttachment = $attachment; |
63 | | - if ( $attachment == true ) { |
64 | | - $this->mMime = $Mime; |
65 | | - $this->mSize = $Size; |
66 | | - if ( $remote ) { |
67 | | - $this->mDate = $Date; |
68 | | - $this->mUrl = $Url; |
69 | | - } |
70 | | - else { |
71 | | - $this->mDate = date( DATE_RFC822 ); |
72 | | - $this->mPatchId = "Patch:ATT" . $this->mID; |
73 | | - $this->mUrl = $wgServer . $Url; |
74 | | - $this->mID = "Patch:ATT" . $this->mID; |
75 | | - } |
76 | | - } |
77 | | - } |
78 | | - |
79 | | - public function storePage( $pageName, $rev ) { |
80 | | - global $wgUser; |
81 | | - $text = ' |
82 | | -[[Special:ArticleAdminPage|DSMW Admin functions]] |
83 | | - |
84 | | -==Features== |
85 | | -[[patchID::' . $this->mPatchId . '| ]] |
86 | | - |
87 | | -\'\'\'SiteID:\'\'\' [[siteID::' . $this->mSiteId . ']] |
88 | | - |
89 | | -\'\'\'SiteUrl:\'\'\' [[siteUrl::' . $this->mSiteUrl . ']] |
90 | | - |
91 | | -\'\'\'Rev:\'\'\' [[Rev::' . $rev . ']] |
92 | | - |
93 | | -'; |
94 | | - |
95 | | - if ( $this->mRemote ) { |
96 | | - $text .= '\'\'\'Remote Patch\'\'\' |
97 | | - |
98 | | -'; |
99 | | - } else { |
100 | | - $this->mPrevPatch = utils::getLastPatchId( $pageName ); |
101 | | - if ( $this->mPrevPatch == false ) { |
102 | | - $this->mPrevPatch = "none"; |
103 | | - } |
104 | | - $this->mCausal = utils::searchCausalLink( $pageName, $this->mCausal ); |
105 | | - } |
106 | | - |
107 | | - |
108 | | - $text .= '\'\'\'Date:\'\'\' ' . date( DATE_RFC822 ) . ' |
109 | | - |
110 | | -'; |
111 | | - if ( $this->mAttachment ) { |
112 | | - $text .= '\'\'\'Date of upload of the Attachment:\'\'\' [[DateAtt::' . $this->mDate . ']] |
113 | | - |
114 | | -\'\'\'Mime:\'\'\' [[Mime::' . $this->mMime . ']] |
115 | | - |
116 | | -\'\'\'Size:\'\'\' [[Size::' . $this->mSize . ']] |
117 | | - |
118 | | -\'\'\'Url:\'\'\' [[Url::' . $this->mUrl . ']] |
119 | | - |
120 | | -'; |
121 | | - } |
122 | | - $text .= '\'\'\'User:\'\'\' ' . $wgUser->getName() . ' |
123 | | - |
124 | | -This is a patch of the article: [[onPage::' . $pageName . ']] <br> |
125 | | - |
126 | | -'; |
127 | | - if ( $this->mAttachment == false ) { |
128 | | - $text .= '==Operations of the patch== |
129 | | - |
130 | | -{| class="wikitable" border="1" style="text-align:left; width:80%;" |
131 | | -|- |
132 | | -!bgcolor=#c0e8f0 scope=col | Type |
133 | | -!bgcolor=#c0e8f0 scope=col | Content |
134 | | -|- |
135 | | -'; |
136 | | - if ( $this->mRemote == true ) { |
137 | | - foreach ( $this->mOperations as $op ) { |
138 | | - $opArr = explode( ";", $op ); |
139 | | - $text .= '|[[hasOperation::' . $op . '| ]]' . $opArr[1] . ' |
140 | | -|<nowiki>' . utils::contentDecoding( $opArr[3] ) . '</nowiki> |
141 | | -|- |
142 | | -'; |
143 | | - } |
144 | | - } else { |
145 | | - $i = 1; // op counter |
146 | | - foreach ( $this->mOperations as $operation ) { |
147 | | - $lineContent = $operation->getLineContent(); |
148 | | - $lineContent1 = utils::contentEncoding( $lineContent ); // base64 encoding |
149 | | - $type = $operation instanceof LogootIns ? 'Insert' : 'Delete'; |
150 | | - |
151 | | - $operationID = utils::generateID(); |
152 | | - $text .= '|[[hasOperation::' . $operationID . ';' . $type . ';' |
153 | | - . $operation->getLogootPosition()->toString() . ';' . $lineContent1 . '| ]]' . $type; |
154 | | - |
155 | | - // displayed text |
156 | | - $lineContent2 = $lineContent; |
157 | | - $text .= ' |
158 | | -|<nowiki>' . $lineContent2 . '</nowiki> |
159 | | -|- |
160 | | -'; |
161 | | - } |
162 | | - } |
163 | | - |
164 | | - $text .= '|}'; |
165 | | - } |
166 | | - if ( is_array( $this->mPrevPatch ) ) { |
167 | | - $text .= ' |
168 | | - |
169 | | -==Previous patch(es)== |
170 | | -[[previous::'; |
171 | | - foreach ( $this->mPrevPatch as $prev ) { |
172 | | - $text .= $prev . ';'; |
173 | | - } |
174 | | - $text .= ']]'; |
175 | | - } else { |
176 | | - $text .= ' |
177 | | - |
178 | | -==Previous patch(es)== |
179 | | -[[previous::' . $this->mPrevPatch . ']]'; |
180 | | - } |
181 | | - $text .= ' |
182 | | - |
183 | | -==Causal Link== |
184 | | -[[causal::' . $this->mCausal . ']]'; |
185 | | - |
186 | | - $title = Title::newFromText( $this->mID, PATCH ); |
187 | | - $article = new Article( $title ); |
188 | | - $article->doEdit( $text, $summary = "" ); |
189 | | - } |
190 | | - |
191 | | - protected function splitLine( $line ) { |
192 | | - return implode( '<br>', str_split( $line, 150 ) ) . '<br />'; |
193 | | - } |
194 | | - |
195 | | -} |
Index: trunk/extensions/DSMW/DSMW.php |
— | — | @@ -74,9 +74,8 @@ |
75 | 75 | |
76 | 76 | $wgAutoloadClasses['DSMWRevisionManager'] = dirname( __FILE__ ) . '/includes/DSMW_RevisionManager.php'; |
77 | 77 | $wgAutoloadClasses['DSMWPersistentClock'] = dirname( __FILE__ ) . '/includes/DSMW_PersistentClock.php'; |
| 78 | +$wgAutoloadClasses['DSMWPatch'] = dirname( __FILE__ ) . '/includes/DSMW_Patch.php'; |
78 | 79 | |
79 | | -$wgAutoloadClasses['Patch'] = "$wgDSMWIP/patch/Patch.php"; |
80 | | - |
81 | 80 | $wgAutoloadClasses['ApiQueryPatch'] = "$wgDSMWIP/api/ApiQueryPatch.php"; |
82 | 81 | $wgAutoloadClasses['ApiQueryChangeSet'] = "$wgDSMWIP/api/ApiQueryChangeSet.php"; |
83 | 82 | $wgAutoloadClasses['ApiUpload'] = "$wgDSMWIP/api/upload/ApiUpload.php"; |
Index: trunk/extensions/DSMW/files/utils.php |
— | — | @@ -357,6 +357,7 @@ |
358 | 358 | * |
359 | 359 | * @param <String> $pageName |
360 | 360 | * @param <Integer> $rev |
| 361 | + * |
361 | 362 | * @return <String> the causal link |
362 | 363 | */ |
363 | 364 | static function searchCausalLink( $pageName, $rev ) { |
— | — | @@ -364,13 +365,27 @@ |
365 | 366 | return 'none'; |
366 | 367 | } else { |
367 | 368 | $res = utils::getSemanticQuery( '[[Patch:+]][[onPage::' . $pageName . ']][[Rev::' . $rev . ']]', '?PatchID' ); |
368 | | - if ( $res === false ) return 'none'; |
| 369 | + |
| 370 | + if ( $res === false ) { |
| 371 | + return 'none'; |
| 372 | + } |
| 373 | + |
369 | 374 | $count1 = $res->getCount(); |
| 375 | + |
370 | 376 | for ( $j = 0; $j < $count1; $j++ ) { |
371 | | - |
372 | | - $row1 = $res->getNext(); |
373 | | - if ( $row1 === false ) |
374 | | - break; |
| 377 | + |
| 378 | + if ( is_object($res) ) { |
| 379 | + $row1 = $res->getNext(); |
| 380 | + } |
| 381 | + else { |
| 382 | + break; |
| 383 | + } |
| 384 | + |
| 385 | + |
| 386 | + if ( $row1 === false ) { |
| 387 | + break; |
| 388 | + } |
| 389 | + |
375 | 390 | $row1 = $row1[0]; |
376 | 391 | |
377 | 392 | $col1 = $row1->getContent(); // SMWResultArray object |
— | — | @@ -710,17 +725,17 @@ |
711 | 726 | } |
712 | 727 | |
713 | 728 | /** |
714 | | - * |
715 | 729 | * @param <String> $query (e.g. [[ChangeSet:+]][[inPullFeed::Pullfeed:xxxxx]]) |
716 | 730 | * @param <String> $paramstring Printout parameters (e.g. ?hasPatch?changeSetID) |
717 | | - * @return <Object> SMWQueryResult object |
| 731 | + * |
| 732 | + * @return SMWQueryResult or false |
718 | 733 | */ |
719 | | - |
720 | 734 | static public function getSemanticQuery( $query, $paramstring = '' ) { |
721 | 735 | $printouts = array(); |
722 | 736 | $rawparams = array(); |
723 | 737 | $params = array( 'format' => ' ', 'sort' => ' ', 'offset' => 0 ); |
724 | 738 | $rawparams[] = $query; |
| 739 | + |
725 | 740 | if ( $paramstring != '' ) { |
726 | 741 | $ps = explode( "\n", $paramstring ); |
727 | 742 | foreach ( $ps as $param ) { |
— | — | @@ -738,7 +753,10 @@ |
739 | 754 | $queryobj->setLimit( 5000 ); |
740 | 755 | $res = smwfGetStore()->getQueryResult( $queryobj ); |
741 | 756 | |
742 | | - if ( !( $res instanceof SMWQueryResult ) )return false; |
| 757 | + if ( !( $res instanceof SMWQueryResult ) ) { |
| 758 | + return false; |
| 759 | + } |
| 760 | + |
743 | 761 | return $res; |
744 | 762 | } |
745 | 763 | |
Index: trunk/extensions/DSMW/INSTALL |
— | — | @@ -1,4 +1,4 @@ |
2 | | -[[Distributed Semantic MediaWiki 1.0]] |
| 2 | +[[Distributed Semantic MediaWiki 1.1]] |
3 | 3 | |
4 | 4 | Contents: |
5 | 5 | * Disclaimer |
— | — | @@ -15,6 +15,7 @@ |
16 | 16 | provided). |
17 | 17 | |
18 | 18 | == Requirements == |
| 19 | + |
19 | 20 | DSMW has been developped on MW 1.14.0. DSMW-0.3.1 and DSMW-0.3.2 has been tested |
20 | 21 | with version MW-1.13.2, MW-1.14.0, MW-1.15.0 and MW-1.15.1. |
21 | 22 | The DSMW extension requires an install of Semantic MediaWiki 1.4.2 or 1.4.3 |
— | — | @@ -22,13 +23,11 @@ |
23 | 24 | For more details, see those extensions'own |
24 | 25 | installation requirements. |
25 | 26 | |
26 | | - |
27 | 27 | Important: If you want to run the DSMW tests, you must make a dump of your |
28 | 28 | database immediatly after having installed DSMW but before using DSMW. |
29 | 29 | For more details, see the readme file in the tests directory |
30 | 30 | [wikipath]/extensions/DSMW/tests. |
31 | 31 | |
32 | | - |
33 | 32 | == Installation == |
34 | 33 | |
35 | 34 | '''Remark:''' Follow these different points carefully for a successful |
— | — | @@ -74,10 +73,7 @@ |
75 | 74 | include_once("$IP/extensions/SemanticMediaWiki/includes/SMW_Settings.php"); |
76 | 75 | enableSemantics($_SERVER['SERVER_NAME']); |
77 | 76 | |
78 | | - |
79 | | - |
80 | 77 | == Contact == |
81 | 78 | |
82 | 79 | If you have any issues or questions, please consult: |
83 | 80 | https://gforge.inria.fr/projects/m3p/ |
84 | | - |
Index: trunk/extensions/DSMW/includes/DSMW_Patch.php |
— | — | @@ -0,0 +1,194 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Object that wraps an operation list and other features concerning an article |
| 6 | + * page. |
| 7 | + * |
| 8 | + * @copyright INRIA-LORIA-ECOO project |
| 9 | + * @author muller jean-philippe & Morel Émile |
| 10 | + */ |
| 11 | +class DSMWPatch { |
| 12 | + |
| 13 | + private $mPatchId; |
| 14 | + private $mOperations = array(); |
| 15 | + private $mPrevPatch; |
| 16 | + private $mCausal; |
| 17 | + private $mSiteId; |
| 18 | + private $mSiteUrl; |
| 19 | + private $mRemote; |
| 20 | + private $mAttachment; |
| 21 | + private $mMime; |
| 22 | + private $mSize; |
| 23 | + private $mUrl; |
| 24 | + private $mDate; |
| 25 | + private $mID; |
| 26 | + |
| 27 | + /** |
| 28 | + * |
| 29 | + * @param <bool> $remote |
| 30 | + * @param <bool> $attachment |
| 31 | + * @param <array> $operations |
| 32 | + * @param <string> $siteUrl |
| 33 | + * @param <array> $causalLink |
| 34 | + * @param <string> $patchid |
| 35 | + * @param <string> $previousPatch |
| 36 | + * @param <string> $siteID |
| 37 | + * @param <string> $Mime |
| 38 | + * @param <string> $Size |
| 39 | + * @param <string> $Url |
| 40 | + * @param <string> $Date |
| 41 | + */ |
| 42 | + public function __construct( $remote, $attachment, $operations, $siteUrl = '', $causalLink = '', $patchid = '', $previousPatch = '', $siteID = '', $Mime = '', $Size = '', $Url = '', $Date = '' ) { |
| 43 | + global $wgServer; |
| 44 | + |
| 45 | + $this->mRemote = $remote; |
| 46 | + $this->mID = utils::generateID(); |
| 47 | + |
| 48 | + if ( $remote == true ) { |
| 49 | + $this->mPatchId = $patchid; |
| 50 | + $this->mSiteId = $siteID; |
| 51 | + $this->mID = $patchid; |
| 52 | + } else { |
| 53 | + $this->mPatchId = "Patch:" . $this->mID; |
| 54 | + $this->mSiteId = DSMWSiteId::getInstance()->getSiteId(); |
| 55 | + } |
| 56 | + |
| 57 | + $this->mOperations = $operations; |
| 58 | + $this->mPrevPatch = $previousPatch; |
| 59 | + $this->mSiteUrl = $siteUrl; |
| 60 | + $this->mCausal = $causalLink; |
| 61 | + |
| 62 | + $this->mAttachment = $attachment; |
| 63 | + if ( $attachment == true ) { |
| 64 | + $this->mMime = $Mime; |
| 65 | + $this->mSize = $Size; |
| 66 | + if ( $remote ) { |
| 67 | + $this->mDate = $Date; |
| 68 | + $this->mUrl = $Url; |
| 69 | + } |
| 70 | + else { |
| 71 | + $this->mDate = date( DATE_RFC822 ); |
| 72 | + $this->mPatchId = "Patch:ATT" . $this->mID; |
| 73 | + $this->mUrl = $wgServer . $Url; |
| 74 | + $this->mID = "Patch:ATT" . $this->mID; |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | + public function storePage( $pageName, $rev ) { |
| 80 | + global $wgUser; |
| 81 | + $text = ' |
| 82 | +[[Special:ArticleAdminPage|DSMW Admin functions]] |
| 83 | + |
| 84 | +==Features== |
| 85 | +[[patchID::' . $this->mPatchId . '| ]] |
| 86 | + |
| 87 | +\'\'\'SiteID:\'\'\' [[siteID::' . $this->mSiteId . ']] |
| 88 | + |
| 89 | +\'\'\'SiteUrl:\'\'\' [[siteUrl::' . $this->mSiteUrl . ']] |
| 90 | + |
| 91 | +\'\'\'Rev:\'\'\' [[Rev::' . $rev . ']] |
| 92 | + |
| 93 | +'; |
| 94 | + |
| 95 | + if ( $this->mRemote ) { |
| 96 | + $text .= '\'\'\'Remote Patch\'\'\' |
| 97 | + |
| 98 | +'; |
| 99 | + } else { |
| 100 | + $this->mPrevPatch = utils::getLastPatchId( $pageName ); |
| 101 | + if ( $this->mPrevPatch == false ) { |
| 102 | + $this->mPrevPatch = "none"; |
| 103 | + } |
| 104 | + $this->mCausal = utils::searchCausalLink( $pageName, $this->mCausal ); |
| 105 | + } |
| 106 | + |
| 107 | + |
| 108 | + $text .= '\'\'\'Date:\'\'\' ' . date( DATE_RFC822 ) . ' |
| 109 | + |
| 110 | +'; |
| 111 | + if ( $this->mAttachment ) { |
| 112 | + $text .= '\'\'\'Date of upload of the Attachment:\'\'\' [[DateAtt::' . $this->mDate . ']] |
| 113 | + |
| 114 | +\'\'\'Mime:\'\'\' [[Mime::' . $this->mMime . ']] |
| 115 | + |
| 116 | +\'\'\'Size:\'\'\' [[Size::' . $this->mSize . ']] |
| 117 | + |
| 118 | +\'\'\'Url:\'\'\' [[Url::' . $this->mUrl . ']] |
| 119 | + |
| 120 | +'; |
| 121 | + } |
| 122 | + $text .= '\'\'\'User:\'\'\' ' . $wgUser->getName() . ' |
| 123 | + |
| 124 | +This is a patch of the article: [[onPage::' . $pageName . ']] <br> |
| 125 | + |
| 126 | +'; |
| 127 | + if ( $this->mAttachment == false ) { |
| 128 | + $text .= '==Operations of the patch== |
| 129 | + |
| 130 | +{| class="wikitable" border="1" style="text-align:left; width:80%;" |
| 131 | +|- |
| 132 | +!bgcolor=#c0e8f0 scope=col | Type |
| 133 | +!bgcolor=#c0e8f0 scope=col | Content |
| 134 | +|- |
| 135 | +'; |
| 136 | + if ( $this->mRemote == true ) { |
| 137 | + foreach ( $this->mOperations as $op ) { |
| 138 | + $opArr = explode( ";", $op ); |
| 139 | + $text .= '|[[hasOperation::' . $op . '| ]]' . $opArr[1] . ' |
| 140 | +|<nowiki>' . utils::contentDecoding( $opArr[3] ) . '</nowiki> |
| 141 | +|- |
| 142 | +'; |
| 143 | + } |
| 144 | + } else { |
| 145 | + $i = 1; // op counter |
| 146 | + foreach ( $this->mOperations as $operation ) { |
| 147 | + $lineContent = $operation->getLineContent(); |
| 148 | + $lineContent1 = utils::contentEncoding( $lineContent ); // base64 encoding |
| 149 | + $type = $operation instanceof LogootIns ? 'Insert' : 'Delete'; |
| 150 | + |
| 151 | + $operationID = utils::generateID(); |
| 152 | + $text .= '|[[hasOperation::' . $operationID . ';' . $type . ';' |
| 153 | + . $operation->getLogootPosition()->toString() . ';' . $lineContent1 . '| ]]' . $type; |
| 154 | + |
| 155 | + // displayed text |
| 156 | + $lineContent2 = $lineContent; |
| 157 | + $text .= ' |
| 158 | +|<nowiki>' . $lineContent2 . '</nowiki> |
| 159 | +|- |
| 160 | +'; |
| 161 | + } |
| 162 | + } |
| 163 | + |
| 164 | + $text .= '|}'; |
| 165 | + } |
| 166 | + if ( is_array( $this->mPrevPatch ) ) { |
| 167 | + $text .= ' |
| 168 | + |
| 169 | +==Previous patch(es)== |
| 170 | +[[previous::'; |
| 171 | + foreach ( $this->mPrevPatch as $prev ) { |
| 172 | + $text .= $prev . ';'; |
| 173 | + } |
| 174 | + $text .= ']]'; |
| 175 | + } else { |
| 176 | + $text .= ' |
| 177 | + |
| 178 | +==Previous patch(es)== |
| 179 | +[[previous::' . $this->mPrevPatch . ']]'; |
| 180 | + } |
| 181 | + $text .= ' |
| 182 | + |
| 183 | +==Causal Link== |
| 184 | +[[causal::' . $this->mCausal . ']]'; |
| 185 | + |
| 186 | + $title = Title::newFromText( $this->mID, PATCH ); |
| 187 | + $article = new Article( $title ); |
| 188 | + $article->doEdit( $text, $summary = "" ); |
| 189 | + } |
| 190 | + |
| 191 | + protected function splitLine( $line ) { |
| 192 | + return implode( '<br>', str_split( $line, 150 ) ) . '<br />'; |
| 193 | + } |
| 194 | + |
| 195 | +} |
Property changes on: trunk/extensions/DSMW/includes/DSMW_Patch.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 196 | + native |
Index: trunk/extensions/DSMW/includes/IntegrationFunctions.php |
— | — | @@ -128,7 +128,7 @@ |
129 | 129 | if ( $sub === 'ATT' ) { |
130 | 130 | $rev = logootIntegrateAtt( $onPage, $edit ); |
131 | 131 | if ( $rev > 0 ) { |
132 | | - $patch = new Patch( true, true, $operations, $SiteUrl, $causal, $patchId, $lastPatch, $siteID, $Mime, $Size, $Url, $Date ); |
| 132 | + $patch = new DSMWPatch( true, true, $operations, $SiteUrl, $causal, $patchId, $lastPatch, $siteID, $Mime, $Size, $Url, $Date ); |
133 | 133 | $patch->storePage( $onPage, $rev ); |
134 | 134 | } else { |
135 | 135 | throw new MWException( __METHOD__ . ': article not saved!' ); |
— | — | @@ -138,7 +138,7 @@ |
139 | 139 | else { |
140 | 140 | $rev = logootIntegrate( $operations, $onPage, $sub ); |
141 | 141 | if ( $rev > 0 ) { |
142 | | - $patch = new Patch( true, false, $operations, $SiteUrl, $causal, $patchId, $lastPatch, $siteID, null, null, null, null ); |
| 142 | + $patch = new DSMWPatch( true, false, $operations, $SiteUrl, $causal, $patchId, $lastPatch, $siteID, null, null, null, null ); |
143 | 143 | $patch->storePage( $onPage, $rev ); |
144 | 144 | } |
145 | 145 | else { |
Index: trunk/extensions/DSMW/specialPage/ArticleAdminPage.php |
— | — | @@ -4,15 +4,13 @@ |
5 | 5 | * DSMW Special page |
6 | 6 | * |
7 | 7 | * @copyright INRIA-LORIA-ECOO project |
| 8 | + * |
8 | 9 | * @author Hantz Marlene - jean-Philippe Muller |
9 | 10 | */ |
10 | | -require_once "$IP/includes/SpecialPage.php"; |
11 | | -require_once "$wgDSMWIP/files/utils.php"; |
12 | | - |
13 | 11 | class ArticleAdminPage extends SpecialPage { |
14 | 12 | |
15 | 13 | public function __construct() { |
16 | | - global $wgHooks, $wgSpecialPages, $wgWatchingMessages; |
| 14 | + global $wgHooks; |
17 | 15 | |
18 | 16 | # Add all our needed hooks |
19 | 17 | $wgHooks["UnknownAction"][] = $this; |
— | — | @@ -545,6 +543,7 @@ |
546 | 544 | return true; |
547 | 545 | } |
548 | 546 | } |
| 547 | + |
549 | 548 | /** |
550 | 549 | * Defines the "Article Admin tab" |
551 | 550 | * |
— | — | @@ -599,7 +598,7 @@ |
600 | 599 | return false; |
601 | 600 | } |
602 | 601 | |
603 | | - /** |
| 602 | + /** |
604 | 603 | * Defines the "Article Admin tab" |
605 | 604 | * |
606 | 605 | * @global <type> $wgRequest |
Index: trunk/extensions/DSMW/specialPage/DSMWGeneralExhibits.php |
— | — | @@ -6,11 +6,9 @@ |
7 | 7 | * TODO: only load when SRF is available? |
8 | 8 | * |
9 | 9 | * @copyright INRIA-LORIA-SCORE Team |
| 10 | + * |
10 | 11 | * @author jean-Philippe Muller |
11 | 12 | */ |
12 | | - |
13 | | -require_once "$IP/includes/SpecialPage.php"; |
14 | | - |
15 | 13 | class DSMWGeneralExhibits extends SpecialPage { |
16 | 14 | |
17 | 15 | public function __construct() { |
— | — | @@ -27,34 +25,10 @@ |
28 | 26 | * (This special page works only when the Semantic Results Format extension is installed) |
29 | 27 | * |
30 | 28 | * There are 3 links used to see informations about Patches, PullFeeds or PushFeeds |
31 | | - * |
32 | | - * |
33 | 29 | */ |
34 | 30 | public function execute() { |
35 | | - global $wgOut, $wgRequest, $wgServerName, $wgScriptPath, $wgDSMWIP, $wgServerName, $wgScriptPath; |
| 31 | + global $wgOut, $wgRequest; |
36 | 32 | |
37 | | - // If the Semantic Results Format isn't installed, a blank warning page appears |
38 | | -// if (!defined('SRF_VERSION')) { |
39 | | -// $wgOut->disable(); // raw output |
40 | | -// ob_start(); |
41 | | -// print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\" dir=\"ltr\">\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>DSMW General Exhibits</title></head><body><p><pre>"; |
42 | | -// header( "Content-type: text/html; charset=UTF-8" ); |
43 | | -// |
44 | | -// print '</pre></p>'; |
45 | | -// print '<p><b>In order to use this feature, you must have installed the Semantic Results Format extension.</b></p>'; |
46 | | -// $SRFUrl = 'http://www.mediawiki.org/wiki/Extension:Semantic_Result_Formats'; |
47 | | -// print '<p> <a href="' . htmlspecialchars($SRFUrl) . '">Extension:Semantic_Result_Formats</a></p>'; |
48 | | -// $returntitle = Title::makeTitle(NS_SPECIAL, 'SpecialPages'); |
49 | | -// print '<p> <a href="' . htmlspecialchars($returntitle->getFullURL()) . '"> Back to Special:SpecialPages</a></p>'; |
50 | | -// print '</body></html>'; |
51 | | -// ob_flush(); |
52 | | -// flush(); |
53 | | -// return; |
54 | | -// } |
55 | | - |
56 | | - |
57 | | - $wgOut->setPagetitle( "DSMW General Exhibits" ); |
58 | | - |
59 | 33 | $output = '<p>This page displays general informations about Distributed Semantic MediaWiki.</p>'; |
60 | 34 | |
61 | 35 | $returntitle1 = Title::makeTitle( NS_SPECIAL, 'DSMWGeneralExhibits' ); |
— | — | @@ -146,6 +120,6 @@ |
147 | 121 | $wgOut->addWikiText( $wikitext ); |
148 | 122 | |
149 | 123 | return false; |
150 | | - }// end execute fct |
| 124 | + } |
151 | 125 | |
152 | 126 | } |