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

(-)a/C4/Installer/PerlDependencies.pm (+5 lines)
Lines 857-862 our $PERL_DEPS = { Link Here
857
        required => 1,
857
        required => 1,
858
        min_ver => '0.058',
858
        min_ver => '0.058',
859
    },
859
    },
860
    'Regexp::Common::URI' => {
861
        'usage'    => 'URL validation value_builder',
862
        'required' => '0',
863
        'min_ver'  => '2010010201',
864
    },
860
};
865
};
861
866
862
1;
867
1;
(-)a/cataloguing/value_builder/url.pl (+91 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 Modern::Perl;
21
22
use C4::Context;
23
use Regexp::Common qw( URI );
24
25
26
=head1 DESCRIPTION
27
28
plugin_javascript : the javascript function called when the user enters the subfield.
29
contain 3 javascript functions :
30
* one called when the field is entered (OnFocus). Named FocusXXX
31
* one called when the field is leaved (onBlur). Named BlurXXX
32
* one called when the ... link is clicked (<a href="javascript:function">) named ClicXXX
33
34
returns :
35
* XXX
36
* a variable containing the 3 scripts.
37
the 3 scripts are inserted after the <input> in the html code
38
39
=cut
40
41
sub plugin_javascript {
42
    my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
43
    my $function_name = $field_number;
44
    my @split_field_name = split(/_/, $field_number);
45
    my $field_name = $split_field_name[1] . '$' . $split_field_name[3];
46
    my $regex = $RE{URI};
47
    $regex =~ s/\//\\\//g;
48
49
    my $res  = <<END_OF_JS;
50
<script type="text/javascript">
51
//<![CDATA[
52
53
function isUrl(s) {
54
    var regexp = /$regex/;
55
    return regexp.test(s);
56
}
57
58
function Blur$function_name(index) {
59
    var fieldValue = document.getElementById("$field_number").value;
60
    if(fieldValue != '') {
61
        if(!isUrl(fieldValue)) {
62
            invalid_url_alert('$field_name');
63
        }
64
    }
65
    return 0;
66
}
67
68
function Focus$function_name(subfield_managed) {
69
    // Do Nothing
70
}
71
72
function Clic$function_name(subfield_managed) {
73
    // Do Nothing
74
}
75
//]]>
76
</script>
77
END_OF_JS
78
return ($function_name,$res);
79
}
80
81
=head1 DESCRIPTION
82
83
plugin : the true value_builded. The screen that is open in the popup window.
84
85
=cut
86
87
sub plugin {
88
    return "";
89
}
90
91
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="[% interface %]/[% theme %]/css/addbiblio.css" />
159
<link type="text/css" rel="stylesheet" href="[% interface %]/[% theme %]/css/addbiblio.css" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (+4 lines)
Lines 378-383 function Changefwk() { Link Here
378
    f.submit();
378
    f.submit();
379
}
379
}
380
380
381
// For the url.pl value_builder validation
382
function invalid_url_alert(field_name) {
383
    alert(_("The field ") + field_name + _(" must contain a valid URL!\nex : http://www.google.com"));
384
}
381
//]]>
385
//]]>
382
</script>
386
</script>
383
<link type="text/css" rel="stylesheet" href="[% interface %]/[% theme %]/css/addbiblio.css" />
387
<link type="text/css" rel="stylesheet" href="[% interface %]/[% theme %]/css/addbiblio.css" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (+11 lines)
Lines 124-129 function confirm_deletion() { Link Here
124
    return confirm(_("Are you sure you want to delete this item?"));
124
    return confirm(_("Are you sure you want to delete this item?"));
125
}
125
}
126
126
127
$(document).ready(function() {
128
    $("#cataloguing_additem_itemlist  tr").hover(
129
        function () {$(this).addClass("highlight");},
130
        function () {$(this).removeClass("highlight");}
131
    );
132
});
133
134
// For the url.pl value_builder validation
135
function invalid_url_alert(field_name) {
136
    alert(_("The field ") + field_name + _(" must contain a valid URL!\nex : http://www.google.com"));
137
}
127
//]]>
138
//]]>
128
</script>
139
</script>
129
<link type="text/css" rel="stylesheet" href="[% interface %]/[% theme %]/css/addbiblio.css" />
140
<link type="text/css" rel="stylesheet" href="[% interface %]/[% theme %]/css/addbiblio.css" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt (-1 / +5 lines)
Lines 36-41 $(document).ready(function(){ Link Here
36
        return submitBackgroundJob(this.form);
36
        return submitBackgroundJob(this.form);
37
    });
37
    });
38
});
38
});
39
40
// For the url.pl value_builder validation
41
function invalid_url_alert(field_name) {
42
    alert(_("The field ") + field_name + _(" must contain a valid URL!\nex : http://www.google.com"));
43
}
39
//]]>
44
//]]>
40
</script>
45
</script>
41
<!--[if IE]>
46
<!--[if IE]>
42
- 

Return to bug 8609