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

(-)a/cataloguing/value_builder/EXAMPLE.pl (-5 / +8 lines)
Lines 50-55 use C4::Output; Link Here
50
# into the event data parameter; Focus e.g. uses that one again by looking at
50
# into the event data parameter; Focus e.g. uses that one again by looking at
51
# the variable event.data.id.
51
# the variable event.data.id.
52
#
52
#
53
# Comments in JavaScript must be multi-line style ( /* ... */ ) in case
54
# the JavaScript block is collapsed by the template
55
#
53
# Do not use the perl variable $id to extract the field value. Use variable
56
# Do not use the perl variable $id to extract the field value. Use variable
54
# event.data.id. This makes a difference when the field is cloned or has
57
# event.data.id. This makes a difference when the field is cloned or has
55
# been created dynamically (as in additem.js).
58
# been created dynamically (as in additem.js).
Lines 59-65 my $builder= sub { Link Here
59
    my $id = $params->{id};
62
    my $id = $params->{id};
60
63
61
    return qq|
64
    return qq|
62
<script type="text/javascript">
65
<script>
63
function Focus$id(event) {
66
function Focus$id(event) {
64
    if( \$('#'+event.data.id).val()=='' ) {
67
    if( \$('#'+event.data.id).val()=='' ) {
65
        \$('#'+event.data.id).val('EXAMPLE:');
68
        \$('#'+event.data.id).val('EXAMPLE:');
Lines 68-81 function Focus$id(event) { Link Here
68
71
69
function MouseOver$id(event) {
72
function MouseOver$id(event) {
70
    return Focus$id(event);
73
    return Focus$id(event);
71
    // just redirecting it to Focus for the same effect
74
    /* just redirecting it to Focus for the same effect */
72
}
75
}
73
76
74
function KeyPress$id(event) {
77
function KeyPress$id(event) {
75
    if( event.which == 64 ) { // at character
78
    if( event.which == 64 ) { /* at character */
76
        var f= \$('#'+event.data.id).val();
79
        var f= \$('#'+event.data.id).val();
77
        \$('#'+event.data.id).val( f + 'AT' );
80
        \$('#'+event.data.id).val( f + 'AT' );
78
        return false; // prevents getting the @ character back too
81
        return false; /* prevents getting the @ character back too */
79
    }
82
    }
80
}
83
}
81
84
Lines 92-98 function Change$id(event) { Link Here
92
function Click$id(event) {
95
function Click$id(event) {
93
    var fieldvalue=\$('#'+event.data.id).val();
96
    var fieldvalue=\$('#'+event.data.id).val();
94
    window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=EXAMPLE.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes');
97
    window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=EXAMPLE.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes');
95
    return false; // prevents scrolling
98
    return false; /* prevents scrolling */
96
}
99
}
97
</script>|;
100
</script>|;
98
};
101
};
(-)a/cataloguing/value_builder/barcode.pl (-4 / +2 lines)
Lines 47-53 my $builder = sub { Link Here
47
    warn "Barcode type = $autoBarcodeType" if $DEBUG;
47
    warn "Barcode type = $autoBarcodeType" if $DEBUG;
48
	if ((not $autoBarcodeType) or $autoBarcodeType eq 'OFF') {
48
	if ((not $autoBarcodeType) or $autoBarcodeType eq 'OFF') {
49
        # don't return a value unless we have the appropriate syspref set
49
        # don't return a value unless we have the appropriate syspref set
50
        return q|<script type=\"text/javascript\"></script>|;
50
        return q|<script></script>|;
51
    }
51
    }
52
	if ($autoBarcodeType eq 'annual') {
52
	if ($autoBarcodeType eq 'annual') {
53
        ($nextnum, $scr) = C4::Barcodes::ValueBuilder::annual::get_barcode(\%args);
53
        ($nextnum, $scr) = C4::Barcodes::ValueBuilder::annual::get_barcode(\%args);
Lines 89-96 if (\$('#' + id).val() == '' || force) { Link Here
89
END_OF_JS
89
END_OF_JS
90
90
91
    my $js  = <<END_OF_JS;
91
    my $js  = <<END_OF_JS;
92
<script type="text/javascript">
92
<script>
93
//<![CDATA[
94
93
95
function Focus$function_name(id, force) {
94
function Focus$function_name(id, force) {
96
$scr
95
$scr
Lines 100-106 function Click$function_name(id) { Link Here
100
    Focus$function_name(id, 1);
99
    Focus$function_name(id, 1);
101
    return false;
100
    return false;
102
}
101
}
103
//]]>
104
</script>
102
</script>
105
END_OF_JS
103
END_OF_JS
106
    return $js;
104
    return $js;
(-)a/cataloguing/value_builder/barcode_manual.pl (-4 / +2 lines)
Lines 48-54 my $builder = sub { Link Here
48
    warn "Barcode type = $autoBarcodeType" if $DEBUG;
48
    warn "Barcode type = $autoBarcodeType" if $DEBUG;
49
    if ((not $autoBarcodeType) or $autoBarcodeType eq 'OFF') {
49
    if ((not $autoBarcodeType) or $autoBarcodeType eq 'OFF') {
50
# don't return a value unless we have the appropriate syspref set
50
# don't return a value unless we have the appropriate syspref set
51
        return q|<script type=\"text/javascript\"></script>|;
51
        return q|<script></script>|;
52
    }
52
    }
53
    if ($autoBarcodeType eq 'annual') {
53
    if ($autoBarcodeType eq 'annual') {
54
        ($nextnum, $scr) = C4::Barcodes::ValueBuilder::annual::get_barcode(\%args);
54
        ($nextnum, $scr) = C4::Barcodes::ValueBuilder::annual::get_barcode(\%args);
Lines 68-81 my $builder = sub { Link Here
68
END_OF_JS
68
END_OF_JS
69
69
70
    my $js  = <<END_OF_JS;
70
    my $js  = <<END_OF_JS;
71
    <script type="text/javascript">
71
    <script>
72
        //<![CDATA[
73
72
74
    function Click$function_name(id) {
73
    function Click$function_name(id) {
75
        $scr
74
        $scr
76
            return false;
75
            return false;
77
    }
76
    }
78
    //]]>
79
    </script>
77
    </script>
80
END_OF_JS
78
END_OF_JS
81
    return $js;
79
    return $js;
(-)a/cataloguing/value_builder/callnumber-KU.pl (-1 / +1 lines)
Lines 45-51 CCC QW - returns first unused number CCC QWxx starting with CCC QW01 Link Here
45
my $builder = sub {
45
my $builder = sub {
46
    my ( $params ) = @_;
46
    my ( $params ) = @_;
47
    my $res="
47
    my $res="
48
    <script type='text/javascript'>
48
    <script>
49
        function Click$params->{id}() {
49
        function Click$params->{id}() {
50
                var code = document.getElementById('$params->{id}');
50
                var code = document.getElementById('$params->{id}');
51
                var url = '../cataloguing/plugin_launcher.pl?plugin_name=callnumber-KU.pl&code=' + code.value;
51
                var url = '../cataloguing/plugin_launcher.pl?plugin_name=callnumber-KU.pl&code=' + code.value;
(-)a/cataloguing/value_builder/callnumber.pl (-1 / +1 lines)
Lines 42-48 In this case, a callnumber has this form : "PREFIX 0009678570". Link Here
42
my $builder = sub {
42
my $builder = sub {
43
    my ( $params ) = @_;
43
    my ( $params ) = @_;
44
    my $res="
44
    my $res="
45
    <script type='text/javascript'>
45
    <script>
46
        function Blur$params->{id}() {
46
        function Blur$params->{id}() {
47
                var code = document.getElementById('$params->{id}');
47
                var code = document.getElementById('$params->{id}');
48
                var url = '../cataloguing/plugin_launcher.pl?plugin_name=callnumber.pl&code=' + code.value;
48
                var url = '../cataloguing/plugin_launcher.pl?plugin_name=callnumber.pl&code=' + code.value;
(-)a/cataloguing/value_builder/cn_browser.pl (-3 / +1 lines)
Lines 32-46 my $builder = sub { Link Here
32
    my ( $params ) = @_;
32
    my ( $params ) = @_;
33
    my $function_name = $params->{id};
33
    my $function_name = $params->{id};
34
    my $res = "
34
    my $res = "
35
<script type=\"text/javascript\">
35
<script>
36
//<![CDATA[
37
36
38
function Click$function_name(i) {
37
function Click$function_name(i) {
39
    q = document.getElementById('$params->{id}');
38
    q = document.getElementById('$params->{id}');
40
    window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=cn_browser.pl&popup&q=\"+q.value,\"cnbrowser\",\"width=500,height=400,toolbar=false,scrollbars=yes\");
39
    window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=cn_browser.pl&popup&q=\"+q.value,\"cnbrowser\",\"width=500,height=400,toolbar=false,scrollbars=yes\");
41
}
40
}
42
41
43
//]]>
44
</script>
42
</script>
45
";
43
";
46
    return $res;
44
    return $res;
(-)a/cataloguing/value_builder/dateaccessioned.pl (-2 / +2 lines)
Lines 31-37 my $builder = sub { Link Here
31
31
32
    my $res  = <<END_OF_JS;
32
    my $res  = <<END_OF_JS;
33
<script>
33
<script>
34
// from: cataloguing/value_builder/dateaccessioned.pl
34
/* from: cataloguing/value_builder/dateaccessioned.pl */
35
35
36
\$(document).ready(function(){
36
\$(document).ready(function(){
37
    \$("#$function_name").datepicker({
37
    \$("#$function_name").datepicker({
Lines 51-57 function Click$function_name(event) { Link Here
51
}
51
}
52
52
53
function set_to_today( id, force ) {
53
function set_to_today( id, force ) {
54
    // The force parameter is used in Click but not in Focus !
54
    /* The force parameter is used in Click but not in Focus ! */
55
    if (! id) { alert(_("Bad id ") + id + _(" sent to set_to_today()")); return 0; }
55
    if (! id) { alert(_("Bad id ") + id + _(" sent to set_to_today()")); return 0; }
56
    if (\$("#" + id).val() == '' || \$("#" + id).val() == '0000-00-00' || force ) {
56
    if (\$("#" + id).val() == '' || \$("#" + id).val() == '0000-00-00' || force ) {
57
        \$("#" + id).val("$date");
57
        \$("#" + id).val("$date");
(-)a/cataloguing/value_builder/macles.pl (-3 / +1 lines)
Lines 30-41 my $builder = sub { Link Here
30
    my ( $params ) = @_;
30
    my ( $params ) = @_;
31
    my $function_name = $params->{id};
31
    my $function_name = $params->{id};
32
    my $res="
32
    my $res="
33
<script type=\"text/javascript\">
33
<script>
34
//<![CDATA[
35
function Click$function_name(i) {
34
function Click$function_name(i) {
36
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=macles.pl&index=\"+i,\"MACLES\",',toolbar=false,scrollbars=yes');
35
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=macles.pl&index=\"+i,\"MACLES\",',toolbar=false,scrollbars=yes');
37
}
36
}
38
//]]>
39
</script>
37
</script>
40
";
38
";
41
    return $res;
39
    return $res;
(-)a/cataloguing/value_builder/marc21_field_005.pl (-4 / +2 lines)
Lines 30-47 my $builder = sub { Link Here
30
    my $date = sprintf("%4d%02d%02d%02d%02d%04.1f",@a);
30
    my $date = sprintf("%4d%02d%02d%02d%02d%04.1f",@a);
31
31
32
    my $res  = "
32
    my $res  = "
33
<script type=\"text/javascript\">
33
<script>
34
//<![CDATA[
35
34
36
function Focus$function_name(event) {
35
function Focus$function_name(event) {
37
    document.getElementById(event.data.id).value='$date';
36
    document.getElementById(event.data.id).value='$date';
38
    return 0;
37
    return 0;
39
}
38
}
40
39
41
//]]>
42
</script>
40
</script>
43
";
41
";
44
    return $res;
42
    return $res;
45
};
43
};
46
44
47
return { builder => $builder };
45
return { builder => $builder };
(-)a/cataloguing/value_builder/marc21_field_006.pl (-3 / +1 lines)
Lines 33-47 my $builder = sub { Link Here
33
    my ( $params ) = @_;
33
    my ( $params ) = @_;
34
    my $function_name = $params->{id};
34
    my $function_name = $params->{id};
35
    my $res           = "
35
    my $res           = "
36
<script type=\"text/javascript\">
36
<script>
37
//<![CDATA[
38
37
39
function Click$function_name(event) {
38
function Click$function_name(event) {
40
    defaultvalue=document.getElementById(event.data.id).value;
39
    defaultvalue=document.getElementById(event.data.id).value;
41
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_006.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
40
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_006.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
42
41
43
}
42
}
44
//]]>
45
</script>
43
</script>
46
";
44
";
47
45
(-)a/cataloguing/value_builder/marc21_field_007.pl (-3 / +1 lines)
Lines 32-46 my $builder = sub { Link Here
32
    my ( $params ) = @_;
32
    my ( $params ) = @_;
33
    my $function_name = $params->{id};
33
    my $function_name = $params->{id};
34
    my $res           = "
34
    my $res           = "
35
<script type=\"text/javascript\">
35
<script>
36
//<![CDATA[
37
36
38
function Click$function_name(event) {
37
function Click$function_name(event) {
39
    defaultvalue=document.getElementById(event.data.id).value;
38
    defaultvalue=document.getElementById(event.data.id).value;
40
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_007.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
39
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_007.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
41
40
42
}
41
}
43
//]]>
44
</script>
42
</script>
45
";
43
";
46
44
(-)a/cataloguing/value_builder/marc21_field_008.pl (-3 / +1 lines)
Lines 42-49 my $builder = sub { Link Here
42
    my $function_name = $params->{id};
42
    my $function_name = $params->{id};
43
    my $dateentered = date_entered();
43
    my $dateentered = date_entered();
44
    my $res           = "
44
    my $res           = "
45
<script type=\"text/javascript\">
45
<script>
46
//<![CDATA[
47
46
48
function Focus$function_name(event) {
47
function Focus$function_name(event) {
49
    if ( document.getElementById(event.data.id).value ) {
48
    if ( document.getElementById(event.data.id).value ) {
Lines 66-72 function Click$function_name(event) { Link Here
66
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008.pl&index=\"+ event.data.id +\"&result=\"+encodeURIComponent(defaultvalue)+leader_parameter,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
65
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008.pl&index=\"+ event.data.id +\"&result=\"+encodeURIComponent(defaultvalue)+leader_parameter,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
67
66
68
}
67
}
69
//]]>
70
</script>
68
</script>
71
";
69
";
72
70
(-)a/cataloguing/value_builder/marc21_field_008_authorities.pl (-3 / +1 lines)
Lines 37-44 my $builder = sub { Link Here
37
    my $dateentered = date_entered();
37
    my $dateentered = date_entered();
38
    my $defaultval = substr( C4::Context->preference(PREF_008) || FIXLEN_DATA_ELTS, 0, 34 );
38
    my $defaultval = substr( C4::Context->preference(PREF_008) || FIXLEN_DATA_ELTS, 0, 34 );
39
    my $res="
39
    my $res="
40
<script type=\"text/javascript\">
40
<script>
41
//<![CDATA[
42
41
43
function Focus$function_name(event) {
42
function Focus$function_name(event) {
44
    if (!document.getElementById(event.data.id).value) {
43
    if (!document.getElementById(event.data.id).value) {
Lines 58-64 function Click$function_name(event) { Link Here
58
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008_authorities.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue+\"&authtypecode=\"+authtype,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
57
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008_authorities.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue+\"&authtypecode=\"+authtype,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
59
58
60
}
59
}
61
//]]>
62
</script>
60
</script>
63
";
61
";
64
62
(-)a/cataloguing/value_builder/marc21_field_008_classifications.pl (-3 / +1 lines)
Lines 32-39 my $builder = sub { Link Here
32
    my $dateentered = date_entered();
32
    my $dateentered = date_entered();
33
    my $defaultval = FIXLEN_DATA_ELTS;
33
    my $defaultval = FIXLEN_DATA_ELTS;
34
    my $res="
34
    my $res="
35
<script type=\"text/javascript\">
35
<script>
36
//<![CDATA[
37
36
38
function Focus$function_name(event) {
37
function Focus$function_name(event) {
39
    if (!document.getElementById(event.data.id).value) {
38
    if (!document.getElementById(event.data.id).value) {
Lines 50-56 function Click$function_name(event) { Link Here
50
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008_classifications.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue+\"&authtypecode=\"+authtype,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
49
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008_classifications.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue+\"&authtypecode=\"+authtype,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
51
}
50
}
52
51
53
//]]>
54
</script>
52
</script>
55
";
53
";
56
54
(-)a/cataloguing/value_builder/marc21_field_245h.pl (-4 / +2 lines)
Lines 27-34 my $builder = sub { Link Here
27
    my $function_name = $params->{id};
27
    my $function_name = $params->{id};
28
28
29
    my $res  = "
29
    my $res  = "
30
<script type=\"text/javascript\">
30
<script>
31
//<![CDATA[
32
31
33
function Blur$function_name(event) {
32
function Blur$function_name(event) {
34
    var fieldValue = document.getElementById(event.data.id).value;
33
    var fieldValue = document.getElementById(event.data.id).value;
Lines 41-50 function Blur$function_name(event) { Link Here
41
    return 0;
40
    return 0;
42
}
41
}
43
42
44
//]]>
45
</script>
43
</script>
46
";
44
";
47
    return $res;
45
    return $res;
48
};
46
};
49
47
50
return { builder => $builder };
48
return { builder => $builder };
(-)a/cataloguing/value_builder/marc21_leader.pl (-3 / +1 lines)
Lines 30-37 my $builder = sub { Link Here
30
    my ( $params ) = @_;
30
    my ( $params ) = @_;
31
    my $function_name = $params->{id};
31
    my $function_name = $params->{id};
32
    my $res           = "
32
    my $res           = "
33
<script type=\"text/javascript\">
33
<script>
34
//<![CDATA[
35
34
36
function Focus$function_name(event) {
35
function Focus$function_name(event) {
37
    if(!document.getElementById(event.data.id).value){
36
    if(!document.getElementById(event.data.id).value){
Lines 44-50 function Click$function_name(event) { Link Here
44
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_leader.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
43
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_leader.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
45
}
44
}
46
45
47
//]]>
48
</script>
46
</script>
49
";
47
";
50
48
(-)a/cataloguing/value_builder/marc21_leader_authorities.pl (-4 / +2 lines)
Lines 32-39 my $builder = sub { Link Here
32
    my ( $params ) = @_;
32
    my ( $params ) = @_;
33
    my $function_name = $params->{id};
33
    my $function_name = $params->{id};
34
    my $res           = "
34
    my $res           = "
35
<script type=\"text/javascript\">
35
<script>
36
//<![CDATA[
37
36
38
function Focus$function_name(event) {
37
function Focus$function_name(event) {
39
    if(!document.getElementById(event.data.id).value){
38
    if(!document.getElementById(event.data.id).value){
Lines 47-53 function Click$function_name(event) { Link Here
47
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_leader_authorities.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
46
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_leader_authorities.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
48
47
49
}
48
}
50
//]]>
51
</script>
49
</script>
52
";
50
";
53
51
Lines 92-95 my $launcher = sub { Link Here
92
    output_html_with_http_headers $input, $cookie, $template->output;
90
    output_html_with_http_headers $input, $cookie, $template->output;
93
};
91
};
94
92
95
return { builder => $builder, launcher => $launcher };
93
return { builder => $builder, launcher => $launcher };
(-)a/cataloguing/value_builder/marc21_linking_section.pl (-1 / +1 lines)
Lines 41-47 my $builder = sub { Link Here
41
    my ( $params ) = @_;
41
    my ( $params ) = @_;
42
    my $function_name = $params->{id};
42
    my $function_name = $params->{id};
43
    my $res           = "
43
    my $res           = "
44
  <script type='text/javascript'>
44
  <script>
45
             function Click$function_name(event) {
45
             function Click$function_name(event) {
46
                       defaultvalue=document.getElementById(event.data.id).value;
46
                       defaultvalue=document.getElementById(event.data.id).value;
47
                 window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl&index=\" + event.data.id + \"&result=\"+defaultvalue, 'tag_editor', 'width=900,height=700,toolbar=false,scrollbars=yes');
47
                 window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl&index=\" + event.data.id + \"&result=\"+defaultvalue, 'tag_editor', 'width=900,height=700,toolbar=false,scrollbars=yes');
(-)a/cataloguing/value_builder/marc21_orgcode.pl (-3 / +1 lines)
Lines 30-37 my $builder = sub { Link Here
30
    my $library = Koha::Libraries->find( C4::Context->userenv->{'branch'} );
30
    my $library = Koha::Libraries->find( C4::Context->userenv->{'branch'} );
31
    my $org = $library->get_effective_marcorgcode;
31
    my $org = $library->get_effective_marcorgcode;
32
    return <<"HERE";
32
    return <<"HERE";
33
<script type=\"text/javascript\">
33
<script>
34
//<![CDATA[
35
34
36
function Focus$params->{id}(event) {
35
function Focus$params->{id}(event) {
37
    if( ! \$('#'+event.data.id).val() ) {
36
    if( ! \$('#'+event.data.id).val() ) {
Lines 39-45 function Focus$params->{id}(event) { Link Here
39
    }
38
    }
40
}
39
}
41
40
42
//]]>
43
</script>
41
</script>
44
HERE
42
HERE
45
};
43
};
(-)a/cataloguing/value_builder/normarc_field_007.pl (-3 / +1 lines)
Lines 29-43 sub plugin_javascript { Link Here
29
my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
29
my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
30
my $function_name= $field_number;
30
my $function_name= $field_number;
31
my $res="
31
my $res="
32
<script type=\"text/javascript\">
32
<script>
33
//<![CDATA[
34
33
35
function Clic$function_name(i) {
34
function Clic$function_name(i) {
36
	defaultvalue=document.getElementById(\"$field_number\").value;
35
	defaultvalue=document.getElementById(\"$field_number\").value;
37
	newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=normarc_field_007.pl&index=$field_number&result=\"+defaultvalue,\"unimarc field 100\",'width=1000,height=600,toolbar=false,scrollbars=yes');
36
	newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=normarc_field_007.pl&index=$field_number&result=\"+defaultvalue,\"unimarc field 100\",'width=1000,height=600,toolbar=false,scrollbars=yes');
38
37
39
}
38
}
40
//]]>
41
</script>
39
</script>
42
";
40
";
43
41
(-)a/cataloguing/value_builder/normarc_field_008.pl (-3 / +1 lines)
Lines 39-46 sub plugin_javascript { Link Here
39
    my ($dbh, $record, $tagslib, $field_number, $tabloop) = @_;
39
    my ($dbh, $record, $tagslib, $field_number, $tabloop) = @_;
40
    my $function_name = $field_number;
40
    my $function_name = $field_number;
41
    my $res           = "
41
    my $res           = "
42
<script type=\"text/javascript\">
42
<script>
43
//<![CDATA[
44
43
45
function Focus$function_name(subfield_managed) {
44
function Focus$function_name(subfield_managed) {
46
45
Lines 58-64 function Clic$function_name(i) { Link Here
58
	newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=normarc_field_008.pl&index=$field_number&result=\"+defaultvalue,\"unimarc field 100\",'width=1000,height=600,toolbar=false,scrollbars=yes');
57
	newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=normarc_field_008.pl&index=$field_number&result=\"+defaultvalue,\"unimarc field 100\",'width=1000,height=600,toolbar=false,scrollbars=yes');
59
58
60
}
59
}
61
//]]>
62
</script>
60
</script>
63
";
61
";
64
62
(-)a/cataloguing/value_builder/normarc_leader.pl (-3 / +1 lines)
Lines 31-38 sub plugin_javascript { Link Here
31
my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
31
my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
32
my $function_name= $field_number;
32
my $function_name= $field_number;
33
my $res="
33
my $res="
34
<script type=\"text/javascript\">
34
<script>
35
//<![CDATA[
36
35
37
function Focus$function_name(subfield_managed) {
36
function Focus$function_name(subfield_managed) {
38
    if(!document.getElementById(\"$field_number\").value){
37
    if(!document.getElementById(\"$field_number\").value){
Lines 46-52 function Clic$function_name(i) { Link Here
46
	newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=normarc_leader.pl&index=$field_number&result=\"+defaultvalue,\"unimarc field 100\",'width=1000,height=600,toolbar=false,scrollbars=yes');
45
	newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=normarc_leader.pl&index=$field_number&result=\"+defaultvalue,\"unimarc field 100\",'width=1000,height=600,toolbar=false,scrollbars=yes');
47
46
48
}
47
}
49
//]]>
50
</script>
48
</script>
51
";
49
";
52
50
(-)a/cataloguing/value_builder/stocknumber.pl (-3 / +1 lines)
Lines 37-44 my $builder = sub { Link Here
37
	$nextnum = $branchcode.'_'.$nextnum;
37
	$nextnum = $branchcode.'_'.$nextnum;
38
38
39
    my $js  = <<END_OF_JS;
39
    my $js  = <<END_OF_JS;
40
<script type="text/javascript">
40
<script>
41
//<![CDATA[
42
41
43
function Focus$function_name(id, force) {
42
function Focus$function_name(id, force) {
44
    if (\$('#' + id).val() == '' || force) {
43
    if (\$('#' + id).val() == '' || force) {
Lines 50-56 function Click$function_name(event) { Link Here
50
    Focus$function_name(event.data.id, 1);
49
    Focus$function_name(event.data.id, 1);
51
    return false;
50
    return false;
52
}
51
}
53
//]]>
54
</script>
52
</script>
55
END_OF_JS
53
END_OF_JS
56
    return $js;
54
    return $js;
(-)a/cataloguing/value_builder/stocknumberam123.pl (-1 / +1 lines)
Lines 43-49 In this case, a stocknumber has this form : "PREFIX 0009678570". Link Here
43
my $builder = sub {
43
my $builder = sub {
44
    my ( $params ) = @_;
44
    my ( $params ) = @_;
45
    my $res="
45
    my $res="
46
    <script type='text/javascript'>
46
    <script>
47
        function Blur$params->{id}() {
47
        function Blur$params->{id}() {
48
                var code = document.getElementById('$params->{id}');
48
                var code = document.getElementById('$params->{id}');
49
                var url = '../cataloguing/plugin_launcher.pl?plugin_name=stocknumberam123.pl&code=' + code.value;
49
                var url = '../cataloguing/plugin_launcher.pl?plugin_name=stocknumberam123.pl&code=' + code.value;
(-)a/cataloguing/value_builder/unimarc_field_010.pl (-1 / +1 lines)
Lines 28-34 use C4::Output; Link Here
28
sub plugin_javascript {
28
sub plugin_javascript {
29
    my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
29
    my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
30
    my $res="
30
    my $res="
31
    <script type='text/javascript'>
31
    <script>
32
        function Blur$field_number() {
32
        function Blur$field_number() {
33
                var isbn = document.getElementById('$field_number');
33
                var isbn = document.getElementById('$field_number');
34
                var url = '../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_010.pl&isbn=' + isbn.value;
34
                var url = '../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_010.pl&isbn=' + isbn.value;
(-)a/cataloguing/value_builder/unimarc_field_100.pl (-1 / +1 lines)
Lines 32-38 use C4::Output; Link Here
32
sub plugin_javascript {
32
sub plugin_javascript {
33
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
33
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
34
    my $res           = "
34
    my $res           = "
35
        <script type='text/javascript'>
35
        <script>
36
            function Clic$field_number(i) {
36
            function Clic$field_number(i) {
37
                var defaultvalue;
37
                var defaultvalue;
38
                try {
38
                try {
(-)a/cataloguing/value_builder/unimarc_field_100_authorities.pl (-1 / +1 lines)
Lines 29-35 use C4::Output; Link Here
29
sub plugin_javascript {
29
sub plugin_javascript {
30
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
30
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
31
    my $res           = "
31
    my $res           = "
32
        <script type='text/javascript'>
32
        <script>
33
            function Clic$field_number(i) {
33
            function Clic$field_number(i) {
34
                var defaultvalue;
34
                var defaultvalue;
35
                try {
35
                try {
(-)a/cataloguing/value_builder/unimarc_field_105.pl (-1 / +1 lines)
Lines 32-38 use C4::Output; Link Here
32
sub plugin_javascript {
32
sub plugin_javascript {
33
    my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
33
    my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
34
    my $res="
34
    my $res="
35
    <script type='text/javascript'>
35
    <script>
36
        function Clic$field_number() {
36
        function Clic$field_number() {
37
                defaultvalue=document.getElementById(\"$field_number\").value;
37
                defaultvalue=document.getElementById(\"$field_number\").value;
38
                window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_105.pl&index=$field_number&result=\"+defaultvalue,\"unimarc_field_105\",'width=1200,height=400,toolbar=false,scrollbars=yes');
38
                window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_105.pl&index=$field_number&result=\"+defaultvalue,\"unimarc_field_105\",'width=1200,height=400,toolbar=false,scrollbars=yes');
(-)a/cataloguing/value_builder/unimarc_field_110.pl (-1 / +1 lines)
Lines 32-38 use C4::Output; Link Here
32
sub plugin_javascript {
32
sub plugin_javascript {
33
    my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
33
    my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
34
    my $res="
34
    my $res="
35
    <script type='text/javascript'>
35
    <script>
36
    function Clic$field_number() {
36
    function Clic$field_number() {
37
            defaultvalue=document.getElementById(\"$field_number\").value;
37
            defaultvalue=document.getElementById(\"$field_number\").value;
38
            window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_110.pl&index=$field_number&result=\"+defaultvalue,\"unimarc_field_110\",'width=700,height=600,toolbar=false,scrollbars=yes');
38
            window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_110.pl&index=$field_number&result=\"+defaultvalue,\"unimarc_field_110\",'width=700,height=600,toolbar=false,scrollbars=yes');
(-)a/cataloguing/value_builder/unimarc_field_115a.pl (-1 / +1 lines)
Lines 31-37 use C4::Output; Link Here
31
sub plugin_javascript {
31
sub plugin_javascript {
32
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
32
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
33
    my $res = "
33
    my $res = "
34
    <script type=\"text/javascript\">
34
    <script>
35
    function Clic$field_number(i) {
35
    function Clic$field_number(i) {
36
        var defaultvalue;
36
        var defaultvalue;
37
        try {
37
        try {
(-)a/cataloguing/value_builder/unimarc_field_115b.pl (-1 / +1 lines)
Lines 31-37 use C4::Output; Link Here
31
sub plugin_javascript {
31
sub plugin_javascript {
32
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
32
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
33
    my $res = "
33
    my $res = "
34
<script type=\"text/javascript\">
34
<script>
35
function Clic$field_number() {
35
function Clic$field_number() {
36
	defaultvalue=document.getElementById(\"$field_number\").value;
36
	defaultvalue=document.getElementById(\"$field_number\").value;
37
	window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_115b.pl&index=$field_number&result=\"+defaultvalue,\"unimarc_field_115b\",'width=1200,height=600,toolbar=false,scrollbars=yes');
37
	window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_115b.pl&index=$field_number&result=\"+defaultvalue,\"unimarc_field_115b\",'width=1200,height=600,toolbar=false,scrollbars=yes');
(-)a/cataloguing/value_builder/unimarc_field_210c.pl (-1 / +1 lines)
Lines 42-48 my $function_name= $field_number; Link Here
42
42
43
43
44
my $res  = "
44
my $res  = "
45
<script type=\"text/javascript\">
45
<script>
46
function Clic$function_name(subfield_managed) {
46
function Clic$function_name(subfield_managed) {
47
    defaultvalue=escape(document.getElementById(\"$field_number\").value);
47
    defaultvalue=escape(document.getElementById(\"$field_number\").value);
48
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_210c.pl&index=\"+subfield_managed,\"unimarc_225a\",'width=500,height=600,toolbar=false,scrollbars=yes');
48
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_210c.pl&index=\"+subfield_managed,\"unimarc_225a\",'width=500,height=600,toolbar=false,scrollbars=yes');
(-)a/cataloguing/value_builder/unimarc_field_210c_bis.pl (-1 / +1 lines)
Lines 51-57 sub plugin_javascript { Link Here
51
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
51
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
52
    my $function_name = $field_number;
52
    my $function_name = $field_number;
53
    my $res           = "
53
    my $res           = "
54
    <script type=\"text/javascript\">
54
    <script>
55
    
55
    
56
    
56
    
57
        function Clic$function_name(index) {
57
        function Clic$function_name(index) {
(-)a/cataloguing/value_builder/unimarc_field_225a.pl (-2 / +2 lines)
Lines 58-68 sub plugin_javascript { Link Here
58
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
58
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
59
    my $function_name = $field_number;
59
    my $function_name = $field_number;
60
    my $res = "
60
    my $res = "
61
    <script type=\"text/javascript\">
61
    <script>
62
    
62
    
63
    
63
    
64
        function Clic$function_name(index) {
64
        function Clic$function_name(index) {
65
        // find the 010a value and the 210c. it will be used in the popup to find possibles collections
65
        /* find the 010a value and the 210c. it will be used in the popup to find possibles collections */
66
            var isbn_found   = 0;
66
            var isbn_found   = 0;
67
            var editor_found = 0;
67
            var editor_found = 0;
68
            
68
            
(-)a/cataloguing/value_builder/unimarc_field_225a_bis.pl (-1 / +1 lines)
Lines 34-40 sub plugin_javascript { Link Here
34
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
34
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
35
    my $function_name = $field_number;
35
    my $function_name = $field_number;
36
    my $res           = "
36
    my $res           = "
37
    <script type=\"text/javascript\">
37
    <script>
38
        function Clic$function_name(index) {
38
        function Clic$function_name(index) {
39
            window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_225a_bis.pl&index=\"+index,\"unimarc225a\",'width=500,height=400,toolbar=false,scrollbars=no');
39
            window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_225a_bis.pl&index=\"+index,\"unimarc225a\",'width=500,height=400,toolbar=false,scrollbars=no');
40
        }
40
        }
(-)a/cataloguing/value_builder/unimarc_field_4XX.pl (-1 / +1 lines)
Lines 46-52 sub plugin_javascript { Link Here
46
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
46
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
47
    my $function_name = $field_number;
47
    my $function_name = $field_number;
48
    my $res           = "
48
    my $res           = "
49
    <script type='text/javascript'>
49
    <script>
50
        function Clic$function_name(i) {
50
        function Clic$function_name(i) {
51
            defaultvalue=document.getElementById(\"$field_number\").value;
51
            defaultvalue=document.getElementById(\"$field_number\").value;
52
            window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_4XX.pl&index=\" + i + \"&result=\"+defaultvalue,\"unimarc_field_4\"+i+\"\",'width=900,height=700,toolbar=false,scrollbars=yes');
52
            window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_4XX.pl&index=\" + i + \"&result=\"+defaultvalue,\"unimarc_field_4\"+i+\"\",'width=900,height=700,toolbar=false,scrollbars=yes');
(-)a/cataloguing/value_builder/upload.pl (-2 / +1 lines)
Lines 33-39 use Modern::Perl; Link Here
33
my $builder = sub {
33
my $builder = sub {
34
    my ( $params ) = @_;
34
    my ( $params ) = @_;
35
    return <<"SCRIPT";
35
    return <<"SCRIPT";
36
<script type=\"text/javascript\">
36
<script>
37
        function Click$params->{id}(event) {
37
        function Click$params->{id}(event) {
38
            var index = event.data.id;
38
            var index = event.data.id;
39
            var str = document.getElementById(index).value;
39
            var str = document.getElementById(index).value;
40
- 

Return to bug 25354