[Koha-patches] [PATCH] Bug 4888 - Add funtionality for indicators - Intranet Files

Salvador Zaragoza Rubio salvazm at masmedios.com
Thu Feb 10 10:49:51 CET 2011


Pm, pl, js, pl files on the intranet to manage the indicators
functionality
---
 C4/Indicators.pm                                   |  746 ++++++++++++++++++++
 admin/marc_indicators_structure.pl                 |  151 ++++
 admin/marctagstructure.pl                          |   12 +
 cataloguing/addbiblio.pl                           |   25 +-
 cataloguing/indicators_ajax.pl                     |  117 +++
 cataloguing/marc21_indicators.pl                   |  115 +++
 koha-tmpl/intranet-tmpl/prog/en/js/indicators.js   |  531 ++++++++++++++
 .../modules/admin/marc_indicators_structure.tmpl   |   67 ++
 .../prog/en/modules/admin/marctagstructure.tmpl    |    5 +-
 .../en/modules/admin/preferences/cataloguing.pref  |   12 +
 .../prog/en/modules/cataloguing/addbiblio.tmpl     |  230 ++++--
 .../en/modules/cataloguing/marc21_indicators.tmpl  |   79 ++
 12 files changed, 2013 insertions(+), 77 deletions(-)
 create mode 100755 C4/Indicators.pm
 create mode 100755 admin/marc_indicators_structure.pl
 create mode 100755 cataloguing/indicators_ajax.pl
 create mode 100755 cataloguing/marc21_indicators.pl
 create mode 100755 koha-tmpl/intranet-tmpl/prog/en/js/indicators.js
 create mode 100755 koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_indicators_structure.tmpl
 mode change 100644 => 100755 koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tmpl
 mode change 100644 => 100755 koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
 mode change 100644 => 100755 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl
 create mode 100755 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/marc21_indicators.tmpl

