<!-- BEGIN admin/user/function/default.tt -->
  [% META title = 'Admin &raquo; User Functions' -%]

  [% PROCESS admin/user_nav.tt page = 'user_function' %]

    [% # PROCESS dumper.tt dump = errors %]

    [% user_functions_dfv_js %]

	<h2 align="center">User Functions</h2>

    [% IF dfv_errors %]
        <p class="error">[% c.cfg('msg').dfv_errors %]</p>
    [% END %]
	
	[% IF any_point # no point registering new functions - hard-coded in user_can() function %]
	<!--
    <p class="title">
		<a href="javascript:toggleview_arrow('new','togglenew')" id='togglenew' class="image">
			<img alt="" src="/images/open.gif" class="menu" /></a> Add new entry
	</p>

	<div class="[% dfv_errors ? 'visible' : 'itemhidden' %]" id="new">

    <form method="post" action="[% app_url %]/admin/user_function/update"
        [% user_functions_onsubmit %] name="user_function" id="user_function">
		<div class="indent">
		<table>
			<tr>
				<td class="label">Function name:</td>
				<td class="content">
                    [% PROCESS site/ajax_input.tt field = 'function_name' %]
					[% error_function_name %]
				</td>
			</tr>
			<tr>
				<td class="label">Description:</td>
				<td class="content">
                    [% PROCESS site/ajax_input.tt field = 'function_detail' size = 30 %]
					[% error_function_detail %]
				</td>
			</tr>
			<tr>
				<td class="label">Active:</td>
				<td class="content">
					<select name="active" [% site.html.onfocus %]>
					[% FOREACH option IN ['yes', 'no'] %]
					 <option value="[% option %]">[% option %]</option>
					[% END %]
					</select>                        						
					[% error_active %]
					</td>
			</tr>
        </table>

        <p class="indent">[% site.html.submit %]</p>
        </div>
    </form>
    </div>

    <p class="spacer">&nbsp;</p>
	-->
	[% END %]

    [% IF functions.size %]
	<table>
        <tr>
            <th></th>
            <th>Function name</th>
            <th>Description</th>
            <th>Active</th>
        </tr>

        [% FOREACH item IN functions %]
        <tr>
            <td>[% loop.count %]</td>
            <td>
                <input type="text" size="30" name="[% item.id %]" value="[% item.function_name %]"
                    [% site.html.disabled %] />
            </td>
            <td>
                <input type="text" size="50" name="[% item.id %]" value="[% item.function_detail %]"
                    [% site.html.disabled %] />
            </td>
			<td>
				<select name="active" [% site.html.disabled %]>
				[% FOREACH option IN ['yes', 'no'] %]
					 <option value="[% option %]" [% 'selected' IF option == item.active %]>
						[% option %]
					</option>
				[% END %]
				</select>
			</td>
            <td align="center">
					<a href="[% app_url %]/admin/user_function/edit/[% item.id %]">Edit</a>
			</td>
         </tr>
        [% END %]
    </table>
    [% END %]
<!-- END admin/user/function/default.tt -->
