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 (+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="[% 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