diff --git a/C4/Indicators.pm b/C4/Indicators.pm
new file mode 100755
index 0000000..5d87c91
--- /dev/null
+++ b/C4/Indicators.pm
@@ -0,0 +1,746 @@
+package C4::Indicators;
+
+# Copyright 2010-2011 MASmedios.com y Ministerio de Cultura
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use strict;
+use warnings;
+use C4::Context;
+use C4::Debug;
+
+
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+
+BEGIN {
+    $VERSION = 3.02;    # set version for version checking
+    require Exporter;
+    @ISA    = qw(Exporter);
+    @EXPORT = qw(
+      &CloneIndicatorsFramework
+      &GetIndicatorsFramework
+      &DelIndicatorsFramework
+      &GetDataFieldMarc
+      &GetIndicator
+      &AddIndicator
+      &DelIndicator
+      &AddIndicatorValue
+      &DelIndicatorValue
+      &ModIndicatorValue
+      &ModIndicatorDesc
+      &GetValuesIndicator
+      &GetValuesIndicatorFrameWork
+      &GetLanguagesIndicators
+      &binarySearch
+      &CheckValueIndicatorsSub
+    );
+}
+
+=head1 NAME
+
+C4::Indicators - Indicators Module Functions
+
+=head1 SYNOPSIS
+
+  use C4::Indicators;
+
+=head1 DESCRIPTION
+
+Module to manage indicators on intranet cataloguing section
+
+Module to manage indicators on the intranet cataloguing section
+applying the rules of MARC21 according to the Library of Congress
+http://www.loc.gov/marc/bibliographic/ecbdhome.html
+
+Functions for handling MARC21 indicators on cataloguing.
+
+
+=head1 SUBROUTINES
+
+
+
+=head2 CloneIndicatorsFramework
+
+Clone all the indicators from one framework to another one
+
+return :
+the new frameworkcode
+
+=cut
+
+
+sub CloneIndicatorsFramework
+{
+    my ($frameworkcodeSource, $frameworkcodeDest) = @_;
+
+    my $indicators = GetIndicatorsFramework($frameworkcodeSource);
+    my $hashRefSource;
+    my ($id_indicator, $id_indicator_value);
+    for $hashRefSource (@$indicators) {
+        $id_indicator = AddIndicator($hashRefSource->{tagfield}, $frameworkcodeDest);
+        if ($id_indicator) {
+            my ($id_indicator_old, $data) = GetValuesIndicator($hashRefSource->{id_indicator}, $hashRefSource->{tagfield}, $frameworkcodeSource);
+            for (@$data) {
+                $id_indicator_value = AddIndicatorValue($id_indicator, $hashRefSource->{tagfield}, $frameworkcodeDest, $_->{ind}, $_->{ind_value}, $_->{ind_desc}, $_->{lang});
+            }
+        }
+    }
+    return $frameworkcodeDest;
+}#CloneIndicatorsFramework
+
+
+
+=head2 GetIndicatorsFramework
+
+Get all the indicators from a framework
+
+return :
+an array of hash data
+
+=cut
+
+
+sub GetIndicatorsFramework
+{
+    my ($frameworkcode) = @_;
+
+    my @data;
+    my $dbh = C4::Context->dbh;
+    if ($dbh) {
+        eval {
+            my $query = qq|SELECT id_indicator, tagfield FROM marc_indicators WHERE frameworkcode=?|;
+            my $sth = $dbh->prepare($query);
+            $sth->execute($frameworkcode);
+            my $hashRef;
+            while ($hashRef = $sth->fetchrow_hashref) {
+                push @data, $hashRef;
+            }
+        };
+        if ($@) {
+            $debug and warn "Error GetIndicatorsFramework $@\n";
+        }
+    }
+    return \@data;
+}#GetIndicatorsFramework
+
+
+
+=head2 DelIndicatorsFramework
+
+Delete indicators in a specific framework
+
+return :
+the success of the operation
+
+=cut
+
+
+sub DelIndicatorsFramework
+{
+    my ($frameworkcode) = @_;
+
+    my $dbh = C4::Context->dbh;
+    if ($dbh) {
+        eval {
+            my $query = qq|DELETE FROM marc_indicators
+                WHERE frameworkcode=?|;
+            my $sth = $dbh->prepare($query);
+            $sth->execute($frameworkcode);
+        };
+        if ($@) {
+            $debug and warn "Error DelIndicatorsFramework $@\n";
+        } else {
+            return 1;
+        }
+    }
+    return 0;
+}#DelIndicatorsFramework
+
+
+
+=head2 GetDataFieldMarc
+
+Get the data from marc_tag_structure for a field in a specific framework
+
+return :
+the data hash for the datafield
+
+=cut
+
+
+sub GetDataFieldMarc
+{
+    my ($tagfield, $frameworkcode) = @_;
+
+    my $data = {};
+    my $dbh = C4::Context->dbh;
+    if ($dbh) {
+        eval {
+            my $query = qq|SELECT tagfield,liblibrarian,libopac,mandatory,repeatable 
+                            FROM marc_tag_structure 
+                            WHERE frameworkcode=? AND tagfield=?|;
+            my $sth = $dbh->prepare($query);
+            $sth->execute($frameworkcode, $tagfield);
+            $data = $sth->fetchrow_hashref;
+        };
+        if ($@) {
+            $debug and warn "Error GetDataFieldMarc $@\n";
+        }
+    }
+    return $data;
+}#GetDataFieldMarc
+
+
+
+=head2 GetIndicator
+
+Get the indicator id from a field in a specific framework
+
+return :
+the id of this indicator
+
+=cut
+
+
+sub GetIndicator
+{
+    my ($tagfield, $frameworkcode) = @_;
+
+    my $id_indicator;
+    my $dbh = C4::Context->dbh;
+    if ($dbh) {
+        eval {
+            my $query;
+            my $sth;
+            if ($frameworkcode) {
+                $query = qq|SELECT id_indicator
+                    FROM marc_indicators
+                    WHERE tagfield=? AND frameworkcode=?|;
+                $sth = $dbh->prepare($query);
+                $sth->execute($tagfield, $frameworkcode);
+            } else {
+                $query = qq|SELECT id_indicator
+                    FROM marc_indicators
+                    WHERE tagfield=? AND frameworkcode=''|;
+                $sth = $dbh->prepare($query);
+                $sth->execute($tagfield);
+            }
+            ($id_indicator) = $sth->fetchrow;
+        };
+        if ($@) {
+            $debug and warn "Error GetIndicator $@\n";
+        }
+    }
+    return $id_indicator;
+}#GetIndicator
+
+
+
+=head2 AddIndicator
+
+Adds a new indicator to a field in a specific framework
+
+return :
+the id of this new indicator
+
+=cut
+
+
+sub AddIndicator
+{
+    my ($tagfield, $frameworkcode) = @_;
+
+    my $id_indicator;
+    my $dbh = C4::Context->dbh;
+    if ($dbh) {
+        eval {
+            my $query = qq|INSERT INTO marc_indicators
+                (tagfield,frameworkcode) VALUES (?,?)|;
+            my $sth = $dbh->prepare($query);
+            $sth->execute($tagfield, $frameworkcode);
+            if ($sth->rows > 0) {
+                $id_indicator = $dbh->{'mysql_insertid'};
+            }
+        };
+        if ($@) {
+            $debug and warn "Error AddIndicator $@\n";
+        }
+    }
+    return $id_indicator;
+}#AddIndicator
+
+
+
+=head2 DelIndicator
+
+Delete a new indicator to a field in a specific framework
+
+return :
+the success of the operation
+
+=cut
+
+
+sub DelIndicator
+{
+    my ($id_indicator, $tagfield, $frameworkcode) = @_;
+
+    my $ret;
+    my $dbh = C4::Context->dbh;
+    if ($dbh) {
+        eval {
+            my $query;
+            my @arrParams;
+            if ($id_indicator){
+                $query = qq|DELETE FROM marc_indicators
+                WHERE id_indicator=?|;
+                push @arrParams, $id_indicator;
+            } else {
+                $query = qq|DELETE FROM marc_indicators
+                WHERE tagfield=? AND frameworkcode=?|;
+                @arrParams = ($tagfield, $frameworkcode);
+            }
+            my $sth = $dbh->prepare($query);
+            $sth->execute(@arrParams);
+            $ret = 1;
+        };
+        if ($@) {
+            $debug and warn "Error DelIndicator $@\n";
+        }
+    }
+    return $ret;
+}#DelIndicator
+
+
+
+=head2 AddIndicatorValue
+
+Adds a new indicator value and (if defined) description to a field in a specific framework
+
+return :
+the id of this new indicator value
+
+=cut
+
+
+sub AddIndicatorValue
+{
+    my ($id_indicator, $tagfield, $frameworkcode, $index, $value, $desc, $lang) = @_;
+
+    my $id_indicator_value;
+    my $dbh = C4::Context->dbh;
+    if ($dbh) {
+        $id_indicator = GetIndicator($tagfield, $frameworkcode) unless ($id_indicator);
+        $id_indicator = AddIndicator($tagfield, $frameworkcode) unless ($id_indicator);
+        eval {
+            my $query = qq|INSERT INTO marc_indicators_value
+                (id_indicator,ind,ind_value) VALUES (?,?,?)|;
+            my $sth = $dbh->prepare($query);
+            $sth->execute($id_indicator, $index, $value);
+            if ($sth->rows > 0) {
+                $id_indicator_value = $dbh->{'mysql_insertid'};
+                if ($id_indicator_value && $desc) {
+                    $query = qq|INSERT INTO marc_indicators_desc 
+                        (id_indicator_value,lang,ind_desc) VALUES (?,?,?)|;
+                    $lang = 'en' unless ($lang);
+                    my $sth2 = $dbh->prepare($query);
+                    $sth2->execute($id_indicator_value, $lang, $desc);
+                }
+            }
+        };
+        if ($@) {
+            print $@;
+            $debug and warn "Error AddIndicatorValue $@\n";
+        }
+    }
+    return $id_indicator_value;
+}#AddIndicatorValue
+
+
+
+=head2 DelIndicatorValue
+
+Delete a new indicator value in a framework field
+
+return :
+the success of the operation
+
+=cut
+
+
+sub DelIndicatorValue
+{
+    my ($id_indicator_value) = @_;
+
+    my $ret;
+    my $dbh = C4::Context->dbh;
+    if ($dbh) {
+        eval {
+            my $query = qq|DELETE FROM marc_indicators_value
+                WHERE id_indicator_value=?|;
+            my $sth = $dbh->prepare($query);
+            $sth->execute($id_indicator_value);
+            $ret = 1;
+        };
+        if ($@) {
+            $debug and warn "Error DelIndicatorValue $@\n";
+        }
+    }
+    return $ret;
+}#DelIndicatorValue
+
+
+
+=head2 ModIndicatorValue
+
+Modify a indicator value in a framework field
+
+return :
+the success of the operation
+
+=cut
+
+
+sub ModIndicatorValue
+{
+    my ($id_indicator_value, $value, $desc, $lang, $ind) = @_;
+
+    my $ret;
+    my $dbh = C4::Context->dbh;
+    if ($dbh) {
+        eval {
+            my $query = qq|UPDATE marc_indicators_value
+                SET ind_value=?, ind=?
+                WHERE id_indicator_value=?|;
+            my $sth = $dbh->prepare($query);
+            $sth->execute($value, $ind, $id_indicator_value);
+            if ($desc) {
+                $ret = ModIndicatorDesc($id_indicator_value, $desc, $lang);
+            } else {
+                $ret = 1;
+            }
+        };
+        if ($@) {
+            $debug and warn "Error ModIndicatorValue $@\n";
+        }
+    }
+    return $ret;
+}#ModIndicatorValue
+
+
+
+=head2 ModIndicatorDesc
+
+Modify a indicator description in a framework field and language
+
+return :
+the success of the operation
+
+=cut
+
+
+sub ModIndicatorDesc
+{
+    my ($id_indicator_value, $desc, $lang) = @_;
+
+    my $ret;
+    my $dbh = C4::Context->dbh;
+    if ($dbh) {
+        eval {
+            my $query = qq|SELECT COUNT(*) FROM marc_indicators_desc
+                WHERE id_indicator_value=? AND lang=?|;
+            my $sth = $dbh->prepare($query);
+            $sth->execute($id_indicator_value, $lang);
+            my ($num) = $sth->fetchrow;
+            $sth->finish;
+            if ($num) {
+                $query = qq|UPDATE marc_indicators_desc
+                SET ind_desc=?
+                WHERE id_indicator_value=? AND lang=?|;
+                $sth = $dbh->prepare($query);
+                $sth->execute($desc, $id_indicator_value, $lang);
+            } else {
+                $query = qq|INSERT INTO marc_indicators_desc 
+                        (id_indicator_value,lang,ind_desc) VALUES (?,?,?)|;
+                $sth = $dbh->prepare($query);
+                $sth->execute($id_indicator_value, $lang, $desc);
+            }
+            $ret = 1;
+        };
+        if ($@) {
+            $debug and warn "Error ModIndicatorDesc $@\n";
+        }
+    }
+    return $ret;
+}#ModIndicatorDesc
+
+
+
+=head2 GetValuesIndicator
+
+Get distinct values and descriptions from framework field
+
+return :
+the id of the indicator and an array structure with the data required
+
+=cut
+
+
+sub GetValuesIndicator
+{
+    my ($id_indicator, $tagfield, $frameworkcode, $lang) = @_;
+
+    my @data;
+    my $dbh = C4::Context->dbh;
+    if ($dbh) {
+        $id_indicator = GetIndicator($tagfield, $frameworkcode) unless ($id_indicator);
+        if ($id_indicator) {
+            eval {
+                my $query;
+                my $sth;
+                if ($lang) {
+                    $query = qq|(SELECT v.id_indicator_value, v.ind, v.ind_value, d.ind_desc, d.lang
+                            FROM marc_indicators_value v, marc_indicators_desc d
+                            WHERE v.id_indicator=? AND d.id_indicator_value=v.id_indicator_value AND d.lang=?
+                            )
+                    UNION
+                        (SELECT v.id_indicator_value, v.ind, v.ind_value, NULL AS ind_desc, NULL AS lang
+                            FROM marc_indicators_value v
+                            WHERE v.id_indicator=? AND NOT EXISTS (SELECT d.* FROM marc_indicators_desc d WHERE d.id_indicator_value=v.id_indicator_value))
+                        ORDER BY ind, ind_value|;
+                    $sth = $dbh->prepare($query);
+                    $sth->execute($id_indicator, $lang, $id_indicator);
+                } else {
+                    $query = qq|SELECT v.id_indicator_value, v.ind, v.ind_value, d.ind_desc, d.lang
+                        FROM marc_indicators_value v
+                        LEFT JOIN marc_indicators_desc d ON d.id_indicator_value=v.id_indicator_value
+                        WHERE v.id_indicator=?
+                        ORDER BY v.ind, v.ind_value|;
+                    $sth = $dbh->prepare($query);
+                    $sth->execute($id_indicator);
+                }
+                while (my $hashRef = $sth->fetchrow_hashref) {
+                    push @data, $hashRef;
+                }
+            };
+            if ($@) {
+                $debug and warn "Error GetValuesIndicator $@\n";
+            }
+        }
+    }
+    return ($id_indicator, \@data);
+}#GetValuesIndicator
+
+
+
+=head2 GetValuesIndicatorFrameWork
+
+Get distinct values and descriptions from framework template
+
+return :
+the frameworkcode and an hash structure with the data required
+
+=cut
+
+
+sub GetValuesIndicatorFrameWork
+{
+    my ($frameworkcode, $tagfieldsArrRef, $lang) = @_;
+
+    my %data;
+    my $dbh = C4::Context->dbh;
+    if ($dbh) {
+        unless ($tagfieldsArrRef && @$tagfieldsArrRef) {
+            $tagfieldsArrRef = [];
+            eval {
+                my $query;
+                my $sth;
+                if ($frameworkcode) {
+                    $query = qq|SELECT tagfield FROM marc_tag_structure
+                        WHERE tagfield NOT LIKE '00%' AND frameworkcode=?|;
+                    $sth = $dbh->prepare($query);
+                    $sth->execute($frameworkcode);
+                } else {
+                    $query = qq|SELECT tagfield FROM marc_tag_structure
+                        WHERE tagfield NOT LIKE '00%' AND frameworkcode=''|;
+                    $sth = $dbh->prepare($query);
+                    $sth->execute();
+                }
+                my $tagfield;
+                while (($tagfield) = $sth->fetchrow) {
+                    push @$tagfieldsArrRef, $tagfield;
+                }
+            };
+        }
+        for (@$tagfieldsArrRef) {
+            my ($id_indicator, $dataInd) = GetValuesIndicator(undef, $_, $frameworkcode, $lang);
+            $data{$_} = $dataInd;
+        }
+        if ($@) {
+            $debug and warn "Error GetValuesIndicatorFrameWork $@\n";
+        }
+    }
+    return ($frameworkcode, \%data);
+}#GetValuesIndicatorFrameWork
+
+
+
+=head2 GetLanguagesIndicators
+
+Get distinct languages from indicators descriptions
+
+return :
+the languages as a sorted array
+
+=cut
+
+
+sub GetLanguagesIndicators
+{
+    my @languages;
+    my $dbh = C4::Context->dbh;
+    if ($dbh) {
+        eval {
+            my $query = qq|SELECT DISTINCT lang FROM marc_indicators_desc ORDER BY lang|;
+            my $sth = $dbh->prepare($query);
+            $sth->execute();
+            my $lang;
+            while (($lang) = $sth->fetchrow) {
+                push @languages, $lang;
+            }
+        };
+        if ($@) {
+            $debug and warn "Error GetLanguagesIndicators $@\n";
+        }
+    }
+    return \@languages;
+}#GetLanguagesIndicators
+
+
+
+=head2 binarySearch
+
+Little binary search for strings
+
+return :
+true or false
+
+=cut
+
+
+sub binarySearch
+{
+    my ($id, $arr) = @_;
+
+    if ($arr && @$arr) {
+        my $i = 0;
+        my $j = scalar(@$arr) - 1;
+        my $k = 0;
+        while ($arr->[$k] ne $id && $j >= $i) {
+            $k = int(($i + $j) / 2);
+            if ($id gt $arr->[$k]) {
+                $i = $k + 1;
+            } else {
+                $j = $k - 1;
+            }
+        }
+        return 0 if ($arr->[$k] ne $id);
+        return 1;
+    }
+    return 0;
+}#binarySearch
+
+
+
+=head2 CheckValueIndicators
+
+Check the validity ot the indicators form values against the user defined ones
+
+return :
+Hash with the indicators with wrong values
+
+=cut
+
+
+sub CheckValueIndicatorsSub
+{
+    my ($input, $frameworkcode, $langParam) = @_;
+
+    my $retHash;
+    my $lang;
+    my $indicatorsLanguages = GetLanguagesIndicators();
+    if ($langParam && binarySearch($langParam, $indicatorsLanguages)) {
+        $lang = $langParam;
+    } elsif ($input->param('lang') && binarySearch($input->param('lang'), $indicatorsLanguages)) {
+        $lang = $input->param('lang');
+    } else {
+        $lang = 'en';
+    }
+    my ($frameworkcodeRet, $data) = GetValuesIndicatorFrameWork($frameworkcode, undef, $lang);
+    if ($data) {
+        $retHash = {};
+        my $tagfield;
+        my $ind;
+        my $var;
+        my $random;
+        my $found;
+        my $nonEmptySubfield;
+        my $pattern;
+        my @params = $input->param();
+        foreach $var (@params) {
+            if ($var =~ /^tag_([0-9]{3})_indicator([12])_([0-9]+)$/) {
+                $tagfield = $1;
+                $ind = $2;
+                $random = '[0-9_]*(?:' . $3 . ')?';
+                if ($data->{$tagfield} && @{$data->{$tagfield}}) {
+                    $found = 0;
+                    $nonEmptySubfield = 0;
+                    $pattern = 'tag_' . $tagfield . '_subfield_[a-z0-9]_' . $random;
+                    foreach my $value (@params) {
+                        if ($value =~ /^$pattern/ && $input->param($value) ne '') {
+                            $nonEmptySubfield = 1;
+                            last;
+                        }
+                    }
+                    if ($nonEmptySubfield) {
+                        for (@{$data->{$tagfield}}) {
+                            if ($ind == $_->{ind} && ($_->{ind_value} eq $input->param($var) || $input->param($var) eq '' || $input->param($var) eq ' ')) {
+                                $found = 1;
+                                last;
+                            }
+                        }
+                        $retHash->{$tagfield}->{$ind} = $input->param($var) unless ($found);
+                    }
+                }
+            }
+        }
+        $retHash = undef unless (scalar(keys %$retHash));
+    }
+    return $retHash;
+}#CheckValueIndicatorsSub
+
+
+
+
+1;
+__END__
+
+=head1 AUTHOR
+
+Koha Development Team <http://koha-community.org/>
+
+=cut
+
diff --git a/admin/marc_indicators_structure.pl b/admin/marc_indicators_structure.pl
new file mode 100755
index 0000000..9bb699f
--- /dev/null
+++ b/admin/marc_indicators_structure.pl
@@ -0,0 +1,151 @@
+#!/usr/bin/perl 
+
+
+# Copyright 2010-2011 MASmedios.com y Ministerio de Cultura
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use strict;
+use CGI;
+use C4::Indicators;
+use C4::Context;
+use C4::Output;
+use C4::Auth;
+use C4::Biblio;
+use Data::Dumper;
+
+
+
+my $input = new CGI;
+
+my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+    {
+        template_name   => "admin/marc_indicators_structure.tmpl",
+        query           => $input,
+        type            => "intranet",
+        authnotrequired => 0,
+        flagsrequired   => { parameters => 1 },
+        debug           => 1,
+    }
+);
+
+my $frameworkcode = $input->param('frameworkcode');
+my $op = $input->param('op');
+my $tagfield = $input->param('tagfield');
+
+# Get the languages associated with indicators
+my $indicatorsLanguages = GetLanguagesIndicators();
+
+# Is our language is defined on the indicators?
+my $lang;
+if ($input->param('lang') && binarySearch($input->param('lang'), $indicatorsLanguages)) {
+    $lang = $input->param('lang');
+} elsif (binarySearch($template->param('lang'), $indicatorsLanguages)) {
+    $lang = $template->param('lang');
+} else {
+    $lang = 'en';
+}
+
+my $dataInd;
+my $id_indicator;
+my $strError = '';
+
+if ($input->request_method() eq "GET") {
+    if ($op eq 'mod') {
+        ($id_indicator, $dataInd) = GetValuesIndicator(undef, $tagfield, $frameworkcode, $lang);
+    } else {
+        $op = 'add';
+    }
+} elsif ($input->request_method() eq "POST") {
+    if ($op eq 'add') {
+        my $inserted = 0;
+        $id_indicator = AddIndicator($tagfield, $frameworkcode);
+        if ($id_indicator) {
+            $inserted++;
+            my $id_indicator_value;
+            my $counter;
+            for ($input->param()) {
+                if ($_ =~ /^ind_value_([0-9]+)$/ && ($counter = $1) && $input->param('ind_' . $counter) =~ /^([12])$/) {
+                    $id_indicator_value = AddIndicatorValue($id_indicator, $tagfield, $frameworkcode, $1, $input->param($_), $input->param('ind_desc_' . $counter), $lang);
+                    $inserted++ if ($id_indicator_value);
+                }
+            }
+        }
+        if ($inserted) {
+            $op = 'mod';
+            $strError = 'Insertion OK';
+            ($id_indicator, $dataInd) = GetValuesIndicator($id_indicator, $tagfield, $frameworkcode, $lang);
+        } else {
+            $strError = 'Insertion failed';
+        }
+    } elsif ($op eq 'mod') {
+        $id_indicator = $input->param('id_indicator');
+        ($id_indicator, $dataInd) = GetValuesIndicator($id_indicator, $tagfield, $frameworkcode, $lang);
+        my $indRepeated = {};
+        my $indId = {};
+        my $id_indicator_value;
+        my $counter;
+        for ($input->param()) {
+            if ($_ =~ /^id_indicator_([0-9]+)$/ && ($counter = $1) && $input->param('ind_' . $counter) =~ /^([12])$/) {
+                $indRepeated->{$counter} = $input->param($_);
+                $indId->{$input->param($_)} = $input->param($_);
+                ModIndicatorValue($input->param($_), $input->param('ind_value_' . $counter), $input->param('ind_desc_' . $counter), $lang, $input->param('ind_' . $counter));
+            } elsif ($_ =~ /^ind_value_([0-9]+)$/ && ($counter = $1) && !exists($indRepeated->{$counter}) && $input->param('ind_' . $counter) =~ /^([12])$/) {
+                $id_indicator_value = AddIndicatorValue($id_indicator, $tagfield, $frameworkcode, $1, $input->param($_), $input->param('ind_desc_' . $counter), $lang);
+                $indId->{$id_indicator_value} = $id_indicator_value if ($id_indicator_value);
+            }
+        }
+        foreach (@$dataInd) {
+            unless (exists($indId->{$_->{id_indicator_value}})) {
+                DelIndicatorValue($_->{id_indicator_value});
+                $id_indicator_value = $_->{id_contenido};
+            }
+        }
+        unless ($id_indicator_value) {
+            $strError = 'Update OK.';
+        } else {
+            $strError = 'Update failed.';
+        }
+        @$dataInd = undef;
+        ($id_indicator, $dataInd) = GetValuesIndicator($id_indicator, $tagfield, $frameworkcode, $lang);
+    }
+}
+
+
+if ($dataInd) {
+    my $i = 1;
+    for (@$dataInd) {
+        $_->{numInd} = $i;
+        $i++;
+    }
+}
+
+
+$template->param(frameworkcode => $frameworkcode,
+            strError => $strError,
+            op => $op,
+            lang => $lang,
+            tagfield => $tagfield,
+            numInd => ($dataInd)?scalar(@$dataInd):0,
+            BIG_LOOP => $dataInd,
+);
+
+
+output_html_with_http_headers $input, $cookie, $template->output;
+# print Dumper $dataInd;
+# print $strError;
+# print $lang;
+
diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl
index 92e0d99..ca7358b 100755
--- a/admin/marctagstructure.pl
+++ b/admin/marctagstructure.pl
@@ -26,6 +26,7 @@ use C4::Koha;
 use C4::Context;
 use C4::Output;
 use C4::Context;
