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

(-)a/C4/Biblio.pm (-2 / +6 lines)
Lines 1118-1124 sub GetMarcStructure { Link Here
1118
    }
1118
    }
1119
1119
1120
    $sth = $dbh->prepare(
1120
    $sth = $dbh->prepare(
1121
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength
1121
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength,punctuation,help
1122
         FROM   marc_subfield_structure 
1122
         FROM   marc_subfield_structure 
1123
         WHERE  frameworkcode=? 
1123
         WHERE  frameworkcode=? 
1124
         ORDER BY tagfield,tagsubfield
1124
         ORDER BY tagfield,tagsubfield
Lines 1138-1148 sub GetMarcStructure { Link Here
1138
    my $link;
1138
    my $link;
1139
    my $defaultvalue;
1139
    my $defaultvalue;
1140
    my $maxlength;
1140
    my $maxlength;
1141
    my $punctuation;
1142
    my $help;
1141
1143
1142
    while (
1144
    while (
1143
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
1145
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
1144
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
1146
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
1145
            $maxlength
1147
            $maxlength,    $punctuation,   $help
1146
        )
1148
        )
1147
        = $sth->fetchrow
1149
        = $sth->fetchrow
1148
      ) {
1150
      ) {
Lines 1160-1165 sub GetMarcStructure { Link Here
1160
        $res->{$tag}->{$subfield}->{'link'}           = $link;
1162
        $res->{$tag}->{$subfield}->{'link'}           = $link;
1161
        $res->{$tag}->{$subfield}->{defaultvalue}     = $defaultvalue;
1163
        $res->{$tag}->{$subfield}->{defaultvalue}     = $defaultvalue;
1162
        $res->{$tag}->{$subfield}->{maxlength}        = $maxlength;
1164
        $res->{$tag}->{$subfield}->{maxlength}        = $maxlength;
1165
        $res->{$tag}->{$subfield}->{punctuation}      = $punctuation;
1166
        $res->{$tag}->{$subfield}->{help}             = $help;
1163
    }
1167
    }
1164
1168
1165
    $marc_structure_cache->{$forlibrarian}->{$frameworkcode} = $res;
1169
    $marc_structure_cache->{$forlibrarian}->{$frameworkcode} = $res;
(-)a/admin/marc_subfields_structure.pl (-3 / +13 lines)
Lines 179-184 if ( $op eq 'add_form' ) { Link Here
179
        my %row_data;    # get a fresh hash for the row data
179
        my %row_data;    # get a fresh hash for the row data
180
        $row_data{defaultvalue} = $data->{defaultvalue};
180
        $row_data{defaultvalue} = $data->{defaultvalue};
181
        $row_data{maxlength} = $data->{maxlength};
181
        $row_data{maxlength} = $data->{maxlength};
182
        $row_data{punctuation} = $data->{'punctuation'};
183
        $row_data{help}        = CGI::escapeHTML( $data->{'help'} );
182
        $row_data{tab} = CGI::scrolling_list(
184
        $row_data{tab} = CGI::scrolling_list(
183
            -name   => 'tab',
185
            -name   => 'tab',
184
            -id     => "tab$i",
186
            -id     => "tab$i",
Lines 385-395 elsif ( $op eq 'add_validate' ) { Link Here
385
#                                     values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
387
#                                     values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
386
#     );
388
#     );
387
    my $sth_insert = $dbh->prepare(qq{
389
    my $sth_insert = $dbh->prepare(qq{
388
        insert into marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,authtypecode,value_builder,hidden,isurl,frameworkcode, link,defaultvalue,maxlength)
390
        insert into marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,authtypecode,value_builder,hidden,isurl,frameworkcode, link,defaultvalue,maxlength,punctuation,help)
389
        values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
391
        values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
390
    });
392
    });
391
    my $sth_update = $dbh->prepare(qq{
393
    my $sth_update = $dbh->prepare(qq{
392
        update marc_subfield_structure set tagfield=?, tagsubfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, kohafield=?, tab=?, seealso=?, authorised_value=?, authtypecode=?, value_builder=?, hidden=?, isurl=?, frameworkcode=?,  link=?, defaultvalue=?, maxlength=?
394
        update marc_subfield_structure set tagfield=?, tagsubfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, kohafield=?, tab=?, seealso=?, authorised_value=?, authtypecode=?, value_builder=?, hidden=?, isurl=?, frameworkcode=?,  link=?, defaultvalue=?, maxlength=?, punctuation=?, help=?
393
        where tagfield=? and tagsubfield=? and frameworkcode=?
395
        where tagfield=? and tagsubfield=? and frameworkcode=?
394
    });
396
    });
395
    my @tagsubfield       = $input->param('tagsubfield');
397
    my @tagsubfield       = $input->param('tagsubfield');
Lines 405-410 elsif ( $op eq 'add_validate' ) { Link Here
405
    my @link              = $input->param('link');
407
    my @link              = $input->param('link');
406
    my @defaultvalue      = $input->param('defaultvalue');
408
    my @defaultvalue      = $input->param('defaultvalue');
407
    my @maxlength         = $input->param('maxlength');
409
    my @maxlength         = $input->param('maxlength');
410
    my @punctuation       = $input->param('punctuation');
411
    my @help              = $input->param('help');
408
    
412
    
409
    for ( my $i = 0 ; $i <= $#tagsubfield ; $i++ ) {
413
    for ( my $i = 0 ; $i <= $#tagsubfield ; $i++ ) {
410
        my $tagfield    = $input->param('tagfield');
414
        my $tagfield    = $input->param('tagfield');
Lines 426-431 elsif ( $op eq 'add_validate' ) { Link Here
426
        my $link   = $link[$i];
430
        my $link   = $link[$i];
427
        my $defaultvalue = $defaultvalue[$i];
431
        my $defaultvalue = $defaultvalue[$i];
428
        my $maxlength = $maxlength[$i];
432
        my $maxlength = $maxlength[$i];
433
        my $punctuation      = $punctuation[$i];
434
        my $help             = $help[$i];
429
        
435
        
430
        if (defined($liblibrarian) && $liblibrarian ne "") {
436
        if (defined($liblibrarian) && $liblibrarian ne "") {
431
            unless ( C4::Context->config('demo') eq 1 ) {
437
            unless ( C4::Context->config('demo') eq 1 ) {
Lines 449-454 elsif ( $op eq 'add_validate' ) { Link Here
449
                        $link,
455
                        $link,
450
                        $defaultvalue,
456
                        $defaultvalue,
451
                        $maxlength,
457
                        $maxlength,
458
                        $punctuation,
459
                        $help,
452
                        (
460
                        (
453
                            $tagfield,
461
                            $tagfield,
454
                            $tagsubfield,
462
                            $tagsubfield,
Lines 475-480 elsif ( $op eq 'add_validate' ) { Link Here
475
                        $link,
483
                        $link,
476
                        $defaultvalue,
484
                        $defaultvalue,
477
                        $maxlength,
485
                        $maxlength,
486
                        $punctuation,
487
                        $help,
478
                    );
488
                    );
479
                }
489
                }
480
            }
490
            }
(-)a/cataloguing/addbiblio.pl (+11 lines)
Lines 330-335 sub create_input { Link Here
330
        id             => "tag_".$tag."_subfield_".$id_subfield."_".$index_tag."_".$index_subfield,
330
        id             => "tag_".$tag."_subfield_".$id_subfield."_".$index_tag."_".$index_subfield,
331
        value          => $value,
331
        value          => $value,
332
        maxlength      => $tagslib->{$tag}->{$subfield}->{maxlength},
332
        maxlength      => $tagslib->{$tag}->{$subfield}->{maxlength},
333
        punctuation    => $tagslib->{$tag}->{$subfield}->{punctuation},
334
        help           => $tagslib->{$tag}->{$subfield}->{help},
333
        random         => CreateKey(),
335
        random         => CreateKey(),
334
    );
336
    );
335
337
Lines 478-488 sub create_input { Link Here
478
                        name=\"".$subfield_data{id}."\"
480
                        name=\"".$subfield_data{id}."\"
479
                        value=\"$value\"
481
                        value=\"$value\"
480
                        tabindex=\"1\"
482
                        tabindex=\"1\"
483
                        punctuation=\"".$subfield_data{punctuation}."\"
481
                        size=\"67\"
484
                        size=\"67\"
482
                        maxlength=\"".$subfield_data{maxlength}."\"
485
                        maxlength=\"".$subfield_data{maxlength}."\"
483
                        class=\"input_marceditor\"
486
                        class=\"input_marceditor\"
487
                        onfocus=\"javascript:GetPunctuation(this);\"
488
                        onblur=\"javascript:CheckPunctuation(this);\"
484
                \/>
489
                \/>
485
                ";
490
                ";
491
                if ($subfield_data{help}){
492
                   $subfield_data{marc_value} .= "
493
                   &nbsp;<a class=\"showhelp\" href=\"#help_" . $subfield_data{id} . "\">Show help</a>
494
                   <div class=\"divsubfieldhelp\" id=\"help_" . $subfield_data{id} . "\" style=\"display:none; clear: both\">&nbsp;<i>" . $subfield_data{help} . "</i></div>
495
                   ";
496
               }
486
        }
497
        }
487
    }
498
    }
488
    $subfield_data{'index_subfield'} = $index_subfield;
499
    $subfield_data{'index_subfield'} = $index_subfield;
(-)a/installer/data/mysql/kohastructure.sql (+2 lines)
Lines 1235-1240 CREATE TABLE `marc_subfield_structure` ( Link Here
1235
  `link` varchar(80) default NULL,
1235
  `link` varchar(80) default NULL,
1236
  `defaultvalue` text default NULL,
1236
  `defaultvalue` text default NULL,
1237
  `maxlength` int(4) NOT NULL DEFAULT '9999',
1237
  `maxlength` int(4) NOT NULL DEFAULT '9999',
1238
  `punctuation` varchar(5) default NULL,
1239
  `help` varchar(255) default NULL, 
1238
  PRIMARY KEY  (`frameworkcode`,`tagfield`,`tagsubfield`),
1240
  PRIMARY KEY  (`frameworkcode`,`tagfield`,`tagsubfield`),
1239
  KEY `kohafield_2` (`kohafield`),
1241
  KEY `kohafield_2` (`kohafield`),
1240
  KEY `tab` (`frameworkcode`,`tab`),
1242
  KEY `tab` (`frameworkcode`,`tab`),
(-)a/installer/data/mysql/updatedatabase.pl (+9 lines)
Lines 6339-6344 if ( CheckVersion($DBversion) ) { Link Here
6339
   SetVersion ($DBversion);
6339
   SetVersion ($DBversion);
6340
}
6340
}
6341
6341
6342
$DBversion = "3.11.00.XXX";
6343
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6344
   $dbh->do("
6345
       ALTER TABLE `marc_subfield_structure` ADD `punctuation` VARCHAR( 5 ) NULL , ADD `help` VARCHAR( 255 ) NULL;
6346
       ");
6347
    print "Upgrade to $DBversion done (Punctuation and cataloguing help)\n";
6348
    SetVersion($DBversion);
6349
}
6350
6342
=head1 FUNCTIONS
6351
=head1 FUNCTIONS
6343
6352
6344
=head2 TableExists($table)
6353
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css (+5 lines)
Lines 89-94 a.tagnum { Link Here
89
	text-decoration : none;
89
	text-decoration : none;
90
}
90
}
91
91
92
.divsubfieldhelp {
93
       background-color: #F0FFEF; 
94
       border: #EFEFEF 1px solid;
95
}
96
92
.subfield {
97
.subfield {
93
	color : #00698a;
98
	color : #00698a;
94
	float: left;
99
	float: left;
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js (+55 lines)
Lines 110-112 function openWindow(link,name,width,height) { Link Here
110
    height = (typeof height == "undefined")?'400':height;
110
    height = (typeof height == "undefined")?'400':height;
111
    var newin=window.open(link,name,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top');
111
    var newin=window.open(link,name,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top');
112
}
112
}
113
114
/*
115
 * Place punctuation when cataloguing
116
 */
117
118
function trim(s) {
119
  while (s.length>0 && (s[0]==' '||s[0]=='\n')) s=s.substring(1, s.length);
120
  while (s.length>0 && (s[s.length-1]==' '||s[s.length-1]=='\n')) s=s.substring(0, s.length-1);
121
  while (s.search (" ") != -1){
122
       s = s.replace (" ","");
123
       }
124
  return s; 
125
}
126
127
/*
128
 * Place the cursor in a determinate place into a textbox
129
*/
130
131
function placePositionTextbox(elem, myPos) {
132
133
    if(elem != null) {
134
        if(elem.createTextRange) {
135
            var range = elem.createTextRange();
136
            range.move('character', myPos);
137
            range.select();
138
        }
139
        else {
140
            if(elem.selectionStart) {
141
                elem.focus();
142
                elem.setSelectionRange(myPos, myPos);
143
            }
144
            else
145
                elem.focus();
146
        }
147
    }
148
}
149
150
function GetPunctuation(field){
151
       var val = field.value;
152
       if (trim(val) == ""){
153
               field.value = field.getAttribute('punctuation');
154
               placePositionTextbox(field,field.value.length);
155
       }
156
}
157
158
function CheckPunctuation(field){
159
       var val = field.value;
160
       if (val == field.getAttribute('punctuation')){
161
               field.value = "";
162
       }
163
}
164
165
/*
166
 * END - Place punctuation when cataloguing
167
 */
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt (+4 lines)
Lines 110-115 $(document).ready(function() { Link Here
110
				<legend>Advanced constraints:</legend>
110
				<legend>Advanced constraints:</legend>
111
                <ol><li><label for="defaultvalue[% loo.row %]">Default value:</label>
111
                <ol><li><label for="defaultvalue[% loo.row %]">Default value:</label>
112
                    <input type="text" name="defaultvalue" id="defaultvalue[% loo.row %]" value="[% loo.defaultvalue %]" /></li>
112
                    <input type="text" name="defaultvalue" id="defaultvalue[% loo.row %]" value="[% loo.defaultvalue %]" /></li>
113
                    <li><label for="punctuation[% loo.row %]">Punctuation:</label>
114
                        <input type="text" name="punctuation" id="punctuation[% loo.row %]" value="[% loo.punctuation %]" /></li>
115
                    <li><label for="help[% loo.row %]">Help:</label><br/>
116
                       <textarea type="text" name="help" id="help[% loo.row %]" cols="40">[% loo.help %]</textarea></li>
113
				<li><label for="maxlength[% loo.row %]">Max length:</label><input type="text" id="maxlength[% loo.row %]" name="maxlength" value="[% loo.maxlength %]" size="4" /> (see online help)</li>
117
				<li><label for="maxlength[% loo.row %]">Max length:</label><input type="text" id="maxlength[% loo.row %]" name="maxlength" value="[% loo.maxlength %]" size="4" /> (see online help)</li>
114
                <li><label for="hidden[% loo.row %]">hidden</label><input type="text" id="hidden[% loo.row %]" name="hidden" value="[% loo.hidden %]" size="2" /> (see online help)</li>
118
                <li><label for="hidden[% loo.row %]">hidden</label><input type="text" id="hidden[% loo.row %]" name="hidden" value="[% loo.hidden %]" size="2" /> (see online help)</li>
115
                <li><label for="isurl[% loo.row %]">Is a URL:</label>[% loo.isurl %] (if checked, it means that the subfield is a URL and can be clicked)</li>
119
                <li><label for="isurl[% loo.row %]">Is a URL:</label>[% loo.isurl %] (if checked, it means that the subfield is a URL and can be clicked)</li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (-2 / +24 lines)
Lines 11-17 Link Here
11
        $('#addbibliotabs').tabs().bind('show.ui-tabs', function(e, ui) {
11
        $('#addbibliotabs').tabs().bind('show.ui-tabs', function(e, ui) {
12
			$("#"+ui.panel.id+" input:eq(0)").focus();
12
			$("#"+ui.panel.id+" input:eq(0)").focus();
13
		});
13
		});
14
14
        $('.tag').each(function() {
15
            var field_id = this.getAttribute('id').substring(0, 7);
16
            if (field_id in fields_in_use) {
17
                fields_in_use[field_id]++;
18
            } else {
19
                fields_in_use[field_id] = 1;
20
            }
21
        });
22
	    $("a.showhelp").click(function(){
23
	       $("#"+$(this).attr("href").replace("#","")).toggle();
24
	           if($(this).html() == "Show help"){
25
	               $(this).html("Hide help");
26
	           } else {
27
	               $(this).html("Show help");
28
	           }
29
	     });
30
        $('.subfield_line').each(function() {
31
            var field_id = this.getAttribute('id').substring(0, 12);
32
            if (field_id in fields_in_use) {
33
                fields_in_use[field_id]++;
34
            } else {
35
                fields_in_use[field_id] = 1;
36
            }
37
        });
15
		/* check cookie to hide/show marcdocs*/
38
		/* check cookie to hide/show marcdocs*/
16
		if($.cookie("marcdocs_[% borrowernumber %]") == 'false'){
39
		if($.cookie("marcdocs_[% borrowernumber %]") == 'false'){
17
			hideMARCdocLinks();
40
			hideMARCdocLinks();
18
- 

Return to bug 6138