From 340ff05fcde137f1932bc0b5b4c717c07a23d640 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 21 Feb 2021 14:13:01 -0800 Subject: [PATCH] Bootstrap5 markup added to download item pagination. Fallback added to e107.css --- e107_plugins/download/download_shortcodes.php | 24 ++++++++++++------- .../download/handlers/download_class.php | 13 ++++++---- .../download/templates/download_template.php | 11 +++++---- e107_web/css/e107.css | 7 +++++- 4 files changed, 36 insertions(+), 19 deletions(-) diff --git a/e107_plugins/download/download_shortcodes.php b/e107_plugins/download/download_shortcodes.php index 092d5f0b7..3387b1dd3 100644 --- a/e107_plugins/download/download_shortcodes.php +++ b/e107_plugins/download/download_shortcodes.php @@ -1053,15 +1053,16 @@ class download_shortcodes extends e_shortcode $tp = e107::getParser(); $dlrow_id = intval($this->var['download_id']); - + + $icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('fa-chevron-left') : '<<'; + $class = empty($parm['class']) ? 'e-tip page-link' : $parm['class']; + if ($sql->select("download", "*", "download_category='".intval($this->var['download_category_id'])."' AND download_id < {$dlrow_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp DESC LIMIT 1")) { $dlrowrow = $sql->fetch(); $url = e107::url('download', 'item', $dlrowrow); - $icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('fa-chevron-left') : '<<'; - $class = empty($parm['class']) ? 'e-tip' : $parm['class']; return "".$icon." ".LAN_PREVIOUS."\n"; @@ -1069,7 +1070,8 @@ class download_shortcodes extends e_shortcode } else { - return " "; + $class .= ' disabled'; + return "".$icon." ".LAN_PREVIOUS."\n"; } } @@ -1081,15 +1083,17 @@ class download_shortcodes extends e_shortcode $sql = e107::getDb(); $tp = e107::getParser(); $dlrow_id = intval($this->var['download_id']); - + $icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('fa-chevron-right') : '>>'; + $class = empty($parm['class']) ? 'e-tip page-link' : $parm['class']; + if ($sql->select("download", "*", "download_category='".intval($this->var['download_category_id'])."' AND download_id > {$dlrow_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp ASC LIMIT 1")) { $dlrowrow = $sql->fetch(); extract($dlrowrow); $url = $url = e107::url('download', 'item', $dlrowrow); - $icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('fa-chevron-right') : '>>'; - $class = empty($parm['class']) ? 'e-tip' : $parm['class']; + + return "".LAN_NEXT." ".$icon."\n"; @@ -1097,7 +1101,9 @@ class download_shortcodes extends e_shortcode } else { - return " "; + $class .= ' disabled'; + return "".LAN_NEXT." ".$icon."\n"; + } } @@ -1110,7 +1116,7 @@ class download_shortcodes extends e_shortcode // e_PLUGIN_ABS."download/download.php?action=list&id=".$this->var['download_category'] $title = "Back to [x]"; - $class = empty($parm['class']) ? 'e-tip' : $parm['class']; + $class = empty($parm['class']) ? 'e-tip page-link' : $parm['class']; return "lanVars($title,array('x'=>$this->var['download_category_name']))."\" href='".$url."'>".LAN_BACK.""; } diff --git a/e107_plugins/download/handlers/download_class.php b/e107_plugins/download/handlers/download_class.php index 6418ce3c7..56e45a1a0 100644 --- a/e107_plugins/download/handlers/download_class.php +++ b/e107_plugins/download/handlers/download_class.php @@ -17,8 +17,8 @@ class download private $orderOptions = array('download_id','download_datestamp','download_filesize','download_name','download_author','download_requested'); - private $templateHeader = ''; - private $templateFooter = ''; + private $templateHeader; + private $templateFooter; private $subCategories = array(); private $categories = array(); @@ -168,19 +168,24 @@ class download { case 'maincats': e107::canonical('download', 'index'); + e107::route('download/index'); break; case "list": + e107::route('download/category'); $this->loadList(); break; case "view": + e107::route('download/item'); $this->loadView(); break; case "report": + if(check_class($pref['download_reportbroken'])) { + e107::route('download/report'); $this->loadReport(); } break; @@ -889,7 +894,7 @@ class download global $nextprev_parms; - $nextprev_parms = http_build_query($nextprev,false,'&'); // 'tmpl_prefix='.deftrue('NEWS_NEXTPREV_TMPL', 'default').'&total='. $total_downloads.'&amount='.$amount.'¤t='.$newsfrom.$nitems.'&url='.$url; + $nextprev_parms = http_build_query($nextprev,false); // 'tmpl_prefix='.deftrue('NEWS_NEXTPREV_TMPL', 'default').'&total='. $total_downloads.'&amount='.$amount.'¤t='.$newsfrom.$nitems.'&url='.$url; $text .= $tp->parseTemplate($DOWNLOAD_LIST_NEXTPREV, TRUE, $sc); @@ -985,7 +990,7 @@ class download
".$frm->textarea('report_add', '')."
- ".$frm->button('report_download',LAN_dl_45,'submit')." + ".$frm->button('report_download',LAN_dl_45)."
"; diff --git a/e107_plugins/download/templates/download_template.php b/e107_plugins/download/templates/download_template.php index 24f5e2843..170423a71 100644 --- a/e107_plugins/download/templates/download_template.php +++ b/e107_plugins/download/templates/download_template.php @@ -506,18 +506,19 @@ $DOWNLOAD_TEMPLATE['view']['nextprev'] = " */ $DOWNLOAD_TEMPLATE['view']['nextprev'] = ' -