+<?xml version="1.0" encoding="Windows-1252"?>
<!--
Template for printing item labels (spine, pocket, etc.).
-->
<style>
/* The .spine here defines a CSS "class", which in this case, is used by our
- spine label */
+ left label */
.spine {
/* this pulls from the "Item Print Label Font Family" setting, but will
default to 'normal' */
font-weight: {{settings['webstaff.cat.label.font.weight'] || 'normal'}};
- /* this pulls from the "Item Print Label - Height for Spine Label"
+ /* this pulls from the "Item Print Label - Height for Left Label"
setting, but will default to '1.25in' */
height: {{settings['webstaff.cat.label.left_label.height'] || '1.25in'}};
min-height: {{settings['webstaff.cat.label.left_label.height'] || '1.25in'}};
max-height: {{settings['webstaff.cat.label.left_label.height'] || '1.25in'}};
- /* this pulls from the "Item Print Label - Width for Spine Label"
+ /* this pulls from the "Item Print Label - Width for Left Label"
setting, but will default to '1in' */
width: {{settings['webstaff.cat.label.left_label.width'] || '1in'}};
min-width: {{settings['webstaff.cat.label.left_label.width'] || '1in'}};
max-width: {{settings['webstaff.cat.label.left_label.width'] || '1in'}};
- /* this pulls from the "Item Print Label - Left Margin for Spine Label"
+ /* this pulls from the "Item Print Label - Left Margin for Left Label"
setting, but will default to '0in' */
margin-left: {{settings['webstaff.cat.label.left_label.left_margin'] || '0in'}};
}
- /* This CSS class is used by our pocket label */
+ /* This CSS class is used by our right label */
.pocket {
/* this pulls from the "Item Print Label Font Family" setting, but will
default to 'normal' */
font-weight: {{settings['webstaff.cat.label.font.weight'] || 'normal'}};
- /* this pulls from the "Item Print Label - Height for Spine Label"
+ /* this pulls from the "Item Print Label - Height for Left Label"
setting, but will default to '1.25in' */
height: {{settings['webstaff.cat.label.right_label.height'] || '1.25in'}};
min-height: {{settings['webstaff.cat.label.right_label.height'] || '1.25in'}};
max-height: {{settings['webstaff.cat.label.right_label.height'] || '1.25in'}};
- /* this pulls from the "Item Print Label - Width for Spine Label"
+ /* this pulls from the "Item Print Label - Width for Left Label"
setting, but will default to '2.625in' */
width: {{settings['webstaff.cat.label.right_label.width'] || '2.625in'}};
min-width: {{settings['webstaff.cat.label.right_label.width'] || '2.625in'}};
max-width: {{settings['webstaff.cat.label.right_label.width'] || '2.625in'}};
- /* this pulls from the "Item Print Label - Left Margin for Pocket Label"
+ /* this pulls from the "Item Print Label - Left Margin for Left Label"
setting, but will default to '0in' */
margin-left: {{settings['webstaff.cat.label.right_label.left_margin'] || '0in'}};
copy['call_number.label_class']
copy['call_number.label_sortkey']
copy['call_number.notes']
+ copy['call_number.owning_lib']
copy['call_number.owning_lib.id']
copy['call_number.owning_lib.shortname']
copy['call_number.owning_lib.name']
copy['call_number.uri_maps']
copy['call_number.uris']
copy['circ_as_type']
+ copy['circ_lib']
copy['circ_lib.id']
copy['circ_lib.shortname']
copy['circ_lib.name']
flesh_fields: {
acp: ['call_number', 'location', 'status', 'location', 'floating', 'circ_modifier', 'age_protect'],
acn: ['record', 'prefix', 'suffix'],
+ acp: ['call_number', 'location', 'status', 'location', 'floating', 'circ_modifier', 'age_protect', 'circ_lib'],
+ acn: ['record', 'prefix', 'suffix', 'owning_lib'],
bre: ['simple_record', 'creator', 'editor']
},
select: {
selected: "spine-pocket"
},
page: {
- column_class: ["spine"],
+ column_class: ["spine", "pocket"],
dimensions: {
columns: 2,
rows: 1
$scope.preview_scope = {
'copies': []
, 'settings': {}
- , 'toolbox_settings': toolbox_settings
+ , 'toolbox_settings': JSON.parse(JSON.stringify(toolbox_settings))
, 'get_cn_for': function (copy) {
var key = $scope.rendered_cn_key_by_copy_id[copy.id];
if (key) {
return !angular.isNumber(toolbox_settings.page.dimensions.rows) || !angular.isNumber(toolbox_settings.page.start_position.row) ? false : (toolbox_settings.page.start_position.row <= toolbox_settings.page.dimensions.rows);
}
};
-
$scope.record_details = {};
$scope.org_unit_settings = {};
}
}
});
+ egCore.hatch.getItem('cat.printlabels.last_toolbox_settings').then(function (last_toolbox_settings) {
+ if (last_toolbox_settings) {
+ $scope.preview_scope.toolbox_settings = JSON.parse(JSON.stringify(last_toolbox_settings));
+ }
+ });
})
);
egCore.print.fleshPrintScope($scope.preview_scope);
$scope.template_changed(); // load the default
$scope.rebuild_cn_set();
- if ($scope.preview_scope.toolbox_settings && $scope.template_name && $scope.print.template_content) {
- var re = /eg\_plt/i;
- if (re.test($scope.print.template_content)) {
- $scope.applyTemplate($scope.template_name);
- $scope.redraw_label_table();
- }
- }
});
});
}
+ $scope.checkForToolboxCustomizations = function (tText, redraw) {
+ var re = /eg\_plt\_(\d+)/;
+ redraw ? $scope.redraw_label_table() : false;
+ return re.test(tText);
+ }
+
$scope.fetchTemplates = function (set_default) {
return egCore.hatch.getItem('cat.printlabels.templates').then(function (t) {
if (t) {
$scope.fetchTemplates(true);
$scope.applyTemplate = function (n) {
- if (n) {
- if ($scope.templates[n]) {
- $scope.print.cn_template_content = $scope.templates[n].cn_content;
- $scope.print.template_content = $scope.templates[n].content;
- $scope.print.template_context = $scope.templates[n].context;
- for (var s in $scope.templates[n].settings) {
- $scope.preview_scope.settings[s] = $scope.templates[n].settings[s];
- }
- if ($scope.templates[n].toolbox_settings) {
- $scope.preview_scope.toolbox_settings = $scope.templates[n].toolbox_settings;
- $scope.create_print_label_table();
- }
- egCore.hatch.setItem('cat.printlabels.default_template', n);
- $scope.save_locally();
- }
+ $scope.print.cn_template_content = $scope.templates[n].cn_content;
+ $scope.print.template_content = $scope.templates[n].content;
+ $scope.print.template_context = $scope.templates[n].context;
+ for (var s in $scope.templates[n].settings) {
+ $scope.preview_scope.settings[s] = $scope.templates[n].settings[s];
+ }
+ if ($scope.templates[n].toolbox_settings) {
+ $scope.preview_scope.toolbox_settings = JSON.parse(JSON.stringify($scope.templates[n].toolbox_settings));
}
+ egCore.hatch.setItem('cat.printlabels.default_template', n);
+ $scope.save_locally();
}
$scope.deleteTemplate = function (n) {
$scope.saveTemplate = function (n) {
if (n) {
+
$scope.templates[n] = {
content: $scope.print.template_content
, context: $scope.print.template_context
.then(
function (html) {
$scope.print.template_content = html;
+ $scope.checkForToolboxCustomizations(html, true);
},
function () {
$scope.print.template_content = '';
);
egCore.hatch.getItem('cat.printlabels.last_settings').then(function (s) {
if (s) {
- $scope.preview_scope.settings = s;
+ $scope.preview_scope.settings = JSON.parse(JSON.stringify(s));
}
});
+ egCore.hatch.getItem('cat.printlabels.last_toolbox_settings').then(function (t) {
+ if (t) {
+ $scope.preview_scope.toolbox_settings = JSON.parse(JSON.stringify(t));
+ }
+ });
+
}
$scope.reset_to_default = function () {
'item_label_cn'
);
egCore.hatch.removeItem('cat.printlabels.last_settings');
+ egCore.hatch.removeItem('cat.printlabels.last_toolbox_settings');
for (s in $scope.preview_scope.settings) {
$scope.preview_scope.settings[s] = undefined;
}
- $scope.preview_scope.settings = {};
+ $scope.preview_scope.toolbox_settings = JSON.parse(JSON.stringify(toolbox_settings));
+
egCore.org.settings($scope.org_unit_setting_list).then(function (res) {
$scope.preview_scope.settings = res;
});
'item_label_cn',
$scope.print.cn_template_content
);
- egCore.hatch.setItem('cat.printlabels.last_settings', $scope.preview_scope.settings);
+ egCore.hatch.setItem('cat.printlabels.last_settings', JSON.parse(JSON.stringify($scope.preview_scope.settings)));
+ egCore.hatch.setItem('cat.printlabels.last_toolbox_settings', JSON.parse(JSON.stringify($scope.preview_scope.toolbox_settings)));
}
$scope.imported_print_templates = { data: '' };
content: el.content
, context: el.context
, cn_content: el.cn_content
- , settings: el.settings
- , toolbox_settings: el.toolbox_settings
+ , settings: JSON.parse(JSON.stringify(el.settings))
};
+ if (el.toolbox_settings) {
+ $scope.templates[k].toolbox_settings = JSON.parse(JSON.stringify(el.toolbox_settings));
+ }
});
$scope.saveTemplate();
$scope.template_changed(); // refresh
});
}
- $scope.create_print_label_table = function () {
+ $scope.redraw_label_table = function () {
if ($scope.print_label_form.$valid && $scope.print.template_content && $scope.preview_scope) {
$scope.preview_scope.label_output_copies = labelOutputRowsFilter($scope.preview_scope.copies, $scope.preview_scope.toolbox_settings);
+ var d = new Date().getTime().toString();
var html = $scope.print.template_content;
- var d = new Date(); //Added to table ID with 'eg_plt_' to cause $complie on $scope.print.template_content to fire due to template content change.
- var table = "<table id=\"eg_plt_" + d.getTime().toString() + "_{{$index}}\" eg-print-label-table style=\"border-collapse: collapse; border: 0 solid transparent; border-spacing: 0; margin: {{$index === 0 ? toolbox_settings.page.margins.top.size : 0}} 0 0 0;\" class=\"custom-label-table{{$index % toolbox_settings.page.dimensions.rows === 0 && $index > 0 && toolbox_settings.feed_option.selected === 'sheet' ? ' page-break' : ''}}\" ng-init=\"parentIndex = $index\" ng-repeat=\"row in label_output_copies\">\n";
- table += "<tr>\n";
- table += "<td style=\"border: 0 solid transparent; padding: {{parentIndex % toolbox_settings.page.dimensions.rows === 0 && toolbox_settings.feed_option.selected === 'sheet' && parentIndex > 0 ? toolbox_settings.page.space_between_labels.vertical.size : parentIndex > 0 ? toolbox_settings.page.space_between_labels.vertical.size : 0}} 0 0 {{$index === 0 ? toolbox_settings.page.margins.left.size : col.styl ? col.styl : toolbox_settings.page.space_between_labels.horizontal.size}};\" ng-repeat=\"col in row.columns\">\n";
- table += "<pre class=\"{{col.cls}}\" style=\"border: none; margin-bottom: 0; margin-top: 0; overflow: hidden;\" ng-if=\"col.cls === 'spine'\">\n";
- table += "{{col.c ? get_cn_for(col.c) : ''}}";
- table += "</pre>\n";
- table += "<pre class=\"{{col.cls}}{{parentIndex % toolbox_settings.page.dimensions.rows === 0 && parentIndex > 0 && toolbox_settings.feed_option.selected === 'sheet' ? ' page-break' : ''}}\" style=\"border: none; margin-bottom: 0; margin-top: 0; overflow: hidden;\" ng-if=\"col.cls === 'pocket'\">\n";
- table += "{{col.c ? col.c.barcode : ''}}\n";
- table += "{{col.c ? col.c['call_number.label'] : ''}}\n";
- table += "{{col.c ? get_bib_for(col.c).author : ''}}\n";
- table += "{{col.c ? (get_bib_for(col.c).title | wrap:28:'once':' ') : ''}}\n";
- table += "</pre>\n";
- table += "</td>\n"
- table += "</tr>\n";
- table += "</table>";
- var comments = html.match(/\<\!\-\-(?:(?!\-\-\>)(?:.|\s))*\-\-\>\s*/g);
- html = html.replace(/\<\!\-\-(?:(?!\-\-\>)(?:.|\s))*\-\-\>\s*/g, "");
- var style = html.match(/\<style[^\>]*\>(?:(?!\<\/style\>)(?:.|\s))*\<\/style\>\s*/gi);
- var output = (style ? style.join("\n") : "") + (comments ? comments.join("\n") : "") + table;
- output = output.replace(/\n+/, "\n");
- $scope.print.template_content = output;
- $scope.save_locally();
- }
- }
-
- $scope.redraw_label_table = function () {
- var d = new Date(); //Added to table ID with 'eg_plt_' to cause $complie on $scope.print.template_content to fire due to template content change.
- var table = "<table id=\"eg_plt_" + d.getTime().toString() + "\"\></table>\n";
- $scope.print.template_content += table;
- $scope.create_print_label_table();
- }
-
- $scope.$watch('preview_scope.toolbox_settings.page.dimensions.columns',
- function (newVal, oldVal) {
- if (newVal && newVal != oldVal && $scope.preview_scope) {
- $scope.redraw_label_table();
+ if ($scope.checkForToolboxCustomizations(html)) {
+ html = html.replace(/eg\_plt\_\d+/, "eg_plt_" + d);
+ $scope.print.template_content = html;
+ } else {
+ var table = "<table id=\"eg_plt_" + d + "_{{$index}}\" eg-print-label-table style=\"border-collapse: collapse; border: 0 solid transparent; border-spacing: 0; margin: {{$index === 0 ? toolbox_settings.page.margins.top.size : 0}} 0 0 0;\" class=\"custom-label-table{{$index % toolbox_settings.page.dimensions.rows === 0 && $index > 0 && toolbox_settings.feed_option.selected === 'sheet' ? ' page-break' : ''}}\" ng-init=\"parentIndex = $index\" ng-repeat=\"row in label_output_copies\">\n";
+ table += "<tr>\n";
+ table += "<td style=\"border: 0 solid transparent; padding: {{parentIndex % toolbox_settings.page.dimensions.rows === 0 && toolbox_settings.feed_option.selected === 'sheet' && parentIndex > 0 ? toolbox_settings.page.space_between_labels.vertical.size : parentIndex > 0 ? toolbox_settings.page.space_between_labels.vertical.size : 0}} 0 0 {{$index === 0 ? toolbox_settings.page.margins.left.size : col.styl ? col.styl : toolbox_settings.page.space_between_labels.horizontal.size}};\" ng-repeat=\"col in row.columns\">\n";
+ table += "<pre class=\"{{col.cls}}\" style=\"border: none; margin-bottom: 0; margin-top: 0; overflow: hidden;\" ng-if=\"col.cls === 'spine'\">\n";
+ table += "{{col.c ? get_cn_for(col.c) : ''}}";
+ table += "</pre>\n";
+ table += "<pre class=\"{{col.cls}}{{parentIndex % toolbox_settings.page.dimensions.rows === 0 && parentIndex > 0 && toolbox_settings.feed_option.selected === 'sheet' ? ' page-break' : ''}}\" style=\"border: none; margin-bottom: 0; margin-top: 0; overflow: hidden;\" ng-if=\"col.cls === 'pocket'\">\n";
+ table += "{{col.c ? col.c.barcode : ''}}\n";
+ table += "{{col.c ? col.c['call_number.label'] : ''}}\n";
+ table += "{{col.c ? get_bib_for(col.c).author : ''}}\n";
+ table += "{{col.c ? (get_bib_for(col.c).title | wrap:28:'once':' ') : ''}}\n";
+ table += "</pre>\n";
+ table += "</td>\n"
+ table += "</tr>\n";
+ table += "</table>";
+ var comments = html.match(/\<\!\-\-(?:(?!\-\-\>)(?:.|\s))*\-\-\>\s*/g);
+ html = html.replace(/\<\!\-\-(?:(?!\-\-\>)(?:.|\s))*\-\-\>\s*/g, '');
+ var style = html.match(/\<style[^\>]*\>(?:(?!\<\/style\>)(?:.|\s))*\<\/style\>\s*/gi);
+ var output = (comments ? comments.join("\n") : "") + (style ? style.join("\n") : "") + table;
+ output = output.replace(/\n+/, "\n");
+ $scope.print.template_content = output;
}
}
- );
+ }
$scope.$watch('print.cn_template_content', function (newVal, oldVal) {
if (newVal && newVal != oldVal) {
}
});
- $scope.$watchGroup(['preview_scope.toolbox_settings.page.margins.top.size', 'preview_scope.toolbox_settings.page.margins.left.size', 'preview_scope.toolbox_settings.page.dimensions.rows', 'preview_scope.toolbox_settings.page.space_between_labels.horizontal.size', 'preview_scope.toolbox_settings.page.space_between_labels.vertical.size', 'preview_scope.toolbox_settings.page.start_position.row', 'preview_scope.toolbox_settings.page.start_position.column', 'preview_scope.toolbox_settings.page.label.gap.size'], function (newVal, oldVal) {
+ $scope.$watchGroup(['preview_scope.toolbox_settings.page.margins.top.size', 'preview_scope.toolbox_settings.page.margins.left.size', 'preview_scope.toolbox_settings.page.dimensions.rows', 'preview_scope.toolbox_settings.page.dimensions.columns', 'preview_scope.toolbox_settings.page.space_between_labels.horizontal.size', 'preview_scope.toolbox_settings.page.space_between_labels.vertical.size', 'preview_scope.toolbox_settings.page.start_position.row', 'preview_scope.toolbox_settings.page.start_position.column', 'preview_scope.toolbox_settings.page.label.gap.size'], function (newVal, oldVal) {
if (newVal && newVal != oldVal && $scope.preview_scope.label_output_copies) {
$scope.redraw_label_table();
}
});
$scope.$watch("preview_scope.toolbox_settings.mode.selected", function (newVal, oldVal) {
- if (newVal && newVal != oldVal) {
+ if (newVal && newVal != oldVal && $scope.preview_scope) {
var ts_p = $scope.preview_scope.toolbox_settings.page;
if (ts_p.label.set.size === 1) {
if (newVal === "spine-pocket") {
});
$scope.$watch("preview_scope.toolbox_settings.page.label.set.size", function (newVal, oldVal) {
- if (newVal && newVal != oldVal) {
+ if (newVal && newVal != oldVal && oldVal) {
var ts_p = $scope.preview_scope.toolbox_settings.page;
if (angular.isNumber(newVal)) {
while (ts_p.column_class.length > ts_p.label.set.size) {
ts_p.column_class.push("spine");
}
}
- $scope.redraw_label_table();
+ }
+ });
+
+ $scope.$watch('print.cn_template_content', function (newVal, oldVal) {
+ if (newVal && newVal != oldVal) {
+ $scope.rebuild_cn_set();
+ }
+ });
+
+ $scope.$watch("preview_scope.settings['webstaff.cat.label.call_number_wrap_filter_height']", function (newVal, oldVal) {
+ if (newVal && newVal != oldVal) {
+ $scope.rebuild_cn_set();
+ }
+ });
+
+ $scope.$watch("preview_scope.settings['webstaff.cat.label.call_number_wrap_filter_width']", function (newVal, oldVal) {
+ if (newVal && newVal != oldVal) {
+ $scope.rebuild_cn_set();
}
});
function getPrintLabelStyle(index, settings) {
return index > 0 && (index % settings.page.label.set.size === 0) ? settings.page.label.gap.size : "";
-}
+}
\ No newline at end of file