Difference between revisions of "Copy.php"
From Organic Design wiki
m |
(That should do it :-)) |
||
Line 12: | Line 12: | ||
if ( $t->getArticleID() ) xwMessage( "Copy failed! \"$target\" already exists!", 'red' ); | if ( $t->getArticleID() ) xwMessage( "Copy failed! \"$target\" already exists!", 'red' ); | ||
else $a->insertNewArticle( $article, "Copied from [[$title]]$summary", false, false ); | else $a->insertNewArticle( $article, "Copied from [[$title]]$summary", false, false ); | ||
− | |||
} | } | ||
else { | else { | ||
Line 21: | Line 20: | ||
<table border=0> | <table border=0> | ||
<tr><td>New title:<td><input type=text name=\"xpath:/properties/copy:target\"> | <tr><td>New title:<td><input type=text name=\"xpath:/properties/copy:target\"> | ||
− | <tr><td>Summary:<td><input type=text name=\"xpath:/properties/ | + | <tr><td>Summary:<td><input type=text name=\"xpath:/properties/copy:summary\"> |
<tr><td><br><br> | <tr><td><br><br> | ||
<tr><td><input type=submit value=\" Copy \"> | <tr><td><input type=submit value=\" Copy \"> |
Revision as of 09:15, 9 March 2006
<?
- Get article name and content from form
xwGetProperty( $properties, 'copy/target', $target ); xwGetProperty( $properties, 'copy/summary', $summary );
- If both are set, create/edit the article
if ( $target ) { 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 {
$article = "
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\"> |
Summary: | <input type=text name=\"xpath:/properties/copy:summary\"> |
<input type=submit value=\" Copy \"> |
</form>";
}
?>