2785c6f52177f9e72b2774cf9f4cccc4e9c5f494
[roojs1] / docs / Roo.docs.ViewSource.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Roo.docs');
6
7 Roo.docs.ViewSource= function() {}
8 Roo.apply(Roo.docs.ViewSource.prototype, {
9
10  _strings : {
11   'd3d2e617335f08df83599665eef8a418' :"Close",
12   '89babd10371e21bb9eaf39937de7c656' :"View Source"
13  },
14
15  dialog : false,
16  callback:  false,
17
18  show : function(data, cb)
19  {
20   if (!this.dialog) {
21    this.create();
22   }
23
24   this.callback = cb;
25   this.data = data;
26   this.dialog.show(this.data._el);
27   if (this.form) {
28    this.form.reset();
29    this.form.setValues(data);
30    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
31   }
32
33  },
34
35  create : function()
36  {
37   var _this = this;
38   this.dialog = Roo.factory({
39     xtype : 'Modal',
40     fitwindow : true,
41     max_width : 900,
42     title : _this._strings['89babd10371e21bb9eaf39937de7c656'] /* View Source */,
43     listeners : {
44      show : function (_self)
45       {
46         //  if(_this.data.buttonText){
47           //    _this.acceptBtn.setText(_this.data.buttonText);
48          // }
49           
50           if (typeof( _this.data.source) == 'undefined') {
51               Roo.Ajax.request({
52                   url : _this.data.src,
53                   method : 'GET',
54                   success : function(res, o)
55                   {
56                       Roo.docs.ViewSource.show({
57                           source : String.format("<PRE>{0}</PRE>",res.responseText),
58                           fname : _this.data.src.split('/').pop()
59                       });
60                       
61                   },
62                   scope : this
63               });
64               
65           
66               return;
67           }
68            
69         _this.body_ctr.el.dom.innerHTML = _this.data.source;
70        _this.body_ctr.el.dom.scrollTop = 0;
71        _this.dialog.setTitle("View Source: " + _this.data.fname);
72           _this.dialog.el.setStyle('zIndex', '10002');
73           
74       }
75     },
76     xns : Roo.bootstrap,
77     '|xns' : 'Roo.bootstrap',
78     buttons : [
79      {
80       xtype : 'Button',
81       html : _this._strings['d3d2e617335f08df83599665eef8a418'] /* Close */,
82       weight : 'primary',
83       listeners : {
84        click : function (_self, e)
85         {
86             _this.dialog.hide();
87          
88             
89         },
90        render : function (_self)
91         {
92             _this.acceptBtn = this;
93             
94         }
95       },
96       xns : Roo.bootstrap,
97       '|xns' : 'Roo.bootstrap'
98      }
99     ],
100     items  : [
101      {
102       xtype : 'Container',
103       style : 'width: 100%;overflow:auto;height:100%;',
104       listeners : {
105        render : function (_self)
106         {
107         _this.body_ctr = this;
108         }
109       },
110       xns : Roo.bootstrap,
111       '|xns' : 'Roo.bootstrap'
112      }
113     ]
114    }  );
115  }
116 });
117 Roo.apply(Roo.docs.ViewSource, Roo.docs.ViewSource.prototype);