<?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
 -
-->
<v:page name="blog_left_page"
        xmlns:vm="http://www.openlinksw.com/vspx/weblog/"
        xmlns:v="http://www.openlinksw.com/vspx/"
        style="/DAV/VAD/blog2/widgets/main.xsl"
        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
        on-deadlock-retry="5">
  <vm:page>
    <vm:wa_header>
      <vm:wa_title>Web Applications</vm:wa_title>
    </vm:wa_header>
    <v:variable name="mode1" type="varchar" default="'feed'" persist="1"/>
    <v:variable name="mode2" type="varchar" default="'read'" persist="1"/>
    <body class="sub_page">
      <![CDATA[
      <script type="text/javascript">
        function loadIframe(iframeName, url)
        {
          if ( window.top.frames[iframeName] )
          {
            window.top.frames[iframeName].location = url;   
          }
          return false;
        }
        function loadAllFrames(url, left, right, top)
        {
          if (window.top.frames['right_frm'])
          {
            window.top.frames['right_frm'].location = url+right;
            if (window.top.frames['ifrm'])
            {
              window.top.frames['ifrm'].location = url+left;
            }
          }
          return false;
        }
        function loadIframe2(url, left, right)
        {
          if (window.top.frames['right_frm'])
          {
            window.top.frames['right_frm'].location = url+right;
            if (window.top.frames['ifrm'])
            {
              window.top.frames['ifrm'].location = url+left;
            }
          }
          return false;
        }
        function reloadIframe2(url, left)
        {
          if (window.top.frames['right_frm'])
          {
            window.top.frames['right_frm'].location.reload(true);
            if (window.top.frames['ifrm'])
            {
              window.top.frames['ifrm'].location = url+left;
            }
          }
          return false;
        }
        function loadIframe3(url)
        {
          if (window.top.frames['right_frm'])
          {
            if (window.top.frames['right_frm'].frames['right_frm1'])
            {
              window.top.frames['right_frm'].frames['right_frm1'].location = url;
            }
          }
          return false;
        }
        function loadRight(url)
        {
          if (window.top.frames['right_frm'])
          {
            window.top.frames['right_frm'].location = url;
          }
          return false;
        }
      </script>
      ]]>
      <v:form name="nav_bar_form" method="POST" type="simple" action="index.vspx?page=wa_left">
        <v:before-data-bind>
          <![CDATA[
            self.mode1 := get_keyword ('mode', self.vc_event.ve_params, self.mode1);
            self.mode2 := get_keyword ('mode2', self.vc_event.ve_params, self.mode2);
          ]]>
        </v:before-data-bind>
        <v:template type="simple" enabled="--equ(self.mode1, 'feed')">
          <vm:left-top-navigation on="feed"/>
          <v:template type="simple" enabled="--equ(self.mode2, 'read')">
            <vm:left-top-navigation1 on="read"/>
          </v:template>
          <v:template type="simple" enabled="--equ(self.mode2, 'edit')">
            <vm:left-top-navigation1 on="edit"/>
          </v:template>
          <v:template type="simple" enabled="--equ(self.mode2, 'admin')">
            <vm:left-top-navigation1 on="admin"/>
          </v:template>
        </v:template>
        <v:template type="simple" enabled="--equ(self.mode1, 'blog')">
          <vm:left-top-navigation on="blog"/>
        </v:template>
        <v:template type="simple" enabled="--equ(self.mode1, 'dav')">
          <vm:left-top-navigation on="dav"/>
        </v:template>
      </v:form>
      <v:template type="simple" enabled="--equ(self.mode1, 'feed')">
        <v:template type="simple" enabled="--equ(self.mode2, 'read')">
        </v:template>
        <v:template type="simple" enabled="--equ(self.mode2, 'edit')">
          <table>
            <tr>
              <td>
          <a href="<?V sprintf('index.vspx?page=channels&sid=%s&realm=%s', self.sid, self.realm) ?>" onclick="return loadIframe('right_frm', this.href)">Add</a>&nbsp;&nbsp;
              </td>
              <td>
          <a href="<?V sprintf('index.vspx?page=channel_list&sid=%s&realm=%s', self.sid, self.realm) ?>" onclick="return loadIframe('right_frm', this.href)">Channels</a>&nbsp;&nbsp;
              </td>
              <td>
          <a href="<?V sprintf('index.vspx?page=channels_ctgs&sid=%s&realm=%s', self.sid, self.realm) ?>" onclick="return loadIframe('right_frm', this.href)">Channel Categories</a>          
              </td>
            </tr>
          </table>
          <br/>
        </v:template>
        <v:template type="simple" enabled="--equ(self.mode2, 'admin')">
        </v:template>
        <vm:feed-tree/>
      </v:template>
      <v:template type="simple" enabled="--equ(self.mode1, 'blog')">
        <table>
          <tr>
            <td>
              <a href="<?V sprintf('index.vspx?page=edit_post&sid=%s&realm=%s', self.sid, self.realm) ?>" onclick="return loadIframe('right_frm', this.href)">New Post</a>&nbsp;&nbsp;
            </td>
            <td>
              <a href="index.vspx?page=index" onclick="return loadIframe('right_frm', this.href)">View Blog</a>&nbsp;&nbsp;
            </td>
            <td>
              <a href="<?V sprintf('index.vspx?page=templates&sid=%s&realm=%s', self.sid, self.realm) ?>" onclick="return loadIframe('right_frm', this.href)">Configuration</a>
            </td>
          </tr>
        </table>
        <br/>
        <vm:posts-tree/>
      </v:template>
      <v:template type="simple" enabled="--equ(self.mode1, 'dav')">
        Here should be DAV browser
      </v:template>
    </body>
  </vm:page>
</v:page>
