So, it’s been a while since i’ve written something. Yes, i’m still alive – a lot has happened in personal and professional life!
With K2 smartforms already being at release 1.0.4, it’s about time I wrote something about it!
A lot of customers are using a custom theme to create forms that are in their company’s style/look&feel.
There’s an article on how to create a theme, but here’s my version of it:
- Copy one of the themes in “C:\Program Files (x86)\K2 blackpearl\K2 smartforms Designer\Styles\Themes” to a new folder, which has the name of your theme.
- Copy the CSS file with the same name, into a new file with the name of the newly copied directory. This will be your theme name.
- Do the same for the C:\Program Files (x86)\K2 blackpearl\K2 smartforms Runtime\Styles\Themes folder and CSS file.
- Add the theme name to the K2 database. Insert into the Form.Theme table. Only the name is enough!
- SmartForms is heavily cached for performance. This cache causes theme changes not to show up. Disable this cache by changing the Forms.CombinedResources.Cache.Enabled value to False in the web.config of both the design and runtime site!
- Recycle the application pool, or do an IISRESET.
And that’s basically it! If you want to quickly change some colours, there’s also a K2 smartforms theme builder on the K2 underground.
After the release of K2 1370, there have been some small updates to the K2HostServer.config file for your SmartObject Services configuration.
The basics is pretty simple, KB1370 added the ability to change binding and binding configuration on the REST and WCF endpoints separately. Because the binding configuration also defines the authentication mechanism, this means that REST endpoints could use basicHttpBinding with Basic authentication, while the WCF endpoint uses wsHttpBinding with Windows authentication. It also allows us to run either one endpoint on HTTPS while the other is not.
In my previous post on the K2 Services I showed you how to create a static endpoint, this simplifies the URL and allows you to rename or update the SMO without the endpoint changing. The configuration sections shown in those posts are now outdated and won’t work anymore. Since the KB article describing the change doesn’t have all the parameters, this post is also a note-to-self.
Read more »
Yesteday I tweeted about inline functions and how to get your Icon working properly.
Appart from all the info in Johnny’s blogpost, there are some other catches as well. Just because i keep forgetting them, here’s a mental note to myself.
It’s a normal class library
Start your project with a normal .NET class library. Make sure it’s .NET 3.5. Add references to the following files:
- SourceCode.Workflow.Functions – this one isn’t always needed.
Another thing you have to make sure is the platform type. Make sure you set it to Any CPU. Here are my Project settings:
Make sure you sign the assembly as well!
The PNG Icon itself
The icon itself is a 16x16pixel PNG file.
Something that a lot of people do wrong is add it via the resource configuration page (if you double click on Resource.resx). You do not need to do this, you can simply add the file to a folder called resources and change the properties of the file to ‘Embedded resource’.
K2 has multiple designers and for that reason requires the assembly to be placed in different locations. In general, deployment is as follows:
- K2 Server – Copy the assembly to the Host Server\bin folder of your K2 installation.
- K2 Designer for SharePoint – Copy to the GAC of the SharePoint WFE. The image should work if you copy the PNG to “12(or 14)-hive\TEMPLATE\LAYOUTS\WebDesigner\Images\Functions”
- K2 Studio/K2 designer for SharePoint – Copy the assembly to the “Bin\Functions” of the K2 installation directory.
Together with this info and Johnny’s blogpost, plus the k2 manual, you should now be able to create your perfect inline function! If you still have questions, feel free to comment!