Showing
3 changed files
with
34 additions
and
85 deletions
... | @@ -6869,18 +6869,6 @@ This expression is called if a node and a predicate/subject type combination is | ... | @@ -6869,18 +6869,6 @@ This expression is called if a node and a predicate/subject type combination is |
6869 | rdfs:range app:WeightedExpression ; | 6869 | rdfs:range app:WeightedExpression ; |
6870 | rdfs:subPropertyOf app:systemProperty . | 6870 | rdfs:subPropertyOf app:systemProperty . |
6871 | 6871 | ||
6872 | -app:reloadable | ||
6873 | - rdf:type ui:NodeClass ; | ||
6874 | - 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 ; | ||
6875 | - rdfs:label "reloadable"^^xsd:string ; | ||
6876 | - rdfs:subClassOf ui:ControlElement ; | ||
6877 | - spin:constraint | ||
6878 | - [ rdf:type spl:Argument ; | ||
6879 | - rdfs:comment "The id of the reloadable element."^^xsd:string ; | ||
6880 | - spl:predicate arg:id ; | ||
6881 | - spl:valueType xsd:string | ||
6882 | - ] . | ||
6883 | - | ||
6884 | app:removeUniqueId | 6872 | app:removeUniqueId |
6885 | rdf:type spin:Function ; | 6873 | rdf:type spin:Function ; |
6886 | rdfs:comment "Takes a string and removes everything after the :: (including the :: itself). This is needed to de-code tree node ids."^^xsd:string ; | 6874 | 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) { | ... | @@ -132,6 +132,36 @@ function appInitDatePicker(id, altId) { |
132 | 132 | ||
133 | 133 | ||
134 | /** | 134 | /** |
135 | + * Reloads a ui:loadable using a jQuery Ajax call. | ||
136 | + * In addition to the id of the loadable, this function can take a JavaScript | ||
137 | + * object with name-value pairs. The names will become pre-bound variables | ||
138 | + * in the reloaded view. The values must be parsable RDF nodes (in SPARQL | ||
139 | + * syntax, e.g. '<http://example.org/MyClass>' or '"2011-11-11"^^xsd:date'. | ||
140 | + * @param id the id of the loadable | ||
141 | + * @param args a JavaScript object with additional parameters | ||
142 | + */ | ||
143 | +function appLoad(id, args) { | ||
144 | + var e = $('#' + id); | ||
145 | + var base = e.attr('uistate'); | ||
146 | + if(!base) { | ||
147 | + alert('Error: Invalid use of appLoad: Missing uistate attribute at ' + id); | ||
148 | + return; | ||
149 | + } | ||
150 | + var url = base; | ||
151 | + if(args) { | ||
152 | + var c = {}; | ||
153 | + for(var key in args) { | ||
154 | + c['_scope' + key] = args[key]; | ||
155 | + } | ||
156 | + var p = jQuery.param(c); | ||
157 | + url = p + "&" + base; | ||
158 | + } | ||
159 | + e.html('<div class="appLoadingIndicator" />'); | ||
160 | + e.load(uispinServlet, url); | ||
161 | +} | ||
162 | + | ||
163 | + | ||
164 | +/** | ||
135 | * Replaces a form with another mode. | 165 | * Replaces a form with another mode. |
136 | * This is for example called as handler of the Edit and Cancel buttons. | 166 | * This is for example called as handler of the Edit and Cancel buttons. |
137 | * @param formId the id of the form to replace | 167 | * @param formId the id of the form to replace |
... | @@ -165,75 +195,6 @@ function appLoadForm(formId, mode, resourceURI, resourceTypeURI, queryGraphURI) | ... | @@ -165,75 +195,6 @@ function appLoadForm(formId, mode, resourceURI, resourceTypeURI, queryGraphURI) |
165 | 195 | ||
166 | 196 | ||
167 | /** | 197 | /** |
168 | - * Loads an edit form into a given element. | ||
169 | - * @param parentId the id of the element to load into | ||
170 | - * @param resourceType the class to edit | ||
171 | - */ | ||
172 | -function appLoadEditForm(parentId, resourceType) { | ||
173 | - var data = { | ||
174 | - modeName: 'edit', | ||
175 | - resourceType: resourceType, | ||
176 | - _viewClass: 'app:FormSelector', | ||
177 | - _snippet: true | ||
178 | - }; | ||
179 | - $.get(uispinServlet, data, function(data) { | ||
180 | - $('#' + parentId).html(data); | ||
181 | - }); | ||
182 | - return false; | ||
183 | -} | ||
184 | - | ||
185 | - | ||
186 | -/** | ||
187 | - * Replaces a given element (specified by oldElementId) with a search form | ||
188 | - * for a given resource type, using a specified query graph. | ||
189 | - * @param oldElementId the id of the element to replace - this will be the id of the new form. | ||
190 | - * @param resultsId the id of the element to display the search results | ||
191 | - * @param resourceTypeURI the type of resources to search for | ||
192 | - * @param queryGraphURI the (instance) query graph URI | ||
193 | - * @param schemaGraphURI the URI of the schema graph | ||
194 | - * @param noBorder (optional) to suppress the border | ||
195 | - */ | ||
196 | -function appLoadSearchForm(oldElementId, resultsId, resourceTypeURI, queryGraphURI, schemaGraphURI, noBorder) { | ||
197 | - var data = { | ||
198 | - formId : oldElementId, | ||
199 | - resourceType : '<' + resourceTypeURI + '>', | ||
200 | - resultsId : resultsId, | ||
201 | - queryGraph : '<' + queryGraphURI + '>', | ||
202 | - _base : '<' + schemaGraphURI + '>', | ||
203 | - _viewClass : 'app:SearchForm', | ||
204 | - _snippet : true | ||
205 | - }; | ||
206 | - if(noBorder) { | ||
207 | - data.noBorder = true; | ||
208 | - } | ||
209 | - $.get(uispinServlet, data, function(data) { | ||
210 | - $('#' + oldElementId).parent().html(data); | ||
211 | - }); | ||
212 | -} | ||
213 | - | ||
214 | - | ||
215 | -function appReload(id, args) { | ||
216 | - var e = $('#' + id); | ||
217 | - var base = e.attr('reload'); | ||
218 | - if(!base) { | ||
219 | - alert('Error: Invalid use of appReload: Missing reload attribute at ' + id); | ||
220 | - return; | ||
221 | - } | ||
222 | - var url = base; | ||
223 | - if(args) { | ||
224 | - var c = {}; | ||
225 | - for(var key in args) { | ||
226 | - c['_scope' + key] = args[key]; | ||
227 | - } | ||
228 | - var p = jQuery.param(c); | ||
229 | - url = p + "&" + base; | ||
230 | - } | ||
231 | - e.html('<div class="appLoadingIndicator" />'); | ||
232 | - e.load(uispinServlet, url); | ||
233 | -} | ||
234 | - | ||
235 | - | ||
236 | -/** | ||
237 | * Loads a SearchResultsGrid based on the selections in a form with | 198 | * Loads a SearchResultsGrid based on the selections in a form with |
238 | * a given id. Will replace the content of a given target element. | 199 | * a given id. Will replace the content of a given target element. |
239 | * @param formId the form id | 200 | * @param formId the form id | ... | ... |
... | @@ -47,14 +47,13 @@ log:LogBrowser | ... | @@ -47,14 +47,13 @@ log:LogBrowser |
47 | [ rdf:type app:Tree ; | 47 | [ rdf:type app:Tree ; |
48 | arg:dataProvider log:LogEventClassTreeDataProvider ; | 48 | arg:dataProvider log:LogEventClassTreeDataProvider ; |
49 | arg:id "classTree"^^xsd:string ; | 49 | arg:id "classTree"^^xsd:string ; |
50 | - arg:onSelect "appReload('form', {resourceType: '<' + resource + '>'})"^^xsd:string ; | 50 | + arg:onSelect "appLoad('form', {resourceType: '<' + resource + '>'})"^^xsd:string ; |
51 | ui:childIndex 1 | 51 | ui:childIndex 1 |
52 | ] ; | 52 | ] ; |
53 | ui:childIndex 0 | 53 | ui:childIndex 0 |
54 | ] ; | 54 | ] ; |
55 | ui:child | 55 | ui:child |
56 | - [ rdf:type app:reloadable ; | 56 | + [ rdf:type ui:loadable ; |
57 | - arg:id "form"^^xsd:string ; | ||
58 | ui:child | 57 | ui:child |
59 | [ rdf:type app:SearchForm ; | 58 | [ rdf:type app:SearchForm ; |
60 | arg:formId "searchForm"^^xsd:string ; | 59 | arg:formId "searchForm"^^xsd:string ; |
... | @@ -69,7 +68,8 @@ log:LogBrowser | ... | @@ -69,7 +68,8 @@ log:LogBrowser |
69 | arg:resultsId "results"^^xsd:string ; | 68 | arg:resultsId "results"^^xsd:string ; |
70 | ui:childIndex 0 | 69 | ui:childIndex 0 |
71 | ] ; | 70 | ] ; |
72 | - ui:childIndex 1 | 71 | + ui:childIndex 1 ; |
72 | + ui:loadId "form"^^xsd:string | ||
73 | ] ; | 73 | ] ; |
74 | ui:childIndex 0 | 74 | ui:childIndex 0 |
75 | ] ; | 75 | ] ; | ... | ... |
-
Please register or login to post a comment