<?xml version="1.0"?>
<!--
 -  
 -  $Id$
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2018 OpenLink Software
 -  
 -  This project 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; only version 2 of the License, dated June 1991.
 -  
 -  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.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -  
 -  
-->
<html>
  <head><link rel="stylesheet" type="text/css" href="../demo.css" /></head>
  <body>
    <v:page xmlns:v="http://www.openlinksw.com/vspx/" name="cattree">
      <v:variable name="devid" type="varchar" default="null" />
      <v:variable name="appid" type="varchar" default="null" />
      <v:variable name="certid" type="varchar" default="null" />
      <v:variable name="uid" type="varchar" default="null" />
      <v:variable name="pwd" type="varchar" default="null" />
      <v:on-init>
	self.set_conn ();
	dbg_obj_print (self.devid);
      </v:on-init>
      <v:method name="set_conn" arglist="">
	if (self.devid is not null)
	  {
	    connection_set ('devid', self.devid);
	    connection_set ('appid', self.appid);
	    connection_set ('certid', self.certid);
	    connection_set ('uid', self.uid);
	    connection_set ('pwd', self.pwd);
	  }
	</v:method>
      <h3>eBay categories browser based on eBay SOAP API</h3>
      <v:form name="frm1" method="POST" type="simple">
	<div>
	  <v:template name="keys" type="simple" enabled="--(case when self.devid is not null then 0 else 1 end)">
	    <p>Enter eBay security credentials</p>
	    <table class="tableentry">
	      <tr><td>DevId</td>	<td><v:text name="devid1" xhtml_size="60"/></td></tr>
	      <tr><td>AppId</td>	<td><v:text name="appid1" xhtml_size="60"/></td></tr>
	      <tr><td>CertId</td>	<td><v:text name="certid1" xhtml_size="60"/></td></tr>
	      <tr><td>Username</td>	<td><v:text name="uid1" xhtml_size="60"/></td></tr>
	      <tr><td>Password</td>	<td><v:text name="pwd1" xhtml_size="60" type="password"/></td></tr>
	    </table>
	    <v:button name="ok" value="Set" action="simple">
	      <v:on-post>
	      self.devid := self.devid1.ufl_value;
	      self.appid := self.appid1.ufl_value;
	      self.certid := self.certid1.ufl_value;
	      self.uid := self.uid1.ufl_value;
	      self.pwd := self.pwd1.ufl_value;
	      self.set_conn ();
	      self.vc_data_bind (e);
	    </v:on-post>
	    </v:button>
	  </v:template>
	</div>
        <div>
	  <v:tree name="tree1" multi-branch="1" orientation="vertical"
	    root="ebay_root_cat" start-path="/" child-function="ebay_child_cat"
	    enabled="--(case when self.devid is null then 0 else 1 end)">
            <v:node-template name="node_tmpl">
              <div STYLE="margin-left:1em;">
		<v:button name="tree1_toggle" action="simple" style="image" value="--case (control.vc_parent as vspx_tree_node).tn_open when 0 then '../../web/plus.gif' else '../../web/minus.gif' end">
		</v:button>
                <b>
		  <v:label name="label1" value="--cast (xpath_eval ('.//CategoryName/text()', (control.vc_parent as vspx_tree_node).tn_element) as varchar)"/>
                </b>
                <v:node/>
              </div>
            </v:node-template>
            <v:leaf-template name="leaf_tmpl">
              <div STYLE="margin-left:1em;">
		<v:label name="label2" value="--cast (xpath_eval ('.//CategoryName/text()', (control.vc_parent as vspx_tree_node).tn_element) as varchar)"/>
              </div>
            </v:leaf-template>
          </v:tree>
        </div>
      </v:form>
    </v:page>
  </body>
</html>
