new: authorities in prog/en template, only partial import from default/en
template. improved: C4::Output::pagination_bar builds an HTML pagination bar with no language dependency. This function hugely simplifies templates and offers a standard pagination method. This function also improves preformances.
This commit is contained in:
parent
36b3d24bcd
commit
e0090dcdaa
141
C4/Output.pm
141
C4/Output.pm
|
|
@ -51,7 +51,7 @@ C4::Output - Functions for managing templates
|
|||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
&themelanguage &gettemplate setlanguagecookie
|
||||
&themelanguage &gettemplate setlanguagecookie pagination_bar
|
||||
);
|
||||
|
||||
#FIXME: this is a quick fix to stop rc1 installing broken
|
||||
|
|
@ -146,6 +146,7 @@ sub themelanguage {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
sub setlanguagecookie {
|
||||
my ($query,$language,$uri)=@_;
|
||||
my $cookie=$query->cookie(-name => 'KohaOpacLanguage',
|
||||
|
|
@ -155,6 +156,144 @@ sub setlanguagecookie {
|
|||
-cookie=>$cookie);
|
||||
}
|
||||
|
||||
=item pagination_bar
|
||||
|
||||
pagination_bar($base_url, $nb_pages, $current_page, $startfrom_name)
|
||||
|
||||
Build an HTML pagination bar based on the number of page to display, the
|
||||
current page and the url to give to each page link.
|
||||
|
||||
C<$base_url> is the URL for each page link. The
|
||||
C<$startfrom_name>=page_number is added at the end of the each URL.
|
||||
|
||||
C<$nb_pages> is the total number of pages available.
|
||||
|
||||
C<$current_page> is the current page number. This page number won't become a
|
||||
link.
|
||||
|
||||
This function returns HTML, without any language dependency.
|
||||
|
||||
=cut
|
||||
|
||||
sub pagination_bar {
|
||||
my ($base_url, $nb_pages, $current_page, $startfrom_name) = @_;
|
||||
|
||||
# how many pages to show before and after the current page?
|
||||
my $pages_around = 2;
|
||||
|
||||
my $url =
|
||||
$base_url
|
||||
.($base_url =~ m/&/ ? '&' : '?')
|
||||
.$startfrom_name.'='
|
||||
;
|
||||
|
||||
my $pagination_bar = '';
|
||||
|
||||
# current page detection
|
||||
if (not defined $current_page) {
|
||||
$current_page = 1;
|
||||
}
|
||||
|
||||
# navigation bar useful only if more than one page to display !
|
||||
if ($nb_pages > 1) {
|
||||
# link to first page?
|
||||
if ($current_page > 1) {
|
||||
$pagination_bar.=
|
||||
"\n".' '
|
||||
.'<a href="'.$url.'1" rel="start">'
|
||||
.'<<'
|
||||
.'</a>'
|
||||
;
|
||||
}
|
||||
else {
|
||||
$pagination_bar.=
|
||||
"\n".' <span class="inactive"><<</span>';
|
||||
}
|
||||
|
||||
# link on previous page ?
|
||||
if ($current_page > 1) {
|
||||
my $previous = $current_page - 1;
|
||||
|
||||
$pagination_bar.=
|
||||
"\n".' '
|
||||
.'<a href="'
|
||||
.$url.$previous
|
||||
.'" rel="prev">'
|
||||
.'<'
|
||||
.'</a>'
|
||||
;
|
||||
}
|
||||
else {
|
||||
$pagination_bar.=
|
||||
"\n".' <span class="inactive"><</span>';
|
||||
}
|
||||
|
||||
my $min_to_display = $current_page - $pages_around;
|
||||
my $max_to_display = $current_page + $pages_around;
|
||||
my $last_displayed_page = undef;
|
||||
|
||||
for my $page_number (1..$nb_pages) {
|
||||
if ($page_number == 1
|
||||
or $page_number == $nb_pages
|
||||
or ($page_number >= $min_to_display and $page_number <= $max_to_display)
|
||||
) {
|
||||
if (defined $last_displayed_page
|
||||
and $last_displayed_page != $page_number - 1
|
||||
) {
|
||||
$pagination_bar.=
|
||||
"\n".' <span class="inactive">...</span>'
|
||||
;
|
||||
}
|
||||
|
||||
if ($page_number == $current_page) {
|
||||
$pagination_bar.=
|
||||
"\n".' '
|
||||
.'<span class="currentPage">'.$page_number.'</span>'
|
||||
;
|
||||
}
|
||||
else {
|
||||
$pagination_bar.=
|
||||
"\n".' '
|
||||
.'<a href="'.$url.$page_number.'">'.$page_number.'</a>'
|
||||
;
|
||||
}
|
||||
$last_displayed_page = $page_number;
|
||||
}
|
||||
}
|
||||
|
||||
# link on next page?
|
||||
if ($current_page < $nb_pages) {
|
||||
my $next = $current_page + 1;
|
||||
|
||||
$pagination_bar.=
|
||||
"\n".' <a href="'.$url.$next.'" rel="next">'
|
||||
.'>'
|
||||
.'</a>'
|
||||
;
|
||||
}
|
||||
else {
|
||||
$pagination_bar.=
|
||||
"\n".' <span class="inactive">></span>'
|
||||
;
|
||||
}
|
||||
|
||||
# link to last page?
|
||||
if ($current_page != $nb_pages) {
|
||||
$pagination_bar.=
|
||||
"\n".' <a href="'.$url.$nb_pages.'" rel="last">'
|
||||
.'>>'
|
||||
.'</a>'
|
||||
;
|
||||
}
|
||||
else {
|
||||
$pagination_bar.=
|
||||
"\n".' <span class="inactive">>></span>';
|
||||
}
|
||||
}
|
||||
|
||||
return $pagination_bar;
|
||||
}
|
||||
|
||||
|
||||
END { } # module clean-up code here (global destructor)
|
||||
|
||||
|
|
|
|||
|
|
@ -38,11 +38,8 @@ my $op = $query->param('op');
|
|||
my $authtypecode = $query->param('authtypecode');
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
my $startfrom=$query->param('startfrom');
|
||||
my $authid=$query->param('authid');
|
||||
$startfrom=0 if(!defined $startfrom);
|
||||
my ($template, $loggedinuser, $cookie);
|
||||
my $resultsperpage;
|
||||
|
||||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop;
|
||||
|
|
@ -62,85 +59,90 @@ if ($op eq "do_search") {
|
|||
my @operator = $query->param('operator');
|
||||
my @value = $query->param('value');
|
||||
|
||||
$resultsperpage= $query->param('resultsperpage');
|
||||
$resultsperpage = 19 if(!defined $resultsperpage);
|
||||
my @tags;
|
||||
my ($results,$total) = authoritysearch($dbh, \@marclist,\@and_or,
|
||||
\@excluding, \@operator, \@value,
|
||||
$startfrom*$resultsperpage, $resultsperpage,$authtypecode);
|
||||
($template, $loggedinuser, $cookie)
|
||||
= get_template_and_user({template_name => "authorities/searchresultlist.tmpl",
|
||||
query => $query,
|
||||
type => 'intranet',
|
||||
authnotrequired => 0,
|
||||
flagsrequired => {borrowers => 1},
|
||||
flagsrequired => {catalogue => 1},
|
||||
debug => 1,
|
||||
});
|
||||
my $startfrom = $query->param('startfrom') || 1;
|
||||
my $resultsperpage = $query->param('resultsperpage') || 19;
|
||||
|
||||
# multi page display gestion
|
||||
my $displaynext=0;
|
||||
my $displayprev=$startfrom;
|
||||
if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
|
||||
$displaynext = 1;
|
||||
}
|
||||
my ($results,$total) = authoritysearch(
|
||||
$dbh,
|
||||
\@marclist,
|
||||
\@and_or,
|
||||
\@excluding,
|
||||
\@operator,
|
||||
\@value,
|
||||
($startfrom - 1)*$resultsperpage,
|
||||
$resultsperpage,
|
||||
$authtypecode
|
||||
);
|
||||
|
||||
($template, $loggedinuser, $cookie)
|
||||
= get_template_and_user({
|
||||
template_name => "authorities/searchresultlist.tmpl",
|
||||
query => $query,
|
||||
type => 'intranet',
|
||||
authnotrequired => 0,
|
||||
flagsrequired => {borrowers => 1},
|
||||
flagsrequired => {catalogue => 1},
|
||||
debug => 1,
|
||||
});
|
||||
|
||||
my @field_data = ();
|
||||
|
||||
# we must get parameters once again. Because if there is a mainentry, it has been replaced by something else during the search, thus the links next/previous would not work anymore
|
||||
# we must get parameters once again. Because if there is a mainentry, it
|
||||
# has been replaced by something else during the search, thus the links
|
||||
# next/previous would not work anymore
|
||||
my @marclist_ini = $query->param('marclist');
|
||||
for(my $i = 0 ; $i <= $#marclist ; $i++)
|
||||
{
|
||||
push @field_data, { term => "marclist", val=>$marclist_ini[$i] };
|
||||
push @field_data, { term => "and_or", val=>$and_or[$i] };
|
||||
push @field_data, { term => "excluding", val=>$excluding[$i] };
|
||||
push @field_data, { term => "operator", val=>$operator[$i] };
|
||||
push @field_data, { term => "value", val=>$value[$i] };
|
||||
push @field_data, { term => "marclist" , val=>$marclist_ini[$i] };
|
||||
push @field_data, { term => "and_or" , val=>$and_or[$i] };
|
||||
push @field_data, { term => "excluding" , val=>$excluding[$i] };
|
||||
push @field_data, { term => "operator" , val=>$operator[$i] };
|
||||
push @field_data, { term => "value" , val=>$value[$i] };
|
||||
}
|
||||
|
||||
my @numbers = ();
|
||||
# construction of the url of each page
|
||||
my $base_url =
|
||||
'authorities-home.pl?'
|
||||
.join(
|
||||
'&',
|
||||
map { $_->{term}.'='.$_->{val} } @field_data
|
||||
)
|
||||
.'&'
|
||||
.join(
|
||||
'&',
|
||||
map { $_->{term}.'='.$_->{val} } (
|
||||
{term => 'resultsperpage', val => $resultsperpage},
|
||||
{term => 'type' , val => 'intranet'},
|
||||
{term => 'op' , val => 'do_search'},
|
||||
{term => 'authtypecode' , val => $authtypecode}
|
||||
)
|
||||
)
|
||||
;
|
||||
|
||||
if ($total>$resultsperpage)
|
||||
{
|
||||
for (my $i=1; $i<$total/$resultsperpage+1; $i++)
|
||||
{
|
||||
if ($i<16)
|
||||
{
|
||||
my $highlight=0;
|
||||
($startfrom==($i-1)) && ($highlight=1);
|
||||
push @numbers, { number => $i,
|
||||
highlight => $highlight ,
|
||||
searchdata=> \@field_data,
|
||||
startfrom => ($i-1)};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $from = $startfrom*$resultsperpage+1;
|
||||
my $from = ($startfrom - 1) * $resultsperpage + 1;
|
||||
my $to;
|
||||
|
||||
if($total < (($startfrom+1)*$resultsperpage))
|
||||
{
|
||||
if ($total < $startfrom * $resultsperpage) {
|
||||
$to = $total;
|
||||
} else {
|
||||
$to = (($startfrom+1)*$resultsperpage);
|
||||
}
|
||||
else {
|
||||
$to = $startfrom * $resultsperpage;
|
||||
}
|
||||
|
||||
$template->param(result => $results) if $results;
|
||||
|
||||
$template->param(
|
||||
startfrom=> $startfrom,
|
||||
displaynext=> $displaynext,
|
||||
displayprev=> $displayprev,
|
||||
resultsperpage => $resultsperpage,
|
||||
startfromnext => $startfrom+1,
|
||||
startfromprev => $startfrom-1,
|
||||
searchdata=>\@field_data,
|
||||
total=>$total,
|
||||
from=>$from,
|
||||
to=>$to,
|
||||
numbers=>\@numbers,
|
||||
authtypecode=>$authtypecode,
|
||||
isEDITORS => $authtypecode eq 'EDITORS',
|
||||
);
|
||||
pagination_bar => pagination_bar(
|
||||
$base_url,
|
||||
int($total/$resultsperpage)+1,
|
||||
$startfrom,
|
||||
'startfrom'
|
||||
),
|
||||
total=>$total,
|
||||
from=>$from,
|
||||
to=>$to,
|
||||
isEDITORS => $authtypecode eq 'EDITORS',
|
||||
);
|
||||
|
||||
} elsif ($op eq "delete") {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,105 @@
|
|||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
|
||||
Koha -- Authorities
|
||||
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
|
||||
|
||||
<!-- TMPL_INCLUDE NAME="menus.inc" -->
|
||||
<!-- TMPL_INCLUDE NAME="menu-authorities.inc" -->
|
||||
|
||||
<fieldset id="authorities_authorities_home_search">
|
||||
<legend>Authority search</legend>
|
||||
|
||||
<form name="f" action="/cgi-bin/koha/authorities/authorities-home.pl" method="post">
|
||||
<input type="hidden" name="op" value="do_search">
|
||||
<input type="hidden" name="type" value="intranet">
|
||||
<input type="hidden" name="nbstatements" value="<!-- TMPL_VAR NAME="nbstatements" -->">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="authtypecode">Search on</label>
|
||||
</th>
|
||||
<td colspan="2">
|
||||
<select id="authtypecode" name="authtypecode">
|
||||
<!-- TMPL_LOOP NAME="authtypesloop" -->
|
||||
<!-- TMPL_IF name="selected" -->
|
||||
<option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="authtypetext" --></option>
|
||||
<!-- TMPL_ELSE -->
|
||||
<option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="authtypetext" --></option>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- /TMPL_LOOP -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="value_mainentry">Main entry</label>
|
||||
<input type="hidden" name="marclist" value="mainentry">
|
||||
<input type="hidden" name="and_or" value="and">
|
||||
<input type="hidden" name="excluding" value="">
|
||||
</th>
|
||||
<td>
|
||||
<select name="operator">
|
||||
<option value="contains">contains</option>
|
||||
<option value="start">start by</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input id="value_mainentry" type="text" name="value" value="<!-- TMPL_VAR NAME="value" -->">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<label for="value_anywhere">Anywhere</label>
|
||||
<input type="hidden" name="marclist" value="">
|
||||
<input type="hidden" name="and_or" value="and">
|
||||
<input type="hidden" name="excluding" value="">
|
||||
</th>
|
||||
<td>
|
||||
<select name="operator">
|
||||
<option value="contains">contains</option>
|
||||
<option value="start">start by</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input id="value_anywhere" type="text" name="value" value="<!-- TMPL_VAR NAME="value" -->">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="action">
|
||||
<input type="submit" value="Start search">
|
||||
</div>
|
||||
</form>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="authorities_authorities_home_add">
|
||||
<legend>Add authority</legend>
|
||||
|
||||
<form name="f2" method="post" action="authorities.pl">
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="add_authtypecode">Authority type</label>
|
||||
</th>
|
||||
<td>
|
||||
<select id="add_authtypecode" name="authtypecode">
|
||||
<!-- TMPL_LOOP name="authtypesloop" -->
|
||||
<!-- TMPL_IF name="selected" -->
|
||||
<option value="<!-- TMPL_VAR name="value" -->" selected="selected"><!-- TMPL_VAR name="authtypetext" --></option>
|
||||
<!-- TMPL_ELSE -->
|
||||
<option value="<!-- TMPL_VAR name="value" -->"><!-- TMPL_VAR name="authtypetext" --></option>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- /TMPL_LOOP -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="action">
|
||||
<input type="submit" value="Add" class="button authority">
|
||||
</div>
|
||||
</form>
|
||||
</fieldset>
|
||||
|
||||
<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->
|
||||
|
|
@ -0,0 +1,212 @@
|
|||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
|
||||
Koha -- Authority details
|
||||
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
|
||||
|
||||
<!-- TMPL_INCLUDE NAME="menus.inc" -->
|
||||
<!-- TMPL_INCLUDE NAME="menu-authorities.inc" -->
|
||||
|
||||
<fieldset id="authorities_authorities_add_or_modify">
|
||||
<!-- TMPL_IF name="authid" -->
|
||||
<legend>Modify authority #<!-- TMPL_VAR NAME="authid" --> (<!-- TMPL_VAR name="authtypetext" -->)</legend>
|
||||
<!-- TMPL_ELSE -->
|
||||
<legend>Adding authority (<!-- TMPL_VAR name="authtypetext" -->)</legend>
|
||||
<!-- /TMPL_IF -->
|
||||
<form method="post" name="f">
|
||||
<input type="hidden" name="op" value="add">
|
||||
<input type="hidden" name="addfield_field">
|
||||
<input type="hidden" name="authtypecode" value="<!-- TMPL_VAR NAME="authtypecode" -->">
|
||||
<input type="hidden" name="authid" value="<!-- TMPL_VAR NAME="authid" -->">
|
||||
|
||||
<div id="action">
|
||||
<!-- TMPL_IF name="authid" -->
|
||||
<input type="button" value="Save" onClick="Check(this.form)" accesskey="w">
|
||||
<!-- TMPL_ELSE -->
|
||||
<input type="button" value="Add authority" onClick="Check(this.form)" accesskey="w">
|
||||
<!-- /TMPL_IF -->
|
||||
</div>
|
||||
|
||||
<!-- TMPL_IF name="duplicateauthid" -->
|
||||
<div class="problem">
|
||||
<p>Duplicate suspected with <a href='javascript:openWindow("detail.pl?authid=<!-- TMPL_VAR name="duplicateauthid" -->&popup=1", "Duplicate Authority")' class="button authority"><!-- TMPL_VAR name="duplicateauthvalue" --></a></p>
|
||||
<p>You must either :</p>
|
||||
<ul>
|
||||
<p><input type="checkbox" value=1 name="confirm_not_duplicate">confirm it's not a duplicate (and click on <input type="button" value="Add authority" onClick="Check(this.form)" accesskey="w" class="button authority"> again)</p>
|
||||
<p>Go to <a href="authorities.pl?authid=<!-- TMPL_VAR name="duplicateauthid" -->" >original authority</a></p>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_LOOP NAME="0XX" -->
|
||||
<!-- TMPL_IF name="tag" -->
|
||||
<p class="MARCtag">
|
||||
<!-- TMPL_VAR NAME="tag" -->
|
||||
<input type="hidden" name="ind_tag" value="<!-- TMPL_VAR NAME="tag" -->">
|
||||
<input type="text" name="indicator" size="3" maxlength="2" value="<!-- TMPL_VAR NAME="indicator" -->"> - <TMPL_VAR NAME="tag_lib">
|
||||
<!-- TMPL_IF name="repeatable" -->
|
||||
<a href="javascript:AddField(<!-- TMPL_VAR NAME="tag" -->)">+</a>
|
||||
<!-- /TMPL_IF -->
|
||||
</p>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_LOOP NAME="subfield_loop" -->
|
||||
<p>
|
||||
<label class="labelsubfield">
|
||||
<!-- TMPL_UNLESS name="hide_marc" -->
|
||||
<img src="<!-- TMPL_VAR NAME="themelang" -->/images/prev.gif" onClick="javascript:upSubfield('<!-- TMPL_VAR name="index" -->')">
|
||||
<input type="text" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->" size="1" maxlength="1">
|
||||
<!-- TMPL_ELSE -->
|
||||
<input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->">
|
||||
<!-- /TMPL_UNLESS -->
|
||||
<!-- TMPL_IF name="mandatory" --><b><!-- /TMPL_IF -->
|
||||
<!-- TMPL_VAR NAME="marc_lib" -->
|
||||
<!-- TMPL_IF name="mandatory" --> *</b><!-- /TMPL_IF -->
|
||||
</label>
|
||||
<!-- TMPL_VAR NAME="marc_value" -->
|
||||
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="tag" -->">
|
||||
<input type="hidden" name="mandatory" value="<!-- TMPL_VAR NAME="mandatory" -->">
|
||||
<input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->">
|
||||
<input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->">
|
||||
</p>
|
||||
<!-- /TMPL_LOOP -->
|
||||
<!-- /TMPL_LOOP -->
|
||||
|
||||
<div name="hidden" id="hidden" class="tab">
|
||||
<!-- TMPL_LOOP NAME="hidden_loop" -->
|
||||
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="tag" -->">
|
||||
<input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->">
|
||||
<input type="hidden" name="mandatory" value="<!-- TMPL_VAR NAME="mandatory" -->">
|
||||
<input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->">
|
||||
<input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->">
|
||||
<!-- /TMPL_LOOP -->
|
||||
</div>
|
||||
<!-- TMPL_IF name="oldbiblionumtagfield" -->
|
||||
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="oldbiblionumtagfield" -->">
|
||||
<input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="oldbiblionumtagsubfield" -->">
|
||||
<input type="hidden" name="field_value" value="<!-- TMPL_VAR NAME="oldbiblionumber" -->">
|
||||
<input type="hidden" name="mandatory" value="0">
|
||||
<input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->">
|
||||
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="oldbiblioitemnumtagfield" -->">
|
||||
<input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="oldbiblioitemnumtagsubfield" -->">
|
||||
<input type="hidden" name="field_value" value="<!-- TMPL_VAR NAME="oldbiblioitemnumber" -->">
|
||||
<input type="hidden" name="mandatory" value="0">
|
||||
<input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->">
|
||||
<input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->">
|
||||
<!-- /TMPL_IF -->
|
||||
</form>
|
||||
</fieldset>
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
function _(s) { return s } // dummy function for gettext
|
||||
function active(numlayer)
|
||||
{
|
||||
for (i=0; i < 10 ; i++ ) {
|
||||
ong = i+"XX";
|
||||
link = "link"+i;
|
||||
if (numlayer==i) {
|
||||
document.getElementById(ong).style.visibility="visible";
|
||||
} else {
|
||||
document.getElementById(ong).style.visibility="hidden";
|
||||
}
|
||||
}
|
||||
}
|
||||
function Check(f) {
|
||||
// Scan for nonempty fields
|
||||
var field_is_nonempty_p = new Array();
|
||||
for (i=0 ; i<f.field_value.length ; i++) {
|
||||
field_is_nonempty_p[f.tag[i].value] = 0;
|
||||
}
|
||||
for (i=0 ; i<f.field_value.length ; i++) {
|
||||
if (f.field_value[i].value.length != 0) {
|
||||
field_is_nonempty_p[f.tag[i].value] += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Scan for missing mandatory subfields
|
||||
var total_missing_mandatory_subfields = 0;
|
||||
for (i=0 ; i<f.field_value.length-2 ; i++) {
|
||||
if (f.field_value[i].value.length==0 && f.mandatory[i].value==1) {
|
||||
// We should not flag an error unless the tag is also
|
||||
// mandatory, or if something else in the tag is entered
|
||||
|
||||
if (f.tag_mandatory[i].value == 1 || field_is_nonempty_p[f.tag[i].value]) {
|
||||
document.getElementById("error"+i).style.backgroundColor="#FF0000";
|
||||
total_missing_mandatory_subfields++;
|
||||
}
|
||||
} else {
|
||||
document.getElementById("error"+i).style.backgroundColor="#FFFFFF";
|
||||
}
|
||||
}
|
||||
|
||||
// Scan for missing mandatory tags
|
||||
var total_missing_mandatory_tags = 0;
|
||||
var seen_mandatory_tag_p = new Array();
|
||||
for (i=0 ; i<f.field_value.length ; i++) {
|
||||
var j = f.tag[i].value;
|
||||
if (!field_is_nonempty_p[j] && f.tag_mandatory[i].value == 1) {
|
||||
if (seen_mandatory_tag_p[j] != 1) {
|
||||
seen_mandatory_tag_p[j] = 1;
|
||||
total_missing_mandatory_tags++;
|
||||
}
|
||||
document.getElementById("error"+i).style.backgroundColor="#ffff00";
|
||||
}
|
||||
}
|
||||
|
||||
var total_errors = total_missing_mandatory_tags + total_missing_mandatory_subfields;
|
||||
var alertString2;
|
||||
if (total_errors!=0) {
|
||||
alertString2 = _("Form not submitted because of the following problem(s)");
|
||||
alertString2 += "\n------------------------------------------------------------------------------------\n";
|
||||
alertString2 += "\n- "+ total_missing_mandatory_tags +_(" mandatory tags empty");
|
||||
alertString2 += "\n- "+ total_missing_mandatory_subfields +_(" mandatory fields empty (see bold subfields)");
|
||||
alert(alertString2);
|
||||
} else {
|
||||
document.forms[0].submit();
|
||||
}
|
||||
}
|
||||
function Dopop(link,i) {
|
||||
defaultvalue=document.forms['f'].field_value[i].value;
|
||||
newin=window.open(link+"&result="+defaultvalue,"value builder",'width=550,height=550,toolbar=false,scrollbars=yes');
|
||||
}
|
||||
|
||||
function PopupZ3950() {
|
||||
var strQuery="";
|
||||
for (i=0 ; i<document.forms['f'].field_value.length ; i++) {
|
||||
if (document.forms['f'].kohafield[i].value == "biblioitems.isbn" && document.forms['f'].field_value[i].value.length>0) {
|
||||
strQuery += "&isbn="+document.forms['f'].field_value[i].value;
|
||||
}
|
||||
if (document.forms['f'].kohafield[i].value == "biblio.title" && document.forms['f'].field_value[i].value.length>0) {
|
||||
strQuery += "&title="+document.forms['f'].field_value[i].value;
|
||||
}
|
||||
if (document.forms['f'].kohafield[i].value == "biblio.author" &&document.forms['f'].field_value[i].value.length>0) {
|
||||
strQuery += "&author="+document.forms['f'].field_value[i].value;
|
||||
}
|
||||
if (document.forms['f'].kohafield[i].value == "biblioitems.issn" && document.forms['f'].field_value[i].value.length>0) {
|
||||
strQuery += "&issn="+document.forms['f'].field_value[i].value;
|
||||
}
|
||||
}
|
||||
newin=window.open("../z3950/search.pl?bibid=<!-- TMPL_VAR NAME="bibid" -->"+strQuery,"z3950search",'width=500,height=400,toolbar=false,scrollbars=yes');
|
||||
}
|
||||
|
||||
function AddField(field) {
|
||||
document.forms[1].op.value = "addfield";
|
||||
document.forms[1].addfield_field.value=field;
|
||||
document.f.submit();
|
||||
}
|
||||
|
||||
function upSubfield(index) {
|
||||
temp = document.forms['f'].field_value[index-1].value;
|
||||
document.forms['f'].field_value[index-1].value=document.forms['f'].field_value[index].value;
|
||||
document.forms['f'].field_value[index].value= temp;
|
||||
temp = document.forms['f'].subfield[index-1].value;
|
||||
document.forms['f'].subfield[index-1].value=document.forms['f'].subfield[index].value;
|
||||
document.forms['f'].subfield[index].value = temp;
|
||||
temp = document.forms['f'].mandatory[index-1].value;
|
||||
document.forms['f'].mandatory[index-1].value=document.forms['f'].mandatory[index].value;
|
||||
document.forms['f'].mandatory[index].value = temp;
|
||||
temp = document.forms['f'].kohafield[index-1].value;
|
||||
document.forms['f'].kohafield[index-1].value=document.forms['f'].kohafield[index].value;
|
||||
document.forms['f'].kohafield[index].value = temp;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
|
||||
Koha -- Authority details
|
||||
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
|
||||
|
||||
<!-- TMPL_INCLUDE NAME="menus.inc" -->
|
||||
<!-- TMPL_INCLUDE NAME="menu-authorities.inc" -->
|
||||
|
||||
<h1 class="authority">Authority #<!-- TMPL_VAR NAME="authid" --> (<!-- TMPL_VAR name="authtypetext" -->)</h1>
|
||||
|
||||
<div id="authorities_detail_actions">
|
||||
<ul>
|
||||
<li><a href="authorities.pl?authid=<!-- TMPL_VAR NAME="authid" -->">Edit</a></li>
|
||||
|
||||
<!-- TMPL_UNLESS name="count" -->
|
||||
<li><a href="javascript:confirm_deletion()">Delete</a></li>
|
||||
<!-- /TMPL_UNLESS -->
|
||||
|
||||
<li><a href="javascript:Dopop('detailprint.pl?authid=<!-- TMPL_VAR NAME="authid" -->')" class="button authority">Print</a></li>
|
||||
|
||||
<li><a href="../search.marc/search.pl?type=intranet&op=do_search&marclist=<!-- TMPL_VAR NAME="biblio_fields" -->&operator==&value=<!-- TMPL_VAR NAME="authid" -->&and_or=and&excluding=" class="button authority"><!-- TMPL_VAR name="count" --> biblios</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="authorities_detail_details">
|
||||
<!-- TMPL_LOOP NAME="0XX" -->
|
||||
<table>
|
||||
<tr>
|
||||
<th colspan="2"><!-- TMPL_VAR NAME="tag" --></th>
|
||||
</tr>
|
||||
<!-- TMPL_LOOP NAME="subfield" -->
|
||||
<tr>
|
||||
<td><!-- TMPL_VAR NAME="marc_subfield" --> <!-- TMPL_VAR NAME="marc_lib" --></td>
|
||||
<td><!-- TMPL_VAR NAME="marc_value" --></td>
|
||||
</tr>
|
||||
<!-- /TMPL_LOOP --> <!-- subfield -->
|
||||
</table>
|
||||
<!-- /TMPL_LOOP --> <!-- tag -->
|
||||
</div>
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
|
||||
function confirm_deletion() {
|
||||
var is_confirmed = confirm('Are you sure you want to delete this authority?');
|
||||
if (is_confirmed) {
|
||||
window.location="authorities-home.pl?op=delete&authid=<!-- TMPL_VAR NAME="authid" -->";
|
||||
}
|
||||
}
|
||||
function Dopop(link) {
|
||||
newin=window.open(link,'width=500,height=400,toolbar=false,scrollbars=yes');
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
|
||||
Koha -- Authorities -- Search result list
|
||||
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
|
||||
|
||||
<!-- TMPL_INCLUDE NAME="menus.inc" -->
|
||||
<!-- TMPL_INCLUDE NAME="menu-authorities.inc" -->
|
||||
|
||||
<h1 class="authority">Authority search results</h1>
|
||||
|
||||
<div class="paginationBar"><!-- TMPL_VAR NAME="pagination_bar" --></div>
|
||||
|
||||
<p id="authorities_searchresultlist_current_page_info">
|
||||
<!-- TMPL_IF name="total" -->
|
||||
Results <!-- TMPL_VAR NAME="from" --> to <!-- TMPL_VAR NAME="to" --> of <!-- TMPL_VAR NAME="total" -->
|
||||
<!-- TMPL_ELSE -->
|
||||
No results found.
|
||||
<!-- /TMPL_IF -->
|
||||
</p>
|
||||
|
||||
<div id="authorities_searchresultlist_results">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Summary</th>
|
||||
<!-- TMPL_UNLESS name="isEDITORS" -->
|
||||
<th>Used in</th>
|
||||
<!-- /TMPL_UNLESS -->
|
||||
<th>View</th>
|
||||
<th>Delete</th>
|
||||
</tr>
|
||||
<!-- TMPL_LOOP NAME="result" -->
|
||||
<tr>
|
||||
<td><!-- TMPL_VAR NAME="summary" --></td>
|
||||
<!-- TMPL_UNLESS name="isEDITORS" -->
|
||||
<td>
|
||||
<a href="../search.marc/search.pl?type=intranet&op=do_search&marclist=<!-- TMPL_VAR NAME="biblio_fields" -->&operator==&value=<!-- TMPL_VAR NAME="authid" -->&and_or=and&excluding=" class="button authority"><!-- TMPL_VAR NAME="used" --> biblio(s)</a>
|
||||
</td>
|
||||
<!-- /TMPL_UNLESS -->
|
||||
<td>
|
||||
<a href="detail.pl?authid=<!-- TMPL_VAR NAME="authid" -->">Authority number <!-- TMPL_VAR NAME="authid" --></a>
|
||||
</td>
|
||||
<td>
|
||||
<!-- TMPL_UNLESS name="used" -->
|
||||
<a href="javascript:confirm_deletion(<!-- TMPL_VAR NAME="authid" -->)">Delete</a>
|
||||
<!-- /TMPL_UNLESS -->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- /TMPL_LOOP -->
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="paginationBar"><!-- TMPL_VAR NAME="pagination_bar" --></div>
|
||||
|
||||
<script language="JavaScript" type="text/javascript" >
|
||||
|
||||
function confirm_deletion(id) {
|
||||
|
||||
var is_confirmed = confirm('Are you sure you want to delete this authority?');
|
||||
if (is_confirmed) {
|
||||
window.location="authorities-home.pl?op=delete&authid="+id;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<script language="JavaScript" type="text/javascript">
|
||||
function Help() {
|
||||
newin=window.open("/cgi-bin/koha/help.pl","Koha Help",'width=600,height=600,toolbar=false,scrollbars=yes');
|
||||
}
|
||||
|
||||
function addauthority() {
|
||||
X = document.forms[0].authtype.value;
|
||||
window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X;
|
||||
}
|
||||
function searchauthority() {
|
||||
X = document.forms[0].authtype2.value;
|
||||
Y = document.forms[0].value.value;
|
||||
window.location="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&authtypecode="+X+"&value="+Y+"&marclist=&and_or=and&excluding=&operator=contains";
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in New Issue