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

(-)a/C4/Biblio.pm (-2 / +6 lines)
Lines 1082-1088 sub GetMarcStructure { Link Here
1082
    }
1082
    }
1083
1083
1084
    $sth = $dbh->prepare(
1084
    $sth = $dbh->prepare(
1085
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength
1085
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength,punctuation,help
1086
         FROM   marc_subfield_structure 
1086
         FROM   marc_subfield_structure 
1087
         WHERE  frameworkcode=? 
1087
         WHERE  frameworkcode=? 
1088
         ORDER BY tagfield,tagsubfield
1088
         ORDER BY tagfield,tagsubfield
Lines 1102-1112 sub GetMarcStructure { Link Here
1102
    my $link;
1102
    my $link;
1103
    my $defaultvalue;
1103
    my $defaultvalue;
1104
    my $maxlength;
1104
    my $maxlength;
1105
    my $punctuation;
1106
    my $help;
1105
1107
1106
    while (
1108
    while (
1107
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
1109
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
1108
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
1110
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
1109
            $maxlength
1111
            $maxlength,    $punctuation,   $help
1110
        )
1112
        )
1111
        = $sth->fetchrow
1113
        = $sth->fetchrow
1112
      ) {
1114
      ) {
Lines 1124-1129 sub GetMarcStructure { Link Here
1124
        $res->{$tag}->{$subfield}->{'link'}           = $link;
1126
        $res->{$tag}->{$subfield}->{'link'}           = $link;
1125
        $res->{$tag}->{$subfield}->{defaultvalue}     = $defaultvalue;
1127
        $res->{$tag}->{$subfield}->{defaultvalue}     = $defaultvalue;
1126
        $res->{$tag}->{$subfield}->{maxlength}        = $maxlength;
1128
        $res->{$tag}->{$subfield}->{maxlength}        = $maxlength;
1129
        $res->{$tag}->{$subfield}->{punctuation}      = $punctuation;
1130
        $res->{$tag}->{$subfield}->{help}             = $help;
1127
    }
1131
    }
1128
1132
1129
    $marc_structure_cache->{$forlibrarian}->{$frameworkcode} = $res;
1133
    $marc_structure_cache->{$forlibrarian}->{$frameworkcode} = $res;
(-)a/admin/marc_subfields_structure.pl (-3 / +13 lines)
Lines 180-185 if ( $op eq 'add_form' ) { Link Here
180
        my %row_data;    # get a fresh hash for the row data
180
        my %row_data;    # get a fresh hash for the row data
181
        $row_data{defaultvalue} = $data->{defaultvalue};
181
        $row_data{defaultvalue} = $data->{defaultvalue};
182
        $row_data{maxlength} = $data->{maxlength};
182
        $row_data{maxlength} = $data->{maxlength};
183
        $row_data{punctuation} = $data->{'punctuation'};
184
        $row_data{help}        = CGI::escapeHTML( $data->{'help'} );
183
        $row_data{tab} = CGI::scrolling_list(
185
        $row_data{tab} = CGI::scrolling_list(
184
            -name   => 'tab',
186
            -name   => 'tab',
185
            -id     => "tab$i",
187
            -id     => "tab$i",
Lines 386-396 elsif ( $op eq 'add_validate' ) { Link Here
386
#                                     values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
388
#                                     values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
387
#     );
389
#     );
388
    my $sth_insert = $dbh->prepare(qq{
390
    my $sth_insert = $dbh->prepare(qq{
389
        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)
391
        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)
390
        values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
392
        values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
391
    });
393
    });
392
    my $sth_update = $dbh->prepare(qq{
394
    my $sth_update = $dbh->prepare(qq{
393
        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=?
395
        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=?
394
        where tagfield=? and tagsubfield=? and frameworkcode=?
396
        where tagfield=? and tagsubfield=? and frameworkcode=?
395
    });
397
    });
396
    my @tagsubfield       = $input->param('tagsubfield');
398
    my @tagsubfield       = $input->param('tagsubfield');
Lines 406-411 elsif ( $op eq 'add_validate' ) { Link Here
406
    my @link              = $input->param('link');
408
    my @link              = $input->param('link');
407
    my @defaultvalue      = $input->param('defaultvalue');
409
    my @defaultvalue      = $input->param('defaultvalue');
408
    my @maxlength         = $input->param('maxlength');
410
    my @maxlength         = $input->param('maxlength');
411
    my @punctuation       = $input->param('punctuation');
412
    my @help              = $input->param('help');
409
    
413
    
410
    for ( my $i = 0 ; $i <= $#tagsubfield ; $i++ ) {
414
    for ( my $i = 0 ; $i <= $#tagsubfield ; $i++ ) {
411
        my $tagfield    = $input->param('tagfield');
415
        my $tagfield    = $input->param('tagfield');
Lines 427-432 elsif ( $op eq 'add_validate' ) { Link Here
427
        my $link   = $link[$i];
431
        my $link   = $link[$i];
428
        my $defaultvalue = $defaultvalue[$i];
432
        my $defaultvalue = $defaultvalue[$i];
429
        my $maxlength = $maxlength[$i];
433
        my $maxlength = $maxlength[$i];
434
        my $punctuation      = $punctuation[$i];
435
        my $help             = $help[$i];
430
        
436
        
431
        if (defined($liblibrarian) && $liblibrarian ne "") {
437
        if (defined($liblibrarian) && $liblibrarian ne "") {
432
            unless ( C4::Context->config('demo') eq 1 ) {
438
            unless ( C4::Context->config('demo') eq 1 ) {
Lines 450-455 elsif ( $op eq 'add_validate' ) { Link Here
450
                        $link,
456
                        $link,
451
                        $defaultvalue,
457
                        $defaultvalue,
452
                        $maxlength,
458
                        $maxlength,
459
                        $punctuation,
460
                        $help,
453
                        (
461
                        (
454
                            $tagfield,
462
                            $tagfield,
455
                            $tagsubfield,
463
                            $tagsubfield,
Lines 476-481 elsif ( $op eq 'add_validate' ) { Link Here
476
                        $link,
484
                        $link,
477
                        $defaultvalue,
485
                        $defaultvalue,
478
                        $maxlength,
486
                        $maxlength,
487
                        $punctuation,
488
                        $help,
479
                    );
489
                    );
480
                }
490
                }
481
            }
491
            }
(-)a/cataloguing/addbiblio.pl (+11 lines)
Lines 328-333 sub create_input { Link Here
328
        id             => "tag_".$tag."_subfield_".$id_subfield."_".$index_tag."_".$index_subfield,
328
        id             => "tag_".$tag."_subfield_".$id_subfield."_".$index_tag."_".$index_subfield,
329
        value          => $value,
329
        value          => $value,
330
        maxlength      => $tagslib->{$tag}->{$subfield}->{maxlength},
330
        maxlength      => $tagslib->{$tag}->{$subfield}->{maxlength},
331
        punctuation    => $tagslib->{$tag}->{$subfield}->{punctuation},
332
        help           => $tagslib->{$tag}->{$subfield}->{help},
331
        random         => CreateKey(),
333
        random         => CreateKey(),
332
    );
334
    );
333
335
Lines 489-499 sub create_input { Link Here
489
                        name=\"".$subfield_data{id}."\"
491
                        name=\"".$subfield_data{id}."\"
490
                        value=\"$value\"
492
                        value=\"$value\"
491
                        tabindex=\"1\"
493
                        tabindex=\"1\"
494
                        punctuation=\"".$subfield_data{punctuation}."\"
492
                        size=\"67\"
495
                        size=\"67\"
493
                        maxlength=\"".$subfield_data{maxlength}."\"
496
                        maxlength=\"".$subfield_data{maxlength}."\"
494
                        class=\"input_marceditor\"
497
                        class=\"input_marceditor\"
498
                        onfocus=\"javascript:GetPunctuation(this);\"
499
                        onblur=\"javascript:CheckPunctuation(this);\"
495
                \/>
500
                \/>
496
                ";
501
                ";
502
                if ($subfield_data{help}){
503
                   $subfield_data{marc_value} .= "
504
                   &nbsp;<a class=\"showhelp\" href=\"#help_" . $subfield_data{id} . "\">Show help</a>
505
                   <div class=\"divsubfieldhelp\" id=\"help_" . $subfield_data{id} . "\" style=\"display:none; clear: both\">&nbsp;<i>" . $subfield_data{help} . "</i></div>
506
                   ";
507
               }
497
        }
508
        }
498
    }
509
    }
499
    $subfield_data{'index_subfield'} = $index_subfield;
510
    $subfield_data{'index_subfield'} = $index_subfield;
(-)a/installer/data/mysql/kohastructure.sql (+2 lines)
Lines 1213-1218 CREATE TABLE `marc_subfield_structure` ( Link Here
1213
  `link` varchar(80) default NULL,
1213
  `link` varchar(80) default NULL,
1214
  `defaultvalue` text default NULL,
1214
  `defaultvalue` text default NULL,
1215
  `maxlength` int(4) NOT NULL DEFAULT '9999',
1215
  `maxlength` int(4) NOT NULL DEFAULT '9999',
1216
  `punctuation` varchar(5) default NULL,
1217
  `help` varchar(255) default NULL, 
1216
  PRIMARY KEY  (`frameworkcode`,`tagfield`,`tagsubfield`),
1218
  PRIMARY KEY  (`frameworkcode`,`tagfield`,`tagsubfield`),
1217
  KEY `kohafield_2` (`kohafield`),
1219
  KEY `kohafield_2` (`kohafield`),
1218
  KEY `tab` (`frameworkcode`,`tab`),
1220
  KEY `tab` (`frameworkcode`,`tab`),
(-)a/installer/data/mysql/updatedatabase.pl (+9 lines)
Lines 5392-5397 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
5392
    SetVersion ($DBversion);
5392
    SetVersion ($DBversion);
5393
}
5393
}
5394
5394
5395
$DBversion = "3.09.00.XXX";
5396
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5397
   $dbh->do("
5398
       ALTER TABLE `marc_subfield_structure` ADD `punctuation` VARCHAR( 5 ) NULL , ADD `help` VARCHAR( 255 ) NULL;
5399
       ");
5400
    print "Upgrade to $DBversion done (Punctuation and cataloguing help)\n";
5401
    SetVersion($DBversion);
5402
}
5403
5395
=head1 FUNCTIONS
5404
=head1 FUNCTIONS
5396
5405
5397
=head2 TableExists($table)
5406
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css (+5 lines)
Lines 83-88 a.tagnum { Link Here
83
	text-decoration : none;
83
	text-decoration : none;
84
}
84
}
85
85
86
.divsubfieldhelp {
87
       background-color: #F0FFEF; 
88
       border: #EFEFEF 1px solid;
89
}
90
86
.subfield {
91
.subfield {
87
	color : #00698a;
92
	color : #00698a;
88
	float: left;
93
	float: left;
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js (+55 lines)
Lines 109-111 function openWindow(link,name,width,height) { Link Here
109
    height = (typeof height == "undefined")?'400':height;
109
    height = (typeof height == "undefined")?'400':height;
110
    var newin=window.open(link,name,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top');
110
    var newin=window.open(link,name,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top');
111
}
111
}
112
113
/*
114
 * Place punctuation when cataloguing
115
 */
116
117
function trim(s) {
118
  while (s.length>0 && (s[0]==' '||s[0]=='\n')) s=s.substring(1, s.length);
119
  while (s.length>0 && (s[s.length-1]==' '||s[s.length-1]=='\n')) s=s.substring(0, s.length-1);
120
  while (s.search (" ") != -1){
121
       s = s.replace (" ","");
122
       }
123
  return s; 
124
}
125
126
/*
127
 * Place the cursor in a determinate place into a textbox
128
*/
129
130
function placePositionTextbox(elem, myPos) {
131
132
    if(elem != null) {
133
        if(elem.createTextRange) {
134
            var range = elem.createTextRange();
135
            range.move('character', myPos);
136
            range.select();
137
        }
138
        else {
139
            if(elem.selectionStart) {
140
                elem.focus();
141
                elem.setSelectionRange(myPos, myPos);
142
            }
143
            else
144
                elem.focus();
145
        }
146
    }
147
}
148
149
function GetPunctuation(field){
150
       var val = field.value;
151
       if (trim(val) == ""){
152
               field.value = field.getAttribute('punctuation');
153
               placePositionTextbox(field,field.value.length);
154
       }
155
}
156
157
function CheckPunctuation(field){
158
       var val = field.value;
159
       if (val == field.getAttribute('punctuation')){
160
               field.value = "";
161
       }
162
}
163
164
/*
165
 * END - Place punctuation when cataloguing
166
 */
(-)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 (-1 / +8 lines)
Lines 19-24 Link Here
19
                fields_in_use[field_id] = 1;
19
                fields_in_use[field_id] = 1;
20
            }
20
            }
21
        });
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
	     });
22
        $('.subfield_line').each(function() {
30
        $('.subfield_line').each(function() {
23
            var field_id = this.getAttribute('id').substring(0, 12);
31
            var field_id = this.getAttribute('id').substring(0, 12);
24
            if (field_id in fields_in_use) {
32
            if (field_id in fields_in_use) {
25
- 

Return to bug 6138