XPages favicon with oneui theme - xpages

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.

Related

Domino Designer shows 'unknown property' on my custom tag in extension plugin

I am currently extracting my common xpage code from my databases and packaging it in an eclipse extension plugin. Everything is working fine except for my extension of RichText tag.
The tag shows up in the Designer Palette and I can insert it onto the page, but none of the standard attributes (id, rendered, etc.) are recognized and I get an 'unknown property' error. This means I cannot build the NSF.
This same code worked in the the database itself, but does not work when I use it in the plugin.
Does anyone have any idea why this WORKS in my database but DOES NOT WORK in my plugin?
The xsp-config is as follows (almost exactly the same as that in the openntf XPages Rich Text Editor Evolution project; just namespace-uri, default-prefix and component-class have been changed):
<?xml version="1.0" encoding="UTF-8"?>
<faces-config>
<faces-config-extension>
<namespace-uri>http://aivisto.com/xsp/control
</namespace-uri>
<default-prefix>ap</default-prefix>
</faces-config-extension>
<component>
<description>A control that displays a field for entering multiple
lines of rich text.
</description>
<display-name>Rich Text</display-name>
<component-type>com.ibm.xsp.InputRichText</component-type>
<component-class>com.adpunctum.aivistox.extlib.ckeditor.component.InputRichText</component-class>
<group-type-ref>com.ibm.xsp.group.core</group-type-ref>
<group-type-ref>com.ibm.xsp.group.core.prop.styleClass</group-type-ref>
<group-type-ref>com.ibm.xsp.group.core.prop.title</group-type-ref>
<group-type-ref>com.ibm.xsp.group.events.prop.onclick</group-type-ref>
<group-type-ref>com.ibm.xsp.group.events.onkey</group-type-ref>
<group-type-ref>com.ibm.xsp.group.focus</group-type-ref>
<group-type-ref>com.ibm.xsp.group.i18n</group-type-ref>
<group-type-ref>com.ibm.xsp.group.input.prop.disabled</group-type-ref>
<group-type-ref>com.ibm.xsp.group.input.prop.onchange</group-type-ref>
<group-type-ref>com.ibm.xsp.group.input.prop.readonly</group-type-ref>
<group-type-ref>com.ibm.xsp.group.outerStyleClass</group-type-ref>
<group-type-ref>com.ibm.xsp.group.filter</group-type-ref>
<group-type-ref>com.ibm.xsp.group.dojoUsage.deprecated</group-type-ref>
<group-type-ref>com.ibm.xsp.group.aria.role</group-type-ref>
<property>
<description></description>
<display-name>CSS Style</display-name>
<property-name>style</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<pass-through>true</pass-through>
<designer-extension>
<category>styling</category>
<editor>com.ibm.workplace.designer.property.editors.StylesEditor</editor>
<styles-excluded>background, font</styles-excluded>
</designer-extension>
</property-extension>
</property>
<component-extension>
<javadoc-description>
<p>Rich Text Control</p>
Control that provides Rich Text Editor functionality through CKEditor
</javadoc-description>
<base-component-type>com.ibm.xsp.UIInputRichText</base-component-type>
<renderer-type>com.ibm.xsp.InputRichText</renderer-type>
<tag-name>inputRichText</tag-name>
<designer-extension>
<category>Aivisto Extension</category>
</designer-extension>
</component-extension>
</component>
</faces-config>

styleClass property always gets overwritten when adding style in theme

