2 # ---------------------------------------------------------------------------
3 # Copyright (C) 2008 Georgia Public Library Service / Equinox Software, Inc
4 # Mike Rylander <miker@esilibrary.com>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 # ---------------------------------------------------------------------------
18 dojo.require('fieldmapper.AutoIDL');
19 dojo.require('fieldmapper.dojoData');
20 dojo.require('openils.widget.TranslatorPopup');
21 dojo.require('openils.PermaCrud');
22 dojo.require('dojo.parser');
23 dojo.require('dojo.cookie');
24 dojo.require('dojo.data.ItemFileWriteStore');
25 dojo.require('dojo.date.stamp');
26 dojo.require('dijit.form.NumberSpinner');
27 dojo.require('dijit.form.TextBox');
28 dojo.require('dijit.form.TimeTextBox');
29 dojo.require('dijit.form.ValidationTextBox');
30 dojo.require('dijit.form.CheckBox');
31 dojo.require('dijit.form.FilteringSelect');
32 dojo.require('dijit.Tree');
33 dojo.require('dijit.layout.ContentPane');
34 dojo.require('dijit.layout.TabContainer');
35 dojo.require('dijit.layout.LayoutContainer');
36 dojo.require('dijit.layout.SplitContainer');
37 dojo.require('dojox.widget.Toaster');
38 dojo.require('dojox.fx');
39 dojo.requireLocalization("openils.conify", "conify");
43 var ses = dojo.cookie('ses') || cgi.param('ses');
44 var pCRUD = new openils.PermaCrud({authtoken:ses});
48 var virgin_out_id = -1;
52 var aout_strings = dojo.i18n.getLocalization('openils.conify', 'conify');
54 function status_update (markup) {
55 if (parent !== window && parent.status_update) parent.status_update( markup );
58 function save_type () {
60 var modified_aout = new aout().fromStoreItem( current_type );
61 modified_aout.ischanged( 1 );
63 new_kid_button.disabled = false;
64 save_out_button.disabled = false;
65 delete_out_button.disabled = false;
67 pCRUD.update(modified_aout, {
68 onerror : function (r) {
69 highlighter.editor_pane.red.play();
70 status_update( dojo.string.substitute(aout_strings.ERROR_SAVING_DATA, [ou_type_store.getValue( current_type, 'name' )] ) );
72 oncomplete : function (r) {
73 ou_type_store.setValue( current_type, 'ischanged', 0 );
74 highlighter.editor_pane.green.play();
75 status_update( dojo.string.substitute(aout_strings.SUCCESS_SAVING_DATA, [ou_type_store.getValue( current_type, 'name' )] ) );