]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/web/conify/global/actor/org_unit_type.js
move the translation widget out to openils.widget
[Evergreen.git] / Open-ILS / web / conify / global / actor / org_unit_type.js
1 /*
2 # ---------------------------------------------------------------------------
3 # Copyright (C) 2008  Georgia Public Library Service / Equinox Software, Inc
4 # Mike Rylander <miker@esilibrary.com>
5
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.
10
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 # ---------------------------------------------------------------------------
16 */
17
18 dojo.require('fieldmapper.dojoData');
19 dojo.require('openils.widget.TranslatorPopup');
20 dojo.require('dojo.parser');
21 dojo.require('dojo.data.ItemFileWriteStore');
22 dojo.require('dojo.date.stamp');
23 dojo.require('dijit.form.NumberSpinner');
24 dojo.require('dijit.form.TextBox');
25 dojo.require('dijit.form.TimeTextBox');
26 dojo.require('dijit.form.ValidationTextBox');
27 dojo.require('dijit.form.CheckBox');
28 dojo.require('dijit.form.FilteringSelect');
29 dojo.require('dijit.Tree');
30 dojo.require('dijit.layout.ContentPane');
31 dojo.require('dijit.layout.TabContainer');
32 dojo.require('dijit.layout.LayoutContainer');
33 dojo.require('dijit.layout.SplitContainer');
34 dojo.require('dojox.widget.Toaster');
35 dojo.require('dojox.fx');
36
37 // some handy globals
38 var cgi = new CGI();
39 var cookieManager = new HTTP.Cookies();
40 var ses = cookieManager.read('ses') || cgi.param('ses');
41 var pCRUD = new OpenSRF.ClientSession('open-ils.permacrud');
42
43 var current_type;
44 var current_fm_type;
45 var virgin_out_id = -1;
46
47 var highlighter = {};
48
49 function status_update (markup) {
50         if (parent !== window && parent.status_update) parent.status_update( markup );
51 }
52
53 function save_type () {
54
55         var modified_aout = new aout().fromStoreItem( current_type );
56         modified_aout.ischanged( 1 );
57
58         new_kid_button.disabled = false;
59         save_out_button.disabled = false;
60         delete_out_button.disabled = false;
61
62         pCRUD.request({
63                 method : 'open-ils.permacrud.update.aout',
64                 timeout : 10,
65                 params : [ ses, modified_aout ],
66                 onerror : function (r) {
67                         highlighter.editor_pane.red.play();
68                         status_update( 'Problem saving data for ' + ou_type_store.getValue( current_type, 'name' ) );
69                 },
70                 oncomplete : function (r) {
71                         var res = r.recv();
72                         if ( res && res.content() ) {
73                                 ou_type_store.setValue( current_type, 'ischanged', 0 );
74                                 highlighter.editor_pane.green.play();
75                                 status_update( 'Saved changes to ' + ou_type_store.getValue( current_type, 'name' ) );
76                         } else {
77                                 highlighter.editor_pane.red.play();
78                                 status_update( 'Problem saving data for ' + ou_type_store.getValue( current_type, 'name' ) );
79                         }
80                 },
81         }).send();
82 }
83