[Koha-cvs] koha C4/Koha.pm C4/NewsChannels.pm koha-tmpl/in... [rel_3_0]

Antoine Farnault antoine at koha-fr.org
Fri Dec 8 18:33:27 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	06/12/08 17:33:27

Modified files:
	C4             : Koha.pm NewsChannels.pm 
	koha-tmpl/intranet-tmpl/prog/en/tools: koha-news.tmpl 
	koha-tmpl/opac-tmpl/prog/en: opac-main.tmpl 
	.              : mainpage.pl 
	opac           : opac-main.pl opac-user.pl 

Log message:
	now news & languages are displayed on the OPAC.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Koha.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.40.2.26&r2=1.40.2.27
http://cvs.savannah.gnu.org/viewcvs/koha/C4/NewsChannels.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1&r2=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/tools/koha-news.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.2&r2=1.1.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/prog/en/opac-main.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.7&r2=1.1.2.8
http://cvs.savannah.gnu.org/viewcvs/koha/mainpage.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.11.2.1&r2=1.11.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-main.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.23.2.3&r2=1.23.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-user.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.23.2.4&r2=1.23.2.5

Patches:
Index: C4/Koha.pm
===================================================================
RCS file: /sources/koha/koha/C4/Koha.pm,v
retrieving revision 1.40.2.26
retrieving revision 1.40.2.27
diff -u -b -r1.40.2.26 -r1.40.2.27
--- C4/Koha.pm	5 Dec 2006 11:35:29 -0000	1.40.2.26
+++ C4/Koha.pm	8 Dec 2006 17:33:27 -0000	1.40.2.27
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Koha.pm,v 1.40.2.26 2006/12/05 11:35:29 toins Exp $
+# $Id: Koha.pm,v 1.40.2.27 2006/12/08 17:33:27 toins Exp $
 
 use strict;
 require Exporter;
@@ -25,7 +25,7 @@
 use C4::Output;
 use vars qw($VERSION @ISA @EXPORT);
 
-$VERSION = do { my @v = '$Revision: 1.40.2.26 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.40.2.27 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -158,7 +158,6 @@
     return "$seg1-$seg2-$seg3-$seg4";
 }
 
-
 # FIXME.. this should be moved to a MARC-specific module
 sub subfield_is_koha_internal_p ($) {
     my ($subfield) = @_;

Index: C4/NewsChannels.pm
===================================================================
RCS file: /sources/koha/koha/C4/NewsChannels.pm,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -b -r1.1 -r1.1.2.1
--- C4/NewsChannels.pm	6 Mar 2006 12:43:36 -0000	1.1
+++ C4/NewsChannels.pm	8 Dec 2006 17:33:27 -0000	1.1.2.1
@@ -25,7 +25,9 @@
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = 0.01;
+$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g;
+    shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v );
+};
 
 =head1 NAME
 

Index: koha-tmpl/intranet-tmpl/prog/en/tools/koha-news.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/tools/koha-news.tmpl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- koha-tmpl/intranet-tmpl/prog/en/tools/koha-news.tmpl	30 Oct 2006 10:08:31 -0000	1.1.2.2
+++ koha-tmpl/intranet-tmpl/prog/en/tools/koha-news.tmpl	8 Dec 2006 17:33:27 -0000	1.1.2.3
@@ -29,7 +29,7 @@
 				<input size="30" type="text" name="title" value="<!-- TMPL_VAR NAME="title" -->" />
 			</p>
 			<p>News</p>
-			<textarea name="new" cols="35" rows="4"><!-- TMPL_VAR NAME="new" --></textarea>
+            <textarea name="new" cols="75" rows="10"><!-- TMPL_VAR NAME="new" --></textarea>
 			<p>
 				<input class="button" type="submit" value="Save" />
 				<input class="button" type="button" value="Cancel" onclick="window.location.href='/cgi-bin/koha/tools/opac-news.pl'" />

