From 52ed4a9dd086aae4652d6d77f39d73ffebdbaa2c Mon Sep 17 00:00:00 2001 From: JLTRY Date: Sun, 29 Dec 2024 09:46:39 +0100 Subject: [PATCH 1/7] adapt pull/8 to joomla 4+ attachments_component/admin/config.xml attachments_component/site/tmpl/attachments/default.php --- attachments_component/admin/config.xml | 7 +++ .../language/en-GB/en-GB.com_attachments.ini | 3 + .../site/tmpl/attachments/default.php | 59 ++++++++++++++----- 3 files changed, 55 insertions(+), 14 deletions(-) diff --git a/attachments_component/admin/config.xml b/attachments_component/admin/config.xml index 2677bb3d..e2e1583d 100644 --- a/attachments_component/admin/config.xml +++ b/attachments_component/admin/config.xml @@ -65,6 +65,13 @@ + + + + + diff --git a/attachments_component/admin/language/en-GB/en-GB.com_attachments.ini b/attachments_component/admin/language/en-GB/en-GB.com_attachments.ini index a2241596..df354ec5 100644 --- a/attachments_component/admin/language/en-GB/en-GB.com_attachments.ini +++ b/attachments_component/admin/language/en-GB/en-GB.com_attachments.ini @@ -382,3 +382,6 @@ COM_ATTACHMENTS_N_ITEMS_PUBLISHED="%d Attachments successfully published" COM_ATTACHMENTS_N_ITEMS_PUBLISHED_1="Attachment successfully published" COM_ATTACHMENTS_N_ITEMS_UNPUBLISHED="%d Attachments successfully unpublished" COM_ATTACHMENTS_N_ITEMS_UNPUBLISHED_1="Attachment successfully unpublished" + +ATTACH_HIDE_BRACKETS_IF_EMPTY="Hide brackets when empty" +ATTACH_HIDE_BRACKETS_IF_EMPTY_DESCRIPTION="Hide brackets when there is no value in 'description' or user defined fields" diff --git a/attachments_component/site/tmpl/attachments/default.php b/attachments_component/site/tmpl/attachments/default.php index 5f895f11..91926dfc 100644 --- a/attachments_component/site/tmpl/attachments/default.php +++ b/attachments_component/site/tmpl/attachments/default.php @@ -276,43 +276,74 @@ // Add description (maybe) if ( $this->show_description ) { $description = htmlspecialchars(stripslashes($attachment->description)); - if ( StringHelper::strlen($description) == 0) + + $is_empty = 0; + if ( StringHelper::strlen($description) == 0) { $description = ' '; + $is_empty = 1; + } + if ( $this->show_column_titles ) $html .= "$description"; - else - $html .= "[$description]"; + else { + if ($is_empty && $this->params->get('hide_brackets_if_empty')) + $html .= "$description"; + else + $html .= "[$description]"; } - + } // Show the USER DEFINED FIELDs (maybe) if ( $this->show_user_field_1 ) { $user_field = stripslashes($attachment->user_field_1); - if ( StringHelper::strlen($user_field) == 0 ) + $is_empty = 0; + if ( StringHelper::strlen($user_field) == 0 ) { $user_field = ' '; + $is_empty = 1; + } + if ( $this->show_column_titles ) $html .= "" . $user_field . ""; - else - $html .= "[" . $user_field . "]"; + else { + if ($is_empty && $this->params->get('hide_brackets_if_empty')) + $html .= "" . $user_field . ""; + else + $html .= "[" . $user_field . "]"; } + } if ( $this->show_user_field_2 ) { $user_field = stripslashes($attachment->user_field_2); - if ( StringHelper::strlen($user_field) == 0 ) + $is_empty = 0; + if ( StringHelper::strlen($user_field) == 0 ) { $user_field = ' '; + $is_empty = 1; + } + if ( $this->show_column_titles ) $html .= "" . $user_field . ""; - else - $html .= "[" . $user_field . "]"; + else { + if ($is_empty && $this->params->get('hide_brackets_if_empty')) + $html .= "" . $user_field . ""; + else + $html .= "[" . $user_field . "]"; } + } if ( $this->show_user_field_3 ) { $user_field = stripslashes($attachment->user_field_3); - if ( StringHelper::strlen($user_field) == 0 ) + $is_empty = 0; + if ( StringHelper::strlen($user_field) == 0 ) { $user_field = ' '; + $is_empty = 1; + } + if ( $this->show_column_titles ) $html .= "" . $user_field . ""; - else - $html .= "[" . $user_field . "]"; + else { + if ($is_empty && $this->params->get('hide_brackets_if_empty')) + $html .= "" . $user_field . ""; + else + $html .= "[" . $user_field . "]"; } - + } // Add the creator's username (if requested) if ( $this->show_creator_name ) { $html .= "{$attachment->creator_name}"; From af880a20a32c82fcc9eb8f81fceccbf8ac87df62 Mon Sep 17 00:00:00 2001 From: Theofilos Intzoglou Date: Mon, 30 Dec 2024 15:42:31 +0200 Subject: [PATCH 2/7] Greek translation --- .../admin/language/el-GR/el-GR.com_attachments.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/attachments_component/admin/language/el-GR/el-GR.com_attachments.ini b/attachments_component/admin/language/el-GR/el-GR.com_attachments.ini index 376c6510..7f3868a7 100644 --- a/attachments_component/admin/language/el-GR/el-GR.com_attachments.ini +++ b/attachments_component/admin/language/el-GR/el-GR.com_attachments.ini @@ -382,3 +382,6 @@ COM_ATTACHMENTS_N_ITEMS_PUBLISHED="%d συνημμένα δημοσιεύθηκ COM_ATTACHMENTS_N_ITEMS_PUBLISHED_1="Το συνημμένο δημοσιεύτηκε με επιτυχία" COM_ATTACHMENTS_N_ITEMS_UNPUBLISHED="%d συνημμένα έγιναν μη δημοσιευμένα με επιτυχία" COM_ATTACHMENTS_N_ITEMS_UNPUBLISHED_1="Το συνημμένο έγινε μη δημοσιευμένο με επιτυχία" + +ATTACH_HIDE_BRACKETS_IF_EMPTY="Απόκρυψε τις αγκύλες όταν είναι κενές" +ATTACH_HIDE_BRACKETS_IF_EMPTY_DESCRIPTION="Απόκρυψε τις αγκύλες όταν δεν υπάρχει τιμή στην 'περιγραφή' ή στα οριζόμενα πεδία από το χρήστη" From d33ff2cdafcb162572bb2577a1a437ce67904abb Mon Sep 17 00:00:00 2001 From: JLTRY Date: Mon, 30 Dec 2024 16:49:14 +0100 Subject: [PATCH 3/7] Update attachments_component/admin/config.xml Co-authored-by: Theofilos Intzoglou --- attachments_component/admin/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attachments_component/admin/config.xml b/attachments_component/admin/config.xml index e2e1583d..ddf962a8 100644 --- a/attachments_component/admin/config.xml +++ b/attachments_component/admin/config.xml @@ -65,7 +65,7 @@ - From 4060b0bc17f0aa79fd26c812563a07339423dcf0 Mon Sep 17 00:00:00 2001 From: JLTRY Date: Mon, 30 Dec 2024 16:49:44 +0100 Subject: [PATCH 4/7] Update attachments_component/site/tmpl/attachments/default.php Co-authored-by: Theofilos Intzoglou --- attachments_component/site/tmpl/attachments/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attachments_component/site/tmpl/attachments/default.php b/attachments_component/site/tmpl/attachments/default.php index 91926dfc..d245c630 100644 --- a/attachments_component/site/tmpl/attachments/default.php +++ b/attachments_component/site/tmpl/attachments/default.php @@ -287,7 +287,7 @@ $html .= "$description"; else { if ($is_empty && $this->params->get('hide_brackets_if_empty')) - $html .= "$description"; + $html .= ""; else $html .= "[$description]"; } From 70e810ab4a4d44a39f21de1e1cc01b2ecc4da754 Mon Sep 17 00:00:00 2001 From: JLTRY Date: Mon, 30 Dec 2024 16:49:53 +0100 Subject: [PATCH 5/7] Update attachments_component/site/tmpl/attachments/default.php Co-authored-by: Theofilos Intzoglou --- attachments_component/site/tmpl/attachments/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attachments_component/site/tmpl/attachments/default.php b/attachments_component/site/tmpl/attachments/default.php index d245c630..702db5b5 100644 --- a/attachments_component/site/tmpl/attachments/default.php +++ b/attachments_component/site/tmpl/attachments/default.php @@ -305,7 +305,7 @@ $html .= "" . $user_field . ""; else { if ($is_empty && $this->params->get('hide_brackets_if_empty')) - $html .= "" . $user_field . ""; + $html .= ""; else $html .= "[" . $user_field . "]"; } From 96194aeba4e785b6d08430f1788c8e8c194e5375 Mon Sep 17 00:00:00 2001 From: JLTRY Date: Mon, 30 Dec 2024 16:50:01 +0100 Subject: [PATCH 6/7] Update attachments_component/site/tmpl/attachments/default.php Co-authored-by: Theofilos Intzoglou --- attachments_component/site/tmpl/attachments/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attachments_component/site/tmpl/attachments/default.php b/attachments_component/site/tmpl/attachments/default.php index 702db5b5..be86a1d5 100644 --- a/attachments_component/site/tmpl/attachments/default.php +++ b/attachments_component/site/tmpl/attachments/default.php @@ -322,7 +322,7 @@ $html .= "" . $user_field . ""; else { if ($is_empty && $this->params->get('hide_brackets_if_empty')) - $html .= "" . $user_field . ""; + $html .= ""; else $html .= "[" . $user_field . "]"; } From 4e279fcb8ac49daa34884b6cbb6dcb488a3d1838 Mon Sep 17 00:00:00 2001 From: JLTRY Date: Mon, 30 Dec 2024 16:50:08 +0100 Subject: [PATCH 7/7] Update attachments_component/site/tmpl/attachments/default.php Co-authored-by: Theofilos Intzoglou --- attachments_component/site/tmpl/attachments/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attachments_component/site/tmpl/attachments/default.php b/attachments_component/site/tmpl/attachments/default.php index be86a1d5..38a9f982 100644 --- a/attachments_component/site/tmpl/attachments/default.php +++ b/attachments_component/site/tmpl/attachments/default.php @@ -339,7 +339,7 @@ $html .= "" . $user_field . ""; else { if ($is_empty && $this->params->get('hide_brackets_if_empty')) - $html .= "" . $user_field . ""; + $html .= ""; else $html .= "[" . $user_field . "]"; }