Ignore:
Timestamp:
03/06/11 22:29:26 (13 years ago)
Author:
gaba
Message:

http://trac.clarin.eu/ticket/102 - query detail functionality

Location:
MDService2/trunk/MDService2/WebContent/scripts
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • MDService2/trunk/MDService2/WebContent/scripts/mdservice_model.js

    r1153 r1156  
    387387        createTooltip(this.container);
    388388 };
    389  
     389 /*
    390390 Query.prototype.renderDetail = function () {
    391391         
     
    464464        $('#detail-'+this.listid).find('.cmd_down').toggleClass('cmd_down cmd_up');     
    465465};
    466 
     466*/
    467467 Query.prototype.open = function (type) {
    468468         if (type != null)
     
    505505                return uri;
    506506};
    507 
    508507 Query.prototype.submit = function () {
    509508               
     
    527526                                        q_header.append(result_header);
    528527                                       
    529                                        
     528                                        //var q_header = $(x).find('.query_header');
     529                                        addDetailFunctionality(q_header);
     530                                       
    530531                                        createTooltip($(this));
    531532                                });
     
    570571                                q_header.children('.result-header').remove();
    571572                               
    572                                 q_header.append(result_header);                                 
    573                                 q_header.find('.cmd_reload').click(function() {
     573                                q_header.append(result_header);                         
     574                                addDetailFunctionality(q_header);
     575/*                              q_header.find('.cmd_reload').click(function() {
    574576                                        // reload  from columns-wrapper
    575577                                        if ($(this).parent().attr('class').indexOf("columns-wrapper") > 0) {
     
    620622                                q_header.find('.columns-wrapper').hide();
    621623                                q_header.find('.terms-tree').treeTable({initialState:"collapsed"});
     624                                */
    622625                        });
    623626
     
    814817       
    815818        // add to query columnslist // columns_widget not used
    816         var qid = $(elem).closest('.query_wrapper').attr("id");
     819        var qid = $(elem).closest('.detail-wrapper').attr("temp_id");
    817820        var q = queryset.getQuery(qid);
    818821        //q.columns_widget.add($(this).text());
     
    828831        q.columns = columns_text;
    829832        */
    830 }
     833};
     834
     835function addDetailFunctionality(q_header){
     836        q_header.find('.cmd_reload').click(function() {
     837                // reload  from columns-wrapper
     838                //if ($(this).parent().attr('class').indexOf("columns-wrapper") > 0) {
     839                //      $(this).closest('.columns-wrapper').hide();
     840                //}
     841                var qid = $(this).closest('.detail-wrapper').attr("temp_id");
     842                //var qid = str.substring(1);
     843                queryset.resubmit(qid);
     844        });
     845        q_header.find('.cmd_prev').click(function() {
     846                var qid = $(this).closest('.detail-wrapper').attr("temp_id");
     847                //var qid = str.substring(7);
     848                queryset.next(qid,-1);
     849        });
     850        q_header.find('.cmd_next').click(function() {
     851                var qid = $(this).closest('.detail-wrapper').attr("temp_id");
     852                //var qid = str.substring(7);
     853                        queryset.next(qid,1);
     854        });
     855       
     856        q_header.find('.value-format').change(function(){
     857                var qid = $(this).closest('.detail-wrapper').attr("temp_id");
     858                //var qid = str.substring(1);
     859                var q = queryset.getQuery(qid);
     860                q.format = $(this).find('option:selected').val();
     861                queryset.resubmit(qid);
     862               
     863        });
     864/*      q_header.find('.cmd_columns').live('click',  function(event) {
     865                notifyUser("DEBUG: submit() .cmd_columns");
     866                $(this).closest('.query_wrapper').find('.columns-wrapper').toggle();
     867        });     
     868*/
     869        q_header.find('.cmd_add').click(function(){
     870               
     871                query_wrapper_add_column($(this));
     872        });
     873       
     874        $('.query-columnslist .cmd_del').live('click',function(){
     875                if ($(this).parent().parent().attr("class") == "query-columnslist"){
     876                        var list = $(this).closest('.query-columns').children('.query-columnslist');
     877                        var qid = $(this).closest('.detail-wrapper').attr("temp_id");
     878                        var q = queryset.getQuery(qid);
     879                       
     880                        $(this).parent().remove();
     881                        q.updatecolumnstext($(list).children());
     882                               
     883                }
     884                if ($(this).parent().attr('class') == 'columns-wrapper'){
     885                        $(this).parent().hide();
     886                }
     887        });
     888        /*
     889        q_header.find('.cmd_del').click(function(){
     890                if ($(this).parent().parent().attr("class") == "query-columnslist"){
     891                        var list = $(this).closest('.query-columns').children('.query-columnslist');
     892                        var qid = $(this).closest('.detail-wrapper').attr("temp_id");
     893                        var q = queryset.getQuery(qid);
     894                       
     895                        $(this).parent().remove();
     896                        q.updatecolumnstext($(list).children());
     897                               
     898                }
     899                if ($(this).parent().attr('class') == 'columns-wrapper'){
     900                        $(this).parent().hide();
     901                }
     902        });
     903        */
     904        q_header.find('.columns-wrapper').hide();
     905        q_header.find('.terms-tree').treeTable({initialState:"collapsed"});
     906
     907
     908};
  • MDService2/trunk/MDService2/WebContent/scripts/mdservice_searchclause.js

    r1153 r1156  
    192192 SearchClause.prototype.initAutocomplete = function(){
    193193       
    194          if (element_autocomplete.size == 0) return;
     194         if (element_autocomplete.length == 0) return;
    195195         
    196196         //autocomplete
     
    259259
    260260                this.GetIndexInput().autocompleteArray(element_autocomplete,{
    261                         autoFill:true,
    262                         width:150,
     261                        //autoFill:true,
     262                        //width:150,
    263263                        onFindValue:findValue,
    264264                        onItemSelect:selectItem
  • MDService2/trunk/MDService2/WebContent/scripts/mdservice_ui.js

    r1153 r1156  
    7777                }
    7878                else {
    79                         did = $(this).parent().siblings('.ui-dialog-content').find('.detail-wrapper').attr('id');
     79                        if ($(this).parent().siblings('.ui-dialog-content').length > 0){
     80                                did = $(this).parent().siblings('.ui-dialog-content').find('.detail-wrapper').attr('id');
     81                        }
    8082                }       
    8183                if (did != undefined){
  • MDService2/trunk/MDService2/WebContent/scripts/mdservice_ui_detail.js

    r1154 r1156  
    11 
    2 function Detail(name, content, url, type, detailwidget) {
    3         this.name = name;
    4         this.content = content;
    5         this.content_wrapper = '';
    6         this.url = url;
    7         this.type = type;
     2function Detail(detailwidget) {
    83        this.detailwidget = detailwidget;
    94       
    105        this.did = '';
    116        this.content_parent = undefined;
    12 };
    13 
     7        this.content_wrapper = '';
     8       
     9        this.url = undefined;
     10        this.type = undefined;
     11        this.name = undefined;
     12        this.content = undefined;
     13        this.temp_id = "";
     14       
     15        this.setData();
     16         
     17};
     18Detail.prototype.update = function(detailwidget){
     19        this.detailwidget = detailwidget;
     20        this.temp_id = "";
     21        this.setData();
     22       
     23};
     24Detail.prototype.setData = function(){
     25       
     26        var widget = this.detailwidget;
     27        if ($(widget).parents('.result').length > 0){
     28                this.name = "record";
     29        } else {
     30                if ($(widget).parents('.result-summary').length > 0) {
     31                        this.name = "values";
     32                } else {
     33                        this.name = $(widget).closest('.ui-widget').attr('name');
     34                }
     35        }
     36       
     37        this.type = blocks_settings[this.name].detail.type;
     38        switch (this.name){
     39        case 'query':
     40                //TODO class standard rename
     41                this.content = $(widget).closest('.query_wrapper').find('.columns-wrapper');
     42                this.url  = undefined;
     43                this.temp_id  = $(widget).closest('.query_wrapper').attr('id');
     44                break;
     45        case 'record':
     46                this.content = undefined;
     47                this.url = $(widget).parent().find("a").attr('href');
     48                break;
     49        case 'values':
     50                this.content = undefined;
     51                this.url = $(widget).parent().find("a").attr('href');
     52                break;
     53        default:
     54        }
     55};
    1456Detail.prototype.getTitle = function(){
    1557        var title = "";
     
    1759        return title;
    1860};
    19 
    2061Detail.prototype.create = function(){
    21         var cw = "<div id='" + this.did + "' class='detail-wrapper ui-widget' >" +
     62        var cw = "<div id='" + this.did + "' temp_id='" + this.temp_id  + "' class='detail-wrapper ui-widget' >" +
    2263        "<div class='detail-header ui-widget-header ui-state-default'>" +// ui-corner-top'>" +
    2364        "<span class='cmd cmd_get'></span>" +
     
    2970       
    3071};
    31 Detail.prototype.update = function(content, url, type, detailwidget){
    32        
    33         this.url = url;
    34         this.content = content;
    35         this.type = type;
    36         this.detailwidget = detailwidget;
    37        
    38 };
     72
    3973Detail.prototype.openContent = function() {
    4074        if (this.content != undefined){
     
    113147                }
    114148                detail = this.details[name];
    115                 url = this.getdetailurl(name, widget)
     149                //url = this.getdetailurl(name, widget);
    116150                if (detail == undefined) {
    117                         content = this.getdetailcontent(name, widget);
    118                         detail = new Detail(name, content, url, blocks_settings[name].detail.type, widget );
     151                        //content = this.getdetailcontent(name, widget);
     152                        detail = new Detail( widget );
    119153                        this.adddetail(detail);
    120154                } else {
    121155                        detail.close();
    122                         content = this.getdetailcontent(name, widget);
    123                         detail.update(content, url, blocks_settings[name].detail.type, widget );
     156                        //content = this.getdetailcontent(name, widget);
     157                        detail.update( widget );
    124158                }
    125159               
Note: See TracChangeset for help on using the changeset viewer.