1 | /** |
---|
2 | * @fileOverview This is the main file, contains main app function (jquery-initialization). |
---|
3 | * The app main function runs setup functionality, which covers this domains: |
---|
4 | * <dl> |
---|
5 | * <dt>the variable initialization<dt> |
---|
6 | * <dd>functions from mdservice_searchclause.js, mdservice_widget.js, mdservice_ui_helpers.js</dd> |
---|
7 | * <dt>loadData()</dt> |
---|
8 | * <dd>loading data from repository and creating particular client-side representations - functions from <a>mdservice_ui_load.js</a></dd> |
---|
9 | * <dt>creating of ui-layout</dt> |
---|
10 | * <dd>i.e. split UI to individual panes - functions from mdservice_ui_layout.js</dd> |
---|
11 | * <dt>addFunctionality()</dt> |
---|
12 | * <dd>bind handlers to events of ui-elements (function directly in mdservice_ui.js)</dd> |
---|
13 | * </dl> |
---|
14 | * @author |
---|
15 | * @version |
---|
16 | */ |
---|
17 | |
---|
18 | $(function(){ |
---|
19 | // turn on debugging (see jquery.xslTransform.js) |
---|
20 | var DEBUG = false; |
---|
21 | |
---|
22 | // check for jQuery |
---|
23 | try{ |
---|
24 | jQuery; |
---|
25 | }catch(e){ |
---|
26 | alert('You need to include jQuery!'); |
---|
27 | } |
---|
28 | |
---|
29 | /////// INIT VARIABLE SETTINGS |
---|
30 | url_params = getUrlVars(); |
---|
31 | workspace = new Workspace(); |
---|
32 | |
---|
33 | // create widgets |
---|
34 | columns_widget = new ListWidget($('#columns-widget'), "columns"); |
---|
35 | collections_widget = new ListWidget($('#collections-widget'), "collections"); |
---|
36 | listwidgetset.add(columns_widget); |
---|
37 | listwidgetset.add(collections_widget); |
---|
38 | |
---|
39 | //////////// LOAD DATA |
---|
40 | loadData(); |
---|
41 | addFunctionality(); |
---|
42 | |
---|
43 | ////////////// CREATE UI-LAYOUT |
---|
44 | createBlock('base',''); |
---|
45 | createLayouts('base'); |
---|
46 | |
---|
47 | // ??autocomplete correction |
---|
48 | initDetailFloat(); |
---|
49 | searchclauseset.addsearchclause(new SearchClause("","",""),"",0,0); |
---|
50 | createInfos(); |
---|
51 | detailcaller.calldetail(undefined, "info"); |
---|
52 | |
---|
53 | }); |
---|
54 | |
---|
55 | function createInfos(){ |
---|
56 | var info = "<span class='cmd cmd_info'></span>"; |
---|
57 | $('.cmds-ui-block').children('.header').append(info); |
---|
58 | createTooltip($('.cmds-ui-block').children('.header')); |
---|
59 | |
---|
60 | $('.cmds-ui-block').children('.header').children('.cmd_info').click(function(){ |
---|
61 | //var a = $(this).parent().next().attr('id'); |
---|
62 | //var uri = window.location.pathname + "static/info.xml"; |
---|
63 | //$.get(uri,{"id":a}, showDetail,'html'); |
---|
64 | detailcaller.calldetail($(this)); |
---|
65 | return false; |
---|
66 | }); |
---|
67 | } |
---|
68 | |
---|
69 | |
---|
70 | function getSelectedRepository(){ |
---|
71 | return $('select[name="x-context"]').find("option:selected").val(); |
---|
72 | } |
---|
73 | |
---|
74 | function getInputMode(){ |
---|
75 | if ($('#searchclauselist').is(":visible")){ |
---|
76 | return 'complex'; |
---|
77 | } |
---|
78 | return 'simple'; |
---|
79 | } |
---|
80 | |
---|
81 | /** |
---|
82 | * This function is called during the initialization sequence and binds event-handlers to events of ui-elements. |
---|
83 | * @function |
---|
84 | */ |
---|
85 | function addFunctionality(){ |
---|
86 | |
---|
87 | //change context_selects |
---|
88 | $('select[name=x-context]').live('click', function(){ |
---|
89 | //delete the autocomplete arrays, reset the index input values |
---|
90 | //element_autocomplete.splice(0, element_autocomplete.length); |
---|
91 | element_autocomplete_explain.splice(0, element_autocomplete_explain.length ); |
---|
92 | searchclauseset.clear(); |
---|
93 | //load new |
---|
94 | loadTermsAutocompleteExplain(); |
---|
95 | }); |
---|
96 | |
---|
97 | //switch the input simple query vs complex query |
---|
98 | $('#switch-input').live('click',function(){ |
---|
99 | $('#searchclauselist').toggle(); |
---|
100 | $('#input-simplequery').toggle(); |
---|
101 | if (getInputMode() == 'complex'){ |
---|
102 | searchclauseset.sctext = $('#input-simplequery').attr("value"); |
---|
103 | searchclauseset.buildfromquerystring(); |
---|
104 | } else { |
---|
105 | $('#input-simplequery').attr("value",searchclauseset.buildsctext()); |
---|
106 | } |
---|
107 | }); |
---|
108 | |
---|
109 | // DEL COMMAND |
---|
110 | /* |
---|
111 | $('.ui-dialog-titlebar .cmd_del').live('click',function(){ |
---|
112 | var did; |
---|
113 | if ($(this).closest('.ui-dialog').length > 0){ |
---|
114 | did = $(this).closest('.ui-dialog').find('.detail-wrapper').attr('id'); |
---|
115 | } |
---|
116 | if (did != undefined){ |
---|
117 | detail = detailcaller.getdetail(did); |
---|
118 | detail.close(); |
---|
119 | } |
---|
120 | $(this).closest('.ui-dialog').hide(); |
---|
121 | }) |
---|
122 | */ |
---|
123 | /** |
---|
124 | * Remove a query from queryset |
---|
125 | * FIXME: shouldn't this primarily delete the query-object from the queryset? |
---|
126 | * @event |
---|
127 | * @name clickQueryremove |
---|
128 | */ |
---|
129 | $('.query_header .cmd_del').live('click', function(){ |
---|
130 | $(this).closest('.query_wrapper').remove(); |
---|
131 | }); |
---|
132 | |
---|
133 | //TODO dialog |
---|
134 | $('.detail-header .cmd_del').live('click', function(){ |
---|
135 | var did, detail; |
---|
136 | |
---|
137 | if ($(this).parent().hasClass('detail-header')){ |
---|
138 | var dw = $(this).closest('.detail-wrapper'); |
---|
139 | did = dw.attr('id'); |
---|
140 | dw.hide(); |
---|
141 | } |
---|
142 | else { |
---|
143 | if ($(this).parent().siblings('.ui-dialog-content').length > 0){ |
---|
144 | did = $(this).parent().siblings('.ui-dialog-content').find('.detail-wrapper').attr('id'); |
---|
145 | } |
---|
146 | } |
---|
147 | if (did != undefined){ |
---|
148 | detail = detailcaller.getdetail(did); |
---|
149 | detail.close(); |
---|
150 | } |
---|
151 | }); |
---|
152 | |
---|
153 | // DETAIL-CALLER |
---|
154 | $('.detail-caller a').live('click', function(event) { |
---|
155 | event.preventDefault(); |
---|
156 | }); |
---|
157 | // open detail (from result-set, but also already within detail-view (ResourceRef, IsPartOf) |
---|
158 | $('.result a.internal, .mdrecord-detail a.internal').live('click', function(event) { |
---|
159 | event.preventDefault(); |
---|
160 | |
---|
161 | var uri = $(this).attr('href'); |
---|
162 | detailcaller.calldetail(undefined, "record", uri); |
---|
163 | }); |
---|
164 | |
---|
165 | $('.detail-content a').live('click', function(event) { |
---|
166 | |
---|
167 | if ($(this).attr("target") == "_blank"){ |
---|
168 | return true; |
---|
169 | } else { |
---|
170 | event.preventDefault(); |
---|
171 | var uri = $(this).attr('href'); // + " body"; |
---|
172 | if ($(this).attr("class") == "query"){ |
---|
173 | var urlparams = getUrlVars(uri); |
---|
174 | loadQueryFromUriParams(urlparams); |
---|
175 | } else { |
---|
176 | var type; |
---|
177 | if ($(this).attr("class") == "bookmark"){ |
---|
178 | type = "record"; |
---|
179 | } else { |
---|
180 | type = $(this).parents('.detail-wrapper').attr("id"); |
---|
181 | type = type.substring(7,type.length); |
---|
182 | } |
---|
183 | // $.get(uri, showDetail,'html'); */ |
---|
184 | detailcaller.calldetail(undefined, type, uri); |
---|
185 | } |
---|
186 | } |
---|
187 | }); |
---|
188 | $('.result a.external, .mdrecord-detail a.external').live('click', function(event) { |
---|
189 | |
---|
190 | //event.preventDefault(); |
---|
191 | var uri = $(this).attr('href'); // + " body"; |
---|
192 | notifyUser('resource-link: ' + uri,'debug' ); |
---|
193 | // $.get(uri, showDetail,'html'); */ |
---|
194 | }); |
---|
195 | /* |
---|
196 | $('.result .cmd_detail').live('click', function(event) { |
---|
197 | //var qid = $(this).closest('.query_wrapper').attr('id'); |
---|
198 | //var query = queryset.getQuery(qid); |
---|
199 | |
---|
200 | var uri = $(this).parent().find("a").attr('href'); // + " body"; |
---|
201 | $.get(uri, showDetail,'html'); |
---|
202 | }); |
---|
203 | */ |
---|
204 | $(".detail-caller, .cmd_detail").live('click',function(event) { |
---|
205 | event.preventDefault(); |
---|
206 | detailcaller.calldetail($(this)); |
---|
207 | |
---|
208 | }); |
---|
209 | $(".detail-caller-inline").live('click',function(event) { |
---|
210 | event.preventDefault(); |
---|
211 | $(this).parent().children('.detail').toggle(); |
---|
212 | $(this).children('.cmd_down, .cmd_up').toggleClass('cmd_down cmd_up'); |
---|
213 | |
---|
214 | }); |
---|
215 | |
---|
216 | |
---|
217 | |
---|
218 | $('.cmd_sc_autocomplete').live('click', function(event) { |
---|
219 | var i = $(this).closest('.sc-i').attr('id'); |
---|
220 | var j = $(this).closest('.sc-j').attr('id'); |
---|
221 | searchclauseset.searchclauses[i][j].initAutocomplete($(this).hasClass('cmd_sca_explain')); |
---|
222 | $(this).toggleClass('cmd_sca_explain cmd_sca_smc'); |
---|
223 | }); |
---|
224 | |
---|
225 | // cmd_up cmd_down |
---|
226 | $('.cmd_up').live('click', function(event) { |
---|
227 | if ($(this).closest('.detail-wrapper').length > 0 ) { |
---|
228 | $(this).closest('.detail-wrapper').find('.detail-content').hide(); |
---|
229 | } else { |
---|
230 | $(this).closest('.query_wrapper').find('.result').hide(); |
---|
231 | } |
---|
232 | $(this).toggleClass('cmd_down cmd_up'); |
---|
233 | }); |
---|
234 | $('.cmd_down').live('click', function(event) { |
---|
235 | if ($(this).closest('.detail-wrapper').length > 0 ) { |
---|
236 | $(this).closest('.detail-wrapper').find('.detail-content').show(); |
---|
237 | } else { |
---|
238 | $(this).closest('.query_wrapper').find('.result').show(); |
---|
239 | } |
---|
240 | $(this).toggleClass('cmd_down cmd_up'); |
---|
241 | }); |
---|
242 | |
---|
243 | $('.cmd_publish').live('click', function(event){ |
---|
244 | var query = $(this).parent().data('query'); |
---|
245 | if (query != undefined){ // query |
---|
246 | query.publish(); |
---|
247 | } else { // bookmarksets |
---|
248 | var json = workspace.getTypedElement('user','bookmarkset'); |
---|
249 | var id = parseInt($('#bts_select').find("option:selected").val()); |
---|
250 | var bsjson = json[id]; |
---|
251 | $.get("/MDService2/virtualcollection/USER/" + bsjson.id,"", function(data){ |
---|
252 | if (bsjson.vcrid == 0){ |
---|
253 | var id = parseInt($(data).children().children('virtualcollectionid').text()); |
---|
254 | bsjson.vcrid = id; |
---|
255 | workspace.savequeryset(bsjson, 1); |
---|
256 | } |
---|
257 | }); |
---|
258 | } |
---|
259 | |
---|
260 | }); |
---|
261 | |
---|
262 | ////////////////////////////////////////////// |
---|
263 | $('#searchretrieve').submit( function(event) { |
---|
264 | event.preventDefault(); |
---|
265 | //hideWelcomeMessage(); |
---|
266 | var query; |
---|
267 | if (getInputMode() == 'complex'){ |
---|
268 | query = searchclauseset.buildsctext(); |
---|
269 | } else { |
---|
270 | query = $('#input-simplequery').attr("value"); |
---|
271 | } |
---|
272 | // TODO we dont use columns-widget |
---|
273 | var columns = "";//columns_widget.getColumnsListText(); |
---|
274 | var collections = collections_widget.widgets; //searchclauseset.sctext; |
---|
275 | //var ws = $('#input-withsummary').attr("checked"); |
---|
276 | |
---|
277 | notifyUser("processing query"); |
---|
278 | |
---|
279 | if (jQuery.trim(query).length == 0){ |
---|
280 | query = null; |
---|
281 | } |
---|
282 | var q = new Query(collections, columns, query); //actions.collections.current, query ); |
---|
283 | q.repository = getSelectedRepository(); |
---|
284 | //if (ws) { |
---|
285 | // q.options = "withSummary"; |
---|
286 | //} |
---|
287 | notifyUser("submit_query:" + q.query_uri(),'debug'); |
---|
288 | queryset.addquery(q); |
---|
289 | }); |
---|
290 | |
---|
291 | $('.autocomplete-select-caller').live('click', function(event) { |
---|
292 | |
---|
293 | $(this).closest(".index-context").prev().parent().find(".autocomplete-input").val($(this).text()).change(); |
---|
294 | $(this).closest(".index-context").hide(); |
---|
295 | }); |
---|
296 | $('.autocomplete-select-caller a').live('click', function(event) { |
---|
297 | event.preventDefault(); |
---|
298 | }); |
---|
299 | |
---|
300 | |
---|
301 | $('.comp_detail input').live('keyup', function(event) { |
---|
302 | $('#srquery').val( |
---|
303 | $(this).parent().children('span.cmdelem_name').text() |
---|
304 | + "=" + $(this).val() ); |
---|
305 | }); |
---|
306 | |
---|
307 | |
---|
308 | $('a.open-in-context').live('click', function(event) { |
---|
309 | event.preventDefault(); |
---|
310 | var uri = $(this).attr('href'); |
---|
311 | /* notifyUser("open_incontext:" + uri); |
---|
312 | $(this).after("<div class='ui-context-dialog cmds-ui-block' ></div>"); |
---|
313 | var trg = $(this).next(".ui-context-dialog"); |
---|
314 | trg.show(); |
---|
315 | $(trg).load(uri); //function(event) { } */ |
---|
316 | var contextual_uri = uri.replace('htmlpage','htmldetail'); |
---|
317 | |
---|
318 | $.get(contextual_uri, showDetail,'html'); |
---|
319 | }); |
---|
320 | |
---|
321 | // RECORDSET searchRetrieve |
---|
322 | /* |
---|
323 | $('#searchretrieve').submit( function(event) { |
---|
324 | event.preventDefault(); |
---|
325 | //hideWelcomeMessage(); |
---|
326 | searchclauseset.buildsctext(); |
---|
327 | notifyUser(searchclauseset.sctext,'debug'); |
---|
328 | //submit_query ($('#columns_list').attr("value"),searchclauseset.sctext, $('#input-simplequery').attr("value")); |
---|
329 | submit_query (columns_widget.getColumnsListText(),searchclauseset.sctext, $('#input-simplequery').attr("value"), $('#input-withsummary').attr("checked")); |
---|
330 | }); |
---|
331 | */ |
---|
332 | $('#columns-widget .cmd_save').click(function(event) { |
---|
333 | var terms = [{}]; |
---|
334 | |
---|
335 | var id = $("#ts_select option").size(); |
---|
336 | var name = "termset_" + id; |
---|
337 | |
---|
338 | columns_widget.getListWidget().find('.list-item').each(function(i,elem){ |
---|
339 | terms[i] = $(elem).text(); |
---|
340 | }); |
---|
341 | |
---|
342 | var dt = new Date(); |
---|
343 | var str_time = dateFormat(dt);//dt.toString("dd/mm/yyyy HH:mm:ss"); |
---|
344 | var jsont = {"name":name, "time" : str_time, "Terms" :terms}; |
---|
345 | if (jsonw["WorkspaceProfile"]["CustomTermsets"] == undefined) { |
---|
346 | jsonw["WorkspaceProfile"]["CustomTermsets"] = [{}]; |
---|
347 | } |
---|
348 | jsonw["WorkspaceProfile"]["CustomTermsets"][id] = jsont; |
---|
349 | |
---|
350 | //saveWorkspace("USER"); |
---|
351 | Workspace.save("USER"); |
---|
352 | loadTermsets(jsonw["WorkspaceProfile"]["CustomTermsets"]); |
---|
353 | //createTermsUI(jsonw["WorkspaceProfile"]["CustomTermsets"][id],$('#userterms')); |
---|
354 | $("#ts_select option").removeAttr("selected"); |
---|
355 | $("#ts_select option").last().attr("selected","selected"); |
---|
356 | $('#ts_input').attr("value",name); |
---|
357 | createTermsUI(jsonw["WorkspaceProfile"]["CustomTermsets"][id],$('#userterms')); |
---|
358 | }); |
---|
359 | |
---|
360 | /* |
---|
361 | $('#querylist .query_header').find('.cmd_del').live('click', function(event) { |
---|
362 | //showTermDetail($(this).parent().text()); |
---|
363 | |
---|
364 | queryset.removequery($(this).closest('.query_wrapper').attr('id')); |
---|
365 | |
---|
366 | }); |
---|
367 | */ |
---|
368 | /* |
---|
369 | $('#querylist .cmd_up').live('click', function(event) { |
---|
370 | $(this).closest('.query_wrapper').find('.result').hide(); |
---|
371 | $(this).toggleClass('cmd_down cmd_up'); |
---|
372 | }); |
---|
373 | |
---|
374 | */ |
---|
375 | |
---|
376 | $('#detail_query .cmds .cmd_save').live('click', function(event) { |
---|
377 | //qid = $(this).data('query').listid; |
---|
378 | qid = $(this).data('qid'); |
---|
379 | notifyUser("here I would save query: " + qid, "debug"); |
---|
380 | var q = queryset.getQuery(qid); |
---|
381 | q.save(); |
---|
382 | //Workspace.saveQuery($(this).data('query')); |
---|
383 | }); |
---|
384 | $('#detail_query .cmds .cmd_savenew').live('click', function(event) { |
---|
385 | //qid = $(this).data('query').listid; |
---|
386 | qid = $(this).data('qid'); |
---|
387 | notifyUser("here I would savenew query: " + qid, "debug"); |
---|
388 | var q = queryset.getQuery(qid); |
---|
389 | q.id = 0; |
---|
390 | q.save(); |
---|
391 | //Workspace.saveQuery($(this).data('query')); |
---|
392 | }); |
---|
393 | |
---|
394 | /** |
---|
395 | * FIXME: this should only invoke appropriate query-function storing the query to workspaceprofile |
---|
396 | */ |
---|
397 | $('#querylist .cmd_save').live('click', function(event) { |
---|
398 | // bookmark |
---|
399 | if ($(this).parents('.result').length > 0){ |
---|
400 | qstring = $(this).parent().find("a").attr('href'); |
---|
401 | qstring = qstring.substring(18,qstring.length); |
---|
402 | |
---|
403 | var q = new Query([],"",qstring); |
---|
404 | q.bookmark = 1; |
---|
405 | q.save(); |
---|
406 | |
---|
407 | } |
---|
408 | }); |
---|
409 | |
---|
410 | /** |
---|
411 | * FIXME: this looks like a typo: #queryslist -> #querylist |
---|
412 | */ |
---|
413 | $('#queryslist .cmd_reload').live('click', function(event) { |
---|
414 | var qid = $(this).closest('.query_wrapper').attr("id"); |
---|
415 | |
---|
416 | queryset.resubmit(qid); |
---|
417 | |
---|
418 | }); |
---|
419 | |
---|
420 | |
---|
421 | |
---|
422 | $('.cmd_sc_delete').live('click', function(event) { |
---|
423 | var i = $(this).closest('.sc-i').attr('id'); |
---|
424 | var j = $(this).closest('.sc-j').attr('id'); |
---|
425 | //notifyUser(i + j,'debug'); |
---|
426 | searchclauseset.removesearchclause(i,j); |
---|
427 | |
---|
428 | }); |
---|
429 | $('.cmd_add_and').live('click', function(event) { |
---|
430 | //showTermDetail($(this).parent().text()); |
---|
431 | //$(this).next().hide(); |
---|
432 | $(this).attr("value","AND"); |
---|
433 | var searchclause = new SearchClause("","",""); |
---|
434 | var i = $(this).closest('.sc-i').attr('id'); |
---|
435 | var j = $(this).closest('.sc-j').attr('id'); |
---|
436 | //notifyUser(i + j,'debug'); |
---|
437 | searchclauseset.addsearchclause(searchclause,"and",i,j); |
---|
438 | |
---|
439 | }); |
---|
440 | $('.cmd_add_or').live('click', function(event) { |
---|
441 | //showTermDetail($(this).parent().text()); |
---|
442 | //$(this).next().hide(); |
---|
443 | var i,j; |
---|
444 | $(this).attr("value","OR"); |
---|
445 | var searchclause = new SearchClause("","",""); |
---|
446 | searchclauseset.addsearchclause(searchclause,"or",$(this).closest('.sc-i').attr('id'),$(this).closest('.sc-j').attr('id')); |
---|
447 | |
---|
448 | }); |
---|
449 | |
---|
450 | ///// QUERYSETS |
---|
451 | $('#qts_save').click(function(){ |
---|
452 | var id = $("#qts_select option:selected").val(); |
---|
453 | //notifyUser($('#qts_input').val() + $('#qts_input').text(),'debug'); |
---|
454 | workspace.user_json["WorkspaceProfile"]["Querysets"][id]["name"] = $('#qts_input').val(); |
---|
455 | //workspace.save("USER"); |
---|
456 | workspace.savequeryset(workspace.user_json["WorkspaceProfile"]["Querysets"][id],0); |
---|
457 | |
---|
458 | $("#qts_select option:selected").text( $('#qts_input').val()); |
---|
459 | |
---|
460 | }); |
---|
461 | $('#qts_add').click(function(){ |
---|
462 | //var new_name = "new_queryset"; |
---|
463 | |
---|
464 | //workspace.addqueryset(new_name); |
---|
465 | //var id = workspace.user_json["WorkspaceProfile"]["Querysets"].length-1; |
---|
466 | //workspace.savequeryset(workspace.user_json["WorkspaceProfile"]["Querysets"][id],0); |
---|
467 | //workspace.save("USER"); |
---|
468 | var q = workspace.addelement('queryset'); |
---|
469 | workspace.savequeryset(q, 0); |
---|
470 | //todo |
---|
471 | var id = $('#qts_select option').size(); |
---|
472 | $("#qts_select").append(new Option(q["name"], id)); |
---|
473 | $("#qts_select").find('option').attr("selected","false"); |
---|
474 | $("#qts_select").find('option').last().attr("selected","true"); |
---|
475 | $('#qts_input').val(q["name"]); |
---|
476 | }); |
---|
477 | $('#qts_delete').click(function(){ |
---|
478 | var qsid = parseInt($("#qts_select option:selected").val()); |
---|
479 | workspace.removeelement("queryset", qsid); |
---|
480 | workspace.save("USER"); |
---|
481 | //update |
---|
482 | loadQuerysets("user"); |
---|
483 | }); |
---|
484 | |
---|
485 | //BOOKMARKSETS |
---|
486 | $('#bts_save').click(function(){ |
---|
487 | var id = $("#bts_select option:selected").val(); |
---|
488 | workspace.user_json["WorkspaceProfile"]["Bookmarksets"][id]["name"] = $('#bts_input').val(); |
---|
489 | workspace.savequeryset(workspace.user_json["WorkspaceProfile"]["Bookmarksets"][id],1); |
---|
490 | |
---|
491 | $("#bts_select option:selected").text( $('#bts_input').val()); |
---|
492 | }); |
---|
493 | $('#bts_add').click(function(){ |
---|
494 | var b = workspace.addelement('bookmarkset'); |
---|
495 | //var id = workspace.user_json["WorkspaceProfile"]["Bookmarksets"].length-1; |
---|
496 | //workspace.savequeryset(workspace.user_json["WorkspaceProfile"]["Bookmarksets"][id],1); |
---|
497 | workspace.savequeryset(b,1); |
---|
498 | |
---|
499 | var id = $('#bts_select option').size(); |
---|
500 | $("#bts_select").append(new Option(b["name"], id)); |
---|
501 | $("#bts_select").find('option').attr("selected","false"); |
---|
502 | $("#bts_select").find('option').last().attr("selected","true"); |
---|
503 | $('#bts_input').val(b["name"]); |
---|
504 | }); |
---|
505 | $('#bts_delete').click(function(){ |
---|
506 | var bsid = parseInt($("#bts_select option:selected").val()); |
---|
507 | |
---|
508 | workspace.removeelement("bookmarkset", bsid); |
---|
509 | workspace.save("USER"); |
---|
510 | //update |
---|
511 | loadBookmarksets("user"); |
---|
512 | }); |
---|
513 | |
---|
514 | //////////////////////////////////////////////// |
---|
515 | $('#ts_save').click(function(){ |
---|
516 | var id = $("#ts_select option:selected").val(); |
---|
517 | //notifyUser($('#qts_input').val() + $('#qts_input').text(),'debug'); |
---|
518 | jsonw["WorkspaceProfile"]["CustomTermsets"][id]["name"] = $('#ts_input').val(); |
---|
519 | |
---|
520 | $("#ts_select option:selected").text( $('#ts_input').val()); |
---|
521 | //saveWorkspace("USER"); |
---|
522 | Workspace.save("USER"); |
---|
523 | }); |
---|
524 | $('#ts_add').click(function(){ |
---|
525 | var new_name = "new_termset"; |
---|
526 | |
---|
527 | var id = $('#ts_select option').size(); |
---|
528 | var dt = new Date(); |
---|
529 | var str_time = dateFormat(dt);//dt.toString("yyyy-MM-dd HH:mm:ss"); |
---|
530 | |
---|
531 | if (id == 0){ |
---|
532 | jsonw["WorkspaceProfile"]["CustomTermsets"] = [{}]; |
---|
533 | } |
---|
534 | |
---|
535 | jsonw["WorkspaceProfile"]["CustomTermsets"][id] = {"name":new_name,"created":str_time , "Terms" : "null"}; |
---|
536 | |
---|
537 | //saveWorkspace("USER"); |
---|
538 | Workspace.save("USER"); |
---|
539 | //todo |
---|
540 | |
---|
541 | //loadWorkspace(jsonw["WorkspaceProfile"]["Querysets"]); |
---|
542 | $("#ts_select").append(new Option(new_name, id)); |
---|
543 | $("#ts_select").find('option').attr("selected","false"); |
---|
544 | $("#ts_select").find('option').last().attr("selected","true"); |
---|
545 | $('#ts_input').val(new_name); |
---|
546 | createTermsUI(jsonw["WorkspaceProfile"]["CustomTermsets"][id],$('#userterms')); |
---|
547 | }); |
---|
548 | $('#ts_delete').click(function(){ |
---|
549 | var count = $("#ts_select option").size(); |
---|
550 | |
---|
551 | //if (count > 1){ |
---|
552 | var id = parseInt($("#ts_select option:selected").val()); |
---|
553 | var size = jsonw["WorkspaceProfile"].CustomTermsets.length; |
---|
554 | |
---|
555 | for (var i=id;i<size-1;i++){ |
---|
556 | jsonw["WorkspaceProfile"].CustomTermsets[i] = jsonw["WorkspaceProfile"].CustomTermsets[i+1]; |
---|
557 | } |
---|
558 | |
---|
559 | delete jsonw["WorkspaceProfile"].CustomTermsets[size-1]; |
---|
560 | jsonw["WorkspaceProfile"]["CustomTermsets"].length = size-1; |
---|
561 | // set null string , if 0 termsets |
---|
562 | if (count == 1) { |
---|
563 | jsonw["WorkspaceProfile"]["CustomTermsets"] = "null"; |
---|
564 | } |
---|
565 | //saveWorkspace("USER"); |
---|
566 | Workspace.save("USER"); |
---|
567 | loadTermsets(jsonw["WorkspaceProfile"]["CustomTermsets"]); |
---|
568 | }); |
---|
569 | |
---|
570 | $('#userterms .cmd_load').live('click',function(event){ |
---|
571 | var term = String.trim($(this).parent().find('a').text()); |
---|
572 | columns_widget.add(new ListItem(term)); |
---|
573 | |
---|
574 | }); |
---|
575 | $('#userterms .cmd_del').live('click', function(event){ |
---|
576 | var id = parseInt($("#ts_select option:selected").val()); |
---|
577 | var str = $(this).parent().find('a').attr("href"); |
---|
578 | var iq = parseInt(str.substring(10)); |
---|
579 | var size = jsonw["WorkspaceProfile"]["CustomTermsets"][id]["Terms"].length; |
---|
580 | |
---|
581 | for (var i=iq;i<size-1;i++){ |
---|
582 | jsonw["WorkspaceProfile"]["CustomTermsets"][id]["Terms"][i] = jsonw["WorkspaceProfile"]["CustomTermsets"][id]["Terms"][i+1]; |
---|
583 | } |
---|
584 | |
---|
585 | delete jsonw["WorkspaceProfile"]["CustomTermsets"][id]["Terms"][size-1]; |
---|
586 | jsonw["WorkspaceProfile"]["CustomTermsets"][id]["Terms"].length = size-1; |
---|
587 | |
---|
588 | if (size == 1){ |
---|
589 | jsonw["WorkspaceProfile"]["CustomTermsets"][id]["Terms"] = "null"; |
---|
590 | } |
---|
591 | |
---|
592 | //saveWorkspace("USER"); |
---|
593 | Workspace.save("USER"); |
---|
594 | loadTermsets(jsonw["WorkspaceProfile"]["CustomTermsets"]); |
---|
595 | //$("#ts_select option").remove(); |
---|
596 | //$("#ts_select option").first().attr("selected","true"); |
---|
597 | }); |
---|
598 | |
---|
599 | |
---|
600 | $('#collections .cmd_load').live('click',function(event){ |
---|
601 | //hideWelcomeMessage(); |
---|
602 | var collection_text = ""; |
---|
603 | var coll = $(this).parent(); |
---|
604 | var collections = []; |
---|
605 | //collections.splice(0, collections.length); |
---|
606 | collections[0] = new Collection($(coll).attr("handle"), String.trim($(coll).children('a').text())); |
---|
607 | var columns = columns_widget.getListText();//$('#columns_list').attr("value"); |
---|
608 | //var collections = collections_widget.getListText(); |
---|
609 | var query = new Query(collections,columns,""); |
---|
610 | query.repository = getSelectedRepository(); |
---|
611 | |
---|
612 | //searchclauseset.clear(); |
---|
613 | queryset.addquery(query); |
---|
614 | //$('#collection_list').attr("value",query.getcollectiontext("name")); |
---|
615 | collections_widget.load(query.collection); |
---|
616 | |
---|
617 | }); |
---|
618 | $('#serverqueries .cmd_load').live('click',function(event){ |
---|
619 | |
---|
620 | //var id = parseInt( $("#serverqts_select option:selected").val()); |
---|
621 | //var str = $(this).parent().find('a').attr("href"); |
---|
622 | //var iq = parseInt(str.substring(9)); |
---|
623 | //var json = jQuery.parseJSON($("#serverqs").attr("data")); |
---|
624 | //var q = json["WorkspaceProfile"]["Querysets"][id]["Queries"][iq]; |
---|
625 | |
---|
626 | var q = $(this).closest('.cmds-elem-plus').data("query");//json"); |
---|
627 | loadQuery(q); |
---|
628 | }); |
---|
629 | $('#userqueries .cmd_load').live('click',function(event){ |
---|
630 | var q = $(this).closest('.cmds-elem-plus').data("query");//json"); |
---|
631 | loadQuery(q); |
---|
632 | }); |
---|
633 | $('#userqueries .cmd_del').live('click', function(event){ |
---|
634 | //var count = $("#userqueries li").size(); |
---|
635 | /* |
---|
636 | var id = parseInt($("#qts_select option:selected").val()); |
---|
637 | var str = $(this).parent().find('a').attr("href"); |
---|
638 | var iq = parseInt(str.substring(7)); |
---|
639 | var size = workspace.user_json["WorkspaceProfile"]["Querysets"][id]["Queries"].length; |
---|
640 | |
---|
641 | for (var i=iq;i<size-1;i++){ |
---|
642 | workspace.user_json["WorkspaceProfile"]["Querysets"][id]["Queries"][i] = workspace.user_json["WorkspaceProfile"]["Querysets"][id]["Queries"][i+1]; |
---|
643 | } |
---|
644 | |
---|
645 | delete workspace.user_json["WorkspaceProfile"]["Querysets"][id]["Queries"][size-1]; |
---|
646 | workspace.user_json["WorkspaceProfile"]["Querysets"][id]["Queries"].length = size-1; |
---|
647 | |
---|
648 | if (size == 1){ |
---|
649 | workspace.user_json["WorkspaceProfile"]["Querysets"][id]["Queries"] = "null"; |
---|
650 | } |
---|
651 | */ |
---|
652 | //saveWorkspace("USER"); |
---|
653 | var id2 = parseInt($("#qts_select option:selected").val()); |
---|
654 | var id1 = parseInt( $(this).parent().find('a').attr("href").substring(7)); |
---|
655 | workspace.removeelement("query", id1, id2); |
---|
656 | workspace.save("user"); |
---|
657 | loadQuerysets("user"); |
---|
658 | //$("#qs_select option").remove(); |
---|
659 | //$("#qs_select option").first().attr("selected","true"); |
---|
660 | }); |
---|
661 | |
---|
662 | $('.detail-wrapper .cmd_withsummary').live('click',function(event){ |
---|
663 | var detail = $(this).closest('.detail-wrapper').data('detail'); |
---|
664 | var query = detail.query; |
---|
665 | // aaaload new query |
---|
666 | query.summaryinfo(); |
---|
667 | // copy summary data |
---|
668 | //detailcaller.calldetail($(query.container).find('.result-header').find('.cmd_detail')); |
---|
669 | }); |
---|
670 | |
---|
671 | $('#bookmarks .cmd_load').live('click',function(event){ |
---|
672 | var q = $(this).closest('.cmds-elem-plus').data("query");//json"); |
---|
673 | var uri = "/MDService2/record/htmldetail/" + q.query; |
---|
674 | detailcaller.calldetail(undefined, "record", uri); |
---|
675 | }); |
---|
676 | $('#bookmarks .cmd_del').live('click', function(event){ |
---|
677 | var id2 = parseInt($("#bts_select option:selected").val()); |
---|
678 | var id1 = parseInt( $(this).parent().find('a').attr("href").substring(7)); |
---|
679 | workspace.removeelement("bookmark", id1, id2); |
---|
680 | workspace.save("user"); |
---|
681 | loadBookmarksets(); |
---|
682 | }); |
---|
683 | |
---|
684 | |
---|
685 | $('.ui-dialog-titlebar-del').live('click', function(event){ |
---|
686 | //$('#detail-float').dialog('close'); |
---|
687 | var t = $(this).parents('.ui-widget').children('.ui-dialog-content'); |
---|
688 | $(t).dialog('close'); |
---|
689 | }); |
---|
690 | |
---|
691 | $('.ui-dialog-titlebar-up').live('click', function(event){ |
---|
692 | var t = $(this).parents('.ui-widget').children('.ui-dialog-content'); |
---|
693 | |
---|
694 | $(this).parents('.ui-widget').attr("tempheight",$(this).parents('.ui-widget').height()); |
---|
695 | //notifyUser("up(height):" + $(this).parents('.ui-widget').height(),'debug'); |
---|
696 | $(this).parents('.ui-widget').height(30); |
---|
697 | //notifyUser("up(tempheight):" + $(this).parents('.ui-widget').attr("tempheight"),'debug'); |
---|
698 | |
---|
699 | |
---|
700 | //$(t).find(".ui-dialog-buttonpane:first, .ui-dialog-content").stop({clearQueue:true}).fadeOut(300); |
---|
701 | //$(t).stop({clearQueue:true}).animate({height:'0px'},300); |
---|
702 | |
---|
703 | $(this).removeClass('cmd_up ui-dialog-titlebar-up'); |
---|
704 | $(this).addClass('cmd_down ui-dialog-titlebar-down'); |
---|
705 | }); |
---|
706 | $('.ui-dialog-titlebar-down').live('click', function(event){ |
---|
707 | var t = $(this).parents('.ui-widget').children('.ui-dialog-content'); |
---|
708 | |
---|
709 | var h = $(this).parents('.ui-widget').attr("tempheight"); |
---|
710 | //notifyUser("down(tempheight):" + h,'debug'); |
---|
711 | $(this).parents('.ui-widget').height(parseInt(h)); |
---|
712 | //notifyUser("down(height):" + $(this).parents('.ui-widget').height(),'debug'); |
---|
713 | |
---|
714 | |
---|
715 | //$(this).parents('.ui-widget').attr("tempheight",$(this).parents('.ui-widget').height()); |
---|
716 | //$(t).find(".ui-dialog-content, .ui-dialog-buttonpane:first").stop({clearQueue:true}).fadeIn(800) |
---|
717 | //.end().stop({clearQueue:true}).animate({height:'100%'},300); |
---|
718 | |
---|
719 | $(this).removeClass('cmd_down ui-dialog-titlebar-down'); |
---|
720 | $(this).addClass('cmd_up ui-dialog-titlebar-up'); |
---|
721 | }); |
---|
722 | |
---|
723 | } |
---|
724 | |
---|
725 | function initDetailFloat(){ |
---|
726 | $("#detail-float").dialog({ autoOpen: false}); |
---|
727 | $("#detail-float").dialog(); |
---|
728 | $("#detail-float").tabs(); |
---|
729 | }; |
---|
730 | |
---|
731 | function submit_query (columns, query, ws) { |
---|
732 | notifyUser("processing query"); |
---|
733 | |
---|
734 | if (jQuery.trim(query).length == 0){ |
---|
735 | query = null; |
---|
736 | } |
---|
737 | |
---|
738 | var q = new Query(collections, columns, query); //actions.collections.current, query ); |
---|
739 | q.repository = getSelectedRepository(); |
---|
740 | if (ws) { |
---|
741 | q.options = "withSummary"; |
---|
742 | } |
---|
743 | notifyUser("submit_query:" + q.query_uri(),'debug'); |
---|
744 | queryset.addquery(q); |
---|
745 | //notifyUser("container" + q.container.attr('id')); |
---|
746 | //$("#querylist").append("sdfdsf"); |
---|
747 | } |
---|
748 | |
---|
749 | /** |
---|
750 | * allows to add ui-containers into the detail-pane. |
---|
751 | * |
---|
752 | * Most of it is just to ensure a defined ordering: |
---|
753 | * 1. info, 2. index, 3. query, 4. record |
---|
754 | */ |
---|
755 | function addToDetailList(elem, did){ |
---|
756 | var exists = false; |
---|
757 | var index_elem = undefined; |
---|
758 | var query_elem = undefined; |
---|
759 | var record_elem = undefined; |
---|
760 | var info_elem = undefined; |
---|
761 | |
---|
762 | $('#detailblock').children('.content').children().each(function(){ |
---|
763 | if ($(this).attr("id") == did){ |
---|
764 | exists = true; |
---|
765 | } |
---|
766 | if ($(this).attr("id") == "detail_index"){ |
---|
767 | index_elem = this; |
---|
768 | } |
---|
769 | if ($(this).attr("id") == "detail_query"){ |
---|
770 | query_elem = this; |
---|
771 | } |
---|
772 | if ($(this).attr("id") == "detail_record"){ |
---|
773 | record_elem = this; |
---|
774 | } |
---|
775 | if ($(this).attr("id") == "detail_info"){ |
---|
776 | info_elem = this; |
---|
777 | } |
---|
778 | }); |
---|
779 | if (!exists) { |
---|
780 | if (did == "detail_record") { |
---|
781 | $('#detailblock').children('.content').append(elem); |
---|
782 | } else { |
---|
783 | if (did == "detail_info") { |
---|
784 | $('#detailblock').children('.content').prepend(elem); |
---|
785 | } else { |
---|
786 | if (did == "detail_index") { |
---|
787 | if (info_elem != undefined) { |
---|
788 | $(info_elem).after(elem); |
---|
789 | } else { |
---|
790 | if (record_elem != undefined) { |
---|
791 | $(record_elem).before(elem); |
---|
792 | } else { |
---|
793 | $('#detailblock').children('.content').prepend(elem); |
---|
794 | } |
---|
795 | } |
---|
796 | } else { |
---|
797 | if (did == "detail_query") { |
---|
798 | if (index_elem != undefined) { |
---|
799 | $(index_elem).after(elem); |
---|
800 | } else { |
---|
801 | if (record_elem != undefined) { |
---|
802 | $(record_elem).before(elem); |
---|
803 | } else { |
---|
804 | $('#detailblock').children('.content').append(elem); |
---|
805 | } |
---|
806 | } |
---|
807 | } else { |
---|
808 | $('#detailblock').children('.content').append(elem); |
---|
809 | } |
---|
810 | } |
---|
811 | } |
---|
812 | } |
---|
813 | |
---|
814 | } else { |
---|
815 | $('#detailblock').children('.content').children().each(function(){ |
---|
816 | if ($(this).attr("id") == did){ |
---|
817 | $(this).show(); |
---|
818 | } |
---|
819 | }); |
---|
820 | } |
---|
821 | } |
---|
822 | |
---|
823 | function addToSClist (div, i, j, rel) { |
---|
824 | |
---|
825 | var x; |
---|
826 | |
---|
827 | //notifyUser(i + "," + j + "," + rel); |
---|
828 | if (rel == ""){ |
---|
829 | x = $('<div />').addClass("sc-i").addClass("and_level"); |
---|
830 | $(div).appendTo($(x).appendTo($('#searchclauselist'))); |
---|
831 | $(x).attr("id",i); |
---|
832 | } else { |
---|
833 | if (rel == "and") { |
---|
834 | x = $('<div />').addClass("sc-i").addClass("and_level"); |
---|
835 | $(x).attr("id",i); |
---|
836 | $(div).appendTo($(x).appendTo($('#searchclauselist'))); |
---|
837 | } else { |
---|
838 | $(div).appendTo($('#searchclauselist').children()[i]); |
---|
839 | } |
---|
840 | } |
---|
841 | |
---|
842 | //$('#searchclauselist').append($(li)); |
---|
843 | |
---|
844 | } |
---|
845 | |
---|
846 | function addToQuerylist (x) { |
---|
847 | $("#querylist").prepend(x); |
---|
848 | } |
---|
849 | |
---|
850 | function addToNotifylist (x) { |
---|
851 | $("#notifylist").prepend(x); |
---|
852 | } |
---|
853 | |
---|
854 | function createTooltip(parentwidget) { |
---|
855 | |
---|
856 | var ccmd; |
---|
857 | if (parentwidget == null) { |
---|
858 | ccmd = $('.cmd'); |
---|
859 | } else { |
---|
860 | ccmd = $(parentwidget).find('.cmd'); |
---|
861 | } |
---|
862 | $(ccmd).mouseover(function(){ |
---|
863 | // command name |
---|
864 | var cmd = $(this).attr("class"); |
---|
865 | cmd = cmd.substring(cmd.indexOf("cmd_")); |
---|
866 | cmd = cmd.split(" ")[0]; |
---|
867 | |
---|
868 | // command place |
---|
869 | var place = ""; |
---|
870 | if ($(this).parents('.content').length > 0) { |
---|
871 | place = $(this).parents('.content').attr("id") + "."; |
---|
872 | } |
---|
873 | if ($(this).parents('.block').length > 0) { |
---|
874 | place = $(this).parents('.block').attr("id") + "."; |
---|
875 | } |
---|
876 | |
---|
877 | |
---|
878 | // find tho tooltiptext |
---|
879 | var a = place + cmd; |
---|
880 | |
---|
881 | if (tooltiptable[a] != null) { |
---|
882 | s = tooltiptable[a]; |
---|
883 | } else { |
---|
884 | if (tooltiptable[cmd] != null) { |
---|
885 | s = tooltiptable[cmd]; |
---|
886 | } else { |
---|
887 | s = a; |
---|
888 | } |
---|
889 | } |
---|
890 | tooltip.show(s); |
---|
891 | }); |
---|
892 | $(ccmd).mouseout(function(){ |
---|
893 | tooltip.hide(); |
---|
894 | }); |
---|
895 | |
---|
896 | }; |
---|
897 | function loadQuery(query){ |
---|
898 | query.repository = getSelectedRepository(); |
---|
899 | queryset.addquery(query); |
---|
900 | |
---|
901 | searchclauseset.sctext = query.query; |
---|
902 | notifyUser(searchclauseset.sctext,'debug'); |
---|
903 | searchclauseset.buildfromquerystring(); |
---|
904 | |
---|
905 | //collections = query.collection; |
---|
906 | collections_widget.load(query.collection); |
---|
907 | columns_widget.load(query.columns.split(',')); |
---|
908 | $('#input-simplequery').attr("value",query.query); |
---|
909 | $('#input-withsummary').attr("checked",(query.options != null)); |
---|
910 | updateCollectionTree(); |
---|
911 | |
---|
912 | }; |
---|
913 | /* |
---|
914 | function loadQuery(q){ |
---|
915 | if (q["bookmark"] == "1") { |
---|
916 | var uri = "/MDService2/record/htmldetail/" + q["querystring"]; |
---|
917 | detailcaller.calldetail(undefined, "record", uri); |
---|
918 | //var uri = "/MDService2/record/htmldetail/" + q["querystring"]; |
---|
919 | //showDetail(null,'html'); |
---|
920 | //$.get(uri, showDetail,'html'); |
---|
921 | } else { |
---|
922 | //hideWelcomeMessage(); |
---|
923 | var query = new Query([],"","",""); |
---|
924 | query.load(q); |
---|
925 | query.repository = getSelectedRepository(); |
---|
926 | queryset.addquery(query); |
---|
927 | |
---|
928 | searchclauseset.sctext = query.query; |
---|
929 | notifyUser(searchclauseset.sctext,'debug'); |
---|
930 | searchclauseset.buildfromquerystring(); |
---|
931 | |
---|
932 | //collections = query.collection; |
---|
933 | collections_widget.load(query.collection); |
---|
934 | columns_widget.load(query.columns.split(',')); |
---|
935 | $('#input-simplequery').attr("value",query.query); |
---|
936 | $('#input-withsummary').attr("checked",(query.options != null)); |
---|
937 | updateCollectionTree(); |
---|
938 | } |
---|
939 | |
---|
940 | } |
---|
941 | */ |
---|
942 | function loadQueryFromUriParams(local_uri){ |
---|
943 | var url; |
---|
944 | |
---|
945 | if (local_uri == undefined){ |
---|
946 | url = url_params; |
---|
947 | } else { |
---|
948 | url = local_uri; |
---|
949 | } |
---|
950 | //TODO new params |
---|
951 | var q = url["q"]; |
---|
952 | if (url["query"] == undefined){ |
---|
953 | q = url["q"]; |
---|
954 | } |
---|
955 | else { |
---|
956 | q = url["query"]; |
---|
957 | } |
---|
958 | |
---|
959 | var collection = url["collection"]; |
---|
960 | var startItem = url["startRecord"]; |
---|
961 | var maximumItems = url["maximumRecords"]; |
---|
962 | var repository = url["repository"]; |
---|
963 | var columns = url["columns"]; |
---|
964 | if ((q != undefined) || (collection != undefined)) { |
---|
965 | if (q == undefined) { |
---|
966 | q = ""; |
---|
967 | } else { |
---|
968 | q = Url.decode(q); |
---|
969 | } |
---|
970 | if (columns == undefined) { |
---|
971 | columns = ""; |
---|
972 | } |
---|
973 | if (startItem == undefined) { |
---|
974 | startItem = 1; |
---|
975 | } |
---|
976 | if (maximumItems == undefined) { |
---|
977 | maximumItems = 10; |
---|
978 | } |
---|
979 | if (repository == undefined) { |
---|
980 | repository = getSelectedRepository(); |
---|
981 | } |
---|
982 | if (collection == undefined){ |
---|
983 | collection = ""; |
---|
984 | } |
---|
985 | var collections = []; |
---|
986 | if (collection.length > 0 ){ |
---|
987 | var coll = collection.split(","); |
---|
988 | $.each(coll,function(i,item){ |
---|
989 | var n; |
---|
990 | n = $('#collections').find(".folder:[handle='"+item+"']").text(); |
---|
991 | var simple_collection = new Collection(item, n); |
---|
992 | collections[i] = simple_collection; |
---|
993 | }); |
---|
994 | } |
---|
995 | |
---|
996 | var query = new Query(collections, columns, q); |
---|
997 | query.startItem = startItem; |
---|
998 | query.maximumItems = maximumItems; |
---|
999 | query.repository = repository; |
---|
1000 | |
---|
1001 | |
---|
1002 | queryset.addquery(query); |
---|
1003 | |
---|
1004 | searchclauseset.sctext = query.query; |
---|
1005 | notifyUser(searchclauseset.sctext,'debug'); |
---|
1006 | searchclauseset.buildfromquerystring(); |
---|
1007 | |
---|
1008 | //collections = query.collection; |
---|
1009 | collections_widget.load(query.collection); |
---|
1010 | columns_widget.load(query.columns.split(',')); |
---|
1011 | $('#input-simplequery').attr("value",query.query); |
---|
1012 | $('#input-withsummary').attr("checked",(query.options != null)); |
---|
1013 | updateCollectionTree(); |
---|
1014 | |
---|
1015 | } |
---|
1016 | |
---|
1017 | } |
---|
1018 | |
---|
1019 | |
---|