Source code for /src/jsp/bamboo_admin_edit2.jsp

//======================================================================//
// Author: Mark Qian <markqian@hotmail.com>                             //
// WWW: http://www.coolshare.com                                        //
// Copyright (c) 2006, Mark Qian                                        //
//                                                                      //
// You must contact Mark Qian to get a permission of use                //
// in case you want to make any use of the codes except viewing it     //
// on Mark's site.                                                      //
//======================================================================//


<%@ include file="/WEB-INF/jsp/include.jsp" %>
<%@ taglib prefix="_tile" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> 

<html>
<link href="/springapp/css/main.css" rel="stylesheet" type="text/css" />

<head><title><fmt:message key="title"/></title>
<script language="javascript"  src="/springapp/js/ajax.js"></script>
<script language="javascript"  src="/springapp/js/cross_browser.js"></script>
<script language="javascript"  src="/springapp/js/_debugger.js"></script>
<script type="text/javascript">
			djConfig = { isDebug: true };
</script>
<script type="text/javascript" src="/springapp/js/dojo/dojo.js"></script>
<script type="text/javascript">
dojo.require("dojo.event.*");
dojo.addOnLoad(init);

function init() {
  dojo.event.connect(dojo.byId("show"), "onclick", window, "handleSource");
  dojo.event.connect(dojo.byId("Source.id"), "onchange", window, "loadSource");
  dojo.event.topic.subscribe("/save", window, "doSave");  
  dojo.event.topic.registerPublisher("/save", dojo.byId("buttonSave"), "onclick");
  doOnload();
}

function doOnload() {
  if (top.list && top.list.sel)
    dojo.byId("buttonSave").disabled = false;
}

function doSave() {
   var f = dojo.byId("booForm");
   updateSource();
   f.target="list";
   f.submit();
}

function updateSource() {
  var sourceName = dojo.byId("Source.name");
  var sourceId = dojo.byId("Source.id");
  sourceName.value = sourceId.options[sourceId.selectedIndex].text;
}

function handleSource(e) {
  var c = getSrcElement();
  var d = dojo.byId("source");
  if (c.checked) {
    d.style.display = "block";
  } else {
    d.style.display = "none";
  }
}
var shttp;
function loadSource(e) {
  updateSource();
  var c = getSrcElement();
  var id = c.value;
  var para = "id="+id;
  shttp = createRequestObject();
  shttp.onreadystatechange = function () {
    if(shttp.readyState == 4){
        var d = dojo.byId("source");
	    d.innerHTML = shttp.responseText;	
	    dojo.event.connect(dojo.byId("Source.id"), "onchange", window, "loadSource");
     		
	}
  
  };
  shttp.open('POST', "/springapp/getSource.htm?jsp=getSource2", true); 
  shttp.setRequestHeader("Content-length", para.length); 
  shttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
  shttp.setRequestHeader("Connection", "close"); 
  shttp.send(para);    
}



</script>
</head>

<body background = "/RemoteScriptGuru/html/coolshare/html/images/rulebk2.jpg">
<div><input type="button" value="Save" id="buttonSave" disabled="disabled"></div>

<form:form id="booForm" action="/springapp/bambooAdminEdit2.htm"> 
<_tile:form tile="Bamboo"/>
 <label for="show" accesskey="p">Show Source:</label> 
  <input type="checkbox" id="show" size="10" maxlength="10" checked="ture">
 <br/>
 <div id="source">
 <_tile:form tile="Source"/>
 </div>
</form:form>
</body>
</html>