Skip to content

Commit b30eafd

Browse files
committed
a lot bugfixes
1 parent bcb8a7a commit b30eafd

File tree

9 files changed

+183
-152
lines changed

9 files changed

+183
-152
lines changed

install.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
12);
2929
$modules[] = new D2UModule('60-2',
3030
'D2U Guestbook - Infobox Bewertung',
31-
2);
31+
3);
3232
$modules[] = new D2UModule('60-3',
3333
'D2U Guestbook - Gästebuch ohne Tabs',
3434
10);

lib/d2u_guestbook_lang_helper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class d2u_guestbook_lang_helper extends \D2U_Helper\ALangHelper
2626
'd2u_guestbook_form_validate_spam_detected' => 'Your message was classified as spam, because not visible fields were filled in.',
2727
'd2u_guestbook_form_validate_title' => 'Failure sending message:',
2828
'd2u_guestbook_no' => 'No',
29+
'd2u_guestbook_no_entries' => 'Currently there are noch entries or ratings available.',
2930
'd2u_guestbook_oclock' => 'h',
3031
'd2u_guestbook_page' => 'Page',
3132
'd2u_guestbook_rating' => 'Customer quality and service rating',
@@ -41,7 +42,7 @@ class d2u_guestbook_lang_helper extends \D2U_Helper\ALangHelper
4142
* value the replacement.
4243
*/
4344
protected array $replacements_german = [
44-
'd2u_guestbook_form_email' => 'E-Mail-SAdresse',
45+
'd2u_guestbook_form_email' => 'E-Mail-Adresse',
4546
'd2u_guestbook_form_message' => 'Nachricht',
4647
'd2u_guestbook_form_name' => 'Name',
4748
'd2u_guestbook_form_privacy_policy' => 'Ich willige in die Speicherung und Verarbeitung meiner Kontakt- und Nutzungsdaten durch den Betreiber des Gästebuches ein. Über den Umfang der Datenverarbeitung habe ich mich <a href="+++LINK_PRIVACY_POLICY+++" target="_blank">hier</a> informiert. Ich habe das Recht dieser Verwendung jederzeit unter den im <a href="+++LINK_IMPRESS+++" target="_blank">Impressum</a> angegebenen Kontaktdaten zu widersprechen.',
@@ -58,6 +59,7 @@ class d2u_guestbook_lang_helper extends \D2U_Helper\ALangHelper
5859
'd2u_guestbook_form_validate_spam_detected' => 'Ihr Eintrag wurde als Spam eingestuft, da nicht sichtbare Felder ausgefüllt wurden.',
5960
'd2u_guestbook_form_validate_title' => 'Fehler beim Senden:',
6061
'd2u_guestbook_no' => 'Nein',
62+
'd2u_guestbook_no_entries' => 'Es sind noch keine Gästebucheinträge und Bewertungen vorhanden.',
6163
'd2u_guestbook_oclock' => 'Uhr',
6264
'd2u_guestbook_page' => 'Seite',
6365
'd2u_guestbook_rating' => 'Kundenbewertung in Qualität, Service und Zuverlässigkeit',

lib/d2u_guestbook_module_manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static function getModules()
1818
12);
1919
$modules[] = new D2UModule('60-2',
2020
'D2U Guestbook - Infobox Bewertung',
21-
2);
21+
3);
2222
$modules[] = new D2UModule('60-3',
2323
'D2U Guestbook - Gästebuch ohne Tabs',
2424
10);

modules/60/1/output.php

Lines changed: 70 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -45,52 +45,58 @@ function sendAdminNotification($yform)
4545
$entries = \D2U_Guestbook\Entry::getAll(true);
4646
$page_no = 0;
4747

