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