xowiki::Page instproc www-duplicate (public)

 <instance of xowiki::Page[i]> www-duplicate

Defined in /var/www/openacs.org/packages/xowiki/tcl/xowiki-www-procs.tcl

This web-callable method duplicated the current object. It uses the same mechanisms as the clipboard-copy operation. After adding elements to the clipboard, redirect either to the return_url of the calling page (as handled by www-clipboard-copy)

Testcases:
No testcase defined.
Source code:
::xowiki::clipboard clear
::xowiki::clipboard add [list ${:item_id}]

if {![regexp {^(.*[-]copy-)\d+} ${:name} . stem]} {
  set stem ${:name}-copy-
}
set new_name [::xowiki::autoname new -name $stem -parent_id ${:package_id}]
set old_name ${:name}

ad_try {
  set :name $new_name
  #
  # Call whatever clipboard-copy is doing....
  #
  :www-clipboard-copy

} finally {
  #
  # Restore the actual object
  #
  set :name $old_name
  #
  # To be on the save side, flush the cache
  #
  ::xo::xotcl_object_cache flush ${:item_id}
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: