Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php |
— | — | @@ -263,7 +263,7 @@ |
264 | 264 | foreach($datasets as $datasetid=>$dataset) { |
265 | 265 | $name=$dataset->fetchName(); |
266 | 266 | $dc2=$datasetid; |
267 | | - $html.="<a href='extended/Wikidata/util/copy.php?dmid=$dmid&dc1=$dc1&dc2=$dc2'>$name</a><br>\n"; |
| 267 | + $html.="<a href='extensions/Wikidata/util/copy.php?dmid=$dmid&dc1=$dc1&dc2=$dc2'>$name</a><br>\n"; |
268 | 268 | } |
269 | 269 | |
270 | 270 | return $html; |
Index: trunk/extensions/Wikidata/util/copy.php |
— | — | @@ -120,8 +120,31 @@ |
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
| 124 | +function getOldSyntrans($dc1, $dmid, $expid) { |
| 125 | + $syntrans_table=mysql_real_escape_string("${dc1}_syntrans"); |
| 126 | + $query="SELECT * from $syntrans_table where defined_meaning_id=$dmid and expression_id=$expid"; |
| 127 | + $result = mysql_query($query)or die ("error ".mysql_error()); |
| 128 | + $data= mysql_fetch_assoc($result); |
| 129 | + var_dump($data); |
| 130 | + return $data; |
| 131 | +} |
124 | 132 | |
| 133 | +function writeSyntrans($syntrans, $newdmid, $newexpid, $dc2) { |
| 134 | + $syntrans["defined_meaning_id"]=$newdmid; |
| 135 | + $syntrans["expression_id"]=$newexpid; |
| 136 | + $syntrans_table=mysql_real_escape_string("${dc2}_syntrans"); |
| 137 | + mysql_insert_assoc($syntrans_table,$syntrans); |
| 138 | +} |
125 | 139 | |
| 140 | +function dupSyntrans($dc1, $dc2, $olddmid, $oldexpid, $newdmid, $newexpid) { |
| 141 | + $syntrans=getOldSyntrans($dc1, $olddmid, $oldexpid); |
| 142 | + $table=mysql_real_escape_string("${dc2}_syntrans"); |
| 143 | + $newid=dupObject($syntrans["syntrans_sid"], $table, $dc1, $dc2); |
| 144 | + $syntrans["syntrans_sid"]=$newid; |
| 145 | + writeSyntrans($syntrans, $newdmid, $newexpid, $dc2); |
| 146 | +} |
| 147 | + |
| 148 | + |
126 | 149 | $start=stopwatch(); |
127 | 150 | |
128 | 151 | $dmid=$_REQUEST['dmid']; |
— | — | @@ -161,6 +184,15 @@ |
162 | 185 | $save_meaning["expression_id"]=$target_expid1; |
163 | 186 | mysql_insert_assoc($dm_target_table, $save_meaning); |
164 | 187 | |
| 188 | +dupsyntrans( |
| 189 | + $dc1, |
| 190 | + $dc2, |
| 191 | + $defined_meaning["defined_meaning_id"], |
| 192 | + $defining_expression["expression_id"], |
| 193 | + $save_meaning["defined_meaning_id"], |
| 194 | + $save_expression["expression_id"] |
| 195 | +); |
| 196 | + |
165 | 197 | $title_name=$defining_expression["spelling"]; |
166 | 198 | $title_number=$target_dmid; |
167 | 199 | $title=str_replace(" ","_",$title_name)."_(".$title_number.")"; |
— | — | @@ -168,6 +200,7 @@ |
169 | 201 | mysql_insert_assoc("page",$pagedata); |
170 | 202 | |
171 | 203 | |
| 204 | + |
172 | 205 | echo" |
173 | 206 | <hr> |
174 | 207 | <div align=\"right\"> |