[Koha-cvs] koha koha-tmpl/intranet-tmpl/prog/en/tools/view... [rel_3_0]

Antoine Farnault antoine at koha-fr.org
Thu Jan 11 15:23:10 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	07/01/11 14:23:10

Modified files:
	koha-tmpl/intranet-tmpl/prog/en/tools: viewlog.tmpl 
	tools          : viewlog.pl 

Log message:
	Viewlog updated to works fine with the new log categories.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/tools/viewlog.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.1&r2=1.1.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/tools/viewlog.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.1&r2=1.1.2.2

Patches:
Index: koha-tmpl/intranet-tmpl/prog/en/tools/viewlog.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/tools/Attic/viewlog.tmpl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- koha-tmpl/intranet-tmpl/prog/en/tools/viewlog.tmpl	10 Jan 2007 16:57:47 -0000	1.1.2.1
+++ koha-tmpl/intranet-tmpl/prog/en/tools/viewlog.tmpl	11 Jan 2007 14:23:10 -0000	1.1.2.2
@@ -1,165 +1,24 @@
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Log viewer<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 
+<!-- Additions to enable Calendar system -->
+<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar-system.css">
+<!-- End of additions --><!-- Additions to enable Calendar system -->
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar.js"></script>
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar-en.js"></script>
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar-setup.js"></script>
+<!-- End of additions -->
+
 <!-- TMPL_INCLUDE NAME="menus.inc" -->
-<!-- TMPL_INCLUDE NAME="menu-admin.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-tools.inc" -->
 
