xml-xang-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdier...@locus.apache.org
Subject cvs commit: xml-xang/java/samples/fs2http fs2http.xap
Date Thu, 22 Jun 2000 00:13:30 GMT
mdierken    00/06/21 17:13:30

  Modified:    java/samples/fs2http fs2http.xap
  Log:
  Update with 'add folder'
  
  Revision  Changes    Path
  1.2       +50 -7     xml-xang/java/samples/fs2http/fs2http.xap
  
  Index: fs2http.xap
  ===================================================================
  RCS file: /home/cvs/xml-xang/java/samples/fs2http/fs2http.xap,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- fs2http.xap	2000/06/21 21:21:48	1.1
  +++ fs2http.xap	2000/06/22 00:13:29	1.2
  @@ -1,11 +1,11 @@
   
  -<fs2http hits='0' onGet="pre_get();" onGetXml="getXML()" 
  +<fs2http hits='0' onGet="pre_get();" onGetXml="getXML()" onPostAddfolder='folder_add();'
   	onLoad="loadSystem();" onGetLoad="doLoadSystem();"
   	layout='fs2http.xsl'
   	resources.server='../layouts/'>
   
  -	<title>File System Browser</title>
  -	<message>Welcome <br /></message>
  +	<title>XDev.DataChannel.com</title>
  +	<message>A place for programmers to play</message>
   
   	<root src="d:/apache/htdocs/" depth='2' />
   	
  @@ -23,7 +23,16 @@
   		while ((node != null) && 
   			   (node.getNodeType() != Packages.org.w3c.dom.Node.DOCUMENT_NODE))
   		{
  -			uri = node.getAttribute("name") + "/" + uri;
  +			name = node.getAttribute("name");
  +			if (uri.length == 0)
  +			{
  +				uri = name;
  +			}
  +			else
  +			{
  +				uri = name + "/" + uri;
  +			}
  +			
   			node = node.getParentNode();			
   		}
   		return uri;
  @@ -82,10 +91,10 @@
   			    {
   					child = xmldoc.createElement("CONTENT");
   			    }
  +			    parent.appendChild(child);
   			    child.setAttribute("title",list[i]);
   			    child.setAttribute("name",list[i]);
  -			    
  -			    parent.appendChild(child);
  +				child.setAttribute('uri',getURI(child));
   			}
           }
   	}
  @@ -98,10 +107,44 @@
   		doc.println("<HTML><BODY>");
   		
   		// add children
  -		loadChildren(xml,"d:/apache/htdocs/"+getURI(xml)+"/");
  +		loadChildren(xml,"d:/apache/htdocs/"+getURI(xml));
   		
   		doc.println("</BODY></HTML>");
       }
  +		
  +	function create_child(parent,type,parameters)
  +	{
  +		child = parent.getOwnerDocument().createElement(type);
  +		parent.appendChild(child);
  +
  +		child.setAttribute('name',parameters.get('name'));
  +		child.setAttribute('title',parameters.get('title'));
  +		child.setAttribute('uri',getURI(child));
  +	}
  +		
  +	function folder_add(context,returnTypes,parameters)
  +	{
  +		doc = context.getResponse().getWriter();
  +		context.getResponse().setContentType("text/html");
  +
  +		doc.println("<HTML><BODY>");
  +		
  +		name = parameters.get('name');
  +		if (name == null || name == "")
  +		{
  +			doc.println("<b>No name specified. Try again.</b>");
  +		}
  +		else
  +		{
  +			f = new Packages.java.io.File("d:/apache/htdocs/"+getURI(xml)+"/"+parameters.get('name'));
  +			f.mkdir();
  +			loadChildren(xml,"d:/apache/htdocs/"+getURI(xml)+"/");
  +			
  +			doc.println("Created "+parameters.get('name')+" folder");
  +		}
  +		
  +		doc.println("</BODY></HTML>");
  +	}
   		
   	]]>
   	</script>
  
  
  

Mime
View raw message