View | Details | Raw Unified | Return to bug 14272
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt (-4 / +26 lines)
Lines 1-5 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE KohaDates %]
3
[% USE Branches %]
4
[% USE Branches %]
4
[% USE Price %]
5
[% USE Price %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
[% INCLUDE 'doc-head-open.inc' %]
Lines 12-18 Link Here
12
13
13
<div class="main">
14
<div class="main">
14
    <ul class="breadcrumb">
15
    <ul class="breadcrumb">
15
        <li><a href="#">Home</a></li>
16
        <li><a href="/cgi-bin/koha/opac-main.pl">Home</a>
17
        [% IF news_item %]
18
            <span class="divider">&rsaquo;</span></li>
19
            <li>[% news_item.title %]</li>
20
        [% END %]
21
        </li>
16
    </ul>
22
    </ul>
17
23
18
    [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
24
    [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
Lines 57-74 Link Here
57
                </form>
63
                </form>
58
            [% END %]
64
            [% END %]
59
65
60
        [% IF ( koha_news_count ) %]
66
        [% IF ( koha_news ) %]
67
68
69
            [% IF single_news_error %]
70
71
                <div class="alert alert-error">
72
                    This news item does not exist.
73
                </div>
74
75
            [% ELSE %]
61
76
62
            <div id="news" class="newscontainer">
77
            <div id="news" class="newscontainer">
63
                [% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %]
78
                [% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %]
64
                [% FOREACH koha_new IN koha_news %]
79
                [% FOREACH koha_new IN koha_news %]
65
                    <div class="newsitem">
80
                    <div class="newsitem">
66
                        <a name="newsitem[% koha_new.idnew | html %]"></a><h4 class="newsheader">[% koha_new.title | html %]</h4>
81
                        <a name="newsitem[% koha_new.idnew | html %]" href="/cgi-bin/koha/opac-main.pl?news_id=[% koha_new.idnew %]"><h4 class="newsheader">[% koha_new.title | html %]</h4></a>
67
                        <div class="newsbody">[% koha_new.content | $raw %]</div>
82
                        <div class="newsbody">[% koha_new.content | $raw %]</div>
68
                        <div class="newsfooter">(published on [% koha_new.newdate | html %][% IF ( (newsdisp == 'opac' || newsdisp == 'both') && koha_new.borrowernumber ) %] by <span class="newsauthor_title">[% koha_new.author_title | html %] </span>[% koha_new.author_firstname | html %] [% koha_new.author_surname | html %][% END %])</div>
83
                        <div class="newsfooter">(published on [% koha_new.timestamp | $KohaDates with_hours = 1 | html %][% IF ( (newsdisp == 'opac' || newsdisp == 'both') && koha_new.borrowernumber ) %] by <span class="newsauthor_title">[% koha_new.author_title | html %] </span>[% koha_new.author_firstname | html %] [% koha_new.author_surname | html %][% END %])</div>
69
                    </div>
84
                    </div>
70
                [% END %]
85
                [% END %]
71
            </div>
86
            </div>
87
88
            [% END %]
89
90
            [% UNLESS news_item %] <!-- If single news item -->
91
72
            <div id="rssnews-container">
92
            <div id="rssnews-container">
73
                <!-- Logged in users have a branch code or it could be explicitly set -->
93
                <!-- Logged in users have a branch code or it could be explicitly set -->
74
                <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-news-rss.pl?branchcode=[% branchcode | uri %]"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png"></a>
94
                <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-news-rss.pl?branchcode=[% branchcode | uri %]"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png"></a>
Lines 109-114 Link Here
109
        [% IF ( OpacMainUserBlock ) %]<div id="opacmainuserblock">[% OpacMainUserBlock | $raw %]</div>[% END %]
129
        [% IF ( OpacMainUserBlock ) %]<div id="opacmainuserblock">[% OpacMainUserBlock | $raw %]</div>[% END %]
110
        </div> <!-- / .span 7/9 -->
130
        </div> <!-- / .span 7/9 -->
111
131
132
        [% END %] <!-- If single news item -->
133
112
        [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) || OpacNavRight ) %]
134
        [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) || OpacNavRight ) %]
113
            <div class="span3">
135
            <div class="span3">
114
                [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
136
                [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
(-)a/opac/opac-main.pl (-5 / +17 lines)
Lines 29-34 use C4::Members; Link Here
29
use C4::Overdues;
29
use C4::Overdues;
30
use Koha::Checkouts;
30
use Koha::Checkouts;
31
use Koha::Holds;
31
use Koha::Holds;
32
use Koha::News;
32
33
33
my $input = new CGI;
34
my $input = new CGI;
34
my $dbh   = C4::Context->dbh;
35
my $dbh   = C4::Context->dbh;
Lines 61-68 if (defined $input->param('branch') and length $input->param('branch')) { Link Here
61
elsif (C4::Context->userenv and defined $input->param('branch') and length $input->param('branch') == 0 ){
62
elsif (C4::Context->userenv and defined $input->param('branch') and length $input->param('branch') == 0 ){
62
   $homebranch = "";
63
   $homebranch = "";
63
}
64
}
64
my $all_koha_news   = &GetNewsToDisplay($news_lang,$homebranch);
65
65
my $koha_news_count = scalar @$all_koha_news;
66
my $news_id = $input->param('news_id');
67
my (@all_koha_news, $koha_news_count);
68
69
if (defined $news_id){
70
    @all_koha_news = Koha::News->search({ idnew => $news_id });
71
    $koha_news_count = 1;
72
    if (scalar @all_koha_news > 0){
73
        $template->param( news_item => @all_koha_news );
74
    } else {
75
        $template->param( single_news_error => 1 );
76
    }
77
} else {
78
    @all_koha_news   = &GetNewsToDisplay($news_lang,$homebranch);
79
}
66
80
67
my $quote = GetDailyQuote();   # other options are to pass in an exact quote id or select a random quote each pass... see perldoc C4::Koha
81
my $quote = GetDailyQuote();   # other options are to pass in an exact quote id or select a random quote each pass... see perldoc C4::Koha
68
82
Lines 90-97 if ( $patron ) { Link Here
90
}
104
}
91
105
92
$template->param(
106
$template->param(
93
    koha_news           => $all_koha_news,
107
    koha_news           => @all_koha_news,
94
    koha_news_count     => $koha_news_count,
95
    branchcode          => $homebranch,
108
    branchcode          => $homebranch,
96
    display_daily_quote => C4::Context->preference('QuoteOfTheDay'),
109
    display_daily_quote => C4::Context->preference('QuoteOfTheDay'),
97
    daily_quote         => $quote,
110
    daily_quote         => $quote,
98
- 

Return to bug 14272