Dotclear


Ignore:
Timestamp:
03/26/13 14:50:45 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Blogroll plugin now uses jQuery UI sortable for links ordering via drag'n'drop

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/blogroll/index.php

    r987 r1131  
    164164<head> 
    165165  <title><?php echo __('Blogroll'); ?></title> 
    166   <?php echo dcPage::jsToolMan(); ?> 
    167166  <?php echo dcPage::jsConfirmClose('links-form','add-link-form','add-category-form'); ?> 
    168167  <?php  
    169      $core->auth->user_prefs->addWorkspace('accessibility');  
    170      $user_dm_nodragdrop = $core->auth->user_prefs->accessibility->nodragdrop; 
     168     $core->auth->user_prefs->addWorkspace('accessibility'); 
     169     if (!$core->auth->user_prefs->accessibility->nodragdrop) { 
     170     echo 
     171          dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). 
     172          dcPage::jsLoad('index.php?pf=blogroll/blogroll.js'); 
     173     } 
    171174  ?> 
    172   <?php if (!$user_dm_nodragdrop) : ?> 
    173   <script type="text/javascript"> 
    174   //<![CDATA[ 
    175    
    176   var dragsort = ToolMan.dragsort(); 
    177   $(function() { 
    178      dragsort.makeTableSortable($("#links-list").get(0), 
    179      dotclear.sortable.setHandle,dotclear.sortable.saveOrder); 
    180       
    181      $('.checkboxes-helpers').each(function() { 
    182           dotclear.checkboxesHelpers(this); 
    183      }); 
    184   }); 
    185    
    186   dotclear.sortable = { 
    187        setHandle: function(item) { 
    188           var handle = $(item).find('td.handle').get(0); 
    189           while (handle.firstChild) { 
    190                handle.removeChild(handle.firstChild); 
    191           } 
    192            
    193           item.toolManDragGroup.setHandle(handle); 
    194           handle.className = handle.className+' handler'; 
    195        }, 
    196         
    197        saveOrder: function(item) { 
    198           var group = item.toolManDragGroup; 
    199           var order = document.getElementById('links_order'); 
    200           group.register('dragend', function() { 
    201                order.value = ''; 
    202                items = item.parentNode.getElementsByTagName('tr'); 
    203                 
    204                for (var i=0; i<items.length; i++) { 
    205                     order.value += items[i].id.substr(2)+','; 
    206                } 
    207           }); 
    208        } 
    209   }; 
    210   //]]> 
    211   </script> 
    212   <?php endif; ?> 
    213175  <?php echo dcPage::jsPageTabs($default_tab); ?> 
    214176</head> 
     
    258220     echo 
    259221     '<tr class="line" id="l_'.$rs->link_id.'">'. 
    260      '<td class="handle minimal">'.form::field(array('order['.$rs->link_id.']'),2,5,$position,'','',false,'title="'.__('position').'"').'</td>'. 
     222     '<td class="handle minimal">'.form::field(array('order['.$rs->link_id.']'),2,5,$position,'position','',false,'title="'.__('position').'"').'</td>'. 
    261223     '<td class="minimal">'.form::checkbox(array('remove[]'),$rs->link_id,'','','',false,'title="'.__('select this link').'"').'</td>'; 
    262224      
Note: See TracChangeset for help on using the changeset viewer.

Sites map