Difference between revisions of "Copy.php"

From Organic Design wiki
(But don't use it yet!)
m
Line 26: Line 26:
 
<tr><td align=right>New title:<td><input type=text name=\"xpath:/properties/copy:target\">
 
<tr><td align=right>New title:<td><input type=text name=\"xpath:/properties/copy:target\">
 
<tr><td align=right>Reason:<td><input type=text name=\"xpath:/properties/copy:summary\">
 
<tr><td align=right>Reason:<td><input type=text name=\"xpath:/properties/copy:summary\">
 +
<tr><td align=right>Action:
 +
<td><input type=radio name=\"xpath:/properties/copy:action\" value=move checked>Move
 +
&nbsp;&nbsp;<input type=radio name=\"xpath:/properties/copy:action\" value=alias>Alias
 +
&nbsp;&nbsp;<input type=radio name=\"xpath:/properties/copy:action\" value=copy>Copy
 
<tr><td><td><input type=checkbox checked=checked value=1 name=\"xpath:/properties/copy:xml\">
 
<tr><td><td><input type=checkbox checked=checked value=1 name=\"xpath:/properties/copy:xml\">
 
&nbsp;Also move/copy properties
 
&nbsp;Also move/copy properties
 
<tr><td><td><input type=checkbox checked=checked value=1 name=\"xpath:/properties/copy:talk\">
 
<tr><td><td><input type=checkbox checked=checked value=1 name=\"xpath:/properties/copy:talk\">
 
&nbsp;Also move discussion
 
&nbsp;Also move discussion
<tr><td align=right>Action:
 
<td><input type=radio name=\"xpath:/properties/copy:action\" value=move checked>Move
 
&nbsp;&nbsp;<input type=radio name=\"xpath:/properties/copy:action\" value=alias>Alias
 
&nbsp;&nbsp;<input type=radio name=\"xpath:/properties/copy:action\" value=copy>Copy
 
 
<tr><td><td><input type=submit value=\"  Commit  \">
 
<tr><td><td><input type=submit value=\"  Commit  \">
 
<tr><td colspan=2><br><br><i>Note, \"alias\" is the default MediaWiki action, but we use \"move\"<br>(Also note, that this isn't working yet! :-)</i>
 
<tr><td colspan=2><br><br><i>Note, \"alias\" is the default MediaWiki action, but we use \"move\"<br>(Also note, that this isn't working yet! :-)</i>

Revision as of 08:41, 10 March 2006

<?

  1. Get copy-target and summary-text from form

xwGetProperty( $properties, 'copy/target', $target ); xwGetProperty( $properties, 'copy/summary', $summary ); xwGetProperty( $properties, 'copy/xml', $xml ); xwGetProperty( $properties, 'copy/talk', $talk ); xwGetProperty( $properties, 'copy/action', $cmd ); xwGetProperty( $properties, 'copy/redir', $redir );

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 { # No target defined, render the copy form

$article = "

Move/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=move checked>Move

  <input type=radio name=\"xpath:/properties/copy:action\" value=alias>Alias   <input type=radio name=\"xpath:/properties/copy:action\" value=copy>Copy

<input type=checkbox checked=checked value=1 name=\"xpath:/properties/copy:xml\">

 Also move/copy properties

<input type=checkbox checked=checked value=1 name=\"xpath:/properties/copy:talk\">

 Also move discussion

<input type=submit value=\" Commit \">


Note, \"alias\" is the default MediaWiki action, but we use \"move\"
(Also note, that this isn't working yet! :-)

</form>";

}

?>