Updated Server files with autologout and last name support

Just talk about kJams stuff with each other, describe things you did that worked, talk about your setup, anything that doesn't fit into the other forums!
Post Reply
DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Updated Server files with autologout and last name support

Post by DeusExMachina »

Hey Dave, I said, kJams server really needs an auto log out capability, since people who use the laptops I set up to select songs usually just walk away without logging out. Then the next person comes along, and they search for songs using the previous person's log in, and so on, so one singer ends up with everyone's songs.
Also, I said, there really should be a way to have singers enter a last name or initial, since otherwise you end up with lots of John 1-John13s and lots of other biblical references in your venue list.

Great idea, says Dave, blah blah Windows, blah blah on the list, blah blah version 1.0. (Sorry dave :twisted: )

So I took matters into my own hands! ;)

So now, without further ado, here is a working substitute for the two files in server. Just place them in:
/Applications/kJams Pro.app/Contents/Resources/server

Don't know how to get there? Then don't do it! I am not providing further instructions for a reason!! :)

Replacement for mainscreen.html:

Code: Select all

<html>
	<head>
		<title>kJams Server</title>
	
		<script src="spry/xpath.js"></script>
		<script src="spry/SpryData.js"></script>
		<script src="ui.js"></script>
		<script src="data.js"></script>
		<script src="main.js"></script>
		<script src="common.js"></script>
		<script type="text/javascript">
			var timer = 0;
			function set_interval() {
				//the interval 'timer' is set as soon as the page loads
				timer=setInterval("auto_logout()",120000);
				// the figure '120000' above indicates how many milliseconds the timer be set to.
				//Eg: to set it to 2 mins, calculate 2min= 2x60=120 sec = 120,000 millisec. So set it to 120000
			}
			function reset_interval() {
				//resets the timer. The timer is reset on each of the below events:
				// 1. mousemove   2. mouseclick   3. key press 4. scroliing
				//first step: clear the existing timer
				if (timer != 0) {
					clearInterval(timer);
					timer = 0;
				}
				//second step: implement the timer again
				timer=setInterval("auto_logout()",120000);
				//completed the reset of the timer
			}
 
			function auto_logout() {
				//this function will redirect the user to the logout script
				window.location=logoutlink;
			}
		</script>
		
		<style type="text/css">
			#main {
				padding: 10px;
				margin-right: 20px;
				margin-left: 20px;
				border-style: solid;
				border-color: #000000;
				border-width: 1px;
				background: url('metal.jpg');
				cursor: default;
			}
			
			#title {
				padding-right: 30px;
				text-align: left;
				font-family: Arial Black;
				font-size: 24pt;
				font-weight: bold;
				margin-bottom: 5px;
			}
			
			#search {
				width: 100%;
				text-align: center;
			}
			
			#searchfield {
				height: 21px;
				width: 144px;
				background: url('search.png');
				border-width: 0px;
				padding-left: 7px;
				padding-right: 7px;
				padding-top: 2px;
			}
			
			#left {
				float: left;
				width: 200px;
				margin: 10px;
				margin-left: 0px;
			}
			
			#status {
				text-align: center;
				color: #333333;
				padding: 0px;
				margin: 0px;
			}
			
			#playlists .KJList {
				overflow: auto;
				height: 240px;
				padding: 0px;
				background-color: #FFFFFF;
				border-style: solid;
				border-color: #999999;
				border-width: 1px;
				padding: 0px;
			}
			
			#playlists .KJList td {
				padding: 0px;
				margin: 0px;
			}
			
			#playlists .KJList table {
				margin: 0px;
				padding: 0px;
			}
			
			#photo {
				padding: 3px;
				width: 190px;
				height: 143px;
				max-height: 150px;
				overflow: hidden;
				margin-top: 5px;
				background-color: #FFFFFF;
				border-style: solid;
				border-color: #999999;
				border-width: 1px;
			}
			
			#songs {
				border-style: solid;
				border-color: #999999;
				border-width: 1px;
				margin-left: 220px;
				background-color: #FFFFFF;
				min-height: 400px;
			}
			
			#message, #waiting, #msg_dosearch, #msg_error {
				text-align: center;
				font-size: 14pt;
			}
			
			#songs .KJList {
				padding: 0px;
				height: 400px;
				overflow: auto;
				background-color: #FFFFFF;
			}
			
			.KJListColumn {
				padding: 0px;
				margin: 0px;
				background: url('column-bg.jpg');
				cursor: default;
			}
			
			.KJListColumn td {
				border-style: solid;
				border-color: #999999;
				border-width: 0px;
				border-right-width: 1px;
			}
			
			.KJListColumn .primary {
				background: url('column-selected-bg.jpg');
			}
			
			.KJListItem, .KJListItem_alt, .KJListItem_selected, .KJListItem_drag, .KJListItem_target, .KJListItem_alt_target {
				padding: 0px;
				padding-top: 0px;
				padding-bottom: 0px;
				margin: 0px;
				cursor: default;
				border-style: solid;
				border-color: #FFFFFF;
				border-width: 0px;
				border-bottom-width: 1px;
			}
			
			.KJListItem_alt {
				background-color: #EEEEFF;
			}
			
			.KJListItem_selected {
				background-color: #4444FF;
				color: #FFFFFF;
			}
						
			.KJListItem_target, .KJListItem_alt_target {
				border-style: solid;
				border-color: #000000;
				border-width: 0px;
				border-top-width: 1px;
			}
			
			.KJListItem_alt_target {
				background-color: #EEEEFF;
			}
			
			.KJListItem_drag {
				position: absolute;
				border-style: solid;
				border-color: #000000;
				border-width: 1px;
				background-color: #DDDDDD;
				filter:alpha(opacity=40); /* for IE */
				-moz-opacity:0.4;
				opacity: 0.4;	
			}
			
			.KJList input {
				padding: 0px;
				margin: 0px;
				border-style: solid;
				border-color: #000000;
				border-width: 1px;
			}
			
			.KJList input:active {
				background-color: #000000;
				color: #FFFFFF;
			}
			
			#playlists .KJListItem, #playlists .KJListItem_alt, #playlists .KJListItem_selected, #playlists .KJListItem_target, #playlists .KJListItem_alt_target {
				background: url('playlist-icon.gif');
				background-repeat: no-repeat;
				padding: 0px;
				padding-left: 20px;
				border-style: solid;
				border-color: #FFFFFF;
				border-width: 3px;
			}
			
			
			#playlists .KJListItem_alt {
				background-color: #EEEEFF;
			}
			
			#playlists .KJListItem_selected {
				background-color: #4444FF;
				color: #FFFFFF;
			}
			
			#playlists .KJListItem_target, #playlists .KJListItem_alt_target {
				border-color: #000000;
				background-color: #9999FF;
			}

			.clear {
				clear: both;
			}
		</style>
	</head>
	
	<body onLoad="set_interval()" onmousemove="reset_interval()" onclick="reset_interval()" onkeypress="reset_interval()" onscroll="reset_interval()">
		<div id="main">
			<table><tr><td id="title"><nobr>Singer: {singer}</nobr></td><td id="search"><nobr>Search Library: <input type="search" id="searchfield" name="search" onkeypress=searchKeyPressed(event) />&nbsp;<input type="submit" style="" name="dosearch" value="Go" onclick=m_doSearch() /></nobr></td><td id="help"><nobr>[ <a id="helplink" href="">Help</a> ] [ <a id="logoutlink" href="">Logout</a> ]</nobr></td></tr></table>
			
			<div>
				<div id="left">
					<div id="playlists"></div>
					<div id="photo"><img src="kjams-main.jpg" /></div>
				</div>
				
				<div id="songs"><p id="msg_error"></p><p id="msg_dosearch">Please enter a serach.</p><p id="message">No Playlist Selected.</p><p id="waiting">Please wait, loading playlist...</p></div>
				
				<div class="clear">&nbsp;</div>
				<div id="status">Welcome to kJams!</div>
			</div>
		</div>
		
		<script language="javascript">
			//Bind key press function
			document.onkeyup = m_keyPressed;
		
			//Hide message fields
			document.getElementById("waiting").style.display = 'none';
			document.getElementById("msg_dosearch").style.display = 'none';
			document.getElementById("msg_error").style.display = 'none';
			
			//Plug in help and logout URLs
			document.getElementById("helplink").href = url_help;
			document.getElementById("logoutlink").href = url_login;
			
			//Playlists
			m_populatePlaylists();
		
			if (0) {
				//Song list
				var songs = new KJList();
				songs.create(document.getElementById("songs"));
				songs.setColumns(Array("#", "Song Name", "Artist", "Pitch", "Add to", "Add to"), 1);
				
				//Set clipping
				songs.setClipping({'right' : songs.getColumnWidth(5) + songs.getColumnWidth(4) + songs.getColumnWidth(3)});
				
				getSongs(url_songs, populateList, 'playlist=1');
				
				function populateList(songList) {
					for(var i = 0; i < songList.length; i++) {
						songs.addItem(songList[i]['number'], Array(songList[i]['number'], songList[i]['name'], songList[i]['artist'], "<select><option>+6</option><option>+5</option><option>+4</option><option>+3</option><option>+2</option><option>+1</option><option selected>0</option><option>-1</option><option>-2</option><option>-3</option><option>-4</option><option>-5</option></select>", "<input type=\"submit\" value=\"Tonight\" />", "<input type=\"submit\" value=\"Favorites\" />"), null, null, false);
					}
					
					songs.color();
				}
			}
		</script>
	</body>
