= Provides forms anywhere there is a wiki =
== Description ==
This plugin aims to allow for forms anywhere there is a wiki. This is meant to provide a more flexible version of TracFormsPlugin.
== Bugs/Feature Requests ==
Existing bugs and feature requests for WikiFormsPlugin are
[report:9?COMPONENT=WikiFormsPlugin here].
If you have any issues, create a
[http://trac-hacks.org/newticket?component=WikiFormsPlugin&owner=asic_druide new ticket].
== Download ==
Download the zipped source from [download:wikiformsplugin here].
== Source ==
You can check out WikiFormsPlugin from [http://trac-hacks.org/svn/wikiformsplugin here] using Subversion, or [source:wikiformsplugin browse the source] with Trac.
== Example ==
{{{
Normal wiki formatted stuff...
{{{
#!WikiForms
== Selects ==
|| '''Description''' || '''Example''' || '''Value'''
|| simple select || select:simple_select:1 2 3 4 || value:simple_select
|| labeled select || select:labeled_select:1=l1 2=l2 3=l3 4=l4 || value:labeled_select
|| quoted select || select:quoted_select:'"a"' "'b'" 'c c' || value:quoted_select
|| complex select || select:complex_select:
#
# keep in mind that
# - comments are removed
# - newlines are replaced with '' (empty string)
# prior to parsing. After all those the preformatting the
# fields still have to be separated by whitespace to be distinguishable.
# Further cfg-options are:
# default
# class
# id
value0 # label = value
'v a l u e 1' # label = value, both containing whitespace
value2='l a b e l 2' #
'v a l u e 3'=label3 #
'val ue4'="lab el4"
class=my_css_class
id=my_css_id
default=value2 # this is the cfg option (not an entry for the selector-list)...
: # separator, from now on everything becomes a selector-list entry even if the name matches a cfg-option
|| value:complex_select
== Checkboxes ==
|| '''Description''' || '''Example''' || '''Value'''
|| simple checkbox || checkbox:simple_checkbox || value:simple_checkbox
|| complex checkbox || checkbox:complex_checkbox:
# Further cfg-options are:
# checked : flag ('1','true' 'on' 'yes') used if there is no database entry available...
# value : value stored when checkbox is checked
# class
# id
value=value_if_checked
checked=true
|| value:complex_checkbox
== Inputs ==
|| '''Description''' || '''Example''' || '''Value'''
|| simple input || input:simple_input || value:simple_input
|| complex input || input:complex_input:
# Further cfg-options are:
# value : default value if no database entry is available
# size : width in characters (defaults to 22)
# class
# id
value=" 'foo' "'"bar" 'baz
size=30
|| value:complex_input
== Radios ==
|| '''Description''' || '''Example''' || '''Value'''
|| simple radio || radio:simple_radio:value='beer' [[BR]]radio:simple_radio:value=milk checked=true [[BR]] radio:simple_radio:value=water || value:simple_radio
|| complex radio || radio:complex_radio:
# Further cfg-options are:
# checked : flag ('1','true' 'on' 'yes') used if there is no database entry available...
# value : value stored when this radio is selected
# class
# id
value=dummy1
size=30
[[BR]] radio:complex_radio:
value=dummy2 || value:complex_radio
== Textareas ==
|| '''Description''' || '''Example''' || '''Value'''
|| simple text || textarea:simple_text || value:simple_text
|| complex text || textarea:complex_text:
# Further cfg-options are:
# rows : defaults to 2
# cols : defaults to 10
# value : default value if no database entry is available, defaults to ''
# class
# id
cols=30 rows=5 value='Please fill your
approval
comment
in here' || value:complex_text
== Submit Buttons ==
|| '''Description''' || '''Example'''
|| simple button || submit
|| complex button || submit:
# label : label on the button, defaults to 'Send'
# class
# id
label='Commit'
== Query Stuff ==
# to have a value which is always there...
set:to_be_queried:magic_value
=== Without Formatting ===
|| '''Value''' || value:to_be_queried
|| '''Who''' || who:to_be_queried
|| '''When''' || when:to_be_queried
=== With Formatting ===
|| '''Value''' (in bold) || '''value:to_be_queried'''
|| '''Who''' (underlined) || __who:to_be_queried__
|| '''When''' (in italic) || ''when:to_be_queried''
lastmodified
== Debug Stuff ==
# set an relative field
set:rel_name:rel_value
# set an absolute field
set:/abs_name:abs_value
delete:/abs_name
# dump fields...
dump:.*
}}}
Normal wiki formatted stuff...
}}}
=== New Include Feature ===
Lets assume you have a wiki page named 'sandbox' like this:
{{{
{{{
({{a}})
({{b}})
({{x}})
({{a}})
({{ c }})
({{d}})
}}}
}}}
If you call it like this:
{{{
[[WikiFormInclude(sandbox:a=1 b=2 c=' " ' d='a b c d')]]
}}}
all defined values are replaces and the resulting page is rendered as usual.
=== New Permission Feature ===
Think of an example like this:
|| || admin[[BR]]user || normal[[BR]]user || other[[BR]]user
|| region1 || rw || r || /
|| region2 || rw || / || /
|| region3 || / || / || r
{{{
{{{
#!WikiForms
permission:change: # default access is none
permission:change: +rw : user in admin_user1,admin_user2 # admin user gets additionally read/write access
permission:change: +r : user in user1 , user2 # normal user get additionally read access
permission:alias : region1 # save this as permission for region 1
permission:change: # default access is none
permission:change: +rw : user in admin_user1,admin_user2 # admin user gets read/write access
permission:alias : region2 # save this as permission for region 2
permission:change: r # default access is read
permission:change: -r : user in admin_user1,admin_user2 # admin user should not see default message
permission:change: -r : user in user1 , user2 # normal user should not see default message
permission:alias : region3 # save this as permission for region 3
permission:alias:region1
checkbox:region1 This is region 1 (rw for admin-user, r for normal-user, hidden for others)
permission:alias:region2
checkbox:region2 This is region 2 (rw for admin-user, hidden for normal-user and others)
permission:alias:region3
checkbox:region3 This is region 3 (hidden for admin- and normal-user, r for others)
}}}
}}}
Permissions might be based on the state of a ticket or milestone like this:
{{{
{{{
#!WikiForms
permission:change:rw
permission:change:-w:ticket_state 42 in closed
|| checkbox:approval:checked=true || (read-only if #42 is in closed state)
|| input:comment:value='Please fill in your comment' size=50 || (read-only if #42 is in closed state)
permission:change:rw
permission:change:-w:milestone_is_complete 'my next milestone'
checkbox:approval:checked=true (read-only if milestone is completed)
}}}
}}}
== Recent Changes ==
[[ChangeLog(wikiformsplugin, 3)]]
== Author/Contributors ==
'''Author:''' [wiki:asic_druide] [[BR]]
'''Maintainer:''' [wiki:asic_druide] [[BR]]
'''Contributors:'''