what is difference between view and page flow logic - sap-bsp

I am new in sap.I read the documentation of BSP, i understand controller,view and model,like in java. But i am confused in page flow logic.I have few questions.
1). what is this and what is difference b/w view and page flow logic.
2). what code should i write in view and page flow logic.
3). what is use of page flow logic. Is BSP has four part, model, controller,view and page flow logic.

Page Flow Logic is for your index.html page. The view folder contains your views and controllers.

Related

POST request in controller for custom contact form via AJAX

I've build a custom form which action redirects to a confirm page. In the controller of this page I get the POST values via $request->request->get('fieldName');
To enhance the user experience I'd like to stay on the same page as the form and add a success message to the page. I guess this can be done via AJAX? I tried to follow this guide since it kind of seems to describe what I'm trying to achieve, but I struggle to understand the custom component part. It seems this is only for the backend?
Any help would be appreciated.
The guide you shared is about the administration, if you want to add your functionality to the storefront instead you should be able to follow this guide.
For an overview of how the administration and storefront differs, you can read up the concepts behind those two areas here.

Orchard CMS Editable Content on MVC Views

I'm working on an Orchard module for selling an e-book of sorts. Prior to purchase, a user can view a page showing a sample of the product. After purchase, there is no more need for the sample page, and the user has access to the full product.
I would like to set things up such that if a paying customer tries to access the sample page that they would be redirected to their full product and if a non-customer were to try to go to full product page they would be redirected to the sample. I'd also like my page content to be editable via the Dashboard.
My current implementation:
Controller handling the conditional routing / redirecting based on whether a purchase has been made.
A layer rule for each of my page url's each containing an html widget to provide the page content
This seems to work, but I am wondering what other options I have to accomplish this.
You may be making things way more complicated than they need to be.
Using widgets is unnecessary. It would be much better to build a regular content type and display that. You could serve it through a special controller that checks for a purchase, but even that is unnecessary. Instead, you could create a part that would have the purchase verification logic in its driver's display method. This way, you could even apply the exact same logic to any content type.

Getting ViewModelReference in another ViewModel

We have an application wich has a typical Master/Detail view. The master view displays a list of ticket titles and if you click on a ticket title you see a view with the ticket details.
The master view has a model wich is a list of "ticket" objects each containing more information about a specific ticket. We bound a handler on click which basically instantiates a new detail view and displays it. This works fine, except that we have to give all the config values as primitive data types to the constructor (we know we can't use objects when instantiating)
We thought about another way to do this but couldn't get it working. In the Init() (of the detail view model) we only pass the ID (of the clicked ticket) and wanted to use Mvx.Resolve to get the master view model. So question one would be, can you fetch arbitrary view models inside other view models?
A second idea would be write a base view model class from which all view models in our app inherit, which registers the view model on instantiation to a service so that you can call that service and fetch the view model from anywhere (mediator pattern). Would that be against the framework?
An answer that I have found is "use messages" but to me it seems sort of bulky, at least how I understood this. The detail view model would have to send a message to the master view model "Ok I'm ready now" and then the master view model would say "Alright, heres the configuration".
So to sum up the questions:
Is it possible to fetch certain view models from the framework inside other view models?
Would implementing this by hand be against the framework?
Did we understand the message approach correctly and if no, what would be a more lightweight/generic way of doing it?
Cheers and thanks
Tom
Usually when I have to share data across View Models, I use a Service to manage it. The service is typically injected via IoC.
I treat View Models as a mediator between the Services and the View. Most of my logic is stored in the Service. The only things I have in the View Model are properties for data binding, commands that dispatch to a service, and other presentation level concerns.
For your scenario, I would have the MasterViewModel pass an identifier to the DetailViewModel, where it will ask the ConfigurationService for the configuration by id.
Hope this helps.

How to load user control in page with specification?

I have a user control where I taken two tables, now I want to add this user control to a aspx page. But there is a condition that I have to show only one table.
I am using LoadControl("UC page url") for loading.
Please help me to do this.
Thanks,
Load user control by creating it's object in aspx page. Then you can check your condition by accessing the properties of the user control and implement the logic.

createchildcontrol() - user control, custom control, web control

I am new to .Net trying to understand about different controls here. I know, custom control, an extension of existing control. User control, a complicated control constructed in .ascx file and can be used anywhere in the application. I couldn't the concept of createchildcontrol() and need of it.
thanks !
It plays the role in the lifecycle of a page request to ensure all controls generated dynamically/via code are in place for binding postback values and rendering out to the page. Also note from the MSDN page:
When you develop a composite or templated server control, you must
override this method.
You can check this page for the full list of events, in order, on an ASPX request.

Resources