Holger Knublauch

Moved to ui:loadable

......@@ -6869,18 +6869,6 @@ This expression is called if a node and a predicate/subject type combination is
rdfs:range app:WeightedExpression ;
rdfs:subPropertyOf app:systemProperty .
app:reloadable
rdf:type ui:NodeClass ;
rdfs:comment "Marks the children of this element as reloadable through an Ajax request. The JavaScript function appReload (which can also be produced through the SPIN function app:reload) can be used to trigger a reload."^^xsd:string ;
rdfs:label "reloadable"^^xsd:string ;
rdfs:subClassOf ui:ControlElement ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The id of the reloadable element."^^xsd:string ;
spl:predicate arg:id ;
spl:valueType xsd:string
] .
app:removeUniqueId
rdf:type spin:Function ;
rdfs:comment "Takes a string and removes everything after the :: (including the :: itself). This is needed to de-code tree node ids."^^xsd:string ;
......
......@@ -132,6 +132,36 @@ function appInitDatePicker(id, altId) {
/**
* Reloads a ui:loadable using a jQuery Ajax call.
* In addition to the id of the loadable, this function can take a JavaScript
* object with name-value pairs. The names will become pre-bound variables
* in the reloaded view. The values must be parsable RDF nodes (in SPARQL
* syntax, e.g. '<http://example.org/MyClass>' or '"2011-11-11"^^xsd:date'.
* @param id the id of the loadable
* @param args a JavaScript object with additional parameters
*/
function appLoad(id, args) {
var e = $('#' + id);
var base = e.attr('uistate');
if(!base) {
alert('Error: Invalid use of appLoad: Missing uistate attribute at ' + id);
return;
}
var url = base;
if(args) {
var c = {};
for(var key in args) {
c['_scope' + key] = args[key];
}
var p = jQuery.param(c);
url = p + "&" + base;
}
e.html('<div class="appLoadingIndicator" />');
e.load(uispinServlet, url);
}
/**
* Replaces a form with another mode.
* This is for example called as handler of the Edit and Cancel buttons.
* @param formId the id of the form to replace
......@@ -165,75 +195,6 @@ function appLoadForm(formId, mode, resourceURI, resourceTypeURI, queryGraphURI)
/**
* Loads an edit form into a given element.
* @param parentId the id of the element to load into
* @param resourceType the class to edit
*/
function appLoadEditForm(parentId, resourceType) {
var data = {
modeName: 'edit',
resourceType: resourceType,
_viewClass: 'app:FormSelector',
_snippet: true
};
$.get(uispinServlet, data, function(data) {
$('#' + parentId).html(data);
});
return false;
}
/**
* Replaces a given element (specified by oldElementId) with a search form
* for a given resource type, using a specified query graph.
* @param oldElementId the id of the element to replace - this will be the id of the new form.
* @param resultsId the id of the element to display the search results
* @param resourceTypeURI the type of resources to search for
* @param queryGraphURI the (instance) query graph URI
* @param schemaGraphURI the URI of the schema graph
* @param noBorder (optional) to suppress the border
*/
function appLoadSearchForm(oldElementId, resultsId, resourceTypeURI, queryGraphURI, schemaGraphURI, noBorder) {
var data = {
formId : oldElementId,
resourceType : '<' + resourceTypeURI + '>',
resultsId : resultsId,
queryGraph : '<' + queryGraphURI + '>',
_base : '<' + schemaGraphURI + '>',
_viewClass : 'app:SearchForm',
_snippet : true
};
if(noBorder) {
data.noBorder = true;
}
$.get(uispinServlet, data, function(data) {
$('#' + oldElementId).parent().html(data);
});
}
function appReload(id, args) {
var e = $('#' + id);
var base = e.attr('reload');
if(!base) {
alert('Error: Invalid use of appReload: Missing reload attribute at ' + id);
return;
}
var url = base;
if(args) {
var c = {};
for(var key in args) {
c['_scope' + key] = args[key];
}
var p = jQuery.param(c);
url = p + "&" + base;
}
e.html('<div class="appLoadingIndicator" />');
e.load(uispinServlet, url);
}
/**
* Loads a SearchResultsGrid based on the selections in a form with
* a given id. Will replace the content of a given target element.
* @param formId the form id
......
......@@ -47,14 +47,13 @@ log:LogBrowser
[ rdf:type app:Tree ;
arg:dataProvider log:LogEventClassTreeDataProvider ;
arg:id "classTree"^^xsd:string ;
arg:onSelect "appReload('form', {resourceType: '<' + resource + '>'})"^^xsd:string ;
arg:onSelect "appLoad('form', {resourceType: '<' + resource + '>'})"^^xsd:string ;
ui:childIndex 1
] ;
ui:childIndex 0
] ;
ui:child
[ rdf:type app:reloadable ;
arg:id "form"^^xsd:string ;
[ rdf:type ui:loadable ;
ui:child
[ rdf:type app:SearchForm ;
arg:formId "searchForm"^^xsd:string ;
......@@ -69,7 +68,8 @@ log:LogBrowser
arg:resultsId "results"^^xsd:string ;
ui:childIndex 0
] ;
ui:childIndex 1
ui:childIndex 1 ;
ui:loadId "form"^^xsd:string
] ;
ui:childIndex 0
] ;
......