</html>
Replacement for newsinger.html:

Code: Select all

<html>
	<head>
		<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
		<title>kJams New Singer</title>
		
		<script src="common.js"></script>
		<script src="./spry/xpath.js"></script>
		<script src="./spry/SpryData.js"></script>
		<script src="data.js"></script>
		<script type="text/javascript">
			function catname(){
				var firstname = document.forms[0].singerfirstname.value;
				var lastname = document.forms[0].singerlastname.value;
				document.forms[0].singername.value = firstname + " " + lastname;
			}
			function validate(thisform) {
				with (thisform){
					if (singerfirstname.value=='') {
						alert('Hey, unless you\’re Obama, ya gotta give me a first name too. Try again.');
						event.returnValue=false;
					}
					else if (singerlastname.value=='') {
						alert('What, you think you\’re Madonna? A last name is required. Lets try this again..');
						event.returnValue=false;
					}
						
				}
			}
		</script>
		<style type="text/css">
			#main {
				width: 400px;
				margin-left: auto;
				margin-right: auto;
				text-align: center;
				background: url('metal.jpg');
				border-style: solid;
				border-color: #000000;
				border-width: 1px;
			}
			
			#main p {
				font-size: 24pt;
			}
			
			#main table {
				margin-left: auto;
				margin-right: auto;
			}
			
			#main img {
				margin-bottom: 10px;
			}
		</style>
	</head>
	
	<body>
		<div id="main">
			<p>New Singer</p>
			<img src="kjams.png" /><br />
			<font color="#FF0000"></font>
			<form id="form" method="POST" action="" onsubmit="validate(this);">
				<table>
					<tr><td>First Name: </td><td><input type="text" name="singerfirstname" value="" onkeyup="catname()"/></td></tr>
					<tr><td>Last Name: </td><td><input type="text" name="singerlastname" value="or last initial" onfocus="this.value= (this.value=='or last initial') ? '' : this.value" onBlur="this.value= (this.value=='') ? 'or last initial' : this.value" onkeyup="catname()"/></td></tr>
					<tr><td>Password: </td><td><input type="password" name="password" value="" /></td></tr>
					<tr><td>Again: </td><td><input type="password" name="confirm" value="" /></td></tr>
					<input type="hidden" id="singername" name="singername">
					<tr><th colspan="2"><input type="submit"  name="submit" value="Jam Out!" /></th></tr>
				</table>
			</form>
			<p style="font-size: 12pt;">[ <a href="/">Back</a> ]</p>
		</div>
		
		<script language="javascript">
			document.getElementById("form").action = url_newsinger;
		</script>
	</body>
