Holger Knublauch

Grid improvements

......@@ -1911,18 +1911,6 @@ app:ImageResourceViewer
]
] .
app:InstancesGrid
rdf:type ui:NodeClass ;
rdfs:comment "A grid displaying all instances of a class."^^xsd:string ;
rdfs:label "Instances grid"^^xsd:string ;
rdfs:subClassOf app:GridElements ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The class to display the instances of."^^xsd:string ;
spl:predicate arg:class ;
spl:valueType rdfs:Class
] .
app:Label
rdf:type ui:NodeClass ;
rdfs:label "Label"^^xsd:string ;
......@@ -3849,6 +3837,13 @@ app:SearchForm
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The onSelect handler of the generated SearchResultsGrid."^^xsd:string ;
spl:optional "true"^^xsd:boolean ;
spl:predicate arg:onSelect ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "An optional graph that contains the schema (needed to determine whether an instance has a class that is the subclass of the resource type)."^^xsd:string ;
spl:optional "true"^^xsd:boolean ;
spl:predicate arg:queryGraph ;
......@@ -3883,7 +3878,7 @@ app:SearchForm
ui:child
[ rdf:type html:Form ;
html:class
[ rdf:type fn:concat ;
[ rdf:type ui:concat ;
sp:arg1 "appForm "^^xsd:string ;
sp:arg2 [ rdf:type sp:if ;
sp:arg1 [ rdf:type sp:or ;
......@@ -3922,7 +3917,7 @@ app:SearchForm
html:name "type"^^xsd:string ;
html:type "hidden"^^xsd:string ;
html:value
[ rdf:type fn:concat ;
[ rdf:type ui:concat ;
sp:arg1 "<"^^xsd:string ;
sp:arg2 [ sp:varName "resourceType"^^xsd:string
] ;
......@@ -3967,7 +3962,7 @@ app:SearchForm
ui:child
[ rdf:type html:Input ;
html:name
[ rdf:type fn:concat ;
[ rdf:type ui:concat ;
sp:arg1 "keyProperty"^^xsd:string ;
sp:arg2 [ sp:varName "index"^^xsd:string
]
......@@ -4024,7 +4019,7 @@ app:SearchForm
ui:child
[ rdf:type html:Input ;
html:onclick
[ rdf:type fn:concat ;
[ rdf:type ui:concat ;
sp:arg1 "appLoadSearchResultsGrid('"^^xsd:string ;
sp:arg2 [ sp:varName "fid"^^xsd:string
] ;
......@@ -4032,7 +4027,9 @@ app:SearchForm
sp:arg4 [ sp:varName "resultsId"^^xsd:string
] ;
sp:arg5 "', '"^^xsd:string ;
sp:arg6 [ rdf:type ui:currentQueryGraph
sp:arg6 [ rdf:type ui:escapeJSON ;
sp:arg1 [ sp:varName "onSelect"^^xsd:string
]
] ;
sp:arg7 "')"^^xsd:string
] ;
......@@ -4040,6 +4037,18 @@ app:SearchForm
html:value "Search"^^xsd:string ;
ui:childIndex 0
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 1 ;
ui:text """ 
"""^^xsd:string
] ;
ui:child
[ rdf:type html:Input ;
html:type "reset"^^xsd:string ;
html:value "Reset"^^xsd:string ;
ui:childIndex 2
] ;
ui:childIndex 6
] ;
ui:childIndex 0 ;
......@@ -4082,6 +4091,13 @@ app:SearchResultsGrid
rdfs:subClassOf app:GridElements ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "JavaScript code that shall be executed if the user selects a row in the grid. In this JavaScript code, the variable resource contains the URI of the selected resource."^^xsd:string ;
spl:optional "true"^^xsd:boolean ;
spl:predicate arg:onSelect ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "A URL-encoded string of the parameters produced by a SearchForm."^^xsd:string ;
spl:predicate arg:params ;
spl:valueType xsd:string
......
......@@ -123,11 +123,29 @@ function appInitDatePicker(id, altId) {
if(!altId) {
altId = 'new-' + id;
}
$('#dateEditor' + id).datepicker({
var eid = '#dateEditor' + id;
$(eid).datepicker({
altField: '#' + altId,
altFormat: 'yy-mm-dd',
dateFormat: 'yy-mm-dd',
});
// Work-around to bug: Make sure that hidden field is cleared if field is empty
$(eid).change(function() {
if('' == $(eid).val()) {
$('#' + altId).val('');
}
});
}
/**
* Replaces the content of a given jQuery element with a loading indicator
* (spinning wheel).
* @param e the jQuery element
*/
function appInsertLoadingIndicator(e) {
e.html('<div class="appLoadingIndicator" />');
}
......@@ -156,7 +174,7 @@ function appLoad(id, args) {
var p = jQuery.param(c);
url = p + "&" + base;
}
e.html('<div class="appLoadingIndicator" />');
appInsertLoadingIndicator(e);
e.load(uispinServlet, url);
}
......@@ -187,6 +205,7 @@ function appLoadForm(formId, mode, resourceURI, resourceTypeURI, queryGraphURI)
if(queryGraphURI) {
data._base = '<' + queryGraphURI + '>';
}
appInsertLoadingIndicator($('#' + formId).parent());
$.get(uispinServlet, data, function(data) {
$('#' + formId).parent().html(data);
});
......@@ -199,16 +218,35 @@ function appLoadForm(formId, mode, resourceURI, resourceTypeURI, queryGraphURI)
* a given id. Will replace the content of a given target element.
* @param formId the form id
* @param targetId the target id
* @returns false
* @param onSelect the value for onSelect of the generated grid
*/
function appLoadSearchResultsGrid(formId, targetId) {
function appLoadSearchResultsGrid(formId, targetId, onSelect) {
var params = $('#' + formId).serialize();
var escaped = '&params=' + escape(params);
if(onSelect) {
escaped += '&onSelect=' + escape(onSelect);
}
appInsertLoadingIndicator($('#' + targetId));
$.get(uispinServlet + '?_viewClass=app:SearchResultsGrid&_snippet=true&' +
params + escaped, function(data) {
$('#' + targetId).html(data);
});
return false;
}
/**
* Loads a given ui:loadable with a given variable pre-bound to
* a given URI resource.
* This can be used as onSelect handler of tree and grid elements,
* e.g. onSelect="appLoadWithResource('form', 'resource', resource)"
* @param loadId the id of the ui:loadable
* @param varName the name of the variable to set
* @param resourceURI the URI of the resource
*/
function appLoadWithResource(loadId, varName, resourceURI) {
var params = {};
params[varName] = '<' + resourceURI + '>';
appLoad(loadId, params);
}
......
......@@ -6,7 +6,7 @@
<div id="{= ?pagerId }" />
<script>
$("#{= ?tableId }").jqGrid({
<swon:NameValuePair arg:name="url" arg:value="{= fn:concat('getSearchResults?', ?params) }" />,
<swon:NameValuePair arg:name="url" arg:value="getSearchResults?{= ?params }" />,
<swon:NameValuePair arg:name="datatype" arg:value="json" />,
colNames:[
<ui:if ui:condition="{= bound(?keyProperties) }">
......@@ -48,11 +48,16 @@
}
</ui:else>
],
<ui:if ui:condition="{= bound(?onSelect) }">
onSelectRow: function(resource) {
{= ?onSelect }
},
</ui:if>
rowNum: 10,
rowList:[5,10,20],
pager: '#{= ?pagerId }',
viewrecords: true,
sortorder: "desc",
sortorder: "asc",
height: "100%",
width: "100%"
}).jqGrid('navGrid', '#{= ?pagerId }', { add:false, edit:false, del:false});
......
# baseURI: http://appschema.org/skapp
# imports: http://appschema.org
# imports: http://www.w3.org/2004/02/skos/core
@prefix app: <http://appschema.org/> .
@prefix arg: <http://spinrdf.org/arg#> .
@prefix default: <http://uispin.org/default#> .
@prefix html: <http://uispin.org/html#> .
@prefix let: <http://uispin.org/let#> .
@prefix letrs: <http://uispin.org/letrs#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skapp: <http://appschema.org/skapp#> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix ui: <http://uispin.org/ui#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
app:skapp
rdf:type owl:Ontology ;
owl:imports <http://appschema.org> , <http://www.w3.org/2004/02/skos/core> ;
owl:versionInfo "0.1.0"^^xsd:string .
skapp:ConceptClassTreeDataProvider
rdf:type app:QueryTreeDataProvider ;
rdfs:label "Concept class tree data provider"^^xsd:string ;
arg:childrenQuery
[ rdf:type sp:Select ;
sp:orderBy ([ sp:varName "label"^^xsd:string
]) ;
sp:resultVariables ([ sp:varName "child"^^xsd:string
] [ sp:varName "label"^^xsd:string
] [ sp:varName "leaf"^^xsd:string
] [ sp:varName "icon"^^xsd:string
] [ sp:varName "type"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "parent"^^xsd:string
] ;
sp:predicate rdfs:subClassOf ;
sp:subject
[ sp:varName "child"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type sp:notExists ;
sp:elements ([ sp:object
[ sp:varName "child"^^xsd:string
] ;
sp:predicate rdfs:subClassOf ;
sp:subject
[ sp:varName "grandChild"^^xsd:string
]
])
] ;
sp:variable
[ sp:varName "leaf"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type ui:label ;
sp:arg1 [ sp:varName "child"^^xsd:string
]
] ;
sp:variable
[ sp:varName "label"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression "appIconClass" ;
sp:variable
[ sp:varName "icon"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spl:object ;
sp:arg1 [ sp:varName "child"^^xsd:string
] ;
sp:arg2 rdf:type
] ;
sp:variable
[ sp:varName "type"^^xsd:string
]
])
] ;
arg:id [ sp:varName "id"^^xsd:string
] ;
arg:rootsQuery
[ rdf:type sp:Select ;
sp:resultVariables ([ sp:varName "child"^^xsd:string
] [ sp:varName "label"^^xsd:string
] [ sp:varName "leaf"^^xsd:string
] [ sp:varName "icon"^^xsd:string
]) ;
sp:where ([ rdf:type sp:Bind ;
sp:expression <http://www.w3.org/2004/02/skos/core#Concept> ;
sp:variable
[ sp:varName "child"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression "Any Concept" ;
sp:variable
[ sp:varName "label"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression "false"^^xsd:boolean ;
sp:variable
[ sp:varName "leaf"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression "appIconClass" ;
sp:variable
[ sp:varName "icon"^^xsd:string
]
])
] .
skapp:ConceptSearchView
rdf:type ui:NodeClass ;
rdfs:comment "A vertical split pane with a search form on top and a search results grid at the bottom."^^xsd:string ;
rdfs:label "Concept search view"^^xsd:string ;
rdfs:subClassOf skapp:Elements ;
ui:prototype
[ rdf:type app:VSplitLayout ;
arg:height "500px"^^xsd:string ;
arg:topHeight "30%"^^xsd:string ;
ui:child
[ rdf:type app:VSplitLayout ;
arg:height "300px"^^xsd:string ;
ui:child
[ rdf:type html:Div ;
ui:child
[ rdf:type app:Header ;
arg:label "Concept Type"^^xsd:string ;
ui:childIndex 0
] ;
ui:child
[ rdf:type app:Tree ;
arg:dataProvider skapp:ConceptClassTreeDataProvider ;
arg:id "classTree"^^xsd:string ;
arg:onSelect "appLoadWithResource('searchFormDiv', 'resourceType', resource)"^^xsd:string ;
ui:childIndex 1
] ;
ui:childIndex 0
] ;
ui:child
[ rdf:type ui:loadable ;
ui:child
[ rdf:type app:SearchForm ;
arg:formId "searchForm"^^xsd:string ;
arg:noBorder "true"^^xsd:boolean ;
arg:onSelect "appLoadWithResource('conceptForm', 'concept', resource)"^^xsd:string ;
arg:resourceType
[ rdf:type sp:coalesce ;
sp:arg1 [ sp:varName "resourceType"^^xsd:string
] ;
sp:arg2 <http://www.w3.org/2004/02/skos/core#Concept>
] ;
arg:resultsId "results"^^xsd:string ;
ui:childIndex 0
] ;
ui:childIndex 1 ;
ui:loadId "searchFormDiv"^^xsd:string
] ;
ui:childIndex 0
] ;
ui:child
[ rdf:type html:Div ;
ui:child
[ rdf:type app:Header ;
arg:label "Matching Concepts"^^xsd:string ;
ui:childIndex 0
] ;
ui:child
[ rdf:type html:Div ;
html:id "results"^^xsd:string ;
ui:childIndex 1
] ;
ui:childIndex 1
]
] .
skapp:ConceptTreeBrowser
rdf:type ui:NodeClass ;
rdfs:comment "A horizontal split pane with a Concept tree on the left and a form for the selected concept on the right."^^xsd:string ;
rdfs:label "Concept tree browser"^^xsd:string ;
rdfs:subClassOf skapp:Elements ;
ui:prototype
[ rdf:type app:HSplitLayout ;
arg:height "500px"^^xsd:string ;
arg:leftWidth "30%"^^xsd:string ;
ui:child
[ rdf:type html:Div ;
ui:child
[ rdf:type app:Header ;
arg:label "Concept Hierarchy"^^xsd:string ;
ui:childIndex 0
] ;
ui:child
[ rdf:type app:Tree ;
arg:dataProvider skapp:ConceptTreeDataProvider ;
arg:id "conceptTree"^^xsd:string ;
arg:onSelect "appLoadWithResource('conceptForm', 'concept', resource)"^^xsd:string ;
ui:childIndex 1
] ;
ui:childIndex 0
] ;
ui:child
[ rdf:type html:Div ;
ui:child
[ rdf:type ui:loadable ;
ui:child
[ rdf:type ui:if ;
ui:child
[ rdf:type app:ViewForm ;
arg:resource
[ sp:varName "concept"^^xsd:string
] ;
ui:childIndex 0
] ;
ui:childIndex 0 ;
ui:condition
[ rdf:type sp:bound ;
sp:arg1 [ sp:varName "concept"^^xsd:string
]
]
] ;
ui:child
[ rdf:type ui:else ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 0 ;
ui:text """
Please select a concept in the tree.
"""^^xsd:string
] ;
ui:childIndex 1
] ;
ui:childIndex 0 ;
ui:loadId "conceptForm"^^xsd:string
] ;
ui:childIndex 1
]
] .
skapp:ConceptTreeDataProvider
rdf:type app:QueryTreeDataProvider ;
rdfs:comment "A data provider for a SKOS Concept tree, walking down skos:broader."^^xsd:string ;
rdfs:label "Concept tree data provider"^^xsd:string ;
arg:childrenQuery
[ rdf:type sp:Select ;
sp:orderBy ([ sp:varName "label"^^xsd:string
]) ;
sp:resultVariables ([ sp:varName "child"^^xsd:string
] [ sp:varName "label"^^xsd:string
] [ sp:varName "leaf"^^xsd:string
] [ sp:varName "icon"^^xsd:string
] [ sp:varName "type"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "parent"^^xsd:string
] ;
sp:predicate <http://www.w3.org/2004/02/skos/core#broader> ;
sp:subject
[ sp:varName "child"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type sp:notExists ;
sp:elements ([ sp:object
[ sp:varName "child"^^xsd:string
] ;
sp:predicate <http://www.w3.org/2004/02/skos/core#broader> ;
sp:subject
[ sp:varName "grandChild"^^xsd:string
]
])
] ;
sp:variable
[ sp:varName "leaf"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type ui:label ;
sp:arg1 [ sp:varName "child"^^xsd:string
]
] ;
sp:variable
[ sp:varName "label"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression "appIconConcept" ;
sp:variable
[ sp:varName "icon"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spl:object ;
sp:arg1 [ sp:varName "child"^^xsd:string
] ;
sp:arg2 rdf:type
] ;
sp:variable
[ sp:varName "type"^^xsd:string
]
])
] ;
arg:id [ sp:varName "id"^^xsd:string
] ;
arg:rootsQuery
[ rdf:type sp:Select ;
sp:distinct "true"^^xsd:boolean ;
sp:orderBy ([ sp:varName "label"^^xsd:string
]) ;
sp:resultVariables ([ sp:varName "child"^^xsd:string
] [ sp:varName "label"^^xsd:string
] [ sp:varName "leaf"^^xsd:string
] [ sp:varName "icon"^^xsd:string
]) ;
sp:where ([ rdf:type sp:TriplePath ;
sp:object <http://www.w3.org/2004/02/skos/core#Concept> ;
sp:path [ rdf:type sp:ModPath ;
sp:modMax -2 ;
sp:modMin 0 ;
sp:subPath rdfs:subClassOf
] ;
sp:subject
[ sp:varName "type"^^xsd:string
]
] [ sp:object
[ sp:varName "type"^^xsd:string
] ;
sp:predicate rdf:type ;
sp:subject
[ sp:varName "child"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:notExists ;
sp:elements ([ sp:object
[ sp:varName "parent"^^xsd:string
] ;
sp:predicate <http://www.w3.org/2004/02/skos/core#broader> ;
sp:subject
[ sp:varName "child"^^xsd:string
]
])
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type sp:notExists ;
sp:elements ([ sp:object
[ sp:varName "child"^^xsd:string
] ;
sp:predicate <http://www.w3.org/2004/02/skos/core#broader> ;
sp:subject
[ sp:varName "grandChild"^^xsd:string
]
])
] ;
sp:variable
[ sp:varName "leaf"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type ui:label ;
sp:arg1 [ sp:varName "child"^^xsd:string
]
] ;
sp:variable
[ sp:varName "label"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression "appIconConcept" ;
sp:variable
[ sp:varName "icon"^^xsd:string
]
])
] .
skapp:Elements
rdf:type ui:NodeClass ;
rdfs:comment "Base class of SKOS related SWP elements."^^xsd:string ;
rdfs:label "Elements"^^xsd:string ;
rdfs:subClassOf ui:Element ;
ui:abstract "true"^^xsd:boolean .
skapp:SearchableConceptTreeBrowser
rdf:type ui:NodeClass ;
rdfs:comment "A horizontal split pane with a search view on the left and a ConceptTreeBrowser on the right."^^xsd:string ;
rdfs:label "Searchable concept tree browser"^^xsd:string ;
rdfs:subClassOf skapp:Elements ;
ui:prototype
[ rdf:type app:HSplitLayout ;
arg:height "500px"^^xsd:string ;
ui:child
[ rdf:type skapp:ConceptSearchView ;
ui:childIndex 0
] ;
ui:child
[ rdf:type skapp:ConceptTreeBrowser ;
ui:childIndex 1
]
] .
......@@ -47,7 +47,7 @@ log:LogBrowser
[ rdf:type app:Tree ;
arg:dataProvider log:LogEventClassTreeDataProvider ;
arg:id "classTree"^^xsd:string ;
arg:onSelect "appLoad('form', {resourceType: '<' + resource + '>'})"^^xsd:string ;
arg:onSelect "appLoadWithResource('form', 'resourceType', resource)"^^xsd:string ;
ui:childIndex 1
] ;
ui:childIndex 0
......