-<!-- TMPL_IF NAME="do_it" -->
-<script language="JavaScript" type="text/javascript">
-function Dopop(link) {
-	newin=window.open(link,'width=500,height=400,toolbar=false,scrollbars=yes');
-}
-</script>
-		<h1>Koha : LogView for <!-- TMPL_VAR NAME="modulename"--> </h1>
-		<!-- TMPL_IF NAME="loopfilter"-->
-			<p>Filtered on</p>
-			<!-- TMPL_LOOP NAME="loopfilter" -->
-					<p><!-- TMPL_IF NAME="err" --> <font color="red"> <b><!--/TMPL_IF --><label class="label100"> <!-- TMPL_VAR NAME="name"--> =</label><!-- TMPL_VAR NAME="value"--><!-- TMPL_IF NAME="err" --> </font> </b><!--/TMPL_IF --></p>
-			<!-- /TMPL_LOOP -->
-		<!-- /TMPL_IF NAME="loopfilter"-->
-		<br>
-		<table>
-			<!-- TMPL_IF NAME="catalogue" -->
-				<tr >
-							<th>Timestamp
-							</th>
-							<th>Firstname
-							</th>
-							<th>Surname
-							</th>
-							<th>Action
-							</th>
-							<th>Info
-							</th>
-							<th>Title
-							</th>
-							<th>Author
-							</th>
-				</tr>
-				<!-- TMPL_LOOP NAME="looprow" -->
-					<!-- TMPL_IF NAME="hilighted" --><tr class="higlighted"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
-						<td><!-- TMPL_IF NAME="timestamp" --><!-- TMPL_VAR NAME="timestamp" --><!-- /TMPL_IF -->
-						</td>
-						<td><!-- TMPL_IF NAME="firstname" --><!-- TMPL_VAR NAME="firstname" --><!-- /TMPL_IF -->
-						</td>
-						<td><!-- TMPL_IF NAME="surname" --><!-- TMPL_VAR NAME="surname" --><!-- /TMPL_IF -->
-						</td>
-						<td><!-- TMPL_IF NAME="action" --><!-- TMPL_VAR NAME="action" --><!-- /TMPL_IF -->
-						</td>
-						<td><!-- TMPL_IF NAME="info" --><!-- TMPL_VAR NAME="info" --><!-- /TMPL_IF -->
-						</td>
-						<td><!-- TMPL_IF NAME="title" --><!-- TMPL_VAR NAME="title" --><!-- /TMPL_IF -->
-						</td>
-						<td><!-- TMPL_IF NAME="author" --><!-- TMPL_VAR NAME="author" --><!-- /TMPL_IF -->
-						</td>
-					</tr>
-				<!-- /TMPL_LOOP -->
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF NAME="acqui" -->
-				<tr >
-							<th>Timestamp
-							</th>
-							<th>Firstname
-							</th>
-							<th>Surname
-							</th>
-							<th>Action
-							</th>
-							<th>Info
-							</th>
-							<th>Title
-							</th>
-							<th>Author
-							</th>
-				</tr>
-				<!-- TMPL_LOOP NAME="looprow" -->
-					<!-- TMPL_IF NAME="hilighted" --><tr class="higlighted"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
-						<!-- TMPL_IF NAME="hilighted" --><td class="hilighted"><!-- TMPL_ELSE --><td><!-- /TMPL_IF -->
-						<!-- TMPL_VAR NAME="rowtitle" --></td>
-						<!-- TMPL_LOOP NAME="loopcell" -->
-							<!-- TMPL_IF NAME="hilighted" --><td class="hilighted"><!-- TMPL_ELSE --><td ><!-- /TMPL_IF -->
-								<!-- TMPL_IF NAME="reference" --><a href="javascript:Dopop('../members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="reference" -->')" ><!-- /TMPL_IF -->
-								<!-- TMPL_IF NAME="value" --><!-- TMPL_VAR NAME="value" --><!-- /TMPL_IF -->
-								<!-- TMPL_IF NAME="reference" --></a><!-- /TMPL_IF -->
-							</td>
-							<!-- TMPL_IF NAME="hilighted" --><td class="hilighted"><!-- TMPL_ELSE --><td ><!-- /TMPL_IF -->
-								<!-- TMPL_IF NAME="count" --><!-- TMPL_VAR NAME="count" --><!-- /TMPL_IF -->
-							</td>
-						<!-- /TMPL_LOOP -->
-					</tr>
-				<!-- /TMPL_LOOP NAME="looprow" -->
-				<!-- /TMPL_IF -->
-				<!-- TMPL_IF NAME="members" -->
-				<tr >
-							<th>Timestamp
-							</th>
-							<th>Firstname
-							</th>
-							<th>Surname
-							</th>
-							<th>Action
-							</th>
-							<th>Info
-							</th>
-							<th>Title
-							</th>
-							<th>Author
-							</th>
-				</tr>
-				<!-- TMPL_LOOP NAME="looprow" -->
-					<!-- TMPL_IF NAME="hilighted" --><tr class="higlighted"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
-						<td><!-- TMPL_IF NAME="timestamp" --><!-- TMPL_VAR NAME="timestamp" --><!-- /TMPL_IF -->
-						</td>
-						<td><!-- TMPL_IF NAME="value" --><!-- TMPL_VAR NAME="value" --><!-- /TMPL_IF -->
-						</td>
-						<td><!-- TMPL_IF NAME="value" --><!-- TMPL_VAR NAME="value" --><!-- /TMPL_IF -->
-						</td>
-						<td><!-- TMPL_IF NAME="value" --><!-- TMPL_VAR NAME="value" --><!-- /TMPL_IF -->
-						</td>
-						<td><!-- TMPL_IF NAME="value" --><!-- TMPL_VAR NAME="value" --><!-- /TMPL_IF -->
-						</td>
-						<td><!-- TMPL_IF NAME="value" --><!-- TMPL_VAR NAME="value" --><!-- /TMPL_IF -->
-						</td>
-						<td><!-- TMPL_IF NAME="value" --><!-- TMPL_VAR NAME="value" --><!-- /TMPL_IF -->
-						</td>
-						<td><!-- TMPL_IF NAME="value" --><!-- TMPL_VAR NAME="value" --><!-- /TMPL_IF -->
-						</td>
-					</tr>
-				<!-- /TMPL_LOOP NAME="looprow" -->
-				<!-- /TMPL_IF -->
-		</table>
-<!-- TMPL_ELSE -->
-	<h1 class = "parameters">Koha : Display Logs </h1>
-	<form method="post">
+<h1>Browse system logs</h1>
 	
