Saving the layout state with the uPortal URLS

0
No votes yet

Recently both Jon and I have brought news of uPortal URLS that allow you to change settings with in Luminis. (See Change the skin being used for the current session and Minimize Channel State Available ?!?!??? for details). Jon's discovery of the save feature is by far the nicest one, however as pointed out you can not change something in the layout (skin, channel minimized state) and do the uP_save=all at the same time.

In not seeing the uPortal code what I believe happens is that it sees the uP_save=all parameter and saves the current settings, then it sees something like uP_tcattr=minimized&minimized_channelId=n423&minimized_n423_value=true
and proceeds to minimise the channel. As the channel is minimised after the save the desired state is lost.

To solve this I have developed a javascript function that will use AJAX to first go to the URL that changes the state (minimised channel, skin change, or whatever) then it will redirect the user back to their tab with the uP_save=all function.

It does make use of a function called httpRequest which we have in another post of mine (U of M JavaScript functions, I really need to update this post with our new javascript file).

The function in question is the following.

function um_saveSettings(sURL) {
// Strip out any existing save commands.
sURL = sURL.replace(/(&?uP_save=all)/g, "");
var oldLoc = sURL.replace(/\?.*$/, "") + "?uP_save=all";

try {
sURL += "&foo=" + Math.random();
httpRequest("GET", sURL, true);
} catch(err) {}

//alert(sURL + "\n" + oldLoc);
document.location = oldLoc;
}

I now use this code with my skin changing drop down box (more on this later) to write to the database which skin the user wishes to use. For the minimise/maximise buttons you can just wrap the URL in the nested-tables.xsl file with a javascript:um_saveSettings('...');

Now as discussed you are unable to save the state of default channels, and actually what I have discovered is that if you try and save the state after minimising a user default channel it manages to blow out your settings for the user defined channel. More testing is needed to determine the actual pattern.

Comments

Comment viewing options

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

Since channels stay

Since channels stay minimized while your logged in... why don't you just save it all on log-out?

User expierence

The concern I have is what happens if the user does not log out as we would expect. Say the just close the browser, or they have timed out but for some reason they did not get logged out automatically so when they navigate to another area they get a session timed out (I have seen this on my development box occasionally), another failure would be if the server gets punted before they log out.

Given these potential fail points I would like the state of the user's layout to be saved as soon as they make a change, which was the desire for this function.

About the log out button

Still trying to perfect the best user expierence so have now tried adding &uP_save=all to the link for the log out button. But sadly this does not seem to be working for me. Did it work for you?

logout

I have not tried, I imagine that it would not work as the logout page does not seem to be a uPortal URL. You would need to perform some other trickery there. Maybe like overloading the onclick or something of that sort.

Another option would be to periodically save. Make a call asynchronously at the same time the session is tested.

An onclick event

I was thinking of an onclick event on the logout but wanted to check on what you have tried before I go to far. I actually did not notice it was not a uPortal URL but that makes sense of course. :)

What I am finding is that the uP_save=all parameter on uPortal URLS is not reliable. I don't think even setting up a async call during the session timeout check will work. What seems to throw a wrench into things is minimising a default channel.

What I think I am going to do is develop a JSP that will take a set of parameters to update either up_ss_user_atts or up_ss_user_parm with the needed information.

I wonder if it works better

I wonder if it works better in Luminis IV or the newer versions of uPortal?

Where channel states are stored

I have found what table the state of the channel is stored in. It is up_ss_user_atts. Query it for the user_id and the struct_id (i.e. n61 but without the n).

I have also confirmed that if you attempt to do a uP_save=all immediately after you have minimised a default channel that for some reason all previously saved minimsed channels are lost. It is possible this could happen even if you only have the uP_save=all on the logout button and the user minimises a default channel prior to log out though I am not certain.

To handle this within the nested-tables.xsl I am using the following xsl:


<a>
<xsl:attribute name="href">
<xsl:if test="starts-with(@ID, 'n')">
<xsl:text>javascript:um_saveSettings('</xsl:text>
</xsl:if>

<xsl:value-of select="$baseActionURL"/>
<xsl:text>?uP_tcattr=minimized&minimized_channelId=</xsl:text>
<xsl:value-of select="@ID"/>
<xsl:text>&minimized_</xsl:text>
<xsl:value-of select="@ID"/>
<xsl:text>_value=true</xsl:text>

<xsl:if test="starts-with(@ID, 'n')">
<xsl:text>');</xsl:text>
</xsl:if>

</xsl:attribute>
<img src="{$mediaPath}/{$skin}/controls/min.gif"
alt="Image button: Minimize" width="16" height="16" border="0" />
</a>