Merge lp:~sebastian-meyer/goobi-presentation/bug826641 into lp:goobi-presentation/1.0

Proposed by Sebastian Meyer
Status: Merged
Merged at revision: 35
Proposed branch: lp:~sebastian-meyer/goobi-presentation/bug826641
Merge into: lp:goobi-presentation/1.0
Diff against target: 118 lines (+18/-33)
5 files modified
dlf/common/class.tx_dlf_plugin.php (+3/-26)
dlf/plugins/navigation/class.tx_dlf_navigation.php (+2/-1)
dlf/plugins/pageview/class.tx_dlf_pageview.php (+2/-1)
dlf/plugins/toc/class.tx_dlf_toc.php (+9/-3)
dlf/plugins/toolbox/class.tx_dlf_toolbox.php (+2/-2)
To merge this branch: bzr merge lp:~sebastian-meyer/goobi-presentation/bug826641
Reviewer Review Type Date Requested Status
Sebastian Meyer Approve
Review via email: mp+71568@code.launchpad.net

Commit message

Fix Bug #826641: Page view doesn't default to first page

To post a comment you must log in.
Revision history for this message
Sebastian Meyer (sebastian-meyer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dlf/common/class.tx_dlf_plugin.php'
2--- dlf/common/class.tx_dlf_plugin.php 2011-08-02 17:38:33 +0000
3+++ dlf/common/class.tx_dlf_plugin.php 2011-08-15 15:30:34 +0000
4@@ -66,29 +66,6 @@
5 protected $template = '';
6
7 /**
8- * Checks $this->piVars array for common required fields and sets some default values
9- *
10- * @access protected
11- *
12- * @param boolean $dontSetDefaults: If TRUE only checks for required fields are performed
13- *
14- * @return boolean TRUE on success or FALSE when required fields are missing
15- */
16- protected function checkPIvars($dontSetDefaults = FALSE) {
17-
18- if (!$dontSetDefaults) {
19-
20- // Set default values for some fields if not set.
21- $this->piVars['page'] = (!empty($this->piVars['page']) ? max(intval($this->piVars['page']), 1) : 1);
22-
23- }
24-
25- // Check for required fields.
26- return !empty($this->piVars['id']);
27-
28- }
29-
30- /**
31 * All the needed configuration values are stored in class variables
32 * Priority: Flexforms > TS-Templates > Extension Configuration > ext_localconf.php
33 *
34@@ -179,8 +156,8 @@
35 */
36 protected function loadDocument() {
37
38- // Check for required fields.
39- if ($this->checkPIvars(TRUE)) {
40+ // Check for required variable.
41+ if (!empty($this->piVars['id'])) {
42
43 // Should we exclude documents from other pages than $this->conf['pages']?
44 $pid = (!empty($this->conf['excludeOther']) ? intval($this->conf['pages']) : 0);
45@@ -196,7 +173,7 @@
46
47 } else {
48
49- trigger_error('Required parameters are not set', E_USER_ERROR);
50+ trigger_error('No UID given for document', E_USER_ERROR);
51
52 }
53
54
55=== modified file 'dlf/plugins/navigation/class.tx_dlf_navigation.php'
56--- dlf/plugins/navigation/class.tx_dlf_navigation.php 2011-08-02 17:38:33 +0000
57+++ dlf/plugins/navigation/class.tx_dlf_navigation.php 2011-08-15 15:30:34 +0000
58@@ -63,7 +63,8 @@
59
60 } else {
61
62- $this->piVars['page'] = min($this->piVars['page'], $this->doc->numPages);
63+ // Set default values for page if not set.
64+ $this->piVars['page'] = t3lib_div::intInRange($this->piVars['page'], 1, $this->doc->numPages, 1);
65
66 }
67
68
69=== modified file 'dlf/plugins/pageview/class.tx_dlf_pageview.php'
70--- dlf/plugins/pageview/class.tx_dlf_pageview.php 2011-08-02 17:38:33 +0000
71+++ dlf/plugins/pageview/class.tx_dlf_pageview.php 2011-08-15 15:30:34 +0000
72@@ -159,7 +159,8 @@
73
74 } else {
75
76- $this->piVars['page'] = min($this->piVars['page'], $this->doc->numPages);
77+ // Set default values for page if not set.
78+ $this->piVars['page'] = t3lib_div::intInRange($this->piVars['page'], 1, $this->doc->numPages, 1);
79
80 }
81
82
83=== modified file 'dlf/plugins/toc/class.tx_dlf_toc.php'
84--- dlf/plugins/toc/class.tx_dlf_toc.php 2011-08-10 16:08:20 +0000
85+++ dlf/plugins/toc/class.tx_dlf_toc.php 2011-08-15 15:30:34 +0000
86@@ -169,9 +169,15 @@
87
88 }
89
90- // Quit without doing anything if required piVars are not set.
91- if (!$this->checkPIvars()) {
92-
93+ // Check for required variable.
94+ if (!empty($this->piVars['id'])) {
95+
96+ // Set default values for page if not set.
97+ $this->piVars['page'] = (!empty($this->piVars['page']) ? max(intval($this->piVars['page']), 1) : 1);
98+
99+ } else {
100+
101+ // Quit without doing anything.
102 return $content;
103
104 }
105
106=== modified file 'dlf/plugins/toolbox/class.tx_dlf_toolbox.php'
107--- dlf/plugins/toolbox/class.tx_dlf_toolbox.php 2011-04-01 15:53:16 +0000
108+++ dlf/plugins/toolbox/class.tx_dlf_toolbox.php 2011-08-15 15:30:34 +0000
109@@ -56,8 +56,8 @@
110 // Turn cache off.
111 $this->setCache(FALSE);
112
113- // Quit without doing anything if required piVars are not set.
114- if (!$this->checkPIvars(TRUE)) {
115+ // Quit without doing anything if required variable is not set.
116+ if (empty($this->piVars['id'])) {
117
118 return $content;
119

Subscribers

People subscribed via source and target branches

to all changes: