Merge pull request #238 from marc1706/ticket/102
[ticket/102] Ajaxify certain actions in the ACP
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -6,3 +6,4 @@ travis/ export-ignore
|
|||||||
.travis.yml export-ignore
|
.travis.yml export-ignore
|
||||||
phpunit.xml.* export-ignore
|
phpunit.xml.* export-ignore
|
||||||
README.md export-ignore
|
README.md export-ignore
|
||||||
|
git-tools/ export-ignore
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ class portal_module
|
|||||||
'S_ERROR' => (sizeof($error)) ? true : false,
|
'S_ERROR' => (sizeof($error)) ? true : false,
|
||||||
'ERROR_MSG' => implode('<br />', $error),
|
'ERROR_MSG' => implode('<br />', $error),
|
||||||
|
|
||||||
'U_ACTION' => $this->u_action . (($module_id) ? '&module_id=' . $module_id : ''),
|
'B3P_U_ACTION' => $this->get_module_link('config', $module_id),
|
||||||
'B3P_ACP_ROOT' => $this->root_path,
|
'B3P_ACP_ROOT' => $this->root_path,
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -671,7 +671,7 @@ class portal_module
|
|||||||
'MODULE_IMAGE' => ($row['module_image_src']) ? '<img src="' . $this->root_path . 'styles/' . $this->user->style['style_path'] . '/theme/images/portal/' . $row['module_image_src'] . '" alt="' . $row['module_name'] . '" />' : '',
|
'MODULE_IMAGE' => ($row['module_image_src']) ? '<img src="' . $this->root_path . 'styles/' . $this->user->style['style_path'] . '/theme/images/portal/' . $row['module_image_src'] . '" alt="' . $row['module_name'] . '" />' : '',
|
||||||
'MODULE_ENABLED' => ($row['module_status']) ? true : false,
|
'MODULE_ENABLED' => ($row['module_status']) ? true : false,
|
||||||
|
|
||||||
'U_DELETE' => $this->u_action . '&module_id=' . $row['module_id'] . '&module_classname=' . $row['module_classname'] . '&action=delete',
|
'U_DELETE' => $this->get_module_link('modules', $row['module_id']) . '&action=delete&module_classname=' . $row['module_classname'],
|
||||||
'U_EDIT' => $this->get_module_link('config', $row['module_id']),
|
'U_EDIT' => $this->get_module_link('config', $row['module_id']),
|
||||||
'U_MOVE_UP' => $this->u_action . '&module_id=' . $row['module_id'] . '&action=move_up',
|
'U_MOVE_UP' => $this->u_action . '&module_id=' . $row['module_id'] . '&action=move_up',
|
||||||
'U_MOVE_DOWN' => $this->u_action . '&module_id=' . $row['module_id'] . '&action=move_down',
|
'U_MOVE_DOWN' => $this->u_action . '&module_id=' . $row['module_id'] . '&action=move_down',
|
||||||
@@ -841,6 +841,12 @@ class portal_module
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->cache->destroy('portal_modules');
|
$this->cache->destroy('portal_modules');
|
||||||
|
|
||||||
|
if ($this->request->is_ajax())
|
||||||
|
{
|
||||||
|
$json_response = new \phpbb\json_response;
|
||||||
|
$json_response->send(array('success' => true));
|
||||||
|
}
|
||||||
redirect($this->u_action); // redirect in order to get rid of excessive URL parameters
|
redirect($this->u_action); // redirect in order to get rid of excessive URL parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,6 +880,7 @@ class portal_module
|
|||||||
*/
|
*/
|
||||||
public function move_module_up($module_id)
|
public function move_module_up($module_id)
|
||||||
{
|
{
|
||||||
|
$updated = false;
|
||||||
$module_data = $this->get_move_module_data($module_id);
|
$module_data = $this->get_move_module_data($module_id);
|
||||||
|
|
||||||
if (($module_data !== false) && ($module_data['module_order'] > 1))
|
if (($module_data !== false) && ($module_data['module_order'] > 1))
|
||||||
@@ -904,6 +911,7 @@ class portal_module
|
|||||||
*/
|
*/
|
||||||
public function move_module_down($module_id)
|
public function move_module_down($module_id)
|
||||||
{
|
{
|
||||||
|
$updated = false;
|
||||||
$module_data = $this->get_move_module_data($module_id);
|
$module_data = $this->get_move_module_data($module_id);
|
||||||
|
|
||||||
if ($module_data !== false && $this->get_last_module_order($module_data['module_column']) != $module_data['module_order'])
|
if ($module_data !== false && $this->get_last_module_order($module_data['module_column']) != $module_data['module_order'])
|
||||||
@@ -1159,6 +1167,15 @@ class portal_module
|
|||||||
|
|
||||||
$this->cache->purge(); // make sure we don't get errors after re-adding a module
|
$this->cache->purge(); // make sure we don't get errors after re-adding a module
|
||||||
|
|
||||||
|
if ($this->request->is_ajax())
|
||||||
|
{
|
||||||
|
$json_response = new \phpbb\json_response;
|
||||||
|
$json_response->send(array(
|
||||||
|
'success' => true,
|
||||||
|
'MESSAGE_TITLE' => $this->user->lang['INFORMATION'],
|
||||||
|
'MESSAGE_TEXT' => $this->user->lang['SUCCESS_DELETE'],
|
||||||
|
));
|
||||||
|
}
|
||||||
trigger_error($this->user->lang['SUCCESS_DELETE'] . adm_back_link($this->u_action));
|
trigger_error($this->user->lang['SUCCESS_DELETE'] . adm_back_link($this->u_action));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1191,7 +1208,7 @@ class portal_module
|
|||||||
*/
|
*/
|
||||||
protected function get_module_link($mode, $module_id)
|
protected function get_module_link($mode, $module_id)
|
||||||
{
|
{
|
||||||
return preg_replace(array('/i=[0-9]+/', '/mode=[a-zA-Z0-9_]+/'), array('i=\\' . __CLASS__, 'mode=' . $mode), $this->u_action) . '&module_id=' . $module_id;
|
return preg_replace(array('/i=[0-9]+/', '/mode=[a-zA-Z0-9_]+/'), array('i=%5C' . str_replace('\\', '%5C', __CLASS__), 'mode=' . $mode), $this->u_action) . (($module_id) ? '&module_id=' . $module_id : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -436,4 +436,4 @@ function getCaretPosition(txtarea)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return caretPos;
|
return caretPos;
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<!-- IF S_EDIT -->
|
<!-- IF S_EDIT -->
|
||||||
<form id="acp_portal_links" method="post" action="{U_ACTION}">
|
<form id="acp_portal_links" method="post" action="{B3P_U_ACTION}">
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{L_ACP_PORTAL_EVENTS}</legend>
|
<legend>{L_ACP_PORTAL_EVENTS}</legend>
|
||||||
@@ -43,8 +43,8 @@
|
|||||||
<dl>
|
<dl>
|
||||||
<dt><label for="event_all_day">{L_EVENT_ALL_DAY}:</label></dt>
|
<dt><label for="event_all_day">{L_EVENT_ALL_DAY}:</label></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<label><input onchange="dE('end', -1)" type="radio" class="radio" name="event_all_day" value="1" id="event_all_day"<!-- IF EVENT_ALL_DAY --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
|
<label><input onchange="phpbb.toggleDisplay('end', -1)" type="radio" class="radio" name="event_all_day" value="1" id="event_all_day"<!-- IF EVENT_ALL_DAY --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
|
||||||
<label><input onchange="dE('end', 1)" type="radio" class="radio" name="event_all_day" value="0"<!-- IF not EVENT_ALL_DAY --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
<label><input onchange="phpbb.toggleDisplay('end', 1)" type="radio" class="radio" name="event_all_day" value="0"<!-- IF not EVENT_ALL_DAY --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<div id="end"<!-- IF EVENT_ALL_DAY -->style="display: none;"<!-- ENDIF -->>
|
<div id="end"<!-- IF EVENT_ALL_DAY -->style="display: none;"<!-- ENDIF -->>
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<!-- END mods -->
|
<!-- END mods -->
|
||||||
<form id="acp_portal_config" method="post" action="{U_ACTION}">
|
<form id="acp_portal_config" method="post" action="{B3P_U_ACTION}">
|
||||||
<!-- IF SHOW_MODULE_OPTIONS -->
|
<!-- IF SHOW_MODULE_OPTIONS -->
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{L_MODULE_OPTIONS}</legend>
|
<legend>{L_MODULE_OPTIONS}</legend>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- INCLUDE overall_header.html -->
|
<!-- INCLUDE overall_header.html -->
|
||||||
|
|
||||||
<!-- INCLUDEJS portal/acp_portal.js -->
|
<!-- INCLUDEJS portal/acp_editor.js -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +55,7 @@ var help_line = {
|
|||||||
|
|
||||||
function change_palette()
|
function change_palette()
|
||||||
{
|
{
|
||||||
dE('colour_palette');
|
phpbb.toggleDisplay('colour_palette');
|
||||||
e = document.getElementById('colour_palette');
|
e = document.getElementById('colour_palette');
|
||||||
|
|
||||||
if (e.style.display == 'block')
|
if (e.style.display == 'block')
|
||||||
@@ -83,7 +83,7 @@ function change_palette()
|
|||||||
<p>{ERROR_MSG}</p>
|
<p>{ERROR_MSG}</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<form id="acp_portal_config" method="post" action="{U_ACTION}">
|
<form id="acp_portal_config" method="post" action="{B3P_U_ACTION}">
|
||||||
<!-- IF SHOW_MODULE_OPTIONS -->
|
<!-- IF SHOW_MODULE_OPTIONS -->
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{L_MODULE_OPTIONS}</legend>
|
<legend>{L_MODULE_OPTIONS}</legend>
|
||||||
@@ -209,8 +209,8 @@ function change_palette()
|
|||||||
<span>{L_ACP_PORTAL_CUSTOM_BBCODE_EXP}</span>
|
<span>{L_ACP_PORTAL_CUSTOM_BBCODE_EXP}</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<label><input onchange="dE('bbcode-buttons', 1)" class="radio" type="radio" value="1" name="custom_use_bbcode" id="custom_use_bbcode"<!-- IF CUSTOM_USE_BBCODE --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
|
<label><input onchange="phpbb.toggleDisplay('bbcode-buttons', 1)" class="radio" type="radio" value="1" name="custom_use_bbcode" id="custom_use_bbcode"<!-- IF CUSTOM_USE_BBCODE --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
|
||||||
<label><input onchange="dE('bbcode-buttons', -1)" class="radio" type="radio" value="0" name="custom_use_bbcode"<!-- IF not CUSTOM_USE_BBCODE --> checked="checked"<!-- ENDIF --> />{L_NO}</label>
|
<label><input onchange="phpbb.toggleDisplay('bbcode-buttons', -1)" class="radio" type="radio" value="0" name="custom_use_bbcode"<!-- IF not CUSTOM_USE_BBCODE --> checked="checked"<!-- ENDIF --> />{L_NO}</label>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<!-- IF S_AUTH -->
|
<!-- IF S_AUTH -->
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<!-- IF S_EDIT -->
|
<!-- IF S_EDIT -->
|
||||||
<form id="acp_portal_links" method="post" action="{U_ACTION}">
|
<form id="acp_portal_links" method="post" action="{B3P_U_ACTION}">
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{L_ACP_PORTAL_LINKS}</legend>
|
<legend>{L_ACP_PORTAL_LINKS}</legend>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<!-- IF S_EDIT -->
|
<!-- IF S_EDIT -->
|
||||||
<form id="acp_portal_links" method="post" action="{U_ACTION}">
|
<form id="acp_portal_links" method="post" action="{B3P_U_ACTION}">
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{L_ACP_PORTAL_MENU_LINK_SETTINGS}</legend>
|
<legend>{L_ACP_PORTAL_MENU_LINK_SETTINGS}</legend>
|
||||||
@@ -24,8 +24,8 @@
|
|||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="link_is_cat">{L_ACP_PORTAL_MENU_IS_CAT}:</label></dt>
|
<dt><label for="link_is_cat">{L_ACP_PORTAL_MENU_IS_CAT}:</label></dt>
|
||||||
<dd><label><input onchange="dE('url', -1)" type="radio" class="radio" name="link_is_cat" value="1" id="link_is_cat"<!-- IF S_LINK_IS_CAT --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
|
<dd><label><input onchange="phpbb.toggleDisplay('url', -1)" type="radio" class="radio" name="link_is_cat" value="1" id="link_is_cat"<!-- IF S_LINK_IS_CAT --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
|
||||||
<label><input onchange="dE('url', 1)" type="radio" class="radio" name="link_is_cat" value="0"<!-- IF not S_LINK_IS_CAT --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
|
<label><input onchange="phpbb.toggleDisplay('url', 1)" type="radio" class="radio" name="link_is_cat" value="0"<!-- IF not S_LINK_IS_CAT --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<div id="url"<!-- IF S_LINK_IS_CAT --> style="display: none;"<!-- ENDIF -->>
|
<div id="url"<!-- IF S_LINK_IS_CAT --> style="display: none;"<!-- ENDIF -->>
|
||||||
<dl>
|
<dl>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
|
<!-- INCLUDECSS portal/b3p_admin.css -->
|
||||||
<!-- INCLUDE overall_header.html -->
|
<!-- INCLUDE overall_header.html -->
|
||||||
|
|
||||||
<a name="maincontent"></a>
|
<a name="maincontent"></a>
|
||||||
@@ -24,7 +25,7 @@
|
|||||||
<h1>{L_ACP_PORTAL_MODULES}</h1>
|
<h1>{L_ACP_PORTAL_MODULES}</h1>
|
||||||
<p>{L_ACP_PORTAL_MODULES_EXP}</p>
|
<p>{L_ACP_PORTAL_MODULES_EXP}</p>
|
||||||
|
|
||||||
<form id="acp_portal_modules" method="post" action="{U_ACTION}">
|
<form id="acp_portal_modules" method="post" action="{B3P_U_ACTION}">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="module_classname">{L_CHOOSE_MODULE}:</label><br /><span>{L_CHOOSE_MODULE_EXP}</span></dt>
|
<dt><label for="module_classname">{L_CHOOSE_MODULE}:</label><br /><span>{L_CHOOSE_MODULE_EXP}</span></dt>
|
||||||
@@ -48,18 +49,20 @@
|
|||||||
<fieldset class="tabulated">
|
<fieldset class="tabulated">
|
||||||
<legend>{L_ACP_PORTAL_MODULES}</legend>
|
<legend>{L_ACP_PORTAL_MODULES}</legend>
|
||||||
|
|
||||||
<table cellspacing="1">
|
<table class="portal-modules-overview">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="text-align: center;" colspan="3">{L_MODULE_POS_TOP}</th>
|
<th style="text-align: center;">{L_MODULE_POS_TOP}</th>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- BEGIN modules_top -->
|
<!-- BEGIN 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 -->
|
<!-- 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 colspan="3">
|
<td>
|
||||||
{modules_top.MODULE_IMAGE} {modules_top.MODULE_NAME}<br />
|
{modules_top.MODULE_IMAGE} {modules_top.MODULE_NAME}<br />
|
||||||
<br />
|
<br />
|
||||||
<!-- IF modules_top.S_FIRST_ROW -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{modules_top.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->
|
<span<!-- IF not modules_top.S_FIRST_ROW --> style="display: none;"<!-- ENDIF -->>{ICON_MOVE_UP_DISABLED} </span>
|
||||||
<!-- IF modules_top.S_LAST_ROW -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{modules_top.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
|
<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> </span>
|
||||||
<a href="{modules_top.U_EDIT}">{ICON_EDIT}</a> <a href="{modules_top.U_DELETE}">{ICON_DELETE}</a>
|
<span<!-- IF not modules_top.S_LAST_ROW --> style="display: none;"<!-- ENDIF -->>{ICON_MOVE_DOWN_DISABLED} </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> </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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- BEGINELSE -->
|
<!-- BEGINELSE -->
|
||||||
@@ -75,7 +78,7 @@
|
|||||||
<table style="background-color: transparent; border: none; padding: 0px; margin: 0px;">
|
<table style="background-color: transparent; border: none; padding: 0px; margin: 0px;">
|
||||||
<tr style="vertical-align: top;">
|
<tr style="vertical-align: top;">
|
||||||
<td style="width: 20%; font-size: 100%; line-height: 100%; padding: 0px; margin: 0px;">
|
<td style="width: 20%; font-size: 100%; line-height: 100%; padding: 0px; margin: 0px;">
|
||||||
<table cellspacing="1">
|
<table class="portal-modules-overview">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{L_MODULE_POS_LEFT}</th>
|
<th>{L_MODULE_POS_LEFT}</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -84,11 +87,13 @@
|
|||||||
<td>
|
<td>
|
||||||
{modules_left.MODULE_IMAGE} {modules_left.MODULE_NAME}<br />
|
{modules_left.MODULE_IMAGE} {modules_left.MODULE_NAME}<br />
|
||||||
<br />
|
<br />
|
||||||
<!-- IF modules_left.S_FIRST_ROW -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{modules_left.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->
|
<span<!-- IF not modules_left.S_FIRST_ROW --> style="display: none;"<!-- ENDIF -->>{ICON_MOVE_UP_DISABLED} </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> </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 -->
|
<!-- 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 -->
|
||||||
<a href="{modules_left.U_EDIT}">{ICON_EDIT}</a> <a href="{modules_left.U_DELETE}">{ICON_DELETE}</a><br />
|
<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 -->
|
<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->{ICON_MOVE_RIGHT_DISABLED}<!-- ELSE -->{ICON_MOVE_LEFT_DISABLED}<!-- ENDIF -->
|
||||||
<!-- IF modules_left.S_LAST_ROW -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{modules_left.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
|
<span<!-- IF not modules_left.S_LAST_ROW --> style="display: none;"<!-- ENDIF -->>{ICON_MOVE_DOWN_DISABLED} </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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- BEGINELSE -->
|
<!-- BEGINELSE -->
|
||||||
@@ -102,7 +107,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td style="font-size: 100%; line-height: 100%; padding: 0 12px;">
|
<td style="font-size: 100%; line-height: 100%; padding: 0 12px;">
|
||||||
<table cellspacing="1">
|
<table class="portal-modules-overview">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="text-align: center;">{L_MODULE_POS_CENTER}</th>
|
<th style="text-align: center;">{L_MODULE_POS_CENTER}</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -111,11 +116,13 @@
|
|||||||
<td>
|
<td>
|
||||||
{modules_center.MODULE_IMAGE} {modules_center.MODULE_NAME}<br />
|
{modules_center.MODULE_IMAGE} {modules_center.MODULE_NAME}<br />
|
||||||
<br />
|
<br />
|
||||||
<!-- IF modules_center.S_FIRST_ROW -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{modules_center.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->
|
<span<!-- IF not modules_center.S_FIRST_ROW --> style="display: none;"<!-- ENDIF -->>{ICON_MOVE_UP_DISABLED} </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> </span>
|
||||||
<!-- IF modules_center.U_MOVE_RIGHT --><a href="{modules_center.U_MOVE_RIGHT}">{ICON_MOVE_RIGHT}</a><!-- ELSE -->{ICON_MOVE_RIGHT_DISABLED}<!-- ENDIF -->
|
<!-- IF modules_center.U_MOVE_RIGHT --><a href="{modules_center.U_MOVE_RIGHT}">{ICON_MOVE_RIGHT}</a><!-- ELSE -->{ICON_MOVE_RIGHT_DISABLED}<!-- ENDIF -->
|
||||||
<a href="{modules_center.U_EDIT}">{ICON_EDIT}</a> <a href="{modules_center.U_DELETE}">{ICON_DELETE}</a><br />
|
<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 -->
|
<!-- IF modules_center.U_MOVE_LEFT --><a href="{modules_center.U_MOVE_LEFT}">{ICON_MOVE_LEFT}</a><!-- ELSE -->{ICON_MOVE_LEFT_DISABLED}<!-- ENDIF -->
|
||||||
<!-- IF modules_center.S_LAST_ROW -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{modules_center.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
|
<span<!-- IF not modules_center.S_LAST_ROW --> style="display: none;"<!-- ENDIF -->>{ICON_MOVE_DOWN_DISABLED} </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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- BEGINELSE -->
|
<!-- BEGINELSE -->
|
||||||
@@ -129,7 +136,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 20%; font-size: 100%; line-height: 100%; padding: 0px;">
|
<td style="width: 20%; font-size: 100%; line-height: 100%; padding: 0px;">
|
||||||
<table cellspacing="1">
|
<table class="portal-modules-overview">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{L_MODULE_POS_RIGHT}</th>
|
<th>{L_MODULE_POS_RIGHT}</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -138,11 +145,13 @@
|
|||||||
<td>
|
<td>
|
||||||
{modules_right.MODULE_IMAGE} {modules_right.MODULE_NAME}<br />
|
{modules_right.MODULE_IMAGE} {modules_right.MODULE_NAME}<br />
|
||||||
<br />
|
<br />
|
||||||
<!-- IF modules_right.S_FIRST_ROW -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{modules_right.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->
|
<span<!-- IF not modules_right.S_FIRST_ROW --> style="display: none;"<!-- ENDIF -->>{ICON_MOVE_UP_DISABLED} </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> </span>
|
||||||
<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->{ICON_MOVE_LEFT_DISABLED}<!-- ELSE -->{ICON_MOVE_RIGHT_DISABLED}<!-- ENDIF -->
|
<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->{ICON_MOVE_LEFT_DISABLED}<!-- ELSE -->{ICON_MOVE_RIGHT_DISABLED}<!-- ENDIF -->
|
||||||
<a href="{modules_right.U_EDIT}">{ICON_EDIT}</a> <a href="{modules_right.U_DELETE}">{ICON_DELETE}</a><br />
|
<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 -->
|
<!-- 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 -->
|
||||||
<!-- IF modules_right.S_LAST_ROW -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{modules_right.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
|
<span<!-- IF not modules_right.S_LAST_ROW --> style="display: none;"<!-- ENDIF -->>{ICON_MOVE_DOWN_DISABLED} </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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- BEGINELSE -->
|
<!-- BEGINELSE -->
|
||||||
@@ -159,18 +168,20 @@
|
|||||||
</table>
|
</table>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<table cellspacing="1">
|
<table class="portal-modules-overview">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="text-align: center;" colspan="3">{L_MODULE_POS_BOTTOM}</th>
|
<th style="text-align: center;">{L_MODULE_POS_BOTTOM}</th>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- BEGIN modules_bottom -->
|
<!-- BEGIN 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 -->
|
<!-- 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 colspan="3">
|
<td>
|
||||||
{modules_bottom.MODULE_IMAGE} {modules_bottom.MODULE_NAME}<br />
|
{modules_bottom.MODULE_IMAGE} {modules_bottom.MODULE_NAME}<br />
|
||||||
<br />
|
<br />
|
||||||
<!-- IF modules_bottom.S_FIRST_ROW -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{modules_bottom.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->
|
<span<!-- IF not modules_bottom.S_FIRST_ROW --> style="display: none;"<!-- ENDIF -->>{ICON_MOVE_UP_DISABLED} </span>
|
||||||
<!-- IF modules_bottom.S_LAST_ROW -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{modules_bottom.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
|
<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> </span>
|
||||||
<a href="{modules_bottom.U_EDIT}">{ICON_EDIT}</a> <a href="{modules_bottom.U_DELETE}">{ICON_DELETE}</a>
|
<span<!-- IF not modules_bottom.S_LAST_ROW --> style="display: none;"<!-- ENDIF -->>{ICON_MOVE_DOWN_DISABLED} </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> </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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- BEGINELSE -->
|
<!-- BEGINELSE -->
|
||||||
@@ -189,5 +200,7 @@
|
|||||||
|
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
|
<!-- INCLUDEJS portal/ajax.js -->
|
||||||
|
|
||||||
<!-- INCLUDE overall_footer.html -->
|
<!-- INCLUDE overall_footer.html -->
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- INCLUDE overall_header.html -->
|
<!-- INCLUDE overall_header.html -->
|
||||||
|
|
||||||
<!-- INCLUDEJS portal/acp_portal.js -->
|
<!-- INCLUDEJS portal/acp_editor.js -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +55,7 @@ var help_line = {
|
|||||||
|
|
||||||
function change_palette()
|
function change_palette()
|
||||||
{
|
{
|
||||||
dE('colour_palette');
|
phpbb.toggleDisplay('colour_palette');
|
||||||
e = document.getElementById('colour_palette');
|
e = document.getElementById('colour_palette');
|
||||||
|
|
||||||
if (e.style.display == 'block')
|
if (e.style.display == 'block')
|
||||||
@@ -83,7 +83,7 @@ function change_palette()
|
|||||||
<p>{ERROR_MSG}</p>
|
<p>{ERROR_MSG}</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<form id="acp_portal_config" method="post" action="{U_ACTION}">
|
<form id="acp_portal_config" method="post" action="{B3P_U_ACTION}">
|
||||||
<!-- IF SHOW_MODULE_OPTIONS -->
|
<!-- IF SHOW_MODULE_OPTIONS -->
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{L_MODULE_OPTIONS}</legend>
|
<legend>{L_MODULE_OPTIONS}</legend>
|
||||||
@@ -145,7 +145,7 @@ function change_palette()
|
|||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{L_PORTAL_WELCOME}</legend>
|
<legend>{L_PORTAL_WELCOME}</legend>
|
||||||
<dl>
|
<dl><dt style="display: none;"></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<div id="colour_palette" style="display: none;">
|
<div id="colour_palette" style="display: none;">
|
||||||
<dl style="clear: left;">
|
<dl style="clear: left;">
|
||||||
|
|||||||
99
adm/style/portal/ajax.js
Normal file
99
adm/style/portal/ajax.js
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
(function($) { // Avoid conflicts with other libraries
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The following callbacks are for reording items. row_down
|
||||||
|
* is triggered when an item is moved down, and row_up is triggered when
|
||||||
|
* an item is moved up. It moves the row up or down, and deactivates /
|
||||||
|
* activates any up / down icons that require it (the ones at the top or bottom).
|
||||||
|
*/
|
||||||
|
phpbb.addAjaxCallback('b3p_move_module_up', function(res) {
|
||||||
|
if (typeof res.success === 'undefined' || !res.success) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var el = $(this).parents('tr:first'),
|
||||||
|
trSwap = el.prev(),
|
||||||
|
elClass = trSwap.attr('class'),
|
||||||
|
trSwapClass = el.attr('class');
|
||||||
|
|
||||||
|
el.insertBefore(trSwap);
|
||||||
|
el.attr('class', elClass);
|
||||||
|
trSwap.attr('class', trSwapClass);
|
||||||
|
|
||||||
|
// Swap images if swap element is first row
|
||||||
|
var swapIsFirstRow = trSwap.find('img[src*="icon_up_disabled"]').parents('span:first').is(':visible');
|
||||||
|
|
||||||
|
if (swapIsFirstRow) {
|
||||||
|
trSwap.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
|
||||||
|
trSwap.find('img[src*="icon_up."]').parents('span:first').toggle();
|
||||||
|
el.find('img[src*="icon_up."]').parents('span:first').toggle();
|
||||||
|
el.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Swap images if move element is last row
|
||||||
|
var elIsLastRow = el.find('img[src*="icon_down_disabled"]').parents('span:first').is(':visible');
|
||||||
|
|
||||||
|
if (elIsLastRow) {
|
||||||
|
trSwap.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
|
||||||
|
trSwap.find('img[src*="icon_down."]').parents('span:first').toggle();
|
||||||
|
el.find('img[src*="icon_down."]').parents('span:first').toggle();
|
||||||
|
el.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
phpbb.addAjaxCallback('b3p_move_module_down', function(res) {
|
||||||
|
if (typeof res.success === 'undefined' || !res.success) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var el = $(this).parents('tr:first'),
|
||||||
|
trSwap = el.next(),
|
||||||
|
elClass = trSwap.attr('class'),
|
||||||
|
trSwapClass = el.attr('class');
|
||||||
|
|
||||||
|
el.insertAfter(trSwap);
|
||||||
|
el.attr('class', elClass);
|
||||||
|
trSwap.attr('class', trSwapClass);
|
||||||
|
|
||||||
|
// Swap images if swap element is last row
|
||||||
|
var swapIsLastRow = trSwap.find('img[src*="icon_down_disabled"]').parents('span:first').is(':visible');
|
||||||
|
|
||||||
|
if (swapIsLastRow) {
|
||||||
|
trSwap.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
|
||||||
|
trSwap.find('img[src*="icon_down."]').parents('span:first').toggle();
|
||||||
|
el.find('img[src*="icon_down."]').parents('span:first').toggle();
|
||||||
|
el.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Swap images if move element is first row
|
||||||
|
var elIsFirstRow = el.find('img[src*="icon_up_disabled"]').parents('span:first').is(':visible');
|
||||||
|
|
||||||
|
if (elIsFirstRow) {
|
||||||
|
trSwap.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
|
||||||
|
trSwap.find('img[src*="icon_up."]').parents('span:first').toggle();
|
||||||
|
el.find('img[src*="icon_up."]').parents('span:first').toggle();
|
||||||
|
el.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
phpbb.addAjaxCallback('b3p_delete_module', function(res) {
|
||||||
|
if (typeof res.success === 'undefined' || !res.success) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var el = $(this).parents('tr:first'),
|
||||||
|
nextEl = el.next();
|
||||||
|
|
||||||
|
el.remove();
|
||||||
|
|
||||||
|
// Fix classes of next elements
|
||||||
|
while (nextEl !== undefined && nextEl.is('tr')) {
|
||||||
|
var nextElClass = (nextEl.attr('class') === 'row1') ? 'row2' : 'row1';
|
||||||
|
nextEl.attr('class', nextElClass);
|
||||||
|
nextEl = nextEl.next();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
})(jQuery); // Avoid conflicts with other libraries
|
||||||
10
adm/style/portal/b3p_admin.css
Normal file
10
adm/style/portal/b3p_admin.css
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/* Board3 Portal 2.1 Admin Style Sheet
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
Copyright 2014 board3 Group ( http://www.board3.de/ )
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
.portal-modules-overview {
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 1px;
|
||||||
|
}
|
||||||
342
git-tools/hooks/commit-msg
Executable file
342
git-tools/hooks/commit-msg
Executable file
@@ -0,0 +1,342 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# A hook to check for correct syntax similar to phpBB3 commit messages per:
|
||||||
|
# * <http://wiki.phpbb.com/display/DEV/Git>
|
||||||
|
# * <http://area51.phpbb.com/phpBB/viewtopic.php?p=209919#p209919>
|
||||||
|
#
|
||||||
|
# This is a commit-msg hook.
|
||||||
|
#
|
||||||
|
# To install this you can either copy or symlink it to
|
||||||
|
# $GIT_DIR/hooks
|
||||||
|
|
||||||
|
config_ns="b3p.hooks.commit-msg";
|
||||||
|
|
||||||
|
if [ "$(git config --bool $config_ns.fatal)" = "true" ]
|
||||||
|
then
|
||||||
|
fatal=1;
|
||||||
|
severity=Error;
|
||||||
|
else
|
||||||
|
fatal=0;
|
||||||
|
severity=Warning;
|
||||||
|
fi
|
||||||
|
|
||||||
|
debug_level=$(git config --int $config_ns.debug || echo 0);
|
||||||
|
|
||||||
|
# Error codes
|
||||||
|
ERR_LENGTH=1;
|
||||||
|
ERR_HEADER=2;
|
||||||
|
ERR_EMPTY=3;
|
||||||
|
ERR_DESCRIPTION=4;
|
||||||
|
ERR_FOOTER=5;
|
||||||
|
ERR_EOF=6;
|
||||||
|
ERR_UNKNOWN=42;
|
||||||
|
|
||||||
|
debug()
|
||||||
|
{
|
||||||
|
local level;
|
||||||
|
|
||||||
|
level=$1;
|
||||||
|
shift;
|
||||||
|
|
||||||
|
if [ $debug_level -ge $level ]
|
||||||
|
then
|
||||||
|
echo $@;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
quit()
|
||||||
|
{
|
||||||
|
if [ $1 -eq 0 ] || [ $1 -eq $ERR_UNKNOWN ]
|
||||||
|
then
|
||||||
|
# success
|
||||||
|
exit 0;
|
||||||
|
elif [ $fatal -eq 0 ]
|
||||||
|
then
|
||||||
|
# problems found but fatal is false
|
||||||
|
complain 'Please run `git commit --amend` and fix the problems mentioned.' 1>&2
|
||||||
|
exit 0;
|
||||||
|
else
|
||||||
|
complain "Aborting commit." 1>&2
|
||||||
|
exit $1;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
use_color()
|
||||||
|
{
|
||||||
|
if [ -z "$use_color_cached" ]
|
||||||
|
then
|
||||||
|
case $(git config --bool $config_ns.color)
|
||||||
|
in
|
||||||
|
false)
|
||||||
|
use_color_cached=1
|
||||||
|
;;
|
||||||
|
true)
|
||||||
|
use_color_cached=0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# tty detection in shell:
|
||||||
|
# http://hwi.ath.cx/jsh/list/shext/isatty.sh.html
|
||||||
|
tty 0>/dev/stdout >/dev/null 2>&1
|
||||||
|
use_color_cached=$?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
# return value is the flag inverted -
|
||||||
|
# if return value is 0, this means use color
|
||||||
|
return $use_color_cached
|
||||||
|
}
|
||||||
|
|
||||||
|
complain()
|
||||||
|
{
|
||||||
|
if use_color
|
||||||
|
then
|
||||||
|
# Careful: our argument may include arguments to echo like -n
|
||||||
|
# ANSI color codes:
|
||||||
|
# http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html
|
||||||
|
printf "\033[31m\033[1m"
|
||||||
|
if [ "$1" = "-n" ]
|
||||||
|
then
|
||||||
|
echo "$@"
|
||||||
|
printf "\033[0m"
|
||||||
|
else
|
||||||
|
# This will print one trailing space.
|
||||||
|
# Not sure how to avoid this at the moment.
|
||||||
|
echo "$@" $(printf "\033[0m")
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check for empty commit message
|
||||||
|
if ! grep -qv '^#' "$1"
|
||||||
|
then
|
||||||
|
# Commit message is empty (or contains only comments).
|
||||||
|
# Let git handle this.
|
||||||
|
# It will abort with a message like so:
|
||||||
|
#
|
||||||
|
# Aborting commit due to empty commit message.
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg=$(grep -v '^#' "$1" |grep -nE '.{81,}')
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
complain "The following lines are greater than 80 characters long:" >&2;
|
||||||
|
complain >&2
|
||||||
|
complain "$msg" >&2;
|
||||||
|
|
||||||
|
quit $ERR_LENGTH;
|
||||||
|
fi
|
||||||
|
|
||||||
|
lines=$(wc -l "$1" | awk '{ print $1; }');
|
||||||
|
expecting=header;
|
||||||
|
in_description=0;
|
||||||
|
in_empty=0;
|
||||||
|
ticket=0;
|
||||||
|
branch_regex="[a-z]+[a-z0-9-]*[a-z0-9]+";
|
||||||
|
i=1;
|
||||||
|
tickets="";
|
||||||
|
|
||||||
|
while [ $i -le $lines ]
|
||||||
|
do
|
||||||
|
# Grab the line we are studying
|
||||||
|
line=$(head -n$i "$1" | tail -n1);
|
||||||
|
|
||||||
|
debug 1 "==> [$i] $line (description: $in_description, empty: $in_empty)";
|
||||||
|
|
||||||
|
err=$ERR_UNKNOWN;
|
||||||
|
|
||||||
|
if [ -z "$expecting" ]
|
||||||
|
then
|
||||||
|
quit $err;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${expecting#comment}" = "$expecting" ]
|
||||||
|
then
|
||||||
|
# Prefix comments to the expected tokens list
|
||||||
|
expecting="comment $expecting";
|
||||||
|
fi
|
||||||
|
|
||||||
|
debug 2 "Expecting: $expecting";
|
||||||
|
|
||||||
|
# Loop over each of the expected line formats
|
||||||
|
for expect in $expecting
|
||||||
|
do
|
||||||
|
# Reset the error code each iteration
|
||||||
|
err=$ERR_UNKNOWN;
|
||||||
|
|
||||||
|
# Test for validity of each line format
|
||||||
|
# This is done first so $? contains the result
|
||||||
|
case $expect in
|
||||||
|
"header")
|
||||||
|
err=$ERR_HEADER;
|
||||||
|
echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] .+$"
|
||||||
|
result=$?
|
||||||
|
if ! echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] [A-Z].+$"
|
||||||
|
then
|
||||||
|
# Don't be too strict.
|
||||||
|
# Commits may be temporary, intended to be squashed later.
|
||||||
|
# Just issue a warning here.
|
||||||
|
complain "$severity: heading should be a sentence beginning with a capital letter." 1>&2
|
||||||
|
complain "You entered:" 1>&2
|
||||||
|
complain "$line" 1>&2
|
||||||
|
fi
|
||||||
|
# restore exit code
|
||||||
|
(exit $result)
|
||||||
|
;;
|
||||||
|
"empty")
|
||||||
|
err=$ERR_EMPTY;
|
||||||
|
echo "$line" | grep -Eq "^$"
|
||||||
|
;;
|
||||||
|
"description")
|
||||||
|
err=$ERR_DESCRIPTION;
|
||||||
|
# Free flow text, the line length was constrained by the initial check
|
||||||
|
echo "$line" | grep -Eq "^.+$";
|
||||||
|
;;
|
||||||
|
"footer")
|
||||||
|
err=$ERR_FOOTER;
|
||||||
|
# Each ticket is on its own line
|
||||||
|
echo "$line" | grep -Eq "^B3P-[0-9]+$";
|
||||||
|
;;
|
||||||
|
"eof")
|
||||||
|
err=$ERR_EOF;
|
||||||
|
# Should not end up here
|
||||||
|
false
|
||||||
|
;;
|
||||||
|
"possibly-eof")
|
||||||
|
# Allow empty and/or comment lines at the end
|
||||||
|
! tail -n +"$i" "$1" |grep -qvE '^($|#)'
|
||||||
|
;;
|
||||||
|
"comment")
|
||||||
|
echo "$line" | grep -Eq "^#";
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
complain "Unrecognised token $expect" >&2;
|
||||||
|
quit $err;
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Preserve the result of the line check
|
||||||
|
result=$?;
|
||||||
|
|
||||||
|
debug 2 "$expect - '$line' - $result";
|
||||||
|
|
||||||
|
if [ $result -eq 0 ]
|
||||||
|
then
|
||||||
|
# Break out the loop on success
|
||||||
|
# otherwise roll on round and keep looking for a match
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $result -eq 0 ]
|
||||||
|
then
|
||||||
|
# Have we switched out of description mode?
|
||||||
|
if [ $in_description -eq 1 ] && [ "$expect" != "description" ] && [ "$expect" != "empty" ] && [ "$expect" != "comment" ]
|
||||||
|
then
|
||||||
|
# Yes, okay we need to backtrace one line and reanalyse
|
||||||
|
in_description=0;
|
||||||
|
i=$(( $i - $in_empty ));
|
||||||
|
|
||||||
|
# Reset the empty counter
|
||||||
|
in_empty=0;
|
||||||
|
continue;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Successful match, but on which line format
|
||||||
|
case $expect in
|
||||||
|
"header")
|
||||||
|
expecting="empty";
|
||||||
|
|
||||||
|
echo "$line" | grep -Eq "^\[ticket/[0-9]+\]$" && (
|
||||||
|
ticket=$(echo "$line" | sed 's,\[ticket/\([0-9]*\)\].*,\1,');
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
"empty")
|
||||||
|
# Description might have empty lines as spacing
|
||||||
|
expecting="footer description";
|
||||||
|
in_empty=$(($in_empty + 1));
|
||||||
|
|
||||||
|
if [ $in_description -eq 1 ]
|
||||||
|
then
|
||||||
|
expecting="$expecting empty";
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"description")
|
||||||
|
expecting="description empty";
|
||||||
|
in_description=1;
|
||||||
|
;;
|
||||||
|
"footer")
|
||||||
|
expecting="footer possibly-eof";
|
||||||
|
if [ "$tickets" = "" ]
|
||||||
|
then
|
||||||
|
tickets="$line";
|
||||||
|
else
|
||||||
|
tickets="$tickets $line";
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"comment")
|
||||||
|
# Comments should expect the same thing again
|
||||||
|
;;
|
||||||
|
"possibly-eof")
|
||||||
|
expecting="eof";
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
complain "Unrecognised token $expect" >&2;
|
||||||
|
quit 254;
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "$expect" != "empty" ]
|
||||||
|
then
|
||||||
|
in_empty=0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
debug 3 "Now expecting: $expecting";
|
||||||
|
else
|
||||||
|
# None of the expected line formats matched
|
||||||
|
# Guess we'll call it a day here then
|
||||||
|
complain "Syntax error on line $i:" >&2;
|
||||||
|
complain ">> $line" >&2;
|
||||||
|
complain -n "Expecting: " >&2;
|
||||||
|
complain "$expecting" | sed 's/ /, /g' >&2;
|
||||||
|
quit $err;
|
||||||
|
fi
|
||||||
|
|
||||||
|
i=$(( $i + 1 ));
|
||||||
|
done
|
||||||
|
|
||||||
|
# If EOF is expected exit cleanly
|
||||||
|
echo "$expecting" | grep -q "eof" || (
|
||||||
|
# Unexpected EOF, error
|
||||||
|
complain "Unexpected EOF encountered" >&2;
|
||||||
|
quit $ERR_EOF;
|
||||||
|
) && (
|
||||||
|
# Do post scan checks
|
||||||
|
if [ ! -z "$tickets" ]
|
||||||
|
then
|
||||||
|
# Check for duplicate tickets
|
||||||
|
dupes=$(echo "$tickets" | sed 's/ /\n/g' | sort | uniq -d);
|
||||||
|
|
||||||
|
if [ ! -z "$dupes" ]
|
||||||
|
then
|
||||||
|
complain "The following tickets are repeated:" >&2;
|
||||||
|
complain "$dupes" | sed 's/ /\n/g;s/^/* /g' >&2;
|
||||||
|
quit $ERR_FOOTER;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Check the branch ticket is mentioned, doesn't make sense otherwise
|
||||||
|
if [ $ticket -gt 0 ]
|
||||||
|
then
|
||||||
|
echo "$tickets" | grep -Eq "\bB3P-$ticket\b" || (
|
||||||
|
complain "Ticket ID [$ticket] of branch missing from list of tickets:" >&2;
|
||||||
|
complain "$tickets" | sed 's/ /\n/g;s/^/* /g' >&2;
|
||||||
|
quit $ERR_FOOTER;
|
||||||
|
) || exit $?;
|
||||||
|
fi
|
||||||
|
# Got here okay exit to reality
|
||||||
|
exit 0;
|
||||||
|
);
|
||||||
|
exit $?;
|
||||||
88
git-tools/hooks/pre-commit
Executable file
88
git-tools/hooks/pre-commit
Executable file
@@ -0,0 +1,88 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# A hook to disallow php syntax errors to be committed
|
||||||
|
# by running php -l (lint) on them. It requires php-cli
|
||||||
|
# to be installed.
|
||||||
|
#
|
||||||
|
# This is a pre-commit hook.
|
||||||
|
#
|
||||||
|
# To install this you can either copy or symlink it to
|
||||||
|
# $GIT_DIR/hooks, example:
|
||||||
|
#
|
||||||
|
# ln -s ../../git-tools/hooks/pre-commit \\
|
||||||
|
# .git/hooks/pre-commit
|
||||||
|
|
||||||
|
if [ -z "$PHP_BIN" ]
|
||||||
|
then
|
||||||
|
PHP_BIN=php
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(echo -e test)" = test ]
|
||||||
|
then
|
||||||
|
echo_e="echo -e"
|
||||||
|
else
|
||||||
|
echo_e="echo"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# necessary check for initial commit
|
||||||
|
if git rev-parse --verify HEAD >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
against=HEAD
|
||||||
|
else
|
||||||
|
# Initial commit: diff against an empty tree object
|
||||||
|
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||||||
|
fi
|
||||||
|
|
||||||
|
errors=""
|
||||||
|
if ! which "$PHP_BIN" >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
echo "PHP Syntax check failed:"
|
||||||
|
echo "PHP binary does not exist or is not in path: $PHP_BIN"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# dash does not support $'\n':
|
||||||
|
# http://forum.soft32.com/linux2/Bug-409179-DASH-Settings-IFS-work-properly-ftopict70039.html
|
||||||
|
IFS='
|
||||||
|
'
|
||||||
|
# get a list of staged files
|
||||||
|
for line in $(git diff-index --cached --full-index $against)
|
||||||
|
do
|
||||||
|
# split needed values
|
||||||
|
sha=$(echo $line | cut -d' ' -f4)
|
||||||
|
temp=$(echo $line | cut -d' ' -f5)
|
||||||
|
status=$(echo $temp | cut -d' ' -f1)
|
||||||
|
filename=$(echo $temp | cut -d' ' -f2)
|
||||||
|
|
||||||
|
# file extension
|
||||||
|
ext=$(echo $filename | sed 's/^.*\.//')
|
||||||
|
|
||||||
|
# only check files with php extension
|
||||||
|
if [ $ext != "php" ]
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# do not check deleted files
|
||||||
|
if [ $status = "D" ]
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check the staged file content for syntax errors
|
||||||
|
# using php -l (lint)
|
||||||
|
result=$(git cat-file -p $sha | "$PHP_BIN" -n -l -ddisplay_errors\=1 -derror_reporting\=E_ALL -dlog_errrors\=0 2>&1)
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
# Swap back in correct filenames
|
||||||
|
errors=$(echo "$errors"; echo "$result" | grep ':' | sed -e "s@in - on@in $filename on@g")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset IFS
|
||||||
|
|
||||||
|
if [ -n "$errors" ]
|
||||||
|
then
|
||||||
|
echo "PHP Syntax check failed: "
|
||||||
|
$echo_e "$errors"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
42
git-tools/hooks/prepare-commit-msg
Executable file
42
git-tools/hooks/prepare-commit-msg
Executable file
@@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# A hook to add [$branch] to the beginning of a commit message
|
||||||
|
# if certain conditions are met.
|
||||||
|
#
|
||||||
|
# This is a prepare-commit-msg hook.
|
||||||
|
#
|
||||||
|
# To install this you can either copy or symlink it to
|
||||||
|
# $GIT_DIR/hooks, example:
|
||||||
|
#
|
||||||
|
# ln -s ../../git-tools/hooks/prepare-commit-msg \\
|
||||||
|
# .git/hooks/prepare-commit-msg
|
||||||
|
|
||||||
|
# get branch name
|
||||||
|
branch="$(git symbolic-ref HEAD)"
|
||||||
|
|
||||||
|
# exit if no branch name is present
|
||||||
|
# (eg. detached HEAD)
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# strip off refs/heads/
|
||||||
|
branch="$(echo "$branch" | sed "s/refs\/heads\///g")"
|
||||||
|
|
||||||
|
# add [branchname] to commit message
|
||||||
|
# * only run when normal commit is made (without -m or -F;
|
||||||
|
# not a merge, etc.)
|
||||||
|
# * also make sure the branch name begins with bug/ or feature/
|
||||||
|
if [ "$2" = "" ]
|
||||||
|
then
|
||||||
|
tail="";
|
||||||
|
|
||||||
|
# Branch is prefixed with 'ticket/', append ticket ID to message
|
||||||
|
if [ "$branch" != "${branch##ticket/}" ];
|
||||||
|
then
|
||||||
|
tail="$(printf "\n\nB3P-${branch##ticket/}")";
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[$branch] $tail$(cat "$1")" > "$1"
|
||||||
|
fi
|
||||||
@@ -297,7 +297,7 @@ class main_menu extends module_base
|
|||||||
|
|
||||||
$links = $this->utf_unserialize($portal_config['board3_menu_array_' . $module_id]);
|
$links = $this->utf_unserialize($portal_config['board3_menu_array_' . $module_id]);
|
||||||
|
|
||||||
$u_action = append_sid('index.' . $this->php_ext, 'i=\board3\portal\modules\portal&mode=config&module_id=' . $module_id);
|
$u_action = append_sid('index.' . $this->php_ext, 'i=%5Cboard3%5Cportal%5Cacp%5Cportal_module&mode=config&module_id=' . $module_id);
|
||||||
|
|
||||||
switch ($action)
|
switch ($action)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,11 +15,13 @@ require_once(dirname(__FILE__) . '/../../acp/portal_module.php');
|
|||||||
class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\database_test_case
|
class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\database_test_case
|
||||||
{
|
{
|
||||||
static public $redirected = false;
|
static public $redirected = false;
|
||||||
|
static public $error = false;
|
||||||
|
static public $override_trigger_error = false;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
global $db, $cache, $phpbb_root_path, $phpEx, $user, $phpbb_container, $template;
|
global $db, $cache, $phpbb_root_path, $phpEx, $user, $phpbb_container, $request, $template;
|
||||||
$user = new \board3\portal\tests\mock\user();
|
$user = new \board3\portal\tests\mock\user();
|
||||||
$phpbb_container = new \phpbb_mock_container_builder();
|
$phpbb_container = new \phpbb_mock_container_builder();
|
||||||
// Mock version check
|
// Mock version check
|
||||||
@@ -55,6 +57,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
|||||||
'UNABLE_TO_MOVE' => 'UNABLE_TO_MOVE',
|
'UNABLE_TO_MOVE' => 'UNABLE_TO_MOVE',
|
||||||
'UNABLE_TO_MOVE_ROW' => 'UNABLE_TO_MOVE_ROW',
|
'UNABLE_TO_MOVE_ROW' => 'UNABLE_TO_MOVE_ROW',
|
||||||
));
|
));
|
||||||
|
$request = new \phpbb_mock_request;
|
||||||
$this->portal_module = new \board3\portal\acp\portal_module();
|
$this->portal_module = new \board3\portal\acp\portal_module();
|
||||||
$this->update_portal_modules();
|
$this->update_portal_modules();
|
||||||
}
|
}
|
||||||
@@ -283,3 +286,12 @@ function adm_back_link($url)
|
|||||||
{
|
{
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function trigger_error($input, $type = E_USER_NOTICE)
|
||||||
|
{
|
||||||
|
if (!phpbb_acp_move_module_test::$override_trigger_error)
|
||||||
|
{
|
||||||
|
\trigger_error($input, $type);
|
||||||
|
}
|
||||||
|
phpbb_acp_move_module_test::$error = $input;
|
||||||
|
}
|
||||||
|
|||||||
@@ -34,6 +34,45 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor
|
|||||||
*/
|
*/
|
||||||
public function test_acp_pages($mode)
|
public function test_acp_pages($mode)
|
||||||
{
|
{
|
||||||
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=' . $mode . '&sid=' . $this->sid);
|
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=' . $mode . '&sid=' . $this->sid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_move_first_module_up()
|
||||||
|
{
|
||||||
|
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=modules&sid=' . $this->sid);
|
||||||
|
$module_link = $crawler->filter('table')->eq(3)->filter('tr')->eq(1)->filter('a')->eq(0)->attr('href');
|
||||||
|
preg_match('/module_id=(?:([0-9]{1,3}))/', $module_link, $output);
|
||||||
|
$this->assertNotEmpty($output[1]);
|
||||||
|
$module_id = $output[1];
|
||||||
|
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=modules&module_id=' . $module_id . '&action=move_up&sid=' . $this->sid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_move_last_module_down()
|
||||||
|
{
|
||||||
|
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=modules&sid=' . $this->sid);
|
||||||
|
$module_link = $crawler->filter('table')->eq(3)->filter('tr')->last()->filter('a')->eq(0)->attr('href');
|
||||||
|
preg_match('/module_id=(?:([0-9]{1,3}))/', $module_link, $output);
|
||||||
|
$this->assertNotEmpty($output[1]);
|
||||||
|
$module_id = $output[1];
|
||||||
|
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=modules&module_id=' . $module_id . '&action=move_down&sid=' . $this->sid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_delete_module()
|
||||||
|
{
|
||||||
|
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=modules&sid=' . $this->sid);
|
||||||
|
$module_link = str_replace(array('./../', '%5C'), array('', '\\'), $crawler->filter('table')->eq(3)->filter('tr')->last()->filter('a')->eq(3)->attr('href'));
|
||||||
|
$crawler = self::request('GET', $module_link);
|
||||||
|
preg_match('/module_classname=(?:([a-z0-9\\\_]+))/', $module_link, $module_name);
|
||||||
|
$module_name = $module_name[1];
|
||||||
|
$this->assertContains('Are you sure you wish to delete the module', $crawler->text());
|
||||||
|
$form = $crawler->selectButton('confirm')->form();
|
||||||
|
$crawler = self::submit($form);
|
||||||
|
$this->assertContains('The module was removed successfully.', $crawler->text());
|
||||||
|
|
||||||
|
// Add it back
|
||||||
|
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=modules&add[center]=true&sid=' . $this->sid);
|
||||||
|
$form = $crawler->selectButton('submit')->form();
|
||||||
|
$form->setValues(array('module_classname' => $module_name));
|
||||||
|
$crawler = self::submit($form);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,15 @@ class user extends \PHPUnit_Framework_TestCase
|
|||||||
return; // can't support other extensions
|
return; // can't support other extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_array($file))
|
||||||
|
{
|
||||||
|
foreach ($file as $cur_file)
|
||||||
|
{
|
||||||
|
$this->add_lang_ext($ext, $cur_file);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (file_exists(dirname(__FILE__) . '/../../language/en/' . $file . '.php'))
|
if (file_exists(dirname(__FILE__) . '/../../language/en/' . $file . '.php'))
|
||||||
{
|
{
|
||||||
include_once(dirname(__FILE__) . '/../../language/en/' . $file . '.php');
|
include_once(dirname(__FILE__) . '/../../language/en/' . $file . '.php');
|
||||||
|
|||||||
Reference in New Issue
Block a user