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.
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!
Don’t worry, I’ve just moved a bit closed to [the] Source[Code Ltd]. I’ve worked at Capgemini and its predecessors for 5 years and it was time to do something different. Capgemini is a wonderful company with lots of opportunities. I’ve also learned a lot there and I’ll always look back at it with good feelings.
I’m now working for K2NE GmbH. K2NE is a K2 distributor run by Ruan Scott who, if you have been in contact with K2 in Europe, you’ll probably know. K2NE operates in the North of Europe, covering Scandinavia, Germany, Swiss and Austria. The opportunity I have at K2NE is a large challenge for me that I could not resist!
Unfortunately, K2 distributors are not allowed to be Insiders so I’m losing that hubris (always wanted to use that word on my blog). That doesn’t mean this blog is going to stop or won’t be updated. I’m still keeping it and I hope to bring more details/real life problem fixes on this blog, together with the new things! And I can assure you, there’s so much goodness to come!
I also want to thank K2’s insider program because it helped me keep up my knowledge and start work at K2NE so easily!