cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
910
Views
10
Helpful
4
Replies

UCCX Trigger application - how do I use an external Cascading Style Sheet?

James Hawkins
Level 8
Level 8

Hello,

I have UCCX 11.6(2) and have written a simple script which gathers data about contact centre settings and returns them as a html page when the script is accessed via a https trigger (port 9443).

So far, so good. I now want toi apply some styling to the returned html page and would prefer to do this using an external stylesheet.

This is where I am struggling - where do I upload my stylesheet and how do I reference it within the html template used by the http triggered script to create the html document?

I have tried putting it in the documents repository under default/webapps/ROOT/  but the web page cannot retrieve them from there.

Any help apprecia

1 Accepted Solution

Accepted Solutions

Yes, you could just embed the CSS in the style tag and make that easier for yourself.

However, the trigger /getfile would be either: a new trigger on the same app, but then you must add logic to handle the new trigger, or a new trigger on a new app, in which case your script is all of 2 steps long to expose documents from the repo without authentication. Careful, because, without controls built in, you are exposing all files in the repo without the need for a password.

RE: Content-type
Try using the Set HTTP Contact Info step, to set the Content-type header to text/html before using the Send HTTP Response.

View solution in original post

4 Replies 4

Anthony Holloway
Cisco Employee
Cisco Employee

If you tell the browser to go fetch a file from the UCCX server, then you will have to have that browser authenticate with UCCX, since the repository is protected behind authentication.

Unless, you indirectly serve the file on port 9443 like this:

https://youruccx:9443/getfile?file=yourfile.css

The script would simply be a String variable to store the file name in, a Get HTTP Contact Info step to retrieve the file name, and a Send HTTP Response, using doc[filevariable] to send the file back to the browser.

 

E.g.,

 

Variables

String the_requested_file = ""

 

Script

Start
the_requested_file = Get HTTP Contact Info (--Triggering Contact--, Parameter the_requested_file = file)
Send HTTP Response (--Triggering Contact--, DOC[the_requested_file])
End

Thanks Anthony,

So the trigger for the http application would be https://youruccx:9443/getfile ?

 

I will give it a go but I guess it might be easier just to embed the style info in the html template rather than use an external css file.

Whilst I have your attention can I ask a related question? - when I access http triggers using Chrome the browser just loads the html file as a text file. Using IE or Firefox the page loads fine. I was wondering if you had seen this behaviour? - I thought it might be because Chrome could not load the external CSS file but it does the same even if I remove the link to the CSS file.

What is really odd is that if I click the link in the repository for the html template that is transformed by the http triggered script Chrome loads it and displays it as a webpage. 

 

Yes, you could just embed the CSS in the style tag and make that easier for yourself.

However, the trigger /getfile would be either: a new trigger on the same app, but then you must add logic to handle the new trigger, or a new trigger on a new app, in which case your script is all of 2 steps long to expose documents from the repo without authentication. Careful, because, without controls built in, you are exposing all files in the repo without the need for a password.

RE: Content-type
Try using the Set HTTP Contact Info step, to set the Content-type header to text/html before using the Send HTTP Response.

Anthony,

Thanks the Set HTTP Contact Info step resolved the issue.

I really appreciate you taking the time to respond.