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-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE KohaDates %]
2
[% USE Branches %]
3
[% USE Branches %]
3
[% USE Price %]
4
[% USE Price %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
Lines 11-17 Link Here
11
12
12
<div class="main">
13
<div class="main">
13
    <ul class="breadcrumb">
14
    <ul class="breadcrumb">
14
        <li><a href="#">Home</a></li>
15
        <li><a href="/cgi-bin/koha/opac-main.pl">Home</a>
16
        [% IF news_item %]
17
            <span class="divider">&rsaquo;</span></li>
18
            <li>[% news_item.title %]</li>
19
        [% END %]
20
        </li>
15
    </ul>
21
    </ul>
16
22
17
    [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
23
    [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
Lines 56-73 Link Here
56
                </form>
62
                </form>
57
            [% END %]
63
            [% END %]
58
64
59
        [% IF ( koha_news_count ) %]
65
        [% IF ( koha_news ) %]
66
67
68
            [% IF single_news_error %]
69
70
                <div class="alert alert-error">
71
                    This news item does not exist.
72
                </div>
73
74
            [% ELSE %]
60
75
61
            <div id="news" class="newscontainer">
76
            <div id="news" class="newscontainer">
62
                [% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %]
77
                [% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %]
63
                [% FOREACH koha_new IN koha_news %]
78
                [% FOREACH koha_new IN koha_news %]
64
                    <div class="newsitem">
79
                    <div class="newsitem">
65
                        <a name="newsitem[% koha_new.idnew %]"></a><h4 class="newsheader">[% koha_new.title %]</h4>
80
                        <a name="newsitem[% koha_new.idnew %]" href="/cgi-bin/koha/opac-main.pl?news_id=[% koha_new.idnew %]"><h4 class="newsheader">[% koha_new.title %]</h4></a>
66
                        <div class="newsbody">[% koha_new.content %]</div>
81
                        <div class="newsbody">[% koha_new.content %]</div>
67
                        <div class="newsfooter">(published on [% koha_new.newdate %][% IF ( (newsdisp == 'opac' || newsdisp == 'both') && koha_new.borrowernumber ) %] by <span class="newsauthor_title">[% koha_new.author_title %] </span>[% koha_new.author_firstname %] [% koha_new.author_surname %][% END %])</div>
82
                        <div class="newsfooter">(published on [% koha_new.timestamp | $KohaDates with_hours = 1 %][% IF ( (newsdisp == 'opac' || newsdisp == 'both') && koha_new.borrowernumber ) %] by <span class="newsauthor_title">[% koha_new.author_title %] </span>[% koha_new.author_firstname %] [% koha_new.author_surname %][% END %])</div>
68
                    </div>
83
                    </div>
69
                [% END %]
84
                [% END %]
70
            </div>
85
            </div>
86
87
            [% END %]
88
89
            [% UNLESS news_item %] <!-- If single news item -->
90
71
            <div id="rssnews-container">
91
            <div id="rssnews-container">
72
                <!-- Logged in users have a branch code or it could be explicitly set -->
92
                <!-- Logged in users have a branch code or it could be explicitly set -->
73
                <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-news-rss.pl?branchcode=[% branchcode %]"><img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png"></a>
93
                <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-news-rss.pl?branchcode=[% branchcode %]"><img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png"></a>
Lines 108-113 Link Here
108
        [% IF ( OpacMainUserBlock ) %]<div id="opacmainuserblock">[% OpacMainUserBlock %]</div>[% END %]
128
        [% IF ( OpacMainUserBlock ) %]<div id="opacmainuserblock">[% OpacMainUserBlock %]</div>[% END %]
109
        </div> <!-- / .span 7/9 -->
129
        </div> <!-- / .span 7/9 -->
110
130
131
        [% END %] <!-- If single news item -->
132
111
        [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) || OpacNavRight ) %]
133
        [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) || OpacNavRight ) %]
112
            <div class="span3">
134
            <div class="span3">
113
                [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
135
                [% 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