<?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>
    <title>User Blogs</title>
    <link rel="stylesheet" type="text/css" href="/weblog/public/css/default.css" />
  </head>
  <body bgcolor="#ffffff">
    <v:page name="select_cat"
            xmlns:v="http://www.openlinksw.com/vspx/"
            xmlns:xhtml="http://www.w3.org/1999/xhtml"
            doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
            on-deadlock-retry="5">
      <v:variable name="ur" type="varchar" default="null"/>
      <v:variable name="nam" type="varchar" default="null"/>
      <v:variable name="pwd" type="varchar" default="null"/>
      <v:variable name="api" type="int" default="0" param-name="upstr_at1"/>
      <v:variable persist="temp" name="r_count" type="integer" default="0"/>
      <v:on-init>
	set http_charset='utf-8';
      </v:on-init>
      <div id="error">
          <v:error-summary/>
      </div>
      <v:data-set name="ds" sql="select BLOGID, BLOGNAME, URL from BLOG.DBA.BLOG_USERS_BLOGS where URI = :ur and NAME = :nam and passwd = :pwd" nrows="10" scrollable="1" cursor-type="static" edit="0" enabled="--position (self.api, vector (1,2,3))">
        <v:param name="ur" value="--self.ur"/>
        <v:param name="nam" value="--self.nam"/>
        <v:param name="pwd" value="--self.pwd"/>
        <v:before-data-bind>
          if (self.ur is null and {?'b_endpoint'} is not null) {
            self.ur := trim({?'b_endpoint'});
            self.nam := {?'b_user'};
            self.pwd := {?'b_pwd'};
          }
          if (self.ur is null and {?'b_endpoint1'} is not null) {
            self.ur := trim({?'b_endpoint1'});
            self.nam := {?'b_user1'};
            self.pwd := {?'b_pwd1'};
          }
          if (self.ur is null and {?'upstr_hn1'} is not null) {
      if (length ({?'upstr_hn1'}))
        {
          self.ur := sprintf ('http://%s:%s%s', {?'upstr_hn1'}, {?'upstr_port1'}, {?'upstr_ep1'});
        }
            self.nam := {?'upstr_un1'};
            self.pwd := {?'upstr_pwd1'};
    }

  if (self.ur is null or self.ur not like 'http://%')
    {
      self.vc_is_valid := 0;
      self.ds.vc_error_message := 'An invalid URL supplied';
      control.vc_enabled := 0;
      return 0;
    }

  </v:before-data-bind>
  <v:before-render>
    if (not self.vc_is_valid)
      {
        control.vc_enabled := 0;
	if (control.vc_error_message is not null)
	  {
	    declare err any;
	    err := regexp_match ('[^\r\n]*', control.vc_error_message);
	    control.vc_error_message := null;
	    if (err like 'HC%')
	      self.vc_error_message := 'Can not connect to the server, please verify the address.';
	    else if (err like 'SP%' or  err like 'X%' or err like 'HT%')
	      self.vc_error_message := 'Not valid XML-RPC endpoint or credentials, please verify the address and credentials.';
	    else
	      self.vc_error_message := err;
	  }
      }
  </v:before-render>
        <v:template name="template1" type="simple" name-to-remove="table" set-to-remove="bottom">
          <table class="listing">
            <tr class="listing_header_row">
              <th>Blod ID</th>
              <th>Blog Name</th>
              <th>URL</th>
              <th>Action</th>
            </tr>
          </table>
        </v:template>
        <v:template name="template2" type="repeat" name-to-remove="" set-to-remove="">
          <v:template name="template7" type="if-not-exists" name-to-remove="table" set-to-remove="both">
            <table width="400" border="2" cellspacing="0" cellpadding="0">
              <tr class="listing_count">
                <td class="listing_count" colspan="4">
                  <b>No rows selected</b>
                </td>
              </tr>
            </table>
          </v:template>
          <v:template name="template4" type="browse" name-to-remove="table" set-to-remove="both">
            <table>
              <?vsp
                self.r_count := self.r_count + 1;
                http (sprintf ('<tr class="%s">', case when mod (self.r_count, 2) then 'listing_row_odd' else 'listing_row_even' end));
              ?>
              <td class="listing_col" nowrap="1">
                <v:label name="label5" value="--(control.vc_parent as vspx_row_template).te_rowset[0]"/>
              </td>
              <td class="listing_col" nowrap="1">
                <v:label name="label6" value="--(control.vc_parent as vspx_row_template).te_rowset[1]"/>
              </td>
              <td class="listing_col" nowrap="1">
                <v:label name="label61" value="--(control.vc_parent as vspx_row_template).te_rowset[2]"/>
              </td>
              <td class="listing_col_action" nowrap="1">
                <v:button xhtml_class="real_button" name="ds_select" action="return" value="Select"  xhtml_title="Select" xhtml_alt="Select">
                  <v:field name="b_blogid" value="--cast ((control.vc_parent.vc_parent as vspx_row_template).te_rowset[0] as varchar)"/>
                  <v:field name="b_blogid1" value="--cast ((control.vc_parent.vc_parent as vspx_row_template).te_rowset[0] as varchar)"/>
                  <v:field name="upstr_pn1" value="--cast ((control.vc_parent.vc_parent as vspx_row_template).te_rowset[0] as varchar)"/>
                </v:button>
              </td>
              <?vsp
                http ('</tr>');
              ?>
            </table>
          </v:template>
        </v:template>
        <v:template name="template3433" type="simple" name-to-remove="table" set-to-remove="top">
          <table>
            <tr class="browse_button_row">
              <td colspan="4" align="center">
                <vm:ds-navigation data-set="ds"/>
              </td>
            </tr>
          </table>
        </v:template>
      </v:data-set>
      <v:data-set name="ds1" sql="select POST_URI, BLOGNAME, BLOG_URL from BLOG.DBA.BLOG_GET_ATOM_URL where URL = :ur" nrows="10" scrollable="1" cursor-type="static" edit="0" enabled="--equ (self.api, 5)">
        <v:param name="ur" value="--self.ur"/>
        <v:before-data-bind>
          if (self.ur is null and {?'upstr_hn1'} is not null) {
      if (length ({?'upstr_hn1'}))
        {
          self.ur := sprintf ('http://%s:%s%s', {?'upstr_hn1'}, {?'upstr_port1'}, {?'upstr_ep1'});
        }
            self.nam := {?'upstr_un1'};
            self.pwd := {?'upstr_pwd1'};
    }

  if (self.ur is null or self.ur not like 'http://%')
    {
      self.vc_is_valid := 0;
      self.ds1.vc_error_message := 'An invalid URL supplied';
      control.vc_enabled := 0;
      return 0;
    }

  </v:before-data-bind>
  <v:before-render>
    if (not self.vc_is_valid)
      control.vc_enabled := 0;
  </v:before-render>
        <v:template name="te1" type="simple" name-to-remove="table" set-to-remove="bottom">
          <table class="listing">
            <tr class="listing_header_row">
              <th>Atom Post URL</th>
              <th>Blog Name</th>
              <th>Blog URL</th>
              <th>Action</th>
            </tr>
          </table>
        </v:template>
        <v:template name="te2" type="repeat" name-to-remove="" set-to-remove="">
          <v:template name="te7" type="if-not-exists" name-to-remove="table" set-to-remove="both">
            <table width="400" border="2" cellspacing="0" cellpadding="0">
              <tr class="listing_count">
                <td class="listing_count" colspan="4">
                  <b>No rows selected</b>
                </td>
              </tr>
            </table>
          </v:template>
          <v:template name="te4" type="browse" name-to-remove="table" set-to-remove="both">
            <table>
              <?vsp
                self.r_count := self.r_count + 1;
                http (sprintf ('<tr class="%s">', case when mod (self.r_count, 2) then 'listing_row_odd' else 'listing_row_even' end));
              ?>
              <td class="listing_col" nowrap="1">
                <v:label name="l5" value="--(control.vc_parent as vspx_row_template).te_rowset[0]"/>
              </td>
              <td class="listing_col" nowrap="1">
                <v:label name="l6" value="--(control.vc_parent as vspx_row_template).te_rowset[1]" format="%s"/>
              </td>
              <td class="listing_col" nowrap="1">
                <v:label name="l61" value="--(control.vc_parent as vspx_row_template).te_rowset[2]"/>
              </td>
              <td class="listing_col_action" nowrap="1">
                <v:button xhtml_class="real_button" name="ds1_select" action="return" value="Select"  xhtml_title="Select" xhtml_alt="Select">
                  <v:field name="aupstr_pn1" value="--cast ((control.vc_parent.vc_parent as vspx_row_template).te_rowset[0] as varchar)"/>
                </v:button>
              </td>
              <?vsp
                http ('</tr>');
              ?>
            </table>
          </v:template>
        </v:template>
        <v:template name="te33" type="simple" name-to-remove="table" set-to-remove="top">
          <table>
            <tr class="browse_button_row">
              <td colspan="4" align="center">
                <vm:ds-navigation data-set="ds1"/>
              </td>
            </tr>
          </table>
        </v:template>
      </v:data-set>
      <v:template name="back1" type="simple" condition="self.vc_is_valid = 0">
  <div>
    <input type="button" name="close" value="Close" onclick="window.close()" />
  </div>
      </v:template>
    </v:page>
    <div align="right">
      <a href="http://www.openlinksw.com/virtuoso">
        <img src="/weblog/public/images/PoweredByVirtuoso.gif" border="0" alt="poweredby"/>
      </a>
    </div>
  </body>
</html>
