Project

General

Profile

1
/*
2
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
3
$Id: Save.js 3052 2007-08-01 21:25:21Z ahocevar $
4
*/
5

    
6
// Ensure this object's dependancies are loaded.
7
mapbuilder.loadScript(baseDir+"/widget/ButtonBase.js");
8

    
9
/**
10
 * When this button is pressed the targetModel is posted to the serializeUrl.
11
 * Also defines a listener function for the "modelSaved" event which opens 
12
 * the serialized document in a new browser window but only
13
 * if the a popupWindowName property is defined for the button in config.
14
 *
15
 * @constructor
16
 * @base ButtonBase
17
 * @author Mike Adair mike.adairATccrs.nrcan.gc.ca
18
 * @param widgetNode  The widget node from the Config XML file.
19
 * @param model  The model for this widget
20
 */
21
function Save(widgetNode, model) {
22
  ButtonBase.apply(this, new Array(widgetNode, model));
23

    
24
 /**
25
   * Save model control.
26
   * @param objRef reference to this object.
27
   * @return {OpenLayers.Control} instance of the OL control.
28
   */
29
  this.createControl = function(objRef) {
30
    var Control = OpenLayers.Class( OpenLayers.Control, {
31
    
32
      type: OpenLayers.Control.TYPE_BUTTON,
33
      
34
      trigger: function () {
35
       		this.map.mbMapPane.targetModel.saveModel(this.map.mbMapPane.targetModel);  
36
                 
37
            
38
       },
39
       CLASS_NAME: 'mbControl.Save'
40
  });
41
  return Control;
42
  }
43

    
44
}
45

    
46

    
(99-99/145)