Bug 1734 - right pane refresh during player selection
: right pane refresh during player selection
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Web Interface
: 6.1.0
: Macintosh All
: P2 normal (vote)
: ---
Assigned To: Dan Sully
http://localhost:9000
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-06-29 17:00 UTC by Patrick Cosson
Modified: 2009-09-08 09:19 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments
reload status, playlist and reset hrefs for browser frame (1022 bytes, patch)
2005-10-03 18:44 UTC, KDF
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Cosson 2005-06-29 17:00:05 UTC
problem:  when you change the player you want to control using the drop down menu, the right pane is 
refreshed to home...this is particularly frustrating if you had already navigated to a selection before 
realizing that the wrong player was selected in the menu.

solution:  not refreshing the right pane when you select a player.
Comment 1 KDF 2005-06-29 17:40:08 UTC
The left side must be refreshed in order to have the proper player links in all
of the urls.  However, it might be possible to refresh to the current page
instead of home.
Comment 2 Vidur Apparao 2005-06-30 14:18:35 UTC
Probably won't be fixed for 6.1.
Comment 3 Dan Sully 2005-08-23 22:34:48 UTC
KDF - do you have cookie code to handle this?
Comment 4 KDF 2005-08-23 22:48:58 UTC
Theere is cookie code in the fishbone skin.  html/scripts.js that grabs the last selected browse page.  
For use as a general skin cookie, it would need a bit of tweaking.  The player id is added as a separate 
process, so that helps.  When is the date for 6.2 again?
Comment 5 Dan Sully 2005-08-23 22:54:26 UTC
September 30th 
Comment 6 KDF 2005-08-23 23:01:02 UTC
ok, the existing code should work.  it needs a better calling mechanism for this application.  The setting 
of it will be a bit different, since I use it as a form action.  In most skins, it will have to be tied to the 
click of the links.  Not too hard, just needs some thought and testing.  I can ponder it for a while.  
should be plenty of time if you want to pop this to me.
Comment 7 KDF 2005-09-20 11:44:20 UTC
javascript:
function loadAgain(newPlayer) {
	for(var i=0;i < top.frames.length; i++){
		var myString = new String(top.frames[i].location)
		var rString = "player=" + newPlayer;
		var rExp = /player\=.*(\&?)/gi;
		
		var newString = myString.replace(rExp, rString + "$1");
		top.frames[i].location = newString;
		alert (newString);
	}
}

usage:
<form><td align="left">
   <select name="player"
onchange="setCookie('SlimServer-player',this.form.player.value);
loadAgain(this.form.player.value); " class="stdedit">[% player_chooser_list
%]</select>
</td></form>

strangely, this ONLY seems to work when the last alert() is inluded in the
script.  very annoying!! without it, the page always goes back to the top level
browse.  anyone have any ideas?
Comment 8 KDF 2005-09-20 12:05:23 UTC
ah...nevermind.  stupid remnant onload in another frame was getting in the way.
 final javascript looks like this:

function loadAgain(newPlayer) {
	for(var i=0;i < top.frames.length; i++){
		var myString = new String(top.frames[i].location);
		var rString = "player=" + newPlayer;
		var rExp = /player\=.*(\&?)(.*?)/gi;
		top.frames[i].location = myString.replace(rExp, rString + "$1$2");
	}
}


as a result, for Default skin, we just need to change the switchPlayer
javascript to:

function switchPlayer(player_List){
   var newPlayer = player_List.options[player_List.selectedIndex].value;
   for(var i=0;i < top.frames.length; i++){
	var myString = new String(top.frames[i].location);
	var rString = "player=" + newPlayer;
	var rExp = /player\=.*(\&?)(.*?)/gi;
	top.frames[i].location = myString.replace(rExp, rString + "$1$2");
   }
}
Comment 9 KDF 2005-09-20 13:15:55 UTC
a better version of the script with a tighter regex to replace JUST the player MAC:
function switchPlayer(player_List){
	var newPlayer = player_List.options[player_List.selectedIndex].value;
	
	for(var i=0;i < top.frames.length; i++){
		var myString = new String(top.frames[i].location);
		var rString = newPlayer;
		var rExp = /(\w\w(:|%3A)){5}(\w\w)/gi;
		top.frames[i].location = myString.replace(rExp, rString);
	}
}
Comment 10 Dan Sully 2005-09-20 13:25:32 UTC
Commited as subversion change 4377

Thanks!
Comment 11 KDF 2005-10-03 16:02:34 UTC
It seems that this causes a problem when the urls have commands associated with
them.  The direct replace of frame urls should probably ONLY be done for
playlist.html,browse*.html and setup.html

I'm not sure if checking the url would be more complete/faster than going
through every link in the DOM to replace the player component.
Comment 12 KDF 2005-10-03 16:58:55 UTC
I think something like this for the loop should work:

for(var i=0;i < top.frames.length; i++){
   for (var j=0;j < top.frames[i].document.links.length; j++){
      var myString = new String(top.frames[i].document.links[j].href);
      var rString = newPlayer;
      var rExp = /(\w\w(:|%3A)){5}(\w\w)/gi;
      top.frames[i].document.links[j].href = myString.replace(rExp, rString);
   }
}

Firefox seems to think it is ok, but IE (surprise!) needs to be kicked around a
bit more.  
Comment 13 KDF 2005-10-03 17:32:14 UTC
adding this line above the loop takes care of reloading the playlist page.

benefit of all of this, no refresh of the frames is required.  Safari still
needs to be tested.
Comment 14 KDF 2005-10-03 18:44:07 UTC
Created attachment 887 [details]
reload status, playlist and reset hrefs for browser frame

This is hopefully the best of both worlds.  The status_header and the playlist
are both reloaded with no command params and the new player uri.  whatever is
in the browser side is rewritten via the DOM to change the player component of
the hrefs.
Comment 15 KDF 2005-10-03 23:22:14 UTC
fixed again in trunk change 4532