{% INCLUDE 'overall_header.html' %}

<a name="maincontent"></a>

<h1>{{ lang('TITLE') }}</h1>

<p>{{ lang('TITLE_EXPLAIN') }}</p>

{% if S_ERROR %}
	<div class="errorbox">
		<h3>{{ lang('WARNING') }}</h3>
		<p>{{ ERROR_MSG }}</p>
	</div>
{% endif %}

{% if S_EDIT %}
	<form id="acp_portal_links" method="post" action="{{ B3P_U_ACTION }}">

	<fieldset>
		<legend>{{ lang('ACP_PORTAL_LINKS') }}</legend>
	<dl>
		<dt><label for="link_title">{{ lang('ACP_PORTAL_LINK_TITLE') }}{{ lang('COLON') }}</label></dt>
		<dd><input name="link_title" type="text" id="link_title" value="{{ LINK_TITLE }}" maxlength="255" /></dd>
	</dl>
	<dl>
		<dt>
			<label for="link_type">{{ lang('ACP_PORTAL_LINK_TYPE') }}{{ lang('COLON') }}</label><br />
			<span>{{ lang('ACP_PORTAL_LINK_TYPE_EXP') }}</span>
		</dt>
		<dd>
			<label><input type="radio" class="radio" name="link_type" value="1" id="link_type"{% if S_LINK_IS_INT %} checked="checked"{% endif %} />{{ lang('ACP_PORTAL_LINK_INT') }}</label>
			<label><input type="radio" class="radio" name="link_type" value="2"{% if not S_LINK_IS_INT %} checked="checked"{% endif %} /> {{ lang('ACP_PORTAL_LINK_EXT') }}</label>
		</dd>
	</dl>
	<dl>
		<dt>
			<label for="link_url">{{ lang('ACP_PORTAL_LINK_URL') }}{{ lang('COLON') }}</label><br />
			<span>{{ lang('ACP_PORTAL_LINK_URL_EXP') }}</span>
		</dt>
		<dd><input name="link_url" type="text" id="link_url" value="{{ LINK_URL }}" maxlength="255" /></dd>
	</dl>
	<dl>
		<dt>
			<label for="permission-setting-link">{{ lang('ACP_PORTAL_LINK_PERMISSION') }}{{ lang('COLON') }}</label><br />
			<span>{{ lang('ACP_PORTAL_LINK_PERMISSION_EXP') }}</span>
		</dt>
		<dd>
			<select id="permission-setting-link" size="10" multiple="multiple" name="permission-setting-link[]">
				{% for permission_setting_link in loops.permission_setting_link %}
				<option value="{{ permission_setting_link.GROUP_ID }}"{% if permission_setting_link.SELECTED %}selected="selected"{% endif %}>{{ permission_setting_link.GROUP_NAME }}</option>
				{% endfor %}
			</select>
		</dd>
	</dl>
	<p class="submit-buttons">
		<input type="hidden" name="action" value="save" />
		{% if LINK_ID !== '' %}<input type="hidden" name="id" value="{{ LINK_ID }}" />{% endif %}

		<input class="button1" type="submit" id="submit" name="submit" value="{{ lang('SUBMIT') }}" />&nbsp;
		<input class="button2" type="reset" id="reset" name="reset" value="{{ lang('RESET') }}" />
		{{ S_FORM_TOKEN }}
	</p>
	</fieldset>
	</form>

