Skip to content

Commit

Permalink
Added abitily to sort installed mods in acp
Browse files Browse the repository at this point in the history
  • Loading branch information
pertneer committed Oct 11, 2012
1 parent 22e637a commit faffda4
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 14 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -3,4 +3,6 @@
# ignore eclipse directories
.project
.settings
.cache
.cache
# ignore backup files
*.bak
24 changes: 17 additions & 7 deletions root/adm/style/acp_mods.html
Expand Up @@ -17,49 +17,59 @@ <h1>{L_ACP_MODS}</h1>
<p>{L_MODS_EXPLAIN}</p>

<table cellspacing="1">
<col class="row1" /><col class="row2" /><col class="row2" />
<col class="row1" /><col class="row2" /><col class="row2" /><col class="row2" />
<thead>
<tr>
<th>{L_NAME}</th>
<th>{L_OPTIONS}</th>
<th>{L_ACTIONS}</th>
<th>{L_INSTALL_DATE}</th>
</tr>
</thead>
<tbody>
<tr>
<td class="row3" colspan="3"><strong>{L_INSTALLED_MODS}</strong></td>
<td class="row3" colspan="4"><strong>{L_INSTALLED_MODS}</strong></td>
</tr>
<!-- IF not .installed -->
<tr>
<td class="row1" colspan="3" style="text-align: center;">{L_NO_INSTALLED_MODS}</td>
<td class="row1" colspan="4" style="text-align: center;">{L_NO_INSTALLED_MODS}</td>
</tr>
<!-- ENDIF -->
<!-- BEGIN installed -->
<tr>
<td><strong>{installed.MOD_NAME}</strong></td>
<td style="text-align: center;"><a href="{installed.U_DETAILS}">{L_DETAILS}</a></td>
<td style="text-align: center;"><a href="{installed.U_UNINSTALL}">{L_UNINSTALL}</a></td>
<td style="text-align: center;"><p>{installed.MOD_TIME}</p></td>
</tr>
<!-- END installed -->
<tr>
<td class="row3" colspan="3"><strong>{L_UNINSTALLED_MODS}</strong></td>
<td class="row3" colspan="4"><strong>{L_UNINSTALLED_MODS}</strong></td>
</tr>
<!-- IF not .uninstalled -->
<tr>
<td class="row1" colspan="3" style="text-align: center;">{L_NO_UNINSTALLED_MODS}</td>
<td class="row1" colspan="4" style="text-align: center;">{L_NO_UNINSTALLED_MODS}</td>
</tr>
<!-- ENDIF -->
<!-- BEGIN uninstalled -->
<tr>
<td><strong>{uninstalled.MOD_NAME}</strong></td>
<td style="text-align: center;"><a href="{uninstalled.U_DETAILS}">{L_DETAILS}</a></td>
<td style="text-align: center;"><a href="{uninstalled.U_INSTALL}">{L_INSTALL}</a>&nbsp;|&nbsp;<a href="{uninstalled.U_DELETE}">{L_DELETE}</a></td>
<td style="text-align: center;"></td>
</tr>
<!-- END uninstalled -->
</tbody>
</table>

<!-- IF S_MOD_UPLOAD -->
<!-- IF .installed -->

<form action="{U_SORT_ACTION}" method="post" id="list">
<fieldset class="display-options">
{L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR}
<input class="button2" value="{L_GO}" name="sort" type="submit">
</fieldset></form>
<!-- ENDIF -->
<!-- IF S_MOD_UPLOAD -->
<br />

<form action="{U_UPLOAD}" method="post" id="mod_upload"{S_FORM_ENCTYPE}>
Expand Down
33 changes: 27 additions & 6 deletions root/includes/acp/acp_mods.php
Expand Up @@ -27,6 +27,8 @@ class acp_mods
var $mods_dir = '';
var $edited_root = '';
var $backup_root = '';
var $sort_key = '';
var $sort_dir = '';

function main($id, $mode)
{
Expand All @@ -52,7 +54,12 @@ function main($id, $mode)
$mod_id = request_var('mod_id', 0);
$mod_url = request_var('mod_url', '');
$parent = request_var('parent', 0);


//sort keys
$sort_key = request_var('sk','t');
$sort_dir = request_var('sd', 'a');


$mod_path = request_var('mod_path', '');

if ($mod_path)
Expand Down Expand Up @@ -306,18 +313,32 @@ function main($id, $mode)
*/
function list_installed()
{
global $db, $template;

$sql = 'SELECT mod_name, mod_id
FROM ' . MODS_TABLE . '
ORDER BY LOWER(mod_name) ASC';
global $db, $template, $user, $sort_key, $sort_dir;
$sort_by_text = array('u' => $user->lang['SORT_NAME'], 't' => $user->lang['SORT_DATE']);

($sort_key == 't')? $sort='mod_time' & $s_sort_key='mod_time': $sort='mod_name' & $s_sort_key='mod_name';
($sort_dir == 'd') ? $dir='DESC' & $s_sort_dir='DESC' : $dir='ASC' & $s_sort_dir='ASC';
$limit_days = array();
$s_limit_days=$sort_days=$s_limit_days = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);

$template->assign_vars(array(
'S_SORT_KEY' => $s_sort_key,
'S_SORT_DIR' => $s_sort_dir,
'U_SORT_ACTION' => $this->u_action ."&amp;$u_sort_param"
));
$sql = 'SELECT mod_name, mod_id, mod_time
FROM ' . MODS_TABLE . '
ORDER BY '.$sort.' '.$dir;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('installed', array(
'MOD_ID' => $row['mod_id'],
'MOD_NAME' => $row['mod_name'],

'MOD_TIME' => $user->format_date($row['mod_time']),

'U_DETAILS' => $this->u_action . '&amp;action=details&amp;mod_id=' . $row['mod_id'],
'U_UNINSTALL' => $this->u_action . '&amp;action=pre_uninstall&amp;mod_id=' . $row['mod_id'])
);
Expand Down
3 changes: 3 additions & 0 deletions root/language/en/acp/mods.php
Expand Up @@ -107,6 +107,7 @@
'INLINE_EDIT_ERROR' => 'Error, an inline edit in the MODX install file is missing all the required elements',
'INSTALL_AUTOMOD' => 'AutoMOD Installation',
'INSTALL_AUTOMOD_CONFIRM' => 'Are you sure you want to install AutoMOD?',
'INSTALL_DATE' => 'Install Date',
'INSTALL_TIME' => 'Installation time',
'INSTALL_MOD' => 'Install this MOD',
'INSTALL_ERROR' => 'One or more install actions failed. Please review the actions below, make any adjustments and retry. You may continue with the installation even though some of the actions failed. <strong>This is not recommended and may cause your board to not function correctly.</strong>',
Expand Down Expand Up @@ -175,6 +176,8 @@
'ROOT_NOT_READABLE' => 'AutoMOD was not able to open phpBB\'s index.php for reading. This probably means that permissions are too restrictive on your phpBB root directory, which will prevent AutoMOD from working. Please adjust your permissions and try the check again.',


'SORT_NAME' => 'Name',
'SORT_DATE' => 'Date',
'SOURCE' => 'Source',
'SQL_QUERIES' => 'SQL Queries',
'STATUS' => 'Status',
Expand Down

0 comments on commit faffda4

Please sign in to comment.