Attachment 'NewPage.py'

Download

   1 """ NewPage.py shows a form to create a new wiki page
   2 parameter: pagename_prefix [template page]
   3 
   4 This macro was written by Lars Kruse
   5 
   6 It is licensed under the GPL (v2 or higher) - see http://www.gnu.org/licenses/gpl.html
   7 
   8 """
   9 
  10 Dependencies = [""]
  11 
  12 def execute(macro, args):
  13 
  14 	buttonText = "Create new page"
  15 
  16 	try:
  17 		arg_items = args.split(",")
  18 	except StandardError:
  19 		return 'Macro NewPage: no parameter was defined (expected one or two parameters)!'
  20 
  21 	argnum = len(arg_items)
  22 
  23 	if argnum > 2:
  24 		return "Macro NewPage: invalid number of parameters (" + str(argnum) + ") - should be one or two!"
  25 
  26 	result = '<form href="' + macro.request.script_name + '" method="get">\n'
  27 	result += '<input type="text" name="page" value="' + arg_items[0] + '" size="30" />\n'
  28 	if argnum == 2:
  29 		result += '<input type="hidden" name="template" value="' + arg_items[1] + '" />\n'
  30 	result += '<input type="hidden" name="action" value="edit" />\n'
  31 	result += '<input type="submit" name="' + buttonText + '" value="' + buttonText + '" />\n'
  32 	result += '</form>\n'
  33 	return result

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2005-11-28 02:14:10, 1.0 KB) [[attachment:NewPage.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.