1 | // mdservice2_ui.js |
---|
2 | // based on metares_profile_ui.js 2010-03-25 |
---|
3 | var jsonw; |
---|
4 | var actions = { |
---|
5 | collections: { |
---|
6 | base_uri: "/MDService2/collections/", |
---|
7 | current:'olac'}, |
---|
8 | elements: { |
---|
9 | base_uri: "/MDService2/element/", |
---|
10 | current:''}, |
---|
11 | terms: { |
---|
12 | base_uri: "/MDService2/terms/", |
---|
13 | current:'all'}, |
---|
14 | terms_autocomplete: { |
---|
15 | base_uri: "/MDService2/terms/", |
---|
16 | current:''}, |
---|
17 | components: { |
---|
18 | base_uri: "/MDService2/comp/", |
---|
19 | current:''}, |
---|
20 | /* current:'cmdi-corpus-aac2'}, */ |
---|
21 | compprofiles: { |
---|
22 | base_uri: "/MDService2/compprofile/", |
---|
23 | current:''}, |
---|
24 | /* current:'cmdi-corpus-aac2'}, */ |
---|
25 | |
---|
26 | recordset: { |
---|
27 | base_uri: "/MDService2/recordset/" |
---|
28 | }, |
---|
29 | |
---|
30 | isocat: { |
---|
31 | base_uri: "/MDService2/datcats/", |
---|
32 | current:5 |
---|
33 | } |
---|
34 | |
---|
35 | }; |
---|
36 | |
---|
37 | |
---|
38 | $(function(){ |
---|
39 | |
---|
40 | init(); |
---|
41 | |
---|
42 | // turn on debugging (see jquery.xslTransform.js) |
---|
43 | var DEBUG = false; |
---|
44 | |
---|
45 | // check for jQuery and Sarissa |
---|
46 | try{ |
---|
47 | jQuery; |
---|
48 | }catch(e){ |
---|
49 | alert('You need to include jQuery!'); |
---|
50 | } |
---|
51 | |
---|
52 | ////////////// |
---|
53 | |
---|
54 | loadWelcomeMessage(); |
---|
55 | loadWorkspaceProfiles(); |
---|
56 | loadCollections(); |
---|
57 | loadComponentsRegistry(); |
---|
58 | loadTerms(); |
---|
59 | loadDCR(); |
---|
60 | |
---|
61 | handleQueryInput(); |
---|
62 | handleBubble(); |
---|
63 | |
---|
64 | addFunctionality(); |
---|
65 | addVisuals(); |
---|
66 | |
---|
67 | }); |
---|
68 | |
---|
69 | |
---|
70 | function init () { |
---|
71 | } |
---|
72 | |
---|
73 | function update (uri, src_container, target_container,handler) { |
---|
74 | notifyUser("update-uri:" + uri,'debug'); |
---|
75 | $(target_container).load(uri, handler ); |
---|
76 | } |
---|
77 | // TODO multiple collections |
---|
78 | function submit_query (columns, query, squery) { |
---|
79 | notifyUser("processing query"); |
---|
80 | |
---|
81 | if (jQuery.trim(query).length == 0){ |
---|
82 | query = null; |
---|
83 | } |
---|
84 | if (jQuery.trim(squery).length == 0){ |
---|
85 | squery = null; |
---|
86 | } |
---|
87 | var q = new Query(collections, columns, query, squery); //actions.collections.current, query ); |
---|
88 | notifyUser("submit_query:" + q.query_uri(),'debug'); |
---|
89 | queryset.addquery(q); |
---|
90 | //notifyUser("container" + q.container.attr('id')); |
---|
91 | //$("#querylist").append("sdfdsf"); |
---|
92 | } |
---|
93 | |
---|
94 | /* OBSOLETE? */ |
---|
95 | function handle_result (data, textStatus) { |
---|
96 | try { |
---|
97 | $(this).text("done"); |
---|
98 | //$(this).html(data); |
---|
99 | notifyUser("query processed:" + textStatus); |
---|
100 | } catch (e) { |
---|
101 | notifyUser(e,'debug'); |
---|
102 | } |
---|
103 | } |
---|
104 | |
---|
105 | |
---|
106 | function showDetail(data, textStatus) { |
---|
107 | try { |
---|
108 | //notifyUser("receiving data:",'debug'); |
---|
109 | //notifyUser(data,'debug'); |
---|
110 | |
---|
111 | $('#detail-float').html(data); |
---|
112 | var title = $('#detail-float').find('.inner_title').attr("value"); |
---|
113 | $('#detail-float').dialog( "option", "title", title ); |
---|
114 | |
---|
115 | //ui-state-default |
---|
116 | |
---|
117 | $('#detail-float').dialog('open'); |
---|
118 | $('#detail-float').siblings('div.ui-dialog-titlebar').addClass('ui-state-default'); |
---|
119 | $('#detail-float').siblings('div.ui-dialog-titlebar').children().remove(); |
---|
120 | var x = '<span class="cmd cmd_del ui-dialog-titlebar-del "/><span class="cmd cmd_up ui-dialog-titlebar-up"/><span>' + title +'</span>'; |
---|
121 | $('#detail-float').siblings('div.ui-dialog-titlebar').prepend(x); |
---|
122 | |
---|
123 | notifyUser("query processed:" + textStatus); |
---|
124 | } catch (e) { |
---|
125 | notifyUser(e,'debug'); |
---|
126 | } |
---|
127 | } |
---|
128 | |
---|
129 | function showDetail2(data, textStatus) { |
---|
130 | try { |
---|
131 | //notifyUser("receiving data:",'debug'); |
---|
132 | //notifyUser(data,'debug'); |
---|
133 | $('#detail').html(data); |
---|
134 | //$(this).html(data); |
---|
135 | |
---|
136 | notifyUser("query processed:" + textStatus); |
---|
137 | $("#detail .treeview").treeview({ |
---|
138 | animated: "fast", |
---|
139 | collapsed: true |
---|
140 | }); |
---|
141 | |
---|
142 | } catch (e) { |
---|
143 | notifyUser(e,'debug'); |
---|
144 | } |
---|
145 | } |
---|
146 | |
---|
147 | function notifyUser (msg) { |
---|
148 | $('#notify').text(msg); |
---|
149 | } |
---|
150 | |
---|
151 | function notifyUser (msg, type) { |
---|
152 | |
---|
153 | if (type=='debug' & !(typeof console == "undefined")) { |
---|
154 | console.log(msg); |
---|
155 | } else { |
---|
156 | $('#notify').text(msg); |
---|
157 | } |
---|
158 | } |
---|
159 | |
---|
160 | |
---|
161 | function addToQuerylist (x) { |
---|
162 | $("#querylist").prepend(x); |
---|
163 | } |
---|
164 | |
---|
165 | |
---|
166 | function addToSClist (div, i, j, rel) { |
---|
167 | |
---|
168 | var x; |
---|
169 | |
---|
170 | //notifyUser(i + "," + j + "," + rel); |
---|
171 | if (rel == ""){ |
---|
172 | x = $('<div />').addClass("sc-i").addClass("and_level"); |
---|
173 | $(div).appendTo($(x).appendTo($('#searchclauselist'))); |
---|
174 | $(x).attr("id",i); |
---|
175 | } else { |
---|
176 | if (rel == "and") { |
---|
177 | x = $('<div />').addClass("sc-i").addClass("and_level"); |
---|
178 | $(x).attr("id",i); |
---|
179 | $(div).appendTo($(x).appendTo($('#searchclauselist'))); |
---|
180 | } else { |
---|
181 | $(div).appendTo($('#searchclauselist').children()[i]); |
---|
182 | } |
---|
183 | } |
---|
184 | |
---|
185 | //$('#searchclauselist').append($(li)); |
---|
186 | |
---|
187 | } |
---|
188 | |
---|
189 | var last_bubble_uri; |
---|
190 | |
---|
191 | |
---|
192 | function showBubble (elem) { |
---|
193 | //get the position of the placeholder element |
---|
194 | notifyUser($(elem),'debug'); |
---|
195 | var pos = $(elem).offset(); |
---|
196 | var width = $(elem).width(); |
---|
197 | //show the menu directly over the placeholder |
---|
198 | //notifyUser(pos + width,'debug'); |
---|
199 | $("#bubble").css( { "left": (pos.left + width) + "px", "top":pos.top + "px" } ); |
---|
200 | $("#bubble").show(); |
---|
201 | } |
---|
202 | |
---|
203 | function link(action,format,params) { |
---|
204 | var l = actions[action].base_uri + format; |
---|
205 | |
---|
206 | // default param is q |
---|
207 | if (params){ |
---|
208 | if ( ! $.isArray(params)) { |
---|
209 | l += '/' + params; |
---|
210 | } else { |
---|
211 | l += '?' + $.param(params); |
---|
212 | } |
---|
213 | } |
---|
214 | notifyUser("l:"+ l,'debug'); |
---|
215 | return l; |
---|
216 | } |
---|
217 | |
---|
218 | function preprocessJSON(json){ |
---|
219 | |
---|
220 | if (json["WorkspaceProfile"].Querysets[0] == undefined){ |
---|
221 | var jj = json["WorkspaceProfile"]["Querysets"]["item"]; |
---|
222 | delete json["WorkspaceProfile"]["Querysets"]["item"]; |
---|
223 | json["WorkspaceProfile"]["Querysets"] = [{}]; |
---|
224 | json["WorkspaceProfile"]["Querysets"][0] = jj; |
---|
225 | } |
---|
226 | if (String(json["WorkspaceProfile"]["Querysets"]) != "null") { |
---|
227 | |
---|
228 | $.each(json["WorkspaceProfile"]["Querysets"], function(i,item) { |
---|
229 | if (this.Queries[0] == undefined){ |
---|
230 | var jj = this["Queries"]["item"]; |
---|
231 | delete this["Queries"]["item"]; |
---|
232 | this.Queries = [{}]; |
---|
233 | this.Queries[0] = jj; |
---|
234 | } |
---|
235 | }); |
---|
236 | |
---|
237 | $.each(json["WorkspaceProfile"]["Querysets"], function(i,item){ |
---|
238 | if (String(this.Queries) != "null") { |
---|
239 | $.each(this.Queries, function(i,item){ |
---|
240 | if (this.collections != "null") { |
---|
241 | if (this.collections[0] == undefined){ |
---|
242 | var jj = this["collections"]["item"]; |
---|
243 | delete this["collections"]["item"]; |
---|
244 | this.collections = [{}]; |
---|
245 | this.collections[0] = jj; |
---|
246 | } |
---|
247 | } |
---|
248 | if (this.columns != "null") { |
---|
249 | if (this.columns[0] == undefined){ |
---|
250 | var jj = this["columns"]["item"]; |
---|
251 | delete this["columns"]["item"]; |
---|
252 | this.columns = [{}]; |
---|
253 | this.columns[0] = jj; |
---|
254 | } |
---|
255 | } |
---|
256 | }); |
---|
257 | } |
---|
258 | }); |
---|
259 | } |
---|
260 | |
---|
261 | return json; |
---|
262 | |
---|
263 | } |
---|
264 | function appendQueryUI(json,i, qs){ |
---|
265 | var del = ''; |
---|
266 | //var ul; |
---|
267 | var id = $(qs).parent().attr('id'); |
---|
268 | |
---|
269 | /* |
---|
270 | if ($(qs).find('ul').size() == 0) { |
---|
271 | ul = $('<ul></ul>'); |
---|
272 | $(ul).appendTo($(qs)); |
---|
273 | } else { |
---|
274 | ul = $(qs).children('ul'); |
---|
275 | } |
---|
276 | |
---|
277 | var x = '<li><span class="query_detail_caller" ><a href="'+id + '_'+ i+'" >' + |
---|
278 | Query.fullformatstring(json) + '</a></span><span class="cmd cmd_load"></span>' + |
---|
279 | del + |
---|
280 | '<div class="term_detail" >' + |
---|
281 | '<ul><li><div class="elem text"><span class="elem_name">query:<span><span class="elem_value">' + Query.simplequerystring(json.querystring)+ |
---|
282 | '</span></div></li><li><div class="elem text"><span class="elem_name">collections:</span><span class="elem_value">' + Query.collectiontext(json) + '</span></div></li></ul></div></li>'; |
---|
283 | */ |
---|
284 | |
---|
285 | if (id == 'userqs') { |
---|
286 | del = '<span class="cmd cmd_del" ><xsl:text> </xsl:text></span>'; |
---|
287 | } |
---|
288 | var x = '<div class="cmds-elem-plus" ><span class="cmd cmd_load"></span><span class="detail-caller" ><a href="'+id + '_'+ i+'" >' + |
---|
289 | Query.fullformatstring(json) + '</a></span>' + |
---|
290 | del + |
---|
291 | '<div class="detail" >' + |
---|
292 | '<div class="cmds-elem-prop"><span class="label">squery:</span><span class="value">' + json.squerystring + |
---|
293 | '</span></div>' + |
---|
294 | '<div class="cmds-elem-prop"><span class="label">query:</span><span class="value">' + Query.simplequerystring(json.querystring) + |
---|
295 | '</span></div><div class="cmds-elem-prop"><span class="label">collections:</span><span class="value">' + Query.collectiontext(json) + '</span></div>' + |
---|
296 | '</div>'; |
---|
297 | |
---|
298 | $(qs).append(x); |
---|
299 | |
---|
300 | } |
---|
301 | |
---|
302 | function createQueriesUI(json, qs){ |
---|
303 | $(qs).children().remove(); |
---|
304 | if (json.Queries != "null") { |
---|
305 | $.each(json.Queries, function(i,item) { |
---|
306 | if (this != "null"){ |
---|
307 | appendQueryUI(this,i, qs); |
---|
308 | } |
---|
309 | }); |
---|
310 | } |
---|
311 | |
---|
312 | } |
---|
313 | |
---|
314 | function loadQuerysets(json, type) { |
---|
315 | |
---|
316 | var $select; |
---|
317 | if (type == "user") { |
---|
318 | $select = $('#qts_select'); |
---|
319 | } else { |
---|
320 | $select = $('#serverqts_select'); |
---|
321 | } |
---|
322 | |
---|
323 | $select.find("option").remove(); |
---|
324 | |
---|
325 | if (String(json) != "null") { |
---|
326 | |
---|
327 | $.each(json, function(i,item) { |
---|
328 | //notifyUser(i + ',' + this.name + ',' + this.created,'debug'); |
---|
329 | $select.append(new Option(this.name, i)); |
---|
330 | }); |
---|
331 | |
---|
332 | |
---|
333 | // find id of selected |
---|
334 | if ($select.find("option").size() > 0) { |
---|
335 | $select.find("option").first().attr("selected","true"); |
---|
336 | var id = parseInt($select.find("option:selected").val()); |
---|
337 | var jsonq = json[id]; |
---|
338 | |
---|
339 | if (type == "user") { |
---|
340 | $('#qts_input').val(jsonq["name"]); |
---|
341 | qs = $("#userqueries"); |
---|
342 | } else { |
---|
343 | qs = $("#serverqueries"); |
---|
344 | } |
---|
345 | createQueriesUI(jsonq, qs); |
---|
346 | } |
---|
347 | |
---|
348 | $select.change(function(data){ |
---|
349 | if ($select.find("option").size() > 0) { |
---|
350 | // find id of selected |
---|
351 | var id = parseInt($select.find("option:selected").val()); |
---|
352 | var jsonq = json[id]; |
---|
353 | |
---|
354 | if (type == "user") { |
---|
355 | $('#qts_input').val(jsonq["name"]); |
---|
356 | qs = $("#userqueries"); |
---|
357 | } else { |
---|
358 | qs = $("#serverqueries"); |
---|
359 | } |
---|
360 | createQueriesUI(jsonq, qs); |
---|
361 | |
---|
362 | /* $('#qs_select').find("option").remove(); |
---|
363 | |
---|
364 | if (String(jsonw["WorkspaceProfile"].Querysets[id].Queries) != "null") { |
---|
365 | $.each(jsonw["WorkspaceProfile"].Querysets[id].Queries, function(i,item) { |
---|
366 | |
---|
367 | notifyUser(i + ',' + this.querystring + ',' + this.collections[0],'debug'); |
---|
368 | $('#qs_select').append(new Option(Query.simplequerystring(this.querystring) , i)); |
---|
369 | }); |
---|
370 | } |
---|
371 | */ |
---|
372 | } |
---|
373 | }); |
---|
374 | } |
---|
375 | |
---|
376 | |
---|
377 | } |
---|
378 | |
---|
379 | function saveWorkspace(){ |
---|
380 | |
---|
381 | var JSONText = JSON.stringify(jsonw["WorkspaceProfile"]); |
---|
382 | //var JSONText = JSON.stringify({"aa.a":"r"}); |
---|
383 | //notifyUser(JSONText,'debug'); |
---|
384 | $.post("/MDService2/workspaceprofilesave/",{"data":JSONText}); |
---|
385 | |
---|
386 | } |
---|
387 | //////////////////////////////////////////////// |
---|
388 | function loadWelcomeMessage(){ |
---|
389 | $('#detail').load("/MDService2/static/welcome.xml", function() { //profile.collections.base_uri, |
---|
390 | $('#welcome').addClass("ui-helper-reset ui-corner-all ui-widget-content"); |
---|
391 | }); |
---|
392 | } |
---|
393 | |
---|
394 | function hideWelcomeMessage(){ |
---|
395 | // kick the welcome message on first submit |
---|
396 | notifyUser("hiding welcome"); |
---|
397 | if( $('#welcome').is(':visible') ) { |
---|
398 | $('#welcome').hide(); |
---|
399 | } |
---|
400 | } |
---|
401 | |
---|
402 | function loadWorkspaceProfiles(){ |
---|
403 | //empty json |
---|
404 | jsonw = {'WorkspaceProfile':{'Querysets':'null','created':'null','lastchanged':'null','profilename':'null'}}; |
---|
405 | $('#qts_input').val(""); |
---|
406 | |
---|
407 | |
---|
408 | jQuery.getJSON("/MDService2/workspaceprofile/server",function(data){ |
---|
409 | notifyUser(data['WorkspaceProfile'],'debug'); |
---|
410 | var json = preprocessJSON(data); |
---|
411 | $("#serverqs").attr("data",JSON.stringify(json)); |
---|
412 | loadQuerysets(json["WorkspaceProfile"]["Querysets"],"server"); |
---|
413 | }); |
---|
414 | |
---|
415 | // USER WORKSPACEPROFILE |
---|
416 | jQuery.getJSON("/MDService2/workspaceprofile/user",function(data){ |
---|
417 | notifyUser(data['WorkspaceProfile'],'debug'); |
---|
418 | jsonw = preprocessJSON(data); |
---|
419 | loadQuerysets(jsonw["WorkspaceProfile"]["Querysets"],"user"); |
---|
420 | }); |
---|
421 | |
---|
422 | } |
---|
423 | function loadCollections(){ |
---|
424 | $('#collections').load(link('collections','htmllist'), //profile.collections.base_uri, |
---|
425 | function() { |
---|
426 | $("#collections .treeview").treeview({ |
---|
427 | animated: "fast", |
---|
428 | collapsed: true |
---|
429 | }); |
---|
430 | |
---|
431 | $(".treeview","#collections").find(".showselection").css("color","white"); |
---|
432 | |
---|
433 | // handle treeview click |
---|
434 | $(".treeview","#collections").find(".selection").click(function() { |
---|
435 | var checked_status = this.checked; |
---|
436 | |
---|
437 | // select or deselect all children according to parent |
---|
438 | $(this).next().next().next().find(".selection").attr("checked",checked_status); |
---|
439 | $(this).next().next().next().find(".selection").attr("child","undefined"); |
---|
440 | |
---|
441 | // deselect parents |
---|
442 | if (checked_status===false){ |
---|
443 | $(this).parent().parents("li").each(function(){ |
---|
444 | $(this).children(".selection").attr("checked",false); |
---|
445 | }); |
---|
446 | } |
---|
447 | |
---|
448 | |
---|
449 | // refresh sign of existent selection |
---|
450 | // first reset childrens settings |
---|
451 | $(this).next().next().next().find(".showselection").css("color","white"); |
---|
452 | $(this).next().next().next().find(".showselection").attr("some_selection","0"); |
---|
453 | |
---|
454 | // then refresh selections |
---|
455 | $(this).parents("li").each(function(){ |
---|
456 | var count_selected = $(this).find("ul li .selection:checked").size(); |
---|
457 | if (count_selected > 0){ |
---|
458 | $(this).children(".showselection").attr("some_selection","1");//css("color","red"); |
---|
459 | } else { |
---|
460 | $(this).children(".showselection").attr("some_selection","0");//css("color","white"); |
---|
461 | } |
---|
462 | //TODO move into .css |
---|
463 | if (count_selected > 0){ |
---|
464 | $(this).children(".showselection").css("color","red"); |
---|
465 | } else { |
---|
466 | $(this).children(".showselection").css("color","white"); |
---|
467 | } |
---|
468 | $(this).children(".showselection").attr("count",count_selected); |
---|
469 | }); |
---|
470 | |
---|
471 | // uncheck parents node + param settings |
---|
472 | $(this).parent().parents("li").each(function(){ |
---|
473 | $(this).find(".selection").attr("child","undefined"); |
---|
474 | $(this).children(".selection").attr("checked",false); |
---|
475 | }); |
---|
476 | |
---|
477 | // sett the parent_selection attr |
---|
478 | $(this).parents("li").each(function(){ |
---|
479 | $(this).find(".selection").each(function(){ |
---|
480 | if (($(this).attr("checked")===true) && |
---|
481 | (($(this).parent().parent().parent().children(".selection").attr("checked")===false) || |
---|
482 | ($(this).parent().parent().parent().children(".treeview").size() == 1)) |
---|
483 | ){ |
---|
484 | $(this).attr("child","parent_selection"); |
---|
485 | } |
---|
486 | }); |
---|
487 | }); |
---|
488 | |
---|
489 | // update collection_selection |
---|
490 | var $treeview = $(".treeview","#collections"); |
---|
491 | //var collection = $("li",$treeview).find("input:checked[child='parent_selection']").next().text(); |
---|
492 | //notifyUser("collection:" + collection,'debug'); |
---|
493 | |
---|
494 | |
---|
495 | var collection_text = ""; |
---|
496 | var coll; |
---|
497 | collections.splice(0, collections.length); |
---|
498 | $("li",$treeview).find("input:checked[child='parent_selection']").next().each(function(index){ |
---|
499 | notifyUser("selection...:" + index + ":" + this.textContent + $(this).attr("handle"),'debug'); |
---|
500 | coll = new Collection($(this).attr("handle"), this.textContent); |
---|
501 | collections[collections.length] = coll; |
---|
502 | if (index == 0) { |
---|
503 | collection_text = this.textContent; |
---|
504 | } else { |
---|
505 | collection_text = collection_text + ", " + this.textContent; |
---|
506 | } |
---|
507 | |
---|
508 | }); |
---|
509 | $('#collection_list').attr("value",collection_text); |
---|
510 | |
---|
511 | });// end of treeview click |
---|
512 | });// end of collection callback |
---|
513 | } |
---|
514 | function loadTerms(){ |
---|
515 | $('#model_profiles').load(link('terms','htmlselect',actions.terms.current)); |
---|
516 | |
---|
517 | $('#terms-select').live('change', function(event) { |
---|
518 | //notifyUser(this.value,'debug'); |
---|
519 | update(link('terms', 'htmllist', this.value), |
---|
520 | '#terms-select', '#model_terms', |
---|
521 | function() { |
---|
522 | $("#model_terms .treeview").treeview({ |
---|
523 | animated: "fast", |
---|
524 | collapsed: false |
---|
525 | }); |
---|
526 | //notifyUser($("#model_terms .treeview"),'debug'); |
---|
527 | notifyUser("loaded: #model_terms .treeview",'debug'); |
---|
528 | } |
---|
529 | ); |
---|
530 | } |
---|
531 | ); |
---|
532 | |
---|
533 | $('#terms .cmd_filter').live('click', function(event) { |
---|
534 | //var term = $(this).parent().find('span.term_detail_caller a').text(); |
---|
535 | var term = $(this).parent().children('span.data').text(); |
---|
536 | if ($('.searchtype_text','#search').size()> 0 ) { |
---|
537 | var t = $('#query_area').text(); |
---|
538 | $('#query_area').val(t + " " + term); |
---|
539 | } else { |
---|
540 | searchclauseset.updatedata(term); |
---|
541 | |
---|
542 | } |
---|
543 | //$('#srquery').val(term); |
---|
544 | }); |
---|
545 | |
---|
546 | $('#terms .cmd_columns').live('click', function(event) { |
---|
547 | //var term = $(this).parent().find('span.term_detail_caller a').text(); |
---|
548 | var term = $(this).parent().children('span.data').text(); |
---|
549 | var columns_text = $('#columns_list').attr("value"); |
---|
550 | if (columns_text.length > 0){ |
---|
551 | columns_text = columns_text + ","; |
---|
552 | } |
---|
553 | columns_text = columns_text + term; |
---|
554 | $('#columns_list').attr("value",columns_text); |
---|
555 | }); |
---|
556 | |
---|
557 | /* |
---|
558 | * deactivated -> obsolete? |
---|
559 | $('#terms .cmd_detail').live('click', function(event) { |
---|
560 | //showTermDetail($(this).parent().text()); |
---|
561 | // notifyUser($(this).parent().find('span.term_detail_caller a').text(),'debug'); |
---|
562 | var term = $(this).parent().find('span.term_detail_caller a').text(); |
---|
563 | var uri = link('terms', 'htmltable', term); // + " body"; |
---|
564 | |
---|
565 | // $.ajax({ |
---|
566 | // url: uri, |
---|
567 | // success: showDetail |
---|
568 | // }); |
---|
569 | $.get(uri, showDetail,'html'); |
---|
570 | |
---|
571 | }); |
---|
572 | */ |
---|
573 | |
---|
574 | } |
---|
575 | function loadComponentsRegistry(){ |
---|
576 | $('#profiles').load(link('compprofiles','htmlselect')); |
---|
577 | |
---|
578 | $('#components a').live('click', function (event) { |
---|
579 | event.preventDefault(); |
---|
580 | update($(this).attr('href'), '#components', '#components'); |
---|
581 | }); |
---|
582 | |
---|
583 | $('#profile-select').live('change', function(event) { |
---|
584 | //notifyUser(this.value,'debug'); |
---|
585 | update(link('compprofiles', 'htmllist', this.value), |
---|
586 | '#profile-select', '#components', |
---|
587 | function() { |
---|
588 | $("#components .treeview").treeview({ |
---|
589 | animated: "fast", |
---|
590 | collapsed: false |
---|
591 | }); |
---|
592 | notifyUser($("#components .treeview"),'debug'); |
---|
593 | } |
---|
594 | ); |
---|
595 | } |
---|
596 | ); |
---|
597 | |
---|
598 | $('#components .cmd_filter').live('click', function(event) { |
---|
599 | var term = $(this).prev().text(); |
---|
600 | if ($('.searchtype_text','#search').size()> 0 ) { |
---|
601 | var t = $('#query_area').text(); |
---|
602 | $('#query_area').val(t + " " + term); |
---|
603 | } else { |
---|
604 | searchclauseset.updatedata(term); |
---|
605 | //$('.focused','#searchclauselist').find('.index_input').val(term); |
---|
606 | } |
---|
607 | //$('#srquery').val($(this).parent().children('a').attr('href')); |
---|
608 | }); |
---|
609 | |
---|
610 | $('#compreg .cmd_detail').live('click', function(event) { |
---|
611 | //showTermDetail($(this).parent().text()); |
---|
612 | |
---|
613 | var uri = $(this).parent().children('a').attr('href'); // + " body"; |
---|
614 | // $.ajax({ |
---|
615 | // url: uri, |
---|
616 | // success: showDetail2 |
---|
617 | // }); |
---|
618 | |
---|
619 | $.get(uri, showDetail2,'html'); |
---|
620 | |
---|
621 | }); |
---|
622 | |
---|
623 | } |
---|
624 | function loadDCR(){ |
---|
625 | |
---|
626 | // ISOCAT DCR |
---|
627 | $('#dcr').load(link('isocat', 'htmllist', actions.isocat.current) ); |
---|
628 | |
---|
629 | // display minimal info in a bubble next to the calling anchor |
---|
630 | $("#dcr a, .comp_detail a").live('click', |
---|
631 | function (event) { |
---|
632 | event.preventDefault(); |
---|
633 | |
---|
634 | var uri = $(this).attr('href'); |
---|
635 | $('#bubble').empty(); |
---|
636 | // weirdly not functioning |
---|
637 | var isVisible = $('#bubble').is(':visible'); |
---|
638 | if (uri==last_bubble_uri) { |
---|
639 | $('#bubble').hide(); |
---|
640 | last_bubble_uri = ''; |
---|
641 | } else { |
---|
642 | notifyUser("conceptlink_uri: " + uri,'debug'); |
---|
643 | $('#bubble').load(uri); |
---|
644 | last_bubble_uri = uri; |
---|
645 | showBubble($(this)); |
---|
646 | } |
---|
647 | notifyUser('last_bubble_uri:' + last_bubble_uri,'debug'); |
---|
648 | |
---|
649 | //TODO filter, read isocat:nr |
---|
650 | // use in query clause |
---|
651 | var term = $(this).val(); |
---|
652 | var x = uri.split("/"); |
---|
653 | var category = x[x.length-1]; |
---|
654 | notifyUser(term); |
---|
655 | searchclauseset.updatedata(term, true, category); |
---|
656 | }); |
---|
657 | } |
---|
658 | |
---|
659 | function handleQueryInput(){ |
---|
660 | |
---|
661 | var elem; |
---|
662 | $('#terms_autocomplete').css('display','none'); |
---|
663 | $('#terms_autocomplete').load(link('terms_autocomplete','autocomplete/?q=all'),function(){ |
---|
664 | $(this).find('term').each(function(index){ |
---|
665 | elem = $(this).attr("name"); |
---|
666 | element_autocomplete[index] = elem; |
---|
667 | elements_hashtable[elem] = $(this).html(); |
---|
668 | |
---|
669 | /* elements_hashtable[elem] = []; |
---|
670 | elements_hashtable[elem][0] = elem; |
---|
671 | |
---|
672 | $(this).find('context').each(function(index){ |
---|
673 | elements_hashtable[elem][index+1] = this.textContent; |
---|
674 | }); |
---|
675 | */ |
---|
676 | }); |
---|
677 | |
---|
678 | $('#query_list').css('display', 'none'); |
---|
679 | $('<div id="searchclauselist"/>').insertAfter($('#query_list')); |
---|
680 | |
---|
681 | var sc = new SearchClause("","",""); |
---|
682 | searchclauseset.addsearchclause(sc,"",0,0); |
---|
683 | |
---|
684 | // $('#query_area').hide(); |
---|
685 | $('#searchclauselist').show(); |
---|
686 | $('#toggle_inputmode_cmd').addClass("searchtype_clauses"); |
---|
687 | |
---|
688 | $('#toggle_inputmode_cmd').live('click',function(){ |
---|
689 | if ($(this).text() == "TEXT") { |
---|
690 | searchclauseset.buildsctext(); |
---|
691 | $('#query_area').val(searchclauseset.sctext); |
---|
692 | $('#query_area').show(); |
---|
693 | $('#searchclauselist').hide(); |
---|
694 | $(this).toggleClass('searchtype_text searchtype_clauses'); |
---|
695 | $(this).text("FORM"); |
---|
696 | } else { |
---|
697 | $('#query_area').hide(); |
---|
698 | $('#searchclauselist').show(); |
---|
699 | $(this).text("TEXT"); |
---|
700 | $(this).toggleClass('searchtype_text searchtype_clauses'); |
---|
701 | } |
---|
702 | }); |
---|
703 | }); |
---|
704 | |
---|
705 | |
---|
706 | |
---|
707 | } |
---|
708 | |
---|
709 | function handleBubble(){ |
---|
710 | // this is dangerous workaround |
---|
711 | // actually I want it only for context-paths in #terms, |
---|
712 | // but they are moved out of the '.term_detail' context into the #bubble |
---|
713 | // so I have to use the generic.. |
---|
714 | // well, dangerous - you might wonder, why the links don't work.. |
---|
715 | $('#bubble a').live('click', function(event) { |
---|
716 | //showTermDetail($(this).parent().text()); |
---|
717 | event.preventDefault(); |
---|
718 | } ); |
---|
719 | |
---|
720 | |
---|
721 | $('#bubble .cmd_filter').live('click', function(event) { |
---|
722 | var term = $(this).next().next().attr("href"); |
---|
723 | if ($('.searchtype_text','#search').size()> 0 ) { |
---|
724 | var t = $('#query_area').text(); |
---|
725 | $('#query_area').val(t + " " + term); |
---|
726 | } else { |
---|
727 | $('.focused','#searchclauselist').find('.index-input').val(term); |
---|
728 | } |
---|
729 | //$('#srquery').val(term); |
---|
730 | }); |
---|
731 | |
---|
732 | /* obsolete: ? */ |
---|
733 | /* $(".term_detail_caller a, .query-detail-caller a").live('click', |
---|
734 | // function(event) { |
---|
735 | // //notifyUser("term_detail_caller_live_click",'debug'); |
---|
736 | // event.preventDefault(); |
---|
737 | // $(this).parents('li').find('div.term_detail').toggle(); |
---|
738 | //}); |
---|
739 | function (event) { |
---|
740 | event.preventDefault(); |
---|
741 | var uri = $(this).attr('href'); |
---|
742 | $('#bubble').empty(); |
---|
743 | // weirdly not functioning |
---|
744 | // var isVisible = $('#bubble').is(':visible'); |
---|
745 | if (uri==last_bubble_uri) { |
---|
746 | $('#bubble').hide(); |
---|
747 | last_bubble_uri = ''; |
---|
748 | } else { |
---|
749 | |
---|
750 | notifyUser("term_uri: " + uri,'debug'); |
---|
751 | var detail_info = $(this).parents('li').find('div.term_detail').html(); |
---|
752 | $('#bubble').html(detail_info); |
---|
753 | last_bubble_uri = uri; |
---|
754 | showBubble($(this)); |
---|
755 | } |
---|
756 | notifyUser('last_bubble_uri:' + last_bubble_uri,'debug'); |
---|
757 | }); |
---|
758 | */ |
---|
759 | |
---|
760 | } |
---|
761 | |
---|
762 | function addFunctionality(){ |
---|
763 | |
---|
764 | /* $('.cmds-elem-plus').live('click', function(event) { |
---|
765 | $(this).children('.detail').toggle(); |
---|
766 | }); |
---|
767 | */ |
---|
768 | $('.detail-caller, .cmd_detail').live('click', function(event) { |
---|
769 | $(this).parent().children('.detail').toggle(); |
---|
770 | }); |
---|
771 | |
---|
772 | $('.detail-caller a').live('click', function(event) { |
---|
773 | event.preventDefault(); |
---|
774 | }); |
---|
775 | |
---|
776 | $('.comp_detail input').live('keyup', function(event) { |
---|
777 | $('#srquery').val( |
---|
778 | $(this).parent().children('span.cmdelem_name').text() |
---|
779 | + "=" + $(this).val() ); |
---|
780 | }); |
---|
781 | |
---|
782 | $('.result a').live('click', function(event) { |
---|
783 | event.preventDefault(); |
---|
784 | var uri = $(this).attr('href'); // + " body"; |
---|
785 | $.get(uri, showDetail,'html'); |
---|
786 | }); |
---|
787 | |
---|
788 | $('.result .cmd_detail').live('click', function(event) { |
---|
789 | var uri = $(this).parent().find("a").attr('href'); // + " body"; |
---|
790 | $.get(uri, showDetail,'html'); |
---|
791 | }); |
---|
792 | |
---|
793 | |
---|
794 | // RECORDSET searchRetrieve |
---|
795 | $('#searchretrieve').submit( function(event) { |
---|
796 | event.preventDefault(); |
---|
797 | hideWelcomeMessage(); |
---|
798 | searchclauseset.buildsctext(); |
---|
799 | notifyUser(searchclauseset.sctext,'debug'); |
---|
800 | submit_query ($('#columns_list').attr("value"),searchclauseset.sctext, $('#input-simplequery').attr("value")); |
---|
801 | }); |
---|
802 | |
---|
803 | $('#querylist .cmd_del').live('click', function(event) { |
---|
804 | //showTermDetail($(this).parent().text()); |
---|
805 | |
---|
806 | queryset.removequery($(this).closest('.query_wrapper').attr('id')); |
---|
807 | |
---|
808 | }); |
---|
809 | |
---|
810 | $('#querylist .cmd_up').live('click', function(event) { |
---|
811 | $(this).closest('.query_wrapper').find('.result').hide(); |
---|
812 | $(this).toggleClass('cmd_down cmd_up'); |
---|
813 | }); |
---|
814 | |
---|
815 | $('#querylist .cmd_save').live('click', function(event) { |
---|
816 | var qid = $(this).closest('.query_wrapper').attr("id"); |
---|
817 | var qstring = queryset.getquerystring(qid); |
---|
818 | var json_coll = queryset.getcollections(qid); |
---|
819 | var json_cols = queryset.getcolumns(qid); |
---|
820 | var squery = queryset.getsquery(qid); |
---|
821 | // JSON conversion |
---|
822 | if (qstring.length == 0){ |
---|
823 | qstring = "[NULL]"; |
---|
824 | } |
---|
825 | if (squery.length == 0){ |
---|
826 | squery = "[NULL]"; |
---|
827 | } |
---|
828 | |
---|
829 | var id = parseInt($("#qts_select option:selected").val()); |
---|
830 | var iq = $('#userqueries').children().size(); |
---|
831 | |
---|
832 | if (iq == 0){ |
---|
833 | jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"] = [{}]; |
---|
834 | } |
---|
835 | |
---|
836 | jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][iq] = {"squerystring":squery, "querystring":qstring,"searchclauses":"null" , "collections" : json_coll, "columns" : json_cols}; |
---|
837 | saveWorkspace(); |
---|
838 | appendQueryUI(jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][iq],iq, $('#userqueries')); |
---|
839 | |
---|
840 | //$("#qs_select").append(new Option(Query.simplequerystring(qstring),iq)); |
---|
841 | }); |
---|
842 | /* |
---|
843 | $('.cmd_select').live('click', function(event) { |
---|
844 | var qid = $(this).closest('.query_wrapper').attr("id"); |
---|
845 | |
---|
846 | searchclauseset.sctext = queryset.getquerystring(qid); |
---|
847 | searchclauseset.buildfromquerystring(); |
---|
848 | }); |
---|
849 | */ |
---|
850 | $('#queryslist .cmd_resubmit').live('click', function(event) { |
---|
851 | var qid = $(this).closest('.query_wrapper').attr("id"); |
---|
852 | |
---|
853 | queryset.resubmit(qid); |
---|
854 | |
---|
855 | }); |
---|
856 | |
---|
857 | |
---|
858 | |
---|
859 | $('.cmd_down').live('click', function(event) { |
---|
860 | $(this).closest('.query_wrapper').find('.result').show(); |
---|
861 | $(this).toggleClass('cmd_down cmd_up'); |
---|
862 | }); |
---|
863 | $('.cmd_sc_delete').live('click', function(event) { |
---|
864 | var i = $(this).closest('.sc-i').attr('id'); |
---|
865 | var j = $(this).closest('.sc-j').attr('id'); |
---|
866 | //notifyUser(i + j,'debug'); |
---|
867 | searchclauseset.removesearchclause(i,j); |
---|
868 | |
---|
869 | }); |
---|
870 | $('.cmd_add_and').live('click', function(event) { |
---|
871 | //showTermDetail($(this).parent().text()); |
---|
872 | //$(this).next().hide(); |
---|
873 | $(this).attr("value","AND"); |
---|
874 | var searchclause = new SearchClause("","",""); |
---|
875 | var i = $(this).closest('.sc-i').attr('id'); |
---|
876 | var j = $(this).closest('.sc-j').attr('id'); |
---|
877 | //notifyUser(i + j,'debug'); |
---|
878 | searchclauseset.addsearchclause(searchclause,"and",i,j); |
---|
879 | |
---|
880 | }); |
---|
881 | $('.cmd_add_or').live('click', function(event) { |
---|
882 | //showTermDetail($(this).parent().text()); |
---|
883 | //$(this).next().hide(); |
---|
884 | var i,j; |
---|
885 | $(this).attr("value","OR"); |
---|
886 | var searchclause = new SearchClause("","",""); |
---|
887 | searchclauseset.addsearchclause(searchclause,"or",$(this).closest('.sc-i').attr('id'),$(this).closest('.sc-j').attr('id')); |
---|
888 | |
---|
889 | }); |
---|
890 | |
---|
891 | ///// datasets/queries |
---|
892 | $('#qts_save').click(function(){ |
---|
893 | var id = $("#qts_select option:selected").val(); |
---|
894 | //notifyUser($('#qts_input').val() + $('#qts_input').text(),'debug'); |
---|
895 | jsonw["WorkspaceProfile"]["Querysets"][id]["name"] = $('#qts_input').val(); |
---|
896 | |
---|
897 | $("#qts_select option:selected").text( $('#qts_input').val()); |
---|
898 | saveWorkspace(); |
---|
899 | }); |
---|
900 | $('#qts_add').click(function(){ |
---|
901 | var new_name = "new_queryset"; |
---|
902 | |
---|
903 | var id = $('#qts_select option').size(); |
---|
904 | var dt = new Date(); |
---|
905 | var str_time = dt.toString("yyyy-MM-dd HH:mm:ss"); |
---|
906 | |
---|
907 | if (id == 0){ |
---|
908 | jsonw["WorkspaceProfile"]["Querysets"] = [{}]; |
---|
909 | } |
---|
910 | |
---|
911 | jsonw["WorkspaceProfile"]["Querysets"][id] = {"name":new_name,"created":str_time , "Queries" : "null"}; |
---|
912 | |
---|
913 | saveWorkspace(); |
---|
914 | //todo |
---|
915 | |
---|
916 | //loadWorkspace(jsonw["WorkspaceProfile"]["Querysets"]); |
---|
917 | $("#qts_select").append(new Option(new_name, id)); |
---|
918 | $("#qts_select").find('option').attr("selected","false"); |
---|
919 | $("#qts_select").find('option').last().attr("selected","true"); |
---|
920 | $('#qts_input').val(new_name); |
---|
921 | }); |
---|
922 | $('#qts_delete').click(function(){ |
---|
923 | var count = $("#qts_select option").size(); |
---|
924 | |
---|
925 | //if (count > 1){ |
---|
926 | var id = parseInt($("#qts_select option:selected").val()); |
---|
927 | var size = jsonw["WorkspaceProfile"].Querysets.length; |
---|
928 | |
---|
929 | for (var i=id;i<size-1;i++){ |
---|
930 | jsonw["WorkspaceProfile"].Querysets[i] = jsonw["WorkspaceProfile"].Querysets[i+1]; |
---|
931 | } |
---|
932 | |
---|
933 | delete jsonw["WorkspaceProfile"].Querysets[size-1]; |
---|
934 | jsonw["WorkspaceProfile"]["Querysets"].length = size-1; |
---|
935 | // set null string , if 0 querysets |
---|
936 | if (count == 1) { |
---|
937 | jsonw["WorkspaceProfile"]["Querysets"] = "null"; |
---|
938 | } |
---|
939 | saveWorkspace(); |
---|
940 | //$("#qts_select option").remove(); |
---|
941 | loadQuerysets(jsonw["WorkspaceProfile"]["Querysets"],"user"); |
---|
942 | |
---|
943 | //} |
---|
944 | }); |
---|
945 | |
---|
946 | $('#collections .cmd_load').live('click',function(event){ |
---|
947 | hideWelcomeMessage(); |
---|
948 | var collection_text = ""; |
---|
949 | var coll = $(this).next().next().next(); |
---|
950 | collections.splice(0, collections.length); |
---|
951 | collections[0] = new Collection($(coll).attr("handle"), $(coll).html()); |
---|
952 | var columns = $('#columns_list').attr("value"); |
---|
953 | var query = new Query(collections,columns,"",""); |
---|
954 | |
---|
955 | //searchclauseset.clear(); |
---|
956 | queryset.addquery(query); |
---|
957 | $('#collection_list').attr("value",query.getcollectiontext("name")); |
---|
958 | |
---|
959 | }); |
---|
960 | $('#serverqueries .cmd_load').live('click',function(event){ |
---|
961 | hideWelcomeMessage(); |
---|
962 | var id = parseInt( $("#serverqts_select option:selected").val()); |
---|
963 | var str = $(this).parent().find('a').attr("href"); |
---|
964 | var iq = parseInt(str.substring(9)); |
---|
965 | var json = jQuery.parseJSON($("#serverqs").attr("data")); |
---|
966 | var query = new Query([],"","",""); |
---|
967 | query.load(json["WorkspaceProfile"]["Querysets"][id]["Queries"][iq]); |
---|
968 | queryset.addquery(query); |
---|
969 | |
---|
970 | searchclauseset.sctext = query.query; |
---|
971 | notifyUser(searchclauseset.sctext,'debug'); |
---|
972 | searchclauseset.buildfromquerystring(); |
---|
973 | |
---|
974 | collections = query.collection; |
---|
975 | $('#collection_list').attr("value",query.getcollectiontext("name")); |
---|
976 | $('#columns_list').attr("value",query.columns); |
---|
977 | $('#input-simplequery').attr("value",query.squery); |
---|
978 | }); |
---|
979 | $('#userqueries .cmd_load').live('click',function(event){ |
---|
980 | hideWelcomeMessage(); |
---|
981 | var id = parseInt( $("#qts_select option:selected").val()); |
---|
982 | var str = $(this).parent().find('a').attr("href"); |
---|
983 | var iq = parseInt(str.substring(7)); |
---|
984 | |
---|
985 | var query = new Query([],"","",""); |
---|
986 | query.load(jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][iq]); |
---|
987 | queryset.addquery(query); |
---|
988 | |
---|
989 | searchclauseset.sctext = query.query; |
---|
990 | notifyUser(searchclauseset.sctext,'debug'); |
---|
991 | searchclauseset.buildfromquerystring(); |
---|
992 | |
---|
993 | collections = query.collection; |
---|
994 | $('#collection_list').attr("value",query.getcollectiontext("name")); |
---|
995 | $('#columns_list').attr("value",query.columns); |
---|
996 | $('#input-simplequery').attr("value",query.squery); |
---|
997 | }); |
---|
998 | $('#userqueries .cmd_del').live('click', function(event){ |
---|
999 | //var count = $("#userqueries li").size(); |
---|
1000 | var id = parseInt($("#qts_select option:selected").val()); |
---|
1001 | var str = $(this).parent().find('a').attr("href"); |
---|
1002 | var iq = parseInt(str.substring(7)); |
---|
1003 | var size = jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"].length; |
---|
1004 | |
---|
1005 | for (var i=iq;i<size-1;i++){ |
---|
1006 | jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][i] = jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][i+1]; |
---|
1007 | } |
---|
1008 | |
---|
1009 | delete jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][size-1]; |
---|
1010 | jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"].length = size-1; |
---|
1011 | |
---|
1012 | if (size == 1){ |
---|
1013 | jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"] = "null"; |
---|
1014 | } |
---|
1015 | |
---|
1016 | saveWorkspace(); |
---|
1017 | loadQuerysets(jsonw["WorkspaceProfile"]["Querysets"],"user"); |
---|
1018 | //$("#qs_select option").remove(); |
---|
1019 | //$("#qs_select option").first().attr("selected","true"); |
---|
1020 | }); |
---|
1021 | |
---|
1022 | |
---|
1023 | $('.ui-dialog-titlebar-del').live('click', function(event){ |
---|
1024 | //$('#detail-float').dialog('close'); |
---|
1025 | var t = $(this).parents('.ui-widget').children('.ui-dialog-content'); |
---|
1026 | $(t).dialog('close'); |
---|
1027 | }); |
---|
1028 | |
---|
1029 | $('.ui-dialog-titlebar-up').live('click', function(event){ |
---|
1030 | var t = $(this).parents('.ui-widget').children('.ui-dialog-content'); |
---|
1031 | $(t).find(".ui-dialog-buttonpane:first, .ui-dialog-content").stop({clearQueue:true}).fadeOut(300); |
---|
1032 | $(t).stop({clearQueue:true}).animate({height:'0px'},300) |
---|
1033 | |
---|
1034 | $(this).removeClass('cmd_up ui-dialog-titlebar-up'); |
---|
1035 | $(this).addClass('cmd_down ui-dialog-titlebar-down'); |
---|
1036 | }); |
---|
1037 | $('.ui-dialog-titlebar-down').live('click', function(event){ |
---|
1038 | var t = $(this).parents('.ui-widget').children('.ui-dialog-content'); |
---|
1039 | $(t).find(".ui-dialog-content, .ui-dialog-buttonpane:first").stop({clearQueue:true}).fadeIn(800) |
---|
1040 | .end().stop({clearQueue:true}).animate({height:'100%'},300); |
---|
1041 | |
---|
1042 | $(this).removeClass('cmd_down ui-dialog-titlebar-down'); |
---|
1043 | $(this).addClass('cmd_up ui-dialog-titlebar-up'); |
---|
1044 | }); |
---|
1045 | |
---|
1046 | |
---|
1047 | |
---|
1048 | } |
---|
1049 | function addVisuals(){ |
---|
1050 | ////////////VISUALS |
---|
1051 | |
---|
1052 | $('#left-menu').addClass('ui-accordion ui-widget ui-helper-reset ui-accordion-icons'); |
---|
1053 | $('#left-menu h2').addClass('ui-accordion-header ui-helper-reset ui-state-default ui-corner-all'); |
---|
1054 | $('#left-menu>div').addClass('block ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom'); |
---|
1055 | $('#left-menu h2').click(function() { |
---|
1056 | $(this).next().toggle('fast'); |
---|
1057 | return false; |
---|
1058 | }).next().hide(); |
---|
1059 | |
---|
1060 | // Accordion |
---|
1061 | // $("#left-menu").accordion({ header: "h2",event: 'click' }); |
---|
1062 | // $("#left-menu").accordion('option', 'autoHeight', false); |
---|
1063 | |
---|
1064 | // hack to open the accordion without scroll-bars on init |
---|
1065 | // $("#left-menu").accordion('option', 'active', 1); |
---|
1066 | |
---|
1067 | |
---|
1068 | //$("#main-menu").treeview(); |
---|
1069 | |
---|
1070 | // Detail |
---|
1071 | // $("#detail").tabs("add", "#components","Tab1"); |
---|
1072 | $("#detail-float").dialog({ autoOpen: false, |
---|
1073 | position: ['right','70px'], |
---|
1074 | height: 450, |
---|
1075 | width: 300, |
---|
1076 | minHeigh: 100}); |
---|
1077 | |
---|
1078 | //$('#detail-float').dialog( "option", "minHeight", '0px' ); |
---|
1079 | |
---|
1080 | $("#detail-float").dialog(); |
---|
1081 | $("#detail-float").tabs(); |
---|
1082 | |
---|
1083 | } |
---|
1084 | |
---|
1085 | String.prototype.beginsWith = function(t, i) { if (i==false) { return |
---|
1086 | (t == this.substring(0, t.length)); } else { return (t.toLowerCase() |
---|
1087 | == this.substring(0, t.length).toLowerCase()); } } ; |
---|
1088 | |
---|
1089 | |
---|
1090 | String.prototype.endsWith = function(t, i) { if (i==false) { return (t |
---|
1091 | == this.substring(this.length - t.length)); } else { return |
---|
1092 | (t.toLowerCase() == this.substring(this.length - |
---|
1093 | t.length).toLowerCase()); } } ; |
---|
1094 | |
---|