File: nntp_cal.xsl

package info (click to toggle)
virtuoso-opensource 7.2.5.1%2Bdfsg1-0.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 285,240 kB
  • sloc: ansic: 641,220; sql: 490,413; xml: 269,570; java: 83,893; javascript: 79,900; cpp: 36,927; sh: 31,653; cs: 25,702; php: 12,690; yacc: 10,227; lex: 7,601; makefile: 7,129; jsp: 4,523; awk: 1,697; perl: 1,013; ruby: 1,003; python: 326
file content (245 lines) | stat: -rw-r--r-- 9,979 bytes parent folder | download | duplicates (2)
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<?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
 -
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/weblog/" version="1.0">
  <xsl:template match="vm:nntp-cal">
  <img id="cal_anchor" src="images/spacer.png" />
      <script type="text/javascript">
       <![CDATA[
           
           var divLT=document.getElementById('LT');
           if(divLT.offsetHeight<170)
           {
            divLT.style.height='170px';
           }
           
           var nntpCal = new Object;
           
           function calendarInit()
           {
           

           nntpCal = new OAT.Calendar();
           
//           if(typeof($('show_tagsblock'))!='undefined' && $('show_tagsblock').value==1) return;
           
           showCalendar();

           }

           function showCalendar()
           {
             var anchorTopLeft=OAT.Dom.position('cal_anchor');

             
             if (!OAT.Browser.isIE)
              nntpCal.show(anchorTopLeft[0]+10, anchorTopLeft[1]+12, clickCal);
           else
              nntpCal.show(anchorTopLeft[0]+10, anchorTopLeft[1]+2, clickCal);
          };

           function clickCal(_date)
           {

            var sid='<?Vself.sid?>';
            var realm='<?Vself.realm?>';
            var loginParams=(sid.length?'sid='+sid:'')+(realm.length?'&realm='+realm:'');
            var searchStr;
            
            var next_day = new Date(_date[0],_date[1]-1,_date[2]+1);

//            '?'+(loginParams.length ? loginParams+'&' : '') +
            searchStr  = '?'+loginParams +
                         '&ontype=nntpf' +
                         '&date_d_after='+_date[2]+'&date_m_after='+_date[1]+'&date_y_after='+_date[0] +
                         '&date_d_before='+next_day.getDate()+'&date_m_before='+(next_day.getMonth()+1)+'&date_y_before='+next_day.getFullYear();

            document.location='<?V sprintf ('%ssearch.vspx', self.odsbar_ods_gpath) ?>'+searchStr;
   
            nntpCal.show(nntpCal.div.style.left, nntpCal.div.style.top, clickCal);
           }

        ]]>
      </script>

  </xsl:template>

  <xsl:template match="vm:nntp-cal-old">
    <v:form name="nntp_cal_form" method="POST" type="simple">
    <v:calendar name="nntp_cal" initial-date="--coalesce (self.nntp_cal_day, now ())">
      <v:on-post>
          <![CDATA[
	    if (not control.vc_focus or e.ve_button.vc_name like '_mon')
	      return;
	    self.fordate := self.nntp_cal.cal_selected;
	    if (udt_defines_field (self, 'ds_list_message'))
	      {
--		 dbg_obj_print ('+ + + comp/nntp_cal.xs self.fordate = ', self.fordate);
		 declare h vspx_data_set;
		 declare x vspx_data_source;
		 x := udt_get (self, 'dss');
		 x.ds_rows_offs := 0;
		 x.vc_data_bind (e);
		 h := udt_get (self, 'ds_list_message');
		 h.vc_reset ();
		 h.ds_rows_offs := 0;
		 h.vc_data_bind (e);
	      }
	    else if (udt_defines_field (self, 'ds_list_thread'))
	      {
		 declare h vspx_control;
		 h := udt_get (self, 'ds_list_thread');
		 h.vc_data_bind (e);
	      }
	    else if (udt_defines_field (self, 'thread_tree'))
	      {
		 declare h vspx_control;
		 h := udt_get (self, 'thread_tree');
		 h.vc_data_bind (e);
	      }
          ]]>
      </v:on-post>
      <v:before-data-bind><![CDATA[

	set isolation = 'committed';
	declare ndays any;
	declare m, y int;
	declare dt date;
	declare sel_group, is_thr varchar;

	if (not self.vc_is_postback)
	  control.cal_date := coalesce (self.nntp_cal_day, now ());

	self.nntp_cal_day := control.cal_date;

	dt := coalesce (control.cal_date, self.fordate);

	m := month (dt);
	y := year (dt);

	ndays := vector ();

	sel_group := atoi (get_keyword ('group', params, NULL));
	is_thr := atoi (get_keyword ('thr', params, NULL));

--	dbg_obj_print ('+++ nntp_cal.xsl params = ', params);

	if (sel_group is NULL)
	  for (select distinct dayofmonth (FTHR_DATE) DDAY from NNFE_THR
		where year (FTHR_DATE) = y and month (FTHR_DATE) = m) do
		     ndays := vector_concat (ndays, vector (cast (DDAY as varchar)));
	else if (is_thr)
	  for (select distinct dayofmonth (FTHR_DATE) DDAY from NNFE_THR
		where year (FTHR_DATE) = y and month (FTHR_DATE) = m and FTHR_GROUP= sel_group and FTHR_TOP = 1) do
		     ndays := vector_concat (ndays, vector (cast (DDAY as varchar)));
	else
	  for (select distinct dayofmonth (FTHR_DATE) DDAY from NNFE_THR
		where year (FTHR_DATE) = y and month (FTHR_DATE) = m and FTHR_GROUP= sel_group) do
		     ndays := vector_concat (ndays, vector (cast (DDAY as varchar)));

--	dbg_obj_print ('ndays = ', ndays);

	self.ndays := ndays;

      ]]></v:before-data-bind>
      <v:template type="simple" name="chead1" name-to-remove="table" set-to-remove="bottom">
      <table border="0" cellpadding="0" cellspacing="0">
        <tr>
         <td align="center">
	  <v:button name="pmon" value="--sprintf('%V', '<')" action="simple" style="url">
	    <!--v:before-render>
	    declare cal vspx_calendar;
	    cal := control.vc_parent.vc_parent;
	    control.ufl_value := substring (monthname (dateadd ('month', -1, cal.cal_date)), 1, 3);
	    </v:before-render-->
	    <v:on-post>
	    declare cal vspx_calendar;
	    declare ctrl vspx_control;
	    cal := control.vc_parent.vc_parent;
	    cal.cal_date := dateadd ('month', -1, cal.cal_date);
	    ctrl := cal;
	    ctrl.vc_data_bind (e);
	    </v:on-post>
	  </v:button>
	 </td>
 	 <td colspan="5" align="center">
           <?V monthname((control.vc_parent as vspx_calendar).cal_date) ?>
	   <?V year((control.vc_parent as vspx_calendar).cal_date) ?>
	 </td>
         <td align="center">
	  <!--v:button name="nmon" value="--sprintf('%V', '>')" action="simple" style="url"-->
	  <v:button name="nmon" value=">" action="simple" style="url">
	    <!--v:before-render>
	    declare cal vspx_calendar;
	    cal := control.vc_parent.vc_parent;
	    control.ufl_value := substring (monthname (dateadd ('month', 1, cal.cal_date)), 1, 3);
	    </v:before-render-->
	    <v:on-post>
	    declare cal vspx_calendar;
	    declare ctrl vspx_control;
	    cal := control.vc_parent.vc_parent;
	    cal.cal_date := dateadd ('month', 1, cal.cal_date);
	    ctrl := cal;
	    ctrl.vc_data_bind (e);
	    </v:on-post>
	  </v:button>
	 </td>
	 </tr>
        <tr><td>Sun</td><td>|Mon</td><td>|Tue</td><td>|Wed</td><td>|Thu</td><td>|Fri</td><td>|Sat</td></tr>
      </table>
      </v:template>
      <v:template type="repeat" name="cbody1" name-to-remove="" set-to-remove="">
      <v:template type="browse" name="crow1" name-to-remove="table" set-to-remove="both">
      <table>
      <tr>
       <td align="center" class="&lt;?V nntpf_cell_fmt((control as vspx_row_template).te_rowset[0], self.ndays, self.fordate, self.nntp_cal.cal_date) ?>">
	<v:button style="url" active="--position(control.ufl_value, self.ndays)" action="simple" name="b1" value="--nntpf_cal_icell(control, 0)" /></td>
       <td align="center" class="&lt;?V nntpf_cell_fmt((control as vspx_row_template).te_rowset[1], self.ndays, self.fordate, self.nntp_cal.cal_date) ?>">
	<v:button style="url" active="--position(control.ufl_value, self.ndays)" action="simple" name="b2" value="--nntpf_cal_icell(control, 1)" /></td>
       <td align="center" class="&lt;?V nntpf_cell_fmt((control as vspx_row_template).te_rowset[2], self.ndays, self.fordate, self.nntp_cal.cal_date) ?>">
	<v:button style="url" active="--position(control.ufl_value, self.ndays)" action="simple" name="b3" value="--nntpf_cal_icell(control, 2)" /></td>
       <td align="center" class="&lt;?V nntpf_cell_fmt((control as vspx_row_template).te_rowset[3], self.ndays, self.fordate, self.nntp_cal.cal_date) ?>">
	<v:button style="url" active="--position(control.ufl_value, self.ndays)" action="simple" name="b4" value="--nntpf_cal_icell(control, 3)" /></td>
       <td align="center" class="&lt;?V nntpf_cell_fmt((control as vspx_row_template).te_rowset[4], self.ndays, self.fordate, self.nntp_cal.cal_date) ?>">
	<v:button style="url" active="--position(control.ufl_value, self.ndays)" action="simple" name="b5" value="--nntpf_cal_icell(control, 4)" /></td>
       <td align="center" class="&lt;?V nntpf_cell_fmt((control as vspx_row_template).te_rowset[5], self.ndays, self.fordate, self.nntp_cal.cal_date) ?>">
	<v:button style="url" active="--position(control.ufl_value, self.ndays)" action="simple" name="b6" value="--nntpf_cal_icell(control, 5)" /></td>
       <td align="center" class="&lt;?V nntpf_cell_fmt((control as vspx_row_template).te_rowset[6], self.ndays, self.fordate, self.nntp_cal.cal_date) ?>">
	<v:button style="url" active="--position(control.ufl_value, self.ndays)" action="simple" name="b7" value="--nntpf_cal_icell(control, 6)" /></td>
      </tr>
      </table>
      </v:template>
      </v:template>
      <v:template type="simple" name="cbott1" name-to-remove="table" set-to-remove="top">
      <table>
      </table>
      </v:template>
      <!--v:before-render>
--      dbg_vspx_control (control);
--        dbg_obj_print ('v:before-render');
      </v:before-render-->
    </v:calendar>
    </v:form>
  </xsl:template>
</xsl:stylesheet>