Dotclear

Changeset 3901:ae61a16b9434


Ignore:
Timestamp:
10/22/18 13:52:49 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Disable module ordering on dashboard if user preference (no drag'n'drop) si set to true

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_index.js

    r3880 r3901  
    206206  } 
    207207 
    208   // Dashboard boxes and their children are sortable 
    209   const set_positions = function(sel, id) { 
    210     const list = $(sel).sortable("toArray").join(); 
    211     // Save positions (via services) for id 
    212     const params = { 
    213       f: 'setDashboardPositions', 
    214       xd_check: dotclear.nonce, 
    215       id: id, 
    216       list: list 
     208  if (!dotclear.noDragDrop) { 
     209    // Dashboard boxes and their children are sortable 
     210    const set_positions = function(sel, id) { 
     211      const list = $(sel).sortable("toArray").join(); 
     212      // Save positions (via services) for id 
     213      const params = { 
     214        f: 'setDashboardPositions', 
     215        xd_check: dotclear.nonce, 
     216        id: id, 
     217        list: list 
     218      }; 
     219      $.post('services.php', params, function() {}); 
    217220    }; 
    218     $.post('services.php', params, function() {}); 
    219   }; 
    220   const init_positions = function(sel, id) { 
    221     $(sel).sortable({ 
    222       cursor: 'move', 
    223       opacity: 0.5, 
    224       tolerance: "pointer", 
    225       update: function() { 
    226         set_positions(sel, id); 
    227       }, 
    228       start: function() { 
    229         $(sel).addClass('sortable-area'); 
    230       }, 
    231       stop: function() { 
    232         $(sel).removeClass('sortable-area'); 
    233       } 
    234     }); 
    235   }; 
    236   // Wait 5 seconds before activating ordering capabilities on dashboard 
    237   setTimeout(function() { 
    238     init_positions('#dashboard-main', 'main_order'); 
    239     init_positions('#dashboard-boxes', 'boxes_order'); 
    240     init_positions('#db-items', 'boxes_items_order'); 
    241     init_positions('#db-contents', 'boxes_contents_order'); 
    242   }, 5000); 
    243  
     221    const init_positions = function(sel, id) { 
     222      $(sel).sortable({ 
     223        cursor: 'move', 
     224        opacity: 0.5, 
     225        tolerance: "pointer", 
     226        update: function() { 
     227          set_positions(sel, id); 
     228        }, 
     229        start: function() { 
     230          $(sel).addClass('sortable-area'); 
     231        }, 
     232        stop: function() { 
     233          $(sel).removeClass('sortable-area'); 
     234        } 
     235      }); 
     236    }; 
     237    // Wait 5 seconds before activating ordering capabilities on dashboard 
     238    setTimeout(function() { 
     239      init_positions('#dashboard-main', 'main_order'); 
     240      init_positions('#dashboard-boxes', 'boxes_order'); 
     241      init_positions('#db-items', 'boxes_items_order'); 
     242      init_positions('#db-contents', 'boxes_contents_order'); 
     243    }, 5000); 
     244  } 
    244245}); 
  • inc/admin/lib.dc.page.php

    r3878 r3901  
    177177            echo self::cssLoad('style/default-rtl.css'); 
    178178        } 
     179 
     180        $core->auth->user_prefs->addWorkspace('accessibility'); 
     181        echo 
     182            '<script type="text/javascript">' . "\n" . 
     183            'dotclear.noDragDrop = '.($core->auth->user_prefs->accessibility->nodragdrop ? 'true' : 'false').';' . "\n" . 
     184            "</script>\n"; 
    179185 
    180186        $core->auth->user_prefs->addWorkspace('interface'); 
     
    458464            echo self::cssLoad('style/default-rtl.css'); 
    459465        } 
     466 
     467        $core->auth->user_prefs->addWorkspace('accessibility'); 
     468        echo 
     469            '<script type="text/javascript">' . "\n" . 
     470            'dotclear.noDragDrop = '.($core->auth->user_prefs->accessibility->nodragdrop ? 'true' : 'false').';' . "\n" . 
     471            "</script>\n"; 
    460472 
    461473        $core->auth->user_prefs->addWorkspace('interface'); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map