Changeset 4899


Ignore:
Timestamp:
08/03/11 16:48:31 (10 years ago)
Author:
fernando-alberto
Message:

Ticket #1269 - Desenvolvimento da nova solucao de arquivamento local MailArchiver?, ajustes para QueryConfig?

Location:
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/MAQueryConfig.js

    r4873 r4899  
    2020  this.body = null; 
    2121  this.date = null; 
    22   this.flag = null; 
     22  this.tag = null; 
    2323  this.folder = null; 
    2424  this.order = null; 
     25  this.preview_message = null; 
     26  this.preview_tooltip = null; 
    2527  this.defaults = null; 
    2628} 
     
    4244      this.setDate(cl[p]); 
    4345    if(p.toLowerCase() == 'flags') 
    44       this.setFlags(cl[p]); 
     46      this.setTag(cl[p]); 
    4547    if(p.toLowerCase() == 'folder') 
    4648      this.setFolder(cl[p]); 
     
    5254MAQueryConfig.prototype.setDefaults = function(defaults){ 
    5355    this.defaults = defaults; 
     56} 
     57 
     58MAQueryConfig.prototype.setExpressoDefaults = function(data_default){ 
     59    //Expresso defaults came from "messages_controller.js": here, we maps 
     60    //each array entry from messages_list intended to run by our own behavior 
     61    if(data_default.length != 7) 
     62        return; 
     63   //expresso default argument list => new Array(baseFolder,msg_range_begin,emails_per_page,sort_box_type,sort_box_reverse,preview_msg_subject,preview_msg_tip); 
     64   this.setFolder(data_default[0]); 
     65   this.setBounds(data_default[1], data_default[2]); 
     66    
     67   if (parseInt(data_default[4]) == 0) 
     68       var oexpor = 'asc'; 
     69   else 
     70       var oexpor = 'desc'; 
     71    
     72   switch(data_default[3].toLowerCase()){ 
     73       case 'sortfrom': 
     74           var oexpcrt = 'from'; 
     75           break; 
     76       case 'sortsubject': 
     77           var oexpcrt = 'subject'; 
     78           break; 
     79       case 'sortsize': 
     80           var oexpcrt = 'size'; 
     81           break; 
     82       default: 
     83           var oexpcrt = 'date'; 
     84           break; 
     85   } 
     86 
     87   var oexporder = eval('({"' + oexpcrt + '":"' + oexpor + '"})'); 
     88       
     89   this.setOrder(oexporder); 
    5490} 
    5591 
     
    181217 
    182218//flags data 
    183 MAQueryConfig.prototype.setFlags = function(flaglist){ 
     219MAQueryConfig.prototype.setTag = function(flaglist){ 
    184220  if(flaglist.flags.length <= 0){ 
    185     this.flag = null; 
    186     return; 
    187   } 
    188  
    189   this.flag = '"flag":['; 
     221    this.tag = null; 
     222    return; 
     223  } 
     224 
     225  this.tag = '"flag":['; 
    190226  var flag_data = flaglist.flags.split(','); 
    191227  if(flag_data.length > 0){ 
    192228    for(var k=0; k<flag_data.length; k++){ 
    193       this.flag += '{"@value":"'+flag_data[k]+'"},' 
     229      this.tag += '{"@value":"'+flag_data[k]+'"},' 
    194230    } 
    195     this.flag = this.flag.substr(0,this.flag.length-1); 
     231    this.tag = this.tag.substr(0,this.tag.length-1); 
    196232  } 
    197233  else{ 
    198     this.flag += '{"@value":"'+flaglist.flags+'"},'; 
    199   } 
    200   this.flag += '],'; 
     234    this.tag += '{"@value":"'+flaglist.flags+'"},'; 
     235  } 
     236  this.tag += '],'; 
    201237} 
    202238 
    203239//Folder data 
    204240MAQueryConfig.prototype.setFolder = function(folderslist){ 
    205   if(folderslist.folderlength <= 0){ 
     241  if(folderslist.length <= 0){ 
    206242    this.folder = null; 
    207243    return; 
     
    209245 
    210246  this.folder = '"folder":['; 
    211   var folder_data = folderslist.folder.split(','); 
    212   if(folder_data.length > 0){ 
    213     for(var k=0; k<folder_data.length; k++){ 
    214       this.folder += '{"@id":"'+folder_data[k]+'"},' 
     247  if (folderslist.indexOf(',') != -1){ 
     248    var folder_data = folderslist.folder.split(','); 
     249    if(folder_data.length > 0){ 
     250        for(var k=0; k<folder_data.length; k++){ 
     251            this.folder += '{"@id":"'+folder_data[k]+'"},' 
     252        } 
     253        this.folder = this.folder.substr(0,this.folder.length-1); 
    215254    } 
    216     this.folder = this.folder.substr(0,this.folder.length-1); 
     255    else{ 
     256        this.folder += '{"@id":"'+folderslist+'"}'; 
     257    } 
    217258  } 
    218259  else{ 
    219     this.folder += '{"@id":"'+folderslist.folder+'"},'; 
     260      this.folder += '{"@id":"' + folderslist + '"}'; 
    220261  } 
    221262  this.folder += '],'; 
     
    224265//Order criteria 
    225266MAQueryConfig.prototype.setOrder = function(order){ 
    226   if(order.length <= 0){ 
     267  if(typeof(order) != 'object'){ 
    227268    this.order = null; 
    228269    return; 
     
    259300} 
    260301 
     302MAQueryConfig.prototype.getFrom = function(){ 
     303    (this.from != null) ? retdata = this.from : retdata = ""; 
     304    return(retdata); 
     305} 
     306 
     307MAQueryConfig.prototype.getTo = function(){ 
     308    (this.to != null) ? retdata = this.to : retdata = ""; 
     309    return(retdata);     
     310} 
     311 
     312MAQueryConfig.prototype.getCc = function(){ 
     313    (this.cc != null) ? retdata = this.cc : retdata = ""; 
     314    return(retdata);     
     315} 
     316 
     317MAQueryConfig.prototype.getSubject = function(){ 
     318    (this.subject != null) ? retdata = this.subject : retdata = ""; 
     319    return(retdata);     
     320} 
     321 
     322MAQueryConfig.prototype.getBody = function(){ 
     323    (this.body != null) ? retdata = this.body : retdata = ""; 
     324    return(retdata);     
     325} 
     326 
     327MAQueryConfig.prototype.getDate = function(){ 
     328    (this.date != null) ? retdata = this.date : retdata = ""; 
     329    return(retdata);     
     330} 
     331 
     332MAQueryConfig.prototype.getTag = function(){ 
     333    (this.tag != null) ? retdata = this.tag : retdata = ""; 
     334    return(retdata);     
     335} 
     336 
     337MAQueryConfig.prototype.getFolder = function(){ 
     338    (this.folder != null) ? retdata = this.folder : retdata = ""; 
     339    return(retdata);     
     340} 
     341 
     342MAQueryConfig.prototype.getOrder = function(){ 
     343    (this.order != null) ? retdata = this.order : retdata = ""; 
     344    return(retdata);     
     345} 
     346 
    261347//Query criteria (core api) 
    262348MAQueryConfig.prototype.query = function(offsetlow,offsethight, criterialist){ 
    263   this.setBounds(offsetlow, offsethight); 
    264   this.setCriteriaList(criterialist); 
     349  if ((offsetlow) && (offsethight)) 
     350    this.setBounds(offsetlow, offsethight); 
     351 
     352  if (criterialist) 
     353    if(criterialist.length > 0) 
     354        this.setCriteriaList(criterialist); 
     355 
    265356  var querystring = '{"query":{' + this.lowerIndex + this.upperIndex; 
    266   querystring += this.from; 
    267   querystring += this.to; 
    268   querystring += this.cc; 
    269   querystring += this.subject; 
    270   querystring += this.body; 
    271   querystring += this.date; 
    272   querystring += this.flag; 
    273   querystring += this.folder; 
    274   querystring += this.order; 
     357  querystring += this.getFrom(); 
     358  querystring += this.getTo(); 
     359  querystring += this.getCc(); 
     360  querystring += this.getSubject(); 
     361  querystring += this.getBody(); 
     362  querystring += this.getDate(); 
     363  querystring += this.getTag(); 
     364  querystring += this.getFolder(); 
     365  querystring += this.getOrder(); 
    275366  querystring += '}}'; 
    276367  return(querystring); 
  • sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/mail_archiver.js

    r4894 r4899  
    730730        var testing_data_xml = '<?xml version="1.0" encoding="UTF-8"?><query lowerIndex="0" upperIndex="50"><folder id="'+folderid+'"/><order asc="date"/><order desc="subject"/></query>'; 
    731731        var testing_data_json_mapped = '{"query":{"@lowerIndex":"0", "@upperIndex":"50", "folder":[{"@id":"'+folderid+'"}], "order":[{"@asc":"date", "@desc":"subject"}]}}'; 
    732         var testing_data = testing_data_json_mapped; 
     732 
     733        if (expresso_mail_archive.queryconfig.folder != null) 
     734            var testing_data = expresso_mail_archive.queryconfig.query(); 
     735        else 
     736            var testing_data = testing_data_json_mapped; 
     737         
    733738        //window.alert('vai chamar o listMessages com testing_data = ' + testing_data); 
    734739        ArchiveServices.listMessages(expresso_mail_archive.listMessagesOperationOK, expresso_mail_archive.listMessagesOperationFailure, sessid, testing_data); 
  • sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/messages_controller.js

    r4875 r4899  
    1818                        //window.alert('dumping data:\n\n' + 'folder = ' + baseFolder + '\nmsg_range_begin = ' + msg_range_begin + '\nemails_per_page = ' + emails_per_page + '\nsort_box_type = ' + sort_box_type + '\nsearch_box_type = ' + search_box_type + '\nsort_box_reverse = ' + sort_box_reverse + '\npreview_msg_subject = ' + preview_msg_subject + '\npreview_msg_tip = ' + preview_msg_tip + '\ntree = ' + tree_name); 
    1919                        if(tree_name == 'tree_folders'){ //only the 'tree_folders' must show messages. 'folders_tree' are just for managment operation 
     20                            //alert('com tree_folders e sort_box_type = ' + sort_box_type + '\nsort_box_reverse = ' + sort_box_reverse + '\ncall_back = ' + call_back); 
    2021                            /*var dfs = new Array(); 
    2122                            dfs["folder"] = baseFolder; 
     
    3031                            */ 
    3132                            var dfs = new Array(baseFolder,msg_range_begin,emails_per_page,sort_box_type,sort_box_reverse,preview_msg_subject,preview_msg_tip,call_back,tree_name); 
    32                             expresso_mail_archive.queryconfig.setDefaults(dfs); 
     33                            expresso_mail_archive.queryconfig.folder = null; 
    3334                            expresso_mail_archive.listMessages(); 
    3435                             
     36                        } 
     37                        else{ 
     38                            if (!tree_name){ 
     39                                var exp_dfs = new Array(baseFolder,msg_range_begin,emails_per_page,sort_box_type,sort_box_reverse,preview_msg_subject,preview_msg_tip); 
     40                                expresso_mail_archive.queryconfig.setExpressoDefaults(exp_dfs); 
     41                                expresso_mail_archive.listMessages(); 
     42                            } 
    3543                        } 
    3644                }else { 
Note: See TracChangeset for help on using the changeset viewer.