-	<table>
-		<thead>
-			<tr>
-			<th>On Module</th>
-			<th>User/Action Filters</th>
-			<th>Object Filter</th>
-			</tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td>
-					<select name="module">
-						<option value ="catalogue" checked>Catalogue</option>
-						<option value ="members">Borrowers</option>
-						<option value ="acqui">Acquisitions</option>
-					</select>
-				</td>
-				<td>
+<form method="post" action="/cgi-bin/koha/tools/viewlog.pl">
+
+<fieldset>
+    <legend>Additional infos</legend>
 				<p>
-					Koha User : <input type="text" name="user" value="">
-				</p>
-				<p>	Action type : <select name="action">
-						<option value ="">All</option>
-						<option value ="add">Add</option>
-						<option value ="del">Delete</option>
-						<option value ="mod">Modify</option>
-					</select>
-				</p>
-				<p> From <input type="text" readonly="readonly" size="10" id="from" name="from" >
+         Display from <input type="text" size="10" id="from" name="from" value="<!-- TMPL_VAR NAME="datefrom"-->"/>
 							<img src="<!-- TMPL_VAR Name="themelang" -->/includes/calendar/cal.gif" border="0" hspace="0" vspace="0" id="openCalendarFrom" style="cursor: pointer;" valign="top">
 								<script language="JavaScript" type="text/javascript">
 									function validate1(date) {
@@ -188,7 +47,7 @@
 										}
 									);
 								</script>
-					To <input readonly="readonly" size="10" id="to" name="Filter" value="" type="to">
+					to <input size="10" id="to" name="to" type="text" value="<!-- TMPL_VAR NAME="dateto"-->"/>
 						<img src="<!-- TMPL_VAR Name="themelang" -->/includes/calendar/cal.gif" id="openCalendarTo" style="cursor: pointer;" valign="top" border="0" hspace="0" vspace="0">
 							<script type="text/javascript">
 								function validate2(date) {
@@ -206,7 +65,6 @@
 										return false;
 									}
 								}
-		
 								Calendar.setup(
 									{
 										inputField : "to",
@@ -217,27 +75,114 @@
 									}
 								);
 							</script>
-				</td>
-			</tr>
-	</table>
-	
-	<div>
-		<h3>Output</h3>
-		<input type="radio" checked name="output" value="screen" > To screen into the browser
+		</p>
+		<p>
+		<p><b>Export into</b></p>
+        <input id="screen" type="radio" checked name="output" value="screen" />
+        <label for="screen" >To screen into the browser</label>
 		<br>
-		<input type="radio" name="output" value="file"> To file <input type="text" name="basename" value="Export"> into an application  
+		<input id="file" type="radio" name="output" value="file" />
+		 <label for="file">To file</label>
+		<input type="text" name="basename" value="Export"> into an application  
 		<!-- TMPL_VAR NAME="CGIextChoice" -->
 		<!-- TMPL_VAR NAME="CGIsepChoice" -->
+	    <input type="hidden" name="report_name" value="<!--TMPL_VAR NAME="report_name" -->">
+	    <input type="submit" value=" GO " />
 	</p>
-	</div>
+</fieldset>
+    
+    <!-- TMPL_IF NAME="do_it" -->
 	<p>
-	<input TYPE="submit" value="OK" class="button parameters">
-	<input type="hidden" name="report_name" value="<!--TMPL_VAR NAME="report_name" -->">
+        <!-- TMPL_IF NAME="total" -->
+            <b><!-- TMPL_VAR NAME="total" --> lines found.</b>
+        <!-- TMPL_ELSE -->
+            <b><span class="probem">No log found.</span></b>
+        <!-- /TMPL_IF -->
+        </p>
+    <!-- /TMPL_IF -->
+    <div class="searchresults">
+	<table>
+    <tr>
+        <th>Date</th>
+        <th>Librarian</th>
+    	<th>Module</th>
+    	<th>Action</th>
+		<th>Object</th>
+		<th>Info</th>
+	</tr>
+	<tr>
+	    <td>
+            <input type="submit" value="filter" />
 	<input type="hidden" name="do_it" value="1">
