问题
My company has about 10 heavily used Xpage applications in our IT department. I want to standardize them and make one "application" that contains all 10 apps. I am looking for advice on the best way to do this.
My plan is make a shell application with a application layout like the one below. I will put links to the apps I want include where App1, App2, App3, and so on are.
Each application would have the same banner (top part in black) but everything else for the app layout would be different. I would like to do this in such a way that I can maintain the banner as one design element and inherit to any of the DBs that I need. That way I wouldn't have to touch every db when this changed. Is there a way to do this.
I have a second part to this question. I would like to make part of this app customizable for the user. So would like to let them be able to add links to frequently used Lotus Notes DBs to the app and it would appear only for them. My idea it to make document that contains their username as a key field, and let them add/change/remove links and subset to show only theirs. But is there an better way to do this?
I needed to mention that I am trying to do this in XPiNC. I am having a lot of trouble with this. First I just want to be able to be in App1 and click on App2 and open that App in the same tab as I am in. That way it will appear as if the user is really in the same app.
I have a basicLeafNode with the following code, but it opens in a new tab. How can I get the app to open in the same tab?
<xe:basicLeafNode
label="CompuWeigh Monitor">
<xe:this.href><![CDATA[#{javascript:var url = "notes://KC1/compuweigh.nsf/xpHome.xsp?OpenXpage"
url}]]></xe:this.href>
</xe:basicLeafNode>
回答1:
I have done exactly this but I'm using an osgi plugin on the server. Basically in the application I put on my layout control and give the id for the control a specific name.
Then in the osgi plugin I have has a beforeRenderResponse phaselistener setup. This phaselistener looks at the page being sent back to the browser, sees if there is a layout control component on the page with the specific name that I have given it and if there is it then accesses the layout controls configuration and dynamically adds the links and options to the control as required.
In my case I read in the list of app links from another nsf stored on the server so that I can add/remove links without having to rebuild the osgi plugin. The list is read in to memory and stored in a singleton for reuse so I'm not hitting the config database on every page load.
This method works great for us and has been in use for about 4 years now.
回答2:
An OSGi plugin with an XspLibrary is they way to go if you don't want to duplicate across NSFs.
My Suggestion is to extend the com.ibm.xsp.extlib.tree.impl.BasicNodeList class and then use this as a beanTreeNode. Put this class in your XspLibrary Plugin, and then use throughout your NSFs.
Example of Extending the BasicNodeList:
package com.yourcompany.xsp.layout;
import com.ibm.xsp.designer.context.XSPUrl;
import com.ibm.xsp.extlib.tree.complex.PageTreeNode;
import com.ibm.xsp.extlib.tree.impl.BasicLeafTreeNode;
import com.ibm.xsp.extlib.tree.impl.BasicNodeList;
public class MyBannerNodes extends BasicNodeList {
private static final long serialVersionUID = -6684020744478484250L;
public MyBannerNodes() {
// Adding a link to page within App
PageTreeNode pageNode = new PageTreeNode();
pageNode.setPage("SomePage.xsp");
pageNode.setLabel("Some Page Node");
pageNode.setSelection("/SomePage");
addChild(pageNode);
// Adding a link to some other url
BasicLeafTreeNode linknode = new BasicLeafTreeNode();
XSPUrl url = new XSPUrl();
url.setScheme("https");
url.setHost("your.host.com");
url.setPath("yourPath/Your.nsf/Home.xsp");
url.setParameter("paramOne", "paramVal");
boolean newWindow = true; //
if (newWindow) {
String script = "window.open(\"" + url.toString() + "\");";
linknode.setOnClick(script);
} else {
linknode.setHref(url.toString());
}
linknode.setLabel("Link Node");
addChild(linknode);
}
}
I have only added pagetreenode and basicleaftreenode but you could add other nodes too.
Then on your layout controls, in the bannerNodes section use a managed bean node.
<xe:oneuiApplication>
<xe:this.bannerUtilityLinks>
<xe:beanTreeNode
nodeBean="com.yourcompany.xsp.layout.MyBannerNodes">
</xe:beanTreeNode>
</xe:this.bannerUtilityLinks>
Any changes you make in your Plugin will then be reflected in your NSFs
You can also still manually put nodes before and after this beanTreeNode if needed on a per NSF basis.
If you don't know how to do an OSGi plugin but want to try this out, just put that java file within the NSF and try it from there first.
In regards to your second part, yep there is no problem with doing as you suggested, just add in a routine to the MyBannerNodes class which retrieves your persisted 'user settings' e.g. get documentsbykey, and the repeat over them, adding each one as a node. You could even put them all in a BasicContainerTreeNode so that they might appear as a drop down e.g. with label 'My Links'
回答3:
If you are comfortable with Java then I would create a banner and a footer as an OSGI plugin and insert those elements in the application. As long as you only change the output then you can make changes via in your source, build then deploy.
来源:https://stackoverflow.com/questions/30652042/creating-uniform-application-layout-for-multiple-applications