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