Add font-weight to label settings to support boldness
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 26 Aug 2010 01:38:54 +0000 (01:38 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 26 Aug 2010 01:38:54 +0000 (01:38 +0000)
  * font-weight gets its own user-editable setting on the label generator UI,
along with a library setting, so now you too can have bold spine labels applied
uniformly at your library (but overridden for individual labels)
  * Convert a few hardcoded labels to entities in passing

git-svn-id: svn://svn.open-ils.org/ILS/trunk@17342 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/0381.data.spine_label_font_weight.sql [new file with mode: 0644]
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/cat/spine_labels.js
Open-ILS/xul/staff_client/server/cat/spine_labels.xul

index cf7c4cb..8d57dbd 100644 (file)
@@ -68,7 +68,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0380'); -- dbs
+INSERT INTO config.upgrade_log (version) VALUES ('0381'); -- dbs
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
index 8ee21df..a75177e 100644 (file)
@@ -6706,6 +6706,14 @@ INSERT INTO config.org_unit_setting_type (name, label, description, datatype)
                 'coust', 'description'),
             'integer'
         )
+        ,('cat.label.font.weight',
+            oils_i18n_gettext('cat.label.font.weight',
+                'Cataloging: Spine and pocket label font weight', 'coust', 'label'),
+            oils_i18n_gettext('cat.label.font.weight',
+                'Set the preferred font weight for spine and pocket labels. You can specify "normal", "bold", "bolder", or "lighter".',
+                'coust', 'description'),
+            'string'
+        )
 ;
 
 INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES
@@ -6714,6 +6722,7 @@ INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES
     ,(1, 'cat.spine.line.width', 8)
     ,(1, 'cat.label.font.family', '"monospace"')
     ,(1, 'cat.label.font.size', 10)
+    ,(1, 'cat.label.font.weight', '"normal"')
 ;
 
 
diff --git a/Open-ILS/src/sql/Pg/upgrade/0381.data.spine_label_font_weight.sql b/Open-ILS/src/sql/Pg/upgrade/0381.data.spine_label_font_weight.sql
new file mode 100644 (file)
index 0000000..6530ea1
--- /dev/null
@@ -0,0 +1,19 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0381'); -- dbs
+
+INSERT INTO config.org_unit_setting_type (name, label, description, datatype)
+    VALUES
+        ('cat.label.font.weight',
+            oils_i18n_gettext('cat.label.font.weight',
+                'Cataloging: Spine and pocket label font weight', 'coust', 'label'),
+            oils_i18n_gettext('cat.label.font.weight',
+                'Set the preferred font weight for spine and pocket labels. You can specify "normal", "bold", "bolder", or "lighter".',
+                'coust', 'description'),
+            'string'
+        )
+;
+
+INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES
+    (1, 'cat.label.font.weight', '"normal"')
+;
index 53c9382..383180e 100644 (file)
 <!ENTITY staff.cat.spine_labels.close_window.label "Close Window">
 <!ENTITY staff.cat.spine_labels.close_window.accesskey "C">
 <!ENTITY staff.cat.spine_labels.font_size.label "Font size (in points):">
+<!ENTITY staff.cat.spine_labels.font_weight.label 'Font weight ("normal" or "bold"):'>
 <!ENTITY staff.cat.spine_labels.spine_label.label "Spine Label">
 <!ENTITY staff.cat.spine_labels.spine_label.left_margin.label "Left Margin (in characters):">
 <!ENTITY staff.cat.spine_labels.spine_label.label_width.label "Label Width (in characters):">
 <!ENTITY staff.cat.spine_labels.spine_label.label_length.label "Label Length (in lines):">
 <!ENTITY staff.cat.spine_labels.pocket_label.label "Pocket Label">
+<!ENTITY staff.cat.spine_labels.pocket_label.enabled.label "Enabled">
 <!ENTITY staff.cat.spine_labels.pocket_label.middle_margin.label "Middle Margin (in characters):">
 <!ENTITY staff.cat.spine_labels.pocket_label.label_width.label "Label Width (in characters):">
 <!ENTITY staff.cat.spine_labels.pocket_label.label_length.label "Label Length (in lines):">
 <!ENTITY staff.cat.spine_labels.pocket_label.title.label "Include Title (wraps on word at label width)">
 <!ENTITY staff.cat.spine_labels.on_line.label "On line:">