-	</form>
-<!-- /TMPL_IF -->
-</div>
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
-
-
+	    </td>
+	    <td>
+	        <input type="text" name="user" value="<!-- TMPL_VAR NAME="user"-->" />
+	    </td>
+	    <td>
+	        <select name="module">
+			    <option value="" checked>All</option>
+			    <option value ="CATALOGUING">Catalogue</option>
+				<option value ="MEMBERS">Borrowers</option>
+				<option value ="ACQUISITION">Acquisitions</option>
+				<option value="CIRCULATION">Circulation</option>
+			</select>
+	    </td>
+	    <td>
+	        <select name="action">
+    			<option value ="">All</option>
+				<option value ="add">Add</option>
+				<option value ="del">Delete</option>
+				<option value ="mod">Modify</option>
+				<option value="issue">Issue</option>
+				<option value="return">Return</option>
+			</select>
+	    </td>
+	    <td>
+	        <input type="text" name="object" value="<!-- TMPL_VAR NAME="object"-->" />
+	    </td>
+	    <td>
+	        <input type="text" name="info" value="<!-- TMPL_VAR NAME="info"-->" />
+	    </td>
+	</tr>
+	    <!-- TMPL_LOOP NAME="looprow" -->
+					<tr>
+						<td><!-- TMPL_VAR NAME="timestamp" --></td>
+						<td>
+						    <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="user" -->" title="display detail for this librarian.">
+						        <!-- TMPL_VAR NAME="user" -->
+						    </a>
+						</td>
+						<td><!-- TMPL_VAR NAME="module" --></td>
+						<td><!-- TMPL_VAR NAME="action" --></td>
+						<td>
+						    <!-- TMPL_IF NAME="MEMBERS"-->
+						        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="object" -->" title="display detail for this member." title="Display member details.">
+						            member <!-- TMPL_VAR NAME="object" -->
+						        </a>
+						    <!-- TMPL_ELSE -->
+						    <!-- TMPL_IF NAME="CIRCULATION" -->
+						        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="object" -->" title="display detail for this member." title="Display member details.">
+						            <!-- TMPL_IF NAME="object"-->member <!-- TMPL_VAR NAME="object" --><!-- /TMPL_IF -->
+						        </a>
+						    <!-- TMPL_ELSE -->
+						    <!-- TMPL_IF NAME="CATALOGUING" -->
+						        <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="object" -->" title="Display detail for this biblio">biblio <!-- TMPL_VAR NAME="object" --></a>
+						    <!-- TMPL_ELSE-->
+    						    <!-- TMPL_VAR NAME="object" -->
+    						<!-- /TMPL_IF -->
+    						<!-- /TMPL_IF -->
+    						<!-- /TMPL_IF -->
+						</td>
+						<td>
+						    <!-- TMPL_IF NAME="CIRCULATION" -->
+						         <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="info" -->" title="Display detail for this biblio">biblio <!-- TMPL_VAR NAME="info" --></a>
+    						<!-- TMPL_ELSE -->
+    						    <!-- TMPL_VAR NAME="info" -->
+    						<!-- /TMPL_IF -->
+						</td>
+					</tr>
+		<!-- /TMPL_LOOP -->
+    </table>
+    </div>
 
+<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: tools/viewlog.pl
===================================================================
RCS file: /sources/koha/koha/tools/Attic/viewlog.pl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- tools/viewlog.pl	10 Jan 2007 16:57:47 -0000	1.1.2.1
+++ tools/viewlog.pl	11 Jan 2007 14:23:10 -0000	1.1.2.2
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: viewlog.pl,v 1.1.2.1 2007/01/10 16:57:47 toins Exp $
+# $Id: viewlog.pl,v 1.1.2.2 2007/01/11 14:23:10 toins Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -28,25 +28,21 @@
 use C4::Log;
 use Date::Manip;
 
-=head1 NAME
+=head1 viewlog.pl
 
 plugin that shows a stats on borrowers
 
-=head1 DESCRIPTION
-
-
-=over2
-
 =cut
 
 my $input          = new CGI;
 my $do_it          = $input->param('do_it');
