mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 13:47:31 +02:00
Bugtracker #4145 - allow subsubcat counts to accumulate in subcat; options for display
This commit is contained in:
24
download.php
24
download.php
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/download.php,v $
|
| $Source: /cvs_backup/e107_0.8/download.php,v $
|
||||||
| $Revision: 1.17 $
|
| $Revision: 1.18 $
|
||||||
| $Date: 2007-11-11 22:30:27 $
|
| $Date: 2007-11-21 22:52:45 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
|
|
|
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
@@ -29,8 +29,11 @@ $dl_text = ''; // Output variable
|
|||||||
|
|
||||||
if(!defined("USER_WIDTH")) { define("USER_WIDTH","width:100%"); }
|
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'
|
// 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 images */
|
||||||
define("IMAGE_DOWNLOAD", (file_exists(THEME."images/download.png") ? THEME."images/download.png" : e_IMAGE."generic/".IMODE."/download.png"));
|
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");}
|
if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:1px solid blue");}
|
||||||
|
|
||||||
// Read in tree of categories which this user is allowed to see
|
// 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)
|
if ($dl->down_count == 0)
|
||||||
{
|
{
|
||||||
@@ -738,13 +741,14 @@ class down_cat_handler
|
|||||||
var $cat_count; // Count visible subcats and subsubcats
|
var $cat_count; // Count visible subcats and subsubcats
|
||||||
var $down_count; // Counts total downloads
|
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
|
{ // Constructor - make a copy of the tree for re-use
|
||||||
// $nest_level = 0 merges subsubcats with subcats. >0 creates full tree.
|
// $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 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("SUB_PREFIX","-->"); // Added in front of sub categories
|
||||||
define("SUBSUB_PREFIX","---->"); // Added in front of sub-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
|
// 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.
|
// 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)
|
// (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;
|
global $sql2;
|
||||||
|
|
||||||
@@ -814,11 +818,14 @@ class down_cat_handler
|
|||||||
{
|
{
|
||||||
$this->cat_count++;
|
$this->cat_count++;
|
||||||
$this->down_count += $row['d_count'];
|
$this->down_count += $row['d_count'];
|
||||||
if ($nest_level == 0)
|
if ($accum || ($nest_level == 0))
|
||||||
{ // Add the counts into the subcategory values
|
{ // 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_size'] += $row['d_size'];
|
||||||
$catlist[$row['d_parent1']]['subcats'][$tmp]['d_count'] += $row['d_count'];
|
$catlist[$row['d_parent1']]['subcats'][$tmp]['d_count'] += $row['d_count'];
|
||||||
$catlist[$row['d_parent1']]['subcats'][$tmp]['d_requests'] += $row['d_requests'];
|
$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'])
|
if ($catlist[$row['d_parent1']]['subcats'][$tmp]['d_last'] < $row['d_last'])
|
||||||
$catlist[$row['d_parent1']]['subcats'][$tmp]['d_last'] = $row['d_last'];
|
$catlist[$row['d_parent1']]['subcats'][$tmp]['d_last'] = $row['d_last'];
|
||||||
}
|
}
|
||||||
@@ -836,6 +843,7 @@ class down_cat_handler
|
|||||||
return $catlist;
|
return $catlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Rest of the class isn't actually used normally, but print_tree() might help with debug
|
// Rest of the class isn't actually used normally, but print_tree() might help with debug
|
||||||
|
|
||||||
function print_cat($cat, $prefix,$postfix)
|
function print_cat($cat, $prefix,$postfix)
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_admin/download.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_admin/download.php,v $
|
||||||
| $Revision: 1.6 $
|
| $Revision: 1.7 $
|
||||||
| $Date: 2007-10-07 20:30:54 $
|
| $Date: 2007-11-21 22:52:46 $
|
||||||
| $Author: mcfly_e107 $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
require_once("../class2.php");
|
require_once("../class2.php");
|
||||||
@@ -142,6 +142,8 @@ if (isset($_POST['updateoptions']))
|
|||||||
$pref['agree_text'] = $tp->toDB($_POST['agree_text']);
|
$pref['agree_text'] = $tp->toDB($_POST['agree_text']);
|
||||||
$pref['download_denied'] = $tp->toDB($_POST['download_denied']);
|
$pref['download_denied'] = $tp->toDB($_POST['download_denied']);
|
||||||
$pref['download_reportbroken'] = $_POST['download_reportbroken'];
|
$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();
|
save_prefs();
|
||||||
$message = DOWLAN_65;
|
$message = DOWLAN_65;
|
||||||
}
|
}
|
||||||
@@ -256,26 +258,45 @@ if ($action == "opt") {
|
|||||||
$text = "<div style='text-align:center'>
|
$text = "<div style='text-align:center'>
|
||||||
<form method='post' action='".e_SELF."?".e_QUERY."'>\n
|
<form method='post' action='".e_SELF."?".e_QUERY."'>\n
|
||||||
<table style='".ADMIN_WIDTH."' class='fborder'>
|
<table style='".ADMIN_WIDTH."' class='fborder'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:70%' />
|
||||||
|
<col style='width:30%' />
|
||||||
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<td style='width:70%' class='forumheader3'>".DOWLAN_69."</td>
|
<td class='forumheader3'>".DOWLAN_69."</td>
|
||||||
<td class='forumheader3' style='width:30%;text-align:left'>";
|
<td class='forumheader3' style='text-align:left'>";
|
||||||
$c = $pref['download_php'] ? " checked = 'checked' " : "";
|
$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>
|
$text .= "<input type='checkbox' name='download_php' value='1' {$c} /> <span class='smalltext'>".DOWLAN_70."</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<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."
|
".DOWLAN_55."
|
||||||
</td>
|
</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 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>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr><td style='width:70%' class='forumheader3'>
|
<tr><td class='forumheader3'>
|
||||||
".DOWLAN_56."
|
".DOWLAN_56."
|
||||||
</td>
|
</td>
|
||||||
<td class='forumheader3' style='width:30%;text-align:left'>
|
<td class='forumheader3' style='text-align:left'>
|
||||||
|
|
||||||
<select name='download_order' class='tbox'>";
|
<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);
|
$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>
|
$text .= "</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td style='width:70%' class='forumheader3'>
|
<tr><td class='forumheader3'>
|
||||||
".LAN_ORDER."
|
".LAN_ORDER."
|
||||||
</td>
|
</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 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>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style='width:70%' class='forumheader3'>".DOWLAN_151."</td>
|
<td 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' style='text-align:left'>". r_userclass("download_reportbroken", $pref['download_reportbroken'])."</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style='width:70%' class='forumheader3'>".DOWLAN_150."</td>
|
<td 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' 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>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style='width:70%' class='forumheader3'>".DOWLAN_100."</td>
|
<td 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' 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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<tr><td style='width:70%' class='forumheader3'>
|
<tr><td class='forumheader3'>
|
||||||
".DOWLAN_101."
|
".DOWLAN_101."
|
||||||
</td>
|
</td>
|
||||||
<td class='forumheader3' style='width:30%;text-align:left'>
|
<td class='forumheader3' style='text-align:left'>
|
||||||
<textarea class='tbox' name='agree_text' cols='59' rows='3'>$agree_text</textarea>
|
<textarea class='tbox' name='agree_text' cols='59' rows='3'>{$agree_text}</textarea>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr><td style='width:70%' class='forumheader3'>
|
<tr><td class='forumheader3'>
|
||||||
".DOWLAN_146."
|
".DOWLAN_146."
|
||||||
</td>
|
</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>
|
<textarea class='tbox' name='download_denied' cols='59' rows='3'>".$pref['download_denied']."</textarea>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -4,9 +4,9 @@
|
|||||||
| e107 website system - Language File.
|
| e107 website system - Language File.
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_download.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_download.php,v $
|
||||||
| $Revision: 1.2 $
|
| $Revision: 1.3 $
|
||||||
| $Date: 2006-12-03 15:12:48 $
|
| $Date: 2007-11-21 22:52:46 $
|
||||||
| $Author: lisa_ $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
define("DOWLAN_1", "Download added to database.");
|
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_155", "Mirror display type:");
|
||||||
define("DOWLAN_156", "show mirror list, allow user to choose mirror");
|
define("DOWLAN_156", "show mirror list, allow user to choose mirror");
|
||||||
define("DOWLAN_157", "use random mirror - no user choice");
|
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");
|
||||||
|
|
||||||
?>
|
?>
|
Reference in New Issue
Block a user