+<!ENTITY staff.cat.spine_labels.pocket_label.include_author.label "Include Author">
 <!ENTITY staff.cat.spine_labels.pocket_label.include_title.label "Include Title (segment after wrapping)">
 <!ENTITY staff.cat.spine_labels.indent_title.label "Indent a space?">
 <!ENTITY staff.cat.spine_labels.inc_call_number.label "Include Call Number">
index 1be57e8..da36312 100644 (file)
                     label_cfg.font_size = g.data.hash.aous['cat.label.font.size'] || 10;
                     $('pt').value = label_cfg.font_size;
                 }
+                label_cfg.font_weight = $('font_weight').value;  /* font weight */
+                if (!label_cfg.font_weight) {
+                    label_cfg.font_weight = g.data.hash.aous['cat.label.font.weight'] || 'normal';
+                    $('font_weight').value = label_cfg.font_weight;
+                }
                 label_cfg.font_family = g.data.hash.aous['cat.label.font.family'] || 'monospace';
                 label_cfg.pocket_width = Number($('plw').value) || 28; /* pocket label width */
                 label_cfg.pocket_length = Number($('pll').value) || 9; /* pocket label length */
                     var tb = document.createElement('textbox'); hb2.appendChild(tb); 
                     tb.value = '';
                     tb.setAttribute('class','plain');