I am using a theme for my XPage application to set global look&feel settings so my configuration for the viewRoot looks like this:
<control dojoTheme="true">
<name>ViewRoot</name>
<property>
<name>pageIcon</name>
<value>/favicon.ico</value>
</property>
<property>
<name>style</name>
<value>#{javascript:
var response = facesContext.getExternalContext().getResponse();
response.setHeader("X-UA-Compatible", "IE=8");
}</value>
</property>
<property mode="concat">
<name>styleClass</name>
<value>claro</value>
</property>
</control>
Although I use the mode="concat", which I thought just adds (like array.concat) my properties to my viewRoot but it always overwrites it, so that my <body> looks like this:
<body class="claro"... instead of:
<body class="xsp lotusui claro"...
I experienced this problem with other <controls>/<properties> as well.
My current solution is that I set the property value to xsp lotusui claro not just only claro to prevent my body from loosing all oneui/xsp styles. Anyone got a idea why the mode="concat" is not working in my example? or is this mode for something else?
I could not find a good documentation of all theme properties so if someone got a good link, I would be glad if he could share it.
EDIT:
As I am also working on a XPages Theme at the moment I got more curious and played a little bit with this. As far as I can see your code works perfectly fine . In my Tests I experienced that you can concat a style definition to a pre-defined styleClass. So you can create an XPages and define a body style class like this with a body-styleClass predefined within the XPage:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" styleClass="mystyle">
<xp:button value="Label" id="button1" themeId="bt"
styleClass="oink">
</xp:button>
</xp:view>
Using a Theme you can now add another (or even multiple) styleClasses:
<control>
<name>ViewRoot</name>
<property mode="concat">
<name>styleClass</name>
<value>claro</value>
</property>
</control>
In your scenario, you want to concat the styleClass definition which is added as "default" styleClass - and this seems to be an issue or conflict.
So, for now this is my conclusion. If there is anybody else having more and deeper insights I would also be interested in deeper insights into Themes and inheritance in particular.
Old comment:
As far as I know, to only add the attribute, you should set the override-property of the control to false.
Example (your code changed):
<control dojoTheme="true" override="false">
<name>ViewRoot</name>
<property>
<name>pageIcon</name>
<value>/favicon.ico</value>
</property>
<property>
<name>style</name>
<value>#{javascript:
var response = facesContext.getExternalContext().getResponse();
response.setHeader("X-UA-Compatible", "IE=8");
}</value>
</property>
<property mode="concat">
<name>styleClass</name>
<value>claro</value>
</property>
Hope that works and helps,
Michael
I know it has been a while, but did you remember to "extend" the theme you want to include the original classes from? i.e.:
<theme extends="oneui">
<control….>…</control>…
</theme>

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 to get space between icon and label on button?

I am working on one of my first xPages applications. I want to add a nice little icon (from the FamfamFam collection) to some of my buttons, e.g. "New","Save", "Cancel", etc.
I add the GIF images as image resource, and specify the image for the buttons I want the icons on.
It all works, but the label (text) on the button is right next to the icon. I would like them to be spaced out some, perhaps 4-6 pixels. I would prefer not to have to add spaces to the label, I am sure there is a better way, probably using CSS somehow.
Anyone know a good way to do this?
OneUI v2.1 is set as the theme for the application and I am using Domino Designer 8.5.3 and Domino Server 8.5.3.
You can use the following custom CSS to add some margin to the right of the icon:
.lotusBtn img {
margin-right: 10px;
}
To add a space I use an <xp:text themeId="Text.Blank"></xp:text>
Text.Blank is in my Theme resource with the following control block:
<control override="true">
<name>Text.Blank</name>
<property mode="override">
<name>escape</name>
<value>#{false}</value>
</property>
<property mode="override">
<name>value</name>
<value>&nbsp;</value>
</property>
</control>

In Sharepoint I need to include a preview image for the screen of selecting layout for a new page

In Sharepoint 2007, I have created a layout. As you know when the user creates a page he chooses a layout from a listbox.
When you select a different element in the listbox, there is a preview image that changes on the left.
I thought this was controlled by the node PublishingPreviewImage in the xml of the layout. I have verified that the image exists in that place.
It is not working.
The code I use is:
<File Path="TituloTextoCtrl.aspx" Url="TituloTextoCtrl.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists ="TRUE">
<Property Name="PublishingPreviewImage" Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/titulotextoctrl.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/titulotextoctrl.png" />
<Property Name="MasterPageDescription" Value="Plantilla Titulo+Texto+Control" />
<Property Name="ContentType" Value="Titulo+Texto+Control" />
<Property Name="PublishingAssociatedContentType" Value=";#Vialibre_ContentTypeGeneral;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39005215cca003b74e479baa123eb1dc5702;#" />
</File>
You also need XML to provision the image:
<Module Name="MyPreviewImages" Url="_catalogs/masterpage" IncludeFolders="??-??" Path="" RootWebOnly="TRUE">
<File Url="titulotextoctrl.png" Name="Preview Images/titulotextoctrl.png" Type="GhostableInLibrary">
</File>
</Module>
first of all upload yor layout page image in site collection document library or picture libary. Then Go to site actions--> site settings-->Galleries-->master pages and pagelayouts-->. In pagelayouts you can see your new layoutpage.
choose edit properties of your layoutpage there you can see the properties of that layout page. There is one column called preview image, give the url of image there that you already uploaed in the docu libary. click on Ok, now you have got preview image of your layout page.
Thx to Rich Bennema and Hojo for answering, there are right, but at the same time, my problem is that this layouts were deployed, and when I deploy again changing the PublishingPreviewImage, the layout is not updating. So my problem was a problem of controlling events so that everytime that I deploy the layouts are recreated in case there is changes.
This I know because it has worked for new layouts.
So for those who try this. Use the code I have provided with the one of Rich Bennema to upload the image.

Resources