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 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
10 JSAN.use('util.error'); this.error = new util.error();
11 JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
12 JSAN.use('util.network'); this.network = new util.network();
14 dump('serial/sstr_editor: ' + E + '\n');
17 /* This keeps track of what fields have been edited for styling purposes */
20 /* This holds the original values for prepopulating the field editors */
21 this.editor_values = {};
25 serial.sstr_editor.prototype = {
26 // we could do this with non-standard '__proto__' property instead
27 'editor_base_init' : serial.editor_base.editor_base_init,
28 'editor_base_apply' : serial.editor_base.editor_base_apply,
29 'editor_base_save' : serial.editor_base.editor_base_save,
32 'fm_type_plural' : 'sstrs',
34 'init' : function (params) {
37 params.retrieve_function = 'FM_SSTR_BATCH_RETRIEVE.authoritative';
39 obj.editor_base_init(params);
42 obj.summarize( obj.sstrs );
46 /******************************************************************************************************/
47 /* Restore backup copies */
49 'reset' : serial.editor_base.editor_base_reset,
51 /******************************************************************************************************/
52 /* Apply a value to a specific field on all the copies being edited */
54 'apply' : function(field,value) {
57 obj.editor_base_apply(field, value);
60 /******************************************************************************************************/
62 'init_panes' : function () {
64 obj.panes_and_field_names = {
66 /* These get shown in the left panel */
67 'sstr_editor_left_pane' :
72 render: '"ID : " + fm.id();',
73 //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);',
80 render: 'fm.routing_label() == null ? "" : fm.routing_label();',
81 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);',
82 value_key: 'routing_label'
90 /******************************************************************************************************/
91 /* This loops through all our fieldnames and all the copies, tallying up counts for the different values */
93 'summarize' : serial.editor_base.editor_base_summarize,
95 /******************************************************************************************************/
96 /* Display the summarized data and inputs for editing */
98 'render' : serial.editor_base.editor_base_render,
100 /******************************************************************************************************/
101 /* This actually draws the change button and input widget for a given field */
102 'render_input' : serial.editor_base.editor_base_render_input,
104 /******************************************************************************************************/
105 /* save the streams */
107 'save' : function() {
109 obj.editor_base_save('open-ils.serial.stream.batch.update');
112 /******************************************************************************************************/
113 'save_attributes' : serial.editor_base.editor_base_save_attributes
116 dump('exiting serial/sstr_editor.js\n');