{% else %}
	<form id="acp_portal_links" method="post" action="{{ B3P_U_ACTION }}">
	{% if SHOW_MODULE_OPTIONS %}
	<fieldset>
		<legend>{{ lang('MODULE_OPTIONS') }}</legend>
		<dl>
			<dt><label for="module_name">{{ lang('MODULE_NAME') }}{{ lang('COLON') }}</label><br /><span>{{ lang('MODULE_NAME_EXP') }}</span></dt>
			<dd><input id="module_name" type="text" value="{{ MODULE_NAME }}" name="module_name" maxlength="255" size="64" /></dd>
		</dl>
		{% if MODULE_SHOW_IMAGE %}
		<dl>
			<dt><label for="module_image">{{ lang('MODULE_IMAGE') }}{{ lang('COLON') }}</label><br /><span>{{ lang('MODULE_IMAGE_EXP') }}</span></dt>
			<dd><input id="module_image" type="text" value="{{ MODULE_IMAGE }}" name="module_image" maxlength="255" size="64" /></dd>
			{% if MODULE_IMAGE_SRC %}<dd><img src="{{ MODULE_IMAGE_SRC }}" alt="{{ lang('MODULE_IMAGE') }}" /></dd>{% endif %}
		</dl>
		{% if MODULE_IMAGE_SRC %}
		<dl>
			<dt><label for="module_img_width">{{ lang('MODULE_IMAGE_WIDTH') }}{{ lang('COLON') }}</label><br /><span>{{ lang('MODULE_IMAGE_WIDTH_EXP') }}</span></dt>
			<dd><input id="module_img_width" type="number" value="{{ MODULE_IMAGE_WIDTH }}" name="module_img_width" min="1" />&nbsp;{{ lang('PIXEL') }}</dd>
		</dl>
		<dl>
			<dt><label for="module_img_height">{{ lang('MODULE_IMAGE_HEIGHT') }}{{ lang('COLON') }}</label><br /><span>{{ lang('MODULE_IMAGE_HEIGHT_EXP') }}</span></dt>
			<dd><input id="module_img_height" type="number" value="{{ MODULE_IMAGE_HEIGHT }}" name="module_img_height" min="1" />&nbsp;{{ lang('PIXEL') }}</dd>
		</dl>
		{% endif %}
		<dl>
			<dt><label for="module_fa">{{ lang('MODULE_FA') }}{{ lang('COLON') }}</label><br/><span>{{ lang('MODULE_FA_EXP') }}</span></dt>
			<dd><input id="module_fa" type="text" value="{{ MODULE_FA }}" name="module_fa" maxlength="255" size="64"/></dd>
		</dl>
		<dl>
			<dt><label for="module_fa_size">{{ lang('MODULE_FA_SIZE') }}{{ lang('COLON') }}</label><br/><span>{{ lang('MODULE_FA_SIZE_EXP') }}</span></dt>
			<dd><input id="module_fa_size" type="number" value="{{ MODULE_FA_SIZE }}" name="module_fa_size" min="1"/>&nbsp;{{ lang('PIXEL') }}</dd>
		</dl>
		{% endif %}
		<dl>
			<dt><label for="module_reset">{{ lang('MODULE_RESET') }}{{ lang('COLON') }}</label><br /><span style="color: #BC2A4D;">{{ lang('MODULE_RESET_EXP') }}</span></dt>
			<dd><input id="module_reset" type="checkbox" value="1" name="module_reset" /></dd>
		</dl>
		<dl>
			<dt><label for="module_status">{{ lang('MODULE_STATUS') }}{{ lang('COLON') }}</label></dt>
			<dd>
				<label><input type="radio" class="radio" name="module_status" value="1" id="module_status"{% if MODULE_ENABLED %} checked="checked"{% endif %} />{{ lang('YES') }}</label>
				<label><input type="radio" class="radio" name="module_status" value="0"{% if not MODULE_ENABLED %} checked="checked"{% endif %} /> {{ lang('NO') }}</label>
			</dd>
		</dl>
		{% if loops.permission_setting|length %}
		<dl>
			<dt><label for="permission-setting">{{ lang('MODULE_PERMISSIONS') }}{{ lang('COLON') }}</label><br /><span>{{ lang('MODULE_PERMISSIONS_EXP') }}</span></dt>
			<dd>
				<select id="permission-setting" size="10" multiple="multiple" name="permission-setting[]">
					{% for permission_setting in loops.permission_setting %}
					<option value="{{ permission_setting.GROUP_ID }}"{% if permission_setting.SELECTED %}selected="selected"{% endif %}>{{ permission_setting.GROUP_NAME }}</option>
					{% endfor %}
				</select>
			</dd>
		</dl>
		{% endif %}
	</fieldset>
	{% endif %}	
{% for options in loops.options %}
	{% if options.S_LEGEND %}
		{% if not options.S_FIRST_ROW %}
			</fieldset>
		{% endif %}
		<fieldset>
			<legend>{{ options.LEGEND }}</legend>
	{% else %}

		<dl>
			<dt><label for="{{ options.KEY }}">{{ options.TITLE }}{{ lang('COLON') }}</label>{% if options.S_EXPLAIN %}<br /><span>{{ options.TITLE_EXPLAIN }}</span>{% endif %}</dt>
			<dd>{{ options.CONTENT }}</dd>
		</dl>

	{% endif %}
{% else %}
	<fieldset>
{% endfor %}
	<fieldset class="tabulated">
	<legend>{{ lang('ACP_PORTAL_LINKS') }}</legend>

	<p class="quick">
		<input class="button2" name="add" type="submit" value="{{ lang('ACP_PORTAL_LINK_ADD') }}" />
	</p>

	<table style="cellspacing: 1;">
	<thead>
	<tr>
		<th>{{ lang('ACP_PORTAL_LINK_TITLE') }}</th>
		<th>{{ lang('ACP_PORTAL_LINK_URL') }}</th>
		<th>{{ lang('ACTION') }}</th>
	</tr>
	</thead>
	<tbody>
	{% for links in loops.links %}
		{% if links.S_ROW_COUNT is even %}<tr class="row1">{% else %}<tr class="row2">{% endif %}
		<td style="text-align: center;"{% if links.S_LINK_IS_CAT %} class="row3" colspan="2"{% endif %}>{{ links.LINK_TITLE }}</td>
		{% if not links.S_LINK_IS_CAT %}<td style="text-align: center;">{{ links.LINK_URL }}</td>{% endif %}
		<td style="text-align: center;">
			{% if links.S_FIRST_ROW %}{{ ICON_MOVE_UP_DISABLED }}{% else %}<a href="{{ links.U_MOVE_UP }}">{{ ICON_MOVE_UP }}</a>{% endif %}&nbsp;
			{% if links.S_LAST_ROW %}{{ ICON_MOVE_DOWN_DISABLED }}{% else %}<a href="{{ links.U_MOVE_DOWN }}">{{ ICON_MOVE_DOWN }}</a>{% endif %}&nbsp;
			<a href="{{ links.U_EDIT }}">{{ ICON_EDIT }}</a> <a href="{{ links.U_DELETE }}">{{ ICON_DELETE }}</a>
		</td>
	</tr>
	{% else %}
	<tr class="row1">
		<td style="text-align: center;" colspan="3">{{ lang('LINKS_NO_LINKS') }}</td>
	</tr>
	{% endfor %}
	</tbody>
	</table>
	<p class="submit-buttons">
		<input class="button1" type="submit" id="submit" name="submit" value="{{ lang('SUBMIT') }}" />&nbsp;
		<input class="button2" type="reset" id="reset" name="reset" value="{{ lang('RESET') }}" />
	</p>
	{{ S_FORM_TOKEN }}
	</fieldset>
	</fieldset>
	</form>

{% endif %}

{% INCLUDE 'overall_footer.html' %}