From f9da54f9894ad3101fc937ac2af5d53c51793e05 Mon Sep 17 00:00:00 2001 From: rogercreagh <44980188+rogercreagh@users.noreply.github.com> Date: Fri, 27 Jan 2023 20:18:43 +0000 Subject: [PATCH] v1.0.3.8 site book view ok with pv --- .../admin/views/book/view.html.php | 6 +- src/com_xbbooks/site/models/book.php | 25 +- .../site/views/book/tmpl/default.php | 409 +++++++++++------- .../site/views/book/tmpl/modalcpv.php | 31 ++ .../site/views/book/tmpl/modalgpv.php | 31 ++ .../site/views/book/tmpl/modalppv.php | 31 ++ src/com_xbbooks/xbbooks.xml | 2 +- 7 files changed, 355 insertions(+), 180 deletions(-) create mode 100755 src/com_xbbooks/site/views/book/tmpl/modalcpv.php create mode 100755 src/com_xbbooks/site/views/book/tmpl/modalgpv.php create mode 100755 src/com_xbbooks/site/views/book/tmpl/modalppv.php diff --git a/src/com_xbbooks/admin/views/book/view.html.php b/src/com_xbbooks/admin/views/book/view.html.php index 65d6b12..0a4d92d 100644 --- a/src/com_xbbooks/admin/views/book/view.html.php +++ b/src/com_xbbooks/admin/views/book/view.html.php @@ -2,7 +2,7 @@ /******* * @package xbBooks * @filesource admin/views/book/view.html.php - * @version 1.0.2.2 6th January 2023 + * @version 1.0.3.8 27th January 2023 * @author Roger C-O * @copyright Copyright (c) Roger Creagh-Osborne, 2021 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html @@ -90,8 +90,6 @@ protected function addToolBar() ToolbarHelper::save('book.save'); ToolbarHelper::save2new('book.save2new'); ToolbarHelper::save2copy('book.save2copy'); - ToolbarHelper::custom('book.save2NewPer', 'user', '', 'XBCULTURE_BTN_SAVE2PER', false) ; - ToolbarHelper::custom('book.save2NewChar', 'user', '', 'XBCULTURE_BTN_SAVE2CHAR', false) ; ToolbarHelper::custom('book.save2NewRev', 'comment', '', 'XBCULTURE_BTN_SAVE2REV', false) ; if ($isNew) { ToolbarHelper::cancel('book.cancel','JTOOLBAR_CANCEL'); @@ -104,7 +102,7 @@ protected function addToolBar() if ($this->item->id > 0) { $dhtml = ' '.Text::_('Preview').''; + class="btn btn-small btn-primary"> '.Text::_('Preview').''; $bar->appendButton('Custom', $dhtml); } ToolbarHelper::help( '', false,'https://crosborne.uk/xbbooks/doc?tmpl=component#bookedit' ); diff --git a/src/com_xbbooks/site/models/book.php b/src/com_xbbooks/site/models/book.php index 9d6c383..0bafbbb 100644 --- a/src/com_xbbooks/site/models/book.php +++ b/src/com_xbbooks/site/models/book.php @@ -2,7 +2,7 @@ /******* * @package xbBooks * @filesource site/models/book.php - * @version 0.9.11.2 17th November 2022 + * @version 1.0.3.8 27th January 2023 * @author Roger C-O * @copyright Copyright (c) Roger Creagh-Osborne, 2021 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html @@ -38,6 +38,9 @@ public function getItem($id = null) { a.state AS published, a.catid AS catid, a.params AS params, a.metadata AS metadata, a.created AS created '); $query->from('#__xbbooks AS a'); $query->select('(SELECT AVG(br.rating) FROM #__xbbookreviews AS br WHERE br.book_id=a.id) AS averat'); + $query->select('(SELECT COUNT(DISTINCT(bp.person_id)) FROM #__xbbookperson AS bp WHERE bp.book_id = a.id) AS pcnt'); + $query->select('(SELECT COUNT(DISTINCT(bc.char_id)) FROM #__xbbookcharacter AS bc WHERE bc.book_id = a.id) AS ccnt'); + $query->select('(SELECT COUNT(DISTINCT(bg.group_id)) FROM #__xbbookgroup AS bg WHERE bg.book_id = a.id) AS gcnt'); $query->select('c.title AS category_title'); $query->leftJoin('#__categories AS c ON c.id = a.catid'); $query->where('a.id = '.$id); @@ -84,15 +87,21 @@ public function getItem($id = null) { $item->mencnt = count(array_keys($roles, 'mention')); $item->othcnt = count(array_keys($roles, 'other')); - $item->alist = $item->authcnt==0 ? '' : XbcultureHelper::makeLinkedNameList($item->people,'author','comma'); - $item->elist = $item->editcnt==0 ? '' : XbcultureHelper::makeLinkedNameList($item->people,'editor','comma'); - $item->mlist = $item->mencnt==0 ? '' : XbcultureHelper::makeLinkedNameList($item->people,'mention','ul',true,1); - $item->olist =$item->othcnt==0 ? '' : XbcultureHelper::makeLinkedNameList($item->people,'other','ul',true,1); + $item->alist = $item->authcnt==0 ? '' : XbcultureHelper::makeItemLists($item->people,'author','tn',5,'ppvmodal'); + $item->elist = $item->editcnt==0 ? '' : XbcultureHelper::makeItemLists($item->people,'editor','tn',5,'ppvmodal'); + $item->mlist = $item->mencnt==0 ? '' : XbcultureHelper::makeItemLists($item->people,'mention','tn',5,'ppvmodal'); + $item->olist =$item->othcnt==0 ? '' : XbcultureHelper::makeItemLists($item->people,'other','rtn',5,'ppvmodal'); - $item->chars = XbbooksGeneral::getBookChars($item->id); - $item->charcnt = empty($item->chars) ? 0 : count($item->chars); - $item->clist = $item->charcnt==0 ? '' : XbcultureHelper::makeLinkedNameList($item->chars,'char','ul',true,1); + if ($item->ccnt>0) { + $item->chars = XbbooksGeneral::getBookChars($item->id); + $item->clist = $item->ccnt==0 ? '' : XbcultureHelper::makeItemLists($item->chars,'char','tn',5,'cpvmodal'); + } + if ($item->gcnt>0) { + $item->groups = XbbooksGeneral::getBookGroups($item->id); + $item->grouplist = XbcultureHelper::makeItemLists($item->groups,'','rtn',5,'gpvgmodal'); + } + //order by review rating or date? $item->reviews = XbbooksGeneral::getBookReviews($item->id); $item->revcnt = count($item->reviews); diff --git a/src/com_xbbooks/site/views/book/tmpl/default.php b/src/com_xbbooks/site/views/book/tmpl/default.php index ea6ce3b..d2f94ca 100644 --- a/src/com_xbbooks/site/views/book/tmpl/default.php +++ b/src/com_xbbooks/site/views/book/tmpl/default.php @@ -2,7 +2,7 @@ /******* * @package xbBooks * @filesource site/views/book/tmpl/default.php - * @version 1.0.3.2 9th January 2023 + * @version 1.0.3.8 27th January 2023 * @author Roger C-O * @copyright Copyright (c) Roger Creagh-Osborne, 2021 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html @@ -33,16 +33,23 @@ } ?> +
-
+
- show_image == 1 )) : ?> + show_image !=2 ) : ?>
- + + +
-
+
revcnt>0) : ?> @@ -53,20 +60,26 @@ star_class.'">',intval($item->averat)); ?> averat - floor($item->averat))>0) : ?> - (averat,1); ?>) +
+ revcnt >1) : ?> + averat,1); ?> average from revcnt; ?> ratings
+ + One review on reviews[0]->rev_date;?> + +
-

+

no reviews available

-

pubyear>0) { - echo Text::_('XBBOOKS_FIRSTPUB').': '.$item->pubyear; - } ?>

+

pubyear>0) { + echo Text::_('XBBOOKS_FIRSTPUB').': '.$item->pubyear.''; + } ?>

show_fict) : ?>

fiction==1) : ?> - ' + @@ -77,141 +90,165 @@ subtitle != '') : ?>

subtitle; ?>

-
- editcnt>0) : ?> -
-

: - elist; ?> -

-
- -

- authcnt>0) : ?> -

- - authcnt==1) ? 'XBCULTURE_AUTHOR' : 'XBCULTURE_AUTHORS').': '; ?> - - alist; ?> -

- -

- -
-
-
+ editcnt>0) : ?> +

: + elist['commalist']; ?> +

+ + authcnt>0) : ?> +

+ + authcnt==1) ? 'XBCULTURE_AUTHOR' : 'XBCULTURE_AUTHORS').': '; ?> + + alist['commalist']; ?> +

+ +

+ +
+ summary)!='') { + $sum = ''.Text::_('XBCULTURE_SUMMARY').': '.$item->summary; + } elseif (trim($item->synopsis)!='') { + $sum = ''.Text::_('XBBOOKS_SYNOPSIS_EXTRACT').': '.XbcultureHelper::makeSummaryText($item->synopsis,200); + } else { + $sum = ''.Text::_('XBBOOKS_NO_SUMMARY_SYNOPSIS').''; + } ?> +
+
+
+
+
+ publisher=='') || (!$hide_empty)) : ?> +
+
+ publisher=='') ? $item->publisher : ''.Text::_('XBBOOKS_UNKNOWN').''; ?> +
+
+ + orig_lang=='') || (!$hide_empty)) : ?> +
+
+ orig_lang=='') ? $item->orig_lang : ''.Text::_('XBBOOKS_UNKNOWN').''; ?> +
+
+ +
+
+
+ edition=='') || (!$hide_empty)) : ?> +
+
+ edition=='') ? $item->edition : ''.Text::_('XBBOOKS_UNKNOWN').''; ?> +
+
+ + format=='') || (!$hide_empty)) : ?> +
+
+ format=='') ? $item->format : ''.Text::_('XBBOOKS_UNKNOWN').''; ?> +
+
+ + +
+
+ mencnt + $item->othcnt + $item->ccnt + $item->gcnt) > 0) || (!$hide_empty)) : ?> +
+
+ mencnt + $item->ccnt) > 0) || (!$hide_empty)) : ?> +
+

People mentioned & Characters

+ mencnt > 0) || (!$hide_empty)) : ?> +
+ : +
+ mencnt == 0) : ?> +
+ +
+
mlist['ullist'] ; ?>
+ +
+ + ccnt > 0) || (!$hide_empty)) : ?> +
+ : +
+ ccnt == 0) : ?> +
+ +
+
clist['ullist'] ; ?>
+ + +
+ + othcnt + $item->gcnt) > 0) || (!$hide_empty)) : ?> +
+ othcnt > 0) || (!$hide_empty)) : ?> +

Other Production Roles

+ othcnt == 0) : ?> +
+ +
olist['ullist'] ; ?>
+ + + gcnt > 0) || (!$hide_empty)) : ?> +

Groups

+ gcnt == 0) : ?> +
+ +
grouplist['ullist'] ; ?>
+ + +
+ +
+ + ext_links_cnt > 0) : ?> +
+
+
+

+ ext_links_list; ?> +
+
+ +
+ show_bcat >0) : ?> +
+
+
+ show_bcat==2) : ?> + + category_title; ?> + + + category_title; ?> + +
+
+ + show_btags>0) && (!empty($item->tags))) : ?> +
+
+
+
+ render($item->tags); ?> +
+
+ +
+
show_image == 2 )) : ?>
-
+
-summary) != '') : ?> -
-
-
-
-
- : -
-
summary; ?>
-
-
-
-
- -
-
- publisher=='') || (!$hide_empty)) : ?> -
-
- publisher=='') ? $item->publisher : ''.Text::_('XBBOOKS_UNKNOWN').''; ?> -
-
- - orig_lang=='') || (!$hide_empty)) : ?> -
-
- orig_lang=='') ? $item->orig_lang : ''.Text::_('XBBOOKS_UNKNOWN').''; ?> -
-
- -
-
-
- edition=='') || (!$hide_empty)) : ?> -
-
- edition=='') ? $item->edition : ''.Text::_('XBBOOKS_UNKNOWN').''; ?> -
-
- - format=='') || (!$hide_empty)) : ?> -
-
- format=='') ? $item->format : ''.Text::_('XBBOOKS_UNKNOWN').''; ?> -
-
- - -
-
-
-mencnt + $item->othcnt + $item->charcnt) > 0) || (!$hide_empty)) : ?> -
- mencnt + $item->charcnt) > 0) || (!$hide_empty)) : ?> -
-

People mentioned & Characters

- mencnt > 0) || (!$hide_empty)) : ?> -
- : -
- mencnt == 0) : ?> -
- -
-
mlist ; ?>
- -
- - charcnt > 0) || (!$hide_empty)) : ?> -
- : -
- charcnt == 0) : ?> -
- -
-
clist ; ?>
- - -
- - othcnt > 0) || (!$hide_empty)) : ?> -
-

Other Production Roles

- othcnt > 0) || (!$hide_empty)) : ?> - othcnt == 0) : ?> -
- -
olist ; ?>
- - -
- -
-
- -ext_links_cnt > 0) : ?> -
-
-

- ext_links_list; ?> -
-
-
- show_bdates) : ?>
@@ -249,32 +286,6 @@ echo $item->synopsis; } ?>
-
- show_bcat >0) : ?> -
-
-
- show_bcat==2) : ?> - - category_title; ?> - - - category_title; ?> - -
-
- - show_btags>0) && (!empty($item->tags))) : ?> -
-
-
-
- render($item->tags); ?> -
-
- -
show_brevs>0) : ?>
@@ -284,7 +295,7 @@ reviews as $rev) : ?>
-
+
show_brevs>0) : ?>
zero_rating) && ($rev->rating==0)) : ?> @@ -377,4 +388,68 @@

+ + + + + + diff --git a/src/com_xbbooks/site/views/book/tmpl/modalcpv.php b/src/com_xbbooks/site/views/book/tmpl/modalcpv.php new file mode 100755 index 0000000..0597d76 --- /dev/null +++ b/src/com_xbbooks/site/views/book/tmpl/modalcpv.php @@ -0,0 +1,31 @@ + + + + + diff --git a/src/com_xbbooks/site/views/book/tmpl/modalgpv.php b/src/com_xbbooks/site/views/book/tmpl/modalgpv.php new file mode 100755 index 0000000..df203df --- /dev/null +++ b/src/com_xbbooks/site/views/book/tmpl/modalgpv.php @@ -0,0 +1,31 @@ + + + + + diff --git a/src/com_xbbooks/site/views/book/tmpl/modalppv.php b/src/com_xbbooks/site/views/book/tmpl/modalppv.php new file mode 100755 index 0000000..e719c6a --- /dev/null +++ b/src/com_xbbooks/site/views/book/tmpl/modalppv.php @@ -0,0 +1,31 @@ + + + + + diff --git a/src/com_xbbooks/xbbooks.xml b/src/com_xbbooks/xbbooks.xml index 28c0f3c..44bd9d2 100644 --- a/src/com_xbbooks/xbbooks.xml +++ b/src/com_xbbooks/xbbooks.xml @@ -2,7 +2,7 @@ xbbooks 27th January 2023 - 1.0.3.7 + 1.0.3.8 Roger C-O roger@crosborne.uk www.crosborne.uk