Dotclear

Changeset 2487:53510da55dc5 for admin/js


Ignore:
Timestamp:
10/24/13 11:14:03 (12 years ago)
Author:
Denis Jean-Chirstian <contact@…>
Branch:
2.6
Message:

Add actions batch (and checkboxes) to modules list.

Location:
admin/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_blog_theme.js

    r2290 r2487  
    1616     }); 
    1717 
    18      // confirm module deletion 
    19      $('div.module-actions form input[type=submit][name=delete]').click(function() { 
    20           var module_id = $('input[name=module]',$(this).parent()).val(); 
    21           return window.confirm(dotclear.msg.confirm_delete_theme.replace('%s',module_id)); 
    22      }); 
    23  
    2418     // dirty short search blocker 
    2519     $('div.modules-search form input[type=submit]').click(function(){ 
     
    2721          if (mlen.length > 2){return true;}else{return false;} 
    2822     }); 
     23 
     24     // checkboxes selection 
     25     $('.checkboxes-helpers').each(function() { 
     26          dotclear.checkboxesHelpers(this); 
     27     }); 
     28 
     29     // actions tests 
     30     $('.modules-form-actions').each(function(){ 
     31          var rxActionType = /^[^\[]+/; 
     32          var rxActionValue = /([^\[]+)\]$/; 
     33          var checkboxes = $(this).find('input[type=checkbox]'); 
     34 
     35          // check if submit is a global action or one line action 
     36          $("input[type=submit]",this).click(function() { 
     37               var keyword = $(this).attr('name'); 
     38               var maction = keyword.match(rxActionType); 
     39               var action = maction[0]; 
     40               var mvalues = keyword.match(rxActionValue); 
     41 
     42               // action on multiple modules 
     43               if (!mvalues) { 
     44                    var checked = false; 
     45 
     46                    // check if there is checkboxes in form 
     47                    if(checkboxes.length > 0) { 
     48                         // check if there is at least one checkbox checked 
     49                         $(checkboxes).each(function() { 
     50                              if (this.checked) { 
     51                                   checked = true; 
     52                              } 
     53                         }); 
     54                         if (!checked) { 
     55                              //alert(dotclear.msg.no_selection); 
     56                              return false; 
     57                         } 
     58                    } 
     59 
     60                    // confirm delete 
     61                    if (action == 'delete') { 
     62                         return window.confirm(dotclear.msg.confirm_delete_themes); 
     63                    } 
     64 
     65               // action on one module 
     66               }else { 
     67                    var module = mvalues[1]; 
     68 
     69                    // confirm delete 
     70                    if (action == 'delete') { 
     71                         return window.confirm(dotclear.msg.confirm_delete_theme.replace('%s',module)); 
     72                    } 
     73               } 
     74 
     75               return true; 
     76          }); 
     77     }); 
    2978}); 
  • admin/js/_plugins.js

    r2354 r2487  
    1111     }); 
    1212 
    13      // confirm module deletion 
    14      $('td.module-actions form input[type=submit][name=delete]').click(function() { 
    15           var module_id = $('input[name=module]',$(this).parent()).val(); 
    16           return window.confirm(dotclear.msg.confirm_delete_plugin.replace('%s',module_id)); 
     13     // checkboxes selection 
     14     $('.checkboxes-helpers').each(function() { 
     15          dotclear.checkboxesHelpers(this); 
     16     }); 
     17 
     18     // actions tests 
     19     $('.modules-form-actions').each(function(){ 
     20          var rxActionType = /^[^\[]+/; 
     21          var rxActionValue = /([^\[]+)\]$/; 
     22          var checkboxes = $(this).find('input[type=checkbox]'); 
     23 
     24          // check if submit is a global action or one line action 
     25          $("input[type=submit]",this).click(function() { 
     26               var keyword = $(this).attr('name'); 
     27               var maction = keyword.match(rxActionType); 
     28               var action = maction[0]; 
     29               var mvalues = keyword.match(rxActionValue); 
     30 
     31               // action on multiple modules 
     32               if (!mvalues) { 
     33                    var checked = false; 
     34 
     35                    // check if there is checkboxes in form 
     36                    if(checkboxes.length > 0) { 
     37                         // check if there is at least one checkbox checked 
     38                         $(checkboxes).each(function() { 
     39                              if (this.checked) { 
     40                                   checked = true; 
     41                              } 
     42                         }); 
     43                         if (!checked) { 
     44                              //alert(dotclear.msg.no_selection); 
     45                              return false; 
     46                         } 
     47                    } 
     48 
     49                    // confirm delete 
     50                    if (action == 'delete') { 
     51                         return window.confirm(dotclear.msg.confirm_delete_plugins); 
     52                    } 
     53 
     54               // action on one module 
     55               }else { 
     56                    var module = mvalues[1]; 
     57 
     58                    // confirm delete 
     59                    if (action == 'delete') { 
     60                         return window.confirm(dotclear.msg.confirm_delete_plugin.replace('%s',module)); 
     61                    } 
     62               } 
     63 
     64               return true; 
     65          }); 
    1766     }); 
    1867}); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map