Index: koha-tmpl/opac-tmpl/prog/en/opac-main.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/opac-tmpl/prog/en/opac-main.tmpl,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -b -r1.1.2.7 -r1.1.2.8
--- koha-tmpl/opac-tmpl/prog/en/opac-main.tmpl	7 Dec 2006 18:09:01 -0000	1.1.2.7
+++ koha-tmpl/opac-tmpl/prog/en/opac-main.tmpl	8 Dec 2006 17:33:27 -0000	1.1.2.8
@@ -25,18 +25,34 @@
     </form>
 </div>
 
-<!-- TMPL_IF NAME="opaclanguagesdisplay" -->
-<div class="content-block">
-    <h4 class="inline">Change Language:</h3>
-    <form action="/cgi-bin/koha/changelanguage.pl" method="post" class="inline">
-        <select name="language">
+<!-- TMPL_IF NAME="languages" -->
+<div>
+    <form action="/cgi-bin/koha/changelanguage.pl" method="POST">
+        <label for="selectlang">Change Language:</label>
+        <select id="selectlang" name="language" onchange="javascript:submit();">
             <!-- TMPL_LOOP NAME="languages" -->
-            <option value="<TMPL_VAR NAME="language">"><!-- TMPL_VAR NAME="language" --></option>
+                <option value="<TMPL_VAR NAME="language">">
+                    <!-- TMPL_VAR NAME="language" -->
+                </option>
                 <!-- /TMPL_LOOP -->
         </select>
-        <input type="submit" value="Switch" class="submit">
     </form>
 </div>
 <!-- /TMPL_IF -->
 
+<!-- TMPL_IF name="koha_news_count" -->
+<p><!-- TMPL_VAR name="koha_news_count" --> recent news</p>
+<table>
+    <!-- TMPL_LOOP name="koha_news" -->
+    <tr>
+        <th>
+            on <!-- TMPL_VAR name="newdate" -->, <!-- TMPL_VAR name="title" -->
+        </th>
+        <tr><td>
+                <p><!-- TMPL_VAR name="new" --></p>
+            </td></tr>
+        <!-- /TMPL_LOOP -->
+    </table>
+        <!-- /TMPL_IF -->
+
 <!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->

Index: mainpage.pl
===================================================================
RCS file: /sources/koha/koha/mainpage.pl,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -u -b -r1.11.2.1 -r1.11.2.2
--- mainpage.pl	7 Sep 2006 07:32:56 -0000	1.11.2.1
+++ mainpage.pl	8 Dec 2006 17:33:27 -0000	1.11.2.2
@@ -17,7 +17,6 @@
 # 
 
 use strict;
-use HTML::Template;
 require Exporter;
 use C4::Database;
 use C4::Output;  # contains gettemplate
@@ -31,32 +30,44 @@
 my $authtypes = getauthtypes;
 my @authtypesloop;
 
-foreach my $thisauthtype (sort { $authtypes->{$a} <=> $authtypes->{$b} } keys %$authtypes) {
-	my %row =(value => $thisauthtype,
+foreach my $thisauthtype ( sort { $authtypes->{$a} <=> $authtypes->{$b} }
+    keys %$authtypes )
+{
+    my %row = (
+        value        => $thisauthtype,
 				authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
 			);
 	push @authtypesloop, \%row;
 }
 
-my ($template, $loggedinuser, $cookie)
-    = get_template_and_user({template_name => "intranet-main.tmpl",
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "intranet-main.tmpl",
 			     query => $query,
 			     type => "intranet",
 			     authnotrequired => 0,
-			     flagsrequired => {catalogue => 1, circulate => 1,
-			     				parameters => 1, borrowers => 1,
-							permissions =>1, reserveforothers=>1,
-							borrow => 1, reserveforself => 1,
-							editcatalogue => 1, updatecharges => 1, },
+        flagsrequired   => {
+            catalogue        => 1,
+            circulate        => 1,
+            parameters       => 1,
+            borrowers        => 1,
+            permissions      => 1,
+            reserveforothers => 1,
+            borrow           => 1,
+            reserveforself   => 1,
+            editcatalogue    => 1,
+            updatecharges    => 1,
+        },
 			     debug => 1,
-			     });
+    }
+);
 
 my $marc_p = C4::Context->boolean_preference("marc");
-$template->param(NOTMARC => !$marc_p);
-$template->param(authtypesloop => \@authtypesloop);
+$template->param( NOTMARC       => !$marc_p );
+$template->param( authtypesloop => \@authtypesloop );
 
