(bug #3398) fix unimarc 210c plugin

this add some args to SearchAuthority();
Fix the pagination, and fix javascript script.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
Nahuel ANGELINETTI 2009-07-15 11:01:27 +02:00 committed by Galen Charlton
parent 7013085ca5
commit 3e7e8bf35e
2 changed files with 24 additions and 9 deletions

View file

@ -162,7 +162,8 @@ my ($input) = @_;
my @excluding = $query->param('excluding');
my @operator = $query->param('operator');
my @value = $query->param('value');
my $orderby = $query->param('orderby');
$resultsperpage= $query->param('resultsperpage');
$resultsperpage = 19 if(!defined $resultsperpage);
@ -171,8 +172,8 @@ my ($input) = @_;
my ($results,$total) = SearchAuthorities( \@tags,\@and_or,
\@excluding, \@operator, \@value,
$startfrom*$resultsperpage, $resultsperpage,$authtypecode);# $orderby);
$startfrom*$resultsperpage, $resultsperpage,$authtypecode, $orderby);
($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "cataloguing/value_builder/unimarc_field_210c.tmpl",
query => $query,
@ -211,7 +212,7 @@ my ($input) = @_;
} else {
$to = (($startfrom+1)*$resultsperpage);
}
my $link="../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_210c.pl&amp;authtypecode=EDITORS&and_or=and&operator=contains&".join("&",map {"value=".$_} @value)."&op=do_search&type=intranet&index=$index";
my $link="../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_210c.pl&amp;authtypecode=EDITORS&and_or=$and_or&amp;marclist=$marclist&amp;operator=$operator&amp;orderby=$orderby&amp;excluding=$excluding&amp;".join("&amp;",map {"value=".$_} @value)."&amp;op=do_search&amp;type=intranet&amp;index=$index";
warn "$link ,".getnbpages($total, $resultsperpage);
$template->param(result => $results) if $results;
$template->param('index' => $query->param('index'));

View file

@ -21,6 +21,20 @@
<input type="hidden" name="index" value="<!--TMPL_VAR Name="index"-->">
<input type="hidden" name="authtypecode" value="EDITORS">
<input type="hidden" name="q" value="<!-- TMPL_VAR NAME="index" -->">
<input type="hidden" name="marclist" value="all" />
<input type="hidden" name="and_or" value="and" />
<input type="hidden" name="excluding" value="" />
<select name="orderby">
<option value="">None</option>
<option value="HeadingAsc" selected="selected">Heading A-Z</option>
<option value="HeadingDsc">Heading Z-A</option>
</select>
<select name="operator">
<option value="contains">contains</option>
<option value="start">starts with</option>
<option value="is">is exactly</option>
</select>
</p>
<p>
<input type="submit" value="Start search" class="button authority">
@ -53,7 +67,7 @@
<td><!-- TMPL_VAR NAME="summary" --></td>
<td><!-- TMPL_VAR NAME="used" --> times</td>
<td>
<a href="javascript:report('<!-- TMPL_VAR NAME="index" -->','<!-- TMPL_VAR name="summary" ESCAPE=JS -->')"><img alt="choose" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/arrow.gif" width="32" hspace="0" vspace="0" border="0"></a>
<a href="javascript:report('<!-- TMPL_VAR name="summary" ESCAPE=JS -->')"><img alt="choose" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/arrow.gif" width="32" hspace="0" vspace="0" border="0"></a>
</td>
</tr>
<!-- /TMPL_LOOP -->
@ -70,14 +84,14 @@
<script language="JavaScript" type="text/javascript">
function report(index,summary)
function report(summary)
{
var regexp= /(\d* -+ *)(.*)/;
var regexp= /--\s*(.*)/;
var result=summary.match(regexp);
var doc = opener.document;
var field = doc.getElementById(index);
var field = doc.getElementById('<!-- TMPL_VAR NAME="index" -->');
field.value = result[2];
field.value = result[1];
self.close();
}
</script>