File: error.xsl

package info (click to toggle)
virtuoso-opensource 6.1.4%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 245,116 kB
  • sloc: ansic: 639,631; sql: 439,225; xml: 287,085; java: 61,048; sh: 38,723; cpp: 36,889; cs: 25,240; php: 12,562; yacc: 9,036; lex: 7,149; makefile: 6,093; jsp: 4,447; awk: 1,643; perl: 1,017; ruby: 1,003; python: 329
file content (185 lines) | stat: -rw-r--r-- 6,394 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?xml version="1.0"?>
<!--
 -
 -  $Id: error.xsl,v 1.3.2.1 2010/09/20 10:14:52 source Exp $
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -
 -  Copyright (C) 1998-2006 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
 -
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:v="http://www.openlinksw.com/vspx/" exclude-result-prefixes="v" xmlns:vm="http://www.openlinksw.com/vspx/weblog/">
  <xsl:output method="xml" indent="yes" cdata-section-elements="style"/>

  <xsl:template match="vm:page">
    <v:variable name="template_preview_mode" type="varchar" default="null" persist="session"/>
    <v:variable name="preview_template_name" type="varchar" default="null" persist="session"/>
    <v:variable name="preview_css_name" type="varchar" default="null" persist="session"/>
    <v:variable name="domain" type="varchar" default="null" persist="0"/>
    <v:variable name="uid" type="varchar" default="null" persist="session"/>
    <v:variable name="blogid" type="varchar" default="''"/>
    <v:variable name="page" type="varchar" default="''"/>
    <v:variable name="title" type="varchar" default="''"/>
    <v:variable name="about" type="varchar" default="''"/>
    <v:before-render>
      <![CDATA[
        connection_set('uid', connection_get('vspx_user'));
      ]]>
    </v:before-render>
    <v:on-init>
      <![CDATA[
        declare uid varchar;
        self.blogid := get_keyword('blog_id', params);
        self.sid := get_keyword('sid', params);
        self.realm := get_keyword('realm', params);
        self.domain := http_map_get('vhost');
        self.page := get_keyword('page', params, '');
        whenever not found goto not_found;
        select
          BI_TITLE,
          coalesce(BI_ABOUT, '')
        into
          self.title,
          self.about
        from
          BLOG.DBA.SYS_BLOG_INFO
        where
	  BI_BLOG_ID = self.blogid;
	select VS_UID into uid from VSPX_SESSION where VS_SID = self.sid and VS_REALM = self.realm;
	connection_set ('vspx_user', uid);
        not_found:
        connection_set('blogid', self.blogid);
        set http_charset='utf-8';
      ]]>
    </v:on-init>
    <?vsp
      BLOG.DBA.BLOG_REFFERAL_REGISTER (self.blogid, lines, params);
    ?>
    <html>
      <xsl:apply-templates/>
    </html>
  </xsl:template>

  <xsl:template match="vm:blog-title">
    <v:label value="--self.title"/>
  </xsl:template>

  <xsl:template match="vm:page-title">
    <xsl:if test="count(ancestor::vm:header)=0">
      <xsl:message terminate="yes">
        Widget vm:page-title should be placed inside vm:header only
      </xsl:message>
    </xsl:if>
    <xsl:if test="count(@title)=0">
      <xsl:message terminate="yes">
        Widget vm:page-title should contain mandatory attribute - TITLE
      </xsl:message>
    </xsl:if>
    <title>
      <v:label format="%V">
        <xsl:attribute name="value">
          <xsl:value-of select="@title"/>
        </xsl:attribute>
      </v:label>
    </title>
  </xsl:template>

  <xsl:template match="vm:blog-about">
    <v:label value="--self.about"/>
  </xsl:template>

  <xsl:template match="vm:header">
    <head>
      <xsl:apply-templates/>
    </head>
  </xsl:template>

  <xsl:template match="vm:body">
    <body>
      <v:form type="simple" name="page_form" method="POST">
        <xsl:apply-templates/>
      </v:form>
    </body>
  </xsl:template>

  <xsl:template match="vm:style">
    <xsl:choose>
      <xsl:when test="@url">
        <link rel="stylesheet" type="text/css">
          <xsl:attribute name="href">
            <xsl:value-of select="@url"/>
          </xsl:attribute>
        </link>
      </xsl:when>
      <xsl:otherwise>
        <style>
          <xsl:value-of select="."/>
        </style>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="vm:error-message">
    <v:template type="simple"  name="if_error_message" condition="length(get_keyword('error_message', self.vc_event.ve_params, '')) > 0">
    <pre>
      <?vsp
        http_value(get_keyword('error_message', self.vc_event.ve_params, ''));
      ?>
    </pre>
    </v:template>
    <v:template type="simple"  name="if_simple_message" condition="length(get_keyword('message', self.vc_event.ve_params, '')) > 0">
      <h2>
      <?vsp
        http_value(get_keyword('message', self.vc_event.ve_params, ''));
      ?>
      </h2>
    </v:template>
  </xsl:template>

  <xsl:template match="vm:reset-templates">
    <v:template type="simple" name="if_error_message2" condition="length(get_keyword('error_message', self.vc_event.ve_params, '')) > 0">
      <v:button xhtml_class="real_button" action="simple" name="reset_template_settings" value="Reset Template Settings" xhtml_title="Reset Template Settings" xhtml_alt="Reset Template Settings">
        <v:on-post>
          <v:script>
            <![CDATA[
              update
                BLOG.DBA.SYS_BLOG_INFO
              set
                BI_TEMPLATE = NULL,
                BI_CSS = NULL
              where
                BI_BLOG_ID = self.blogid;
              http_request_status ('HTTP/1.1 302 Found');
              http_header(sprintf(
                'Location: index.vspx?page=index&sid=%s&realm=%s\r\n\r\n',
                self.sid ,
                self.realm));
              self.template_preview_mode := NULL;
              self.preview_template_name := NULL;
              self.preview_css_name := NULL;
            ]]>
          </v:script>
        </v:on-post>
      </v:button>
    </v:template>
  </xsl:template>

  <xsl:template match="vm:*">
    Unknown Weblog component "<xsl:value-of select="local-name()" />"
  </xsl:template>

</xsl:stylesheet>