Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php |
— | — | @@ -21,6 +21,11 @@ |
22 | 22 | } |
23 | 23 | $definedMeaningModel = new DefinedMeaningModel($dmInfo["id"]); |
24 | 24 | |
| 25 | + $copyTo=$wgRequest->getText('CopyTo'); |
| 26 | + if ($copyTo) { |
| 27 | + $definedMeaningModel->copyTo($copyTo); |
| 28 | + } |
| 29 | + |
25 | 30 | if(!empty($dmInfo["expression"])) |
26 | 31 | $definedMeaningModel->setDefiningExpression($dmInfo["expression"]); |
27 | 32 | |
— | — | @@ -187,9 +192,29 @@ |
188 | 193 | $titleText=$wgTitle->getPrefixedURL(); |
189 | 194 | $cmlink=$sk->makeLinkObj($cmtitle,"<small>".wfMsg("add_concept_link")."</small>","set_$dc=$titleText&suppressWarnings=true"); |
190 | 195 | $html.="<tr><td>$cmlink</td></tr>\n"; |
| 196 | + $html.="<tr><td>".$this->getCopyPanel()."<td><tr>"; |
191 | 197 | $html.="</table>\n"; |
192 | 198 | $html.="</div>\n"; |
193 | 199 | return $html; |
194 | 200 | } |
| 201 | + |
| 202 | + /** |
| 203 | + * @returns user interface html for copying Defined Meanings between |
| 204 | + datasets |
| 205 | + */ |
| 206 | + protected function getCopyPanel() { |
| 207 | + |
| 208 | + # mostly same code as in SpecialAddCollection... possibly might |
| 209 | + # make a nice separate function |
| 210 | + $datasets=wdGetDatasets(); |
| 211 | + $datasetarray['']=wfMsg('ow_none_selected'); |
| 212 | + foreach($datasets as $datasetid=>$dataset) { |
| 213 | + $datasetarray[$datasetid]=$dataset->fetchName(); |
| 214 | + } |
| 215 | + $html= getOptionPanel( array ( |
| 216 | + 'Copy to' => getSelect('CopyTo', $datasetarray) |
| 217 | + )); |
| 218 | + return $html; |
| 219 | + } |
195 | 220 | } |
196 | 221 | |
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php |
— | — | @@ -297,7 +297,8 @@ |
298 | 298 | * @returns defined meaning id in the new dataset |
299 | 299 | */ |
300 | 300 | public function copyTo($dataset) { |
301 | | - $definedMeaningID=$this->getDefinedMeaningID(); |
| 301 | + #$definedMeaningID=$this->getId(); |
| 302 | + echo "copy to:$dataset "; |
302 | 303 | #$from_dc=$this->getDataset(); |
303 | 304 | $to_dc=$dataset; |
304 | 305 | # TODO We should actually thoroughly check that everything |
— | — | @@ -461,4 +462,4 @@ |
462 | 463 | return $this->exists; |
463 | 464 | } |
464 | 465 | |
465 | | -} |
\ No newline at end of file |
| 466 | +} |