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