SAPUI5 - Header and Footer for all applications - url

I'm pretty new to SAPUI5 and have a question:
Is it possible to have for example a base application with a custom Header and footer and to change only the content to the view of another application?
So basically I have for example 3 applications and one base application.
In the base application, there is only a page header and footer. I want to change the page content to the first view of one of the three application (for example based on a parameter, passed in URL).
With another parameter passed in URL, The content changes to the view of the second application.
In dynpros it was possible with subscreens, so a new "application" was inserted as a subscreen.
I hope you understand my question.

What you describe, sounds like the Page navivation concept in UI5, using the Router (as #Bernard said). More info here
You can find a more specific example here which does what you describe. You can reuse the code of this example app using the top right corner icon.
A different scenario is the navigation between different apps. In UI5/Fiori an app is the whole package with its own Component.js. So navigating from one app to another app means to load a new Component.js, start the execution from there, and rerender all the application controls, reset the models, and so on so forth. But this should not scare you if you really want to change the whole context. If you configure your apps correctly, you won't need to download the same libraries again when swtching between apps, because they will be cached. So the browser just needs to rerender (miliseconds for a header and footer).

Related

Update partial view in Layout

I'm working on ASP.NET MVC project with C#.
Ok so I have a layout view where I put my partial view which contains just a div that displays notification messages.
Now from some view I have a button that generate a report in 5 minutes in async manner. While the report being generated I need to allow the user to use other areas of the website.
My action method, once the report is generated successfully, simply returns a string "Success", o/w "Fail".
What I want to do is assign that returned string to the div of the partial view which is on the layout page. So this way the user can see the notification from wherever he is within the website.
How can I do this? Thanks.
There's a number of different things going on here. First, you want the server to update the user with the "success" or "fail" status. This requires 1) using web sockets to create a persistent connection between the client and server, allowing the server to talk to the client without requiring the client to first send a request, or 2) long-polling, which is means the client continuously sending requests at a defined interval to see if the server has any updates.
Long-polling (with AJAX) was the only way to achieve this before the advent of web sockets, which are relatively new, and not universally supported. In particular, IIS8+ is required on the server side, and client side, you need a modern browser, which is really any except IE 9 and below. If you can't run the site on IIS8+ or you need to support legacy versions of IE, then you're stuck with long-polling.
However, with either approach, you're tied to a single page. If the user navigates away, web socket connections are closed and long-polling stops. If the user is still on your site, the next page would need to re-establish all this functionality to keep it working. That's not really difficult - just something to be aware of. It just means that you'll need some universal script running on page load across your site for this.
Now as far as replacing the content of your "partial view" goes. You shouldn't look at it that way. I encourage you to read my post: There's no such thing as a "partial view" client-side, where I get into more detail. The TL;DR version is that all of this updating of the client is happening client-side, and at that point, all you have is the browser DOM. There's no concept of a "partial view". If you want to replace a part of the DOM, you must select it and manipulate it. That's all done with JavaScript and it's all on you. There's no easy "replace this partial view" button.

Vaadin 7: Usage of UI vs. Navigator+Views

In Vaadin 7, a web application can have multiple entry points; the UIs. Each UI can only have a single Navigator containing Views.
We are working on an application which requires multi-level navigation, and for some screens we don't know if we should have a single UI with a navigator or multiple UIs with a shared menu component.
What are the advantages and inconveniences of UI and Navigator? Are there any guidelines about this choice?
I recommend using one UI with Navigator as in my opinion it's enough to do the job. Main inconvinience of many UIs is reload when switching between them. Also you would need to remember about desired consistency, eg. to have same header in each UI. And from my experience you would for sure encounter more problems ;-)
To make it clean you should use MVP patter. I use similar to this one with com.google.common.eventbus.EventBus to handle events. I add eventBus to my views, post events there and handle them in appropriate presenter, without implementing listeners in view which in my opinion is more problematic. As MVP already reserves 'presenter' and 'view' I call Vaadin view 'page'.
You can create header, footer main menu and then content container (eg. some Layout) to wire navigator with:
Navigator n = new Navigator(UI.getCurrent(), layout);
To manage navigation I created PagesEnum and when changing view I post ChangePageEvent which gets PageEnum.SOME_PAGE as parameter. Optionally there is also an id of item to display. So in MainPresenter I have:
#Subscribe
public void changePage(ChangePageEvent event) {
String url = event.getPageName();
if (event.hasId()) {
url += "/" + event.getEntityId();
}
navigator.navigateTo(url);
}
Then there are different possibilities:
in enter method of the page (Vaadin view) make sure that appropriate submenu is displayed.
add it as parameter to ChangePageEvent and handle it in changePage method.
hardcode it in PageEnum as new field, eg. subMenu and create other enum for submenus, chandle it in changePage method.
Submenu will be probably outside of the container that you wire Navigator with, so there you can create SubMenuPresenter and SubMenuView to handle submenu change.
the subject of your question made me sweat very much in the past 2013.
I studied, analyzed and tested various aspects of Vaadin 7 UIs and Navigator.
I looked a great number of framework, wiki and paper on the subject; related and non related to Vaadin 7.
It was some time ago (in early 2013), I'm not fresh on the subject; anyway these are some of the links I'm able to resurrect:
Vaadin MVP Lite for Vaadin 6
MVP4Vaadin - Basic Principle
Views content switching
Vaadin 7 Navigator problem - Vaadin forum
Sub-navigation - Vaadin forum
Our requirements was somewhat similar to the scenario of Vaadin MVP Lite; but we needed more abstraction and flexibility on the composition of the views.
I tried hard to use the provided Navigator but It wasn't easily customizable.
Navigator is a concrete class. UIs can have only one Navigator.
In the Navigator constructor you can find this line:
this.ui.setNavigator(this);
Navigator do a great job for most application with simple needs and provide nice functionality out of the box, but it isn't really intended for extension or customization.
Another aspect to keep in mind is that when changing view with Navigator, you change all the components on screen; you cannot change small bits.
Then I found this guide that put me on a interesting road:
Composing the User Interface, Chapter 7 - MSDN Microsoft
The article is really nice and illuminating; though it has many commonalities with the way Delphi or any other component based framework work, the 'Region' concept was really a bless.
The other chapters are really interesting too (Modular application development, and MVVP).
In the end we adopted the concept of Region with only one UI.
Briefly it works like this:
There is a GUI component that is able to host other component(s); The places where it can hosts other components are like 'holes'. Each hole is registered and it is a Region bonded to a String name (simple hasmap)
Through the Region name, one can 'put' another Vaadin component in a Region in order to make it visible.
What happens when the UI is inited is that one Region is registered (the entire UI) as the 'root' Region.
Then a component that represent the login form is hosted in the 'root' region.
If a successful login attempt is made then another component is hosted in the 'root' region (removing the login component); this very component is a host too: it registers another Region called 'main' and have a left side navigation menu too.
Now, if one want to display a component (the welcome page, for example) can retrieve the 'main' Region and put the component to display.
Vaadin Navigator implements bookmarking and back button support.
I was sad because we didn't develop it but it was not a requirement for our application.
IMHO, the Vaadin guys did a hard but good decision keeping Navigator simple; state management is not easily implemented. It would be nice for the future have a Navigator more extensible.
Anyway I think current Navigator respond to most average needs.
My answer is longer then foreseen; I hope my effort can help.

Integrating custom view without a model into admin

I'm trying to figure out how to integrate a given view into the admin url scheme without manually setting up the url.
Background:
I have three models for which I get data in one CSV file (don't even ask why...). So the import view is not bound to a given model in my concept.
Is there any way to register a view without a model to the default admin site, so that I can add the view to the sidebar block in app_index with an url relative to the app (like "app/import")?
I would like to avoid writing the "admin/app/import" url to my urlconf. However, if that can't be avoided, could someone give me some tips how to at least make them portable? (like variables containing the apps name/base url for the app admin)
I don't know all the magic behind django yet.

Rails: How to separate static content and application but while maintaining a connection between the 2?

Ok this question might sound a bit weird, let me try to explain what I am trying to achieve here.
I need:
- some mostly static pages: home page, about us, etc. the usual suspects
- a full complex rails web app
The web app being the heart of the system will have a lot of stuff, including user authentication (with devise by the way). The application will have a standard navigation menu with possible actions changing depending on user status (login or not, admin or not, etc).
Until now, nothing out of the ordinary.
However for unrelated reason, I MUST have the entry point of the whole system be the home page that will be hosted on another server (ergh).
So now, since my home page and other static pages will be on server A and all the application will be on server B how can I maintain contact between the 2 ?
Meaning: keep my navigation menu dynamic even on my static pages, have a sign-in / sign-up form on my static server but registering an account on the "real" application server ?
They can share the same database, no pb there.
Any pointers on how to do this ? I would really like not to put some iframes on the static site...
Thanks !
Alex
For the signin/signup stuff, you can have your forms action going to B and redirecting to A.
To display the right stuff in the menus you can make a jsonp call(as Chris said) to fetch either the entire header or specific parts of the header that are dynamic.
If you are just looking to include the users name, you can also simply store their name in a cookie and then use javascript to display it in the header.
If there's no cookie display a link to login/signup.
edit: For the jsonp calls take a look at a javascript framework to make the call client side, I personally use jQuery http://api.jquery.com/jQuery.ajax (and look at the jsonp options).
Thinking out loud...
Can you dynamically build the menus using javascript/AJAX in the static code? Perhaps that could query server B (via jsonp) to determine the options...
Its going to have do some "funky" (tm) stuff to track whether there is a user session or not... and linking them...

Creating custom content sections with umbraco

I'm working on an umbraco website just now and one of the requirements is to have a custom section in the back end that can be used to manage publish smaller micro-sites.
I have been able to create the new section and added some nodes to it. What I can't get to work is publishing them and making them viewable at the correct url.
As an example, say i have created a new section called microsite, inside that there is a folder called myportfolio. this should route to something like www.myumbracosite.com/microsite/myportfolio.
Does anyone know how to get this sort of thing working? Is it even possible to publish content from outsite of the main content section?
Any help would be greatly apprechiated.
Kind Regards
Colin G
From my understanding the custom sections are for linking to custom databases or data somewhere that needs an interface.
That said, you can use UrlRewriting and an existing content page with a macro to do something like that.
If you had a page called microsite, then using UrlRewriting you could make the parameter passed in to microsite.aspx (a content page in Umbraco) be "myportfolio".
With a user control on the microsite template it could display some content from your external database (or wherever your custom section stores it).
Not sure that's what you're looking for...
Why are you trying to create a new section for more content? The current Umbraco content area has all kinds of permissions for both users and members. Are the microsites all in the same install of Umbraco?
Another option is that the custom section could simply be used as a setup wizard for the new sites. You could create new content and users in their normal places and just use the new section to create them. It's not too hard to create content from C#, so it would probably be the same as doing it from a user control.
Could you provide a little more info?

Resources