View | Details | Raw Unified | Return to bug 8609
Collapse All | Expand All

(-)a/C4/Installer/PerlDependencies.pm (+5 lines)
Lines 822-827 our $PERL_DEPS = { Link Here
822
        'required' => '0',
822
        'required' => '0',
823
        'min_ver'  => '0.03',
823
        'min_ver'  => '0.03',
824
    },
824
    },
825
    'Regexp::Common::URI' => {
826
        'usage'    => 'URL validation value_builder',
827
        'required' => '0',
828
        'min_ver'  => '2010010201',
829
    },
825
};
830
};
826
831
827
1;
832
1;
(-)a/cataloguing/value_builder/url.pl (+93 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
4
# Copyright 2010 Frédérick Capovilla - Libéo
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation;
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use strict;
21
use warnings;
22
no warnings 'redefine'; # otherwise loading up multiple plugins fills the log with subroutine redefine warnings
23
24
use C4::Context;
25
use Regexp::Common qw( URI );
26
27
28
=head1 DESCRIPTION
29
30
plugin_javascript : the javascript function called when the user enters the subfield.
31
contain 3 javascript functions :
32
* one called when the field is entered (OnFocus). Named FocusXXX
33
* one called when the field is leaved (onBlur). Named BlurXXX
34
* one called when the ... link is clicked (<a href="javascript:function">) named ClicXXX
35
36
returns :
37
* XXX
38
* a variable containing the 3 scripts.
39
the 3 scripts are inserted after the <input> in the html code
40
41
=cut
42
43
sub plugin_javascript {
44
    my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
45
    my $function_name = $field_number;
46
    my @split_field_name = split(/_/, $field_number);
47
    my $field_name = $split_field_name[1] . '$' . $split_field_name[3];
48
    my $regex = $RE{URI};
49
    $regex =~ s/\//\\\//g;
50
51
    my $res  = <<END_OF_JS;
52
<script type="text/javascript">
53
//<![CDATA[
54
55
function isUrl(s) {
56
    var regexp = /$regex/;
57
    return regexp.test(s);
58
}
59
60
function Blur$function_name(index) {
61
    var fieldValue = document.getElementById("$field_number").value;
62
    if(fieldValue != '') {
63
        if(!isUrl(fieldValue)) {
64
            invalid_url_alert('$field_name');
65
        }
66
    }
67
    return 0;
68
}
69
70
function Focus$function_name(subfield_managed) {
71
    // Do Nothing
72
}
73
74
function Clic$function_name(subfield_managed) {
75
    // Do Nothing
76
}
77
//]]>
78
</script>
79
END_OF_JS
80
return ($function_name,$res);
81
}
82
83
=head1 DESCRIPTION
84
85
plugin : the true value_builded. The screen that is open in the popup window.
86
87
=cut
88
89
sub plugin {
90
    return "";
91
}
92
93
1;
(-)a/install_misc/debian.packages (+1 lines)
Lines 93-98 libpdf-api2-simple-perl install Link Here
93
libpdf-reuse-barcode-perl install
93
libpdf-reuse-barcode-perl install
94
libpdf-reuse-perl install
94
libpdf-reuse-perl install
95
libpdf-table-perl install
95
libpdf-table-perl install
96
libregexp-common-perl install
96
libschedule-at-perl install
97
libschedule-at-perl install
97
libsms-send-perl install
98
libsms-send-perl install
98
libstring-random-perl		install
99
libstring-random-perl		install
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt (+4 lines)
Lines 150-155 function confirmnotdup(redirect){ Link Here
150
    $("#confirm_not_duplicate").attr("value","1");
150
    $("#confirm_not_duplicate").attr("value","1");
151
    Check();
151
    Check();
152
}
152
}
153
// For the url.pl value_builder validation
154
function invalid_url_alert(field_name) {
155
    alert(_("The field ") + field_name + _(" must contain a valid URL!\nex : http://www.google.com"));
156
}
153
//]]>
157
//]]>
154
</script>
158
</script>
155
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
159
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (+4 lines)
Lines 386-391 function Changefwk(FwkList) { Link Here
386
    f.submit();
386
    f.submit();
387
}
387
}
388
388
389
// For the url.pl value_builder validation
390
function invalid_url_alert(field_name) {
391
    alert(_("The field ") + field_name + _(" must contain a valid URL!\nex : http://www.google.com"));
392
}
389
//]]>
393
//]]>
390
</script>
394
</script>
391
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
395
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (+11 lines)
Lines 103-108 function confirm_deletion() { Link Here
103
    return confirm(_("Are you sure you want to delete this item?"));
103
    return confirm(_("Are you sure you want to delete this item?"));
104
}
104
}
105
105
106
$(document).ready(function() {
107
    $("#cataloguing_additem_itemlist  tr").hover(
108
        function () {$(this).addClass("highlight");},
109
        function () {$(this).removeClass("highlight");}
110
    );
111
});
112
113
// For the url.pl value_builder validation
114
function invalid_url_alert(field_name) {
115
    alert(_("The field ") + field_name + _(" must contain a valid URL!\nex : http://www.google.com"));
116
}
106
//]]>
117
//]]>
107
</script>
118
</script>
108
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
119
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt (-1 / +5 lines)
Lines 33-38 $(document).ready(function(){ Link Here
33
  });
33
  });
34
34
35
});
35
});
36
37
// For the url.pl value_builder validation
38
function invalid_url_alert(field_name) {
39
    alert(_("The field ") + field_name + _(" must contain a valid URL!\nex : http://www.google.com"));
40
}
36
//]]>
41
//]]>
37
</script>
42
</script>
38
<!--[if IE]>
43
<!--[if IE]>
39
- 

Return to bug 8609