source: MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui_load.js @ 1681

Last change on this file since 1681 was 1681, checked in by gaba, 12 years ago

autocomplete new version

File size: 21.7 KB
Line 
1
2/**
3 * @fileOverview  The file contains app load functionality. The load functions actualy used provides client side model building together with
4 * ui building. The load module is independant from app pane-layout and all ui-layout functionality.
5 *
6 * @author
7 * @version
8 */
9
10function loadData(){
11        //loadWelcomeMessage();
12        loadTooltiptable();
13        loadWorkspaceProfiles();
14        //loadCollections(); // loaded after WorkspaceProfile is loaded
15        //loadTerms();           // loaded after WorkspaceProfile is loaded
16        //loadTermsAutocomplete(); //handleQueryInput();
17        //createTooltip()
18       
19        //loadComponentsRegistry();     
20        //loadDCR();
21
22}
23
24function loadTooltiptable() {
25         
26         var uri = window.location.pathname + "/../../static/info.xml";
27         
28         $.get(uri,function(data, textStatus){
29                $(data).find('#commands').find('dt').each(function(){
30                        tooltiptable[$(this).attr("id")] = $(this).text();
31                        //$(this).next('dd').text();
32                });
33         },'html');
34
35};
36/*
37function loadAdminFile(){
38        json_admin = {'Admin':{'maxqid':'0','QueryIndices':'null'}};
39       
40        jQuery.getJSON("/MDService2/workspaceprofile/admin",function(data){
41                        json_admin = preprocessJSON(data);
42        });
43}
44*/
45function loadWorkspaceProfiles(){
46        //empty json
47        workspace.user_json  = {'WorkspaceProfile':{'CustomTermsets':'null','Termsets':'null','Repositories':'null','Querysets':'null','created':'null','lastchanged':'null','profilename':'null'}};
48        $('#qts_input').val("");
49       
50        $.ajaxSetup({"error":function(XMLHttpRequest,textStatus, errorThrown) {   
51              alert(textStatus); 
52              alert(errorThrown); 
53              alert(XMLHttpRequest.responseText); 
54          }}); 
55 
56
57        // server profile first - options needed
58        jQuery.getJSON("/MDService2/workspaceprofile/json/server",function(sdata){
59                                //notifyUser(sdata['WorkspaceProfile'],'debug');
60                                var json = preprocessJSON(sdata);
61                                workspace.server_json = json;
62                                $("#serverqs").attr("data",JSON.stringify(json));
63                                loadQuerysets("server");
64                                loadRepositories(workspace.server_json["WorkspaceProfile"]["Repositories"]);
65                                loadCollections(true);                         
66                                loadTerms();
67                                //loadTermsAutocomplete();
68                                loadQueryFromUriParams();
69                                createTooltip(null);
70                               
71                                // USER WORKSPACEPROFILE
72                                jQuery.getJSON("/MDService2/workspaceprofile/json/user",function(data){
73                                                        notifyUser(data['WorkspaceProfile'],'debug');
74                                                        workspace.user_json  = preprocessJSON(data);
75                                                        loadQuerysets("user");
76                                                        loadBookmarksets();
77                                                        createTooltip(this);
78                                                        loadTermsAutocomplete();
79                                });
80                               
81                });
82       
83       
84       
85
86}
87
88function loadCollections(ini){
89        var coll_uri = link('collections','htmllist?repository=' + getSelectedRepository());
90               
91        $("#collections").jstree({ 
92                "html_data" : {
93                        "ajax" : {
94                                "url" : coll_uri,
95                                "data" : function (n) { 
96                                        return {  //id : n.attr ? n.attr("id") : 0 ,
97                                                          collection : n.attr ? n.attr("handle") : "",
98                                                          maxdepth : n.attr ? 2 : 1 };
99                                }
100                        }
101                },
102                types : {
103                        // the default type
104                        "default" : {
105                                "max_children"  : -1,
106                                "max_depth"             : -1,
107                                "valid_children": "all"
108
109                }
110                },
111
112                "plugins" : [ "themes", "html_data", "ui" , "checkbox", "types", "search" ]
113        });
114       
115        $('#collections').bind('loaded.jstree reopen.jstree', function(event, data)
116                        {
117                                if ((event.type == "loaded") &&(ini)) {
118                                        loadQueryFromUriParams();
119                                }
120                               
121                                var dataelems = data.inst.get_container();
122                                createTooltip($(dataelems));
123                                        //data.inst.get_container().unblock();         
124                });
125
126        $('#collections').bind("change_state.jstree", function (event, data) {
127                var dataelems = data.inst.get_container();
128                var coll;
129                if (!local_collections){
130                        var collections  = [];
131                        //collections.splice(0, collections.length);
132                       
133                        $(this).find('.jstree-checked').each(function(index){
134                                if (!($(this).parent().parent().hasClass("jstree-checked")) ) {
135                                        //notifyUser("selection...:" + index + ":" + String.trim($(this).children('a').text())  + $(this).attr("handle"),'debug');     
136                                        coll = new Collection($(this).attr("handle"), String.trim($(this).children('a').text()));
137                                        collections[collections.length] = coll;                                         
138                                }
139                        });
140                       
141                        collections_widget.load(collections);
142                }
143    });
144       
145        $('#collections').bind("search.jstree", function (e, data) { 
146               
147                if (data.rslt.nodes.length > 0){
148                        $('#collections').jstree("checkbox.check_node",data.rslt.nodes[0]);
149                }
150                //alert("Found " + data.rslt.nodes.length + " nodes matching '" + data.rslt.str + "'."); 
151    }); 
152
153};
154
155function updateCollectionTree(){
156        /*
157        local_collections = true;
158        var cc = $('#collections').jstree("get_checked");
159        $('#collections').jstree("uncheck_all");
160        $.each(collections, function(){
161                $('#collections').jstree("search",this.name);
162        });
163        local_collections = false;
164        */
165};
166
167function loadTerms(){
168        $('#model_profiles').load(link('terms','htmlselect',actions.terms.current) + '?repository=' + getSelectedRepository());
169       
170        $('#terms-select').live('change', function(event) {
171                //notifyUser(this.value,'debug');
172                update(link('terms', 'htmllist', this.value)+ '?maxdepth=' + actions.terms.maxdepth + '&repository=' + getSelectedRepository(), 
173                                '#terms-select', '#model_terms',
174                                        function() {
175                                                $("#model_terms .treeview").treeview({
176                                                        animated: "fast",
177                                                        collapsed: false
178                                                });
179                                                //notifyUser($("#model_terms .treeview"),'debug');
180                                                notifyUser("loaded: #model_terms .treeview",'debug');
181                                                createTooltip(this);
182                                                }       
183                        );     
184                }
185        );
186       
187        $('#terms .cmd_filter').live('click',  function(event) {                       
188                var term = $(this).parent().children('span.data').text();               
189                if ($('.searchtype_text','#search').size()> 0 ) {
190                        var t = $('#query_area').text();
191                        $('#query_area').val(t + " " + term);
192                } else {
193                        searchclauseset.updatedata(term);
194                       
195                }
196        });
197       
198        $('#terms .cmd_columns').live('click',  function(event) {       
199                var term = $(this).parent().children('span.data').text();
200                columns_widget.add(new ListItem(term)); 
201               
202        });     
203
204}
205
206function loadRepositories(json) {
207       
208        var $select;
209        $select = $('#repositories_select');
210       
211       
212        $select.find("option").remove();
213       
214        if (String(json) != "null") {
215               
216                $.each(json, function(i,item) {
217                    $select.append(new Option(this.name, this.id));
218                });
219               
220        }
221        // select first
222        if (url_params["repository"] != undefined){
223                var r = parseInt(url_params["repository"])-1;
224                $($select.find("option")[r]).attr("selected","true");
225        } else {
226                $select.find("option").first().attr("selected","true");
227        }
228
229       
230        $select.change(function(data){
231                if (workspace.getRepositoryType(getSelectedRepository())=='md'){
232                        loadCollections(false);                         
233                        loadTerms();
234                        loadTermsAutocomplete();
235                        $('#model_profiles').load(link('terms','htmlselect',actions.terms.current) + '?repository=' + getSelectedRepository());
236
237                }
238        });
239       
240}
241
242function loadTermsAutocomplete(){
243       
244        var elem;
245        $('#termset_autocomplete').children().remove();
246        $('#termset_autocomplete').css('display','none');
247        $('#terms_autocomplete').children().remove();
248        $('#terms_autocomplete').css('display','none');
249        $('#termset_autocomplete').load(link('smc','list/?context=*'),function(){
250                $(this).find('Termset').each(function(index){
251                        var _key, _name, _id, _parent, _isleaf = 0; 
252                        _key = $(this).children("key").text();
253                        _name = $(this).children("name").text();
254                        _parent = $(this).parents('Termset');
255                        _id = $(this).children("id").text();
256                        if ($(this).children('Termset').length == 0){
257                                _isleaf = 1;
258                        }
259                       
260                        element_autocomplete[index] = { label:_name, value:_name, key:_key, id:_id, parent:_parent, isleaf:_isleaf, data:[]};   
261                        // obsolete
262                        // create div for each element
263                        //elements_hashtable[elem] = new Array();//$(this).html()
264                        //$('#terms_autocomplete').append($('<div/>').attr("id","elements_hashtable_" + elem));
265                });
266                // add autocomplete 's
267                searchclauseset.initAutocomplete();
268                columns_widget.initAutocomplete(element_autocomplete);
269        });
270};
271
272// QUERYSETS UI
273function appendQueryUI(json,i, qs){
274        var del = '';
275        var name = '';
276        //var ul;
277        var id = $(qs).parent().attr('id');
278       
279        if (id == 'userqs') {
280                del = '<span class="cmd cmd_del" ><xsl:text> </xsl:text></span>';
281                name = '<div class="cmds-elem-prop"><span class="label">name:</span><input type="text" class="input-name" value="' + json.name + '"></div>';
282        } else {
283                name = '<div class="cmds-elem-prop"><span class="label">name:</span><span class="value">' + json.name +
284                '</span></div>';
285        }
286               
287        var timestr = "";
288        if (json.time != undefined){
289                timestr = json.time;
290        }
291        var qq = json.querystring;
292        if (qq == "[NULL]"){
293                qq = "";
294        }
295        var x = '<div class="cmds-elem-plus" ><span class="cmd cmd_load"></span><span class="detail-caller-inline" ><a href="'+id + '_'+ i+'" >' + 
296        json.name + '</a></span>' + 
297        del +
298        '<span class="cmd cmd_publish"></span><div class="detail" >' +
299        name +
300        '<div class="cmds-elem-prop"><span class="label">query:</span><span class="value">' + Query.simplequerystring(qq) + '</span></div>' + 
301        '<div class="cmds-elem-prop"><span class="label">collections:</span><span class="value">' + Query.collectiontext(json) + '</span></div>' +
302        '<div class="cmds-elem-prop"><span class="label">columns:</span><span class="value">' + Query.columnstext(json) + '</span></div>' +
303        '<div class="cmds-elem-prop"><span class="label">time:</span><span class="value">' + timestr + '</span></div>' +
304        //'<div class="cmds-elem-prop"><span class="label">startItem:</span><span class="value">' + Query.startItem + '</span></div>' +
305        //'<div class="cmds-elem-prop"><span class="label">maxItems:</span><span class="value">' + Query.maximumItems + '</span></div>' +
306        //'<div class="cmds-elem-prop"><span class="label">repository:</span><span class="value">' + Query.repository + '</span></div>' +
307        '<div class="cmds-elem-prop"><span class="label">bookmark:</span><span class="value">' + json.bookmark + '</span></div>' +
308        '<div class="cmds-elem-prop"><span class="label">options:</span><span class="value">' + Query.optionstext(json) +  '</span></div>' +
309        '</div>';
310       
311        //dt = Date.parse('2010-10-18, 10:06 AM'); dt.toString('dd/mm/yyyy HH:mm:ss GMT')
312        $(qs).append(x);
313       
314        var query = new Query([],"","");
315        query.load(json);
316        $(qs).find("[href='"+ id + "_" + i + "']").closest('.cmds-elem-plus').data('query',query);
317        $(qs).find("[href='"+ id + "_" + i + "']").closest('.cmds-elem-plus').data('queryjson',json);
318        $(qs).find("[href='"+ id + "_" + i + "']").closest('.cmds-elem-plus').find('.input-name').data('queryjson',json);
319        $(qs).find('.detail').css({'z-index' : '1000'});
320       
321        $(qs).find('.input-name').keydown(function(ev){
322                var evStop = function(){ 
323                        ev.stopPropagation(); 
324                        ev.preventDefault(); 
325                };
326                if (ev.which === 13) {
327                        $(this).data("queryjson").name = $(this).val();
328                        workspace.savequeryset($(this).data("queryjson"),0);
329                        //todo update
330                        $(this).parent().parent().parent().find('a').text($(this).val());
331                        //Workspace.save("user");
332                        //var query = new Query();
333                        //query.load($(this).data("queryjson"));
334                        //query.save();
335                        /*
336                        var id = parseInt( $("#qts_select option:selected").val());
337                        $(this).parent().parent().parent().find('a').text($(this).val());
338                        var str = $(this).parent().parent().parent().find('a').attr("href");
339                        var iq = parseInt(str.substring(7));
340                       
341                        jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][iq].name = $(this).val();
342                        //saveWorkspace("USER");
343                        Workspace.save("USER");
344                        */
345                        evStop();
346                }
347        });
348        createTooltip(qs);
349}
350
351function createQueriesUI(json, qs){
352        $(qs).children().remove();
353        if (json.Queries != "null") {
354                $.each(json.Queries, function(i,item) {
355                        if (this != "null"){
356                                appendQueryUI(this,i, qs);
357                        }
358                });
359        }
360       
361}
362function loadQuerysets(type) {
363       
364        var json = workspace.getTypedElement(type, 'queryset');
365        var $select;
366        if (type == "user") {
367                $select = $('#qts_select');
368        } else {
369                $select = $('#serverqts_select');
370        }
371       
372        $select.find("option").remove();
373       
374        if (String(json) != "null") {
375               
376                $.each(json, function(i,item) {
377                        //notifyUser(i + ',' + this.name + ',' + this.created,'debug');
378                    $select.append(new Option(this.name, i));
379                });
380               
381               
382                // find id of selected
383                if ($select.find("option").size() > 0) {
384                        $select.find("option").first().attr("selected","true");
385                        var id = parseInt($select.find("option:selected").val());
386                        var jsonq = json[id];
387                        //var jsonq = $select.find("option:selected").val();
388                       
389                        if (type == "user") {
390                                $('#qts_input').val(jsonq["name"]);
391                                qs = $("#userqueries");
392                        } else {
393                                qs = $("#serverqueries");
394                        }
395                        createQueriesUI(jsonq, qs);
396                }
397               
398                $select.change(function(data){
399                        if ($select.find("option").size() > 0) {
400                                // find id of selected
401                                var id = parseInt($select.find("option:selected").val());
402                                var jsonq = json[id];
403                                //var jsonq = $select.find("option:selected").val();
404                                       
405                                if (type == "user") {
406                                        $('#qts_input').val(jsonq["name"]);
407                                        qs = $("#userqueries");
408                                } else {
409                                        qs = $("#serverqueries");
410                                }
411                                createQueriesUI(jsonq, qs);
412                               
413                        }
414             });
415               
416        }
417
418}
419
420// BOOKMARKS UI
421function appendBookmarkUI(json,i, bs){
422        var del = '';
423        var name = '';
424        var id = $(bs).parent().attr('id');
425       
426        del = '<span class="cmd cmd_del" ><xsl:text> </xsl:text></span>';
427        name = '<div class="cmds-elem-prop"><span class="label">name:</span><input type="text" class="input-name" value="' + json.name + '"></div>';
428               
429        var timestr = "";
430        if (json.time != undefined){
431                timestr = json.time;
432        }
433       
434        var qq = json.querystring;
435        if (qq = "[NULL]"){
436                qq = "";
437        }
438        var x = '<div class="cmds-elem-plus" ><span class="cmd cmd_load"></span><span class="detail-caller-inline" ><a href="'+ id + '_'+ i+'" >' + 
439        json.name + '</a></span>' + 
440        del +
441        '<div class="detail" >' +
442        name +
443        '<div class="cmds-elem-prop"><span class="label">query:</span><span class="value">' + Query.simplequerystring(qq) + '</span></div>' + 
444        '<div class="cmds-elem-prop"><span class="label">collections:</span><span class="value">' + Query.collectiontext(json) + '</span></div>' +
445        '<div class="cmds-elem-prop"><span class="label">columns:</span><span class="value">' + Query.columnstext(json) + '</span></div>' +
446        '<div class="cmds-elem-prop"><span class="label">time:</span><span class="value">' + timestr + '</span></div>' +
447        '<div class="cmds-elem-prop"><span class="label">bookmark:</span><span class="value">' + json.bookmark + '</span></div>' +
448        '<div class="cmds-elem-prop"><span class="label">options:</span><span class="value">' + Query.optionstext(json) +  '</span></div>' +
449        '</div>';
450         
451        $(bs).append(x);
452       
453        var query = new Query([],"","");
454        query.load(json);
455        $(bs).find("[href='"+ id + "_" + i + "']").closest('.cmds-elem-plus').data('query',query);
456        $(bs).find("[href='"+ id + "_" + i + "']").closest('.cmds-elem-plus').data('queryjson',json);
457        $(bs).find('.input-name').data('queryjson',json);
458        $(bs).find('.detail').css({'z-index' : '1000'});
459       
460        $(bs).find('.input-name').keydown(function(ev){
461                var evStop = function(){ 
462                        ev.stopPropagation(); 
463                        ev.preventDefault(); 
464                };
465                if (ev.which === 13) {
466                        $(this).data("queryjson").name = $(this).val();
467                        $(this).data("query").name = $(this).val();
468                        workspace.save("user");
469                       
470                        evStop();
471                }
472        });
473        createTooltip(qs);
474}
475
476function createBookmarksUI(json, bs){
477        $(bs).children().remove();
478        if (json.Bookmarks != "null") {
479                $.each(json.Bookmarks, function(i,item) {
480                        if (this != "null"){
481                                appendBookmarkUI(this,i, bs);
482                        }
483                });
484        }
485       
486}
487function loadBookmarksets() {
488       
489        var json = workspace.getTypedElement('user','bookmarkset');
490        var $select = $('#bts_select');
491       
492        $select.find("option").remove();
493       
494        if (String(json) != "null") {
495               
496                $.each(json, function(i,item) {
497                    $select.append(new Option(this.name, i));
498                });
499               
500               
501                // find id of selected
502                if ($select.find("option").size() > 0) {
503                        $select.find("option").first().attr("selected","true");
504                        var id = parseInt($select.find("option:selected").val());
505                        var jsonb = json[id];
506                       
507                        $('#bts_input').val(jsonb["name"]);
508                        //qs = $("#bookmarks");
509                       
510                        createBookmarksUI(jsonb,  $("#bookmarks"));
511                }
512               
513                $select.change(function(data){
514                        if ($select.find("option").size() > 0) {
515                                // find id of selected
516                                var id = parseInt($select.find("option:selected").val());
517                                var jsonq = json[id];
518                                       
519                                $('#bts_input').val(jsonq["name"]);
520                                bs = $("#bookmarks");
521                               
522                                createBookmarksUI(jsonq, bs);
523                               
524                        }
525             });
526               
527        }
528
529}
530
531function  preprocessJSON(json){
532        if (json["Admin"] != undefined) {
533                if (json["Admin"]["QueryIndices"] != undefined){
534                        if (String(json["Admin"]["QueryIndices"]) != "null") {
535                                if (json["Admin"].QueryIndices[0] == undefined){
536                                        var jj = json["Admin"]["QueryIndices"]["item"];
537                                        delete json["Admin"]["QueryIndices"]["item"];
538                                        json["Admin"]["QueryIndices"] = [{}];
539                                        json["Admin"]["QueryIndices"][0] = jj;
540                                }
541                        }
542                }
543        }
544       
545       
546        if (json["WorkspaceProfile"]["CustomTermsets"] != undefined){
547       
548        if (String(json["WorkspaceProfile"]["CustomTermsets"]) != "null") {
549                if (json["WorkspaceProfile"].CustomTermsets[0] == undefined){
550                        var jj = json["WorkspaceProfile"]["CustomTermsets"]["item"];
551                        delete json["WorkspaceProfile"]["CustomTermsets"]["item"];
552                        json["WorkspaceProfile"]["CustomTermsets"] = [{}];
553                        json["WorkspaceProfile"]["CustomTermsets"][0] = jj;
554                }
555       
556               
557                $.each(json["WorkspaceProfile"]["CustomTermsets"], function(i,item) {
558                    if (this.Terms[0] == undefined){
559                        var jj = this["Terms"]["item"];
560                                delete this["Terms"]["item"];
561                                this.Terms = [{}];
562                        this.Terms[0] = jj;
563                    }
564                });
565        }
566        }
567        if (json["WorkspaceProfile"].Querysets[0] == undefined){
568                var jj = json["WorkspaceProfile"]["Querysets"]["item"];
569                delete json["WorkspaceProfile"]["Querysets"]["item"];
570                json["WorkspaceProfile"]["Querysets"] = [{}];
571                json["WorkspaceProfile"]["Querysets"][0] = jj;
572                }
573        if (json["WorkspaceProfile"].Bookmarksets[0] == undefined){
574                var jj = json["WorkspaceProfile"]["Bookmarksets"]["item"];
575                delete json["WorkspaceProfile"]["Bookmarksets"]["item"];
576                json["WorkspaceProfile"]["Bookmarksets"] = [{}];
577                json["WorkspaceProfile"]["Bookmarksets"][0] = jj;
578                }
579
580        if (String(json["WorkspaceProfile"]["Querysets"]) != "null") {
581               
582                $.each(json["WorkspaceProfile"]["Querysets"], function(i,item) {
583                    if (this.Queries[0] == undefined){
584                        var jj = this["Queries"]["item"];
585                                delete this["Queries"]["item"];
586                                this.Queries = [{}];
587                        this.Queries[0] = jj;
588                    }
589                });
590               
591                $.each(json["WorkspaceProfile"]["Querysets"], function(i,item){
592                        if (String(this.Queries) != "null") {
593                                $.each(this.Queries, function(i,item){
594                                        if (this.collections != "null") {
595                                                if (this.collections[0] == undefined){
596                                                var jj = this["collections"]["item"];
597                                                        delete this["collections"]["item"];
598                                                        this.collections = [{}];
599                                                this.collections[0] = jj;
600                                            }
601                                        }
602                                        if (this.columns != "null") {
603                                                if (this.columns[0] == undefined){
604                                                var jj = this["columns"]["item"];
605                                                        delete this["columns"]["item"];
606                                                        this.columns = [{}];
607                                                this.columns[0] = jj;
608                                            }
609                                        }
610                                });
611                        }
612                });
613        }
614       
615       
616        if (String(json["WorkspaceProfile"]["Bookmarksets"]) != "null") {
617               
618                $.each(json["WorkspaceProfile"]["Bookmarksets"], function(i,item) {
619                    if (this.Bookmarks[0] == undefined){
620                        var jj = this["Bookmarks"]["item"];
621                                delete this["Bookmarks"]["item"];
622                                this.Bookmarks = [{}];
623                        this.Bookmarks[0] = jj;
624                    }
625                });
626               
627                $.each(json["WorkspaceProfile"]["Bookmarksets"], function(i,item){
628                        if (String(this.Bookmarks) != "null") {
629                                $.each(this.Bookmarks, function(i,item){
630                                        if (this.collections != "null") {
631                                                if (this.collections[0] == undefined){
632                                                var jj = this["collections"]["item"];
633                                                        delete this["collections"]["item"];
634                                                        this.collections = [{}];
635                                                this.collections[0] = jj;
636                                            }
637                                        }
638                                        if (this.columns != "null") {
639                                                if (this.columns[0] == undefined){
640                                                var jj = this["columns"]["item"];
641                                                        delete this["columns"]["item"];
642                                                        this.columns = [{}];
643                                                this.columns[0] = jj;
644                                            }
645                                        }
646                                });
647                        }
648                });
649        }
650        return json;
651       
652}
653
654
655
656
657function saveTermset(id, name, listwidget) {
658       
659
660        var terms = [{}];       
661       
662        $.each(listwidget.widgets,function(i,elem){
663                terms[i] = elem.name;
664        });
665       
666        var dt = new Date();
667        var str_time = dateFormat(dt);//dt.toString("dd/mm/yyyy HH:mm:ss");
668        var jsont = {"name":name, "time" : str_time, "Terms" :terms};
669
670        workspace.addelement("customtermset",jsont);
671        workspace.save("user");
672/*
673        if (jsonw["WorkspaceProfile"]["CustomTermsets"] == "null") {
674                jsonw["WorkspaceProfile"]["CustomTermsets"] = [{}];
675                if (id == -1) {id = 0;};
676        }
677        if (id == -1) {id = jsonw["WorkspaceProfile"]["CustomTermsets"].length;};
678        jsonw["WorkspaceProfile"]["CustomTermsets"][id] = jsont;
679       
680        //saveWorkspace("USER");
681        Workspace.save("USER");
682*/
683};
684function removeTermset(id){
685        workspace.removeelement("customtermset",id);
686        workspace.save("user");
687        /*
688        var size = jsonw["WorkspaceProfile"]["CustomTermsets"].length;
689
690        for (var i=id;i<size-1;i++){
691                jsonw["WorkspaceProfile"].CustomTermsets[i] = jsonw["WorkspaceProfile"].CustomTermsets[i+1];
692        }
693
694        delete jsonw["WorkspaceProfile"].CustomTermsets[size-1];
695        jsonw["WorkspaceProfile"]["CustomTermsets"].length = size-1;
696        // set null string , if 0
697        if (size == 1) {
698                jsonw["WorkspaceProfile"]["CustomTermsets"] = "null";
699        }
700        //saveWorkspace("USER");
701        Workspace.save("USER");
702        */
703};
704
705/*
706function loadWelcomeMessage(){ 
707        $('#welcomedetail').load("/MDService2/docs/xml/welcome #welcome", function() { //profile.collections.base_uri,
708                $('#welcome').addClass("ui-helper-reset ui-corner-all ui-widget-content");
709        });
710}
711*/
Note: See TracBrowser for help on using the repository browser.