1 dump('entering serial/sstr_editor.js\n');
4 JSAN.use('serial.editor_base');
6 if (typeof serial == 'undefined') serial = {};
7 serial.sstr_editor = function (params) {
9 JSAN.use('util.error'); this.error = new util.error();
10 JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
11 JSAN.use('util.network'); this.network = new util.network();
13 dump('serial/sstr_editor: ' + E + '\n');
16 /* This keeps track of what fields have been edited for styling purposes */
19 /* This holds the original values for prepopulating the field editors */
20 this.editor_values = {};
24 serial.sstr_editor.prototype = {
25 // we could do this with non-standard '__proto__' property instead
26 'editor_base_init' : serial.editor_base.editor_base_init,
27 'editor_base_apply' : serial.editor_base.editor_base_apply,
28 'editor_base_save' : serial.editor_base.editor_base_save,
31 'fm_type_plural' : 'sstrs',
33 'init' : function (params) {
36 params.retrieve_function = 'FM_SSTR_BATCH_RETRIEVE.authoritative';
38 obj.editor_base_init(params);
41 obj.summarize( obj.sstrs );
45 /******************************************************************************************************/
46 /* Restore backup copies */
48 'reset' : serial.editor_base.editor_base_reset,
50 /******************************************************************************************************/
51 /* Apply a value to a specific field on all the copies being edited */
53 'apply' : function(field,value) {
56 obj.editor_base_apply(field, value);
59 /******************************************************************************************************/
61 'init_panes' : function () {
63 obj.panes_and_field_names = {
65 /* These get shown in the left panel */
66 'sstr_editor_left_pane' :
71 //render: 'fm.id() == null ? "" : fm.id();',
72 //input: 'c = function(v){ obj.apply("distribution",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
79 //render: 'fm.routing_label() == null ? "" : fm.routing_label();',
80 input: 'c = function(v){ obj.apply("routing_label",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.setAttribute("value",obj.editor_values.routing_label); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
81 value_key: 'routing_label'
89 /******************************************************************************************************/
90 /* This loops through all our fieldnames and all the copies, tallying up counts for the different values */
92 'summarize' : serial.editor_base.editor_base_summarize,
94 /******************************************************************************************************/
95 /* Display the summarized data and inputs for editing */
97 'render' : serial.editor_base.editor_base_render,
99 /******************************************************************************************************/
100 /* This actually draws the change button and input widget for a given field */
101 'render_input' : serial.editor_base.editor_base_render_input,
103 /******************************************************************************************************/
104 /* save the streams */
106 'save' : function() {
108 obj.editor_base_save('open-ils.serial.stream.batch.update');
111 /******************************************************************************************************/
112 'save_attributes' : serial.editor_base.editor_base_save_attributes
115 dump('exiting serial/sstr_editor.js\n');