From faffda4cf8ed7b3ad8f379ccca0e3c41482ee71c Mon Sep 17 00:00:00 2001 From: pertneer Date: Thu, 11 Oct 2012 12:20:26 -0500 Subject: [PATCH] Added abitily to sort installed mods in acp --- .gitignore | 4 +++- root/adm/style/acp_mods.html | 24 +++++++++++++++++------- root/includes/acp/acp_mods.php | 33 +++++++++++++++++++++++++++------ root/language/en/acp/mods.php | 3 +++ 4 files changed, 50 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index a47ba10..6343f73 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ # ignore eclipse directories .project .settings -.cache \ No newline at end of file +.cache +# ignore backup files +*.bak diff --git a/root/adm/style/acp_mods.html b/root/adm/style/acp_mods.html index 4fbcb7e..f064ee7 100644 --- a/root/adm/style/acp_mods.html +++ b/root/adm/style/acp_mods.html @@ -17,21 +17,22 @@

{L_ACP_MODS}

{L_MODS_EXPLAIN}

- + + - + - + @@ -39,14 +40,15 @@

{L_ACP_MODS}

+ - + - + @@ -54,12 +56,20 @@

{L_ACP_MODS}

+
{L_NAME} {L_OPTIONS} {L_ACTIONS}{L_INSTALL_DATE}
{L_INSTALLED_MODS}{L_INSTALLED_MODS}
{L_NO_INSTALLED_MODS}{L_NO_INSTALLED_MODS}
{installed.MOD_NAME} {L_DETAILS} {L_UNINSTALL}

{installed.MOD_TIME}

{L_UNINSTALLED_MODS}{L_UNINSTALLED_MODS}
{L_NO_UNINSTALLED_MODS}{L_NO_UNINSTALLED_MODS}
{uninstalled.MOD_NAME} {L_DETAILS} {L_INSTALL} | {L_DELETE}
- - + + +
+
+ {L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR} + +
+ +
diff --git a/root/includes/acp/acp_mods.php b/root/includes/acp/acp_mods.php index f6675b1..46eb3c6 100644 --- a/root/includes/acp/acp_mods.php +++ b/root/includes/acp/acp_mods.php @@ -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) { @@ -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) @@ -306,11 +313,23 @@ 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 ."&$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)) { @@ -318,6 +337,8 @@ function list_installed() 'MOD_ID' => $row['mod_id'], 'MOD_NAME' => $row['mod_name'], + 'MOD_TIME' => $user->format_date($row['mod_time']), + 'U_DETAILS' => $this->u_action . '&action=details&mod_id=' . $row['mod_id'], 'U_UNINSTALL' => $this->u_action . '&action=pre_uninstall&mod_id=' . $row['mod_id']) ); diff --git a/root/language/en/acp/mods.php b/root/language/en/acp/mods.php index 2abdc02..15325f5 100644 --- a/root/language/en/acp/mods.php +++ b/root/language/en/acp/mods.php @@ -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. This is not recommended and may cause your board to not function correctly.', @@ -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',