xpages theme add script library to a scpecific XPage - xpages

All my XPages apart from "DefaultLogin.xsp" have a resource of xpServerSide added to them, but wondered if there was a way to add this resource via the theme?

you can add resources to your theme like this:
<theme extends="whatever">
<resources>
<bundle src="prop.properties" var="strings"></bundle> <!-- propertie example -->
<dojoModule name="extlib.dijit.ExtLib"></dojoModule><!-- dojo module example -->
<script src="/whatever.js" clientSide="true"></script><!-- scriptlibray example -->
</resources>
....
...
</theme>
This will add your script, properties or dojoModule to all your XPages if this theme is selected.
You can also extend this by adding a rendered attribute to the <resource> tag. to load it only on special conditions. e.g.:
<resource rendered="#{javascript:context.getUserAgent().isFirefox()}">
<content-type>text/css</content-type>
<href>stylesFF.css</href>
</resource>

Related

XPages - Bootstrap Customization Affects valuePicker Behaviour

Without Customization - valuePicker works fine
https://serveragi12.agi-imc.de/BootstrapTest.nsf
With Customization (modified bootstrap.min.css as resource in Theme) - valuePicker not working
https://serveragi12.agi-imc.de/BootstrapTestCustomized.nsf
Compare the button appearance for the two cases, background-color for btn-warning modified and taking effect.
MORE INFO:
The only difference is that in the customized case the backround-color of a button was modified in the bootstrap.min.css, and that bootstrap.min.css was then referenced as a resource in the theme.
It is strange that changing of a background-color can affect the functioning of a valuePicker.
THEME CODE (for BootstrapTestCustomized):
<theme extends="Bootstrap3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="platform:/plugin/com.ibm.designer.domino.stylekits/schema/stylekit.xsd">
<resource>
<content-type>text/css</content-type>
<href>/css/bootstrap.min.css</href>
<media>screen</media>
</resource>
</theme>

XPages favicon with oneui theme