-                    tb.setAttribute('style','font-family: ' + label_cfg.font_family + '; font-size: ' + label_cfg.font_size);
+                    tb.setAttribute('style',
+                        'font-family: ' + label_cfg.font_family
+                        + '; font-size: ' + label_cfg.font_size
+                        + '; font-weight: ' + label_cfg.font_weight
+                    );
                     tb.setAttribute('size',label_cfg.spine_width+1);
                     tb.setAttribute('maxlength',label_cfg.spine_width);
                     tb.setAttribute('name','spine');
                 if ($('pl').checked && j < label_cfg.pocket_length) {
                     var tb2 = document.createElement('textbox'); hb2.appendChild(tb2); 
                     tb2.value = '';
-                    tb2.setAttribute('class','plain'); tb2.setAttribute('style','font-family: ' + label_cfg.font_family + '; font-size: ' + label_cfg.font_size);
+                    tb2.setAttribute('class','plain');
+                    tb2.setAttribute('style',
+                        'font-family: ' + label_cfg.font_family
+                        + '; font-size: ' + label_cfg.font_size
+                        + '; font-weight: ' + label_cfg.font_weight
+                    );
                     tb2.setAttribute('size',label_cfg.pocket_width+1); tb2.setAttribute('maxlength',label_cfg.pocket_width);
                     tb2.setAttribute('name','pocket');
                     if ($('title').checked && $('title_line').value == j + 1 && instanceOf(volume.record(),mvr)) {
                         $('pt').value = pt;
                     }
                     var ff = g.data.hash.aous['cat.spine.font.family'] || 'monospace';
+                    var fw = $('font_weight').value;  /* font weight */
+                    if (!fw) {
+                        fw = g.data.hash.aous['cat.label.font.weight'] || 'normal';
+                    }
                     var lm = Number($('lm').value); /* left margin */
                     if (!lm) {
                         lm = g.data.hash.aous['cat.spine.line.margin'] || 11;
                     var plw = Number($('plw').value) || 28; var pll = Number($('pll').value) || 9; /* pocket label width and length */
                     var html = "<html><head>";
                     html += "<link type='text/css' rel='stylesheet' href='" + xulG.url_prefix('/xul/server/skin/print.css') + "'></link>"
-                    html += "<link type='text/css' rel='stylesheet' href='data:text/css,pre{font-family:" + ff + ";font-size:" + pt + "pt;}'></link>";
+                    html += "<link type='text/css' rel='stylesheet' href='data:text/css,pre{font-family:" + ff + ";font-size:" + pt + "pt; font-weight: " + fw + ";}'></link>";
                     html += "<title>Spine Labels</title></head><body>\n";
                     var nl = document.getElementsByAttribute('name','template');
                     for (var i = 0; i < nl.length; i++) {
index d6bbc7a..d875df4 100644 (file)
                     accesskey="&staff.cat.spine_labels.close_window.accesskey;" oncommand="window.close()"/>
             </hbox>
 
-            <hbox>
-                <label value="&staff.cat.spine_labels.font_size.label;" control="pt"/>
-                <textbox id="pt" value="" onchange="this.setAttribute('value',this.value)" oils_persist="value" context="clipboard"/>
-            </hbox>
+            <grid><columns><column/><column/></columns><rows>
+                <row>
+                    <label value="&staff.cat.spine_labels.font_size.label;" control="pt"/>
+                    <textbox id="pt" value="" onchange="this.setAttribute('value',this.value)" oils_persist="value" context="clipboard"/>
+                </row>
+                <row>
+                    <label value="&staff.cat.spine_labels.font_weight.label;" control="font_weight"/>
+                    <textbox id="font_weight" value="" onchange="this.setAttribute('value',this.value)" oils_persist="value" context="clipboard"/>
+                </row>
+            </rows></grid>
             <grid><columns><column/><column/><column/><column/></columns><rows>
                 <row> <label class="header" value="&staff.cat.spine_labels.spine_label.label;"/><spacer/> </row>
                 <row> <label value="&staff.cat.spine_labels.spine_label.left_margin.label;" control="lm"/><textbox id="lm" value="" onchange="this.setAttribute('value',this.value)" oils_persist="value" context="clipboard"/> </row>
                 <row> <label value="&staff.cat.spine_labels.spine_label.label_width.label;" control="lw"/><textbox id="lw" value="" onchange="this.setAttribute('value',this.value)" oils_persist="value" context="clipboard"/> </row>
                 <row> <label value="&staff.cat.spine_labels.spine_label.label_length.label;" control="ll"/><textbox id="ll" value="" onchange="this.setAttribute('value',this.value)" oils_persist="value" context="clipboard"/> </row>
-                <row> <label class="header" value="&staff.cat.spine_labels.pocket_label.label;"/><checkbox id="pl" checked="false" oils_persist="checked" label="Enabled"/> </row>
+                <row> <label class="header" value="&staff.cat.spine_labels.pocket_label.label;"/><checkbox id="pl" checked="false" oils_persist="checked" label="&staff.cat.spine_labels.pocket_label.enabled.label;"/> </row>
                 <row> <label value="&staff.cat.spine_labels.pocket_label.middle_margin.label;" control="mm"/><textbox id="mm" value="2" onchange="this.setAttribute('value',this.value)" oils_persist="value" context="clipboard"/> </row>
                 <row> <label value="&staff.cat.spine_labels.pocket_label.label_width.label;" control="plw"/><textbox id="plw" value="28" onchange="this.setAttribute('value',this.value)" oils_persist="value" context="clipboard"/> </row>
                 <row> <label value="&staff.cat.spine_labels.pocket_label.label_length.label;" control="pll"/><textbox id="pll" value="9" onchange="this.setAttribute('value',this.value)" oils_persist="value" context="clipboard"/> </row>
@@ -76,7 +82,7 @@
                 </row>
                 <row> <spacer/><checkbox id="title_r_indent" checked="true" oils_persist="checked" label="&staff.cat.spine_labels.indent_title.label;"/> </row>
                 <row>
-                    <checkbox id="author" checked="true" oils_persist="checked" label="Include Author"/>
+                    <checkbox id="author" checked="true" oils_persist="checked" label="&staff.cat.spine_labels.pocket_label.include_author.label;"/>
                     <hbox>
                         <label value="&staff.cat.spine_labels.on_line.label;"/>
                         <textbox id="author_line" value="3" oils_persist="value" onchange="this.setAttribute('value',this.value)" context="clipboard"/>