diff --git a/e107_plugins/download/download.php b/e107_plugins/download/download.php
index 77f818a8a..111f6023b 100644
--- a/e107_plugins/download/download.php
+++ b/e107_plugins/download/download.php
@@ -27,15 +27,21 @@ if (!e107::isInstalled('download'))
$dl = new download();
- if(!defined("USER_WIDTH")) { define("USER_WIDTH","width:100%"); }
+ if(!defined("USER_WIDTH") && !deftrue('BOOTSTRAP')) { define("USER_WIDTH","width:100%"); }
/* define images */
- /** @Deprecated **/
- define("IMAGE_DOWNLOAD", (file_exists(THEME."images/download.png") ? THEME."images/download.png" : e_IMAGE."generic/download.png"));
+ if(deftrue('BOOTSTRAP'))
+ {
+ define("IMAGE_DOWNLOAD", (file_exists(THEME."images/download.png") ? THEME."images/download.png" : e_IMAGE."generic/download.png"));
+ define("IMAGE_NEW", (file_exists(THEME."images/new.png") ? THEME."images/new.png" : ''));
+ }
+ else
+ {
+ define("IMAGE_DOWNLOAD", (file_exists(THEME."images/download.png") ? THEME."images/download.png" : e_IMAGE."generic/download.png"));
+ define("IMAGE_NEW", (file_exists(THEME."images/new.png") ? THEME."images/new.png" : e_IMAGE."generic/new.png"));
+ }
- /** @Deprecated **/
- define("IMAGE_NEW", (file_exists(THEME."images/new.png") ? THEME."images/new.png" : e_IMAGE."generic/new.png"));
$dl->init();
diff --git a/e107_plugins/download/download_shortcodes.php b/e107_plugins/download/download_shortcodes.php
index 51d8d7003..fc353fdb9 100644
--- a/e107_plugins/download/download_shortcodes.php
+++ b/e107_plugins/download/download_shortcodes.php
@@ -56,11 +56,11 @@ class download_shortcodes extends e_shortcode
default:
$breadcrumb[] = array('text' => LAN_dl_18, 'url' => e_SELF);
- $breadcrumb[] = array('text' => $this->var['download_category_name'], 'url' => e_SELF."?action=list&id=".$this->var['download_category_id']);
+ $breadcrumb[] = array('text' => $this->var['download_category_name'], 'url' => ($this->var['download_category_id']) ? e_SELF."?action=list&id=".$this->var['download_category_id'] : null);
$breadcrumb[] = array('text' => $this->var['download_name'], 'url' => null);
break;
}
-
+
return $frm->breadcrumb($breadcrumb);
}
@@ -89,9 +89,13 @@ class download_shortcodes extends e_shortcode
function sc_download_cat_sub_name()
{
$tp = e107::getParser();
+
+ $class = 'category-name';
+ $class .= $this->isNewDownload($this->dlsubrow['d_last']) ? ' new' : '';
+
if ($this->dlsubrow['d_count'])
{
- return "".$tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE')."";
+ return "".$tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE')."";
}
else
{
@@ -112,7 +116,7 @@ class download_shortcodes extends e_shortcode
function sc_download_cat_sub_new_icon()
{
- return $this->_check_new_download($this->dlsubrow['d_last_subs']);
+ return ($this->isNewDownload($this->dlsubrow['d_last_subs'])) ? $this->renderNewIcon() : "";
}
function sc_download_cat_sub_count()
@@ -136,10 +140,15 @@ class download_shortcodes extends e_shortcode
function sc_download_cat_subsub_name()
{
+
+ // isNewDownload
+ $class = 'category-name';
+ $class .= $this->isNewDownload($this->dlsubsubrow['d_last']) ? ' new' : '';
+
$tp = e107::getParser();
if ($this->dlsubsubrow['d_count'])
{
- return "".$tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE')."";
+ return "".$tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE')."";
}
else
{
@@ -271,14 +280,14 @@ class download_shortcodes extends e_shortcode
function sc_download_list_newicon()
{
- return (USER && $this->var['download_datestamp'] > USERLV ? "
" : "");
+ return $this->isNewDownload($this->var['download_datestamp']) ? $this->renderNewIcon() : "";
}
function sc_download_list_recenticon()
{
$pref = e107::getPref();
// convert "recent_download_days" to seconds
- return ($this->var['download_datestamp'] > time()-($pref['recent_download_days']*86400) ? '
' : '');
+ return ($this->var['download_datestamp'] > time()-($pref['recent_download_days']*86400) ? $this->renderNewIcon() : '');
}
function sc_download_list_filesize()
@@ -812,15 +821,15 @@ class download_shortcodes extends e_shortcode
// Misc stuff ---------------------------------------------------------------------------------
function sc_download_cat_newdownload_text()
{
- return "
".LAN_dl_36;
+ return $this->renderNewIcon()." ".LAN_dl_36;
}
function sc_download_cat_search()
{
return "
";
@@ -840,16 +849,26 @@ class download_shortcodes extends e_shortcode
}
- function _check_new_download($last_val)
+ private function isNewDownload($last_val)
{
if (USER && ($last_val > USERLV))
{
- return "
";
+ return true;
}
else
{
- return "";
+ return false;
}
}
+
+ private function renderNewIcon()
+ {
+ if(strstr(IMAGE_NEW,'";
+ }
}
?>
\ No newline at end of file
diff --git a/e107_plugins/download/handlers/download_class.php b/e107_plugins/download/handlers/download_class.php
index 2bdc7309a..508710c93 100644
--- a/e107_plugins/download/handlers/download_class.php
+++ b/e107_plugins/download/handlers/download_class.php
@@ -17,10 +17,17 @@ class download
private $orderOptions = array('download_id','download_datestamp','download_filesize','download_name','download_author','download_requested');
+ private $templateHeader = '';
+ private $templateFooter = '';
+
function __construct()
{
require_once(e_PLUGIN."download/download_shortcodes.php");
+
+ $this->templateHeader = e107::getTemplate('download','download','header');
+ $this->templateFooter = e107::getTemplate('download','download','footer');
+
}
public function init()
@@ -213,13 +220,16 @@ class download
}
}
- $dl_text = $tp->parseTemplate($DOWNLOAD_CAT_TABLE_START, TRUE, $download_shortcodes);
+ $dl_text .= $tp->parseTemplate($this->templateHeader, TRUE, $download_shortcodes);
+ $dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_START, TRUE, $download_shortcodes);
$dl_text .= $download_cat_table_string;
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_END, TRUE, $download_shortcodes);
$caption = varset($DOWNLOAD_CAT_CAPTION) ? $tp->parseTemplate($DOWNLOAD_CAT_CAPTION, TRUE, $download_shortcodes) : LAN_dl_18;
//ob_start();
+
+ $dl_text .= $tp->parseTemplate($this->templateFooter, TRUE, $download_shortcodes);
return $ns->tablerender($caption, $dl_text, 'download-categories',true);
@@ -323,7 +333,10 @@ class download
$DL_TEMPLATE = $DOWNLOAD_VIEW_TABLE_START.$DOWNLOAD_VIEW_TABLE.$DOWNLOAD_VIEW_TABLE_END;
- $text = $tp->parseTemplate($DL_TEMPLATE, TRUE, $download_shortcodes);
+
+ $text = $tp->parseTemplate($this->templateHeader, TRUE, $download_shortcodes);
+
+ $text .= $tp->parseTemplate($DL_TEMPLATE, TRUE, $download_shortcodes);
if(!isset($DL_VIEW_NEXTPREV))
{
@@ -347,6 +360,8 @@ class download
$caption = $tp->parseTemplate($DL_VIEW_CAPTION, TRUE, $download_shortcodes);
+ $text .= $tp->parseTemplate($this->templateFooter, TRUE, $download_shortcodes);
+
$ret = $ns->tablerender($caption, $text, 'download-view', true);
unset($text);
@@ -384,12 +399,18 @@ class download
if(deftrue('BOOTSTRAP')) // v2.x
{
- $template = e107::getTemplate('download','download','list');
+ $template = e107::getTemplate('download','download');
- $DOWNLOAD_LIST_TABLE_START = $template['start'];
- $DOWNLOAD_LIST_TABLE = $template['item'];
- $DOWNLOAD_LIST_TABLE_END = $template['end'];
- $DOWNLOAD_LIST_NEXTPREV = $template['nextprev'];
+ $DOWNLOAD_LIST_TABLE_START = $template['list']['start'];
+ $DOWNLOAD_LIST_TABLE = $template['list']['item'];
+ $DOWNLOAD_LIST_TABLE_END = $template['list']['end'];
+ $DOWNLOAD_LIST_NEXTPREV = $template['list']['nextprev'];
+
+ $DOWNLOAD_CAT_TABLE_START = varset($template['categories']['start']);
+ $DOWNLOAD_CAT_PARENT_TABLE = $template['categories']['parent'];
+ $DOWNLOAD_CAT_CHILD_TABLE = $template['categories']['child'];
+ $DOWNLOAD_CAT_SUBSUB_TABLE = $template['categories']['subchild'];
+ $DOWNLOAD_CAT_TABLE_END = varset($template['categories']['end']);
}
else // Legacy v1.x
{
@@ -443,6 +464,7 @@ class download
$maincatval = $id;
}
+ $dl_text = $tp->parseTemplate($this->templateHeader, TRUE, $download_shortcodes);
$total_downloads = $sql->count("download", "(*)", "WHERE download_category = '{$this->qry['id']}' AND download_active > 0 AND download_visible REGEXP '" . e_CLASS_REGEXP . "'");
@@ -451,7 +473,9 @@ class download
$qry = "SELECT download_category_id,download_category_class FROM #download_category WHERE download_category_parent=".intval($this->qry['id']);
if($sql->gen($qry))
- {
+ {
+
+
/* there are subcats - display them ... */
$qry = "
SELECT dc.*, dc2.download_category_name AS parent_name, dc2.download_category_icon as parent_icon, SUM(d.download_filesize) AS d_size,
@@ -465,37 +489,33 @@ class download
GROUP by dc.download_category_id ORDER by dc.download_category_order
";
- $sql->gen($qry);
-
- $scArray = $sql->db_getList();
- $load_template = 'download_template';
-
- if(!isset($DOWNLOAD_CAT_PARENT_TABLE))
+ if($sql->gen($qry))
{
- eval($template_load_core);
+
+ $scArray = $sql->db_getList();
+
+ /** @DEPRECATED **/
+ // if(!defined("DL_IMAGESTYLE"))
+ // {
+ // define("DL_IMAGESTYLE", "border:1px solid blue");
+ // }
+
+ $download_cat_table_string = "";
+
+ $dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_PRE, TRUE, $download_shortcodes);
+ $dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_START, TRUE, $download_shortcodes);
+
+ foreach($scArray as $dlsubsubrow)
+ {
+ $download_shortcodes->dlsubsubrow = $dlsubsubrow;
+ $dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_SUBSUB_TABLE, TRUE, $download_shortcodes);
+ }
+
+ $dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_END, TRUE, $download_shortcodes);
+
+ // $text = $ns->tablerender($dl_title, $dl_text, 'download-list', true);
}
- /** @DEPRECATED **/
- // if(!defined("DL_IMAGESTYLE"))
- // {
- // define("DL_IMAGESTYLE", "border:1px solid blue");
- // }
-
- $download_cat_table_string = "";
-
- $dl_text = $tp->parseTemplate($DOWNLOAD_CAT_TABLE_PRE, TRUE, $download_shortcodes);
- $dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_START, TRUE, $download_shortcodes);
-
- foreach($scArray as $dlsubsubrow)
- {
- $dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_SUBSUB_TABLE, TRUE, $download_shortcodes);
- }
-
- $dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_END, TRUE, $download_shortcodes);
-
- $text = $ns->tablerender($dl_title, $dl_text, 'download-list', true);
-
-
}// End of subcategory display
// Now display individual downloads
@@ -537,7 +557,7 @@ class download
if($filetotal)
{
// Only show list if some files in it
- $dl_text = $tp->parseTemplate($DOWNLOAD_LIST_TABLE_START, TRUE, $download_shortcodes);
+ $dl_text .= $tp->parseTemplate($DOWNLOAD_LIST_TABLE_START, TRUE, $download_shortcodes);
global $dlft, $dltdownloads;
@@ -566,8 +586,9 @@ class download
$parent = $sql->fetch();
}
+ $dl_text .= $tp->parseTemplate($this->templateFooter, TRUE, $download_shortcodes);
- $text = $ns->tablerender(LAN_dl_18, $dl_text, 'download-list', true);
+ $text .= $ns->tablerender(LAN_dl_18, $dl_text, 'download-list', true);
}
if(!isset($DOWNLOAD_LIST_NEXTPREV))
@@ -768,6 +789,8 @@ class download
}
}
+ $dl_text = $tp->parseTemplate($this->templateHeader, TRUE, $download_shortcodes);
+
$dl_text = $tp->parseTemplate($DOWNLOAD_MIRROR_START, TRUE, $download_shortcodes);
$download_mirror = 1;
@@ -789,6 +812,8 @@ class download
$dl_text .= $tp->parseTemplate($DOWNLOAD_MIRROR_END, TRUE, $download_shortcodes);
+ $dl_text .= $tp->parseTemplate($this->templateFooter, TRUE, $download_shortcodes);
+
return $ns->tablerender(LAN_dl_18, $dl_text, 'download-mirror', true);
diff --git a/e107_plugins/download/templates/download_template.php b/e107_plugins/download/templates/download_template.php
index 7a863b5dd..42ee75bbf 100644
--- a/e107_plugins/download/templates/download_template.php
+++ b/e107_plugins/download/templates/download_template.php
@@ -15,10 +15,7 @@
*/
if (!defined('e107_INIT')) { exit; }
-if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
-/* set style of download image and thumbnail */
-define("DL_IMAGESTYLE","border:0px");
// ##### CAT TABLE --------------------------------------------------------------------------------
if(!isset($DOWNLOAD_CAT_TABLE_PRE))
@@ -351,8 +348,8 @@ if(!isset($DOWNLOAD_MIRROR_END))
// v2.x Bootstrap Template. - Overrides the above templates.
-$DOWNLOAD_TEMPLATE['categories']['start'] = "{DOWNLOAD_BREADCRUMB}
-
+$DOWNLOAD_TEMPLATE['categories']['start'] = "
+
@@ -368,23 +365,15 @@ $DOWNLOAD_TEMPLATE['categories']['start'] = "{DOWNLOAD_BREADCRUMB}
".LAN_dl_77." |
-
-
- {DOWNLOAD_CAT_NEWDOWNLOAD_TEXT} |
-
-
- {DOWNLOAD_CAT_SEARCH} |
-
-
";
$DOWNLOAD_TEMPLATE['categories']['parent'] = "
-
{DOWNLOAD_CAT_MAIN_ICON}
|
-
{DOWNLOAD_CAT_MAIN_NAME}
{DOWNLOAD_CAT_MAIN_DESCRIPTION}
|
@@ -407,23 +396,15 @@ $DOWNLOAD_TEMPLATE['categories']['child'] = "
$DOWNLOAD_TEMPLATE['categories']['subchild'] = "
-
- |
-
-
-
-
- {DOWNLOAD_CAT_SUBSUB_ICON}
- |
-
- {DOWNLOAD_CAT_SUBSUB_NEW_ICON} {DOWNLOAD_CAT_SUBSUB_NAME}
-
- {DOWNLOAD_CAT_SUBSUB_DESCRIPTION}
-
- |
-
-
+ {DOWNLOAD_CAT_SUBSUB_ICON}
|
+
+ {DOWNLOAD_CAT_SUBSUB_NEW_ICON} {DOWNLOAD_CAT_SUBSUB_NAME}
+
+ {DOWNLOAD_CAT_SUBSUB_DESCRIPTION}
+
+ |
+
{DOWNLOAD_CAT_SUBSUB_COUNT} |
{DOWNLOAD_CAT_SUBSUB_SIZE} |
{DOWNLOAD_CAT_SUBSUB_DOWNLOADED} |
@@ -432,28 +413,32 @@ $DOWNLOAD_TEMPLATE['categories']['subchild'] = "
$DOWNLOAD_TEMPLATE['categories']['end'] = "
-
\n";
+
+
+
{DOWNLOAD_CAT_NEWDOWNLOAD_TEXT}
+
{DOWNLOAD_CAT_SEARCH}
+
";
// ##### ------------------------------------------------------------------------------------------
//FIXME - not being utilized at the moment.
-$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHOR_LAN'] = "";
-$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHOR'] = "";
-$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHOREMAIL_LAN'] = "
";
-$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHOREMAIL'] = "";
-$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHORWEBSITE_LAN'] = "
";
-$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHORWEBSITE'] = "";
-$DOWNLOAD_WRAPPER['view']['DOWNLOAD_REPORT_LINK'] = "
";
+$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHOR_LAN'] = "{---} | ";
+$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHOR'] = "{---} | ";
+$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHOREMAIL_LAN'] = "
{---} | ";
+$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHOREMAIL'] = "{---} | ";
+$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHORWEBSITE_LAN'] = "
{---} | ";
+$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHORWEBSITE'] = "{---} | ";
+$DOWNLOAD_WRAPPER['view']['DOWNLOAD_REPORT_LINK'] = "
{---} |
";
$DOWNLOAD_TEMPLATE['view']['caption'] = LAN_dl_18;
-$DOWNLOAD_TEMPLATE['view']['start'] = "{DOWNLOAD_BREADCRUMB} ";
+$DOWNLOAD_TEMPLATE['view']['start'] = " ";
$DOWNLOAD_TEMPLATE['view']['item'] = "
-
-
+
+
@@ -470,32 +455,32 @@ $DOWNLOAD_TEMPLATE['view']['item'] = "
{DOWNLOAD_VIEW_AUTHORWEBSITE_LAN}
{DOWNLOAD_VIEW_AUTHORWEBSITE}
-
-
+ {DOWNLOAD_VIEW_DESCRIPTION_LAN} |
+ {DOWNLOAD_VIEW_DESCRIPTION} |
-
-
+ {DOWNLOAD_VIEW_IMAGE_LAN} |
+ {DOWNLOAD_VIEW_IMAGE} |
-
-
+ {DOWNLOAD_VIEW_FILESIZE_LAN} |
+ {DOWNLOAD_VIEW_FILESIZE} |
-
-
+ {DOWNLOAD_VIEW_DATE_LAN} |
+ {DOWNLOAD_VIEW_DATE=long} |
-
-
+ {DOWNLOAD_VIEW_REQUESTED_LAN} |
+ {DOWNLOAD_VIEW_REQUESTED} |
-
-
+ {DOWNLOAD_VIEW_LINK_LAN} |
+ {DOWNLOAD_VIEW_LINK} |
-
-
+ {DOWNLOAD_VIEW_RATING_LAN} |
+ {DOWNLOAD_VIEW_RATING} |
{DOWNLOAD_REPORT_LINK}
@@ -530,10 +515,9 @@ $DOWNLOAD_TEMPLATE['view']['nextprev'] = '
// ##### ------------------------------------------------------------------------------------------
-$DOWNLOAD_TEMPLATE['list']['start'] = "{DOWNLOAD_BREADCRUMB}
-
+$DOWNLOAD_TEMPLATE['list']['start'] = "