I want to set a favicon in XPages. I am using Domino 8.5.3 with the latest 8.5.x version of the extlib. As application theme oneuiv2.1 is used.
I tried setting the pageIcon attribute in the XPage without success. Adding a link attribute to the header using
<xp:this.resources>
<xp:headTag tagName="link" rendered="true" loaded="true">
<xp:this.attributes>
<xp:parameter name="rel" value="icon"></xp:parameter>
<xp:parameter name="href" value="favIcon.png">
</xp:parameter>
<xp:parameter name="type" value="image/png">
</xp:parameter>
</xp:this.attributes>
</xp:headTag>
</xp:this.resources>
did not change the favicon. I found in various blogs, that I have to add a control to the application theme, for example:
<control>
<property>
<name>pageIcon</name>
<value>favicon.ico</value>
</property>
</control>
However I use the provided oneUi theme and do not want to create a custom theme. Is there a way to either set the favicon directly or modify the theme without creating a complete new one?
I think you are missing the control name in your theme rule.
Here is the syntax of the theme rule that works for me. (Taken from Tim Tripcony's HowYaBean demo application referenced on NotesIn9 and downloadable from here). I use it a ton. It takes the icon from the NotesDatabase (remember the one from the old Notes workspace that has not yet been pried out of my cold dead fingers). It also works with image or file resources.
<control override="false">
<name>ViewRoot</name>
<property>
<name>pageIcon</name>
<value>/$icon</value>
</property>
<property>
<name>pageTitle</name>
<value>#{database.title}</value>
</property>
</control>
This works for me - icon shows in tab bar and shortcut created from application URL.
Image resource (PNG image) with name img_ApplicationIcon16. The name is generic for every application, but each NSF contains different image.
Every XPage has property pageIcon="/img_ApplicationIcon16"
It renders as <link rel="SHORTCUT ICON" href="/path/database.nsf/img_ApplicationIcon16">
In my case, I did not want to use theme, too.
Import the favicon.ico file as file resource instead of image resource
Add the following code to the selected theme:
<control>
<name>ViewRoot</name>
<property>
<name>pageIcon</name>
<value>/favicon.ico</value>
</property>
</control>
Set up the application to use the theme containing the reference for the favicon.
Create a new xpage for testing, or delete the browser cache.
This works for me properly. In the browser window you should see the folloving source:
<link rel="SHORTCUT ICON" href="/db.nsf/favicon.ico">
(db.nsf is your database.)
If still not work check the xpage: "All properties-styling-disableTheme" should not be enabled.

How can I add locale to a resource in an XPages theme?

I am trying to add a local for the date picker and I have the following code in my XPages theme
<resource>
<content-type>application/x-javascript</content-type>
<href>#{javascript:return "js/jquery-ui.datepicker_"+view.getLocale()+".js"}</href>
</resource>
unfortunately this gets passed straight through to the browser as a string
< script type="text/javascript" src="whatever.nsf/#%7Bjavascript:return%20%22js/jquery-ui.datepicker_%22+view.getLocale()+%22.js%22%7D" >
How can I get the EL to work? And for that matter because it is in the theme can it even tell at that point what the locale() is ?
First, I'd recommend using the <resources/> syntax instead. Secondly, instead of a single SSJS expression, try a mixed expression using just standard EL:
<resources>
<script clientSide="true" src="/js/jquery-ui.datepicker_#{view.locale}.js" />
</resources>

Theme not working for Button

I started playing with themes. I was able so create CSS and associated the CSS to various table elements. Works fine.
Now I am trying to do the same with a button. But it does not seem to work. If I apply the styleclass right to the button then it works.
<theme extends="oneuiv2.1">
<resource>
<content-type>text/css</content-type>
<href>app.css</href>
</resource>
<resource>
<content-type>text/css</content-type>
<href>viewpicklistCC.css</href>
</resource>
<control>
<name>Button</name>
<property>
<name>styleClass</name>
<value>MyButton</value>
</property>
</control>
<control>
<name>HtmlTable</name>
<property>
<name>styleClass</name>
<value>PNCTable</value>
</property>
</control>
<control>
<name>HtmlTd</name>
<property>
<name>styleClass</name>
<value>PNCTableCell</value>
</property>
</control>
</theme>
.MyButton {
width:179.0px;
font-family:Arial,sans-serif;
font-size:18pt;
color:rgb(255,128,0);
font-weight:bold
}
In a theme you need to use the theme id of a control in order to target it. This is not the same as the CSS style class.
You can set the theme id manually on a control (in Style - Theme, or in All properties - Style - Theme id) and then target the control by referring to this theme id.
Or you can use the default theme id for a control. The XPageswiki contains a list of default theme ids for core controls:
http://xpageswiki.com/web/youatnotes/wiki-xpages.nsf/dx/Work_with_themes#themeID+values+for+core+controls
So in your case you need to use one of the following theme ids in order to target your button:
Button: Button.Command
Button with type=submit: Button.Submit
Button with type=cancel: Button.Cancel

How can I change the color of an mdiTab that already has a style assigned to it? (Infragistics)

I want to make the color of a tab change on a certain event. The ISL file for the project contains the following:
<styleLibrary>
<styleSets defaultStyleSet="Default">
<styleSet name="Default" viewStyle="Standard">
...
<styles>
...
<style role="TabItem">
<states>
<state name="Normal">
<resources>
<name>Header</name>
</resources>
</state>
<state name="HotTracked">
<resources>
<name>HeaderHotTrack</name>
</resources>
</state>
<state name="Active">
<resources>
<name>HeaderActive</name>
</resources>
</state>
...
</states>
</style>
</styles>
</styleSet>
<resources>
...
<resource name="Header" backColor="White" foreColor="Black" backColor2="255, 152, 53" backGradientStyle="Vertical" />
<resource name="HeaderActive" backColor="255, 237,175" foreColor="Black" backColor2="255, 127, 0" backGradientStyle="Vertical" />
<resource name="HeaderHotTrack" backColor="25, 237, 175" foreColor="White" backColor2="255,127, 0" backGradientStyle="Vertical" />
<resource name="HeaderHasUpdates" backColor="Green" foreColor="Black" backColor2="White" backGradientStyle="Vertical" />
...
</resources>
</styleLibrary>
When the program begins, it is loaded with:
Infragistics.Win.AppStyling.StyleManager.Load()
When the tab is selected, the tab is colored as the resource named "HeaderActive". At a certain trigger, I want it to be switched to the resource named "HeaderHasUpdates." What I currently have which isn't working is this (where mdiTab is an Infragistics.Win.UltraWinTabbedMdi.MdiTab):
mdiTab.Settings.TabAppearance.StyleResourceName = "HeaderHasUpdates"
If I remove all of the resources except the "HeaderHasUpdates" one, the forecolor actually does change, which makes me think there's another place where the colors are being set and at that spot, the foreColor isn't being set. I'm just unfamiliar with the precedence of color styles.
So what can I do to change the style?
-- EDIT 4/17/2012 --
For the record, the fix added in the following under <styleSet> and above <styles>:
<componentStyles>
<componentStyle name="UltraTabbedMdiManager" resolutionOrder="ControlThenApplication">
<properties>
<property> name="ViewStyle" colorCategory="{Default}">Office2003</property>
</properties>
</componentStyle>
</componentStyles>
Just in case you didn't want to use the AppStylist
Never done that so this need to be tested, however I think you could try to define in your ISL file two StyleSet. (Style Explorer-> Add)
In the first you set your default style, in the second you define only the Style for the TabHeader.
When you need the different style, just set the StyleSetName to the second StyleSet available in your ISL file. Don't know if some kind of refresh will be needed.
Also if you want to override the settings from appstylist with appearances defined at design time, you would need to check the ResolutionOrder in AppStylist
Go to "Component Role Settings->Infragistics Components->UltraTabControl->ResolutionOrder"
The ResolutionOrder is, by default, set to ApplicationThenControl which
means that the AppStyling property values take precedence over any control
settings for the corresponding appearance properties. In your case, you
should change that to ControlThenApplication so the properties set on
the control will take precedence.

Resources