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 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090
|
<?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" version="1.0" xmlns:v="http://www.openlinksw.com/vspx/" exclude-result-prefixes="v" xmlns:vm="http://www.openlinksw.com/vspx/weblog/">
<xsl:template match="vm:calendar">
<xsl:if test="count(//vm:posts)=0 and $chk">
<xsl:message terminate="yes">
Widget vm:calendar should be used together with vm:posts on the same page
</xsl:message>
</xsl:if>
<xsl:variable name="url">get_keyword ('url', self.user_data, '<xsl:value-of select="./@vm:url" />')</xsl:variable>
<v:template name="calendar" type="simple" enabled="1">
<xsl:processing-instruction name="vsp"><![CDATA[
{
set isolation = 'uncommitted';
declare rowset, urlformat, link any;
declare adays any;
declare m, y, inx int;
declare dt date;
dt := coalesce (self.fordate, now());
if (dt is not null)
{
declare d1, d2, tz any;
m := month (dt);
y := year (dt);
tz := timezone (curdatetime_tz());
d1 := stringdate (sprintf ('%i-%i-%i', y, m, 1));
d2 := dateadd('month', 1, d1);
if (self.have_comunity_blog)
{
self.dprev := (select top 1 B_TS from BLOG.DBA.SYS_BLOGS where B_STATE = 2 and B_TS < d1 order by B_TS desc);
self.dnext := (select top 1 B_TS from BLOG.DBA.SYS_BLOGS where B_STATE = 2 and B_TS >= d2 order by B_TS asc);
}
else
{
self.dprev := (select top 1 B_TS from BLOG.DBA.SYS_BLOGS where B_STATE = 2 and B_BLOG_ID = self.blogid and B_TS < d1 order by B_TS desc);
self.dnext := (select top 1 B_TS from BLOG.DBA.SYS_BLOGS where B_STATE = 2 and B_BLOG_ID = self.blogid and B_TS >= d2 order by B_TS asc);
}
adays := make_array (31, 'any');
inx := 0;
if (self.blog_view = 0 or self.blog_view = 2)
{
if (self.have_comunity_blog)
{
for select distinct dayofmonth (dt_set_tz(B_TS, tz)) DDAY from BLOG.DBA.SYS_BLOGS,
(select BI_BLOG_ID as BA_C_BLOG_ID, BI_BLOG_ID as BA_M_BLOG_ID from BLOG..SYS_BLOG_INFO
where BI_BLOG_ID = self.blogid union all
select * from (select BA_C_BLOG_ID, BA_M_BLOG_ID from BLOG.DBA.SYS_BLOG_ATTACHES
where BA_M_BLOG_ID = self.blogid) name1) name2
where B_BLOG_ID = BA_C_BLOG_ID
and B_STATE = 2
and B_TS >= d1 and B_TS < d2 do
{
adays[inx] := cast(DDAY as varchar);
inx := inx + 1;
}
}
else
{
for select distinct dayofmonth (dt_set_tz(B_TS, tz)) DDAY from BLOG.DBA.SYS_BLOGS where B_STATE = 2
and B_BLOG_ID = self.blogid and B_TS >= d1 and B_TS < d2 do
{
adays[inx] := cast(DDAY as varchar);
inx := inx + 1;
}
}
}
else
{
if (self.have_comunity_blog)
{
for select distinct dayofmonth (dt_set_tz(B_TS,tz)) DDAY from BLOG.DBA.SYS_BLOGS where B_STATE = 2
and B_TS >= d1 and B_TS < d2 and
xpath_contains (B_CONTENT,
'[__quiet BuildStandalone=ENABLE] //a[starts-with (@href,"http") and not(img)]')
do
{
adays[inx] := cast(DDAY as varchar);
inx := inx + 1;
}
}
else
{
for select distinct dayofmonth (dt_set_tz(B_TS,tz)) DDAY from BLOG.DBA.SYS_BLOGS where B_STATE = 2
and B_BLOG_ID = self.blogid and B_TS >= d1 and B_TS < d2 and
xpath_contains (B_CONTENT,
'[__quiet BuildStandalone=ENABLE] //a[starts-with (@href,"http") and not(img)]')
do
{
adays[inx] := cast(DDAY as varchar);
inx := inx + 1;
}
}
}
}
rowset := BLOG..get_date_array (dt);
]]></xsl:processing-instruction>
<xsl:processing-instruction name="vsp">
link := cast (<xsl:value-of select="$url" /> as varchar);
if (strstr (link, '?') is not null)
link := link || '&';
else
link := link || '?';
urlformat := link || 'date=%04d-%02d-%02d' || self.login_pars;
</xsl:processing-instruction>
<table id="calendar">
<tr>
<td colspan="7">
<v:select-list name="pmon1" value="--cast (month (self.fordate) as varchar)" auto-submit="1" xhtml_class="select">
<v:item name="January" value="1"/>
<v:item name="February" value="2"/>
<v:item name="March" value="3"/>
<v:item name="April" value="4"/>
<v:item name="May" value="5"/>
<v:item name="June" value="6"/>
<v:item name="July" value="7"/>
<v:item name="August" value="8"/>
<v:item name="September" value="9"/>
<v:item name="October" value="10"/>
<v:item name="November" value="11"/>
<v:item name="December" value="12"/>
<v:after-data-bind>
<![CDATA[
if (e.ve_initiator = control)
control.vc_parent.vc_focus := 1;
]]>
</v:after-data-bind>
<v:on-post>
<![CDATA[
if (e.ve_initiator is null or e.ve_initiator <> control)
return;
declare d, y int;
d := 1;
y := year(self.fordate);
self.fordate := stringdate(sprintf('%d-%s-%d', y, control.ufl_value, d));
self.fordate_n := -1;
self.dss.vc_data_bind (e);
self.posts.vc_data_bind (e);
]]>
</v:on-post>
</v:select-list>
&nbsp;
<v:select-list name="pyear" value="--cast(year (self.fordate) as varchar)" auto-submit="1"
xhtml_class="select"
>
<v:before-data-bind><![CDATA[
declare st, en date;
declare sty, eny, ix int;
declare arr any;
if (self.have_comunity_blog)
{
st := (select top 1 B_TS from BLOG.DBA.SYS_BLOGS order by B_TS asc);
en := (select top 1 B_TS from BLOG.DBA.SYS_BLOGS order by B_TS desc);
}
else
{
st := (select top 1 B_TS from BLOG.DBA.SYS_BLOGS where B_BLOG_ID = self.blogid order by B_TS asc);
en := (select top 1 B_TS from BLOG.DBA.SYS_BLOGS where B_BLOG_ID = self.blogid order by B_TS desc);
}
if (st is null)
st := en := now ();
sty := year (st);
eny := year (en);
arr := make_array ((eny - sty) + 1, 'any');
for (ix := sty; ix <= eny; ix := ix + 1)
{
arr[ix-sty] := cast (ix as varchar);
}
control.vsl_items := arr;
control.vsl_item_values := arr;
]]></v:before-data-bind>
<v:on-post>
<![CDATA[
if (e.ve_initiator is null or e.ve_initiator <> control)
return;
declare d, m int;
d := 1;
m := month(self.fordate);
self.fordate := stringdate(sprintf('%s-%d-%d', control.ufl_value, m, d));
self.fordate_n := -1;
self.dss.vc_data_bind (e);
self.posts.vc_data_bind (e);
]]>
</v:on-post>
</v:select-list>
</td>
</tr>
<tr>
<th>Sun</th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
<th>Sat</th>
</tr>
<?vsp
declare tdate any;
if (self.fordate_n = -1 or self.fordate_n = 1)
tdate := null;
else
tdate := self.fordate;
foreach (any row in rowset) do
{
?>
<tr>
<?vsp
foreach (any cell in row) do
{
if (cell <> '')
{
?>
<td class="<?V BLOG..cell_fmt(cell, adays, tdate, self.fordate) ?>">
<!-- active="-#-position(cell, self.adays)" -->
<a href="<?V case when position(cell, adays) then sprintf (urlformat, year (self.fordate), month(self.fordate), cast (cell as int)) else 'javascript: void(0)' end ?>">
<?V cell ?>
</a>
</td>
<?vsp
}
else
http ('<td> </td>');
}
?>
</tr>
<?vsp
}
?>
<tr>
<td>
<?vsp if (self.dprev is not null) { ?>
<a href="<?V sprintf (urlformat, year (self.dprev), month(self.dprev), 0) ?>" class="real_button" title="Previous">&lt;</a>
<?vsp
}
?>
</td>
<td colspan="5" align="center">
<a class="button" href="<?V sprintf ('index.vspx?page=%U&date=%04d-%02d-%02d%s', self.page, year(now()), month(now()), dayofmonth(now()), self.login_pars) ?>">today</a>
</td>
<td>
<?vsp if (self.dnext is not null) { ?>
<a href="<?V sprintf (urlformat, year (self.dnext), month(self.dnext), 0) ?>" class="real_button" title="Next">&gt;</a>
<?vsp
}
?>
</td>
</tr>
</table>
<?vsp
}
?>
</v:template>
</xsl:template>
<xsl:template match="vm:post-form">
<v:variable name="text2" type="varchar" default="''"/>
<v:variable name="success_posted" type="int" default="0"/>
<v:variable name="is_draft" type="int" default="0"/>
<v:variable name="n_post_id" type="varchar" default="null"/>
<v:variable name="post_state" type="int" default="1"/>
<v:variable name="post_date" type="datetime" default="null"/>
<script type="text/javascript">
def_btn = 'submit2';
</script>
<v:form name="edit_form" method="POST" action="index.vspx?page=edit_post" type="simple">
<v:template name="result_templ"
type="simple"
enabled="--(case when ((self.blog_access = 1 or self.blog_access = 2) and (self.success_posted = 1 or self.success_posted = 2) and self.preview_post_mode = 0) then 1 else 0 end)">
<v:before-render>
<![CDATA[
if (self.vc_event.ve_is_post and self.success_posted)
self.success_posted := 0;
]]>
</v:before-render>
<div>
Your post '<v:url name="edit_n_post1" value="--(select B_TITLE from BLOG..SYS_BLOGS where B_POST_ID = self.n_post_id)" url="--sprintf ('?page=edit_post&editid=%s', self.n_post_id)" />' is
<?vsp
if (self.is_draft = 0)
{
?>
published.
<?vsp
}
else if (self.is_draft = 1)
{
?>
saved as draft.
<?vsp
}
?>
</div>
</v:template>
<v:template name="preview_templ"
type="simple"
enabled="--(case when ((self.blog_access = 1 or self.blog_access = 2) and self.preview_post_mode = 1 and self.success_posted = 0) then 1 else 0 end)">
<div class="posts-title">
Post preview
</div>
<div class="message">
<div class="post-title">
<?V BLOG..blog_utf2wide(self.mtit1.ufl_value) ?>
</div>
<div class="post-content">
<?vsp
http(BLOG..BLOG2_POST_RENDER(self.text2, self.filt, self.user_id));
?>
</div>
<div class="post-actions">
<v:button xhtml_class="real_button" action="simple" name="back_to_edit" value="Go back to edit" xhtml_title="Go back to edit" xhtml_alt="Go back to edit">
<v:on-post>
<![CDATA[
self.preview_post_mode := 0;
self.vc_data_bind(e);
]]>
</v:on-post>
</v:button>
</div>
<div class="pubdate">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<v:label name="label6" value="--BLOG..blog_date_fmt (now(), self.tz)" format="%s"/>
<span class="state-mark">[ <v:label name="label36" value="Preview" format="%s"/> ]</span>
</td>
<td align="right" colspan="3"/>
</tr>
</table>
</div>
</div>
</v:template>
<v:template name="edit_templ"
type="simple"
enabled="--(case when ((self.blog_access = 1 or self.blog_access = 2) and self.preview_post_mode = 0) then 1 else 0 end)">
<v:before-render>
<![CDATA[
if (self.preview_post_mode)
control.vc_enabled := 0;
]]>
</v:before-render>
<v:before-data-bind>
<![CDATA[
declare _editid, _editbid, _cf_id, _ch_id, _subj, _msg, _from_preview_mode, params any;
params := self.vc_event.ve_params;
_editid := get_keyword('editid', params);
_cf_id := get_keyword('cf_id', params);
_ch_id := get_keyword('ch_id', params);
_subj := get_keyword('subj', params);
_msg := get_keyword('msg', params);
_from_preview_mode := get_keyword('from_preview_mode', params);
set isolation = 'committed';
-- edit post
self.post_date := '';
if (_editid is not null)
{
declare meta BLOG.DBA."MTWeblogPost";
self.text2 := null;
whenever not found goto endb;
select blob_to_string (B_CONTENT), B_TITLE, B_COMMENTS_NO, B_META, B_STATE, B_TS, B_BLOG_ID
into self.text2, self.mtit1.ufl_value, self.comments_no, meta, self.post_state, self.post_date, _editbid
from BLOG.DBA.SYS_BLOGS
where B_POST_ID = _editid;
if (not BLOG2_GET_ACCESS (_editbid, self.sid, self.realm, 120) in (1, 2))
goto endb;
self.editpost := _editid;
self.mtit1.ufl_value := BLOG..blog_utf2wide(self.mtit1.ufl_value);
if (meta is not null and meta.enclosure is not null)
{
declare encl2 BLOG.DBA."MWeblogEnclosure";
encl2 := meta.enclosure;
self.encl1.ufl_value := encl2.url;
}
select count(*) into self.comments_no
from BLOG..BLOG_COMMENTS
where BM_BLOG_ID = self.blogid and BM_POST_ID = _editid;
select count(*) into self.tb_no from BLOG..MTYPE_TRACKBACK_PINGS where MP_POST_ID = _editid;
self.post_date := substring (datestring (self.post_date), 1, 16);
endb:;
}
-- paste from channels
else if (_cf_id is not null and _ch_id is not null)
{
self.text2 := null;
declare title1, link1, desc1, home1, title2 varchar;
self.rich_mode := 1;
select CF_TITLE, CF_LINK, CF_DESCRIPTION, BCD_HOME_URI, BCD_TITLE
into title1, link1, desc1, home1, title2
from BLOG.DBA.SYS_BLOG_CHANNEL_FEEDS, BLOG.DBA.SYS_BLOG_CHANNEL_INFO
where BCD_CHANNEL_URI = CF_CHANNEL_URI and CF_CHANNEL_URI = _ch_id and CF_ID = atoi(_cf_id);
title1 := trim(title1);
if (title1 is null or title1 = '')
title1 := 'via [' || title2 || ']';
self.text2 :=
'<p><a href="'|| link1 ||'">' || title1 || '</a></p>'||
'<p>' || blob_to_string (desc1)
||'</p><p>via <a href="'|| home1 ||'">[' || title2 || ']</a></p>';
self.mtit1.ufl_value := BLOG..blog_utf2wide('<a href="'|| link1 ||'">' || title1 || '</a>');
}
-- paste from moblog
else if (_subj is not null and _msg is not null and _from_preview_mode is null)
{
self.text2 := null;
declare img_path varchar;
declare content, file, mime, tmp varchar;
declare rc, i, l int;
self.mbid := atoi(_msg);
self.mset := deserialize(decode_base64 (get_keyword ('mset', params, '')));
if (not isarray (self.mset)) self.mset := vector (self.mbid);
tmp := '';
whenever not found goto nfbm;
i := 0;
l := length(self.mset);
while (i < l)
{
select MA_NAME, MA_MIME into file, mime from MAIL_ATTACHMENT
where MA_ID = self.mset[i] and MA_M_OWN = connection_get ('vspx_user');
img_path := self.base || 'images/' || file;
if (mime like 'image/%')
{
tmp := tmp || '<div>\n<a href="http://'||BLOG.DBA.BLOG_GET_HOST()|| img_path || '">\n' ||
'<img src="http://'||BLOG.DBA.BLOG_GET_HOST ()|| img_path ||
'" width="200" border="0" />\n</a>\n</div>\n';
}
else
{
tmp := tmp || '<div>\n<a href="http://'||BLOG.DBA.BLOG_GET_HOST()|| img_path || '">\n' ||
_subj || '</a>\n</div>\n';
}
i := i + 1;
}
self.mtit1.ufl_value := _subj;
self.text2 := tmp;
nfbm:;
}
else if (_subj is not null and _msg is not null and _from_preview_mode is not null)
{
self.text2 := _msg;
self.mtit1.ufl_value := _subj;
}
else if (length (self.rtr_vars))
{
self.text2 := get_keyword ('text2', self.rtr_vars);
self.mtit1.ufl_value := get_keyword ('mtit1', self.rtr_vars);
}
]]>
</v:before-data-bind>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<th>
Title
</th>
</tr>
<tr>
<td>
<v:text name="mtit1" value="" xhtml_style="width: 99%" xhtml_class="textbox" xhtml_id="mtit1"/>
</td>
</tr>
<tr>
<th>
Message
</th>
</tr>
<tr>
<td>
<?vsp
declare tmpString varchar;
tmpString := trim(blob_to_string (coalesce (self.text2, '')));
if (trim (tmpString) = '')
tmpString := '<p> </p>';
?>
<textarea id="text2" name="text2"><?vsp http (tmpString); ?></textarea>
<![CDATA[
<script type="text/javascript" src="/ods/ckeditor/ckeditor.js"></script>
<script type="text/javascript">
var oEditor = CKEDITOR.replace('text2', { width: '100%'});
</script>
]]>
<script type="text/javascript">
function getTags ()
{
oEditor.updateElement();
// window.hdntext2=document.page_form['hdntext2'];
window.post_tags=document.page_form['post_tags'];
window.open ('index.vspx?page=get_tags&sid=<?V self.sid ?>&realm=wa&hdntext2=' +
escape ($v('text2')) +
'&post_tags='+ escape (document.page_form['post_tags'].value),
'tags_suggest_window', 'scrollbars=yes, resize=yes, menubar=no, height=200, width=600');
}
<![CDATA[
function getTb ()
{
oEditor.updateElement();
// window.hdntext2=document.page_form['hdntext2'];
window.tpurl1=document.page_form['tpurl1'];
window.open ('index.vspx?page=suggest_tb&sid=<?V self.sid ?>&realm=wa&hdntext2=' +
escape ($v('text2')) +
'&tpurl1='+ escape (document.page_form['tpurl1'].value),
'tags_suggest_window', 'scrollbars=yes, resize=yes, menubar=no, height=200, width=600');
}
function updateRTEsafe ()
{
}
]]>
</script>
</td>
</tr>
<tr>
<td nowrap="1">
<label for="bdate">Date in "YYYY-MM-DD HH:MM" format, or empty for current date and time</label> <br/>
<v:text name="bdate" xhtml_size="16" xhtml_class="textbox" value="--self.post_date" error-glyph="*">
<v:validator name="vv_bdate" test="regexp"
regexp="^[0-9]\1734\175-[0-9][0-9]?-[0-9][0-9]?( [0-9][0-9]?:[0-9][0-9]?)?$"
message="Invalid input, please specify the date in YYYY-MM-DD [HH:MM] format or leave empty."
empty-allowed="1" />
</v:text>
<br/>
Enclosure<br />
<v:text name="encl1" value="" xhtml_size="80" xhtml_style="width: 80%" xhtml_class="textbox" />
<v:text type="hidden" value="--concat ('/DAV/home/',self.user_name,'/')" name="b_home_path" />
<vm:dav_browser
render="popup"
list_type="details"
flt="yes"
flt_pat=""
browse_type="res"
w_title="Briefcase"
title="Briefcase"
return_box="encl1">
<v:field name="path" ref="b_home_path" />
</vm:dav_browser>
<br/>
<span id="ins_media_cb" style="">
<v:check-box name="ins_media" value="1" xhtml_id="ins_media">
<v:before-render>
<![CDATA[
if (regexp_match ('<script.*playEnclosure.*</script>', self.text2) is not null)
control.ufl_selected := 1;
if (regexp_match ('<img[^>]+playMedia[^>]+>', self.text2) is not null)
control.ufl_selected := 1;
]]>
</v:before-render>
</v:check-box>
<label for="ins_media">Insert Media Object</label>
</span>
<br/>
<v:check-box name="salmon_ping" value="1" xhtml_id="salmon_ping"/>
<label for="salmon_ping">Notify everybody mentioned in the post</label>
<script type="text/javascript"><![CDATA[
<!--
if (oEditor)
{
var sp = document.getElementById ("ins_media_cb");
var cb = document.getElementById ("ins_media");
sp.style.visibility = "hidden";
cb.checked = false;
}
// -->
]]></script>
</td>
</tr>
<tr>
<td>
<div class="w_content">
<ul class="tab_bar">
<li id="tags"><a href="javascript:void(0)">Tags</a></li>
<li id="moat"><a href="javascript:void(0)">MOAT</a></li>
<li id="category"><a href="javascript:void(0)">Category</a></li>
<li id="trackback"><a href="javascript:void(0)">Trackback ping URLs</a></li>
</ul>
<div class="tab_deck">
<div id="tb_cont"><![CDATA[ ]]></div>
<div id="tb_tab">
<small>You can specify multiple URLs, each on single line</small>
<v:textarea name="tpurl1" value="" xhtml_rows="3" xhtml_style="width:99%"/>
<br/>
<a href="javascript:void(0)" onclick="javascript:getTb()">Suggest</a>
</div>
<div id="tb_tags">
<v:textarea name="post_tags"
xhtml_id="post_tags"
value=""
xhtml_rows="3"
xhtml_style="width:99%"
xhtml_onblur="javascript:moat_init ()">
<v:after-data-bind>
<![CDATA[
if (self.editpost is not null and not e.ve_is_post)
{
whenever not found goto nf;
select BT_TAGS into control.ufl_value from BLOG..BLOG_TAG
where BT_POST_ID = self.editpost;
nf:;
}
]]>
</v:after-data-bind>
</v:textarea>
<br/>
<a href="javascript:void(0)" onclick="javascript:getTags()">Suggest</a>
<![CDATA[ ]]>
<v:url name="new_tag_rule_url" value="New Tag Rule" url="--sprintf ('%s/tags.vspx?RETURL=%U', wa_link(1), self.return_url_1)" render-only="1" is-local="1"/>
</div>
<div id="tb_cat">
<select style="width:100%" name="post_cat" multiple="multiple" size="3">
<?vsp
for select MTC_ID, MTC_NAME, MTC_DEFAULT from BLOG.DBA.MTYPE_CATEGORIES where MTC_BLOG_ID = self.blogid do
{
declare sel1, cid varchar;
cid := MTC_ID;
if (self.editpost is not null and exists
(select 1
from BLOG.DBA.MTYPE_BLOG_CATEGORY
where MTB_CID = cid and MTB_POST_ID = self.editpost))
sel1 := 'SELECTED="SELECTED"';
else if (self.editpost is null and MTC_DEFAULT)
sel1 := 'SELECTED="SELECTED"';
else
sel1 := '';
http (sprintf ('<option value="%s" %s>%s</option>', MTC_ID, sel1, MTC_NAME));
}
?>
</select>
<br/>
<v:url name="cr_new_cat1" value="Create Category" url="index.vspx?page=category" xhtml_target="_blank"/>
</div>
<div id="tb_moat"><![CDATA[ ]]></div>
</div>
</div>
<![CDATA[<script type="text/javascript" src="/weblog/public/scripts/moat.js"></script>]]>
<script type="text/javascript">
<![CDATA[
var featureList = ["tab"];
var inst_id = <?V self.inst_id ?>;
var post_id = <?V coalesce (self.editpost, -1) ?>;
ODSInitArray.push( function (){OAT.Loader.load(["tab"], panel_init);});
]]>
</script>
</td>
</tr>
<tr>
<td>
<v:url name="com_edit"
value="--sprintf ('Edit comments [%d]', self.comments_no)"
url="--sprintf ('index.vspx?page=edit_comments&editid=%s', self.editpost)"
enabled="--gt (self.comments_no, 0)"/>
<v:url name="trb_edit"
value="--sprintf ('Edit Trackbacks [%d]', self.tb_no)"
url="--sprintf ('index.vspx?page=edit_tb&editid=%s', self.editpost)"
enabled="--gt (self.tb_no, 0)"/>
</td>
</tr>
<tr>
<td align="right">
<v:method name="prepare_post" arglist="in _post_state int, inout retid any">
<![CDATA[
declare msg, tagstr, tagarr, alltags, mcopy, post_title varchar;
declare bdate datetime;
declare id, tmp_blog_id varchar;
declare dummy, vtb any;
declare res BLOG.DBA."MTWeblogPost";
declare encl_obj BLOG.DBA."MWeblogEnclosure";
declare encl varchar;
declare vh, lh, local_lp, local_pp any;
declare rep, rep_encl varchar;
if (not self.vc_is_valid)
return 0;
tmp_blog_id := self.blogid;
if (self.editpost is not null)
{
tmp_blog_id := (select B_BLOG_ID from BLOG.DBA.SYS_BLOGS where B_POST_ID = self.editpost);
if (not (BLOG2_GET_ACCESS (tmp_blog_id, self.sid, self.realm, 120) in (1, 2)))
{
self.vc_error_message := 'You have not rights for the operation';
self.vc_is_valid := 0;
return;
}
}
dummy := null;
encl_obj := null;
msg := get_keyword('text2', self.vc_event.ve_params);
msg := replace(msg, '<img src="/weblog/public/images/', '<img src="http://' || BLOG.DBA.BLOG2_GET_HOST () || '/weblog/public/images/');
msg := regexp_replace (msg, '<script[^<]+playEnclosure[^<]+</script>', '', 1, null);
encl := self.encl1.ufl_value;
rep_encl := encl;
self.text2 := msg;
if (length (encl) and encl[0] = ascii ('/'))
{
vh := http_map_get ('vhost');
lh := http_map_get ('lhost');
local_lp := null;
for select top 1 HP_LPATH, HP_PPATH from HTTP_PATH where HP_LISTEN_HOST = lh and HP_HOST = vh
and encl like concat (HP_PPATH, '%') and HP_STORE_AS_DAV = 1 order by HP_LPATH desc do
{
local_lp := HP_LPATH;
local_pp := HP_PPATH;
}
if (local_lp is null)
{
self.vc_is_valid := 0;
self.vc_error_message := 'The physical location of the enclosure cannot be seen via current virtual host, please either select new resource or enter the full URL containing host and port information.';
return;
}
encl := 'http://' || self.host || local_lp || substring (encl, length (local_pp), length (encl));
self.encl1.ufl_value := encl;
}
set isolation='repeatable';
declare exit handler for sqlstate '*'
{
rollback work;
self.vc_is_valid := 0;
if (__SQL_MESSAGE like 'BLOG2:%')
self.vc_error_message := 'The enclosure is not accessible. Please check the URL.';
else
self.vc_error_message := __SQL_MESSAGE;
return;
};
if (length (self.bdate.ufl_value) and self.vc_event.ve_is_post)
bdate := stringdate (self.bdate.ufl_value);
else
bdate := null;
if (length (encl))
{
declare eid int;
encl_obj := BLOG..BLOG_MAKE_ENCLOSURE (encl);
if (self.editpost is not null)
eid := self.editpost;
else
eid := 'enc_'||cast (sequence_next ('__blog_enclosure_id') as varchar);
if (self.ins_media.ufl_selected)
{
msg := regexp_replace (msg, '<img[^>]+playMedia[^>]+>', '', 1, null);
msg := msg || sprintf ('<img src="/weblog/public/images/wmp.jpg" id="media_%s" onclick="javascript: playMedia (\'%V\', \'media_%s\', 320, 240, \'%s\'); return false" border="0" title="Play Media" alt="Play Media" />', eid, encl, eid, encl_obj."type");
}
msg := replace (msg, '{id}', eid);
msg := replace (msg, rep_encl, encl);
msg := replace (msg, '{type}', encl_obj."type");
}
self.text2 := msg;
mcopy := trim(replace (msg,' ', ''), ' \r\n');
post_title := trim (self.mtit1.ufl_value);
if (not length (post_title))
{
declare cont4tit varchar;
cont4tit := regexp_replace (mcopy, '<script[^<]+playEnclosure[^<]+</script>', '', 1, null);
post_title := regexp_match ('(<[^<])?+[^<]+(</?[^>]+>)?', cont4tit);
post_title := trim(regexp_replace (post_title, '<[^>]+>', '', 1, null));
}
if (not length(msg) or not length (mcopy))
{
self.vc_is_valid := 0;
self.vc_error_message := 'The article is empty. Nothing to ' || case when _post_state = 0 then 'preview.' else 'post.' end;
return 0;
}
if (not length (post_title))
{
self.vc_is_valid := 0;
self.vc_error_message := 'The post title cannot be empty and cannot be extracted from the post content';
return;
}
if (_post_state = 0)
return 1;
tagstr := trim (self.post_tags.ufl_value, ', ');
tagarr := split_and_decode (tagstr, 0, '\0\0,');
alltags := vector ();
foreach (any t in tagarr) do
{
t := trim (t);
if (length (t) and not position (t, alltags))
alltags := vector_concat (alltags, vector (t));
}
{
declare xt, xp any;
xt := xtree_doc (self.text2, 2, '', 'UTF-8');
xp := xpath_eval ('//a[@rel="tag"]/text()', xt, 0);
foreach (any t in xp) do
{
t := charset_recode (xpath_eval('string()', t), '_WIDE_', 'UTF-8');
if (length (t) and not position (t, alltags))
alltags := vector_concat (alltags, vector (t));
}
}
tagstr := '';
foreach (any t in alltags) do
{
if (vt_is_noise (t,'UTF-8', 'x-ViDoc'))
{
signal ('22023', sprintf ('The tag "%s" is noise word, please enter a valid tag words', t));
}
tagstr := tagstr || t || ', ';
}
tagstr := trim (tagstr, ', ');
if (self.editpost is null)
{
declare dat datetime;
bdate := coalesce (bdate, now());
dat := bdate;
id := cast (sequence_next ('blogger.postid') as varchar);
res := BLOG.DBA.BLOG_MESSAGE_OR_META_DATA (dummy, self.user_id, dummy, id, dat);
res.title := post_title;
res.dateCreated := dat;
res.postid := id;
res.enclosure := encl_obj;
retid := id;
insert into BLOG.DBA.SYS_BLOGS(
B_APPKEY,
B_POST_ID,
B_BLOG_ID,
B_TS,
B_CONTENT,
B_USER_ID,
B_META,
B_STATE,
B_TITLE,
B_TS)
values(
'appKey',
id,
tmp_blog_id,
dat,
msg,
self.user_id,
res,
_post_state,
post_title,
bdate);
self.preview_post_id := id;
if (self.salmon_ping.ufl_selected)
{
ODS.DBA.sp_send_all_mentioned (self.owner_name, sioc..blog_post_iri (self.blogid, id), msg);
}
}
else
{
declare odate datetime;
select BLOG.DBA.BLOG_MESSAGE_OR_META_DATA(
B_META,
B_USER_ID,
dummy,
B_POST_ID,
B_TS),
B_TS
into res,
odate
from BLOG.DBA.SYS_BLOGS
where B_BLOG_ID = tmp_blog_id and B_POST_ID = self.editpost;
res.title := post_title;
res.enclosure := encl_obj;
bdate := coalesce (bdate, now ());
-- the delete must be there as update will nake a ftt hit
delete from BLOG.DBA.MTYPE_BLOG_CATEGORY
where MTB_POST_ID = self.editpost;
update BLOG.DBA.SYS_BLOGS set
B_CONTENT = msg,
B_META = res,
B_STATE = _post_state,
B_TITLE = res.title,
B_TS = bdate
where
B_POST_ID = self.editpost and
B_BLOG_ID = tmp_blog_id;
id := self.editpost;
retid := id;
}
delete from BLOG..BLOG_TAG where BT_BLOG_ID = tmp_blog_id and BT_POST_ID = id;
delete from moat.DBA.moat_meanings where m_inst = self.inst_id and m_id = id;
{
declare cat, ix any;
ix := 0;
while (cat := adm_next_keyword ('post_cat', self.vc_event.ve_params, ix))
{
if (cat <> '')
{
insert soft BLOG.DBA.MTYPE_BLOG_CATEGORY (MTB_CID, MTB_POST_ID, MTB_BLOG_ID, MTB_IS_AUTO)
values (atoi(cat), id, tmp_blog_id, 1);
}
}
}
if (length (tagstr))
{
declare turi, pars any;
pars := self.vc_event.ve_params;
foreach (any t in alltags) do
{
declare idx int;
idx := 0;
while (turi := adm_next_keyword('tag_'||t, pars, idx))
{
if (length (turi))
insert replacing moat.DBA.moat_meanings (m_inst, m_id, m_tag, m_uri, m_iri)
values (self.inst_id, id, t, turi, iri_to_id (sioc..blog_post_iri (tmp_blog_id, id)));
}
}
insert replacing BLOG..BLOG_TAG (BT_BLOG_ID, BT_POST_ID, BT_TAGS) values (tmp_blog_id, id, tagstr);
}
if (self.mbid is not null and self.mset is not null)
{
declare rc any;
declare content, file, mime varchar;
declare i, l int;
whenever not found goto skipthis;
i := 0; l := length (self.mset);
while (i < l)
{
declare thumb_path varchar;
select blob_to_string (MA_CONTENT), MA_NAME
into content, file
from MAIL_ATTACHMENT
where MA_ID = self.mset[i] and MA_M_OWN = connection_get ('uid');
-- BLOG_UPDATE_IMAGES_TO_USER_DIR (self.user_name, content, file);
BLOG.DBA.BLOG2_UPLOAD_IMAGES_TO_BLOG_HOME(self.user_id, self.blog_id, content, file, thumb_path);
update MAIL_ATTACHMENT set MA_PUBLISHED = 1
where MA_ID = self.mset[i] and MA_M_OWN = connection_get ('uid');
i := i + 1;
}
skipthis:;
}
declare tbu any;
tbu := vector ();
if(self.tpurl1.ufl_value <> '')
{
declare tb any;
declare i, l int;
tb := self.tpurl1.ufl_value;
tb := replace (tb, '\r', '\n');
tb := split_and_decode (tb, 0, '\0\0\n');
l := length (tb); i := 0;
while (i < l)
{
if (lower (tb[i]) like 'http://%')
{
tbu := vector_concat (tbu, vector (tb[i]));
}
i := i + 1;
}
if (res is not null)
{
res.mt_tb_ping_urls := tbu;
res.description := msg;
BLOG.DBA.BLOG_SEND_TB_PINGS (res);
}
}
self.post_tags.ufl_value := '';
self.encl1.ufl_value := '';
self.ins_media.ufl_selected := 0;
self.bdate.ufl_value := '';
return 1;
]]>
</v:method>
<v:button xhtml_class="real_button" action="simple" name="submit2" value="Post" xhtml_title="Post" xhtml_alt="Post">
<v:on-post>
<![CDATA[
declare _retval, n_post_id any;
_retval := self.prepare_post(2, n_post_id);
self.n_post_id := n_post_id;
if (not _retval)
return;
self.editpost := null;
self.postid := null;
self.post_state := 1;
self.bdate.ufl_value := '';
self.post_date := null;
self.success_posted := 2;
self.is_draft := 0;
self.mtit1.ufl_value := null;
self.text2 := null;
self.vc_data_bind(e);
]]>
<xsl:if test="@redirect">
declare _redir any;
_redir := '<xsl:value-of select="@redirect" />';
<![CDATA[
http_request_status ('HTTP/1.1 302 Found');
http_header(sprintf('Location: index.vspx?page=%s&sid=%s&realm=wa\r\n', _redir, self.sid));
]]>
</xsl:if>
</v:on-post>
</v:button>
<v:button xhtml_class="real_button" action="simple" name="make_draft_post" value="Save Draft" xhtml_title="Save Draft" xhtml_alt="Save Draft" enabled="--equ (self.post_state, 1)">
<v:on-post>
<![CDATA[
declare _retval, n_post_id any;
_retval := self.prepare_post(1, n_post_id);
self.n_post_id := n_post_id;
if (not _retval)
return;
self.editpost := null;
self.postid := null;
self.success_posted := 1;
self.is_draft := 1;
self.mtit1.ufl_value := null;
self.text2 := null;
self.vc_data_bind(e);
]]>
<xsl:if test="@redirect">
declare _redir any;
_redir := '<xsl:value-of select="@redirect" />';
<![CDATA[
http_request_status ('HTTP/1.1 302 Found');
http_header(sprintf('Location: index.vspx?page=%s&sid=%s&realm=wa\r\n', _redir, self.sid));
]]>
</xsl:if>
</v:on-post>
</v:button>
<v:button xhtml_class="real_button" action="simple" name="make_preview_post" value="Preview" xhtml_title="Preview" xhtml_alt="Preview">
<v:before-render>
<![CDATA[
if (self.editpost)
control.vc_enabled := 0;
]]>
</v:before-render>
<v:on-post>
<![CDATA[
declare _retval, n_post_id any;
self.mtit1.ufl_value := BLOG..blog_utf2wide(get_keyword('mtit1', self.vc_event.ve_params));
_retval := self.prepare_post(0, n_post_id);
self.n_post_id := n_post_id;
if (not _retval)
return;
self.is_draft := 0;
self.preview_post_mode := 1;
self.vc_data_bind(e);
]]>
</v:on-post>
</v:button>
</td>
</tr>
</table>
</v:template>
</v:form>
</xsl:template>
<xsl:template match="vm:post-comment">
<v:variable name="comment2" type="varchar" default="''" param-name="comment2"/>
<xsl:if test="count(//vm:comments)=0 and count(//vm:comments-list)=0 and count(//vm:comments-tree)=0 and $chk">
<xsl:message terminate="yes">
Widget vm:post-comment should be used together with vm:comments on the same page
</xsl:message>
</xsl:if>
<v:template name="post_comment" type="simple" enabled="1">
<div class="post-comment-ctr">
<div>
<v:error-summary match="name1" />
</div>
<div>
<v:error-summary match="email1" />
</div>
<div>
<b><v:label name="warn1" value="Thank you for your comment. Because comments to this weblog are moderated,
yours is now on hold, pending approval." enabled="0"/></b>
</div>
<v:form name="post_comment_frm" method="POST" action="index.vspx?page=index" type="simple">
<v:before-data-bind>
<![CDATA[
declare cbid, cvid, cook, is_notify, _post_id varchar;
cook := vsp_ua_get_cookie_vec (e.ve_lines);
cbid := get_keyword ('bv_blog_id', cook);
cvid := get_keyword ('bv_id', cook);
if (cbid = self.blogid)
{
whenever not found goto ef;
select BLOG..blog_utf2wide(BV_NAME), BV_E_MAIL, BV_HOME, BV_ID, BV_NOTIFY, BV_POST_ID into
self.name1.ufl_value, self.email1.ufl_value, self.openid_url.ufl_value, self.vid,
is_notify, _post_id from
BLOG.DBA.SYS_BLOG_VISITORS where BV_BLOG_ID = self.blogid and BV_ID = cvid;
if (_post_id = self.postid)
{
self.notify_me.ufl_selected := is_notify;
self.notify_me.ufl_value := case is_notify when 1 then 'checked' else 'unchecked' end;
}
ef:;
}
if (length (self.sid))
{
whenever not found goto nfusr;
select U_FULL_NAME, U_E_MAIL into
self.name1.ufl_value, self.email1.ufl_value from SYS_USERS where U_ID = self.user_id;
if (length (self.name1.ufl_value) = 0)
self.name1.ufl_value := self.user_name;
self.openid_url.ufl_value := wa_link (1, '/dataspace/'||self.user_name);
nfusr:;
}
]]>
</v:before-data-bind>
<v:text xhtml_class="textbox" name="id" type="hidden" value="--self.postid" />
<v:label name="status_msg_board" value="--''" />
<div class="postcomment">
<a name="comment_input_st"><![CDATA[ ]]></a>
<h2>
<v:button name="comment_input_bt" value="Post Comment" action="simple" style="url">
<v:before-data-bind>
if (not e.ve_is_post)
self.show_comment_input := 0;
if (self.cmf_open = 1)
self.show_comment_input := 1;
</v:before-data-bind>
<v:on-post>
if (self.show_comment_input)
self.show_comment_input := 0;
else
self.show_comment_input := 1;
self.name1.ufl_failed := 0;
self.email1.ufl_failed := 0;
self.vc_is_valid := 1;
</v:on-post>
<v:before-render>
if (self.dss.get_item_value(8) = 1)
control.vc_enabled := 0;
control.ufl_active := equ (self.show_comment_input, 0);
</v:before-render>
</v:button>
</h2>
<?vsp
if (self.show_comment_input)
{
?>
<!--[CDATA[
<script type='text/javascript' src='/weblog/public/scripts/openid.js'></script>
]]-->
<table class="postcomment" border="0">
<tr>
<th>Name</th>
<td>
<v:text xhtml_class="textbox" name="name1" value="--coalesce (control.ufl_value, self.openid_name)" xhtml_size="50" error-glyph="*" xhtml_id="name1">
<v:validator test="length" min="2" max="120" message="No name entered" />
<v:before-render>
control.ufl_value := BLOG..blog_utf2wide (control.ufl_value);
</v:before-render>
</v:text>
</td>
<td/>
</tr>
<tr>
<th>Email</th>
<td>
<v:text xhtml_class="textbox" name="email1" value="--coalesce (control.ufl_value, self.openid_mail)"
xhtml_size="50" error-glyph="*" xhtml_id="email1">
<v:validator test="regexp" regexp="[^@]+@([^\.]+.)*[^\.]+" message="Invalid e-mail address" />
</v:text>
</td>
<td>
</td>
</tr>
<tr>
<th>OpenID</th>
<td id='outerbox' style='padding: 0.4em; margin-left: 100px; margin-right: 100px; width: auto;' nowrap="true">
<v:text name="oid_sig" value="--self.openid_sig" type="hidden" xhtml_id="oid_sig">
<v:on-init><![CDATA[
if (get_keyword ('openid.mode', self.vc_event.ve_params) = 'id_res')
{
declare rc int;
declare k any;
k := (select SS_KEY from OPENID..SERVER_SESSIONS where SS_HANDLE = self.openid_key);
rc := openid..check_signature (http_request_get ('QUERY_STRING')||
sprintf ('&mac_key=%U', cast (k as varchar)));
if (rc = 0)
{
self.openid_sig := null;
self.vc_error_message := 'The OpenID identity verification failed.';
self.vc_is_valid := 0;
return;
}
self.openid_key := cast (k as varchar);
self.openid_sig := http_request_get ('QUERY_STRING');
}
if (get_keyword ('openid.mode', self.vc_event.ve_params) = 'cancel')
{
self.openid_sig := null;
self.vc_error_message := 'The OpenID identity verification failed.';
self.vc_is_valid := 0;
}
]]></v:on-init>
</v:text>
<v:text name="oid_key" value="--self.openid_key" type="hidden" xhtml_id="oid_key" />
<span id='img'>
<img src="/weblog/public/images/login-bg.gif"
width="16" height="16" hspace="1"
/>
</span>
<v:text xhtml_class="textbox" name="openid_url" value="--self.openid_identity"
xhtml_size="50" xhtml_id="openid_url"/>
<v:button value='Verify' xhtml_id='verify_button' xhtml_class="textbox" action="simple">
<v:on-post><![CDATA[
declare url, ret, cnt, oi_srv, oi_delegate, oi_ident, this_page, xt, hdr, host, oi_mode any;
declare setup_url, oi_handle, trust_root, oi_sig, oi_signed, oi_key varchar;
declare ses, flds, check_immediate any;
host := http_request_header (lines, 'Host');
this_page := 'http://' || host || http_path () || sprintf ('?id=%s&cmf=1', self.postid);
trust_root := 'http://' || host;
oi_ident := self.openid_url.ufl_value;
if (oi_ident is not null)
{
url := trim(oi_ident);
declare exit handler for sqlstate '*'
{
self.vc_error_message := 'The URL cannot be retrieved';
self.vc_is_valid := 0;
return;
};
if (not length (url) or url not like 'http%://%')
{
self.vc_is_valid := 0;
self.vc_error_message := 'Invalid URL';
return;
}
again:
hdr := null;
cnt := DB.DBA.HTTP_CLIENT_EXT (url=>url, headers=>hdr);
if (hdr [0] like 'HTTP/1._ 30_ %')
{
declare loc any;
loc := http_request_header (hdr, 'Location', null, null);
url := WS.WS.EXPAND_URL (url, loc);
oi_ident := url;
goto again;
}
xt := xtree_doc (cnt, 2);
oi_srv := cast (xpath_eval ('//link[contains (@rel, "openid.server")]/@href', xt) as varchar);
oi_delegate := cast (xpath_eval ('//link[contains (@rel, "openid.delegate")]/@href', xt) as varchar);
if (oi_srv is null)
{
self.vc_is_valid := 0;
self.vc_error_message := 'The OpenID server cannot be located';
return;
}
if (oi_delegate is not null)
oi_ident := oi_delegate;
oi_handle := null;
oi_key := '';
check_immediate := sprintf ('%s?openid.mode=associate', oi_srv);
cnt := http_client (url=>check_immediate);
cnt := split_and_decode (cnt, 0, '\0\0\x0A:');
oi_handle := get_keyword ('assoc_handle', cnt, null);
oi_key := get_keyword ('mac_key', cnt, '');
insert soft OPENID..SERVER_SESSIONS (SS_HANDLE, SS_KEY, SS_KEY_TYPE, SS_EXPIRY)
values (oi_handle, oi_key, 'RAW', dateadd ('hour', 1, now()));
self.openid_key := oi_key;
check_immediate :=
sprintf ('%s?openid.mode=checkid_setup&openid.identity=%U&openid.return_to=%U&openid.trust_root=%U',
oi_srv, oi_ident, this_page, trust_root);
if (length (oi_handle))
check_immediate := check_immediate || sprintf ('&openid.assoc_handle=%U', oi_handle);
check_immediate := check_immediate || sprintf ('&openid.sreg.optional=%U', 'email,fullname');
self.vc_redirect (check_immediate);
}
]]></v:on-post>
</v:button>
<br/>
<span id='msg'>
</span>
</td>
<td/>
</tr>
<tr>
<th>Comment</th>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2">
<div>
<?vsp
declare tmpString varchar;
if (self.comm_ref is not null and not self.vc_event.ve_is_post)
{
declare _author, _text varchar;
whenever not found goto nfcm;
select BM_NAME, BM_COMMENT
into _author, _text
from BLOG..BLOG_COMMENTS
where BM_BLOG_ID = self.blogid and BM_POST_ID = self.postid and BM_ID = self.comm_ref;
self.comment2 := _author || ' wrote: <br />' || blob_to_string (_text);
nfcm:;
}
tmpString := coalesce (self.comment2, '');
?>
<textarea id="comment2" name="comment2"><?vsp http (tmpString); ?></textarea>
<![CDATA[
<script type="text/javascript" src="/ods/ckeditor/ckeditor.js"></script>
<script type="text/javascript">
var oEditor = CKEDITOR.replace('comment2');
</script>
]]>
</div>
</td>
<td valign="top">
<div>
<v:check-box name="cook1" value="on" initial-checked="1" xhtml_id="cook1"/>
<label for="cook1">Remember my details</label>
</div>
<div>
<v:check-box name="notify_me" xhtml_id="notify_me">
<v:before-render>
if (exists (select 1 from BLOG.DBA.SYS_BLOG_VISITORS where
BV_ID = self.vid and BV_BLOG_ID = self.blogid and BV_POST_ID = self.postid and BV_NOTIFY = 1))
control.ufl_selected := 1;
</v:before-render>
</v:check-box> <label for="notify_me">Notify me on future updates</label>
</div>
<div>
<v:check-box name="semping1" value="on" initial-checked="0" xhtml_id="semping1"/>
<label for="semping1">Issue Semantic Pingback</label>
</div>
<div>
<v:check-box name="salmon_ping" value="1" xhtml_id="salmon_ping"/>
<label for="salmon_ping">Notify everybody mentioned in the post</label>
</div>
<div><v:check-box name="comment1_disable_html" enabled="--equ(length (self.sid), 0)" initial-checked="--equ(isnull(self.comm_ref), 0)" /><v:label value=" Contains Markup" name="comment1_disable_html_l1" enabled="--equ(length (self.sid), 0)"/> </div>
</td>
</tr>
<v:template name="kwd_verify_tmpl" type="simple" enabled="--get_keyword ('CommentQuestion', self.opts, 0)">
<tr><td colspan="2">To verify your request please specify the result of </td></tr>
<tr>
<th>
<v:label name="kwd_verify_quest" format="%s" value="--self.comment_vrfy_qst">
</v:label>
</th>
<td>
<v:text xhtml_class="textbox" name="kwd_verify_u_resp" value="" xhtml_size="50"/>
</td>
<td> </td>
</tr>
</v:template>
<tr>
<td colspan="2" align="right">
<v:button xhtml_class="real_button" action="simple" name="submit1" value="Post" xhtml_title="Post">
<v:on-post>
<![CDATA[
declare expires any;
if (exists (select 1
from DB.DBA.HTTP_ACL where HA_LIST = 'BLOG2IGNORE' and http_client_ip() like HA_CLIENT_IP))
{
control.vc_parent.vc_error_message := 'Sorry, you cannot post comments. Your IP address is banned. Please, contact this blog administrator.';
self.vc_is_valid := 0;
return;
}
if (not self.vc_is_valid)
return;
if (get_keyword ('CommentReg', self.opts, 0) = 1)
{
if (length (self.sid) = 0)
{
self.vc_error_message := 'Please register in order to post a comment';
self.vc_is_valid := 0;
return;
}
else
{
whenever not found goto nfusr;
select U_FULL_NAME, U_E_MAIL into
self.name1.ufl_value, self.email1.ufl_value from SYS_USERS where U_ID = self.user_id;
nfusr:;
}
}
if (get_keyword ('CommentQuestion', self.opts, 0) = 1 and self.comment_vrfy_old_resp <> atoi (self.kwd_verify_u_resp.ufl_value))
{
self.vc_error_message := 'Incorrect answer, please enter the correct result';
self.vc_is_valid := 0;
return;
}
if (length (self.openid_url.ufl_value) and lower (self.openid_url.ufl_value) not like 'http://%' and lower (self.openid_url.ufl_value) not like 'https://%')
{
self.vc_error_message := 'Invalid Web Site URL, please enter correct value';
self.vc_is_valid := 0;
return;
}
if (length (self.comment2) > 0)
{
self.comment2 := replace(self.comment2, '<img src="/weblog/public/images/', '<img src="http://' || BLOG.DBA.BLOG2_GET_HOST () || '/weblog/public/images/');
if (not self.comment1_disable_html.ufl_selected)
{
self.comment2 := BLOG..BLOG_HTMLIZE_TEXT (self.comment2);
}
else if (length (self.sid) = 0)
{
declare xt any;
xt := xtree_doc (self.comment2, 2, '', 'UTF-8');
declare exit handler for sqlstate '*'
{
self.vc_error_message := 'Invalid comment markup, only "b", "i", "a", "u" are allowed';
self.vc_is_valid := 0;
return;
};
xslt (BLOG..BLOG2_GET_PPATH_URL ('widgets/comment_check.xsl'), xt);
}
declare comm_id int;
declare cook_str varchar;
insert into BLOG.DBA.BLOG_COMMENTS
(BM_BLOG_ID, BM_POST_ID, BM_COMMENT, BM_NAME, BM_E_MAIL, BM_HOME_PAGE,
BM_ADDRESS, BM_TS, BM_REF_ID, BM_OPENID_SIG, BM_OWN_COMMENT)
values
(self.blogid, self.postid, self.comment2, self.name1.ufl_value, self.email1.ufl_value, self.openid_url.ufl_value,
http_client_ip (), now (), self.comm_ref, self.oid_sig.ufl_value||'&mac_key='||self.oid_key.ufl_value,
case when self.blog_access = 1 then 1 else 0 end);
comm_id := identity_value ();
declare cu vspx_field;
cu := self.posts.vc_find_descendant_control ('comment_url');
if (cu is not null)
{
cu.ufl_value := cu.ufl_value + 1;
}
if (exists (select 1 from BLOG.DBA.BLOG_COMMENTS where BM_BLOG_ID = self.blogid and BM_POST_ID = self.postid and BM_ID = comm_id and BM_IS_PUB = 0))
{
self.warn1.vc_enabled := 1;
}
declare blog_iri, src_iri varchar;
src_iri := sioc..blog_comment_iri (self.blogid, self.postid, comm_id);
if (self.semping1.ufl_selected)
{
if (not length (src_iri))
{
rollback work;
self.vc_error_message := 'You must specify valid WebID in order to issue Semantic Pingback';
self.vc_is_valid := 0;
return;
}
for select BI_WAI_NAME from BLOG..SYS_BLOG_INFO where BI_BLOG_ID = self.blogid do
{
blog_iri := sioc..blog_iri (BI_WAI_NAME);
SEMPING..CLI_PING (src_iri, blog_iri);
}
for select CL_LINK from BLOG..BLOG_COMMENT_LINKS
where CL_BLOG_ID = self.blogid and CL_POST_ID = self.postid and CL_CID = comm_id and CL_PING = 1 do
{
SEMPING..CLI_PING (src_iri, CL_LINK);
}
}
if (self.salmon_ping.ufl_selected)
{
ODS.DBA.sp_send_all_mentioned (self.owner_name, src_iri, self.comment2);
}
self.comment2 := '';
if (self.cook1.ufl_selected and self.blog_access <> 1)
{
if (self.vid is not null)
{
if (not exists (select 1 from BLOG.DBA.SYS_BLOG_VISITORS where
BV_ID = self.vid and BV_BLOG_ID = self.blogid and BV_POST_ID = self.postid))
self.vid := null;
}
if (self.vid is not null)
{
update BLOG.DBA.SYS_BLOG_VISITORS set
BV_NAME = self.name1.ufl_value,
BV_E_MAIL = self.email1.ufl_value,
BV_HOME = self.openid_url.ufl_value,
BV_NOTIFY = self.notify_me.ufl_selected,
BV_POST_ID = self.postid
where BV_BLOG_ID = self.blogid and BV_ID = self.vid;
}
else
{
self.vid := uuid ();
insert replacing BLOG.DBA.SYS_BLOG_VISITORS (BV_ID, BV_BLOG_ID, BV_NAME, BV_E_MAIL,
BV_HOME, BV_IP, BV_NOTIFY, BV_POST_ID, BV_VIA_DOMAIN)
values (self.vid, self.blogid, self.name1.ufl_value,
self.email1.ufl_value, self.openid_url.ufl_value, http_client_ip (),
self.notify_me.ufl_selected, self.postid, self.host);
}
expires := date_rfc1123 (dateadd ('month', 1, now()));
cook_str := sprintf ('Set-Cookie: bv_blog_id=%s; path=%s; expires=%s;\r\n',
self.blogid, http_path (), expires);
http_header (concat (http_header_get (), cook_str));
cook_str := sprintf ('Set-Cookie: bv_id=%s; path=%s; expires=%s;\r\n',
self.vid, http_path (), expires);
http_header (concat (http_header_get (), cook_str));
}
}
else
{
self.vc_error_message := 'No comment text entered';
self.vc_is_valid := 0;
return;
}
self.comments_list.vc_data_bind(e);
]]>
<xsl:if test="@redirect">
declare _redir any;
_redir := '<xsl:value-of select="@redirect" />';
<![CDATA[
http_request_status ('HTTP/1.1 302 Found');
http_header(sprintf('Location: index.vspx?page=%s&sid=%s&realm=wa\r\n', _redir, self.sid));
]]>
</xsl:if>
</v:on-post>
</v:button>
</td>
<td/>
</tr>
</table>
<?vsp
}
?>
<div>Subscribe to an RSS feed of this comment thread:
<a href="<?vsp http (sprintf ('http://%s%sgems/rsscomment.xml?:id=%s', self.host, self.base, self.postid)); ?>"><img src="/weblog/public/images/rss-icon-16.gif" border="0" alt="RSS" title="RSS"/></a>
</div>
</div>
</v:form>
</div>
</v:template>
</xsl:template>
<xsl:template match="vm:micro-post">
<v:template name="mpt" type="simple" enabled="--(case when (self.blog_access = 1 or self.blog_access = 2) then 1 else 0 end)">
<div class="micro-post">
<div id="mptitle"><xsl:value-of select="@title"/></div>
<v:form name="mpf" method="POST" type="simple">
<v:textarea name="mpta" xhtml_cols="70" xhtml_rows="5" xhtml_id="mpta"/>
<v:button name="mpb" action="simple" value="Send" xhtml_id="mpb" xhtml_class="real_button">
<v:on-post><![CDATA[
declare res BLOG.DBA."MTWeblogPost";
declare dat datetime;
declare id, dummy, title, message, tmp any;
tmp := trim (self.mpta.ufl_value);
if (length (tmp) = 0)
{
self.vc_is_valid := 0;
self.vc_error_message := 'No content';
return 0;
}
title := BLOG..BLOG_RESOLVE_REFS (sprintf ('%V', tmp));
message := '';
dat := now ();
id := cast (sequence_next ('blogger.postid') as varchar);
dummy := null;
res := BLOG.DBA.BLOG_MESSAGE_OR_META_DATA (dummy, self.user_id, dummy, id, dat);
res.title := title;
res.dateCreated := dat;
res.postid := id;
insert into BLOG.DBA.SYS_BLOGS( B_APPKEY, B_POST_ID, B_BLOG_ID, B_TS, B_CONTENT, B_USER_ID, B_META, B_STATE, B_TITLE, B_TS)
values( 'appKey', id, self.blogid, dat, message, self.user_id, res, 2, title, dat);
self.mpta.ufl_value := '';
self.vc_data_bind(e);
ODS.DBA.sp_send_all_mentioned (self.owner_name, sioc..blog_post_iri (self.blogid, id), title);
]]></v:on-post>
</v:button>
</v:form>
</div>
</v:template>
</xsl:template>
<xsl:template match="vm:advanced-search-link">
<xsl:variable name="val">--get_keyword ('title', self.user_data, <xsl:apply-templates select="@title" mode="static_value"/>)</xsl:variable>
<v:url name="a_srch" value="{$val}" url="--sprintf('/weblog/public/search.vspx?blogid=%s', self.blogid)" />
</xsl:template>
<xsl:template match="vm:search">
<script type="text/javascript"><![CDATA[
<!--
function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;
if (keycode == 13)
{
//myfield.form.submit();
doPost ('page_form', 'GO');
return false;
}
else
return true;
}
//-->
]]></script>
<v:form type="simple" method="POST" name="search">
<!--v:url name="a_srch" value="Advanced" url="-#-sprintf('/weblog/public/search.vspx?blogid=%s', self.blogid)" /-->
<v:text xhtml_size="10" name="txt" value="" xhtml_class="textbox" xhtml_onkeypress="return submitenter(this,event)"/>
<v:button xhtml_id="search_button" action="simple" value="/weblog/public/images/go_16.png" style="image" name="GO" xhtml_title="Search" xhtml_alt="Search"/>
<v:on-post>
<![CDATA[
if(e.ve_button.vc_name <> 'GO' or length (trim(self.txt.ufl_value)) = 0) {
return;
}
self.vc_redirect (sprintf ('/weblog/public/search.vspx?blogid=%s&q=%U', self.blogid, self.txt.ufl_value));
return;
]]>
</v:on-post>
</v:form>
<!--div id="selector">
<v:url xhtml_class="button" name="a_srch" value="Advanced Search" url="-#-sprintf('/weblog/public/search.vspx?blogid=%s', self.blogid)" />
</div-->
</xsl:template>
<xsl:template match="vm:blog-div-title">
<v:label name="lbdt" value="--get_keyword ('BDivTitle', self.opts, 'Blog Roll')" />
</xsl:template>
<xsl:template match="vm:channel-div-title">
<v:label name="lcdt" value="--get_keyword ('CDivTitle', self.opts, 'Channel Roll')" />
</xsl:template>
<xsl:template match="vm:opml-div-title">
<v:label name="lopdt" value="--get_keyword ('OPMLDivTitle', self.opts, 'OPML Links')" />
</xsl:template>
<xsl:template match="vm:ocs-div-title">
<v:label name="locdt" value="--get_keyword ('OCSDivTilte', self.opts, 'OCS Links')" />
</xsl:template>
<xsl:template match="vm:rss-feeds">
<?vsp
if (self.have_comunity_blog)
{
for select BCC_ID, BCC_NAME from BLOG.DBA.SYS_BLOG_CHANNEL_CATEGORY,
(select BI_BLOG_ID as BA_C_BLOG_ID, BI_BLOG_ID as BA_M_BLOG_ID from BLOG..SYS_BLOG_INFO where BI_BLOG_ID = self.blogid
union all select BA_C_BLOG_ID, BA_M_BLOG_ID from BLOG.DBA.SYS_BLOG_ATTACHES where BA_M_BLOG_ID = self.blogid
) name2
where BCC_BLOG_ID = BA_C_BLOG_ID and (BCC_BLOG_ID = self.blogid or
exists (select 1 from BLOG.DBA.SYS_BLOG_CHANNELS where BC_BLOG_ID = BA_C_BLOG_ID and BC_SHARED = 1 and BC_CAT_ID = BCC_ID))
order by lower (BCC_NAME)
do {
?>
<div class="roll">
<h2>
<?V BCC_NAME ?>
<?vsp
if (get_keyword('ShowOPML', self.opts, 1))
{
?>
<!-- LINK IS IN THE HEAD ONLY link rel="subscriptions" type="text/x-opml" title="Subscriptions" href="<?vsp http(sprintf ('http://%s%sgems/opml.xml?:c=%d', self.host, self.base, BCC_ID)); ?>"/-->
<a href="<?vsp http (sprintf ('http://%s%sgems/opml.xml?:c=%d', self.host, self.base, BCC_ID)); ?>" class="opml-link">
<img border="0" alt="OPML" title="OPML" src="/weblog/public/images/blue-icon-16.gif" hspace="3"/>
OPML</a>
<?vsp
}
if (get_keyword('ShowOCS', self.opts, 1))
{
?>
<a href="<?vsp http (sprintf ('http://%s%sgems/ocs.xml?:c=%d', self.host, self.base, BCC_ID)); ?>" class="ocs-link">
<img border="0" alt="OCS" title="OCS" src="/weblog/public/images/blue-icon-16.gif" hspace="3"/>
OCS</a>
<?vsp
}
?>
</h2>
<?vsp
for select BCD_TITLE, BCD_HOME_URI, BC_CHANNEL_URI, BC_REL
from BLOG.DBA.SYS_BLOG_CHANNELS, BLOG.DBA.SYS_BLOG_CHANNEL_INFO,
(select BI_BLOG_ID as BA_C_BLOG_ID, BI_BLOG_ID as BA_M_BLOG_ID from BLOG..SYS_BLOG_INFO where BI_BLOG_ID = self.blogid
union all select BA_C_BLOG_ID, BA_M_BLOG_ID from BLOG.DBA.SYS_BLOG_ATTACHES where BA_M_BLOG_ID = self.blogid
) name2
where BC_BLOG_ID = BA_C_BLOG_ID and length (BC_CHANNEL_URI)
and BCD_HOME_URI is not null and BC_CHANNEL_URI = BCD_CHANNEL_URI and BC_CAT_ID = BCC_ID
and (BC_SHARED = 1 or BC_BLOG_ID = self.blogid)
order by lower(BCD_TITLE)
do
{
declare ftype varchar;
ftype := 'rss';
if (strstr (BC_CHANNEL_URI, 'rdf'))
ftype := 'rdf';
if (strstr (BC_CHANNEL_URI, 'atom'))
ftype := 'atom';
?>
<div>
<a href="<?V BC_CHANNEL_URI ?>"><img src="/weblog/public/images/<?V ftype ?>-icon-16.gif" border="0" alt="<?V upper (ftype) ?>" title="<?V upper (ftype) ?>"/></a>
<a href="<?V BCD_HOME_URI ?>" rel="<?V BC_REL ?>"><?vsp http(BCD_TITLE); ?></a>
</div>
<?vsp
}
?>
</div>
<?vsp
}
}
else
{
for select BCC_ID, BCC_NAME from BLOG.DBA.SYS_BLOG_CHANNEL_CATEGORY
where BCC_BLOG_ID = self.blogid
and exists (select 1 from BLOG.DBA.SYS_BLOG_CHANNELS where BC_CAT_ID = BCC_ID)
order by lower (BCC_NAME)
do {
?>
<div class="roll">
<h2>
<?V BCC_NAME ?>
<?vsp
if (get_keyword('ShowOPML', self.opts, 1))
{
?>
<!-- LINK IS IN THE HEAD ONLY link rel="subscriptions" type="text/x-opml" title="Subscriptions" href="<?vsp http(sprintf ('http://%s%sgems/opml.xml?:c=%d', self.host, self.base, BCC_ID)); ?>"/-->
<a href="<?vsp http (sprintf ('http://%s%sgems/opml.xml?:c=%d', self.host, self.base, BCC_ID)); ?>" class="opml-link">
<img border="0" alt="OPML" title="OPML" src="/weblog/public/images/blue-icon-16.gif" hspace="3"/>
OPML</a>
<?vsp
}
if (get_keyword('ShowOCS', self.opts, 1))
{
?>
<a href="<?vsp http (sprintf ('http://%s%sgems/ocs.xml?:c=%d', self.host, self.base, BCC_ID)); ?>" class="ocs-link">
<img border="0" alt="OCS" title="OCS" src="/weblog/public/images/blue-icon-16.gif" hspace="3"/>
OCS</a>
<?vsp
}
?>
</h2>
<?vsp
for select BCD_TITLE, BCD_HOME_URI, BC_CHANNEL_URI, BC_REL
from BLOG.DBA.SYS_BLOG_CHANNELS, BLOG.DBA.SYS_BLOG_CHANNEL_INFO
where BC_BLOG_ID = self.blogid and length (BC_CHANNEL_URI)
and BCD_HOME_URI is not null and BC_CHANNEL_URI = BCD_CHANNEL_URI and BC_CAT_ID = BCC_ID
order by lower(BCD_TITLE)
do
{
declare ftype varchar;
ftype := 'rss';
if (strstr (BC_CHANNEL_URI, 'rdf'))
ftype := 'rdf';
if (strstr (BC_CHANNEL_URI, 'atom'))
ftype := 'atom';
?>
<div>
<a href="<?V BC_CHANNEL_URI ?>"><img src="/weblog/public/images/<?V ftype ?>-icon-16.gif" border="0" alt="<?V upper (ftype) ?>" title="<?V upper (ftype) ?>"/></a>
<a href="<?V BCD_HOME_URI ?>" rel="<?V BC_REL ?>"><?vsp http(BCD_TITLE); ?></a>
</div>
<?vsp
}
?>
</div>
<?vsp
}
}
?>
</xsl:template>
<xsl:template match="vm:top-10-search">
<v:template type="simple" enabled="--case when length (self.keywords) > 1 then 1 else 0 end" name="top_10_search">
<v:before-data-bind><![CDATA[
if (not exists (select 1 from BLOG..SYS_BLOG_SEARCH_ENGINE_SETTINGS where SS_BLOG_ID = self.blogid))
{
control.vc_enabled := 0;
return 1;
}
]]></v:before-data-bind>
<h2>Top 10 Search Results</h2>
<div class="roll">
<v:data-list name="sswitch"
sql="select SE_NAME from BLOG..SYS_BLOG_SEARCH_ENGINE where __proc_exists (SE_HOOK)"
key-column="SE_NAME" value-column="SE_NAME" auto-submit="1">
<v:after-data-bind>
if (control.ufl_value is null)
{
control.ufl_value := 'Google';
control.vs_set_selected ();
}
</v:after-data-bind>
<v:on-post>
if (e.ve_initiator = control and control.vsl_items is not null)
{
control.ufl_value := get_keyword ('sswitch', e.ve_params, 'Google');
control.vs_set_selected ();
self.ssres.vc_data_bind (e);
}
</v:on-post>
</v:data-list>
<div>
<v:data-set name="ssres" data="--self.search_result" meta="--NULL" nrows="-1" scrollable="0">
<v:before-data-bind>
declare nrows int;
declare skey, psname varchar;
self.search_result := vector ();
whenever not found goto endf;
select SS_KEY, SS_MAX_ROWS, SE_HOOK
into skey, nrows, psname
from BLOG..SYS_BLOG_SEARCH_ENGINE, BLOG..SYS_BLOG_SEARCH_ENGINE_SETTINGS
where SS_BLOG_ID = self.blogid and SS_NAME = SE_NAME
and SE_NAME = coalesce (self.sswitch.ufl_value, 'Google');
self.search_result := call (psname) (self.keywords, skey, nrows);
endf:;
</v:before-data-bind>
<v:template type="repeat" name="g_rpt">
<v:template type="browse" name="g_brws">
<div><v:url
value="--(control.vc_parent as vspx_row_template).te_rowset[0]"
url="--(control.vc_parent as vspx_row_template).te_rowset[1]"/>
</div>
</v:template>
</v:template>
</v:data-set>
</div>
</div>
</v:template>
</xsl:template>
<xsl:template match="vm:weblog-import">
<v:variable name="step" type="int" default="1" />
<v:variable name="imp_src" type="any" default="null" />
<v:variable name="imp_url" type="any" default="null" />
<v:variable name="imp_bid" type="any" default="null" />
<v:variable name="imp_uid" type="any" default="null" />
<v:variable name="imp_pwd" type="any" default="null" />
<v:variable name="imp_api" type="any" default="null" />
<v:variable name="imp_n" type="int" default="0" />
<v:variable name="imp_hub" type="varchar" default="null" />
<v:template name="tmpl1" type="simple" condition="self.step = 1">
<div>
<h3>Active PubSubHub subscriptions</h3>
<table class="listing">
<tr class="listing_header_row">
<th>URL</th>
<th>Action</th>
</tr>
<v:data-set name="psh_list" sql="select PS_URL, PS_HUB from WA_PSH_SUBSCRIPTIONS where PS_INST_ID = :inst"
scrollable="0" edit="0" nrows="1000">
<v:param name="inst" value="-- self.inst_id"/>
<v:template name="t_rep" type="repeat">
<v:template name="t_brws" type="browse">
<tr>
<td><v:label render-only="1" name="psh_l1" value="--(control.vc_parent as vspx_row_template).te_rowset[0]"/></td>
<td>
<v:button name="subdrop" value="Unsubscribe" action="simple">
<v:on-post>
PSH.DBA.ods_cli_subscribe (self.inst_id,
(control.vc_parent as vspx_row_template).te_rowset[1],
'unsubscribe',
(control.vc_parent as vspx_row_template).te_rowset[0]
);
self.psh_list.vc_data_bind (e);
</v:on-post>
</v:button>
</td>
</tr>
</v:template>
<v:template type="if-not-exists" name="t_nf">
<tr>
<td colspan="2">
No subscriptions
</td>
</tr>
</v:template>
</v:template>
</v:data-set>
</table>
</div>
<hr/>
<h3>To import posts from another blog system enter:</h3>
<div>
<fieldset>
<label for="imp_blog">Weblog or Feed URL</label>
<v:text xhtml_class="textbox" xhtml_id="imp_blog" name="imp_blog" xhtml_size="110" /><br/>
<v:button xhtml_class="real_button" action="simple" name="bt_discov" value="Next">
<v:on-post><![CDATA[
declare xt1, url, cnt, hd, xt, tmp, res any;
declare exit handler for sqlstate '*'
{
self.vc_is_valid := 0;
self.vc_error_message := __SQL_MESSAGE;
};
url := self.imp_blog.ufl_value;
cnt := BLOG..GET_URL_AND_REDIRECTS (url, hd);
res := vector ();
xt := xtree_doc (cnt, 2);
if (xpath_eval ('/rss|/feed|/rdf', xt) is not null)
{
self.imp_url := url;
self.step := 4;
self.imp_hub := xpath_eval ('/rss/link[@rel="hub"]/@href|/feed/link[@rel="hub"]/@href', xt);
return;
}
tmp := xpath_eval ('//link[@rel="EditURI" and @type="application/rsd+xml"]/@href',xt);
if (tmp is not null)
{
cnt := BLOG..GET_URL_AND_REDIRECTS (WS.WS.EXPAND_URL (url, tmp), hd);
xt1 := xtree_doc (cnt);
tmp := xpath_eval ('/rsd/service/apis/api', xt1, 0);
foreach (any x in tmp) do
{
declare tit, link, bid, pref any;
tit := xpath_eval ('@name', x);
link := xpath_eval ('@apiLink', x);
bid := xpath_eval ('@blogID', x);
pref := xpath_eval ('@preferred', x);
if (pref = N'true')
pref := 1;
else
pref := 0;
res := vector_concat (res, vector (vector (tit,link, bid, pref)));
}
}
tmp := xpath_eval ('//link[@rel="alternate" and @type="application/rss+xml"]|//link[@rel="alternate" and @type="application/atom+xml"]',xt,0);
foreach (any x in tmp) do
{
declare tit, link any;
tit := xpath_eval ('@title', x);
link := WS.WS.EXPAND_URL (url, cast (xpath_eval ('@href', x) as varchar));
res := vector_concat (res, vector (vector (tit,link, '', 0)));
}
self.imp_src := res;
self.impds1.vc_data_bind (e);
self.step := 2;
]]></v:on-post>
</v:button>
</fieldset>
</div>
</v:template>
<v:template name="tmpl2" type="simple" condition="self.step = 2">
<h3>Please choose the source for import:</h3>
<div>
<table class="listing">
<tr class="listing_header_row">
<th>Name</th>
<th>URL</th>
<th>BlogID</th>
</tr>
<v:data-set name="impds1" data="--self.imp_src" meta="--vector ()" edit="0" nrows="-1" scrollable="1">
<v:template name="t1" type="repeat">
<v:template name="t2" type="browse">
<tr class="<?V case when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
<td>
<v:radio-button name="rb1"
group-name="rg1" value="--(control.vc_parent as vspx_row_template).te_ctr"
initial-checked="--(control.vc_parent as vspx_row_template).te_rowset[3]"
/>
<v:label name="l1" value="--(control.vc_parent as vspx_row_template).te_rowset[0]" format="%s"/>
</td>
<td><v:label name="l2" value="--(control.vc_parent as vspx_row_template).te_rowset[1]" format="%s"/></td>
<td><v:label name="l3" value="--(control.vc_parent as vspx_row_template).te_rowset[2]" format="%s"/></td>
</tr>
</v:template>
</v:template>
</v:data-set>
</table>
<v:button xhtml_class="real_button" action="simple" name="bt_discov2" value="Next">
<v:on-post><![CDATA[
declare ix, tmp any;
ix := atoi (get_keyword ('rg1', e.ve_params, '-1'));
if (ix < 0)
{
self.vc_is_valid := 0;
self.vc_error_message := 'The credentials cannot be empty';
return;
}
tmp := self.imp_src[ix];
self.imp_url := tmp[1];
self.imp_bid := tmp[2];
self.imp_api := tmp[0];
if (length (self.imp_bid))
self.step := 3;
else
self.step := 4;
]]></v:on-post>
</v:button>
</div>
</v:template>
<v:template name="tmpl3" type="simple" condition="self.step = 3">
<h3>The selected target needs credentials:</h3>
<fieldset>
<label for="imp_blog_uid">Account name</label>
<v:text xhtml_class="textbox" xhtml_id="imp_blog_uid" name="imp_blog_uid" xhtml_size="50" /><br/>
<label for="imp_blog_pwd">Account password</label>
<v:text xhtml_class="textbox" xhtml_id="imp_blog_pwd" name="imp_blog_pwd" xhtml_size="50" type="password" /><br/>
<v:button xhtml_class="real_button" action="simple" name="bt_discov3" value="Next">
<v:on-post>
self.imp_uid := self.imp_blog_uid.ufl_value;
self.imp_pwd := self.imp_blog_pwd.ufl_value;
if (length (self.imp_uid) = 0 or length (self.imp_pwd) = 0)
{
self.vc_is_valid := 0;
self.vc_error_message := 'The credentials cannot be empty';
return;
}
self.step := 4;
</v:on-post>
</v:button>
</fieldset>
</v:template>
<v:template name="tmpl4" type="simple" condition="self.step = 4">
<h3>Do you want to import posts from <?V self.imp_url ?> ?</h3>
<?vsp if (length (self.imp_hub)) { ?>
<v:check-box name="use_psh" value="1" initial-checked="1"/> Use PubSubHub <v:label name="pshep" value="--self.imp_hub"/><br/>
<?vsp } ?>
<v:button xhtml_class="real_button" action="simple" name="bt_discov4" value="Yes">
<v:on-post>
declare exit handler for sqlstate '*'
{
self.vc_is_valid := 0;
self.vc_error_message := __SQL_MESSAGE;
};
self.imp_n :=
BLOG..IMPORT_BLOG (self.blogid, self.user_id, self.imp_url, self.imp_api,
self.imp_bid, self.imp_uid, self.imp_pwd, case when self.use_psh.ufl_selected then self.imp_hub else null end);
self.step := 5;
</v:on-post>
</v:button>
<v:button xhtml_class="real_button" action="simple" name="bt_discov5" value="Cancel">
<v:on-post>
self.step := 1;
</v:on-post>
</v:button>
</v:template>
<v:template name="tmpl3" type="simple" condition="self.step = 5">
<h3>Imported: <?V self.imp_n ?> post(s)</h3>
<v:button xhtml_class="real_button" action="simple" name="bt_discov6" value="Ok">
<v:on-post>
self.imp_url := '';
self.imp_blog.ufl_value := '';
self.step := 1;
</v:on-post>
</v:button>
</v:template>
</xsl:template>
</xsl:stylesheet>
|