-my $fullreportname = "admin/viewlog.tmpl";
-my $modulename     = $input->param("module");
-my $userfilter     = $input->param("user");
-my $actionfilter   = $input->param("action");
-my $fromfilter     = $input->param("from");
-my $tofilter       = $input->param("to");
+my $module   = $input->param("module");
+my $user     = $input->param("user");
+my $action   = $input->param("action");
+my $object   = $input->param("object");
+my $info     = $input->param("info");
+my $datefrom = $input->param("from");
+my $dateto   = $input->param("to");
 my $basename       = $input->param("basename");
 my $mime           = $input->param("MIME");
 my $del            = $input->param("sep");
@@ -54,52 +50,38 @@
 
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
     {
-        template_name   => $fullreportname,
+        template_name   => "tools/viewlog.tmpl",
         query           => $input,
         type            => "intranet",
         authnotrequired => 0,
-        flagsrequired   => { editcatalogue => 1 },
+        flagsrequired   => { tools => 1 },
         debug           => 1,
     }
 );
-$template->param( do_it => $do_it );
+
 if ($do_it) {
 
-    # Displaying results
-    #building filters
-    my @filters;
-    push @filters, { name => 'user', value => $userfilter } if ($userfilter);
-    push @filters, { name => 'action', value => $actionfilter }
-      if ($actionfilter);
-    push @filters, { name => 'from', value => $fromfilter } if ($fromfilter);
-    push @filters, { name => 'to',   value => $tofilter }   if ($tofilter);
-    if ( $modulename eq "catalogue" ) {
-        my $titlefilter      = $input->param("title");
-        my $authorfilter     = $input->param("author");
-        my $publisherfilter  = $input->param("publisher");
-        my $callnumberfilter = $input->param("itemcallnumber");
-
-        push @filters, { name => 'title', value => $titlefilter }
-          if ($titlefilter);
-        push @filters, { name => 'author', value => $authorfilter }
-          if ($authorfilter);
-        push @filters, { name => 'publisher', value => $publisherfilter }
-          if ($publisherfilter);
-        push @filters, { name => 'callnumber', value => $callnumberfilter }
-          if ($callnumberfilter);
-    }
+    my $results = GetLogs($datefrom,$dateto,$user,$module,$action,$object,$info);
+    my $total = scalar @$results;
 
-    my ( $count, $results ) = displaylog( $modulename, @filters );
     if ( $output eq "screen" ) {
 
         # Printing results to screen
-        $template->param(
-            modulename  => $modulename,
-            $modulename => 1,
-            looprow     => $results
+        $template->param (
+            total    => $total,
+            $module  => 1,
+            looprow  => $results,
+            do_it    => 1,
+            datefrom => $datefrom,
+            dateto   => $dateto,
+            user     => $user,
+            module   => $module,
+            object   => $object,
+            action   => $action,
+            info     => $info,
         );
         output_html_with_http_headers $input, $cookie, $template->output;
-        exit(1);
+        exit;
     }
     else {
 
@@ -112,11 +94,8 @@
         my $sep;
         $sep = C4::Context->preference("delimiter");
 
-        # header top-right
-        # Other header
-        # Table
         foreach my $line (@$results) {
-            if ( $modulename eq "catalogue" ) {
+            if ( $module eq "catalogue" ) {
                 print $line->{timestamp} . $sep;
                 print $line->{firstname} . $sep;
                 print $line->{surname} . $sep;
@@ -125,11 +104,9 @@
                 print $line->{title} . $sep;
                 print $line->{author} . $sep;
             }
-            print "\n";
         }
 
-        # footer
-        exit(1);
+        exit;
     }
 }
 else {
@@ -141,10 +118,6 @@
 
     my @mime = ( C4::Context->preference("MIME") );
 
-    #	foreach my $mime (@mime){
-    #		warn "".$mime;
-    #	}
-
     my $CGIextChoice = CGI::scrolling_list(
         -name     => 'MIME',
         -id       => 'MIME',
@@ -163,6 +136,7 @@
     );
 
     $template->param(
+        total        => 0,
         CGIextChoice => $CGIextChoice,
         CGIsepChoice => $CGIsepChoice
     );





More information about the Koha-cvs mailing list