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

(-)a/C4/Biblio.pm (-5 / +13 lines)
Lines 1624-1630 sub GetMarcAuthors { Link Here
1624
1624
1625
=head2 GetMarcUrls
1625
=head2 GetMarcUrls
1626
1626
1627
  $marcurls = GetMarcUrls($record,$marcflavour);
1627
  $marcurls = GetMarcUrls($record,$marcflavour,$frameworkcode);
1628
1628
1629
Returns arrayref of URLs from MARC data, suitable to pass to tmpl loop.
1629
Returns arrayref of URLs from MARC data, suitable to pass to tmpl loop.
1630
Assumes web resources (not uncommon in MARC21 to omit resource type ind) 
1630
Assumes web resources (not uncommon in MARC21 to omit resource type ind) 
Lines 1632-1646 Assumes web resources (not uncommon in MARC21 to omit resource type ind) Link Here
1632
=cut
1632
=cut
1633
1633
1634
sub GetMarcUrls {
1634
sub GetMarcUrls {
1635
    my ( $record, $marcflavour ) = @_;
1635
    my ( $record, $marcflavour, $frameworkcode ) = @_;
1636
1637
    my $tagslib = &GetMarcStructure(1, $frameworkcode);
1638
    my $urltag = '856';
1639
    my $urlsubtag = 'u';
1636
1640
1637
    my @marcurls;
1641
    my @marcurls;
1638
    for my $field ( $record->field('856') ) {
1642
    for my $field ( $record->field($urltag) ) {
1639
        my @notes;
1643
        my @notes;
1640
        for my $note ( $field->subfield('z') ) {
1644
        for my $note ( $field->subfield('z') ) {
1641
            push @notes, { note => $note };
1645
            push @notes, { note => $note };
1642
        }
1646
        }
1643
        my @urls = $field->subfield('u');
1647
        my @urls = $field->subfield($urlsubtag);
1644
        foreach my $url (@urls) {
1648
        foreach my $url (@urls) {
1645
            my $marcurl;
1649
            my $marcurl;
1646
            if ( $marcflavour eq 'MARC21' ) {
1650
            if ( $marcflavour eq 'MARC21' ) {
Lines 1669-1675 sub GetMarcUrls { Link Here
1669
                $marcurl->{'toc'} = 1 if ( defined($s3) && $s3 =~ /^[Tt]able/ );
1673
                $marcurl->{'toc'} = 1 if ( defined($s3) && $s3 =~ /^[Tt]able/ );
1670
            } else {
1674
            } else {
1671
                $marcurl->{'linktext'} = $field->subfield('2') || C4::Context->preference('URLLinkText') || $url;
1675
                $marcurl->{'linktext'} = $field->subfield('2') || C4::Context->preference('URLLinkText') || $url;
1672
                $marcurl->{'MARCURL'} = $url;
1676
		if ($tagslib->{ $urltag }->{ $urlsubtag }->{value_builder} eq "upload.pl") {
1677
		    $marcurl->{'MARCURL'} = C4::Context->preference('uploadWebPath') . "/" . $url;
1678
		} else {
1679
		    $marcurl->{'MARCURL'} = $url;
1680
		}
1673
            }
1681
            }
1674
            push @marcurls, $marcurl;
1682
            push @marcurls, $marcurl;
1675
        }
1683
        }
(-)a/basket/basket.pl (-1 / +1 lines)
Lines 65-71 foreach my $biblionumber ( @bibs ) { Link Here
65
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
65
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
66
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
66
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
67
    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
67
    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
68
    my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
68
    my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour, GetFrameworkCode($biblionumber));
69
    my @items            = GetItemsInfo( $biblionumber );
69
    my @items            = GetItemsInfo( $biblionumber );
70
70
71
    my $hasauthors = 0;
71
    my $hasauthors = 0;
(-)a/catalogue/MARCdetail.pl (+11 lines)
Lines 82-87 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
82
    }
82
    }
83
);
83
);
84
84
85
my $uploadWebPath;
86
if (C4::Context->preference('uploadWebPath')) {
87
    $uploadWebPath = C4::Context->preference('uploadWebPath');
88
}
89
85
my $record = GetMarcBiblio($biblionumber);
90
my $record = GetMarcBiblio($biblionumber);
86
91
87
if ( not defined $record ) {
92
if ( not defined $record ) {
Lines 215-220 for ( my $tabloop = 0 ; $tabloop <= 10 ; $tabloop++ ) { Link Here
215
                      GetAuthorisedValueDesc( $fields[$x_i]->tag(),
220
                      GetAuthorisedValueDesc( $fields[$x_i]->tag(),
216
                        $subf[$i][0], $subf[$i][1], '', $tagslib) || $subf[$i][1];
221
                        $subf[$i][0], $subf[$i][1], '', $tagslib) || $subf[$i][1];
217
222
223
                    if ($tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }->{value_builder} eq "upload.pl" and $uploadWebPath) {
224
                        my $file_uri = qq($uploadWebPath/$subf[$i][1]);
225
                        $subfield_data{marc_value} = qq/<a href="$file_uri">$subfield_data{marc_value}<\/a>/;
226
                        $subfield_data{is_file} = 1;
227
                    }
228
218
                }
229
                }
219
                $subfield_data{marc_subfield} = $subf[$i][0];
230
                $subfield_data{marc_subfield} = $subf[$i][0];
220
                $subfield_data{marc_tag}      = $fields[$x_i]->tag();
231
                $subfield_data{marc_tag}      = $fields[$x_i]->tag();
(-)a/catalogue/detail.pl (-1 / +1 lines)
Lines 104-110 my $marcisbnsarray = GetMarcISBN( $record, $marcflavour ); Link Here
104
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
104
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
105
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
105
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
106
my $marcseriesarray  = GetMarcSeries($record,$marcflavour);
106
my $marcseriesarray  = GetMarcSeries($record,$marcflavour);
107
my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
107
my $marcurlsarray    = GetMarcUrls    ($record, $marcflavour, $fw);
108
my $subtitle         = GetRecordValue('subtitle', $record, $fw);
108
my $subtitle         = GetRecordValue('subtitle', $record, $fw);
109
109
110
# Get Branches, Itemtypes and Locations
110
# Get Branches, Itemtypes and Locations
(-)a/cataloguing/value_builder/upload.pl (+188 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
use strict;
4
use warnings;
5
6
use C4::Auth;
7
use CGI qw/-utf8/;
8
use C4::Context;
9
use C4::Debug;
10
11
use C4::AuthoritiesMarc;
12
use C4::Output;
13
use File::Basename;
14
use Text::Undiacritic qw/undiacritic/;
15
use Encode;
16
17
#use open qw(:std :utf8);
18
19
20
my $upload_path = C4::Context->preference('uploadPath');
21
22
=head1
23
24
plugin_parameters : other parameters added when the plugin is called by the dopop function
25
26
=cut
27
28
sub plugin_parameters {
29
    my ( $dbh, $record, $tagslib, $i, $tabloop ) = @_;
30
    return "";
31
}
32
33
sub plugin_javascript {
34
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
35
    my $function_name = $field_number;
36
    my $res           = "
37
    <script type=\"text/javascript\">
38
        function Focus$function_name(subfield_managed) {
39
            return 1;
40
        }
41
    
42
        function Blur$function_name(subfield_managed) {
43
            return 1;
44
        }
45
    
46
        function Clic$function_name(index) {
47
            defaultvalue = document.getElementById(index).value;
48
            window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=upload.pl&index=\"+index+\"&result=\"+defaultvalue,'upload','width=600,height=400,toolbar=false,scrollbars=no');
49
    
50
        }
51
    </script>
52
";
53
54
    return ( $function_name, $res );
55
}
56
57
sub plugin {
58
    my ($input)      = @_;
59
    my $index        = $input->param('index');
60
    my $result       = $input->param('result');
61
    my $delete       = $input->param('delete');
62
    my $uploaded_file = $input->param('uploaded_file');
63
64
    my $template_name = $result || $delete ? "upload_delete_file.tmpl" : "upload.tmpl";
65
66
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
67
        {   template_name   => "cataloguing/value_builder/$template_name",
68
            query           => $input,
69
            type            => "intranet",
70
            authnotrequired => 0,
71
            flagsrequired   => { editcatalogue => '*' },
72
            debug           => 1,
73
        }
74
    );
75
76
77
    my $filefield = CGI::filefield( -name=>'uploaded_file', 
78
     -default=>'starting value',
79
     -size=>50,
80
     -maxlength=>80);
81
82
    $template->param(
83
        index      => $index,
84
	result     => $result,
85
	filefield  => $filefield
86
    );
87
88
89
    # If there's already a file uploaded for this field,
90
    # We handle is deletion
91
    if ($delete) {
92
	warn "deletion of $upload_path/$result";
93
	my $success = unlink("$upload_path/$result");
94
	if ($success) {
95
	    $template->param(success => $success);
96
	} else {
97
	    $template->param(error => 1);
98
	}
99
    }
100
101
102
    # Dealing with the uploaded file
103
    if ($uploaded_file) {
104
105
	my $fh = $input->upload('uploaded_file');
106
	my $error;
107
	my $success;
108
109
	if (defined $fh) {
110
	
111
	    # Dealing with filenames:
112
113
	    # Normalizing filename:
114
	    $uploaded_file = normalize_string($uploaded_file);
115
	    $uploaded_file = undiacritic($uploaded_file);
116
117
	    # Checking for an existing filename in destination directory
118
	    if (-f "$upload_path/$uploaded_file") {
119
120
		# And getting a new one if needed
121
		my ($dir, $file, $ext) = fileparse("$upload_path/$uploaded_file", qr/\.[^.]*/);
122
		$uploaded_file = findname($dir, $file, $ext);
123
	    }
124
125
	    # Copying the temp file to the destination directory
126
	    my $io_fh = $fh->handle;
127
	    open (OUTFILE, '>', "$upload_path/$uploaded_file") or $error = $!;
128
	    if (!$error) {
129
		my $buffer;
130
		while (my $bytesread = $io_fh->read($buffer,1024)) {
131
		    print OUTFILE $buffer;
132
		}
133
		close(OUTFILE);
134
		$success = 1;
135
	    } else {
136
		$error = "Could not write to destination file";
137
	    }
138
	} else {
139
	    $error = "Could not get the file";
140
	}
141
	$template->param(success       => $success)        if ($success);
142
	$template->param(error         => $error)          if ($error);
143
	$template->param(uploaded_file => $uploaded_file);
144
    }
145
146
    output_html_with_http_headers $input, $cookie, $template->output;
147
}
148
149
sub findname {
150
    my $file = shift;
151
    my $dir = shift;
152
    my $ext = shift;
153
154
    my $count = 1;
155
    my $found = 0;
156
157
    while ($found == 0) {
158
	if (-f "$dir/$file-$count$ext") {
159
	    $count++;
160
	} else {
161
	    $found = 1;	    
162
	}
163
    }
164
165
    return "$file-$count$ext";
166
}
167
168
=head2 normalize_string
169
        Given 
170
            a string
171
        Returns a utf8 NFC normalized string
172
        
173
        Sample code :
174
=cut
175
176
sub normalize_string{
177
        my ($string)=@_;
178
    $debug and warn " string in normalize before normalize :",$string;
179
    $string=decode_utf8($string,1);
180
    $debug and warn " string in normalize :",$string;
181
    $string=~s/\<|\>|\^|\;|\?|,|\-|\(|\)|\[|\]|\{|\}|\$|\%|\!|\*|\:|\\|\/|\&|\"|\'|\s/_/g;
182
    $string=~s/\s+$//g;
183
    $string=~s/^\s+//g;
184
    return $string; 
185
}
186
187
188
1;
(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 318-320 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( Link Here
318
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('BasketConfirmations', '1', 'When closing or reopening a basket,', 'always ask for confirmation.|do not ask for confirmation.', 'Choice');
318
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('BasketConfirmations', '1', 'When closing or reopening a basket,', 'always ask for confirmation.|do not ask for confirmation.', 'Choice');
319
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('MARCAuthorityControlField008', '|| aca||aabn           | a|a     d', NULL, NULL, 'Textarea');
319
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('MARCAuthorityControlField008', '|| aca||aabn           | a|a     d', NULL, NULL, 'Textarea');
320
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpenLibraryCovers',0,'If ON Openlibrary book covers will be show',NULL,'YesNo');
320
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpenLibraryCovers',0,'If ON Openlibrary book covers will be show',NULL,'YesNo');
321
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('uploadPath','','Sets the upload path for the upload.pl plugin','','');
322
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('uploadWebPath','','Set the upload path starting from document root for the upload.pl plugin','','');
(-)a/installer/data/mysql/updatedatabase.pl (+14 lines)
Lines 4446-4451 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4446
    SetVersion($DBversion);
4446
    SetVersion($DBversion);
4447
}
4447
}
4448
4448
4449
$DBversion = "XXX";
4450
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4451
    $dbh->do("
4452
    INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES('uploadPath','','Sets the upload path for the upload.pl plugin','','');
4453
    ");
4454
4455
    $dbh->do("
4456
    INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES('uploadWebPath','','Set the upload path starting from document root for the upload.pl plugin','','');
4457
    ");
4458
    print "Upgrade to $DBversion done (Adding upload plugin sysprefs)\n";
4459
    SetVersion($DBversion);
4460
}
4461
4462
=item DropAllForeignKeys($table)
4449
4463
4450
=head1 FUNCTIONS
4464
=head1 FUNCTIONS
4451
4465
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt (-10 / +70 lines)
Lines 109-115 function Changefwk(FwkList) { Link Here
109
                    <span class="subfield-label">&nbsp;
109
                    <span class="subfield-label">&nbsp;
110
                    [% UNLESS ( subfiel.hide_marc ) %][% subfiel.marc_subfield %][% END %]
110
                    [% UNLESS ( subfiel.hide_marc ) %][% subfiel.marc_subfield %][% END %]
111
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
111
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
112
                    [% IF ( subfiel.is_url ) %]<a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>[% ELSE %][% subfiel.marc_value |html %][% END %]
112
                    [% IF ( subfiel.is_url ) %]
113
                        <a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>
114
                    [% ELSIF ( subfiel.is_file ) %]
115
                        [% subfiel.marc_value %]
116
                    [% ELSE %]
117
                        [% subfiel.marc_value |html %]
118
                    [% END %]
113
                    [% IF ( subfiel.link ) %]
119
                    [% IF ( subfiel.link ) %]
114
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
120
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
115
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
121
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
Lines 139-145 function Changefwk(FwkList) { Link Here
139
                    <span class="subfield-label">&nbsp;
145
                    <span class="subfield-label">&nbsp;
140
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
146
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
141
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
147
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
142
                    [% IF ( subfiel.is_url ) %]<a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>[% ELSE %][% subfiel.marc_value |html %][% END %]
148
                    [% IF ( subfiel.is_url ) %]
149
                        <a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>
150
                    [% ELSIF ( subfiel.is_file ) %]
151
                        [% subfiel.marc_value %]
152
                    [% ELSE %]
153
                        [% subfiel.marc_value |html %]
154
                    [% END %]
143
                    [% IF ( subfiel.link ) %]
155
                    [% IF ( subfiel.link ) %]
144
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
156
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
145
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
157
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
Lines 169-175 function Changefwk(FwkList) { Link Here
169
                    <span class="subfield-label">&nbsp;
181
                    <span class="subfield-label">&nbsp;
170
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
182
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
171
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
183
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
172
                    [% IF ( subfiel.is_url ) %]<a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>[% ELSE %][% subfiel.marc_value |html %][% END %]
184
                    [% IF ( subfiel.is_url ) %]
185
                        <a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>
186
                    [% ELSIF ( subfiel.is_file ) %]
187
                        [% subfiel.marc_value %]
188
                    [% ELSE %]
189
                        [% subfiel.marc_value |html %]
190
                    [% END %]
173
                    [% IF ( subfiel.link ) %]
191
                    [% IF ( subfiel.link ) %]
174
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
192
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
175
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
193
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
Lines 199-205 function Changefwk(FwkList) { Link Here
199
                    <span class="subfield-label">&nbsp;
217
                    <span class="subfield-label">&nbsp;
200
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
218
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
201
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
219
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
202
                    [% IF ( subfiel.is_url ) %]<a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>[% ELSE %][% subfiel.marc_value |html %][% END %]
220
                    [% IF ( subfiel.is_url ) %]
221
                        <a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>
222
                    [% ELSIF ( subfiel.is_url ) %]
223
                        [% subfiel.marc_value %]
224
                    [% ELSE %]
225
                        [% subfiel.marc_value |html %]
226
                    [% END %]
203
                    [% IF ( subfiel.link ) %]
227
                    [% IF ( subfiel.link ) %]
204
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
228
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
205
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
229
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
Lines 229-235 function Changefwk(FwkList) { Link Here
229
                    <span class="subfield-label">&nbsp;
253
                    <span class="subfield-label">&nbsp;
230
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
254
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
231
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
255
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
232
                    [% IF ( subfiel.is_url ) %]<a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>[% ELSE %][% subfiel.marc_value |html %][% END %]
256
                    [% IF ( subfiel.is_url ) %]
257
                        <a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>
258
                    [% ELSIF (subfiel.is_url ) %]
259
                        [% subfiel.marc_value %]
260
                    [% ELSE %]
261
                        [% subfiel.marc_value |html %]
262
                    [% END %]
233
                    [% IF ( subfiel.link ) %]
263
                    [% IF ( subfiel.link ) %]
234
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
264
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
235
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
265
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
Lines 259-265 function Changefwk(FwkList) { Link Here
259
                    <span class="subfield-label">&nbsp;
289
                    <span class="subfield-label">&nbsp;
260
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
290
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
261
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
291
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
262
                    [% IF ( subfiel.is_url ) %]<a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>[% ELSE %][% subfiel.marc_value |html %][% END %]
292
                    [% IF ( subfiel.is_url ) %]
293
                        <a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>
294
                    [% ELSIF (subfiel.is_url ) %]
295
                        [% subfiel.marc_value %]
296
                    [% ELSE %]
297
                        [% subfiel.marc_value |html %]
298
                    [% END %]
263
                    [% IF ( subfiel.link ) %]
299
                    [% IF ( subfiel.link ) %]
264
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
300
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
265
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
301
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
Lines 289-295 function Changefwk(FwkList) { Link Here
289
                    <span class="subfield-label">&nbsp;
325
                    <span class="subfield-label">&nbsp;
290
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
326
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
291
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
327
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
292
                    [% IF ( subfiel.is_url ) %]<a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>[% ELSE %][% subfiel.marc_value |html %][% END %]
328
                    [% IF ( subfiel.is_url ) %]
329
                        <a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>
330
                    [% ELSIF (subfiel.is_url ) %]
331
                        [% subfiel.marc_value %]
332
                    [% ELSE %]
333
                        [% subfiel.marc_value |html %]
334
                    [% END %]
293
                    [% IF ( subfiel.link ) %]
335
                    [% IF ( subfiel.link ) %]
294
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
336
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
295
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
337
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
Lines 319-325 function Changefwk(FwkList) { Link Here
319
                    <span class="subfield-label">&nbsp;
361
                    <span class="subfield-label">&nbsp;
320
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
362
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
321
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
363
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
322
                    [% IF ( subfiel.is_url ) %]<a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>[% ELSE %][% subfiel.marc_value |html %][% END %]
364
                    [% IF ( subfiel.is_url ) %]
365
                        <a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>
366
                    [% ELSIF (subfiel.is_url ) %]
367
                        [% subfiel.marc_value %]
368
                    [% ELSE %]
369
                        [% subfiel.marc_value |html %]
370
                    [% END %]
323
                    [% IF ( subfiel.link ) %]
371
                    [% IF ( subfiel.link ) %]
324
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
372
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
325
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
373
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
Lines 349-355 function Changefwk(FwkList) { Link Here
349
                    <span class="subfield-label">&nbsp;
397
                    <span class="subfield-label">&nbsp;
350
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
398
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
351
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
399
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
352
                    [% IF ( subfiel.is_url ) %]<a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>[% ELSE %][% subfiel.marc_value |html %][% END %]
400
                    [% IF ( subfiel.is_url ) %]
401
                        <a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>
402
                    [% ELSIF (subfiel.is_url ) %]
403
                        [% subfiel.marc_value %]
404
                    [% ELSE %]
405
                        [% subfiel.marc_value |html %]
406
                    [% END %]
353
                    [% IF ( subfiel.link ) %]
407
                    [% IF ( subfiel.link ) %]
354
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
408
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
355
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
409
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
Lines 379-385 function Changefwk(FwkList) { Link Here
379
                    <span class="subfield-label">&nbsp;
433
                    <span class="subfield-label">&nbsp;
380
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
434
                    [% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield %]</b>[% END %]
381
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
435
                    <span title="[% subfiel.long_desc %]">[% subfiel.short_desc %]</span></span>
382
                    [% IF ( subfiel.is_url ) %]<a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>[% ELSE %][% subfiel.marc_value |html %][% END %]
436
                    [% IF ( subfiel.is_url ) %]
437
                        <a href="[% subfiel.marc_value %]">[% subfiel.marc_value |html %]</a>
438
                    [% ELSIF (subfiel.is_url ) %]
439
                        [% subfiel.marc_value %]
440
                    [% ELSE %]
441
                        [% subfiel.marc_value |html %]
442
                    [% END %]
383
                    [% IF ( subfiel.link ) %]
443
                    [% IF ( subfiel.link ) %]
384
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
444
                        <a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;idx=[% subfiel.link %],phr&amp;type=intranet&amp;q=[% subfiel.marc_value |url %]">
385
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
445
                            <img border="0" src="[% interface %]/[% theme %]/img/filefind.png" height="15" title="Search on [% subfiel.marc_value |html %]" alt="Search on [% subfiel.marc_value |html %]" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload.tt (+50 lines)
Line 0 Link Here
1
<!DOCTYPE html PUBLIC "-//W3C//DTD Xhtml 1.0 Transitional//EN"
2
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
    <title>Upload plugin</title>
6
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
    <script type="text/javascript" src="[% yuipath %]/utilities/utilities.js"></script> 
8
    <link rel="stylesheet" type="text/css" href="[% themelang %]/css/staff-global.css" />
9
10
</head>
11
<body>
12
[% IF ( success ) %]
13
14
    <script type="text/javascript">
15
        function report() {
16
            var doc   = opener.document; 
17
            var field = doc.getElementById("[% index %]");
18
            field.value =  "[% uploaded_file %]";
19
            window.close();
20
            return false;
21
        }
22
    </script>
23
24
25
    The file [% uploaded_file %] has been successfully added.
26
    <p><input type="button" value="close" onclick="javascript:report();" /></p>
27
28
[% ELSE %]
29
30
    [% IF ( error ) %]
31
	Error: [% error %]
32
	<p><input type="button" value="close" onclick="javascript:window.close();" /></p>
33
    [% ELSE %]
34
35
	[% IF ( uploaded_file ) %]
36
	uploaded file: [% uploaded_file %]
37
	[% ELSE %]
38
	    <h2>Please select the file to upload : </h2>
39
	    <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/cataloguing/plugin_launcher.pl">
40
		[% filefield %]
41
		<input type="hidden" name="plugin_name" value="upload.pl" />
42
		<input type="hidden" name="index" value="[% index %]" />
43
		<input type="submit">
44
	    </form>
45
	[% END %]
46
    [% END %]
47
[% END %]
48
49
</body>
50
</html>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload_delete_file.tt (+52 lines)
Line 0 Link Here
1
<!DOCTYPE html PUBLIC "-//W3C//DTD Xhtml 1.0 Transitional//EN"
2
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
    <title>Upload plugin</title>
6
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
    <script type="text/javascript" src="[% yuipath %]/utilities/utilities.js"></script> 
8
    <link rel="stylesheet" type="text/css" href="[% themelang %]/css/staff-global.css" />
9
10
</head>
11
<body>
12
[% IF ( success ) %]
13
14
    <script type="text/javascript">
15
        function report() {
16
            var doc   = opener.document; 
17
            var field = doc.getElementById("[% index %]");
18
            field.value =  "";
19
            window.close();
20
            return false;
21
        }
22
    </script>
23
24
    The file has been successfully deleted.
25
    <p><input type="button" value="close" onclick="javascript:report();" /></p>
26
27
[% ELSE %]
28
29
    [% IF ( error ) %]
30
	Error: Unable to delete the file.
31
	<p><input type="button" value="close" onclick="javascript:window.close();" /></p>
32
    [% ELSE %]
33
34
	[% IF ( uploaded_file ) %]
35
	uploaded file: [% uploaded_file %]
36
	[% ELSE %]
37
	    <h2>File deletion</h2>
38
	    <p>A file has already been uploaded for this field. Do you want to delete it?</p>
39
	    <form method="post" action="/cgi-bin/koha/cataloguing/plugin_launcher.pl">
40
		<input type="hidden" name="plugin_name" value="upload.pl" />
41
		<input type="hidden" name="delete" value="delete" />
42
		<input type="hidden" name="result" value="[% result %]" />
43
		<input type="hidden" name="index" value="[% index %]" />
44
		<input type="button" value="Cancel" onclick="javascript:window.close();" />
45
		<input type="submit" value="Delete" />
46
	    </form>
47
	[% END %]
48
    [% END %]
49
[% END %]
50
51
</body>
52
</html>
(-)a/kohaversion.pl (-1 / +1 lines)
Lines 16-22 the kohaversion is divided in 4 parts : Link Here
16
use strict;
16
use strict;
17
17
18
sub kohaversion {
18
sub kohaversion {
19
    our $VERSION = '3.05.00.011';
19
    our $VERSION = 'XXX';
20
    # version needs to be set this way
20
    # version needs to be set this way
21
    # so that it can be picked up by Makefile.PL
21
    # so that it can be picked up by Makefile.PL
22
    # during install
22
    # during install
(-)a/misc/strip_value_from_tag.pl (+60 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This script takes every biblio record in the database,
4
# looks for a value beginning with $find in $fieldtag$$subfieldtag
5
# and strips $find from this value.
6
# This was originally made for the file upload plugin, but might
7
# be used for other purposes.
8
9
use strict;
10
11
use Getopt::Long;
12
use C4::Context;
13
use C4::Biblio;
14
15
my $debug = 0;
16
17
# Which field are we processing?
18
my $fieldtag = "857";
19
my $subfieldtag = "u";
20
21
# Whichi beginning pattern are we looking to delete?
22
my $find = "http://myurl.tld/";
23
my $length = length($find);
24
my $pattern = qr|^$find|;
25
26
print "Field $fieldtag\$$subfieldtag\n";
27
28
# Getting db connection
29
my $dbh = C4::Context->dbh;
30
31
# Getting max bibnumber
32
my $query = "SELECT MAX(biblionumber) from biblio";
33
my $sth = $dbh->prepare($query);
34
$sth->execute();
35
my $bibliocount = $sth->fetchrow;
36
37
warn "unable to get biblio count" and exit -1 unless $bibliocount;
38
39
print "Biblio count : $bibliocount\n";
40
41
# Foreach each biblio
42
foreach (1..$bibliocount) {
43
    my $found = 0;
44
    my $record = GetMarcBiblio($_);
45
    $debug and warn "unable to get marc for record $_" unless $record;
46
    next unless $record;
47
    foreach my $field ($record->field($fieldtag)) {
48
	my $newfield = $field->clone();
49
	my $subfield = $newfield->subfield($subfieldtag);
50
	if ($subfield and $subfield =~ $pattern) {
51
	    my $newsubfield = substr $subfield, $length;
52
	    $newsubfield =~ s/\s+$//;
53
	    $newfield->update($subfieldtag, $newsubfield);
54
	    $field->replace_with($newfield);
55
	    $found = 1;
56
	}
57
    }
58
    print "processing $_\n" if ($found == 1);
59
    ModBiblioMarc($record, $_, GetFrameworkCode($_)) if ($found == 1);
60
}
(-)a/opac/opac-MARCdetail.pl (+10 lines)
Lines 90-95 if (C4::Context->preference("RequestOnOpac")) { Link Here
90
	$RequestOnOpac = 1;
90
	$RequestOnOpac = 1;
91
}
91
}
92
92
93
my $uploadWebPath;
94
if (C4::Context->preference('uploadWebPath')) {
95
    $uploadWebPath = C4::Context->preference('uploadWebPath');
96
}
97
93
# fill arrays
98
# fill arrays
94
my @loop_data = ();
99
my @loop_data = ();
95
my $tag;
100
my $tag;
Lines 161-166 for ( my $tabloop = 0 ; $tabloop <= 10 ; $tabloop++ ) { Link Here
161
                    }
166
                    }
162
                    $subfield_data{marc_value} = GetAuthorisedValueDesc( $fields[$x_i]->tag(),
167
                    $subfield_data{marc_value} = GetAuthorisedValueDesc( $fields[$x_i]->tag(),
163
                        $subf[$i][0], $subf[$i][1], '', $tagslib, '', 'opac' );
168
                        $subf[$i][0], $subf[$i][1], '', $tagslib, '', 'opac' );
169
                    if ($tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }->{value_builder} eq "upload.pl" and $uploadWebPath) {
170
                        my $file_uri = qq($uploadWebPath/$subf[$i][1]);
171
                        $subfield_data{marc_value} = qq/<a href="$file_uri">$subfield_data{marc_value}<\/a>/;
172
                    }
173
164
                }
174
                }
165
                $subfield_data{marc_subfield} = $subf[$i][0];
175
                $subfield_data{marc_subfield} = $subf[$i][0];
166
                $subfield_data{marc_tag}      = $fields[$x_i]->tag();
176
                $subfield_data{marc_tag}      = $fields[$x_i]->tag();
(-)a/opac/opac-basket.pl (-1 / +1 lines)
Lines 67-73 foreach my $biblionumber ( @bibs ) { Link Here
67
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
67
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
68
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
68
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
69
    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
69
    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
70
    my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
70
    my $marcurlsarray    = GetMarcUrls    ($record, $marcflavour, GetFrameworkCode($biblionumber));
71
    my @items            = &GetItemsLocationInfo( $biblionumber );
71
    my @items            = &GetItemsLocationInfo( $biblionumber );
72
    my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
72
    my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
73
73
(-)a/opac/opac-detail.pl (-2 / +1 lines)
Lines 223-229 my $marcisbnsarray = GetMarcISBN ($record,$marcflavour); Link Here
223
my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour);
223
my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour);
224
my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour);
224
my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour);
225
my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
225
my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
226
my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
226
my $marcurlsarray    = GetMarcUrls    ($record, $marcflavour, $dat->{'frameworkcode'});
227
my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
227
my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
228
228
229
    $template->param(
229
    $template->param(
230
- 

Return to bug 6874