Location: PHPKode > projects > Community Learning Network > cln/lib/CLN/interfaces/Room/EditDetails.html
<script type="text/javascript" language="JavaScript">
<!--
v=false;
//-->
</script>

<script type="text/javascript" language="JavaScript1.1">
<!--
if (typeof(Option)+"" != "undefined") v=true;
//-->
</script>


<script type="text/javascript" language="JavaScript">
<!--

// Universal Related Select Menus - cascading popdown menus
// by Andrew King. v1.34 19990720
// Copyright (c) 1999 internet.com LLC. All Rights Reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// Originally published and documented at http://www.webreference.com
// Contact hide@address.com for all other uses.
//
// Change History
// 3-3-96 code optimized, modularized, and made universal-abk
// 3-8-97 jumpPage1 and 2 consolidated into generalized func
// 3-10-97 changeMenu added jumpPage(0,0), for non-ns3 browsers
// make popup act like a live popup when no related functionality
// 8-5-97 browser detect script changed to check for option functionality
// 9-11-97 aln changed to options.length, as IE 4 does not support
// nulling out options
// 12-22-98 added SIZE att to make select lists, used named forms/elements
// 1-1-99 added getFormNum to fix netscape 2 bug (doesn't support named fms)
//  pass formName, elementNum to relate and jmp as workaround
//  pass this.form,0 and increment instead of decrement in relate to get 
//   next form
//  assumes menu2 follows menu1 in HTML
// tested in mac ie3.01/ns2.02 (live), ns 3.01,4.05,4.5 and ie4.01 related
// 990204 - adopted a more modular/oo approach using two D arrays, thanks
//   to Jacob Berner <hide@address.com> for his input
// 990701 - fixed back button bug in ie4+ by resetting all forms onload-abk
//    thanks to peter belesis (hide@address.com) for this fix
// 990714 - added IE5 persistence - abk pb
// 990715 - went open source, created stripped down example files - abk
// 990720 - jmp() fix getFormNum(formName);->
//     var formNum = getFormNum(formName);
//  if (v) {..} added around newCat array creation for old browsers
// 990721 - getFormNum/relate tweaks, unnec code removed, 
//     ns2.0 mac fix - getFormNum returns -1 in nested tables
//     new jmp bypasses prob - thx to thanks to Michael Guitton
//     hide@address.com
// 990722 - var for scope added, jmp chgd to named form for ns2.02 bug-abk

if(v){a=new Array(22);}

function getFormNum (formName) {
	var formNum =-1;
	for (i=0;i<document.forms.length;i++){
		tempForm = document.forms[i];
		if (formName == tempForm) {
			formNum = i;
			break;
		}
	}
	return formNum;
}

var catsIndex = -1;
var itemsIndex;

if (v) { // ns 2 fix
function newCat(){
	catsIndex++;
	a[catsIndex] = new Array();
	itemsIndex = 0;
}

function O(txt,url) {
	a[catsIndex][itemsIndex]=new myOptions(txt,url);
	itemsIndex++;
}

function myOptions(text,value){
	this.text = text;
	this.value = value;
}

// fill array

<?php

foreach ($GLOBALS['CLN_TEMPLATES'] as $templateFolder => $templateSettings) {
	echo "newCat();\n";
	foreach ($templateSettings['StyleSheets'] as $stylesheetPath => $stylesheetName) {
		echo 'O("' . $stylesheetName . '","' . $stylesheetPath . '");' . "\n";
	}
}
?>

} // if (v)

function relate(formName,elementNum,j) {
	if(v){
		var formNum = getFormNum(formName);
		if (formNum>=0) {
			with (document.forms[formNum].elements[elementNum]) {
				for ( i=options.length-1; i>0; i=i-1 ) options[i] = null; // null out in reverse order (bug workarnd)
				for(i=0;i<a[j].length;i++){
					options[i] = new Option(a[j][i].text,a[j][i].value); 
				}
				options[0].selected = true;
			}
		}
	}
}

