]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/js/dojo/openils/widget/EditDialog.js
apply the edit dialog class in the dialog, not the editpane
[working/Evergreen.git] / Open-ILS / web / js / dojo / openils / widget / EditDialog.js
1 /**
2 var dialog = new openils.widget.EditDialog({
3     fmObject: survey,
4     fieldOrder: ['id', 'name', 'description', 'start_date', 'end_date']
5 });
6 dialog.startup();
7 dialog.show();
8 */
9
10
11
12 if(!dojo._hasResource['openils.widget.EditDialog']) {
13     dojo.provide('openils.widget.EditDialog');
14     dojo.require('openils.widget.EditPane');
15     dojo.require('dijit.Dialog');
16     dojo.require('openils.Util');
17
18     /**
19      * Given a fieldmapper object, this builds a pop-up dialog used for editing the object
20      */
21
22     dojo.declare(
23         'openils.widget.EditDialog',
24         [dijit.Dialog],
25         {
26             editPane : null, // reference to our EditPane object
27
28             constructor : function(args) {
29                 this.editPane = new openils.widget.EditPane(args);
30                 var self = this;
31
32                 this.editPane.onCancel = function() { 
33                     if(args.onCancel)
34                         args.onCancel();
35                     self.hide(); 
36                 }
37
38                 this.editPane.onPostSubmit = function(r) { 
39                     self.hide(); 
40                     if(args.onPostSubmit)
41                         args.onPostSubmit(r);
42                 }
43             },
44
45             /**
46              * Builds a basic table of key / value pairs.  Keys are IDL display labels.
47              * Values are dijit's, when values set
48              */
49             startup : function() {
50                 this.inherited(arguments);
51                 this.editPane.startup();
52                 this.domNode.appendChild(this.editPane.domNode);
53                 openils.Util.addCSSClass(this.editPane.table, 'oils-fm-edit-dialog');
54             }
55         }
56     );
57 }
58