{% if S_AJAX_REQUEST %}
	<form id="acp_portal_modules" method="post" action="{{ U_ACTION }}">
		<fieldset>
			<dl>
				<dt><label for="module_classname" style="display: inline;">{{ lang('CHOOSE_MODULE') }}{{ lang('COLON') }}</label><br /><span>{{ lang('CHOOSE_MODULE_EXP') }}</span></dt>
				<dd><select name="module_classname" id="module_classname">{{ S_MODULE_NAMES }}</select></dd>
			</dl>

			<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') }}" />
				{{ S_FORM_TOKEN }}{{ S_HIDDEN_FIELDS }}
			</p>
		</fieldset>
	</form>

{% else %}
{% INCLUDECSS 'portal/b3p_admin.css' %}
{% INCLUDE 'overall_header.html' %}

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

{% if S_EDIT %}

<h1>{{ lang('ACP_PORTAL_MODULES') }}</h1>
<p>{{ lang('ACP_PORTAL_MODULES_EXP') }}</p>

<form id="acp_portal_modules" method="post" action="{{ B3P_U_ACTION }}">
	<fieldset>
		<dl>
			<dt><label for="module_classname">{{ lang('CHOOSE_MODULE') }}{{ lang('COLON') }}</label><br /><span>{{ lang('CHOOSE_MODULE_EXP') }}</span></dt>
			<dd><select name="module_classname" id="module_classname">{{ S_MODULE_NAMES }}</select></dd>
		</dl>

		<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') }}" />
			{{ S_FORM_TOKEN }}{{ S_HIDDEN_FIELDS }}
		</p>
	</fieldset>
</form>

{% else %}

<h1>{{ lang('ACP_PORTAL_MODULES') }}</h1>
<p>{{ lang('ACP_PORTAL_MODULES_EXP') }}</p>