</html>
If you like this, let Dave know. You know, light the fires!!!!

dave
Site Admin
Posts: 6692
Joined: Sun Sep 18, 2005 8:02 am
Location: Seattle
Contact:

Re: Updated Server files with autologout and last name support

Post by dave »

pushy pushy, jeeeEEEEEeeeez :roll:

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: Updated Server files with autologout and last name support

Post by DeusExMachina »

No pushy pushy, me givee givee (free code)

Pushy pushy is me asking for people to ask for a dialogue box after every song prompting them to either add another or log out! ;)

Well, that and video overlay!

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: Updated Server files with autologout and last name support

Post by DeusExMachina »

Oh yeah, forgot to mention. All that code has been extensively tested by professional beta testers and has been shown to work fine with kJams server. ;)
(I.e. I hammered at it for hours and it worked fine for me.)

dave
Site Admin
Posts: 6692
Joined: Sun Sep 18, 2005 8:02 am
Location: Seattle
Contact:

Re: Updated Server files with autologout and last name support

Post by dave »

of course, when i make my million, you're totally hired.

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: Updated Server files with autologout and last name suppo

Post by DeusExMachina »

Oh, cool, since autologout has been taken back OUT of server, nice that i posted these here, so I can d/l them again, myself, to re-add my old autologout code.

kJams backup in the cloud!

dave
Site Admin
Posts: 6692
Joined: Sun Sep 18, 2005 8:02 am
Location: Seattle
Contact:

Re: Updated Server files with autologout and last name suppo

Post by dave »

hoping to get this fixed soon

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: Updated Server files with autologout and last name suppo

Post by DeusExMachina »

Soon as in I shouldn't bother to re-add it, or soon as in, after we get iGlasses support? ;)

dave
Site Admin
Posts: 6692
Joined: Sun Sep 18, 2005 8:02 am
Location: Seattle
Contact:

Re: Updated Server files with autologout and last name suppo

Post by dave »

in between. do re-add it.

Post Reply