Dotclear

Changeset 2545:63fc385ee997


Ignore:
Timestamp:
11/14/13 12:14:36 (10 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.6
Message:

List of tags are now coped correctly depending on setting (short/all), Addresses #1866

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/js/meta-editor.js

    r1920 r2545  
    1313     text_all: 'all', 
    1414     text_separation: 'Separate each %s by comas', 
    15       
     15 
    1616     target: null, 
    1717     meta_type: null, 
     
    2020     submit_button: null, 
    2121     post_id: false, 
    22       
     22 
    2323     service_uri: 'services.php', 
    24       
     24 
    2525     displayMeta: function(type,post_id) { 
    2626          this.meta_type = type; 
    2727          this.post_id = post_id; 
    2828          this.target.empty(); 
    29            
     29 
    3030          this.meta_dialog = $('<input type="text" class="ib" />'); 
    3131          this.meta_dialog.attr('title',this.text_add_meta.replace(/%s/,this.meta_type)); 
     
    3939               return true; 
    4040          }); 
    41            
     41 
    4242          var This = this; 
    43            
     43 
    4444          this.submit_button = $('<input type="button" value="ok" class="ib" />'); 
    4545          this.submit_button.click(function() { 
     
    4848               return false; 
    4949          }); 
    50            
     50 
    5151          this.addMetaDialog(); 
    52            
     52 
    5353          if (this.post_id == false) { 
    5454               this.target.append(this.meta_field); 
     
    5656          this.displayMetaList(); 
    5757     }, 
    58       
     58 
    5959     displayMetaList: function() { 
    6060          var li; 
     
    6363               this.target.prepend(this.meta_list); 
    6464          } 
    65            
     65 
    6666          if (this.post_id == false) { 
    6767               var meta = this.splitMetaValues(this.meta_field.val()); 
    68                 
     68 
    6969               this.meta_list.empty(); 
    7070               for (var i=0; i<meta.length; i++) { 
     
    8888                    postId: this.post_id 
    8989               }; 
    90                 
     90 
    9191               $.get(this.service_uri,params,function(data) { 
    9292                    data = $(data); 
    93                      
     93 
    9494                    if (data.find('rsp').attr('status') != 'ok') { return; } 
    95                      
     95 
    9696                    This.meta_list.empty(); 
    9797                    data.find('meta').each(function() { 
     
    111111          } 
    112112     }, 
    113       
     113 
    114114     addMetaDialog: function() { 
    115            
     115 
    116116          if (this.submit_button == null) { 
    117117               this.target.append($('<p></p>').append(this.meta_dialog)); 
     
    119119               this.target.append($('<p></p>').append(this.meta_dialog).append(' ').append(this.submit_button)); 
    120120          } 
    121            
     121 
    122122          if (this.text_separation != '') { 
    123123               this.target.append($('<p></p>').addClass('form-note').append(this.text_separation.replace(/%s/,this.meta_type))); 
    124124          } 
    125            
     125 
    126126          this.showMetaList(metaEditor.prototype.meta_type,this.target); 
    127            
    128      }, 
    129       
     127 
     128     }, 
     129 
    130130     showMetaList: function(type,target) { 
    131            
     131 
    132132          var params = { 
    133133               f: 'getMeta', 
     
    135135               sortby: 'metaId,asc' 
    136136          }; 
    137            
     137 
    138138          if (type == 'more') { 
    139139               params.limit = '30'; 
    140140          } 
    141            
     141 
    142142          var This = this; 
    143            
     143 
    144144          $.get(this.service_uri,params,function(data) { 
    145                 
     145 
    146146               var pl = $('<p class="addMeta"></p>'); 
    147                 
     147 
    148148               $(target).find('.addMeta').remove(); 
    149                 
     149 
    150150               if ($(data).find('meta').length > 0) { 
    151151                    pl.empty(); 
    152152                    var meta_link; 
    153                      
     153 
    154154                    $(data).find('meta').each(function(i) { 
    155155                         meta_link = $('<a href="#">' + $(this).text() + '</a>'); 
     
    160160                              return false; 
    161161                         }); 
    162                           
     162 
    163163                         if (i>0) { 
    164164                              pl.append(', '); 
     
    166166                         pl.append(meta_link); 
    167167                    }); 
    168                      
     168 
    169169                    if (type == 'more') { 
    170170                         var a_more = $('<a href="#" class="metaGetMore"></a>'); 
    171171                         a_more.append(This.text_all + String.fromCharCode(160)+String.fromCharCode(187)); 
    172172                         a_more.click(function() { 
    173                               This.showMetaList('all',target); 
     173                              This.showMetaList('more-all',target); 
    174174                              return false; 
    175175                         }); 
    176176                         pl.append(', ').append(a_more); 
    177                           
     177                    } 
     178 
     179                    if (type != 'more-all') { 
    178180                         pl.addClass('hide'); 
    179                           
     181 
    180182                         var pa = $('<p></p>'); 
    181183                         target.append(pa); 
    182                           
     184 
    183185                         var a = $('<a href="#" class="metaGetList">' + This.text_choose + '</a>'); 
    184186                         a.click(function() { 
     
    187189                              return false; 
    188190                         }); 
    189                           
     191 
    190192                         pa.append(a); 
    191193                    } 
    192                      
     194 
    193195                    target.append(pl); 
    194                      
     196 
    195197               } else { 
    196198                    pl.empty(); 
     
    198200          }); 
    199201     }, 
    200       
     202 
    201203     addMeta: function(str) { 
    202204          str = this.splitMetaValues(str).join(','); 
     
    204206               str = this.splitMetaValues(this.meta_field.val() + ',' + str); 
    205207               this.meta_field.val(str); 
    206                 
     208 
    207209               this.meta_dialog.val(''); 
    208210               this.displayMetaList(); 
     
    215217                    meta: str 
    216218               }; 
    217                 
     219 
    218220               var This = this; 
    219221               $.post(this.service_uri,params,function(data) { 
     
    227229          } 
    228230     }, 
    229       
     231 
    230232     removeMeta: function(meta_id) { 
    231233          if (this.post_id == false) { 
     
    241243          } else { 
    242244               var text_confirm_msg = this.text_confirm_remove.replace(/%s/,this.meta_type); 
    243                 
     245 
    244246               if (window.confirm(text_confirm_msg)) { 
    245247                    var This = this; 
     
    251253                         metaType: this.meta_type 
    252254                    }; 
    253                      
     255 
    254256                    $.post(this.service_uri,params,function(data) { 
    255257                         if ($(data).find('rsp').attr('status') == 'ok') { 
     
    262264          } 
    263265     }, 
    264       
     266 
    265267     splitMetaValues: function(str) { 
    266268          function inArray(needle,stack) { 
     
    272274               return false; 
    273275          } 
    274            
     276 
    275277          var res = new Array(); 
    276278          var v = str.split(','); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map