<form id="acp_portal_modules" method="post" action="{{ B3P_U_ACTION }}" data-ajax="true">
	<fieldset class="tabulated">
	<legend>{{ lang('ACP_PORTAL_MODULES') }}</legend>

	<table class="portal-modules-overview">
		<tr>
			<th style="text-align: center;">{{ lang('MODULE_POS_TOP') }}</th>
		</tr>
		{% for modules_top in loops.modules_top %}
			{% if not modules_top.MODULE_ENABLED %}<tr class="row3">{% elseif modules_top.S_ROW_COUNT is even %}<tr class="row1">{% else %}<tr class="row2">{% endif %}
				<td>
					{{ modules_top.MODULE_IMAGE }} {{ modules_top.MODULE_NAME }}<br />
					<br />
					<span{% if not modules_top.S_FIRST_ROW %} style="display: none;"{% endif %}>{{ ICON_MOVE_UP_DISABLED }}&nbsp;</span>
					<span{% if modules_top.S_FIRST_ROW %} style="display: none;"{% endif %}><a href="{{ modules_top.U_MOVE_UP }}" data-ajax="b3p_move_module_up">{{ ICON_MOVE_UP }}</a>&nbsp;</span>
					<span{% if not modules_top.S_LAST_ROW %} style="display: none;"{% endif %}>{{ ICON_MOVE_DOWN_DISABLED }}&nbsp;</span>
					<span{% if modules_top.S_LAST_ROW %} style="display: none;"{% endif %}><a href="{{ modules_top.U_MOVE_DOWN }}" data-ajax="b3p_move_module_down">{{ ICON_MOVE_DOWN }}</a>&nbsp;</span>
					<a href="{{ modules_top.U_EDIT }}">{{ ICON_EDIT }}</a> <a href="{{ modules_top.U_DELETE }}" data-ajax="b3p_delete_module">{{ ICON_DELETE }}</a>
				</td>
			</tr>
		{% else %}
			<tr>
				<td class="row1" style="text-align: center;">{{ lang('NO_MODULES') }}</td>
			</tr>
		{% endfor %}
	</table>
	<p class="quick">
		<input class="button2" name="add[top]" type="submit" value="{{ lang('ADD_MODULE') }}" />
	</p>

	<table style="background-color: transparent; border: none; padding: 0px; margin: 0px;">
		<tr style="vertical-align: top;">
				<td style="width: 20%; font-size: 100%; line-height: 100%; padding: 0px; margin: 0px;">
	<table class="portal-modules-overview">
		<tr>
				<th>{{ lang('MODULE_POS_LEFT') }}</th>
		</tr>
		{% for modules_left in loops.modules_left %}
			{% if not modules_left.MODULE_ENABLED %}<tr class="row3">{% elseif modules_left.S_ROW_COUNT is even %}<tr class="row1">{% else %}<tr class="row2">{% endif %}
				<td>
					{{ modules_left.MODULE_IMAGE }} {{ modules_left.MODULE_NAME }}<br />
					<br />
					<span{% if not modules_left.S_FIRST_ROW %} style="display: none;"{% endif %}>{{ ICON_MOVE_UP_DISABLED }}&nbsp;</span>
					<span{% if modules_left.S_FIRST_ROW %} style="display: none;"{% endif %}><a href="{{ modules_left.U_MOVE_UP }}" data-ajax="b3p_move_module_up">{{ ICON_MOVE_UP }}</a>&nbsp;</span>
					{% if modules_left.U_MOVE_RIGHT %}<a href="{{ modules_left.U_MOVE_RIGHT }}">{% if S_CONTENT_DIRECTION eq 'rtl' %}{{ ICON_MOVE_LEFT }}{% else %}{{ ICON_MOVE_RIGHT }}{% endif %}</a>{% else %}{% if S_CONTENT_DIRECTION eq 'rtl' %}{{ ICON_MOVE_LEFT_DISABLED }}{% else %}{{ ICON_MOVE_RIGHT_DISABLED }}{% endif %}{% endif %}&nbsp;
					<a href="{{ modules_left.U_EDIT }}">{{ ICON_EDIT }}</a> <a href="{{ modules_left.U_DELETE }}" data-ajax="b3p_delete_module">{{ ICON_DELETE }}</a><br />
					{% if S_CONTENT_DIRECTION eq 'rtl' %}{{ ICON_MOVE_RIGHT_DISABLED }}{% else %}{{ ICON_MOVE_LEFT_DISABLED }}{% endif %}&nbsp;
					<span{% if not modules_left.S_LAST_ROW %} style="display: none;"{% endif %}>{{ ICON_MOVE_DOWN_DISABLED }}&nbsp;</span>
					<span{% if modules_left.S_LAST_ROW %} style="display: none;"{% endif %}><a href="{{ modules_left.U_MOVE_DOWN }}" data-ajax="b3p_move_module_down">{{ ICON_MOVE_DOWN }}</a></span>
				</td>
			</tr>
		{% else %}
			<tr>
				<td class="row1" style="text-align: center;">{{ lang('NO_MODULES') }}</td>
			</tr>
		{% endfor %}
	</table>
	<p class="quick">
		<input class="button2" name="add[left]" type="submit" value="{{ lang('ADD_MODULE') }}" />
	</p>
				</td>
				<td style="font-size: 100%; line-height: 100%; padding: 0 12px;">
	<table class="portal-modules-overview">
		<tr>
				<th style="text-align: center;">{{ lang('MODULE_POS_CENTER') }}</th>
		</tr>
		{% for modules_center in loops.modules_center %}
			{% if not modules_center.MODULE_ENABLED %}<tr class="row3">{% elseif modules_center.S_ROW_COUNT is even %}<tr class="row1">{% else %}<tr class="row2">{% endif %}
				<td>
					{{ modules_center.MODULE_IMAGE }} {{ modules_center.MODULE_NAME }}<br />
					<br />
					<span{% if not modules_center.S_FIRST_ROW %} style="display: none;"{% endif %}>{{ ICON_MOVE_UP_DISABLED }}&nbsp;</span>
					<span{% if modules_center.S_FIRST_ROW %} style="display: none;"{% endif %}><a href="{{ modules_center.U_MOVE_UP }}" data-ajax="b3p_move_module_up">{{ ICON_MOVE_UP }}</a>&nbsp;</span>
					{% if modules_center.U_MOVE_RIGHT %}<a href="{{ modules_center.U_MOVE_RIGHT }}">{{ ICON_MOVE_RIGHT }}</a>{% else %}{{ ICON_MOVE_RIGHT_DISABLED }}{% endif %}&nbsp;
					<a href="{{ modules_center.U_EDIT }}">{{ ICON_EDIT }}</a> <a href="{{ modules_center.U_DELETE }}" data-ajax="b3p_delete_module">{{ ICON_DELETE }}</a><br />
					{% if modules_center.U_MOVE_LEFT %}<a href="{{ modules_center.U_MOVE_LEFT }}">{{ ICON_MOVE_LEFT }}</a>{% else %}{{ ICON_MOVE_LEFT_DISABLED }}{% endif %}&nbsp;
					<span{% if not modules_center.S_LAST_ROW %} style="display: none;"{% endif %}>{{ ICON_MOVE_DOWN_DISABLED }}&nbsp;</span>
					<span{% if modules_center.S_LAST_ROW %} style="display: none;"{% endif %}><a href="{{ modules_center.U_MOVE_DOWN }}" data-ajax="b3p_move_module_down">{{ ICON_MOVE_DOWN }}</a></span>
				</td>
			</tr>
		{% else %}
			<tr>
				<td class="row1" style="text-align: center;">{{ lang('NO_MODULES') }}</td>
			</tr>
		{% endfor %}
	</table>
	<p class="quick">
		<input class="button2" name="add[center]" type="submit" value="{{ lang('ADD_MODULE') }}" />
	</p>
				</td>
				<td style="width: 20%; font-size: 100%; line-height: 100%; padding: 0px;">
	<table class="portal-modules-overview">
		<tr>
				<th>{{ lang('MODULE_POS_RIGHT') }}</th>
		</tr>
		{% for modules_right in loops.modules_right %}
			{% if not modules_right.MODULE_ENABLED %}<tr class="row3">{% elseif modules_right.S_ROW_COUNT is even %}<tr class="row1">{% else %}<tr class="row2">{% endif %}
				<td>
					{{ modules_right.MODULE_IMAGE }} {{ modules_right.MODULE_NAME }}<br />
					<br />
					<span{% if not modules_right.S_FIRST_ROW %} style="display: none;"{% endif %}>{{ ICON_MOVE_UP_DISABLED }}&nbsp;</span>
					<span{% if modules_right.S_FIRST_ROW %} style="display: none;"{% endif %}><a href="{{ modules_right.U_MOVE_UP }}" data-ajax="b3p_move_module_up">{{ ICON_MOVE_UP }}</a>&nbsp;</span>
					{% if S_CONTENT_DIRECTION eq 'rtl' %}{{ ICON_MOVE_LEFT_DISABLED }}{% else %}{{ ICON_MOVE_RIGHT_DISABLED }}{% endif %}&nbsp;
					<a href="{{ modules_right.U_EDIT }}">{{ ICON_EDIT }}</a> <a href="{{ modules_right.U_DELETE }}" data-ajax="b3p_delete_module">{{ ICON_DELETE }}</a><br />
					{% if modules_right.U_MOVE_LEFT %}<a href="{{ modules_right.U_MOVE_LEFT }}">{% if S_CONTENT_DIRECTION eq 'rtl' %}{{ ICON_MOVE_RIGHT }}{% else %}{{ ICON_MOVE_LEFT }}{% endif %}</a>{% else %}{% if S_CONTENT_DIRECTION eq 'rtl' %}{{ ICON_MOVE_RIGHT_DISABLED }}{% else %}{{ ICON_MOVE_LEFT_DISABLED }}{% endif %}{% endif %}&nbsp;
					<span{% if not modules_right.S_LAST_ROW %} style="display: none;"{% endif %}>{{ ICON_MOVE_DOWN_DISABLED }}&nbsp;</span>
					<span{% if modules_right.S_LAST_ROW %} style="display: none;"{% endif %}><a href="{{ modules_right.U_MOVE_DOWN }}" data-ajax="b3p_move_module_down">{{ ICON_MOVE_DOWN }}</a></span>
				</td>
			</tr>
		{% else %}
			<tr>
				<td class="row1" style="text-align: center;">{{ lang('NO_MODULES') }}</td>
			</tr>
		{% endfor %}
	</table>
	<p class="quick">
		<input class="button2" name="add[right]" type="submit" value="{{ lang('ADD_MODULE') }}" />
	</p>
				</td>
		</tr>
	</table>
	<br />

	<table class="portal-modules-overview">
		<tr>
			<th style="text-align: center;">{{ lang('MODULE_POS_BOTTOM') }}</th>
		</tr>
		{% for modules_bottom in loops.modules_bottom %}
			{% if not modules_bottom.MODULE_ENABLED %}<tr class="row3">{% elseif modules_bottom.S_ROW_COUNT is even %}<tr class="row1">{% else %}<tr class="row2">{% endif %}
				<td>
					{{ modules_bottom.MODULE_IMAGE }} {{ modules_bottom.MODULE_NAME }}<br />
					<br />
					<span{% if not modules_bottom.S_FIRST_ROW %} style="display: none;"{% endif %}>{{ ICON_MOVE_UP_DISABLED }}&nbsp;</span>
					<span{% if modules_bottom.S_FIRST_ROW %} style="display: none;"{% endif %}><a href="{{ modules_bottom.U_MOVE_UP }}" data-ajax="b3p_move_module_up">{{ ICON_MOVE_UP }}</a>&nbsp;</span>
					<span{% if not modules_bottom.S_LAST_ROW %} style="display: none;"{% endif %}>{{ ICON_MOVE_DOWN_DISABLED }}&nbsp;</span>
					<span{% if modules_bottom.S_LAST_ROW %} style="display: none;"{% endif %}><a href="{{ modules_bottom.U_MOVE_DOWN }}" data-ajax="b3p_move_module_down">{{ ICON_MOVE_DOWN }}</a>&nbsp;</span>
					<a href="{{ modules_bottom.U_EDIT }}">{{ ICON_EDIT }}</a> <a href="{{ modules_bottom.U_DELETE }}" data-ajax="b3p_delete_module">{{ ICON_DELETE }}</a>
				</td>
			</tr>
		{% else %}
			<tr>
				<td class="row1" style="text-align: center;">{{ lang('NO_MODULES') }}</td>
			</tr>
		{% endfor %}
	</table>
	<p class="quick">
		<input class="button2" name="add[bottom]" type="submit" value="{{ lang('ADD_MODULE') }}" />
	</p>

	{{ S_FORM_TOKEN }}
	</fieldset>
</form>

{% endif %}

{% INCLUDEJS 'portal/ajax.js' %}

{% INCLUDE 'overall_footer.html' %}
{% endif %}