PDA

View Full Version : MVC design



sj_tt6
4 Sep 2012, 2:30 PM
Hi,

I have used Sencha to develop a couple applications and I like the capabilities of Sencha. Now I develop a new application and I have problems with design. I hope get advices or hint from this forum.

My application has 2 types of users: end users and administrators. My first thought is my application has login, registration, record, and administration pages.
1.login page: end users and admin enter username and password to log in. There is a hyperlink for registration

2. Registration page: if the end user clicks on the link this page is open for the user entering info

3. Record page: if the end user successfully registers the user sees this page next that shows all information. (s)he can update information in the account on this page.

4. Administration page: After the admin logged in, (s)he sees this page that shows all user accounts.

If I use MVC to develop I have 1 index.html, 1 app.js, 1 viewport.js. I have no idea how to make the view port to display different pages (above) dynamically according to each use case.

Or should I create 2 index files, 2 app.js files, and 2 viewport.js files for end user and administrator ?

Thank you,

sj_tt6
4 Sep 2012, 2:46 PM
I think I would create only 1 view port that contains login, registration, record, or administration panel depending on each use case. If so, how can I from a child panel (e.g. login panel) call the view port to remove it and add another panel (e.g. record panel) ?

Thanks,

friend
5 Sep 2012, 4:21 AM
I usually create a non-MVC login page, which does a non-AJAX submit of the login form data. If the user authenticates successfully, you now know who they are and their level of permissions.

My home page uses the ExtJs MVC architecture, where the west region of the Viewport is a menu Tree Panel. Prior to redirecting an authenticated user to the home page, I filter the JSON data used to populate the menu tree, so the user ends up seeing only the menu options appropriate to their permissions.

sj_tt6
5 Sep 2012, 8:48 AM
Hi friend,

Thank you for the explanation!

I plan to play around some designs to see how they work. I'll update later.