Skip to content

Commit

Permalink
a lot bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasKrais committed Mar 24, 2023
1 parent bcb8a7a commit b30eafd
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 152 deletions.
2 changes: 1 addition & 1 deletion install.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
12);
$modules[] = new D2UModule('60-2',
'D2U Guestbook - Infobox Bewertung',
2);
3);
$modules[] = new D2UModule('60-3',
'D2U Guestbook - Gästebuch ohne Tabs',
10);
Expand Down
4 changes: 3 additions & 1 deletion lib/d2u_guestbook_lang_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class d2u_guestbook_lang_helper extends \D2U_Helper\ALangHelper
'd2u_guestbook_form_validate_spam_detected' => 'Your message was classified as spam, because not visible fields were filled in.',
'd2u_guestbook_form_validate_title' => 'Failure sending message:',
'd2u_guestbook_no' => 'No',
'd2u_guestbook_no_entries' => 'Currently there are noch entries or ratings available.',
'd2u_guestbook_oclock' => 'h',
'd2u_guestbook_page' => 'Page',
'd2u_guestbook_rating' => 'Customer quality and service rating',
Expand All @@ -41,7 +42,7 @@ class d2u_guestbook_lang_helper extends \D2U_Helper\ALangHelper
* value the replacement.
*/
protected array $replacements_german = [
'd2u_guestbook_form_email' => 'E-Mail-SAdresse',
'd2u_guestbook_form_email' => 'E-Mail-Adresse',
'd2u_guestbook_form_message' => 'Nachricht',
'd2u_guestbook_form_name' => 'Name',
'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.',
Expand All @@ -58,6 +59,7 @@ class d2u_guestbook_lang_helper extends \D2U_Helper\ALangHelper
'd2u_guestbook_form_validate_spam_detected' => 'Ihr Eintrag wurde als Spam eingestuft, da nicht sichtbare Felder ausgefüllt wurden.',
'd2u_guestbook_form_validate_title' => 'Fehler beim Senden:',
'd2u_guestbook_no' => 'Nein',
'd2u_guestbook_no_entries' => 'Es sind noch keine Gästebucheinträge und Bewertungen vorhanden.',
'd2u_guestbook_oclock' => 'Uhr',
'd2u_guestbook_page' => 'Seite',
'd2u_guestbook_rating' => 'Kundenbewertung in Qualität, Service und Zuverlässigkeit',
Expand Down
2 changes: 1 addition & 1 deletion lib/d2u_guestbook_module_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static function getModules()
12);
$modules[] = new D2UModule('60-2',
'D2U Guestbook - Infobox Bewertung',
2);
3);
$modules[] = new D2UModule('60-3',
'D2U Guestbook - Gästebuch ohne Tabs',
10);
Expand Down
131 changes: 70 additions & 61 deletions modules/60/1/output.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,52 +45,58 @@ function sendAdminNotification($yform)
$entries = \D2U_Guestbook\Entry::getAll(true);
$page_no = 0;

