1 // ========================================================================== 2 // Project: Greenhouse 3 // Copyright: ©2010 Mike Ball 4 // ========================================================================== 5 /*globals Greenhouse */ 6 7 //better default state name... 8 SC.DEFAULT_TREE = 'main'; 9 10 /** 11 12 My cool new app. Describe your application. 13 14 @extends SC.Object 15 */ 16 Greenhouse = SC.Object.create( 17 /** @scope Greenhouse.prototype */ { 18 19 NAMESPACE: 'Greenhouse', 20 VERSION: '0.1.0', 21 22 /* 23 types fom json 24 */ 25 FILE: 'file', 26 DIR: 'dir', 27 28 store: SC.Store.create().from('Greenhouse.DataSource'), 29 30 //statechart options 31 monitorIsActive: YES, 32 33 34 35 loadIframeWithPage: function(firstTime){ 36 var c = Greenhouse.fileController.get('content'), iframe = Greenhouse.get('iframe'), namespace, page; 37 var r = c.get('pageRegex'), mainPane; 38 namespace = r[1]; 39 page = r[2]; 40 41 42 if(namespace && page && iframe){ 43 if(iframe[namespace] && !iframe[namespace][page]) iframe.eval(c.get('body')); 44 45 //just change main view for now... 46 namespace = iframe[namespace]; 47 //setup the designer container 48 if(firstTime){ 49 mainPane = iframe.SC.designPage.get('designMainPane'); 50 mainPane.append(); 51 } 52 53 //get the designs... 54 namespace[page].set('needsDesigner', YES); 55 this.pageController.set('content', namespace[page]); 56 57 58 iframe.SC.RunLoop.begin(); 59 if(!firstTime) iframe.SC.designController.set('content', null); 60 iframe.SC.designsController.setDesigns(namespace[page],iframe); 61 iframe.SC.designPage.designMainPane.viewList.contentView.set('content', Greenhouse.iframe.SC.designsController.get('content')); 62 iframe.SC.RunLoop.end(); 63 } 64 } 65 }); 66