The 1000 steps program to MDriven Chapter 12
No edit summary
No edit summary
Line 3: Line 3:
Here's the video link for Chapter 12: https://youtu.be/N4xW-CS02sE
Here's the video link for Chapter 12: https://youtu.be/N4xW-CS02sE


In this chapter, we'll discuss how to add an image attribute to a brand, making sure it shows in various places, dropping the AutoForms, and ensuring the access rights for editing checks who can set the brand and registration number.
== Chapter 12 ==
'''In this chapter, we'll discuss how to add an image attribute to a brand, making sure it shows in various places. We'll drop the AutoForms, and ensure the access rights for editing checks who can set the brand and registration number.'''


== Chapter 12 ==
365. Adopt the Autoform ''AutoFormBrandOfCar'' and rename it to <code>ManageBrand</code>.  
365. Adopt the Autoform ''AutoFormBrandOfCar'' and rename it to <code>ManageBrand</code>.  


Line 14: Line 14:
368. Delete all the ViewModelColumns except the Name.
368. Delete all the ViewModelColumns except the Name.


369. Make sure you understand the opt-in-opt-out for actions.
369. Make sure you understand the opt-in/opt-out for actions.


370. Add an image - BrandImage:Blob to class BrandOfCar.
370. Add an image - BrandImage:Blob to class BrandOfCar.
Line 24: Line 24:
373. Start the application and upload images for the different brands.
373. Start the application and upload images for the different brands.


374. Add a new ViewModel to seek for BrandOfCar; name it BandSeeker and use the UIFirst to get a copy of SeekerAutoForm-logic.
374. Add a new ViewModel to seek for BrandOfCar. Name it BrandSeeker and use the UIFirst to get a copy of SeekerAutoForm logic.


375. Set sortorder on Global Action BrandOfCar and make sure you understand how Action order is handled in menus.
375. Set sortorder on Global Action BrandOfCar and make sure you understand how Action order is handled in menus.
Line 34: Line 34:
378. Right-click on the BrandOfCar class and check the UsedBy list. Find out where BrandOfCar is used and add the BrandImage to these places.
378. Right-click on the BrandOfCar class and check the UsedBy list. Find out where BrandOfCar is used and add the BrandImage to these places.


379. Make sure you try a few of the ways to find the proper expression for showing the BrandImage from the different contexts: "Add Column", "Add column from model", and "manual expression typing".
379. Make sure you try a few of the ways to find the proper expression for showing the BrandImage from the different contexts:  
 
* "Add Column"  
* "Add column from model"  
* "manual expression typing"
380. Fix up the NewCar action that does not have a view (since it pointed to an AutoForm that we dropped) - make it show view ''ProperCarView''.
380. Fix up the NewCar action that does not have a view (since it pointed to an AutoForm that we dropped) - make it show view ''ProperCarView''.


Line 44: Line 46:
383. Fix the ReadOnly expression to only allow the admin to change the BrandOfCar.
383. Fix the ReadOnly expression to only allow the admin to change the BrandOfCar.


384. Run the app. Check with your two users - ''a'' and ''b'' - where a is admin and b is not. Verify that you understand the read-only expression.
384. Run the app. Check with your two users - ''a'' and ''b'' - where '''a''' is admin and '''b''' is not. Verify that you understand the read-only expression.


385. Go back to the app and make the BrandOfCarForAdmin column invisible for anyone who's not the admin. Do this by checking the FollowEnable box behind the VisibleExpression.
385. Go back to the app and make the BrandOfCarForAdmin column invisible for anyone who's not the admin. Do this by checking the FollowEnable box behind the VisibleExpression.


386. Then, we discover that the ''RegistrationNumber'' can be changed by anyone. Fix this by first setting the access-group IsAdministrator on the action NewCar.
386. Then, we discover that the ''RegistrationNumber'' can be changed by anyone. Fix this by first setting the access group ''IsAdministrator'' on the action NewCar.


387. Move the read-only expression from combobox BrandOfCarForAdmin to the read-only expression for the whole ProperCarView.
387. Move the read-only expression from combobox BrandOfCarForAdmin to the read-only expression for the whole ProperCarView.

Revision as of 07:01, 28 September 2023

This is Chapter 12. Are you looking for the beginning? Find it here: Chapter 1, or link to Chapter 11(the previous chapter)

Here's the video link for Chapter 12: https://youtu.be/N4xW-CS02sE

Chapter 12

In this chapter, we'll discuss how to add an image attribute to a brand, making sure it shows in various places. We'll drop the AutoForms, and ensure the access rights for editing checks who can set the brand and registration number.

365. Adopt the Autoform AutoFormBrandOfCar and rename it to ManageBrand.

366. Rename the Class action that brings that form up to have the same name as the form.

367. Delete the 2 actions that now show errors due to the use of vCurrent_<oldname>

368. Delete all the ViewModelColumns except the Name.

369. Make sure you understand the opt-in/opt-out for actions.

370. Add an image - BrandImage:Blob to class BrandOfCar.

371. Add a column that shows BrandImage in the ManageBrand view.

372. Remove the presentation from the BrandImage column.

373. Start the application and upload images for the different brands.

374. Add a new ViewModel to seek for BrandOfCar. Name it BrandSeeker and use the UIFirst to get a copy of SeekerAutoForm logic.

375. Set sortorder on Global Action BrandOfCar and make sure you understand how Action order is handled in menus.

376. Drop all the AutoForms from the model. Note that a lot of actions and ViewModels are now removed from the app.

377. Note that the logic to jump on the first click is in effect whenever there is only 1 available navigating action.

378. Right-click on the BrandOfCar class and check the UsedBy list. Find out where BrandOfCar is used and add the BrandImage to these places.

379. Make sure you try a few of the ways to find the proper expression for showing the BrandImage from the different contexts:

  • "Add Column"
  • "Add column from model"
  • "manual expression typing"

380. Fix up the NewCar action that does not have a view (since it pointed to an AutoForm that we dropped) - make it show view ProperCarView.

381. Add a SingleLinkWithSetter/Picker/Combobox in ProperCarView to set the BrandOfCar link and call the column BrandOfCarForAdmin.

382. Note the access issues with ProperCarView - anyone can set the BrandOfCar.

383. Fix the ReadOnly expression to only allow the admin to change the BrandOfCar.

384. Run the app. Check with your two users - a and b - where a is admin and b is not. Verify that you understand the read-only expression.

385. Go back to the app and make the BrandOfCarForAdmin column invisible for anyone who's not the admin. Do this by checking the FollowEnable box behind the VisibleExpression.

386. Then, we discover that the RegistrationNumber can be changed by anyone. Fix this by first setting the access group IsAdministrator on the action NewCar.

387. Move the read-only expression from combobox BrandOfCarForAdmin to the read-only expression for the whole ProperCarView.

File:ModelAfterChapter12.zip

Next Chapter:

The_1000_steps_program_to_MDriven_Chapter_13

This page was edited 4 days ago on 05/15/2024. What links here