for ($i = 0; $i < count($entries); ++$i) {
$entry = $entries[$i];

if (0 == $i % rex_config::get('d2u_guestbook', 'no_entries_page', 10)) {
++$page_no;
if (1 != $page_no) {
echo '</div>';
if(0 === count($entries)) {
echo '<p>'. \Sprog\Wildcard::get('d2u_guestbook_no_entries') . '</p>';
}
else {
for ($i = 0; $i < count($entries); ++$i) {
$entry = $entries[$i];

if (0 == $i % rex_config::get('d2u_guestbook', 'no_entries_page', 10)) {
++$page_no;
if (1 != $page_no) {
echo '</div>';
}
echo '<div class="row guestbook-page pages-'. $page_no .'">'; // Pagination div
}
echo '<div class="row guestbook-page pages-'. $page_no .'">'; // Pagination div
}

echo '<div class="col-12">';

echo '<div class="entry-header">';
echo '<div class="row">';
echo '<div class="col-6"><b>';
if ('' != $entry->email && 'true' == rex_config::get('d2u_guestbook', 'allow_answer', 'false')) {
echo '<a href="mailto:'. $entry->email .'">';
echo $entry->name .' <span class="icon mail"></span>';
echo '</a>';
} else {
echo $entry->name;
}
echo '</b></div>';
echo '<div class="col-6 right">'. date('d.m.Y H:i', strtotime($entry->create_date)) .' '. $tag_open .'d2u_guestbook_oclock'. $tag_close .'</div>';
echo '</div>';
echo '</div>';

echo '<div class="entry-body">';
echo '<div class="row">';
echo '<div class="col-12">'. nl2br($entry->description) .'</div>';
if (!$hide_rating && $entry->rating > 0) {
echo '<div class="col-12"><b>'. $tag_open .'d2u_guestbook_rating'. $tag_close .': ';
for ($j = 1; $j <= 5; ++$j) {
if ($j <= $entry->rating) {
echo ' <span class="icon star-full"></span>';
} else {
echo ' <span class="icon star-empty"></span>';
}
echo '<div class="col-12">';

echo '<div class="entry-header">';
echo '<div class="row">';
echo '<div class="col-6"><b>';
if ('' != $entry->email && 'true' == rex_config::get('d2u_guestbook', 'allow_answer', 'false')) {
echo '<a href="mailto:'. $entry->email .'">';
echo $entry->name .' <span class="icon mail"></span>';
echo '</a>';
} else {
echo $entry->name;
}
echo '</b></div>';
}
echo '</div>';
echo '</div>';
echo '<div class="col-6 right">'. date('d.m.Y H:i', strtotime($entry->create_date)) .' '. $tag_open .'d2u_guestbook_oclock'. $tag_close .'</div>';
echo '</div>';
echo '</div>';

echo '<div class="entry-body">';
echo '<div class="row">';
echo '<div class="col-12">'. nl2br($entry->description) .'</div>';
if (!$hide_rating && $entry->rating > 0) {
echo '<div class="col-12"><b>'. $tag_open .'d2u_guestbook_rating'. $tag_close .': ';
for ($j = 1; $j <= 5; ++$j) {
if ($j <= $entry->rating) {
echo ' <span class="icon star-full"></span>';
} else {
echo ' <span class="icon star-empty"></span>';
}
}
echo '</b></div>';
}
echo '</div>';
echo '</div>';

echo '</div>';
echo '</div>';
echo '</div>';
}
}
echo '</div>'; // tab_guestbook

Expand Down Expand Up @@ -119,41 +125,42 @@ function changePage(pageno) {
echo '</div>';
}

echo '</div>';

// Entry Form
echo '<div id="tab_write" class="tab-pane fade guestbook-tab">';
echo '<div class="row">';
echo '<div class="col-12">';
echo '<fieldset><legend>'. $tag_open .'d2u_guestbook_tab_write'. $tag_close .'</legend>';
?>
<script>
function set_stars(wert) {
function d2u_guestbook_module_60_1_set_stars(wert) {
for(var x = 1; x <= 5; x++) {
if(x <= wert) {
if($('#star' + x).hasClass('star-empty')) {
$('#star' + x).removeClass('star-empty');
$('#star' + x).addClass('star-full');
if($('#d2u_guestbook_module_60_1_star' + x).hasClass('star-empty')) {
$('#d2u_guestbook_module_60_1_star' + x).removeClass('star-empty');
$('#d2u_guestbook_module_60_1_star' + x).addClass('star-full');
}
}
else {
if($('#star' + x).hasClass('star-full')) {
$('#star' + x).removeClass('star-full');
$('#star' + x).addClass('star-empty');
if($('#d2u_guestbook_module_60_1_star' + x).hasClass('star-full')) {
$('#d2u_guestbook_module_60_1_star' + x).removeClass('star-full');
$('#d2u_guestbook_module_60_1_star' + x).addClass('star-empty');
}
}
}
}
function reset_stars(wert) {
set_stars($('input[name=rating]').val());
function d2u_guestbook_module_60_1_reset_stars(wert) {
d2u_guestbook_module_60_1_set_stars($('input[name=rating]').val());
}
function click_stars(wert) {
function d2u_guestbook_module_60_1_click_stars(wert) {
$('input[name=rating]').val(wert);
set_stars(wert);
d2u_guestbook_module_60_1_set_stars(wert);
}
</script>
<?php
$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>';
$stars = '';
for($i = 1; $i <= 5; $i++) {
$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> ';
}
$form_data = '
text|name|'. $tag_open .'d2u_guestbook_form_name'. $tag_close .' *
email|email|'. $tag_open .'d2u_guestbook_form_email'. $tag_close .'
Expand Down Expand Up @@ -183,11 +190,12 @@ function click_stars(wert) {

$yform = new rex_yform();
$yform->setFormData(trim($form_data));
$yform->setObjectparams('real_field_names', true);
$yform->setObjectparams('csrf_protection', false);
$yform->setObjectparams('Error-occured', $tag_open .'d2u_guestbook_form_validate_title'. $tag_close);
$yform->setObjectparams('form_action', rex_getUrl(rex_article::getCurrentId()));
$yform->setObjectparams('form_anchor', 'tab_write');
$yform->setObjectparams('Error-occured', $tag_open .'d2u_guestbook_form_validate_title'. $tag_close);
$yform->setObjectparams('form_name', 'd2u_guestbook_module_60_1_'. rand(1, 100));
$yform->setObjectparams('real_field_names', true);

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

echo '</div>'; // tab_content

echo '</div>';
echo '</div>';
echo '</div>';
?>
Expand All @@ -210,7 +221,5 @@ function click_stars(wert) {
});

// set stars on failure page correctly
set_stars($('input[name=rating]').val());
</script>
</div>
</div>
d2u_guestbook_module_60_1_set_stars($('input[name=rating]').val());
</script>
4 changes: 3 additions & 1 deletion modules/60/1/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ a.recommendation:hover {
content: "\f006";
}


#guestbook_tabs {
border-bottom: none;
}
#guestbook_tabs a.active {
background-color: navi_color_bg;
}
Expand Down
45 changes: 25 additions & 20 deletions modules/60/2/output.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,39 @@

$rating = round(D2U_Guestbook\Entry::getRating(), 1);
$num_recommendations = D2U_Guestbook\Entry::getRecommendation();

$entries = D2U_Guestbook\Entry::getAll(true);
?>
<div class="col-12 col-sm-6 col-md-4 col-lg-12">
<div class="infobox">
<div class="infobox-header"><?= $tag_open .'d2u_guestbook_ratings'. $tag_close ?></div>
<div class="infobox-content" style="text-align: center" title="<?= $tag_open .'d2u_guestbook_rating'. $tag_close ?>">
<?php
if ($show_link) {
echo '<a href="'. rex_getUrl($d2u_guestbook->getConfig('guestbook_article_id')) .'" class="recommendation">';
if(0 === count($entries)) {
echo '<p>'. \Sprog\Wildcard::get('d2u_guestbook_no_entries') . '</p>';
}
echo '<div class="recommendation-stars">';
for ($i = 1; $i <= 5; ++$i) {
if ($i <= $rating) {
echo '<span class="icon star-full"></span> ';
} elseif ($i <= $rating + 1) {
echo '<span class="icon star-half"></span> ';
} else {
echo '<span class="icon star-empty"></span> ';
else {
if ($show_link) {
echo '<a href="'. rex_getUrl($d2u_guestbook->getConfig('guestbook_article_id')) .'" class="recommendation">';
}
echo '<div class="recommendation-stars">';
for ($i = 1; $i <= 5; ++$i) {
if ($i <= $rating) {
echo '<span class="icon star-full"></span> ';
} elseif ($i <= $rating + 1) {
echo '<span class="icon star-half"></span> ';
} else {
echo '<span class="icon star-empty"></span> ';
}
}
echo '</div>';
if ($show_link) {
echo '</a>';
echo '<a href="'. rex_getUrl($d2u_guestbook->getConfig('guestbook_article_id')) .'">';
}
echo $tag_open .'d2u_guestbook_recommended_pre'. $tag_close .' '. $num_recommendations .' '. $tag_open .'d2u_guestbook_recommended_post'. $tag_close;
if ($show_link) {
echo '</a>';
}
}
echo '</div>';
if ($show_link) {
echo '</a>';
echo '<a href="'. rex_getUrl($d2u_guestbook->getConfig('guestbook_article_id')) .'">';
}
echo $tag_open .'d2u_guestbook_recommended_pre'. $tag_close .' '. $num_recommendations .' '. $tag_open .'d2u_guestbook_recommended_post'. $tag_close;
if ($show_link) {
echo '</a>';
}
?>
</div>
Expand Down
22 changes: 11 additions & 11 deletions modules/60/2/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
url("./assets/addons/be_style/fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular") format('svg');
}

.right {
text-align: right;
}
.entry-body {
padding: 0.25em 1em 2em 1em;
}
.entry-header {
background-color: article_color_box;
border-bottom: 1px solid navi_color_bg;
padding: 0.25em 1em;

article .infobox-header {
background-color: article_color_h;
color: #ffffff;
padding: 0.25em 0.75em;
text-align: center;
}
article .infobox {
border: 1px solid article_color_h;
margin-bottom: 1em;
width: 100%;
}
}
.recommendation-stars {
font-size: 1.5em;
}
Expand Down
Loading

0 comments on commit b30eafd

Please sign in to comment.