<?xml version="1.0" encoding="UTF-8"?>
<!--
 -
 -  $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
 -
-->
<v:page name="user_edit_buss"
  doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
  fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/"
  style="index.xsl"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:vm="http://www.openlinksw.com/vspx/ods/"
  xmlns:v="http://www.openlinksw.com/vspx/">

  <v:method name="getItems" arglist="in prefix varchar, in mode varchar, inout ontologies any, inout IDs any">
    <![CDATA[
      declare params any;
      declare N, M, L integer;
      declare re, reParts any;
      declare ontology, ontologyNo, ontologyName, ontologyItems any;
      declare item, itemID, itemNo, itemClass, itemProperties any;

      params := self.vc_page.vc_event.ve_params;
      L := 0;
      IDs := vector ();
      ontologies := vector ();
      for (N := 0; N < length (params); N := N + 4)
      {
        if (not isstring(params[N+1]) or trim (params[N+1]) = '')
          goto _skip;
        re := prefix || '_fld_2_([0-9]+)';
        if (regexp_like(params[N], re))
        {
          reParts := regexp_parse(re, params[N], 0);
          ontologyNo := subseq (params[N], reParts[2], reParts[3]);
          ontologyName := trim (params[N+1]);
          ontologyItems := vector ();
          for (M := 0; M < length (params); M := M + 4)
          {
            if (not isstring(params[M+1]) or trim (params[M+1]) = '')
              goto _skip2;
            re := prefix || '_item_'||ontologyNo||'_fld_2_([0-9]+)';
            if (regexp_like(params[M], re))
            {
              reParts := regexp_parse(re, params[M], 0);
              itemNo := subseq (params[M], reParts[2], reParts[3]);
              itemClass := trim (params[M+1]);
              itemID := cast (get_keyword (prefix || '_item_'||ontologyNo||'_fld_1_'||itemNo, params, -1) as integer);
              if (itemID <> 0)
                IDs := vector_concat (IDs, vector (itemID));
              if ((mode = 'gr') and (itemID = -1))
                itemID := itemNo;
              itemProperties := self.getProperties(prefix, params, ontologyNo, itemNo);
              item := vector_concat (ODS..jsonObject (), vector ('id', itemID, 'className', itemClass, 'properties', itemProperties));
              ontologyItems := vector_concat (ontologyItems, vector (item));
            }
          _skip2:;
          }
          ontology := vector_concat (ODS..jsonObject (), vector ('id', cast (L as varchar), 'ontology', ontologyName, 'items', ontologyItems));
          L := L + 1;
          ontologies := vector_concat (ontologies, vector (ontology));
        }
      _skip:;
      }
    ]]>
  </v:method>

  <v:method name="getProperties" arglist="in prefix any, in params any, in ontologyNo varchar, in itemNo varchar">
    <![CDATA[
      declare L integer;
      declare re, reParts any;
      declare itemProperties any;
      declare tmp, property, propNo, propName, propValue, propType, propLanguage any;


              itemProperties := vector ();
              for (L := 0; L < length (params); L := L + 4)
              {
                if (not isstring(params[L+1]) or trim (params[L+1]) = '')
          goto _skip;
                re := prefix || '_item_'||ontologyNo||'_prop_'||itemNo||'_fld_1_([0-9]+)';
                if (regexp_like(params[L], re))
                {
                  reParts := regexp_parse(re, params[L], 0);
                  propNo := subseq (params[L], reParts[2], reParts[3]);
                  propName := trim (params[L+1]);
          tmp := prefix || '_item_'||ontologyNo||'_prop_'||itemNo;
          propType := get_keyword (tmp||'_fld_2_'||propNo, params, 'data');
          propValue := get_keyword (tmp||'_fld_3_'||propNo, params);
          property := vector_concat (ODS..jsonObject (), vector ('name', propName, 'value', propValue, 'type', propType));
          propLanguage := get_keyword (tmp||'_fld_4_'||propNo, params, '');
          if (propLanguage <> '')
            property := vector_concat (property, vector ('language', propLanguage));
                  itemProperties := vector_concat (itemProperties, vector (property));
                }
      _skip:;
      }
      return itemProperties;
    ]]>
  </v:method>

    <br />
    <div id="p" class="c1">
      <div class="tabs">
      <div id="pf_tabs_0_row_0" style="margin-top: 6px;">
      <v:url name="p_url_0" xhtml_id="p_url_0" value="Profile Import" url="--sprintf('uiedit.vspx?page=1&tabNo=0')" xhtml_class="--case when self.tabNo = 0 then 'tabX activeTabX' else 'tabX' end"/>
      <v:url name="p_url_1" xhtml_id="p_url_1" value="Main" url="--sprintf('uiedit.vspx?page=1&tabNo=1')" xhtml_class="--case when self.tabNo = 1 then 'tabX activeTabX' else 'tabX' end"/>
      <v:url name="p_url_2" xhtml_id="p_url_2" value="Address" url="--sprintf('uiedit.vspx?page=1&tabNo=2')" xhtml_class="--case when self.tabNo = 2 then 'tabX activeTabX' else 'tabX' end"/>
      <v:url name="p_url_3" xhtml_id="p_url_3" value="Online Accounts" url="--sprintf('uiedit.vspx?page=1&tabNo=3')" xhtml_class="--case when self.tabNo = 3 then 'tabX activeTabX' else 'tabX' end"/>
      <v:url name="p_url_4" xhtml_id="p_url_4" value="Messaging Services" url="--sprintf('uiedit.vspx?page=1&tabNo=4')" xhtml_class="--case when self.tabNo = 4 then 'tabX activeTabX' else 'tabX' end"/>
      <v:url name="p_url_5"  xhtml_id="p_url_5"  value="Biographical Events" url="--sprintf('uiedit.vspx?page=1&tabNo=5')"  xhtml_class="--case when self.tabNo = 5  then 'tabX activeTabX' else 'tabX' end"/>
      </div>
      <div id="pf_tabs_0_row_1" style="margin-top: 6px;">
      <v:url name="p_url_6"  xhtml_id="p_url_6"  value="Owns"                url="--sprintf('uiedit.vspx?page=1&tabNo=6')"  xhtml_class="--case when self.tabNo = 6  then 'tabX activeTabX' else 'tabX' end"/>
      <v:url name="p_url_7"  xhtml_id="p_url_7"  value="Favorite Things"     url="--sprintf('uiedit.vspx?page=1&tabNo=7')"  xhtml_class="--case when self.tabNo = 7  then 'tabX activeTabX' else 'tabX' end"/>
      <v:url name="p_url_8"  xhtml_id="p_url_8"  value="Creator Of"          url="--sprintf('uiedit.vspx?page=1&tabNo=8')"  xhtml_class="--case when self.tabNo = 8  then 'tabX activeTabX' else 'tabX' end"/>
      <v:url name="p_url_9"  xhtml_id="p_url_9"  value="My Offers"           url="--sprintf('uiedit.vspx?page=1&tabNo=9')"  xhtml_class="--case when self.tabNo = 9  then 'tabX activeTabX' else 'tabX' end"/>
      <v:url name="p_url_10" xhtml_id="p_url_10" value="Offers I Seek"       url="--sprintf('uiedit.vspx?page=1&tabNo=10')" xhtml_class="--case when self.tabNo = 10 then 'tabX activeTabX' else 'tabX' end"/>
      <v:url name="p_url_11" xhtml_id="p_url_11" value="Likes & DisLikes"    url="--sprintf('uiedit.vspx?page=1&tabNo=11')" xhtml_class="--case when self.tabNo = 11 then 'tabX activeTabX' else 'tabX' end"/>
      <v:url name="p_url_12" xhtml_id="p_url_12" value="Social Network"      url="--sprintf('uiedit.vspx?page=1&tabNo=12')" xhtml_class="--case when self.tabNo = 12 then 'tabX activeTabX' else 'tabX' end"/>
      </div>
      </div>
      <div class="contents">
      <v:template name="personal_template_0" type="simple" enabled="-- equ (self.tabNo, 0)">
        <v:include url="uiedit_personal_0.vspx"/>
              </v:template>
      <v:template name="personal_template_1" type="simple" enabled="-- equ (self.tabNo, 1)">
        <v:include url="uiedit_personal_1.vspx"/>
              </v:template>
      <v:template name="personal_template_2" type="simple" enabled="-- equ (self.tabNo, 2)">
        <v:include url="uiedit_personal_2.vspx"/>
              </v:template>
      <v:template name="personal_template_3" type="simple" enabled="-- equ (self.tabNo, 3)">
        <v:include url="uiedit_personal_3.vspx"/>
              </v:template>
      <v:template name="personal_template_4" type="simple" enabled="-- equ (self.tabNo, 4)">
        <v:include url="uiedit_personal_4.vspx"/>
              </v:template>
      <v:template name="personal_template_5" type="simple" enabled="-- equ (self.tabNo, 5)">
        <v:include url="uiedit_personal_5.vspx"/>
      </v:template>
      <v:template name="personal_template_6" type="simple" enabled="-- equ (self.tabNo, 6)">
        <v:include url="uiedit_owns.vspx"/>
      </v:template>
      <v:template name="personal_template_7" type="simple" enabled="-- equ (self.tabNo, 7)">
        <v:include url="uiedit_personal_6.vspx"/>
      </v:template>
      <v:template name="personal_template_8" type="simple" enabled="-- equ (self.tabNo, 8)">
        <v:include url="uiedit_prj.vspx"/>
      </v:template>
      <v:template name="personal_template_9" type="simple" enabled="-- equ (self.tabNo, 9)">
        <v:include url="uiedit_offerlist.vspx"/>
      </v:template>
      <v:template name="personal_template_10" type="simple" enabled="-- equ (self.tabNo, 10)">
        <v:include url="uiedit_wishlist.vspx"/>
      </v:template>
      <v:template name="personal_template_11" type="simple" enabled="-- equ (self.tabNo, 11)">
        <v:include url="uiedit_likes.vspx"/>
      </v:template>
      <v:template name="personal_template_12" type="simple" enabled="-- equ (self.tabNo, 12)">
        <v:include url="uiedit_knows.vspx"/>
      </v:template>
        </div>
    <script type="text/javascript">
      <![CDATA[
        swapRows(<?V self.tabNo ?>);
      ]]>
    </script>
    </div>
</v:page>
