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