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