Difference between revisions of "Copy.php"
(New article-copy feature on the way) |
(Render form if no parameters) |
||
Line 15: | Line 15: | ||
xwMessage( 'Article copied successfully', 'green' ); | xwMessage( 'Article copied successfully', 'green' ); | ||
} | } | ||
− | else | + | else { |
+ | $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\"> | ||
+ | <table border=0> | ||
+ | <tr><td>New title:<td><input type=text name=\"xpath:/properties/copy:target\"> | ||
+ | <tr><td>Summary:<td><input type=text name=\"xpath:/properties/example:summary\"> | ||
+ | <br><br> | ||
+ | <tr><td><input type=submit value=\" Copy \"> | ||
+ | </table></form>"; | ||
+ | } | ||
?> | ?> |
Revision as of 08:50, 9 March 2006
<?
- Get article name and content from form
xwGetProperty( $properties, 'example/target', $target ); xwGetProperty( $properties, 'example/summary', $summary );
- If both are set, create/edit the article
if ( $target ) { if ( $summary ) $summary = ": $summary"; $newTitle = ucfirst( eregi_replace( '[^a-z0-9_]+', '_', $newTitle ) ); $a = new Article( $t = Title::makeTitleSafe( 0, $newTitle ) ); $id = $t->getArticleID(); if ( $id ) xwMessage( "Could not copy article, target \"$target\" already exists!", 'red' ); else $a->insertNewArticle( $article, "Copied from $title$summary", false, false ); xwMessage( 'Article copied successfully', 'green' ); } else { $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\"> |
Summary: | <input type=text name=\"xpath:/properties/example:summary\">
|
<input type=submit value=\" Copy \"> |
</form>";
}
?>