+use C4::Indicators;
 
 
 # retrieve parameters
@@ -199,6 +200,10 @@ if ($op eq 'add_form') {
         my $sth2 = $dbh->prepare("DELETE FROM marc_subfield_structure WHERE tagfield=? AND frameworkcode=?");
         $sth1->execute($searchfield, $frameworkcode);
         $sth2->execute($searchfield, $frameworkcode);
+        # Manage Indicators
+        if (C4::Context->preference("marcflavour") eq 'MARC21' && int($searchfield) >= 10) {
+            DelIndicator(undef, $searchfield, $frameworkcode);
+        }
 	}
 	$template->param(
           searchfield => $searchfield,
@@ -263,6 +268,7 @@ if ($op eq 'add_form') {
 			$row_data{mandatory}        = $results[$i]->{'mts_mandatory'};
 			$row_data{authorised_value} = $results[$i]->{'mts_authorised_value'};
 			$row_data{subfield_link} = "marc_subfields_structure.pl?op=add_form&amp;tagfield=".$results[$i]->{'mts_tagfield'}."&amp;frameworkcode=".$frameworkcode;
+            $row_data{indicator_link} = (C4::Context->preference("marcflavour") eq 'MARC21' && int($results[$i]->{'mts_tagfield'}) >= 10)?"marc_indicators_structure.pl?op=mod&amp;tagfield=".$results[$i]->{'mts_tagfield'}."&amp;frameworkcode=".$frameworkcode:'';
 			$row_data{edit}          = "$script_name?op=add_form&amp;searchfield="            .$results[$i]->{'mts_tagfield'}."&amp;frameworkcode=".$frameworkcode;
 			$row_data{delete}        = "$script_name?op=delete_confirm&amp;searchfield="      .$results[$i]->{'mts_tagfield'}."&amp;frameworkcode=".$frameworkcode;
 			$j=$i;
@@ -302,12 +308,14 @@ if ($op eq 'add_form') {
 			$row_data{mandatory}        = $results->[$i]{'mandatory'};
 			$row_data{authorised_value} = $results->[$i]{'authorised_value'};
 			$row_data{subfield_link}    = "marc_subfields_structure.pl?tagfield="          .$results->[$i]{'tagfield'}."&amp;frameworkcode=".$frameworkcode;
+            $row_data{indicator_link} = (C4::Context->preference("marcflavour") eq 'MARC21' && int($results->[$i]{'tagfield'}) >= 10)?"marc_indicators_structure.pl?op=mod&amp;tagfield=".$results->[$i]{'tagfield'}."&amp;frameworkcode=".$frameworkcode:'';
 			$row_data{edit}             = "$script_name?op=add_form&amp;searchfield="      .$results->[$i]{'tagfield'}."&amp;frameworkcode=".$frameworkcode;
 			$row_data{delete}           = "$script_name?op=delete_confirm&amp;searchfield=".$results->[$i]{'tagfield'}."&amp;frameworkcode=".$frameworkcode;
 			push(@loop_data, \%row_data);
 		}
 		$template->param(loop => \@loop_data);
 	}
+    $template->param(showIndicators => (C4::Context->preference("marcflavour") eq 'MARC21')?1:0);
 	if ($offset>0) {
 		$template->param(isprevpage => $offset,
 						prevpage=> $offset-$pagesize,
@@ -361,5 +369,9 @@ sub duplicate_framework {
 	while ( my ($frameworkcode, $tagfield, $tagsubfield, $liblibrarian, $libopac, $repeatable, $mandatory, $kohafield, $tab, $authorised_value, $thesaurus_category, $value_builder, $seealso,$hidden) = $sth->fetchrow) {
 	    $sth_insert->execute($newframeworkcode, $tagfield, $tagsubfield, $liblibrarian, $libopac, $repeatable, $mandatory, $kohafield, $tab, $authorised_value, $thesaurus_category, $value_builder, $seealso, $hidden);
 	}
+    # Manage Indicators
+    if (C4::Context->preference("marcflavour") eq 'MARC21') {
+        CloneIndicatorsFramework($oldframeworkcode, $newframeworkcode);
+    }
 }
 
diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl
index f416cc7..5f44e4d 100755
--- a/cataloguing/addbiblio.pl
+++ b/cataloguing/addbiblio.pl
@@ -34,6 +34,7 @@ use C4::Branch;    # XXX subfield_is_koha_internal_p
 use C4::ClassSource;
 use C4::ImportBatch;
 use C4::Charset;
+use C4::Indicators;
 
 use Date::Calc qw(Today);
 use MARC::File::USMARC;
@@ -912,11 +913,27 @@ if ($biblionumber) {
 #-------------------------------------------------------------------------------------
 if ( $op eq "addbiblio" ) {
 #-------------------------------------------------------------------------------------
+    my ($duplicatebiblionumber,$duplicatetitle);
+    my $retWrongInd; # variable to hold the indicators with wrong values
+    if (C4::Context->preference("marcflavour") eq "MARC21" && (C4::Context->preference("CheckValueIndicators") || C4::Context->preference("DisplayPluginValueIndicators"))) {
+        $retWrongInd = CheckValueIndicatorsSub($input, $frameworkcode, $template->param('lang'));
+        if ($retWrongInd) {
+            my @params = $input->param();
+            $record = TransformHtmlToMarc( \@params , $input );
+            $duplicatebiblionumber = 1; # modify the variable (even it's not a duplicate) to not enter the next if block
+            $is_a_modif = 1; # do not want FindDuplicate
+            $input->param('confirm_not_duplicate', '0'); # modify to not enter the next if clause
+            my @wrongInd = ();
+            map { push @wrongInd, {tagfield => $_, ind1 => $retWrongInd->{$_}->{1}, ind2 => $retWrongInd->{$_}->{2}}; } keys %$retWrongInd;
+            $template->param(wrongInd => \@wrongInd);
+        }
+    }
+    
     # getting html input
     my @params = $input->param();
     $record = TransformHtmlToMarc( \@params , $input );
     # check for a duplicate
-    my ($duplicatebiblionumber,$duplicatetitle) = FindDuplicate($record) if (!$is_a_modif);
+    ($duplicatebiblionumber,$duplicatetitle) = FindDuplicate($record) if (!$is_a_modif);
     my $confirm_not_duplicate = $input->param('confirm_not_duplicate');
     # it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate)
     if ( !$duplicatebiblionumber or $confirm_not_duplicate ) {
@@ -970,6 +987,7 @@ if ( $op eq "addbiblio" ) {
         }
     } else {
     # it may be a duplicate, warn the user and do nothing
+        $duplicatebiblionumber = 0 if ($retWrongInd); # reset duplicatebiblionumber to the original value
         build_tabs ($template, $record, $dbh,$encoding,$input);
         $template->param(
             biblionumber             => $biblionumber,
@@ -1029,4 +1047,9 @@ $template->param(
     itemtype => $frameworkcode,
 );
 
+$template->param(
+    DisplayPluginValueIndicators => (C4::Context->preference("marcflavour") eq "MARC21")?C4::Context->preference("DisplayPluginValueIndicators"):0,
+    CheckValueIndicators => (C4::Context->preference("marcflavour") eq "MARC21")?(C4::Context->preference("CheckValueIndicators") | C4::Context->preference("DisplayPluginValueIndicators")):0
+);
+
 output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/cataloguing/indicators_ajax.pl b/cataloguing/indicators_ajax.pl
new file mode 100755
index 0000000..7aa6cd1
--- /dev/null
+++ b/cataloguing/indicators_ajax.pl
@@ -0,0 +1,117 @@
+#!/usr/bin/perl
+
+
+# Copyright 2010-2011 MASmedios.com y Ministerio de Cultura
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+use strict;
+use XML::LibXML;
+use CGI;
+use C4::Indicators;
+
+
+my $cgi = new CGI;
+my $strXml = '';
+my $doc;
+my $root;
+
+eval {
+    $doc = XML::LibXML::Document->new('1.0', 'UTF-8');
+};
+if ($@) {
+    $doc = undef;
+    $strXml = '<?xml version="1.0" encoding="UTF-8"?>' . chr(10);
+}
+
+if ($cgi->request_method() eq "POST" || $cgi->request_method() eq "GET") {
+
+    my $frameworkcode = $cgi->param('frameworkcode');
+    if ($doc) {
+        $root = $doc->createElement('Framework');
+        $root->setAttribute('frameworkcode', $frameworkcode);
+        $doc->addChild($root);
+    } else {
+        $strXml .= '<Framework frameworkcode="' . $frameworkcode . '">' . chr(10);
+    }
+    
+    my $params = $cgi->Vars;
+    my @tagfields;
+    @tagfields = split("\0", $params->{'tagfields'}) if $params->{'tagfields'};
+    
+    my $indicatorsLanguages = GetLanguagesIndicators();
+    my $lang;
+    if ($cgi->param('lang') && binarySearch($cgi->param('lang'), $indicatorsLanguages)) {
+        $lang = $cgi->param('lang');
+    } else {
+        $lang = 'en';
+    }
+
+    my ($frameworkcodeRet, $data) = GetValuesIndicatorFrameWork($frameworkcode, \@tagfields, $lang);
+    if ($data) {
+        my $elementFields;
+        if ($doc) {
+            $elementFields = $doc->createElement('Fields');
+            $root->addChild($elementFields);
+        } else {
+            $strXml .= '<Fields>' . chr(10);
+        }
+        my $tagfield;
+        my $elementField;
+        for $tagfield (sort keys %$data) {
+            if ($doc) {
+                $elementField = $doc->createElement('Field');
+                $elementField->setAttribute('tag', $tagfield);
+                $elementFields->addChild($elementField);
+            } else {
+                $strXml .= '<Field tag="' . $tagfield . '">' . chr(10);
+            }
+            if (@{$data->{$tagfield}}) {
+                my $elementInd;
+                my $dataUnique = {};
+                for (@{$data->{$tagfield}}) {
+                    unless (exists($dataUnique->{$_->{ind}}->{$_->{ind_value}})) {
+                        $dataUnique->{$_->{ind}}->{$_->{ind_value}} = 1;
+                        if ($doc) {
+                            $elementInd = $doc->createElement('Indicator');
+                            $elementInd->setAttribute('ind', $_->{ind});
+                            $elementInd->appendText($_->{ind_value});
+                            $elementField->addChild($elementInd);
+                        } else {
+                            $strXml .= '<Indicator ind="' . $_->{ind} . '">' . $_->{ind_value} . '</Indicator>' . chr(10);
+                        }
+                    }
+                }
+            }
+            $strXml .= '</Field>' . chr(10) unless ($doc);
+        }
+        $strXml .= '</Fields>' . chr(10) unless ($doc);
+    }
+    $strXml .= '</Framework>';
+} else {
+    if ($doc) {
+        $root = $doc->createElement('Error');
+        $doc->addChild($root);
+    } else {
+        $strXml .= '<Error />' . chr(10);
+    }
+}
+if ($doc) {
+    $strXml = $doc->toString(1);
+}
+print "Content-type: application/xml\n\n";
+print $strXml;
\ No newline at end of file
diff --git a/cataloguing/marc21_indicators.pl b/cataloguing/marc21_indicators.pl
new file mode 100755
index 0000000..77d0567
--- /dev/null
+++ b/cataloguing/marc21_indicators.pl
@@ -0,0 +1,115 @@
+#!/usr/bin/perl 
+
+
+# Copyright 2010-2011 MASmedios.com y Ministerio de Cultura
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use strict;
+use CGI;
+use C4::Indicators;
+use C4::Context;
+use C4::Output;
+use C4::Auth;
+use C4::Biblio;
+use Data::Dumper;
+
+
+
+my $input = new CGI;
+my $biblionumber = $input->param('biblionumber');
+my $frameworkcode = $input->param('frameworkcode');
+
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "cataloguing/marc21_indicators.tmpl",
+        query           => $input,
+        type            => "intranet",
+        authnotrequired => 0,
+    }
+);
+
+
+# Values of indicators as filled by user
+my %tagfields = ();
+foreach my $var ($input->param()) {
+    if ($var =~ /^tag_([0-9]{3})_indicator([12])_[0-9]+$/) {
+        $tagfields{$1}{$2}{value} = $input->param($var) if (defined($input->param($var)) && $input->param($var) ne '#');
+        $tagfields{$1}{$2}{field} = $var;
+    }
+}
+
+
+# Get data from biblio
+if ($biblionumber) {
+    my $record = GetMarcBiblio($biblionumber);
+    $template->param( title => $record->title());
+}
+
+# Get the languages associated with indicators
+my $indicatorsLanguages = GetLanguagesIndicators();
+
+# Is our language is defined on the indicators?
+my $lang;
+if ($input->param('lang') && binarySearch($input->param('lang'), $indicatorsLanguages)) {
+    $lang = $input->param('lang');
+} elsif (binarySearch($template->param('lang'), $indicatorsLanguages)) {
+    $lang = $template->param('lang');
+} else {
+    $lang = 'en';
+}
+
+my @INDICATORS_LOOP;
+my @tagfields = keys %tagfields;
+
+# Get predefined values for indicators on a framework, tagfields and language
+my ($frameworkcodeRet, $data) = GetValuesIndicatorFrameWork($frameworkcode, \@tagfields, $lang);
+if ($data) {
+    my $tagfield;
+    for $tagfield (sort keys %$data) {
+        my $dataField = GetDataFieldMarc($tagfield, $frameworkcode);
+        if (exists($tagfields{$tagfield}) || @{$data->{$tagfield}}) {
+            my $hashRef = {tagfield=> $tagfield, 
+                    desc => $dataField->{liblibrarian}?$dataField->{liblibrarian}:$dataField->{libopac},
+                    current_value_1 => exists($tagfields{$tagfield}{1}{value})?$tagfields{$tagfield}{1}{value}:'',
+                    current_value_2 => exists($tagfields{$tagfield}{2}{value})?$tagfields{$tagfield}{2}{value}:'',
+                    current_field_1 => exists($tagfields{$tagfield}{1})?$tagfields{$tagfield}{1}{field}:'',
+                    current_field_2 => exists($tagfields{$tagfield}{2})?$tagfields{$tagfield}{2}{field}:'',
+                    ind1_ok => 0, ind2_ok => 0,
+                    data => $data->{$tagfield}};
+            if (exists($tagfields{$tagfield}) && @{$data->{$tagfield}}) {
+                for (@{$data->{$tagfield}}) {
+                    last if ($hashRef->{ind1_ok} && $hashRef->{ind2_ok});
+                    if ($_->{ind} == 1 && !$hashRef->{ind1_ok}) {
+                        $hashRef->{ind1_ok} = 1 if ($_->{ind_value} eq $tagfields{$tagfield}{1}{value});
+                    } elsif ($_->{ind} == 2 && !$hashRef->{ind2_ok}) {
+                        $hashRef->{ind2_ok} = 1 if ($_->{ind_value} eq $tagfields{$tagfield}{2}{value});
+                    }
+                }
+            }
+            push @INDICATORS_LOOP, $hashRef;
+        }
+    }
+}
+
+$template->param(biblionumber => $biblionumber,
+                INDICATORS_LOOP => \@INDICATORS_LOOP,
+                indicatorsLanguages => $indicatorsLanguages
+        );
+
+output_html_with_http_headers $input, $cookie, $template->output;
+# print Dumper @INDICATORS_LOOP;
\ No newline at end of file
diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/indicators.js b/koha-tmpl/intranet-tmpl/prog/en/js/indicators.js
new file mode 100755
index 0000000..6c5f403
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/indicators.js
@@ -0,0 +1,531 @@
+
+    // Block for check validity of value indicators
+
+    function checkValueInd(obj, ind, field)
+    {
+        var valueInd = obj.value;
+        var form = obj.form;
+        var name = field + "_" + ind + "_";
+        var ok = false;
+        for (var i=0; i < form.elements.length; i++) {
+            if (form.elements[i].name.indexOf(name) >= 0 && valueInd == form.elements[i].value) {
+                ok = true;
+                break;
+            }
+        }
+        var a_usevalue;
+        var a_usevalue_3;
+        if (document && arguments.length == 5) {
+            a_usevalue = document.getElementById("a_usevalue_" + ind);
+            a_usevalue_3 = document.getElementById("a_usevalue_3");
+        }
+        if (ok) {
+            obj.title = "User Value for Indicator " + ind + " is valid";
+            obj.style.backgroundColor = "";
+            if (a_usevalue != undefined && a_usevalue != null && a_usevalue_3 != undefined && a_usevalue_3 != null ) {
+                if (document.all) {
+                    a_usevalue.onclick = function() { useValue(ind, field, arguments[3], true)};
+                    a_usevalue_3.onclick = function() { useValues(field, arguments[3], arguments[4])};
+                } else {
+                    a_usevalue.setAttribute('onclick', "useValue(" + ind + ", '" + field + "', '" + arguments[3] + "', true);");
+                    a_usevalue_3.setAttribute('onclick', "useValues('" + field + "', '" + arguments[3] + "', '" + arguments[4] + "');");
+                }
+                a_usevalue.title = "Use this value and close the window";
+                a_usevalue.innerHTML = "Use and Close";
+                a_usevalue_3.title = "Use these values and close the window";
+                a_usevalue_3.innerHTML = "Use both and Close";
+            }
+        } else {
+            obj.title = "User Value for Indicator " + ind + " is not valid";
+            obj.style.backgroundColor = "yellow";
+            if (a_usevalue != undefined && a_usevalue != null && a_usevalue_3 != undefined && a_usevalue_3 != null ) {
+                if (document.all) {
+                    a_usevalue.onclick = function() { return false; };
+                    a_usevalue_3.onclick = function() { return false; };
+                } else {
+                    a_usevalue.setAttribute('onclick', "return false;");
+                    a_usevalue_3.setAttribute('onclick', "return false;");
+                }
+                a_usevalue.title = "Can't Use this value until is correct";
+                a_usevalue.innerHTML = "Can't Use this value until is correct";
+                a_usevalue_3.title = "Can't Use these values until they're correct";
+                a_usevalue_3.innerHTML = "Can't Use these values until they're correct";
+            }
+        }
+        return ok;
+    }//checkValueInd
+
+
+    function changeValueInd(value, ind, field, openerField1, openerField2)
+    {
+        var openerField = (ind == 1)?openerField1:openerField2;
+        var name = field + "_ind" + ind;
+        var form = document.forms["f_pop"];
+        for (var i=0; i < form.elements.length; i++) {
+            if (form.elements[i].name == name) {
+                form.elements[i].value = value;
+                if (checkValueInd(form.elements[i], ind, field, openerField1, openerField2) && opener) {
+                    for (var j=0; j < opener.document.f.elements.length; j++) {
+                        if (opener.document.f.elements[j].name == openerField) {
+                            opener.document.f.elements[j].value = value;
+                            opener.document.f.elements[j].style.backgroundColor = "";
+                            break;
+                        }
+                    }
+                }
+                break;
+            }
+        }
+    }//changeValueInd
+
+
+    function useValue(ind, field, openerField, close)
+    {
+        var obj = document.getElementById(field + "_ind" + ind);
+        if (obj != null) {
+            var value = obj.value;
+            if (checkValueInd(obj, ind, field)) {
+                if (opener) {
+                    for (var j=0; j < opener.document.f.elements.length; j++) {
+                        if (opener.document.f.elements[j].name == openerField) {
+                            opener.document.f.elements[j].value = value;
+                            break;
+                        }
+                    }
+                    if (close) window.close();
+                }
+                return true;
+            } else {
+                var obja = document.getElementById("a_usevalue_" + ind);
+                if (obja != null) obja.title = "Value " + value + " invalid for indicator " + ind;
+                alert("Value " + value + " invalid for indicator " + ind);
+            }
+        }
+        return false;
+    }//useValue
+
+
+    function useValues(field, openerField1, openerField2)
+    {
+        if (useValue(1, field, openerField1, false) && useValue(2, field, openerField2, false)) {
+            if (opener) window.close();
+        }
+    }//useValues
+
+
+    function launchPopupValueIndicators(frameworkcode, tag, index, random)
+    {
+        var ind1 = "tag_" + tag + "_indicator1_" + index + random;
+        var ind2 = "tag_" + tag + "_indicator2_" + index + random;
+        var objInd1;
+        var objInd2;
+        try {
+            var result = document.evaluate("//input[@type='text' and @name='" + ind1 + "']", document.documentElement, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
+            objInd1 = result.singleNodeValue;
+            result = document.evaluate("//input[@type='text' and @name='" + ind2 + "']", document.documentElement, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
+            objInd2 = result.singleNodeValue;
+        } catch (e) {
+            for (var i=0; i < document.forms['f'].elements.length; i++) {
+                if (document.forms['f'].elements[i].name == ind1) objInd1 = document.forms['f'].elements[i];
+                else if (document.forms['f'].elements[i].name == ind2) objInd2 = document.forms['f'].elements[i];
+                if (objInd1 != undefined && objInd2 != undefined) break;
+            }
+        }
+        if (objInd1 != undefined || objInd2 != undefined) {
+            var strParam = "";
+            if (objInd1 != undefined) strParam += "&" + ind1 + "=" + ((objInd1.value)?objInd1.value:escape("#"));
+            if (objInd2 != undefined) strParam += "&" + ind2 + "=" + ((objInd2.value)?objInd2.value:escape("#"));
+            if (arguments.length == 5) {
+                window.open("/cgi-bin/koha/cataloguing/marc21_indicators.pl?biblionumber=" + arguments[4] + "&frameworkcode=" + frameworkcode + strParam, "valueindicators",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
+            } else {
+                window.open("/cgi-bin/koha/cataloguing/marc21_indicators.pl?frameworkcode=" + frameworkcode + strParam, "valueindicators",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
+            }
+        }
+    }//launchPopupValueIndicators
+
+
+
+    // Block for get indicators data from a framework with ajax
+
+    function get_request()
+    {
+        var req = null;
+        if (window.XMLHttpRequest) {
+            req = new XMLHttpRequest();
+            if (req.overrideMimeType) {
+                req.overrideMimeType('text/xml');
+            }
+        } else if (window.ActiveXObject) {
+            try {
+                req = new ActiveXObject("Msxml2.XMLHTTP");
+            } catch(e){
+                try {
+                    req = new ActiveXObject("Microsoft.XMLHTTP");
+                } catch(e) {}
+            }
+        }//if
+        return req;
+    }//get_request
+
+
+    function send_ajax_indicators(frameworkcode)
+    {
+        var req = null;
+        req = get_request();
+        if (!req) {
+            return false;
+        }
+
+        req.onreadystatechange = function() {
+            receive_ok_indicators(req);
+        };
+        req.open('POST', '/cgi-bin/koha/cataloguing/indicators_ajax.pl',true);
+        req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+        var param = "frameworkcode=" + escape(frameworkcode);
+        req.send(param);
+    }//send_ajax_indicators
+
+
+    var xmlDocInd;
+    var tagFields;
+
+    function receive_ok_indicators(req)
+    {
+        try {
+            if (req.readyState == 4) {
+                if (req.status == 200) {
+                    xmlDocInd = req.responseXML.documentElement;
+                    getTagFields();
+                }
+            }
+        } catch (e) {
+        }
+    }//receive_ok_indicators
+
+
+    function getTagFields()
+    {
+        tagFields = new Array();
+        var form = document.f;
+        var name;
+        var tag;
+        for (var i=0; i < form.elements.length; i++) {
+            name = form.elements[i].name;
+            if (name.indexOf("tag_") == 0 && name.indexOf("_indicator") > 0) {
+                tag = name.substr(4,3);
+                tagFields[tag] = true;
+            }
+        }
+    }//getTagFields
+
+
+    function checkValidIndFramework()
+    {
+        var form = document.f;
+        var strErrorInd = "";
+        var numError = -1;
+        if (xmlDocInd != undefined) {
+            if (xmlDocInd.nodeName == "Error") {
+            } else {
+                if (xmlDocInd.nodeName == "Framework" && xmlDocInd.nodeType == 1 && xmlDocInd.hasChildNodes()) {
+                    var nodeFields = xmlDocInd.getElementsByTagName('Fields')[0];
+                    if (nodeFields && nodeFields.nodeType == 1 && nodeFields.hasChildNodes()) {
+                        var nodeField = nodeFields.firstChild;
+                        var tag;
+                        var i = 1;
+                        var indexLast = 0;
+                        while (nodeField != null) {
+                            if (nodeField.nodeType == 1) {
+                                tag = nodeField.attributes.getNamedItem("tag").nodeValue;
+                                if (nodeField.hasChildNodes()) {
+                                    var objFieldsInd;
+                                    var arrObj = search_koha_field(form, tag, indexLast + 1);
+                                    if (arrObj != undefined && arrObj.length > 0) {
+                                        for (var z = 0; z < arrObj.length; z++) {
+                                            objFieldsInd = arrObj[z];
+                                            if (objFieldsInd != undefined && (objFieldsInd.ind1 != undefined || objFieldsInd.ind2 != undefined)) {
+                                                indexLast = objFieldsInd.indexOnForm;
+                                                for (var j = 1; j <= 2; j++) {
+                                                    var objInd;
+                                                    if (j == 1 && objFieldsInd.ind1 != undefined) objInd = objFieldsInd.ind1;
+                                                    else if (j == 2 && objFieldsInd.ind2 != undefined) objInd = objFieldsInd.ind2;
+                                                    if (objInd != undefined) {
+                                                        var valueInd = objInd.value;
+                                                        if (!checkValidIndField(j, valueInd, nodeField)) {
+                                                            strErrorInd += "The value \"" + valueInd + "\" is not valid for indicator 1 on tag " + tag + ". ";
+                                                            numError++;
+                                                            if (numError > 0 && (numError + 1) % 2 == 0) strErrorInd += "\n";
+                                                            objInd.style.backgroundColor = "yellow";
+                                                        } else {
+                                                            objInd.style.backgroundColor = "";
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                            nodeField = nodeField.nextSibling;
+                            i++;
+                        }
+                    }
+                }
+            }
+        }
+        return strErrorInd;
+    }//checkValidIndField
+
+
+    function checkValidIndField(ind, valueInd, nodeField)
+    {
+        try {
+            var nodeInd = nodeField.firstChild;
+            while (nodeInd != null) {
+                if (nodeInd.nodeType == 1 && (nodeInd.getAttributeNode("ind") || nodeInd.hasAttribute("ind"))) {
+                    if (nodeInd.getAttribute("ind") == ind) {
+                        if (nodeInd.hasChildNodes() && nodeInd.firstChild.nodeValue == valueInd) return true;
+                        else if (valueInd == "" || valueInd == " ") return true;
+                    }
+                }
+                nodeInd = nodeInd.nextSibling;
+            }
+        } catch (e) {
+            //alert("An exception occurred in the script. Error name: " + e.name + ". Error message: " + e.message);
+        }
+        return false;
+    }//checkValidIndField
+
+
+    function FieldIndicatorObject()
+    {
+    }//IndicatorObject
+
+    FieldIndicatorObject.prototype = {
+        ind1: undefined,
+        ind2: undefined,
+        indexOnForm: -1
+    }
+
+    function search_koha_field(form, tag, index)
+    {
+        var resArr;
+        if (tagFields != undefined && (tagFields[tag] == undefined || !tagFields[tag])) {
+            return resArr;
+        }
+        resArr = new Array();
+        var indTag = "tag_" + tag + "_indicator";
+        var lengthIndTag = indTag.length;
+        var pos;
+        var iterTotal = 0;
+        var ind1 = false;
+        var ind2 = false;
+        var obj;
+        var name;
+        for (var i=index; i < form.elements.length; i++, iterTotal++) {
+            name = form.elements[i].name;
+            if ((pos = name.indexOf(indTag)) >= 0) {
+                if (!ind1 && !ind2) {
+                    obj = new FieldIndicatorObject();
+                }
+                if (name.charAt(pos + lengthIndTag) == 1) {
+                    ind1 = true;
+                    obj.ind1 = form.elements[i];
+                    obj.indexOnForm = i;
+                } else {
+                    ind2 = true;
+                    obj.ind2 = form.elements[i];
+                    obj.indexOnForm = i;
+                }
+                if (ind1 && ind2 && obj.ind1 != undefined && obj.ind2 != undefined) {
+                    ind1 = false;
+                    ind2 = false;
+                    resArr.push(obj);
+                }
+            } else if (resArr.length > 0 && name.indexOf("tag_") == 0 && name.indexOf("_indicator") > 0) {
+                var tagAux = name.substr(4,3);
+                if (tag != tagAux) break;
+            }
+        }
+        if (resArr.length == 0 && index > 0) {
+            ind1 = false;
+            ind2 = false;
+            for (var i=0; i < index; i++, iterTotal++) {
+                name = form.elements[i].name;
+                if ((pos = name.indexOf(indTag)) >= 0) {
+                    if (!ind1 && !ind2) {
+                        obj = new FieldIndicatorObject();
+                    }
+                    if (name.charAt(pos + lengthIndTag) == 1) {
+                        ind1 = true;
+                        obj.ind1 = form.elements[i];
+                        obj.indexOnForm = i;
+                    } else {
+                        ind2 = true;
+                        obj.ind2 = form.elements[i];
+                        obj.indexOnForm = i;
+                    }
+                    if (ind1 && ind2 && obj.ind1 != undefined && obj.ind2 != undefined) {
+                        ind1 = false;
+                        ind2 = false;
+                        resArr.push(obj);
+                    }
+                } else if (resArr.length > 0 && name.indexOf("tag_") == 0 && name.indexOf("_indicator") > 0) {
+                    var tagAux = name.substr(4,3);
+                    if (tag != tagAux) break;
+                }
+            }
+        }
+        //alert(tag + "," + resArr.length + "," + index + "," + iterTotal);
+        return resArr;
+    }//search_koha_field
+
+
+
+    // Block for dynamic HTML management of value indicators
+
+
+    function add_element(name, attributes)
+    {
+        if ((document.all && navigator.appName.indexOf("Microsoft") >= 0) || name == "object") {
+            var str = " ";
+            if (attributes != "") {
+                var arr = attributes.split("\|");
+                for (var i=0; i < arr.length; i++) {
+                    if ((pos = arr[i].indexOf('=')) >= 0) {
+                        var arr2 = arr[i].split("=");
+                        if (arr[i].indexOf("'") > 0) {
+                            if (arr2.length == 2) str += arr2[0] + "=" + arr2[1] + " ";
+                            else str += arr2[0] + "=" + arr[i].substring(pos + 1, arr[i].length) + " ";
+                        } else {
+                            if (arr2.length == 2) str += arr2[0] + "=" + "'" + arr2[1] + "' ";
+                            else str += arr2[0] + "=" + "'" + arr[i].substring(pos + 1, arr[i].length) + "' ";
+                        }
+                    }//if
+                }//for
+            }//if
+            var element = document.createElement("<" + name + str + ">");
+        } else {
+            var element = document.createElement(name);
+            if (attributes != "") {
+                var arr = attributes.split("\|");
+                for (var i=0; i < arr.length; i++) {
+                    if ((pos = arr[i].indexOf('=')) >= 0) {
+                        var arr2 = arr[i].split("=");
+                        var regexp = new RegExp("'","gi");
+                        arr2[1] = arr2[1].replace(regexp,"");
+                        if (arr2.length == 2) element.setAttribute(arr2[0],arr2[1]);
+                        else element.setAttribute(arr2[0],arr[i].substring(pos + 1,arr[i].length));
+                    }
+                }//for
+            }//if
+        }//else
+        return element;
+    }//add_element
+
+
+    function delete_ind_value(id)
+    {
+        var list = document.getElementById('marc_indicators_structure');
+        var ind = document.getElementById('ul_' + id);
+        if (list && ind) {
+            list.removeChild(ind);
+        }
+    }//delete_ind_value
+
+
+    function hideShowBlock(a, ind)
+    {
+        var ul_in = document.getElementById("ul_in_" + ind);
+        if (ul_in.style.display == "none") {
+            ul_in.style.display = "block";
+            a.title = "Hide: " + a.innerHTML;
+        } else {
+            ul_in.style.display = "none";
+            a.title = "Show: " + a.innerHTML;
+        }
+    }//hideShowBlock
+
+
+    function changeLabelInd(ind, obj)
+    {
+        var a_in = document.getElementById('a_in_' + ind);
+        if (!(obj.value == '1' || obj.value == '2')) {
+            obj.value = '';
+            a_in.innerHTML = ind + ' - Indicator ' + obj.value;
+        }
+        a_in.innerHTML = ind + ' - Indicator ' + obj.value;
+    }//changeLabelInd
+
+
+    function checkValueIndCompleteSet(ind, obj)
+    {
+        var rege = new RegExp("^[abcdefghijklmnopqrstuvwxyz0123456789 ]$");
+        if (rege.test(obj.value) || obj.value == "") {
+            obj.title = "Value \"" + obj.value + "\" for Indicator " + ind + " is valid";
+            obj.style.backgroundColor = "";
+        } else {
+            obj.title = "Value \"" + obj.value + "\"  for Indicator " + ind + " is not valid (abcdefghijklmnopqrstuvwxyz0123456789 )";
+            obj.style.backgroundColor = "yellow";
+        }
+    }//checkValueIndCompleteSet
+
+
+    function add_ind_value()
+    {
+        var list = document.getElementById('marc_indicators_structure');
+        if (list) {
+            numInd++;
+            var ul = add_element('ol',"id='ul_" + numInd + "'|style='width:590px'");
+
+            var li = add_element('li', '');
+            li.appendChild(document.createTextNode('\u00a0'));
+            ul.appendChild(li);
+
+            li = add_element('li', '');
+            var bold = add_element('b', '');
+            li.appendChild(bold);
+            var a = add_element('a', "id='a_in_" + numInd + "'|href='javascript:void(0)'|onclick='hideShowBlock(this, " + numInd + ")'");
+            a.appendChild(document.createTextNode(numInd + " - Indicator"));
+            bold.appendChild(a);
+            ul.appendChild(li);
+
+            li = add_element('li', "id='ul_in_" + numInd + "'|style='display:block'");
+            ul.appendChild(li);
+            var ul2 = add_element('ol',"");
+            li.appendChild(ul2);
+
+            var li2 = add_element('li', '');
+            label = add_element('label', "for='ind_" + numInd + "'");
+            label.appendChild(document.createTextNode('Type of indicator'));
+            li2.appendChild(label);
+            input = add_element('input', "type='text'|size='1'|maxlength='1'|name='ind_" + numInd + "'|id='ind_" + numInd + "'|onkeyup='changeLabelInd(" + numInd + ", this)'");
+            li2.appendChild(input);
+            ul2.appendChild(li2);
+
+            li2 = add_element('li', '');
+            label = add_element('label', "for='ind_value_" + numInd + "'");
+            label.appendChild(document.createTextNode('Value'));
+            li2.appendChild(label);
+            input = add_element('input', "type='text'|size='1'|maxlength='1'|name='ind_value_" + numInd + "'|id='ind_value_" + numInd + "'|onkeyup='checkValueIndCompleteSet(" + numInd + ", this)'");
+            li2.appendChild(input);
+            ul2.appendChild(li2);
+
+            li2 = add_element('li', '');
+            label = add_element('label', "for='ind_desc_" + numInd + "'");
+            label.appendChild(document.createTextNode('Description'));
+            li2.appendChild(label);
+            input = add_element('textarea', "cols='80'|rows='4'|name='ind_desc_" + numInd + "'|id='ind_desc_" + numInd + "'");
+            li2.appendChild(input);
+            ul2.appendChild(li2);
+
+            var del = add_element('input', "type='button'|value='Delete'|onclick='delete_ind_value(" + numInd + ")'");
+            li2 = add_element('li', '');
+            li2.appendChild(del);
+            ul2.appendChild(li2);
+
+            list.appendChild(ul, list.firstChild);
+        }
+    }//anyadir_noticia
+
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_indicators_structure.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_indicators_structure.tmpl
new file mode 100755
index 0000000..7ff4d3c
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_indicators_structure.tmpl
@@ -0,0 +1,67 @@
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
+    <title>Koha &rsaquo; Administration &rsaquo; Indicators Structure - Framework <!-- TMPL_VAR NAME="frameworkcode" --> - Tag <!-- TMPL_VAR NAME="tagfield" --></title>
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+    <script type="text/javascript">
+        var numInd = <!-- TMPL_VAR name="numInd" -->;
+    </script>
+    <script type="text/javascript" src='<!-- TMPL_VAR name="themelang" -->/js/indicators.js'></script>
+
+</head>
+<body>
+<!-- TMPL_INCLUDE NAME="header.inc" -->
+<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
+
+<div id="breadcrumbs">
+  <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; <a href="/cgi-bin/koha/admin/biblio_framework.pl">MARC Frameworks</a> &rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=<!-- TMPL_VAR NAME="frameworkcode" -->&amp;searchfield=<!-- TMPL_VAR name="tagfield" -->"><!-- TMPL_VAR NAME="frameworkcode" --> Framework Structure</a> &rsaquo; Indicators Structure - Tag <!-- TMPL_VAR NAME="tagfield" -->
+</div>
+
+<div id="doc" class="yui-t7">
+   <div id="bd">
+        <div id="yui-main">
+            <div class="yui-g">
+
+            <form action="/cgi-bin/koha/admin/marc_indicators_structure.pl" name="f_ind" method="post">
+                <input type="hidden" name="op" value="<!-- TMPL_VAR NAME="op" -->" />
+                <input type="hidden" name="tagfield" value="<!-- TMPL_VAR NAME="tagfield" -->" />
+                <input type="hidden" name="frameworkcode" value="<!-- TMPL_VAR NAME="frameworkcode" -->" />
+                <input type="hidden" name="lang" value="<!-- TMPL_VAR NAME="lang" -->" />
+                <fieldset class="rows" id="marc_indicators_structure"><legend id="marc_indicators_structure"><!-- TMPL_IF EXPR="op eq 'mod'" -->Edit value indicators<!-- TMPL_ELSE -->Add value indicators<!-- /TMPL_IF --></legend>
+                <!-- TMPL_LOOP name="BIG_LOOP" -->
+                <ol id='ul_<!-- TMPL_VAR name="numInd" -->'>
+                    <input type="hidden" name="id_indicator_<!-- TMPL_VAR name="numInd" -->" value="<!-- TMPL_VAR name="id_indicator_value" -->" />
+                    <li>&nbsp;</li>
+                    <li><b><a href="javascript:void(0)" onclick="var ul_in = document.getElementById('ul_in_<!-- TMPL_VAR name="numInd" -->'); if (ul_in.style.display == 'none') {ul_in.style.display = 'block'; this.title = 'Hide: ' + this.innerHTML;} else {ul_in.style.display = 'none'; this.title = 'Show: ' + this.innerHTML;}" onmouseover="var ul_in = document.getElementById('ul_in_<!-- TMPL_VAR name="numInd" -->'); this.title = (ul_in.style.display == 'block')?'Hide: ':'Show: '; this.title += this.innerHTML;" id="a_in_<!-- TMPL_VAR name="numInd" -->"><!-- TMPL_VAR name="numInd" --> - Indicator <!-- TMPL_VAR name="ind" --></a></b></li>
+                    <li id='ul_in_<!-- TMPL_VAR name="numInd" -->' style="display:block">
+                        <ol>
+                            <li>
+                                <label for="ind_<!-- TMPL_VAR name="numInd" -->">Type of indicator</label>
+                                <input type="text" size="1" maxlength="1" name="ind_<!-- TMPL_VAR name="numInd" -->" id="ind_<!-- TMPL_VAR name="numInd" -->" value="<!-- TMPL_VAR name="ind" -->" onkeyup="changeLabelInd(<!-- TMPL_VAR name="numInd" -->, this)" />
+                            </li>
+                            <li>
+                                <label for="ind_value_<!-- TMPL_VAR name="numInd" -->">Value</label>
+                                <input type="text" size="1" maxlength="1" name="ind_value_<!-- TMPL_VAR name="numInd" -->" id="ind_value_<!-- TMPL_VAR name="numInd" -->" value="<!-- TMPL_VAR name="ind_value" -->" onkeyup="checkValueIndCompleteSet(<!-- TMPL_VAR name="numInd" -->, this)" />
+                            </li>
+                            <li>
+                                <label for="ind_desc_<!-- TMPL_VAR name="numInd" -->">Description</label>
+                                <textarea cols="80" rows="4" name="ind_desc_<!-- TMPL_VAR name="numInd" -->" id="ind_desc_<!-- TMPL_VAR name="numInd" -->"><!-- TMPL_VAR name="ind_desc" --></textarea>
+                            </li>
+                            <li>
+                                <input type="button" value="Delete" onclick="delete_ind_value(<!-- TMPL_VAR name="numInd" -->)" />
+                            </li>
+                        </ol>
+                    </li>
+                </ol>
+                <!--  /TMPL_LOOP -->
+                </fieldset>
+                <fieldset class="action">
+                    <input type="button" class="button" title="Add another value" value="Add another value" onclick="add_ind_value()" name="btn_add_ind" />
+                    <input type="submit" class="button" title="Save Values" value="Save Values" name="btn_save" />
+                </fieldset>
+            </form>
+            
+            </div>
+        </div>
+    </div>
+
+<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tmpl
old mode 100644
new mode 100755
index e587967..eb70760
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tmpl
@@ -187,6 +187,7 @@ $(document).ready(function() {
         <th>Mandatory</th>
         <th>Auth value</th>
         <th>Subfields</th>
+        <!-- TMPL_IF NAME="showIndicators" --><th>Indicators</th><!-- /TMPL_IF -->
         <th>Edit</th>
         <th>Delete</th>
 	</thead>
@@ -200,12 +201,13 @@ $(document).ready(function() {
             <td><!-- TMPL_IF NAME="mandatory" -->Yes<!-- TMPL_ELSE -->No<!-- /TMPL_IF --></td>
             <td><!-- TMPL_VAR NAME="authorised_value" --></td>
             <td><a href="<!-- TMPL_VAR NAME="subfield_link" -->">subfields</a></td>
+            <!-- TMPL_IF NAME="showIndicators" --><td><!-- TMPL_IF NAME="indicator_link" --><a href="<!-- TMPL_VAR NAME="indicator_link" -->">indicators</a><!--/TMPL_IF --></td><!-- /TMPL_IF -->
             <td><a href="<!-- TMPL_VAR NAME="edit" -->">Edit</a></td>
             <td><a href="<!-- TMPL_VAR NAME="delete" -->">Delete</a></td>
         </tr>
       <!-- TMPL_IF NAME="__odd__" --><tr><!-- TMPL_ELSE --><tr class="highlight"><!-- /TMPL_IF -->
             <td>&nbsp;</td>
-            <td colspan="7">
+            <td colspan="<!-- TMPL_IF NAME="showIndicators" -->8<!-- TMPL_ELSE -->7<!-- /TMPL_IF -->">
                 <!-- TMPL_LOOP NAME="subfields" -->
                     <p>	Tab:<!-- TMPL_VAR NAME="tab" --> | $<!-- TMPL_VAR NAME="tagsubfield" -->
                             <!-- TMPL_VAR NAME="liblibrarian" --> <!-- TMPL_IF NAME="kohafield" --><!-- TMPL_VAR NAME="kohafield" --><!--/TMPL_IF --><!-- TMPL_IF NAME="repeatable" -->, repeatable<!-- /TMPL_IF --><!-- TMPL_IF NAME="mandatory" -->, Mandatory<!-- /TMPL_IF --><!-- TMPL_IF NAME="seealso" -->, See <!-- TMPL_VAR name="seealso" --><!--/TMPL_IF --><!-- TMPL_IF NAME="authorised_value" -->, <!-- TMPL_VAR NAME="authorised_value" --><!--/TMPL_IF --><!-- TMPL_IF NAME="authtypecode" -->, <!-- TMPL_VAR NAME="authtypecode" --><!--/TMPL_IF --><!-- TMPL_IF NAME="value_builder" -->, <!-- TMPL_VAR NAME="value_builder" --><!--/TMPL_IF -->
@@ -223,6 +225,7 @@ $(document).ready(function() {
         <td><!-- TMPL_IF NAME="mandatory" -->Yes<!-- TMPL_ELSE -->No<!-- /TMPL_IF --></td>
         <td><!-- TMPL_VAR NAME="authorised_value" --></td>
         <td><a href="<!-- TMPL_VAR NAME="subfield_link" -->">Subfields</a></td>
+        <!-- TMPL_IF NAME="showIndicators" --><td><!-- TMPL_IF NAME="indicator_link" --><a href="<!-- TMPL_VAR NAME="indicator_link" -->">Indicators</a><!--/TMPL_IF --></td><!-- /TMPL_IF -->
         <td><a href="<!-- TMPL_VAR NAME="edit" -->">Edit</a></td>
         <td><a href="<!-- TMPL_VAR NAME="delete" -->">Delete</a></td>
     </tr>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
old mode 100644
new mode 100755
index d809022..607f24d
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
@@ -77,6 +77,12 @@ Cataloging:
                   annual: generated in the form &lt;year&gt;-0001, &lt;year&gt;-0002.
                   hbyymmincr: generated in the form &lt;branchcode&gt;yymm0001.
                   "OFF": not generated automatically.
+        -
+            - pref: CheckValueIndicators
+              choices:
+                  yes: Check
+                  no: "Don't check"
+            - when saving a biblio record on cataloguing check the values of the indicators against the supplied for a framework.
     Display:
         -
             - 'Separate multiple displayed authors, series or subjects with '
@@ -118,4 +124,10 @@ Cataloging:
                   yes: Hide
                   no: "Don't hide"
             - items marked as suppressed from OPAC search results. Note that you must have the <code>Suppress</code> index set up in Zebra and at least one suppressed item, or your searches will be broken.
+        -
+            - pref: DisplayPluginValueIndicators
+              choices:
+                  yes: "Don't hide"
+                  no: Hide
+            - beside the indicator field there'll be a link to open a plugin to show the allowed values of the indicator for this field and framework. If CheckValueIndicators is "Don't check" and this variable is "Don't hide" it will do the CheckValueIndicators function as well, i.e., it includes the CheckValueIndicators functionality.
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl
old mode 100644
new mode 100755
index b33f897..808444e
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl
@@ -2,6 +2,9 @@
 <title>Koha &rsaquo; Cataloging &rsaquo; <!-- TMPL_IF NAME="biblionumber" -->Editing <!-- TMPL_VAR NAME="title" escape="html" --> (Record Number <!-- TMPL_VAR name="biblionumber" -->)<!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF --></title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/yui/plugins/bubbling-min.js"></script>
+<!-- TMPL_IF NAME="CheckValueIndicators" -->
+<script type="text/javascript" src='<!-- TMPL_VAR name="themelang" -->/js/indicators.js'></script>
+<!-- /TMPL_IF -->
 <script type="text/javascript">
 //<![CDATA[
 
@@ -27,7 +30,7 @@
             }
         });
 	 });
-	 
+
 	 $('#header_search > ul').tabs().bind('show.ui-tabs', function(e, ui) { $('#header_search > div:not(.ui-tabs-hide)').find('input').eq(0).focus(); });
 
 function confirmnotdup(){
@@ -37,12 +40,70 @@ function confirmnotdup(){
 	Check(checkform);
 }
 
+
 /**
- * 
- * 
+ *
+ *
  */
+
+// Get XML Document with values of indicators, and check when we come from an addbiblio operation and the document is ready the indicator values
+<!-- TMPL_IF NAME="CheckValueIndicators" -->
+    send_ajax_indicators('<!-- TMPL_VAR NAME="frameworkcode" -->');
+    <!-- TMPL_IF NAME="wrongInd" -->
+        $(document).ready(function() {
+            var form = document.f;
+            var tagfield;
+            var arrInd;
+            var indexLastKohaField = 0;
+            var strIndError = "";
+        <!-- TMPL_LOOP NAME="wrongInd" -->
+            tagfield = '<!-- TMPL_VAR NAME="tagfield" -->';
+            arrInd = search_koha_field(form, tagfield, indexLastKohaField + 1);
+            if (arrInd != undefined && arrInd.length > 0) {
+                for (var i=0; i < arrInd.length; i++) {
+                    indexLastKohaField = arrInd[i].indexOnForm;
+                    var ind1 = '<!-- TMPL_VAR NAME="ind1" -->';
+                    var ind2 = '<!-- TMPL_VAR NAME="ind2" -->';
+                    if (ind1 != '' && ind1 != ' ' && arrInd[i].ind1.value == ind1) {
+                        arrInd[i].ind1.style.backgroundColor = "yellow";
+                        strIndError += "Field " + tagfield + " has wrong value \"" + ind1 + "\" on indicator 1.\n";
+                    }
+                    if (ind2 != '' && ind2 != ' ' && arrInd[i].ind2.value == ind2) {
+                        arrInd[i].ind2.style.backgroundColor = "yellow";
+                        strIndError += "Field " + tagfield + " has wrong value \"" + ind2 + "\" on indicator 2.\n";
+                    }
+                }
+            }
+        <!-- /TMPL_LOOP -->
+        if (strIndError != "") alert("Record not saved due to errors on indicators:\n\n" + strIndError);
+        });
+    <!-- /TMPL_IF -->
+    var triesReadXmlDocInd = 1;
+/**
+ * this function waits a maximun ot 1.5s for xmlDocInd to be populated.
+ */
+    function CheckAgain(dest)
+    {
+        Check(dest);
+    }
+<!-- /TMPL_IF -->
+
 function Check(dest){
     var StrAlert = AreMandatoriesNotOk();
+    // check for indicator values
+    <!-- TMPL_IF NAME="CheckValueIndicators" -->
+    if (xmlDocInd != undefined) {
+        var strInd = checkValidIndFramework();
+        if (strInd != "") {
+            if (StrAlert == 0) StrAlert = "";
+            else StrAlert += "\n";
+            StrAlert += strInd;
+        }
+    } else if (triesReadXmlDocInd <= 3 && !StrAlert) {
+        triesReadXmlDocInd++;
+        setTimeout(function(){CheckAgain(dest)}, 500);
+    }
+    <!-- /TMPL_IF -->
     if( ! StrAlert ){
         document.f.submit();
         return true;
@@ -64,7 +125,7 @@ function PopupZ3950() {
     var strQuery = GetZ3950Terms();
 	if(strQuery){
         window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
-    } 
+    }
 }
 
 function PopupMARCFieldDoc(field, blocknumber) {
@@ -111,7 +172,7 @@ function AreMandatoriesNotOk(){
     var tab = new Array();
     var label = new Array();
     var flag=0;
-    var tabflag= new Array();  
+    var tabflag= new Array();
     <!-- TMPL_LOOP NAME='BIG_LOOP' -->
     	<!-- TMPL_LOOP NAME='innerloop' -->
 	        <!-- TMPL_IF NAME="mandatory" -->
@@ -136,45 +197,47 @@ function AreMandatoriesNotOk(){
         if( ! document.getElementById(mandatories[i]).value){
             tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ;
             document.getElementById(mandatories[i]).setAttribute('class','subfield_not_filled');
-            document.getElementById(mandatories[i]).focus();
+            try {
+                document.getElementById(mandatories[i]).focus();
+            } catch (e) {}
             tabflag[tag+subfield+tagnumber][1]=label[i];
             tabflag[tag+subfield+tagnumber][2]=tab[i];
         } else {
             tabflag[tag+subfield+tagnumber][0] = 1;
-        }    
+        }
     }
     for (var tagsubfieldid in tabflag){
       if (tabflag[tagsubfieldid][0]==0){
         var tag=tagsubfieldid.substr(0,3);
-        var subfield=tagsubfieldid.substr(3,1);    
+        var subfield=tagsubfieldid.substr(3,1);
         StrAlert += "\t* "+_("tag ")+tag+_(" subfield ")+subfield+" "+tabflag[tagsubfieldid][1]+_(" in tab ")+tabflag[tagsubfieldid][2]+"\n";
-        //StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n"; 
-        flag=1;    
-      }   
-    }   
-    
+        //StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n";
+        flag=1;
+      }
+    }
+
     /* Check for mandatories field(not subfields) */
     for(var i=0,len=mandatoriesfields.length; i<len; i++){
 	    isempty  = true;
 		arr      = mandatoriesfields[i];
     	divid    = "tag_" + arr[0] + "_" + arr[1];
     	varegexp = new RegExp("^tag_" + arr[0] + "_code_");
-    	
+
 		if(parseInt(arr[0]) >= 10){
 	    	elem = document.getElementById(divid);
 	    	eleminputs = elem.getElementsByTagName('input');
-	    	
+
 	    	for(var j=0,len2=eleminputs.length; j<len2; j++){
-	
+
 	    		if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
 					inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
-					
+
 					for( var k=0; k<len2; k++){
 						if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
 							isempty = false
 						}
 					}
-					
+
 					elemselect = elem.getElementsByTagName('select');
 					for( var k=0; k<elemselect.length; k++){
 						if(elemselect[k].id.match(inputregexp) && elemselect[k].value){
@@ -194,14 +257,14 @@ function AreMandatoriesNotOk(){
     	}else{
     		isempty = false;
     	}
-    	
+
     	if(isempty){
     		flag = 1;
     		StrAlert += _("\t* Field ") + arr[0] + _(" is mandatory, at least one of its subfields must be filled.") + "\n";
     	}
-    	
+
     }
-    
+
     if(flag){
 	    return StrAlert;
 	} else {
@@ -209,7 +272,7 @@ function AreMandatoriesNotOk(){
 	}
 }
 
-/** 
+/**
  * check if z3950 mandatories are set or not
  */
 function GetZ3950Terms(){
@@ -218,7 +281,7 @@ function GetZ3950Terms(){
     var mandatories_label = new Array();
     <!-- TMPL_LOOP NAME='BIG_LOOP' --><!-- TMPL_LOOP NAME='innerloop' --><!-- TMPL_LOOP NAME='subfield_loop'--><!-- TMPL_IF NAME='z3950_mandatory'-->mandatories.push("<!-- TMPL_VAR NAME='id' -->");
         mandatories_label.push("<!-- TMPL_VAR NAME='z3950_mandatory' -->");<!-- /TMPL_IF --><!-- /TMPL_LOOP --><!-- /TMPL_LOOP --><!-- /TMPL_LOOP -->
-    
+
     for(var i=0,len=mandatories.length; i<len ; i++){
         var field_value = document.getElementById(mandatories[i]).value;
         if( field_value ){
@@ -236,19 +299,19 @@ function Changefwk(FwkList) {
 
 // returns the subfieldcode based upon subfieldid writing
 function getSubfieldcode(tagsubfieldid){
-    // 3 : tag +3 : tagnumber +4 : number of _ +8 subfield -1 begins at 0  
+    // 3 : tag +3 : tagnumber +4 : number of _ +8 subfield -1 begins at 0
     return tagsubfieldid.substr(3+3+4+8-1,1);
 }
 
 // Take the base of tagsubfield information (removing the subfieldcodes and subfieldindexes)
 // returns the filter
 function getTagInputnameFilter(tagsubfieldid){
-    var tagsubfield=tagsubfieldid.substr(0,tagsubfieldid.lastIndexOf("_"));  
+    var tagsubfield=tagsubfieldid.substr(0,tagsubfieldid.lastIndexOf("_"));
     var tagcode=tagsubfield.substr(tagsubfield.lastIndexOf("_"));
     tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_"));
     tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_"));
     tagsubfield=tagsubfield+"_."+tagcode;
-    return tagsubfield;  
+    return tagsubfield;
 }
 
 function openAuth(tagsubfieldid,authtype) {
@@ -257,7 +320,7 @@ function openAuth(tagsubfieldid,authtype) {
     var tagsubfield=getTagInputnameFilter(tagsubfieldid);
     var elementsubfcode=getSubfieldcode(element.name);
     var mainmainstring=element.value;
-    var mainstring="";  
+    var mainstring="";
     var inputs = element.parentNode.parentNode.getElementsByTagName("input");
 
     for (var myindex =0; myindex<inputs.length;myindex++){
@@ -265,9 +328,9 @@ function openAuth(tagsubfieldid,authtype) {
             var subfieldcode=getSubfieldcode(inputs[myindex].name);
             if (isNaN(parseInt(subfieldcode)) && inputs[myindex].value != "" && subfieldcode!=elementsubfcode){
                 mainstring=inputs[myindex].value+" "+mainstring;
-            }      
+            }
         }
-    }           
+    }
 	newin=window.open("../authorities/auth_finder.pl?authtypecode="+  authtype+ "&index="+tagsubfieldid+"&value_mainstr="+encodeURI(mainmainstring)+"&value_main="+encodeURI(mainstring), "_blank",'width=700,height=550,toolbar=false,scrollbars=yes');
 }
 
@@ -288,42 +351,55 @@ function ExpandField(index) {
 
 /**
  * To clone a field or a subfield by clicking on '+' button
- */ 
+ */
 function CloneField(index) {
     var original = document.getElementById(index); //original <div>
     fields_in_use[index.substr(0, 7)]++;
     var clone = original.cloneNode(true);
     var new_key = CreateKey();
     var new_id  = original.getAttribute('id')+new_key;
-    
+
     clone.setAttribute('id',new_id); // setting a new id for the parent div
-    
+
     var divs = clone.getElementsByTagName('div');
-    
+
     <!-- TMPL_UNLESS NAME='hide_marc'--> // No indicator if hide_marc
         // setting a new name for the new indicator
         for(var i=0; i < 2; i++) {
             var indicator = clone.getElementsByTagName('input')[i];
             indicator.setAttribute('name',indicator.getAttribute('name')+new_key);
         }
+        <!-- TMPL_IF NAME="DisplayPluginValueIndicators" -->
+            var linksInd   = clone.getElementsByTagName('a');
+            var tagInd = clone.getAttribute('id').substr(4,3);
+            var indexInd = original.getAttribute('id').substring(8, original.getAttribute('id').length);
+            for ( j = 0 ; j < linksInd.length ; j++ ) {
+                if (linksInd[j].name == "a_ind1" || linksInd[j].name == "a_ind2") {
+                    if (document.all)
+                        linksInd[j].onclick = function() { launchPopupValueIndicators('<!-- TMPL_VAR NAME="frameworkcode"-->', tagInd, indexInd, new_key<!-- TMPL_IF NAME="biblionumber" -->,<!-- TMPL_VAR NAME='biblionumber'--><!-- /TMPL_IF -->)};
+                    else
+                        linksInd[j].setAttribute('onclick', "launchPopupValueIndicators('<!-- TMPL_VAR NAME="frameworkcode"-->', '" + tagInd + "', '" + indexInd + "', '" + new_key + "'<!-- TMPL_IF NAME="biblionumber" -->,<!-- TMPL_VAR NAME='biblionumber'--><!-- /TMPL_IF -->)");
+                }
+            }
+            <!-- /TMPL_IF -->
     <!-- /TMPL_UNLESS -->
-        
+
     // settings all subfields
     for(var i=0,divslen = divs.length ; i<divslen ; i++){      // foreach div
         if(divs[i].getAttribute("id").match(/^subfield/)){  // if it s a subfield
-            
+
             // set the attribute for the new 'div' subfields
             divs[i].setAttribute('id',divs[i].getAttribute('id')+new_key);
-            
+
             var inputs   = divs[i].getElementsByTagName('input');
             var id_input = "";
-            
+
             for( j = 0 ; j < inputs.length ; j++ ) {
             	if(inputs[j].getAttribute("id") && inputs[j].getAttribute("id").match(/^tag_/) ){
             		inputs[j].value = "";
             	}
             }
-            
+
             inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
             inputs[0].setAttribute('name',inputs[0].getAttribute('name')+new_key);
             var id_input;
@@ -344,19 +420,19 @@ function CloneField(index) {
                     textaeras[0].setAttribute('name',textaeras[0].getAttribute('name')+new_key);
                 }
             }
-            
+
             <!-- TMPL_UNLESS NAME='advancedMARCEditor'-->
             // when cloning a subfield, re set its label too.
             var labels = divs[i].getElementsByTagName('label');
             labels[0].setAttribute('for',id_input);
             <!-- /TMPL_UNLESS -->
-            
+
             <!-- TMPL_UNLESS NAME='hide_marc'-->
                 // updating javascript parameters on button up
                 var imgs = divs[i].getElementsByTagName('img');
                 imgs[0].setAttribute('onclick',"upSubfield(\'"+divs[i].getAttribute('id')+"\');");
             <!-- /TMPL_UNLESS -->
-            
+
             // setting its '+' and '-' buttons
             try {
                 var anchors = divs[i].getElementsByTagName('a');
@@ -371,7 +447,7 @@ function CloneField(index) {
             catch(e){
                 // do nothig if ButtonPlus & CloneButtonPlus don t exist.
             }
-            
+
             // button ...
             var spans=0;
             try {
@@ -400,7 +476,7 @@ function CloneField(index) {
 
                                     buttonDotOnClick = buttonDotOnClick.replace(re1,"&index="+inputs[1].getAttribute('id')+"',");
                                     buttonDotOnClick = buttonDotOnClick.replace(re2,",'"+inputs[1].getAttribute('id')+"')");
-                                    
+
                                     if(buttonDotOnClick){
                                             buttonDot.setAttribute('onclick',buttonDotOnClick);
                                     }
@@ -421,13 +497,13 @@ function CloneField(index) {
                 var buttonUp = divs[i].getElementsByTagName('img')[0];
                 buttonUp.setAttribute('onclick',"upSubfield('" + divs[i].getAttribute('id') + "')");
             <!-- /TMPL_UNLESS -->
-            
+
         } else { // it's a indicator div
             if(divs[i].getAttribute('id').match(/^div_indicator/)){
                 var inputs = divs[i].getElementsByTagName('input');
                 inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
                 inputs[1].setAttribute('id',inputs[1].getAttribute('id')+new_key);
-                
+
                 var CloneButtonPlus;
                 try {
                     var anchors = divs[i].getElementsByTagName('a');
@@ -455,7 +531,7 @@ function CloneField(index) {
             }
         }
     }
-    
+
     // insert this line on the page
     original.parentNode.insertBefore(clone,original.nextSibling);
 }
@@ -480,14 +556,14 @@ function CloneSubfield(index){
         inputs[i].setAttribute('name',inputs[i].getAttribute('name')+new_key);
 	linkid = id_input;
     }
-    
-    // select 
+
+    // select
     for(var i=0,len=selects.length; i<len ; i++ ){
         id_input = selects[i].getAttribute('id')+new_key;
         selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key);
         selects[i].setAttribute('name',selects[i].getAttribute('name')+new_key);
     }
-    
+
     // textarea
     for(var i=0,len=textareas.length; i<len ; i++ ){
         id_input = textareas[i].getAttribute('id')+new_key;
@@ -513,10 +589,10 @@ function CloneSubfield(index){
     var label = clone.getElementsByTagName('label')[0];
     label.setAttribute('for',id_input);
     <!-- /TMPL_UNLESS -->
-    
+
     // setting a new id for the parent div
     clone.setAttribute('id',new_id);
-    
+
     try {
         var buttonUp = clone.getElementsByTagName('img')[0];
         buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')");
@@ -588,15 +664,15 @@ function upSubfield(index) {
         return; // this line doesn't exist...
     }
     var tag = line.parentNode; // get the dad of this line. (should be "<div id='tag_...'>")
-    
+
     // getting all subfields for this tag
     var subfields = tag.getElementsByTagName('div');
     var subfieldsLength = subfields.length;
-    
+
     if(subfieldsLength<=1) return; // nothing to do if there is just one subfield.
-    
-    // among all subfields 
-    for(var i=0;i<subfieldsLength;i++){ 
+
+    // among all subfields
+    for(var i=0;i<subfieldsLength;i++){
         if(subfields[i].getAttribute('id') == index){ //looking for the subfield which is clicked :
             if(i==1){ // if the clicked subfield is on the top
                 tag.appendChild(subfields[1]);
@@ -614,7 +690,7 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
     subfield = document.getElementById(index);
     subfield.style.display = 'block';
     label = document.getElementById(labelindex);
-    label.style.display='none';	
+    label.style.display='none';
 }
 //]]>
 </script>
@@ -678,7 +754,7 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
     <input type="hidden" value="" id="redirect" name="redirect" />
 	<input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
 <!-- /TMPL_IF -->
-	
+
 <div id="toolbar">
 
 <script type="text/javascript">
@@ -721,7 +797,7 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
             container: "savebutton"
          });
 
-        savesplitmenu.on("click", onOption); 
+        savesplitmenu.on("click", onOption);
 
 		new YAHOO.widget.Button({
             id: "z3950search",
@@ -741,12 +817,12 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
 			<li id="changeframework"><label for="Frameworks">Change framework: </label>
 			<select name="Frameworks" id="Frameworks" onchange="Changefwk(this);">
 			                <option value="Default">Default</option>
-							<!-- TMPL_LOOP NAME="frameworkcodeloop" -->                                             
+							<!-- TMPL_LOOP NAME="frameworkcodeloop" -->
                                 <option value="<!-- TMPL_VAR NAME="value"-->" <!-- TMPL_VAR NAME="selected" -->>
-					             <!-- TMPL_VAR NAME="frameworktext" -->                                      
-                                 </option>                          
+					             <!-- TMPL_VAR NAME="frameworktext" -->
+                                 </option>
 					        <!-- /TMPL_LOOP -->
-			</select> 
+			</select>
 <input type="hidden" name="op" value="addbiblio" /></li>
 		</ul>
 </div>
@@ -775,7 +851,7 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
     <div id="tab<!-- TMPL_VAR name="number" -->XX">
 <!-- /TMPL_IF -->
 
-    
+
     <!-- TMPL_LOOP NAME="innerloop" -->
         <!-- TMPL_IF NAME="tag" -->
 	<div class="tag" id="tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->">
@@ -792,7 +868,9 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
 	                <input tabindex="1" class="indicator flat" type="text" style="display:none;" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" size="1" maxlength="1" value="<!-- TMPL_VAR NAME="indicator2" -->" />
                 <!-- TMPL_ELSE -->
         	        <input tabindex="1" class="indicator flat" type="text" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" size="1" maxlength="1" value="<!-- TMPL_VAR NAME="indicator1" -->" />
+                    <!-- TMPL_IF NAME="DisplayPluginValueIndicators" --><a href="javascript:void(0)" name="a_ind1" onclick="launchPopupValueIndicators('<!-- TMPL_VAR NAME="frameworkcode"-->', '<!-- TMPL_VAR NAME="tag" -->', '<!-- TMPL_VAR NAME="index" -->', '<!-- TMPL_VAR name="random" -->'<!-- TMPL_IF NAME="biblionumber" -->,<!-- TMPL_VAR NAME='biblionumber'--><!-- /TMPL_IF -->)" title="Show allowed values for indicator 1 on field <!-- TMPL_VAR name="tag"-->">...</a><!-- /TMPL_IF -->
         	        <input tabindex="1" class="indicator flat" type="text" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" size="1" maxlength="1" value="<!-- TMPL_VAR NAME="indicator2" -->" />
+                    <!-- TMPL_IF NAME="DisplayPluginValueIndicators" --><a href="javascript:void(0)" name="a_ind2" onclick="launchPopupValueIndicators('<!-- TMPL_VAR NAME="frameworkcode"-->', '<!-- TMPL_VAR NAME="tag" -->', '<!-- TMPL_VAR NAME="index" -->', '<!-- TMPL_VAR name="random" -->'<!-- TMPL_IF NAME="biblionumber" -->,<!-- TMPL_VAR NAME='biblionumber'--><!-- /TMPL_IF -->)" title="Show allowed values for indicator 2 on field <!-- TMPL_VAR name="tag"-->">...</a><!-- /TMPL_IF -->
                 <!-- /TMPL_IF --> -
             <!-- TMPL_ELSE -->
                 <!-- TMPL_IF NAME="fixedfield" -->
@@ -800,7 +878,9 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
                     <input tabindex="1" type="hidden" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" value="<!-- TMPL_VAR NAME="indicator2" -->" />
                 <!-- TMPL_ELSE -->
                     <input tabindex="1" type="hidden" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" value="<!-- TMPL_VAR NAME="indicator1" -->" />
+                    <!-- TMPL_IF NAME="DisplayPluginValueIndicators" --><a href="javascript:void(0)" name="a_ind1" onclick="launchPopupValueIndicators('<!-- TMPL_VAR NAME="frameworkcode"-->', '<!-- TMPL_VAR NAME="tag" -->', '<!-- TMPL_VAR NAME="index" -->', '<!-- TMPL_VAR name="random" -->'<!-- TMPL_IF NAME="biblionumber" -->,<!-- TMPL_VAR NAME='biblionumber'--><!-- /TMPL_IF -->)" title="Show allowed values for indicator 1 on field <!-- TMPL_VAR name="tag"-->">...</a><!-- /TMPL_IF -->
                     <input tabindex="1" type="hidden" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" value="<!-- TMPL_VAR NAME="indicator2" -->" />
+                    <!-- TMPL_IF NAME="DisplayPluginValueIndicators" --><a href="javascript:void(0)" name="a_ind2" onclick="launchPopupValueIndicators('<!-- TMPL_VAR NAME="frameworkcode"-->', '<!-- TMPL_VAR NAME="tag" -->', '<!-- TMPL_VAR NAME="index" -->', '<!-- TMPL_VAR name="random" -->'<!-- TMPL_IF NAME="biblionumber" -->,<!-- TMPL_VAR NAME='biblionumber'--><!-- /TMPL_IF -->)" title="Show allowed values for indicator 2 on field <!-- TMPL_VAR name="tag"-->">...</a><!-- /TMPL_IF -->
                 <!-- /TMPL_IF -->
             <!-- /TMPL_UNLESS -->
 
@@ -811,19 +891,19 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
                 <a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->'); return false;" title="Repeat this Tag">+</a>
             <!-- /TMPL_IF -->
                 <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->'); return false;" title="Delete this Tag">&#8722;</a>
-            
+
         </div>
-	
+
         <!-- TMPL_LOOP NAME="subfield_loop" -->
             <!--  One line on the marc editor -->
             <div class="subfield_line" style="<!-- TMPL_VAR NAME='visibility' -->; float: left; clear: left; width: 100%;" id="subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->">
-            
+
                 <!--TMPL_UNLESS NAME="advancedMARCEditor" -->
                     <label for="tag_<!-- TMPL_VAR NAME='tag'-->_subfield_<!--  TMPL_VAR NAME='subfield'-->_<!-- TMPL_VAR NAME='index'-->_<!-- TMPL_VAR NAME='index_subfield'-->" <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> class="labelsubfield">
-                <!-- /TMPL_UNLESS --> 
-                
+                <!-- /TMPL_UNLESS -->
+
                 <!-- TMPL_UNLESS name="hide_marc" -->
-                <span class="subfieldcode"><!-- TMPL_IF NAME="fixedfield" --> 
+                <span class="subfieldcode"><!-- TMPL_IF NAME="fixedfield" -->
                         <img class="buttonUp" style="display:none;" src="<!-- TMPL_VAR NAME="themelang" -->/../img/up.png" onclick="upSubfield('subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->')" alt="Move Up" title="Move Up" />
                     <!-- TMPL_ELSE -->
                         <img class="buttonUp" src="<!-- TMPL_VAR NAME="themelang" -->/../img/up.png" onclick="upSubfield('subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->')" alt="Move Up" title="Move Up" />
@@ -834,7 +914,7 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
                     <input type="hidden" name="tag_<!-- TMPL_VAR NAME='tag'-->_code_<!--  TMPL_VAR NAME='subfield'-->_<!-- TMPL_VAR NAME='index'-->_<!-- TMPL_VAR NAME='index_subfield'-->" value="<!-- TMPL_VAR NAME="subfield" -->" />
  </span>
                 <!-- /TMPL_UNLESS -->
-            
+
                 <!-- TMPL_UNLESS NAME="advancedMARCEditor" -->
                     <!-- TMPL_IF name="mandatory" --><span class="subfield subfield_mandatory"><!-- TMPL_ELSE --><span class="subfield"><!-- /TMPL_IF -->
                         <!-- TMPL_VAR NAME="marc_lib_plain" -->
@@ -842,18 +922,18 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
                     </span>
                     </label>
                 <!-- /TMPL_UNLESS -->
-                
+
                 <!-- TMPL_VAR NAME="marc_value" -->
-                
+
                 <!-- TMPL_IF NAME="repeatable" -->
                     <span class="subfield_controls"><a href="#" class="buttonPlus" tabindex="1" onclick="CloneSubfield('subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->'); return false;"><img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /></a>
                                         <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->'); return false;"><img src="/intranet-tmpl/prog/img/delete-subfield.png" alt="Delete" title="Delete this subfield" /></a></span>
                 <!-- /TMPL_IF -->
 
-                
+
             </div>
             <!-- End of the line -->
-            
+
         <!-- /TMPL_LOOP -->
         </div>
         <!-- /TMPL_IF --><!-- tag -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/marc21_indicators.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/marc21_indicators.tmpl
new file mode 100755
index 0000000..9843e47
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/marc21_indicators.tmpl
@@ -0,0 +1,79 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>Koha &rsaquo; Cataloging &rsaquo; <!-- TMPL_IF NAME="biblionumber" -->Editing Indicators for <!-- TMPL_VAR NAME="title" escape="html" --> (Record Number <!-- TMPL_VAR name="biblionumber" -->)<!-- TMPL_ELSE -->Editing Indicators for Add MARC Record<!-- /TMPL_IF --></title>
+        
+        <script type="text/javascript" src='<!-- TMPL_VAR name="themelang" -->/js/indicators.js'></script>
+
+    </head>
+    <body>
+        <h1>Cataloging  &rsaquo; <!-- TMPL_IF NAME="biblionumber" -->Editing Indicators for <em><!-- TMPL_VAR NAME="title" escape="html" --></em> (Record Number <!-- TMPL_VAR name="biblionumber" -->)<!-- TMPL_ELSE -->Indicators for Add MARC Record<!-- /TMPL_IF --></h1>
+        <form name="f_pop" action="">
+            <ul style="list-style-type: none">
+                <!-- TMPL_LOOP name="INDICATORS_LOOP" -->
+                <li><h2>Field <!--TMPL_VAR Name="tagfield"-->: <!--TMPL_VAR Name="desc"--></h2></li>
+                <li><label for="<!--TMPL_VAR Name="tagfield"-->_ind1" title="User Value for Indicator 1 is <!-- TMPL_UNLESS NAME="ind1_ok" -->not<!-- /TMPL_UNLESS --> valid">User Value for Indicator 1:</label> <input type="text" name="<!--TMPL_VAR Name="tagfield"-->_ind1" id="<!--TMPL_VAR Name="tagfield"-->_ind1" value="<!--TMPL_VAR Name="current_value_1"-->" size="1" maxlength="1" <!-- TMPL_UNLESS NAME="ind1_ok" -->style="background-color:yellow"<!-- /TMPL_UNLESS --> onfocus="checkValueInd(this, 1, '<!--TMPL_VAR Name="tagfield"-->', '<!--TMPL_VAR Name="current_field_1"-->', '<!--TMPL_VAR Name="current_field_2"-->')" onkeyup="checkValueInd(this, 1, '<!--TMPL_VAR Name="tagfield"-->', '<!--TMPL_VAR Name="current_field_1"-->', '<!--TMPL_VAR Name="current_field_2"-->')" />
+                <a href="javascript:void(0);" id="a_usevalue_1" onclick="useValue(1, '<!--TMPL_VAR Name="tagfield"-->', '<!--TMPL_VAR Name="current_field_1"-->', true)" title="Use this value and close the window">Use and Close</a>
+                </li>
+                <li><label for="<!--TMPL_VAR Name="tagfield"-->_ind2" title="User Value for Indicator 2 is <!-- TMPL_UNLESS NAME="ind2_ok" -->not<!-- /TMPL_UNLESS --> valid">User Value for Indicator 2: </label> <input type="text" name="<!--TMPL_VAR Name="tagfield"-->_ind2" id="<!--TMPL_VAR Name="tagfield"-->_ind2" value="<!--TMPL_VAR Name="current_value_2"-->" size="1" maxlength="1" <!-- TMPL_UNLESS NAME="ind2_ok" -->style="background-color:yellow"<!-- /TMPL_UNLESS -->  onfocus="checkValueInd(this, 2, '<!--TMPL_VAR Name="tagfield"-->', '<!--TMPL_VAR Name="current_field_1"-->', '<!--TMPL_VAR Name="current_field_2"-->')" onkeyup="checkValueInd(this, 2, '<!--TMPL_VAR Name="tagfield"-->', '<!--TMPL_VAR Name="current_field_1"-->', '<!--TMPL_VAR Name="current_field_2"-->')" />
+                <a href="javascript:void(0);" id="a_usevalue_2" onclick="useValue(2, '<!--TMPL_VAR Name="tagfield"-->', '<!--TMPL_VAR Name="current_field_2"-->', true)" title="Use this value and close the window">Use and Close</a>
+                </li>
+                <li><a href="javascript:void(0);" id="a_usevalue_3" onclick="useValues('<!--TMPL_VAR Name="tagfield"-->', '<!--TMPL_VAR Name="current_field_1"-->', '<!--TMPL_VAR Name="current_field_2"-->')" title="Use these values and close the window">Use both and Close</a>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="window.close();" title="Close the window">Close</a></li>
+                <li>
+                <!-- TMPL_IF NAME="data" -->
+                    <h3 style="text-decoration: underline">Predefined values</h3>
+                    <ul style="list-style-type: none">
+                        <li><label for="select_ind1_values">Indicator 1</label>
+                            <select name="select_ind1_values" id="select_ind1_values" onchange="changeValueInd(this.options[this.selectedIndex].value, 1, '<!--TMPL_VAR Name="tagfield"-->', '<!--TMPL_VAR Name="current_field_1"-->', '<!--TMPL_VAR Name="current_field_2"-->');" title="Choose an option to change the value on indicator 1 for field <!--TMPL_VAR Name="tagfield"-->">
+                                <option value="">Choose an option to change the value</option>
+                                <!-- TMPL_LOOP name="data" -->
+                                    <!-- TMPL_IF EXPR="ind == 1" -->
+                                    <option value="<!--TMPL_VAR Name="ind_value"-->">&quot;<!--TMPL_VAR Name="ind_value"-->&quot;: <!--TMPL_VAR Name="ind_desc"--></option>
+                                    <!-- /TMPL_IF -->
+                                <!--/TMPL_LOOP-->
+                            </select>
+                        </li>
+                        <li>&nbsp;</li>
+                        <li><label for="select_ind2_values">Indicator 2</label>
+                            <select name="select_ind2_values" id="select_ind2_values" onchange="changeValueInd(this.options[this.selectedIndex].value, 2, '<!--TMPL_VAR Name="tagfield"-->', '<!--TMPL_VAR Name="current_field_1"-->', '<!--TMPL_VAR Name="current_field_2"-->');" title="Choose an option to change the value on indicator 2 for field <!--TMPL_VAR Name="tagfield"-->">
+                                <option value="">Choose an option to change the value</option>
+                                <!-- TMPL_LOOP name="data" -->
+                                    <!-- TMPL_IF EXPR="ind == 2" -->
+                                    <option value="<!--TMPL_VAR Name="ind_value"-->">&quot;<!--TMPL_VAR Name="ind_value"-->&quot;: <!--TMPL_VAR Name="ind_desc"--></option>
+                                    <!-- /TMPL_IF -->
+                                <!--/TMPL_LOOP-->
+                            </select>
+                        </li>
+                        <li>&nbsp;</li>
+                        <li><a href="javascript:void(0)" onclick="var table_ind_values = document.getElementById('table_ind_values'); if (table_ind_values.style.display == 'none') {table_ind_values.style.display = 'block'; this.title = 'Hide ' + this.innerHTML;} else {table_ind_values.style.display = 'none'; this.title = 'Show ' + this.innerHTML;}" onmouseover="var table_ind_values = document.getElementById('table_ind_values'); this.title = (table_ind_values.style.display == 'block')?'Hide ':'Show '; this.title += this.innerHTML;">View values as a table</a></li>
+                        <li>&nbsp;</li>
+                    </ul>
+                    <table border="1" id="table_ind_values" style="display:none">
+                        <thead>
+                            <th>Indicator</th>
+                            <th>Description</th>
+                            <th>Value</th>
+                            <th>Action</th>
+                        </thead>
+                        <tbody>
+                        <!-- TMPL_LOOP name="data" -->
+                            <tr>
+                                <td><!--TMPL_VAR Name="ind"--></td>
+                                <td><!--TMPL_VAR Name="ind_desc"--></td>
+                                <td>&quot;<!--TMPL_VAR Name="ind_value"-->&quot;</td>
+                                <td><a href="javascript:void(0)" onclick="changeValueInd('<!--TMPL_VAR Name="ind_value"-->', <!--TMPL_VAR Name="ind"-->, '<!--TMPL_VAR Name="tagfield"-->', '<!--TMPL_VAR Name="current_field_1"-->', '<!--TMPL_VAR Name="current_field_2"-->');" title="Use this value <!--TMPL_VAR Name="ind_value"--> on indicator <!--TMPL_VAR Name="ind"--> for field <!--TMPL_VAR Name="tagfield"-->">Use this value</a></td>
+                                <input type="hidden" name="<!--TMPL_VAR Name="tagfield"-->_<!--TMPL_VAR Name="ind"-->_<!--TMPL_VAR Name="id_indicator_value"-->" id="<!--TMPL_VAR Name="tagfield"-->_<!--TMPL_VAR Name="ind"-->_<!--TMPL_VAR Name="id_indicator_value"-->" value="<!--TMPL_VAR Name="ind_value"-->" />
+                            </tr>
+                        <!--/TMPL_LOOP-->
+                        </tbody>
+                    </table>
+                <!-- TMPL_ELSE -->
+                There aren't predefined values for this field
+                <!-- /TMPL_IF -->
+                </li>
+                <!--/TMPL_LOOP-->
+            </ul>
+        </form>
+    </body>
+</html>
-- 
1.5.6.5



More information about the Koha-patches mailing list