815770fd2bae1df99e503cc8a33d3593fc12e8c0
[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="' + baseURL + '"><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, rec, 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                                         _this.projectCombo = _self;
99                                         // BC..
100                                        MTrack.projectCombo = _self;
101                                         
102                                         // set the default value to our current project..
103                                         this.setFromData({
104                                             id : project_id,
105                                             name : project_name
106                                         });
107                                     }
108                                 },
109                                 allowBlank : false,
110                                 alwaysQuery : true,
111                                 displayField : 'name',
112                                 editable : false,
113                                 emptyText : "Select Project",
114                                 forceSelection : true,
115                                 listWidth : 400,
116                                 loadingText : "Searching...",
117                                 pageSize : 40,
118                                 qtip : "Select Project",
119                                 selectOnFocus : true,
120                                 tpl : '<div class="x-grid-cell-text x-btn">{name} -  <b>{code}</b> </div>',
121                                 triggerAction : 'all',
122                                 typeAhead : true,
123                                 valueField : 'id',
124                                 width : 150,
125                                 store : {
126                                     xtype: 'Store',
127                                     xns: Roo.data,
128                                     listeners : {
129                                         beforeload : function (_self, o){
130                                             o.params = o.params || {};
131                                             // set more here
132                                         }
133                                     },
134                                     remoteSort : true,
135                                     sortInfo : { direction : 'ASC', field: 'name' },
136                                     proxy : {
137                                         xtype: 'HttpProxy',
138                                         xns: Roo.data,
139                                         method : 'GET',
140                                         url : baseURL + '/Roo/Projects.php'
141                                     },
142                                     reader : {
143                                         xtype: 'JsonReader',
144                                         xns: Roo.data,
145                                         id : 'id',
146                                         root : 'data',
147                                         totalProperty : 'total',
148                                         fields : [{"name":"id","type":"int"},"name","code"]
149                                     }
150                                 }
151                             },
152                             {
153                                 xtype: 'Separator',
154                                 xns: Roo.Toolbar
155                             },
156                             {
157                                 xtype: 'TextField',
158                                 xns: Roo.form,
159                                 listeners : {
160                                     specialkey : function (_self, e)
161                                     {
162                                        if (e.getKey() == 13) {
163                                             // search!
164                                        }
165                                     }
166                                 },
167                                 emptyText : "Search (to be done..)",
168                                 width : 100
169                             },
170                             {
171                                 xtype: 'Button',
172                                 xns: Roo.Toolbar,
173                                 cls : 'x-btn-icon',
174                                 icon : rootURL + '/Pman/templates/images/search.gif'
175                             },
176                             {
177                                 xtype: 'Separator',
178                                 xns: Roo.Toolbar
179                             },
180                             {
181                                 xtype: 'SplitButton',
182                                 xns: Roo.Toolbar,
183                                 listeners : {
184                                     click : function (_self, e)
185                                     {
186                                         var bt = this;
187                                         if (!Pman.Login.authUser.id) { 
188                                             Pman.Login.show(false, function() {
189                                                 bt.setText('Logout');
190                                                 Roo.select('.banner-username').first().update(
191                                                     String.format('You are logged in as {0} &lt;{1}&gt;',
192                                                         Pman.Login.authUser.name,
193                                                         Pman.Login.authUser.email));
194                                                 
195                                                  
196                                                 // set the default value to our current project..
197                                                 MTrack.projectCombo.setFromData({
198                                                     id : Pman.Login.authUser.project.id,
199                                                     name : Pman.Login.authUser.project.name
200                                                 });
201                                                 
202                                                 MTrack.ajaxLoad( MTrack.currentURL);
203                                                 //document.location = baseURL + '/Report/1?ts=' + Math.random();
204                                                 // reload the project list!??
205                                                 // reload the active page
206                                             });
207                                         } else {
208                                             Roo.MessageBox.confirm("Logout", 
209                                                 "Are you sure you want to Log out?",
210                                                 function(r) {
211                                                     if (r!='yes') {
212                                                         return;
213                                                     }
214                                             
215                                                     Pman.Login.logout();
216                                                 }
217                                             );
218                                             // should for a reload..
219                                         }
220                                     },
221                                     render : function (_self)
222                                     {
223                                         if (typeof(Pman) == 'undefined') {
224                                             return;
225                                         }
226                                         
227                                         // if we are logged in.. change stuff..
228                                         if (!Pman.Login.authUser.id) {
229                                             // not logged in..
230                                             return;
231                                         }
232                                         // logged in..
233                                         this.el.child("button:first").setStyle(
234                                                 'background-image', 'url(' + rootURL + '/Pman/templates/images/logout.gif)');
235                                         this.setText('Logout');
236                                         Roo.select('.banner-username').first().update(
237                                              String.format('You are logged in as {0} &lt;{1}&gt;',
238                                                 Pman.Login.authUser.name,
239                                                 Pman.Login.authUser.email));
240                                         // change the icon..
241                                          
242                                     }
243                                 },
244                                 cls : 'x-btn-text-icon',
245                                 text : "Login",
246                                 icon : rootURL + '/Pman/templates/images/lock.gif',
247                                 menu : {
248                                     xtype: 'Menu',
249                                     xns: Roo.menu,
250                                     items : [
251                                         {
252                                             xtype: 'Item',
253                                             xns: Roo.menu,
254                                             text : "Request Account"
255                                         },
256                                         {
257                                             xtype: 'Item',
258                                             xns: Roo.menu,
259                                             text : "Send Invite to a Friend"
260                                         },
261                                         {
262                                             xtype: 'Separator',
263                                             xns: Roo.menu
264                                         },
265                                         {
266                                             xtype: 'Item',
267                                             xns: Roo.menu,
268                                             listeners : {
269                                                 render : function (_self)
270                                                 {
271                                                     _this.changePassword = _self;
272                                                 }
273                                             },
274                                             text : "Change Password"
275                                         }
276                                     ]
277                                 }
278                             }
279                         ]
280                     }
281                 },
282                 south : {
283                     xtype: 'LayoutRegion',
284                     xns: Roo,
285                     height : 30,
286                     titlebar : false
287                 }
288             }
289         };
290     }
291 });