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

(-)a/cataloguing/value_builder/url.pl (+100 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; either version 2 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
use strict;
22
use warnings;
23
no warnings 'redefine'; # otherwise loading up multiple plugins fills the log with subroutine redefine warnings
24
25
use C4::Context;
26
27
=head1
28
29
plugin_parameters : other parameters added when the plugin is called by the dopop function
30
31
=cut
32
33
sub plugin_parameters {
34
    return "";
35
}
36
37
=head1
38
39
plugin_javascript : the javascript function called when the user enters the subfield.
40
contain 3 javascript functions :
41
* one called when the field is entered (OnFocus). Named FocusXXX
42
* one called when the field is leaved (onBlur). Named BlurXXX
43
* one called when the ... link is clicked (<a href="javascript:function">) named ClicXXX
44
45
returns :
46
* XXX
47
* a variable containing the 3 scripts.
48
the 3 scripts are inserted after the <input> in the html code
49
50
=cut
51
52
sub plugin_javascript {
53
    my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
54
    my $function_name = $field_number;
55
    my @split_field_name = split(/_/, $field_number);
56
    my $field_name = $split_field_name[1] . '$' . $split_field_name[3];
57
58
    my $res  = <<END_OF_JS;
59
<script typei="text/javascript">
60
//<![CDATA[
61
62
function isUrl(s) {
63
    var regexp = /(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?/;
64
    return regexp.test(s);
65
}
66
67
function Blur$function_name(index) {
68
    var fieldValue = document.getElementById("$field_number").value;
69
    if(fieldValue != '') {
70
        if(!isUrl(fieldValue)) {
71
            invalid_url_alert('$field_name');
72
        }
73
    }
74
    return 0;
75
}
76
77
function Focus$function_name(subfield_managed) {
78
    // Do Nothing
79
}
80
81
function Clic$function_name(subfield_managed) {
82
    // Do Nothing
83
}
84
//]]>
85
</script>
86
END_OF_JS
87
return ($function_name,$res);
88
}
89
90
=head1
91
92
plugin : the true value_builded. The screen that is open in the popup window.
93
94
=cut
95
96
sub plugin {
97
    return "";
98
}
99
100
1;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt (+5 lines)
Lines 501-506 function searchauthority() { Link Here
501
    Y = document.forms[0].value.value;
501
    Y = document.forms[0].value.value;
502
    window.location="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&authtypecode="+X+"&value="+Y+"&marclist=&and_or=and&excluding=&operator=contains";
502
    window.location="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&authtypecode="+X+"&value="+Y+"&marclist=&and_or=and&excluding=&operator=contains";
503
}
503
}
504
505
// For the url.pl value_builder validation
506
function invalid_url_alert(field_name) {
507
    alert(_("The field ") + field_name + _(" must contain a valid URL!\nex : http://www.google.com"));
508
}
504
//]]>
509
//]]>
505
</script>
510
</script>
506
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
511
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (+6 lines)
Lines 635-640 function unHideSubfield(index,labelindex) { // FIXME :: is it used ? Link Here
635
    label = document.getElementById(labelindex);
635
    label = document.getElementById(labelindex);
636
    label.style.display='none';	
636
    label.style.display='none';	
637
}
637
}
638
639
// For the url.pl value_builder validation
640
function invalid_url_alert(field_name) {
641
    alert(_("The field ") + field_name + _(" must contain a valid URL!\nex : http://www.google.com"));
642
}
643
638
//]]>
644
//]]>
639
</script>
645
</script>
640
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
646
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (+5 lines)
Lines 162-167 $(document).ready(function() { Link Here
162
        function () {$(this).attr("class",""         );}
162
        function () {$(this).attr("class",""         );}
163
    );
163
    );
164
});
164
});
165
166
// For the url.pl value_builder validation
167
function invalid_url_alert(field_name) {
168
    alert(_("The field ") + field_name + _(" must contain a valid URL!\nex : http://www.google.com"));
169
}
165
//]]>
170
//]]>
166
</script>
171
</script>
167
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
172
<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 35-40 $("input[name='disable_input']").click(function() { Link Here
35
    }
35
    }
36
});
36
});
37
37
38
// For the url.pl value_builder validation
39
function invalid_url_alert(field_name) {
40
    alert(_("The field ") + field_name + _(" must contain a valid URL!\nex : http://www.google.com"));
41
}
42
38
//]]>
43
//]]>
39
</script>
44
</script>
40
<script type="text/javascript" src="[% themelang %]/js/pages/batchMod.js"></script>
45
<script type="text/javascript" src="[% themelang %]/js/pages/batchMod.js"></script>
41
- 

Return to bug 8609