Copy.php
<?
- Get copy-target and summary-text from form
xwGetProperty($properties, 'copy/target', $target); xwGetProperty($properties, 'copy/summary', $summary); xwGetProperty($properties, 'copy/xml', $xml); # move/copy properties too? xwGetProperty($properties, 'copy/talk', $talk); # move/copy talk too? xwGetProperty($properties, 'copy/action', $action);
if ( $target ) { # Do the copy if target defined if ($summary) $summary = " : $summary"; $target = ucfirst(eregi_replace( '[^a-z0-9_]+', '_', $target)); $a = new Article($t = Title::newFromText($target)); if ($t->getArticleID()) xwMessage("Copy failed! \"$target\" already exists!", 'red'); else $a->insertNewArticle($article, "Copied from $title$summary", false, false); } else { # Define the form
$form = "
Rename/copy article:
<form action=\"/wiki/index.php\">
<input type=hidden name=title value=\"$title\"> <input type=hidden name=\"xpath:/properties:data\" value=\"$tTitle\"> <input type=hidden name=\"xpath:/properties:copy\">
New title: | <input type=text name=\"xpath:/properties/copy:target\"> |
Reason: | <input type=text name=\"xpath:/properties/copy:summary\"> |
Action: | <input type=radio name=\"xpath:/properties/copy:action\" value=rename checked>Rename
<input type=radio name=\"xpath:/properties/copy:action\" value=redir>Redirect <input type=radio name=\"xpath:/properties/copy:action\" value=copy>Copy |
<input type=checkbox checked=checked value=1 name=\"xpath:/properties/copy:xml\">
Also apply to properties | |
<input type=checkbox checked=checked value=1 name=\"xpath:/properties/copy:talk\">
Also apply to discussion | |
<input type=submit value=\" Commit \"> | |
, but we use \"rename\" (Also note, that this isn't working yet! :-) Help Rename |
</form>";
# Replace article content with form $article = preg_replace('/(?<=).+(?=)/s',$form,$article); }
?>