Bugzilla – Attachment 3828 Details for
Bug 6138
Show local help and isbd punctuation automatically when we are cataloguing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
punctuation-help-cataloguing.patch (text/plain), 14.05 KB, created by
Juan Romay Sieira
on 2011-04-08 09:25:20 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Juan Romay Sieira
Created:
2011-04-08 09:25:20 UTC
Size:
14.05 KB
patch
obsolete
>From 983782c3ebbe823542deab15bd5ae1f3670257f2 Mon Sep 17 00:00:00 2001 >From: Juan Romay Sieira <juan.sieira@xercode.es> >Date: Fri, 8 Apr 2011 11:02:55 +0200 >Subject: [PATCH] Show local help and isbd punctuation when we are cataloguing. >Content-Type: text/plain; charset="utf-8" > >--- > C4/Biblio.pm | 9 +++- > admin/marc_subfields_structure.pl | 16 +++++- > cataloguing/addbiblio.pl | 11 ++++ > installer/data/mysql/kohastructure.sql | 2 + > installer/data/mysql/updatedatabase.pl | 9 +++ > koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css | 7 ++- > koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js | 55 ++++++++++++++++++++ > .../en/modules/admin/marc_subfields_structure.tmpl | 2 + > .../prog/en/modules/cataloguing/addbiblio.tmpl | 8 +++ > 9 files changed, 113 insertions(+), 6 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 135dd91..ccbb804 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -952,7 +952,7 @@ sub GetMarcStructure { > } > > $sth = $dbh->prepare( >- "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue >+ "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,punctuation,help > FROM marc_subfield_structure > WHERE frameworkcode=? > ORDER BY tagfield,tagsubfield >@@ -971,10 +971,13 @@ sub GetMarcStructure { > my $isurl; > my $link; > my $defaultvalue; >+ my $punctuation; >+ my $help; > > while ( > ( $tag, $subfield, $liblibrarian, $libopac, $tab, $mandatory, $repeatable, $authorised_value, >- $authtypecode, $value_builder, $kohafield, $seealso, $hidden, $isurl, $link, $defaultvalue >+ $authtypecode, $value_builder, $kohafield, $seealso, $hidden, $isurl, $link, $defaultvalue, >+ $punctuation, $help > ) > = $sth->fetchrow > ) { >@@ -991,6 +994,8 @@ sub GetMarcStructure { > $res->{$tag}->{$subfield}->{isurl} = $isurl; > $res->{$tag}->{$subfield}->{'link'} = $link; > $res->{$tag}->{$subfield}->{defaultvalue} = $defaultvalue; >+ $res->{$tag}->{$subfield}->{punctuation} = $punctuation; >+ $res->{$tag}->{$subfield}->{help} = $help; > } > > $marc_structure_cache->{$forlibrarian}->{$frameworkcode} = $res; >diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl >index 0049376..184292a 100755 >--- a/admin/marc_subfields_structure.pl >+++ b/admin/marc_subfields_structure.pl >@@ -179,6 +179,8 @@ if ( $op eq 'add_form' ) { > while ( $data = $sth->fetchrow_hashref ) { > my %row_data; # get a fresh hash for the row data > $row_data{defaultvalue} = $data->{defaultvalue}; >+ $row_data{punctuation} = $data->{'punctuation'}; >++ $row_data{help} = CGI::escapeHTML( $data->{'help'} ); > $row_data{tab} = CGI::scrolling_list( > -name => 'tab', > -id => "tab$i", >@@ -386,11 +388,11 @@ elsif ( $op eq 'add_validate' ) { > # values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" > # ); > my $sth_insert = $dbh->prepare(qq{ >- insert into marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,authtypecode,value_builder,hidden,isurl,frameworkcode, link,defaultvalue) >- values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) >+ 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) >+ values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) > }); > my $sth_update = $dbh->prepare(qq{ >- update marc_subfield_structure set tagfield=?, tagsubfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, kohafield=?, tab=?, seealso=?, authorised_value=?, authtypecode=?, value_builder=?, hidden=?, isurl=?, frameworkcode=?, link=?, defaultvalue=? >+ 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=? > where tagfield=? and tagsubfield=? and frameworkcode=? > }); > my @tagsubfield = $input->param('tagsubfield'); >@@ -405,6 +407,8 @@ elsif ( $op eq 'add_validate' ) { > my @value_builder = $input->param('value_builder'); > my @link = $input->param('link'); > my @defaultvalue = $input->param('defaultvalue'); >+ my @punctuation = $input->param('punctuation'); >+ my @help = $input->param('help'); > > for ( my $i = 0 ; $i <= $#tagsubfield ; $i++ ) { > my $tagfield = $input->param('tagfield'); >@@ -425,6 +429,8 @@ elsif ( $op eq 'add_validate' ) { > my $isurl = $input->param("isurl$i") ? 1 : 0; > my $link = $link[$i]; > my $defaultvalue = $defaultvalue[$i]; >+ my $punctuation = $punctuation[$i]; >+ my $help = $help[$i]; > > if ($liblibrarian) { > unless ( C4::Context->config('demo') eq 1 ) { >@@ -447,6 +453,8 @@ elsif ( $op eq 'add_validate' ) { > $frameworkcode, > $link, > $defaultvalue, >+ $punctuation, >+ $help, > ( > $tagfield, > $tagsubfield, >@@ -472,6 +480,8 @@ elsif ( $op eq 'add_validate' ) { > $frameworkcode, > $link, > $defaultvalue, >+ $punctuation, >+ $help > ); > } > } >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index d2a3841..56b1418 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -332,6 +332,8 @@ sub create_input { > mandatory => $tagslib->{$tag}->{$subfield}->{mandatory}, > repeatable => $tagslib->{$tag}->{$subfield}->{repeatable}, > kohafield => $tagslib->{$tag}->{$subfield}->{kohafield}, >+ punctuation => $tagslib->{$tag}->{$subfield}->{punctuation}, >+ help => $tagslib->{$tag}->{$subfield}->{help}, > index => $index_tag, > id => "tag_".$tag."_subfield_".$id_subfield."_".$index_tag."_".$index_subfield, > value => $value, >@@ -508,8 +510,17 @@ sub create_input { > size=\"67\" > maxlength=\"$max_length\" > class=\"input_marceditor\" >+ punctuation=\"".$subfield_data{punctuation}."\" >+ onfocus=\"javascript:GetPunctuation(this);\" >+ onblur=\"javascript:CheckPunctuation(this);\" > \/> > "; >+ if ($subfield_data{help}){ >+ $subfield_data{marc_value} .= " >+ <a class=\"showhelp\" href=\"#help_" . $subfield_data{id} . "\">Show help</a> >+ <div class=\"divsubfieldhelp\" id=\"help_" . $subfield_data{id} . "\" style=\"display:none; clear: both\"> <i>" . $subfield_data{help} . "</i></div> >+ "; >+ } > } > } > $subfield_data{'index_subfield'} = $index_subfield; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 28dd5a6..b722411 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1180,6 +1180,8 @@ CREATE TABLE `marc_subfield_structure` ( > `seealso` varchar(1100) default NULL, > `link` varchar(80) default NULL, > `defaultvalue` text default NULL, >+ `punctuation` varchar(5) default NULL, >+ `help` varchar(255) default NULL, > PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`), > KEY `kohafield_2` (`kohafield`), > KEY `tab` (`frameworkcode`,`tab`), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 7f76078..648e35b 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4259,6 +4259,15 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.03.00.047"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do(" >+ ALTER TABLE `marc_subfield_structure` ADD `punctuation` VARCHAR( 5 ) NULL , ADD `help` VARCHAR( 255 ) NULL; >+ "); >+ print "Upgrade to $DBversion done (Punctuation and cataloguing help)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css b/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css >index 26a8066..51544f5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css >+++ b/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css >@@ -133,4 +133,9 @@ a.tagnum { > .linktools a:first-child { border-bottom: 1px solid #DDD; } > .linktools a:hover { background-color: #FFC; } > .subfield_controls { margin : 0 .5em; } >-.readonly { border-width : 1px; border-style: inset; padding-left : 15px; background: #EEE url(../../img/locked.png) center left no-repeat; width:29em; } >\ No newline at end of file >+.readonly { border-width : 1px; border-style: inset; padding-left : 15px; background: #EEE url(../../img/locked.png) center left no-repeat; width:29em; } >+ >+.divsubfieldhelp { >+ background-color: #F0FFEF; >+ border: #EFEFEF 1px solid; >+} >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js >index 463c28e..a93f88a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js >@@ -89,3 +89,58 @@ function checkEnter(e){ //e is event object passed from function invocation > return true; > } > } >+ >+/* >+ * Place punctuation when cataloguing >+ */ >+ >+function trim(s) { >+ while (s.length>0 && (s[0]==' '||s[0]=='\n')) s=s.substring(1, s.length); >+ while (s.length>0 && (s[s.length-1]==' '||s[s.length-1]=='\n')) s=s.substring(0, s.length-1); >+ while (s.search (" ") != -1){ >+ s = s.replace (" ",""); >+ } >+ return s; >+} >+ >+/* >+ Place the cursor in a determinate place into a textbox >+*/ >+ >+function placePositionTextbox(elem, myPos) { >+ >+ if(elem != null) { >+ if(elem.createTextRange) { >+ var range = elem.createTextRange(); >+ range.move('character', myPos); >+ range.select(); >+ } >+ else { >+ if(elem.selectionStart) { >+ elem.focus(); >+ elem.setSelectionRange(myPos, myPos); >+ } >+ else >+ elem.focus(); >+ } >+ } >+} >+ >+function GetPunctuation(field){ >+ var val = field.value; >+ if (trim(val) == ""){ >+ field.value = field.getAttribute('punctuation'); >+ placePositionTextbox(field,field.value.length); >+ } >+} >+ >+function CheckPunctuation(field){ >+ var val = field.value; >+ if (val == field.getAttribute('punctuation')){ >+ field.value = ""; >+ } >+} >+ >+/* >+ * END - Place punctuation when cataloguing >+ */ >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tmpl >index 671d3c9..de750ae 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tmpl >@@ -108,6 +108,8 @@ > <legend>Advanced constraints:</legend> > <ol><li><label for="defaultvalue<!-- TMPL_VAR NAME="row" -->">Default value:</label> > <input type="text" name="defaultvalue" id="defaultvalue<!-- TMPL_VAR NAME="row" -->" value="<!-- TMPL_VAR NAME="defaultvalue" -->" /></li> >+ <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> >+ <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> > <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> > <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> > <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> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl >index ba59280..a7a7d26 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl >@@ -26,6 +26,14 @@ > fields_in_use[field_id] = 1; > } > }); >+ $("a.showhelp").click(function(){ >+ $("#"+$(this).attr("href").replace("#","")).toggle(); >+ if($(this).html() == "Show help"){ >+ $(this).html("Hide help"); >+ } else { >+ $(this).html("Show help"); >+ } >+ }); > }); > > $('#header_search > ul').tabs().bind('show.ui-tabs', function(e, ui) { $('#header_search > div:not(.ui-tabs-hide)').find('input').eq(0).focus(); }); >-- >1.7.4.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6138
:
3828
|
4632
|
7536
|
10404
|
14354