Changeset 540:5a4bc7d9ddac for plugins/simpleMenu
- Timestamp:
- 07/09/11 20:55:09 (14 years ago)
- Branch:
- themes
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/simpleMenu/index.php
r539 r540 300 300 $order = array_keys($order); 301 301 } elseif (!empty($_POST['im_order'])) { 302 $order = explode(',',$_POST['im_order']); 302 $order = $_POST['im_order']; 303 if (substr($order,-1) == ',') { 304 $order = substr($order,0,strlen($order)-1); 305 } 306 $order = explode(',',$order); 303 307 } 304 308 … … 335 339 <?php 336 340 echo 337 dcPage::jsToolMan(); //. 338 // dcPage::jsLoad('index.php?pf=simpleMenu/dragdrop.js'); 341 dcPage::jsToolMan(); 339 342 ?> 343 <?php 344 $core->auth->user_prefs->addWorkspace('accessibility'); 345 $user_dm_nodragdrop = $core->auth->user_prefs->accessibility->nodragdrop; 346 ?> 347 <?php if (!$user_dm_nodragdrop) : ?> 348 <script type="text/javascript"> 349 //<![CDATA[ 350 351 var dragsort = ToolMan.dragsort(); 352 $(function() { 353 dragsort.makeTableSortable($("#menuitemslist").get(0), 354 dotclear.sortable.setHandle,dotclear.sortable.saveOrder); 355 356 $('.checkboxes-helpers').each(function() { 357 dotclear.checkboxesHelpers(this); 358 }); 359 }); 360 361 dotclear.sortable = { 362 setHandle: function(item) { 363 var handle = $(item).find('td.handle').get(0); 364 while (handle.firstChild) { 365 handle.removeChild(handle.firstChild); 366 } 367 368 item.toolManDragGroup.setHandle(handle); 369 handle.className = handle.className+' handler'; 370 }, 371 372 saveOrder: function(item) { 373 var group = item.toolManDragGroup; 374 var order = document.getElementById('im_order'); 375 group.register('dragend', function() { 376 order.value = ''; 377 items = item.parentNode.getElementsByTagName('tr'); 378 379 for (var i=0; i<items.length; i++) { 380 order.value += items[i].id.substr(2)+','; 381 } 382 }); 383 } 384 }; 385 //]]> 386 </script> 387 <?php endif; ?> 340 388 <!-- 341 389 <link rel="stylesheet" type="text/css" href="index.php?pf=simpleMenu/style.css" /> … … 437 485 // Entête table 438 486 echo 439 '<table id="menuitemslist">'.487 '<table class="maximal dragable">'. 440 488 '<caption>'.__('Menu items list').'</caption>'. 441 489 '<thead>'. 442 490 '<tr>'; 443 491 if (!$step) { 492 if (count($menu) > 1) { 493 echo '<th scope="col"></th>'; 494 } 444 495 echo '<th scope="col"></th>'; 445 if (count($menu) > 1) {446 echo '<th scope="col">'.__('Order').'</th>';447 }448 496 } 449 497 echo … … 453 501 '</tr>'. 454 502 '</thead>'. 455 '<tbody >';503 '<tbody id="menuitemslist">'; 456 504 $count = 0; 457 505 foreach ($menu as $i => $m) { 458 echo '<tr >';506 echo '<tr class="line" id="l_'.$i.'">'; 459 507 if (!$step) { 460 508 $count++; 461 echo '<td>'.form::checkbox(array('items_selected[]','ims-'.$i),$i).'</td>';462 509 if (count($menu) > 1) { 463 echo '<td >'.form::field(array('order['.$i.']'),2,3,$count,'position','',false,'title="'.sprintf(__('position of %s'),__($m['label'])).'"').510 echo '<td class="handle minimal">'.form::field(array('order['.$i.']'),2,3,$count,'position','',false,'title="'.sprintf(__('position of %s'),__($m['label'])).'"'). 464 511 form::hidden(array('dynorder[]','dynorder-'.$i),$i).'</td>'; 465 512 } 513 echo '<td class="minimal">'.form::checkbox(array('items_selected[]','ims-'.$i),$i).'</td>'; 466 514 echo '<td class="nowrap" scope="row">'.form::field(array('items_label[]','iml-'.$i),20,255,__($m['label'])).'</td>'; 467 515 echo '<td class="nowrap">'.form::field(array('items_descr[]','imd-'.$i),30,255,__($m['descr'])).'</td>'; … … 477 525 '</table>'; 478 526 if (!$step) { 479 echo '<p>'.form::hidden('im_order','').$core->formNonce(); 527 echo '<div class="two-cols">'; 528 echo '<p class="col">'.form::hidden('im_order','').$core->formNonce(); 480 529 if (count($menu) > 1) { 481 530 echo '<input type="submit" name="saveorder" value="'.__('Save order').'" /> '; 482 531 } 483 echo 484 '<input type="submit" name="updateaction" value="'.__('Update menu items').'" /> '. 485 '<input type="submit" class="delete" name="removeaction" '. 532 echo '<input type="submit" name="updateaction" value="'.__('Update menu items').'" />'.'</p>'; 533 echo '<p class="col right">'.'<input type="submit" class="delete" name="removeaction" '. 486 534 'value="'.__('Delete selected menu items').'" '. 487 535 'onclick="return window.confirm(\''.html::escapeJS(__('Are you sure you want to remove selected menu items?')).'\');" />'. 488 536 '</p>'; 537 echo '</div>'; 489 538 echo '</form>'; 490 539 }
Note: See TracChangeset
for help on using the changeset viewer.