48-
for ($i = 0; $i < count($entries); ++$i) {
49-
$entry = $entries[$i];
50-
51-
if (0 == $i % rex_config::get('d2u_guestbook', 'no_entries_page', 10)) {
52-
++$page_no;
53-
if (1 != $page_no) {
54-
echo '</div>';
48+
if(0 === count($entries)) {
49+
echo '<p>'. \Sprog\Wildcard::get('d2u_guestbook_no_entries') . '</p>';
50+
}
51+
else {
52+
for ($i = 0; $i < count($entries); ++$i) {
53+
$entry = $entries[$i];
54+
55+
if (0 == $i % rex_config::get('d2u_guestbook', 'no_entries_page', 10)) {
56+
++$page_no;
57+
if (1 != $page_no) {
58+
echo '</div>';
59+
}
60+
echo '<div class="row guestbook-page pages-'. $page_no .'">'; // Pagination div
5561
}
56-
echo '<div class="row guestbook-page pages-'. $page_no .'">'; // Pagination div
57-
}
5862

59-
echo '<div class="col-12">';
60-
61-
echo '<div class="entry-header">';
62-
echo '<div class="row">';
63-
echo '<div class="col-6"><b>';
64-
if ('' != $entry->email && 'true' == rex_config::get('d2u_guestbook', 'allow_answer', 'false')) {
65-
echo '<a href="mailto:'. $entry->email .'">';
66-
echo $entry->name .' <span class="icon mail"></span>';
67-
echo '</a>';
68-
} else {
69-
echo $entry->name;
70-
}
71-
echo '</b></div>';
72-
echo '<div class="col-6 right">'. date('d.m.Y H:i', strtotime($entry->create_date)) .' '. $tag_open .'d2u_guestbook_oclock'. $tag_close .'</div>';
73-
echo '</div>';
74-
echo '</div>';
75-
76-
echo '<div class="entry-body">';
77-
echo '<div class="row">';
78-
echo '<div class="col-12">'. nl2br($entry->description) .'</div>';
79-
if (!$hide_rating && $entry->rating > 0) {
80-
echo '<div class="col-12"><b>'. $tag_open .'d2u_guestbook_rating'. $tag_close .': ';
81-
for ($j = 1; $j <= 5; ++$j) {
82-
if ($j <= $entry->rating) {
83-
echo ' <span class="icon star-full"></span>';
84-
} else {
85-
echo ' <span class="icon star-empty"></span>';
86-
}
63+
echo '<div class="col-12">';
64+
65+
echo '<div class="entry-header">';
66+
echo '<div class="row">';
67+
echo '<div class="col-6"><b>';
68+
if ('' != $entry->email && 'true' == rex_config::get('d2u_guestbook', 'allow_answer', 'false')) {
69+
echo '<a href="mailto:'. $entry->email .'">';
70+
echo $entry->name .' <span class="icon mail"></span>';
71+
echo '</a>';
72+
} else {
73+
echo $entry->name;
8774
}
8875
echo '</b></div>';
89-
}
90-
echo '</div>';
91-
echo '</div>';
76+
echo '<div class="col-6 right">'. date('d.m.Y H:i', strtotime($entry->create_date)) .' '. $tag_open .'d2u_guestbook_oclock'. $tag_close .'</div>';
77+
echo '</div>';
78+
echo '</div>';
79+
80+
echo '<div class="entry-body">';
81+
echo '<div class="row">';
82+
echo '<div class="col-12">'. nl2br($entry->description) .'</div>';
83+
if (!$hide_rating && $entry->rating > 0) {
84+
echo '<div class="col-12"><b>'. $tag_open .'d2u_guestbook_rating'. $tag_close .': ';
85+
for ($j = 1; $j <= 5; ++$j) {
86+
if ($j <= $entry->rating) {
87+
echo ' <span class="icon star-full"></span>';
88+
} else {
89+
echo ' <span class="icon star-empty"></span>';
90+
}
91+
}
92+
echo '</b></div>';
93+
}
94+
echo '</div>';
95+
echo '</div>';
9296

93-
echo '</div>';
97+
echo '</div>';
98+
echo '</div>';
99+
}
94100
}
95101
echo '</div>'; // tab_guestbook
96102

@@ -119,41 +125,42 @@ function changePage(pageno) {
119125
echo '</div>';
120126
}
121127

122-
echo '</div>';
123-
124128
// Entry Form
125129
echo '<div id="tab_write" class="tab-pane fade guestbook-tab">';
126130
echo '<div class="row">';
127131
echo '<div class="col-12">';
128132
echo '<fieldset><legend>'. $tag_open .'d2u_guestbook_tab_write'. $tag_close .'</legend>';
129133
?>
130134
<script>
131-
function set_stars(wert) {
135+
function d2u_guestbook_module_60_1_set_stars(wert) {
132136
for(var x = 1; x <= 5; x++) {
133137
if(x <= wert) {
134-
if($('#star' + x).hasClass('star-empty')) {
135-
$('#star' + x).removeClass('star-empty');
136-
$('#star' + x).addClass('star-full');
138+
if($('#d2u_guestbook_module_60_1_star' + x).hasClass('star-empty')) {
139+
$('#d2u_guestbook_module_60_1_star' + x).removeClass('star-empty');
140+
$('#d2u_guestbook_module_60_1_star' + x).addClass('star-full');
137141
}
138142
}
139143
else {
140-
if($('#star' + x).hasClass('star-full')) {
141-
$('#star' + x).removeClass('star-full');
142-
$('#star' + x).addClass('star-empty');
144+
if($('#d2u_guestbook_module_60_1_star' + x).hasClass('star-full')) {
145+
$('#d2u_guestbook_module_60_1_star' + x).removeClass('star-full');
146+
$('#d2u_guestbook_module_60_1_star' + x).addClass('star-empty');
143147
}
144148
}
145149
}
146150
}
147-
function reset_stars(wert) {
148-
set_stars($('input[name=rating]').val());
151+
function d2u_guestbook_module_60_1_reset_stars(wert) {
152+
d2u_guestbook_module_60_1_set_stars($('input[name=rating]').val());
149153
}
150-
function click_stars(wert) {
154+
function d2u_guestbook_module_60_1_click_stars(wert) {
151155
$('input[name=rating]').val(wert);
152-
set_stars(wert);
156+
d2u_guestbook_module_60_1_set_stars(wert);
153157
}
154158
</script>
155159
<?php
156-
$stars = '<span class="icon star-empty" id="star1" onmouseover="set_stars(1)" onmouseout="reset_stars(1)" onclick="click_stars(1)"></span> <span class="icon star-empty" id="star2" onmouseover="set_stars(2)" onmouseout="reset_stars(2)" onclick="click_stars(2)"></span> <span class="icon star-empty" id="star3" onmouseover="set_stars(3)" onmouseout="reset_stars(3)" onclick="click_stars(3)"></span> <span class="icon star-empty" id="star4" onmouseover="set_stars(4)" onmouseout="reset_stars(4)" onclick="click_stars(4)"></span> <span class="icon star-empty" id="star5" onmouseover="set_stars(5)" onmouseout="reset_stars(5)" onclick="click_stars(5)"></span>';
160+
$stars = '';
161+
for($i = 1; $i <= 5; $i++) {
162+
$stars .= '<span class="icon star-empty" id="d2u_guestbook_module_60_1_star'. $i.'" onmouseover="d2u_guestbook_module_60_1_set_stars('. $i.')" onmouseout="d2u_guestbook_module_60_1_reset_stars('. $i.')" onclick="d2u_guestbook_module_60_1_click_stars('. $i.')"></span> ';
163+
}
157164
$form_data = '
158165
text|name|'. $tag_open .'d2u_guestbook_form_name'. $tag_close .' *
159166
email|email|'. $tag_open .'d2u_guestbook_form_email'. $tag_close .'
@@ -183,11 +190,12 @@ function click_stars(wert) {
183190

184191
$yform = new rex_yform();
185192
$yform->setFormData(trim($form_data));
186-
$yform->setObjectparams('real_field_names', true);
193+
$yform->setObjectparams('csrf_protection', false);
194+
$yform->setObjectparams('Error-occured', $tag_open .'d2u_guestbook_form_validate_title'. $tag_close);
187195
$yform->setObjectparams('form_action', rex_getUrl(rex_article::getCurrentId()));
188196
$yform->setObjectparams('form_anchor', 'tab_write');
189-
$yform->setObjectparams('Error-occured', $tag_open .'d2u_guestbook_form_validate_title'. $tag_close);
190197
$yform->setObjectparams('form_name', 'd2u_guestbook_module_60_1_'. rand(1, 100));
198+
$yform->setObjectparams('real_field_names', true);
191199

192200
// action - showtext
193201
$yform->setActionField('showtext', [$tag_open .'d2u_guestbook_form_thanks'. $tag_close]);
@@ -199,6 +207,9 @@ function click_stars(wert) {
199207
// End request form
200208
echo '</div>'; // tab_write
201209

210+
echo '</div>'; // tab_content
211+
212+
echo '</div>';
202213
echo '</div>';
203214
echo '</div>';
204215
?>
@@ -210,7 +221,5 @@ function click_stars(wert) {
210221
});
211222

212223
// set stars on failure page correctly
213-
set_stars($('input[name=rating]').val());
214-
</script>
215-
</div>
216-
</div>
224+
d2u_guestbook_module_60_1_set_stars($('input[name=rating]').val());
225+
</script>

modules/60/1/style.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ a.recommendation:hover {
5050
content: "\f006";
5151
}
5252

53-
53+
#guestbook_tabs {
54+
border-bottom: none;
55+
}
5456
#guestbook_tabs a.active {
5557
background-color: navi_color_bg;
5658
}

modules/60/2/output.php

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,39 @@
99

1010
$rating = round(D2U_Guestbook\Entry::getRating(), 1);
1111
$num_recommendations = D2U_Guestbook\Entry::getRecommendation();
12-
12+
$entries = D2U_Guestbook\Entry::getAll(true);
1313
?>
1414
<div class="col-12 col-sm-6 col-md-4 col-lg-12">
1515
<div class="infobox">
1616
<div class="infobox-header"><?= $tag_open .'d2u_guestbook_ratings'. $tag_close ?></div>
1717
<div class="infobox-content" style="text-align: center" title="<?= $tag_open .'d2u_guestbook_rating'. $tag_close ?>">
1818
<?php
19-
if ($show_link) {
20-
echo '<a href="'. rex_getUrl($d2u_guestbook->getConfig('guestbook_article_id')) .'" class="recommendation">';
19+
if(0 === count($entries)) {
20+
echo '<p>'. \Sprog\Wildcard::get('d2u_guestbook_no_entries') . '</p>';
2121
}
22-
echo '<div class="recommendation-stars">';
23-
for ($i = 1; $i <= 5; ++$i) {
24-
if ($i <= $rating) {
25-
echo '<span class="icon star-full"></span> ';
26-
} elseif ($i <= $rating + 1) {
27-
echo '<span class="icon star-half"></span> ';
28-
} else {
29-
echo '<span class="icon star-empty"></span> ';
22+
else {
23+
if ($show_link) {
24+
echo '<a href="'. rex_getUrl($d2u_guestbook->getConfig('guestbook_article_id')) .'" class="recommendation">';
25+
}
26+
echo '<div class="recommendation-stars">';
27+
for ($i = 1; $i <= 5; ++$i) {
28+
if ($i <= $rating) {
29+
echo '<span class="icon star-full"></span> ';
30+
} elseif ($i <= $rating + 1) {
31+
echo '<span class="icon star-half"></span> ';
32+
} else {
33+
echo '<span class="icon star-empty"></span> ';
34+
}
35+
}
36+
echo '</div>';
37+
if ($show_link) {
38+
echo '</a>';
39+
echo '<a href="'. rex_getUrl($d2u_guestbook->getConfig('guestbook_article_id')) .'">';
40+
}
41+
echo $tag_open .'d2u_guestbook_recommended_pre'. $tag_close .' '. $num_recommendations .' '. $tag_open .'d2u_guestbook_recommended_post'. $tag_close;
42+
if ($show_link) {
43+
echo '</a>';
3044
}
31-
}
32-
echo '</div>';
33-
if ($show_link) {
34-
echo '</a>';
35-
echo '<a href="'. rex_getUrl($d2u_guestbook->getConfig('guestbook_article_id')) .'">';
36-
}
37-
echo $tag_open .'d2u_guestbook_recommended_pre'. $tag_close .' '. $num_recommendations .' '. $tag_open .'d2u_guestbook_recommended_post'. $tag_close;
38-
if ($show_link) {
39-
echo '</a>';
4045
}
4146
?>
4247
</div>

modules/60/2/style.css

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
url("./assets/addons/be_style/fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular") format('svg');
1010
}
1111

12-
.right {
13-
text-align: right;
14-
}
15-
.entry-body {
16-
padding: 0.25em 1em 2em 1em;
17-
}
18-
.entry-header {
19-
background-color: article_color_box;
20-
border-bottom: 1px solid navi_color_bg;
21-
padding: 0.25em 1em;
12+
13+
article .infobox-header {
14+
background-color: article_color_h;
15+
color: #ffffff;
16+
padding: 0.25em 0.75em;
17+
text-align: center;
18+
}
19+
article .infobox {
20+
border: 1px solid article_color_h;
21+
margin-bottom: 1em;
2222
width: 100%;
23-
}
23+
}
2424
.recommendation-stars {
2525
font-size: 1.5em;
2626
}

0 commit comments

Comments
 (0)