MTrackWeb/templates/images/MTrackWeb/MTrackWeb.Layout.js
[web.mtrack] / MTrackWeb / templates / images / MTrackWeb / MTrackWeb.Layout.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 MTrackWeb.Layout = new Roo.XComponent({
6     order    : '001-MTrackWeb.Layout',
7     region   : 'center',
8     parent   : false,
9     name     : "unnamed module",
10     disabled : false, 
11     tree : function()
12     {
13         var _this = this;
14         var MODULE = this;
15         return {
16             xtype: 'NestedLayoutPanel',
17             xns: Roo,
18             layout : {
19                 xtype: 'BorderLayout',
20                 xns: Roo,
21                 items : [
22                     {
23                         xtype: 'ContentPanel',
24                         xns: Roo,
25                         region : 'north',
26                         content : '<div class="banner-username"></div>' + 
27                                 '<div id="banner">' +
28                                     '<a href="' + rootURL + '"><img style="float: left;margin-right: 10px;" src="' +
29                                         rootURL + '/Roojscom/templates/images/roojsorg_logo-55.png" width="150" height="55"></a>' +
30                                     '<div class="banner-title">Project Tracker</div>'+
31                                 '</div>'
32                     },
33                     {
34                         xtype: 'ContentPanel',
35                         xns: Roo,
36                         region : 'center',
37                         title : "test"
38                     }
39                 ],
40                 north : {
41                     xtype: 'LayoutRegion',
42                     xns: Roo,
43                     height : 52,
44                     titlebar : false
45                 },
46                 center : {
47                     xtype: 'LayoutRegion',
48                     xns: Roo,
49                     alwaysShowTabs : true,
50                     tabPosition : 'top',
51                     toolbar : {
52                         xtype: 'Toolbar',
53                         xns: Roo,
54                         items : [
55                             {
56                                 xtype: 'Fill',
57                                 xns: Roo.Toolbar
58                             },
59                             {
60                                 xtype: 'TextItem',
61                                 xns: Roo.Toolbar,
62                                 text : "Project:"
63                             },
64                             {
65                                 xtype: 'ComboBox',
66                                 xns: Roo.form,
67                                 listeners : {
68                                     beforeselect : function (combo, record, index)
69                                     {
70                                       // this should post to the system, - to register active Project..
71                                                             // it's not really needed in new version... but done for compat.
72                                                             // at present..
73                                             Roo.Ajax.request( {
74                                                 method: 'POST',
75                                                 url : baseURL + '/Projects/' + rec.data.id,
76                                                 success : function (data) {
77                                                     // then, it should refresh the current active tab..
78                                                     MTrack.ajaxLoad( MTrack.currentURL);
79                                                 }
80                                             }); 
81                                         
82                                     },
83                                     render : function (_self)
84                                     {
85                                         
86                                         
87                                        MTrack.projectCombo = _self;
88                                         
89                                         // set the default value to our current project..
90                                         this.setFromData({
91                                             id : project_id,
92                                             name : project_name
93                                         });
94                                     }
95                                 },
96                                 allowBlank : false,
97                                 alwaysQuery : true,
98                                 displayField : 'name',
99                                 editable : false,
100                                 emptyText : "Select Project",
101                                 forceSelection : true,
102                                 listWidth : 400,
103                                 loadingText : "Searching...",
104                                 pageSize : 40,
105                                 qtip : "Select Project",
106                                 selectOnFocus : true,
107                                 tpl : '<div class="x-grid-cell-text x-btn button"><b>{code}</b> {name} </div>',
108                                 triggerAction : 'all',
109                                 typeAhead : true,
110                                 valueField : 'id',
111                                 width : 150,
112                                 store : {
113                                     xtype: 'Store',
114                                     xns: Roo.data,
115                                     listeners : {
116                                         beforeload : function (_self, o){
117                                             o.params = o.params || {};
118                                             // set more here
119                                         }
120                                     },
121                                     remoteSort : true,
122                                     sortInfo : { direction : 'ASC', field: 'name' },
123                                     proxy : {
124                                         xtype: 'HttpProxy',
125                                         xns: Roo.data,
126                                         method : 'GET',
127                                         url : baseURL + '/Projects.php'
128                                     },
129                                     reader : {
130                                         xtype: 'JsonReader',
131                                         xns: Roo.data,
132                                         id : 'id',
133                                         root : 'data',
134                                         totalProperty : 'total',
135                                         fields : [{"name":"id","type":"int"},"name","code"]
136                                     }
137                                 }
138                             },
139                             {
140                                 xtype: 'Separator',
141                                 xns: Roo.Toolbar
142                             },
143                             {
144                                 xtype: 'TextField',
145                                 xns: Roo.form,
146                                 listeners : {
147                                     specialkey : function (_self, e)
148                                     {
149                                        if (e.getKey() == 13) {
150                                             // search!
151                                        }
152                                     }
153                                 },
154                                 emptyText : "Search (to be done..)",
155                                 width : 100
156                             },
157                             {
158                                 xtype: 'Button',
159                                 xns: Roo.Toolbar,
160                                 cls : 'x-btn-icon',
161                                 icon : rootURL + '/Pman/templates/images/search.gif'
162                             },
163                             {
164                                 xtype: 'Separator',
165                                 xns: Roo.Toolbar
166                             },
167                             {
168                                 xtype: 'SplitButton',
169                                 xns: Roo.Toolbar,
170                                 listeners : {
171                                     click : function (_self, e)
172                                     {
173                                         var bt = this;
174                                         if (!Pman.Login.authUser.id) { 
175                                             Pman.Login.show(false, function() {
176                                                 bt.setText('Logout');
177                                                 Roo.select('.banner-username').first().update(
178                                                     String.format('You are logged in as {0} &lt;{1}&gt;',
179                                                         Pman.Login.authUser.name,
180                                                         Pman.Login.authUser.email));
181                                                 
182                                                  
183                                                 // set the default value to our current project..
184                                                 MTrack.projectCombo.setFromData({
185                                                     id : Pman.Login.authUser.project.id,
186                                                     name : Pman.Login.authUser.project.name
187                                                 });
188                                                 
189                                                 MTrack.ajaxLoad( MTrack.currentURL);
190                                                 //document.location = baseURL + '/Report/1?ts=' + Math.random();
191                                                 // reload the project list!??
192                                                 // reload the active page
193                                             });
194                                         } else {
195                                             Pman.Login.logout();
196                                             // should for a reload..
197                                         }
198                                     },
199                                     render : function (_self)
200                                     {
201                                         if (typeof(Pman) == 'undefined') {
202                                             return;
203                                         }
204                                         
205                                         // if we are logged in.. change stuff..
206                                         if (!Pman.Login.authUser.id) {
207                                             // not logged in..
208                                             return;
209                                         }
210                                         // logged in..
211                                         this.el.child("button:first").setStyle(
212                                                 'background-image', 'url(' + rootURL + '/Pman/templates/images/logout.gif)');
213                                         this.setText('Logout');
214                                         Roo.select('.banner-username').first().update(
215                                              String.format('You are logged in as {0} &lt;{1}&gt;',
216                                                 Pman.Login.authUser.name,
217                                                 Pman.Login.authUser.email));
218                                         // change the icon..
219                                          
220                                     }
221                                 },
222                                 cls : 'x-btn-text-icon',
223                                 text : "Login",
224                                 icon : rootURL + '/Pman/templates/images/lock.gif',
225                                 menu : {
226                                     xtype: 'Menu',
227                                     xns: Roo.menu,
228                                     items : [
229                                         {
230                                             xtype: 'Item',
231                                             xns: Roo.menu,
232                                             listeners : {
233                                                 render : function (_self)
234                                                 {
235                                                     _this.changePassword = _self;
236                                                 }
237                                             },
238                                             text : "Change Password"
239                                         }
240                                     ]
241                                 }
242                             }
243                         ]
244                     }
245                 },
246                 south : {
247                     xtype: 'LayoutRegion',
248                     xns: Roo,
249                     height : 30,
250                     titlebar : false
251                 }
252             }
253         };
254     }
255 });