// BACK BUTTON FIX for ie4+- or
// MEMORY-CACHE-STORING-ONLY-INDEX-AND-NOT-CONTENT
//
// from peter belesis:
// IE4+ remembers the index of each SELECT but NOT the CONTENTS of each
// SELECT, so it gets it wrong.
//
// it has to do with MEMORY CACHE (where form input is stored) and how
// IE stores information about SELECT menus.
//
// IE stores the selectedINDEX ONLY of the SELECT menu, not the
// CONTENTS-AT-THE-TIME-OF-SELECTION
//
// when we return to a page, it displays the default contents of each
// SELECT, grabs the stored index from cache and aligns the default
// contents to that index.
// 
// Netscape, on the other hand, seems to remember both INDEX and CONTENTS
// added ie5 persistence 990714

function IEsetup(){
	if(!document.all) return;
	IE5 = navigator.appVersion.indexOf("5.")!=-1;
	if(!IE5) {
		for (i=0;i<document.forms.length;i++) {
			document.forms[i].reset();
		}
	}
}

window.onload = IEsetup;

//-->
</script>


<fieldset>
<form name="roomEdit" action="<?php echo appendToURL(cleanURL($GLOBALS['path']), 'editKoId=' . $this->_super->koId . '&amp;editProcess=Content'); ?>" method="post">

<?php
$sessionObject = "Room";
include("interfaces/simpleMetadata.html");

// The form element that the Javascript uses changes depending 
//on whether this is a new room or not
if ($this->_super->koId == 'NEW') {
	$selectToChange = 7;
	$GLOBALS['CLN_PAGE_TITLE'] = "Create New Room";
}
else {
	$selectToChange = 6;
	$GLOBALS['CLN_PAGE_TITLE'] = 'Edit Room Details';
}

?>

<div class="grRow">
		<span class="grFormLabel">
		<label for="roomEditTemplate"> <?php echo ADMIN_LABEL_TEMPLATE; ?>:  </label>
		</span>
		<select id="roomEditTemplate" class="grFormElement" name="roomEditTemplate" onChange="relate(this.form,<?php echo $selectToChange; ?>,this.selectedIndex)">
		
<?php

// If none is selected, display an empty element
if ($this->_super->currentPart['object']->template == "") {
	echo '<option label="" value=""></option>"';
}

foreach ($GLOBALS['CLN_TEMPLATES'] as $templateFolder => $templateSettings) {
	echo '<option label="' . $templateSettings['Title'] . '" value="' . $templateFolder . '" ';
	if ($this->_super->currentPart['object']->template == $templateFolder) {
		echo " selected=\"selected\" ";
	}
	echo '>' . $templateSettings['Title'] . '</option>' . "\n";
}

?>

	</select>
</div>
<div class="grRow">
	<span class="grFormLabel">
	<label for="roomEditStylesheet"><?php echo ADMIN_LABEL_STYLESHEET; ?>: </label>
	</span>
	<select id="roomEditStylesheet" class="grFormElement" name="roomEditStylesheet">
<?php

// If none is selected, display an empty element
if ($this->_super->currentPart['object']->stylesheet == "") {
	echo '<option label="" value=""></option>"';
}

foreach ($GLOBALS['CLN_TEMPLATES'][($this->template)]['StyleSheets'] as $stylesheetPath => $stylesheetName) {
	echo '<option label="' . $stylesheetName . '" value="' . $stylesheetPath . '" ';
	if ($this->_super->currentPart['object']->stylesheet == $stylesheetPath) {
		echo " selected=\"selected\" ";
	}
	echo '>' . $stylesheetName . '</option>' . "\n";
}

?>
	</select>
</div>
<div class="grRow">
	<span class="grFormLabel">
	<input  class="grFormInput" type="submit" name="editRoomDetails" value="<?php echo ADMIN_BTN_CONTINUE; ?>" />	
	<input class="grFormInput" type="submit" name="ReturnToPanel" value="<?php echo ADMIN_BTN_CANCEL_RETURN; ?>" />
	</span>
</div>
</form>
</fieldset>
<br class="clear"/>
<!-- end of editDetails.html -->
Return current item: Community Learning Network