diff --git a/UPSUser.js b/UPSUser.js new file mode 100644 index 0000000..6d2c49e --- /dev/null +++ b/UPSUser.js @@ -0,0 +1,19 @@ +function UPSUser() +{ + this.storage = window.localStorage; +} + +UPSUser.prototype.GetUserType = function() +{ + if(!this.storage.getItem("usertype")) + { + this.storage.setItem("usertype","none"); + } + + return this.storage.getItem("usertype"); +} + +UPSUser.prototype.SetUserType = function(type) +{ + this.storage.setItem("usertype",type); +} \ No newline at end of file diff --git a/app/app.js b/app/app.js new file mode 100644 index 0000000..1b75f4a --- /dev/null +++ b/app/app.js @@ -0,0 +1,10 @@ + +Ext.regApplication('UPSApp', { + defaultTarget:'viewport', + name:'UPSApp', + launch: function() { + + // The Ext.regApplication call automatically creates our 'views' namespace + this.views.viewport = new this.views.Viewport(); + } +}); diff --git a/app/views/SelectUserType.js b/app/views/SelectUserType.js new file mode 100644 index 0000000..1758ac4 --- /dev/null +++ b/app/views/SelectUserType.js @@ -0,0 +1,27 @@ +UPSApp.views.SelectUserType = Ext.extend(Ext.Panel, { + cardSwitchAnimation:'slide', + dockedItems:[], + items:[ + { + xtype:'button', + text:"I'm a Parent", + handler:function() { + User.SetUserType('parent'); + UPSApp.views.viewport.setActiveItem('parenthome'); + } + }, + { + xtype:'button', + text:"I'm a Student" + }, + { + xtype:'button', + text:"I'm an Alumnus" + } + ], + initComponent: function() { + + + UPSApp.views.Viewport.superclass.initComponent.apply(this, arguments); + } +}); \ No newline at end of file diff --git a/app/views/Viewport.js b/app/views/Viewport.js new file mode 100644 index 0000000..6dff3ce --- /dev/null +++ b/app/views/Viewport.js @@ -0,0 +1,49 @@ +var User; + +UPSApp.views.Viewport = Ext.extend(Ext.Panel, { + fullscreen:true, + layout: 'card', + cardSwitchAnimation:'pop', + dockedItems:[ + new Ext.Toolbar({ + dock:'bottom', + title:"Debug", + items:[ + { + xtype:'button', + text:'Reset Usertype', + handler:function(){User.SetUserType("none");} + } + ] + }) + ], + items:[], + activeItem:0, + initComponent: function() { + + User = new UPSUser(); + + UPSApp.views.toolbar = new Ext.Toolbar({ + title:'University of Puget Sound' + }); + + this.dockedItems[1] = UPSApp.views.toolbar; + + UPSApp.views.selectUserType = new UPSApp.views.SelectUserType(); + UPSApp.views.parentHome = new UPSApp.views.ParentHome(); + + this.items[0] = UPSApp.views.selectUserType; + this.items[1] = UPSApp.views.parentHome; + + if(User.GetUserType() == "none") + Ext.apply(this, { + activeItem:0 + }) + else if(User.GetUserType() == "parent") + Ext.apply(this, { + activeItem:1 + }) + + UPSApp.views.Viewport.superclass.initComponent.apply(this, arguments); + } +}); \ No newline at end of file diff --git a/app/views/parent/ParentHome.js b/app/views/parent/ParentHome.js new file mode 100644 index 0000000..62091b3 --- /dev/null +++ b/app/views/parent/ParentHome.js @@ -0,0 +1,10 @@ +UPSApp.views.ParentHome = Ext.extend(Ext.Panel, { + id:'parenthome', + dockedItems:[], + items:[], + html:"
I'm a Parent
", + initComponent: function() { + + UPSApp.views.Viewport.superclass.initComponent.apply(this, arguments); + } +}); \ No newline at end of file diff --git a/index.html b/index.html index b345408..65c4d3f 100644 --- a/index.html +++ b/index.html @@ -7,8 +7,12 @@ + - + + + +