-my ($koha_news_count, $all_koha_news) = &get_opac_news(undef, 'koha');
-$template->param(koha_news        => $all_koha_news);
-$template->param(koha_news_count  => $koha_news_count);
+my ( $koha_news_count, $all_koha_news ) = &get_opac_news( undef, 'koha' );
+$template->param( koha_news       => $all_koha_news );
+$template->param( koha_news_count => $koha_news_count );
 
 output_html_with_http_headers $query, $cookie, $template->output;

Index: opac/opac-main.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-main.pl,v
retrieving revision 1.23.2.3
retrieving revision 1.23.2.4
diff -u -b -r1.23.2.3 -r1.23.2.4
--- opac/opac-main.pl	7 Dec 2006 15:42:15 -0000	1.23.2.3
+++ opac/opac-main.pl	8 Dec 2006 17:33:27 -0000	1.23.2.4
@@ -15,7 +15,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: opac-main.pl,v 1.23.2.3 2006/12/07 15:42:15 toins Exp $
+# $Id: opac-main.pl,v 1.23.2.4 2006/12/08 17:33:27 toins Exp $
 
 use strict;
 require Exporter;
@@ -24,8 +24,9 @@
 use C4::Auth;    # get_template_and_user
 use C4::Interface::CGI::Output;
 use C4::BookShelves;
-use C4::Koha;
+use C4::Koha;          # GetBranches
 use C4::Members;
+use C4::NewsChannels;  # get_opac_news
 
 my $input = new CGI;
 my $dbh   = C4::Context->dbh;
@@ -57,23 +58,19 @@
 );
 
 my $borrower = GetMember( '', $borrowernumber );
-my @options;
+my @languages;
 my $counter = 0;
 foreach my $language ( GetLanguages() ) {
-    my $selected = '0';
-
     #   next if $currently_selected_languages->{$language};
-    push @options, { language => $language, counter => $counter };
+    push @languages, { language => $language, counter => $counter };
     $counter++;
 }
 
 # Template params
-if ( ( scalar @options ) > 1 ) {
-    $template->param(
-        languages            => \@options,
-        opaclanguagesdisplay => C4::Context->preference("opaclanguagesdisplay")
-    );
+if ( $counter > 1 ) {
+    $template->param(languages => \@languages) if C4::Context->preference('opaclanguagesdisplay');
 }
+
 $template->param(
     branchloop           => \@branchloop,
     suggestion           => C4::Context->preference("suggestion"),
@@ -90,6 +87,11 @@
     opaclanguagesdisplay => 0,
 );
 
+# display news
+my ( $koha_news_count, $all_koha_news ) = &get_opac_news( undef, GetLanguages("opac") );
+$template->param( koha_news       => $all_koha_news );
+$template->param( koha_news_count => $koha_news_count );
+
 $template->param(
     'Disable_Dictionary' => C4::Context->preference("Disable_Dictionary") )
   if ( C4::Context->preference("Disable_Dictionary") );

Index: opac/opac-user.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-user.pl,v
retrieving revision 1.23.2.4
retrieving revision 1.23.2.5
diff -u -b -r1.23.2.4 -r1.23.2.5
--- opac/opac-user.pl	8 Dec 2006 16:33:51 -0000	1.23.2.4
+++ opac/opac-user.pl	8 Dec 2006 17:33:27 -0000	1.23.2.5
@@ -15,7 +15,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: opac-user.pl,v 1.23.2.4 2006/12/08 16:33:51 toins Exp $
+# $Id: opac-user.pl,v 1.23.2.5 2006/12/08 17:33:27 toins Exp $
 
 use strict;
 require Exporter;
@@ -83,7 +83,6 @@
 my @issuedat;
 my $imgdir = getitemtypeimagesrc();
 my $itemtypes = GetItemTypes();
-#warn "" . Data::Dumper::Dumper($issues);
 foreach my $key ( keys %$issues ) {
     my $issue = $issues->{$key};
     $issue->{'date_due'} = format_date( $issue->{'date_due'} );





More information about the Koha-cvs mailing list