This is part 2/3 about customizing Storefront Services “Receiver for Web” stores using JavaScript (updated to reflect the changes invoked with StoreFront Services 1.2). Check out part 1/3 on how to hide applications and part 3/3 on how to autostart applications.

One of the cool new features of Storefront Services is the concept of “subscriptions”. Users can pick resources they use most often and by subscribing to them, they are displayed in a central location. No more browsing trying to remember what category or folder an app is linked to.

But what if you want to provide a pre-populated list of apps to users (for example to make the transition from Web Interface a little easier)?

To achieve this, Storefront leverages “keywords”. You could use “KEYWORDS:Auto” in an app’s description field in XenApp to make it an automatical subscription for all users.

Yet, users can still unsubscribe from resources that have been provisioned automatically and because of the concept of “subscriptions”, removing an app breaks the “automatic assignment”. That means, if you remove a subscription for an app that has the “KEYWORDS: Auto” description, they will no longer show up in your store automatically (so you need to re-subscribe manually).

Wouldn’t it be nice to have true “mandatory” apps?

In a future version, the different keyword types might be extended to offer this feature, but until then these little JavaScript tweaks will help you to accomplish the same.

Before we start, let’s create a backup copy of “C:\wwwroot\Citrix\%Your_Web_Store_Name%\scripts\Default.htm.script.min.js”, re-format it using http://jsbeautifier.org/ and edit as follows. Note that the line numbers might be slightly different, either because of the editor used or a release change in jsbeautifier.

Below line 5858 (below “c = CTXS.canLaunchResources(g)”), insert:

if (g.encodedName.indexOf(“notepad”) != -1) {
var mandatory = true;
b += ” mandatory”;
} else {
var mandatory = false;
}

Replace lines 5887-5889 (between “b += <div class=myapps-status></div>;” and “b += </div>”) with:

b += ‘<div class=”myapps-name”>’ + g.displayNameBelt + “</div>”;
if (!mandatory) {
var f = ‘ title= “‘ + a.localization.string(“Remove”) + ‘”‘;
b += ‘<div class=”myapps-removehotspot”><div></div></div>”;
}

Below line 6182 (“n;”) insert:

check = f(this).hasClass(“mandatory”);

Replace line 6193 (“n = e”) with:

if (!check) {
n = e
} else {
n = a
}

Note: Replace %resource-name% accordingly with the name of your application, desktop or content.

What have we done?
These tweaks will remove the little “x” that appears when you hover over the icon of a subscribed app and also it will surpress the context menu from being displayed (which also has a link to “remove app”).
Now applications cannot only be subscribed to automatically using the description “KEYWORDS:Auto” but also users can no longer remove them if you deploy these sniplets.

As always, be aware that this solution is provided “as is” and if something goes wrong Citrix support might ask you to re-instate the original source files.
Keeping a backup is always a good idea, but if you forgot to do this, you can simply create a second “Receiver for Web” store and copy any lost script files from there.