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
|
<?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="foaf-import-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">
<v:variable name="m_mode" type="varchar" default="'M/browse'"/>
<v:variable name="m_id" type="integer" default="null" />
<v:variable name="m_name" type="varchar" default="null" />
<v:form name="usr_personal_7" type="simple" method="POST" xhtml_enctype="multipart/form-data">
<h3>Creator Of</h3>
<vm:if test="self.m_mode = 'M/browse'">
<?vsp
if (0)
{
?>
<v:button name="m_dButton" action="simple" value="Delete">
<v:on-post>
<![CDATA[
delete from DB.DBA.WA_USER_PROJECTS where WUP_ID = get_keyword ('m_id', self.vc_page.vc_event.ve_params) and WUP_U_ID = self.u_id;
self.vc_data_bind(e);
]]>
</v:on-post>
</v:button>
<?vsp
}
?>
<input type="hidden" name="m_id" id="m_id" value="" />
<div style="padding: 0 0 0.5em 0;">
<v:button name="m_aButton" action="simple" style="url" value="''" xhtml_class="img_button">
<v:before-render>
<![CDATA[
control.ufl_value := '<img src="images/icons/add_16.png" border="0" /> Add';
]]>
</v:before-render>
<v:on-post>
<![CDATA[
self.m_mode := 'M/add';
self.m_name := 'foaf:made';
self.m_url.ufl_value := null;
self.m_descr.ufl_value := null;
self.vc_data_bind (e);
]]>
</v:on-post>
</v:button>
</div>
<v:data-set name="m_ds"
sql="select WUP_ID, WUP_NAME, WUP_URL, WUP_DESC from DB.DBA.WA_USER_PROJECTS where WUP_U_ID = :self.u_id"
scrollable="1"
editable="1"
nrows="0">
<v:template name="m_ds_header" type="simple" name-to-remove="table" set-to-remove="bottom">
<table class="listing" rules="groups">
<tr class="listing_header_row">
<th>Property</th>
<th>Description</th>
<th width="1%" nowrap="nowrap">Action</th>
</tr>
</table>
</v:template>
<v:template name="m_ds_repeat" type="repeat" name-to-remove="" set-to-remove="">
<v:template name="m_ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
<table>
<tr>
<td colspan="3">No 'Creator Of' Items</td>
</tr>
</table>
</v:template>
<v:template name="m_ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
<table>
<tr class="<?V case when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
<td nowrap="nowrap" width="50%">
<v:label value="--(control.vc_parent as vspx_row_template).te_column_value('WUP_NAME')" format="%s"/>
</td>
<td nowrap="nowrap" width="50%">
<v:label value="--(control.vc_parent as vspx_row_template).te_column_value('WUP_DESC')" format="%s"/>
</td>
<td nowrap="nowrap">
<v:button name="m_eButton" action="simple" style="url" value="''" xhtml_onclick="javascript: return confirm(\'Are you sure you want to delete this record?\');" xhtml_class="img_button">
<v:before-render>
<![CDATA[
control.ufl_value := '<img src="images/icons/edit_16.png" border="0" alt="Edit Offer" title="Edit Offer"/> Edit';
]]>
</v:before-render>
<v:on-post>
<![CDATA[
self.m_mode := 'M/edit';
self.m_id := (control.vc_parent as vspx_row_template).te_column_value('WUP_ID');
select WUP_NAME,
WUP_URL,
WUP_DESC
into self.m_name,
self.m_url.ufl_value,
self.m_descr.ufl_value
from DB.DBA.WA_USER_PROJECTS
where WUP_ID = self.m_id;
self.vc_data_bind (e);
]]>
</v:on-post>
</v:button>
<span class="button pointer" onclick="javascript: if (confirm('Are you sure you want to delete this record?')) {$('m_id').value = <?V (control as vspx_row_template).te_column_value('WUP_ID') ?>; doPost('page_form', 'm_dButton');}">
<img class="button" src="/ods/images/icons/trash_16.png"/> Delete
</span>
</td>
</tr>
</table>
</v:template>
</v:template>
<v:template name="m_ds_footer" type="simple" name-to-remove="table" set-to-remove="top">
<table>
</table>
</v:template>
</v:data-set>
</vm:if>
<vm:if test="self.m_mode <> 'M/browse'">
<div class="fm">
<table>
<tr>
<th width="120px">
Property (*)
</th>
<td id="if_opt">
<script type="text/javascript">
<![CDATA[
function p_init ()
{
var fld = new OAT.Combolist([], "<?V self.m_name ?>");
fld.input.name = 'm_name';
fld.input.id = 'm_name';
fld.input.style.width = "300px";
$("if_opt").appendChild(fld.div);
fld.addOption("foaf:made");
fld.addOption("dc:creator");
fld.addOption("sioc:owner");
}
ODSInitArray.push ( function () { OAT.Loader.load(["combolist"], p_init); } );
]]>
</script>
</td>
</tr>
<tr>
<th valign="top">
URI
</th>
<td>
<v:text name="m_url" value="" xhtml_id="m_url" xhtml_style="width:316px" xhtml_class="_validate_ _url_ _canEmpty_" xhtml_onblur="javascript: validateField(this);" />
</td>
</tr>
<tr>
<th valign="top">
Description (*)
</th>
<td>
<v:textarea name="m_descr" value="" xhtml_id="m_descr" xhtml_rows="4" xhtml_cols="80"/>
<br />
<label>Note: The fields designated with '*' will be fetched from the source document if empty</label>
</td>
</tr>
<tr>
<td></td>
<td>
<v:button name="user_c_personal_7" value="Cancel" action="simple">
<v:on-post>
self.m_mode := 'M/browse';
self.vc_data_bind (e);
</v:on-post>
</v:button>
<v:button name="user_s_personal_7" value="--case when self.m_mode = 'M/add' then 'Add' else 'Update' end" action="simple" xhtml_onclick="return validateInputs(this);">
<v:on-post>
<![CDATA[
declare tmp, descr, iri, name, url varchar;
declare stat, msg, dta, mdta, qrs, params any;
if (not self.vc_is_valid)
return;
params := e.ve_params;
self.m_name := get_keyword ('m_name', params);
url := self.m_url.ufl_value;
descr := self.m_descr.ufl_value;
name := self.m_name;
iri := url;
tmp := uuid ();
{
declare exit handler for sqlstate '*'
{
exec (sprintf ('sparql clear graph <%s>', tmp), stat, msg);
goto nexts;
};
qrs := vector (0,0,0);
exec (sprintf ('sparql load "%s" into graph <%s>', url, tmp));
qrs[0] := sprintf ('sparql
prefix doap: <http://usefulinc.com/ns/doap#>
select ?P ?N ?D
from <%s>
where { ?P a doap:Project ; doap:name ?N ; doap:description ?D . }', tmp);
qrs[1] := sprintf ('sparql
prefix foaf: <http://xmlns.com/foaf/0.1/>
select ?P ?N ?D
from <%s>
where { ?P a foaf:Organization ; foaf:name ?N . optional { ?P foaf:dummy ?D . } }', tmp);
qrs[2] := sprintf ('sparql
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix dc: <http://purl.org/dc/elements/1.1/>
prefix foaf: <http://xmlns.com/foaf/0.1/>
select ?P ?N ?D ?TI
from <%s>
where { ?P a ?TP .
optional { ?P foaf:name ?N } .
optional { ?P rdfs:label ?D . } .
optional { ?P dc:title ?TI }
filter ( ?P = <%s> )
}', tmp, url);
foreach (any qr in qrs) do
{
exec (qr, stat, msg, vector (), 0, mdta, dta);
if (length (dta) and length (dta[0]) > 3)
{
iri := url;
name := coalesce (dta[0][1], dta[0][2], dta[0][3]);
descr := coalesce (name, descr);
goto _found;
}
else if (length (dta) and length (dta[0]) > 2)
{
iri := dta[0][0];
name := dta[0][1];
descr := coalesce (dta[0][2], descr);
goto _found;
}
}
_found:
exec (sprintf ('sparql clear graph <%s>', tmp), stat, msg);
}
nexts:;
if (length (self.m_name))
name := self.m_name;
name := cast (name as varchar);
descr := cast (descr as varchar);
if (not length (name))
{
self.vc_error_message := 'The title of item made is not specified nor can be retrieved from source URI, please specify.';
self.vc_is_valid := 0;
return;
}
if (not length (descr))
{
self.vc_error_message := 'The description of item made is not specified nor can be retrieved from source URI, please specify.';
self.vc_is_valid := 0;
return;
}
if (self.m_mode = 'M/add')
{
insert into DB.DBA.WA_USER_PROJECTS (WUP_U_ID, WUP_NAME, WUP_URL, WUP_DESC, WUP_IRI)
values (self.u_id, name, url, descr, iri);
} else {
update DB.DBA.WA_USER_PROJECTS
set WUP_NAME = name,
WUP_URL = url,
WUP_DESC = descr,
WUP_IRI = iri
where WUP_ID = self.m_id;
}
self.m_mode := 'M/browse';
self.vc_data_bind (e);
]]>
</v:on-post>
</v:button>
</td>
</tr>
</table>
</div>
</vm:if>
</v:form>
</v:page>
|