Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions attachments_component/admin/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="hide_brackets_if_empty" type="radio" default="0" class="btn-group"
Comment thread
JLTRY marked this conversation as resolved.
Outdated
label="ATTACH_HIDE_BRACKETS_IF_EMPTY"
description="ATTACH_HIDE_BRACKETS_IF_EMPTY_DESCRIPTION">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>

<field name="show_creator_name" type="radio" default="0" layout="joomla.form.field.radio.switcher"
label="ATTACH_SHOW_ATTACHMENT_CREATOR"
description="ATTACH_SHOW_ATTACHMENT_CREATOR_DESCRIPTION">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
59 changes: 45 additions & 14 deletions attachments_component/site/tmpl/attachments/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '&nbsp;';
$is_empty = 1;
}

if ( $this->show_column_titles )
$html .= "<td class=\"at_description\">$description</td>";
else
$html .= "<td class=\"at_description\">[$description]</td>";
else {
if ($is_empty && $this->params->get('hide_brackets_if_empty'))
$html .= "<td class=\"at_description\">$description</td>";
Comment thread
JLTRY marked this conversation as resolved.
Outdated
else
$html .= "<td class=\"at_description\">[$description]</td>";
}

}
// 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 = '&nbsp;';
$is_empty = 1;
}

if ( $this->show_column_titles )
$html .= "<td class=\"at_user_field\">" . $user_field . "</td>";
else
$html .= "<td class=\"at_user_field\">[" . $user_field . "]</td>";
else {
if ($is_empty && $this->params->get('hide_brackets_if_empty'))
$html .= "<td class=\"at_user_field\">" . $user_field . "</td>";
Comment thread
JLTRY marked this conversation as resolved.
Outdated
else
$html .= "<td class=\"at_user_field\">[" . $user_field . "]</td>";
}
}
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 = '&nbsp;';
$is_empty = 1;
}

if ( $this->show_column_titles )
$html .= "<td class=\"at_user_field\">" . $user_field . "</td>";
else
$html .= "<td class=\"at_user_field\">[" . $user_field . "]</td>";
else {
if ($is_empty && $this->params->get('hide_brackets_if_empty'))
$html .= "<td class=\"at_user_field\">" . $user_field . "</td>";
Comment thread
JLTRY marked this conversation as resolved.
Outdated
else
$html .= "<td class=\"at_user_field\">[" . $user_field . "]</td>";
}
}
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 = '&nbsp;';
$is_empty = 1;
}

if ( $this->show_column_titles )
$html .= "<td class=\"at_user_field\">" . $user_field . "</td>";
else
$html .= "<td class=\"at_user_field\">[" . $user_field . "]</td>";
else {
if ($is_empty && $this->params->get('hide_brackets_if_empty'))
$html .= "<td class=\"at_user_field\">" . $user_field . "</td>";
Comment thread
JLTRY marked this conversation as resolved.
Outdated
else
$html .= "<td class=\"at_user_field\">[" . $user_field . "]</td>";
}

}
// Add the creator's username (if requested)
if ( $this->show_creator_name ) {
$html .= "<td class=\"at_creator_name\">{$attachment->creator_name}</td>";
Expand Down