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

(-)a/C4/Biblio.pm (-2 / +7 lines)
Lines 952-958 sub GetMarcStructure { Link Here
952
    }
952
    }
953
953
954
    $sth = $dbh->prepare(
954
    $sth = $dbh->prepare(
955
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue 
955
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,punctuation,help 
956
         FROM   marc_subfield_structure 
956
         FROM   marc_subfield_structure 
957
         WHERE  frameworkcode=? 
957
         WHERE  frameworkcode=? 
958
         ORDER BY tagfield,tagsubfield
958
         ORDER BY tagfield,tagsubfield
Lines 971-980 sub GetMarcStructure { Link Here
971
    my $isurl;
971
    my $isurl;
972
    my $link;
972
    my $link;
973
    my $defaultvalue;
973
    my $defaultvalue;
974
    my $punctuation;
975
    my $help;
974
976
975
    while (
977
    while (
976
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
978
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
977
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue
979
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
980
	    $punctuation,  $help
978
        )
981
        )
979
        = $sth->fetchrow
982
        = $sth->fetchrow
980
      ) {
983
      ) {
Lines 991-996 sub GetMarcStructure { Link Here
991
        $res->{$tag}->{$subfield}->{isurl}            = $isurl;
994
        $res->{$tag}->{$subfield}->{isurl}            = $isurl;
992
        $res->{$tag}->{$subfield}->{'link'}           = $link;
995
        $res->{$tag}->{$subfield}->{'link'}           = $link;
993
        $res->{$tag}->{$subfield}->{defaultvalue}     = $defaultvalue;
996
        $res->{$tag}->{$subfield}->{defaultvalue}     = $defaultvalue;
997
        $res->{$tag}->{$subfield}->{punctuation}      = $punctuation;
998
        $res->{$tag}->{$subfield}->{help}	      = $help;
994
    }
999
    }
995
1000
996
    $marc_structure_cache->{$forlibrarian}->{$frameworkcode} = $res;
1001
    $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
    while ( $data = $sth->fetchrow_hashref ) {
179
    while ( $data = $sth->fetchrow_hashref ) {
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{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 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)
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,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=?
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=?, 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 405-410 elsif ( $op eq 'add_validate' ) { Link Here
405
    my @value_builder     = $input->param('value_builder');
407
    my @value_builder     = $input->param('value_builder');
406
    my @link              = $input->param('link');
408
    my @link              = $input->param('link');
407
    my @defaultvalue      = $input->param('defaultvalue');
409
    my @defaultvalue      = $input->param('defaultvalue');
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 425-430 elsif ( $op eq 'add_validate' ) { Link Here
425
        my $isurl  = $input->param("isurl$i") ? 1 : 0;
429
        my $isurl  = $input->param("isurl$i") ? 1 : 0;
426
        my $link   = $link[$i];
430
        my $link   = $link[$i];
427
        my $defaultvalue = $defaultvalue[$i];
431
        my $defaultvalue = $defaultvalue[$i];
432
	my $punctuation	= $punctuation[$i];
433
	my $help	= $help[$i];
428
        
434
        
429
        if ($liblibrarian) {
435
        if ($liblibrarian) {
430
            unless ( C4::Context->config('demo') eq 1 ) {
436
            unless ( C4::Context->config('demo') eq 1 ) {
Lines 447-452 elsif ( $op eq 'add_validate' ) { Link Here
447
                        $frameworkcode,
453
                        $frameworkcode,
448
                        $link,
454
                        $link,
449
                        $defaultvalue,
455
                        $defaultvalue,
456
			$punctuation,
457
			$help,
450
                        (
458
                        (
451
                            $tagfield,
459
                            $tagfield,
452
                            $tagsubfield,
460
                            $tagsubfield,
Lines 472-477 elsif ( $op eq 'add_validate' ) { Link Here
472
                        $frameworkcode,
480
                        $frameworkcode,
473
                        $link,
481
                        $link,
474
                        $defaultvalue,
482
                        $defaultvalue,
483
			$punctuation,
484
			$help
475
                    );
485
                    );
476
                }
486
                }
477
            }
487
            }
(-)a/cataloguing/addbiblio.pl (+11 lines)
Lines 332-337 sub create_input { Link Here
332
        mandatory      => $tagslib->{$tag}->{$subfield}->{mandatory},
332
        mandatory      => $tagslib->{$tag}->{$subfield}->{mandatory},
333
        repeatable     => $tagslib->{$tag}->{$subfield}->{repeatable},
333
        repeatable     => $tagslib->{$tag}->{$subfield}->{repeatable},
334
        kohafield      => $tagslib->{$tag}->{$subfield}->{kohafield},
334
        kohafield      => $tagslib->{$tag}->{$subfield}->{kohafield},
335
	punctuation    => $tagslib->{$tag}->{$subfield}->{punctuation},
336
	help           => $tagslib->{$tag}->{$subfield}->{help},
335
        index          => $index_tag,
337
        index          => $index_tag,
336
        id             => "tag_".$tag."_subfield_".$id_subfield."_".$index_tag."_".$index_subfield,
338
        id             => "tag_".$tag."_subfield_".$id_subfield."_".$index_tag."_".$index_subfield,
337
        value          => $value,
339
        value          => $value,
Lines 508-515 sub create_input { Link Here
508
                        size=\"67\"
510
                        size=\"67\"
509
                        maxlength=\"$max_length\"
511
                        maxlength=\"$max_length\"
510
                        class=\"input_marceditor\"
512
                        class=\"input_marceditor\"
513
			punctuation=\"".$subfield_data{punctuation}."\"
514
			onfocus=\"javascript:GetPunctuation(this);\"
515
			onblur=\"javascript:CheckPunctuation(this);\"
511
                \/>
516
                \/>
512
                ";
517
                ";
518
	      if ($subfield_data{help}){
519
		  $subfield_data{marc_value} .= "
520
		  &nbsp;<a class=\"showhelp\" href=\"#help_" . $subfield_data{id} . "\">Show help</a>
521
		  <div class=\"divsubfieldhelp\" id=\"help_" . $subfield_data{id} . "\" style=\"display:none; clear: both\">&nbsp;<i>" . $subfield_data{help} . "</i></div>
522
		  ";
523
	      }
513
        }
524
        }
514
    }
525
    }
515
    $subfield_data{'index_subfield'} = $index_subfield;
526
    $subfield_data{'index_subfield'} = $index_subfield;
(-)a/installer/data/mysql/kohastructure.sql (+2 lines)
Lines 1180-1185 CREATE TABLE `marc_subfield_structure` ( Link Here
1180
  `seealso` varchar(1100) default NULL,
1180
  `seealso` varchar(1100) default NULL,
1181
  `link` varchar(80) default NULL,
1181
  `link` varchar(80) default NULL,
1182
  `defaultvalue` text default NULL,
1182
  `defaultvalue` text default NULL,
1183
  `punctuation` varchar(5) default NULL,
1184
  `help` varchar(255) default NULL,
1183
  PRIMARY KEY  (`frameworkcode`,`tagfield`,`tagsubfield`),
1185
  PRIMARY KEY  (`frameworkcode`,`tagfield`,`tagsubfield`),
1184
  KEY `kohafield_2` (`kohafield`),
1186
  KEY `kohafield_2` (`kohafield`),
1185
  KEY `tab` (`frameworkcode`,`tab`),
1187
  KEY `tab` (`frameworkcode`,`tab`),
(-)a/installer/data/mysql/updatedatabase.pl (+9 lines)
Lines 4259-4264 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4259
    SetVersion($DBversion);
4259
    SetVersion($DBversion);
4260
}
4260
}
4261
4261
4262
$DBversion = "3.03.00.047";
4263
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4264
    $dbh->do("
4265
	ALTER TABLE `marc_subfield_structure` ADD `punctuation` VARCHAR( 5 ) NULL , ADD `help` VARCHAR( 255 ) NULL;
4266
    ");
4267
    print "Upgrade to $DBversion done (Punctuation and cataloguing help)\n";
4268
    SetVersion($DBversion);
4269
}
4270
4262
=head1 FUNCTIONS
4271
=head1 FUNCTIONS
4263
4272
4264
=head2 DropAllForeignKeys($table)
4273
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css (-1 / +6 lines)
Lines 133-136 a.tagnum { Link Here
133
.linktools a:first-child { border-bottom: 1px solid #DDD; }
133
.linktools a:first-child { border-bottom: 1px solid #DDD; }
134
.linktools a:hover { background-color: #FFC; }
134
.linktools a:hover { background-color: #FFC; }
135
.subfield_controls { margin : 0 .5em; }
135
.subfield_controls { margin : 0 .5em; }
136
.readonly { border-width : 1px; border-style: inset; padding-left : 15px; background: #EEE url(../../img/locked.png) center left no-repeat; width:29em; }
136
.readonly { border-width : 1px; border-style: inset; padding-left : 15px; background: #EEE url(../../img/locked.png) center left no-repeat; width:29em; }
137
138
.divsubfieldhelp {
139
	background-color: #F0FFEF; 
140
	border: #EFEFEF 1px solid;
141
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js (+55 lines)
Lines 89-91 function checkEnter(e){ //e is event object passed from function invocation Link Here
89
		return true;
89
		return true;
90
	}
90
	}
91
}
91
}
92
93
/*
94
 * Place punctuation when cataloguing
95
 */
96
97
function trim(s) {
98
  while (s.length>0 && (s[0]==' '||s[0]=='\n')) s=s.substring(1, s.length);
99
  while (s.length>0 && (s[s.length-1]==' '||s[s.length-1]=='\n')) s=s.substring(0, s.length-1);
100
  while (s.search (" ") != -1){
101
        s = s.replace (" ","");
102
        }
103
  return s;
104
}
105
106
/*
107
        Place the cursor in a determinate place into a textbox
108
*/
109
110
function placePositionTextbox(elem, myPos) {
111
112
    if(elem != null) {
113
        if(elem.createTextRange) {
114
            var range = elem.createTextRange();
115
            range.move('character', myPos);
116
            range.select();
117
        }
118
        else {
119
            if(elem.selectionStart) {
120
                elem.focus();
121
                elem.setSelectionRange(myPos, myPos);
122
            }
123
            else
124
                elem.focus();
125
        }
126
    }
127
}
128
129
function GetPunctuation(field){
130
        var val = field.value;
131
        if (trim(val) == ""){
132
                field.value = field.getAttribute('punctuation');
133
                placePositionTextbox(field,field.value.length);
134
        }
135
}
136
137
function CheckPunctuation(field){
138
        var val = field.value;
139
        if (val == field.getAttribute('punctuation')){
140
                field.value = "";
141
        }
142
}
143
144
/*
145
 * END - Place punctuation when cataloguing
146
 */
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tmpl (+2 lines)
Lines 108-113 Link Here
108
				<legend>Advanced constraints:</legend>
108
				<legend>Advanced constraints:</legend>
109
                <ol><li><label for="defaultvalue<!-- TMPL_VAR NAME="row" -->">Default value:</label>
109
                <ol><li><label for="defaultvalue<!-- TMPL_VAR NAME="row" -->">Default value:</label>
110
                    <input type="text" name="defaultvalue" id="defaultvalue<!-- TMPL_VAR NAME="row" -->" value="<!-- TMPL_VAR NAME="defaultvalue" -->" /></li>
110
                    <input type="text" name="defaultvalue" id="defaultvalue<!-- TMPL_VAR NAME="row" -->" value="<!-- TMPL_VAR NAME="defaultvalue" -->" /></li>
111
                <li><label for="punctuation<!-- TMPL_VAR NAME="row" -->">Punctuation:</label><input type="text" name="punctuation" id="punctuation<!-- TMPL_VAR NAME="row" -->" value="<!-- TMPL_VAR NAME="punctuation" -->" /></li>
112
                <li><label for="help<!-- TMPL_VAR NAME="row" -->">Help:</label><br/><textarea type="text" name="help" id="help<!-- TMPL_VAR NAME="row" -->" cols="40"><!-- TMPL_VAR NAME="help" --></textarea></li>
111
                <li><label for="hidden<!-- TMPL_VAR NAME="row" -->">hidden</label><input type="text" id="hidden<!-- TMPL_VAR NAME="row" -->" name="hidden" value="<!-- TMPL_VAR name="hidden" -->" size="2" /> (see online help)</li>
113
                <li><label for="hidden<!-- TMPL_VAR NAME="row" -->">hidden</label><input type="text" id="hidden<!-- TMPL_VAR NAME="row" -->" name="hidden" value="<!-- TMPL_VAR name="hidden" -->" size="2" /> (see online help)</li>
112
                <li><label for="isurl<!-- TMPL_VAR NAME="row" -->">Is a URL:</label><!-- TMPL_VAR NAME="isurl" --> (if checked, it means that the subfield is a URL and can be clicked)</li>
114
                <li><label for="isurl<!-- TMPL_VAR NAME="row" -->">Is a URL:</label><!-- TMPL_VAR NAME="isurl" --> (if checked, it means that the subfield is a URL and can be clicked)</li>
113
                <li><label for="link<!-- TMPL_VAR NAME="row" -->">Link:</label><input type="text" id="link<!-- TMPL_VAR NAME="row" -->" name="link" value="<!-- TMPL_VAR NAME="link" -->" size="10" maxlength="80" /> (e.g., Title or Local-Number) <span class="error"><em>NOTE: If you change this value you must ask your administrator to run misc/batchRebuildBiblioTables.pl.</em></span></li>
115
                <li><label for="link<!-- TMPL_VAR NAME="row" -->">Link:</label><input type="text" id="link<!-- TMPL_VAR NAME="row" -->" name="link" value="<!-- TMPL_VAR NAME="link" -->" size="10" maxlength="80" /> (e.g., Title or Local-Number) <span class="error"><em>NOTE: If you change this value you must ask your administrator to run misc/batchRebuildBiblioTables.pl.</em></span></li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl (-1 / +8 lines)
Lines 26-31 Link Here
26
                fields_in_use[field_id] = 1;
26
                fields_in_use[field_id] = 1;
27
            }
27
            }
28
        });
28
        });
29
            $("a.showhelp").click(function(){
30
		$("#"+$(this).attr("href").replace("#","")).toggle();
31
		if($(this).html() == "Show help"){
32
		    $(this).html("Hide help");
33
		} else {
34
		    $(this).html("Show help");
35
		}
36
	    });
29
	 });
37
	 });
30
	 
38
	 
31
	 $('#header_search > ul').tabs().bind('show.ui-tabs', function(e, ui) { $('#header_search > div:not(.ui-tabs-hide)').find('input').eq(0).focus(); });
39
	 $('#header_search > ul').tabs().bind('show.ui-tabs', function(e, ui) { $('#header_search > div:not(.ui-tabs-hide)').find('input').eq(0).focus(); });
32
- 

Return to bug 6138