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
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
-
- $Id$
-
- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- project.
-
- Copyright (C) 1998-2018 OpenLink Software
-
- This project is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; only version 2 of the License, dated June 1991.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-->
<v:page name="blog-home-page"
xmlns:vm="http://www.openlinksw.com/vspx/ods/"
xmlns:v="http://www.openlinksw.com/vspx/"
style="index.xsl"
doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<vm:page>
<vm:header>
<vm:title>Content Hyperlinking Rules</vm:title>
</vm:header>
<vm:pagewrapper>
<v:variable name="aps_id" type="int" default="null" />
<v:variable name="edit_id" type="varchar" default="null" param-name="edit" />
<v:variable name="del_id" type="varchar" default="null" param-name="del" />
<v:variable name="chksum" type="int" default="null" param-name="ck" />
<v:variable name="pg" type="int" default="1" param-name="pg" />
<vm:navigation on="settings"/>
<vm:navigation1 on="services"/>
<vm:rawheader caption="Content Hyperlinking Rules"/>
<vm:body>
<vm:login redirect="index.vspx" />
<script type="text/javascript">
<![CDATA[
function selectAllCheckboxes (form, btn)
{
for (var i = 0; i < form.elements.length; i = i + 1) {
var contr = form.elements[i];
if (contr != null && contr.type == "checkbox") {
contr.focus();
if (btn.value == 'Select All')
contr.checked = true;
else
contr.checked = false;
}
}
if (btn.value == 'Select All')
btn.value = 'Unselect All';
else
btn.value = 'Select All';
btn.focus();
}
]]>
</script>
<v:before-data-bind>
<![CDATA[
if ((self.aps_id is null) and (self.u_id is not null))
{
declare ap_name varchar;
ap_name := sprintf ('Hyperlinking-%d', self.u_id);
self.aps_id := (select APS_ID from SYS_ANN_PHRASE_SET where APS_OWNER_UID = self.u_id and APS_NAME = ap_name);
if (self.aps_id is null)
{
declare c_id, s_id int;
c_id := ANN_GETID ('C');
s_id := ANN_GETID ('S');
ANN_PHRASE_CLASS_ADD_INT (c_id, ap_name, self.u_id, http_nogroup_gid (), null, null);
ANN_PHRASE_SET_ADD_INT (s_id, ap_name, self.u_id, http_nogroup_gid (), c_id, 'x-any', null, 100000, 1);
self.aps_id := s_id;
}
}
]]>
</v:before-data-bind>
<div class="box">
<p>
</p>
<div>
<v:form type="simple" method="POST" xhtml_enctype="multipart/form-data">
<v:template type="simple" name="tm1" enabled="--equ (self.pg, 1)">
<table class="listing" rules="groups">
<colgroup>
<col/>
<col/>
<col/>
</colgroup>
<tr class="listing_header_row">
<th>
<input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this.form, this)" />
Phrase
</th>
<th>URI</th>
<th>Action</th>
</tr>
<v:data-set name="dset"
sql="select AP_TEXT, AP_LINK_DATA, AP_CHKSUM from SYS_ANN_PHRASE where AP_APS_ID = :self.aps_id"
scrollable="1"
editable="1"
nrows="1000">
<v:before-data-bind>
if (not e.ve_is_post and self.del_id is not null)
{
delete from SYS_ANN_PHRASE where AP_APS_ID = self.aps_id and AP_TEXT = self.del_id and AP_CHKSUM = self.chksum;
}
</v:before-data-bind>
<v:template name="dst_rep" type="repeat">
<v:template name="dset_brows" type="browse">
<v:after-data-bind>
if (not e.ve_is_post and control.te_rowset[0] = self.edit_id and self.chksum = control.te_rowset[2])
{
self.a_pat.ufl_value := control.te_rowset[0];
self.a_url.ufl_value := control.te_rowset[1];
}
</v:after-data-bind>
<tr class="<?V case when self.edit_id = control.te_rowset[0] and self.chksum = control.te_rowset[2] then 'listing_row_selected' when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
<td>
<input type="checkbox" name="cb_<?V control.te_rowset[0] ?>" value="on"/>
<v:url name="dset_ur1"
value='--concat ('<img src="images/icons/edit_16.png" hspace="3" border="0"/>', (control.vc_parent as vspx_row_template).te_rowset[0])'
format="%s"
url="--sprintf ('url_rule.vspx?page=11&edit=%U&ck=%d', (control.vc_parent as vspx_row_template).te_rowset[0], (control.vc_parent as vspx_row_template).te_rowset[2])"
xhtml_title="Edit"
xhtml_alt="Edit"
/>
</td>
<td>
<v:label name="lr1" value="--ods_iri_qual ((control.vc_parent as vspx_row_template).te_rowset[1])"/>
</td>
<td>
<v:url name="dset_ur2" value='<img src="images/icons/del_16.png" hspace="3" border="0"/>Delete'
format="%s"
url="--sprintf ('url_rule.vspx?page=11&del=%U&ck=%d', (control.vc_parent as vspx_row_template).te_rowset[0], (control.vc_parent as vspx_row_template).te_rowset[2])"
xhtml_title="Delete"
xhtml_alt="Delete"
/>
</td>
</tr>
</v:template>
</v:template>
<v:template name="dset_footer" type="simple">
<tr>
<td colspan="3" class="listing_col_action">
<vm:ds-navigation data-set="dset" type="set" />
</td>
</tr>
</v:template>
</v:data-set>
</table>
<div class="fm">
<fieldset>
<v:form name="addf" type="simple" method="POST">
<label for="a_pat">Phrase</label><br/>
<v:text name="a_pat" value="" xhtml_id="a_pat" xhtml_size="50" error-glyph="*">
<v:validator test="sql" expression="length(trim(control.ufl_value)) < 2" message="Pattern can not be empty"/>
</v:text>
<br/>
<label for="a_url">URI</label><br/>
<v:text name="a_url" value="" xhtml_id="a_url" xhtml_size="100"/>
<br />
<span class="fm_ctl_btn">
<v:button name="cancel1" value="Cancel" action="simple" enabled="--equ(isnull(self.edit_id),0)">
<v:on-post>
self.a_pat.ufl_value := null;
self.a_url.ufl_value := null;
self.edit_id := null;
self.save1.vc_data_bind (e);
control.vc_enabled := 0;
</v:on-post>
</v:button>
<v:button name="save1" value="--case when self.edit_id is null then 'Add' else 'Update' end" action="simple">
<v:on-post>
<![CDATA[
declare url, pat varchar;
if (not self.vc_is_valid)
return;
url := self.a_url.ufl_value;
pat := self.a_pat.ufl_value;
if (not length (url))
{
self.vc_is_valid := 0;
self.vc_error_message := 'The URI cannot be empty';
return;
}
ap_add_phrases (self.aps_id, vector (vector (pat, url)));
self.edit_id := null;
self.a_pat.ufl_value := null;
self.a_url.ufl_value := null;
control.vc_data_bind (e);
self.cancel1.vc_data_bind (e);
self.dset.vc_data_bind (e);
]]>
</v:on-post>
</v:button>
</span>
</v:form>
<v:form name="impf" type="simple" method="POST">
<span class="fm_ctl_btn">
<v:button action="simple" name="exp_btn1" value="Export"
xhtml_onclick="--sprintf ('javascript: window.open (\'href_export.xml?:u=%d&contenttype=application/octet-stream&content-filename=hyperlinking_rules.xml\', \'export\', \'\'); return false', coalesce (self.u_id, -1))"
enabled="--coalesce ((select top 1 1 from SYS_ANN_PHRASE, SYS_ANN_PHRASE_SET where AP_APS_ID = APS_ID and APS_NAME = sprintf ('Hyperlinking-%d', coalesce (self.u_id, -1))), 0)">
</v:button>
<v:text type="file" name="exp_file" value="">
</v:text>
<v:button action="simple" name="imp_btn4" value="Import from File">
<v:on-post>
<![CDATA[
declare f, i, arr, xt, xp, phrase, href any;
f := self.exp_file.ufl_value;
declare exit handler for sqlstate '*'
{
rollback work;
self.vc_is_valid := 0;
self.vc_error_message := 'The file to import is not specified or does not contains hyperlinking rules data.';
return;
};
xt := xtree_doc (f);
xp := xpath_eval ('/href-rules/phrase', xt, 0);
arr := make_array (length (xp), 'any');
i := 0;
foreach (any p in xp) do
{
phrase := cast (xpath_eval ('@text', p) as varchar);
href := cast (xpath_eval ('@link', p) as varchar);
arr[i] := vector (phrase, href);
i := i + 1;
}
ap_add_phrases (self.aps_id, arr);
self.tm1.vc_data_bind (e);
]]>
</v:on-post>
</v:button>
<v:button name="import1" value="Import from MOAT" action="simple">
<v:on-post>
<![CDATA[
self.pg := 2;
self.tm1.vc_enabled := 0;
self.tm2.vc_enabled := 1;
]]>
</v:on-post>
</v:button>
</span>
</v:form>
<span class="fm_ctl_btn">
<v:button name="del_sel" value="Delete selected" action="simple">
<v:on-post>
<![CDATA[
declare i, phrase any;
i := 0;
while ((phrase := adm_next_checkbox ('cb_', params, i)))
{
delete from SYS_ANN_PHRASE where AP_APS_ID = self.aps_id and AP_TEXT = phrase;
}
if (row_count ())
self.tm1.vc_data_bind (e);
]]>
</v:on-post>
</v:button>
</span>
</fieldset>
</div>
</v:template>
<v:template type="simple" name="tm2" enabled="--equ (self.pg, 2)">
<div>
<div>Please confirm selection of meanings to import as a content annotation rules</div>
<table class="listing" rules="groups">
<colgroup>
<col/>
<col/>
</colgroup>
<tr class="listing_header_row">
<th>Phrase</th>
<th>URI</th>
</tr>
<?vsp
declare arr any;
for select rs_query, mu_url
from tag_rules, tag_rule_set, moat.DBA.moat_user_meanings
where rs_trs = trs_id and mu_trs_id = trs_id and mu_tag = rs_tag and trs_owner = self.u_id do
{
?>
<tr>
<td>
<input type="checkbox" name="cb_<?V rs_query ?>" value="<?V mu_url ?>" checked="checked" />
<?V rs_query ?></td>
<td><?V mu_url ?></td>
</tr>
<?vsp
}
?>
</table>
<v:form name="impf2" type="simple" method="POST">
<span class="fm_ctl_btn">
<v:button name="cancel2" value="Cancel" action="simple">
<v:on-post>
<![CDATA[
self.pg := 1;
self.tm1.vc_data_bind (e);
self.tm2.vc_enabled := 0;
]]>
</v:on-post>
</v:button>
<v:button name="import2" value="Import" action="simple">
<v:on-post>
<![CDATA[
declare arr, val, i, len, url any;
arr := vector ();
len := length (params);
for (i := 0; i < len; i := i + 4)
{
if (params[i] like 'cb_%')
{
val := subseq (params[i], 3);
url := params[i + 1];
arr := vector_concat (arr, vector (vector (val, url)));
}
}
ap_add_phrases (self.aps_id, arr);
self.pg := 1;
self.tm1.vc_data_bind (e);
self.tm2.vc_enabled := 0;
]]>
</v:on-post>
</v:button>
</span>
</v:form>
</div>
</v:template>
</v:form>
</div>
</div>
</vm:body>
</vm:pagewrapper>
</vm:page>
</v:page>
|