1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 12:20:44 +02:00

Bugtracker #4145 - allow subsubcat counts to accumulate in subcat; options for display

This commit is contained in:
e107steved
2007-11-21 22:52:46 +00:00
parent b39fff6e45
commit c2a7f06784
3 changed files with 66 additions and 33 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/download.php,v $
| $Revision: 1.17 $
| $Date: 2007-11-11 22:30:27 $
| $Revision: 1.18 $
| $Date: 2007-11-21 22:52:45 $
| $Author: e107steved $
|
+----------------------------------------------------------------------------+
@@ -29,8 +29,11 @@ $dl_text = ''; // Output variable
if(!defined("USER_WIDTH")) { define("USER_WIDTH","width:100%"); }
// Following two now set in prefs
// To prevent display of sub-categories on the main display, change the value in the following line from '1' to '0'
$pref['download_subsub'] = '1';
//$pref['download_subsub'] = '1';
// To include file counts and sizes from subcategories and subsubcategories in superior categories, change the following to '1'
//$pref['download_incinfo'] = '1';
/* define images */
define("IMAGE_DOWNLOAD", (file_exists(THEME."images/download.png") ? THEME."images/download.png" : e_IMAGE."generic/".IMODE."/download.png"));
@@ -158,7 +161,7 @@ switch ($action)
if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:1px solid blue");}
// Read in tree of categories which this user is allowed to see
$dl = new down_cat_handler($pref['download_subsub'],USERCLASS_LIST,$maincatval);
$dl = new down_cat_handler(varset($pref['download_subsub'],1),USERCLASS_LIST,$maincatval,varset($pref['download_incinfo'],FALSE));
if ($dl->down_count == 0)
{
@@ -738,13 +741,14 @@ class down_cat_handler
var $cat_count; // Count visible subcats and subsubcats
var $down_count; // Counts total downloads
function down_cat_handler($nest_level = 1, $load_class = USERCLASS_LIST, $main_cat_load = '')
function down_cat_handler($nest_level = 1, $load_class = USERCLASS_LIST, $main_cat_load = '', $accum = FALSE)
{ // Constructor - make a copy of the tree for re-use
// $nest_level = 0 merges subsubcats with subcats. >0 creates full tree.
// If load-class non-null, assumed to be a 'class set' such as USERCLASS_LIST
// If $accum is TRUE, include file counts and sizes in superior categories
define("SUB_PREFIX","-->"); // Added in front of sub categories
define("SUBSUB_PREFIX","---->"); // Added in front of sub-sub categories
$this->cat_tree = $this->down_cat_tree($nest_level,$load_class, $main_cat_load);
$this->cat_tree = $this->down_cat_tree($nest_level,$load_class, $main_cat_load, $accum);
}
@@ -754,7 +758,7 @@ class down_cat_handler
// Within the 'sub-category' level of the nesting, array 'subsubcats' has the next level's info
// If $main_cat_load is numeric, and the value of a 'main' category, only that main category is displayed.
// (Unpredictable if $main_cat_load is some other category)
function down_cat_tree($nest_level = 1, $load_cat_class = USERCLASS_LIST, $main_cat_load = '')
function down_cat_tree($nest_level = 1, $load_cat_class = USERCLASS_LIST, $main_cat_load = '', $accum = FALSE)
{
global $sql2;
@@ -814,11 +818,14 @@ class down_cat_handler
{
$this->cat_count++;
$this->down_count += $row['d_count'];
if ($nest_level == 0)
if ($accum || ($nest_level == 0))
{ // Add the counts into the subcategory values
$catlist[$row['d_parent1']]['subcats'][$tmp]['d_size'] += $row['d_size'];
$catlist[$row['d_parent1']]['subcats'][$tmp]['d_count'] += $row['d_count'];
$catlist[$row['d_parent1']]['subcats'][$tmp]['d_requests'] += $row['d_requests'];
}
if ($nest_level == 0)
{ // Reflect subcat dates in category
if ($catlist[$row['d_parent1']]['subcats'][$tmp]['d_last'] < $row['d_last'])
$catlist[$row['d_parent1']]['subcats'][$tmp]['d_last'] = $row['d_last'];
}
@@ -835,6 +842,7 @@ class down_cat_handler
}
return $catlist;
}
// Rest of the class isn't actually used normally, but print_tree() might help with debug

View File

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/download.php,v $
| $Revision: 1.6 $
| $Date: 2007-10-07 20:30:54 $
| $Author: mcfly_e107 $
| $Revision: 1.7 $
| $Date: 2007-11-21 22:52:46 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
require_once("../class2.php");
@@ -142,6 +142,8 @@ if (isset($_POST['updateoptions']))
$pref['agree_text'] = $tp->toDB($_POST['agree_text']);
$pref['download_denied'] = $tp->toDB($_POST['download_denied']);
$pref['download_reportbroken'] = $_POST['download_reportbroken'];
if ($_POST['download_subsub']) $pref['download_subsub'] = '1'; else $pref['download_subsub'] = '0';
if ($_POST['download_incinfo']) $pref['download_incinfo'] = '1'; else $pref['download_incinfo'] = '0';
save_prefs();
$message = DOWLAN_65;
}
@@ -256,26 +258,45 @@ if ($action == "opt") {
$text = "<div style='text-align:center'>
<form method='post' action='".e_SELF."?".e_QUERY."'>\n
<table style='".ADMIN_WIDTH."' class='fborder'>
<colgroup>
<col style='width:70%' />
<col style='width:30%' />
</colgroup>
<tr>
<td style='width:70%' class='forumheader3'>".DOWLAN_69."</td>
<td class='forumheader3' style='width:30%;text-align:left'>";
<td class='forumheader3'>".DOWLAN_69."</td>
<td class='forumheader3' style='text-align:left'>";
$c = $pref['download_php'] ? " checked = 'checked' " : "";
$ssc = ((!isset($pref['download_subsub'])) || ($pref['download_subsub'] == '1')) ? " checked = 'checked' " : "";
$sacc = (varset($pref['download_incinfo'],0) == '1') ? " checked = 'checked' " : "";
$text .= "<input type='checkbox' name='download_php' value='1' {$c} /> <span class='smalltext'>".DOWLAN_70."</span></td>
</tr>
<tr>
<td style='width:70%' class='forumheader3'>
<td class='forumheader3'>".DOWLAN_158."</td>
<td class='forumheader3' style='text-align:left'>
<input type='checkbox' name='download_subsub' value='1' {$ssc} /> </td>
</tr>
<tr>
<td class='forumheader3'>".DOWLAN_159."</td>
<td class='forumheader3' style='text-align:left'>
<input type='checkbox' name='download_incinfo' value='1' {$sacc} /> </td>
</tr>
<tr>
<td class='forumheader3'>
".DOWLAN_55."
</td>
<td class='forumheader3' style='width:30%;text-align:left'>
<td class='forumheader3' style='text-align:left'>
<select name='download_view' class='tbox'>". ($pref['download_view'] == 5 ? "<option selected='selected'>5</option>" : "<option>5</option>"). ($pref['download_view'] == 10 ? "<option selected='selected'>10</option>" : "<option>10</option>"). ($pref['download_view'] == 15 ? "<option selected='selected'>15</option>" : "<option>15</option>"). ($pref['download_view'] == 20 ? "<option selected='selected'>20</option>" : "<option>20</option>"). ($pref['download_view'] == 50 ? "<option selected='selected'>50</option>" : "<option>50</option>")."
</select>
</td>
</tr>
<tr><td style='width:70%' class='forumheader3'>
<tr><td class='forumheader3'>
".DOWLAN_56."
</td>
<td class='forumheader3' style='width:30%;text-align:left'>
<td class='forumheader3' style='text-align:left'>
<select name='download_order' class='tbox'>";
$order_options = array("download_id"=>"Id No.","download_datestamp"=>LAN_DATE,"download_requested"=>ADLAN_24,"download_name"=>DOWLAN_59,"download_author"=>DOWLAN_15);
@@ -287,44 +308,44 @@ if ($action == "opt") {
$text .= "</select>
</td>
</tr>
<tr><td style='width:70%' class='forumheader3'>
<tr><td class='forumheader3'>
".LAN_ORDER."
</td>
<td class='forumheader3' style='width:30%;text-align:left'>
<td class='forumheader3' text-align:left'>
<select name='download_sort' class='tbox'>". ($pref['download_sort'] == "ASC" ? "<option value='ASC' selected='selected'>".DOWLAN_62."</option>" : "<option value='ASC'>".DOWLAN_62."</option>"). ($pref['download_sort'] == "DESC" ? "<option value='DESC' selected='selected'>".DOWLAN_63."</option>" : "<option value='DESC'>".DOWLAN_63."</option>")."
</select>
</td>
</tr>
<tr>
<td style='width:70%' class='forumheader3'>".DOWLAN_151."</td>
<td class='forumheader3' style='width:30%;text-align:left'>". r_userclass("download_reportbroken", $pref['download_reportbroken'])."</td>
<td class='forumheader3'>".DOWLAN_151."</td>
<td class='forumheader3' style='text-align:left'>". r_userclass("download_reportbroken", $pref['download_reportbroken'])."</td>
</tr>
<tr>
<td style='width:70%' class='forumheader3'>".DOWLAN_150."</td>
<td class='forumheader3' style='width:30%;text-align:left'>". ($pref['download_email'] ? "<input type='checkbox' name='download_email' value='1' checked='checked' />" : "<input type='checkbox' name='download_email' value='1' />")."</td>
<td class='forumheader3'>".DOWLAN_150."</td>
<td class='forumheader3' style='text-align:left'>". ($pref['download_email'] ? "<input type='checkbox' name='download_email' value='1' checked='checked' />" : "<input type='checkbox' name='download_email' value='1' />")."</td>
</tr>
<tr>
<td style='width:70%' class='forumheader3'>".DOWLAN_100."</td>
<td class='forumheader3' style='width:30%;text-align:left'>". ($agree_flag ? "<input type='checkbox' name='agree_flag' value='1' checked='checked' />" : "<input type='checkbox' name='agree_flag' value='1' />")."</td>
<td class='forumheader3'>".DOWLAN_100."</td>
<td class='forumheader3' style='text-align:left'>". ($agree_flag ? "<input type='checkbox' name='agree_flag' value='1' checked='checked' />" : "<input type='checkbox' name='agree_flag' value='1' />")."</td>
</tr>
<tr><td style='width:70%' class='forumheader3'>
<tr><td class='forumheader3'>
".DOWLAN_101."
</td>
<td class='forumheader3' style='width:30%;text-align:left'>
<textarea class='tbox' name='agree_text' cols='59' rows='3'>$agree_text</textarea>
<td class='forumheader3' style='text-align:left'>
<textarea class='tbox' name='agree_text' cols='59' rows='3'>{$agree_text}</textarea>
</td>
</tr>
<tr><td style='width:70%' class='forumheader3'>
<tr><td class='forumheader3'>
".DOWLAN_146."
</td>
<td class='forumheader3' style='width:30%;text-align:left'>
<td class='forumheader3' style='text-align:left'>
<textarea class='tbox' name='download_denied' cols='59' rows='3'>".$pref['download_denied']."</textarea>
</td>
</tr>

View File

@@ -4,9 +4,9 @@
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_download.php,v $
| $Revision: 1.2 $
| $Date: 2006-12-03 15:12:48 $
| $Author: lisa_ $
| $Revision: 1.3 $
| $Date: 2007-11-21 22:52:46 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
define("DOWLAN_1", "Download added to database.");
@@ -140,4 +140,8 @@ define("DOWLAN_154", "if using mirrors, select how they will be displayed");
define("DOWLAN_155", "Mirror display type:");
define("DOWLAN_156", "show mirror list, allow user to choose mirror");
define("DOWLAN_157", "use random mirror - no user choice");
define("DOWLAN_158", "Show sub-sub-categories on main download page");
define("DOWLAN_159", "Include sub-sub-category counts in subcategory counts");
?>