Koha/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc
Fridolyn SOMERS 0ee3a414e8 Bug 10650 - export merge-record.inc javascript into a file
Bug 9755 added a refactoring of records merge adding the include
merge-record.inc. This include contains a block "mergejs" containing all
JavaScript code that was in merge.tt.
This patch exports this code into a js file.
Translatable strings contained in this file are in
merge-record-strings.inc.

Test plan :
- Put two records is a list
- Go to this list and check the two records
- Click on "Merge selected"
- Click on next
- Go to second source record
- Click on a repeatable field
=> The field is added to destination record
- Click on a subfield of a field existing in destination record
=> The subfield is added to destination record
- Click on a non repeatable field existing in destination record
=> You get an alert and field is not added
- Click on a subfield of a field not existing in destination record
=> You get an alert and subfield is not added
- Click on Merge
=> Records are merged

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests and test plan, no regressions found.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-16 16:17:34 +00:00

91 lines
4.6 KiB
HTML

[% BLOCK sourcetab %]
<div id="tabrecord[% recordnumber %]">
[% IF ( records ) %]
<div class="record">
<ul id="ulrecord[% recordnumber %]">
[% FOREACH record IN records %]
[% FOREACH fiel IN record.field %]
<li id="k[% fiel.key %]">
[% IF (defaultrecord) %]
<input type="checkbox" checked="checked" class="fieldpick" id="rec_[% recordnumber %]_[% fiel.key %]" />
[% ELSE %]
<input type="checkbox" class="fieldpick" id="rec_[% recordnumber %]_[% fiel.key %]" />
[% END %]
<span class="field">[% fiel.tag %]</span>
<input type="hidden" name="tag_[% fiel.tag %]_indicator1_[% fiel.key %]" value="[% fiel.indicator1 %]" />
<input type="hidden" name="tag_[% fiel.tag %]_indicator2_[% fiel.key %]" value="[% fiel.indicator2 %]" />
[% IF ( fiel.value ) %] / [% fiel.value %]
<input type="hidden" name="tag_[% fiel.tag %]_code_00_[% fiel.key %]" value="00" />
<input type="hidden" name="tag_[% fiel.tag %]_subfield_00_[% fiel.key %]" value="[% fiel.value %]" />
[% END %]
[% IF ( fiel.subfield ) %]
<ul>
[% FOREACH subfiel IN fiel.subfield %]
<li id="k[% subfiel.subkey %]">
[% IF (defaultrecord) %]
<input type="checkbox" checked="checked" class="subfieldpick" id="rec_[% recordnumber %]_[% subfiel.subkey %]" />
[% ELSE %]
<input type="checkbox" class="subfieldpick" id="rec_[% recordnumber %]_[% subfiel.subkey %]" />
[% END %]
<span class="subfield">[% subfiel.subtag %]</span> / [% subfiel.value %]
<input type="hidden" name="tag_[% subfiel.tag %]_code_[% subfiel.subtag %]_[% subfiel.key %]_[% subfiel.subkey %]" value="[% subfiel.subtag %]" />
<input type="hidden" name="tag_[% subfiel.tag %]_subfield_[% subfiel.subtag %]_[% subfiel.key %]_[% subfiel.subkey %]" value="[% subfiel.value |html%]" />
</li>
[% END %]
</ul>
[% END %]
[% END %]
</li>
[% END %]
</ul>
</div><!-- /div.record -->
[% END %]
</div><!-- /div#tabrecord[% recordnumber %] -->
[% END %]
[% BLOCK mergesource %]
<div id="tabs" class="toptabs">
<h2>Source records</h2>
<ul>
<li><a href="#tabrecord1">[% recordid1 %]</a></li>
<li><a href="#tabrecord2">[% recordid2 %]</a></li>
</ul>
[% PROCESS sourcetab records=record1 recordnumber=1 defaultrecord=1 %]
[% PROCESS sourcetab records=record2 recordnumber=2 defaultrecord=0 %]
</div> <!-- // #tabs -->
[% END %]
[% BLOCK mergetarget %]
<div id="result">
<h2>Destination record</h2>
<div style="border:1px solid #E8E8E8;padding:1em;margin-top:2em;">
<ul id="resultul">
[% FOREACH record IN record1 %]
[% FOREACH fiel IN record.field %]<li id="k[% fiel.key %]">
<span class="field">[% fiel.tag %]</span>
<input type="hidden" name="tag_[% fiel.tag %]_indicator1_[% fiel.key %]" value="[% fiel.indicator1 %]" />
<input type="hidden" name="tag_[% fiel.tag %]_indicator2_[% fiel.key %]" value="[% fiel.indicator2 %]" />
[% IF ( fiel.value ) %] /
[% fiel.value %]
<input type="hidden" name="tag_[% fiel.tag %]_code_00_[% fiel.key %]" value="00" />
<input type="hidden" name="tag_[% fiel.tag %]_subfield_00_[% fiel.key %]" value="[% fiel.value |html%]" />
[% END %]
[% IF ( fiel.subfield ) %]
<ul>
[% FOREACH subfiel IN fiel.subfield %]
<li id="k[% subfiel.subkey %]">
<span class="subfield">[% subfiel.subtag %]</span> / [% subfiel.value %]
<input type="hidden" name="tag_[% subfiel.tag %]_code_[% subfiel.subtag %]_[% subfiel.key %]_[% subfiel.subkey %]" value="[% subfiel.subtag %]" />
<input type="hidden" name="tag_[% subfiel.tag %]_subfield_[% subfiel.subtag %]_[% subfiel.key %]_[% subfiel.subkey %]" value="[% subfiel.value |html%]" />
</li>
[% END %]
</ul>
[% END %]
</li>[% END %]
[% END %]
</ul>
</div>
</div> <!-- // #result -->
[% END %]