Change the skin being used for the current session

5
Average: 5 (2 votes)

Today I have stumbled upon a document(Appendix A: URL Parameter Syntax) from uPortal that talks about the various uP_* requests that uPortal handles.

In this document it mentions a URL one can use to set the value of a theme stylesheet parameter. This URL would allow a user to switch to a different skin (see Jon's post Skinning the Portal (Go Skins) about the available default skins in a Luminis III install).

To use it you would construct a url like the following:

http://luminis.server/cp/tag.idempotent.render.userLayoutRootNode.uP?uP_tparam=skin&skin=imm

Until the user logs out, they will be using the imm skin. Sadly it does not adjust the table that Jon speaks of such that when they log in next time it will revert them back to the normal view. Still it is a nice way to test new skins without needing to adjust your database record.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

skinning the url

Holy crap - that works!

Nice find !

Now to find a way to allow the user to pick it and set it :)

pick your color scheme?

I had a thought that since its only session based, that you could have a pallet of 4 colors that a user can click on to choose, it sets a cookie with that 'skin' and resets the URL with the new parameters.
when they log back in, have some javascript read that cookie and reset the URL again for that session.

I'll have some proof of concept code in a bit I think

User skinner

Ok - since I can't attach files to comments, I'll link to the .html page I've created.

http://apps.messiah.edu/portal/chan_skin.html

You'll have to view source to get the code, but its all there (it can be done much more elegantly - but I whipped this off fast)

I've created a webproxy channel called Choose Your Skin and pulled in this file.

You'll see it render something like this to the screen -

| default | imm | matrix | java | Current Skin | Set Current Skin |

Clicking on any of these first 4 will set your skin for your session.
If you log out and come back in, go to the tab you placed this channel and it'll set the last skin you chose.

You can add a call to setCurrentSkin(); in the onload or some other area of the page header (in nested-tables.xsl) so you can set it right away.

I added this code to my /js/util.js file to parse the querystring and detect if a skin was already set
Although now that I think about it - this is going to continue to redirect the page if "skin" is not in the querystring. (here's the querystring script - http://adamv.com/dev/javascript/files/querystring.js

Oh well - have fun anyway - its a proof of concept - not production code.

-Jon

I think there may be some

I think there may be some code for this already in the Preferences channel. Not sure if it's just commented out in the XSL though or if it's been removed from the source too.
Dave

preferences channel?

can you elaborate on this ? Where is the preferences channel?
How do you activate it?

uPortal.jar\org\jasig\portal\

uPortal.jar\org\jasig\portal\channels\CUserPreferences\EditProfile.xsl

OK I found the preferences

OK I found the preferences screen... but not the theme chooser....
Go to edit your layout, then remove the variables in the URL and add:
userPreferencesAction=manageProfiles

Have Fun.

this lets you manage the stylesheets you choose for different browsers... this will come in handy soon as I'm going to start investigating a mobile version of our portal.

Preferences Fun

OK Even more preferences fun :)

Go into Edit Content or whatever your layout manager is...

In firefox, select a link and view source. Copy that links URL. Paste it in the appropriate place of your address bar. Remove all the Get Variables.
add in userPreferencesAction=manageProfiles
Then edit the profile or something, essentially whatever you click on should put a couple more get variables in your address bar. We need the profile ID variable as it's what the next part relies on, so remove the action variable, and add in userPreferencesAction=managePreferences

THis will let you re-order tabs and perform other tasks. On the top right there should be a dropdown of things you can do. I was allowed to change "Global Preferences" and edit the theme name. No list of themes though :(

There is something to play with... Be aware though. I created a profile, set it to deck of cards and assigned it to myself and the current browser.... then when I logged back in I got the old system is not availible error. I think I can reverse it by playing with it in anouther browser or editing the database.

Hope that helps out the cause... I swear I saw a theme selector somewhere in my travels though... I just can't remember what channel....

DAVE